Sun program help

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
User avatar
salvomic
Posts: 58
Joined: Sat Dec 30, 2017 9:09 am
Location: Ragusa, Sicily
Contact:

Sun program help

Post by salvomic » Thu Feb 08, 2018 8:33 pm

hi,
please, I need help about the program Sun.raw.
I loaded it, after a reset I loaded it again, it seems ok, but when I press XEQ Sun I get "Nonexistent".
Are the variables (TILT, LAT, SEAS, TOD, HIGHT) to be set firstly, but what they mean (ok per LAT, I presume latitude...)?
Other advice?

Thank you
Salvo

EDIT: it presents the soft keys with TILT, LAT, SEAS, TOD, HIGHT, after for example choosing first ∫ integral, then pressing SUN, but not with XEQ. The program, however works putting values in the variables after integral, the first time...

EDIT: Found the explanation of the variables in the Thomas' site: «Variables used: TILT: the angle between the Earth's axis of rotation and the normal of the ecliptic (23.5 degrees); LAT: observer's latitude (use positive values for Northern latitudes, negative values for Southern latitudes); SEAS: the current season, given as an angle between 0 and 360 degrees, with 0 being mid-winter in the Northern hemisphere, 90 being the Northern Spring equinox, etc.; TOD: time of day (solar time, from 0-24, where 12 is noon; solar time differs from official time, depending on where you are within your time zone); HGHT: height of the sun above the horizon, in degrees; negative numbers mean nighttime.».
∫aL√0mic (IT9CLU) - DM42 (SN: 00881), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, HP 35s, WP34s :: Free42

Thomas Okken
Posts: 676
Joined: Tue May 02, 2017 3:48 pm
Contact:

Re: Sun program help

Post by Thomas Okken » Fri Feb 09, 2018 12:38 am

The SUN program on my web site calculates the height of the sun above the horizon, given the axial tilt of the planet, the observer's latitude, the season (expressed as an angle, where 0° is the winter solstice), and solar time of day.

It is based on a very simplistic formula, which assumes the Earth is a perfect sphere, and its orbit around the sun is a perfect circle; that the sun is a point source of light, and that there are no atmospheric effects.

I wrote it to get a sense of how the length of the day varies depending on where and when you are. It is not meant to be super accurate; for that, see /viewtopic.php?f=19&t=434&p=5138&hilit=sun#p5138.

Lastly, to answer Salvo's actual question: to use my SUN program -- in case I haven't just convinced you not to -- you have to use SOLVE. Enter the parameters you have, then solve for the unknown. It is not an interactive program, it's just an RPN implementation of a formula.

Historic trivia: this problem, and my simplistic formula, are what prompted me to write Free42, and also the plot_thomas program, which lets you plot any of the parameters of a SOLVE-compatible function. I.e. you can use plot_thomas to plot the time of sunrise over a year, like this:

XEQ "PLOT"
0 YMIN
12 YMAX
-1 AXIS
0 XMIN
360 XMAX
30 XINC
R/S
"SUN" R/S
23.4 TILT
40.7 LAT
0 HGHT
SEAS
SOLVE
TOD

User avatar
salvomic
Posts: 58
Joined: Sat Dec 30, 2017 9:09 am
Location: Ragusa, Sicily
Contact:

Re: Sun program help

Post by salvomic » Fri Feb 09, 2018 8:18 am

Thomas Okken wrote:
Fri Feb 09, 2018 12:38 am
The SUN program on my web site calculates the height of the sun above the horizon, given the axial tilt of the planet, the observer's latitude, the season (expressed as an angle, where 0° is the winter solstice), and solar time of day.
It is based on a very simplistic formula, which assumes the Earth is a perfect sphere, and its orbit around the sun is a perfect circle; that the sun is a point source of light, and that there are no atmospheric effects.
Thank you!
I like to have astronomic programs on the calculators.
For the Prime Marcel Pelletier made the nice Astro Lab 4 app (he'll release soon an upgrade for the new firmware) and I made Effemeridi (Ephemeris) -[see in the Program Library of MoHPC]- program with some routines to calculate a lot of values for Sun, Moon, Planets and Heart. I hope to make something also for DM42, but yourself could make freely programs translating the formulas in my program, it would be nice.
Thomas Okken wrote:
Fri Feb 09, 2018 12:38 am
Lastly, to answer Salvo's actual question: to use my SUN program -- in case I haven't just convinced you not to -- you have to use SOLVE. Enter the parameters you have, then solve for the unknown. It is not an interactive program, it's just an RPN implementation of a formula.
Well!
With Solve the programs works as expected here.

Salvo
∫aL√0mic (IT9CLU) - DM42 (SN: 00881), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, HP 35s, WP34s :: Free42

Post Reply