jsthermalcomfort 1.0.4 → 1.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 (216) hide show
  1. package/README.md +24 -166
  2. package/lib/cjs/index.js +17 -0
  3. package/lib/cjs/models/a_pmv.js +25 -63
  4. package/lib/cjs/models/adaptive_ashrae.js +9 -145
  5. package/lib/cjs/models/adaptive_en.js +9 -148
  6. package/lib/cjs/models/ankle_draft.js +11 -0
  7. package/lib/cjs/models/at.js +8 -0
  8. package/lib/cjs/models/athb.js +9 -67
  9. package/lib/cjs/models/clo_tout.js +6 -26
  10. package/lib/cjs/models/cooling_effect.js +11 -0
  11. package/lib/cjs/models/discomfort_index.js +5 -39
  12. package/lib/cjs/models/e_pmv.js +25 -72
  13. package/lib/cjs/models/heat_index.js +9 -0
  14. package/lib/cjs/models/humidex.js +6 -0
  15. package/lib/cjs/models/index.js +28 -17
  16. package/lib/cjs/models/net.js +7 -0
  17. package/lib/cjs/models/pet_steady.js +30 -0
  18. package/lib/cjs/models/phs.js +58 -0
  19. package/lib/cjs/models/pmv.js +28 -89
  20. package/lib/cjs/models/pmv_ppd.js +27 -168
  21. package/lib/cjs/models/pmv_ppd_ashrae.js +26 -0
  22. package/lib/cjs/models/pmv_ppd_iso.js +24 -0
  23. package/lib/cjs/models/set_tmp.js +33 -106
  24. package/lib/cjs/models/solar_gain.js +22 -2
  25. package/lib/cjs/models/two_nodes.js +42 -237
  26. package/lib/cjs/models/use_fans_heatwave.js +35 -0
  27. package/lib/cjs/models/utci.js +41 -116
  28. package/lib/cjs/models/vertical_tmp_grad_ppd.js +12 -0
  29. package/lib/cjs/models/wbgt.js +14 -0
  30. package/lib/cjs/models/wc.js +6 -0
  31. package/lib/cjs/psychrometrics/index.js +9 -8
  32. package/lib/cjs/psychrometrics/p_sat_torr.js +0 -18
  33. package/lib/cjs/psychrometrics/t_mrt.js +1 -41
  34. package/lib/cjs/psychrometrics/t_o.js +0 -1
  35. package/lib/cjs/types/index.d.ts +3 -0
  36. package/lib/cjs/types/index.d.ts.map +1 -1
  37. package/lib/cjs/types/models/JOS3.d.ts +3 -3
  38. package/lib/cjs/types/models/JOS3.d.ts.map +1 -1
  39. package/lib/cjs/types/models/a_pmv.d.ts +3 -122
  40. package/lib/cjs/types/models/a_pmv.d.ts.map +1 -1
  41. package/lib/cjs/types/models/adaptive_ashrae.d.ts +9 -180
  42. package/lib/cjs/types/models/adaptive_ashrae.d.ts.map +1 -1
  43. package/lib/cjs/types/models/adaptive_en.d.ts +12 -164
  44. package/lib/cjs/types/models/adaptive_en.d.ts.map +1 -1
  45. package/lib/cjs/types/models/ankle_draft.d.ts +4 -49
  46. package/lib/cjs/types/models/ankle_draft.d.ts.map +1 -1
  47. package/lib/cjs/types/models/at.d.ts +5 -38
  48. package/lib/cjs/types/models/at.d.ts.map +1 -1
  49. package/lib/cjs/types/models/athb.d.ts +3 -100
  50. package/lib/cjs/types/models/athb.d.ts.map +1 -1
  51. package/lib/cjs/types/models/clo_tout.d.ts +3 -49
  52. package/lib/cjs/types/models/clo_tout.d.ts.map +1 -1
  53. package/lib/cjs/types/models/cooling_effect.d.ts +3 -52
  54. package/lib/cjs/types/models/cooling_effect.d.ts.map +1 -1
  55. package/lib/cjs/types/models/discomfort_index.d.ts +4 -76
  56. package/lib/cjs/types/models/discomfort_index.d.ts.map +1 -1
  57. package/lib/cjs/types/models/e_pmv.d.ts +3 -128
  58. package/lib/cjs/types/models/e_pmv.d.ts.map +1 -1
  59. package/lib/cjs/types/models/heat_index.d.ts +6 -31
  60. package/lib/cjs/types/models/heat_index.d.ts.map +1 -1
  61. package/lib/cjs/types/models/humidex.d.ts +6 -37
  62. package/lib/cjs/types/models/humidex.d.ts.map +1 -1
  63. package/lib/cjs/types/models/index.d.ts +1 -24
  64. package/lib/cjs/types/models/index.d.ts.map +1 -1
  65. package/lib/cjs/types/models/net.d.ts +5 -43
  66. package/lib/cjs/types/models/net.d.ts.map +1 -1
  67. package/lib/cjs/types/models/pet_steady.d.ts +5 -56
  68. package/lib/cjs/types/models/pet_steady.d.ts.map +1 -1
  69. package/lib/cjs/types/models/phs.d.ts +28 -121
  70. package/lib/cjs/types/models/phs.d.ts.map +1 -1
  71. package/lib/cjs/types/models/pmv.d.ts +1 -170
  72. package/lib/cjs/types/models/pmv.d.ts.map +1 -1
  73. package/lib/cjs/types/models/pmv_ppd.d.ts +4 -196
  74. package/lib/cjs/types/models/pmv_ppd.d.ts.map +1 -1
  75. package/lib/cjs/types/models/pmv_ppd_ashrae.d.ts +4 -48
  76. package/lib/cjs/types/models/pmv_ppd_ashrae.d.ts.map +1 -1
  77. package/lib/cjs/types/models/pmv_ppd_iso.d.ts +4 -48
  78. package/lib/cjs/types/models/pmv_ppd_iso.d.ts.map +1 -1
  79. package/lib/cjs/types/models/set_tmp.d.ts +3 -111
  80. package/lib/cjs/types/models/set_tmp.d.ts.map +1 -1
  81. package/lib/cjs/types/models/solar_gain.d.ts +4 -56
  82. package/lib/cjs/types/models/solar_gain.d.ts.map +1 -1
  83. package/lib/cjs/types/models/two_nodes.d.ts +58 -305
  84. package/lib/cjs/types/models/two_nodes.d.ts.map +1 -1
  85. package/lib/cjs/types/models/use_fans_heatwave.d.ts +1 -92
  86. package/lib/cjs/types/models/use_fans_heatwave.d.ts.map +1 -1
  87. package/lib/cjs/types/models/utci.d.ts +6 -74
  88. package/lib/cjs/types/models/utci.d.ts.map +1 -1
  89. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts +4 -43
  90. package/lib/cjs/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -1
  91. package/lib/cjs/types/models/wbgt.d.ts +3 -55
  92. package/lib/cjs/types/models/wbgt.d.ts.map +1 -1
  93. package/lib/cjs/types/models/wc.d.ts +2 -25
  94. package/lib/cjs/types/models/wc.d.ts.map +1 -1
  95. package/lib/cjs/types/psychrometrics/index.d.ts +1 -6
  96. package/lib/cjs/types/psychrometrics/index.d.ts.map +1 -1
  97. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts +0 -15
  98. package/lib/cjs/types/psychrometrics/p_sat_torr.d.ts.map +1 -1
  99. package/lib/cjs/types/psychrometrics/t_mrt.d.ts +0 -20
  100. package/lib/cjs/types/psychrometrics/t_mrt.d.ts.map +1 -1
  101. package/lib/cjs/types/psychrometrics/t_o.d.ts +0 -1
  102. package/lib/cjs/types/psychrometrics/t_o.d.ts.map +1 -1
  103. package/lib/cjs/types/utilities/index.d.ts +2 -6
  104. package/lib/cjs/types/utilities/index.d.ts.map +1 -1
  105. package/lib/cjs/types/utilities/utilities.d.ts +2 -59
  106. package/lib/cjs/types/utilities/utilities.d.ts.map +1 -1
  107. package/lib/cjs/utilities/index.js +11 -8
  108. package/lib/cjs/utilities/utilities.js +58 -101
  109. package/lib/esm/index.js +3 -0
  110. package/lib/esm/models/a_pmv.js +26 -64
  111. package/lib/esm/models/adaptive_ashrae.js +11 -146
  112. package/lib/esm/models/adaptive_en.js +11 -149
  113. package/lib/esm/models/ankle_draft.js +12 -1
  114. package/lib/esm/models/at.js +9 -1
  115. package/lib/esm/models/athb.js +10 -67
  116. package/lib/esm/models/clo_tout.js +7 -26
  117. package/lib/esm/models/cooling_effect.js +12 -1
  118. package/lib/esm/models/discomfort_index.js +6 -39
  119. package/lib/esm/models/e_pmv.js +26 -73
  120. package/lib/esm/models/heat_index.js +10 -1
  121. package/lib/esm/models/humidex.js +7 -1
  122. package/lib/esm/models/index.js +13 -24
  123. package/lib/esm/models/net.js +8 -1
  124. package/lib/esm/models/pet_steady.js +31 -1
  125. package/lib/esm/models/phs.js +59 -1
  126. package/lib/esm/models/pmv.js +28 -89
  127. package/lib/esm/models/pmv_ppd.js +27 -168
  128. package/lib/esm/models/pmv_ppd_ashrae.js +25 -0
  129. package/lib/esm/models/pmv_ppd_iso.js +23 -0
  130. package/lib/esm/models/set_tmp.js +35 -107
  131. package/lib/esm/models/solar_gain.js +23 -3
  132. package/lib/esm/models/two_nodes.js +43 -237
  133. package/lib/esm/models/use_fans_heatwave.js +36 -1
  134. package/lib/esm/models/utci.js +42 -117
  135. package/lib/esm/models/vertical_tmp_grad_ppd.js +13 -1
  136. package/lib/esm/models/wbgt.js +15 -1
  137. package/lib/esm/models/wc.js +7 -1
  138. package/lib/esm/psychrometrics/index.js +4 -6
  139. package/lib/esm/psychrometrics/p_sat_torr.js +0 -17
  140. package/lib/esm/psychrometrics/t_mrt.js +2 -41
  141. package/lib/esm/psychrometrics/t_o.js +0 -1
  142. package/lib/esm/types/index.d.ts +3 -0
  143. package/lib/esm/types/index.d.ts.map +1 -1
  144. package/lib/esm/types/models/JOS3.d.ts +3 -3
  145. package/lib/esm/types/models/JOS3.d.ts.map +1 -1
  146. package/lib/esm/types/models/a_pmv.d.ts +3 -122
  147. package/lib/esm/types/models/a_pmv.d.ts.map +1 -1
  148. package/lib/esm/types/models/adaptive_ashrae.d.ts +9 -180
  149. package/lib/esm/types/models/adaptive_ashrae.d.ts.map +1 -1
  150. package/lib/esm/types/models/adaptive_en.d.ts +12 -164
  151. package/lib/esm/types/models/adaptive_en.d.ts.map +1 -1
  152. package/lib/esm/types/models/ankle_draft.d.ts +4 -49
  153. package/lib/esm/types/models/ankle_draft.d.ts.map +1 -1
  154. package/lib/esm/types/models/at.d.ts +5 -38
  155. package/lib/esm/types/models/at.d.ts.map +1 -1
  156. package/lib/esm/types/models/athb.d.ts +3 -100
  157. package/lib/esm/types/models/athb.d.ts.map +1 -1
  158. package/lib/esm/types/models/clo_tout.d.ts +3 -49
  159. package/lib/esm/types/models/clo_tout.d.ts.map +1 -1
  160. package/lib/esm/types/models/cooling_effect.d.ts +3 -52
  161. package/lib/esm/types/models/cooling_effect.d.ts.map +1 -1
  162. package/lib/esm/types/models/discomfort_index.d.ts +4 -76
  163. package/lib/esm/types/models/discomfort_index.d.ts.map +1 -1
  164. package/lib/esm/types/models/e_pmv.d.ts +3 -128
  165. package/lib/esm/types/models/e_pmv.d.ts.map +1 -1
  166. package/lib/esm/types/models/heat_index.d.ts +6 -31
  167. package/lib/esm/types/models/heat_index.d.ts.map +1 -1
  168. package/lib/esm/types/models/humidex.d.ts +6 -37
  169. package/lib/esm/types/models/humidex.d.ts.map +1 -1
  170. package/lib/esm/types/models/index.d.ts +1 -24
  171. package/lib/esm/types/models/index.d.ts.map +1 -1
  172. package/lib/esm/types/models/net.d.ts +5 -43
  173. package/lib/esm/types/models/net.d.ts.map +1 -1
  174. package/lib/esm/types/models/pet_steady.d.ts +5 -56
  175. package/lib/esm/types/models/pet_steady.d.ts.map +1 -1
  176. package/lib/esm/types/models/phs.d.ts +28 -121
  177. package/lib/esm/types/models/phs.d.ts.map +1 -1
  178. package/lib/esm/types/models/pmv.d.ts +1 -170
  179. package/lib/esm/types/models/pmv.d.ts.map +1 -1
  180. package/lib/esm/types/models/pmv_ppd.d.ts +4 -196
  181. package/lib/esm/types/models/pmv_ppd.d.ts.map +1 -1
  182. package/lib/esm/types/models/pmv_ppd_ashrae.d.ts +4 -48
  183. package/lib/esm/types/models/pmv_ppd_ashrae.d.ts.map +1 -1
  184. package/lib/esm/types/models/pmv_ppd_iso.d.ts +4 -48
  185. package/lib/esm/types/models/pmv_ppd_iso.d.ts.map +1 -1
  186. package/lib/esm/types/models/set_tmp.d.ts +3 -111
  187. package/lib/esm/types/models/set_tmp.d.ts.map +1 -1
  188. package/lib/esm/types/models/solar_gain.d.ts +4 -56
  189. package/lib/esm/types/models/solar_gain.d.ts.map +1 -1
  190. package/lib/esm/types/models/two_nodes.d.ts +58 -305
  191. package/lib/esm/types/models/two_nodes.d.ts.map +1 -1
  192. package/lib/esm/types/models/use_fans_heatwave.d.ts +1 -92
  193. package/lib/esm/types/models/use_fans_heatwave.d.ts.map +1 -1
  194. package/lib/esm/types/models/utci.d.ts +6 -74
  195. package/lib/esm/types/models/utci.d.ts.map +1 -1
  196. package/lib/esm/types/models/vertical_tmp_grad_ppd.d.ts +4 -43
  197. package/lib/esm/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -1
  198. package/lib/esm/types/models/wbgt.d.ts +3 -55
  199. package/lib/esm/types/models/wbgt.d.ts.map +1 -1
  200. package/lib/esm/types/models/wc.d.ts +2 -25
  201. package/lib/esm/types/models/wc.d.ts.map +1 -1
  202. package/lib/esm/types/psychrometrics/index.d.ts +1 -6
  203. package/lib/esm/types/psychrometrics/index.d.ts.map +1 -1
  204. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts +0 -15
  205. package/lib/esm/types/psychrometrics/p_sat_torr.d.ts.map +1 -1
  206. package/lib/esm/types/psychrometrics/t_mrt.d.ts +0 -20
  207. package/lib/esm/types/psychrometrics/t_mrt.d.ts.map +1 -1
  208. package/lib/esm/types/psychrometrics/t_o.d.ts +0 -1
  209. package/lib/esm/types/psychrometrics/t_o.d.ts.map +1 -1
  210. package/lib/esm/types/utilities/index.d.ts +2 -6
  211. package/lib/esm/types/utilities/index.d.ts.map +1 -1
  212. package/lib/esm/types/utilities/utilities.d.ts +2 -59
  213. package/lib/esm/types/utilities/utilities.d.ts.map +1 -1
  214. package/lib/esm/utilities/index.js +2 -4
  215. package/lib/esm/utilities/utilities.js +55 -97
  216. package/package.json +2 -2
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  | docs | [![docs](https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/test_docs.yml/badge.svg)][docs_link] |
4
4
  | :-----------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
