Post by donnybowers on Dec 10, 2021 11:55:50 GMT
I release this simple little program to the public domain. It can be handy for calculating the angle of a solar panel or the glazing angle on a green house. If you find any use for it, just use and modify it any way you want.
In the results:
- "ANGLE OF THE SUN" is the angle of the sun at solar noon from the ground to the nearest degree (usually close enough for most DIY solar projects).
- "SOLAR PANEL ANGLES" is the optimum angle of your solar panel(s) or your greenhouse glazing from the ground (facing south of course).
This program suits my needs so I probably won't develop it much further. It appears it only works properly in regions at least 24 degrees north of the equator.
The program might also be useful for calculating how much of an overhang you need on a roof to shade a window in the summer, though this would require some trigonometry to calculate.
In the results:
- "ANGLE OF THE SUN" is the angle of the sun at solar noon from the ground to the nearest degree (usually close enough for most DIY solar projects).
- "SOLAR PANEL ANGLES" is the optimum angle of your solar panel(s) or your greenhouse glazing from the ground (facing south of course).
This program suits my needs so I probably won't develop it much further. It appears it only works properly in regions at least 24 degrees north of the equator.
The program might also be useful for calculating how much of an overhang you need on a roof to shade a window in the summer, though this would require some trigonometry to calculate.
INPUT "Enter Degrees Latitude "; latitude
PRINT
'PUBLIC DOMAIN
'USE THIS SIMPLE PROGRAM ANY WAY YOU WANT.
'IT'S ONLY REALLY USEFUL FOR LOCATIONS
'IN THE NORTHERN HEMISPHERE 24 DEGREES
'LATITUDE OR HIGHER, WHICH WAS ENOUGH TO
'SUIT MY PERSONAL USE FOR THE CODE.
'CHALLENGE: MAKE A VERSION THAT WORKS FOR
'ANY LOCATION ON EARTH.
'SOLSTICE / EQUINOX DATA
fall=90-latitude
winter=fall-23.5 ' spring is the same as fall
summer=fall+23.5
'CALCULATE DEGRESS BETWEEN MONTHS
degrees=(fall-winter)/3
'CALCULATE DATA FOR EACH MONTH OF THE YEAR
'THE RESULTS WILL BE ACCURATE TO WITHIN ABOUT
'1 DEGREE. MORE ACCURACY CAN BE ACHIEVED BY
'CHANGING THE "USING" TEMPLATE
'I.E. "###.#" ETC. INSTEAD OF JUST "###"
Dec=winter 'SUN'S ANGLE FROM THE GROUND IN WINTER
Dec$=using("###", Dec) 'THE "USING" TEMPLATE (IT'S ALWAYS 2 DIGITS OR LESS)
'THE EXTRA # IS IN CASE YOU GET A NEGATIVE NUMBER
'(BELOW ABOUT 24 DEGREES LATITUDE).
DecPanel=90-Dec 'SOLAR PANELS SHOULD BE PERPENDICULAR TO
'THE SUN'S ANGLE IN THE SKY.
DecPanel$=using("###", DecPanel) 'THE "USING" TEMPLATE
Jan=winter+degrees
Jan$=using("###", Jan)
JanPanel=90-Jan
JanPanel$=using("###", JanPanel)
Feb=winter+(degrees*2)
Feb$=using("###", Feb)
FebPanel=90-Feb
FebPanel$=using("###", FebPanel)
Mar=winter+(degrees*3)
Mar$=using("###", Mar)
MarPanel=90-Mar
MarPanel$=using("###", MarPanel)
Apr=winter+(degrees*4)
Apr$=using("###", Apr)
AprPanel=90-Apr
AprPanel$=using("###", AprPanel)
May=winter+(degrees*5)
May$=using("###", May)
MayPanel=90-May
MayPanel$=using("###", MayPanel)
Jun=summer
Jun$=using("###", Jun)
JunPanel=90-Jun
JunPanel$=using("###", JunPanel)
Jul=winter+(degrees*5)
Jul$=using("###", Jul)
JulPanel=90-Jul
JulPanel$=using("###", JulPanel)
Aug=winter+(degrees*4)
Aug$=using("###", Aug)
AugPanel=90-Aug
AugPanel$=using("###", AugPanel)
Sep=winter+(degrees*3)
Sep$=using("###", Sep)
SepPanel=90-Sep
SepPanel$=using("###", SepPanel)
Oct=winter+(degrees*2)
Oct$=using("###", Oct)
OctPanel=90-Oct
OctPanel$=using("###", OctPanel)
Nov=winter+degrees
Nov$=using("###", Nov)
NovPanel=90-Nov
NovPanel$=using("###", NovPanel)
print "ROUNDED TO NEAREST DEGREE"
print " | SOLAR"
print " ANGLE OF | PANEL"
print " THE SUN | ANGLES"
print " Jan ";Jan$;chr$(176);" | ";JanPanel$;chr$(176)
print " Feb ";Feb$;chr$(176);" | ";FebPanel$;chr$(176)
print " Mar ";Mar$;chr$(176);" | ";MarPanel$;chr$(176)
print " Apr ";Apr$;chr$(176);" | ";AprPanel$;chr$(176)
print " May ";May$;chr$(176);" | ";MayPanel$;chr$(176)
print " Jun ";Jun$;chr$(176);" | ";JunPanel$;chr$(176)
print " Jul ";Jul$;chr$(176);" | ";JulPanel$;chr$(176)
print " Aug ";Aug$;chr$(176);" | ";AugPanel$;chr$(176)
print " Sep ";Sep$;chr$(176);" | ";SepPanel$;chr$(176)
print " Oct ";Oct$;chr$(176);" | ";OctPanel$;chr$(176)
print " Nov ";Nov$;chr$(176);" | ";NovPanel$;chr$(176)
print " Dec ";Dec$;chr$(176);" | ";DecPanel$;chr$(176)