Fork SolTrack on GitHub

Get SolTrack at Fast, secure and Free Open Source software downloads     SolTrack home page     Get SolTrack at Fast, secure and Free Open Source software downloads

GNU Lesser General Public Licence, version 3 SolTrack is a free, fast and accurate C/C++ routine to compute the position of the Sun. In addition, SolTrack computes rise and set times and azimuths, and transit times and altitudes. The code can be used to track the Sun on a low-specs machine, such as a microcontroller or PLC, and can be used for e.g. (highly) concentrated (photovoltaic) solar power or accurate solar-energy modelling. SolTrack has been developed by Marc van der Sluys, Paul van Kan and Jurgen Reintjes, at the Lectorate of Sustainable Energy at the HAN University of Applied Sciences in Arnhem, the Netherlands. The code is based on the astronomical Fortran library libTheSky and can be used, modified and distributed under the conditions of version 3 of the GNU Lesser General Public Licence.

Description, speed and accuracy

See also the poster and conference proceedings we presented on CPV-11 in April 2015.

SolTrack is a simple C/C++ routine that can compute the position of the Sun in topocentric coordinates, both in a horizontal and in an equatorial system. The code is based on the Fortran library libTheSky and includes corrections for aberration and parallax, and a simple routine to correct for atmospheric refraction, taking into account local atmospheric conditions. We compared the performance of SolTrack to detailed calculations using the planetary theories VSOP 87 and an accurate model for atmospheric refraction.

We tested SolTrack for 100,000 random moments in the next 100 years (between 2017 and 2116) when the Sun is above the horizon in the Netherlands (latitude ∼52°N). We find that the mean error in position is 0.0030 ± 0.0016°, which is sufficient for solar tracking of CPV systems under all conditions. The code can compute ten million positions in 6.47 ± 0.03s on a single 2.67 GHz CPU core when only horizontal coordinates (azimuth and altitude) are computed, and takes 8.16 ± 0.02s (26% slower) if refraction-corrected parallactic coordinates are also calculated. In addition to positions, SolTrack can also compute the distance to the Sun, its rise, transit and set times, and its rise and set azimuth and transit altitude.

When compared to the PSA SunPos routine, which is also light-weight and freely available, SolTrack is 24 times more accurate (0.073°) and 2% faster. When computing additional refraction-corrected equatorial coordinates, SolTrack is 23% slower than SunPos. We also compared the performance of SolTrack to the NREL SPA routine, which is more elaborate and has a more restricted licence. SPA is 24% more accurate than SolTrack (0.0023°), but also 20 times slower, where we computed only the Sun's position in SPA (not its rise and set times or incident radiation) and included the additional refraction-corrected equatorial coordinates in SolTrack. A paper describing more details is forthcoming.

Code download and documentation

  • SolTrack project page   on SourceForge (code/binary download, bug reports, etc.)
    • 2017-09-09: v2.2 released
    • 2017-04-15: v2.1 released
    • 2017-02-22: v2.0 released
    • 2015-04-11: v1.1 released
    • 2014-11-10: v1.0 released (first stable release)

  • Code documentation   generated by Doxygen

Installing SolTrack

The SolTrack tarball contains CMake installer files for (semi)automatic compilation and installation of the shared (and if desired static) library. See doc/INSTALL for more information.

SolTrack has an ebuild for easy installation in Gentoo Linux and has been included in Arch Linux's AUR. Binary packages (.deb and .rpm) are available for e.g. Debian, (*)Ubuntu, Red Hat, Fedora, CentOS, Scientific Linux, SUSE and many others.


The examples/ directory lists two example programs that can be linked against the SolTrack library, and which compute either data for a single instance, or read dates from a file and compute the corresponding positions. Example output is provided to verify the results.

SolTrack has been used by:


You can contact the authors (preferably through email) via this page.