MSPA

A mex interface function to the C function spa.c developed by NREL for computing solar position.
469 Downloads
Updated 23 Aug 2011

View License

The MATLAB function mspa is a mex interface function to the C function spa.c developed by National Renewable Energy Laboratory (NREL) for accurately computing the position of the sun on the sky.

The algorithm on which the reference implementation spa.c is based is described in the report "Solar position algorithm for solar radiation application" by Ibrahim Reda and Afshin Andreas, National Renewable Energy Laboratory (NREL) Technical report NREL/TP-560-34302, Revised January 2008.

The report is available from
http://rredc.nrel.gov/solar/codesandalgorithms/spa/
There is also a link from which the reference implementation spa.c and a corresponding spa.h file can be downloaded.

Once the zip-file in this submission is unpacked and the files spa.c and spa.h downloaded to the same directory, the mex interface function can be compiled with mex mspa.c spa.c

The calling syntax of mspa is
res = mspa( arg )
where arg is a column vector with 17 rows containing the arguments to the function spa.c, and res is a column vector containing the results of the function spa. The ordering of individual parameters in the argument follows the one described in the report, look at the file mspa_tester.m for details.

A valid argument arg can also hold multiple columns, i.e. it can be a 17 x n matrix where n > 1. If so, the result is also a matrix with equally many columns and each column of the result holds the result of the function spa evaluated for the corresponding column of the argument matrix.

Cite As

Anders Lennartsson (2024). MSPA (https://www.mathworks.com/matlabcentral/fileexchange/32507-mspa), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Gravitation, Cosmology & Astrophysics in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

.

1.0.0.0