Hello again!
I want to predict what my longitude is at the spacecraft's apoapsis, assuming that I'm burning the engines right now.
I thought that I could just look at the longitude of periapsis which I can find with the GetElements method, add 180 degrees to get the apoapsis and then subtract the amount of degrees the Earth will rotate beneath until apoapsis. I discovered that longitude of periapsis is given in radians after the ascending node, so I used this code to predict longitude of apoapsis:
where the variables are defined as:
Now, this doesn't work correctly. The longitude of periapsis is given in a fixed reference frame, not taking into account that the Earth is rotating, so this will not give the right answer over time.
My guess is that I have to find out the orientation of the Earth and add that to the equation, but I don't know how to find that.
Is it right? If so: how do I find the planet's orientation? If not: how can I find the longitude of apoapsis?
Thanks in advance!
I want to predict what my longitude is at the spacecraft's apoapsis, assuming that I'm burning the engines right now.
I thought that I could just look at the longitude of periapsis which I can find with the GetElements method, add 180 degrees to get the apoapsis and then subtract the amount of degrees the Earth will rotate beneath until apoapsis. I discovered that longitude of periapsis is given in radians after the ascending node, so I used this code to predict longitude of apoapsis:
Code:
double LongApo = LAN + LongPer + PI - (PI2/oapiGetPlanetPeriod(RefPlanet))*HypApTime;
Code:
ELEMENTS el;
ORBITPARAM prm;
Vessel->GetElements (RefPlanet, el, &prm, oapiGetSimMJD(), FRAME_EQU);
double LAN = el.theta;
double LongPer = el.omegab;
double HypSMa = (TargetRadius + prm.PeR)/2
double HypApTime = PI*sqrt(pow(HypSMa,3)/(GGRAV*oapiGetMass(RefPlanet)));
Now, this doesn't work correctly. The longitude of periapsis is given in a fixed reference frame, not taking into account that the Earth is rotating, so this will not give the right answer over time.
My guess is that I have to find out the orientation of the Earth and add that to the equation, but I don't know how to find that.
Is it right? If so: how do I find the planet's orientation? If not: how can I find the longitude of apoapsis?
Thanks in advance!