jsthermalcomfort 0.0.2 → 0.1.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 (228) hide show
  1. package/README.md +3 -1
  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 +21 -14
  228. package/lib/esm/index.mjs +0 -430
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.adaptive_ashrae_array = exports.adaptive_ashrae = void 0;
4
+ const utilities_js_1 = require("../utilities/utilities.js");
5
+ const t_o_js_1 = require("../psychrometrics/t_o.js");
6
+ const adaptive_en_js_1 = require("./adaptive_en.js");
7
+ /**
8
+ * @typedef {object} AdaptiveAshraeResult
9
+ * @property {number} tmp_cmf - Comfort temperature a that specific running mean temperature, default in [°C] or in [°F]
10
+ * @property {number} tmp_cmf_80_low - Lower acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
11
+ * @property {number} tmp_cmf_80_up - Upper acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
12
+ * @property {number} tmp_cmf_90_low - Lower acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
13
+ * @property {number} tmp_cmf_90_up - Upper acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
14
+ * @property {boolean} acceptability_80 - Acceptability for 80% occupants
15
+ * @property {boolean} acceptability_90 - Acceptability for 90% occupants
16
+ * @public
17
+ */
18
+ /**
19
+ * Determines the adaptive thermal comfort based on ASHRAE 55. The adaptive
20
+ * model relates indoor design temperatures or acceptable temperature ranges
21
+ * to outdoor meteorological or climatological parameters. The adaptive model
22
+ * can only be used in occupant-controlled naturally conditioned spaces that
23
+ * meet all the following criteria:
24
+ *
25
+ * - There is no mechianical cooling or heating system in operation
26
+ * - Occupants have a metabolic rate between 1.0 and 1.5 met
27
+ * - Occupants are free to adapt their clothing within a range as wide as 0.5 and 1.0 clo
28
+ * - The prevailing mean (runnin mean) outdoor temperature is between 10 and 33.5 °C
29
+ *
30
+ * @see {@link adaptive_ashrae_array} for a version that supports array arguments
31
+ *
32
+ * @public
33
+ * @memberof models
34
+ * @docname Adaptive ASHRAE
35
+ *
36
+ * @param {number} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
37
+ * @param {number} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
38
+ * @param {number} t_running_mean - running mean temperature, default in [°C] in [°C] in [°F] if `units` = 'IP'
39
+ * The running mean temperature can be calculated using the function {@link #running_mean_outdoor_temperature|running_mean_outdoor_temperature}
40
+ * @param {number} v - air speed, default in [m/s] in [fps] if `units` = 'IP'
41
+ * @param {"SI" | "IP"} units - select the SI (International System of Units) or the IP (Imperial Units) system.
42
+ * @param {boolean} limit_inputs - By default, if the inputs are outsude the standard applicability limits the
43
+ * function returns nan. If False returns pmv and ppd values even if input values are
44
+ * outside the applicability limits of the model.
45
+ *
46
+ * @returns {AdaptiveAshraeResult} set containing results for the model
47
+ *
48
+ * The ASHRAE 55 2020 limits are 10 < tdb [°C] < 40, 10 < tr [°C] < 40,
49
+ * 0 < vr [m/s] < 2, 10 < t running mean [°C] < 33.5
50
+ *
51
+ * You can use this function to calculate if your conditions are within the `adaptive thermal comfort region`.
52
+ * Calculations with comply with the ASHRAE 55 2020 Standard {@link #ref_1|[1]}.
53
+ *
54
+ * @example
55
+ * import { adaptive_ashrae } from "jsthermalcomfort/models";
56
+ * const results = adaptive_ashrae(25, 25, 20, 0.1);
57
+ * console.log(results);
58
+ * // {tmp_cmf: 24.0, tmp_cmf_80_low: 20.5, tmp_cmf_80_up: 27.5,
59
+ * // tmp_cmf_90_low: 21.5, tmp_cmf_90_up: 26.5, acceptability_80: true,
60
+ * // acceptability_90: true}
61
+ * console.log(results.acceptability_80);
62
+ * // true
63
+ *
64
+ * @example
65
+ * import { adaptive_ashrae } from "jsthermalcomfort/models";
66
+ * // For users who want to use the IP system
67
+ * const results = adaptive_ashrae(77, 77, 68, 0.3, 'IP');
68
+ * console.log(results);
69
+ * // {tmp_cmf: 75.2, tmp_cmf_80_low: 68.9, tmp_cmf_80_up: 81.5,
70
+ * // tmp_cmf_90_low: 70.7, tmp_cmf_90_up: 79.7, acceptability_80: true,
71
+ * // acceptability_90: true}
72
+ *
73
+ * @example
74
+ * import { adaptive_ashrae } from "jsthermalcomfort/models";
75
+ * const results = adaptive_ashrae(25, 25, 9, 0.1);
76
+ * console.log(results);
77
+ * // {tmp_cmf: NaN, tmp_cmf_80_low: NaN, ...}
78
+ * // The adaptive thermal comfort model can only be used
79
+ * // if the running mean temperature is higher than 10°C
80
+ */
81
+ function adaptive_ashrae(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
82
+ const standard = "ASHRAE";
83
+ if (units === "IP") {
84
+ ({
85
+ tdb,
86
+ tr,
87
+ tmp_running_mean: t_running_mean,
88
+ v,
89
+ } = (0, utilities_js_1.units_converter)({
90
+ tdb,
91
+ tr,
92
+ tmp_running_mean: t_running_mean,
93
+ v,
94
+ }));
95
+ }
96
+ const to = (0, t_o_js_1.t_o)(tdb, tr, v, standard);
97
+ // calculate cooling effect (ce) of elevated air speed when top > 25 degC.
98
+ const ce = (0, adaptive_en_js_1.get_ce)(v, to);
99
+ // Relation between comfort and outdoor temperature
100
+ let t_cmf = 0.31 * t_running_mean + 17.8;
101
+ if (limit_inputs) {
102
+ const { tdb: tdb_valid, tr: tr_valid, v: v_valid, } = (0, utilities_js_1.check_standard_compliance_array)(standard, {
103
+ tdb: [tdb],
104
+ tr: [tr],
105
+ v: [v],
106
+ });
107
+ const trm_valid = t_running_mean >= 10.0 && t_running_mean <= 33.5 ? t_running_mean : NaN;
108
+ if (isNaN(tdb_valid[0]) ||
109
+ isNaN(tr_valid[0]) ||
110
+ isNaN(v_valid[0]) ||
111
+ isNaN(trm_valid))
112
+ t_cmf = NaN;
113
+ }
114
+ t_cmf = (0, utilities_js_1.round)(t_cmf, 1);
115
+ let tmp_cmf_80_low = t_cmf - 3.5;
116
+ let tmp_cmf_90_low = t_cmf - 2.5;
117
+ let tmp_cmf_80_up = t_cmf + 3.5 + ce;
118
+ let tmp_cmf_90_up = t_cmf + 2.5 + ce;
119
+ const acceptability_80 = tmp_cmf_80_low <= to && to <= tmp_cmf_80_up;
120
+ const acceptability_90 = tmp_cmf_90_low <= to && to <= tmp_cmf_90_up;
121
+ if (units === "IP") {
122
+ ({
123
+ tmp_cmf: t_cmf,
124
+ tmp_cmf_80_low,
125
+ tmp_cmf_80_up,
126
+ tmp_cmf_90_low,
127
+ tmp_cmf_90_up,
128
+ } = (0, utilities_js_1.units_converter)({
129
+ tmp_cmf: t_cmf,
130
+ tmp_cmf_80_low,
131
+ tmp_cmf_80_up,
132
+ tmp_cmf_90_low,
133
+ tmp_cmf_90_up,
134
+ }, "SI"));
135
+ }
136
+ return {
137
+ tmp_cmf: t_cmf,
138
+ tmp_cmf_80_low,
139
+ tmp_cmf_80_up,
140
+ tmp_cmf_90_low,
141
+ tmp_cmf_90_up,
142
+ acceptability_80,
143
+ acceptability_90,
144
+ };
145
+ }
146
+ exports.adaptive_ashrae = adaptive_ashrae;
147
+ /**
148
+ * @typedef {object} AdaptiveAshraeArrayResult
149
+ * @property {number[]} tmp_cmf - Comfort temperature a that specific running mean temperature, default in [°C] or in [°F]
150
+ * @property {number[]} tmp_cmf_80_low - Lower acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
151
+ * @property {number[]} tmp_cmf_80_up - Upper acceptable comfort temperature for 80% occupants, default in [°C] or in [°F]
152
+ * @property {number[]} tmp_cmf_90_low - Lower acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
153
+ * @property {number[]} tmp_cmf_90_up - Upper acceptable comfort temperature for 90% occupants, default in [°C] or in [°F]
154
+ * @property {boolean[]} acceptability_80 - Acceptability for 80% occupants
155
+ * @property {boolean[]} acceptability_90 - Acceptability for 90% occupants
156
+ * @public
157
+ */
158
+ /**
159
+ * Determines the adaptive thermal comfort based on ASHRAE 55. The adaptive
160
+ * model relates indoor design temperatures or acceptable temperature ranges
161
+ * to outdoor meteorological or climatological parameters. The adaptive model
162
+ * can only be used in occupant-controlled naturally conditioned spaces that
163
+ * meet all the following criteria:
164
+ *
165
+ * - There is no mechianical cooling or heating system in operation
166
+ * - Occupants have a metabolic rate between 1.0 and 1.5 met
167
+ * - Occupants are free to adapt their clothing within a range as wide as 0.5 and 1.0 clo
168
+ * - The prevailing mean (runnin mean) outdoor temperature is between 10 and 33.5 °C
169
+ *
170
+ * @see {@link adaptive_ashrae} for a version that supports scalar arguments
171
+ *
172
+ * @public
173
+ * @memberof models
174
+ * @docname Adaptive ASHRAE (array version)
175
+ *
176
+ * @param {number[]} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
177
+ * @param {number[]} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
178
+ * @param {number[]} t_running_mean - running mean temperature, default in [°C] in [°C] in [°F] if `units` = 'IP'
179
+ * The running mean temperature can be calculated using the function {@link #running_mean_outdoor_temperature|running_mean_outdoor_temperature}
180
+ * @param {number[]} v - air speed, default in [m/s] in [fps] if `units` = 'IP'
181
+ * @param {"SI" | "IP"} units - select the SI (International System of Units) or the IP (Imperial Units) system.
182
+ * @param {boolean} limit_inputs - By default, if the inputs are outsude the standard applicability limits the
183
+ * function returns nan. If False returns pmv and ppd values even if input values are
184
+ * outside the applicability limits of the model.
185
+ *
186
+ * @returns {AdaptiveAshraeArrayResult} set containing results for the model
187
+ *
188
+ * The ASHRAE 55 2020 limits are 10 < tdb [°C] < 40, 10 < tr [°C] < 40,
189
+ * 0 < vr [m/s] < 2, 10 < t running mean [°C] < 33.5
190
+ *
191
+ * You can use this function to calculate if your conditions are within the `adaptive thermal comfort region`.
192
+ * Calculations with comply with the ASHRAE 55 2020 Standard {@link #ref_1|[1]}.
193
+ *
194
+ * @example
195
+ * import { adaptive_ashrae_array } from "jsthermalcomfort/models";
196
+ * const results = adaptive_ashrae_array([25], [25], [20], [0.1]);
197
+ * console.log(results);
198
+ * // {tmp_cmf: [24.0], tmp_cmf_80_low: [20.5], tmp_cmf_80_up: [27.5],
199
+ * // tmp_cmf_90_low: [21.5], tmp_cmf_90_up: [26.5], acceptability_80: [true],
200
+ * // acceptability_90: [true]}
201
+ * console.log(results.acceptability_80);
202
+ * // [true]
203
+ *
204
+ * @example
205
+ * import { adaptive_ashrae_array } from "jsthermalcomfort/models";
206
+ * // For users who want to use the IP system
207
+ * const results = adaptive_ashrae_array([77], [77], [68], [0.3], 'IP');
208
+ * console.log(results);
209
+ * // {tmp_cmf: [75.2], tmp_cmf_80_low: [68.9], tmp_cmf_80_up: [81.5],
210
+ * // tmp_cmf_90_low: [70.7], tmp_cmf_90_up: [79.7], acceptability_80: [true],
211
+ * // acceptability_90: [true]}
212
+ *
213
+ * @example
214
+ * import { adaptive_ashrae_array } from "jsthermalcomfort/models";
215
+ * const results = adaptive_ashrae_array([25], [25], [9], [0.1]);
216
+ * console.log(results);
217
+ * // {tmp_cmf: [NaN], tmp_cmf_80_low: [NaN], ...}
218
+ * // The adaptive thermal comfort model can only be used
219
+ * // if the running mean temperature is higher than 10°C
220
+ */
221
+ function adaptive_ashrae_array(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
222
+ const standard = "ASHRAE";
223
+ if (units === "IP") {
224
+ ({
225
+ tdb,
226
+ tr,
227
+ tmp_running_mean: t_running_mean,
228
+ v,
229
+ } = (0, utilities_js_1.units_converter_array)({
230
+ tdb,
231
+ tr,
232
+ tmp_running_mean: t_running_mean,
233
+ v,
234
+ }));
235
+ }
236
+ const to = (0, t_o_js_1.t_o_array)(tdb, tr, v, standard);
237
+ // calculate cooling effect (ce) of elevated air speed when top > 25 degC.
238
+ const ce = v.map((_v, index) => (0, adaptive_en_js_1.get_ce)(_v, to[index]));
239
+ // Relation between comfort and outdoor temperature
240
+ let t_cmf = t_running_mean.map((_t) => 0.31 * _t + 17.8);
241
+ if (limit_inputs) {
242
+ const { tdb: tdb_valid, tr: tr_valid, v: v_valid, } = (0, utilities_js_1.check_standard_compliance_array)(standard, {
243
+ tdb,
244
+ tr,
245
+ v,
246
+ });
247
+ const trm_valid = (0, utilities_js_1.valid_range)(t_running_mean, [10.0, 33.5]);
248
+ for (let i = 0; i < t_cmf.length; ++i) {
249
+ if (isNaN(tdb_valid[i]) ||
250
+ isNaN(tr_valid[i]) ||
251
+ isNaN(v_valid[i]) ||
252
+ isNaN(trm_valid[i]))
253
+ t_cmf[i] = NaN;
254
+ }
255
+ }
256
+ for (let i = 0; i < t_cmf.length; ++i) {
257
+ t_cmf[i] = (0, utilities_js_1.round)(t_cmf[i], 1);
258
+ }
259
+ let tmp_cmf_80_low = t_cmf.map((_t) => _t - 3.5);
260
+ let tmp_cmf_90_low = t_cmf.map((_t) => _t - 2.5);
261
+ let tmp_cmf_80_up = t_cmf.map((_t, i) => _t + 3.5 + ce[i]);
262
+ let tmp_cmf_90_up = t_cmf.map((_t, i) => _t + 2.5 + ce[i]);
263
+ const acceptability_80 = tmp_cmf_80_low.map((_low, index) => _low <= to[index] && to[index] <= tmp_cmf_80_up[index]);
264
+ const acceptability_90 = tmp_cmf_90_low.map((_low, index) => _low <= to[index] && to[index] <= tmp_cmf_90_up[index]);
265
+ if (units === "IP") {
266
+ ({
267
+ tmp_cmf: t_cmf,
268
+ tmp_cmf_80_low,
269
+ tmp_cmf_80_up,
270
+ tmp_cmf_90_low,
271
+ tmp_cmf_90_up,
272
+ } = (0, utilities_js_1.units_converter_array)({
273
+ tmp_cmf: t_cmf,
274
+ tmp_cmf_80_low,
275
+ tmp_cmf_80_up,
276
+ tmp_cmf_90_low,
277
+ tmp_cmf_90_up,
278
+ }, "SI"));
279
+ }
280
+ return {
281
+ tmp_cmf: t_cmf,
282
+ tmp_cmf_80_low,
283
+ tmp_cmf_80_up,
284
+ tmp_cmf_90_low,
285
+ tmp_cmf_90_up,
286
+ acceptability_80,
287
+ acceptability_90,
288
+ };
289
+ }
290
+ exports.adaptive_ashrae_array = adaptive_ashrae_array;
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.get_ce = exports.adaptive_en_array = exports.adaptive_en = void 0;
4
+ const t_o_js_1 = require("../psychrometrics/t_o.js");
5
+ const utilities_js_1 = require("../utilities/utilities.js");
6
+ /**
7
+ * @typedef {object} AdaptiveEnResult - a result set containing the results for {@link #adative_en|adaptive_en}
8
+ * @property {number} tmp_cmf - Comfort temperature at that specific running mean temperature, default in [°C] or in [°F]
9
+ * @property {boolean} acceptability_cat_i - If the indoor conditions comply with comfort category I
10
+ * @property {boolean} acceptability_cat_ii - If the indoor conditions comply with comfort category II
11
+ * @property {boolean} acceptability_cat_iii - If the indoor conditions comply with comfort category III
12
+ * @property {number} tmp_cmf_cat_i_up - Upper acceptable comfort temperature for category I, default in [°C] or in [°F]
13
+ * @property {number} tmp_cmf_cat_ii_up - Upper acceptable comfort temperature for category II, default in [°C] or in [°F]
14
+ * @property {number} tmp_cmf_cat_iii_up - Upper acceptable comfort temperature for category III, default in [°C] or in [°F]
15
+ * @property {number} tmp_cmf_cat_i_low - Lower acceptable comfort temperature for category I, default in [°C] or in [°F]
16
+ * @property {number} tmp_cmf_cat_ii_low - Lower acceptable comfort temperature for category II, default in [°C] or in [°F]
17
+ * @property {number} tmp_cmf_cat_iii_low - Lower acceptable comfort temperature for category III, default in [°C] or in [°F]
18
+ * @public
19
+ */
20
+ /**
21
+ * Determines the adaptive thermal comfort based on EN 16798-1 2019 {@link #ref_3|[3]}
22
+ *
23
+ * Note: You can use this function to calculate if your conditions are within the EN
24
+ * adaptive thermal comfort region. Calculations with comply with the EN 16798-1 2019 {@link #ref_3|[3]}.
25
+ *
26
+ * @see {@link adaptive_en_array} for a version that supports array arguments
27
+ *
28
+ * @public
29
+ * @memberof models
30
+ * @docname Adaptive EN
31
+ *
32
+ * @param {number} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
33
+ * @param {number} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
34
+ * @param {number} t_running_mean - running mean temperature, default in [°C] in [°C] in [°F] if `units` = 'IP'
35
+ * The running mean temperature can be calculated using the function {@link #running_mean_outdoor_temperature|running_mean_outdoor_temperature}
36
+ *
37
+ * @param {number} v - air speed, default in [m/s] in [fps] if `units` = 'IP'
38
+ *
39
+ * Note: Indoor operative temperature correction is applicable for buildings equipped
40
+ * with fans or personal systems providing building occupants with personal
41
+ * control over air speed at occupant level.
42
+ * For operative temperatures above 25°C the comfort zone upper limit can be
43
+ * increased by 1.2 °C (0.6 < v < 0.9 m/s), 1.8 °C (0.9 < v < 1.2 m/s), 2.2 °C (v > 1.2 m/s)
44
+ *
45
+ * @param {"IP" | "SI"} [units="SI"] - select the SI (International System of Units) or the IP (Imperial Units) system.
46
+ * @param {boolean} [limit_inputs=true] - By default, if the inputs are outsude the standard applicability limits the
47
+ * function returns nan. If False returns pmv and ppd values even if input values are
48
+ * outside the applicability limits of the model.
49
+ *
50
+ * @returns {AdaptiveEnResult} result set
51
+ *
52
+ * @example
53
+ * const results = adaptive_en(25, 25, 20, 0.1);
54
+ * console.log(results); // {tmp_cmf: 25.4, acceptability_cat_i: true, acceptability_cat_ii: true, ... }
55
+ * console.log(results.acceptability_cat_i); // true
56
+ * // The conditions you entered are considered to comply with Category I
57
+ *
58
+ * @example
59
+ * // for users who wants to use the IP system
60
+ * const results = adaptive_en(77, 77, 68, 0.3, 'IP');
61
+ * console.log(results); // {tmp_cmf: 77.7, acceptability_cat_i: true, acceptability_cat_ii: true, ... }
62
+ *
63
+ * @example
64
+ * const results = adaptive_en(25, 25, 9, 0.1);
65
+ * console.log(results); // {tmp_cmf: NaN, acceptability_cat_i: true, acceptability_cat_ii: true, ... }
66
+ * // The adaptive thermal comfort model can only be used
67
+ * // if the running mean temperature is between 10 °C and 30 °C
68
+ */
69
+ function adaptive_en(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
70
+ const standard = "ISO";
71
+ if (units.toLowerCase() == "ip") {
72
+ ({
73
+ tdb,
74
+ tr,
75
+ tmp_running_mean: t_running_mean,
76
+ v,
77
+ } = (0, utilities_js_1.units_converter)({ tdb, tr, tmp_running_mean: t_running_mean, v }));
78
+ }
79
+ const to = (0, t_o_js_1.t_o)(tdb, tr, v, standard);
80
+ const ce = get_ce(v, to);
81
+ let t_cmf = 0.33 * t_running_mean + 18.8;
82
+ if (limit_inputs) {
83
+ const trm_valid = t_running_mean >= 10.0 && t_running_mean <= 33.5;
84
+ if (!trm_valid)
85
+ t_cmf = NaN;
86
+ }
87
+ let t_cmf_i_lower = t_cmf - 3.0;
88
+ let t_cmf_ii_lower = t_cmf - 4.0;
89
+ let t_cmf_iii_lower = t_cmf - 5.0;
90
+ let t_cmf_i_upper = t_cmf + 2.0 + ce;
91
+ let t_cmf_ii_upper = t_cmf + 3.0 + ce;
92
+ let t_cmf_iii_upper = t_cmf + 4.0 + ce;
93
+ const acceptability_i = t_cmf_i_lower <= to && to <= t_cmf_i_upper;
94
+ const acceptability_ii = t_cmf_ii_lower <= to && to <= t_cmf_ii_upper;
95
+ const acceptability_iii = t_cmf_iii_lower <= to && to <= t_cmf_iii_upper;
96
+ if (units.toLocaleLowerCase() === "ip") {
97
+ ({
98
+ tmp_cmf: t_cmf,
99
+ tmp_cmf_cat_i_up: t_cmf_i_upper,
100
+ tmp_cmf_cat_ii_up: t_cmf_ii_upper,
101
+ tmp_cmf_cat_iii_up: t_cmf_iii_upper,
102
+ } = (0, utilities_js_1.units_converter)({
103
+ tmp_cmf: t_cmf,
104
+ tmp_cmf_cat_i_up: t_cmf_i_upper,
105
+ tmp_cmf_cat_ii_up: t_cmf_ii_upper,
106
+ tmp_cmf_cat_iii_up: t_cmf_iii_upper,
107
+ }, "SI"));
108
+ ({
109
+ tmp_cmf_cat_i_low: t_cmf_i_lower,
110
+ tmp_cmf_cat_ii_low: t_cmf_ii_lower,
111
+ tmp_cmf_cat_iii_low: t_cmf_iii_lower,
112
+ } = (0, utilities_js_1.units_converter)({
113
+ tmp_cmf_cat_i_low: t_cmf_i_lower,
114
+ tmp_cmf_cat_ii_low: t_cmf_ii_lower,
115
+ tmp_cmf_cat_iii_low: t_cmf_iii_lower,
116
+ }, "SI"));
117
+ }
118
+ return {
119
+ tmp_cmf: (0, utilities_js_1.round)(t_cmf, 1),
120
+ acceptability_cat_i: acceptability_i,
121
+ acceptability_cat_ii: acceptability_ii,
122
+ acceptability_cat_iii: acceptability_iii,
123
+ tmp_cmf_cat_i_up: (0, utilities_js_1.round)(t_cmf_i_upper, 1),
124
+ tmp_cmf_cat_ii_up: (0, utilities_js_1.round)(t_cmf_ii_upper, 1),
125
+ tmp_cmf_cat_iii_up: (0, utilities_js_1.round)(t_cmf_iii_upper, 1),
126
+ tmp_cmf_cat_i_low: (0, utilities_js_1.round)(t_cmf_i_lower, 1),
127
+ tmp_cmf_cat_ii_low: (0, utilities_js_1.round)(t_cmf_ii_lower, 1),
128
+ tmp_cmf_cat_iii_low: (0, utilities_js_1.round)(t_cmf_iii_lower, 1),
129
+ };
130
+ }
131
+ exports.adaptive_en = adaptive_en;
132
+ /**
133
+ * @typedef {object} AdaptiveEnArrayResult - a result set containing the results for {@link #adative_en_array|adaptive_en_array}
134
+ * @property {number[]} tmp_cmf - Comfort temperature at that specific running mean temperature, default in [°C] or in [°F]
135
+ * @property {boolean[]} acceptability_cat_i - If the indoor conditions comply with comfort category I
136
+ * @property {boolean[]} acceptability_cat_ii - If the indoor conditions comply with comfort category II
137
+ * @property {boolean[]} acceptability_cat_iii - If the indoor conditions comply with comfort category III
138
+ * @property {number[]} tmp_cmf_cat_i_up - Upper acceptable comfort temperature for category I, default in [°C] or in [°F]
139
+ * @property {number[]} tmp_cmf_cat_ii_up - Upper acceptable comfort temperature for category II, default in [°C] or in [°F]
140
+ * @property {number[]} tmp_cmf_cat_iii_up - Upper acceptable comfort temperature for category III, default in [°C] or in [°F]
141
+ * @property {number[]} tmp_cmf_cat_i_low - Lower acceptable comfort temperature for category I, default in [°C] or in [°F]
142
+ * @property {number[]} tmp_cmf_cat_ii_low - Lower acceptable comfort temperature for category II, default in [°C] or in [°F]
143
+ * @property {number[]} tmp_cmf_cat_iii_low - Lower acceptable comfort temperature for category III, default in [°C] or in [°F]
144
+ * @public
145
+ */
146
+ /**
147
+ * Determines the adaptive thermal comfort based on EN 16798-1 2019 {@link #ref_3|[3]}
148
+ *
149
+ * Note: You can use this function to calculate if your conditions are within the EN
150
+ * adaptive thermal comfort region. Calculations with comply with the EN 16798-1 2019 {@link #ref_3|[3]}.
151
+ *
152
+ * @public
153
+ * @memberof models
154
+ * @docname Adaptive EN (array version)
155
+ *
156
+ * @see {@link adaptive_en} for a version that supports scalar arguments
157
+ *
158
+ * @param {number[]} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
159
+ * @param {number[]} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
160
+ * @param {number[]} t_running_mean - running mean temperature, default in [°C] in [°C] in [°F] if `units` = 'IP'
161
+ * The running mean temperature can be calculated using the function {@link #running_mean_outdoor_temperature|running_mean_outdoor_temperature}
162
+ *
163
+ * @param {number[]} v - air speed, default in [m/s] in [fps] if `units` = 'IP'
164
+ *
165
+ * Note: Indoor operative temperature correction is applicable for buildings equipped
166
+ * with fans or personal systems providing building occupants with personal
167
+ * control over air speed at occupant level.
168
+ * For operative temperatures above 25°C the comfort zone upper limit can be
169
+ * increased by 1.2 °C (0.6 < v < 0.9 m/s), 1.8 °C (0.9 < v < 1.2 m/s), 2.2 °C (v> 1.2 m/s)
170
+ *
171
+ * @param {"IP" | "SI"} [units="SI"] - select the SI (International System of Units) or the IP (Imperial Units) system.
172
+ * @param {boolean} [limit_inputs=true] - By default, if the inputs are outsude the standard applicability limits the
173
+ * function returns nan. If False returns pmv and ppd values even if input values are
174
+ * outside the applicability limits of the model.
175
+ *
176
+ * @returns {AdaptiveEnArrayResult} result set
177
+ *
178
+ * @example
179
+ * const results = adaptive_en([25,25], [25,25], [20,9], [0.1,0.1]);
180
+ * console.log(results); // {tmp_cmf: [25.4, NaN], acceptability_cat_i: [true, true], acceptability_cat_ii: [true, true], ... }
181
+ * console.log(results.acceptability_cat_i); // [true, true]
182
+ * // The conditions you entered are considered to comply with Category I
183
+ * // The adaptive thermal comfort model can only be used
184
+ * // if the running mean temperature is between 10 °C and 30 °C
185
+ */
186
+ function adaptive_en_array(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
187
+ const standard = "ISO";
188
+ if (units.toLowerCase() == "ip") {
189
+ ({
190
+ tdb,
191
+ tr,
192
+ tmp_running_mean: t_running_mean,
193
+ v,
194
+ } = (0, utilities_js_1.units_converter_array)({
195
+ tdb,
196
+ tr,
197
+ tmp_running_mean: t_running_mean,
198
+ v,
199
+ }));
200
+ }
201
+ const to = (0, t_o_js_1.t_o_array)(tdb, tr, v, standard);
202
+ const ce = v.map((_v, index) => get_ce(_v, to[index]));
203
+ let t_cmf = t_running_mean.map((_t_running_mean) => 0.33 * _t_running_mean + 18.8);
204
+ if (limit_inputs) {
205
+ const trm_valid = (0, utilities_js_1.valid_range)(t_running_mean, [10.0, 33.5]);
206
+ trm_valid.forEach((_trm_valid, index) => {
207
+ if (isNaN(_trm_valid))
208
+ t_cmf[index] = NaN;
209
+ });
210
+ }
211
+ let t_cmf_i_lower = t_cmf.map((_t) => _t - 3.0);
212
+ let t_cmf_ii_lower = t_cmf.map((_t) => _t - 4.0);
213
+ let t_cmf_iii_lower = t_cmf.map((_t) => _t - 5.0);
214
+ let t_cmf_i_upper = t_cmf.map((_t, index) => _t + 2.0 + ce[index]);
215
+ let t_cmf_ii_upper = t_cmf.map((_t, index) => _t + 3.0 + ce[index]);
216
+ let t_cmf_iii_upper = t_cmf.map((_t, index) => _t + 4.0 + ce[index]);
217
+ const acceptability_i = to.map((_to, index) => t_cmf_i_lower[index] <= _to && _to <= t_cmf_i_upper[index]);
218
+ const acceptability_ii = to.map((_to, index) => t_cmf_ii_lower[index] <= _to && _to <= t_cmf_ii_upper[index]);
219
+ const acceptability_iii = to.map((_to, index) => t_cmf_iii_lower[index] <= _to && _to <= t_cmf_iii_upper[index]);
220
+ if (units.toLocaleLowerCase() === "ip") {
221
+ ({
222
+ tmp_cmf: t_cmf,
223
+ tmp_cmf_cat_i_up: t_cmf_i_upper,
224
+ tmp_cmf_cat_ii_up: t_cmf_ii_upper,
225
+ tmp_cmf_cat_iii_up: t_cmf_iii_upper,
226
+ } = (0, utilities_js_1.units_converter_array)({
227
+ tmp_cmf: t_cmf,
228
+ tmp_cmf_cat_i_up: t_cmf_i_upper,
229
+ tmp_cmf_cat_ii_up: t_cmf_ii_upper,
230
+ tmp_cmf_cat_iii_up: t_cmf_iii_upper,
231
+ }, "SI"));
232
+ ({
233
+ tmp_cmf_cat_i_low: t_cmf_i_lower,
234
+ tmp_cmf_cat_ii_low: t_cmf_ii_lower,
235
+ tmp_cmf_cat_iii_low: t_cmf_iii_lower,
236
+ } = (0, utilities_js_1.units_converter_array)({
237
+ tmp_cmf_cat_i_low: t_cmf_i_lower,
238
+ tmp_cmf_cat_ii_low: t_cmf_ii_lower,
239
+ tmp_cmf_cat_iii_low: t_cmf_iii_lower,
240
+ }, "SI"));
241
+ }
242
+ // NOTE: even all these arrays are the same length and this could be done in one loop
243
+ // doing it in seperate loops means that it is much more cache friendly which makes it faster
244
+ for (let i = 0; i < t_cmf.length; ++i) {
245
+ t_cmf[i] = (0, utilities_js_1.round)(t_cmf[i], 1);
246
+ }
247
+ for (let i = 0; i < t_cmf_i_lower.length; ++i) {
248
+ t_cmf_i_lower[i] = (0, utilities_js_1.round)(t_cmf_i_lower[i], 1);
249
+ }
250
+ for (let i = 0; i < t_cmf_ii_lower.length; ++i) {
251
+ t_cmf_ii_lower[i] = (0, utilities_js_1.round)(t_cmf_ii_lower[i], 1);
252
+ }
253
+ for (let i = 0; i < t_cmf_iii_lower.length; ++i) {
254
+ t_cmf_iii_lower[i] = (0, utilities_js_1.round)(t_cmf_iii_lower[i], 1);
255
+ }
256
+ for (let i = 0; i < t_cmf_i_upper.length; ++i) {
257
+ t_cmf_i_upper[i] = (0, utilities_js_1.round)(t_cmf_i_upper[i], 1);
258
+ }
259
+ for (let i = 0; i < t_cmf_ii_upper.length; ++i) {
260
+ t_cmf_ii_upper[i] = (0, utilities_js_1.round)(t_cmf_ii_upper[i], 1);
261
+ }
262
+ for (let i = 0; i < t_cmf_iii_upper.length; ++i) {
263
+ t_cmf_iii_upper[i] = (0, utilities_js_1.round)(t_cmf_iii_upper[i], 1);
264
+ }
265
+ return {
266
+ tmp_cmf: t_cmf,
267
+ acceptability_cat_i: acceptability_i,
268
+ acceptability_cat_ii: acceptability_ii,
269
+ acceptability_cat_iii: acceptability_iii,
270
+ tmp_cmf_cat_i_up: t_cmf_i_upper,
271
+ tmp_cmf_cat_ii_up: t_cmf_ii_upper,
272
+ tmp_cmf_cat_iii_up: t_cmf_iii_upper,
273
+ tmp_cmf_cat_i_low: t_cmf_i_lower,
274
+ tmp_cmf_cat_ii_low: t_cmf_ii_lower,
275
+ tmp_cmf_cat_iii_low: t_cmf_iii_lower,
276
+ };
277
+ }
278
+ exports.adaptive_en_array = adaptive_en_array;
279
+ /**
280
+ *
281
+ * @param {number} v
282
+ * @param {number} to
283
+ * @returns {number}
284
+ */
285
+ function get_ce(v, to) {
286
+ let ce = 0;
287
+ if (v >= 0.6 && to >= 25.0) {
288
+ if (v < 0.9) {
289
+ ce = 1.2;
290
+ }
291
+ else if (v < 1.2) {
292
+ ce = 1.8;
293
+ }
294
+ else {
295
+ ce = 2.2;
296
+ }
297
+ }
298
+ return ce;
299
+ }
300
+ exports.get_ce = get_ce;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ankle_draft = void 0;
4
+ const pmv_js_1 = require("./pmv.js");
5
+ const utilities_js_1 = require("../utilities/utilities.js");
6
+ /**
7
+ * @public
8
+ * @typedef {Object} AnkleDraftRet
9
+ * @property {number} PPD_ad - redicted Percentage of Dissatisfied occupants with ankle draft, [%]
10
+ * @property {boolean} Acceptability - The ASHRAE 55 2020 standard defines that the value of air speed at the ankle level is acceptable if PPD_ad is lower or equal than 20%
11
+ */
12
+ /**
13
+ * Calculates the percentage of thermally dissatisfied people with the ankle draft (0.1 m) above floor level {@link #ref_23|[23]}.
14
+ This equation is only applicable for vr < 0.2 m/s (40 fps).
15
+ * @public
16
+ * @memberof models
17
+ * @docname Ankle draft
18
+ *
19
+ * @param {number} tdb - dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
20
+ *
21
+ Note: The air temperature is the average value over two heights: 0.6 m (24 in.)
22
+ and 1.1 m (43 in.) for seated occupants
23
+ and 1.1 m (43 in.) and 1.7 m (67 in.) for standing occupants.
24
+
25
+ * @param {number} tr - mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
26
+ * @param {number} vr - relative air speed, default in [m/s] in [fps] if `units` = 'IP'
27
+
28
+ Note: vr is the relative air speed caused by body movement and not the air
29
+ speed measured by the air speed sensor. The relative air speed is the sum of the
30
+ average air speed measured by the sensor plus the activity-generated air speed
31
+ (Vag). Where Vag is the activity-generated air speed caused by motion of
32
+ individual body parts. vr can be calculated using the function v_relative in utilities.js.
33
+
34
+ * @param {number} rh - relative humidity, [%]
35
+ * @param {number} met - metabolic rate, [met]
36
+ * @param {number} clo - clothing insulation, [clo]
37
+
38
+ Note: The activity as well as the air speed modify the insulation characteristics
39
+ of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
40
+ the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
41
+ for the effect of the body movement for met equal or higher than 1.2 met using
42
+ the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
43
+ can be calculated using the function clo_dynamic in utilities.js.
44
+ * @param {number} v_ankle - air speed at the 0.1 m (4 in.) above the floor, default in [m/s] in [fps] if
45
+ `units` = 'IP'
46
+ * @param {"IP"|"SI"} [units="SI"] - select the SI (International System of Units) or the IP (Imperial Units) system.
47
+ * @returns {AnkleDraftRet} - Returns {"PPD_ad": ppd_val, "Acceptability": acceptability}
48
+ *
49
+ * @example
50
+ * results = ankle_draft(25, 25, 0.2, 50, 1.2, 0.5, 0.3, "SI")
51
+ * console.log(results) // expected result is {PPD_ad: 18.5, Acceptability: true}
52
+ *
53
+ */
54
+ function ankle_draft(tdb, tr, vr, rh, met, clo, v_ankle, units = "SI") {
55
+ let kwargs = {};
56
+ let ret = 0;
57
+ if (units.toLowerCase() == "ip") {
58
+ kwargs = {
59
+ tdb: tdb,
60
+ tr: tr,
61
+ v: vr,
62
+ vel: v_ankle,
63
+ };
64
+ ret = (0, utilities_js_1.units_converter)(kwargs);
65
+ tdb = ret["tdb"];
66
+ tr = ret["tr"];
67
+ vr = ret["v"];
68
+ v_ankle = ret["vel"];
69
+ }
70
+ kwargs = { tdb: tdb, tr: tr, v_limited: vr, rh: rh, met: met, clo: clo };
71
+ const warns = (0, utilities_js_1.check_standard_compliance)("ASHRAE", kwargs);
72
+ for (const warn of warns) {
73
+ console.warn("Warning:", warn);
74
+ }
75
+ const tsv = (0, pmv_js_1.pmv)(tdb, tr, vr, rh, met, clo, 0, "ASHRAE");
76
+ const ppd_val = (0, utilities_js_1.round)((Math.exp(-2.58 + 3.05 * v_ankle - 1.06 * tsv) /
77
+ (1 + Math.exp(-2.58 + 3.05 * v_ankle - 1.06 * tsv))) *
78
+ 100, 1);
79
+ const acceptability = ppd_val <= 20;
80
+ return { PPD_ad: ppd_val, Acceptability: acceptability };
81
+ }
82
+ exports.ankle_draft = ankle_draft;