java.lang.Object
net.e175.klaus.solarpositioning.SPA

public final class SPA extends Object
Calculate topocentric solar position and sunrise/sunset/twilight times using the NREL SPA algorithm.

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.

Autor:
Klaus Brunner
  • Methodendetails

    • calculateSolarPosition

      public static SolarPosition calculateSolarPosition(ZonedDateTime date, double latitude, double longitude, double elevation, double deltaT, double pressure, double temperature)
      Calculate topocentric solar position: 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.

      Parameter:
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      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.
      Gibt zurück:
      Topocentric solar position (azimuth measured eastward from north)
      Löst aus:
      IllegalArgumentException - for nonsensical latitude/longitude
      Siehe auch:
    • calculateSolarPosition

      public static SolarPosition calculateSolarPosition(ZonedDateTime date, double latitude, double longitude, double elevation, double deltaT)
      Calculate topocentric solar position: 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.

      Parameter:
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      Gibt zurück:
      Topocentric solar position (azimuth measured eastward from north)
      Löst aus:
      IllegalArgumentException - for nonsensical latitude/longitude
      Siehe auch:
    • calculateSunriseTransitSet

      public static SunriseResult 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°.
      Parameter:
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      Gibt zurück:
      An implementation of SunriseResult depending on the type of day.
      Löst aus:
      IllegalArgumentException - for nonsensical latitude/longitude
    • calculateSunriseTransitSet

      public static SunriseResult calculateSunriseTransitSet(ZonedDateTime day, double latitude, double longitude, double deltaT, SPA.Horizon horizon)
      Calculate the times of sunrise, sun transit (solar noon), and sunset for a given day. The definition of sunrise or sunset can be chosen based on a horizon type (defined via its elevation angle).
      Parameter:
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      horizon - Horizon (basically, elevation angle) to use as the sunrise/sunset definition. This can be used to calculate twilight times.
      Gibt zurück:
      An implementation of SunriseResult depending on the type of day.
      Löst aus:
      IllegalArgumentException - for nonsensical latitude/longitude
    • calculateSunriseTransitSet

      public static Map<SPA.Horizon,SunriseResult> calculateSunriseTransitSet(ZonedDateTime day, double latitude, double longitude, double deltaT, SPA.Horizon... horizons)
      Calculate the times of sunrise, sun transit (solar noon), and sunset for a given day and horizon types. This is useful to get sunrise/sunset and multiple twilight times in one call and is expected to be faster than separate calls.
      Parameter:
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      horizons - Horizons (basically, elevation angles) to use as the sunrise/sunset definition. This can be used to calculate twilight times.
      Gibt zurück:
      A Map with one key-value pair for each unique horizon type and SunriseResult. This map may or may not be mutable.
      Löst aus:
      IllegalArgumentException - for nonsensical latitude/longitude