calc_sun 0.1.1 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/calc_sun.gemspec CHANGED
@@ -8,26 +8,21 @@ Gem::Specification.new do |spec|
8
8
  spec.version = CalcSun::VERSION
9
9
  spec.author = 'Douglas Allen'
10
10
  spec.email = ['kb9agt@gmail.com']
11
-
12
11
  spec.summary = 'Calculates Sun Times ea. rise, noon, set'
13
- spec.description = 'supply the jd date, latitude, and longitude in the calls
14
- to each method t_rise(jd, lon, lat),
15
- t_mid_day(jd, lon, lat), and t_set(jd, lon, lat)'
12
+ spec.description = 'supply the date yyyy-mm-dd, latitude decimal, and
13
+ longitude decimal in the calls to each method
14
+ rise(date, lat, lon),
15
+ noon(date, lat, lon), and
16
+ set(date, lat, lon)'
16
17
  spec.homepage = 'https://github.com/DouglasAllen/calc_sun'
17
18
  spec.license = 'MIT'
19
+ require 'English'
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
18
23
  require 'rake'
19
- spec.files = FileList['lib .rb',
20
- '[A-Z]*',
21
- 'test/ *'].to_a
22
- spec.extensions << 'ext/eot/extconf.rb'
24
+ spec.extensions << 'ext/calc_sun/extconf.rb'
23
25
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
26
  spec.require_paths = ['lib']
25
27
  spec.platform = Gem::Platform::RUBY
26
- spec.add_development_dependency 'bundler', '~> 1.13'
27
- spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'rake-compiler', '~> 0.9.3'
29
- spec.add_development_dependency 'hoe', '~> 3.12.0'
30
- spec.add_development_dependency 'guard', '~> 2.6.1'
31
- spec.add_development_dependency 'guard-minitest', '~> 2.3.2'
32
- spec.add_development_dependency 'minitest', '~> 5.4.1'
33
28
  end
