When I was looking into a few things like angles of the sun and the moon (and uranus) from the earth, I really got annoyed going to suncalc tools to get a particular angle on this and that date and place. So I thought: Why not build my own sunapp?

And so I started..

And here it is: Solar System Animation App

First of all, it is actually not very complicated. The basic rules for the path of the planets around the sun are based on six parameters for each body:

The primary orbital elements are:

N (Ω)= longitude of the ascending node

i = inclination to the ecliptic (plane of the Earth's orbit)

w (ω) = argument of perihelion or argument of periapsis (which is the same for the sun),

a = semi-major axis, or mean distance from Sun (the sum of the distance at periapsis and apoapsis divided by 2.

e = eccentricity (0=circle, 0-1=ellipse, 1=parabola)

M = mean anomaly (0 at perihelion; increases uniformly with time)

Related orbital elements are:

w1 = N + w = longitude of perihelion

L = M + w1 = mean longitude

q = a*(1-e) = perihelion distance

Q = a*(1+e) = aphelion distance

P = a ^ 1.5 = orbital period (years if a is in AU, astronomical units)

T = Epoch_of_M - (M(deg)/360_deg) / P = time of perihelion

v = true anomaly (angle between position and perihelion)

E = eccentric anomaly

That is a lot of difficult terminology, which are explained on https://en.wikipedia.org/wiki/Orbital_elements and I will try to explain them in laymen terms:

The reference plane is the ecliptic, this is the plane of earth's orbit around the sun. In the picture this is the dark grey plane.

The inclination is the angle to this reference plane, and thus the angle the orbit has to the ecliptic.

The sun is off course in the ecliptic, so the inclination is 0. The moon is slightly (5.14^{o}) tilted in the ecliptic, so the inclination (i) is 5.14^{o}.

The orbital elements are specified for a specific date and time, i.e. January 1^{st} 2000 at midnight and then calculated for a specific date.

i = 0.0

N = 0.0

a = 1.00000011 (AU)

e = 0.016709

w = 282.9404

M = 356.0470

**i** is zero, as the sun and the earth are (per definition) in the same reference plane:The ecliptic.

**N**: The longitude of the ascending node (the angle of the direction of the sun and the intersection of the plane of reference and the orbit of the earth is undefined, as the intersection is on the whole plane. We therefore can assign the value of 0 to N.

**a** is 1,00000011 (and thus nearly 1 Astronomical Unit

**e** is an indication of the shape of the orbit. for e=0 it is a perfect circle, between 0 and 1 the shape is an ellipse, and for e>1 the orbit becomes a parabola. At 1-1-2000 the shape of the orbit gets a 0.016709, so

it is close to a circle. This shape changes over (a very long) time.

So we are left with only 2 interesting values w, and M.

**w** is the argument of perihelion. The perihelion is the position of the earth in it's orbit when it is closest to the sun. In 2019 this happened on January 3 at 05:20 UTC, when the sun was at 147.099.761 km distance). The argument of the perihelion is the angle between the sun, at 1-1-2000, to the perihelion.

**M** is the mean anomaly. This is the projection of the angles on a true circle from the ellipsis. This is necessary, because the speed of the earth around the sun changes during the year., It is fastest when the sun is furthest away, and slowest at perihelion. Projected on a circle, the speed never changes, and therefore it is easier to calculate with. The mean anomaly is 356.0470^{o}.

So these are the orbital elements explained, for 1-1-2000. Now we have to calculate them for a specific date.

For that we are going to use these formulas, where d is the number of days since/before 1-1-2000.Now d is something special. We cannot just take the days since 1-1-2000, because a solar year is longer than our year of 365 days, hence we have leap years, etc. That is why we use Julian Day Numbers.

The formula I used to convert to Julian days =

$$d = 367*Y - \frac{7*(Y + ((M+9)/12))}{4} + \frac{275*M}{9} + D - 730530$$

i = 0.0

N = 0.0

w = 282.9404 + 4.70935E-5 * d

a = 1.000000 (AU)

e = 0.016709 - 1.151E-9 * d

M = 356.0470 + 0.9856002585 * d.

There are 3 parameters that are depended on d. The argument of the perihelion, the shape of the orbit, and the mean anomaly. The factors are all describing the shape of the orbit, and the speed of the earth along this orbit.

M is easy, as this show a single degree per Julian Day.

The eccentricity changes over time, this is a very small number, so the changes are small, but they are there. They are caused by the gravitational influence of Jupiter and Saturn.

The argument of the perihelion is changing too over time, at a factor of 0,00005^{o} per day. (-0.1668523^{o} in 10 years). This is called the Apsidal Precession. The orbit of the earth itself tilts

## Calculation the path of the sun, the final calculations.

So now we can calculate the true distance and angle on a specific day:

We can calculate the eccentric anomaly (or true anomaly) from Kepler's equation

E = eccentric anomaly = M + e sin(E) = M + (180/pi) * e * sin(M) * (1 + e * cos(M))

x = cos(E) - e

y = sin(E) * sqrt(1 - e*e)

r = sqrt(x^{2} + y^{2})

v = arctan2( y, x )

What we just did was calculating the expected position of the earth in the orbit around the sun. When we want to calculate the angle we see the sun at, from the surface of the earth, we have to deal with one extra item: The tilt of the earth itself. Moving through the ecliptic plane we are tilted at a 23.4^{o} angle: The obliquity, and the main reason we have seasons. With the formula oblecl = 23.4393 - 3.563E-7 * d we can calculate this for a specific day.

Plugging in other simple trigonometric calculations we then can calculate the RA (Right Ascension) and Declination... and I did just that:

Date | Time | Time Zone vs UTC | Longitude | Latitude | |
---|---|---|---|---|---|

Local | |||||

UTC | 1990-04-19 | 0:00:00 | 15° 0' 0" | 60° 0' 0" |

Test | Calculated Value | Data from Stellarium | |

test_calcDay - UTC array | 1990-04-19 00:00:00 | 1990-04-19 00:00:00 | areEqual |

test_calcDay - UTC Decimal | -3543 | -3543 | areEqual |

getOrbitalData Sun test w | 282.7735477295 | 282.7735 | values are Near |

getOrbitalData Sun test a | 1.00000011 | 1 | values are Near |

getOrbitalData Sun test e | 0.016713077993 | 0.016713 | values are Near |

getOrbitalData Sun test M | 104.06528413449996 | 104.0653 | values are Near |

getOrbitalData Sun test L | 26.838831863999985 | 26.8388 | values are Near |

getOrbitalData Sun test oblecl | 23.4405623709 | 23.4406 | values are Near |

sideRealTime GMST0 | 13.7892554576 | 13.78925 | values are Near |

sideRealTime LST | 14.7892554576 | 14.78925 | values are Near |

Eccentric Anomaly | 104.9903910585529 | 104.990391058 | values are Near |

rectang x | -0.2753701262907824 | -0.275370 | values are Near |

rectang y | 0.9658342985903203 | 0.965834 | values are Near |

rectang r | 1.00432295542164 | 1.004323 | values are Near |

rectang v | 105.91344169702866 | 105.9134 | values are Near |

longitude SUN | 28.68698942652867 | 28.6869 | values are Near |

SUN r | 1.00432295542164 | 1.004323 | values are Near |

SUN RA | 26.658077679334248 | 26.6580 | values are Near |

SUN Decl | 11.00837473502555 | 11.0084 | values are Near |

AltAzi HA | 13.012050278977716 | 13.01205 | values are Near |

AltAzi x | -0.9473458951927932 | -0.947346 | values are Near |

AltAzi y | -0.25704650810097696 | -0.257047 | values are Near |

AltAzi z | 0.19095247454395453 | 0.190953 | values are Near |

AltAzi xhor | -0.9159018486798465 | -0.915902 | values are Near |

AltAzi yhor | -0.25704650810097696 | -0.257047 | values are Near |

AltAzi zhor | -0.3083032537258308 | -0.308303 | values are Near |

Sun Azimuth | 15.676697321318073 | 15.67669 | values are Near |

Sun Altitude | -17.957006397288996 | -17.957006 | values are Near |

Sun Azimuth From North | 344.3233026786819 | 344.3233026 | values are Near |

This is pretty cool, is it not? And doing some more test the data is very exact. So we show here that with some relative simple formulae we get an accurate calculation of what we see when we look outside..

Below are some examples of what we get when we plug these data into another tool I made:

# Explaining the angles when calculation the position of the sun

Have you ever tried to understand all the terminology used when looking up things like Sidereal Time, and Right Ascension.

The webapplication I created, shows you exactly what is what. On this page a more verbal explanation is given, right along some things you can do in the app to make it more clear.

The webapplication can be found on https://solarsystem.bartje.org/solarsystem.php?apptype=gmst_explain

Wiki information can be found here : https://en.wikipedia.org/wiki/Equatorial_coordinate_system

## Ecliptic

## Equatorial Plane

## Meridian/Equator

## Sun Pointer

## Longitude Pointer

## Sun Trail

## Sun Distance Indicator

## Angle Calculations

The application shows how you can envision the different angles that are used to calculate the position of the sun, earth, planets, and all other celestial objects.

The explanation here uses the sun as it's primary example. This is done intentionally as I found it hard to get used to the terminology when going through all the explanations on the internet. However where I use the sun in these descriptions, the method is valid for most other objects in the sky.

## Animate Calculation

## Greenwich Mean Sidereal Time

The Greenwich Mean Sidereal Time is the angle between the Vernal Equinox and the Prime Meridian, on the celestial plane.

The word **mean** describes that

https://en.wikipedia.org/wiki/Sidereal_time

## LM Sidereal Time

The local mean sidereal time is the angle(or time) between the vernal equinox and the meridian of the observer, on the celestial plane.

## Right Ascension

The right ascension measures the angle along the **celestial** equator from the vernal equinox to where the sun is at that moment.

To show how it works, pick on of the prime times: Vernal Equinox (0^{o}), Summer Solstice(90^{o}), Autumnal Equinox(180^{o}) or Winter Solstice (270^{o}).

When you move the date the angle will decrease when going back and increase when going forward in time. Note how the earth rotates almost precisely with the Right Ascension angle when going up (or down) 1 day.

When inceasing the time, the angle will change too, of course, but it is smaller: The earth does not move that much around the sun in 1 hour.

However it will not change when moving you location from east to west (or north to south): The value is fixed on the position of the earth around the sun.

Set the sequence function 1 to day, and see how it changes during the year, make sure to set the display option for Right Ascension (white) on, and leave the others off to not get confused.

You could leave the Sun Pointer and the Point of Aries (red) on too, it will make even more sense.

https://en.wikipedia.org/wiki/Right_ascension

## Hour Angle

The Hour angle measures the angle along the **celestial** equator from the observer's meridian to the hour circle passing through the sun. In layman language: It is the angle (or time) since noon on the observers place.

In the application there are two options, one from P.o.A. (Point of Aries). This is not the real situation, but lets you see how the angle changes over time. One noticeable thing is, to view

https://en.wikipedia.org/wiki/Hour_angle

## Universal Time

The Universal Time is the hour angle between the suns position and the Prime Meridian, only the not at 0^{o}, but at the other side of the earth at a 180^{o}.

So essentially it is the time since midnight in Greenwich.

In the app this is visible by always showing the angle from from the Prime Meridian.

To show same examples:

Set lat/lon to Greenwich (use Earth Icon and select Greenwich) and click on the Sun Icon . Set display option to show Universal Time: The result is a semi circle. Now move the time to 0hrs. The earth will spin 180^{o} and the purple arc is gone.

## Longitude

The longitude option shows the longitude from Greenwich, on the **celestial** equator.

## Point Of Aries

The point of Aries is the place where the Equatorial Plane and the Celestial Plane intersect. Those are fancy words for the point where the sun is when spring begins (around march 22nd).