I'm trying to understand how Radiance calculate the position of sun at a particular hour.
Following the sun.c source code in the Radiance package at here, I calculated the values step by step, but got errors for solar altitude and azimuth:
The formula used in each step is stated beside the value:
I have the following questions:
May I ask how solar altitude and azimuth are defined in Radiance?
the value feed into the asin() function for the calculation of solar altitude has an absolute value larger than 1. May I ask what went wrong in the Excel calculation if i didn't interpret the c file correctly?
Seems that only month is used for the calculation. May I ask why day and hour values are not used in the calculation of solar altitude and azimuth?
The formula used are:
jdate = IF(B5=1, 0, IF(B5=2, 31, IF(B5=3, 59, IF(B5=4, 90, IF(B5=5, 120, IF(B5=6, 151, IF(B5=7, 181, IF(B5=8, 212, IF(B5=9, 243, IF(B5=10, 273, IF(B5=11, 304, 334))))))))))) + B6
stadj = 0.17 * SIN((4PI()/373)(B8-80)) - 0.129 * SIN((2PI()/355)(B8-8)) + 12*(RADIANS(B4) - RADIANS(B2)) / PI()
sdec = 0.4093 * SIN( (2*PI()/368) * (B8 - 81) )
salt = DEGREES(asin(SIN(RADIANS(B1)) * SIN(B10) - COS(RADIANS(B1) * COS(B10) * COS(B9)*(PI()/12))))
sazi = DEGREES(-ATAN2(COS(B10) * SIN(B9(PI()/12)),-COS(RADIANS(B1)) * SIN(B10) - SIN(RADIANS(B1)) * COS(B10) * COS(B10(PI()/12))))