Kipp&Zonen BSRN Scientific Solar Monitoring System User Manual
Page 179
167
Subroutine Solar: Equations based upon the paper of Michalsky (1988) and the approxim ate equations
given in the Astronom ical Alm anac.
Note: Subroutine call is to be a single line
SUB AstroAlm (year, jd, GMT, Lat, Lon, StnHeight, Az, El, EOT, SolarTim e$, Decdegrees, Airm ass$,
HaDegrees)
' ===========================================================================
' The following subroutine calculates the approxim ate solar position and is
' based on the following paper:
' Joseph J. Michalsky: The astronom ical alm anac's algorithm for approxim ate
' solar position (1950-2050). Solar Energy 40 (3), 227-235 (1988).
' Note also that an Errata notice appeared in Solar Energy Vol. 41, No. 1,
' p. 113, 1988 concerning a correction to the above algorithm . This
' correction has been incorporated into the subroutine that follows.
' In the original subroutine, a division by latitude in the determ ination of
' of 'elc' (critical elevation) caused a divide by zero error for equatorial
' calculations. This code has been replacedby equivalent code for deter-
' m ining solar azim uth.
' This subroutine calculates the local azim uth and elevation of the sun at
' a specific location and tim e using an approxim ation to equations used to
' generate tables in The Astronom ical Alm anac. Refraction correction is added
' so sun position is the apparent one.
' The Astronom ical Alm anac, U.S. Governm ent Printing Office, W ashington, DC
' Input param eters:
' Year = year (e.g., 1986)
' JD = day of year (e.g., Feb. 1 = 32)
' GMT = Greenwich Mean Tim e (decim al hours)
' Lat = latitude in degrees (north is positive)
' Lon = longitude in degrees (west is positive)
' StnHeight = height of station in m etres above sea level
' Output param eters:
' Az = sun azim uth angle
' (m easured east from north, 0 to 360 degrees)
' El = sun elevation angle (degrees) plus others, but note the
' units indicated before return to calling routine
' EOT = equation of tim e (seconds)
' TST = True Solar Tim e (hours)
' SolarTim e$ = solar tim e (HH:MM:SS)
' Decdegrees = declination in degrees
' Airm ass$ = airm ass as an alphanum eric string
'
' Notes: 1) The algorithm included in the above-m entioned paper was written
' in Fortran and has been translated into QuickBasic V4.5.
' 2) Since QuickBasic V4.5 does not contain the arcsin function, the
' following substitute relationship is used:
' arcsin(x) = ATN(X / SQR(1 - X ^ 2))
' where ATN is the arctangent.
' 3) The MOD (m odulus) function provided by QuickBasic V4.5 is not
' used since it does not yield the sam e result as the m odulus
' function in Fortran. For exam ple:
' in QuickBasic V4.5 19 MOD 6.7 = 5.0 (decim al portion truncated)
' in Fortran 19 MOD 6.7 = 5.6
' As a result, the Fortran m odulus function has been rewritten
' using the equivalent: