Calculation of sunrise and sunset: Difference between revisions

From WickyWiki
mNo edit summary
mNo edit summary
Line 22: Line 22:
   vDecl = 0.006918 - 0.399912 * COS(vY) + 0.070257 * SIN(vY) - 0.006758 * COS(2 * vY) + 0.000907 * SIN(2 * vY) - 0.002697 * COS(3 * vY) + 0.00148 * SIN (3 * vY)
   vDecl = 0.006918 - 0.399912 * COS(vY) + 0.070257 * SIN(vY) - 0.006758 * COS(2 * vY) + 0.000907 * SIN(2 * vY) - 0.002697 * COS(3 * vY) + 0.00148 * SIN (3 * vY)


For sunrise or sunset, the zenith is set to 90.833 degrees (the approximate correction for atmospheric refraction at sunrise and sunset, and the size of the solar disk). Hours angle:
For sunrise or sunset, the zenith is set to 90.833 degrees (the approximate correction for atmospheric refraction at sunrise and sunset, and the size of the solar disk). Hours angle (radians):


   vHa = ACOS( COS( RADIANS(90.833) ) / COS(vLat) * COS(vDecl) - TAN(vLat) * TAN(vDecl) )
   vHa = ACOS( COS( TO_RADIANS(90.833) ) / COS(vLat) * COS(vDecl) - TAN(vLat) * TAN(vDecl) )


Sunrise UTC minutes
Sunrise UTC minutes


   vUtcMinsSunrise = 360 * 2 - 4 * (vLon + vHa) - vEqtime
   vUtcMinsSunrise = 360 * 2 - 4 * (vLon + TO_DEGREES(vHa) ) - vEqtime


Noon UTC minutes
Noon UTC minutes
Line 36: Line 36:
Sunset UTC minutes
Sunset UTC minutes


   vUtcMinsSunset = 360 * 2 - 4 * (vLon - vHa) - vEqtime
   vUtcMinsSunset = 360 * 2 - 4 * (vLon - TO_DEGREES(vHa) ) - vEqtime


Sunrise local time (fractional day). For Europe/Amsterdam --> vTimezone=+1 or +2 (DST)
Sunset local time in fractional day. For Europe/Amsterdam --> vTimezone=+1 or +2 (DST)


   (vUtcMinsSunrise / 60 + vTimezone) / 24
   (vUtcMinsSunset / 60 + vTimezone) / 24

Revision as of 12:37, 3 March 2019


Source:

Input example:

  • Date --> vDayOfYear
  • Date --> vLeapyear

Fractional year (radians)

 vY = 2 * PI() / (365 + vLeapYear) * (vDayOfYear - 1 )

Equation of time (minutes)

 vEqtime = 229.18 * (0.000075 + 0.001868 * COS( vY ) - 0.032077 * SIN( vY ) - 0.014615 * COS(2 *  vY ) - 0.040849 * SIN(2 *  vY )

Solar declination angle (radians).

 vDecl = 0.006918 - 0.399912 * COS(vY) + 0.070257 * SIN(vY) - 0.006758 * COS(2 * vY) + 0.000907 * SIN(2 * vY) - 0.002697 * COS(3 * vY) + 0.00148 * SIN (3 * vY)

For sunrise or sunset, the zenith is set to 90.833 degrees (the approximate correction for atmospheric refraction at sunrise and sunset, and the size of the solar disk). Hours angle (radians):

 vHa = ACOS( COS( TO_RADIANS(90.833) ) / COS(vLat) * COS(vDecl) - TAN(vLat) * TAN(vDecl) )

Sunrise UTC minutes

 vUtcMinsSunrise = 360 * 2 - 4 * (vLon + TO_DEGREES(vHa) ) - vEqtime

Noon UTC minutes

 vUtcMinsNoon = 360 * 2 - 4 * vLon - vEqtime

Sunset UTC minutes

 vUtcMinsSunset = 360 * 2 - 4 * (vLon - TO_DEGREES(vHa) ) - vEqtime

Sunset local time in fractional day. For Europe/Amsterdam --> vTimezone=+1 or +2 (DST)

 (vUtcMinsSunset / 60 + vTimezone) / 24