## Introduction

When observed from the ground, the distribution of light over the skydome is rarely uniform. Solar radiation from the Sun travelling through the Earth’s atmosphere can be absorbed, reflected and scattered in all directions by gas and dust particles as well as clouds of moisture vapour. Cloudiness and turbidity are also highly dynamic and, when driven by winds in the upper atmosphere, can change the characteristics of the entire sky within minutes. Figure 1 shows some examples of different types of real sky conditions commonly experienced - in this case overcast, partly cloudy and clear skies.

The CIE Standard General Sky described in CIE S 011/E:2003 and ISO 15469:2004(E) provides a mathematical model that uses a combination of five (5) coefficients and the position of the Sun within the sky to describe the spatial distribution of daylight over the whole skydome. It includes a set of coefficients for 15 different sky types that are broadly representative of common sky conditions with varying levels of cloudiness and turbidity. However, it is also possible to derive coefficient values directly from measured instantaneous sky illuminance or irradiance, or to adjust them independently in order to match any sky conditions. Figure 2 shows how the radiant distribution of the real sky examples used earier can be quite closely modelled using specific coefficient values.

The CIE standard includes coefficient settings for 15 general sky types which represent a range of different sky conditions - from overcast to cloudless, and with varying levels of direct sunlight. An additional 16th type is also given that is based on a much simpler mathematical model for overcast skies defined and used by CIE prior to this current standard. Figure 3 shows examples of the instantaneous distributions for each of these 16 sky types.

## Using the CIE Standard General Sky

At its core, the CIE Standard General Sky model is based on variations in three key characteristics; sky clearness, sky brightness and solar altitude. Clearness and brightness can be derived from a comparison of direct normal and diffuse horizontal irradiance and/or illuminance. The solar altitude can be either calculated for a specific date and time, or given as a measured angle above the horizontal plane. The five sky coefficients can then be calculated directly from these three values.

Using the calculated sky coefficients, the luminance for any point on the skydome can be calculated relative to the zenith illuminance. Given that the EnergyPlus weather file format (EPW) includes hourly values for zenith illuminance, one might think that this data could be used directly and relatively simply. However, in many EPW files the values for zenith illuminance are unreliable, being recorded as zero during the middle of the day when the solar altitude is relatively high. Figure 4 shows examples of this issue in EPW data for New York City, Singapore and Perth, Australia. The blue/purple areas in the center of the charts show areas of zero value where zenith illuminance should really be at its peak when compared to global horizontal illuminance values in the same data set.

Thankfully, EPW files do contain much more reliable data for annual hourly direct normal and diffuse horizontal illuminance and irradiance which can be used instead. Of interest, the calculation of sky clearness and brightness is actually dependant on diffuse horizontal irradiance rather than illuminance, as per Perez et.al. 1990 (ref: 1), and converting from illuminance to irradiance can sometimes involve a small amount to iteration to converge on the right values. Thus, the use of irradiance data from the weather data actually makes the luminance calculations slightly faster.

Also, it is important to note that the CIE Standard General Sky only models the spatial distribution of daylight, not sunlight. Daylight refers to the omni-directional diffuse light reflected and refracted from the entire skydome, whereas sunlight refers to just the highly directional rays of solar radiation passing straight through the atmosphere directly from the Sun.

### Obtaining Absolute Values

The values calculated by the CIE Standard General Sky model are always given relative to the illuminance at the zenith of the sky. This means that the scale and range of values distributed over the sky is pretty arbitrary and can change significantly with different sky types and solar altitudes. To convert these relative values to absolute values of illuminance or irradiance, it is necessary to normalise the total contribution of the whole skydome so that it is equal to 1, before multiplying by the reference value of diffuse horizontal irradiance or illuminance.

This typically means subdividing the skydome into a series of discrete sky patches and then integrating all of their values to obtain the total contribution. As the reference value is diffuse horizontal irradiance or illuminance, the integration needs to factor in Lambert’s cosine law and the angle of incidence of light from each sky patch on the horizontal plane when determining each patch’s contribution. Furthermore, many sky subdivision techniques do not result in sky patches that are all exactly equal in size. Thus the contribution of each patch must also be accurately area-weighted, as shown in the equation that follows.

$$F_{norm} = \sum_{p=1}^n (\frac{L_p \times A_p \times \cos({\delta})}{L_{zen}})$$

Where:

• Fnorm = The normalisation factor to apply to all patches.
• n = The total number of sky patches into which the skydome is divided.
• Lp = The relative contribution of each sky patch compared to the zenith.
• Ap = The relative area of each sky patch as a fraction of the total skydome area.
• δ = The angle between the sky patch center and the sky zenith.
• Lzen = The relative contribution at the zenith of the sky.

Once the values at each sky patch have been normalised and area-weighted, their absolute radiance or luminance values can then be determined by simply multiplying by the corresponding instantaneous diffuse horizontal irradiance or illuminance value. This is usually done as a separate step at the very end to allow for caching and re-using calculated sky patch data.

