jsthermalcomfort 0.0.2 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/README.md +196 -6
  2. package/lib/cjs/index.js +7 -434
  3. package/lib/cjs/models/a_pmv.js +140 -0
  4. package/lib/cjs/models/adaptive_ashrae.js +290 -0
  5. package/lib/cjs/models/adaptive_en.js +300 -0
  6. package/lib/cjs/models/ankle_draft.js +82 -0
  7. package/lib/cjs/models/at.js +52 -0
  8. package/lib/cjs/models/athb.js +135 -0
  9. package/lib/cjs/models/clo_tout.js +58 -0
  10. package/lib/cjs/models/cooling_effect.js +164 -0
  11. package/lib/cjs/models/discomfort_index.js +115 -0
  12. package/lib/cjs/models/e_pmv.js +154 -0
  13. package/lib/cjs/models/heat_index.js +60 -0
  14. package/lib/cjs/models/humidex.js +63 -0
  15. package/lib/cjs/models/index.js +71 -0
  16. package/lib/cjs/models/net.js +50 -0
  17. package/lib/cjs/models/pet_steady.js +443 -0
  18. package/lib/cjs/models/phs.js +458 -0
  19. package/lib/cjs/models/pmv.js +200 -0
  20. package/lib/cjs/models/pmv_ppd.js +404 -0
  21. package/lib/cjs/models/set_tmp.js +203 -0
  22. package/lib/cjs/models/solar_gain.js +163 -0
  23. package/lib/cjs/models/two_nodes.js +790 -0
  24. package/lib/cjs/models/use_fans_heatwave.js +203 -0
  25. package/lib/cjs/models/utci.js +609 -0
  26. package/lib/cjs/models/vertical_tmp_grad_ppd.js +95 -0
  27. package/lib/cjs/models/wbgt.js +72 -0
  28. package/lib/cjs/models/wc.js +37 -0
  29. package/lib/cjs/psychrometrics/enthalpy.js +24 -0
  30. package/lib/cjs/psychrometrics/index.js +28 -0
  31. package/lib/cjs/psychrometrics/p_sat.js +46 -0
  32. package/lib/cjs/psychrometrics/p_sat_torr.js +34 -0
  33. package/lib/cjs/psychrometrics/psy_ta_rh.js +51 -0
  34. package/lib/cjs/psychrometrics/t_dp.js +19 -0
  35. package/lib/cjs/psychrometrics/t_mrt.js +117 -0
  36. package/lib/cjs/psychrometrics/t_o.js +82 -0
  37. package/lib/cjs/psychrometrics/t_wb.js +23 -0
  38. package/lib/cjs/types/index.d.ts +7 -79
  39. package/lib/cjs/types/index.d.ts.map +1 -1
  40. package/lib/cjs/types/models/a_pmv.d.ts +133 -0
  41. package/lib/cjs/types/models/a_pmv.d.ts.map +1 -0
  42. package/lib/cjs/types/models/adaptive_ashrae.d.ts +211 -0
  43. package/lib/cjs/types/models/adaptive_ashrae.d.ts.map +1 -0
  44. package/lib/cjs/types/models/adaptive_en.d.ts +217 -0
  45. package/lib/cjs/types/models/adaptive_en.d.ts.map +1 -0
  46. package/lib/cjs/types/models/ankle_draft.d.ts +60 -0
  47. package/lib/cjs/types/models/ankle_draft.d.ts.map +1 -0
  48. package/lib/cjs/types/models/at.d.ts +34 -0
  49. package/lib/cjs/types/models/at.d.ts.map +1 -0
  50. package/lib/cjs/types/models/athb.d.ts +96 -0
  51. package/lib/cjs/types/models/athb.d.ts.map +1 -0
  52. package/lib/cjs/types/models/clo_tout.d.ts +45 -0
  53. package/lib/cjs/types/models/clo_tout.d.ts.map +1 -0
  54. package/lib/cjs/types/models/cooling_effect.d.ts +49 -0
  55. package/lib/cjs/types/models/cooling_effect.d.ts.map +1 -0
  56. package/lib/cjs/types/models/discomfort_index.d.ts +91 -0
  57. package/lib/cjs/types/models/discomfort_index.d.ts.map +1 -0
  58. package/lib/cjs/types/models/e_pmv.d.ts +139 -0
  59. package/lib/cjs/types/models/e_pmv.d.ts.map +1 -0
  60. package/lib/cjs/types/models/heat_index.d.ts +27 -0
  61. package/lib/cjs/types/models/heat_index.d.ts.map +1 -0
  62. package/lib/cjs/types/models/humidex.d.ts +54 -0
  63. package/lib/cjs/types/models/humidex.d.ts.map +1 -0
  64. package/lib/cjs/types/models/index.d.ts +78 -0
  65. package/lib/cjs/types/models/index.d.ts.map +1 -0
  66. package/lib/cjs/types/models/net.d.ts +39 -0
  67. package/lib/cjs/types/models/net.d.ts.map +1 -0
  68. package/lib/cjs/types/models/pet_steady.d.ts +59 -0
  69. package/lib/cjs/types/models/pet_steady.d.ts.map +1 -0
  70. package/lib/cjs/types/models/phs.d.ts +242 -0
  71. package/lib/cjs/types/models/phs.d.ts.map +1 -0
  72. package/lib/cjs/types/models/pmv.d.ts +198 -0
  73. package/lib/cjs/types/models/pmv.d.ts.map +1 -0
  74. package/lib/cjs/types/models/pmv_ppd.d.ts +246 -0
  75. package/lib/cjs/types/models/pmv_ppd.d.ts.map +1 -0
  76. package/lib/cjs/types/models/set_tmp.d.ts +124 -0
  77. package/lib/cjs/types/models/set_tmp.d.ts.map +1 -0
  78. package/lib/cjs/types/models/solar_gain.d.ts +76 -0
  79. package/lib/cjs/types/models/solar_gain.d.ts.map +1 -0
  80. package/lib/cjs/types/models/two_nodes.d.ts +412 -0
  81. package/lib/cjs/types/models/two_nodes.d.ts.map +1 -0
  82. package/lib/cjs/types/models/use_fans_heatwave.d.ts +188 -0
  83. package/lib/cjs/types/models/use_fans_heatwave.d.ts.map +1 -0
  84. package/lib/cjs/types/models/utci.d.ts +79 -0
  85. package/lib/cjs/types/models/utci.d.ts.map +1 -0
  86. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts +58 -0
  87. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -0
  88. package/lib/cjs/types/models/wbgt.d.ts +51 -0
  89. package/lib/cjs/types/models/wbgt.d.ts.map +1 -0
  90. package/lib/cjs/types/models/wc.d.ts +29 -0
  91. package/lib/cjs/types/models/wc.d.ts.map +1 -0
  92. package/lib/cjs/types/psychrometrics/enthalpy.d.ts +12 -0
  93. package/lib/cjs/types/psychrometrics/enthalpy.d.ts.map +1 -0
  94. package/lib/cjs/types/psychrometrics/index.d.ts +26 -0
  95. package/lib/cjs/types/psychrometrics/index.d.ts.map +1 -0
  96. package/lib/cjs/types/psychrometrics/p_sat.d.ts +13 -0
  97. package/lib/cjs/types/psychrometrics/p_sat.d.ts.map +1 -0
  98. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts +26 -0
  99. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
  100. package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts +51 -0
  101. package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
  102. package/lib/cjs/types/psychrometrics/t_dp.d.ts +9 -0
  103. package/lib/cjs/types/psychrometrics/t_dp.d.ts.map +1 -0
  104. package/lib/cjs/types/psychrometrics/t_mrt.d.ts +43 -0
  105. package/lib/cjs/types/psychrometrics/t_mrt.d.ts.map +1 -0
  106. package/lib/cjs/types/psychrometrics/t_o.d.ts +31 -0
  107. package/lib/cjs/types/psychrometrics/t_o.d.ts.map +1 -0
  108. package/lib/cjs/types/psychrometrics/t_wb.d.ts +12 -0
  109. package/lib/cjs/types/psychrometrics/t_wb.d.ts.map +1 -0
  110. package/lib/cjs/types/utilities/index.d.ts +28 -0
  111. package/lib/cjs/types/utilities/index.d.ts.map +1 -0
  112. package/lib/cjs/types/utilities/utilities.d.ts +377 -0
  113. package/lib/cjs/types/utilities/utilities.d.ts.map +1 -0
  114. package/lib/cjs/utilities/index.js +27 -0
  115. package/lib/cjs/utilities/utilities.js +903 -0
  116. package/lib/esm/index.js +4 -0
  117. package/lib/esm/models/a_pmv.js +135 -0
  118. package/lib/esm/models/adaptive_ashrae.js +285 -0
  119. package/lib/esm/models/adaptive_en.js +294 -0
  120. package/lib/esm/models/ankle_draft.js +78 -0
  121. package/lib/esm/models/at.js +48 -0
  122. package/lib/esm/models/athb.js +130 -0
  123. package/lib/esm/models/clo_tout.js +53 -0
  124. package/lib/esm/models/cooling_effect.js +159 -0
  125. package/lib/esm/models/discomfort_index.js +110 -0
  126. package/lib/esm/models/e_pmv.js +149 -0
  127. package/lib/esm/models/heat_index.js +56 -0
  128. package/lib/esm/models/humidex.js +59 -0
  129. package/lib/esm/models/index.js +69 -0
  130. package/lib/esm/models/net.js +46 -0
  131. package/lib/esm/models/pet_steady.js +439 -0
  132. package/lib/esm/models/phs.js +454 -0
  133. package/lib/esm/models/pmv.js +195 -0
  134. package/lib/esm/models/pmv_ppd.js +398 -0
  135. package/lib/esm/models/set_tmp.js +198 -0
  136. package/lib/esm/models/solar_gain.js +158 -0
  137. package/lib/esm/models/two_nodes.js +784 -0
  138. package/lib/esm/models/use_fans_heatwave.js +199 -0
  139. package/lib/esm/models/utci.js +604 -0
  140. package/lib/esm/models/wbgt.js +68 -0
  141. package/lib/esm/models/wc.js +33 -0
  142. package/lib/esm/psychrometrics/enthalpy.js +20 -0
  143. package/lib/esm/psychrometrics/index.js +26 -0
  144. package/lib/esm/psychrometrics/p_sat.js +42 -0
  145. package/lib/esm/psychrometrics/p_sat_torr.js +29 -0
  146. package/lib/esm/psychrometrics/psy_ta_rh.js +47 -0
  147. package/lib/esm/psychrometrics/t_dp.js +15 -0
  148. package/lib/esm/psychrometrics/t_mrt.js +112 -0
  149. package/lib/esm/psychrometrics/t_o.js +77 -0
  150. package/lib/esm/psychrometrics/t_wb.js +19 -0
  151. package/lib/esm/types/index.d.ts +7 -79
  152. package/lib/esm/types/index.d.ts.map +1 -1
  153. package/lib/esm/types/models/a_pmv.d.ts +133 -0
  154. package/lib/esm/types/models/a_pmv.d.ts.map +1 -0
  155. package/lib/esm/types/models/adaptive_ashrae.d.ts +211 -0
  156. package/lib/esm/types/models/adaptive_ashrae.d.ts.map +1 -0
  157. package/lib/esm/types/models/adaptive_en.d.ts +217 -0
  158. package/lib/esm/types/models/adaptive_en.d.ts.map +1 -0
  159. package/lib/esm/types/models/ankle_draft.d.ts +60 -0
  160. package/lib/esm/types/models/ankle_draft.d.ts.map +1 -0
  161. package/lib/esm/types/models/at.d.ts +34 -0
  162. package/lib/esm/types/models/at.d.ts.map +1 -0
  163. package/lib/esm/types/models/athb.d.ts +96 -0
  164. package/lib/esm/types/models/athb.d.ts.map +1 -0
  165. package/lib/esm/types/models/clo_tout.d.ts +45 -0
  166. package/lib/esm/types/models/clo_tout.d.ts.map +1 -0
  167. package/lib/esm/types/models/cooling_effect.d.ts +49 -0
  168. package/lib/esm/types/models/cooling_effect.d.ts.map +1 -0
  169. package/lib/esm/types/models/discomfort_index.d.ts +91 -0
  170. package/lib/esm/types/models/discomfort_index.d.ts.map +1 -0
  171. package/lib/esm/types/models/e_pmv.d.ts +139 -0
  172. package/lib/esm/types/models/e_pmv.d.ts.map +1 -0
  173. package/lib/esm/types/models/heat_index.d.ts +27 -0
  174. package/lib/esm/types/models/heat_index.d.ts.map +1 -0
  175. package/lib/esm/types/models/humidex.d.ts +54 -0
  176. package/lib/esm/types/models/humidex.d.ts.map +1 -0
  177. package/lib/esm/types/models/index.d.ts +77 -0
  178. package/lib/esm/types/models/index.d.ts.map +1 -0
  179. package/lib/esm/types/models/net.d.ts +39 -0
  180. package/lib/esm/types/models/net.d.ts.map +1 -0
  181. package/lib/esm/types/models/pet_steady.d.ts +59 -0
  182. package/lib/esm/types/models/pet_steady.d.ts.map +1 -0
  183. package/lib/esm/types/models/phs.d.ts +242 -0
  184. package/lib/esm/types/models/phs.d.ts.map +1 -0
  185. package/lib/esm/types/models/pmv.d.ts +198 -0
  186. package/lib/esm/types/models/pmv.d.ts.map +1 -0
  187. package/lib/esm/types/models/pmv_ppd.d.ts +246 -0
  188. package/lib/esm/types/models/pmv_ppd.d.ts.map +1 -0
  189. package/lib/esm/types/models/set_tmp.d.ts +124 -0
  190. package/lib/esm/types/models/set_tmp.d.ts.map +1 -0
  191. package/lib/esm/types/models/solar_gain.d.ts +76 -0
  192. package/lib/esm/types/models/solar_gain.d.ts.map +1 -0
  193. package/lib/esm/types/models/two_nodes.d.ts +412 -0
  194. package/lib/esm/types/models/two_nodes.d.ts.map +1 -0
  195. package/lib/esm/types/models/use_fans_heatwave.d.ts +188 -0
  196. package/lib/esm/types/models/use_fans_heatwave.d.ts.map +1 -0
  197. package/lib/esm/types/models/utci.d.ts +79 -0
  198. package/lib/esm/types/models/utci.d.ts.map +1 -0
  199. package/lib/esm/types/models/wbgt.d.ts +51 -0
  200. package/lib/esm/types/models/wbgt.d.ts.map +1 -0
  201. package/lib/esm/types/models/wc.d.ts +29 -0
  202. package/lib/esm/types/models/wc.d.ts.map +1 -0
  203. package/lib/esm/types/psychrometrics/enthalpy.d.ts +12 -0
  204. package/lib/esm/types/psychrometrics/enthalpy.d.ts.map +1 -0
  205. package/lib/esm/types/psychrometrics/index.d.ts +26 -0
  206. package/lib/esm/types/psychrometrics/index.d.ts.map +1 -0
  207. package/lib/esm/types/psychrometrics/p_sat.d.ts +13 -0
  208. package/lib/esm/types/psychrometrics/p_sat.d.ts.map +1 -0
  209. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts +26 -0
  210. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
  211. package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts +51 -0
  212. package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
  213. package/lib/esm/types/psychrometrics/t_dp.d.ts +9 -0
  214. package/lib/esm/types/psychrometrics/t_dp.d.ts.map +1 -0
  215. package/lib/esm/types/psychrometrics/t_mrt.d.ts +43 -0
  216. package/lib/esm/types/psychrometrics/t_mrt.d.ts.map +1 -0
  217. package/lib/esm/types/psychrometrics/t_o.d.ts +31 -0
  218. package/lib/esm/types/psychrometrics/t_o.d.ts.map +1 -0
  219. package/lib/esm/types/psychrometrics/t_wb.d.ts +12 -0
  220. package/lib/esm/types/psychrometrics/t_wb.d.ts.map +1 -0
  221. package/lib/esm/types/utilities/index.d.ts +28 -0
  222. package/lib/esm/types/utilities/index.d.ts.map +1 -0
  223. package/lib/esm/types/utilities/utilities.d.ts +377 -0
  224. package/lib/esm/types/utilities/utilities.d.ts.map +1 -0
  225. package/lib/esm/utilities/index.js +25 -0
  226. package/lib/esm/utilities/utilities.js +885 -0
  227. package/package.json +22 -15
  228. package/lib/esm/index.mjs +0 -430
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "jsthermalcomfort",
3
- "version": "0.0.2",
3
+ "version": "0.1.2",
4
4
  "description": "A JavaScript package to calculate thermal comfort indices (e.g., Predicted Mean Vote, Standard Effective Temperature, Predicted Heat Strain).",
