jsthermalcomfort 1.3.1 → 2.0.0-next.1

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 (500) hide show
  1. package/README.md +83 -12
  2. package/lib/esm/_internal/adaptive_cooling_effect.js +14 -0
  3. package/lib/esm/_internal/ashrae55.js +121 -0
  4. package/lib/esm/_internal/brentq.js +216 -0
  5. package/lib/esm/_internal/classifierBins.js +67 -0
  6. package/lib/esm/_internal/define.js +215 -0
  7. package/lib/esm/_internal/errors.js +45 -0
  8. package/lib/esm/_internal/floatRepr.js +33 -0
  9. package/lib/esm/_internal/fsolve.js +879 -0
  10. package/lib/esm/_internal/modelInfo.js +107 -0
  11. package/lib/esm/_internal/pythonSum.js +104 -0
  12. package/lib/esm/_internal/round.js +58 -0
  13. package/lib/esm/_internal/validation.js +83 -0
  14. package/lib/esm/environment/f_svv.js +23 -0
  15. package/lib/esm/environment/index.js +21 -0
  16. package/lib/esm/{psychrometrics/t_mrt.js → environment/mean_radiant_tmp.js} +13 -8
  17. package/lib/esm/environment/operative_tmp.js +31 -0
  18. package/lib/esm/environment/running_mean_outdoor_temperature.js +64 -0
  19. package/lib/esm/environment/transpose_sharp_altitude.js +19 -0
  20. package/lib/esm/environment/v_relative.js +33 -0
  21. package/lib/esm/index.js +12 -1
  22. package/lib/esm/jos3_functions/bsa_rate.js +1 -1
  23. package/lib/esm/jos3_functions/conductance.js +2 -2
  24. package/lib/esm/models/JOS3.js +13 -2
  25. package/lib/esm/models/_pmv_ppd_optimized.js +57 -0
  26. package/lib/esm/models/adaptive_ashrae.js +133 -86
  27. package/lib/esm/models/adaptive_en.js +140 -108
  28. package/lib/esm/models/ankle_draft.js +145 -77
  29. package/lib/esm/models/at.js +52 -41
  30. package/lib/esm/models/clo_tout.js +59 -32
  31. package/lib/esm/models/cooling_effect.js +122 -154
  32. package/lib/esm/models/discomfort_index.js +76 -64
  33. package/lib/esm/models/esi.js +63 -0
  34. package/lib/esm/models/heat_index_lu.js +354 -0
  35. package/lib/esm/models/heat_index_rothfusz.js +85 -0
  36. package/lib/esm/models/heat_index_schoen.js +72 -0
  37. package/lib/esm/models/humidex.js +78 -51
  38. package/lib/esm/models/index.js +109 -39
  39. package/lib/esm/models/ireq.js +412 -0
  40. package/lib/esm/models/net.js +46 -32
  41. package/lib/esm/models/pet_steady.js +354 -445
  42. package/lib/esm/models/phs.js +598 -430
  43. package/lib/esm/models/pmv_a.js +139 -0
  44. package/lib/esm/models/pmv_athb.js +106 -0
  45. package/lib/esm/models/pmv_e.js +175 -0
  46. package/lib/esm/models/pmv_ppd_ashrae.js +219 -62
  47. package/lib/esm/models/pmv_ppd_iso.js +240 -65
  48. package/lib/esm/models/ridge_regression_predict_t_re_t_sk.js +373 -0
  49. package/lib/esm/models/set_tmp.js +108 -110
  50. package/lib/esm/models/solar_gain.js +228 -128
  51. package/lib/esm/models/sports_heat_stress_risk.js +452 -0
  52. package/lib/esm/models/thi.js +44 -0
  53. package/lib/esm/models/two_nodes_gagge.js +401 -0
  54. package/lib/esm/models/two_nodes_gagge_ji.js +338 -0
  55. package/lib/esm/models/two_nodes_gagge_sleep.js +519 -0
  56. package/lib/esm/models/use_fans_heatwaves.js +203 -0
  57. package/lib/esm/models/utci.js +334 -381
  58. package/lib/esm/models/vertical_tmp_grad_ppd.js +136 -90
  59. package/lib/esm/models/wbgt.js +62 -65
  60. package/lib/esm/models/wci.js +68 -0
  61. package/lib/esm/models/wind_chill_temperature.js +55 -0
  62. package/lib/esm/models/work_capacity_dunne.js +63 -0
  63. package/lib/esm/models/work_capacity_hothaps.js +82 -0
  64. package/lib/esm/models/work_capacity_iso.js +54 -0
  65. package/lib/esm/models/work_capacity_niosh.js +54 -0
  66. package/lib/esm/psychrometrics/dew_point_tmp.js +34 -0
  67. package/lib/esm/psychrometrics/enthalpy_air.js +20 -0
  68. package/lib/esm/psychrometrics/hr_to_rh.js +28 -0
  69. package/lib/esm/psychrometrics/index.js +19 -14
  70. package/lib/esm/psychrometrics/p_sat.js +24 -28
  71. package/lib/esm/psychrometrics/p_sat_torr.js +6 -6
  72. package/lib/esm/psychrometrics/psy_ta_rh.js +50 -30
  73. package/lib/esm/psychrometrics/rh_from_dew_point.js +28 -0
  74. package/lib/esm/psychrometrics/rh_from_vapour_pressure.js +25 -0
  75. package/lib/esm/psychrometrics/rh_from_wet_bulb.js +51 -0
  76. package/lib/esm/psychrometrics/wet_bulb_tmp.js +19 -0
  77. package/lib/esm/types/_internal/adaptive_cooling_effect.d.ts +12 -0
  78. package/lib/esm/types/_internal/adaptive_cooling_effect.d.ts.map +1 -0
  79. package/lib/esm/types/_internal/ashrae55.d.ts +92 -0
  80. package/lib/esm/types/_internal/ashrae55.d.ts.map +1 -0
  81. package/lib/esm/types/_internal/brentq.d.ts +27 -0
  82. package/lib/esm/types/_internal/brentq.d.ts.map +1 -0
  83. package/lib/esm/types/_internal/classifierBins.d.ts +66 -0
  84. package/lib/esm/types/_internal/classifierBins.d.ts.map +1 -0
  85. package/lib/esm/types/_internal/define.d.ts +108 -0
  86. package/lib/esm/types/_internal/define.d.ts.map +1 -0
  87. package/lib/esm/types/_internal/errors.d.ts +24 -0
  88. package/lib/esm/types/_internal/errors.d.ts.map +1 -0
  89. package/lib/esm/types/_internal/floatRepr.d.ts +20 -0
  90. package/lib/esm/types/_internal/floatRepr.d.ts.map +1 -0
  91. package/lib/esm/types/_internal/fsolve.d.ts +33 -0
  92. package/lib/esm/types/_internal/fsolve.d.ts.map +1 -0
  93. package/lib/esm/types/_internal/modelInfo.d.ts +434 -0
  94. package/lib/esm/types/_internal/modelInfo.d.ts.map +1 -0
  95. package/lib/esm/types/_internal/pythonSum.d.ts +14 -0
  96. package/lib/esm/types/_internal/pythonSum.d.ts.map +1 -0
  97. package/lib/esm/types/_internal/round.d.ts +36 -0
  98. package/lib/esm/types/_internal/round.d.ts.map +1 -0
  99. package/lib/esm/types/_internal/validation.d.ts +69 -0
  100. package/lib/esm/types/_internal/validation.d.ts.map +1 -0
  101. package/lib/esm/types/environment/f_svv.d.ts +15 -0
  102. package/lib/esm/types/environment/f_svv.d.ts.map +1 -0
  103. package/lib/esm/types/environment/index.d.ts +23 -0
  104. package/lib/esm/types/environment/index.d.ts.map +1 -0
  105. package/lib/{cjs/types/psychrometrics/t_mrt.d.ts → esm/types/environment/mean_radiant_tmp.d.ts} +3 -3
  106. package/lib/esm/types/environment/mean_radiant_tmp.d.ts.map +1 -0
  107. package/lib/esm/types/environment/operative_tmp.d.ts +12 -0
  108. package/lib/esm/types/environment/operative_tmp.d.ts.map +1 -0
  109. package/lib/esm/types/environment/running_mean_outdoor_temperature.d.ts +25 -0
  110. package/lib/esm/types/environment/running_mean_outdoor_temperature.d.ts.map +1 -0
  111. package/lib/esm/types/environment/transpose_sharp_altitude.d.ts +3 -0
  112. package/lib/esm/types/environment/transpose_sharp_altitude.d.ts.map +1 -0
  113. package/lib/esm/types/environment/v_relative.d.ts +16 -0
  114. package/lib/esm/types/environment/v_relative.d.ts.map +1 -0
  115. package/lib/esm/types/index.d.ts +2960 -11
  116. package/lib/esm/types/index.d.ts.map +1 -1
  117. package/lib/esm/types/models/JOS3.d.ts +1 -1
  118. package/lib/esm/types/models/JOS3.d.ts.map +1 -1
  119. package/lib/esm/types/models/_pmv_ppd_optimized.d.ts +2 -0
  120. package/lib/esm/types/models/_pmv_ppd_optimized.d.ts.map +1 -0
  121. package/lib/esm/types/models/adaptive_ashrae.d.ts +175 -39
  122. package/lib/esm/types/models/adaptive_ashrae.d.ts.map +1 -1
  123. package/lib/esm/types/models/adaptive_en.d.ts +167 -59
  124. package/lib/esm/types/models/adaptive_en.d.ts.map +1 -1
  125. package/lib/esm/types/models/ankle_draft.d.ts +151 -14
  126. package/lib/esm/types/models/ankle_draft.d.ts.map +1 -1
  127. package/lib/esm/types/models/at.d.ts +80 -11
  128. package/lib/esm/types/models/at.d.ts.map +1 -1
  129. package/lib/esm/types/models/clo_tout.d.ts +72 -9
  130. package/lib/esm/types/models/clo_tout.d.ts.map +1 -1
  131. package/lib/esm/types/models/cooling_effect.d.ts +120 -10
  132. package/lib/esm/types/models/cooling_effect.d.ts.map +1 -1
  133. package/lib/esm/types/models/discomfort_index.d.ts +81 -16
  134. package/lib/esm/types/models/discomfort_index.d.ts.map +1 -1
  135. package/lib/esm/types/models/esi.d.ts +68 -0
  136. package/lib/esm/types/models/esi.d.ts.map +1 -0
  137. package/lib/esm/types/models/heat_index_lu.d.ts +64 -0
  138. package/lib/esm/types/models/heat_index_lu.d.ts.map +1 -0
  139. package/lib/esm/types/models/heat_index_rothfusz.d.ts +87 -0
  140. package/lib/esm/types/models/heat_index_rothfusz.d.ts.map +1 -0
  141. package/lib/esm/types/models/heat_index_schoen.d.ts +71 -0
  142. package/lib/esm/types/models/heat_index_schoen.d.ts.map +1 -0
  143. package/lib/esm/types/models/humidex.d.ts +85 -20
  144. package/lib/esm/types/models/humidex.d.ts.map +1 -1
  145. package/lib/esm/types/models/index.d.ts +2955 -59
  146. package/lib/esm/types/models/index.d.ts.map +1 -1
  147. package/lib/esm/types/models/ireq.d.ts +195 -0
  148. package/lib/esm/types/models/ireq.d.ts.map +1 -0
  149. package/lib/esm/types/models/net.d.ts +83 -11
  150. package/lib/esm/types/models/net.d.ts.map +1 -1
  151. package/lib/esm/types/models/pet_steady.d.ts +141 -21
  152. package/lib/esm/types/models/pet_steady.d.ts.map +1 -1
  153. package/lib/esm/types/models/phs.d.ts +430 -173
  154. package/lib/esm/types/models/phs.d.ts.map +1 -1
  155. package/lib/esm/types/models/pmv_a.d.ts +171 -0
  156. package/lib/esm/types/models/pmv_a.d.ts.map +1 -0
  157. package/lib/esm/types/models/pmv_athb.d.ts +114 -0
  158. package/lib/esm/types/models/pmv_athb.d.ts.map +1 -0
  159. package/lib/esm/types/models/pmv_e.d.ts +189 -0
  160. package/lib/esm/types/models/pmv_e.d.ts.map +1 -0
  161. package/lib/esm/types/models/pmv_ppd_ashrae.d.ts +233 -14
  162. package/lib/esm/types/models/pmv_ppd_ashrae.d.ts.map +1 -1
  163. package/lib/esm/types/models/pmv_ppd_iso.d.ts +246 -14
  164. package/lib/esm/types/models/pmv_ppd_iso.d.ts.map +1 -1
  165. package/lib/esm/types/models/ridge_regression_predict_t_re_t_sk.d.ts +219 -0
  166. package/lib/esm/types/models/ridge_regression_predict_t_re_t_sk.d.ts.map +1 -0
  167. package/lib/esm/types/models/set_tmp.d.ts +147 -24
  168. package/lib/esm/types/models/set_tmp.d.ts.map +1 -1
  169. package/lib/esm/types/models/solar_gain.d.ts +174 -19
  170. package/lib/esm/types/models/solar_gain.d.ts.map +1 -1
  171. package/lib/esm/types/models/sports_heat_stress_risk.d.ts +244 -0
  172. package/lib/esm/types/models/sports_heat_stress_risk.d.ts.map +1 -0
  173. package/lib/esm/types/models/thi.d.ts +53 -0
  174. package/lib/esm/types/models/thi.d.ts.map +1 -0
  175. package/lib/esm/types/models/two_nodes_gagge.d.ts +281 -0
  176. package/lib/esm/types/models/two_nodes_gagge.d.ts.map +1 -0
  177. package/lib/esm/types/models/two_nodes_gagge_ji.d.ts +163 -0
  178. package/lib/esm/types/models/two_nodes_gagge_ji.d.ts.map +1 -0
  179. package/lib/esm/types/models/two_nodes_gagge_sleep.d.ts +277 -0
  180. package/lib/esm/types/models/two_nodes_gagge_sleep.d.ts.map +1 -0
  181. package/lib/esm/types/models/use_fans_heatwaves.d.ts +262 -0
  182. package/lib/esm/types/models/use_fans_heatwaves.d.ts.map +1 -0
  183. package/lib/esm/types/models/utci.d.ts +151 -11
  184. package/lib/esm/types/models/utci.d.ts.map +1 -1
  185. package/lib/esm/types/models/vertical_tmp_grad_ppd.d.ts +151 -16
  186. package/lib/esm/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -1
  187. package/lib/esm/types/models/wbgt.d.ts +90 -9
  188. package/lib/esm/types/models/wbgt.d.ts.map +1 -1
  189. package/lib/esm/types/models/wci.d.ts +78 -0
  190. package/lib/esm/types/models/wci.d.ts.map +1 -0
  191. package/lib/esm/types/models/wind_chill_temperature.d.ts +67 -0
  192. package/lib/esm/types/models/wind_chill_temperature.d.ts.map +1 -0
  193. package/lib/esm/types/models/work_capacity_dunne.d.ts +66 -0
  194. package/lib/esm/types/models/work_capacity_dunne.d.ts.map +1 -0
  195. package/lib/esm/types/models/work_capacity_hothaps.d.ts +79 -0
  196. package/lib/esm/types/models/work_capacity_hothaps.d.ts.map +1 -0
  197. package/lib/esm/types/models/work_capacity_iso.d.ts +57 -0
  198. package/lib/esm/types/models/work_capacity_iso.d.ts.map +1 -0
  199. package/lib/esm/types/models/work_capacity_niosh.d.ts +55 -0
  200. package/lib/esm/types/models/work_capacity_niosh.d.ts.map +1 -0
  201. package/lib/esm/types/psychrometrics/dew_point_tmp.d.ts +23 -0
  202. package/lib/esm/types/psychrometrics/dew_point_tmp.d.ts.map +1 -0
  203. package/lib/esm/types/psychrometrics/enthalpy_air.d.ts +9 -0
  204. package/lib/esm/types/psychrometrics/enthalpy_air.d.ts.map +1 -0
  205. package/lib/esm/types/psychrometrics/hr_to_rh.d.ts +20 -0
  206. package/lib/esm/types/psychrometrics/hr_to_rh.d.ts.map +1 -0
  207. package/lib/esm/types/psychrometrics/index.d.ts +30 -19
  208. package/lib/esm/types/psychrometrics/index.d.ts.map +1 -1
  209. package/lib/esm/types/psychrometrics/p_sat.d.ts +4 -9
  210. package/lib/esm/types/psychrometrics/p_sat.d.ts.map +1 -1
  211. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts +4 -7
  212. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts.map +1 -1
  213. package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts +41 -43
  214. package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts.map +1 -1
  215. package/lib/esm/types/psychrometrics/rh_from_dew_point.d.ts +18 -0
  216. package/lib/esm/types/psychrometrics/rh_from_dew_point.d.ts.map +1 -0
  217. package/lib/esm/types/psychrometrics/rh_from_vapour_pressure.d.ts +18 -0
  218. package/lib/esm/types/psychrometrics/rh_from_vapour_pressure.d.ts.map +1 -0
  219. package/lib/esm/types/psychrometrics/rh_from_wet_bulb.d.ts +23 -0
  220. package/lib/esm/types/psychrometrics/rh_from_wet_bulb.d.ts.map +1 -0
  221. package/lib/esm/types/psychrometrics/wet_bulb_tmp.d.ts +9 -0
  222. package/lib/esm/types/psychrometrics/wet_bulb_tmp.d.ts.map +1 -0
  223. package/lib/esm/types/utilities/body_surface_area.d.ts +22 -0
  224. package/lib/esm/types/utilities/body_surface_area.d.ts.map +1 -0
  225. package/lib/esm/types/utilities/clothing.d.ts +163 -0
  226. package/lib/esm/types/utilities/clothing.d.ts.map +1 -0
  227. package/lib/esm/types/utilities/index.d.ts +72 -21
  228. package/lib/esm/types/utilities/index.d.ts.map +1 -1
  229. package/lib/esm/types/utilities/met_to_w_m2.d.ts +3 -0
  230. package/lib/esm/types/utilities/met_to_w_m2.d.ts.map +1 -0
  231. package/lib/esm/types/utilities/options.d.ts +68 -0
  232. package/lib/esm/types/utilities/options.d.ts.map +1 -0
  233. package/lib/esm/types/utilities/units_converter.d.ts +13 -0
  234. package/lib/esm/types/utilities/units_converter.d.ts.map +1 -0
  235. package/lib/esm/types/utilities/utilities.d.ts +76 -280
  236. package/lib/esm/types/utilities/utilities.d.ts.map +1 -1
  237. package/lib/esm/utilities/body_surface_area.js +45 -0
  238. package/lib/esm/utilities/clothing.js +258 -0
  239. package/lib/esm/utilities/index.js +22 -14
  240. package/lib/esm/utilities/met_to_w_m2.js +2 -0
  241. package/lib/esm/utilities/options.js +67 -0
  242. package/lib/esm/utilities/units_converter.js +64 -0
  243. package/lib/esm/utilities/utilities.js +243 -780
  244. package/package.json +41 -27
  245. package/lib/cjs/index.js +0 -26
  246. package/lib/cjs/jos3_functions/JOS3Defaults.js +0 -34
  247. package/lib/cjs/jos3_functions/bfb_rate.js +0 -75
  248. package/lib/cjs/jos3_functions/bsa_rate.js +0 -27
  249. package/lib/cjs/jos3_functions/capacity.js +0 -102
  250. package/lib/cjs/jos3_functions/conductance.js +0 -180
  251. package/lib/cjs/jos3_functions/local_bsa.js +0 -64
  252. package/lib/cjs/jos3_functions/matrix.js +0 -351
  253. package/lib/cjs/jos3_functions/thermoregulation/ava_blood_flow.js +0 -84
  254. package/lib/cjs/jos3_functions/thermoregulation/basal_met.js +0 -54
  255. package/lib/cjs/jos3_functions/thermoregulation/clo_area_factor.js +0 -13
  256. package/lib/cjs/jos3_functions/thermoregulation/conv_coef.js +0 -136
  257. package/lib/cjs/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.js +0 -95
  258. package/lib/cjs/jos3_functions/thermoregulation/dry_r.js +0 -56
  259. package/lib/cjs/jos3_functions/thermoregulation/error_signals.js +0 -64
  260. package/lib/cjs/jos3_functions/thermoregulation/evaporation.js +0 -104
  261. package/lib/cjs/jos3_functions/thermoregulation/fixed_hc.js +0 -51
  262. package/lib/cjs/jos3_functions/thermoregulation/fixed_hr.js +0 -52
  263. package/lib/cjs/jos3_functions/thermoregulation/local_mbase.js +0 -79
  264. package/lib/cjs/jos3_functions/thermoregulation/local_q_work.js +0 -57
  265. package/lib/cjs/jos3_functions/thermoregulation/nonshivering.js +0 -104
  266. package/lib/cjs/jos3_functions/thermoregulation/operative_temp.js +0 -51
  267. package/lib/cjs/jos3_functions/thermoregulation/rad_coef.js +0 -83
  268. package/lib/cjs/jos3_functions/thermoregulation/resp_heat_loss.js +0 -23
  269. package/lib/cjs/jos3_functions/thermoregulation/shivering.js +0 -143
  270. package/lib/cjs/jos3_functions/thermoregulation/skin_blood_flow.js +0 -84
  271. package/lib/cjs/jos3_functions/thermoregulation/sum_bf.js +0 -59
  272. package/lib/cjs/jos3_functions/thermoregulation/sum_m.js +0 -75
  273. package/lib/cjs/jos3_functions/thermoregulation/wet_r.js +0 -62
  274. package/lib/cjs/jos3_functions/validate_body_parameters.js +0 -31
  275. package/lib/cjs/jos3_functions/weight_rate.js +0 -30
  276. package/lib/cjs/models/JOS3.js +0 -962
  277. package/lib/cjs/models/a_pmv.js +0 -107
  278. package/lib/cjs/models/adaptive_ashrae.js +0 -146
  279. package/lib/cjs/models/adaptive_en.js +0 -160
  280. package/lib/cjs/models/ankle_draft.js +0 -92
  281. package/lib/cjs/models/at.js +0 -64
  282. package/lib/cjs/models/athb.js +0 -83
  283. package/lib/cjs/models/clo_tout.js +0 -43
  284. package/lib/cjs/models/cooling_effect.js +0 -180
  285. package/lib/cjs/models/discomfort_index.js +0 -80
  286. package/lib/cjs/models/e_pmv.js +0 -112
  287. package/lib/cjs/models/heat_index.js +0 -94
  288. package/lib/cjs/models/humidex.js +0 -76
  289. package/lib/cjs/models/index.js +0 -88
  290. package/lib/cjs/models/net.js +0 -61
  291. package/lib/cjs/models/pet_steady.js +0 -482
  292. package/lib/cjs/models/phs.js +0 -597
  293. package/lib/cjs/models/pmv.js +0 -142
  294. package/lib/cjs/models/pmv_ppd.js +0 -263
  295. package/lib/cjs/models/pmv_ppd_ashrae.js +0 -79
  296. package/lib/cjs/models/pmv_ppd_iso.js +0 -78
  297. package/lib/cjs/models/set_tmp.js +0 -130
  298. package/lib/cjs/models/solar_gain.js +0 -181
  299. package/lib/cjs/models/two_nodes.js +0 -603
  300. package/lib/cjs/models/use_fans_heatwave.js +0 -233
  301. package/lib/cjs/models/utci.js +0 -533
  302. package/lib/cjs/models/vertical_tmp_grad_ppd.js +0 -106
  303. package/lib/cjs/models/wbgt.js +0 -90
  304. package/lib/cjs/models/wc.js +0 -42
  305. package/lib/cjs/psychrometrics/enthalpy.js +0 -23
  306. package/lib/cjs/psychrometrics/index.js +0 -29
  307. package/lib/cjs/psychrometrics/p_sat.js +0 -45
  308. package/lib/cjs/psychrometrics/p_sat_torr.js +0 -15
  309. package/lib/cjs/psychrometrics/psy_ta_rh.js +0 -50
  310. package/lib/cjs/psychrometrics/t_dp.js +0 -18
  311. package/lib/cjs/psychrometrics/t_mrt.js +0 -76
  312. package/lib/cjs/psychrometrics/t_o.js +0 -55
  313. package/lib/cjs/psychrometrics/t_wb.js +0 -22
  314. package/lib/cjs/supa.js +0 -73
  315. package/lib/cjs/types/index.d.ts +0 -13
  316. package/lib/cjs/types/index.d.ts.map +0 -1
  317. package/lib/cjs/types/jos3_functions/JOS3Defaults.d.ts +0 -27
  318. package/lib/cjs/types/jos3_functions/JOS3Defaults.d.ts.map +0 -1
  319. package/lib/cjs/types/jos3_functions/bfb_rate.d.ts +0 -13
  320. package/lib/cjs/types/jos3_functions/bfb_rate.d.ts.map +0 -1
  321. package/lib/cjs/types/jos3_functions/bsa_rate.d.ts +0 -15
  322. package/lib/cjs/types/jos3_functions/bsa_rate.d.ts.map +0 -1
  323. package/lib/cjs/types/jos3_functions/capacity.d.ts +0 -19
  324. package/lib/cjs/types/jos3_functions/capacity.d.ts.map +0 -1
  325. package/lib/cjs/types/jos3_functions/conductance.d.ts +0 -13
  326. package/lib/cjs/types/jos3_functions/conductance.d.ts.map +0 -1
  327. package/lib/cjs/types/jos3_functions/local_bsa.d.ts +0 -19
  328. package/lib/cjs/types/jos3_functions/local_bsa.d.ts.map +0 -1
  329. package/lib/cjs/types/jos3_functions/matrix.d.ts +0 -63
  330. package/lib/cjs/types/jos3_functions/matrix.d.ts.map +0 -1
  331. package/lib/cjs/types/jos3_functions/thermoregulation/ava_blood_flow.d.ts +0 -33
  332. package/lib/cjs/types/jos3_functions/thermoregulation/ava_blood_flow.d.ts.map +0 -1
  333. package/lib/cjs/types/jos3_functions/thermoregulation/basal_met.d.ts +0 -13
  334. package/lib/cjs/types/jos3_functions/thermoregulation/basal_met.d.ts.map +0 -1
  335. package/lib/cjs/types/jos3_functions/thermoregulation/clo_area_factor.d.ts +0 -9
  336. package/lib/cjs/types/jos3_functions/thermoregulation/clo_area_factor.d.ts.map +0 -1
  337. package/lib/cjs/types/jos3_functions/thermoregulation/conv_coef.d.ts +0 -16
  338. package/lib/cjs/types/jos3_functions/thermoregulation/conv_coef.d.ts.map +0 -1
  339. package/lib/cjs/types/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.d.ts +0 -37
  340. package/lib/cjs/types/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.d.ts.map +0 -1
  341. package/lib/cjs/types/jos3_functions/thermoregulation/dry_r.d.ts +0 -12
  342. package/lib/cjs/types/jos3_functions/thermoregulation/dry_r.d.ts.map +0 -1
  343. package/lib/cjs/types/jos3_functions/thermoregulation/error_signals.d.ts +0 -27
  344. package/lib/cjs/types/jos3_functions/thermoregulation/error_signals.d.ts.map +0 -1
  345. package/lib/cjs/types/jos3_functions/thermoregulation/evaporation.d.ts +0 -46
  346. package/lib/cjs/types/jos3_functions/thermoregulation/evaporation.d.ts.map +0 -1
  347. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hc.d.ts +0 -5
  348. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hc.d.ts.map +0 -1
  349. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hr.d.ts +0 -9
  350. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hr.d.ts.map +0 -1
  351. package/lib/cjs/types/jos3_functions/thermoregulation/local_mbase.d.ts +0 -14
  352. package/lib/cjs/types/jos3_functions/thermoregulation/local_mbase.d.ts.map +0 -1
  353. package/lib/cjs/types/jos3_functions/thermoregulation/local_q_work.d.ts +0 -12
  354. package/lib/cjs/types/jos3_functions/thermoregulation/local_q_work.d.ts.map +0 -1
  355. package/lib/cjs/types/jos3_functions/thermoregulation/nonshivering.d.ts +0 -16
  356. package/lib/cjs/types/jos3_functions/thermoregulation/nonshivering.d.ts.map +0 -1
  357. package/lib/cjs/types/jos3_functions/thermoregulation/operative_temp.d.ts +0 -13
  358. package/lib/cjs/types/jos3_functions/thermoregulation/operative_temp.d.ts.map +0 -1
  359. package/lib/cjs/types/jos3_functions/thermoregulation/rad_coef.d.ts +0 -10
  360. package/lib/cjs/types/jos3_functions/thermoregulation/rad_coef.d.ts.map +0 -1
  361. package/lib/cjs/types/jos3_functions/thermoregulation/resp_heat_loss.d.ts +0 -27
  362. package/lib/cjs/types/jos3_functions/thermoregulation/resp_heat_loss.d.ts.map +0 -1
  363. package/lib/cjs/types/jos3_functions/thermoregulation/shivering.d.ts +0 -27
  364. package/lib/cjs/types/jos3_functions/thermoregulation/shivering.d.ts.map +0 -1
  365. package/lib/cjs/types/jos3_functions/thermoregulation/skin_blood_flow.d.ts +0 -15
  366. package/lib/cjs/types/jos3_functions/thermoregulation/skin_blood_flow.d.ts.map +0 -1
  367. package/lib/cjs/types/jos3_functions/thermoregulation/sum_bf.d.ts +0 -15
  368. package/lib/cjs/types/jos3_functions/thermoregulation/sum_bf.d.ts.map +0 -1
  369. package/lib/cjs/types/jos3_functions/thermoregulation/sum_m.d.ts +0 -39
  370. package/lib/cjs/types/jos3_functions/thermoregulation/sum_m.d.ts.map +0 -1
  371. package/lib/cjs/types/jos3_functions/thermoregulation/wet_r.d.ts +0 -13
  372. package/lib/cjs/types/jos3_functions/thermoregulation/wet_r.d.ts.map +0 -1
  373. package/lib/cjs/types/jos3_functions/validate_body_parameters.d.ts +0 -12
  374. package/lib/cjs/types/jos3_functions/validate_body_parameters.d.ts.map +0 -1
  375. package/lib/cjs/types/jos3_functions/weight_rate.d.ts +0 -20
  376. package/lib/cjs/types/jos3_functions/weight_rate.d.ts.map +0 -1
  377. package/lib/cjs/types/models/JOS3.d.ts +0 -385
  378. package/lib/cjs/types/models/JOS3.d.ts.map +0 -1
  379. package/lib/cjs/types/models/a_pmv.d.ts +0 -25
  380. package/lib/cjs/types/models/a_pmv.d.ts.map +0 -1
  381. package/lib/cjs/types/models/adaptive_ashrae.d.ts +0 -40
  382. package/lib/cjs/types/models/adaptive_ashrae.d.ts.map +0 -1
  383. package/lib/cjs/types/models/adaptive_en.d.ts +0 -65
  384. package/lib/cjs/types/models/adaptive_en.d.ts.map +0 -1
  385. package/lib/cjs/types/models/ankle_draft.d.ts +0 -15
  386. package/lib/cjs/types/models/ankle_draft.d.ts.map +0 -1
  387. package/lib/cjs/types/models/at.d.ts +0 -12
  388. package/lib/cjs/types/models/at.d.ts.map +0 -1
  389. package/lib/cjs/types/models/athb.d.ts +0 -10
  390. package/lib/cjs/types/models/athb.d.ts.map +0 -1
  391. package/lib/cjs/types/models/clo_tout.d.ts +0 -10
  392. package/lib/cjs/types/models/clo_tout.d.ts.map +0 -1
  393. package/lib/cjs/types/models/cooling_effect.d.ts +0 -11
  394. package/lib/cjs/types/models/cooling_effect.d.ts.map +0 -1
  395. package/lib/cjs/types/models/discomfort_index.d.ts +0 -19
  396. package/lib/cjs/types/models/discomfort_index.d.ts.map +0 -1
  397. package/lib/cjs/types/models/e_pmv.d.ts +0 -25
  398. package/lib/cjs/types/models/e_pmv.d.ts.map +0 -1
  399. package/lib/cjs/types/models/heat_index.d.ts +0 -13
  400. package/lib/cjs/types/models/heat_index.d.ts.map +0 -1
  401. package/lib/cjs/types/models/humidex.d.ts +0 -23
  402. package/lib/cjs/types/models/humidex.d.ts.map +0 -1
  403. package/lib/cjs/types/models/index.d.ts +0 -61
  404. package/lib/cjs/types/models/index.d.ts.map +0 -1
  405. package/lib/cjs/types/models/net.d.ts +0 -12
  406. package/lib/cjs/types/models/net.d.ts.map +0 -1
  407. package/lib/cjs/types/models/pet_steady.d.ts +0 -22
  408. package/lib/cjs/types/models/pet_steady.d.ts.map +0 -1
  409. package/lib/cjs/types/models/phs.d.ts +0 -174
  410. package/lib/cjs/types/models/phs.d.ts.map +0 -1
  411. package/lib/cjs/types/models/pmv.d.ts +0 -35
  412. package/lib/cjs/types/models/pmv.d.ts.map +0 -1
  413. package/lib/cjs/types/models/pmv_ppd.d.ts +0 -58
  414. package/lib/cjs/types/models/pmv_ppd.d.ts.map +0 -1
  415. package/lib/cjs/types/models/pmv_ppd_ashrae.d.ts +0 -15
  416. package/lib/cjs/types/models/pmv_ppd_ashrae.d.ts.map +0 -1
  417. package/lib/cjs/types/models/pmv_ppd_iso.d.ts +0 -15
  418. package/lib/cjs/types/models/pmv_ppd_iso.d.ts.map +0 -1
  419. package/lib/cjs/types/models/set_tmp.d.ts +0 -27
  420. package/lib/cjs/types/models/set_tmp.d.ts.map +0 -1
  421. package/lib/cjs/types/models/solar_gain.d.ts +0 -24
  422. package/lib/cjs/types/models/solar_gain.d.ts.map +0 -1
  423. package/lib/cjs/types/models/two_nodes.d.ts +0 -168
  424. package/lib/cjs/types/models/two_nodes.d.ts.map +0 -1
  425. package/lib/cjs/types/models/use_fans_heatwave.d.ts +0 -97
  426. package/lib/cjs/types/models/use_fans_heatwave.d.ts.map +0 -1
  427. package/lib/cjs/types/models/utci.d.ts +0 -14
  428. package/lib/cjs/types/models/utci.d.ts.map +0 -1
  429. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts +0 -19
  430. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts.map +0 -1
  431. package/lib/cjs/types/models/wbgt.d.ts +0 -10
  432. package/lib/cjs/types/models/wbgt.d.ts.map +0 -1
  433. package/lib/cjs/types/models/wc.d.ts +0 -6
  434. package/lib/cjs/types/models/wc.d.ts.map +0 -1
  435. package/lib/cjs/types/psychrometrics/enthalpy.d.ts +0 -12
  436. package/lib/cjs/types/psychrometrics/enthalpy.d.ts.map +0 -1
  437. package/lib/cjs/types/psychrometrics/index.d.ts +0 -21
  438. package/lib/cjs/types/psychrometrics/index.d.ts.map +0 -1
  439. package/lib/cjs/types/psychrometrics/p_sat.d.ts +0 -13
  440. package/lib/cjs/types/psychrometrics/p_sat.d.ts.map +0 -1
  441. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts +0 -11
  442. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts.map +0 -1
  443. package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts +0 -51
  444. package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts.map +0 -1
  445. package/lib/cjs/types/psychrometrics/t_dp.d.ts +0 -9
  446. package/lib/cjs/types/psychrometrics/t_dp.d.ts.map +0 -1
  447. package/lib/cjs/types/psychrometrics/t_mrt.d.ts.map +0 -1
  448. package/lib/cjs/types/psychrometrics/t_o.d.ts +0 -15
  449. package/lib/cjs/types/psychrometrics/t_o.d.ts.map +0 -1
  450. package/lib/cjs/types/psychrometrics/t_wb.d.ts +0 -12
  451. package/lib/cjs/types/psychrometrics/t_wb.d.ts.map +0 -1
  452. package/lib/cjs/types/supa.d.ts +0 -25
  453. package/lib/cjs/types/supa.d.ts.map +0 -1
  454. package/lib/cjs/types/utilities/index.d.ts +0 -23
  455. package/lib/cjs/types/utilities/index.d.ts.map +0 -1
  456. package/lib/cjs/types/utilities/utilities.d.ts +0 -302
  457. package/lib/cjs/types/utilities/utilities.d.ts.map +0 -1
  458. package/lib/cjs/utilities/index.js +0 -29
  459. package/lib/cjs/utilities/utilities.js +0 -835
  460. package/lib/esm/models/a_pmv.js +0 -103
  461. package/lib/esm/models/athb.js +0 -80
  462. package/lib/esm/models/e_pmv.js +0 -108
  463. package/lib/esm/models/heat_index.js +0 -90
  464. package/lib/esm/models/pmv.js +0 -138
  465. package/lib/esm/models/pmv_ppd.js +0 -258
  466. package/lib/esm/models/two_nodes.js +0 -599
  467. package/lib/esm/models/use_fans_heatwave.js +0 -230
  468. package/lib/esm/models/wc.js +0 -39
  469. package/lib/esm/psychrometrics/enthalpy.js +0 -20
  470. package/lib/esm/psychrometrics/t_dp.js +0 -15
  471. package/lib/esm/psychrometrics/t_o.js +0 -52
  472. package/lib/esm/psychrometrics/t_wb.js +0 -19
  473. package/lib/esm/types/models/a_pmv.d.ts +0 -25
  474. package/lib/esm/types/models/a_pmv.d.ts.map +0 -1
  475. package/lib/esm/types/models/athb.d.ts +0 -10
  476. package/lib/esm/types/models/athb.d.ts.map +0 -1
  477. package/lib/esm/types/models/e_pmv.d.ts +0 -25
  478. package/lib/esm/types/models/e_pmv.d.ts.map +0 -1
  479. package/lib/esm/types/models/heat_index.d.ts +0 -13
  480. package/lib/esm/types/models/heat_index.d.ts.map +0 -1
  481. package/lib/esm/types/models/pmv.d.ts +0 -35
  482. package/lib/esm/types/models/pmv.d.ts.map +0 -1
  483. package/lib/esm/types/models/pmv_ppd.d.ts +0 -58
  484. package/lib/esm/types/models/pmv_ppd.d.ts.map +0 -1
  485. package/lib/esm/types/models/two_nodes.d.ts +0 -168
  486. package/lib/esm/types/models/two_nodes.d.ts.map +0 -1
  487. package/lib/esm/types/models/use_fans_heatwave.d.ts +0 -97
  488. package/lib/esm/types/models/use_fans_heatwave.d.ts.map +0 -1
  489. package/lib/esm/types/models/wc.d.ts +0 -6
  490. package/lib/esm/types/models/wc.d.ts.map +0 -1
  491. package/lib/esm/types/psychrometrics/enthalpy.d.ts +0 -12
  492. package/lib/esm/types/psychrometrics/enthalpy.d.ts.map +0 -1
  493. package/lib/esm/types/psychrometrics/t_dp.d.ts +0 -9
  494. package/lib/esm/types/psychrometrics/t_dp.d.ts.map +0 -1
  495. package/lib/esm/types/psychrometrics/t_mrt.d.ts +0 -23
  496. package/lib/esm/types/psychrometrics/t_mrt.d.ts.map +0 -1
  497. package/lib/esm/types/psychrometrics/t_o.d.ts +0 -15
  498. package/lib/esm/types/psychrometrics/t_o.d.ts.map +0 -1
  499. package/lib/esm/types/psychrometrics/t_wb.d.ts +0 -12
  500. package/lib/esm/types/psychrometrics/t_wb.d.ts.map +0 -1
package/README.md CHANGED
@@ -59,20 +59,12 @@ You can also import it in the website directly, and caution that you need to mar
59
59
  </script>
60
60
  ```
61
61
 
62
- # Examples and Tutorials
63
-
64
- We developed a few [examples](https://github.com/FedericoTartarini/jsthermalcomfort/tree/main/docs/examples) files on how to use some of the functions.
65
-
66
- Here is a list of examples running in the browser:
67
-
68
- - [PHS](/docs/examples/phs.html)
69
-
70
62
  # Contributing
71
63
 
72
64
  Contributions are welcome.
73
65
 
74
- - Contributor guide: [`docs_theme/contributing.md`](docs_theme/contributing.md)
75
- - Online docs version: [Contributing](https://federicotartarini.github.io/jsthermalcomfort/contributing.html)
66
+ - Contributor guide: [`docs/contributing.md`](docs/contributing.md)
67
+ - Online docs version: [Contributing](https://federicotartarini.github.io/jsthermalcomfort/documents/contributing.html)
76
68
  - Bug reports and feature requests: [GitHub Issues](https://github.com/FedericoTartarini/jsthermalcomfort/issues)
77
69
 
78
70
  ## Local development (quick start)
@@ -84,10 +76,89 @@ npm run check:format
84
76
  npm run build
85
77
  ```
