Skip to main content

ferrunitas/system/defs/
photometric.rs

1//! Photometric & luminous intensity domain units.
2//!
3//! Includes luminous flux, illuminance and related optical perception based
4//! quantities anchored in luminosity dimension.
5
6use crate::system::defs::base::*;
7use crate::system::defs::dimensionless::*;
8use crate::system::defs::mechanics::*;
9use crate::system::prefixes::*;
10use crate::{quantity, unit};
11use typenum::*;
12
13// ===========================
14// LUMINOUS FLUX (Steradiands are dimensionless in SI, so this is dimensionally equal to Luminious Intensity)
15// ===========================
16quantity!(LuminousFlux: M Z0, L Z0, T Z0, I Z0, Th Z0, N Z0, J P1; marked); // J
17
18unit!(compound: Lumen, "lm", [(Candela, P1), (Steradian, P1)]; marked LuminousFlux);
19
20// ===========================
21// LUMINANCE
22// ===========================
23quantity!(Luminance: M Z0, L N2, T Z0, I Z0, Th Z0, N Z0, J P1); // L⁻² J
24
25unit!(compound: Nit, "nt", [(Candela, P1), (Metre, N2)]; prefixable);
26
27// ===========================
28// ILLUMINANCE
29// ===========================
30quantity!(Illuminance: M Z0, L N2, T Z0, I Z0, Th Z0, N Z0, J P1; marked); // L⁻² J
31
32unit!(compound: Lux, "lx", [(Lumen, P1), (SquareMetre, N1)]; prefixable, marked Illuminance);
33unit!(prefix: Kilolux, Kilo, Lux);
34
35// ===========================
36// OPTICAL POWER (LENS)
37// ===========================
38quantity!(OpticalPower: M Z0, L N1, T Z0, I Z0, Th Z0, N Z0, J Z0; marked); // L⁻¹
39
40unit!(compound: Dioptre, "D", [(Metre, N1)]; marked OpticalPower);
41
42// ===========================
43// LUMINOUS ENERGY
44// ===========================
45quantity!(LuminousEnergy: M Z0, L Z0, T P1, I Z0, Th Z0, N Z0, J P1; marked); // T J
46
47unit!(compound: LumenSecond, "lm⋅s", [(Lumen, P1), (Second, P1)]; marked LuminousEnergy);
48unit!(derived: Talbot, "T", (1, LumenSecond)); // Historical unit
49
50// ===========================
51// LUMINOUS EXPOSURE
52// ===========================
53quantity!(LuminousExposure: M Z0, L N2, T P1, I Z0, Th Z0, N Z0, J P1; marked); // L⁻² T J
54
55unit!(compound: LuxSecond, "lx⋅s", [(Lux, P1), (Second, P1)]; marked LuminousExposure);
56
57// ===========================
58// LUMINOUS EFFICACY
59// ===========================
60quantity!(LuminousEfficacy: M N1, L N2, T P3, I Z0, Th Z0, N Z0, J P1; marked); // M⁻¹ L⁻² T³ J
61
62unit!(compound: LumenPerWatt, "lm/W", [(Lumen, P1), (Watt, N1)]; marked LuminousEfficacy);
63
64// ===========================
65// RADIANCE
66// ===========================
67quantity!(Radiance: M P1, L Z0, T N3, I Z0, Th Z0, N Z0, J Z0; marked); // M T⁻³
68
69unit!(compound: WattPerSquareMetreSteradian, "W/(m²⋅sr)", [(Watt, P1), (Metre, N2), (Steradian, N1)]; marked Radiance);
70
71// ===========================
72// RADIANT INTENSITY
73// ===========================
74quantity!(RadiantIntensity: M P1, L P2, T N3, I Z0, Th Z0, N Z0, J Z0; marked); // M L² T⁻³
75
76unit!(compound: WattPerSteradian, "W/sr", [(Watt, P1), (Steradian, N1)]; marked RadiantIntensity);
77
78// ===========================
79// IRRADIANCE / RADIANT EXITANCE
80// ===========================
81quantity!(Irradiance: M P1, L Z0, T N3, I Z0, Th Z0, N Z0, J Z0); // M T⁻³
82
83unit!(compound: WattPerSquareMetre, "W/m²", [(Watt, P1), (Metre, N2)]);
84
85// ===========================
86// SPECTRAL RADIANCE
87// ===========================
88quantity!(SpectralRadiance: M P1, L N1, T N3, I Z0, Th Z0, N Z0, J Z0; marked); // M L⁻¹ T⁻³
89
90unit!(compound: WattPerSquareMetreMetreSteradian, "W/(m³⋅sr)", [(Watt, P1), (Metre, N3), (Steradian, N1)]; marked SpectralRadiance);
91unit!(compound: WattPerSquareMetreNanometreSteradian, "W/(m²⋅nm⋅sr)", [(Watt, P1), (Metre, N2), (Nanometre, N1), (Steradian, N1)]; marked SpectralRadiance);
92
93// ==============================================================================
94
95#[cfg(test)]
96mod tests {
97    use super::*;
98    use crate::common::verify_unit;
99
100    // LUMINOUS FLUX
101    verify_unit!(Lumen, LuminousFlux, 1.0);
102
103    // LUMINANCE
104    verify_unit!(Nit, Luminance, 1.0);
105
106    // ILLUMINANCE
107    verify_unit!(Lux, Illuminance, 1.0);
108    verify_unit!(Kilolux, Illuminance, 1000.0);
109
110    // OPTICAL POWER
111    verify_unit!(Dioptre, OpticalPower, 1.0);
112
113    // LUMINOUS ENERGY
114    verify_unit!(LumenSecond, LuminousEnergy, 1.0);
115    verify_unit!(Talbot, LuminousEnergy, 1.0);
116
117    // LUMINOUS EXPOSURE
118    verify_unit!(LuxSecond, LuminousExposure, 1.0);
119
120    // LUMINOUS EFFICACY
121    verify_unit!(LumenPerWatt, LuminousEfficacy, 1.0);
122
123    // RADIANCE
124    verify_unit!(WattPerSquareMetreSteradian, Radiance, 1.0);
125
126    // RADIANT INTENSITY
127    verify_unit!(WattPerSteradian, RadiantIntensity, 1.0);
128
129    // IRRADIANCE
130    verify_unit!(WattPerSquareMetre, Irradiance, 1.0);
131
132    // SPECTRAL RADIANCE
133    verify_unit!(WattPerSquareMetreMetreSteradian, SpectralRadiance, 1.0);
134    verify_unit!(WattPerSquareMetreNanometreSteradian, SpectralRadiance, 1e9);
135}