NREL's Solar and Moon Position Algorithm (SAMPA)

This algorithm calculates the solar and lunar zenith and azimuth angles in the period from the year -2000 to 6000, with uncertainties of +/- 0.0003 degrees for the Sun and +/- 0.003 degrees for the Moon, based on the date, time, and location on Earth. The algorithm can be used for solar eclipse monitoring and estimating the reduction in solar irradiance for many applications, such as smart grid, solar energy, etc. The software has not been tested on a variety of platforms and is not guaranteed to work on yours. It is provided here as a convenience.

How to use this algorithm and a description of the variables is included in the sampa.h header file. Further information on this algorithm is available in the following NREL technical report:

Reda, I. (2010). Solar Eclipse Monitoring for Solar Energy Applications Using the Solar and Moon Position Algorithms. 35 pp.; NREL Report No. TP-3B0-47681. (927 KB PDF Document)


SAMPA.C

Distributed by the National Renewable Energy Laboratory
Solar Radiation Research Laboratory
August 2012

NOTICE
Copyright © 2012 the Alliance for Sustainable Energy, LLC, All Rights Reserved
This computer software is prepared by the Alliance for Sustainable Energy, LLC, (hereinafter the "Contractor"), under Contract DE-AC36-08GO28308 ("Contract") with the Department of Energy ("DOE"). The United States Government has been granted for itself and others acting on its behalf a paid-up, non-exclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, and perform publicly and display publicly. Beginning five (5) years after the date permission to assert copyright is obtained from DOE, and subject to any subsequent five (5) year renewals, the United States Government is granted for itself and others acting on its behalf a paid-up, non-exclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so. If the Contractor ceases to make this computer software available, it may be obtained from DOE's Office of Scientific and Technical Information's Energy Science and Technology Software Center (ESTSC) at PO Box 1020, Oak Ridge, TN 37831-1020. THIS SOFTWARE IS PROVIDED BY THE CONTRACTOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRACTOR, DOE, OR THE U.S GOVERNMENT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER, INCLUDING BUT NOT LIMITED TO CLAIMS ASSOCIATED WITH THE LOSS OF DATA OR PROFITS, WHICH MAY RESULT FROM AN ACTION IN CONTRACT, NEGLIGENCE OR OTHER TORTIOUS CLAIM THAT ARISES OUT OF OR IN CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
The software is being provided for internal, noncommercial purposes only and shall not be re-distributed. Please contact Jennifer Ramsey in the NREL Commercialization and Technology Transfer Office for information concerning a commercial license to use the software.
As a condition of using the software in an application, the developer of the application agrees to reference the use of the software and make this notice readily accessible to any end-user in a Help|About screen or equivalent manner.


This section contains six C codes:

Note: An online SAMPA calculator that uses this source code is also available.


To download SAMPA.C, please accept the license terms above and submit the following information:
*Required
We will not share this information with other companies or agencies outside the US Department of Energy.



[NREL] [MIDC] [SAMPA Calculator]