Class SPA

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

public final class SPA extends Object
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.

This is not a port of the C code, but a re-implementation based on the published procedure.

Author:
Klaus Brunner
  • 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. 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.
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      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. See JulianDate(ZonedDateTime, double) and DeltaT.
      Throws:
      IllegalArgumentException - for nonsensical latitude/longitude