jsthermalcomfort 0.0.1 → 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 -72
  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 -25
  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 -25
  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 -68
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # jsthermalcomfort
2
+
2
3
  jsthermalcomfort is a JavaScript package that allows users to calculate thermal comfort indices, including Predicted Mean Vote (PMV), Standard Effective Temperature (SET), and Predicted Heat Strain (PHS).
3
4
 
4
5
  ## Installation
6
+
5
7
  Using npm:
6
8
 
7
9
  ```
8
10
  npm install jsthermalcomfort
9
- ```
11
+ ```
package/lib/cjs/index.js CHANGED
@@ -1,74 +1,9 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.goodBye = exports.helloWorld = exports.heatIndex = void 0;
4
- /**
5
- * Calculates the Heat Index (HI). It combines air temperature and relative humidity to determine an apparent temperature.
6
- *
7
- * @param tdb Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'.
8
- * @param rh Relative humidity, [%].
9
- * @param options (Optional) Other parameters.
10
- * @param options.round If True rounds output value, if False it does not round it.
11
- * @param options.units Select the SI (International System of Units) or the IP (Imperial Units) system.
12
- *
13
- * @returns Heat Index, default in [°C] in [°F] if `units` = 'IP'.
14
- *
15
- * @example
16
- * const hi = heatIndex(25, 50); // returns 25.9
17
- */
18
- function heatIndex(tdb, rh, options = {}) {
19
- const defaultOptions = {
20
- round: true,
21
- units: "SI",
22
- };
23
- let round, units;
24
- let heatIndexOptions;
25
- // @ts-ignore
26
- heatIndexOptions = { round, units } = Object.assign(defaultOptions, options);
27
- let hi;
28
- if (units === "SI") {
29
- hi =
30
- -8.784695 +
31
- 1.61139411 * tdb +
32
- 2.338549 * rh -
33
- 0.14611605 * tdb * rh -
34
- 0.012308094 * Math.pow(tdb, 2) -
35
- 0.016424828 * Math.pow(rh, 2) +
36
- 0.002211732 * Math.pow(tdb, 2) * rh +
37
- 0.00072546 * tdb * Math.pow(rh, 2) -
38
- 0.000003582 * Math.pow(tdb, 2) * Math.pow(rh, 2);
39
- }
40
- else {
41
- hi =
42
- -42.379 +
43
- 2.04901523 * tdb +
44
- 10.14333127 * rh -
45
- 0.22475541 * tdb * rh -
46
- 0.00683783 * Math.pow(tdb, 2) -
47
- 0.05481717 * Math.pow(rh, 2) +
48
- 0.00122874 * Math.pow(tdb, 2) * rh +
49
- 0.00085282 * tdb * Math.pow(rh, 2) -
50
- 0.00000199 * Math.pow(tdb, 2) * Math.pow(rh, 2);
51
- }
52
- if (round) {
53
- return Math.round(hi * 10) / 10;
54
- }
55
- else {
56
- return hi;
57
- }
58
- }
59
- exports.heatIndex = heatIndex;
60
- function helloWorld() {
61
- const message = 'Hello World from my example modern npm package!';
62
- return message;
63
- }
64
- exports.helloWorld = helloWorld;
65
- function goodBye() {
66
- const message = 'Goodbye from my example modern npm package!';
67
- return message;
68
- }
69
- exports.goodBye = goodBye;
70
- exports.default = {
71
- helloWorld,
72
- heatIndex,
73
- goodBye,
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
74
4
  };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const index_js_1 = __importDefault(require("./utilities/index.js"));
7
+ const index_js_2 = __importDefault(require("./psychrometrics/index.js"));
8
+ const index_js_3 = __importDefault(require("./models/index.js"));
9
+ exports.default = { utilities: index_js_1.default, psychrometrics: index_js_2.default, models: index_js_3.default };
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.a_pmv_array = exports.a_pmv = void 0;
4
+ const pmv_js_1 = require("./pmv.js");
5
+ const utilities_js_1 = require("../utilities/utilities.js");
6
+ /**
7
+ * @typedef {Object} A_pmvKwargs
8
+ * @property {'SI'|'IP'} units - select the SI (International System of Units) or the IP (Imperial Units) system.
9
+ * @property { boolean } limit_inputs - Default is True. By default, if the inputs are outside the standard applicability
10
+ * limits the function returns NaN. If false, returns pmv and ppd values even if input values are outside
11
+ * the applicability limits of the model.
12
+ *
13
+ * The ISO 7730 2005 limits are 10 < tdb [°C] < 30, 10 < tr [°C] < 40,
14
+ * 0 < vr [m/s] < 1, 0.8 < met [met] < 4, 0 < clo [clo] < 2, and -2 < PMV < 2.
15
+ * @public
16
+ */
17
+ /**
18
+ * Returns Adaptive Predicted Mean Vote (aPMV) {@link #ref_25|[25]}.
19
+ * This index was developed by Yao, R. et al. (2009). The model takes into account factors
20
+ * such as culture, climate, social, psychological and behavioral adaptations, which have
21
+ * an impact on the senses used to detect thermal comfort. This model uses an adaptive
22
+ * coefficient (λ) representing the adaptive factors that affect the sense of thermal comfort.
23
+ *
24
+ * This is a version that supports scalar arguments.
25
+ * @see {@link a_pmv_array} for a version that supports arrays.
26
+ *
27
+ * @public
28
+ * @memberof models
29
+ * @docname Adaptive Predicted Mean Vote (aPMV)
30
+ *
31
+ * @param {number} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
32
+ * @param {number} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
33
+ * @param {number} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
34
+ *
35
+ * Note: vr is the relative air speed caused by body movement and not the air
36
+ * speed measured by the air speed sensor. The relative air speed is the sum of the
37
+ * average air speed measured by the sensor plus the activity-generated air speed
38
+ * (Vag). Where Vag is the activity-generated air speed caused by motion of
39
+ * individual body parts. vr can be calculated using the function v_relative in utilities.js.
40
+ * @param {number} rh - Relative humidity, [%]
41
+ * @param {number} met - Metabolic rate, [met]
42
+ * @param {number} clo - Clothing insulation, [clo]
43
+ *
44
+ * Note: The activity as well as the air speed modify the insulation characteristics
45
+ * of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
46
+ * the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
47
+ * for the effect of the body movement for met equal or higher than 1.2 met using
48
+ * the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
49
+ * can be calculated using the function clo_dynamic in utilities.js.
50
+ * @param {number} a_coefficient - Adaptive coefficient
51
+ * @param {number} [wme=0] - External work
52
+ * @param {A_pmvKwargs} kwargs - additional arguments
53
+ *
54
+ * @returns {number} pmv - Predicted Mean Vote
55
+ *
56
+ * @example
57
+ * const tdb = 24,
58
+ * const tr = 30,
59
+ * const vr = 0.22,
60
+ * const rh = 50,
61
+ * const met = 1.4,
62
+ * const clo = 0.5,
63
+ * const a_coefficient = 0.293,
64
+ * const wme = undefined,
65
+ *
66
+ * const result = a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme);
67
+ * console.log(result) //output 0.48
68
+ */
69
+ function a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme = 0, kwargs = {}) {
70
+ const default_kwargs = {
71
+ units: "SI",
72
+ limit_inputs: true,
73
+ };
74
+ kwargs = Object.assign(default_kwargs, kwargs);
75
+ const _pmv = (0, pmv_js_1.pmv)(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
76
+ return (0, utilities_js_1.round)(_pmv / (1 + a_coefficient * _pmv), 2);
77
+ }
78
+ exports.a_pmv = a_pmv;
79
+ /**
80
+ * Returns Adaptive Predicted Mean Vote (aPMV) {@link #ref_25|[25]}.
81
+ * This index was developed by Yao, R. et al. (2009). The model takes into account factors
82
+ * such as culture, climate, social, psychological and behavioral adaptations, which have
83
+ * an impact on the senses used to detect thermal comfort. This model uses an adaptive
84
+ * coefficient (λ) representing the adaptive factors that affect the sense of thermal comfort.
85
+ *
86
+ * This is a version that supports arrays.
87
+ * @see {@link a_pmv} for a version that supports scalar arguments.
88
+ *
89
+ * @public
90
+ * @memberof models
91
+ * @docname Adaptive Predicted Mean Vote (aPMV) (array version)
92
+ *
93
+ * @param {number[]} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
94
+ * @param {number[]} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
95
+ * @param {number[]} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
96
+ *
97
+ * Note: vr is the relative air speed caused by body movement and not the air
98
+ * speed measured by the air speed sensor. The relative air speed is the sum of the
99
+ * average air speed measured by the sensor plus the activity-generated air speed
100
+ * (Vag). Where Vag is the activity-generated air speed caused by motion of
101
+ * individual body parts. vr can be calculated using the function v_relative_array in utilities.js.
102
+ * @param {number[]} rh - Relative humidity, [%]
103
+ * @param {number[]} met - Metabolic rate, [met]
104
+ * @param {number[]} clo - Clothing insulation, [clo]
105
+ *
106
+ * Note: The activity as well as the air speed modify the insulation characteristics
107
+ * of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
108
+ * the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
109
+ * for the effect of the body movement for met equal or higher than 1.2 met using
110
+ * the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
111
+ * can be calculated using the function clo_dynamic_array in utilities.js.
112
+ * @param {number[]} a_coefficient - Adaptive coefficient
113
+ * @param {number[]} wme - External work, default is array of 0
114
+ * @param {A_pmvKwargs} kwargs - additional arguments
115
+ *
116
+ * @returns {number[]} pmv - Predicted Mean Vote
117
+ *
118
+ * @example
119
+ * const tdb = [24, 30],
120
+ * const tr = [30, 30],
121
+ * const vr = [0.22, 0.22],
122
+ * const rh = [50, 50],
123
+ * const met = [1.4, 1.4],
124
+ * const clo = [0.5, 0.5],
125
+ * const a_coefficient = [0.293, 0.293],
126
+ * const wme = undefined,
127
+ *
128
+ * const result = a_pmv_array(tdb, tr, vr, rh, met, clo, a_coefficient, wme);
129
+ * console.log(result) //output [0.48, 1.09]
130
+ */
131
+ function a_pmv_array(tdb, tr, vr, rh, met, clo, a_coefficient, wme, kwargs = {}) {
132
+ const default_kwargs = {
133
+ units: "SI",
134
+ limit_inputs: true,
135
+ };
136
+ kwargs = Object.assign(default_kwargs, kwargs);
137
+ const _pmv = (0, pmv_js_1.pmv_array)(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
138
+ return _pmv.map((_pmvValue, i) => (0, utilities_js_1.round)(_pmvValue / (1 + a_coefficient[i] * _pmvValue), 2));
139
+ }
140
+ exports.a_pmv_array = a_pmv_array;
@@ -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;