jsthermalcomfort 0.0.2 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -6
- package/lib/cjs/index.js +7 -434
- package/lib/cjs/models/a_pmv.js +140 -0
- package/lib/cjs/models/adaptive_ashrae.js +290 -0
- package/lib/cjs/models/adaptive_en.js +300 -0
- package/lib/cjs/models/ankle_draft.js +82 -0
- package/lib/cjs/models/at.js +52 -0
- package/lib/cjs/models/athb.js +135 -0
- package/lib/cjs/models/clo_tout.js +58 -0
- package/lib/cjs/models/cooling_effect.js +164 -0
- package/lib/cjs/models/discomfort_index.js +115 -0
- package/lib/cjs/models/e_pmv.js +154 -0
- package/lib/cjs/models/heat_index.js +60 -0
- package/lib/cjs/models/humidex.js +63 -0
- package/lib/cjs/models/index.js +71 -0
- package/lib/cjs/models/net.js +50 -0
- package/lib/cjs/models/pet_steady.js +443 -0
- package/lib/cjs/models/phs.js +458 -0
- package/lib/cjs/models/pmv.js +200 -0
- package/lib/cjs/models/pmv_ppd.js +404 -0
- package/lib/cjs/models/set_tmp.js +203 -0
- package/lib/cjs/models/solar_gain.js +163 -0
- package/lib/cjs/models/two_nodes.js +790 -0
- package/lib/cjs/models/use_fans_heatwave.js +203 -0
- package/lib/cjs/models/utci.js +609 -0
- package/lib/cjs/models/vertical_tmp_grad_ppd.js +95 -0
- package/lib/cjs/models/wbgt.js +72 -0
- package/lib/cjs/models/wc.js +37 -0
- package/lib/cjs/psychrometrics/enthalpy.js +24 -0
- package/lib/cjs/psychrometrics/index.js +28 -0
- package/lib/cjs/psychrometrics/p_sat.js +46 -0
- package/lib/cjs/psychrometrics/p_sat_torr.js +34 -0
- package/lib/cjs/psychrometrics/psy_ta_rh.js +51 -0
- package/lib/cjs/psychrometrics/t_dp.js +19 -0
- package/lib/cjs/psychrometrics/t_mrt.js +117 -0
- package/lib/cjs/psychrometrics/t_o.js +82 -0
- package/lib/cjs/psychrometrics/t_wb.js +23 -0
- package/lib/cjs/types/index.d.ts +7 -79
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/models/a_pmv.d.ts +133 -0
- package/lib/cjs/types/models/a_pmv.d.ts.map +1 -0
- package/lib/cjs/types/models/adaptive_ashrae.d.ts +211 -0
- package/lib/cjs/types/models/adaptive_ashrae.d.ts.map +1 -0
- package/lib/cjs/types/models/adaptive_en.d.ts +217 -0
- package/lib/cjs/types/models/adaptive_en.d.ts.map +1 -0
- package/lib/cjs/types/models/ankle_draft.d.ts +60 -0
- package/lib/cjs/types/models/ankle_draft.d.ts.map +1 -0
- package/lib/cjs/types/models/at.d.ts +34 -0
- package/lib/cjs/types/models/at.d.ts.map +1 -0
- package/lib/cjs/types/models/athb.d.ts +96 -0
- package/lib/cjs/types/models/athb.d.ts.map +1 -0
- package/lib/cjs/types/models/clo_tout.d.ts +45 -0
- package/lib/cjs/types/models/clo_tout.d.ts.map +1 -0
- package/lib/cjs/types/models/cooling_effect.d.ts +49 -0
- package/lib/cjs/types/models/cooling_effect.d.ts.map +1 -0
- package/lib/cjs/types/models/discomfort_index.d.ts +91 -0
- package/lib/cjs/types/models/discomfort_index.d.ts.map +1 -0
- package/lib/cjs/types/models/e_pmv.d.ts +139 -0
- package/lib/cjs/types/models/e_pmv.d.ts.map +1 -0
- package/lib/cjs/types/models/heat_index.d.ts +27 -0
- package/lib/cjs/types/models/heat_index.d.ts.map +1 -0
- package/lib/cjs/types/models/humidex.d.ts +54 -0
- package/lib/cjs/types/models/humidex.d.ts.map +1 -0
- package/lib/cjs/types/models/index.d.ts +78 -0
- package/lib/cjs/types/models/index.d.ts.map +1 -0
- package/lib/cjs/types/models/net.d.ts +39 -0
- package/lib/cjs/types/models/net.d.ts.map +1 -0
- package/lib/cjs/types/models/pet_steady.d.ts +59 -0
- package/lib/cjs/types/models/pet_steady.d.ts.map +1 -0
- package/lib/cjs/types/models/phs.d.ts +242 -0
- package/lib/cjs/types/models/phs.d.ts.map +1 -0
- package/lib/cjs/types/models/pmv.d.ts +198 -0
- package/lib/cjs/types/models/pmv.d.ts.map +1 -0
- package/lib/cjs/types/models/pmv_ppd.d.ts +246 -0
- package/lib/cjs/types/models/pmv_ppd.d.ts.map +1 -0
- package/lib/cjs/types/models/set_tmp.d.ts +124 -0
- package/lib/cjs/types/models/set_tmp.d.ts.map +1 -0
- package/lib/cjs/types/models/solar_gain.d.ts +76 -0
- package/lib/cjs/types/models/solar_gain.d.ts.map +1 -0
- package/lib/cjs/types/models/two_nodes.d.ts +412 -0
- package/lib/cjs/types/models/two_nodes.d.ts.map +1 -0
- package/lib/cjs/types/models/use_fans_heatwave.d.ts +188 -0
- package/lib/cjs/types/models/use_fans_heatwave.d.ts.map +1 -0
- package/lib/cjs/types/models/utci.d.ts +79 -0
- package/lib/cjs/types/models/utci.d.ts.map +1 -0
- package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts +58 -0
- package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -0
- package/lib/cjs/types/models/wbgt.d.ts +51 -0
- package/lib/cjs/types/models/wbgt.d.ts.map +1 -0
- package/lib/cjs/types/models/wc.d.ts +29 -0
- package/lib/cjs/types/models/wc.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/enthalpy.d.ts +12 -0
- package/lib/cjs/types/psychrometrics/enthalpy.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/index.d.ts +26 -0
- package/lib/cjs/types/psychrometrics/index.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/p_sat.d.ts +13 -0
- package/lib/cjs/types/psychrometrics/p_sat.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts +26 -0
- package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts +51 -0
- package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_dp.d.ts +9 -0
- package/lib/cjs/types/psychrometrics/t_dp.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_mrt.d.ts +43 -0
- package/lib/cjs/types/psychrometrics/t_mrt.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_o.d.ts +31 -0
- package/lib/cjs/types/psychrometrics/t_o.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_wb.d.ts +12 -0
- package/lib/cjs/types/psychrometrics/t_wb.d.ts.map +1 -0
- package/lib/cjs/types/utilities/index.d.ts +28 -0
- package/lib/cjs/types/utilities/index.d.ts.map +1 -0
- package/lib/cjs/types/utilities/utilities.d.ts +377 -0
- package/lib/cjs/types/utilities/utilities.d.ts.map +1 -0
- package/lib/cjs/utilities/index.js +27 -0
- package/lib/cjs/utilities/utilities.js +903 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/models/a_pmv.js +135 -0
- package/lib/esm/models/adaptive_ashrae.js +285 -0
- package/lib/esm/models/adaptive_en.js +294 -0
- package/lib/esm/models/ankle_draft.js +78 -0
- package/lib/esm/models/at.js +48 -0
- package/lib/esm/models/athb.js +130 -0
- package/lib/esm/models/clo_tout.js +53 -0
- package/lib/esm/models/cooling_effect.js +159 -0
- package/lib/esm/models/discomfort_index.js +110 -0
- package/lib/esm/models/e_pmv.js +149 -0
- package/lib/esm/models/heat_index.js +56 -0
- package/lib/esm/models/humidex.js +59 -0
- package/lib/esm/models/index.js +69 -0
- package/lib/esm/models/net.js +46 -0
- package/lib/esm/models/pet_steady.js +439 -0
- package/lib/esm/models/phs.js +454 -0
- package/lib/esm/models/pmv.js +195 -0
- package/lib/esm/models/pmv_ppd.js +398 -0
- package/lib/esm/models/set_tmp.js +198 -0
- package/lib/esm/models/solar_gain.js +158 -0
- package/lib/esm/models/two_nodes.js +784 -0
- package/lib/esm/models/use_fans_heatwave.js +199 -0
- package/lib/esm/models/utci.js +604 -0
- package/lib/esm/models/wbgt.js +68 -0
- package/lib/esm/models/wc.js +33 -0
- package/lib/esm/psychrometrics/enthalpy.js +20 -0
- package/lib/esm/psychrometrics/index.js +26 -0
- package/lib/esm/psychrometrics/p_sat.js +42 -0
- package/lib/esm/psychrometrics/p_sat_torr.js +29 -0
- package/lib/esm/psychrometrics/psy_ta_rh.js +47 -0
- package/lib/esm/psychrometrics/t_dp.js +15 -0
- package/lib/esm/psychrometrics/t_mrt.js +112 -0
- package/lib/esm/psychrometrics/t_o.js +77 -0
- package/lib/esm/psychrometrics/t_wb.js +19 -0
- package/lib/esm/types/index.d.ts +7 -79
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/models/a_pmv.d.ts +133 -0
- package/lib/esm/types/models/a_pmv.d.ts.map +1 -0
- package/lib/esm/types/models/adaptive_ashrae.d.ts +211 -0
- package/lib/esm/types/models/adaptive_ashrae.d.ts.map +1 -0
- package/lib/esm/types/models/adaptive_en.d.ts +217 -0
- package/lib/esm/types/models/adaptive_en.d.ts.map +1 -0
- package/lib/esm/types/models/ankle_draft.d.ts +60 -0
- package/lib/esm/types/models/ankle_draft.d.ts.map +1 -0
- package/lib/esm/types/models/at.d.ts +34 -0
- package/lib/esm/types/models/at.d.ts.map +1 -0
- package/lib/esm/types/models/athb.d.ts +96 -0
- package/lib/esm/types/models/athb.d.ts.map +1 -0
- package/lib/esm/types/models/clo_tout.d.ts +45 -0
- package/lib/esm/types/models/clo_tout.d.ts.map +1 -0
- package/lib/esm/types/models/cooling_effect.d.ts +49 -0
- package/lib/esm/types/models/cooling_effect.d.ts.map +1 -0
- package/lib/esm/types/models/discomfort_index.d.ts +91 -0
- package/lib/esm/types/models/discomfort_index.d.ts.map +1 -0
- package/lib/esm/types/models/e_pmv.d.ts +139 -0
- package/lib/esm/types/models/e_pmv.d.ts.map +1 -0
- package/lib/esm/types/models/heat_index.d.ts +27 -0
- package/lib/esm/types/models/heat_index.d.ts.map +1 -0
- package/lib/esm/types/models/humidex.d.ts +54 -0
- package/lib/esm/types/models/humidex.d.ts.map +1 -0
- package/lib/esm/types/models/index.d.ts +77 -0
- package/lib/esm/types/models/index.d.ts.map +1 -0
- package/lib/esm/types/models/net.d.ts +39 -0
- package/lib/esm/types/models/net.d.ts.map +1 -0
- package/lib/esm/types/models/pet_steady.d.ts +59 -0
- package/lib/esm/types/models/pet_steady.d.ts.map +1 -0
- package/lib/esm/types/models/phs.d.ts +242 -0
- package/lib/esm/types/models/phs.d.ts.map +1 -0
- package/lib/esm/types/models/pmv.d.ts +198 -0
- package/lib/esm/types/models/pmv.d.ts.map +1 -0
- package/lib/esm/types/models/pmv_ppd.d.ts +246 -0
- package/lib/esm/types/models/pmv_ppd.d.ts.map +1 -0
- package/lib/esm/types/models/set_tmp.d.ts +124 -0
- package/lib/esm/types/models/set_tmp.d.ts.map +1 -0
- package/lib/esm/types/models/solar_gain.d.ts +76 -0
- package/lib/esm/types/models/solar_gain.d.ts.map +1 -0
- package/lib/esm/types/models/two_nodes.d.ts +412 -0
- package/lib/esm/types/models/two_nodes.d.ts.map +1 -0
- package/lib/esm/types/models/use_fans_heatwave.d.ts +188 -0
- package/lib/esm/types/models/use_fans_heatwave.d.ts.map +1 -0
- package/lib/esm/types/models/utci.d.ts +79 -0
- package/lib/esm/types/models/utci.d.ts.map +1 -0
- package/lib/esm/types/models/wbgt.d.ts +51 -0
- package/lib/esm/types/models/wbgt.d.ts.map +1 -0
- package/lib/esm/types/models/wc.d.ts +29 -0
- package/lib/esm/types/models/wc.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/enthalpy.d.ts +12 -0
- package/lib/esm/types/psychrometrics/enthalpy.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/index.d.ts +26 -0
- package/lib/esm/types/psychrometrics/index.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/p_sat.d.ts +13 -0
- package/lib/esm/types/psychrometrics/p_sat.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/p_sat_torr.d.ts +26 -0
- package/lib/esm/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts +51 -0
- package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_dp.d.ts +9 -0
- package/lib/esm/types/psychrometrics/t_dp.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_mrt.d.ts +43 -0
- package/lib/esm/types/psychrometrics/t_mrt.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_o.d.ts +31 -0
- package/lib/esm/types/psychrometrics/t_o.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_wb.d.ts +12 -0
- package/lib/esm/types/psychrometrics/t_wb.d.ts.map +1 -0
- package/lib/esm/types/utilities/index.d.ts +28 -0
- package/lib/esm/types/utilities/index.d.ts.map +1 -0
- package/lib/esm/types/utilities/utilities.d.ts +377 -0
- package/lib/esm/types/utilities/utilities.d.ts.map +1 -0
- package/lib/esm/utilities/index.js +25 -0
- package/lib/esm/utilities/utilities.js +885 -0
- package/package.json +22 -15
- package/lib/esm/index.mjs +0 -430
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { units_converter, round } from "../utilities/utilities.js";
|
|
2
|
+
import { set_tmp } from "./set_tmp.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the value of the Cooling Effect ( {@link https://en.wikipedia.org/wiki/Thermal_comfort#Cooling_Effect|CE} )
|
|
5
|
+
* calculated in compliance with the ASHRAE 55 2020 Standard {@link #ref_1|[1]}.
|
|
6
|
+
* The {@link https://en.wikipedia.org/wiki/Thermal_comfort#Cooling_Effect|CE} of the elevated air speed
|
|
7
|
+
* is the value that, when subtracted equally from both the average air temperature and the mean radiant temperature,
|
|
8
|
+
* the same {@link https://en.wikipedia.org/wiki/Thermal_comfort#Standard_effective_temperature|SET} under still air
|
|
9
|
+
* as in the first {@link https://en.wikipedia.org/wiki/Thermal_comfort#Standard_effective_temperature|SET} calculation
|
|
10
|
+
* under elevated air speed. The cooling effect is calculated only for air speed higher than 0.1 m/s.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @memberof models
|
|
14
|
+
* @docname Cooling Effect (CE)
|
|
15
|
+
*
|
|
16
|
+
* @param {number} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
|
|
17
|
+
* @param {number} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
|
|
18
|
+
* @param {number} vr - relative air speed, default in [m/s] in [fps] if `units` = 'IP'
|
|
19
|
+
*
|
|
20
|
+
* Note: vr is the relative air speed caused by body movement and not the air
|
|
21
|
+
* speed measured by the air speed sensor. The relative air speed is the sum of the
|
|
22
|
+
* average air speed measured by the sensor plus the activity-generated air speed
|
|
23
|
+
* (Vag). Where Vag is the activity-generated air speed caused by motion of individual body parts.
|
|
24
|
+
* vr can be calculated using the function `v_relative` which is in .utilities.js.
|
|
25
|
+
*
|
|
26
|
+
* @param {number} rh - relative humidity, [%]
|
|
27
|
+
* @param {number} met - metabolic rate, [met]
|
|
28
|
+
* @param {number} clo - clothing insulation, [clo]
|
|
29
|
+
*
|
|
30
|
+
* Note: The activity as well as the air speed modify the insulation characteristics
|
|
31
|
+
* of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
|
|
32
|
+
* the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
|
|
33
|
+
* for the effect of the body movement for met equal or higher than 1.2 met using
|
|
34
|
+
* the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
|
|
35
|
+
* can be calculated using the function `clo_dynamic` which is in .utilities.js.
|
|
36
|
+
*
|
|
37
|
+
* @param {number} [wme=0] - external work
|
|
38
|
+
* @param {'SI'|'IP'} [units= "SI"] - select the SI (International System of Units) or the IP (Imperial Units) system.
|
|
39
|
+
* @returns {number} ce - Cooling Effect, default in [°C] in [°F] if `units` = 'IP'
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const CE = cooling_effect(25, 25, 0.3, 50, 1.2, 0.5);
|
|
43
|
+
* console.log(CE); // Output: 1.64
|
|
44
|
+
*
|
|
45
|
+
* // For users who want to use the IP system
|
|
46
|
+
* const CE_IP = cooling_effect(77, 77, 1.64, 50, 1, 0.6, "IP");
|
|
47
|
+
* console.log(CE_IP); // Output: 3.74
|
|
48
|
+
*/
|
|
49
|
+
export function cooling_effect(tdb, tr, vr, rh, met, clo, wme = 0, units = "SI") {
|
|
50
|
+
if (units.toLowerCase() === "ip") {
|
|
51
|
+
const result = units_converter({ tdb, tr, vr }, "IP");
|
|
52
|
+
tdb = result.tdb;
|
|
53
|
+
tr = result.tr;
|
|
54
|
+
vr = result.vr;
|
|
55
|
+
}
|
|
56
|
+
if (vr <= 0.1) {
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
const still_air_threshold = 0.1;
|
|
60
|
+
const initial_set_tmp = set_tmp(tdb, tr, vr, rh, met, clo, wme, undefined, undefined, undefined, undefined, false, {
|
|
61
|
+
round: false,
|
|
62
|
+
calculate_ce: true,
|
|
63
|
+
});
|
|
64
|
+
function func(x) {
|
|
65
|
+
return (set_tmp(tdb - x, tr - x, still_air_threshold, rh, met, clo, wme, undefined, undefined, undefined, undefined, false, {
|
|
66
|
+
round: false,
|
|
67
|
+
calculate_ce: true,
|
|
68
|
+
}) - initial_set_tmp);
|
|
69
|
+
}
|
|
70
|
+
let ce;
|
|
71
|
+
try {
|
|
72
|
+
// Find a root of a function in a bracketing interval
|
|
73
|
+
ce = brent(func, 0, 40);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
ce = 0;
|
|
77
|
+
}
|
|
78
|
+
if (ce === 0) {
|
|
79
|
+
console.warn(`Assuming cooling effect = 0 since it could not be calculated for this set of inputs tdb=${tdb}, tr=${tr}, rh=${rh}, vr=${vr}, clo=${clo}, met=${met}`);
|
|
80
|
+
}
|
|
81
|
+
if (units.toLowerCase() === "ip") {
|
|
82
|
+
ce = (ce / 1.8) * 3.28;
|
|
83
|
+
}
|
|
84
|
+
return round(ce, 2);
|
|
85
|
+
}
|
|
86
|
+
// https://gist.github.com/ryanspradlin/18c1010b7dd2d875284933d018c5c908
|
|
87
|
+
// Derived from: https://en.wikipedia.org/wiki/Brent%27s_method#Algorithm
|
|
88
|
+
// Brent's method is a hybrid root-finding algorithm that combines the
|
|
89
|
+
// faster/less-reliable inverse quadradic interpolation and secant methods with
|
|
90
|
+
// the slower/more-reliable bisection method.
|
|
91
|
+
export function brent(f, lowerBound, upperBound, tolerance = 1e-6, maxIterations = 100) {
|
|
92
|
+
let a = lowerBound;
|
|
93
|
+
let b = upperBound;
|
|
94
|
+
let fa = f(a);
|
|
95
|
+
let fb = f(b);
|
|
96
|
+
if (fa * fb > 0) {
|
|
97
|
+
// Root is not bracketed.
|
|
98
|
+
throw new Error(`Root is not bracketed: [${fa}, ${fb}].`);
|
|
99
|
+
}
|
|
100
|
+
if (Math.abs(fa) < Math.abs(fb)) {
|
|
101
|
+
[a, b] = [b, a];
|
|
102
|
+
[fa, fb] = [fb, fa];
|
|
103
|
+
}
|
|
104
|
+
let c = a;
|
|
105
|
+
let fc = fa;
|
|
106
|
+
let s = 0;
|
|
107
|
+
let d = 0;
|
|
108
|
+
let mflag = true;
|
|
109
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
110
|
+
// Check if we have succeeded...
|
|
111
|
+
if (fb === 0 || Math.abs(b - a) <= tolerance) {
|
|
112
|
+
// Root found!
|
|
113
|
+
return b;
|
|
114
|
+
}
|
|
115
|
+
// Try to use fast/less-reliable methods first...
|
|
116
|
+
if (fa !== fc && fb !== fc) {
|
|
117
|
+
// Inverse quadratic interpolation.
|
|
118
|
+
s =
|
|
119
|
+
(a * fb * fc) / ((fa - fb) * (fa - fc)) +
|
|
120
|
+
(b * fa * fc) / ((fb - fa) * (fb - fc)) +
|
|
121
|
+
(c * fa * fb) / ((fc - fa) * (fc - fb));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// Secant method.
|
|
125
|
+
s = b - fb * ((b - a) / (fb - fa));
|
|
126
|
+
}
|
|
127
|
+
// If necessary, fallback to slow/more-reliable method...
|
|
128
|
+
if ((s - (3 * a + b) / 4) * (s - b) >= 0 ||
|
|
129
|
+
(mflag && Math.abs(s - b) >= Math.abs(b - c) / 2) ||
|
|
130
|
+
(!mflag && Math.abs(s - b) >= Math.abs(c - d) / 2) ||
|
|
131
|
+
(mflag && Math.abs(b - c) < Math.abs(tolerance)) ||
|
|
132
|
+
(!mflag && Math.abs(c - d) < Math.abs(tolerance))) {
|
|
133
|
+
// Bisection method.
|
|
134
|
+
s = (a + b) / 2;
|
|
135
|
+
mflag = true;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
mflag = false;
|
|
139
|
+
}
|
|
140
|
+
d = c;
|
|
141
|
+
c = b;
|
|
142
|
+
fc = fb;
|
|
143
|
+
const fs = f(s);
|
|
144
|
+
if (fa * fs < 0) {
|
|
145
|
+
b = s;
|
|
146
|
+
fb = fs;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
a = s;
|
|
150
|
+
fa = fs;
|
|
151
|
+
}
|
|
152
|
+
if (Math.abs(fa) < Math.abs(fb)) {
|
|
153
|
+
[a, b] = [b, a];
|
|
154
|
+
[fa, fb] = [fb, fa];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Could not achieve required tolerance within iteration limit.
|
|
158
|
+
throw new Error("Could not achieve required tolerance within iteration limit.");
|
|
159
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { round } from "../utilities/utilities.js";
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} DiscomfortIndexReturnType - a result set containing the discomfort index and the classification of the
|
|
4
|
+
* thermal comfort conditions
|
|
5
|
+
* @property {number} di – Discomfort Index(DI)
|
|
6
|
+
* @property {string} discomfort_condition Classification of the thermal comfort conditions according to the discomfort index
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Calculates the Discomfort Index (DI). The index is essentially an effective temperature based on air temperature and humidity.
|
|
11
|
+
* The discomfort index is usuallly divided in 6 dicomfort categories and it only applies to warm environments. {@link #ref_24|[24]}
|
|
12
|
+
*
|
|
13
|
+
* - class 1 - DI < 21 °C - No discomfort
|
|
14
|
+
* - class 2 - 21 <= DI < 24 °C - Less than 50% feels discomfort
|
|
15
|
+
* - class 3 - 24 <= DI < 27 °C - More than 50% feels discomfort
|
|
16
|
+
* - class 4 - 27 <= DI < 29 °C - Most of the population feels discomfort
|
|
17
|
+
* - class 5 - 29 <= DI < 32 °C - Everyone feels severe stress
|
|
18
|
+
* - class 6 - DI >= 32 °C - State of medical emergency
|
|
19
|
+
*
|
|
20
|
+
* @see {@link discomfort_index_array} for a version that supports arrays
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @memberof models
|
|
24
|
+
* @docname Discomfort Index (DI)
|
|
25
|
+
*
|
|
26
|
+
* @param {number} tdb - air temperature [C]
|
|
27
|
+
* @param {number} rh - relative humidity [%]
|
|
28
|
+
*
|
|
29
|
+
* @returns {DiscomfortIndexReturnType} object with results of DI
|
|
30
|
+
* @example
|
|
31
|
+
* const DI = discomfort_index(25, 50); // returns { di: 22.1, discomfort_condition: 'Less than 50% feels discomfort' }
|
|
32
|
+
*/
|
|
33
|
+
export function discomfort_index(tdb, rh) {
|
|
34
|
+
const di = calculate_di(tdb, rh);
|
|
35
|
+
const condition = check_categories(di);
|
|
36
|
+
return {
|
|
37
|
+
di: round(di, 1),
|
|
38
|
+
discomfort_condition: condition,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @typedef {Object} DiscomfortIndexArrayReturnType - a result set containing an array of discomfort index and an array
|
|
43
|
+
* of classification of the thermal comfort conditions
|
|
44
|
+
* @property {number[]} di – Discomfort Index(DI) Array
|
|
45
|
+
* @property {string[]} discomfort_condition Classification of the thermal comfort conditions in array
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Calculates the Discomfort Index (DI). The index is essentially an effective temperature based on air temperature and humidity.
|
|
50
|
+
* The discomfort index is usuallly divided in 6 dicomfort categories and it only applies to warm environments. {@link #ref_24|[24]}
|
|
51
|
+
*
|
|
52
|
+
* - class 1 - DI < 21 °C - No discomfort
|
|
53
|
+
* - class 2 - 21 <= DI < 24 °C - Less than 50% feels discomfort
|
|
54
|
+
* - class 3 - 24 <= DI < 27 °C - More than 50% feels discomfort
|
|
55
|
+
* - class 4 - 27 <= DI < 29 °C - Most of the population feels discomfort
|
|
56
|
+
* - class 5 - 29 <= DI < 32 °C - Everyone feels severe stress
|
|
57
|
+
* - class 6 - DI >= 32 °C - State of medical emergency
|
|
58
|
+
*
|
|
59
|
+
* @see {@link discomfort_index} for a version that supports scalar arguments
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @memberof models
|
|
63
|
+
* @docname Discomfort Index (DI) (array version)
|
|
64
|
+
*
|
|
65
|
+
* @param {number[]} tdb - air temperature [C]
|
|
66
|
+
* @param {number[]} rh - relative humidity [%]
|
|
67
|
+
*
|
|
68
|
+
* @returns {DiscomfortIndexArrayReturnType} object with results of DI
|
|
69
|
+
*/
|
|
70
|
+
export function discomfort_index_array(tdb, rh) {
|
|
71
|
+
const di = tdb.map((temperature, index) => calculate_di(temperature, rh[index]));
|
|
72
|
+
const discomfortCondition = di.map((value) => check_categories(value));
|
|
73
|
+
return {
|
|
74
|
+
di: di.map((value) => round(value, 1)),
|
|
75
|
+
discomfort_condition: discomfortCondition,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* Determine the discomfort categories based on DI.
|
|
81
|
+
*
|
|
82
|
+
* @param {number} di - Discomfort Index (DI)
|
|
83
|
+
* @returns {string} Discomfort condition
|
|
84
|
+
*/
|
|
85
|
+
function check_categories(di) {
|
|
86
|
+
const threshold = [21, 24, 27, 29, 32, 99];
|
|
87
|
+
const condition = [
|
|
88
|
+
"No discomfort",
|
|
89
|
+
"Less than 50% feels discomfort",
|
|
90
|
+
"More than 50% feels discomfort",
|
|
91
|
+
"Most of the population feels discomfort",
|
|
92
|
+
"Everyone feels severe stress",
|
|
93
|
+
"State of medical emergency",
|
|
94
|
+
];
|
|
95
|
+
for (let index = 0; index < threshold.length; index++) {
|
|
96
|
+
if (di <= threshold[index]) {
|
|
97
|
+
return condition[index];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Calculate Discomfort Index (DI) based on air temperature and relative humidity.
|
|
103
|
+
*
|
|
104
|
+
* @param {number} tdb - air temperature [C]
|
|
105
|
+
* @param {number} rh - relative humidity [%]
|
|
106
|
+
* @returns {number} Discomfort Index (DI)
|
|
107
|
+
*/
|
|
108
|
+
function calculate_di(tdb, rh) {
|
|
109
|
+
return tdb - 0.55 * (1 - 0.01 * rh) * (tdb - 14.5);
|
|
110
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { pmv, pmv_array } from "./pmv.js";
|
|
2
|
+
import { round } from "../utilities/utilities.js";
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} E_pmvKwargs
|
|
5
|
+
* @property {'SI'|'IP'} units - select the SI (International System of Units) or the IP (Imperial Units) system.
|
|
6
|
+
* @property { boolean } limit_inputs - Default is True. By default, if the inputs are outside the standard
|
|
7
|
+
* applicability limits the function returns NaN. If false, returns pmv and ppd values even if input values
|
|
8
|
+
* are outside the applicability limits of the model.
|
|
9
|
+
*
|
|
10
|
+
* The ISO 7730 2005 limits are 10 < tdb [°C] < 30, 10 < tr [°C] < 40,
|
|
11
|
+
* 0 < vr [m/s] < 1, 0.8 < met [met] < 4, 0 < clo [clo] < 2, and -2 < PMV < 2.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Returns Adjusted Predicted Mean Votes with Expectancy Factor (ePMV). This index was developed by
|
|
16
|
+
* Fanger, P. O. et al. (2002). In non-air-conditioned buildings in warm climates, occupants may sense
|
|
17
|
+
* the warmth as being less severe than the PMV predicts. The main reason is low expectations, but a
|
|
18
|
+
* metabolic rate that is estimated too high can also contribute to explaining the difference. An extension
|
|
19
|
+
* of the PMV model that includes an expectancy factor is introduced for use in non-air-conditioned buildings
|
|
20
|
+
* in warm climates {@link #ref_26|[26]}.
|
|
21
|
+
*
|
|
22
|
+
* This is a version that supports scalar arguments.
|
|
23
|
+
* @see {@link e_pmv_array} for a version that supports arrays.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* @memberof models
|
|
27
|
+
* @docname Adjusted Predicted Mean Votes with Expectancy Factor (ePMV)
|
|
28
|
+
*
|
|
29
|
+
* @param {number} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
|
|
30
|
+
* @param {number} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
|
|
31
|
+
* @param {number} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
|
|
32
|
+
*
|
|
33
|
+
* Note: vr is the relative air speed caused by body movement and not the air
|
|
34
|
+
* speed measured by the air speed sensor. The relative air speed is the sum of the
|
|
35
|
+
* average air speed measured by the sensor plus the activity-generated air speed
|
|
36
|
+
* (Vag). Where Vag is the activity-generated air speed caused by motion of
|
|
37
|
+
* individual body parts. vr can be calculated using the function v_relative in utilities.js.
|
|
38
|
+
* @param {number} rh - Relative humidity, [%]
|
|
39
|
+
* @param {number} met - Metabolic rate, [met]
|
|
40
|
+
* @param {number} clo - Clothing insulation, [clo]
|
|
41
|
+
*
|
|
42
|
+
* Note: The activity as well as the air speed modify the insulation characteristics
|
|
43
|
+
* of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
|
|
44
|
+
* the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
|
|
45
|
+
* for the effect of the body movement for met equal or higher than 1.2 met using
|
|
46
|
+
* the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
|
|
47
|
+
* can be calculated using the function clo_dynamic in utilities.js.
|
|
48
|
+
* @param {number} e_coefficient - expectancy factor
|
|
49
|
+
* @param {number} [wme=0] - External work
|
|
50
|
+
* @param {E_pmvKwargs} [kwargs] - additional arguments
|
|
51
|
+
*
|
|
52
|
+
* @returns {number} pmv - Predicted Mean Vote
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const tdb = 28;
|
|
56
|
+
* const tr = 28;
|
|
57
|
+
* const v = 0.1;
|
|
58
|
+
* const met = 1.4;
|
|
59
|
+
* const clo = 0.5;
|
|
60
|
+
* // Calculate relative air speed
|
|
61
|
+
* const v_r = v_relative(v, met);
|
|
62
|
+
* // Calculate dynamic clothing
|
|
63
|
+
* const clo_d = clo_dynamic(clo, met);
|
|
64
|
+
* const e_coefficient = 0.6;
|
|
65
|
+
*
|
|
66
|
+
* const result = e_pmv(tdb, tr, v_r, rh, met, clo_d, e_coefficient);
|
|
67
|
+
* console.log(result) // output 0.51
|
|
68
|
+
*/
|
|
69
|
+
export function e_pmv(tdb, tr, vr, rh, met, clo, e_coefficient, wme = 0, kwargs = {}) {
|
|
70
|
+
const default_kwargs = {
|
|
71
|
+
units: "SI",
|
|
72
|
+
limit_inputs: true,
|
|
73
|
+
};
|
|
74
|
+
kwargs = Object.assign(default_kwargs, kwargs);
|
|
75
|
+
let _pmv = pmv(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
|
|
76
|
+
met = _pmv > 0 ? met * (1 + _pmv * -0.067) : met;
|
|
77
|
+
_pmv = pmv(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
|
|
78
|
+
return round(_pmv * e_coefficient, 2);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns Adjusted Predicted Mean Votes with Expectancy Factor (ePMV). This index was developed by
|
|
82
|
+
* Fanger, P. O. et al. (2002). In non-air-conditioned buildings in warm climates, occupants may sense
|
|
83
|
+
* the warmth as being less severe than the PMV predicts. The main reason is low expectations, but a
|
|
84
|
+
* metabolic rate that is estimated too high can also contribute to explaining the difference. An extension
|
|
85
|
+
* of the PMV model that includes an expectancy factor is introduced for use in non-air-conditioned buildings
|
|
86
|
+
* in warm climates {@link #ref_26|[26]}.
|
|
87
|
+
*
|
|
88
|
+
* This is a version that supports arrays.
|
|
89
|
+
* @see {@link a_pmv} for a version that supports scalar arguments.
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
* @memberof models
|
|
93
|
+
* @docname Adjusted Predicted Mean Votes with Expectancy Factor (ePMV) (array version)
|
|
94
|
+
*
|
|
95
|
+
* @param {number[]} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
|
|
96
|
+
* @param {number[]} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
|
|
97
|
+
* @param {number[]} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
|
|
98
|
+
*
|
|
99
|
+
* Note: vr is the relative air speed caused by body movement and not the air
|
|
100
|
+
* speed measured by the air speed sensor. The relative air speed is the sum of the
|
|
101
|
+
* average air speed measured by the sensor plus the activity-generated air speed
|
|
102
|
+
* (Vag). Where Vag is the activity-generated air speed caused by motion of
|
|
103
|
+
* individual body parts. vr can be calculated using the function v_relative_array in utilities.js.
|
|
104
|
+
* @param {number[]} rh - Relative humidity, [%]
|
|
105
|
+
* @param {number[]} met - Metabolic rate, [met]
|
|
106
|
+
* @param {number[]} clo - Clothing insulation, [clo]
|
|
107
|
+
*
|
|
108
|
+
* Note: The activity as well as the air speed modify the insulation characteristics
|
|
109
|
+
* of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
|
|
110
|
+
* the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
|
|
111
|
+
* for the effect of the body movement for met equal or higher than 1.2 met using
|
|
112
|
+
* the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
|
|
113
|
+
* can be calculated using the function clo_dynamic_array in utilities.js.
|
|
114
|
+
* @param {number[]} e_coefficient - expectancy factor
|
|
115
|
+
* @param {number[]} wme - External work, default is array of 0
|
|
116
|
+
* @param {E_pmvKwargs} [kwargs] - additional arguments
|
|
117
|
+
*
|
|
118
|
+
* @returns {number[]} pmv - Predicted Mean Vote
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* const tdb = [24, 30];
|
|
122
|
+
* const tr = [30, 30];
|
|
123
|
+
* const v = [0.22, 0.22];
|
|
124
|
+
* const met = [1.4, 1.4];
|
|
125
|
+
* const clo = [0.5, 0.5];
|
|
126
|
+
* // Calculate relative air speed
|
|
127
|
+
* const v_r = v_relative_array(v, met);
|
|
128
|
+
* // Calculate dynamic clothing
|
|
129
|
+
* const clo_d = clo_dynamic_array(clo, met);
|
|
130
|
+
* const e_coefficient = [0.6, 0.6];
|
|
131
|
+
*
|
|
132
|
+
* const result = e_pmv_array(tdb, tr, v_r, rh, met, clo_d, e_coefficient);
|
|
133
|
+
* console.log(result) // output [0.29, 0.91]
|
|
134
|
+
*/
|
|
135
|
+
export function e_pmv_array(tdb, tr, vr, rh, met, clo, e_coefficient, wme, kwargs = {}) {
|
|
136
|
+
const default_kwargs = {
|
|
137
|
+
units: "SI",
|
|
138
|
+
limit_inputs: true,
|
|
139
|
+
};
|
|
140
|
+
kwargs = Object.assign(default_kwargs, kwargs);
|
|
141
|
+
let _pmv = pmv_array(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
|
|
142
|
+
met = _pmv.map((value, i) => {
|
|
143
|
+
return value > 0 ? met[i] * (1 + value * -0.067) : met[i];
|
|
144
|
+
});
|
|
145
|
+
_pmv = pmv_array(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
|
|
146
|
+
return _pmv.map((value, i) => {
|
|
147
|
+
return round(value * e_coefficient[i], 2);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { round } from "../utilities/utilities.js";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the Heat Index (HI). It combines air temperature and relative humidity to determine an apparent temperature.
|
|
4
|
+
* The HI equation {@link #ref_12|[12]} is derived by multiple regression analysis in temperature and relative humidity from the first version
|
|
5
|
+
* of Steadman’s (1979) apparent temperature (AT) {@link #ref_13|[13]}.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
* @memberof models
|
|
9
|
+
* @docname Heat Index
|
|
10
|
+
*
|
|
11
|
+
* @param {number} tdb Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'.
|
|
12
|
+
* @param {number} rh Relative humidity, [%].
|
|
13
|
+
* @param {Object} [options] (Optional) Other parameters.
|
|
14
|
+
* @param {boolean} [options.round=true] - If True rounds output value, if False it does not round it.
|
|
15
|
+
* @param {"SI" | "IP"} [options.units="SI"] - Select the SI (International System of Units) or the IP (Imperial Units) system.
|
|
16
|
+
*
|
|
17
|
+
* @returns {number} Heat Index, default in [°C] in [°F] if `units` = 'IP'.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const hi = heat_index(25, 50); // returns 25.9
|
|
21
|
+
*
|
|
22
|
+
* @category Thermophysiological models
|
|
23
|
+
*/
|
|
24
|
+
export function heat_index(tdb, rh, options = { round: true, units: "SI" }) {
|
|
25
|
+
/**
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
let hi;
|
|
29
|
+
let tdb_squared = Math.pow(tdb, 2);
|
|
30
|
+
let rh_squared = Math.pow(rh, 2);
|
|
31
|
+
if (options.units === undefined || options.units === "SI") {
|
|
32
|
+
hi =
|
|
33
|
+
-8.784695 +
|
|
34
|
+
1.61139411 * tdb +
|
|
35
|
+
2.338549 * rh -
|
|
36
|
+
0.14611605 * tdb * rh -
|
|
37
|
+
0.012308094 * tdb_squared -
|
|
38
|
+
0.016424828 * rh_squared +
|
|
39
|
+
0.002211732 * tdb_squared * rh +
|
|
40
|
+
0.00072546 * tdb * rh_squared -
|
|
41
|
+
0.000003582 * tdb_squared * rh_squared;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
hi =
|
|
45
|
+
-42.379 +
|
|
46
|
+
2.04901523 * tdb +
|
|
47
|
+
10.14333127 * rh -
|
|
48
|
+
0.22475541 * tdb * rh -
|
|
49
|
+
0.00683783 * tdb_squared -
|
|
50
|
+
0.05481717 * rh_squared +
|
|
51
|
+
0.00122874 * tdb_squared * rh +
|
|
52
|
+
0.00085282 * tdb * rh_squared -
|
|
53
|
+
0.00000199 * tdb_squared * rh_squared;
|
|
54
|
+
}
|
|
55
|
+
return options.round === undefined || options.round ? round(hi, 1) : hi;
|
|
56
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { round } from "../utilities/utilities.js";
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {object} HumidexResult - a result set containing the humidex and
|
|
4
|
+
* discomfort level.
|
|
5
|
+
* @property {number} humidex - the humdidex given the provided dry bulb
|
|
6
|
+
* air temperature and relative humidity.
|
|
7
|
+
* @property {string} discomfort - a human description of how the weather
|
|
8
|
+
* would be felt by the average person.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Calculates the humidex (short for "humidity index"). It has been
|
|
13
|
+
* developed by the Canadian Meteorological service. It was introduced in 1965
|
|
14
|
+
* and then it was revised by Masterson and Richardson (1979) {@link #ref_14|[14]}. It aims
|
|
15
|
+
* to describe how hot, humid weather is felt by the average person. The
|
|
16
|
+
* Humidex differs from the heat index in being related to the dew point
|
|
17
|
+
* rather than relative humidity {@link #ref_15|[15]}.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
* @memberof models
|
|
21
|
+
* @docname Humidex
|
|
22
|
+
*
|
|
23
|
+
* @param {number} tdb - dry bulb air temperature, [°C]
|
|
24
|
+
* @param {number} rh - relative humidity, [%]
|
|
25
|
+
* @param {object} [options] - configuration options for the function.
|
|
26
|
+
* @param {boolean} [options.round = true] - If true, rounds output value. If
|
|
27
|
+
* false, it does not.
|
|
28
|
+
*
|
|
29
|
+
* @returns {HumidexResult} the result given the provided temperature and
|
|
30
|
+
* relative humidity.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const result = humidex(25, 50);
|
|
34
|
+
* console.log(result); // -> { humidex: 28.2, discomfort: "Little or no discomfort" }
|
|
35
|
+
*/
|
|
36
|
+
export function humidex(tdb, rh, options = { round: true }) {
|
|
37
|
+
let hi = tdb +
|
|
38
|
+
(5 / 9) * ((6.112 * 10 ** ((7.5 * tdb) / (237.7 + tdb)) * rh) / 100 - 10);
|
|
39
|
+
if (options.round) {
|
|
40
|
+
hi = round(hi, 1);
|
|
41
|
+
}
|
|
42
|
+
let stress_category = "Heat stroke probable";
|
|
43
|
+
if (hi <= 30) {
|
|
44
|
+
stress_category = "Little or no discomfort";
|
|
45
|
+
}
|
|
46
|
+
else if (hi <= 35) {
|
|
47
|
+
stress_category = "Noticeable discomfort";
|
|
48
|
+
}
|
|
49
|
+
else if (hi <= 40) {
|
|
50
|
+
stress_category = "Evident discomfort";
|
|
51
|
+
}
|
|
52
|
+
else if (hi <= 45) {
|
|
53
|
+
stress_category = "Intense discomfort; avoid exertion";
|
|
54
|
+
}
|
|
55
|
+
else if (hi <= 54) {
|
|
56
|
+
stress_category = "Dangerous discomfort";
|
|
57
|
+
}
|
|
58
|
+
return { humidex: hi, discomfort: stress_category };
|
|
59
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { heat_index } from "./heat_index.js";
|
|
2
|
+
import { phs } from "./phs.js";
|
|
3
|
+
import { humidex } from "./humidex.js";
|
|
4
|
+
import { net } from "./net.js";
|
|
5
|
+
import { wbgt } from "./wbgt.js";
|
|
6
|
+
import { discomfort_index, discomfort_index_array, } from "./discomfort_index.js";
|
|
7
|
+
import { two_nodes, two_nodes_array } from "./two_nodes.js";
|
|
8
|
+
import { set_tmp, set_tmp_array } from "./set_tmp.js";
|
|
9
|
+
import { wc } from "./wc.js";
|
|
10
|
+
import { adaptive_en, adaptive_en_array } from "./adaptive_en.js";
|
|
11
|
+
import { at } from "./at.js";
|
|
12
|
+
import { pmv_ppd, pmv_ppd_array } from "./pmv_ppd.js";
|
|
13
|
+
import { adaptive_ashrae, adaptive_ashrae_array } from "./adaptive_ashrae.js";
|
|
14
|
+
import { solar_gain } from "./solar_gain.js";
|
|
15
|
+
import { cooling_effect } from "./cooling_effect.js";
|
|
16
|
+
import { athb, athb_array } from "./athb.js";
|
|
17
|
+
import { pmv, pmv_array } from "./pmv.js";
|
|
18
|
+
import { a_pmv, a_pmv_array } from "./a_pmv.js";
|
|
19
|
+
import { ankle_draft } from "./ankle_draft.js";
|
|
20
|
+
import { e_pmv, e_pmv_array } from "./e_pmv.js";
|
|
21
|
+
import { vertical_tmp_grad_ppd } from "./vertical_tmp_grad_ppd";
|
|
22
|
+
import { use_fans_heatwaves } from "./use_fans_heatwave.js";
|
|
23
|
+
import { clo_tout, clo_tout_array } from "./clo_tout.js";
|
|
24
|
+
import { utci, utci_array } from "./utci.js";
|
|
25
|
+
import { pet_steady } from "./pet_steady.js";
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
* @name models
|
|
29
|
+
* @docname Comfort Models
|
|
30
|
+
*/
|
|
31
|
+
export default {
|
|
32
|
+
heat_index,
|
|
33
|
+
phs,
|
|
34
|
+
humidex,
|
|
35
|
+
net,
|
|
36
|
+
wbgt,
|
|
37
|
+
clo_tout,
|
|
38
|
+
clo_tout_array,
|
|
39
|
+
discomfort_index,
|
|
40
|
+
discomfort_index_array,
|
|
41
|
+
two_nodes,
|
|
42
|
+
two_nodes_array,
|
|
43
|
+
wc,
|
|
44
|
+
adaptive_en,
|
|
45
|
+
adaptive_en_array,
|
|
46
|
+
at,
|
|
47
|
+
vertical_tmp_grad_ppd,
|
|
48
|
+
set_tmp,
|
|
49
|
+
set_tmp_array,
|
|
50
|
+
adaptive_ashrae,
|
|
51
|
+
adaptive_ashrae_array,
|
|
52
|
+
solar_gain,
|
|
53
|
+
cooling_effect,
|
|
54
|
+
pmv_ppd,
|
|
55
|
+
pmv_ppd_array,
|
|
56
|
+
pmv,
|
|
57
|
+
pmv_array,
|
|
58
|
+
athb,
|
|
59
|
+
athb_array,
|
|
60
|
+
a_pmv,
|
|
61
|
+
a_pmv_array,
|
|
62
|
+
ankle_draft,
|
|
63
|
+
e_pmv,
|
|
64
|
+
e_pmv_array,
|
|
65
|
+
use_fans_heatwaves,
|
|
66
|
+
utci,
|
|
67
|
+
utci_array,
|
|
68
|
+
pet_steady,
|
|
69
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { round } from "../utilities/utilities.js";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the Normal Effective Temperature (NET). Missenard (1933)
|
|
4
|
+
* devised a formula for calculating effective temperature. The index
|
|
5
|
+
* establishes a link between the same condition of the organism's
|
|
6
|
+
* thermoregulatory capability (warm and cold perception) and the surrounding
|
|
7
|
+
* environment's temperature and humidity. The index is calculated as a
|
|
8
|
+
* function of three meteorological factors: air temperature, relative
|
|
9
|
+
* humidity of air, and wind speed. This index allows to calculate the
|
|
10
|
+
* effective temperature felt by a person. Missenard original equation was
|
|
11
|
+
* then used to calculate the Normal Effective Temperature (NET), by
|
|
12
|
+
* considering normal atmospheric pressure and a normal human body temperature
|
|
13
|
+
* (37°C). The NET is still in use in Germany, where medical check-ups for
|
|
14
|
+
* subjects working in the heat are decided on by prevailing levels of ET,
|
|
15
|
+
* depending on metabolic rates. The NET is also constantly monitored by the
|
|
16
|
+
* Hong Kong Observatory {@link #ref_16|[16]}. In central Europe the following thresholds are
|
|
17
|
+
* in use: <1°C = very cold; 1–9 = cold; 9–17 = cool; 17–21 = fresh;
|
|
18
|
+
* 21–23 = comfortable; 23–27 = warm; >27°C = hot [1].
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @memberof models
|
|
22
|
+
* @docname Normal Effective Temperature (NET)
|
|
23
|
+
*
|
|
24
|
+
* @param {number} tdb - dry bulb air temperature, [°C]
|
|
25
|
+
* @param {number} rh - relative humidity, [%]
|
|
26
|
+
* @param {number} v - wind speed [m/s] at 1.2 m above the ground
|
|
27
|
+
* @param {object} [options] - configuration options for the function.
|
|
28
|
+
* @param {boolean} [options.round = true] - If true, rounds output value. If
|
|
29
|
+
* false, it does not.
|
|
30
|
+
*
|
|
31
|
+
* @returns {number} Normal Effective Temperature, [°C]
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const result = net(37, 100, 0.1);
|
|
35
|
+
* console.log(result); // -> 37
|
|
36
|
+
*/
|
|
37
|
+
export function net(tdb, rh, v, options = { round: true }) {
|
|
38
|
+
const frac = 1.0 / (1.76 + 1.4 * v ** 0.75);
|
|
39
|
+
const et = 37 -
|
|
40
|
+
(37 - tdb) / (0.68 - 0.0014 * rh + frac) -
|
|
41
|
+
0.29 * tdb * (1 - 0.01 * rh);
|
|
42
|
+
if (options.round) {
|
|
43
|
+
return round(et, 1);
|
|
44
|
+
}
|
|
45
|
+
return et;
|
|
46
|
+
}
|