86
78
 
79
+ ## Releasing
80
+
81
+ Releases are triggered by **pushing a git tag**. Merging publishes nothing —
82
+ nothing reaches npm until someone tags deliberately.
83
+
84
+ ### Tags, not branches
85
+
86
+ The publish workflow fires on any `v*` tag and has no branch filter. A git tag
87
+ points at a _commit_, not a branch, so a release can be cut from any branch:
88
+
89
+ ```
90
+ main ──●──●──● ← v1.4.0 tagged here
91
+ \
92
+ development ●──●──●──● ← v2.0.0-next.1 tagged here
93
+ ```
94
+
95
+ Both publish through the same workflow. What differs is the dist-tag, and that
96
+ is derived from the version rather than chosen by whoever runs the release.
97
+
98
+ ### Cutting a release
99
+
100
+ ```bash
101
+ # 1. set the version in package.json — it must match the tag exactly,
102
+ # the workflow fails the build otherwise
103
+ npm version 2.0.0 --no-git-tag-version
104
+
105
+ # 2. commit and push the version bump
106
+ git commit -am "2.0.0" && git push
107
+
108
+ # 3. tag and push the tag — this is the step that publishes
109
+ git tag v2.0.0 && git push origin v2.0.0
110
+ ```
111
+
112
+ ### Prereleases
113
+
114
+ A version containing a hyphen is a semver prerelease and is published under the
115
+ **`next`** dist-tag instead of `latest`:
116
+
117
+ ```bash
118
+ npm version 2.0.0-next.1 --no-git-tag-version
119
+ git commit -am "2.0.0-next.1" && git push
120
+ git tag v2.0.0-next.1 && git push origin v2.0.0-next.1
121
+ ```
122
+
123
+ Consumers opt in explicitly, and nobody on `^1.x` is affected:
124
+
125
+ ```bash
126
+ npm install jsthermalcomfort@next
127
+ ```
128
+
129
+ This is how work on `development` reaches front ends before the major release, so
130
+ packaging problems surface before they reach everyone. Cut as many as you like
131
+ — `next.1`, `next.2` and so on — each is a real installable package.
132
+
133
+ ### What protects you
134
+
135
+ | Guard | Effect |
136
+ | ------------------------------------------- | ---------------------------------------------------------------- |
137
+ | Version contains a hyphen → `--tag next` | Never touches `latest`; `^1.x` users see nothing |
138
+ | Version must equal the tag | Build fails on a mismatch rather than publishing the wrong thing |
139
+ | `check:format`, `npm test`, `npm run build` | All run before the publish step |
140
+ | GitHub release marked prerelease | Matches the npm dist-tag, so the two do not disagree |
141
+
142
+ `npm publish` writes `latest` unless told otherwise, which is why the dist-tag
143
+ is computed in the workflow. Leaving it to the person releasing is exactly how
144
+ a preview ends up as the default install.
145
+
146
+ ### One thing to be careful about
147
+
148
+ **Do not tag a final version (no hyphen) from `development` while it is still work in
149
+ progress.** Without a hyphen it publishes as `latest`, and `npm install
150
+ jsthermalcomfort` starts handing out an unfinished major. It is not easily
151
+ undone — npm allows unpublishing only within a short window.
152
+
153
+ Prereleases from `development`; the final `vX.0.0` after `development` merges into `main`,
154
+ so `latest` and the default branch agree about what the current release is.
155
+
87
156
  Validation datasets for model tests are fetched from
