Solar and Lunar Position Calculators
NREL's Measurement & Instrumentation Data Center provides web based applications for calculating solar and lunar position and/or solar intesity. Please remember that the amount of solar energy received by the Earth is highly variable both in time and space (from location to location), and that these mathematical models cannot be expected to produce an exact replication of any given set of physical conditions.
SOLPOS: SOLPOS calculates the location of the Sun in the sky and its intensity for any given location, day, and time. Valid from the year 1950 to 2050, with an uncertainty of +/- 0.01 degrees.
Solar Position Algorithm (SPA): SPA calculates the location of the Sun in the sky (and various other values). Valid from the year -2000 to 6000, with an uncertainty of +/- 0.0003 degrees.
Solar and Moon Position Algorithm (SAMPA): SAMPA calculates the location of the Sun and Moon in the sky for the purpose of solar eclipse monitoring and for estimating the influence on solar irradiance. Valid from the year -2000 to 6000, with an uncertainty of +/- 0.0003 degrees for the Sun position and +/- 0.003 degrees for the Moon position.
For more information about these algorithms and the C source codes.