data/dev.md ADDED
@@ -0,0 +1,49 @@
1
+
2
+ # calc_sun
3
+
4
+ ## develop
5
+
6
+ ```code
7
+ $> autotest
8
+ ```
9
+
10
+ or
11
+
12
+ ```code
13
+ $> rake
14
+ ```
15
+
16
+ ## example
17
+
18
+ ```code
19
+ $> ruby example/sunriset.rb
20
+ ```
21
+
22
+ Change the lat, lon, and date in sunriset.rb for your location or preferences.
23
+
24
+ pull requests welcome
25
+
26
+ == LICENSE:
27
+
28
+ (The MIT License)
29
+
30
+ Copyright (c) 2016
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining
33
+ a copy of this software and associated documentation files (the
34
+ 'Software'), to deal in the Software without restriction, including
35
+ without limitation the rights to use, copy, modify, merge, publish,
36
+ distribute, sublicense, and/or sell copies of the Software, and to
37
+ permit persons to whom the Software is furnished to do so, subject to
38
+ the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,1456 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <!-- saved from url=(0033)http://www.celnav.de/longterm.htm -->
3
+ <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4
+
5
+
6
+
7
+ <title>Almanac</title>
8
+
9
+ <script language="JavaScript">
10
+
11
+ var dtr = Math.PI/180;
12
+
13
+ // Main function
14
+ function Main()
15
+ {
16
+ window.status = "Calculating... Please wait.";
17
+ ReadData();
18
+ TimeMeasures();
19
+ Nutation();
20
+ Aries();
21
+ Sun();
22
+ Moon();
23
+ Polaris();
24
+ MoonPhase();
25
+ Weekday();
26
+ Output();
27
+ window.status = "Done.";
28
+ }
29
+
30
+
31
+ //Auxiliary functions
32
+
33
+ //Sine of angles in degrees
34
+ function sind(x)
35
+ {
36
+ return Math.sin(dtr*x);
37
+ }
38
+
39
+ //Cosine of angles in degrees
40
+ function cosd(x)
41
+ {
42
+ return Math.cos(dtr*x);
43
+ }
44
+
45
+ //Tangent of angles in degrees
46
+ function tand(x)
47
+ {
48
+ return Math.tan(dtr*x);
49
+ }
50
+
51
+ //Normalize large angles
52
+ function norm_360_deg(x)
53
+ {
54
+ while (x<0) {
55
+ x+=360;
56
+ }
57
+ return x%360;
58
+ }
59
+
60
+
61
+ //Output Hour Angle
62
+ function OutHA(x)
63
+ {
64
+ with(Math)
65
+ {
66
+ var GHAdeg = floor(x);
67
+ var GHAmin = floor(60*(x-GHAdeg));
68
+ var GHAsec = round(3600*(x-GHAdeg-GHAmin/60));
69
+ if (GHAsec==60) {GHAsec=0; GHAmin+=1};
70
+ if (GHAmin==60) {GHAmin=0; GHAdeg+=1};
71
+ if (GHAdeg==0) GHAdeg="000";
72
+ else if (GHAdeg<10) GHAdeg="00"+GHAdeg;
73
+ else if (GHAdeg<100) GHAdeg="0"+GHAdeg;
74
+ if (GHAmin==0) GHAmin="00";
75
+ else if (GHAmin<10) GHAmin="0"+GHAmin;
76
+ if (GHAsec<10) GHAsec="0"+GHAsec;
77
+ return " "+GHAdeg+"°"+" "+GHAmin+"'"+" "+GHAsec+"''";
78
+ }
79
+ }
80
+
81
+ //Output Mean Obliqity of Ecliptic
82
+ function OutECL(x)
83
+ {
84
+ with(Math)
85
+ {
86
+ var ECLdeg = floor(x);
87
+ var ECLmin = floor(60*(x-ECLdeg));
88
+ var ECLsec = round(3600000*(x-ECLdeg-ECLmin/60))/1000;
89
+ if (ECLsec==60) {ECLsec=0; ECLmin+=1};
90
+ if (ECLmin==60) {ECLmin=0; ECLdeg+=1};
91
+ if (ECLmin==0) ECLmin="00";
92
+ else if (ECLmin<10) ECLmin="0"+ECLmin;
93
+ if (ECLsec<10) ECLsec="0"+ECLsec;
94
+ return " "+ECLdeg+"°"+" "+ECLmin+"'"+" "+ECLsec+"''";
95
+ }
96
+ }
97
+
98
+ //Output Sidereal Time
99
+ function OutSidTime(x)
100
+ {
101
+ with(Math)
102
+ {
103
+ var GMSTdecimal = x/15;
104
+ var GMSTh = floor(GMSTdecimal);
105
+ var GMSTmdecimal = 60*(GMSTdecimal-GMSTh);
106
+ var GMSTm = floor(GMSTmdecimal);
107
+ var GMSTsdecimal = 60*(GMSTmdecimal-GMSTm);
108
+ var GMSTs = round(1000*GMSTsdecimal)/1000;
109
+ if (GMSTs-floor(GMSTs)==0) GMSTs+=".000";
110
+ else if (10*GMSTs-floor(10*GMSTs)==0) GMSTs+="00";
111
+ else if (100*GMSTs-floor(100*GMSTs)==0) GMSTs+="0";
112
+ return " "+GMSTh+"h"+" "+GMSTm+"m"+" "+GMSTs+"s";
113
+ }
114
+ }
115
+
116
+
117
+ //Output Declination
118
+ function OutDec(x)
119
+ {
120
+ with(Math)
121
+ {
122
+ if (x<0) {var signDEC=-1; var name="S";}
123
+ else {var signDEC=1; var name="N";}
124
+ var DEC = abs(x);
125
+ var DECdeg = floor(DEC);
126
+ var DECmin = floor(60*(DEC-DECdeg));
127
+ var DECsec = round(3600*(DEC-DECdeg-DECmin/60));
128
+ if (DECsec==60) {DECsec=0; DECmin+=1};
129
+ if (DECmin==60) {DECmin=0; DECdeg+=1};
130
+ if (DECdeg==0) DECdeg="00";
131
+ else if (DECdeg<10) DECdeg="0"+DECdeg;
132
+ if (DECmin==0) DECmin="00";
133
+ else if (DECmin<10) DECmin="0"+DECmin;
134
+ if (DECsec<10) DECsec="0"+DECsec;
135
+ return " "+name+" "+DECdeg+"°"+" "+DECmin+"'"+" "+DECsec+"''";
136
+ }
137
+ }
138
+
139
+
140
+ //Output SD and HP
141
+ function OutSDHP(x)
142
+ {
143
+ with(Math)
144
+ {
145
+ x = round(10*x)/10;
146
+ if (x-floor(x)== 0) x+=".0";
147
+ return " "+x+"''";
148
+ }
149
+ }
150
+
151
+
152
+ // Input data conversion
153
+ function ReadData()
154
+ {
155
+ with(document)
156
+ {
157
+ if(InForm.year.value == "") alert("Missing year! Restart calculation.");
158
+ else year = eval(InForm.year.value);
159
+ if(InForm.month.value == "") alert("Missing month! Restart calculation.");
160
+ else month = eval(InForm.month.value);
161
+ if(month < 1 || month > 12) alert("Month out of range! Restart calculation.");
162
+ if(InForm.day.value == "") alert("Missing day! Restart calculation.");
163
+ else day = eval(InForm.day.value);
164
+ if(day < 1 || day > 31) alert("Day out of range! Restart calculation.");
165
+ var schj=0;
166
+ if(year/4-Math.floor(year/4) == 0) schj=1;
167
+ if(year/100-Math.floor(year/100) == 0) schj=0;
168
+ if(year/400-Math.floor(year/400) == 0) schj=1;
169
+ if(month == 2 && day > 28 && schj == 0) alert("February has only 28 days! Restart calculation.");
170
+ if(month == 2 && day > 29 && schj == 1) alert("February has only 29 days in a leap year! Restart calculation.");
171
+ if(month == 4 && day > 30) alert("April has only 30 days! Restart calculation.");
172
+ if(month == 6 && day > 30) alert("June has only 30 days! Restart calculation.");
173
+ if(month == 9 && day > 30) alert("September has only 30 days! Restart calculation.");
174
+ if(month == 11 && day > 30) alert("November has only 30 days! Restart calculation.");
175
+ if(InForm.hour.value == "") var hour = 0;
176
+ else var hour = eval(InForm.hour.value);
177
+ if(InForm.minute.value == "") var minute = 0;
178
+ else var minute = eval(InForm.minute.value);
179
+ if(InForm.second.value == "") var second = 0;
180
+ else var second = eval(InForm.second.value);
181
+ dayfraction = (hour + minute/60 + second/3600)/24;
182
+ if(dayfraction < 0 || dayfraction > 1) alert("Time out of range! Restart calculation.");
183
+ if(InForm.delta.value == "") deltaT = 0;
184
+ else deltaT = eval(InForm.delta.value);
185
+ }
186
+ }
187
+
188
+
189
+ // Calculating Julian date, century, and millennium
190
+ function TimeMeasures()
191
+ {
192
+ with(Math)
193
+ {
194
+ //Julian day (UT1)
195
+ if(month <= 2) {year -=1; month += 12;}
196
+ var A = floor(year/100);
197
+ var B = 2-A+floor(A/4);
198
+ JD0h = floor(365.25*(year+4716))+floor(30.6001*(month+1))+day+B-1524.5;
199
+ JD = JD0h+dayfraction;
200
+
201
+ //Julian centuries (GMT) since 2000 January 0.5
202
+ T = (JD-2451545)/36525;
203
+ T2 = T*T;
204
+ T3 = T*T2;
205
+ T4 = T*T3;
206
+ T5 = T*T4;
207
+
208
+ //Julian ephemeris day (TDT)
209
+ JDE = JD+deltaT/86400;
210
+
211
+ //Julian centuries (TDT) from 2000 January 0.5
212
+ TE = (JDE-2451545)/36525;
213
+ TE2 = TE*TE;
214
+ TE3 = TE*TE2;
215
+ TE4 = TE*TE3;
216
+ TE5 = TE*TE4;
217
+
218
+ //Julian millenniums (TDT) from 2000 January 0.5
219
+ Tau = 0.1*TE;
220
+ Tau2 = Tau*Tau;
221
+ Tau3 = Tau*Tau2;
222
+ Tau4 = Tau*Tau3;
223
+ Tau5 = Tau*Tau4;
224
+ }
225
+ }
226
+
227
+
228
+ //Nutation, obliquity of the ecliptic
229
+ function Nutation()
230
+ {
231
+ //IAU 1980 nutation theory:
232
+
233
+ //Mean anomaly of the moon
234
+ var Mm = 134.962981389+198.867398056*TE+norm_360_deg(477000*TE)+0.008697222222*TE2+TE3/56250;
235
+
236
+ //Mean anomaly of the sun
237
+ var M = 357.527723333+359.05034*TE+norm_360_deg(35640*TE)-0.0001602777778*TE2-TE3/300000;
238
+ SunMA = norm_360_deg(M);
239
+
240
+ //Mean distance of the moon from the ascending node
241
+ var F = 93.271910277+82.017538055*TE+norm_360_deg(483120*TE)-0.0036825*TE2+TE3/327272.7273;
242
+
243
+ //Mean elongation of the moon
244
+ var D = 297.850363055+307.11148*TE+norm_360_deg(444960*TE)-0.001914166667*TE2+TE3/189473.6842;
245
+
246
+ //Longitude of the ascending node of the moon
247
+ var omega = 125.044522222-134.136260833*TE-norm_360_deg(1800*TE)+0.002070833333*TE2+TE3/450000;
248
+
249
+ //Periodic terms for nutation
250
+ var nut = new Array(106);
251
+ nut[0] = " 0 0 0 0 1-171996-174.2 92025 8.9 ";
252
+ nut[1] = " 0 0 2-2 2 -13187 -1.6 5736-3.1 ";
253
+ nut[2] = " 0 0 2 0 2 -2274 -0.2 977-0.5 ";
254
+ nut[3] = " 0 0 0 0 2 2062 0.2 -895 0.5 ";
255
+ nut[4] = " 0-1 0 0 0 -1426 3.4 54-0.1 ";
256
+ nut[5] = " 1 0 0 0 0 712 0.1 -7 0.0 ";
257
+ nut[6] = " 0 1 2-2 2 -517 1.2 224-0.6 ";
258
+ nut[7] = " 0 0 2 0 1 -386 -0.4 200 0.0 ";
259
+ nut[8] = " 1 0 2 0 2 -301 0.0 129-0.1 ";
260
+ nut[9] = " 0-1 2-2 2 217 -0.5 -95 0.3 ";
261
+ nut[10] = "-1 0 0 2 0 158 0.0 -1 0.0 ";
262
+ nut[11] = " 0 0 2-2 1 129 0.1 -70 0.0 ";
263
+ nut[12] = "-1 0 2 0 2 123 0.0 -53 0.0 ";
264
+ nut[13] = " 1 0 0 0 1 63 0.1 -33 0.0 ";
265
+ nut[14] = " 0 0 0 2 0 63 0.0 -2 0.0 ";
266
+ nut[15] = "-1 0 2 2 2 -59 0.0 26 0.0 ";
267
+ nut[16] = "-1 0 0 0 1 -58 -0.1 32 0.0 ";
268
+ nut[17] = " 1 0 2 0 1 -51 0.0 27 0.0 ";
269
+ nut[18] = "-2 0 0 2 0 -48 0.0 1 0.0 ";
270
+ nut[19] = "-2 0 2 0 1 46 0.0 -24 0.0 ";
271
+ nut[20] = " 0 0 2 2 2 -38 0.0 16 0.0 ";
272
+ nut[21] = " 2 0 2 0 2 -31 0.0 13 0.0 ";
273
+ nut[22] = " 2 0 0 0 0 29 0.0 -1 0.0 ";
274
+ nut[23] = " 1 0 2-2 2 29 0.0 -12 0.0 ";
275
+ nut[24] = " 0 0 2 0 0 26 0.0 -1 0.0 ";
276
+ nut[25] = " 0 0 2-2 0 -22 0.0 0 0.0 ";
277
+ nut[26] = "-1 0 2 0 1 21 0.0 -10 0.0 ";
278
+ nut[27] = " 0 2 0 0 0 17 -0.1 0 0.0 ";
279
+ nut[28] = " 0 2 2-2 2 -16 0.1 7 0.0 ";
280
+ nut[29] = "-1 0 0 2 1 16 0.0 -8 0.0 ";
281
+ nut[30] = " 0 1 0 0 1 -15 0.0 9 0.0 ";
282
+ nut[31] = " 1 0 0-2 1 -13 0.0 7 0.0 ";
283
+ nut[32] = " 0-1 0 0 1 -12 0.0 6 0.0 ";
284
+ nut[33] = " 2 0-2 0 0 11 0.0 0 0.0 ";
285
+ nut[34] = "-1 0 2 2 1 -10 0.0 5 0.0 ";
286
+ nut[35] = " 1 0 2 2 2 -8 0.0 3 0.0 ";
287
+ nut[36] = " 0-1 2 0 2 -7 0.0 3 0.0 ";
288
+ nut[37] = " 0 0 2 2 1 -7 0.0 3 0.0 ";
289
+ nut[38] = " 1 1 0-2 0 -7 0.0 0 0.0 ";
290
+ nut[39] = " 0 1 2 0 2 7 0.0 -3 0.0 ";
291
+ nut[40] = "-2 0 0 2 1 -6 0.0 3 0.0 ";
292
+ nut[41] = " 0 0 0 2 1 -6 0.0 3 0.0 ";
293
+ nut[42] = " 2 0 2-2 2 6 0.0 -3 0.0 ";
294
+ nut[43] = " 1 0 0 2 0 6 0.0 0 0.0 ";
295
+ nut[44] = " 1 0 2-2 1 6 0.0 -3 0.0 ";
296
+ nut[45] = " 0 0 0-2 1 -5 0.0 3 0.0 ";
297
+ nut[46] = " 0-1 2-2 1 -5 0.0 3 0.0 ";
298
+ nut[47] = " 2 0 2 0 1 -5 0.0 3 0.0 ";
299
+ nut[48] = " 1-1 0 0 0 5 0.0 0 0.0 ";
300
+ nut[49] = " 1 0 0-1 0 -4 0.0 0 0.0 ";
301
+ nut[50] = " 0 0 0 1 0 -4 0.0 0 0.0 ";
302
+ nut[51] = " 0 1 0-2 0 -4 0.0 0 0.0 ";
303
+ nut[52] = " 1 0-2 0 0 4 0.0 0 0.0 ";
304
+ nut[53] = " 2 0 0-2 1 4 0.0 -2 0.0 ";
305
+ nut[54] = " 0 1 2-2 1 4 0.0 -2 0.0 ";
306
+ nut[55] = " 1 1 0 0 0 -3 0.0 0 0.0 ";
307
+ nut[56] = " 1-1 0-1 0 -3 0.0 0 0.0 ";
308
+ nut[57] = "-1-1 2 2 2 -3 0.0 1 0.0 ";
309
+ nut[58] = " 0-1 2 2 2 -3 0.0 1 0.0 ";
310
+ nut[59] = " 1-1 2 0 2 -3 0.0 1 0.0 ";
311
+ nut[60] = " 3 0 2 0 2 -3 0.0 1 0.0 ";
312
+ nut[61] = "-2 0 2 0 2 -3 0.0 1 0.0 ";
313
+ nut[62] = " 1 0 2 0 0 3 0.0 0 0.0 ";
314
+ nut[63] = "-1 0 2 4 2 -2 0.0 1 0.0 ";
315
+ nut[64] = " 1 0 0 0 2 -2 0.0 1 0.0 ";
316
+ nut[65] = "-1 0 2-2 1 -2 0.0 1 0.0 ";
317
+ nut[66] = " 0-2 2-2 1 -2 0.0 1 0.0 ";
318
+ nut[67] = "-2 0 0 0 1 -2 0.0 1 0.0 ";
319
+ nut[68] = " 2 0 0 0 1 2 0.0 -1 0.0 ";
320
+ nut[69] = " 3 0 0 0 0 2 0.0 0 0.0 ";
321
+ nut[70] = " 1 1 2 0 2 2 0.0 -1 0.0 ";
322
+ nut[71] = " 0 0 2 1 2 2 0.0 -1 0.0 ";
323
+ nut[72] = " 1 0 0 2 1 -1 0.0 0 0.0 ";
324
+ nut[73] = " 1 0 2 2 1 -1 0.0 1 0.0 ";
325
+ nut[74] = " 1 1 0-2 1 -1 0.0 0 0.0 ";
326
+ nut[75] = " 0 1 0 2 0 -1 0.0 0 0.0 ";
327
+ nut[76] = " 0 1 2-2 0 -1 0.0 0 0.0 ";
328
+ nut[77] = " 0 1-2 2 0 -1 0.0 0 0.0 ";
329
+ nut[78] = " 1 0-2 2 0 -1 0.0 0 0.0 ";
330
+ nut[79] = " 1 0-2-2 0 -1 0.0 0 0.0 ";
331
+ nut[80] = " 1 0 2-2 0 -1 0.0 0 0.0 ";
332
+ nut[81] = " 1 0 0-4 0 -1 0.0 0 0.0 ";
333
+ nut[82] = " 2 0 0-4 0 -1 0.0 0 0.0 ";
334
+ nut[83] = " 0 0 2 4 2 -1 0.0 0 0.0 ";
335
+ nut[84] = " 0 0 2-1 2 -1 0.0 0 0.0 ";
336
+ nut[85] = "-2 0 2 4 2 -1 0.0 1 0.0 ";
337
+ nut[86] = " 2 0 2 2 2 -1 0.0 0 0.0 ";
338
+ nut[87] = " 0-1 2 0 1 -1 0.0 0 0.0 ";
339
+ nut[88] = " 0 0-2 0 1 -1 0.0 0 0.0 ";
340
+ nut[89] = " 0 0 4-2 2 1 0.0 0 0.0 ";
341
+ nut[90] = " 0 1 0 0 2 1 0.0 0 0.0 ";
342
+ nut[91] = " 1 1 2-2 2 1 0.0 -1 0.0 ";
343
+ nut[92] = " 3 0 2-2 2 1 0.0 0 0.0 ";
344
+ nut[93] = "-2 0 2 2 2 1 0.0 -1 0.0 ";
345
+ nut[94] = "-1 0 0 0 2 1 0.0 -1 0.0 ";
346
+ nut[95] = " 0 0-2 2 1 1 0.0 0 0.0 ";
347
+ nut[96] = " 0 1 2 0 1 1 0.0 0 0.0 ";
348
+ nut[97] = "-1 0 4 0 2 1 0.0 0 0.0 ";
349
+ nut[98] = " 2 1 0-2 0 1 0.0 0 0.0 ";
350
+ nut[99] = " 2 0 0 2 0 1 0.0 0 0.0 ";
351
+ nut[100]= " 2 0 2-2 1 1 0.0 -1 0.0 ";
352
+ nut[101]= " 2 0-2 0 1 1 0.0 0 0.0 ";
353
+ nut[102]= " 1-1 0-2 0 1 0.0 0 0.0 ";
354
+ nut[103]= "-1 0 0 1 1 1 0.0 0 0.0 ";
355
+ nut[104]= "-1-1 0 2 1 1 0.0 0 0.0 ";
356
+ nut[105]= " 0 1 0 1 0 1 0.0 0 0.0 ";
357
+
358
+ //Reading periodic terms
359
+ var fMm, fM, fF, fD, f_omega, dp=0, de=0;
360
+
361
+ for (x=0; x<105; x++)
362
+ {
363
+ fMm = eval(nut[x].substring(0,2));
364
+ fM = eval(nut[x].substring(2,4));
365
+ fF = eval(nut[x].substring(4,6));
366
+ fD = eval(nut[x].substring(6,8));
367
+ f_omega = eval(nut[x].substring(8,10));
368
+ dp += (eval(nut[x].substring(10,17))+TE*eval(nut[x].substring(17,23)))*sind(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega);
369
+ de += (eval(nut[x].substring(23,29))+TE*eval(nut[x].substring(29,33)))*cosd(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega);
370
+ }
371
+
372
+ //Corrections (Herring, 1987)
373
+ /*
374
+ var corr = new Array(4);
375
+ corr[0] = " 0 0 0 0 1-725 417 213 224 ";
376
+ corr[1] = " 0 1 0 0 0 523 61 208 -24 ";
377
+ corr[2] = " 0 0 2-2 2 102-118 -41 -47 ";
378
+ corr[3] = " 0 0 2 0 2 -81 0 32 0 ";
379
+
380
+ for (x=0; x<4; x++)
381
+ {
382
+ fMm = eval(corr[x].substring(0,2));
383
+ fM = eval(corr[x].substring(2,4));
384
+ fF = eval(corr[x].substring(4,6));
385
+ fD = eval(corr[x].substring(6,8));
386
+ f_omega = eval(corr[x].substring(8,10));
387
+ dp += 0.1*(eval(corr[x].substring(10,14))*sind(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega)+eval(corr[x].substring(14,18))*cosd(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega));
388
+ de += 0.1*(eval(corr[x].substring(18,22))*cosd(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega)+eval(corr[x].substring(22,26))*sind(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega));
389
+ }
390
+ */
391
+
392
+ //Nutation in longitude
393
+ delta_psi = dp/36000000;
394
+
395
+ //Nutation in obliquity
396
+ delta_eps = de/36000000;
397
+
398
+ //Mean obliquity of the ecliptic
399
+ eps0 = (84381.448-46.815*TE-0.00059*TE2+0.001813*TE3)/3600;
400
+
401
+ //True obliquity of the ecliptic
402
+ eps = eps0+delta_eps;
403
+ }
404
+
405
+
406
+ //GHA Aries, GAST, GMST, equation of the equinoxes
407
+ function Aries()
408
+ {
409
+ //Mean GHA Aries
410
+ var GHAAmean = norm_360_deg(280.46061837+ 360.98564736629*(JD-2451545)+0.000387933*T2-T3/38710000);
411
+ ARIESmean = GHAAmean;
412
+ //GMST
413
+ SidTm = OutSidTime(GHAAmean);
414
+
415
+ //True GHA Aries
416
+ GHAAtrue = norm_360_deg(GHAAmean+delta_psi*cosd(eps));
417
+
418
+ //GAST
419
+ SidTa = OutSidTime(GHAAtrue);
420
+
421
+ //Equation of the equinoxes
422
+ EoE = 240*delta_psi*cosd(eps);
423
+ EoE = delta_psi*cosd(eps);
424
+ EoEout = Math.round(1000*EoE)/1000;
425
+ EoEout = " "+EoEout+"s";
426
+ }
427
+
428
+
429
+ //Calculations for the sun
430
+ function Sun()
431
+ {
432
+ with(Math)
433
+ {
434
+ //Periodic terms for the sun
435
+
436
+ //Longitude
437
+ var L0=175347046;
438
+ L0+=3341656*cos(4.6692568+6283.0758500*Tau);
439
+ L0+=34894*cos(4.62610+12566.15170*Tau);
440
+ L0+=3497*cos(2.7441+5753.3849*Tau);
441
+ L0+=3418*cos(2.8289+3.5231*Tau);
442
+ L0+=3136*cos(3.6277+77713.7715*Tau);
443
+ L0+=2676*cos(4.4181+7860.4194*Tau);
444
+ L0+=2343*cos(6.1352+3930.2097*Tau);
445
+ L0+=1324*cos(0.7425+11506.7698*Tau);
446
+ L0+=1273*cos(2.0371+529.6910*Tau);
447
+
448
+ L0+=1199*cos(1.1096+1577.3435*Tau);
449
+ L0+=990*cos(5.233+5884.927*Tau);
450
+ L0+=902*cos(2.045+26.298*Tau);
451
+ L0+=857*cos(3.508+398.149*Tau);
452
+ L0+=780*cos(1.179+5223.694*Tau);
453
+ L0+=753*cos(2.533+5507.553*Tau);
454
+ L0+=505*cos(4.583+18849.228*Tau);
455
+ L0+=492*cos(4.205+775.523*Tau);
456
+ L0+=357*cos(2.920+0.067*Tau);
457
+ L0+=317*cos(5.849+11790.629*Tau);
458
+
459
+ L0+=284*cos(1.899+796.298*Tau);
460
+ L0+=271*cos(0.315+10977.079*Tau);
461
+ L0+=243*cos(0.345+5486.778*Tau);
462
+ L0+=206*cos(4.806+2544.314*Tau);
463
+ L0+=205*cos(1.869+5573.143*Tau);
464
+ L0+=202*cos(2.458+6069.777*Tau);
465
+ L0+=156*cos(0.833+213.299*Tau);
466
+ L0+=132*cos(3.411+2942.463*Tau);
467
+ L0+=126*cos(1.083+20.775*Tau);
468
+ L0+=115*cos(0.645+0.980*Tau);
469
+
470
+ L0+=103*cos(0.636+4694.003*Tau);
471
+ L0+=102*cos(0.976+15720.839*Tau);
472
+ L0+=102*cos(4.267+7.114*Tau);
473
+ L0+=99*cos(6.21+2146.17*Tau);
474
+ L0+=98*cos(0.68+155.42*Tau);
475
+ L0+=86*cos(5.98+161000.69*Tau);
476
+ L0+=85*cos(1.30+6275.96*Tau);
477
+ L0+=85*cos(3.67+71430.70*Tau);
478
+ L0+=80*cos(1.81+17260.15*Tau);
479
+ L0+=79*cos(3.04+12036.46*Tau);
480
+
481
+ L0+=75*cos(1.76+5088.63*Tau);
482
+ L0+=74*cos(3.50+3154.69*Tau);
483
+ L0+=74*cos(4.68+801.82*Tau);
484
+ L0+=70*cos(0.83+9437.76*Tau);
485
+ L0+=62*cos(3.98+8827.39*Tau);
486
+ L0+=61*cos(1.82+7084.90*Tau);
487
+ L0+=57*cos(2.78+6286.60*Tau);
488
+ L0+=56*cos(4.39+14143.50*Tau);
489
+ L0+=56*cos(3.47+6279.55*Tau);
490
+ L0+=52*cos(0.19+12139.55*Tau);
491
+
492
+ L0+=52*cos(1.33+1748.02*Tau);
493
+ L0+=51*cos(0.28+5856.48*Tau);
494
+ L0+=49*cos(0.49+1194.45*Tau);
495
+ L0+=41*cos(5.37+8429.24*Tau);
496
+ L0+=41*cos(2.40+19651.05*Tau);
497
+ L0+=39*cos(6.17+10447.39*Tau);
498
+ L0+=37*cos(6.04+10213.29*Tau);
499
+ L0+=37*cos(2.57+1059.38*Tau);
500
+ L0+=36*cos(1.71+2352.87*Tau);
501
+ L0+=36*cos(1.78+6812.77*Tau);
502
+
503
+ L0+=33*cos(0.59+17789.85*Tau);
504
+ L0+=30*cos(0.44+83996.85*Tau);
505
+ L0+=30*cos(2.74+1349.87*Tau);
506
+ L0+=25*cos(3.16+4690.48*Tau);
507
+
508
+
509
+ var L1=628331966747;
510
+ L1+=206059*cos(2.678235+6283.075850*Tau);
511
+ L1+=4303*cos(2.6351+12566.1517*Tau);
512
+ L1+=425*cos(1.590+3.523*Tau);
513
+ L1+=119*cos(5.796+26.298*Tau);
514
+ L1+=109*cos(2.966+1577.344*Tau);
515
+ L1+=93*cos(2.59+18849.23*Tau);
516
+ L1+=72*cos(1.14+529.69*Tau);
517
+ L1+=68*cos(1.87+398.15*Tau);
518
+ L1+=67*cos(4.41+5507.55*Tau);
519
+
520
+ L1+=59*cos(2.89+5223.69*Tau);
521
+ L1+=56*cos(2.17+155.42*Tau);
522
+ L1+=45*cos(0.40+796.30*Tau);
523
+ L1+=36*cos(0.47+775.52*Tau);
524
+ L1+=29*cos(2.65+7.11*Tau);
525
+ L1+=21*cos(5.34+0.98*Tau);
526
+ L1+=19*cos(1.85+5486.78*Tau);
527
+ L1+=19*cos(4.97+213.30*Tau);
528
+ L1+=17*cos(2.99+6275.96*Tau);
529
+ L1+=16*cos(0.03+2544.31*Tau);
530
+
531
+ L1+=16*cos(1.43+2146.17*Tau);
532
+ L1+=15*cos(1.21+10977.08*Tau);
533
+ L1+=12*cos(2.83+1748.02*Tau);
534
+ L1+=12*cos(3.26+5088.63*Tau);
535
+ L1+=12*cos(5.27+1194.45*Tau);
536
+ L1+=12*cos(2.08+4694.00*Tau);
537
+ L1+=11*cos(0.77+553.57*Tau);
538
+ L1+=10*cos(1.30+6286.60*Tau);
539
+ L1+=10*cos(4.24+1349.87*Tau);
540
+ L1+=9*cos(2.70+242.73*Tau);
541
+
542
+ L1+=9*cos(5.64+951.72*Tau);
543
+ L1+=8*cos(5.30+2352.87*Tau);
544
+ L1+=6*cos(2.65+9437.76*Tau);
545
+ L1+=6*cos(4.67+4690.48*Tau);
546
+
547
+
548
+ var L2=52919;
549
+ L2+=8720*cos(1.0721+6283.0758*Tau);
550
+ L2+=309*cos(0.867+12566.152*Tau);
551
+ L2+=27*cos(0.05+3.52*Tau);
552
+ L2+=16*cos(5.19+26.30*Tau);
553
+ L2+=16*cos(3.68+155.42*Tau);
554
+ L2+=10*cos(0.76+18849.23*Tau);
555
+ L2+=9*cos(2.06+77713.77*Tau);
556
+ L2+=7*cos(0.83+775.52*Tau);
557
+ L2+=5*cos(4.66+1577.34*Tau);
558
+
559
+ L2+=4*cos(1.03+7.11*Tau);
560
+ L2+=4*cos(3.44+5573.14*Tau);
561
+ L2+=3*cos(5.14+796.30*Tau);
562
+ L2+=3*cos(6.05+5507.55*Tau);
563
+ L2+=3*cos(1.19+242.73*Tau);
564
+ L2+=3*cos(6.12+529.69*Tau);
565
+ L2+=3*cos(0.31+398.15*Tau);
566
+ L2+=3*cos(2.28+553.57*Tau);
567
+ L2+=2*cos(4.38+5223.69*Tau);
568
+ L2+=2*cos(3.75+0.98*Tau);
569
+
570
+
571
+ var L3=289*cos(5.844+6283.076*Tau);
572
+ L3+=35;
573
+ L3+=17*cos(5.49+12566.15*Tau);
574
+ L3+=3*cos(5.20+155.42*Tau);
575
+ L3+=1*cos(4.72+3.52*Tau);
576
+ L3+=1*cos(5.30+18849.23*Tau);
577
+ L3+=1*cos(5.97+242.73*Tau);
578
+
579
+
580
+ var L4=114*cos(3.142);
581
+ L4+=8*cos(4.13+6283.08*Tau);
582
+ L4+=1*cos(3.84+12566.15*Tau);
583
+
584
+
585
+ var L5 = 1*cos(3.14);
586
+
587
+ //Mean longitude of the sun
588
+ var Lsun_mean = norm_360_deg(280.4664567+360007.6982779*Tau+0.03032028*Tau2+Tau3/49931-Tau4/15299-Tau5/1988000);
589
+ SunML = Lsun_mean
590
+
591
+ //Heliocentric longitude
592
+ var Lhelioc = norm_360_deg((L0+L1*Tau+L2*Tau2+L3*Tau3+L4*Tau4+L5*Tau5)/1e8/dtr);
593
+ Hlon = Lhelioc
594
+
595
+ //Geocentric longitude
596
+ Lsun_true = norm_360_deg(Lhelioc+180-0.000025);
597
+
598
+ //Latitude
599
+ var B0=280*cos(3.199+84334.662*Tau);
600
+ B0+=102*cos(5.422+5507.553*Tau);
601
+ B0+=80*cos(3.88+5223.69*Tau);
602
+ B0+=44*cos(3.70+2352.87*Tau);
603
+ B0+=32*cos(4.00+1577.34*Tau);
604
+
605
+ var B1=9*cos(3.90+5507.55*Tau);
606
+ B1+=6*cos(1.73+5223.69*Tau);
607
+
608
+ //Heliocentric latitude
609
+ var B = (B0+B1*Tau)/1e8/dtr;
610
+ Hlat = B;
611
+
612
+ //Geocentric latitude
613
+ var beta = norm_360_deg(-B);
614
+ Glat = beta
615
+
616
+ //Corrections
617
+ Lsun_prime = norm_360_deg(Lhelioc+180-1.397*TE-0.00031*TE2);
618
+
619
+ beta = beta+0.000011*(cosd(Lsun_prime)-sind(Lsun_prime));
620
+
621
+
622
+ //Distance earth-sun
623
+ var R0=100013989;
624
+ R0+=1670700*cos(3.0984635+6283.0758500*Tau);
625
+ R0+=13956*cos(3.05525+12566.15170*Tau);
626
+ R0+=3084*cos(5.1985+77713.7715*Tau);
627
+ R0+=1628*cos(1.1739+5753.3849*Tau);
628
+ R0+=1576*cos(2.8469+7860.4194*Tau);
629
+ R0+=925*cos(5.453+11506.770*Tau);
630
+ R0+=542*cos(4.564+3930.210*Tau);
631
+ R0+=472*cos(3.661+5884.927*Tau);
632
+ R0+=346*cos(0.964+5507.553*Tau);
633
+
634
+ R0+=329*cos(5.900+5223.694*Tau);
635
+ R0+=307*cos(0.299+5573.143*Tau);
636
+ R0+=243*cos(4.273+11790.629*Tau);
637
+ R0+=212*cos(5.847+1577.344*Tau);
638
+ R0+=186*cos(5.022+10977.079*Tau);
639
+ R0+=175*cos(3.012+18849.228*Tau);
640
+ R0+=110*cos(5.055+5486.778*Tau);
641
+ R0+=98*cos(0.89+6069.78*Tau);
642
+ R0+=86*cos(5.69+15720.84*Tau);
643
+ R0+=86*cos(1.27+161000.69*Tau);
644
+
645
+ R0+=65*cos(0.27+17260.15*Tau);
646
+ R0+=63*cos(0.92+529.69*Tau);
647
+ R0+=57*cos(2.01+83996.85*Tau);
648
+ R0+=56*cos(5.24+71430.70*Tau);
649
+ R0+=49*cos(3.25+2544.31*Tau);
650
+ R0+=47*cos(2.58+775.52*Tau);
651
+ R0+=45*cos(5.54+9437.76*Tau);
652
+ R0+=43*cos(6.01+6275.96*Tau);
653
+ R0+=39*cos(5.36+4694.00*Tau);
654
+ R0+=38*cos(2.39+8827.39*Tau);
655
+
656
+ R0+=37*cos(0.83+19651.05*Tau);
657
+ R0+=37*cos(4.90+12139.55*Tau);
658
+ R0+=36*cos(1.67+12036.46*Tau);
659
+ R0+=35*cos(1.84+2942.46*Tau);
660
+ R0+=33*cos(0.24+7084.90*Tau);
661
+ R0+=32*cos(0.18+5088.63*Tau);
662
+ R0+=32*cos(1.78+398.15*Tau);
663
+ R0+=28*cos(1.21+6286.60*Tau);
664
+ R0+=28*cos(1.90+6279.55*Tau);
665
+ R0+=26*cos(4.59+10447.39*Tau);
666
+
667
+
668
+ var R1=103019*cos(1.107490+6283.075850*Tau);
669
+ R1+=1721*cos(1.0644+12566.1517*Tau);
670
+ R1+=702*cos(3.142);
671
+ R1+=32*cos(1.02+18849.23*Tau);
672
+ R1+=31*cos(2.84+5507.55*Tau);
673
+ R1+=25*cos(1.32+5223.69*Tau);
674
+ R1+=18*cos(1.42+1577.34*Tau);
675
+ R1+=10*cos(5.91+10977.08*Tau);
676
+ R1+=9*cos(1.42+6275.96*Tau);
677
+ R1+=9*cos(0.27+5486.78*Tau);
678
+
679
+
680
+ var R2=4359*cos(5.7846+6283.0758*Tau);
681
+ R2+=124*cos(5.579+12566.152*Tau);
682
+ R2+=12*cos(3.14);
683
+ R2+=9*cos(3.63+77713.77*Tau);
684
+ R2+=6*cos(1.87+5573.14*Tau);
685
+ R2+=3*cos(5.47+18849.23*Tau);
686
+
687
+
688
+ var R3=145*cos(4.273+6283.076*Tau);
689
+ R3+=7*cos(3.92+12566.15*Tau);
690
+
691
+
692
+ var R4 = 4*cos(2.56+6283.08*Tau);
693
+
694
+ R = (R0+R1*Tau+R2*Tau2+R3*Tau3+R4*Tau4)/1e8;
695
+
696
+
697
+ //Apparent longitude of the sun
698
+ lambda = norm_360_deg(Lsun_true+delta_psi-0.005691611/R);
699
+
700
+ //Right ascension of the sun, apparent
701
+ RAsun = norm_360_deg(atan2((sind(lambda)*cosd(eps)-tand(beta)*sind(eps)),cosd(lambda))/dtr);
702
+
703
+ //Sidereal hour angle of the sun, apparent
704
+ SHAsun = 360-RAsun;
705
+
706
+ //Declination of the sun, apparent
707
+ DECsun = asin(sind(beta)*cosd(eps)+cosd(beta)*sind(eps)*sind(lambda))/dtr;
708
+ Dsun = DECsun;
709
+
710
+ //GHA of the sun
711
+ GHAsun = norm_360_deg(GHAAtrue-RAsun);
712
+
713
+ //Semidiameter of the sun
714
+ SDsun = 959.63/R;
715
+
716
+ //Horizontal parallax of the sun
717
+ HPsun = 8.794/R;
718
+
719
+ //Equation of time
720
+ //EOT = 4*(Lsun_mean-0.0057183-0.0008-RAsun+delta_psi*cosd(eps));
721
+ Eot = 4*GHAsun+720-1440*dayfraction;
722
+ if (Eot>20) Eot-=1440;
723
+ if (Eot<-20) Eot+=1440;
724
+ }
725
+ }
726
+
727
+
728
+ //Calculation of ephemerides for the moon
729
+ function Moon()
730
+ {
731
+ with (Math)
732
+ {
733
+ // Mean longitude of the moon
734
+ Lmoon_mean = norm_360_deg(218.3164591+481267.88134236*TE-0.0013268*TE2+TE3/538841-TE4/65194000);
735
+
736
+ //Mean elongation of the moon
737
+ D = norm_360_deg(297.8502042+445267.1115168*TE-0.00163*TE2+TE3/545868-TE4/113065000);
738
+
739
+ // Mean anomaly of the sun
740
+ Msun_mean = norm_360_deg(357.5291092+35999.0502909*TE-0.0001536*TE2+TE3/24490000);
741
+
742
+ //Mean anomaly of the moon
743
+ Mmoon_mean = norm_360_deg(134.9634114+477198.8676313*TE+0.008997*TE2+TE3/69699-TE4/14712000);
744
+
745
+ //Mean distance of the moon from her ascending node
746
+ F = norm_360_deg(93.2720993+483202.0175273*TE-0.0034029*TE2-TE3/3526000+TE4/863310000);
747
+
748
+ //Corrections
749
+ A1 =119.75+131.849*TE;
750
+ A1 = 360*(A1/360 - floor(A1/360));
751
+ A2 = 53.09+479264.29*TE;
752
+ A2 = 360*(A2/360 - floor(A2/360));
753
+ A3 = 313.45+481266.484*TE;
754
+ A3 = 360*(A3/360 - floor(A3/360));
755
+
756
+ fE = 1-0.002516*TE-0.0000074*TE2;
757
+ fE2 = fE*fE;
758
+
759
+
760
+ //Periodic terms for the moon
761
+
762
+ //Longitude and distance
763
+ fD = new Array(60);
764
+ fMms = new Array(60);
765
+ fMmm = new Array(60);
766
+ fF = new Array(60);
767
+ coeffs = new Array(60);
768
+ coeffc = new Array(60);
769
+
770
+ fD[0]=0; fMms[0]=0; fMmm[0]=1; fF[0]=0; coeffs[0]=6288774; coeffc[0]=-20905355;
771
+ fD[1]=2; fMms[1]=0; fMmm[1]=-1; fF[1]=0; coeffs[1]=1274027; coeffc[1]=-3699111;
772
+ fD[2]=2; fMms[2]=0; fMmm[2]=0; fF[2]=0; coeffs[2]=658314; coeffc[2]=-2955968;
773
+ fD[3]=0; fMms[3]=0; fMmm[3]=2; fF[3]=0; coeffs[3]=213618; coeffc[3]=-569925;
774
+ fD[4]=0; fMms[4]=1; fMmm[4]=0; fF[4]=0; coeffs[4]=-185116; coeffc[4]=48888;
775
+ fD[5]=0; fMms[5]=0; fMmm[5]=0; fF[5]=2; coeffs[5]=-114332; coeffc[5]=-3149;
776
+ fD[6]=2; fMms[6]=0; fMmm[6]=-2; fF[6]=0; coeffs[6]=58793; coeffc[6]=246158;
777
+ fD[7]=2; fMms[7]=-1; fMmm[7]=-1; fF[7]=0; coeffs[7]=57066; coeffc[7]=-152138;
778
+ fD[8]=2; fMms[8]=0; fMmm[8]=1; fF[8]=0; coeffs[8]=53322; coeffc[8]=-170733;
779
+ fD[9]=2; fMms[9]=-1; fMmm[9]=0; fF[9]=0; coeffs[9]=45758; coeffc[9]=-204586;
780
+
781
+ fD[10]=0; fMms[10]=1; fMmm[10]=-1; fF[10]=0; coeffs[10]=-40923; coeffc[10]=-129620;
782
+ fD[11]=1; fMms[11]=0; fMmm[11]=0; fF[11]=0; coeffs[11]=-34720; coeffc[11]=108743;
783
+ fD[12]=0; fMms[12]=1; fMmm[12]=1; fF[12]=0; coeffs[12]=-30383; coeffc[12]=104755;
784
+ fD[13]=2; fMms[13]=0; fMmm[13]=0; fF[13]=-2; coeffs[13]=15327; coeffc[13]=10321;
785
+ fD[14]=0; fMms[14]=0; fMmm[14]=1; fF[14]=2; coeffs[14]=-12528; coeffc[14]=0;
786
+ fD[15]=0; fMms[15]=0; fMmm[15]=1; fF[15]=-2; coeffs[15]=10980; coeffc[15]=79661;
787
+ fD[16]=4; fMms[16]=0; fMmm[16]=-1; fF[16]=0; coeffs[16]=10675; coeffc[16]=-34782;
788
+ fD[17]=0; fMms[17]=0; fMmm[17]=3; fF[17]=0; coeffs[17]=10034; coeffc[17]=-23210;
789
+ fD[18]=4; fMms[18]=0; fMmm[18]=-2; fF[18]=0; coeffs[18]=8548; coeffc[18]=-21636;
790
+ fD[19]=2; fMms[19]=1; fMmm[19]=-1; fF[19]=0; coeffs[19]=-7888; coeffc[19]=24208;
791
+
792
+ fD[20]=2; fMms[20]=1; fMmm[20]=0; fF[20]=0; coeffs[20]=-6766; coeffc[20]=30824;
793
+ fD[21]=1; fMms[21]=0; fMmm[21]=-1; fF[21]=0; coeffs[21]=-5163; coeffc[21]=-8379;
794
+ fD[22]=1; fMms[22]=1; fMmm[22]=0; fF[22]=0; coeffs[22]=4987; coeffc[22]=-16675;
795
+ fD[23]=2; fMms[23]=-1; fMmm[23]=1; fF[23]=0; coeffs[23]=4036; coeffc[23]=-12831;
796
+ fD[24]=2; fMms[24]=0; fMmm[24]=2; fF[24]=0; coeffs[24]=3994; coeffc[24]=-10445;
797
+ fD[25]=4; fMms[25]=0; fMmm[25]=0; fF[25]=0; coeffs[25]=3861; coeffc[25]=-11650;
798
+ fD[26]=2; fMms[26]=0; fMmm[26]=-3; fF[26]=0; coeffs[26]=3665; coeffc[26]=14403;
799
+ fD[27]=0; fMms[27]=1; fMmm[27]=-2; fF[27]=0; coeffs[27]=-2689; coeffc[27]=-7003;
800
+ fD[28]=2; fMms[28]=0; fMmm[28]=-1; fF[28]=2; coeffs[28]=-2602; coeffc[28]=0;
801
+ fD[29]=2; fMms[29]=-1; fMmm[29]=-2; fF[29]=0; coeffs[29]=2390; coeffc[29]=10056;
802
+
803
+ fD[30]=1; fMms[30]=0; fMmm[30]=1; fF[30]=0; coeffs[30]=-2348; coeffc[30]=6322;
804
+ fD[31]=2; fMms[31]=-2; fMmm[31]=0; fF[31]=0; coeffs[31]=2236; coeffc[31]=-9884;
805
+ fD[32]=0; fMms[32]=1; fMmm[32]=2; fF[32]=0; coeffs[32]=-2120; coeffc[32]=5751;
806
+ fD[33]=0; fMms[33]=2; fMmm[33]=0; fF[33]=0; coeffs[33]=-2069; coeffc[33]=0;
807
+ fD[34]=2; fMms[34]=-2; fMmm[34]=-1; fF[34]=0; coeffs[34]=2048; coeffc[34]=-4950;
808
+ fD[35]=2; fMms[35]=0; fMmm[35]=1; fF[35]=-2; coeffs[35]=-1773; coeffc[35]=4130;
809
+ fD[36]=2; fMms[36]=0; fMmm[36]=0; fF[36]=2; coeffs[36]=-1595; coeffc[36]=0;
810
+ fD[37]=4; fMms[37]=-1; fMmm[37]=-1; fF[37]=0; coeffs[37]=1215; coeffc[37]=-3958;
811
+ fD[38]=0; fMms[38]=0; fMmm[38]=2; fF[38]=2; coeffs[38]=-1110; coeffc[38]=0;
812
+ fD[39]=3; fMms[39]=0; fMmm[39]=-1; fF[39]=0; coeffs[39]=-892; coeffc[39]=3258;
813
+
814
+ fD[40]=2; fMms[40]=1; fMmm[40]=1; fF[40]=0; coeffs[40]=-810; coeffc[40]=2616;
815
+ fD[41]=4; fMms[41]=-1; fMmm[41]=-2; fF[41]=0; coeffs[41]=759; coeffc[41]=-1897;
816
+ fD[42]=0; fMms[42]=2; fMmm[42]=-1; fF[42]=0; coeffs[42]=-713; coeffc[42]=-2117;
817
+ fD[43]=2; fMms[43]=2; fMmm[43]=-1; fF[43]=0; coeffs[43]=-700; coeffc[43]=2354;
818
+ fD[44]=2; fMms[44]=1; fMmm[44]=-2; fF[44]=0; coeffs[44]=691; coeffc[44]=0;
819
+ fD[45]=2; fMms[45]=-1; fMmm[45]=0; fF[45]=-2; coeffs[45]=596; coeffc[45]=0;
820
+ fD[46]=4; fMms[46]=0; fMmm[46]=1; fF[46]=0; coeffs[46]=549; coeffc[46]=-1423;
821
+ fD[47]=0; fMms[47]=0; fMmm[47]=4; fF[47]=0; coeffs[47]=537; coeffc[47]=-1117;
822
+ fD[48]=4; fMms[48]=-1; fMmm[48]=0; fF[48]=0; coeffs[48]=520; coeffc[48]=-1571;
823
+ fD[49]=1; fMms[49]=0; fMmm[49]=-2; fF[49]=0; coeffs[49]=-487; coeffc[49]=-1739;
824
+
825
+ fD[50]=2; fMms[50]=1; fMmm[50]=0; fF[50]=-2; coeffs[50]=-399; coeffc[50]=0;
826
+ fD[51]=0; fMms[51]=0; fMmm[51]=2; fF[51]=-2; coeffs[51]=-381; coeffc[51]=-4421;
827
+ fD[52]=1; fMms[52]=1; fMmm[52]=1; fF[52]=0; coeffs[52]=351; coeffc[52]=0;
828
+ fD[53]=3; fMms[53]=0; fMmm[53]=-2; fF[53]=0; coeffs[53]=-340; coeffc[53]=0;
829
+ fD[54]=4; fMms[54]=0; fMmm[54]=-3; fF[54]=0; coeffs[54]=330; coeffc[54]=0;
830
+ fD[55]=2; fMms[55]=-1; fMmm[55]=2; fF[55]=0; coeffs[55]=327; coeffc[55]=0;
831
+ fD[56]=0; fMms[56]=2; fMmm[56]=1; fF[56]=0; coeffs[56]=-323; coeffc[56]=1165;
832
+ fD[57]=1; fMms[57]=1; fMmm[57]=-1; fF[57]=0; coeffs[57]=299; coeffc[57]=0;
833
+ fD[58]=2; fMms[58]=0; fMmm[58]=3; fF[58]=0; coeffs[58]=294; coeffc[58]=0;
834
+ fD[59]=2; fMms[59]=0; fMmm[59]=-1; fF[59]=-2; coeffs[59]=0; coeffc[59]=8752;
835
+
836
+ //Latitude
837
+ fD2 = new Array(60);
838
+ fMms2= new Array(60);
839
+ fMmm2 = new Array(60);
840
+ fF2 = new Array(60);
841
+ coeffs2 = new Array(60);
842
+
843
+ fD2[0]=0; fMms2[0]=0; fMmm2[0]=0; fF2[0]=1; coeffs2[0]=5128122;
844
+ fD2[1]=0; fMms2[1]=0; fMmm2[1]=1; fF2[1]=1; coeffs2[1]=280602;
845
+ fD2[2]=0; fMms2[2]=0; fMmm2[2]=1; fF2[2]=-1; coeffs2[2]=277693;
846
+ fD2[3]=2; fMms2[3]=0; fMmm2[3]=0; fF2[3]=-1; coeffs2[3]=173237;
847
+ fD2[4]=2; fMms2[4]=0; fMmm2[4]=-1; fF2[4]=1; coeffs2[4]=55413;
848
+ fD2[5]=2; fMms2[5]=0; fMmm2[5]=-1; fF2[5]=-1; coeffs2[5]=46271;
849
+ fD2[6]=2; fMms2[6]=0; fMmm2[6]=0; fF2[6]=1; coeffs2[6]=32573;
850
+ fD2[7]=0; fMms2[7]=0; fMmm2[7]=2; fF2[7]=1; coeffs2[7]=17198;
851
+ fD2[8]=2; fMms2[8]=0; fMmm2[8]=1; fF2[8]=-1; coeffs2[8]=9266;
852
+ fD2[9]=0; fMms2[9]=0; fMmm2[9]=2; fF2[9]=-1; coeffs2[9]=8822;
853
+
854
+ fD2[10]=2; fMms2[10]=-1; fMmm2[10]=0; fF2[10]=-1; coeffs2[10]=8216;
855
+ fD2[11]=2; fMms2[11]=0; fMmm2[11]=-2; fF2[11]=-1; coeffs2[11]=4324;
856
+ fD2[12]=2; fMms2[12]=0; fMmm2[12]=1; fF2[12]=1; coeffs2[12]=4200;
857
+ fD2[13]=2; fMms2[13]=1; fMmm2[13]=0; fF2[13]=-1; coeffs2[13]=-3359;
858
+ fD2[14]=2; fMms2[14]=-1; fMmm2[14]=-1; fF2[14]=1; coeffs2[14]=2463;
859
+ fD2[15]=2; fMms2[15]=-1; fMmm2[15]=0; fF2[15]=1; coeffs2[15]=2211;
860
+ fD2[16]=2; fMms2[16]=-1; fMmm2[16]=-1; fF2[16]=-1; coeffs2[16]=2065;
861
+ fD2[17]=0; fMms2[17]=1; fMmm2[17]=-1; fF2[17]=-1; coeffs2[17]=-1870;
862
+ fD2[18]=4; fMms2[18]=0; fMmm2[18]=-1; fF2[18]=-1; coeffs2[18]=1828;
863
+ fD2[19]=0; fMms2[19]=1; fMmm2[19]=0; fF2[19]=1; coeffs2[19]=-1794;
864
+
865
+ fD2[20]=0; fMms2[20]=0; fMmm2[20]=0; fF2[20]=3; coeffs2[20]=-1749;
866
+ fD2[21]=0; fMms2[21]=1; fMmm2[21]=-1; fF2[21]=1; coeffs2[21]=-1565;
867
+ fD2[22]=1; fMms2[22]=0; fMmm2[22]=0; fF2[22]=1; coeffs2[22]=-1491;
868
+ fD2[23]=0; fMms2[23]=1; fMmm2[23]=1; fF2[23]=1; coeffs2[23]=-1475;
869
+ fD2[24]=0; fMms2[24]=1; fMmm2[24]=1; fF2[24]=-1; coeffs2[24]=-1410;
870
+ fD2[25]=0; fMms2[25]=1; fMmm2[25]=0; fF2[25]=-1; coeffs2[25]=-1344;
871
+ fD2[26]=1; fMms2[26]=0; fMmm2[26]=0; fF2[26]=-1; coeffs2[26]=-1335;
872
+ fD2[27]=0; fMms2[27]=0; fMmm2[27]=3; fF2[27]=1; coeffs2[27]=1107;
873
+ fD2[28]=4; fMms2[28]=0; fMmm2[28]=0; fF2[28]=-1; coeffs2[28]=1021;
874
+ fD2[29]=4; fMms2[29]=0; fMmm2[29]=-1; fF2[29]=1; coeffs2[29]=833;
875
+
876
+ fD2[30]=0; fMms2[30]=0; fMmm2[30]=1; fF2[30]=-3; coeffs2[30]=777;
877
+ fD2[31]=4; fMms2[31]=0; fMmm2[31]=-2; fF2[31]=1; coeffs2[31]=671;
878
+ fD2[32]=2; fMms2[32]=0; fMmm2[32]=0; fF2[32]=-3; coeffs2[32]=607;
879
+ fD2[33]=2; fMms2[33]=0; fMmm2[33]=2; fF2[33]=-1; coeffs2[33]=596;
880
+ fD2[34]=2; fMms2[34]=-1; fMmm2[34]=1; fF2[34]=-1; coeffs2[34]=491;
881
+ fD2[35]=2; fMms2[35]=0; fMmm2[35]=-2; fF2[35]=1; coeffs2[35]=-451;
882
+ fD2[36]=0; fMms2[36]=0; fMmm2[36]=3; fF2[36]=-1; coeffs2[36]=439;
883
+ fD2[37]=2; fMms2[37]=0; fMmm2[37]=2; fF2[37]=1; coeffs2[37]=422;
884
+ fD2[38]=2; fMms2[38]=0; fMmm2[38]=-3; fF2[38]=-1; coeffs2[38]=421;
885
+ fD2[39]=2; fMms2[39]=1; fMmm2[39]=-1; fF2[39]=1; coeffs2[39]=-366;
886
+
887
+ fD2[40]=2; fMms2[40]=1; fMmm2[40]=0; fF2[40]=1; coeffs2[40]=-351;
888
+ fD2[41]=4; fMms2[41]=0; fMmm2[41]=0; fF2[41]=1; coeffs2[41]=331;
889
+ fD2[42]=2; fMms2[42]=-1; fMmm2[42]=1; fF2[42]=1; coeffs2[42]=315;
890
+ fD2[43]=2; fMms2[43]=-2; fMmm2[43]=0; fF2[43]=-1; coeffs2[43]=302;
891
+ fD2[44]=0; fMms2[44]=0; fMmm2[44]=1; fF2[44]=3; coeffs2[44]=-283;
892
+ fD2[45]=2; fMms2[45]=1; fMmm2[45]=1; fF2[45]=-1; coeffs2[45]=-229;
893
+ fD2[46]=1; fMms2[46]=1; fMmm2[46]=0; fF2[46]=-1; coeffs2[46]=223;
894
+ fD2[47]=1; fMms2[47]=1; fMmm2[47]=0; fF2[47]=1; coeffs2[47]=223;
895
+ fD2[48]=0; fMms2[48]=1; fMmm2[48]=-2; fF2[48]=-1; coeffs2[48]=-220;
896
+ fD2[49]=2; fMms2[49]=1; fMmm2[49]=-1; fF2[49]=-1; coeffs2[49]=-220;
897
+
898
+ fD2[50]=1; fMms2[50]=0; fMmm2[50]=1; fF2[50]=1; coeffs2[50]=-185;
899
+ fD2[51]=2; fMms2[51]=-1; fMmm2[51]=-2; fF2[51]=-1; coeffs2[51]=181;
900
+ fD2[52]=0; fMms2[52]=1; fMmm2[52]=2; fF2[52]=1; coeffs2[52]=-177;
901
+ fD2[53]=4; fMms2[53]=0; fMmm2[53]=-2; fF2[53]=-1; coeffs2[53]=176;
902
+ fD2[54]=4; fMms2[54]=-1; fMmm2[54]=-1; fF2[54]=-1; coeffs2[54]=166;
903
+ fD2[55]=1; fMms2[55]=0; fMmm2[55]=1; fF2[55]=-1; coeffs2[55]=-164;
904
+ fD2[56]=4; fMms2[56]=0; fMmm2[56]=1; fF2[56]=-1; coeffs2[56]=132;
905
+ fD2[57]=1; fMms2[57]=0; fMmm2[57]=-1; fF2[57]=-1; coeffs2[57]=-119;
906
+ fD2[58]=4; fMms2[58]=-1; fMmm2[58]=0; fF2[58]=-1; coeffs2[58]=115;
907
+ fD2[59]=2; fMms2[59]=-2; fMmm2[59]=0; fF2[59]=1; coeffs2[59]=107;
908
+
909
+
910
+ var sumL = 0; var sumr = 0; var sumB = 0;
911
+
912
+ for (x=0; x<60; x++)
913
+ {
914
+ var f = 1;
915
+ if(abs(fMms[x])==1) f=fE;
916
+ if(abs(fMms[x])==2) f=fE2;
917
+ sumL += f*(coeffs[x]*sind(fD[x]*D+fMms[x]*Msun_mean+fMmm[x]*Mmoon_mean+fF[x]*F));
918
+ sumr += f*(coeffc[x]*cosd(fD[x]*D+fMms[x]*Msun_mean+fMmm[x]*Mmoon_mean+fF[x]*F));
919
+ f = 1;
920
+ if(abs(fMms2[x])==1) f=fE;
921
+ if(abs(fMms2[x])==2) f=fE2;
922
+ sumB += f*(coeffs2[x]*sind(fD2[x]*D+fMms2[x]*Msun_mean+fMmm2[x]*Mmoon_mean+fF2[x]*F));
923
+ }
924
+
925
+ //Corrections
926
+ sumL = sumL+3958*sind(A1)+1962*sind(Lmoon_mean-F)+318*sind(A2);
927
+ sumB = sumB-2235*sind(Lmoon_mean)+382*sind(A3)+175*sind(A1-F)+175*sind(A1+F)+127*sind(Lmoon_mean-Mmoon_mean)-115*sind(Lmoon_mean+Mmoon_mean);
928
+
929
+ //Longitude of the moon
930
+ lambdaMm = norm_360_deg(Lmoon_mean+sumL/1000000);
931
+
932
+ //Latitude of the moon
933
+ betaM = sumB/1000000;
934
+
935
+ //Distance earth-moon
936
+ dEM = 385000.56+sumr/1000;
937
+
938
+ //Apparent longitude of the moon
939
+ lambdaMapp = lambdaMm+delta_psi;
940
+
941
+ //Right ascension of the moon, apparent
942
+ RAmoon = norm_360_deg(atan2((sind(lambdaMapp)*cosd(eps)-tand(betaM)*sind(eps)),cosd(lambdaMapp))/dtr);
943
+
944
+ //Sidereal hour angle of the moon, apparent
945
+ SHAmoon = 360-RAmoon;
946
+
947
+ //Declination of the moon
948
+ DECmoon = asin(sind(betaM)*cosd(eps)+cosd(betaM)*sind(eps)*sind(lambdaMapp))/dtr;
949
+ Dmoon = DECmoon;
950
+
951
+ //GHA of the moon
952
+ GHAmoon = norm_360_deg(GHAAtrue-RAmoon);
953
+
954
+ //Horizontal parallax of the moon
955
+ HPmoon = 3600*asin(6378.14/dEM)/dtr;
956
+
957
+ //Semidiameter of the moon
958
+ SDmoon = 3600*asin(1738/dEM)/dtr;
959
+
960
+ //Geocentric angular distance between moon and sun
961
+ LDist = acos(sind(Dmoon)*sind(Dsun)+cosd(Dmoon)*cosd(Dsun)*cosd(RAmoon-RAsun))/dtr;
962
+
963
+ //Phase of the moon
964
+ var i = lambdaMapp-lambda;
965
+ k = 100*(1-cosd(i))/2;
966
+ k = round(10*k)/10;
967
+ }
968
+ }
969
+
970
+
971
+ //Ephemerides of Polaris
972
+ function Polaris()
973
+ {
974
+ //Equatorial coordinates of Polaris at 2000.0 (mean equinox and equator 2000.0)
975
+ var RApol0 = 37.95293333;
976
+ var DECpol0 = 89.26408889;
977
+
978
+ //Proper motion per year
979
+ var dRApol = 2.98155/3600;
980
+ var dDECpol = -0.0152/3600;
981
+
982
+ //Equatorial coordinates at Julian Date T (mean equinox and equator 2000.0)
983
+ var RApol1 = RApol0+100*TE*dRApol;
984
+ var DECpol1 = DECpol0+100*TE*dDECpol;
985
+
986
+ //Mean obliquity of ecliptic at 2000.0 in degrees
987
+ var eps0_2000 = 23.439291111;
988
+
989
+ //Transformation to ecliptic coordinates in radians (mean equinox and equator 2000.0)
990
+ with(Math)
991
+ {
992
+ var lambdapol1 = atan2((sind(RApol1)*cosd(eps0_2000)+tand(DECpol1)*sind(eps0_2000)),cosd(RApol1));
993
+ var betapol1 = asin(sind(DECpol1)*cosd(eps0_2000)-cosd(DECpol1)*sind(eps0_2000)*sind(RApol1));
994
+ }
995
+
996
+ //Precession
997
+ var eta = (47.0029*TE-0.03302*TE2+0.00006*TE3)*dtr/3600;
998
+ var PI0 = (174.876384-(869.8089*TE+0.03536*TE2)/3600)*dtr;
999
+ var p0 = (5029.0966*TE+1.11113*TE2-0.0000006*TE3)*dtr/3600;
1000
+ with(Math)
1001
+ {
1002
+ var A1 = cos(eta)*cos(betapol1)*sin(PI0-lambdapol1)-sin(eta)*sin(betapol1);
1003
+ var B1 = cos(betapol1)*cos(PI0-lambdapol1);
1004
+ var C1 = cos(eta)*sin(betapol1)+sin(eta)*cos(betapol1)*sin(PI0-lambdapol1);
1005
+ var lambdapol2 = p0+PI0-atan2(A1,B1);
1006
+ var betapol2 = asin(C1);
1007
+ }
1008
+
1009
+ //Nutation in longitude
1010
+ lambdapol2 += dtr*delta_psi;
1011
+
1012
+ //Aberration
1013
+ var kappa = dtr*20.49552/3600;
1014
+ pi0 = dtr*(102.93735+1.71953*TE+0.00046*TE2);
1015
+ var e = 0.016708617-0.000042037*TE-0.0000001236*TE2;
1016
+ with(Math)
1017
+ {
1018
+ dlambdapol = (e*kappa*cos(pi0-lambdapol2)-kappa*cos(dtr*Lsun_true-lambdapol2))/cos(betapol2);
1019
+ dbetapol = -kappa*sin(betapol2)*(sin(dtr*Lsun_true-lambdapol2)-e*sin(pi0-lambdapol2));
1020
+ }
1021
+ lambdapol2 += dlambdapol;
1022
+ betapol2 += dbetapol;
1023
+
1024
+ //Transformation back to equatorial coordinates in radians
1025
+ with(Math)
1026
+ {
1027
+ var RApol2 = atan2((sin(lambdapol2)*cosd(eps)-tan(betapol2)*sind(eps)),cos(lambdapol2));
1028
+ var DECpol2 = asin(sin(betapol2)*cosd(eps)+cos(betapol2)*sind(eps)*sin(lambdapol2));
1029
+ }
1030
+
1031
+ //Finals
1032
+ GHApol = GHAAtrue-RApol2/dtr;
1033
+ GHApol = norm_360_deg(GHApol);
1034
+ SHApol = 360-RApol2/dtr;
1035
+ SHApol = norm_360_deg(SHApol);
1036
+ DECpol = DECpol2/dtr;
1037
+ }
1038
+
1039
+
1040
+ //Calculation of the phase of the moon
1041
+ function MoonPhase()
1042
+ {
1043
+ var x = lambdaMapp-lambda;
1044
+ x = norm_360_deg(x);
1045
+ if(x>0 && x<180) quarter = " (+)";
1046
+ if(x>180 && x<360) quarter = " (-)";
1047
+ if (k==0) quarter = ", new";
1048
+ if (k==100) quarter = ", full";
1049
+ }
1050
+
1051
+ //Day of the week
1052
+ function Weekday()
1053
+ {
1054
+ JD0h += 1.5;
1055
+ var res = JD0h-7*Math.floor(JD0h/7);
1056
+ if (res == 0) DoW = " SUN";
1057
+ if (res == 1) DoW = " MON";
1058
+ if (res == 2) DoW = " TUE";
1059
+ if (res == 3) DoW = " WED";
1060
+ if (res == 4) DoW = " THU";
1061
+ if (res == 5) DoW = " FRI";
1062
+ if (res == 6) DoW = " SAT";
1063
+ }
1064
+
1065
+ // Data output
1066
+ function Output()
1067
+ {
1068
+ //Sun
1069
+ GHASun = OutHA(GHAsun);
1070
+ SHAsun = OutHA(SHAsun);
1071
+ DECSun = OutDec(DECsun);
1072
+ SDsun = OutSDHP(SDsun);
1073
+ HPsun = OutSDHP(HPsun);
1074
+
1075
+ //Moon
1076
+ GHAmoon = OutHA(GHAmoon);
1077
+ SHAmoon = OutHA(SHAmoon);
1078
+ DECmoon = OutDec(DECmoon);
1079
+ SDmoon = OutSDHP(SDmoon);
1080
+ HPmoon = OutSDHP(HPmoon);
1081
+
1082
+ //Aries
1083
+ AR = OutHA(GHAAtrue);
1084
+
1085
+ //Polaris
1086
+ GHApolaris = OutHA(GHApol);
1087
+ SHApolaris = OutHA(SHApol);
1088
+ DECpolaris = OutDec(DECpol);
1089
+
1090
+ //Obliquity of Ecliptic
1091
+ OoE = OutECL(eps0);
1092
+ tOoE = OutECL(eps);
1093
+
1094
+ with(Math)
1095
+ {
1096
+ //Equation of time
1097
+ if (Eot<0) var sign="-";
1098
+ else var sign="+";
1099
+ Eot = abs(Eot);
1100
+ var EOTmin = floor(Eot);
1101
+ var EOTsec = round(600*(Eot-EOTmin))/10;
1102
+ if (EOTsec-floor(EOTsec)==0) EOTsec+=".0";
1103
+ if (EOTmin==0) EOT = " "+sign+" "+EOTsec+"s";
1104
+ else EOT = " "+sign+" "+EOTmin+"m "+EOTsec+"s";
1105
+ Eot = sign+Eot;
1106
+
1107
+ //Illumination
1108
+ var illum=" "+k+"%"+quarter;
1109
+
1110
+ //Lunar Distance of Sun
1111
+ LDist = OutHA(LDist);
1112
+ }
1113
+
1114
+ with(document)
1115
+ {
1116
+ OutForm.SunMA.value = SunMA;
1117
+ OutForm.SunML.value = SunML;
1118
+ OutForm.SunRA.value = RAsun;
1119
+ OutForm.SunDEC.value = DECsun;
1120
+ OutForm.SunGHA.value = GHAsun;
1121
+ OutForm.HLon.value = Hlon;
1122
+ OutForm.GLon.value = Lsun_true;
1123
+ OutForm.HLat.value = Hlat;
1124
+ OutForm.GLat.value = Glat;
1125
+ OutForm.EOT.value = Eot;
1126
+ OutForm.SidTapp.value = GHAAtrue;
1127
+ OutForm.SidTmean.value = ARIESmean;
1128
+ OutForm.EoEquin.value = EoE;
1129
+ OutForm.dpsi.value = delta_psi;//Math.round(3600000*delta_psi)/1000+"''";
1130
+ OutForm.deps.value = delta_eps;//Math.round(3600000*delta_eps)/1000+"''";
1131
+ OutForm.obliq.value = eps0;
1132
+ OutForm.trueobliq.value = eps;
1133
+ OutForm.JulianDay.value = JD//" "+Math.round(1000000*JD)/1000000;
1134
+ OutForm.JulianEphemDay.value = JDE//" "+Math.round(1000000*JDE)/1000000;
1135
+ OutForm.LunarDist.value = " "+LDist;
1136
+ OutForm.DayOfWeek.value = " "+DoW;
1137
+ }
1138
+ }
1139
+
1140
+ </script>
1141
+ </head>
1142
+
1143
+ <body bgcolor="#eeeeee">
1144
+ <p><font color="#500000" size="4">&nbsp;LONG-TERM ALMANAC FOR SUN, MOON, AND POLARIS&nbsp;&nbsp;V1.11</font>
1145
+ <br>
1146
+ <font color="#500000" size="3">&nbsp;<i>Copyright © 2001−2016 Henning Umland</i></font></p>
1147
+
1148
+ <form name="InForm">
1149
+ <thead>
1150
+ <tr>
1151
+ <th><font color="#000080" size="4"><b>&nbsp;Date:&nbsp;&nbsp;</b></font></th>
1152
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1153
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1154
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1155
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1156
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1157
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1158
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1159
+ <th><font color="#000080" size="4"><b>Time (UT1):&nbsp;</b></font></th>
1160
+ </tr>
1161
+ </thead>
1162
+ <table border="0">
1163
+ <tbody>
1164
+ <tr>
1165
+ <th align="center"><font color="#000080" size="4">y</b></font></th>
1166
+ <td><input size="4" name="year"></td>
1167
+ <th align="center">m</th>
1168
+ <td><input size="2" name="month"></td>
1169
+ <th align="center">d</th>
1170
+ <td><input size="2" name="day"></td>
1171
+ <td>&nbsp; &nbsp; &nbsp;</td>
1172
+ <th align="center">h</th>
1173
+ <td><input size="2" name="hour"></td>
1174
+ <th align="center">m</th>
1175
+ <td><input size="2" name="minute"></td>
1176
+ <th align="center"><font color="#000080" size="4">s</b></font></th>
1177
+ <td><input size="8" name="second"></td>
1178
+ <td>&nbsp; &nbsp; &nbsp;</td>
1179
+ <td><font color="#000080" size="4"><b>&nbsp;ΔT:&nbsp;</b></font></td>
1180
+ <td><input size="3" name="delta"></td>
1181
+ <td>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</td>
1182
+ <td><input onclick="Main()" value="Calculate" type="button">&nbsp;</td>
1183
+ <td><input value="Clear" type="reset"></td>
1184
+ </tr>
1185
+
1186
+ <tr>
1187
+ <td colspan="15">---------------------------------------------------------------------------------------------------------------------</td>
1188
+ </tr>
1189
+ </tbody>
1190
+ </table>
1191
+ </form>
1192
+
1193
+ <form name="OutForm">
1194
+ <table border="0" cellspacing="4">
1195
+ <tbody>
1196
+ <tr>
1197
+ <td>&nbsp;</td>
1198
+ <td align="center">mean anomaly</td>
1199
+ <td></td>
1200
+ <td align="center">mean longitude</td>
1201
+ <td></td>
1202
+ <td align="center">RA</td>
1203
+ <td></td>
1204
+ <td align="center">DEC</td>
1205
+ <td></td>
1206
+ <td align="center">GHA</td>
1207
+ <td></td>
1208
+ </tr>
1209
+ <tr>
1210
+ <td><font color="#500000" size="4"><b>Sun </b></font></td>
1211
+ <td><input size="20" name="SunMA"></td>
1212
+ <td></td>
1213
+ <td><input size="20" name="SunML"></td>
1214
+ <td></td>
1215
+ <td><input size="20" name="SunRA"></td>
1216
+ <td></td>
1217
+ <td><input size="20" name="SunDEC"></td>
1218
+ <td></td>
1219
+ <td><input size="20" name="SunGHA"></td>
1220
+ <td></td>
1221
+ </tr>
1222
+ <tr>
1223
+ <td colspan="12"></td>
1224
+ </tr>
1225
+ <tr>
1226
+ <td>&nbsp;</td>
1227
+ <td align="center">HLon</td>
1228
+ <td></td>
1229
+ <td align="center">GLon</td>
1230
+ <td></td>
1231
+ <td align="center">HLat</td>
1232
+ <td></td>
1233
+ <td align="center">GLat</td>
1234
+ <td></td>
1235
+ <td align="center">Equation of Time</td>
1236
+ </tr>
1237
+ <tr>
1238
+ <td></td>
1239
+ <td><input size="20" name="HLon"></td>
1240
+ <td></td>
1241
+ <td><input size="20" name="GLon"></td>
1242
+ <td></td>
1243
+ <td><input size="20" name="HLat"></td>
1244
+ <td></td>
1245
+ <td><input size="20" name="GLat"></td>
1246
+ <td></td>
1247
+ <td><input size="20" name="EOT"></td>
1248
+ </tr>
1249
+ <tr>
1250
+ <td colspan="12"></td>
1251
+ </tr>
1252
+
1253
+ <tr>
1254
+ <td colspan="12"></td>
1255
+ </tr>
1256
+ <tr>
1257
+ <td colspan="12"></td>
1258
+ </tr>
1259
+ <tr>
1260
+ <td colspan="12"></td>
1261
+ </tr>
1262
+ <tr><td></td></tr>
1263
+ <tr>
1264
+ <td>&nbsp;</td>
1265
+ <td align="center">GAST</td>
1266
+ <td></td>
1267
+ <td align="center">GMST</td>
1268
+ <td></td>
1269
+ <td align="center">Eq. of Equinoxes</td>
1270
+ <td></td>
1271
+ <td align="center">Δψ</td>
1272
+ <td></td>
1273
+ <td align="center">Δε</td>
1274
+ <td></td>
1275
+ <td align="center">Mean Obl. of Ecl.</td>
1276
+ </tr>
1277
+ <tr>
1278
+ <td><font color="#500000" size="4"><b>Misc.</b></font></td>
1279
+ <td><input size="20" name="SidTapp"></td>
1280
+ <td></td>
1281
+ <td><input size="20" name="SidTmean"></td>
1282
+ <td></td>
1283
+ <td><input size="20" name="EoEquin"></td>
1284
+ <td></td>
1285
+ <td><input size="20" name="dpsi"></td>
1286
+ <td></td>
1287
+ <td><input size="20" name="deps"></td>
1288
+ <td></td>
1289
+ <td><input size="20" name="obliq"></td>
1290
+ </tr>
1291
+ <tr>
1292
+ <td colspan="12"></td>
1293
+ </tr>
1294
+ <tr><td></td></tr>
1295
+ <tr>
1296
+ <td>&nbsp;</td>
1297
+ <td align="center">JD</td>
1298
+ <td></td>
1299
+ <td align="center">JDE</td>
1300
+ <td></td>
1301
+ <td align="center">Lunar Dist. of Sun</td>
1302
+ <td></td>
1303
+ <td align="center">Weekday</td>
1304
+ <td></td>
1305
+ <td align="center"></td>
1306
+ <td></td>
1307
+ <td align="center">True Obl. of Ecl.</td>
1308
+ </tr>
1309
+ <tr>
1310
+ <td>&nbsp;</td>
1311
+ <td><input size="20" name="JulianDay"></td>
1312
+ <td></td>
1313
+ <td><input size="20" name="JulianEphemDay"></td>
1314
+ <td></td>
1315
+ <td><input size="20" name="LunarDist"></td>
1316
+ <td></td>
1317
+ <td><input size="20" name="DayOfWeek"></td>
1318
+ <td></td>
1319
+ <td></td>
1320
+ <td></td>
1321
+ <td><input size="20" name="trueobliq"></td>
1322
+ </tr>
1323
+ </tbody>
1324
+ </table>
1325
+ </form>
1326
+
1327
+ <br><br>
1328
+
1329
+ <p align="justify"><b>Description:</b> <br>This computer almanac is based
1330
+ upon formulas published in <i>Astronomical Algorithms</i> by Jean Meeus.
1331
+ The program calculates Greenwich hour angle (GHA), sidereal hour angle
1332
+ (SHA), and declination (Dec) for sun, moon, and polaris.<br><br>
1333
+ Further, the following quantities are provided:<br><br>
1334
+ Greenwich hour angle of the vernal point (Aries)<br>
1335
+ Geocentric semidiameter (SD) and equatorial horizontal parallax (HP) for sun
1336
+ and moon<br>
1337
+ Equation of time<br>
1338
+ Phase of the moon (illuminated fraction of the moon's disk)<br>
1339
+ Greenwich apparent sidereal time (GAST)<br>
1340
+ Greenwich mean sidereal time (GMST)<br>
1341
+ Equation of the equinoxes (= GAST−GMST)<br>
1342
+ Nutation in longitude (Δψ)<br>
1343
+ Nutation in obliquity (Δε)<br>
1344
+ Mean obliquity of the ecliptic<br>
1345
+ True obliquity of the ecliptic (= mean obliquity + Δε)<br>
1346
+ Julian date (JD)<br>
1347
+ Julian ephemeris date (JDE)<br>
1348
+ Geocentric lunar distance of the sun (center-center)<br>
1349
+ Day of the week<br><br>
1350
+ The almanac can be used for many decades, provided the ΔT value (= TT−UT1)
1351
+ for the given date is known. An accuracy of approx. ±1s is sufficient for most
1352
+ applications. Errors in ΔT have a much greater influence on the coordinates
1353
+ of the moon than on the other results. ΔT is obtained through the following
1354
+ formula:<br><br>
1355
+ ΔT = 32.184s + (TAI−UTC) − DUT1 <br><br>
1356
+ Current values for TAI−UTC and DUT1 (= UT1−UTC) are published on the web site
1357
+ of the <a href="http://maia.usno.navy.mil/"><i>IERS Rapid Service / Prediction
1358
+ Center</i></a> (IERS Bulletin A). <br><br>Reliable long-term predictions for
1359
+ ΔT are not possible. Here are some ΔT values of the past:
1360
+ <br><br>
1361
+ 1970.0:&nbsp;&nbsp;+40.2s<br>
1362
+ 1975.0:&nbsp;&nbsp;+45.5s<br>
1363
+ 1980.0:&nbsp;&nbsp;+50.5s<br>
1364
+ 1985.0:&nbsp;&nbsp;+54.3s<br>
1365
+ 1990.0:&nbsp;&nbsp;+56.9s<br>
1366
+ 1995.0:&nbsp;&nbsp;+60.8s<br>
1367
+ 2000.0:&nbsp;&nbsp;+63.8s<br>
1368
+ 2005.0:&nbsp;&nbsp;+64.7s<br>
1369
+ 2010.0:&nbsp;&nbsp;+66.1s<br>
1370
+ 2015.0:&nbsp;&nbsp;+67.6s<br>
1371
+ 2016.0:&nbsp;&nbsp;+68.1s<br><br>
1372
+
1373
+ The program regards any blank dialog box in the time input field as zero. A
1374
+ missing year, month, or day will result in an error message (program must be
1375
+ restarted). The number of the year must be entered in 4-digit format.<br><br>
1376
+ A "(+)" behind the value for the illuminated fraction of the moon's disk
1377
+ indicates a waxing moon, a "(−)" a waning moon.
1378
+ <br><br>
1379
+ SHA and GHA<sub>Aries</sub> refer to the true equinox of date.<br><br>
1380
+
1381
+ </p><b>Accuracy (approximate values):</b><br>
1382
+
1383
+ <table border="0">
1384
+ <tbody>
1385
+ <tr>
1386
+ <td>GHA, SHA, and Dec of the sun: </td>
1387
+ <td>±1"</td>
1388
+ </tr>
1389
+ <tr>
1390
+ <td>GHA and SHA of the moon: &nbsp;&nbsp;</td>
1391
+ <td>±10"</td>
1392
+ </tr>
1393
+ <tr>
1394
+ <td>Dec of the moon: &nbsp;&nbsp;</td>
1395
+ <td>±5"</td>
1396
+ </tr>
1397
+ <tr>
1398
+ <td>GHA and SHA of Polaris: </td>
1399
+ <td>±2"</td>
1400
+ </tr>
1401
+ <tr>
1402
+ <td>Dec of Polaris: </td>
1403
+ <td>±1"</td>
1404
+ </tr>
1405
+ <tr>
1406
+ <td>GHA Aries: &nbsp;&nbsp;</td>
1407
+ <td>±1"</td>
1408
+ </tr>
1409
+ <tr>
1410
+ <td>HP and SD: </td>
1411
+ <td>±0.1"</td>
1412
+ </tr>
1413
+ <tr>
1414
+ <td>Equation of Time: </td>
1415
+ <td>±0.1s</td>
1416
+ </tr>
1417
+ <tr>
1418
+ <td>GAST, GMST, and Equation of Equinoxes: &nbsp;&nbsp;</td>
1419
+ <td>±0.001s</td>
1420
+ </tr>
1421
+ <tr>
1422
+ <td>Nutation (Δψ and Δε): </td>
1423
+ <td>±0.001"</td>
1424
+ </tr>
1425
+ <tr>
1426
+ <td>Mean Obliquity of the Ecliptic: </td>
1427
+ <td>±0.001"</td>
1428
+ </tr>
1429
+ <tr>
1430
+ <td>Lunar distance of sun: </td>
1431
+ <td>±10"</td>
1432
+ </tr>
1433
+ </tbody>
1434
+ </table>
1435
+
1436
+ <br><br>
1437
+
1438
+ <hr>
1439
+ <p align="justify">LICENSE<br><br>
1440
+ This program is free software: you can redistribute it and/or modify
1441
+ it under the terms of the GNU General Public License as published by the Free Software
1442
+ Foundation, either version 3 of the license or any later version.<br><br>
1443
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
1444
+ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1445
+ See the GNU General Public License
1446
+ (<a href="http://www.celnav.de/index.htm">http://www.gnu.org/licenses/</a>) for more details.
1447
+ <br><br>
1448
+ Henning Umland &nbsp;&nbsp;&nbsp;N 53° 20' 34'' &nbsp; E 9° 52' 00''
1449
+ <br><br>
1450
+ Check this web site for updated versions:
1451
+ <a href="http://www.celnav.de/index.htm">http://www.celnav.de/index.htm</a></p>
1452
+ <hr>
1453
+
1454
+
1455
+
1456
+ </body></html>