Interface SolarTime.Calculator

All Known Implementing Classes:
StdSolarCalculator
Enclosing class:
SolarTime

public static interface SolarTime.Calculator

An SPI-interface representing a facade for the calculation engine regarding sunrise or sunset.

Note: All implementations must have a public no-arg constructor.

Since:
3.34/4.29
See Also:
ServiceLoader
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    equationOfTime​(double jde)
    Calculates the difference between true and mean solar time.
    default double
    getFeature​(double jde, String nameOfFeature)
    Calculates a value suitable for given time and feature.
    default double
    getGeodeticAngle​(double latitude, int altitude)
    Calculates the additional geodetic angle due to the extra altitude of the observer.
    default double
    getZenithAngle​(double latitude, int altitude)
    Calculates the angle of the sun relative to the zenith at sunrise or sunset.
    Obtains the name of the calculation method.
    sunrise​(CalendarDate date, double latitude, double longitude, double zenith)
    Calculates the moment of sunrise.
    sunset​(CalendarDate date, double latitude, double longitude, double zenith)
    Calculates the moment of sunset.
  • Method Details

    • name

      String name()

      Obtains the name of the calculation method.

      Returns:
      String
    • sunrise

      Optional<Moment> sunrise(CalendarDate date, double latitude, double longitude, double zenith)

      Calculates the moment of sunrise.

      Parameters:
      date - the local calendar date
      latitude - geographical latitude in degrees, positive for North, negative for South
      longitude - geographical longitude in degrees, positive for East, negative for West
      zenith - the distance of the center of the sun from geographical local zenith in degrees
      Returns:
      moment of sunrise if it exists for given parameters else not present (polar day or night)
      Throws:
      IllegalArgumentException - if any parameter is out of range
    • sunset

      Optional<Moment> sunset(CalendarDate date, double latitude, double longitude, double zenith)

      Calculates the moment of sunset.

      Parameters:
      date - the local calendar date
      latitude - geographical latitude in degrees, positive for North, negative for South
      longitude - geographical longitude in degrees, positive for East, negative for West
      zenith - the distance of the center of the sun from geographical local zenith in degrees
      Returns:
      moment of sunset if it exists for given parameters else not present (polar day or night)
      Throws:
      IllegalArgumentException - if any parameter is out of range
    • equationOfTime

      double equationOfTime(double jde)

      Calculates the difference between true and mean solar time.

      Parameters:
      jde - julian day in ephemeris time
      Returns:
      value in seconds
    • getFeature

      default double getFeature(double jde, String nameOfFeature)

      Calculates a value suitable for given time and feature.

      Subclasses overriding this method document which features are supported. At least the feature of "declination" should be supported.

      Parameters:
      jde - julian day in ephemeris time
      nameOfFeature - describes what kind of value shall be calculated
      Returns:
      result value or Double.NaN if the feature is not supported
    • getGeodeticAngle

      default double getGeodeticAngle(double latitude, int altitude)

      Calculates the additional geodetic angle due to the extra altitude of the observer.

      The default implementation just returns 0.0.

      Parameters:
      latitude - the geographical latitude in degrees
      altitude - the altitude of the observer in meters
      Returns:
      geodetic angle correction in degrees
      Since:
      3.36/4.31
    • getZenithAngle

      default double getZenithAngle(double latitude, int altitude)

      Calculates the angle of the sun relative to the zenith at sunrise or sunset.

      The default implementation just uses the standard refraction angle of 34 arc minutes, adds to it 90° and the geodetic angle correction.

      Parameters:
      latitude - the geographical latitude in degrees
      altitude - the altitude of the observer in meters
      Returns:
      effective zenith angle in degrees
      Since:
      3.36/4.31