# Frequently Asked Questions

## Question

**How does gensky work internally?**

## Answer

Here is a description of the gensky behaviour and of the formulas that it uses (as far as I can understand from the gensky.c code). gensky at the moment behaves this way (I hope not to make any error ...): 1. it can model uniform skies 2. it can model CIE standard clear skies (as described in CIE 110-1994) 3. it can model CIE standard overcast skies (as described in CIE 110-1994 and previous standards) 4. it can model non standard intermediate skies, whose definition is contained inside src/gen/gensky.c and /src/gen/skybright.cal (I don't have a reference about where the intermediate sky definition was taken from) If it is given zenith radiance (-b) and solar radiance (-r), gensky uses directly the CIE formulas or the intermediate sky formula, since all the sky distribution parameters are already defined, but it is not very usual to have measured sequences of such weather data. DIRECT CONTRIBUTION from the sun If we provide gensky with horizontal direct irradiance (ees), solar radiance (solarbr) is computed with the following formula: solarbr = ees/(6e-5*sin(sunaltitude)) If we only specify location and time, gensky uses the following formula: solarbr = 1.5e9/SUNEFFICACY*sin(sunaltitude) if (1.147 - .147/sin(sunaltitude) > .16), otherwise 1.5e9/SUNEFFICACY*.16 where SUNEFFICACY = 208 /* illuminant B (solar dir.) */ Additionally, if the sky is intermediate, the previous value is multiplied by 0.15 (i.e the so called /* fudge factor! */) DIFFUSE CONTRIBUTION from the sky If neither zenith radiance (zenithbr) nor horizontal diffuse irradiance (eed) are given, the Krochmann equation is used for the CIE OVERCAST SKY: zenithbr = 8.6*sin(sunaltitude) + .123 [kcd/m^2] (Krochmann) CIE 110-1994 also reports equations by Kittler and Nakamura, Oki et al. for this purpose. For the CIE CLEAR SKY the LBL equation (Karayel, Navvab, Ne'eman, Selkowitz) is used (here the Linke Turbidity appears for the first time): zenithbr = (1.376*turbidity-1.81)*tan(sunaltitude)+0.38 [kcd/m^2] (Karayel, Navvab, Ne'eman, Selkowitz) CIE 110-1994 also reports a lot of equations that should be chosen according to the climate condition in the location of interest (Kittler, Dogniaux, Krochmann, Liebelt, Gusev, Nagata, Nakamura Oki et al.), but gensky only uses the LBL one. For the INTERMEDIATE SKY, gensky computes the average of the overcast and CIE clear zenith radiances. At the end, the computed resulting value is divided by SKYEFFICACY D65EFFICACY = 203 /* standard illuminant D65 */ SKYEFFICACY = D65EFFICACY /* skylight */ If the horizontal diffuse irradiance (eed) is provided, then gensky computes the zenith radiance by using the following formula: zenithbr = eed/(normfactor*PI) normfactor = 7/9 for CIE OVERCAST SKY while for CIE CLEAR SKY and the INTERMEDIATE SKY, normfactor is computed by using two different polynomial approximations. For the CIE CLEAR SKY, CIE 110-1994 suggests two different polynomial approximations by Kittler (as said, "for practical purposes") and by Gusev (for polluted atmosphere): both of them are not used by gensky.

- Submitted by: pisuke
- Answered by: