So, you want to calculate orbits?

george7378

DON'T PANIC
Addon Developer
Donator
Joined
Jun 26, 2009
Messages
1,045
Reaction score
0
Points
36
Well, do you? If so, I hope this can show you how to calculate and therefore simulate an orbit yourself! By this I mean you will be able to calculate a satellite's altitude and velocity at a chosen time, among other things, like OrbitMFD shows. Let's assume we're orbiting Earth, and that there are no other forces acting on the satellite other than the Earth's gravity. So, what do we do with this assumption?

1. Decide on an apogee and perigee.

Let's have a nice sensible 400 x 1400 km orbit.

2. Calculate some constants for the orbit.

These constants are a)Apogee and perigee radii b) Semi-major axis, c) Eccentricity, d) Mean motion and e) Orbital period.

a) Apogee and perigee radii are simply the apogee and perigee + the radius of Earth:

[math]R_a = apogee+6378[/math] = 7778km
[math]R_p = perigee+6378[/math] = 6778km

b) Semi-major axis is the distance from the centre of your orbit to one of the extreme ends:

[math]SMa = \frac{R_a + R_p} {2}[/math] = 7278km

c) Eccentricity is how close (or far away, depending on how you look at it) your orbit is to being a circle:

[math]e = \frac{R_a - R_p}{R_a + R_p}[/math] = 0.069

d) Mean motion is a measure of how quickly a satellite moves in its orbit (The constant GM is the gravitational constant multiplied by Earth's mass, and equals 398600.4):

[math]M_m = \sqrt{\frac{GM}{SMa^3}}[/math] = 1.02 x 10^-3

e) Orbital period is how long it takes to complete one orbit:

[math]T = 2\pi\sqrt{\frac{SMa^3}{GM}}[/math] = 6179 seconds

3. Decide on a time for which you want to calculate the altitude and velocity.

By 'a time', I mean 'how far into the orbit do you want to be?' - eg: if t=0, you are at perigee. If t=T/2, you are halfway round the orbit and at apogee. If you choose anything in between, you will calculate for that position. So this basically means 'how many seconds past the perigee do you want to be?' - you can't have a negative number, or a number larger than the orbital period.

We will calculate for the apogee. Therefore:

t = T/2 = 3089.5 seconds.

4. Calculate some anomalies (angles).

These are simply angles between different points in the orbit. They are a) Mean anomaly, b) Eccentric anomaly and c) True anomaly. To understand them, it's best to see a diagram like this one:

figure1.jpg


These angles are in radians!

a) Mean anomaly:

[math]M = M_m \times t[/math] = 3.15

b) To find the Eccentric anomaly, you have to iterate. The formula you need to iterate is:

[math]E = E_0 - \frac{E_0-esin(E_0)-M}{1-ecos(E_0)}[/math]

To start, make [math]E_0 = M[/math]

If you're not faimilar with iteration, it means that you have to take an initial value (in this case, M, your Mean anomaly) and substitute it into the given equation. Then, you replace your initial value with your result of your first calculation, and do the same thing again and again until the result you get doesn't change. In this case, because you are at apogee, E = M, so you get:

E = 3.15

c) True anomaly:

[math]v = cos^{-1}(\frac{cos(E)-e}{1-ecos(E)})[/math] = 3.15

As you can see, all three anomalies are equal at this point, meaning that our method is working (since we are calculating for the apogee where they all ~ 3.15 radians. The actual value is 3.141 radians, but the reason we are slightly out is because of rounding in our previous answers. No biggie at all).

5. Calculate the final result!

To arrive at the final result of altitude and velocity, you need one more interim value. The flightpath:

[math]F_p = tan^{-1}(\frac{esin(v)}{1+ecos(v)})[/math] = -6.2 x 10^-4

A little note: This number should be zero at apogee, but again, it's because of rounding. This is not a big deal, and will still give us a perfectly accurate answer.

Finally, we can now calculate our results!

[math]alt = (SMa \times 1-ecos(E))-6378[/math] = 1402km.

[math]vel = \sqrt{ GM( \frac{2}{alt+6378}-\frac{1}{SMa})}[/math] = 6.91km/s

As you can see, there are minor errors of ~ 2km in altitude, and hence a tiny error in velocity, but this is all because of rounding in the constants and prior results. If you use a program to solve these equations, you will get far more accurate values.

It is of course inconvenient to solve these equations manually, but if used as part of a program which continues to solve as time increases, a very accurate orbit simulation can be made!

I have created a program which runs on these equations alone, and which simulates an Earth-orbiting satellite in the way we just have. It's called Orbit-Vis, and is available here:

http://sourceforge.net/projects/orbitvis/

Thanks for reading!
 

bdalton

New member
Joined
Sep 24, 2020
Messages
2
Reaction score
1
Points
1
Location
Utah
It would be nice to clean this up for view in a browser, as well as make clear for people who may not know what they're doing.
The [math] formatting shows up as obnoxious text, if this is made for viewing in a particular browser or with a particular plugin it would be nice to say so or include versions with simple formats such as (number)/(number) instead of making people have to assume what /frac means.
also it's unclear if ecos and esin are intended to mean something like e * cos()
How am I supposed to interpret (SMa \times 1-ecos(E)) ??
SMa * (1-e*cos(E))?[/math]
 
Last edited:

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
669
Reaction score
195
Points
58
Location
This place called "home".
It would be nice to clean this up for view in a browser, as well as make clear for people who may not know what they're doing.