5
+ "type": "module",
6
+ "files": [
7
+ "lib"
8
+ ],
5
9
  "exports": {
6
10
  ".": {
7
11
  "import": {
8
12
  "types": "./lib/esm/types/index.d.ts",
9
- "default": "./lib/esm/index.mjs"
13
+ "default": "./lib/esm/index.js"
10
14
  },
11
15
  "require": {
12
16
  "types": "./lib/cjs/types/index.d.ts",
@@ -14,19 +18,16 @@
14
18
  }
15
19
  }
16
20
  },
17
- "types": "./lib/cjs/types/index.d.ts",
18
- "main": "./lib/cjs/index.js",
19
- "files": [
20
- "lib/**/*"
21
- ],
22
21
  "scripts": {
23
22
  "clean": "rm -rf ./lib",
24
23
  "build": "npm run clean && npm run build:esm && npm run build:cjs",
25
- "build:esm": "tsc -p ./configs/tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs",
24
+ "build:esm": "tsc -p ./configs/tsconfig.esm.json",
26
25
  "build:cjs": "tsc -p ./configs/tsconfig.cjs.json",
27
- "test": "mocha",
26
+ "test": "node --experimental-vm-modules ./node_modules/.bin/jest",
28
27
  "semantic-release": "semantic-release",
29
- "prepack": "npm run build"
28
+ "docs": "npx documentation build ./src/index.js -f html --github --config documentation.yml -a public --theme docs_theme/index.js -o docs && ./create_readme.sh",
29
+ "format": "npx prettier . --write",
30
+ "check:format": "npx prettier . --check"
30
31
  },
