[go: up one dir, main page]

Menu

[d33b2f]: / jsjdetst.html  Maximize  Restore  History

Download this file

187 lines (174 with data), 7.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0053)http://www.go.ednet.ns.ca/~larry/orbits/jsjdetst.html -->
<HTML><HEAD><TITLE>Julian Day/Equation of Time/Siderial Time Calculation-Java Script</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"><!-- This works for Julian Days- L.Bogan March 1998 --><!-- Modified to include the Equation of Time - L.Bogan March 23, 1998 now called jsjdetst.htm --><!-- Feb 25, 1999 - corrected for incorrect Local Siderial Time --><!-- Nov 5, 2000 - I finally correct the fact that the local siderail time sometime was > 24 hours -->
<SCRIPT language=JavaScript>
var jd0=0, lngtd=0, T=0, t1=0, t=0, degcorr=0, tzone=0;
// calculate the siderial time at greenwich for the given local standard time
function calcJD(form) {
y = eval(form.year.value);
m = eval(form.month.value);
d = eval(form.day.value);
t = eval(form.time.value);
if (m <= 2) {
y = y - 1;
m = m + 12;
}
var a = Math.floor(y/100);
var b = 2 - a + Math.floor(a/4);
d += t/24
jdg = Math.floor(365.25*(y+4716))+Math.floor(30.6001*(m+1))+d+b-1524.5;
// Correct the time for UT from local standard time - this only sets up calc to give the right jd for 0h UT
jdg -= tzone/24;
jd0 = Math.floor(jdg+0.5)-0.5
// Julian day 0h UT
return jd0;
}
function longcorr(fm) {
lngtd = eval(fm.longitude.value);
tzone = Math.round(lngtd/15);
degcorr = lngtd-15*tzone;
top.document.entry.lcorrection.value = 4*degcorr;
return tzone;
}
function calcET(jday) {
with(Math) {
radian = 180/PI;
T = (jday-2451545.0)/36525;
tau = T/10;
obl=23.439291-0.001300*T;
obl=obl/radian;
L = 280.46644567+360007.6982779*tau+0.030320*tau*tau+pow(tau,3)/49931-pow(tau,4)/15299;
L = L/radian;
M = 357.052910+35999.05030*T-0.0001559*T*T-0.00000048*T*T*T;
M = M/radian;
e = 0.01670617-0.000042037*T-0.0000001236*T*T;
y = pow(tan(obl/2),2);
ET = y*sin(2*L)-2*e*sin(M)+4*e*y*sin(M)*cos(2*L)-y*y/2*sin(4*L);
}
ET = ET*radian*4;
return ET;
}
function calcST(jdi) {
// calculate the siderial time at Greenwich in degrees at 0hUT
t1 = (jdi-2451545.0)/36525;
var st = 100.46061837+36000.77053608*t1+0.000387933*t1*t1-t1*t1*t1/38710000;
// correct for other time and time zone
// remember that julian day is for 0h UT (add in time plus time zone (negative =west))
// The following gives the UT for the time, t in time zone tzone
ut = (t-tzone)
// example if tzone = -4 hours and time = 15 hours (3 pm) then UT = 15+4 = 19 hours (remember st is in degrees)
st = st + 1.002738*ut*15
// Now calculate local siderial time which is your longitude less than the st at greenwich
st = st+lngtd
// Reduce the angle to 0-360
with(Math) {
if (st < 0) {
n = floor(abs(st/360));
st += ((n+1)*360);
};
var hr = floor(st/15);
var mn = floor((st % 15)*4);
var sc = round((st-(hr*15)-(mn/4))*240);
if (hr > 24) {
n = floor(hr/24);
hr = hr - n*24;
};
siderial = ""+hr+"h"+mn+"m"+sc+"s";
}
return siderial;
}
function calculate(form) {
form.tzhr.value = longcorr(form);
// returns the julian day for 0h UT
form.julian0.value = calcJD(form)
// julian day for the local time
var jd1 = jd0+((t-tzone)/24)
if ((t-tzone)>=24) {
jd1 -= 1;};
form.julian.value = jd1;
form.eqtntime.value = calcET(jd1);
form.sidtime.value = calcST(jd0);
}
</SCRIPT>
</HEAD>
<BODY>
<TABLE cellSpacing=3 cols=2 cellPadding=5 width="100%" bgColor=#66ff99
border=3><CAPTION>
<H2>Astronomical Time Calculations</H2>
<H3>Julian Day, Equation of Time and Siderial Time</H3></CAPTION>
<TBODY>
<TR align=top>
<TD width="50%">
<H3 align=center>TIME</H3>
<UL type=CIRCLE>
<LI><B>Local Apparent Time -</B> Sun Dial Time or hour angle of the real
Sun
<LI><B>Local Mean Solar Time -</B> The hour angle of a fictitious, mean
Sun and used to determine Standard Time.
<LI><B>Standard Time -</B> The Local Mean Solar Time at the standard
meridian of your time zone. Standard meridian are space approximately
15<SUP>o</SUP> apart in longitude around the Earth.
<LI><B>Equation of Time -</B> The difference between the apparent time
and the mean time. The Equation of Time value for the date is used to
convert Sun Dial Time to Local Mean Time. </LI></UL>
<P><B>Local Siderial Time</B> is the 'star time'. It is the hour angle of
the vernal equinox. Or in more useful terms, the right ascension of the
stars on your local celestial meridian.
<P><B>Julian Day </B>is a linear count of days starting on January 1, 4713
BC and is commonly used for astronomical calculations. The Julian Day
starts at Noon Universal Time (UT) hence at 0h UT the Julian day is some
whole number + 0.5.
<HR>
[This page utilizes Java Script:] <BR>[<I>you must have Navigator 2.0 or
Internet Explorer 3.0 or later and have JavaScript activated</I>]
<HR>
<UL>
<LI><A href="http://www.go.ednet.ns.ca/~larry">Larry Bogan's Home
Page</A>
<LI><A href="mailto:larry@go.ednet.ns.ca">Feedback</A>
</LI></UL><I>Created by L.Bogan - March 1998<BR>Updated with corrections
for errors- 7 Nov, 2000</I><br>
<i>Siderial Time > 24 hr corrected - Nov 20,2002</i> </TD>
<TD vAlign=top>
<FORM name=entry action=post>
<H3 align=center>CALCULATIONS</H3>
<P>Enter the Longitude of your location. <BR>[This affects local Siderial
Time and use of the Equation of Time.] <BR><B>Longitude </B>(degrees) =
<INPUT size=5 name=longitude> <BR>(west longitude is negative)
<P>Enter the Date and Local Time for which the Julian Day will be
Calculated <BR>(The time should hours and fraction on the 24 hour clock)
<P><B>Year - Month - Day - Time</B> <BR>--yyyy---mm--dd---hh.hhhh
<BR><INPUT maxLength=4 size=4 name=year> <INPUT maxLength=2 size=2
name=month> <INPUT maxLength=2 size=2 name=day> <INPUT maxLength=7 size=7
name=time> <INPUT type=reset value="Clear Entries"> <BR><INPUT onclick=calculate(top.document.entry); type=button value="Calculate JD,ET and ST">
<HR>
<TABLE>
<TBODY>
<TR>
<TD><B>Local Time Zone</B></TD>
<TD><INPUT size=4 name=tzhr></TD>
<TD>hours from UT.</TD></TR>
<TR>
<TD><B>Julian Day</B></TD>
<TD><INPUT maxLength=15 size=12 name=julian></TD>
<TD></TD></TR>
<TR>
<TD><B>Julian Day 0h UT </B></TD>
<TD><INPUT maxLength=10 size=10 name=julian0></TD>
<TD></TD></TR>
<TR>
<TD><B>Equation of Time</B></TD>
<TD><INPUT maxLength=6 size=6 name=eqtntime></TD>
<TD>minutes</TD></TR>
<TR>
<TD><B>Longitude Correction </B></TD>
<TD><INPUT maxLength=6 size=5 name=lcorrection></TD>
<TD>minutes</TD></TR>
<TR>
<TD><B>Local Siderial Time</B></TD>
<TD><INPUT size=10 name=sidtime></TD>
<TD></TD></TR></TBODY></TABLE>
<P><B>Standard Time</B> <BR>= Sundial Time - Equation of Time - Longitude
Correction </FORM></P>
<hr></TD></TR></TBODY></TABLE></BODY></HTML>