Sustainable By Design
tools consulting about contact solar_cooking

SunAngle

This tool calculates solar angle data based on date, time, and location. Please read the important instructions, notes, and FAQ pages before using this tool. Click on any input or output name for additional details.

INPUTS
longitude time
latitude time zone
date   time basis
year daylight savings
elevation zero azimuth
OUTPUTS
altitude angle declination
azimuth angle equation of time
clock time time of sunrise
solar time time of sunset
hour angle

Support SunAngle!

The development and maintenance of SunAngle is supported 100% by voluntary user donations. If you found this program helpful, please consider making a small donation...this can be done quickly and securely by credit card, or you can mail a check. Suggested donations are $25 for commercial use, and $10 for personal use. Please visit the Shareware page for details, or you can make a quick PayPal or credit card donation to the right. Thanks!

QUICK DONATION
Commercial ($25)
Personal ($10)

Mailing List

The author maintains a private mailing list of users of SunAngle and his other shareware solar design tools, and is happy to send you very occasional notices about software upgrades and other items of interest. Such notices do not occur more frequently than a few times a year.

If you're interested in joining the SunAngle mailing list, please send e-mail to the author with this request. Your e-mail address will never be used for commercial purposes or given to anyone else for any reason.

Copyright 2005 Christopher Gronbeck

- - - original - - -


Instructions close window

You should enter as much information as possible into the Inputs section, then click on the Calculate button. The calculation results will then appear in the Outputs section.

Here is a list of inputs and how to use them:

