Solar Positioning in Java
2010-12-12
This is a Java library containing algorithms for finding the sun’s position on the sky for a given date and latitude and longitude (and other parameters). Currently, the PSA algorithm by Blanco-Muriel et al. and the SPA algorithm by Reda and Andreas are included.
Sample Usage
import net.e175.klaus.solarpositioning.*;
public class App {
public static void main(String[] args) {
final GregorianCalendar dateTime = new GregorianCalendar();
final double latitude = 48.21;
final double longitude = 16.37;
AzimuthZenithAngle position = PSA.calculateSolarPosition(dateTime,
latitude,
longitude);
System.out.println("PSA: " + position);
position = SPA.calculateSolarPosition(dateTime,
latitude,
longitude,
190, // elevation
67, // delta T
1010, // avg. air pressure
11); // avg. air temperature
System.out.println("SPA: " + position);
}
}
