Class SPA
This follows the SPA algorithm described in Reda, I.; Andreas, A. (2003): Solar Position Algorithm for Solar Radiation Applications. NREL Report No. TP-560-34302, Revised January 2008.
This is not a port of the C code, but a re-implementation based on the published procedure.
- Author:
- Klaus Brunner
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final doublestatic final doublestatic final double -
Method Summary
Modifier and TypeMethodDescriptionstatic AzimuthZenithAnglecalculateSolarPosition(ZonedDateTime date, double latitude, double longitude, double elevation, double deltaT) Calculate topocentric solar position, i.e.static AzimuthZenithAnglecalculateSolarPosition(ZonedDateTime date, double latitude, double longitude, double elevation, double deltaT, double pressure, double temperature) Calculate topocentric solar position, i.e.static SunriseTransitSetcalculateSunriseTransitSet(ZonedDateTime day, double latitude, double longitude, double deltaT) Calculate the times of sunrise, sun transit (solar noon), and sunset for a given day.static SunriseTransitSetcalculateSunriseTransitSet(ZonedDateTime day, double latitude, double longitude, double deltaT, double elevationAngle) Calculate the times of sunrise, sun transit (solar noon), and sunset for a given day.
-
Field Details
-
SUNRISE_SUNSET
public static final double SUNRISE_SUNSET- See Also:
-
CIVIL_TWILIGHT
public static final double CIVIL_TWILIGHT- See Also:
-
NAUTICAL_TWILIGHT
public static final double NAUTICAL_TWILIGHT- See Also:
-
ASTRONOMICAL_TWILIGHT
public static final double ASTRONOMICAL_TWILIGHT- See Also:
-
-
Method Details
-
calculateSolarPosition
public static AzimuthZenithAngle calculateSolarPosition(ZonedDateTime date, double latitude, double longitude, double elevation, double deltaT, double pressure, double temperature) Calculate topocentric solar position, i.e. the location of the sun on the sky for a certain point in time on a certain point of the Earth's surface.This follows the SPA algorithm described in Reda, I.; Andreas, A. (2003): Solar Position Algorithm for Solar Radiation Applications. NREL Report No. TP-560-34302, Revised January 2008. The algorithm is supposed to work for the years -2000 to 6000, with uncertainties of +/-0.0003 degrees.
- Parameters:
date- Observer's local date and time.latitude- Observer's latitude, in degrees (negative south of equator).longitude- Observer's longitude, in degrees (negative west of Greenwich).elevation- Observer's elevation, in meters.deltaT- Difference between earth rotation time and terrestrial time (or Universal Time and Terrestrial Time), in seconds. SeeJulianDate(ZonedDateTime, double)andDeltaT.pressure- Annual average local pressure, in millibars (or hectopascals). Used for refraction correction of zenith angle. If unsure, 1000 is a reasonable default.temperature- Annual average local temperature, in degrees Celsius. Used for refraction correction of zenith angle.- Returns:
- Topocentric solar position (azimuth measured eastward from north)
- Throws:
IllegalArgumentException- for nonsensical latitude/longitude- See Also:
-
calculateSolarPosition
public static AzimuthZenithAngle calculateSolarPosition(ZonedDateTime date, double latitude, double longitude, double elevation, double deltaT) Calculate topocentric solar position, i.e. the location of the sun on the sky for a certain point in time on a certain point of the Earth's surface.This follows the SPA algorithm described in Reda, I.; Andreas, A. (2003): Solar Position Algorithm for Solar Radiation Applications. NREL Report No. TP-560-34302, Revised January 2008. The algorithm is supposed to work for the years -2000 to 6000, with uncertainties of +/-0.0003 degrees.
This method does not perform refraction correction.
- Parameters:
date- Observer's local date and time.latitude- Observer's latitude, in degrees (negative south of equator).longitude- Observer's longitude, in degrees (negative west of Greenwich).elevation- Observer's elevation, in meters.deltaT- Difference between earth rotation time and terrestrial time (or Universal Time and Terrestrial Time), in seconds. SeeJulianDate(ZonedDateTime, double)andDeltaT.- Returns:
- Topocentric solar position (azimuth measured eastward from north)
- Throws:
IllegalArgumentException- for nonsensical latitude/longitude- See Also:
-
calculateSunriseTransitSet
public static SunriseTransitSet calculateSunriseTransitSet(ZonedDateTime day, double latitude, double longitude, double deltaT) Calculate the times of sunrise, sun transit (solar noon), and sunset for a given day. The calculation is based on the astronomical definition of sunrise and sunset, using a refraction correction of -0.8333°.- Parameters:
day- GregorianCalendar of day for which sunrise/transit/sunset are to be calculated. The time of day (hour, minute, second, millisecond) is ignored.latitude- Observer's latitude, in degrees (negative south of equator).longitude- Observer's longitude, in degrees (negative west of Greenwich).deltaT- Difference between earth rotation time and terrestrial time (or Universal Time and Terrestrial Time), in seconds. SeeJulianDate(ZonedDateTime, double)andDeltaT.- Throws:
IllegalArgumentException- for nonsensical latitude/longitude
-
calculateSunriseTransitSet
public static SunriseTransitSet calculateSunriseTransitSet(ZonedDateTime day, double latitude, double longitude, double deltaT, double elevationAngle) Calculate the times of sunrise, sun transit (solar noon), and sunset for a given day. The definition of sunrise or sunset can be chosen as an elevation angle.This method's signature is unstable and may change.
- Parameters:
day- GregorianCalendar of day for which sunrise/transit/sunset are to be calculated. The time of day (hour, minute, second, millisecond) is ignored.latitude- Observer's latitude, in degrees (negative south of equator).longitude- Observer's longitude, in degrees (negative west of Greenwich).deltaT- Difference between earth rotation time and terrestrial time (or Universal Time and Terrestrial Time), in seconds. SeeJulianDate(ZonedDateTime, double)andDeltaT.elevationAngle- Sun's elevation in degrees to consider as sunrise/sunset. This can be used to calculate twilight times.- Throws:
IllegalArgumentException- for nonsensical latitude/longitude
-