Saturday, December 7, 2019

HP 42S and DM42: Solar Declination, Zenith, and Sunrise

HP 42S and DM42: Solar Declination, Zenith, and Sunrise

Introduction

The program SUNS will calculate:

1.  Approximation declination given month and day.  A 365-year is assumed.

δ ≈ 23.45° sin(.9863 * (284 + n))

where n is the nth day of the year:

If month = 1 or month = 2, then:
n = IP(30.6 * month + 368.8) + day - 399

If month ≥ 3 then:
n = IP(30.6 * month + 1.6) + day - 34

2.  Zenith angle θ:

θ ≈ acos(sin δ * sin ϕ + cos δ * cos ϕ * cos hour_angle)

where:
ϕ = latitude, north is positive
hour_angle = (12 - number of hours before noon) * 15

3.  Approximate time of sunrise:

ω ≈ acos(-tan ϕ * tan δ)
Sunrise time ≈ (12 - ω/15) converted to HMS

The program was entered on a HP 42S, and should work for the Free42 and Swiss Micros DM42.

HP 42S/DM42 Program SUNS

00 {206-Byte Prgm}
01 LBL "SUNS"
02 DEG
03 "MONTH?"
04 PROMPT
05 STO 01
06 "DAY?"
07 PROMPT 
08 STO 02
09 "HRS BEFORE NOON"
10 PROMPT 
11 STO 03
12 "LAT (N+)?"
13 PROMPT
14 →HR
15 STO 04
16 RCL 02     // calculate n
17 RCL 01
18 CF 00
19 3
20 X>Y?
21 SF 00
22 R↓
23 30.6
24 *
25 1.6
26 +
27 FS? 00
28 367.2
29 FS? 00
30 +
31 IP
32 +
33 34
34 -
35 FS? 00
36 365
37 FS? 00
38 -
39 CF 00
40 STO 11
41 284     // calculate δ
42 +
43 0.9863
44 *
45 SIN
46 23.45
47 * 
48 STO 12
49 "DEC="
50 ARCL ST X
51 AVIEW 
52 STOP
53 12
54 RCL- 03
55 15
56  *
57 STO 13
58 RCL 12   // calculate θ
59 SIN
60 RCL 04
61 SIN
62 *
63 RCL 12
64 COS
65 RCL 04
66 COS
67 *
68 RCL 13
69 COS 
70 *
71 +
72 ACOS
73 STO 14
74 "ZENITH="
75 ARCL ST X
76 AVIEW
77 STOP
78 RCL 04   // calculate ω
79 TAN
80 +/-
81 RCL 12
82 TAN
83 *
84 ACOS
85 15
86 ÷
87 12
88 X<>Y
89 -
90 →HMS
91 STO 15
92 "SUNRISE="
93 ARCL ST X
94 AVIEW
95 END

Variables:
R01 = month
R02 = day
R03 = hours before moon
R04 = latitude

R11 = n,  nth day of the year
R12 = δ,  declination
R13 = hour_angle
R14 = θ,  zenith
R15 = ω, approximate sunrise

Example

March 15, 8:00 AM (4 hours before noon), latitude is 40°

Results:
DEC = -2.8191   (-2.8191°)
ZENITH = 114.4672
SUNRISE = 6.0928  (around 6:09:28)

Remember, these results are approximate!

Source:
Hewlett Packard.  "Solar-Beam Irradiation"  Hewlett Packard User's Library Solution:  Solar Engineering.  HP 41C  January 1984.

Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...