88
157
  `FedericoTartarini/validation-data-comfort-models` on GitHub (no submodule needed).
89
- By default tests use the `main` branch. To pin tests to a specific ref (tag/branch/commit), set
90
- `VALIDATION_DATA_REF` when running tests:
158
+ By default tests use the `v1.1.0` tag, the ref pythermalcomfort's own tests pin
159
+ (`unit_test_data_prefix` in its `tests/conftest.py`); bump it together with
160
+ upstream. To run the tests against another ref (tag/branch/commit), set
161
+ `VALIDATION_DATA_REF`:
91
162
 
92
163
  ```bash
93
164
  VALIDATION_DATA_REF=main npm test
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Return the adaptive cooling effect for an air speed and operative temperature.
3
+ *
4
+ * The cooling effect is non-zero only when operative temperature is at or
5
+ * above 25 °C **and** air speed meets the minimum threshold (0.6 m/s).
6
+ *
7
+ * @param v - Air speed, [m/s].
8
+ * @param to - Operative temperature, [°C].
9
+ * @returns Cooling effect magnitude, [°C].
10
+ */
11
+ export function adaptive_cooling_effect(v, to) {
12
+ const magnitude = v >= 1.2 ? 2.2 : v >= 0.9 ? 1.8 : v >= 0.6 ? 1.2 : 0.0;
13
+ return to >= 25.0 ? magnitude : 0.0;
14
+ }
@@ -0,0 +1,121 @@
1
+ import { operative_tmp } from "../environment/operative_tmp.js";
2
+ import { Standard } from "../utilities/options.js";
3
+ import { deepFreeze } from "./modelInfo.js";
4
+ import { _valid_range } from "./validation.js";
5
+ // The counterpart of upstream's `_internal/ashrae55.py`.
6
+ /**
7
+ * ASHRAE 55's limits that `_check_ashrae55_compliance` checks, keyed as its
8
+ * keyword arguments: the Table 7.3.4 single-variable limits, and `v_limited`'s.
9
+ * The models that call it reference these from their `*_INFO`.
10
+ */
11
+ export const ASHRAE_55_LIMITS = deepFreeze({
12
+ tdb: { min: 10.0, max: 40.0 },
13
+ tr: { min: 10.0, max: 40.0 },
14
+ v: { min: 0.0, max: 2.0 },
15
+ met: { min: 1.0, max: 4.0 },
16
+ clo: { min: 0.0, max: 1.5 },
17
+ v_limited: { min: 0.0, max: 0.2 },
18
+ });
19
+ /**
20
+ * The standards `_check_ashrae55_compliance` checks against: upstream's
21
+ * docstring calls it the "ASHRAE 55-2023 input applicability check"
22
+ * (`_internal/ashrae55.py:12`).
23
+ */
24
+ export const ASHRAE_55_COMPLIANCE_STANDARDS = deepFreeze([
25
+ Standard.ashrae_55_2023,
26
+ ]);
27
+ /**
28
+ * ASHRAE 55's still-air speed, 0.1 m/s: `cooling_effect` calculates the
29
+ * cooling effect only above it and computes the still-air SET at it
30
+ * (`models/cooling_effect.py:35-40, :141, :187`), and `pmv_ppd_ashrae`
31
+ * applies the cooling effect above it (`models/pmv_ppd_ashrae.py:190-199`).
32
+ */
33
+ export const ASHRAE_55_STILL_AIR_THRESHOLD = 0.1;
34
+ /**
35
+ * The fixed airspeed bounds of the §7.2.1.2 `airspeed_control` rules: `any`
36
+ * at every operative temperature, `cool` when the operative temperature is at
37
+ * or below 23 °C.
38
+ */
39
+ const ASHRAE_55_AIRSPEED_NO_CONTROL = deepFreeze({
40
+ any: { max: 0.8 },
41
+ cool: { max: 0.2 },
42
+ });
43
+ /**
44
+ * ASHRAE 55-2023 input applicability check.
45
+ *
46
+ * Implements the Table 7.3.4 single-variable limits and the §7.2.1.2
47
+ * `airspeed_control` cross-variable rules. Single-use compliance checks for other
48
+ * standards (ISO 7730, ISO 7933, fan_heatwaves) live inline in the respective model
49
+ * files.
50
+ *
51
+ * `v_param_name` (default `"v"`) controls how the airspeed variable is rendered in
52
+ * the range rows emitted by this function. Callers whose signature names the airspeed
53
+ * argument `vr` should pass `v_param_name="vr"` so the row's key matches the
54
+ * caller's variable name. It does not affect which value is checked.
55
+ *
56
+ * @param kwargs - The values to check, keyed as upstream's keyword arguments.
57
+ * @param warnings - The call's rows.
58
+ * @returns The values in `kwargs`' order (`tdb`, `tr`, then `v`, `met` and
59
+ * `clo`, and `v_limited` where given), each NaN where it broke a limit.
60
+ */
61
+ export function _check_ashrae55_compliance(kwargs, warnings) {
62
+ const default_kwargs = { airspeed_control: true, v_param_name: "v" };
63
+ const params = { ...default_kwargs, ...kwargs };
64
+ const v_param_name = params.v_param_name;
65
+ const values_to_return = {};
66
+ const tdb_valid = _valid_range(params.tdb, ASHRAE_55_LIMITS.tdb, "tdb", "input", "°C", warnings);
67
+ const tr_valid = _valid_range(params.tr, ASHRAE_55_LIMITS.tr, "tr", "input", "°C", warnings);
68
+ values_to_return.tdb = tdb_valid;
69
+ values_to_return.tr = tr_valid;
70
+ let v_valid = NaN;
71
+ if (params.v !== undefined) {
72
+ v_valid = _valid_range(params.v, ASHRAE_55_LIMITS.v, v_param_name, "input", "m/s", warnings);
73
+ values_to_return.v = v_valid;
74
+ }
75
+ // Ashrae55Kwargs gives v, met and clo wherever airspeed_control can be
76
+ // false; the checks on v and met only narrow the types.
77
+ if (!params.airspeed_control &&
78
+ params.v !== undefined &&
79
+ params.met !== undefined) {
80
+ const { v, met, clo } = params;
81
+ const exceeding = (bound) => {
82
+ warnings.push(Object.freeze({
83
+ kind: "range",
84
+ key: v_param_name,
85
+ role: "input",
86
+ value: v,
87
+ unit: "m/s",
88
+ bound,
89
+ }));
90
+ };
91
+ const cond1 = v > ASHRAE_55_AIRSPEED_NO_CONTROL.any.max && clo < 0.7 && met < 1.3;
92
+ if (cond1)
93
+ exceeding(ASHRAE_55_AIRSPEED_NO_CONTROL.any);
94
+ v_valid = cond1 ? NaN : v_valid;
95
+ const to = operative_tmp(params.tdb, params.tr, v);
96
+ const v_limit = 50.49 - 4.4047 * to + 0.096425 * to * to;
97
+ const cond2 = to > 23 && to < 25.5 && v > v_limit && clo < 0.7 && met < 1.3;
98
+ if (cond2)
99
+ exceeding(Object.freeze({ max: v_limit }));
100
+ v_valid = cond2 ? NaN : v_valid;
101
+ const cond3 = to <= 23 &&
102
+ v > ASHRAE_55_AIRSPEED_NO_CONTROL.cool.max &&
103
+ clo < 0.7 &&
104
+ met < 1.3;
105
+ if (cond3)
106
+ exceeding(ASHRAE_55_AIRSPEED_NO_CONTROL.cool);
107
+ v_valid = cond3 ? NaN : v_valid;
108
+ values_to_return.v = v_valid;
109
+ }
110
+ if (params.met !== undefined) {
111
+ const met_valid = _valid_range(params.met, ASHRAE_55_LIMITS.met, "met", "input", "met", warnings);
112
+ const clo_valid = _valid_range(params.clo, ASHRAE_55_LIMITS.clo, "clo", "input", "clo", warnings);
113
+ values_to_return.met = met_valid;
114
+ values_to_return.clo = clo_valid;
115
+ }
116
+ if (params.v_limited !== undefined) {
117
+ const valid = _valid_range(params.v_limited, ASHRAE_55_LIMITS.v_limited, "v_limited", "input", "m/s", warnings);
118
+ values_to_return.v_limited = valid;
119
+ }
120
+ return Object.values(values_to_return);
121
+ }
@@ -0,0 +1,216 @@
1
+ // A line-by-line port of scipy 1.18.1's `scipy.optimize.brentq` (ADR 0026).
2
+ //
3
+ // Copyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers.
4
+ // All rights reserved.
5
+ //
6
+ // Redistribution and use in source and binary forms, with or without
7
+ // modification, are permitted provided that the following conditions
8
+ // are met:
9
+ //
10
+ // 1. Redistributions of source code must retain the above copyright
11
+ // notice, this list of conditions and the following disclaimer.
12
+ //
13
+ // 2. Redistributions in binary form must reproduce the above
14
+ // copyright notice, this list of conditions and the following
15
+ // disclaimer in the documentation and/or other materials provided
16
+ // with the distribution.
17
+ //
18
+ // 3. Neither the name of the copyright holder nor the names of its
19
+ // contributors may be used to endorse or promote products derived
20
+ // from this software without specific prior written permission.
21
+ //
22
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ import { notOfType } from "./errors.js";
34
+ const _iter = 100;
35
+ const _xtol = 2e-12;
36
+ const _rtol = 4 * Number.EPSILON;
37
+ /**
38
+ * Find a root of a function in a bracketing interval using Brent's method.
39
+ *
40
+ * The port of scipy's Python wrapper (`scipy/optimize/_zeros_py.py`, `brentq`
41
+ * and `_wrap_nan_raise`), its C caller (`scipy/optimize/_zerosmodule.c`,
42
+ * `call_solver`) and the solver (`scipy/optimize/Zeros/brentq.c`, written by
43
+ * Charles Harris). It takes the arguments upstream's callers pass: `args`,
44
+ * `full_output` and `disp` are left out, so a call that does not converge
45
+ * throws, as `disp=True` raises. scipy's `ValueError`s are `RangeError`s and
46
+ * its `RuntimeError` an `Error` (ADR 0022).
47
+ *
48
+ * @param f - The function, continuous, with `f(a)` and `f(b)` of opposite
49
+ * signs.
50
+ * @param a - One end of the bracketing interval `[a, b]`.
51
+ * @param b - The other end of the bracketing interval `[a, b]`.
52
+ * @param xtol - The absolute tolerance, positive.
53
+ * @param rtol - The relative tolerance, at least its default,
54
+ * `4 * Number.EPSILON`.
55
+ * @param maxiter - The most iterations, at least 0.
56
+ * @returns The root of `f` between `a` and `b`.
57
+ * @throws `TypeError` for a `maxiter` that is not an integer; `RangeError` for
58
+ * a tolerance or `maxiter` out of range, for `f(a)`
59
+ * and `f(b)` of the same sign, and for a NaN value of `f`; `Error` when
60
+ * `maxiter` iterations do not converge.
61
+ */
62
+ export function brentq(f, a, b, xtol = _xtol, rtol = _rtol, maxiter = _iter) {
63
+ // _zeros_py.py brentq, whose operator.index raises TypeError for a non-integer
64
+ if (!Number.isInteger(maxiter))
65
+ throw notOfType("maxiter", "an integer");
66
+ if (xtol <= 0) {
67
+ throw new RangeError(`xtol too small (${xtol} <= 0)`);
68
+ }
69
+ if (rtol < _rtol) {
70
+ throw new RangeError(`rtol too small (${rtol} < 8.88178e-16)`);
71
+ }
72
+ f = _wrap_nan_raise(f);
73
+ // _zerosmodule.c call_solver, whose `xtol < 0` check the one above makes
74
+ // unreachable
75
+ if (maxiter < 0) {
76
+ throw new RangeError("maxiter must be >= 0");
77
+ }
78
+ const [zero, error_num, iterations] = _brentq(f, a, b, xtol, rtol, maxiter);
79
+ if (error_num === SIGNERR) {
80
+ throw new RangeError("f(a) and f(b) must have different signs");
81
+ }
82
+ if (error_num === CONVERR) {
83
+ throw new Error(`Failed to converge after ${iterations} iterations.`);
84
+ }
85
+ return zero;
86
+ }
87
+ function _wrap_nan_raise(f) {
88
+ function f_raise(x) {
89
+ const fx = f(x);
90
+ if (Number.isNaN(fx)) {
91
+ const msg = `The function value at x=${x} is NaN; solver cannot continue.`;
92
+ throw new RangeError(msg);
93
+ }
94
+ return fx;
95
+ }
96
+ return f_raise;
97
+ }
98
+ const CONVERGED = 0;
99
+ const SIGNERR = -1;
100
+ const CONVERR = -2;
101
+ /*
102
+ At the top of the loop the situation is the following:
103
+
104
+ 1. the root is bracketed between xa and xb
105
+ 2. xa is the most recent estimate
106
+ 3. xp is the previous estimate
107
+ 4. |fp| < |fb|
108
+
109
+ The order of xa and xp doesn't matter, but assume xp < xb. Then xa lies to
110
+ the right of xp and the assumption is that xa is increasing towards the root.
111
+ In this situation we will attempt quadratic extrapolation as long as the
112
+ condition
113
+
114
+ * |fa| < |fp| < |fb|
115
+
116
+ is satisfied. That is, the function value is decreasing as we go along.
117
+ Note the 4 above implies that the right inequlity already holds.
118
+
119
+ The first check is that xa is still to the left of the root. If not, xb is
120
+ replaced by xp and the interval reverses, with xb < xa. In this situation
121
+ we will try linear interpolation. That this has happened is signaled by the
122
+ equality xb == xp;
123
+
124
+ The second check is that |fa| < |fb|. If this is not the case, we swap
125
+ xa and xb and resort to bisection.
126
+
127
+ */
128
+ function _brentq(f, xa, xb, xtol, rtol, iter) {
129
+ let xpre = xa, xcur = xb;
130
+ let xblk = 0, fpre, fcur, fblk = 0, spre = 0, scur = 0, sbis;
131
+ /* the tolerance is 2*delta */
132
+ let delta;
133
+ let stry, dpre, dblk;
134
+ let i;
135
+ let iterations = 0;
136
+ fpre = f(xpre);
137
+ fcur = f(xcur);
138
+ if (fpre === 0) {
139
+ return [xpre, CONVERGED, iterations];
140
+ }
141
+ if (fcur === 0) {
142
+ return [xcur, CONVERGED, iterations];
143
+ }
144
+ if (signbit(fpre) === signbit(fcur)) {
145
+ return [0, SIGNERR, iterations];
146
+ }
147
+ for (i = 0; i < iter; i++) {
148
+ iterations++;
149
+ if (fpre !== 0 && fcur !== 0 && signbit(fpre) !== signbit(fcur)) {
150
+ xblk = xpre;
151
+ fblk = fpre;
152
+ spre = scur = xcur - xpre;
153
+ }
154
+ if (Math.abs(fblk) < Math.abs(fcur)) {
155
+ xpre = xcur;
156
+ xcur = xblk;
157
+ xblk = xpre;
158
+ fpre = fcur;
159
+ fcur = fblk;
160
+ fblk = fpre;
161
+ }
162
+ delta = (xtol + rtol * Math.abs(xcur)) / 2;
163
+ sbis = (xblk - xcur) / 2;
164
+ if (fcur === 0 || Math.abs(sbis) < delta) {
165
+ return [xcur, CONVERGED, iterations];
166
+ }
167
+ if (Math.abs(spre) > delta && Math.abs(fcur) < Math.abs(fpre)) {
168
+ if (xpre === xblk) {
169
+ /* interpolate */
170
+ stry = (-fcur * (xcur - xpre)) / (fcur - fpre);
171
+ }
172
+ else {
173
+ /* extrapolate */
174
+ dpre = (fpre - fcur) / (xpre - xcur);
175
+ dblk = (fblk - fcur) / (xblk - xcur);
176
+ stry =
177
+ (-fcur * (fblk * dblk - fpre * dpre)) / (dblk * dpre * (fblk - fpre));
178
+ }
179
+ if (2 * Math.abs(stry) <
180
+ min(Math.abs(spre), 3 * Math.abs(sbis) - delta)) {
181
+ /* good short step */
182
+ spre = scur;
183
+ scur = stry;
184
+ }
185
+ else {
186
+ /* bisect */
187
+ spre = sbis;
188
+ scur = sbis;
189
+ }
190
+ }
191
+ else {
192
+ /* bisect */
193
+ spre = sbis;
194
+ scur = sbis;
195
+ }
196
+ xpre = xcur;
197
+ fpre = fcur;
198
+ if (Math.abs(scur) > delta) {
199
+ xcur += scur;
200
+ }
201
+ else {
202
+ xcur += sbis > 0 ? delta : -delta;
203
+ }
204
+ fcur = f(xcur);
205
+ }
206
+ return [xcur, CONVERR, iterations];
207
+ }
208
+ // C's `MIN(a, b)` macro, `((a) < (b) ? (a) : (b))`, which returns `b` where
209
+ // `Math.min` returns NaN.
210
+ function min(a, b) {
211
+ return a < b ? a : b;
212
+ }
213
+ // C's `signbit`, true for -0 too; `f_raise` has rejected NaN.
214
+ function signbit(x) {
215
+ return x < 0 || Object.is(x, -0);
216
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Classifies a value into bins, matching numpy's `digitize`.
3
+ *
4
+ * Given a value and a set of bin edges with corresponding labels, returns the
5
+ * label of the bin that contains the value:
6
+ *
7
+ * - `right: false` (left-inclusive): the bins are `[edges[i-1], edges[i])`.
8
+ * It returns `labels[0]` if `value < edges[0]`, `labels[1]` if
9
+ * `edges[0] <= value < edges[1]`, and so on, and NaN if
10
+ * `value >= edges[-1]`.
11
+ * - `right: true` (right-inclusive): the bins are `(edges[i-1], edges[i]]`.
12
+ * It returns `labels[0]` if `value <= edges[0]`, `labels[1]` if
13
+ * `edges[0] < value <= edges[1]`, and so on, and NaN if
14
+ * `value > edges[-1]`.
15
+ *
16
+ * As with `digitize`, NaN returns NaN, -Infinity falls into the first bin and
17
+ * +Infinity is beyond the last.
18
+ *
19
+ * Unlike `digitize`, which also takes decreasing edges, it throws unless the
20
+ * edges are strictly increasing (deviation _shared-2).
21
+ *
22
+ * @param value - The value to classify.
23
+ * @param bins - The bin configuration: strictly increasing `edges`, one
24
+ * `label` per bin, and `right` selecting right-inclusive (`value <= edge`) or
25
+ * left-inclusive (`value < edge`) bins. Typed readonly, so the frozen
26
+ * constants this library publishes can be passed straight in.
27
+ * @returns The label of the bin containing `value`, or NaN if `value` is
28
+ * outside all bins.
29
+ * @throws `RangeError` if the edges are not strictly increasing.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const bins = {
34
+ * edges: [0, 10, 20],
35
+ * labels: ["low", "medium", "high"],
36
+ * right: false,
37
+ * };
38
+ * classifyFromBins(-5, bins); // "low" (value < 0)
39
+ * classifyFromBins(5, bins); // "medium" (0 <= value < 10)
40
+ * classifyFromBins(15, bins); // "high" (10 <= value < 20)
41
+ * classifyFromBins(25, bins); // NaN (value >= 20)
42
+ * classifyFromBins(-Infinity, bins); // "low"
43
+ * classifyFromBins(Infinity, bins); // NaN
44
+ * ```
45
+ */
46
+ export function classifyFromBins(value, bins) {
47
+ const { edges, labels, right } = bins;
48
+ // The edges are checked before the value, so a bad table fails on every call
49
+ // rather than only on the values it would misclassify.
50
+ let previous;
51
+ for (const edge of edges) {
52
+ if (previous !== undefined && !(previous < edge)) {
53
+ throw new RangeError("edges must be strictly increasing.");
54
+ }
55
+ previous = edge;
56
+ }
57
+ // NaN, and +Infinity, which is beyond the last bin, give NaN; -Infinity falls
58
+ // into the first bin in both modes.
59
+ if (Number.isNaN(value) || value === Infinity)
60
+ return NaN;
61
+ if (value === -Infinity)
62
+ return labels[0] ?? NaN;
63
+ // The first edge the value is at or below (right-inclusive), or below
64
+ // (left-inclusive), names its bin; beyond the last edge there is none.
65
+ const index = edges.findIndex((edge) => right ? value <= edge : value < edge);
66
+ return index === -1 ? NaN : (labels[index] ?? NaN);
67
+ }