Accurate computation of solar position plays a fundamental role in solar energy applications, especially for concentrating systems. The required accuracy varies over a wide range, depending on the application: flat systems tolerate errors of a few degrees without significant losses, while high-concentration systems can require an accuracy of the order of 0.01º. More specific applications, such as the calibration of pyranometers ( Reda and Andreas, 2004 ), require an even greater accuracy.

Despite its apparent simplicity, accurate computation of the solar position is a quite difficult task. Indeed, the apparent motion of the sun is subject to a high number of perturbations: precession and nutation of the rotation axis of the earth, perturbations caused by the moon, the decreasing rotation speed of the earth, and the effects of other planets. All these factors affect the computation in different ways.

Several algorithms for computing the solar position with different levels of accuracy and complexity can be found in the solar engineering literature. Simple formulas ( Cooper, 1969; Spencer, 1971; Swift, 1976; Lamm, 1981 ) that find the declination or the equation of time usually have errors of the order of tenths of degree. A more complex algorithm was proposed by Pitman and Vant-Hull (1978) , with a maximum error of 0.02º; some years later Walraven published another algorithm ( Walraven, 1978 ) with an error of 0.013º, followed by corrections and comments ( Walraven, 1979; Archer, 1980; Wilkinson, 1981; Ilyas, 1983; Pascoe, 1984 ). Another algorithm was proposed by Michalsky 10 years later ( Michalsky, 1988 ); it is based on The Astronomical Almanac (1985) , and it reduces the maximum error to 0.01º. Two other algorithms with lower errors, but also with a shorter time range of validity, were proposed in the following years ( Blanco-Muriel et al., 2001; Grena, 2008 ). All these algorithms have quite simple implementations and low computational complexity.

There are a few different algorithms to find the position of the Sun (solar zenith and azimuth angles), all with different precision and characteristics.

Here are some of them:

**Solar Position Algorithm (NREL) :**

Algorithm written by I. Reda and A. Andreas of NREL, based on the algorithm described by Jean Meeus (1998), It’s valid to calculate the solar zenith and azimuth angles in the period from the year -2000 to 6000, with uncertainties of ±0.0003º.

The code it’s available in C language and fully described here

Translated for Matlab here and for Python Sunpy

**Michalsky’s method** :

The method described by J. Michalsky in 1988 is limited to the period from 1950 to 2050 with uncertainty of greater than ±0.01º but it’s much faster and easy to manage than the method of Meeus and normally the uncertainty is more than acceptable for engineering tasks.

Code in Fortran 90 here.

**References
**

Blanco-Muriel et al., 2001 M. Blanco-Muriel D.C. Alarcon-Padilla T. Lopea-Moratalla M. Lara-Coira , Computing the solar vector Solar Energy Volume 70 Issue 2001 Pages 431 – 441

Cooper, 1969 P.I. Cooper , The absorption of radiation in solar stills Solar Energy Volume 12 Issue 1969 Pages 333 – 346

Grena, 2008 R. Grena , An algorithm for the computation of the solar position Solar Energy Volume 82 Issue 2008 Pages 462 – 470

Lamm, 1981 L.O. Lamm , A new analytic expression for the equation of time Solar Energy Volume 26 Issue 1981 Pages 465 –

Meeus, 1998 J. Meeus , Astronomical Algorithms second ed. 1998 Willmann-Bell Inc

Michalsky, 1988 J.J. Michalsky , The astronomical Almanac???s algorithm for approximate solar position (1950???2050) Solar Energy Volume 40 Issue 1988 Pages 227 – 235

Pascoe, 1984 D.J.B. Pascoe , Comments on Solar position programs: refraction, sidereal time and Sunset/Sunrise Solar Energy Volume 34 Issue 1984 Pages 205 – 206

Reda and Andreas, 2004 I. Reda A. Andreas , Solar position algorithm for solar radiation applications Solar Energy Volume 76 Issue 2004 Pages 577 – 589

Spencer, 1971 J.W. Spencer , Fourier series representation of the position of the Sun Search Volume 2 Issue 1971 Pages 172 – 173

Swift, 1976 L.W. Swift , Algorithm for solar radiation on mountain slopes Water Resour. Res. Volume 12 Issue 1976 Pages 108 – 112

The Astronomical Almanac, 1985 The Astronomical Almanac, 1985, 1986 ed. US Gov. Printing Office, Washington, DC.

Walraven, 1978 R. Walraven , Calculating the position of the Sun Solar Energy Volume 20 Issue 1978 Pages 393 – 397

Walraven, 1979 R. Walraven , Erratum Solar Energy Volume 22 Issue 1979 Pages 195 –

Wilkinson, 1981 B.J. Wilkinson , An improved FORTRAN program for the rapid calculation of the solar position Solar Energy Volume 27 Issue 1981 Pages 67 – 68

Aubrey“Where is the Sun ?? (Solar position algorithms) | Solar Energy Research”

ended up being a very nice post, . Keep writing and

I will keep on reading through! Thanks for your time -Aaron