It is important to note that the CIE Standard General Sky model becomes less accurate when the Sun is very low in the sky at or near sunrise and sunset. When the altitude of the Sun above the horizon is less than 2 degrees, the majority of the luminance occurs at close to grazing incidence to the horizontal plane. This can result in very small normalisation factors that test the floating point accuracy of the Javascript engine. However, once understood, this can be relatively easily accommodated by value scaling at lower solar altitudes, and any residual effects become relatively insignificant as diffuse horizontal irradiance and illuminance both converge to zero around these times anyway.

## Aggregating and Accumulating Skies

In order to calculate values over a long period of time, it is possible to generate many sequential instantaneous sky distributions, run the calculation on each of them, and then sum the results. Depending on the nature of the calculation, it can sometimes be much more efficient to generate a single sky distribution that is the cumulative sum of many sequential instantaneous sky distributions, and then run the required solar calculations just once using that cumulative sky.

Generating and aggregating multiple sky distributions is a relatively trivial task, especially if they are all based on the same sky patches. However, doing this with hourly weather data can lead to significant potential errors as the Sun’s actual path across the sky is smooth and continuous whereas hourly sampling results in large gaps between Sun positions, as shown in Figure 5.

Sub-hourly sampling is the solution, but this requires a careful approach to the interpolation of sub-hourly weather data values.

### Interpolating Between Sky Conditions

The obvious approach to sub-hourly sampling is to simply calculate the two hourly sky conditions and then linearly interpolate between the two values in each sky segment. However, as shown in Figure 6, this approach simply results in the Sun fading out from its position at the previous hour and fading back in at its new position at the next. The sky distributions interpolated at times between the two hours are not an accurate representation of the real sky conditions that would have actually occurred at those times.

Another approach is to linearly interpolate between hourly direct and diffuse solar irradiance values at each hour boundary and derive the sky coefficients at each interim time step. However, the derivation of sky coefficients from direct and diffuse solar irradiance is based on tabulated data ranges. This means that transitioning from one set of diffuse/direct values to another over an hour will sometimes introduce noticeable steps or jumps in the characteristics of the sky distribution, resulting in the inclusion of intermediate sky conditions that may not have actually occured within that hour of recorded data.

#### An Alternate Approach

Figure 7 illustrates an example of this, clearly showing the sudden step-changes that occur when crossing boundary thresholds within the tabulated data ranges. In the displayed example, the diffuse horizontal illuminance is interpolating between 6000 and 20000 lux, and shows big steps occurring at 10000 and 15000 lux. At these thresholds you can clearly see some of the sky coefficient sliders suddenly jump to significantly different values.

#### The Right Approach

To avoid both of the above issues, the best solution found by the author has been to calculate the resulting sky coefficients for each hourly sky condition, and then linearly interpolate between the two sets of calculated coefficients - generating the sub-hourly Sun positions and resulting sky conditions at each interim time step. This approach results in the smoothest and most realistic transitions between any two known sky conditions. Figure 8 shows an example of the resulting interpolation between two hourly sky conditions using this method.

### Apportioning Direct Sunlight

To properly simulate a real sky, the direct solar component, often termed sunlight, must also be included in the model. Apportioning direct sunlight to the sky distribution seems quite simple at first, but can get complicated once the sky is divided into discrete patches.

From the literature, there are two commonly used approaches to this:

1. Solar Disk Method:
Distribute sunlight only to those sky patches that the 0.533° diameter solar disk actually overlaps, apportioned by the number of patches affected and their relative area of overlap.

2. Nearest Neighbor Method:
Distribute sunlight to the four (4) closest neighbouring sky patches, apportioned based on the relative distance from the center of each patch to the center of the Sun.

Whilst the absolute accuracy of both methods depend primarily on the resolution of the sky subdivision, the small size of the solar disk in the first method can sometimes result in noticeable jumps in value as it transitions between patches, especially when using a small number of large sky patches. Such cases result in periods of static sky condition as all of the sunlight is apportioned to a single patch as the Sun moves slowly through it, interspersed with sudden changes as it moves on to the next patch. Figure 9 shows an example visual comparison between the two methods over the same period and on the same day.

The nearest neighbor approach may appear to be slightly less accurate, but it actually provides for a much smoother and more continuous transition of values as the Sun moves through the sky, and gives a better simulation of the actual Sun position. This is important when using pre-calculated shading masks for windows and apertures, within which one sky patch may be visible but another immediately adjacent may not be. Using the solar disk approach would result in a sudden jump between none and full direct sunlight over the space of a single time step. Using the nearest neighbor approach would result in a more realistically gradual change in internal light conditions.

The choice of sunlight distribution method will also affect the aggregated values in a cumulative sky calculation. Figure 10 shows a comparison of the annual cumulative skies for New York, USA using each of the two direct sunlight distribution methods. The overall pattern in each is very similar, however the smearing effect of the nearest neighbor method is apparent. The overall total sky radiance is the same in both methods, but the scales are slightly different as the maximum value in any particular sky segment will be affected by the chosen method. Which method is best to use is an open debate.

### Sub-Hourly Time Step

The next obvious question is what sub-hourly time increment should be used to generate cumulative sky distributions. As shown in Figure 11, the answer is definitely not 60 minutes, or even 30. To obtain a smooth and accurate cumulative sky distribution, a sub-hourly time increment of 10-12 minutes or less is required.