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.
- package/README.md +196 -6
- package/lib/cjs/index.js +7 -434
- package/lib/cjs/models/a_pmv.js +140 -0
- package/lib/cjs/models/adaptive_ashrae.js +290 -0
- package/lib/cjs/models/adaptive_en.js +300 -0
- package/lib/cjs/models/ankle_draft.js +82 -0
- package/lib/cjs/models/at.js +52 -0
- package/lib/cjs/models/athb.js +135 -0
- package/lib/cjs/models/clo_tout.js +58 -0
- package/lib/cjs/models/cooling_effect.js +164 -0
- package/lib/cjs/models/discomfort_index.js +115 -0
- package/lib/cjs/models/e_pmv.js +154 -0
- package/lib/cjs/models/heat_index.js +60 -0
- package/lib/cjs/models/humidex.js +63 -0
- package/lib/cjs/models/index.js +71 -0
- package/lib/cjs/models/net.js +50 -0
- package/lib/cjs/models/pet_steady.js +443 -0
- package/lib/cjs/models/phs.js +458 -0
- package/lib/cjs/models/pmv.js +200 -0
- package/lib/cjs/models/pmv_ppd.js +404 -0
- package/lib/cjs/models/set_tmp.js +203 -0
- package/lib/cjs/models/solar_gain.js +163 -0
- package/lib/cjs/models/two_nodes.js +790 -0
- package/lib/cjs/models/use_fans_heatwave.js +203 -0
- package/lib/cjs/models/utci.js +609 -0
- package/lib/cjs/models/vertical_tmp_grad_ppd.js +95 -0
- package/lib/cjs/models/wbgt.js +72 -0
- package/lib/cjs/models/wc.js +37 -0
- package/lib/cjs/psychrometrics/enthalpy.js +24 -0
- package/lib/cjs/psychrometrics/index.js +28 -0
- package/lib/cjs/psychrometrics/p_sat.js +46 -0
- package/lib/cjs/psychrometrics/p_sat_torr.js +34 -0
- package/lib/cjs/psychrometrics/psy_ta_rh.js +51 -0
- package/lib/cjs/psychrometrics/t_dp.js +19 -0
- package/lib/cjs/psychrometrics/t_mrt.js +117 -0
- package/lib/cjs/psychrometrics/t_o.js +82 -0
- package/lib/cjs/psychrometrics/t_wb.js +23 -0
- package/lib/cjs/types/index.d.ts +7 -79
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/models/a_pmv.d.ts +133 -0
- package/lib/cjs/types/models/a_pmv.d.ts.map +1 -0
- package/lib/cjs/types/models/adaptive_ashrae.d.ts +211 -0
- package/lib/cjs/types/models/adaptive_ashrae.d.ts.map +1 -0
- package/lib/cjs/types/models/adaptive_en.d.ts +217 -0
- package/lib/cjs/types/models/adaptive_en.d.ts.map +1 -0
- package/lib/cjs/types/models/ankle_draft.d.ts +60 -0
- package/lib/cjs/types/models/ankle_draft.d.ts.map +1 -0
- package/lib/cjs/types/models/at.d.ts +34 -0
- package/lib/cjs/types/models/at.d.ts.map +1 -0
- package/lib/cjs/types/models/athb.d.ts +96 -0
- package/lib/cjs/types/models/athb.d.ts.map +1 -0
- package/lib/cjs/types/models/clo_tout.d.ts +45 -0
- package/lib/cjs/types/models/clo_tout.d.ts.map +1 -0
- package/lib/cjs/types/models/cooling_effect.d.ts +49 -0
- package/lib/cjs/types/models/cooling_effect.d.ts.map +1 -0
- package/lib/cjs/types/models/discomfort_index.d.ts +91 -0
- package/lib/cjs/types/models/discomfort_index.d.ts.map +1 -0
- package/lib/cjs/types/models/e_pmv.d.ts +139 -0
- package/lib/cjs/types/models/e_pmv.d.ts.map +1 -0
- package/lib/cjs/types/models/heat_index.d.ts +27 -0
- package/lib/cjs/types/models/heat_index.d.ts.map +1 -0
- package/lib/cjs/types/models/humidex.d.ts +54 -0
- package/lib/cjs/types/models/humidex.d.ts.map +1 -0
- package/lib/cjs/types/models/index.d.ts +78 -0
- package/lib/cjs/types/models/index.d.ts.map +1 -0
- package/lib/cjs/types/models/net.d.ts +39 -0
- package/lib/cjs/types/models/net.d.ts.map +1 -0
- package/lib/cjs/types/models/pet_steady.d.ts +59 -0
- package/lib/cjs/types/models/pet_steady.d.ts.map +1 -0
- package/lib/cjs/types/models/phs.d.ts +242 -0
- package/lib/cjs/types/models/phs.d.ts.map +1 -0
- package/lib/cjs/types/models/pmv.d.ts +198 -0
- package/lib/cjs/types/models/pmv.d.ts.map +1 -0
- package/lib/cjs/types/models/pmv_ppd.d.ts +246 -0
- package/lib/cjs/types/models/pmv_ppd.d.ts.map +1 -0
- package/lib/cjs/types/models/set_tmp.d.ts +124 -0
- package/lib/cjs/types/models/set_tmp.d.ts.map +1 -0
- package/lib/cjs/types/models/solar_gain.d.ts +76 -0
- package/lib/cjs/types/models/solar_gain.d.ts.map +1 -0
- package/lib/cjs/types/models/two_nodes.d.ts +412 -0
- package/lib/cjs/types/models/two_nodes.d.ts.map +1 -0
- package/lib/cjs/types/models/use_fans_heatwave.d.ts +188 -0
- package/lib/cjs/types/models/use_fans_heatwave.d.ts.map +1 -0
- package/lib/cjs/types/models/utci.d.ts +79 -0
- package/lib/cjs/types/models/utci.d.ts.map +1 -0
- package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts +58 -0
- package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -0
- package/lib/cjs/types/models/wbgt.d.ts +51 -0
- package/lib/cjs/types/models/wbgt.d.ts.map +1 -0
- package/lib/cjs/types/models/wc.d.ts +29 -0
- package/lib/cjs/types/models/wc.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/enthalpy.d.ts +12 -0
- package/lib/cjs/types/psychrometrics/enthalpy.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/index.d.ts +26 -0
- package/lib/cjs/types/psychrometrics/index.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/p_sat.d.ts +13 -0
- package/lib/cjs/types/psychrometrics/p_sat.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts +26 -0
- package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts +51 -0
- package/lib/cjs/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_dp.d.ts +9 -0
- package/lib/cjs/types/psychrometrics/t_dp.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_mrt.d.ts +43 -0
- package/lib/cjs/types/psychrometrics/t_mrt.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_o.d.ts +31 -0
- package/lib/cjs/types/psychrometrics/t_o.d.ts.map +1 -0
- package/lib/cjs/types/psychrometrics/t_wb.d.ts +12 -0
- package/lib/cjs/types/psychrometrics/t_wb.d.ts.map +1 -0
- package/lib/cjs/types/utilities/index.d.ts +28 -0
- package/lib/cjs/types/utilities/index.d.ts.map +1 -0
- package/lib/cjs/types/utilities/utilities.d.ts +377 -0
- package/lib/cjs/types/utilities/utilities.d.ts.map +1 -0
- package/lib/cjs/utilities/index.js +27 -0
- package/lib/cjs/utilities/utilities.js +903 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/models/a_pmv.js +135 -0
- package/lib/esm/models/adaptive_ashrae.js +285 -0
- package/lib/esm/models/adaptive_en.js +294 -0
- package/lib/esm/models/ankle_draft.js +78 -0
- package/lib/esm/models/at.js +48 -0
- package/lib/esm/models/athb.js +130 -0
- package/lib/esm/models/clo_tout.js +53 -0
- package/lib/esm/models/cooling_effect.js +159 -0
- package/lib/esm/models/discomfort_index.js +110 -0
- package/lib/esm/models/e_pmv.js +149 -0
- package/lib/esm/models/heat_index.js +56 -0
- package/lib/esm/models/humidex.js +59 -0
- package/lib/esm/models/index.js +69 -0
- package/lib/esm/models/net.js +46 -0
- package/lib/esm/models/pet_steady.js +439 -0
- package/lib/esm/models/phs.js +454 -0
- package/lib/esm/models/pmv.js +195 -0
- package/lib/esm/models/pmv_ppd.js +398 -0
- package/lib/esm/models/set_tmp.js +198 -0
- package/lib/esm/models/solar_gain.js +158 -0
- package/lib/esm/models/two_nodes.js +784 -0
- package/lib/esm/models/use_fans_heatwave.js +199 -0
- package/lib/esm/models/utci.js +604 -0
- package/lib/esm/models/wbgt.js +68 -0
- package/lib/esm/models/wc.js +33 -0
- package/lib/esm/psychrometrics/enthalpy.js +20 -0
- package/lib/esm/psychrometrics/index.js +26 -0
- package/lib/esm/psychrometrics/p_sat.js +42 -0
- package/lib/esm/psychrometrics/p_sat_torr.js +29 -0
- package/lib/esm/psychrometrics/psy_ta_rh.js +47 -0
- package/lib/esm/psychrometrics/t_dp.js +15 -0
- package/lib/esm/psychrometrics/t_mrt.js +112 -0
- package/lib/esm/psychrometrics/t_o.js +77 -0
- package/lib/esm/psychrometrics/t_wb.js +19 -0
- package/lib/esm/types/index.d.ts +7 -79
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/models/a_pmv.d.ts +133 -0
- package/lib/esm/types/models/a_pmv.d.ts.map +1 -0
- package/lib/esm/types/models/adaptive_ashrae.d.ts +211 -0
- package/lib/esm/types/models/adaptive_ashrae.d.ts.map +1 -0
- package/lib/esm/types/models/adaptive_en.d.ts +217 -0
- package/lib/esm/types/models/adaptive_en.d.ts.map +1 -0
- package/lib/esm/types/models/ankle_draft.d.ts +60 -0
- package/lib/esm/types/models/ankle_draft.d.ts.map +1 -0
- package/lib/esm/types/models/at.d.ts +34 -0
- package/lib/esm/types/models/at.d.ts.map +1 -0
- package/lib/esm/types/models/athb.d.ts +96 -0
- package/lib/esm/types/models/athb.d.ts.map +1 -0
- package/lib/esm/types/models/clo_tout.d.ts +45 -0
- package/lib/esm/types/models/clo_tout.d.ts.map +1 -0
- package/lib/esm/types/models/cooling_effect.d.ts +49 -0
- package/lib/esm/types/models/cooling_effect.d.ts.map +1 -0
- package/lib/esm/types/models/discomfort_index.d.ts +91 -0
- package/lib/esm/types/models/discomfort_index.d.ts.map +1 -0
- package/lib/esm/types/models/e_pmv.d.ts +139 -0
- package/lib/esm/types/models/e_pmv.d.ts.map +1 -0
- package/lib/esm/types/models/heat_index.d.ts +27 -0
- package/lib/esm/types/models/heat_index.d.ts.map +1 -0
- package/lib/esm/types/models/humidex.d.ts +54 -0
- package/lib/esm/types/models/humidex.d.ts.map +1 -0
- package/lib/esm/types/models/index.d.ts +77 -0
- package/lib/esm/types/models/index.d.ts.map +1 -0
- package/lib/esm/types/models/net.d.ts +39 -0
- package/lib/esm/types/models/net.d.ts.map +1 -0
- package/lib/esm/types/models/pet_steady.d.ts +59 -0
- package/lib/esm/types/models/pet_steady.d.ts.map +1 -0
- package/lib/esm/types/models/phs.d.ts +242 -0
- package/lib/esm/types/models/phs.d.ts.map +1 -0
- package/lib/esm/types/models/pmv.d.ts +198 -0
- package/lib/esm/types/models/pmv.d.ts.map +1 -0
- package/lib/esm/types/models/pmv_ppd.d.ts +246 -0
- package/lib/esm/types/models/pmv_ppd.d.ts.map +1 -0
- package/lib/esm/types/models/set_tmp.d.ts +124 -0
- package/lib/esm/types/models/set_tmp.d.ts.map +1 -0
- package/lib/esm/types/models/solar_gain.d.ts +76 -0
- package/lib/esm/types/models/solar_gain.d.ts.map +1 -0
- package/lib/esm/types/models/two_nodes.d.ts +412 -0
- package/lib/esm/types/models/two_nodes.d.ts.map +1 -0
- package/lib/esm/types/models/use_fans_heatwave.d.ts +188 -0
- package/lib/esm/types/models/use_fans_heatwave.d.ts.map +1 -0
- package/lib/esm/types/models/utci.d.ts +79 -0
- package/lib/esm/types/models/utci.d.ts.map +1 -0
- package/lib/esm/types/models/wbgt.d.ts +51 -0
- package/lib/esm/types/models/wbgt.d.ts.map +1 -0
- package/lib/esm/types/models/wc.d.ts +29 -0
- package/lib/esm/types/models/wc.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/enthalpy.d.ts +12 -0
- package/lib/esm/types/psychrometrics/enthalpy.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/index.d.ts +26 -0
- package/lib/esm/types/psychrometrics/index.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/p_sat.d.ts +13 -0
- package/lib/esm/types/psychrometrics/p_sat.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/p_sat_torr.d.ts +26 -0
- package/lib/esm/types/psychrometrics/p_sat_torr.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts +51 -0
- package/lib/esm/types/psychrometrics/psy_ta_rh.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_dp.d.ts +9 -0
- package/lib/esm/types/psychrometrics/t_dp.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_mrt.d.ts +43 -0
- package/lib/esm/types/psychrometrics/t_mrt.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_o.d.ts +31 -0
- package/lib/esm/types/psychrometrics/t_o.d.ts.map +1 -0
- package/lib/esm/types/psychrometrics/t_wb.d.ts +12 -0
- package/lib/esm/types/psychrometrics/t_wb.d.ts.map +1 -0
- package/lib/esm/types/utilities/index.d.ts +28 -0
- package/lib/esm/types/utilities/index.d.ts.map +1 -0
- package/lib/esm/types/utilities/utilities.d.ts +377 -0
- package/lib/esm/types/utilities/utilities.d.ts.map +1 -0
- package/lib/esm/utilities/index.js +25 -0
- package/lib/esm/utilities/utilities.js +885 -0
- package/package.json +22 -15
- package/lib/esm/index.mjs +0 -430
package/README.md
CHANGED
|
@@ -1,9 +1,199 @@
|
|
|
1
|
-
#
|
|
2
|
-
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).
|
|
1
|
+
# Overview
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
| docs | [][docs_link] |
|
|
4
|
+
| :-----------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
5
|
+
| **build** | [][build_link] |
|
|
6
|
+
| **tests** | [][test_link] |
|
|
7
|
+
| **page deployment** | [][deploy_link] |
|
|
8
|
+
| **snyk security** | [][synk_link] |
|
|
9
|
+
| **license** | [](https://github.com/FedericoTartarini/jsthermalcomfort/blob/main/LICENSE) |
|
|
10
|
+
| **npm version** | [][npm_link] |
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
Package to calculate several thermal comfort indices (e.g. PMV, PPD, SET, adaptive) and convert physical variables.
|
|
13
|
+
|
|
14
|
+
Please cite us if you use this package: [Tartarini, F., Schiavon, S., 2020. pythermalcomfort: A Python package for thermal comfort research. SoftwareX 12, 100578. https://doi.org/10.1016/j.softx.2020.100578](https://www.sciencedirect.com/science/article/pii/S2352711020302910)
|
|
15
|
+
|
|
16
|
+
- Free software: MIT license
|
|
17
|
+
- Authors: [Omar Jesus Acuache Briceno](https://www.linkedin.com/in/omar-acuache), [Ruoshui Chen](https://github.com/ChristinChen233), [Jingyu Lu](https://github.com/Lu-Whale), [Yuchen Mu](https://github.com/YuchenMu), [Jordan Ocokoljic](https://github.com/JordanOcokoljic), [Santiago Zaldivar del Alba](https://github.com/szaldivar)
|
|
18
|
+
|
|
19
|
+
[docs_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/test_docs.yml
|
|
20
|
+
[build_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/build.yml
|
|
21
|
+
[test_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/test.yml
|
|
22
|
+
[deploy_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/pages/pages-build-deployment
|
|
23
|
+
[synk_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/snyk.yml
|
|
24
|
+
[npm_link]: https://www.npmjs.com/package/jsthermalcomfort
|
|
25
|
+
|
|
26
|
+
# Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
8
29
|
npm install jsthermalcomfort
|
|
9
|
-
```
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
if you want to use jsthermalcomfort package without installing it on your local machine, you can import with:
|
|
33
|
+
|
|
34
|
+
[`https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/`](https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/)
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import {
|
|
40
|
+
models,
|
|
41
|
+
utilities,
|
|
42
|
+
pschymetrics,
|
|
43
|
+
} from "https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/index.js";
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also import it in the website directly, and caution that you need to mark the script as module:
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<script type="module">
|
|
50
|
+
import {
|
|
51
|
+
models,
|
|
52
|
+
utilities,
|
|
53
|
+
pschymetrics,
|
|
54
|
+
} from "https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/index.js";
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
# Examples and Tutorials
|
|
59
|
+
|
|
60
|
+
## [Examples](https://github.com/FedericoTartarini/jsthermalcomfort/tree/main/docs/examples) files on how to use some of the functions
|
|
61
|
+
|
|
62
|
+
Here is a list of examples running in the browser:
|
|
63
|
+
|
|
64
|
+
- [PHS](/jsthermalcomfort/examples/phs.html)
|
|
65
|
+
|
|
66
|
+
# Contributing
|
|
67
|
+
|
|
68
|
+
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
|
|
69
|
+
|
|
70
|
+
## Bug reports
|
|
71
|
+
|
|
72
|
+
When [reporting a bug](https://github.com/FedericoTartarini/jsthermalcomfort/issues) please include:
|
|
73
|
+
|
|
74
|
+
- Your operating system name and version.
|
|
75
|
+
- Any details about your local setup that might be helpful in troubleshooting.
|
|
76
|
+
- Detailed steps to reproduce the bug.
|
|
77
|
+
|
|
78
|
+
## Documentation improvements
|
|
79
|
+
|
|
80
|
+
jsthermalcomfort could always use more documentation, whether as part of the official jsthermalcomfort docs, in JSDocs, or even on the web in blog posts, articles, and such.
|
|
81
|
+
|
|
82
|
+
## Feature requests and feedback
|
|
83
|
+
|
|
84
|
+
The best way to send feedback is to file an issue at [https://github.com/FedericoTartarini/jsthermalcomfort/issues](https://github.com/FedericoTartarini/jsthermalcomfort/issues)
|
|
85
|
+
|
|
86
|
+
If you are proposing a feature:
|
|
87
|
+
|
|
88
|
+
- Explain in detail how it would work.
|
|
89
|
+
- Keep the scope as narrow as possible, to make it easier to implement.
|
|
90
|
+
- Remember that this is a volunteer-driven project, and that code contributions are welcome :)
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
To set up jsthermalcomfort for local development:
|
|
95
|
+
|
|
96
|
+
1. Fork jsthermalcomfort (look for the “Fork” button).
|
|
97
|
+
2. Clone your fork locally. Fetch and pull all the updates from the master branch before you do anything:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone git@github.com:FedericoTartarini/jsthermalcomfort.git
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
3. Create a branch for local development. The naming rule for new branch are, as follows:
|
|
104
|
+
|
|
105
|
+
- If this update is for a new feature Feature/feature_name_here
|
|
106
|
+
- If this update is for bug fix Fix/bug_name_here
|
|
107
|
+
- If this update is for documentation Documentation/doc_name_here
|
|
108
|
+
|
|
109
|
+
You can create a branch locally using the following command. Make sure you only push updates to this new branch only:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git checkout -b name-of-your-bugfix-or-feature
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Now you can make your changes locally.
|
|
116
|
+
|
|
117
|
+
4. When you’re done making changes run all tests using Jest:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run test
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
- Run prettier to format your code:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm run format
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- Commit your changes:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git add .
|
|
133
|
+
git commit -m "Your detailed description of your changes."
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- Update the docs:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm run docs
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- Commit your documentation changes:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git add .
|
|
146
|
+
git commit -m "Your detailed description of your changes."
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- Push your branch to GitHub:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
git push origin name-of-your-bugfix-or-feature
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
5. Submit a pull request after you have done all your modifications and tested your work. The pull request should include a detailed description of your work:
|
|
156
|
+
- What this pull request is about
|
|
157
|
+
- Have you tested your work
|
|
158
|
+
- Will this work affect other component in the product
|
|
159
|
+
|
|
160
|
+
### Pull Request Guidelines
|
|
161
|
+
|
|
162
|
+
If you need some code review or feedback while you’re developing the code just make the pull request.
|
|
163
|
+
|
|
164
|
+
For merging, you should:
|
|
165
|
+
|
|
166
|
+
- Include passing tests (run `npm run test`).
|
|
167
|
+
- Update documentation when there’s new API, functionality etc.
|
|
168
|
+
|
|
169
|
+
### Documentation
|
|
170
|
+
|
|
171
|
+
We are using [JSDoc](https://jsdoc.app/) and [documentation.js](https://github.com/documentationjs/documentation) to automatically build the documentation.
|
|
172
|
+
|
|
173
|
+
### To add a function
|
|
174
|
+
|
|
175
|
+
1. Add a file under `src/models/` with the name of the function/model and document it.
|
|
176
|
+
2. Add any related functions that are used by your function either in `src/utilities/utilities.js` or `src/psychrometrics/`. See existing code as example.
|
|
177
|
+
- In order to add a new function/API to the library you should mark that function as `@public`, add it to its corresponding category, for example for models you should do `@memberof models`, and lastly you should give it a proper name for the documentation with `@docname`, for example: `@docname Clothing prediction`. It is important to note that you should also add the `@public` tag to any types the function exposes/uses.
|
|
178
|
+
3. Test your function by writing a test in `tests/models/<name_of_model>.test.js`.
|
|
179
|
+
|
|
180
|
+
### Tips
|
|
181
|
+
|
|
182
|
+
To run a subset of tests you can do the following:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npm run test -- '<path_to_test_file>' -t '<test_pattern/name>'
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If you are using VSCode you can use the [Jest Runner extension](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to easily run subset of tests.
|
|
189
|
+
|
|
190
|
+
### Releases
|
|
191
|
+
|
|
192
|
+
To create a new release do the following:
|
|
193
|
+
|
|
194
|
+
1. Update the `package.json` version to the new version (we use the semantic release system for versioning)
|
|
195
|
+
2. Run `npm run build` to update the `lib` directory (output with types of the library that gets published to NPM) and commit the updates
|
|
196
|
+
3. In GitHub go to Releases -> click `Draft a new release`
|
|
197
|
+
4. Click `Choose a tag` and type the new version, for example `v0.1,1`
|
|
198
|
+
5. Write the title and description and click `Publish release`
|
|
199
|
+
6. This will trigger a GitHub action that will publish the new version to NPM
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,436 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Calculates vapour pressure of water at different temperatures
|
|
6
|
-
* @param {number} tdb - air temperature, [°C]
|
|
7
|
-
* @returns {number} - operative temperature, [Pa]
|
|
8
|
-
*/
|
|
9
|
-
function p_sat(tdb) {
|
|
10
|
-
const c_to_k = 273.15;
|
|
11
|
-
const ta_k = tdb + c_to_k;
|
|
12
|
-
const c1 = -5674.5359;
|
|
13
|
-
const c2 = 6.3925247;
|
|
14
|
-
const c3 = -0.9677843 * Math.pow(10, -2);
|
|
15
|
-
const c4 = 0.62215701 * Math.pow(10, -6);
|
|
16
|
-
const c5 = 0.20747825 * Math.pow(10, -8);
|
|
17
|
-
const c6 = -0.9484024 * Math.pow(10, -12);
|
|
18
|
-
const c7 = 4.1635019;
|
|
19
|
-
const c8 = -5800.2206;
|
|
20
|
-
const c9 = 1.3914993;
|
|
21
|
-
const c10 = -0.048640239;
|
|
22
|
-
const c11 = 0.41764768 * Math.pow(10, -4);
|
|
23
|
-
const c12 = -0.14452093 * Math.pow(10, -7);
|
|
24
|
-
const c13 = 6.5459673;
|
|
25
|
-
let pascals;
|
|
26
|
-
if (ta_k < c_to_k) {
|
|
27
|
-
pascals = Math.exp(c1 / ta_k +
|
|
28
|
-
c2 +
|
|
29
|
-
ta_k * (c3 + ta_k * (c4 + ta_k * (c5 + c6 * ta_k))) +
|
|
30
|
-
c7 * Math.log(ta_k));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
pascals = Math.exp(c8 / ta_k +
|
|
34
|
-
c9 +
|
|
35
|
-
ta_k * (c10 + ta_k * (c11 + ta_k * c12)) +
|
|
36
|
-
c13 * Math.log(ta_k));
|
|
37
|
-
}
|
|
38
|
-
return Math.round(pascals * 10) / 10;
|
|
39
|
-
}
|
|
40
|
-
exports.p_sat = p_sat;
|
|
41
|
-
/**
|
|
42
|
-
* Calculates the Heat Index (HI). It combines air temperature and relative humidity to determine an apparent temperature.
|
|
43
|
-
*
|
|
44
|
-
* @param tdb Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'.
|
|
45
|
-
* @param rh Relative humidity, [%].
|
|
46
|
-
* @param options (Optional) Other parameters.
|
|
47
|
-
* @param options.round If True rounds output value, if False it does not round it.
|
|
48
|
-
* @param options.units Select the SI (International System of Units) or the IP (Imperial Units) system.
|
|
49
|
-
*
|
|
50
|
-
* @returns Heat Index, default in [°C] in [°F] if `units` = 'IP'.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* const hi = heatIndex(25, 50); // returns 25.9
|
|
54
|
-
*/
|
|
55
|
-
function heatIndex(tdb, rh, options = {}) {
|
|
56
|
-
const defaultOptions = {
|
|
57
|
-
round: true,
|
|
58
|
-
units: "SI",
|
|
59
|
-
};
|
|
60
|
-
let round, units;
|
|
61
|
-
let heatIndexOptions;
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
heatIndexOptions = { round, units } = Object.assign(defaultOptions, options);
|
|
64
|
-
let hi;
|
|
65
|
-
if (units === "SI") {
|
|
66
|
-
hi =
|
|
67
|
-
-8.784695 +
|
|
68
|
-
1.61139411 * tdb +
|
|
69
|
-
2.338549 * rh -
|
|
70
|
-
0.14611605 * tdb * rh -
|
|
71
|
-
0.012308094 * Math.pow(tdb, 2) -
|
|
72
|
-
0.016424828 * Math.pow(rh, 2) +
|
|
73
|
-
0.002211732 * Math.pow(tdb, 2) * rh +
|
|
74
|
-
0.00072546 * tdb * Math.pow(rh, 2) -
|
|
75
|
-
0.000003582 * Math.pow(tdb, 2) * Math.pow(rh, 2);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
hi =
|
|
79
|
-
-42.379 +
|
|
80
|
-
2.04901523 * tdb +
|
|
81
|
-
10.14333127 * rh -
|
|
82
|
-
0.22475541 * tdb * rh -
|
|
83
|
-
0.00683783 * Math.pow(tdb, 2) -
|
|
84
|
-
0.05481717 * Math.pow(rh, 2) +
|
|
85
|
-
0.00122874 * Math.pow(tdb, 2) * rh +
|
|
86
|
-
0.00085282 * tdb * Math.pow(rh, 2) -
|
|
87
|
-
0.00000199 * Math.pow(tdb, 2) * Math.pow(rh, 2);
|
|
88
|
-
}
|
|
89
|
-
if (round) {
|
|
90
|
-
return Math.round(hi * 10) / 10;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
return hi;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.heatIndex = heatIndex;
|
|
97
|
-
/**
|
|
98
|
-
* Calculates the Predicted Heat Strain (PHS) index based in compliance with
|
|
99
|
-
* the ISO 7933:2004 Standard [8]_. The ISO 7933 provides a method for the
|
|
100
|
-
* analytical evaluation and interpretation of the thermal stress experienced
|
|
101
|
-
* by a subject in a hot environment. It describes a method for predicting the
|
|
102
|
-
* sweat rate and the internal core temperature that the human body will
|
|
103
|
-
* develop in response to the working conditions.
|
|
104
|
-
* The PHS model can be used to predict the: heat by respiratory convection, heat flow
|
|
105
|
-
* by respiratory evaporation, steady state mean skin temperature, instantaneous value
|
|
106
|
-
* of skin temperature, heat accumulation associated with the metabolic rate, maximum
|
|
107
|
-
* evaporative heat flow at the skin surface, predicted sweat rate, predicted evaporative
|
|
108
|
-
* heat flow, and rectal temperature.
|
|
109
|
-
* @param {number} tdb - dry bulb air temperature, default in [°C]
|
|
110
|
-
* @param {number} tr - mean radiant temperature, default in [°C]
|
|
111
|
-
* @param {number} v - air speed, default in [m/s]
|
|
112
|
-
* @param {number} rh - relative humidity, [%]
|
|
113
|
-
* @param {number} met - metabolic rate, [W/(m2)]
|
|
114
|
-
* @param {number} clo - clothing insulation, [clo]
|
|
115
|
-
* @param {number} posture - a numeric value presenting posture of person [sitting=1, standing=2, crouching=3]
|
|
116
|
-
* @param {number} wme - external work, [W/(m2)] default 0
|
|
117
|
-
* @param {number} i_mst - static moisture permeability index, [dimensionless], default 0.38
|
|
118
|
-
* @param {number} a_p - fraction of the body surface covered by the reflective clothing, [dimensionless], default 0.54
|
|
119
|
-
* @param {number} drink - 1 if workers can drink freely, 0 otherwise, default 1
|
|
120
|
-
* @param {number} weight - body weight, [kg], default 75
|
|
121
|
-
* @param {number} height - height, [m], default 1.8
|
|
122
|
-
* @param {number} walk_sp - walking speed, [m/s], default 0
|
|
123
|
-
* @param {number} theta - angle between walking direction and wind direction [degrees], default 0
|
|
124
|
-
* @param {number} acclimatized - 100 if acclimatised subject, 0 otherwise, default 100
|
|
125
|
-
* @param {number} duration - duration of the work sequence, [minutes], default 480
|
|
126
|
-
* @param {number} f_r - emissivity of the reflective clothing, [dimensionless], default 0.97
|
|
127
|
-
* @param {number} t_sk - mean skin temperature when worker starts working, [°C], default 34.1
|
|
128
|
-
* @param {number} t_cr - mean core temperature when worker starts working, [°C], default 36.8
|
|
129
|
-
* @param {number} t_re - mean rectal temperature when worker starts working, [°C], default false
|
|
130
|
-
* @param {number} t_cr_eq - mean core temperature as a function of met when worker starts working, [°C], default false
|
|
131
|
-
* @param {number} sweat_rate - default 0
|
|
132
|
-
* @returns {[number]} - an array of the following results:
|
|
133
|
-
*/
|
|
134
|
-
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) {
|
|
135
|
-
const p_a = ((p_sat(tdb) / 1000) * rh) / 100;
|
|
136
|
-
if (t_re == 999) {
|
|
137
|
-
t_re = t_cr;
|
|
138
|
-
}
|
|
139
|
-
if (t_cr_eq == 999) {
|
|
140
|
-
t_cr_eq = t_cr;
|
|
141
|
-
}
|
|
142
|
-
// DuBois body surface area [m2]
|
|
143
|
-
const a_dubois = 0.202 * Math.pow(weight, 0.425) * Math.pow(height, 0.725);
|
|
144
|
-
const sp_heat = (57.83 * weight) / a_dubois; // specific heat of the body
|
|
145
|
-
let d_lim_t_re = 0; // maximum allowable exposure time for heat storage [min]
|
|
146
|
-
// maximum allowable exposure time for water loss, mean subject [min]
|
|
147
|
-
let d_lim_loss_50 = 0;
|
|
148
|
-
// maximum allowable exposure time for water loss, 95 % of the working population [min]
|
|
149
|
-
let d_lim_loss_95 = 0;
|
|
150
|
-
// maximum water loss to protect a mean subject [g]
|
|
151
|
-
const d_max_50 = 0.075 * weight * 1000;
|
|
152
|
-
// maximum water loss to protect 95 % of the working population [g]
|
|
153
|
-
const d_max_95 = 0.05 * weight * 1000;
|
|
154
|
-
// exponential averaging constants
|
|
155
|
-
const const_t_eq = Math.exp(-1 / 10);
|
|
156
|
-
const const_t_sk = Math.exp(-1 / 3);
|
|
157
|
-
const const_sw = Math.exp(-1 / 10);
|
|
158
|
-
let sweat_rate = sw_tot;
|
|
159
|
-
let def_dir = 0;
|
|
160
|
-
if (theta !== 0) {
|
|
161
|
-
// def_dir = 1 for unidirectional walking, def_dir = 0 for omni-directional walking
|
|
162
|
-
def_dir = 1;
|
|
163
|
-
}
|
|
164
|
-
let def_speed = 0;
|
|
165
|
-
if (walk_sp !== 0) {
|
|
166
|
-
def_speed = 1;
|
|
167
|
-
}
|
|
168
|
-
// radiating area dubois
|
|
169
|
-
let a_r_du = 0.7;
|
|
170
|
-
if (posture === 2) {
|
|
171
|
-
a_r_du = 0.77;
|
|
172
|
-
}
|
|
173
|
-
if (posture === 3) {
|
|
174
|
-
a_r_du = 0.67;
|
|
175
|
-
}
|
|
176
|
-
// evaluation of the max sweat rate as a function of the metabolic rate
|
|
177
|
-
let sw_max = (met - 32) * a_dubois;
|
|
178
|
-
if (sw_max > 400) {
|
|
179
|
-
sw_max = 400;
|
|
180
|
-
}
|
|
181
|
-
if (sw_max < 250) {
|
|
182
|
-
sw_max = 250;
|
|
183
|
-
}
|
|
184
|
-
if (acclimatized >= 50) {
|
|
185
|
-
sw_max = sw_max * 1.25;
|
|
186
|
-
}
|
|
187
|
-
// max skin wettedness
|
|
188
|
-
let w_max = 0.85;
|
|
189
|
-
if (acclimatized > 50) {
|
|
190
|
-
w_max = 1;
|
|
191
|
-
}
|
|
192
|
-
// static clothing insulation
|
|
193
|
-
const i_cl_st = clo * 0.155;
|
|
194
|
-
const fcl = 1 + 0.3 * clo;
|
|
195
|
-
// Static boundary layer thermal insulation in quiet air
|
|
196
|
-
const i_a_st = 0.111;
|
|
197
|
-
// Total static insulation
|
|
198
|
-
const i_tot_st = i_cl_st + i_a_st / fcl;
|
|
199
|
-
let v_r = v;
|
|
200
|
-
if (def_speed > 0) {
|
|
201
|
-
if (def_dir === 1) {
|
|
202
|
-
// Unidirectional walking
|
|
203
|
-
v_r = Math.abs(v - walk_sp * Math.cos((3.14159 * theta) / 180));
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
// Omni-directional walking IF
|
|
207
|
-
if (v < walk_sp) {
|
|
208
|
-
v_r = walk_sp;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
v_r = v;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
walk_sp = 0.0052 * (met - 58);
|
|
217
|
-
if (walk_sp > 0.7) {
|
|
218
|
-
walk_sp = 0.7;
|
|
219
|
-
}
|
|
220
|
-
v_r = v;
|
|
221
|
-
}
|
|
222
|
-
// Dynamic clothing insulation - correction for wind (Var) and walking speed
|
|
223
|
-
let v_ux = v_r;
|
|
224
|
-
if (v_r > 3) {
|
|
225
|
-
v_ux = 3;
|
|
226
|
-
}
|
|
227
|
-
let w_a_ux = walk_sp;
|
|
228
|
-
if (walk_sp > 1.5) {
|
|
229
|
-
w_a_ux = 1.5;
|
|
230
|
-
}
|
|
231
|
-
// correction for the dynamic total dry thermal insulation at or above 0.6 clo
|
|
232
|
-
let corr_cl = 1.044 *
|
|
233
|
-
Math.exp((0.066 * v_ux - 0.398) * v_ux + (0.094 * w_a_ux - 0.378) * w_a_ux);
|
|
234
|
-
if (corr_cl > 1) {
|
|
235
|
-
corr_cl = 1;
|
|
236
|
-
}
|
|
237
|
-
// correction for the dynamic total dry thermal insulation at 0 clo
|
|
238
|
-
let corr_ia = Math.exp((0.047 * v_r - 0.472) * v_r + (0.117 * w_a_ux - 0.342) * w_a_ux);
|
|
239
|
-
if (corr_ia > 1) {
|
|
240
|
-
corr_ia = 1;
|
|
241
|
-
}
|
|
242
|
-
let corr_tot = corr_cl;
|
|
243
|
-
if (clo <= 0.6) {
|
|
244
|
-
corr_tot = ((0.6 - clo) * corr_ia + clo * corr_cl) / 0.6;
|
|
245
|
-
}
|
|
246
|
-
// total dynamic clothing insulation
|
|
247
|
-
let i_tot_dyn = i_tot_st * corr_tot;
|
|
248
|
-
// dynamic boundary layer thermal insulation
|
|
249
|
-
let i_a_dyn = corr_ia * i_a_st;
|
|
250
|
-
let i_cl_dyn = i_tot_dyn - i_a_dyn / fcl;
|
|
251
|
-
// correction for the dynamic permeability index
|
|
252
|
-
let corr_e = (2.6 * corr_tot - 6.5) * corr_tot + 4.9;
|
|
253
|
-
let im_dyn = i_mst * corr_e;
|
|
254
|
-
if (im_dyn > 0.9) {
|
|
255
|
-
im_dyn = 0.9;
|
|
256
|
-
}
|
|
257
|
-
let r_t_dyn = i_tot_dyn / im_dyn / 16.7;
|
|
258
|
-
let t_exp = 28.56 + 0.115 * tdb + 0.641 * p_a; // expired air temperature
|
|
259
|
-
// respiratory convective heat flow [W/m2]
|
|
260
|
-
let c_res = 0.001516 * met * (t_exp - tdb);
|
|
261
|
-
// respiratory evaporative heat flow [W/m2]
|
|
262
|
-
let e_res = 0.00127 * met * (59.34 + 0.53 * tdb - 11.63 * p_a);
|
|
263
|
-
let z = 3.5 + 5.2 * v_r;
|
|
264
|
-
if (v_r > 1) {
|
|
265
|
-
z = 8.7 * Math.pow(v_r, 0.6);
|
|
266
|
-
}
|
|
267
|
-
// Dynamic convective heat transfer coefficient
|
|
268
|
-
let hc_dyn = 2.38 * Math.pow(Math.abs(t_sk - tdb), 0.25);
|
|
269
|
-
if (z > hc_dyn) {
|
|
270
|
-
hc_dyn = z;
|
|
271
|
-
}
|
|
272
|
-
let aux_r = 5.67e-8 * a_r_du;
|
|
273
|
-
let f_cl_r = (1 - a_p) * 0.97 + a_p * f_r;
|
|
274
|
-
let h_r;
|
|
275
|
-
let t_cl;
|
|
276
|
-
let t_cl_new;
|
|
277
|
-
let sw_req;
|
|
278
|
-
let e_v_eff;
|
|
279
|
-
let k;
|
|
280
|
-
let wp = 0;
|
|
281
|
-
let e_p;
|
|
282
|
-
let sw_tot_g = 0;
|
|
283
|
-
for (let time = 1; time <= duration; time++) {
|
|
284
|
-
const t_sk0 = t_sk;
|
|
285
|
-
const t_re0 = t_re;
|
|
286
|
-
const t_cr0 = t_cr;
|
|
287
|
-
const t_cr_eq0 = t_cr_eq;
|
|
288
|
-
const t_sk_t_cr_wg0 = t_sk_t_cr_wg;
|
|
289
|
-
// equilibrium core temperature associated to the metabolic rate
|
|
290
|
-
const t_cr_eq_m = 0.0036 * met + 36.6;
|
|
291
|
-
// Core temperature at this minute, by exponential averaging
|
|
292
|
-
t_cr_eq = t_cr_eq0 * const_t_eq + t_cr_eq_m * (1 - const_t_eq);
|
|
293
|
-
// Heat storage associated with this core temperature increase during the last minute
|
|
294
|
-
const d_stored_eq = sp_heat * (t_cr_eq - t_cr_eq0) * (1 - t_sk_t_cr_wg0);
|
|
295
|
-
// skin temperature prediction -- clothed model
|
|
296
|
-
let t_sk_eq_cl = 12.165 + 0.02017 * tdb + 0.04361 * tr + 0.19354 * p_a - 0.25315 * v;
|
|
297
|
-
t_sk_eq_cl = t_sk_eq_cl + 0.005346 * met + 0.51274 * t_re;
|
|
298
|
-
// nude model
|
|
299
|
-
let t_sk_eq_nu = 7.191 + 0.064 * tdb + 0.061 * tr + 0.198 * p_a - 0.348 * v;
|
|
300
|
-
t_sk_eq_nu = t_sk_eq_nu + 0.616 * t_re;
|
|
301
|
-
let t_sk_eq = t_sk_eq_nu + 2.5 * (t_sk_eq_cl - t_sk_eq_nu) * (clo - 0.2);
|
|
302
|
-
if (clo >= 0.6) {
|
|
303
|
-
t_sk_eq = t_sk_eq_cl;
|
|
304
|
-
}
|
|
305
|
-
else if (clo <= 0.2) {
|
|
306
|
-
t_sk_eq = t_sk_eq_nu;
|
|
307
|
-
}
|
|
308
|
-
// skin temperature [C]
|
|
309
|
-
t_sk = t_sk0 * const_t_sk + t_sk_eq * (1 - const_t_sk);
|
|
310
|
-
// Saturated water vapour pressure at the surface of the skin
|
|
311
|
-
const p_sk = 0.6105 * Math.exp((17.27 * t_sk) / (t_sk + 237.3));
|
|
312
|
-
t_cl = tr + 0.1; // clothing surface temperature
|
|
313
|
-
while (true) {
|
|
314
|
-
// radiative heat transfer coefficient
|
|
315
|
-
h_r =
|
|
316
|
-
(f_cl_r * aux_r * (Math.pow(t_cl + 273, 4) - Math.pow(tr + 273, 4))) /
|
|
317
|
-
(t_cl - tr);
|
|
318
|
-
let t_cl_new = (fcl * (hc_dyn * tdb + h_r * tr) + t_sk / i_cl_dyn) /
|
|
319
|
-
(fcl * (hc_dyn + h_r) + 1 / i_cl_dyn);
|
|
320
|
-
if (Math.abs(t_cl - t_cl_new) <= 0.001) {
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
t_cl = (t_cl + t_cl_new) / 2;
|
|
324
|
-
}
|
|
325
|
-
let convection = fcl * hc_dyn * (t_cl - tdb);
|
|
326
|
-
let radiation = fcl * h_r * (t_cl - tr);
|
|
327
|
-
// maximum evaporative heat flow at the skin surface [W/m2]
|
|
328
|
-
let e_max = (p_sk - p_a) / r_t_dyn;
|
|
329
|
-
// required evaporative heat flow [W/m2]
|
|
330
|
-
let e_req = met - d_stored_eq - wme - c_res - e_res - convection - radiation;
|
|
331
|
-
// required skin wettedness
|
|
332
|
-
let w_req = e_req / e_max;
|
|
333
|
-
if (e_req <= 0) {
|
|
334
|
-
e_req = 0;
|
|
335
|
-
sw_req = 0; // required sweat rate [W/m2]
|
|
336
|
-
}
|
|
337
|
-
else if (e_max <= 0) {
|
|
338
|
-
e_max = 0;
|
|
339
|
-
sw_req = sw_max;
|
|
340
|
-
}
|
|
341
|
-
else if (w_req >= 1.7) {
|
|
342
|
-
sw_req = sw_max;
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
e_v_eff = 1 - Math.pow(w_req, 2) / 2;
|
|
346
|
-
if (w_req > 1) {
|
|
347
|
-
e_v_eff = Math.pow(2 - w_req, 2) / 2;
|
|
348
|
-
}
|
|
349
|
-
sw_req = e_req / e_v_eff;
|
|
350
|
-
if (sw_req > sw_max) {
|
|
351
|
-
sw_req = sw_max;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
sweat_rate = sweat_rate * const_sw + sw_req * (1 - const_sw);
|
|
355
|
-
if (sweat_rate <= 0) {
|
|
356
|
-
e_p = 0; // predicted evaporative heat flow [W/m2]
|
|
357
|
-
sweat_rate = 0;
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
k = e_max / sweat_rate;
|
|
361
|
-
wp = 1;
|
|
362
|
-
if (k >= 0.5) {
|
|
363
|
-
wp = -k + Math.sqrt(k * k + 2);
|
|
364
|
-
}
|
|
365
|
-
if (wp > w_max) {
|
|
366
|
-
wp = w_max;
|
|
367
|
-
}
|
|
368
|
-
e_p = wp * e_max;
|
|
369
|
-
}
|
|
370
|
-
// body heat storage rate [W/m2]
|
|
371
|
-
let d_storage = e_req - e_p + d_stored_eq;
|
|
372
|
-
let t_cr_new = t_cr0;
|
|
373
|
-
while (true) {
|
|
374
|
-
t_sk_t_cr_wg = 0.3 - 0.09 * (t_cr_new - 36.8);
|
|
375
|
-
if (t_sk_t_cr_wg > 0.3) {
|
|
376
|
-
t_sk_t_cr_wg = 0.3;
|
|
377
|
-
}
|
|
378
|
-
if (t_sk_t_cr_wg < 0.1) {
|
|
379
|
-
t_sk_t_cr_wg = 0.1;
|
|
380
|
-
}
|
|
381
|
-
t_cr =
|
|
382
|
-
d_storage / sp_heat +
|
|
383
|
-
(t_sk0 * t_sk_t_cr_wg0) / 2 -
|
|
384
|
-
(t_sk * t_sk_t_cr_wg) / 2;
|
|
385
|
-
t_cr = (t_cr + t_cr0 * (1 - t_sk_t_cr_wg0 / 2)) / (1 - t_sk_t_cr_wg / 2);
|
|
386
|
-
if (Math.abs(t_cr - t_cr_new) <= 0.001) {
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
t_cr_new = (t_cr_new + t_cr) / 2;
|
|
390
|
-
}
|
|
391
|
-
t_re = t_re0 + (2 * t_cr - 1.962 * t_re0 - 1.31) / 9;
|
|
392
|
-
if (d_lim_t_re == 0 && t_re >= 38) {
|
|
393
|
-
d_lim_t_re = time;
|
|
394
|
-
}
|
|
395
|
-
sw_tot = sw_tot + sweat_rate + e_res;
|
|
396
|
-
sw_tot_g = (sw_tot * 2.67 * a_dubois) / 1.8 / 60;
|
|
397
|
-
if (d_lim_loss_50 == 0 && sw_tot_g >= d_max_50) {
|
|
398
|
-
d_lim_loss_50 = time;
|
|
399
|
-
}
|
|
400
|
-
if (d_lim_loss_95 == 0 && sw_tot_g >= d_max_95) {
|
|
401
|
-
d_lim_loss_95 = time;
|
|
402
|
-
}
|
|
403
|
-
if (drink == 0) {
|
|
404
|
-
d_lim_loss_95 = d_lim_loss_95 * 0.6;
|
|
405
|
-
d_lim_loss_50 = d_lim_loss_95;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
if (d_lim_loss_50 == 0) {
|
|
409
|
-
d_lim_loss_50 = duration;
|
|
410
|
-
}
|
|
411
|
-
if (d_lim_loss_95 == 0) {
|
|
412
|
-
d_lim_loss_95 = duration;
|
|
413
|
-
}
|
|
414
|
-
if (d_lim_t_re == 0) {
|
|
415
|
-
d_lim_t_re = duration;
|
|
416
|
-
}
|
|
417
|
-
return {
|
|
418
|
-
t_re: round ? Math.round(t_re * 10) / 10 : t_re,
|
|
419
|
-
t_sk: round ? Math.round(t_sk * 10) / 10 : t_sk,
|
|
420
|
-
t_cr: round ? Math.round(t_cr * 10) / 10 : t_cr,
|
|
421
|
-
t_cr_eq: round ? Math.round(t_cr_eq * 10) / 10 : t_cr_eq,
|
|
422
|
-
t_sk_t_cr_wg: round ? Math.round(t_sk_t_cr_wg * 100) / 100 : t_sk_t_cr_wg,
|
|
423
|
-
sweat_rate: round ? Math.round(sweat_rate * 10) / 10 : sweat_rate,
|
|
424
|
-
sw_tot_g: round ? Math.round(sw_tot_g * 10) / 10 : sw_tot_g,
|
|
425
|
-
d_lim_loss_50: round ? Math.round(d_lim_loss_50 * 10) / 10 : d_lim_loss_50,
|
|
426
|
-
d_lim_loss_95: round ? Math.round(d_lim_loss_95 * 10) / 10 : d_lim_loss_95,
|
|
427
|
-
d_lim_t_re: round ? Math.round(d_lim_t_re * 10) / 10 : d_lim_t_re,
|
|
428
|
-
wp: round ? Math.round(wp * 100) / 100 : wp,
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
exports.phs = phs;
|
|
432
|
-
exports.default = {
|
|
433
|
-
heatIndex,
|
|
434
|
-
phs,
|
|
435
|
-
p_sat,
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
436
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 };
|