Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sun altitude and azimuth calculation error following sun.c in Radiance source files

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:

image description

I have the following questions:

  1. May I ask how solar altitude and azimuth are defined in Radiance?

  2. 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?

  3. 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))))

sun altitude and azimuth calculation error following sun.c in Radiance source files

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:

image description

I have the following questions:

  1. May I ask how solar altitude and azimuth are defined in Radiance?

  2. 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?

  3. Seems that only month is and day are used for the calculation. May I ask why day and hour values are is 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))))

sun altitude and azimuth calculation error following sun.c in Radiance source files

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:

image description

I have the following questions:

  1. May I ask how solar altitude and azimuth are defined in Radiance?

  2. 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?

  3. Seems that only month and day are used for the calculation. May I ask why hour is 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))))