View Single Post
  #4  
Old February 16th 08, 06:35 PM posted to sci.astro,sci.astro.amateur,comp.home.automation
Androcles[_8_]
external usenet poster
 
Posts: 1,135
Default Simple Calculation of Sunset Time required


"tomcee" wrote in message
...
| Given a table of sunset times, such as:
|
| Day # Sunset (H:M):
| --------- ----------
| 1 17:10
| 2 17:11
| . . .
| 180 20:21
| ...
| 365 17:10
|
| and plotting this data (of course converting H:M to Decimal hours), we
| get a somewhat sinusoidal relationship between the Day and time of
| Sunset: Sunset = f(Day); or more specifically: Sunset = f(A*sin(k*D-
| P) This of course is not a pure sinusoid. Observation shows that it
| has a significant 2nd harmonic component.
|
| My application is that I have an automation controller that has a
| calendar, can do calculations (including trig), but is rather memory
| limited. Thus I would like to calculate time of sunset 'on the fly'
| rather than store the data table.
|
| I would like an equation that yields Sunset as a function of day
| number. I would like to keep it simpler than the generic formula
| given latitude and longitude. I would like the formula from the
| tabular data.
|
| It appears to have the form:
|
| Sunset = K + A1*sin(k*D-P1) + A2*sin(2*k*D-P2) + ???
| Whe
| D = Day number
| K, A1, A2, k, P1, P2 are constants determined by Long/Lat.
|
| Has anyone determined the basic functions contained within this
| 'Sunset function'? Given the basic functions, I can then calculate the
| constants.
| Thanks in advance for your help,
| TomCee

Ok, first understand the problem.
Imagine (because it isn't so, but it helps) that the Earth
has no tilt and moves in a perfect circle around the Sun
and the Sun itself is a point of light, not a ball 1/2 a degree
wide.
Sunrise and sunset will be at the same time every day,
6:00 am and 6:00 pm at the equator, earlier and later as
you move North or South. When you reach either Pole
it will not set at all, but goes around the horizon.
The function for this is the cosine of latitude, cos(90 degrees) = 0.
Now we tilt the Earth, and we do so in our imagination by 90 degrees.
The North pole faces the Sun on mid-summer's day, and
the south pole faces the Sun 6 months later. As you know,
Northern Summer is Southern Winter and vice versa.
With our 90 degree tilt the Sun doesn't rise or set at the equator
on mid-summer's day OR mid-winter's day, equal day and night
occur mid-spring and mid-autumn.

Okay, so much for latitude and tilt, next is orbital eccentricity.
We imagined that the Earth moved in a perfect circle, but it doesn't.
It is closest to the Sun on or about Jan 3rd at 91,000,000 miles
and furthest 6 months later at 94,000,000 miles, moving in
an elliptical orbit. As we did above, we again imagine an
extreme case where the Earth passes very close to our
point-like Sun and then 6 months later is way out near Pluto.
The orbit is almost a straight line. The Earth falls toward
the Sun going faster and faster (as comets do) and then
swings around the back where gravity is at its greatest,
climbs away again and slows as it gets toward Pluto's
orbit where it stops climbing and falls once again, just
as a ball thrown straight up would do. Now, when far
from the Sun the Earth turns once a day, sunset and sunrise
are about the same each day, but when close to the sun
we have a problem with that. The Earth turns on its axis
360 degrees in what is called a sidereal day
(1 sidereal day = 23.9344696 hours)
and there are 366, (not 365) sidereal days in a year.
http://en.wikipedia.org/wiki/Sidereal_day
That is when the Earth has turned not to face the sun
once a day, but to face the other stars.
You will notice that the night sky has different stars
directly overheard between Summer and Winter.
This means that when (in our imagination) the Earth
passes very close by the sun, noon, when the sun is overhead,
can last for 12 hours.
Look at the diagram at
http://en.wikipedia.org/wiki/Sidereal_day
and you'll see why.
Last and least, the Sun is NOT a point.
Now... the computation of Earth's orbit is something you
do NOT want to do.
http://mathworld.wolfram.com/KeplersEquation.html

In conclusion, a look-up table is the simplest solution for you.