Resources Numerical accuracy Calculation policy

Clear-sky solar irradiance

Estimates the beam and diffuse solar irradiance on a clear day from the day of the year, the sun's height, the site altitude and a climate type.

How the precision is kept

A short empirical model evaluated in 64-bit. Its accuracy is that of the model's fitted coefficients, written to 3 or 4 digits, and of the solar constant of 1367 W/m², not of the arithmetic.

Calculations under this policy

1 calculation in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

pv/daylight-bim-sky.js CivilCraft 0.8.1 64-bit 1 calculation Reviewed

Tests None found by the review

Clear-sky beam and diffuse irradiance

64-bit

The irradiance outside the atmosphere, the beam transmittance, and the beam and diffuse irradiance at the ground.

τ_b = a₀ + a₁·exp(−k ÷ cos Z); G_on = 1367·(1 + 0.033·cos(2πn ÷ 365)); G_bn = G_on·τ_b; τ_d = 0.271 − 0.294·τ_b

The coefficients a₀, a₁ and k are quadratics in altitude with constants written to 3 or 4 digits (0.4237, 0.00821, 0.5055, 0.00595, 0.2711, 0.01858), scaled by the climate factors. The division by cos Z is guarded by returning zeros when cos Z is not positive.

  • pv/daylight-bim-sky.js
  • lines 6 to 14
  • CivilCraft 0.8.1
export function clearSky(n, cosZ, { altitudeKm = 0, climate = 'midlat-summer' } = {}) {
  const A = Math.max(0, Math.min(2.5, altitudeKm));
  const [r0, r1, rk] = CLIMATES[climate] || CLIMATES['midlat-summer'];
  const a0 = r0 * (0.4237 - 0.00821 * (6 - A) ** 2), a1 = r1 * (0.5055 + 0.00595 * (6.5 - A) ** 2), k = rk * (0.2711 + 0.01858 * (2.5 - A) ** 2);
  const Gon = GSC * (1 + 0.033 * Math.cos(2 * Math.PI * n / 365));
  if (!(cosZ > 0)) return { Gon, tauB: 0, Gbn: 0, Gbh: 0, Gdh: 0 };
  const tauB = a0 + a1 * Math.exp(-k / cosZ), tauD = 0.271 - 0.294 * tauB;
  return { Gon, tauB, Gbn: Gon * tauB, Gbh: Gon * tauB * cosZ, Gdh: Gon * cosZ * tauD };
}

In detail

Method
The Hottel clear-sky transmittance, as the file's comment names it, with climate correction factors; extraterrestrial irradiance 1367 × (1 + 0.033·cos(2πn ÷ 365)).
Number types
64-bit numbers.
Limits
Altitude is limited to 0 to 2.5 km. A sun at or below the horizon returns zero beam and diffuse irradiance. The file is generated from BimCraft's daylight-bim-sky.js, as its header says.

Approach: 64-bit, stated limit

The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.

Every policy that takes this approach