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,199 @@
1
+ import { units_converter, check_standard_compliance_array, round, } from "../utilities/utilities.js";
2
+ import { two_nodes } from "../models/two_nodes.js";
3
+ /**
4
+ * @typedef {Object} HeatwaveReturnType
5
+ * @property {number} e_skin – Total rate of evaporative heat loss from skin, [W/m2]. Equal to e_rsw + e_diff
6
+ * @property {number} e_rsw – Rate of evaporative heat loss from sweat evaporation, [W/m2]
7
+ * @property {number} e_diff – Rate of evaporative heat loss from moisture diffused through the skin [W/m2]
8
+ * @property {number} e_max – Maximum rate of evaporative heat loss from skin, [W/m2]
9
+ * @property {number} q_sensible – Sensible heat loss from skin, [W/m2]
10
+ * @property {number} q_skin – Total rate of heat loss from skin, [W/m2]. Equal to q_sensible + e_skin
11
+ * @property {number} q_res – Total rate of heat loss through respiration, [W/m2]
12
+ * @property {number} t_core – Core temperature, [°C]
13
+ * @property {number} t_skin – Skin temperature, [°C]
14
+ * @property {number} m_bl – Skin blood flow, [kg/h/m2]
15
+ * @property {number} m_rsw – Rate at which regulatory sweat is generated, [kg/h/m2]
16
+ * @property {number} w – Skin wettedness, adimensional. Ranges from 0 and 1
17
+ * @property {number} w_max – Skin wettedness (w) practical upper limit, adimensional. Ranges from 0 and 1
18
+ * @property {boolean | undefined} heat_strain – True if the model predict that the person may be experiencing heat strain, undefined if the result of two nodes model is not a number
19
+ * @property {boolean | undefined} heat_strain_blood_flow – True if heat strain is caused by skin blood flow (m_bl) reaching its maximum value, undefined if the result of two nodes model is not a number
20
+ * @property {boolean | undefined} heat_strain_w – True if heat strain is caused by skin wettedness (w) reaching its maximum value, undefined if the result of two nodes model is not a number
21
+ * @property {boolean | undefined} heat_strain_sweating – True if heat strain is caused by regulatory sweating (m_rsw) reaching its maximum value, undefined if the result of two nodes model is not a number
22
+ * @public
23
+ */
24
+ /**
25
+ * @typedef {Object} HeatwaveKwargs - a keywords argument set containing the additional arguments for use fans heatwave
26
+ * @property {number} [max_sweating] - max sweating, [mL/h/m2] default 500
27
+ * @property {boolean} [round=true] - if True rounds output value, if False it does not round it, default True
28
+ * @property {boolean} [limit_inputs=true] – By default, if the inputs are outsude the following limits the function returns nan. If
29
+ * False returns values regardless of the input values, default True
30
+ *
31
+ * The applicability limits are 20 < tdb [°C] < 50, 20 < tr [°C] < 50, 0.1 < v [m/s] < 4.5, 0.7 < met [met] < 2, and 0 < clo [clo] < 1.
32
+ * @public
33
+ */
34
+ /**
35
+ * @typedef {Object} HeatwaveKwargsRequired
36
+ * @property {boolean} round
37
+ * @property {number} max_sweating
38
+ * @property {boolean} limit_inputs
39
+ */
40
+ /**
41
+ *
42
+ * It helps you to estimate if the conditions you have selected would cause heat strain.
43
+ * This occurs when either the following variables reaches its maximum value:
44
+ *
45
+ * - m_rsw Rate at which regulatory sweat is generated, [mL/h/m2].
46
+ * - w : Skin wettedness, adimensional. Ranges from 0 and 1.
47
+ * - m_bl : Skin blood flow [kg/h/m2].
48
+ *
49
+ * @public
50
+ * @memberof models
51
+ * @docname Use Fans During Heatwaves
52
+ *
53
+ * @param {number} tdb dry bulb air temperature, default in [°C] in [°F] if units = ‘IP’
54
+ * @param {number} tr mean radiant temperature, default in [°C] in [°F] if units = ‘IP’
55
+ * @param {number} v air speed, default in [m/s] in [fps] if units = ‘IP’
56
+ * @param {number} rh relative humidity, [%]
57
+ * @param {number} met metabolic rate, [met]
58
+ * @param {number} clo clothing insulation, [clo]
59
+ * @param {number} [wme=0] external work, [met] default 0
60
+ * @param {number} [body_surface_area] body surface area, default value 1.8258 [m2] in [ft2] if units = ‘IP’
61
+ *
62
+ * The body surface area can be calculated using the function pythermalcomfort.utilities.body_surface_area().
63
+ * @param {number} [p_atm] atmospheric pressure, default value 101325 [Pa] in [atm] if units = ‘IP’
64
+ * @param {"standing" | "sitting"} [body_position="standing"] select either “sitting” or “standing”
65
+ * @param {"SI" | "IP"} [units="SI"] select the SI (International System of Units) or the IP (Imperial Units) system.
66
+ * @param {number} [max_skin_blood_flow=80] maximum blood flow from the core to the skin
67
+ * @param {HeatwaveKwargs} [kwargs]
68
+ *
69
+ * @returns {HeatwaveReturnType} object with results of use fans during heatwave
70
+ *
71
+ * @example
72
+ * const results = use_fans_heatwaves(25, 25, 0.1, 50, 1.2, 0.5);
73
+ * console.log(results); //
74
+ * {
75
+ e_skin: 18.1,
76
+ e_rsw: 10.0,
77
+ e_max: 145.0,
78
+ q_sensible: 45.7,
79
+ q_skin: 63.8,
80
+ q_res: 5.2,
81
+ t_core: 36.9,
82
+ t_skin: 33.8,
83
+ m_bl: 13.6,
84
+ m_rsw: 14.6,
85
+ w: 0.1,
86
+ w_max: 0.7,
87
+ heat_strain_blood_flow: 0.0,
88
+ heat_strain_w: 0.0,
89
+ heat_strain_sweating: 0.0,
90
+ heat_strain: 0.0
91
+ }
92
+ *
93
+ */
94
+ export function use_fans_heatwaves(tdb, tr, v, rh, met, clo, wme = 0, body_surface_area, p_atm, body_position = "standing", units = "SI", max_skin_blood_flow = 80, kwargs = {}) {
95
+ const defaults_kwargs = {
96
+ round: true,
97
+ max_sweating: 500,
98
+ limit_inputs: true,
99
+ };
100
+ let joint_kwargs = Object.assign(defaults_kwargs, kwargs);
101
+ if (body_surface_area === undefined)
102
+ body_surface_area = units === "SI" ? 1.8258 : 19.65;
103
+ if (p_atm === undefined)
104
+ p_atm = units === "SI" ? 101325 : 1;
105
+ if (units === "IP") {
106
+ const unit_convert = units_converter({
107
+ tdb: tdb,
108
+ tr: tr,
109
+ v: v,
110
+ area: body_surface_area,
111
+ pressure: p_atm,
112
+ }, "IP");
113
+ tdb = unit_convert.tdb;
114
+ tr = unit_convert.tr;
115
+ v = unit_convert.v;
116
+ body_surface_area = unit_convert.area;
117
+ p_atm = unit_convert.pressure;
118
+ }
119
+ let output = two_nodes(tdb, tr, v, rh, met, clo, wme, body_surface_area, p_atm, body_position, max_skin_blood_flow, { round: false, max_sweating: joint_kwargs.max_sweating });
120
+ let heatwave_output = cal_heatwave(output, joint_kwargs, max_skin_blood_flow);
121
+ const key_to_remove = ["set", "et", "pmv_gagge", "pmv_set", "disc", "t_sens"];
122
+ const joint_output = {};
123
+ for (const key in output) {
124
+ if (!key_to_remove.includes(key)) {
125
+ joint_output[key] = output[key];
126
+ }
127
+ }
128
+ Object.assign(joint_output, heatwave_output);
129
+ if (joint_kwargs.limit_inputs) {
130
+ const { tdb: tdb_valid, tr: tr_valid, v: v_valid, met: met_valid, clo: clo_valid, } = check_standard_compliance_array("FAN_HEATWAVES", {
131
+ tdb: [tdb],
132
+ tr: [tr],
133
+ v: [v],
134
+ met: [met],
135
+ clo: [clo],
136
+ });
137
+ if (isNaN(tdb_valid[0]) ||
138
+ isNaN(tr_valid[0]) ||
139
+ isNaN(v_valid[0]) ||
140
+ isNaN(met_valid[0]) ||
141
+ isNaN(clo_valid[0])) {
142
+ for (let key in joint_output) {
143
+ if (key === "heat_strain" ||
144
+ key === "heat_strain_blood_flow" ||
145
+ key === "heat_strain_sweating" ||
146
+ key === "heat_strain_w") {
147
+ joint_output[key] = undefined;
148
+ }
149
+ else {
150
+ joint_output[key] = NaN;
151
+ }
152
+ }
153
+ }
154
+ }
155
+ if (joint_kwargs.round) {
156
+ return {
157
+ e_skin: round(joint_output.eSkin, 1),
158
+ e_rsw: round(joint_output.eRsw, 1),
159
+ e_max: round(joint_output.eMax, 1),
160
+ q_sensible: round(joint_output.qSensible, 1),
161
+ q_skin: round(joint_output.qSkin, 1),
162
+ q_res: round(joint_output.qRes, 1),
163
+ t_core: round(joint_output.tCore, 1),
164
+ t_skin: round(joint_output.tSkin, 1),
165
+ m_bl: round(joint_output.mBl, 1),
166
+ m_rsw: round(joint_output.mRsw, 1),
167
+ w: round(joint_output.w, 1),
168
+ w_max: round(joint_output.wMax, 1),
169
+ heat_strain_blood_flow: joint_output.heat_strain_blood_flow,
170
+ heat_strain_w: joint_output.heat_strain_w,
171
+ heat_strain_sweating: joint_output.heat_strain_sweating,
172
+ heat_strain: joint_output.heat_strain,
173
+ };
174
+ }
175
+ return joint_output;
176
+ }
177
+ /**
178
+ * Calculate heat strain conditions based on the result of two nodes model and max skin blood flow
179
+ *
180
+ * @param {object} two_nodes_result - the result of two nodes model
181
+ * @param {HeatwaveKwargs} joint_kwargs - heatwave kwargs
182
+ * @param {number} max_skin_blood_flow - maximum blood flow from the core to the skin, [kg/h/m2] default 80
183
+ * @returns {object} heat strain conditions
184
+ */
185
+ function cal_heatwave(two_nodes_result, joint_kwargs, max_skin_blood_flow) {
186
+ let heat_strain_blood_flow, heat_strain_w, heat_strain_sweating, heat_strain = false;
187
+ heat_strain_blood_flow = two_nodes_result.mBl === max_skin_blood_flow;
188
+ heat_strain_w = two_nodes_result.w === two_nodes_result.wMax;
189
+ heat_strain_sweating = two_nodes_result.mRsw === joint_kwargs.max_sweating;
190
+ if (heat_strain_blood_flow || heat_strain_w || heat_strain_sweating) {
191
+ heat_strain = true;
192
+ }
193
+ return {
194
+ heat_strain_blood_flow: heat_strain_blood_flow,
195
+ heat_strain_w: heat_strain_w,
196
+ heat_strain_sweating: heat_strain_sweating,
197
+ heat_strain: heat_strain,
198
+ };
199
+ }