The [math] tags were used when Orbiter-Forum used a different forum hosting site, and allowed to use \( \LaTeX \) formatting (see here).
Typeset like this [math] 2 + 2 = 4 = \sqrt{16} [/math] .
Now, the same functionality is available using \( 2 + 2 = 4 = \sqrt{16} \) ( \( 2 + 2 = 4 = \sqrt{16} \) ), or \[ 2 + 2 = 4 = \sqrt{16} \] , which creates a new line and bigger text: \[ 2 + 2 = 4 = \sqrt{16} \]
 

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
669
Reaction score
195
Points
58
Location
This place called "home".
For your convenience, I've here swapped all [math]-[/math] with \(-\).
And yes: ecos is no function, so it is \( e\cdot \cos () \), which is eccentricity times the cosine function.
Well, do you? If so, I hope this can show you how to calculate and therefore simulate an orbit yourself! By this I mean you will be able to calculate a satellite's altitude and velocity at a chosen time, among other things, like OrbitMFD shows. Let's assume we're orbiting Earth, and that there are no other forces acting on the satellite other than the Earth's gravity. So, what do we do with this assumption?

1. Decide on an apogee and perigee.

Let's have a nice sensible 400 x 1400 km orbit.

2. Calculate some constants for the orbit.

These constants are a)Apogee and perigee radii b) Semi-major axis, c) Eccentricity, d) Mean motion and e) Orbital period.

a) Apogee and perigee radii are simply the apogee and perigee + the radius of Earth:

\(R_a = apogee+6378\) = 7778km
\(R_p = perigee+6378\) = 6778km

b) Semi-major axis is the distance from the centre of your orbit to one of the extreme ends:

\(SMa = \frac{R_a + R_p} {2}\) = 7278km

c) Eccentricity is how close (or far away, depending on how you look at it) your orbit is to being a circle:

\(e = \frac{R_a - R_p}{R_a + R_p}\) = 0.069

d) Mean motion is a measure of how quickly a satellite moves in its orbit (The constant GM is the gravitational constant multiplied by Earth's mass, and equals 398600.4):

\(M_m = \sqrt{\frac{GM}{SMa^3}}\) = 1.02 x 10^-3

e) Orbital period is how long it takes to complete one orbit:

\(T = 2\pi\sqrt{\frac{SMa^3}{GM}}\) = 6179 seconds

3. Decide on a time for which you want to calculate the altitude and velocity.

By 'a time', I mean 'how far into the orbit do you want to be?' - eg: if t=0, you are at perigee. If t=T/2, you are halfway round the orbit and at apogee. If you choose anything in between, you will calculate for that position. So this basically means 'how many seconds past the perigee do you want to be?' - you can't have a negative number, or a number larger than the orbital period.

We will calculate for the apogee. Therefore:

t = T/2 = 3089.5 seconds.

4. Calculate some anomalies (angles).

These are simply angles between different points in the orbit. They are a) Mean anomaly, b) Eccentric anomaly and c) True anomaly. To understand them, it's best to see a diagram like this one:

figure1.jpg


These angles are in radians!

a) Mean anomaly:

\(M = M_m \times t\) = 3.15

b) To find the Eccentric anomaly, you have to iterate. The formula you need to iterate is:

\(E = E_0 - \frac{E_0-esin(E_0)-M}{1-ecos(E_0)}\)

To start, make \(E_0 = M\)

If you're not faimilar with iteration, it means that you have to take an initial value (in this case, M, your Mean anomaly) and substitute it into the given equation. Then, you replace your initial value with your result of your first calculation, and do the same thing again and again until the result you get doesn't change. In this case, because you are at apogee, E = M, so you get:

E = 3.15

c) True anomaly:

\(v = cos^{-1}(\frac{cos(E)-e}{1-ecos(E)})\) = 3.15

As you can see, all three anomalies are equal at this point, meaning that our method is working (since we are calculating for the apogee where they all ~ 3.15 radians. The actual value is 3.141 radians, but the reason we are slightly out is because of rounding in our previous answers. No biggie at all).

5. Calculate the final result!

To arrive at the final result of altitude and velocity, you need one more interim value. The flightpath:

\(F_p = tan^{-1}(\frac{esin(v)}{1+ecos(v)})\) = -6.2 x 10^-4

A little note: This number should be zero at apogee, but again, it's because of rounding. This is not a big deal, and will still give us a perfectly accurate answer.

Finally, we can now calculate our results!

\(alt = (SMa \times 1-ecos(E))-6378\) = 1402km.

\(vel = \sqrt{ GM( \frac{2}{alt+6378}-\frac{1}{SMa})}\) = 6.91km/s

As you can see, there are minor errors of ~ 2km in altitude, and hence a tiny error in velocity, but this is all because of rounding in the constants and prior results. If you use a program to solve these equations, you will get far more accurate values.

It is of course inconvenient to solve these equations manually, but if used as part of a program which continues to solve as time increases, a very accurate orbit simulation can be made!

I have created a program which runs on these equations alone, and which simulates an Earth-orbiting satellite in the way we just have. It's called Orbit-Vis, and is available here:

http://sourceforge.net/projects/orbitvis/

Thanks for reading!
 

bdalton

New member
Joined
Sep 24, 2020
Messages
2
Reaction score
1
Points
1
Location
Utah
For your convenience, I've here swapped all [math]-[/math] with \(-\).
And yes: ecos is no function, so it is \( e\cdot \cos () \), which is eccentricity times the cosine function.
Thank you very much for taking the time to straighten this all out! (Sorry for the belated reply)
 
Top