5
- | **build** | [![build](https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/build.yml/badge.svg)][build_link] |
6
- | **tests** | [![test](https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/test.yml/badge.svg)][test_link] |
7
- | **page deployment** | [![page deployment](https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/pages/pages-build-deployment/badge.svg)][deploy_link] |
5
+ | **build** | [![build](https://img.shields.io/github/actions/workflow/status/FedericoTartarini/jsthermalcomfort/ci.yml?branch=main&label=build)][build_link] |
6
+ | **tests** | [![test](https://img.shields.io/github/actions/workflow/status/FedericoTartarini/jsthermalcomfort/ci.yml?branch=main&label=tests)][test_link] |
7
+ | **page deployment** | [![page deployment](https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/deploy-docs.yml/badge.svg)][deploy_link] |
8
8
  | **snyk security** | [![snyk](https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/snyk.yml/badge.svg)][snyk_link] |
9
9
  | **license** | [![license](https://custom-icon-badges.demolab.com/github/license/denvercoder1/custom-icon-badges?logo=law)](https://github.com/FedericoTartarini/jsthermalcomfort/blob/main/LICENSE) |
10
10
  | **npm version** | [![npm](https://img.shields.io/npm/v/jsthermalcomfort?style=plastic&logo=npm&logoColor=rgb)][npm_link] |
@@ -17,9 +17,9 @@ Please cite us if you use this package: [Tartarini, F., Schiavon, S., 2020. pyth
17
17
  - Authors: [Federico Tartarini](https://www.linkedin.com/in/federico-tartarini/), [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), [Stefano Schiavon](https://www.linkedin.com/in/stefanoschiavon/), [Ollie Jay](https://www.linkedin.com/in/ollie-jay-793a1b11/)
18
18
 
19
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
20
+ [build_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/ci.yml
21
+ [test_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/ci.yml
22
+ [deploy_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/deploy-docs.yml
23
23
  [snyk_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/snyk.yml
24
24
  [npm_link]: https://www.npmjs.com/package/jsthermalcomfort
25
25
 
@@ -43,7 +43,7 @@ Example:
43
43
  import {
44
44
  models,
45
45
  utilities,
46
- pschymetrics,
46
+ psychrometrics,
47
47
  } from "https://cdn.jsdelivr.net/npm/jsthermalcomfort/lib/esm/index.js";
48
48
  ```
49
49
 
@@ -54,7 +54,7 @@ You can also import it in the website directly, and caution that you need to mar
54
54
  import {
55
55
  models,
56
56
  utilities,
57
- pschymetrics,
57
+ psychrometrics,
58
58
  } from "https://cdn.jsdelivr.net/npm/jsthermalcomfort/lib/esm/index.js";
59
59
  </script>
60
60
  ```
@@ -69,168 +69,26 @@ Here is a list of examples running in the browser:
69
69
 
70
70
  # Contributing
71
71
 
72
- Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
72
+ Contributions are welcome.
73
73
 
74
- ## Bug reports
74
+ - Contributor guide: [`docs_theme/contributing.md`](docs_theme/contributing.md)
75
+ - Online docs version: [Contributing](https://federicotartarini.github.io/jsthermalcomfort/contributing.html)
76
+ - Bug reports and feature requests: [GitHub Issues](https://github.com/FedericoTartarini/jsthermalcomfort/issues)
75
77
 
76
- When [reporting a bug](https://github.com/FedericoTartarini/jsthermalcomfort/issues) please include:
77
-
78
- - Your operating system name and version.
79
- - Any details about your local setup that might be helpful in troubleshooting.
80
- - Detailed steps to reproduce the bug.
81
-
82
- ## Documentation improvements
83
-
84
- If you find any issue in our online [documentation](https://federicotartarini.github.io/jsthermalcomfort/) please open
85
- an [issue](https://github.com/FedericoTartarini/jsthermalcomfort/issues).
86
-
87
- jsthermalcomfort could always use more documentation, whether as part of the official jsthermalcomfort docs, in JSDocs,
88
- or even on the web in blog posts, articles, and such.
89
-
90
- ## Feature requests and feedback
91
-
92
- The best way to send feedback is to file an issue
93
- at [https://github.com/FedericoTartarini/jsthermalcomfort/issues](https://github.com/FedericoTartarini/jsthermalcomfort/issues)
94
-
95
- If you are proposing a feature:
96
-
97
- - Explain in detail how it would work.
98
- - Keep the scope as narrow as possible, to make it easier to implement.
99
- - Remember that this is a volunteer-driven project, and that code contributions are welcome :)
100
-
101
- ## Local development
102
-
103
- To set up jsthermalcomfort for local development:
104
-
105
- 1. Fork jsthermalcomfort (look for the “Fork” button).
106
- 2. Clone your fork locally. Fetch and pull all the updates from the main branch before you do anything:
107
-
108
- ```bash
109
- git clone git@github.com:FedericoTartarini/jsthermalcomfort.git
110
- ```
111
-
112
- 3. Create a branch for local development. The naming rule for new branch are, as follows:
113
- - If this update is for a new feature Feature/feature_name_here
114
- - If this update is for bug fix Fix/bug_name_here
115
- - If this update is for documentation Documentation/doc_name_here
116
-
117
- You can create a branch locally using the following command. Make sure you only push updates to this new branch only:
118
-
119
- ```bash
120
- git checkout -b name-of-your-bugfix-or-feature
121
- ```
122
-
123
- Now you can make your changes locally.
124
-
125
- 4. When you’re done making changes run all tests using Jest:
126
- - Install dependencies
127
-
128
- ```bash
129
- npm install
130
- ```
131
-
132
- ```bash
133
- npm run test
134
- ```
135
-
136
- - Run prettier to format your code:
137
-
138
- ```bash
139
- npm run format
140
- ```
141
-
142
- - A pre-commit hook now runs automatically on every commit and executes:
143
-
144
- ```bash
145
- npm run check:format
146
- npm run build
147
- npm test
148
- ```
149
-
150
- If one of these checks fails, the commit is blocked until the issue is fixed.
151
- - Commit your changes:
152
-
153
- ```bash
154
- git add .
155
- git commit -m "Your detailed description of your changes."
156
- ```
157
-
158
- - Update the docs:
159
-
160
- ```bash
161
- npm run docs
162
- ```
163
-
164
- - Commit your documentation changes:
165
-
166
- ```bash
167
- git add .
168
- git commit -m "Your detailed description of your changes."
169
- ```
170
-
171
- - Push your branch to GitHub:
172
-
173
- ```bash
174
- git push origin name-of-your-bugfix-or-feature
175
- ```
176
-
177
- 5. Submit a pull request after you have done all your modifications and tested your work. The pull request should
178
- include a detailed description of your work:
179
- - What this pull request is about
180
- - Have you tested your work
181
- - Will this work affect other component in the product
182
-
183
- ### Pull Request Guidelines
184
-
185
- If you need some code review or feedback while you’re developing the code just make the pull request.
186
-
187
- For merging, you should:
188
-
189
- - Include passing tests (run `npm run test`).
190
- - Update documentation when there’s new API, functionality etc.
191
-
192
- ## Documentation
193
-
194
- We are using [JSDoc](https://jsdoc.app/) and [documentation.js](https://github.com/documentationjs/documentation) to
195
- automatically build the documentation.
196
-
197
- All the files needed to generate the documentation can be found in the `docs_theme` repository.
198
- After updating the Markdown files, please run the command:
78
+ ## Local development (quick start)
199
79
 
200
80
  ```bash
201
- npm run docs
81
+ npm ci
82
+ npm test
83
+ npm run check:format
84
+ npm run build
202
85
  ```
203
86
 
204
- Please ignore the `docs` folder, this folder contains all the files generated by the above command.
205
-
206
- ## How to add a new model to jsthermalcomfort
207
-
208
- 1. Add a file under `src/models/` with the name of the function/model and document it.
209
- 2. Add any related functions that are used by your function either in `src/utilities/utilities.js`
210
- or `src/psychrometrics/`. See existing code as example.
211
- - In order to add a new function/API to the library you should mark that function as `@public`, add it to its
212
- corresponding category, for example for models you should do `@memberof models`, and lastly you should give it a
213
- proper name for the documentation with `@docname`, for example: `@docname Clothing prediction`. It is important to
214
- note that you should also add the `@public` tag to any types the function exposes/uses.
215
- 3. Test your function by writing a test in `tests/models/<name_of_model>.test.js`.
216
- 4. To run a subset of tests you can do the following:
217
-
218
- ```bash
219
- npm run test -- '<path_to_test_file>' -t '<test_pattern/name>'
220
- ```
87
+ Validation datasets for model tests are fetched from
88
+ `FedericoTartarini/validation-data-comfort-models` on GitHub (no submodule needed).
89
+ By default tests use the `main` branch. To pin tests to a specific ref (tag/branch/commit), set
90
+ `VALIDATION_DATA_REF` when running tests:
221
91
 
222
- If you are using VSCode you can use
223
- the [Jest Runner extension](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to easily
224
- run subset of tests.
225
-
226
- ## How to publish a new version of jsthermalcomfort
227
-
228
- To create a new release do the following:
229
-
230
- 1. Update the `package.json` version to the new version (we use the semantic release system for versioning)
231
- 2. Run `npm run build` to update the `lib` directory (output with types of the library that gets published to NPM)
232
- 3. Commit the updates
233
- 4. In GitHub go to Releases -> click `Draft a new release`
234
- 5. Click `Choose a tag` and type the new version, for example `v0.1.1`
235
- 6. Write the title and description and click `Publish release`
236
- 7. This will trigger a GitHub action that will publish the new version to NPM
92
+ ```bash
93
+ VALIDATION_DATA_REF=main npm test
94
+ ```
package/lib/cjs/index.js CHANGED
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./utilities/index.js"), exports);
21
+ __exportStar(require("./psychrometrics/index.js"), exports);
22
+ __exportStar(require("./models/index.js"), exports);
6
23
  const index_js_1 = __importDefault(require("./utilities/index.js"));
7
24
  const index_js_2 = __importDefault(require("./psychrometrics/index.js"));
8
25
  const index_js_3 = __importDefault(require("./models/index.js"));
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.a_pmv = a_pmv;
4
- exports.a_pmv_array = a_pmv_array;
5
4
  const utilities_js_1 = require("../utilities/utilities.js");
6
5
  const pmv_js_1 = require("./pmv.js");
7
6
  /**
@@ -28,7 +27,6 @@ const pmv_js_1 = require("./pmv.js");
28
27
  * coefficient (λ) representing the adaptive factors that affect the sense of thermal comfort.
29
28
  *
30
29
  * This is a version that supports scalar arguments.
31
- * @see {@link a_pmv_array} for a version that supports arrays.
32
30
  *
33
31
  * @public
34
32
  * @memberof models
@@ -72,7 +70,32 @@ const pmv_js_1 = require("./pmv.js");
72
70
  * const result = a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme);
73
71
  * console.log(result) //output { a_pmv: 0.48 }
74
72
  */
73
+ const A_PMV_SCHEMA = {
74
+ tdb: { type: "number" },
75
+ tr: { type: "number" },
76
+ vr: { type: "number" },
77
+ rh: { type: "number" },
78
+ met: { type: "number" },
79
+ clo: { type: "number" },
80
+ a_coefficient: { type: "number" },
81
+ wme: { type: "number" },
82
+ units: { enum: ["SI", "IP"] },
83
+ limit_inputs: { type: "boolean", required: false },
84
+ };
75
85
  function a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme = 0, kwargs = {}) {
86
+ var _a;
87
+ (0, utilities_js_1.validateInputs)({
88
+ tdb,
89
+ tr,
90
+ vr,
91
+ rh,
92
+ met,
93
+ clo,
94
+ a_coefficient,
95
+ wme,
96
+ units: ((_a = kwargs.units) !== null && _a !== void 0 ? _a : "SI").toUpperCase(),
97
+ limit_inputs: kwargs.limit_inputs,
98
+ }, A_PMV_SCHEMA);
76
99
  const default_kwargs = {
77
100
  units: "SI",
78
101
  limit_inputs: true,
@@ -82,64 +105,3 @@ function a_pmv(tdb, tr, vr, rh, met, clo, a_coefficient, wme = 0, kwargs = {}) {
82
105
  _pmv = (0, utilities_js_1.round)(_pmv / (1 + a_coefficient * _pmv), 2);
83
106
  return { a_pmv: _pmv };
84
107
  }
85
- /**
86
- * Returns Adaptive Predicted Mean Vote (aPMV) {@link #ref_25|[25]}.
87
- * This index was developed by Yao, R. et al. (2009). The model takes into account factors
88
- * such as culture, climate, social, psychological and behavioral adaptations, which have
89
- * an impact on the senses used to detect thermal comfort. This model uses an adaptive
90
- * coefficient (λ) representing the adaptive factors that affect the sense of thermal comfort.
91
- *
92
- * This is a version that supports arrays.
93
- * @see {@link a_pmv} for a version that supports scalar arguments.
94
- *
95
- * @public
96
- * @memberof models
97
- * @docname Adaptive Predicted Mean Vote (aPMV) (array version)
98
- *
99
- * @param {number[]} tdb - Dry bulb air temperature, default in [°C] in [°F] if `units` = 'IP'
100
- * @param {number[]} tr - Mean radiant temperature, default in [°C] in [°F] if `units` = 'IP'
101
- * @param {number[]} vr - Relative air speed, default in [m/s] in [fps] if `units` = 'IP'
102
- *
103
- * Note: vr is the relative air speed caused by body movement and not the air
104
- * speed measured by the air speed sensor. The relative air speed is the sum of the
105
- * average air speed measured by the sensor plus the activity-generated air speed
106
- * (Vag). Where Vag is the activity-generated air speed caused by motion of
107
- * individual body parts. vr can be calculated using the function v_relative_array in utilities.js.
108
- * @param {number[]} rh - Relative humidity, [%]
109
- * @param {number[]} met - Metabolic rate, [met]
110
- * @param {number[]} clo - Clothing insulation, [clo]
111
- *
112
- * Note: The activity as well as the air speed modify the insulation characteristics
113
- * of the clothing and the adjacent air layer. Consequently, the ISO 7730 states that
114
- * the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects
115
- * for the effect of the body movement for met equal or higher than 1.2 met using
116
- * the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation, clo,
117
- * can be calculated using the function clo_dynamic_array in utilities.js.
118
- * @param {number[]} a_coefficient - Adaptive coefficient
119
- * @param {number[]} wme - External work, default is array of 0
120
- * @param {A_pmvKwargs} kwargs - additional arguments
121
- *
122
- * @returns {number[]} pmv - Predicted Mean Vote
123
- *
124
- * @example
125
- * const tdb = [24, 30],
126
- * const tr = [30, 30],
127
- * const vr = [0.22, 0.22],
128
- * const rh = [50, 50],
129
- * const met = [1.4, 1.4],
130
- * const clo = [0.5, 0.5],
131
- * const a_coefficient = [0.293, 0.293],
132
- * const wme = undefined,
133
- *
134
- * const result = a_pmv_array(tdb, tr, vr, rh, met, clo, a_coefficient, wme);
135
- * console.log(result) //output [0.48, 1.09]
136
- */
137
- function a_pmv_array(tdb, tr, vr, rh, met, clo, a_coefficient, wme, kwargs = {}) {
138
- const default_kwargs = {
139
- units: "SI",
140
- limit_inputs: true,
141
- };
142
- kwargs = Object.assign(default_kwargs, kwargs);
143
- const _pmv = (0, pmv_js_1.pmv_array)(tdb, tr, vr, rh, met, clo, wme, "ISO", kwargs);
144
- return _pmv.map((_pmvValue, i) => (0, utilities_js_1.round)(_pmvValue / (1 + a_coefficient[i] * _pmvValue), 2));
145
- }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.adaptive_ashrae = adaptive_ashrae;
4
- exports.adaptive_ashrae_array = adaptive_ashrae_array;
5
4
  const t_o_js_1 = require("../psychrometrics/t_o.js");
6
5
  const utilities_js_1 = require("../utilities/utilities.js");
7
6
  const adaptive_en_js_1 = require("./adaptive_en.js");
@@ -28,7 +27,6 @@ const adaptive_en_js_1 = require("./adaptive_en.js");
28
27
  * - Occupants are free to adapt their clothing within a range as wide as 0.5 and 1.0 clo
29
28
  * - The prevailing mean (runnin mean) outdoor temperature is between 10 and 33.5 °C
30
29
  *
31
- * @see {@link adaptive_ashrae_array} for a version that supports array arguments
32
30
  *
33
31
  * @public
34
32
  * @memberof models
@@ -79,7 +77,16 @@ const adaptive_en_js_1 = require("./adaptive_en.js");
79
77
  * // The adaptive thermal comfort model can only be used
80
78
  * // if the running mean temperature is higher than 10°C
81
79
  */
80
+ const ADAPTIVE_ASHRAE_SCHEMA = {
81
+ tdb: { type: "number" },
82
+ tr: { type: "number" },
83
+ t_running_mean: { type: "number" },
84
+ v: { type: "number" },
85
+ units: { enum: ["SI", "IP"] },
86
+ limit_inputs: { type: "boolean" },
87
+ };
82
88
  function adaptive_ashrae(tdb, tr, t_running_mean, v, units = "SI", limit_inputs = true) {
89
+ (0, utilities_js_1.validateInputs)({ tdb, tr, t_running_mean, v, units: units.toUpperCase(), limit_inputs }, ADAPTIVE_ASHRAE_SCHEMA);
83
90
  const standard = "ASHRAE";
84
91
  if (units.toUpperCase() === "IP") {
85
92
  ({
@@ -144,146 +151,3 @@ function adaptive_ashrae(tdb, tr, t_running_mean, v, units = "SI", limit_inputs
144
151
  acceptability_90,
145
152
  };
146
153
  }
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
- }