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.
Files changed (228) hide show
  1. package/README.md +196 -6
  2. package/lib/cjs/index.js +7 -434
  3. package/lib/cjs/models/a_pmv.js +140 -0
  4. package/lib/cjs/models/adaptive_ashrae.js +290 -0
  5. package/lib/cjs/models/adaptive_en.js +300 -0
  6. package/lib/cjs/models/ankle_draft.js +82 -0
  7. package/lib/cjs/models/at.js +52 -0
  8. package/lib/cjs/models/athb.js +135 -0
  9. package/lib/cjs/models/clo_tout.js +58 -0
  10. package/lib/cjs/models/cooling_effect.js +164 -0
  11. package/lib/cjs/models/discomfort_index.js +115 -0
  12. package/lib/cjs/models/e_pmv.js +154 -0
  13. package/lib/cjs/models/heat_index.js +60 -0
  14. package/lib/cjs/models/humidex.js +63 -0
  15. package/lib/cjs/models/index.js +71 -0
  16. package/lib/cjs/models/net.js +50 -0
  17. package/lib/cjs/models/pet_steady.js +443 -0
  18. package/lib/cjs/models/phs.js +458 -0
  19. package/lib/cjs/models/pmv.js +200 -0
  20. package/lib/cjs/models/pmv_ppd.js +404 -0
  21. package/lib/cjs/models/set_tmp.js +203 -0
  22. package/lib/cjs/models/solar_gain.js +163 -0
  23. package/lib/cjs/models/two_nodes.js +790 -0
  24. package/lib/cjs/models/use_fans_heatwave.js +203 -0
  25. package/lib/cjs/models/utci.js +609 -0
  26. package/lib/cjs/models/vertical_tmp_grad_ppd.js +95 -0
  27. package/lib/cjs/models/wbgt.js +72 -0
  28. package/lib/cjs/models/wc.js +37 -0
  29. package/lib/cjs/psychrometrics/enthalpy.js +24 -0
  30. package/lib/cjs/psychrometrics/index.js +28 -0
  31. package/lib/cjs/psychrometrics/p_sat.js +46 -0
  32. package/lib/cjs/psychrometrics/p_sat_torr.js +34 -0
  33. package/lib/cjs/psychrometrics/psy_ta_rh.js +51 -0
  34. package/lib/cjs/psychrometrics/t_dp.js +19 -0
  35. package/lib/cjs/psychrometrics/t_mrt.js +117 -0
  36. package/lib/cjs/psychrometrics/t_o.js +82 -0
  37. package/lib/cjs/psychrometrics/t_wb.js +23 -0
  38. package/lib/cjs/types/index.d.ts +7 -79
  39. package/lib/cjs/types/index.d.ts.map +1 -1
  40. package/lib/cjs/types/models/a_pmv.d.ts +133 -0
  41. package/lib/cjs/types/models/a_pmv.d.ts.map +1 -0
  42. package/lib/cjs/types/models/adaptive_ashrae.d.ts +211 -0
  43. package/lib/cjs/types/models/adaptive_ashrae.d.ts.map +1 -0
  44. package/lib/cjs/types/models/adaptive_en.d.ts +217 -0
  45. package/lib/cjs/types/models/adaptive_en.d.ts.map +1 -0
  46. package/lib/cjs/types/models/ankle_draft.d.ts +60 -0
  47. package/lib/cjs/types/models/ankle_draft.d.ts.map +1 -0
  48. package/lib/cjs/types/models/at.d.ts +34 -0
  49. package/lib/cjs/types/models/at.d.ts.map +1 -0
  50. package/lib/cjs/types/models/athb.d.ts +96 -0
  51. package/lib/cjs/types/models/athb.d.ts.map +1 -0
  52. package/lib/cjs/types/models/clo_tout.d.ts +45 -0
  53. package/lib/cjs/types/models/clo_tout.d.ts.map +1 -0
  54. package/lib/cjs/types/models/cooling_effect.d.ts +49 -0
  55. package/lib/cjs/types/models/cooling_effect.d.ts.map +1 -0
  56. package/lib/cjs/types/models/discomfort_index.d.ts +91 -0
  57. package/lib/cjs/types/models/discomfort_index.d.ts.map +1 -0
  58. package/lib/cjs/types/models/e_pmv.d.ts +139 -0
  59. package/lib/cjs/types/models/e_pmv.d.ts.map +1 -0
  60. package/lib/cjs/types/models/heat_index.d.ts +27 -0
  61. package/lib/cjs/types/models/heat_index.d.ts.map +1 -0
  62. package/lib/cjs/types/models/humidex.d.ts +54 -0
  63. package/lib/cjs/types/models/humidex.d.ts.map +1 -0
  64. package/lib/cjs/types/models/index.d.ts +78 -0
  65. package/lib/cjs/types/models/index.d.ts.map +1 -0
  66. package/lib/cjs/types/models/net.d.ts +39 -0
  67. package/lib/cjs/types/models/net.d.ts.map +1 -0
  68. package/lib/cjs/types/models/pet_steady.d.ts +59 -0
  69. package/lib/cjs/types/models/pet_steady.d.ts.map +1 -0
  70. package/lib/cjs/types/models/phs.d.ts +242 -0
  71. package/lib/cjs/types/models/phs.d.ts.map +1 -0
  72. package/lib/cjs/types/models/pmv.d.ts +198 -0
  73. package/lib/cjs/types/models/pmv.d.ts.map +1 -0
  74. package/lib/cjs/types/models/pmv_ppd.d.ts +246 -0
  75. package/lib/cjs/types/models/pmv_ppd.d.ts.map +1 -0
  76. package/lib/cjs/types/models/set_tmp.d.ts +124 -0
  77. package/lib/cjs/types/models/set_tmp.d.ts.map +1 -0
  78. package/lib/cjs/types/models/solar_gain.d.ts +76 -0
  79. package/lib/cjs/types/models/solar_gain.d.ts.map +1 -0
  80. package/lib/cjs/types/models/two_nodes.d.ts +412 -0
  81. package/lib/cjs/types/models/two_nodes.d.ts.map +1 -0
  82. package/lib/cjs/types/models/use_fans_heatwave.d.ts +188 -0
  83. package/lib/cjs/types/models/use_fans_heatwave.d.ts.map +1 -0
  84. package/lib/cjs/types/models/utci.d.ts +79 -0
  85. package/lib/cjs/types/models/utci.d.ts.map +1 -0
  86. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts +58 -0
  87. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -0
  88. package/lib/cjs/types/models/wbgt.d.ts +51 -0
  89. package/lib/cjs/types/models/wbgt.d.ts.map +1 -0
  90. package/lib/cjs/types/models/wc.d.ts +29 -0
  91. package/lib/cjs/types/models/wc.d.ts.map +1 -0
  92. package/lib/cjs/types/psychrometrics/enthalpy.d.ts +12 -0
  93. package/lib/cjs/types/psychrometrics/enthalpy.d.ts.map +1 -0
  94. package/lib/cjs/types/psychrometrics/index.d.ts +26 -0
  95. package/lib/cjs/types/psychrometrics/index.d.ts.map +1 -0
  96. package/lib/cjs/types/psychrometrics/p_sat.d.ts +13 -0
  97. package/lib/cjs/types/psychrometrics/p_sat.d.ts.map +1 -0
  98. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts +26 -0
  99. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
  100. package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts +51 -0
  101. package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
  102. package/lib/cjs/types/psychrometrics/t_dp.d.ts +9 -0
  103. package/lib/cjs/types/psychrometrics/t_dp.d.ts.map +1 -0
  104. package/lib/cjs/types/psychrometrics/t_mrt.d.ts +43 -0
  105. package/lib/cjs/types/psychrometrics/t_mrt.d.ts.map +1 -0
  106. package/lib/cjs/types/psychrometrics/t_o.d.ts +31 -0
  107. package/lib/cjs/types/psychrometrics/t_o.d.ts.map +1 -0
  108. package/lib/cjs/types/psychrometrics/t_wb.d.ts +12 -0
  109. package/lib/cjs/types/psychrometrics/t_wb.d.ts.map +1 -0
  110. package/lib/cjs/types/utilities/index.d.ts +28 -0
  111. package/lib/cjs/types/utilities/index.d.ts.map +1 -0
  112. package/lib/cjs/types/utilities/utilities.d.ts +377 -0
  113. package/lib/cjs/types/utilities/utilities.d.ts.map +1 -0
  114. package/lib/cjs/utilities/index.js +27 -0
  115. package/lib/cjs/utilities/utilities.js +903 -0
  116. package/lib/esm/index.js +4 -0
  117. package/lib/esm/models/a_pmv.js +135 -0
  118. package/lib/esm/models/adaptive_ashrae.js +285 -0
  119. package/lib/esm/models/adaptive_en.js +294 -0
  120. package/lib/esm/models/ankle_draft.js +78 -0
  121. package/lib/esm/models/at.js +48 -0
  122. package/lib/esm/models/athb.js +130 -0
  123. package/lib/esm/models/clo_tout.js +53 -0
  124. package/lib/esm/models/cooling_effect.js +159 -0
  125. package/lib/esm/models/discomfort_index.js +110 -0
  126. package/lib/esm/models/e_pmv.js +149 -0
  127. package/lib/esm/models/heat_index.js +56 -0
  128. package/lib/esm/models/humidex.js +59 -0
  129. package/lib/esm/models/index.js +69 -0
  130. package/lib/esm/models/net.js +46 -0
  131. package/lib/esm/models/pet_steady.js +439 -0
  132. package/lib/esm/models/phs.js +454 -0
  133. package/lib/esm/models/pmv.js +195 -0
  134. package/lib/esm/models/pmv_ppd.js +398 -0
  135. package/lib/esm/models/set_tmp.js +198 -0
  136. package/lib/esm/models/solar_gain.js +158 -0
  137. package/lib/esm/models/two_nodes.js +784 -0
  138. package/lib/esm/models/use_fans_heatwave.js +199 -0
  139. package/lib/esm/models/utci.js +604 -0
  140. package/lib/esm/models/wbgt.js +68 -0
  141. package/lib/esm/models/wc.js +33 -0
  142. package/lib/esm/psychrometrics/enthalpy.js +20 -0
  143. package/lib/esm/psychrometrics/index.js +26 -0
  144. package/lib/esm/psychrometrics/p_sat.js +42 -0
  145. package/lib/esm/psychrometrics/p_sat_torr.js +29 -0
  146. package/lib/esm/psychrometrics/psy_ta_rh.js +47 -0
  147. package/lib/esm/psychrometrics/t_dp.js +15 -0
  148. package/lib/esm/psychrometrics/t_mrt.js +112 -0
  149. package/lib/esm/psychrometrics/t_o.js +77 -0
  150. package/lib/esm/psychrometrics/t_wb.js +19 -0
  151. package/lib/esm/types/index.d.ts +7 -79
  152. package/lib/esm/types/index.d.ts.map +1 -1
  153. package/lib/esm/types/models/a_pmv.d.ts +133 -0
  154. package/lib/esm/types/models/a_pmv.d.ts.map +1 -0
  155. package/lib/esm/types/models/adaptive_ashrae.d.ts +211 -0
  156. package/lib/esm/types/models/adaptive_ashrae.d.ts.map +1 -0
  157. package/lib/esm/types/models/adaptive_en.d.ts +217 -0
  158. package/lib/esm/types/models/adaptive_en.d.ts.map +1 -0
  159. package/lib/esm/types/models/ankle_draft.d.ts +60 -0
  160. package/lib/esm/types/models/ankle_draft.d.ts.map +1 -0
  161. package/lib/esm/types/models/at.d.ts +34 -0
  162. package/lib/esm/types/models/at.d.ts.map +1 -0
  163. package/lib/esm/types/models/athb.d.ts +96 -0
  164. package/lib/esm/types/models/athb.d.ts.map +1 -0
  165. package/lib/esm/types/models/clo_tout.d.ts +45 -0
  166. package/lib/esm/types/models/clo_tout.d.ts.map +1 -0
  167. package/lib/esm/types/models/cooling_effect.d.ts +49 -0
  168. package/lib/esm/types/models/cooling_effect.d.ts.map +1 -0
  169. package/lib/esm/types/models/discomfort_index.d.ts +91 -0
  170. package/lib/esm/types/models/discomfort_index.d.ts.map +1 -0
  171. package/lib/esm/types/models/e_pmv.d.ts +139 -0
  172. package/lib/esm/types/models/e_pmv.d.ts.map +1 -0
  173. package/lib/esm/types/models/heat_index.d.ts +27 -0
  174. package/lib/esm/types/models/heat_index.d.ts.map +1 -0
  175. package/lib/esm/types/models/humidex.d.ts +54 -0
  176. package/lib/esm/types/models/humidex.d.ts.map +1 -0
  177. package/lib/esm/types/models/index.d.ts +77 -0
  178. package/lib/esm/types/models/index.d.ts.map +1 -0
  179. package/lib/esm/types/models/net.d.ts +39 -0
  180. package/lib/esm/types/models/net.d.ts.map +1 -0
  181. package/lib/esm/types/models/pet_steady.d.ts +59 -0
  182. package/lib/esm/types/models/pet_steady.d.ts.map +1 -0
  183. package/lib/esm/types/models/phs.d.ts +242 -0
  184. package/lib/esm/types/models/phs.d.ts.map +1 -0
  185. package/lib/esm/types/models/pmv.d.ts +198 -0
  186. package/lib/esm/types/models/pmv.d.ts.map +1 -0
  187. package/lib/esm/types/models/pmv_ppd.d.ts +246 -0
  188. package/lib/esm/types/models/pmv_ppd.d.ts.map +1 -0
  189. package/lib/esm/types/models/set_tmp.d.ts +124 -0
  190. package/lib/esm/types/models/set_tmp.d.ts.map +1 -0
  191. package/lib/esm/types/models/solar_gain.d.ts +76 -0
  192. package/lib/esm/types/models/solar_gain.d.ts.map +1 -0
  193. package/lib/esm/types/models/two_nodes.d.ts +412 -0
  194. package/lib/esm/types/models/two_nodes.d.ts.map +1 -0
  195. package/lib/esm/types/models/use_fans_heatwave.d.ts +188 -0
  196. package/lib/esm/types/models/use_fans_heatwave.d.ts.map +1 -0
  197. package/lib/esm/types/models/utci.d.ts +79 -0
  198. package/lib/esm/types/models/utci.d.ts.map +1 -0
  199. package/lib/esm/types/models/wbgt.d.ts +51 -0
  200. package/lib/esm/types/models/wbgt.d.ts.map +1 -0
  201. package/lib/esm/types/models/wc.d.ts +29 -0
  202. package/lib/esm/types/models/wc.d.ts.map +1 -0
  203. package/lib/esm/types/psychrometrics/enthalpy.d.ts +12 -0
  204. package/lib/esm/types/psychrometrics/enthalpy.d.ts.map +1 -0
  205. package/lib/esm/types/psychrometrics/index.d.ts +26 -0
  206. package/lib/esm/types/psychrometrics/index.d.ts.map +1 -0
  207. package/lib/esm/types/psychrometrics/p_sat.d.ts +13 -0
  208. package/lib/esm/types/psychrometrics/p_sat.d.ts.map +1 -0
  209. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts +26 -0
  210. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
  211. package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts +51 -0
  212. package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
  213. package/lib/esm/types/psychrometrics/t_dp.d.ts +9 -0
  214. package/lib/esm/types/psychrometrics/t_dp.d.ts.map +1 -0
  215. package/lib/esm/types/psychrometrics/t_mrt.d.ts +43 -0
  216. package/lib/esm/types/psychrometrics/t_mrt.d.ts.map +1 -0
  217. package/lib/esm/types/psychrometrics/t_o.d.ts +31 -0
  218. package/lib/esm/types/psychrometrics/t_o.d.ts.map +1 -0
  219. package/lib/esm/types/psychrometrics/t_wb.d.ts +12 -0
  220. package/lib/esm/types/psychrometrics/t_wb.d.ts.map +1 -0
  221. package/lib/esm/types/utilities/index.d.ts +28 -0
  222. package/lib/esm/types/utilities/index.d.ts.map +1 -0
  223. package/lib/esm/types/utilities/utilities.d.ts +377 -0
  224. package/lib/esm/types/utilities/utilities.d.ts.map +1 -0
  225. package/lib/esm/utilities/index.js +25 -0
  226. package/lib/esm/utilities/utilities.js +885 -0
  227. package/package.json +22 -15
  228. package/lib/esm/index.mjs +0 -430
