FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smallbasic.github.io/samples/node/133.bas at master · smallbasic/smallbasic.github.io · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
smallbasic
/
smallbasic.github.io
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
133.bas
Copy path
More file actions
More file actions
Latest commit
History
History
History
159 lines (158 loc) · 4.4 KB
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
133.bas
Copy path
File metadata and controls
159 lines (158 loc) · 4.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
'10 '' Sunrise-Sunset
11
'' mode =1 Automatic
12
mode
=
0
20
GOSUB
300
21
'' Chandler Arizona Latitude=33N18 Longitude=-111W50
22
B5
=
33
+
(
18
/
60
) : L5
=-
1
*
(
111
+
(
50
/
60
))
23
H
=
7
25
if
mode
=
1
then
goto
50
30
INPUT
"Lat, Long (deg)"
;B5,L5
40
INPUT
"Time zone (hrs)"
;H
50
L5
=
L5
/
360
: Z0
=
H
/
24
60
GOSUB
1170
: T
=
(J
-
2451545
)
+
F
70
TT
=
T
/
36525
+
1
:
'' TT = centuries
80
'' from 1900.0
90
GOSUB
410
: T
=
T
+
Z0
100
''
110
'' Get Sun''s Position
120
GOSUB
910
: A(
1
)
=
A5: D(
1
)
=
D7
130
T
=
T
+
1
140
GOSUB
910
: A(
2
)
=
A5: D(
2
)
=
D7
150
IF
A(
2
)
<
A(
1
)
THEN
A(
2
)
=
A(
2
)
+
P2
160
Z1
=
DR
*
90.833
:
'' Zenith dist.
170
S
=
SIN
(B5
*
DR): C
=
COS
(B5
*
DR)
180
Z
=
COS
(Z1): M8
=
0
: W8
=
0
:
PRINT
190
A0
=
A(
1
): D0
=
D(
1
)
200
DA
=
A(
2
)
-
A(
1
): DD
=
D(
2
)
-
D(
1
)
210
FOR
C0
=
0
TO
23
220
P
=
(C0
+
1
)
/
24
230
A2
=
A(
1
)
+
P
*
DA: D2
=
D(
1
)
+
P
*
DD
240
GOSUB
490
250
A0
=
A2: D0
=
D2: V0
=
V2
260
NEXT
270
GOSUB
820
:
'' Special msg?
271
if
mode!
=
1
then
goto
280
272
PRINT
"Latitude "
;B5;
" Longitude "
;L5
*
360
;
" TimeZone "
;H
273
PRINT
"Day/Month/Year "
;nd$
280
END
290
''
300
'' Constants
310
DIM
A(
2
),D(
2
)
320
REM P1=3.14159265: P2=2*P1
320
P1
=
PI : P2
=
2
*
P1
330
DR
=
P1
/
180
: K1
=
15
*
DR
*
1.0027379
340
S$
=
"Sunset at "
350
R$
=
"Sunrise at "
360
M1$
=
"No sunrise this date"
370
M2$
=
"No sunset this date"
380
M3$
=
"Sun down all day"
390
M4$
=
"Sun up all day"
400
RETURN
410
'' LST at 0h zone time
420
T0
=
T
/
36525
430
S
=
24110.5
+
8640184.813
*
T0
440
S
=
S
+
86636.6
*
Z0
+
86400
*
L5
450
S
=
S
/
86400
: S
=
S
-
INT
(S)
460
T0
=
S
*
360
*
DR
470
RETURN
480
''
490
'' Test an hour for an event
500
L0
=
T0
+
C0
*
K1: L2
=
L0
+
K1
510
H0
=
L0
-
A0: H2
=
L2
-
A2
520
H1
=
(H2
+
H0)
/
2
:
'' Hour angle,
530
D1
=
(D2
+
D0)
/
2
:
'' declination,
540
'' at half hour
550
IF
C0
>
0
THEN
570
560
V0
=
S
*
SIN
(D0)
+
C
*
COS
(D0)
*
COS
(H0)
-
Z
570
V2
=
S
*
SIN
(D2)
+
C
*
COS
(D2)
*
COS
(H2)
-
Z
580
IF
SGN
(V0)
=
SGN
(V2)
THEN
800
590
V1
=
S
*
SIN
(D1)
+
C
*
COS
(D1)
*
COS
(H1)
-
Z
600
A1
=
2
*
V2
-
4
*
V1
+
2
*
V0: B
=
4
*
V1
-
3
*
V0
-
V2
610
D8
=
B
*
B
-
4
*
A1
*
V0:
IF
D8
<
0
THEN
800
620
D8
=
SQR
(D8)
630
IF
V0
<
0
AND
V2
>
0
THEN
PRINT
R$;
640
IF
V0
<
0
AND
V2
>
0
THEN
M8
=
1
650
IF
V0
>
0
AND
V2
<
0
THEN
PRINT
S$;
660
IF
V0
>
0
AND
V2
<
0
THEN
W8
=
1
670
E
=
(
-
B
+
D8)
/
(
2
*
A1)
680
IF
E
>
1
OR
E
<
0
THEN
E
=
(
-
B
-
D8)
/
(
2
*
A1)
690
T3
=
C0
+
E
+
1
/
120
:
'' Round off
700
H3
=
INT
(T3): M3
=
INT
((T3
-
H3)
*
60
)
710
PRINT
USING
"##:##"
;H3;M3;
720
H7
=
H0
+
E
*
(H2
-
H0)
730
N7
=-
COS
(D1)
*
SIN
(H7)
740
D7
=
C
*
SIN
(D1)
-
S
*
COS
(D1)
*
COS
(H7)
750
AZ
=
ATN
(N7
/
D7)
/
DR
760
IF
D7
<
0
THEN
AZ
=
AZ
+
180
770
IF
AZ
<
0
THEN
AZ
=
AZ
+
360
780
IF
AZ
>
360
THEN
AZ
=
AZ
-
360
790
PRINT
USING
", azimuth ###.#"
;AZ
800
RETURN
810
''
820
'' Special-message routine
830
IF
M8
=
0
AND
W8
=
0
THEN
870
840
IF
M8
=
0
THEN
PRINT
M1$
850
IF
W8
=
0
THEN
PRINT
M2$
860
GOTO
890
870
IF
V2
<
0
THEN
PRINT
M3$
880
IF
V2
>
0
THEN
PRINT
M4$
890
RETURN
900
''
910
'' Fundamental arguments
920
'' (Van Flandern &
930
'' Pulkkinen, 1979)
940
L
=
.
779072
+
.
00273790931
*
T
950
G
=
.
993126
+
.
0027377785
*
T
960
L
=
L
-
INT
(L): G
=
G
-
INT
(G)
970
L
=
L
*
P2: G
=
G
*
P2
980
V
=
.
39785
*
SIN
(L)
990
V
=
V
-
.
01000
*
SIN
(L
-
G)
1000
V
=
V
+
.
00333
*
SIN
(L
+
G)
1010
V
=
V
-
.
00021
*
TT
*
SIN
(L)
1020
U
=
1
-
.
03349
*
COS
(G)
1030
U
=
U
-
.
00014
*
COS
(
2
*
L)
1040
U
=
U
+
.
00008
*
COS
(L)
1050
W
=-
.
00010
-
.
04129
*
SIN
(
2
*
L)
1060
W
=
W
+
.
03211
*
SIN
(G)
1070
W
=
W
+
.
00104
*
SIN
(
2
*
L
-
G)
1080
W
=
W
-
.
00035
*
SIN
(
2
*
L
+
G)
1090
W
=
W
-
.
00008
*
TT
*
SIN
(G)
1100
''
1110
'' Compute Sun''s RA and Dec
1120
S
=
W
/
SQR
(U
-
V
*
V)
1130
A5
=
L
+
ATN
(S
/
SQR
(
1
-
S
*
S))
1140
S
=
V
/
SQR
(U):D7
=
ATN
(S
/
SQR
(
1
-
S
*
S))
1150
R5
=
1.00021
*
SQR
(U)
1160
RETURN
1165
''
1170
'' Calendar --> JD
1171
'' Get current Date
1172
nd$
=
DATE$
1173
'' DATE$ - returns the current day as string "DD/MM/YYYY"
1174
M
=
MID$
(nd$,
4
,
2
)
+
0
1175
Y
=
MID$
(nd$,
7
,
4
)
+
0
1176
Day
=
MID$
(nd$,
1
,
2
)
+
0
1177
if
mode
=
1
then
goto
1190
1180
INPUT
"Year, Month, Day"
;Y,M,Day
1190
G
=
1
:
IF
Y
<
1583
THEN
G
=
0
1200
D1
=
INT
(Day): F
=
Day
-
D1
-
.
5
1210
J
=-
INT
(
7
*
(
INT
((M
+
9
)
/
12
)
+
Y)
/
4
)
1220
IF
G
=
0
THEN
1260
1230
S
=
SGN
(M
-
9
): A3
=
ABS
(M
-
9
)
1240
J3
=
INT
(Y
+
S
*
INT
(A3
/
7
))
1250
J3
=-
INT
((
INT
(J3
/
100
)
+
1
)
*
3
/
4
)
1260
J
=
J
+
INT
(
275
*
M
/
9
)
+
D1
+
G
*
J3
1270
J
=
J
+
1721027
+
2
*
G
+
367
*
Y
1280
IF
F
>=
0
THEN
1300
1290
F
=
F
+
1
: J
=
J
-
1
1300
RETURN
1310
''
1320
'' This program by Roger W. Sinnott calculates the times of sunrise
1330
'' and sunset on any date, accurate to the minute within several
1340
'' centuries of the present. It correctly describes what happens in the
1350
'' arctic and antarctic regions, where the Sun may not rise or set on
1360
'' a given date. Enter north latitudes positive, west longitudes
1370
'' negative. For the time zone, enter the number of hours west of
1380
'' Greenwich (e.g., 5 for EST, 4 for EDT). The calculation is
1390
'' discussed in Sky & Telescope for August 1994, page 84.
'
Back
|
FazBrowse Home
|
New Git URL