Latitude
Your latitude, in degrees North or South of the equator (use the pull-down menu after the input field to indicate which one). You may use either decimal or degree-minute-second (DMS) notation for latitude. For decimal values, enter the latitude simply as, for instance, "45.5" (don't include the quotation marks). For DMS values, enter the degrees followed by "d", arc-minutes followed by "m", and arc-seconds followed by "s". Do not use spaces. A sample DMS value would be "45d30m0s". This is a new feature of SunAngle, so please let me know if you have any questions about it.

Longitude
Your longitude, in degrees East or West (use the pull-down menu after the input field to indicate which one). You may use decimal or degree-minute-second notation for longitude; please see the instructions for latitude above for more information.

Date
Indicate the month and date using the pull-down menus.

Year
Indicate the year using the pull-down menu. If the year you are interested in does not appear, select any value (the exact year matters very little for most calculations...this variable only affects the equation of time value, and only by a few seconds here and there).

Elevation
Your elevation compared to the surrounding terrain, in meters or feet (use the pull-down menu after the input field to indicate which one). This is not the same as your elevation above sea level; it's your height above (or below) the land and geographical features in your vicinity. So if you're on a hill, your elevation is the height of the hill. If you're on a mountain and you're surrounded by other mountains of the same height, your relative elevation would be zero. This input is only necessary for computing accurate values for the times of sunrise and sunset, so you can leave this set to the default value of "0" if you don't know your elevation or if you're not interested in extremely accurate sunrise/set outputs.

Time
Indicate the time you are interested in calculating sun angles for, using "12:34" or "1234" notation. You can indicate morning (AM), afternoon (PM), or 24-hour time using the pull-down menu to the right of the text field. 12:00 AM is considered to be midnight, and 12:00 PM is noon (it's best to actually avoid these confusing cases and use 11:59 or 12:01 to be safe). Note: pay special attention to the AM/PM/24 indicator...it's a common error to forget to set this correctly.

Time Zone
Select the time zone which includes the location you're interested. There are 36 time zones in the menu, all specified by a standard letter designation and the time difference from Greenwich Mean Time (GMT) when daylight savings time is not active. If you are unsure of your time zone, you can look it up. The program checks to see if the time zone you selected is anywhere near the longitude of your location...if they're too far apart it will alert you.

Time Basis
The time you enter in the Time input field can be either clock time or local solar time (LSOT). Clock time, which is the default value of this input, is the time you'd observe on any time keeping device. Solar time is a system based more exactly on the cycle of the sun...it differs from clock time since the latter standardizes time to suit the practical needs of modern society.

Daylight Savings
Daylight savings time (DST) is observed in most locations around the world by setting clocks ahead one hour during the summer. If DST is in effect on the date you're investigating, set the Daylight savings input to Yes. I'll be adding a chart of DST information soon; in the meantime the TimePalette program (also shareware) has a great deal of DST information.

When you've entered all of the inputs, click on the Calculate button, and the results will appear in the Outputs section immediately.

Note that you can click on the labels of any input or output field to learn more about it.

Altitude Angle close window

The altitude angle (sometimes referred to as the "solar elevation angle") describes how high the sun appears in the sky. The angle is measured between an imaginary line between the observer and the sun and the horizontal plane the observer is standing on. The altitude angle is negative when the sun drops below the horizon. (In this graphic, replace "N" with "S" for observers in the Southern Hemisphere.)

The altitude angle is calculated as follows:

sin (Al) = [cos (L) * cos (D) * cos (H)] + [sin (L) * sin (D)]

where:

Al = Solar altitude angle

L = Latitude (negative for Southern Hemisphere)

D = Declination (negative for Southern Hemisphere)

H = Hour angle

Azimuth Angle close window

The solar azimuth angle is the angular distance between due South (see note below) and the projection of the line of sight to the sun on the ground. A positive solar azimuth angle indicates a position East of South, and a negative azimuth angle indicates West of South.

The azimuth angle is calculated as follows:

cos (Az) = (sin (Al) * sin (L) - sin (D)) / (cos (Al) * cos (L))

where:

Az = Solar azimuth angle

Al = Solar altitude angle

L = Latitude (negative for Southern Hemisphere)

D = Declination (negative for Southern Hemisphere)

The sign of the azimuth angle also needs to be made equal to the sign of the hour angle when using the above equation.

Note that SunAngle now allows for North to optionally serve as the zero-azimuth instead of South. This can be selected in the inputs section above.

Thanks to Oddbjorn Grandum for the updated azimuth angle calculation, which is accurate for results > 90 degrees, and to Terry Leier for additional refinements!

Time Basis close window

There are two important ways of describing time when calculating sun angles. "Clock time" is the artificial time that we use in everyday life to standardize our time measurements. It allows people in different locations to use the same time or to easily convert time from one location to another.

"Local solar time" (or simply "solar time") is the time according to the position of the sun in the sky relative to one specific location on the ground. In solar time, the sun is always due south (or north in the southern hemisphere) at exactly noon. This means that someone a few miles east or west of you will realize a slightly different solar time than you, although your clock time is probably the same.

For the purpose of calculating local solar time, clock time must modified to compensate for three things: (1) the relationship between the local time zone annd the local longitude, (2) daylight savings time, and (3) the earth's slightly-irregular motion around the sun (corrected for using the equation of time).

Local solar time (LSoT) is calculated as follows:

LSoT = LST + 4 minutes * (LL - LSTM) + ET

Where:

LST (local standard time) = Clock time, adjusted for daylight savings time if necessary.

LL = The local longitude; positive = East, and negative = West.

LSTM = The local standard time meridian, measured in degrees, which runs through the center of each time zone. It can be calculated by multiplying the differences in hours from Greenwich Mean Time by 15 degrees per hour. Positive = East, and negative = West.

ET = The equation of time adjustment in minutes

Note that if the site is east of the LSTM, the (LL - LSTM) factor should be a positive number, and if it is west it should be negative.

The "4" in the equation is the quotient of 60 minutes of time and the 15 degrees of longitude that the earth rotates in that time (i.e., the earth rotates one degree every four minutes).

To convert from LSoT to clock time, perform the reverse of this formula.

In the input section of SunAngle, you should indicate whether the time you entered is based on clock time or solar time. The output section then includes both clock time and solar time for reference.

Hour Angle close window

The hour angle is an expression describing the difference between local solar time and solar noon. Although it is calculated directly from measurements of time, it is expressed in angular units (degrees).

The hour angle measures time before solar noon in terms of one degree for every four minutes, or fifteen per hour. Time after solar noon is expressed using a negative hour angle. Therefore, at two hours before solar noon the hour angle is 30 degrees, and at two hours after solar noon it is -30 degrees. This chart depicts the relationship between the hour angle and local solar time ("N" represents North but would be South in the Southern Hemisphere).

Note that the hour angle does not represent the altitude of the sun in the sky because it is a measurement of time. The sun rises and sets when its altitude is zero degrees, not necessarily when its hour angle is +/- 90 degrees.

Declination close window

Declination is the angular distance of the sun north or south of the earth's equator.

The earth's equator is tilted 23.45 degrees with respect to the plane of the earth's orbit around the sun, so at various times during the year, as the earth orbits the sun, declination varies from 23.45 degrees north to 23.45 degrees south.

This gives rise to the seasons. Around December 21, the northern hemisphere of the earth is tilted 23.45 degrees away from the sun, which is the winter solstice for the northern hemisphere and the summer solstice for the southern hemisphere. Around June 21, the southern hemisphere is tilted 23.45 degrees away from the sun, which is the summer solstice for the northern hemisphere and winter solstice for the southern hemisphere. On March 21 and September 21 are the fall and spring equinoxes when the sun is passing directly over the equator. Note that the tropics of cancer and capricorn mark the maximum declination of the sun in each hemisphere.

Declination is calculated with the following formula:

d = 23.45 * sin [360 / 365 * (284 + N)]

Where:

d = declination

N = day number, January 1 = day 1

Note: SunAngle currently uses a more sophisticated algorithm for declination calculations than this method, but the formula on this page suffices for most applications. Please view the source code of this page if you'd like to review the algorithm actually being used.

Equation of Time close window

The equation of time (EOT) is a formula used in the process of converting between solar time and clock time to compensate for the earth's elliptical orbit around the sun and its axial tilt. Essentially, the earth does not move perfectly smoothly in a perfectly circular orbit, so the EOT adjusts for that. Graphically, it appears as:

For example, the EOT adjustment in mid-February is about -14 minutes. So when converting clock time to local solar time, you'd subtract 14 minutes. When converting from local solar time to clock time, you'd add 14 minutes.

The EOT can be approximated by the following formula:

E = 9.87 * sin (2B) - 7.53 * cos (B) - 1.5 * sin (B)

Where:

B = 360 * (N - 81) / 365

Where:

N = day number, January 1 = day 1

Note: The SunAngle program currently uses a more sophisticated algorithm for EOT calculations, but the above formula is a decent approximation and much simpler. Note also that the EOT output is in hours, so please multiply by 60 if you'd like to obtain results in minutes.

Sunrise / Sunset close window

The times of sunrise and sunset are calculated as the times of morning and evening that the sun is apparently at the horizon. In the outputs section of SunAngle, sunrise and sunset times are given in clock time.

The sun would normally appear to be exactly on the horizon when its altitude angle is zero degrees, except that the atmosphere refracts sunlight when it's low in the sky, and the observer's elevation relative to surrounding terrain also impacts the apparent time of sunrise and sunset. The difference between the time of apparent sunrise or sunset and the time when the sun's altitude angle is zero is usually on the order of several minutes, so it's necessary to correct for these factors in order to obtain an accurate result.

The times of sunrise and sunset are calculated by computing the hour angle when the altitude angle is a certain value, then converting the hour angle to clock time. The value used for the altitude angle when the sun is apparently on the horizon is:

Al = -0.8333 - 0.347 * sqrt (elevation in meters)

If we then take the altitude angle equation:

sin (Al) = [cos (L) * cos (D) * cos (H)] + [sin (L) * sin (D)]

where:

Al = Solar altitude angle

L = Latitude (negative for Southern Hemisphere)

D = Declination (negative for Southern Hemisphere)

H = Hour angle

and solve for the hour angle, setting Al equal to the equation above that corrects for refraction and elevation, we get:

H = cos-1[-1 * (sin (L) * sin (D) - sin (-0.8333 - 0.0347 (sqrt (elev)))) / (cos (L) * cos (D))]

Note that "cos-1" represents the inverse cosine function. The hour angle is converted to a number of minutes by multiplying the angle by 4 minutes per degree of hour angle, then that number of minutes is subtracted from 12:00 noon for the time of sunrise and added to 12:00 noon for the time of sunset, both in local solar time (LSoT). LSoT is then converted into clock time by performing the reverse of the calculations described on the time basis page.

For U.S. cities, there are tables of sunrise and sunset times available from the U.S. Naval Observatory Astronomical Applications Department.

close window