@@ -0,0 +1,4 @@
1
+ import utilities from "./utilities/index.js";
2
+ import psychrometrics from "./psychrometrics/index.js";
3
+ import models from "./models/index.js";
4
+ export default { utilities, psychrometrics, models };
@@ -0,0 +1,135 @@
1
+ import { pmv, pmv_array } from "./pmv.js";
2
+ import { round } from "../utilities/utilities.js";
3
+ /**
4
+ * @typedef {Object} A_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 applicability
7
+ * limits the function returns NaN. If false, returns pmv and ppd values even if input values are outside
8
+ * 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 Adaptive Predicted Mean Vote (aPMV) {@link #ref_25|[25]}.
16
+ * This index was developed by Yao, R. et al. (2009). The model takes into account factors
17
+ * such as culture, climate, social, psychological and behavioral adaptations, which have
18
+ * an impact on the senses used to detect thermal comfort. This model uses an adaptive
19
+ * coefficient (λ) representing the adaptive factors that affect the sense of thermal comfort.
20
+ *
21
+ * This is a version that supports scalar arguments.
22
+ * @see {@link a_pmv_array} for a version that supports arrays.
23
+ *
24
+ * @public
25
+ * @memberof models
26
+ * @docname Adaptive Predicted Mean Vote (aPMV)
27
+ *
28
+ * @param {number} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
29
+ * @param {number} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
30
+ * @param {number} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
31
+ *
32
+ * Note: vr is the relative air speed caused by body movement and not the air
33
+ * speed measured by the air speed sensor. The relative air speed is the sum of the
34
+ * average air speed measured by the sensor plus the activity-generated air speed
35
+ * (Vag). Where Vag is the activity-generated air speed caused by motion of
36
+ * individual body parts. vr can be calculated using the function v_relative in utilities.js.
37
+ * @param {number} rh - Relative humidity, [%]
38
+ * @param {number} met - Metabolic rate, [met]
39
+ * @param {number} clo - Clothing insulation, [clo]
40
+ *
41
+ * Note: The activity as well as the air speed modify the insulation characteristics
42
+ * of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
43
+ * the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
44
+ * for the effect of the body movement for met equal or higher than 1.2 met using
45
+ * the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
46
+ * can be calculated using the function clo_dynamic in utilities.js.
47
+ * @param {number} a_coefficient - Adaptive coefficient
48
+ * @param {number} [wme=0] - External work
49
+ * @param {A_pmvKwargs} kwargs - additional arguments
50
+ *
51
+ * @returns {number} pmv - Predicted Mean Vote
52
+ *
53
+ * @example
54
+ * const tdb = 24,
55
+ * const tr = 30,
56
+ * const vr = 0.22,
57
+ * const rh = 50,
58
+ * const met = 1.4,
59
+ * const clo = 0.5,
60
+ * const a_coefficient = 0.293,
61
+ * const wme = undefined,
62
+ *
63
+ * const result = a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme);
64
+ * console.log(result) //output 0.48
65
+ */
66
+ export function a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme = 0, kwargs = {}) {
67
+ const default_kwargs = {
68
+ units: "SI",
69
+ limit_inputs: true,
70
+ };
71
+ kwargs = Object.assign(default_kwargs, kwargs);
72
+ const _pmv = pmv(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
73
+ return round(_pmv / (1 + a_coefficient * _pmv), 2);
74
+ }
75
+ /**
76
+ * Returns Adaptive Predicted Mean Vote (aPMV) {@link #ref_25|[25]}.
77
+ * This index was developed by Yao, R. et al. (2009). The model takes into account factors
78
+ * such as culture, climate, social, psychological and behavioral adaptations, which have
79
+ * an impact on the senses used to detect thermal comfort. This model uses an adaptive
80
+ * coefficient (λ) representing the adaptive factors that affect the sense of thermal comfort.
81
+ *
82
+ * This is a version that supports arrays.
83
+ * @see {@link a_pmv} for a version that supports scalar arguments.
84
+ *
85
+ * @public
86
+ * @memberof models
87
+ * @docname Adaptive Predicted Mean Vote (aPMV) (array version)
88
+ *
89
+ * @param {number[]} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
90
+ * @param {number[]} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
91
+ * @param {number[]} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
92
+ *
93
+ * Note: vr is the relative air speed caused by body movement and not the air
94
+ * speed measured by the air speed sensor. The relative air speed is the sum of the
95
+ * average air speed measured by the sensor plus the activity-generated air speed
96
+ * (Vag). Where Vag is the activity-generated air speed caused by motion of
97
+ * individual body parts. vr can be calculated using the function v_relative_array in utilities.js.
98
+ * @param {number[]} rh - Relative humidity, [%]
99
+ * @param {number[]} met - Metabolic rate, [met]
100
+ * @param {number[]} clo - Clothing insulation, [clo]
101
+ *
102
+ * Note: The activity as well as the air speed modify the insulation characteristics
103
+ * of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
104
+ * the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
105
+ * for the effect of the body movement for met equal or higher than 1.2 met using
106
+ * the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
107
+ * can be calculated using the function clo_dynamic_array in utilities.js.
108
+ * @param {number[]} a_coefficient - Adaptive coefficient
109
+ * @param {number[]} wme - External work, default is array of 0
110
+ * @param {A_pmvKwargs} kwargs - additional arguments
111
+ *
112
+ * @returns {number[]} pmv - Predicted Mean Vote
113
+ *
114
+ * @example
115
+ * const tdb = [24, 30],
116
+ * const tr = [30, 30],
117
+ * const vr = [0.22, 0.22],
118
+ * const rh = [50, 50],
119
+ * const met = [1.4, 1.4],
120
+ * const clo = [0.5, 0.5],
121
+ * const a_coefficient = [0.293, 0.293],
122
+ * const wme = undefined,
123
+ *
124
+ * const result = a_pmv_array(tdb, tr, vr, rh, met, clo, a_coefficient, wme);
125
+ * console.log(result) //output [0.48, 1.09]
126
+ */
127
+ export function a_pmv_array(tdb, tr, vr, rh, met, clo, a_coefficient, wme, kwargs = {}) {
128
+ const default_kwargs = {
129
+ units: "SI",
130
+ limit_inputs: true,
131
+ };
132
+ kwargs = Object.assign(default_kwargs, kwargs);
133
+ const _pmv = pmv_array(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
134
+ return _pmv.map((_pmvValue, i) => round(_pmvValue / (1 + a_coefficient[i] * _pmvValue), 2));
135
+ }
@@ -0,0 +1,285 @@
1
+ import { round, check_standard_compliance_array, units_converter, valid_range, units_converter_array, } from "../utilities/utilities.js";
2
+ import { t_o, t_o_array } from "../psychrometrics/t_o.js";
3
+ import { get_ce } from "./adaptive_en.js";
4
+ /**
5
+ * @typedef {object} AdaptiveAshraeResult
6
+ * @property {number} tmp_cmf - Comfort temperature a that specific running mean temperature, default in [°C] or in [°F]
7
+ * @property {number} tmp_cmf_80_low - Lower acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
8
+ * @property {number} tmp_cmf_80_up - Upper acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
9
+ * @property {number} tmp_cmf_90_low - Lower acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
10
+ * @property {number} tmp_cmf_90_up - Upper acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
11
+ * @property {boolean} acceptability_80 - Acceptability for 80% occupants
12
+ * @property {boolean} acceptability_90 - Acceptability for 90% occupants
13
+ * @public
14
+ */
15
+ /**
16
+ * Determines the adaptive thermal comfort based on ASHRAE 55. The adaptive
17
+ * model relates indoor design temperatures or acceptable temperature ranges
18
+ * to outdoor meteorological or climatological parameters. The adaptive model
19
+ * can only be used in occupant-controlled naturally conditioned spaces that
20
+ * meet all the following criteria:
21
+ *
22
+ * - There is no mechianical cooling or heating system in operation
23
+ * - Occupants have a metabolic rate between 1.0 and 1.5 met
24
+ * - Occupants are free to adapt their clothing within a range as wide as 0.5 and 1.0 clo
25
+ * - The prevailing mean (runnin mean) outdoor temperature is between 10 and 33.5 °C
26
+ *
27
+ * @see {@link adaptive_ashrae_array} for a version that supports array arguments
28
+ *
29
+ * @public
30
+ * @memberof models
31
+ * @docname Adaptive ASHRAE
32
+ *
33
+ * @param {number} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
34
+ * @param {number} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
35
+ * @param {number} t_running_mean - running mean temperature, default in [°C] in [°C] in [°F] if `units` = 'IP'
36
+ * The running mean temperature can be calculated using the function {@link #running_mean_outdoor_temperature|running_mean_outdoor_temperature}
37
+ * @param {number} v - air speed, default in [m/s] in [fps] if `units` = 'IP'
38
+ * @param {"SI" | "IP"} units - select the SI (International System of Units) or the IP (Imperial Units) system.
39
+ * @param {boolean} limit_inputs - By default, if the inputs are outsude the standard applicability limits the
40
+ * function returns nan. If False returns pmv and ppd values even if input values are
41
+ * outside the applicability limits of the model.
42
+ *
43
+ * @returns {AdaptiveAshraeResult} set containing results for the model
44
+ *
45
+ * The ASHRAE 55 2020 limits are 10 < tdb [°C] < 40, 10 < tr [°C] < 40,
46
+ * 0 < vr [m/s] < 2, 10 < t running mean [°C] < 33.5
47
+ *
48
+ * You can use this function to calculate if your conditions are within the `adaptive thermal comfort region`.
49
+ * Calculations with comply with the ASHRAE 55 2020 Standard {@link #ref_1|[1]}.
50
+ *
51
+ * @example
52
+ * import { adaptive_ashrae } from "jsthermalcomfort/models";
53
+ * const results = adaptive_ashrae(25, 25, 20, 0.1);
54
+ * console.log(results);
55
+ * // {tmp_cmf: 24.0, tmp_cmf_80_low: 20.5, tmp_cmf_80_up: 27.5,
56
+ * // tmp_cmf_90_low: 21.5, tmp_cmf_90_up: 26.5, acceptability_80: true,
57
+ * // acceptability_90: true}
58
+ * console.log(results.acceptability_80);
59
+ * // true
60
+ *
61
+ * @example
62
+ * import { adaptive_ashrae } from "jsthermalcomfort/models";
63
+ * // For users who want to use the IP system
64
+ * const results = adaptive_ashrae(77, 77, 68, 0.3, 'IP');
65
+ * console.log(results);
66
+ * // {tmp_cmf: 75.2, tmp_cmf_80_low: 68.9, tmp_cmf_80_up: 81.5,
67
+ * // tmp_cmf_90_low: 70.7, tmp_cmf_90_up: 79.7, acceptability_80: true,
68
+ * // acceptability_90: true}
69
+ *
70
+ * @example
71
+ * import { adaptive_ashrae } from "jsthermalcomfort/models";
72
+ * const results = adaptive_ashrae(25, 25, 9, 0.1);
73
+ * console.log(results);
74
+ * // {tmp_cmf: NaN, tmp_cmf_80_low: NaN, ...}
75
+ * // The adaptive thermal comfort model can only be used
76
+ * // if the running mean temperature is higher than 10°C
77
+ */
78
+ export function adaptive_ashrae(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
79
+ const standard = "ASHRAE";
80
+ if (units === "IP") {
81
+ ({
82
+ tdb,
83
+ tr,
84
+ tmp_running_mean: t_running_mean,
85
+ v,
86
+ } = units_converter({
87
+ tdb,
88
+ tr,
89
+ tmp_running_mean: t_running_mean,
90
+ v,
91
+ }));
92
+ }
93
+ const to = t_o(tdb, tr, v, standard);
94
+ // calculate cooling effect (ce) of elevated air speed when top > 25 degC.
95
+ const ce = get_ce(v, to);
96
+ // Relation between comfort and outdoor temperature
97
+ let t_cmf = 0.31 * t_running_mean + 17.8;
98
+ if (limit_inputs) {
99
+ const { tdb: tdb_valid, tr: tr_valid, v: v_valid, } = check_standard_compliance_array(standard, {
100
+ tdb: [tdb],
101
+ tr: [tr],
102
+ v: [v],
103
+ });
104
+ const trm_valid = t_running_mean >= 10.0 && t_running_mean <= 33.5 ? t_running_mean : NaN;
105
+ if (isNaN(tdb_valid[0]) ||
106
+ isNaN(tr_valid[0]) ||
107
+ isNaN(v_valid[0]) ||
108
+ isNaN(trm_valid))
109
+ t_cmf = NaN;
110
+ }
111
+ t_cmf = round(t_cmf, 1);
112
+ let tmp_cmf_80_low = t_cmf - 3.5;
113
+ let tmp_cmf_90_low = t_cmf - 2.5;
114
+ let tmp_cmf_80_up = t_cmf + 3.5 + ce;
115
+ let tmp_cmf_90_up = t_cmf + 2.5 + ce;
116
+ const acceptability_80 = tmp_cmf_80_low <= to && to <= tmp_cmf_80_up;
117
+ const acceptability_90 = tmp_cmf_90_low <= to && to <= tmp_cmf_90_up;
118
+ if (units === "IP") {
119
+ ({
120
+ tmp_cmf: t_cmf,
121
+ tmp_cmf_80_low,
122
+ tmp_cmf_80_up,
123
+ tmp_cmf_90_low,
124
+ tmp_cmf_90_up,
125
+ } = units_converter({
126
+ tmp_cmf: t_cmf,
127
+ tmp_cmf_80_low,
128
+ tmp_cmf_80_up,
129
+ tmp_cmf_90_low,
130
+ tmp_cmf_90_up,
131
+ }, "SI"));
132
+ }
133
+ return {
134
+ tmp_cmf: t_cmf,
135
+ tmp_cmf_80_low,
136
+ tmp_cmf_80_up,
137
+ tmp_cmf_90_low,
138
+ tmp_cmf_90_up,
139
+ acceptability_80,
140
+ acceptability_90,
141
+ };
142
+ }
143
+ /**
144
+ * @typedef {object} AdaptiveAshraeArrayResult
145
+ * @property {number[]} tmp_cmf - Comfort temperature a that specific running mean temperature, default in [°C] or in [°F]
146
+ * @property {number[]} tmp_cmf_80_low - Lower acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
147
+ * @property {number[]} tmp_cmf_80_up - Upper acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
148
+ * @property {number[]} tmp_cmf_90_low - Lower acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
149
+ * @property {number[]} tmp_cmf_90_up - Upper acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
150
+ * @property {boolean[]} acceptability_80 - Acceptability for 80% occupants
151
+ * @property {boolean[]} acceptability_90 - Acceptability for 90% occupants
152
+ * @public
153
+ */
154
+ /**
155
+ * Determines the adaptive thermal comfort based on ASHRAE 55. The adaptive
156
+ * model relates indoor design temperatures or acceptable temperature ranges
157
+ * to outdoor meteorological or climatological parameters. The adaptive model
158
+ * can only be used in occupant-controlled naturally conditioned spaces that
159
+ * meet all the following criteria:
160
+ *
161
+ * - There is no mechianical cooling or heating system in operation
162
+ * - Occupants have a metabolic rate between 1.0 and 1.5 met
163
+ * - Occupants are free to adapt their clothing within a range as wide as 0.5 and 1.0 clo
164
+ * - The prevailing mean (runnin mean) outdoor temperature is between 10 and 33.5 °C
165
+ *
166
+ * @see {@link adaptive_ashrae} for a version that supports scalar arguments
167
+ *
168
+ * @public
169
+ * @memberof models
170
+ * @docname Adaptive ASHRAE (array version)
171
+ *
172
+ * @param {number[]} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
173
+ * @param {number[]} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
174
+ * @param {number[]} t_running_mean - running mean temperature, default in [°C] in [°C] in [°F] if `units` = 'IP'
175
+ * The running mean temperature can be calculated using the function {@link #running_mean_outdoor_temperature|running_mean_outdoor_temperature}
176
+ * @param {number[]} v - air speed, default in [m/s] in [fps] if `units` = 'IP'
177
+ * @param {"SI" | "IP"} units - select the SI (International System of Units) or the IP (Imperial Units) system.
178
+ * @param {boolean} limit_inputs - By default, if the inputs are outsude the standard applicability limits the
179
+ * function returns nan. If False returns pmv and ppd values even if input values are
180
+ * outside the applicability limits of the model.
181
+ *
182
+ * @returns {AdaptiveAshraeArrayResult} set containing results for the model
183
+ *
184
+ * The ASHRAE 55 2020 limits are 10 < tdb [°C] < 40, 10 < tr [°C] < 40,
185
+ * 0 < vr [m/s] < 2, 10 < t running mean [°C] < 33.5
186
+ *
187
+ * You can use this function to calculate if your conditions are within the `adaptive thermal comfort region`.
188
+ * Calculations with comply with the ASHRAE 55 2020 Standard {@link #ref_1|[1]}.
189
+ *
190
+ * @example
191
+ * import { adaptive_ashrae_array } from "jsthermalcomfort/models";
192
+ * const results = adaptive_ashrae_array([25], [25], [20], [0.1]);
193
+ * console.log(results);
194
+ * // {tmp_cmf: [24.0], tmp_cmf_80_low: [20.5], tmp_cmf_80_up: [27.5],
195
+ * // tmp_cmf_90_low: [21.5], tmp_cmf_90_up: [26.5], acceptability_80: [true],
196
+ * // acceptability_90: [true]}
197
+ * console.log(results.acceptability_80);
198
+ * // [true]
199
+ *
200
+ * @example
201
+ * import { adaptive_ashrae_array } from "jsthermalcomfort/models";
202
+ * // For users who want to use the IP system
203
+ * const results = adaptive_ashrae_array([77], [77], [68], [0.3], 'IP');
204
+ * console.log(results);
205
+ * // {tmp_cmf: [75.2], tmp_cmf_80_low: [68.9], tmp_cmf_80_up: [81.5],
206
+ * // tmp_cmf_90_low: [70.7], tmp_cmf_90_up: [79.7], acceptability_80: [true],
207
+ * // acceptability_90: [true]}
208
+ *
209
+ * @example
210
+ * import { adaptive_ashrae_array } from "jsthermalcomfort/models";
211
+ * const results = adaptive_ashrae_array([25], [25], [9], [0.1]);
212
+ * console.log(results);
213
+ * // {tmp_cmf: [NaN], tmp_cmf_80_low: [NaN], ...}
214
+ * // The adaptive thermal comfort model can only be used
215
+ * // if the running mean temperature is higher than 10°C
216
+ */
217
+ export function adaptive_ashrae_array(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
218
+ const standard = "ASHRAE";
219
+ if (units === "IP") {
220
+ ({
221
+ tdb,
222
+ tr,
223
+ tmp_running_mean: t_running_mean,
224
+ v,
225
+ } = units_converter_array({
226
+ tdb,
227
+ tr,
228
+ tmp_running_mean: t_running_mean,
229
+ v,
230
+ }));
231
+ }
232
+ const to = t_o_array(tdb, tr, v, standard);
233
+ // calculate cooling effect (ce) of elevated air speed when top > 25 degC.
234
+ const ce = v.map((_v, index) => get_ce(_v, to[index]));
235
+ // Relation between comfort and outdoor temperature
236
+ let t_cmf = t_running_mean.map((_t) => 0.31 * _t + 17.8);
237
+ if (limit_inputs) {
238
+ const { tdb: tdb_valid, tr: tr_valid, v: v_valid, } = check_standard_compliance_array(standard, {
239
+ tdb,
240
+ tr,
241
+ v,
242
+ });
243
+ const trm_valid = valid_range(t_running_mean, [10.0, 33.5]);
244
+ for (let i = 0; i < t_cmf.length; ++i) {
245
+ if (isNaN(tdb_valid[i]) ||
246
+ isNaN(tr_valid[i]) ||
247
+ isNaN(v_valid[i]) ||
248
+ isNaN(trm_valid[i]))
249
+ t_cmf[i] = NaN;
250
+ }
251
+ }
252
+ for (let i = 0; i < t_cmf.length; ++i) {
253
+ t_cmf[i] = round(t_cmf[i], 1);
254
+ }
255
+ let tmp_cmf_80_low = t_cmf.map((_t) => _t - 3.5);
256
+ let tmp_cmf_90_low = t_cmf.map((_t) => _t - 2.5);
257
+ let tmp_cmf_80_up = t_cmf.map((_t, i) => _t + 3.5 + ce[i]);
258
+ let tmp_cmf_90_up = t_cmf.map((_t, i) => _t + 2.5 + ce[i]);
259
+ const acceptability_80 = tmp_cmf_80_low.map((_low, index) => _low <= to[index] && to[index] <= tmp_cmf_80_up[index]);
260
+ const acceptability_90 = tmp_cmf_90_low.map((_low, index) => _low <= to[index] && to[index] <= tmp_cmf_90_up[index]);
261
+ if (units === "IP") {
262
+ ({
263
+ tmp_cmf: t_cmf,
264
+ tmp_cmf_80_low,
265
+ tmp_cmf_80_up,
266
+ tmp_cmf_90_low,
267
+ tmp_cmf_90_up,
268
+ } = units_converter_array({
269
+ tmp_cmf: t_cmf,
270
+ tmp_cmf_80_low,
271
+ tmp_cmf_80_up,
272
+ tmp_cmf_90_low,
273
+ tmp_cmf_90_up,
274
+ }, "SI"));
275
+ }
276
+ return {
277
+ tmp_cmf: t_cmf,
278
+ tmp_cmf_80_low,
279
+ tmp_cmf_80_up,
280
+ tmp_cmf_90_low,
281
+ tmp_cmf_90_up,
282
+ acceptability_80,
283
+ acceptability_90,
284
+ };
285
+ }