31
32
  "release": {
32
33
  "branches": [
@@ -53,10 +54,16 @@
53
54
  },
54
55
  "homepage": "https://github.com/FedericoTartarini/jsthermalcomfort#readme",
55
56
  "devDependencies": {
56
- "@types/chai": "^4.3.4",
57
- "@types/mocha": "^10.0.1",
58
- "chai": "^4.3.7",
59
- "mocha": "^10.2.0",
60
- "ts-node": "^10.9.1"
57
+ "documentation": "^14.0.2",
58
+ "github-slugger": "^2.0.0",
59
+ "highlight.js": "^11.8.0",
60
+ "jest": "^29.6.2",
61
+ "jsdoc": "^4.0.2",
62
+ "lodash": "^4.17.21",
63
+ "prettier": "3.0.2",
64
+ "typescript": "^5.1.6"
65
+ },
66
+ "dependencies": {
67
+ "mathjs": "^11.11.2"
61
68
  }
62
69
  }
package/lib/esm/index.mjs DELETED
@@ -1,430 +0,0 @@
1
- /**
2
- * Calculates vapour pressure of water at different temperatures
3
- * @param {number} tdb - air temperature, [°C]
4
- * @returns {number} - operative temperature, [Pa]
5
- */
6
- export function p_sat(tdb) {
7
- const c_to_k = 273.15;
8
- const ta_k = tdb + c_to_k;
9
- const c1 = -5674.5359;
10
- const c2 = 6.3925247;
11
- const c3 = -0.9677843 * Math.pow(10, -2);
12
- const c4 = 0.62215701 * Math.pow(10, -6);
13
- const c5 = 0.20747825 * Math.pow(10, -8);
14
- const c6 = -0.9484024 * Math.pow(10, -12);
15
- const c7 = 4.1635019;
16
- const c8 = -5800.2206;
17
- const c9 = 1.3914993;
18
- const c10 = -0.048640239;
19
- const c11 = 0.41764768 * Math.pow(10, -4);
20
- const c12 = -0.14452093 * Math.pow(10, -7);
21
- const c13 = 6.5459673;
22
- let pascals;
23
- if (ta_k < c_to_k) {
24
- pascals = Math.exp(c1 / ta_k +
25
- c2 +
26
- ta_k * (c3 + ta_k * (c4 + ta_k * (c5 + c6 * ta_k))) +
27
- c7 * Math.log(ta_k));
28
- }
29
- else {
30
- pascals = Math.exp(c8 / ta_k +
31
- c9 +
32
- ta_k * (c10 + ta_k * (c11 + ta_k * c12)) +
33
- c13 * Math.log(ta_k));
34
- }
35
- return Math.round(pascals * 10) / 10;
36
- }
37
- /**
38
- * Calculates the Heat Index (HI). It combines air temperature and relative humidity to determine an apparent temperature.
39
- *
40
- * @param tdb Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'.
41
- * @param rh Relative humidity, [%].
42
- * @param options (Optional) Other parameters.
43
- * @param options.round If True rounds output value, if False it does not round it.
44
- * @param options.units Select the SI (International System of Units) or the IP (Imperial Units) system.
45
- *
46
- * @returns Heat Index, default in [°C] in [°F] if `units` = 'IP'.
47
- *
48
- * @example
49
- * const hi = heatIndex(25, 50); // returns 25.9
50
- */
51
- export function heatIndex(tdb, rh, options = {}) {
52
- const defaultOptions = {
53
- round: true,
54
- units: "SI",
55
- };
56
- let round, units;
57
- let heatIndexOptions;
58
- // @ts-ignore
59
- heatIndexOptions = { round, units } = Object.assign(defaultOptions, options);
60
- let hi;
61
- if (units === "SI") {
62
- hi =
63
- -8.784695 +
64
- 1.61139411 * tdb +
65
- 2.338549 * rh -
66
- 0.14611605 * tdb * rh -
67
- 0.012308094 * Math.pow(tdb, 2) -
68
- 0.016424828 * Math.pow(rh, 2) +
69
- 0.002211732 * Math.pow(tdb, 2) * rh +
70
- 0.00072546 * tdb * Math.pow(rh, 2) -
71
- 0.000003582 * Math.pow(tdb, 2) * Math.pow(rh, 2);
72
- }
73
- else {
74
- hi =
75
- -42.379 +
76
- 2.04901523 * tdb +
77
- 10.14333127 * rh -
78
- 0.22475541 * tdb * rh -
79
- 0.00683783 * Math.pow(tdb, 2) -
80
- 0.05481717 * Math.pow(rh, 2) +
81
- 0.00122874 * Math.pow(tdb, 2) * rh +
82
- 0.00085282 * tdb * Math.pow(rh, 2) -
83
- 0.00000199 * Math.pow(tdb, 2) * Math.pow(rh, 2);
84
- }
85
- if (round) {
86
- return Math.round(hi * 10) / 10;
87
- }
88
- else {
89
- return hi;
90
- }
91
- }
92
- /**
93
- * Calculates the Predicted Heat Strain (PHS) index based in compliance with
94
- * the ISO 7933:2004 Standard [8]_. The ISO 7933 provides a method for the
95
- * analytical evaluation and interpretation of the thermal stress experienced
96
- * by a subject in a hot environment. It describes a method for predicting the
97
- * sweat rate and the internal core temperature that the human body will
98
- * develop in response to the working conditions.
99
- * The PHS model can be used to predict the: heat by respiratory convection, heat flow
100
- * by respiratory evaporation, steady state mean skin temperature, instantaneous value
101
- * of skin temperature, heat accumulation associated with the metabolic rate, maximum
102
- * evaporative heat flow at the skin surface, predicted sweat rate, predicted evaporative
103
- * heat flow, and rectal temperature.
104
- * @param {number} tdb - dry bulb air temperature, default in [°C]
105
- * @param {number} tr - mean radiant temperature, default in [°C]
106
- * @param {number} v - air speed, default in [m/s]
107
- * @param {number} rh - relative humidity, [%]
108
- * @param {number} met - metabolic rate, [W/(m2)]
109
- * @param {number} clo - clothing insulation, [clo]
110
- * @param {number} posture - a numeric value presenting posture of person [sitting=1, standing=2, crouching=3]
111
- * @param {number} wme - external work, [W/(m2)] default 0
112
- * @param {number} i_mst - static moisture permeability index, [dimensionless], default 0.38
113
- * @param {number} a_p - fraction of the body surface covered by the reflective clothing, [dimensionless], default 0.54
114
- * @param {number} drink - 1 if workers can drink freely, 0 otherwise, default 1
115
- * @param {number} weight - body weight, [kg], default 75
116
- * @param {number} height - height, [m], default 1.8
117
- * @param {number} walk_sp - walking speed, [m/s], default 0
118
- * @param {number} theta - angle between walking direction and wind direction [degrees], default 0
119
- * @param {number} acclimatized - 100 if acclimatised subject, 0 otherwise, default 100
120
- * @param {number} duration - duration of the work sequence, [minutes], default 480
121
- * @param {number} f_r - emissivity of the reflective clothing, [dimensionless], default 0.97
122
- * @param {number} t_sk - mean skin temperature when worker starts working, [°C], default 34.1
123
- * @param {number} t_cr - mean core temperature when worker starts working, [°C], default 36.8
124
- * @param {number} t_re - mean rectal temperature when worker starts working, [°C], default false
125
- * @param {number} t_cr_eq - mean core temperature as a function of met when worker starts working, [°C], default false
126
- * @param {number} sweat_rate - default 0
127
- * @returns {[number]} - an array of the following results:
128
- */
129
- export function phs(tdb, tr, rh, v, met, clo, posture, wme = 0, i_mst = 0.38, a_p = 0.54, drink = 1, weight = 75, height = 1.8, walk_sp = 0, theta = 0, acclimatized = 100, duration = 480, f_r = 0.97, t_sk = 34.1, t_cr = 36.8, t_re = 999, t_cr_eq = 999, t_sk_t_cr_wg = 0.3, sw_tot = 0, round = true) {
130
- const p_a = ((p_sat(tdb) / 1000) * rh) / 100;
131
- if (t_re == 999) {
132
- t_re = t_cr;
133
- }
134
- if (t_cr_eq == 999) {
135
- t_cr_eq = t_cr;
136
- }
137
- // DuBois body surface area [m2]
138
- const a_dubois = 0.202 * Math.pow(weight, 0.425) * Math.pow(height, 0.725);
139
- const sp_heat = (57.83 * weight) / a_dubois; // specific heat of the body
140
- let d_lim_t_re = 0; // maximum allowable exposure time for heat storage [min]
141
- // maximum allowable exposure time for water loss, mean subject [min]
142
- let d_lim_loss_50 = 0;
143
- // maximum allowable exposure time for water loss, 95 % of the working population [min]
144
- let d_lim_loss_95 = 0;
145
- // maximum water loss to protect a mean subject [g]
146
- const d_max_50 = 0.075 * weight * 1000;
147
- // maximum water loss to protect 95 % of the working population [g]
148
- const d_max_95 = 0.05 * weight * 1000;
149
- // exponential averaging constants
150
- const const_t_eq = Math.exp(-1 / 10);
151
- const const_t_sk = Math.exp(-1 / 3);
152
- const const_sw = Math.exp(-1 / 10);
153
- let sweat_rate = sw_tot;
154
- let def_dir = 0;
155
- if (theta !== 0) {
156
- // def_dir = 1 for unidirectional walking, def_dir = 0 for omni-directional walking
157
- def_dir = 1;
158
- }
159
- let def_speed = 0;
160
- if (walk_sp !== 0) {
161
- def_speed = 1;
162
- }
163
- // radiating area dubois
164
- let a_r_du = 0.7;
165
- if (posture === 2) {
166
- a_r_du = 0.77;
167
- }
168
- if (posture === 3) {
169
- a_r_du = 0.67;
170
- }
171
- // evaluation of the max sweat rate as a function of the metabolic rate
172
- let sw_max = (met - 32) * a_dubois;
173
- if (sw_max > 400) {
174
- sw_max = 400;
175
- }
176
- if (sw_max < 250) {
177
- sw_max = 250;
178
- }
179
- if (acclimatized >= 50) {
180
- sw_max = sw_max * 1.25;
181
- }
182
- // max skin wettedness
183
- let w_max = 0.85;
184
- if (acclimatized > 50) {
185
- w_max = 1;
186
- }
187
- // static clothing insulation
188
- const i_cl_st = clo * 0.155;
189
- const fcl = 1 + 0.3 * clo;
190
- // Static boundary layer thermal insulation in quiet air
191
- const i_a_st = 0.111;
192
- // Total static insulation
193
- const i_tot_st = i_cl_st + i_a_st / fcl;
194
- let v_r = v;
195
- if (def_speed > 0) {
196
- if (def_dir === 1) {
197
- // Unidirectional walking
198
- v_r = Math.abs(v - walk_sp * Math.cos((3.14159 * theta) / 180));
199
- }
200
- else {
201
- // Omni-directional walking IF
202
- if (v < walk_sp) {
203
- v_r = walk_sp;
204
- }
205
- else {
206
- v_r = v;
207
- }
208
- }
209
- }
210
- else {
211
- walk_sp = 0.0052 * (met - 58);
212
- if (walk_sp > 0.7) {
213
- walk_sp = 0.7;
214
- }
215
- v_r = v;
216
- }
217
- // Dynamic clothing insulation - correction for wind (Var) and walking speed
218
- let v_ux = v_r;
219
- if (v_r > 3) {
220
- v_ux = 3;
221
- }
222
- let w_a_ux = walk_sp;
223
- if (walk_sp > 1.5) {
224
- w_a_ux = 1.5;
225
- }
226
- // correction for the dynamic total dry thermal insulation at or above 0.6 clo
227
- let corr_cl = 1.044 *
228
- Math.exp((0.066 * v_ux - 0.398) * v_ux + (0.094 * w_a_ux - 0.378) * w_a_ux);
229
- if (corr_cl > 1) {
230
- corr_cl = 1;
231
- }
232
- // correction for the dynamic total dry thermal insulation at 0 clo
233
- let corr_ia = Math.exp((0.047 * v_r - 0.472) * v_r + (0.117 * w_a_ux - 0.342) * w_a_ux);
234
- if (corr_ia > 1) {
235
- corr_ia = 1;
236
- }
237
- let corr_tot = corr_cl;
238
- if (clo <= 0.6) {
239
- corr_tot = ((0.6 - clo) * corr_ia + clo * corr_cl) / 0.6;
240
- }
241
- // total dynamic clothing insulation
242
- let i_tot_dyn = i_tot_st * corr_tot;
243
- // dynamic boundary layer thermal insulation
244
- let i_a_dyn = corr_ia * i_a_st;
245
- let i_cl_dyn = i_tot_dyn - i_a_dyn / fcl;
246
- // correction for the dynamic permeability index
247
- let corr_e = (2.6 * corr_tot - 6.5) * corr_tot + 4.9;
248
- let im_dyn = i_mst * corr_e;
249
- if (im_dyn > 0.9) {
250
- im_dyn = 0.9;
251
- }
252
- let r_t_dyn = i_tot_dyn / im_dyn / 16.7;
253
- let t_exp = 28.56 + 0.115 * tdb + 0.641 * p_a; // expired air temperature
254
- // respiratory convective heat flow [W/m2]
255
- let c_res = 0.001516 * met * (t_exp - tdb);
256
- // respiratory evaporative heat flow [W/m2]
257
- let e_res = 0.00127 * met * (59.34 + 0.53 * tdb - 11.63 * p_a);
258
- let z = 3.5 + 5.2 * v_r;
259
- if (v_r > 1) {
260
- z = 8.7 * Math.pow(v_r, 0.6);
261
- }
262
- // Dynamic convective heat transfer coefficient
263
- let hc_dyn = 2.38 * Math.pow(Math.abs(t_sk - tdb), 0.25);
264
- if (z > hc_dyn) {
265
- hc_dyn = z;
266
- }
267
- let aux_r = 5.67e-8 * a_r_du;
268
- let f_cl_r = (1 - a_p) * 0.97 + a_p * f_r;
269
- let h_r;
270
- let t_cl;
271
- let t_cl_new;
272
- let sw_req;
273
- let e_v_eff;
274
- let k;
275
- let wp = 0;
276
- let e_p;
277
- let sw_tot_g = 0;
278
- for (let time = 1; time <= duration; time++) {
279
- const t_sk0 = t_sk;
280
- const t_re0 = t_re;
281
- const t_cr0 = t_cr;
282
- const t_cr_eq0 = t_cr_eq;
283
- const t_sk_t_cr_wg0 = t_sk_t_cr_wg;
284
- // equilibrium core temperature associated to the metabolic rate
285
- const t_cr_eq_m = 0.0036 * met + 36.6;
286
- // Core temperature at this minute, by exponential averaging
287
- t_cr_eq = t_cr_eq0 * const_t_eq + t_cr_eq_m * (1 - const_t_eq);
288
- // Heat storage associated with this core temperature increase during the last minute
289
- const d_stored_eq = sp_heat * (t_cr_eq - t_cr_eq0) * (1 - t_sk_t_cr_wg0);
290
- // skin temperature prediction -- clothed model
291
- let t_sk_eq_cl = 12.165 + 0.02017 * tdb + 0.04361 * tr + 0.19354 * p_a - 0.25315 * v;
292
- t_sk_eq_cl = t_sk_eq_cl + 0.005346 * met + 0.51274 * t_re;
293
- // nude model
294
- let t_sk_eq_nu = 7.191 + 0.064 * tdb + 0.061 * tr + 0.198 * p_a - 0.348 * v;
295
- t_sk_eq_nu = t_sk_eq_nu + 0.616 * t_re;
296
- let t_sk_eq = t_sk_eq_nu + 2.5 * (t_sk_eq_cl - t_sk_eq_nu) * (clo - 0.2);
297
- if (clo >= 0.6) {
298
- t_sk_eq = t_sk_eq_cl;
299
- }
300
- else if (clo <= 0.2) {
301
- t_sk_eq = t_sk_eq_nu;
302
- }
303
- // skin temperature [C]
304
- t_sk = t_sk0 * const_t_sk + t_sk_eq * (1 - const_t_sk);
305
- // Saturated water vapour pressure at the surface of the skin
306
- const p_sk = 0.6105 * Math.exp((17.27 * t_sk) / (t_sk + 237.3));
307
- t_cl = tr + 0.1; // clothing surface temperature
308
- while (true) {
309
- // radiative heat transfer coefficient
310
- h_r =
311
- (f_cl_r * aux_r * (Math.pow(t_cl + 273, 4) - Math.pow(tr + 273, 4))) /
312
- (t_cl - tr);
313
- let t_cl_new = (fcl * (hc_dyn * tdb + h_r * tr) + t_sk / i_cl_dyn) /
314
- (fcl * (hc_dyn + h_r) + 1 / i_cl_dyn);
315
- if (Math.abs(t_cl - t_cl_new) <= 0.001) {
316
- break;
317
- }
318
- t_cl = (t_cl + t_cl_new) / 2;
319
- }
320
- let convection = fcl * hc_dyn * (t_cl - tdb);
321
- let radiation = fcl * h_r * (t_cl - tr);
322
- // maximum evaporative heat flow at the skin surface [W/m2]
323
- let e_max = (p_sk - p_a) / r_t_dyn;
324
- // required evaporative heat flow [W/m2]
325
- let e_req = met - d_stored_eq - wme - c_res - e_res - convection - radiation;
326
- // required skin wettedness
327
- let w_req = e_req / e_max;
328
- if (e_req <= 0) {
329
- e_req = 0;
330
- sw_req = 0; // required sweat rate [W/m2]
331
- }
332
- else if (e_max <= 0) {
333
- e_max = 0;
334
- sw_req = sw_max;
335
- }
336
- else if (w_req >= 1.7) {
337
- sw_req = sw_max;
338
- }
339
- else {
340
- e_v_eff = 1 - Math.pow(w_req, 2) / 2;
341
- if (w_req > 1) {
342
- e_v_eff = Math.pow(2 - w_req, 2) / 2;
343
- }
344
- sw_req = e_req / e_v_eff;
345
- if (sw_req > sw_max) {
346
- sw_req = sw_max;
347
- }
348
- }
349
- sweat_rate = sweat_rate * const_sw + sw_req * (1 - const_sw);
350
- if (sweat_rate <= 0) {
351
- e_p = 0; // predicted evaporative heat flow [W/m2]
352
- sweat_rate = 0;
353
- }
354
- else {
355
- k = e_max / sweat_rate;
356
- wp = 1;
357
- if (k >= 0.5) {
358
- wp = -k + Math.sqrt(k * k + 2);
359
- }
360
- if (wp > w_max) {
361
- wp = w_max;
362
- }
363
- e_p = wp * e_max;
364
- }
365
- // body heat storage rate [W/m2]
366
- let d_storage = e_req - e_p + d_stored_eq;
367
- let t_cr_new = t_cr0;
368
- while (true) {
369
- t_sk_t_cr_wg = 0.3 - 0.09 * (t_cr_new - 36.8);
370
- if (t_sk_t_cr_wg > 0.3) {
371
- t_sk_t_cr_wg = 0.3;
372
- }
373
- if (t_sk_t_cr_wg < 0.1) {
374
- t_sk_t_cr_wg = 0.1;
375
- }
376
- t_cr =
377
- d_storage / sp_heat +
378
- (t_sk0 * t_sk_t_cr_wg0) / 2 -
379
- (t_sk * t_sk_t_cr_wg) / 2;
380
- t_cr = (t_cr + t_cr0 * (1 - t_sk_t_cr_wg0 / 2)) / (1 - t_sk_t_cr_wg / 2);
381
- if (Math.abs(t_cr - t_cr_new) <= 0.001) {
382
- break;
383
- }
384
- t_cr_new = (t_cr_new + t_cr) / 2;
385
- }
386
- t_re = t_re0 + (2 * t_cr - 1.962 * t_re0 - 1.31) / 9;
387
- if (d_lim_t_re == 0 && t_re >= 38) {
388
- d_lim_t_re = time;
389
- }
390
- sw_tot = sw_tot + sweat_rate + e_res;
391
- sw_tot_g = (sw_tot * 2.67 * a_dubois) / 1.8 / 60;
392
- if (d_lim_loss_50 == 0 && sw_tot_g >= d_max_50) {
393
- d_lim_loss_50 = time;
394
- }
395
- if (d_lim_loss_95 == 0 && sw_tot_g >= d_max_95) {
396
- d_lim_loss_95 = time;
397
- }
398
- if (drink == 0) {
399
- d_lim_loss_95 = d_lim_loss_95 * 0.6;
400
- d_lim_loss_50 = d_lim_loss_95;
401
- }
402
- }
403
- if (d_lim_loss_50 == 0) {
404
- d_lim_loss_50 = duration;
405
- }
406
- if (d_lim_loss_95 == 0) {
407
- d_lim_loss_95 = duration;
408
- }
409
- if (d_lim_t_re == 0) {
410
- d_lim_t_re = duration;
411
- }
412
- return {
413
- t_re: round ? Math.round(t_re * 10) / 10 : t_re,
414
- t_sk: round ? Math.round(t_sk * 10) / 10 : t_sk,
415
- t_cr: round ? Math.round(t_cr * 10) / 10 : t_cr,
416
- t_cr_eq: round ? Math.round(t_cr_eq * 10) / 10 : t_cr_eq,
417
- t_sk_t_cr_wg: round ? Math.round(t_sk_t_cr_wg * 100) / 100 : t_sk_t_cr_wg,
418
- sweat_rate: round ? Math.round(sweat_rate * 10) / 10 : sweat_rate,
419
- sw_tot_g: round ? Math.round(sw_tot_g * 10) / 10 : sw_tot_g,
420
- d_lim_loss_50: round ? Math.round(d_lim_loss_50 * 10) / 10 : d_lim_loss_50,
421
- d_lim_loss_95: round ? Math.round(d_lim_loss_95 * 10) / 10 : d_lim_loss_95,
422
- d_lim_t_re: round ? Math.round(d_lim_t_re * 10) / 10 : d_lim_t_re,
423
- wp: round ? Math.round(wp * 100) / 100 : wp,
424
- };
425
- }
426
- export default {
427
- heatIndex,
428
- phs,
429
- p_sat,
430
- };