Beruflich Dokumente
Kultur Dokumente
INTRODUCTION
Since astronomers seem to use a common mode of date and time, we will only
discuss the two date systems and the established time system commonly used.
We will begin with a brief discussion and methods to calculate the Leap Day,
Day of the Year, Day of the Week, and the Julian Day. Our topics later, Part 2
will include Local Standard Time (time), Coordinated Universal Time (UTC),
and Local Sidereal Time (LST). And, how to convert from one system to the
other? Once we have those "simple" methods and calculations out of the way, we
get into the real scary stuff.
Since this author writes mostly in Visual Basic programming examples will be
presented as they would by using Microsoft Visual Basic. We encourage others
to add to these routines as time goes by. It may seem odd to use computer
programming to explain this stuff. Hopefully, it will become clear after a while
why. Formatting commands for Visual Basic makes life easier in the fast lane of
computer programming. They actually are similar to some of the old FORTRAN
format commands with lot of flexibility. Since we will discuss dates and times, a
simpler routine using Visual Basic formatting will be included with each
discussion.
The following equations and their use can be found in the books by Jean Meeus.
Detailed discussion on these equations will not be given. However, program
techniques will be discussed.
PROGRAMMING TIPS
We may wish to start with come essential constants in the General section of our
Visual Basic form with:
Const PI = 3.14159265
Const rad = PI / 180
Function Arcsin(X)
X = Atn(X / Sqr(-X * X + 1)) / rad
End Function
Function Arccos(X)
X = (Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)) / rad
End Function
Many of the long equations result in angles of five digit angles, meaningless for
real world thinking. A good sub-routine can be formed in our program as a
Function Call. Much of the answers of the equations we will use results in angle
over 360 degrees. At times it is necessary to "normalize" the results to a value at
or below 360 degrees. A handy call is:
Function NORMALIZE(X)
X = ((X / 360) - Int(X / 360)) * 360
End Function
Function NORMTIM(X)
X = X / 24
X = 24 * (X - Int(X))
End Function
Some trigonometric functions may result in erroneous angles that will throw the
positions of a planet way out of bounds. First, when any equation contains the
tangent (TAN) it is possible to end up in the wrong quadrant of the circle. Once
this author printed a daily listing of the Ephemeris of Mars and was surprised to
find the right ascension changed from 23:59:59 to 12:00:00!!! A simple over sight
caused this. So, when a TAN shows up, say in the following equation:
X = Tan B / Cos LA
This may result in the wrong sign and quadrant, so to find the inverse tangent of
the denominator and numerator as this equation and the signs of each. Also, it
may be a good time to convert from radial measure to degrees. If the
denominator is negative then we add 180 to the result and find the correct
quadrant. Also, this is a good one for the Function Call routine. FORTRAN
incorporates a nice call ATN2 that accomplishes this for you. Basic does not! So
lets just emulate FORTRAN with a Function Call.
An example for equation X = Tan B / Cos LA, simply tag the numerator and
dominator as, RX = Tan B: RY = Cos LA, then:
End Function
Time zones are measured from the 0 degrees meridian, somewhere in England,
and increases one hour for each 15 degrees of longitude around Earth. This is a
general rule. Governments in the various countries attempt to define nature and
make laws governing how our clocks will show time. After looking at a colored
map on the World Time Zones web page it is easy to see that the times zones
really follow more closely to country boundaries than to the 15-degree longitude
zones.
For time calculations we define the times zones in the United States are as
follows: Puerto Rico and U.S. Virgin Islands (-4), Eastern; including eastern
Indiana (-5), Central and western Indiana (-6), Mountain (-7), Pacific (-8), Alaska
(-9), and Hawaii (-10) and American Samoa (-11).
In the USA all states but Arizona, Hawaii, the eastern zone portion of Indiana,
Puerto Rico, the U.S. Virgin Islands and American Samoa practice this unnatural
act. That is, change over to DST, during the early hours (2 a.m.) of the second
Sunday of March and revert back to Standard Time during the early hours (2
a.m.) of the first Sunday in November. Funny, if you followed the letter of the law
you would get up at 2 a.m. the last Sunday morning of the year. Set your clock
back an hour to 1 a.m. then wait until the clock read 2 a.m. and then set your
clock back an hour -- AGAIN! This could conceivably go on until you reached the
first Sunday in April then go on for there. Just kidding. But, it gives some
indication of how government works!
The Daylight Saving Time Zones for the USA are: Eastern; including eastern
Indiana (-5), Central and western Indiana (-6), Mountain (-7), Pacific (-8), and
Alaska (-9).
Here are two subroutines to determine when daylight savings time begins and
ends:
Sub Saylight_Savings()
These values would be carried in from the location veriables.
CivilMonth = Month(Now)
CivilDay = Day(Now)
CivilYear = Year(Now)
CivilHour = Hour(Now)
CivilMin = Minute(Now) MarJulianDate = Int(365.25 * (Cyear + 4716)) +
Int(30.6001 * 4) + 0 + (2 - Int(Cyear / 100) + Int(Int(Cyear / 100) / 4)) -
1524.5
TDM = Cday + (HR + MN / 60 + SC / 3600) / 24
DS1 = 14 - Int((MarJulianDate + 1.5) - 7 * Int((MarJulianDate + 1.5) / 7)) +
TK
NovJulianDate = Int(365.25 * (Cyear + 4716)) + Int(30.6001 * 12) + 0 + (2
- Int(Cyear / 100) + Int(Int(Cyear / 100) / 4)) - 1524.5
DS2 = 7 - Int((NovJulianDate + 1.5) - 7 * Int((NovJulianDate + 1.5) / 7)) +
TK
If DS2 > 7.2 Then DS2 = 1 + TK
If Cmonth > 3 Or (Cmonth = 3 And TDM >= DS1) Then Tzone = TZ + 1
If Cmonth > 11 Or (Cmonth = 11 And TDM >= DS2) Then Tzone = TZ
If DST = 0 Then Tzone = TZ
Print "Daylight Savings Time begins at 2 a.m. March "; Int(DS1); "and ends
at 2 a.m. November "; Int(DS2)
Example 1: March 08, 2009 at 3 a.m. the Universal Time (UT) would be [Note:
we have already passed into Eastern Daylight Savings Time (EDT) at 2 a.m. on
this day! So, time zone will be 4 hours instead of 5 hours]. The 24-hour clock
for 03:30 a.m. EDT = 0330.
Find: UT for 0330 EDT add 4 hours: UT = 0330 +0400 = 0730. VB format is
Format(UT, "hh:nn) = 0730.
Find: UT for 2100 in the EST add 5 hours: UT = 2100 + 0500 = 2600.
Normalize by subtracting 2400, then UT = 2600 - 2400 = 0200.
VB format is Format(UT, "hh:nn:ss) = 02:00:00
There are several sources for setting your astronomical clocks. Since this author
works for the U.S. Naval Observatory it is recommended that observers call into
1-202-762-1594 if you have a computer time setting program such as TimeSet
(DOS) or Atomic.exe (Atomic Clock for Windows) and so on. You can find
Timeset on the Rightime web page (http://www.rightime.com/) or the Atomic
Clock at Parsons Technology (1-800-223-6925).
Julian Day
Routine 1:
Sub JulDay(Yr, Mo, Da, JulianDate)
If Mo <= 2 Then
Y1 = Yr - 1
Mo1 = Mo + 12
Else
Y1 = Yr
Mo1 = Mo
End If
JulianDate = Int(365.25 * (Y1 + 4716)) + Int(30.6001 * (Mo1 + 1)) + Da +
(2 - Int(Y1 / 100) + Int(Int(Y1 / 100) / 4)) - 1524.5 End Sub
Add the time of day divided by 24 to establish the exact Julian day number i.e., if
the UT is 1500 hours then: 1500 / 24 = 0.625. Corrected Julian day = 2451269.5
+ 0.625 = 2451270.125
The Julian date can be further adjusted to include the time of day by dividing the
Universal Time by 24 and adding it to the Julian date:
Many of the equations in our Ephemeris calculations require the fractional parts
of the Julian Century:
Delta T
Because the Solar System doesnt conform to our time measuring systems a
brief note on Delta Time (T) is in order. Delta Time the difference between
Universal Time and the time of our Solar System as determined by the U.S.
Naval Observatory and is not readily available until they compute it each year.
Here is an approximation of the value from the Polynomial Expressions for Delta
T ( T); Adapted from "Five Millennium Canon of Solar Eclipses [ Espenak and
Meeus ] found at URL: http://eclipse.gsfc.nasa.gov/SEhelp/deltatpoly2004.html
End If
If UnivYear >= 1941 And UnivYear < 1961 Then
tDT = UnivYear - 1950
DT = 29.07 + 0.407 * tDT - tDT ^ 2 / 233 + tDT ^ 3 / 2547
End If
If UnivYear >= 1961 And UnivYear < 1986 Then
tDT = UnivYear - 1975
DT = 45.45 + 1.067 * tDT - tDT ^ 2 / 260 - tDT ^ 3 / 718
End If
If UnivYear >= 1986 And UnivYear < 2005 Then
tDT = UnivYear - 2000
DT = 63.86 + 0.3345 * tDT - 0.060374 * tDT ^ 2 + 0.0017275 * tDT
^ 3 + 0.000651814 * tDT ^ 4 + 0.00002373599 * tDT ^ 5
End If
If UnivYear >= 2005 And UnivYear < 2050 Then
tDT = UnivYear - 2000
DT = 62.92 + 0.32217 * tDT + 0.005589 * tDT ^ 2
End If
If UnivYear >= 2050 And UnivYear < 2150 Then
DT = -20 + 32 * ((UnivYear - 1820) / 100) ^ 2 - 0.5628 * (2150 -
UnivYear)
End If
If UnivYear >= 2150 Then
u = (UnivYear - 1820) / 100
DT = -20 + 32 * u ^ 2
End If
End Sub
Before getting started on the primary equations for the Ephemeris lets discuss
some pesky transform routines. To correct a previous problem with the year 2000
leap day a new routine for Julian date is discussed.
Leap Day
Leap Year Rule: Every year that is exactly divisible by 4 is a leap year, except for
years that are exactly divisible by 100; these centurial years are leap years only if
they are exactly divisible by 400. The break out the leap day, a good computer
program routine would be:
Two routines for finding the Leap day for any year. The first can be found in many
"professional" programming manuals, college classes, and so on. The second
works exactly the same, however, is faster and a bit less complex. The last, a
short statement in Visual Basic, is very fast:
Routine 2: Leap = ABS((Year MOD 4 = 0 AND Year MOD 100 < 0) OR (Year
MOD 400 = 0))
Find: ABS((1999 MOD 4 = 0 AND 1999 MOD 100 < 0) OR (1999 MOD 400 = 0)),
where 1999 MOD 4 = 3 and 1999 MOD 100 = 99, so the answer is ABS (0) or 0
Find: ABS((2000 MOD 4 = 0 AND 2000 MOD 100 < 0) OR (2000 MOD 400 = 0))
where 2000 MOD 4 = 0 and 2000 MOD 100 = 0, so the answer is ABS (-1) or 1
Routine 3: Format (Now, "yyyy") = 1999. Visual Basic (VB) takes care of leap
days. No need for complex coding to accomplish this.
Routine 2: Find the JD for 0 hour of January 1st. then subtract this from the JD
for the day of the year.
Example 2 : March 01, 1999, JD = 2451239.5
Routine 3: Format(Now, "y") if Now = March 01, 1999, Dnum = 60 [VB method]
We may even need to know the day of the week. Not that is necessary to
calculate the Ephemeris of a planet, its just nice to have around in case.
If you were to want the week day spelled out completely, the change the "3 *" to
9*" and modify the line "SunMonTueWedThuFriSat" to "Sunday Monday
Tuesday WednesdayThursday Friday Saturday " where each week day contains
at 9 characters, spaces included.
1: Lets make a couple essential constants, (pi) and radian (rad) then set the variable
dimension statements to make room in the memory for program variable array storage:
Const PI = 3.14159265
Const rad = PI/180
Dim DT
Dim Leap As Integer
Dim Leap As Integer
Dim Pass As Integer
Dim UnivMonth As Variant
Dim UnivDay As Variant
Dim UnivYear As Variant
Function Arccos(X)
X = (Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)) / rad
End Function
Function Arcsin(X)
X = Atn(X / Sqr(-X * X + 1)) / rad
End Function
Function NORM(X)
X = ((X / 360) - Int(X / 360)) * 360
End Function
End Function
3: Compute the Julian Date or Day and the fraction of a Julian Century.
5: We begin with computing the mean anomalies for Earth, Mars and Jupiter, a correction
for Mars, and Venus:
10: These equations find the elongation, right ascension and declination of Mars:
If TH < LO And TH > (LO - 180) Or TH > (LO + 180) Then cc = "E" Else cc = "W"
LT = ArcTan2(Rmars * Cos(rad * b) * Sin(rad * (LO - TH)), Rmars * Cos(rad * b) * Cos(rad * (LO -
TH)) + Rearth)
LA = LT + TH
Call NORM(LA)
BA = Rmars * Sin(rad * B) / DA
Call Arcsin(BA)
EL = Cos(rad * BA) * Cos(rad * LT)
Call Arccos(EL)
RA = ArcTan2(Sin(rad * LA) * Cos(rad * EPearth) - Tan(rad * BA) * Sin(rad * EPearth), Cos(rad *
LA))
RH = Int(RA / 15)
RM = 4 * (RA - 15 * RH)
RS = (RM - Int(RM)) * 60
RM = Int(RM): RS = Int(RS)
RightAsc = Format(TimeSerial(RH, RM, RS), " hh:nn")
DC = Sin(rad * BA) * Cos(rad * EPearth) + Cos(rad * BA) * Sin(rad * EPearth) * Sin(rad * LA)
Call Arcsin(DC)
O9 = ArcTan2(Cos(rad * D0) * Cos(rad * (N0 - A0)), -Sin(rad * D0) * Sin(rad * J) + Cos(rad * D0) *
Cos(rad * J) * Sin(rad * (N0 - A0)))
Ls = LM - O9 + O6
Call NORM(Ls)
De = -Sin(rad * D0) * Sin(rad * DC) - Cos(rad * D0) * Cos(rad * DC) * Cos(rad * (A0 - RA))
Call Arcsin(De)
D6 = ArcTan2(Sin(rad * J) * Cos(rad * (N0 - A0)), Cos(rad * D0) * Cos(rad * J) - Sin(rad * D0) *
Sin(rad * J) * Sin(rad * (N0 - A0)))
A3 = ArcTan2((Cos(rad * D0) * Sin(rad * DC) - Sin(rad * D0) * Cos(rad * DC) * Cos(rad * (A0 -
RA))) / Cos(rad * De), -Cos(rad * DC) * Sin(rad * (A0 - RA)) / Cos(rad * De))
A4 = A3 - D6
Call NORM(A4)
A8 = ArcTan2(Cos(rad * EPearth) * Sin(rad * TH), Cos(rad * TH))
P8 = ArcTan2(Cos(rad * D0) * Sin(rad * (A0 - RA)), Sin(rad * D0) * Cos(rad * DC) - Cos(rad * D0)
* Sin(rad * DC) * Cos(rad * (A0 - RA)))
S2 = ArcTan2(Sin(rad * TH) * Cos(rad * EPearth), Cos(rad * TH))
S3 = Sin(rad * EPearth) * Sin(rad * TH)
Call Arcsin(S3)
T8 = ArcTan2(Cos(rad * S3) * Sin(rad * (S2 - RA)) / Sin(rad * EL), (Sin(rad * S3) * Cos(rad * DC) -
Cos(rad * S3) * Sin(rad * DC) * Cos(rad * (S2 - RA))) / Sin(rad * EL))
Q = T8 + 180
Call NORM(Q)
Printout as desired.
Elongation (EL), phase angle (I2) and phase (phase): Mars to Sun distance (Rmars), Earth
to Mars distance (DA), and Earth to the Sun distance (Rearth):
ro = 0.0057755183 * DA)
W = 11.504 + 350.89200025 * (JulianDate + UT / 24 - ro - 2433282.5))
Call NORM(W)
k = ArcTan2(Sin(rad * D0) * Cos(rad * DC) * Cos(rad * (A0 - RA)) - Sin(rad * DC) * Cos(rad *
D0), Cos(rad * DC) * Sin(rad * (A0 - RA)))
CM = W - k
Call NORM(CM)
NOTE: Above equations D6, A3 and A4 not needed with this method.