# LED Illuminants

Direct LED emission, as opposed to Phosphor-Converted LED emission, can be described using Gaussian-based spectral irradiance distributions. Red LEDs typically use an AlInGaP semiconductor material, which has a red emission, and blue and green LEDs typically use an InGaN semiconductor. White light can be generated by a combination of at least three red, green, blue, and amber LEDs, or by using a blue or violet emitting LED chip, in combination with a phosphor mixture, which converts part of the emission to yellowish-green light. There is no phosphor-converted white LED model in this library, due to the complex spectral interactions of the phosphor materials.

Direct emission of InGaN and AlInGaP LEDs are implemented in this library and are modeled in the `LedArray`

illuminant class.
The spectral model used is described by Y. Ohno in Spectral design considerations for white LED color rendering,
in which the spectral distribution \(S_i\) of an individual LED emitter is given by:
$$ S(\lambda) = \frac{g(\lambda) + 2 g^5(\lambda)}{3}.$$
The function \(g(\lambda)\) a Gaussian function, centered around a center wavelength \(\lambda_c\),
and with a width of \(\lambda_w\):
$$ g(\lambda) = e^{-((\lambda-\lambda_c)/\lambda_w)^2}.$$
The spectral width here is not exactly the full half maximum width, for both the \(g(\lambda)\) and \(S(\lambda)\) functions.
For the single LED irradiance distribution a full half maximum width of \(\lambda_2\) as input a value for\(\lambda_w\) is used to obtain the correct full width half maximum width:
$$\lambda_w = 1.08480681239\ldots\times\lambda_2.$$

The irradiance of an individual LED is given by: $$ \int_{-\infty}^\infty S(\lambda) d\lambda = a\lambda_{w},$$ with the constant \(a\) having a value of: $$ a = \frac{5 + 2\sqrt{5}}{15}\sqrt{\pi} = 1.11926\ldots.$$ The total spectral irradiance distribution from an array is obtained by summation of the individual LED spectral irradiances, \(S_i\), normalized to have an irradiance of 1.0 Watt per square meter, and scaled by their target irradiance \(E_{e,i}\): $$ \overline{S(\lambda)} = \sum_i E_{e,i}\frac{S_i(\lambda)}{a\lambda_{w,i}}.$$ Total irradiance of this composite spectral distribution is simply given by: $$ \overline{E_e} = \sum_i E_{e,i}.$$

## LED Array Illuminant

In a `LedArray`

, each LED in the array is described by an irradiance parameter \(E_e\) (in units of watts per square
meter), a center wavelength \(\lambda_c\) (in units of meters), and its full width at half maximum value
\(\lambda_2\) (also in units of meters).
The illuminant requires at least a single LED, with its parameters supplied in the constructor.

In this example we start with a single LED, with an irradiant power of 4 W/m^{2}, a center wavelength of 450 nm (450E-9 m),
and a width of 25 nm (25E-9 m):

```
const ledArray = new cie.LedArray(4.0, 450E-9, 30E-9);
```

And we can add more LEDs, with center wavelengths of 550 and 650 nm, and spectral widths of 40 and 20 nm, respectively, by using the `add_led`

method:

```
ledArray.addLed(6.0, 550E-9, 40E-9);
ledArray.addLed(3.0, 650E-9, 20E-9);
```

Using its `illuminate`

method,
we get a spectral irradiance distribution over a wavelength range from 380 to 780 nm, with a step size of 1 nm.
And to confirm that the total irradiance is the sum of the LED’s irradiances,
we can integrate the spectral distribution,
and check it is 13 W/m^{2},
which is the sum of the powers we used in the LedArray constructor:

```
const domain = new cie.Domain(380E-9, 780E-9, 401);
const sid = ledArray.illuminate(domain);
const totalIrradiance = cie.integrate(sid,domain.step());
assert.assertAlmostEquals(totalIrradiance, 13.00, 5E-3);
```

To change the total target irradiance from an LED array, you can set its irradiance value. Here we set it to a value of 10W/m2, and confirm it worked, by integrating all the values of the spectral irradiance distribution:

```
ledArray.irradiance = 10.0;
const newIrr = cie.integrate(ledArray.illuminate(domain), domain.step());
assert.assertAlmostEquals(newIrr, 10.00, 5E-3);
```

Total irradiance is different from illuminance.
You cannot directly set the target illuminance in the `LedArray`

class,
but you can use its `scale`

function after calculating its illuminance after defining an observer using this illuminant.
Here we set it to 10W/m^{2}, and confirm it worked, by integrating all the values of the spectral irradiance distribution:

```
// need an observer to calculate photometric and colorimetric vales
const c31 = await cie.fetchCIE1931();
const ill = ledArray.illuminance(c31);
ledArray.scale(5000.0/ill);
const newIll = ledArray.illuminance(c31);
assert.assertAlmostEquals(newIll, 5000.00, 5E-3);
```

### Target White Point

The `LEDArrayIlluminant`

class requires the exact irradiance values to construct or add LEDs.
If you don’t know the exact component irradiance values to target a particular white point, you can use the
`LEDArrayIlluminantFactory`

function, which requires a color-matching function to use, a target illuminant,
and a flat array of center and wavelength pairs, without a power specification: