jsthermalcomfort 0.1.4 → 0.2.0

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 (200) hide show
  1. package/README.md +64 -28
  2. package/lib/cjs/jos3_functions/JOS3Defaults.js +34 -0
  3. package/lib/cjs/jos3_functions/bfb_rate.js +66 -0
  4. package/lib/cjs/jos3_functions/bsa_rate.js +28 -0
  5. package/lib/cjs/jos3_functions/capacity.js +103 -0
  6. package/lib/cjs/jos3_functions/conductance.js +171 -0
  7. package/lib/cjs/jos3_functions/local_bsa.js +55 -0
  8. package/lib/cjs/jos3_functions/matrix.js +341 -0
  9. package/lib/cjs/jos3_functions/thermoregulation/ava_blood_flow.js +75 -0
  10. package/lib/cjs/jos3_functions/thermoregulation/basal_met.js +55 -0
  11. package/lib/cjs/jos3_functions/thermoregulation/clo_area_factor.js +14 -0
  12. package/lib/cjs/jos3_functions/thermoregulation/conv_coef.js +127 -0
  13. package/lib/cjs/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.js +86 -0
  14. package/lib/cjs/jos3_functions/thermoregulation/dry_r.js +47 -0
  15. package/lib/cjs/jos3_functions/thermoregulation/error_signals.js +55 -0
  16. package/lib/cjs/jos3_functions/thermoregulation/evaporation.js +94 -0
  17. package/lib/cjs/jos3_functions/thermoregulation/fixed_hc.js +42 -0
  18. package/lib/cjs/jos3_functions/thermoregulation/fixed_hr.js +43 -0
  19. package/lib/cjs/jos3_functions/thermoregulation/local_mbase.js +70 -0
  20. package/lib/cjs/jos3_functions/thermoregulation/local_q_work.js +48 -0
  21. package/lib/cjs/jos3_functions/thermoregulation/nonshivering.js +95 -0
  22. package/lib/cjs/jos3_functions/thermoregulation/operative_temp.js +42 -0
  23. package/lib/cjs/jos3_functions/thermoregulation/rad_coef.js +74 -0
  24. package/lib/cjs/jos3_functions/thermoregulation/resp_heat_loss.js +24 -0
  25. package/lib/cjs/jos3_functions/thermoregulation/shivering.js +133 -0
  26. package/lib/cjs/jos3_functions/thermoregulation/skin_blood_flow.js +75 -0
  27. package/lib/cjs/jos3_functions/thermoregulation/sum_bf.js +50 -0
  28. package/lib/cjs/jos3_functions/thermoregulation/sum_m.js +66 -0
  29. package/lib/cjs/jos3_functions/thermoregulation/wet_r.js +53 -0
  30. package/lib/cjs/jos3_functions/validate_body_parameters.js +32 -0
  31. package/lib/cjs/jos3_functions/weight_rate.js +31 -0
  32. package/lib/cjs/models/JOS3.js +953 -0
  33. package/lib/cjs/models/index.js +29 -27
  34. package/lib/cjs/supa.js +74 -0
  35. package/lib/cjs/types/jos3_functions/JOS3Defaults.d.ts +27 -0
  36. package/lib/cjs/types/jos3_functions/JOS3Defaults.d.ts.map +1 -0
  37. package/lib/cjs/types/jos3_functions/bfb_rate.d.ts +13 -0
  38. package/lib/cjs/types/jos3_functions/bfb_rate.d.ts.map +1 -0
  39. package/lib/cjs/types/jos3_functions/bsa_rate.d.ts +15 -0
  40. package/lib/cjs/types/jos3_functions/bsa_rate.d.ts.map +1 -0
  41. package/lib/cjs/types/jos3_functions/capacity.d.ts +19 -0
  42. package/lib/cjs/types/jos3_functions/capacity.d.ts.map +1 -0
  43. package/lib/cjs/types/jos3_functions/conductance.d.ts +13 -0
  44. package/lib/cjs/types/jos3_functions/conductance.d.ts.map +1 -0
  45. package/lib/cjs/types/jos3_functions/local_bsa.d.ts +19 -0
  46. package/lib/cjs/types/jos3_functions/local_bsa.d.ts.map +1 -0
  47. package/lib/cjs/types/jos3_functions/matrix.d.ts +63 -0
  48. package/lib/cjs/types/jos3_functions/matrix.d.ts.map +1 -0
  49. package/lib/cjs/types/jos3_functions/thermoregulation/ava_blood_flow.d.ts +33 -0
  50. package/lib/cjs/types/jos3_functions/thermoregulation/ava_blood_flow.d.ts.map +1 -0
  51. package/lib/cjs/types/jos3_functions/thermoregulation/basal_met.d.ts +13 -0
  52. package/lib/cjs/types/jos3_functions/thermoregulation/basal_met.d.ts.map +1 -0
  53. package/lib/cjs/types/jos3_functions/thermoregulation/clo_area_factor.d.ts +9 -0
  54. package/lib/cjs/types/jos3_functions/thermoregulation/clo_area_factor.d.ts.map +1 -0
  55. package/lib/cjs/types/jos3_functions/thermoregulation/conv_coef.d.ts +16 -0
  56. package/lib/cjs/types/jos3_functions/thermoregulation/conv_coef.d.ts.map +1 -0
  57. package/lib/cjs/types/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.d.ts +37 -0
  58. package/lib/cjs/types/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.d.ts.map +1 -0
  59. package/lib/cjs/types/jos3_functions/thermoregulation/dry_r.d.ts +12 -0
  60. package/lib/cjs/types/jos3_functions/thermoregulation/dry_r.d.ts.map +1 -0
  61. package/lib/cjs/types/jos3_functions/thermoregulation/error_signals.d.ts +27 -0
  62. package/lib/cjs/types/jos3_functions/thermoregulation/error_signals.d.ts.map +1 -0
  63. package/lib/cjs/types/jos3_functions/thermoregulation/evaporation.d.ts +46 -0
  64. package/lib/cjs/types/jos3_functions/thermoregulation/evaporation.d.ts.map +1 -0
  65. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hc.d.ts +5 -0
  66. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hc.d.ts.map +1 -0
  67. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hr.d.ts +9 -0
  68. package/lib/cjs/types/jos3_functions/thermoregulation/fixed_hr.d.ts.map +1 -0
  69. package/lib/cjs/types/jos3_functions/thermoregulation/local_mbase.d.ts +14 -0
  70. package/lib/cjs/types/jos3_functions/thermoregulation/local_mbase.d.ts.map +1 -0
  71. package/lib/cjs/types/jos3_functions/thermoregulation/local_q_work.d.ts +12 -0
  72. package/lib/cjs/types/jos3_functions/thermoregulation/local_q_work.d.ts.map +1 -0
  73. package/lib/cjs/types/jos3_functions/thermoregulation/nonshivering.d.ts +16 -0
  74. package/lib/cjs/types/jos3_functions/thermoregulation/nonshivering.d.ts.map +1 -0
  75. package/lib/cjs/types/jos3_functions/thermoregulation/operative_temp.d.ts +13 -0
  76. package/lib/cjs/types/jos3_functions/thermoregulation/operative_temp.d.ts.map +1 -0
  77. package/lib/cjs/types/jos3_functions/thermoregulation/rad_coef.d.ts +10 -0
  78. package/lib/cjs/types/jos3_functions/thermoregulation/rad_coef.d.ts.map +1 -0
  79. package/lib/cjs/types/jos3_functions/thermoregulation/resp_heat_loss.d.ts +27 -0
  80. package/lib/cjs/types/jos3_functions/thermoregulation/resp_heat_loss.d.ts.map +1 -0
  81. package/lib/cjs/types/jos3_functions/thermoregulation/shivering.d.ts +27 -0
  82. package/lib/cjs/types/jos3_functions/thermoregulation/shivering.d.ts.map +1 -0
  83. package/lib/cjs/types/jos3_functions/thermoregulation/skin_blood_flow.d.ts +15 -0
  84. package/lib/cjs/types/jos3_functions/thermoregulation/skin_blood_flow.d.ts.map +1 -0
  85. package/lib/cjs/types/jos3_functions/thermoregulation/sum_bf.d.ts +15 -0
  86. package/lib/cjs/types/jos3_functions/thermoregulation/sum_bf.d.ts.map +1 -0
  87. package/lib/cjs/types/jos3_functions/thermoregulation/sum_m.d.ts +39 -0
  88. package/lib/cjs/types/jos3_functions/thermoregulation/sum_m.d.ts.map +1 -0
  89. package/lib/cjs/types/jos3_functions/thermoregulation/wet_r.d.ts +13 -0
  90. package/lib/cjs/types/jos3_functions/thermoregulation/wet_r.d.ts.map +1 -0
  91. package/lib/cjs/types/jos3_functions/validate_body_parameters.d.ts +12 -0
  92. package/lib/cjs/types/jos3_functions/validate_body_parameters.d.ts.map +1 -0
  93. package/lib/cjs/types/jos3_functions/weight_rate.d.ts +20 -0
  94. package/lib/cjs/types/jos3_functions/weight_rate.d.ts.map +1 -0
  95. package/lib/cjs/types/models/JOS3.d.ts +385 -0
  96. package/lib/cjs/types/models/JOS3.d.ts.map +1 -0
  97. package/lib/cjs/types/models/index.d.ts +56 -54
  98. package/lib/cjs/types/models/index.d.ts.map +1 -1
  99. package/lib/cjs/types/supa.d.ts +25 -0
  100. package/lib/cjs/types/supa.d.ts.map +1 -0
  101. package/lib/esm/jos3_functions/JOS3Defaults.js +32 -0
  102. package/lib/esm/jos3_functions/bfb_rate.js +36 -0
  103. package/lib/esm/jos3_functions/bsa_rate.js +21 -0
  104. package/lib/esm/jos3_functions/capacity.js +96 -0
  105. package/lib/esm/jos3_functions/conductance.js +141 -0
  106. package/lib/esm/jos3_functions/local_bsa.js +25 -0
  107. package/lib/esm/jos3_functions/matrix.js +311 -0
  108. package/lib/esm/jos3_functions/thermoregulation/ava_blood_flow.js +45 -0
  109. package/lib/esm/jos3_functions/thermoregulation/basal_met.js +48 -0
  110. package/lib/esm/jos3_functions/thermoregulation/clo_area_factor.js +10 -0
  111. package/lib/esm/jos3_functions/thermoregulation/conv_coef.js +97 -0
  112. package/lib/esm/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.js +56 -0
  113. package/lib/esm/jos3_functions/thermoregulation/dry_r.js +20 -0
  114. package/lib/esm/jos3_functions/thermoregulation/error_signals.js +28 -0
  115. package/lib/esm/jos3_functions/thermoregulation/evaporation.js +63 -0
  116. package/lib/esm/jos3_functions/thermoregulation/fixed_hc.js +12 -0
  117. package/lib/esm/jos3_functions/thermoregulation/fixed_hr.js +13 -0
  118. package/lib/esm/jos3_functions/thermoregulation/local_mbase.js +40 -0
  119. package/lib/esm/jos3_functions/thermoregulation/local_q_work.js +21 -0
  120. package/lib/esm/jos3_functions/thermoregulation/nonshivering.js +65 -0
  121. package/lib/esm/jos3_functions/thermoregulation/operative_temp.js +15 -0
  122. package/lib/esm/jos3_functions/thermoregulation/rad_coef.js +44 -0
  123. package/lib/esm/jos3_functions/thermoregulation/resp_heat_loss.js +20 -0
  124. package/lib/esm/jos3_functions/thermoregulation/shivering.js +102 -0
  125. package/lib/esm/jos3_functions/thermoregulation/skin_blood_flow.js +45 -0
  126. package/lib/esm/jos3_functions/thermoregulation/sum_bf.js +23 -0
  127. package/lib/esm/jos3_functions/thermoregulation/sum_m.js +39 -0
  128. package/lib/esm/jos3_functions/thermoregulation/wet_r.js +23 -0
  129. package/lib/esm/jos3_functions/validate_body_parameters.js +25 -0
  130. package/lib/esm/jos3_functions/weight_rate.js +24 -0
  131. package/lib/esm/models/JOS3.js +923 -0
  132. package/lib/esm/models/index.js +29 -27
  133. package/lib/esm/supa.js +62 -0
  134. package/lib/esm/types/jos3_functions/JOS3Defaults.d.ts +27 -0
  135. package/lib/esm/types/jos3_functions/JOS3Defaults.d.ts.map +1 -0
  136. package/lib/esm/types/jos3_functions/bfb_rate.d.ts +13 -0
  137. package/lib/esm/types/jos3_functions/bfb_rate.d.ts.map +1 -0
  138. package/lib/esm/types/jos3_functions/bsa_rate.d.ts +15 -0
  139. package/lib/esm/types/jos3_functions/bsa_rate.d.ts.map +1 -0
  140. package/lib/esm/types/jos3_functions/capacity.d.ts +19 -0
  141. package/lib/esm/types/jos3_functions/capacity.d.ts.map +1 -0
  142. package/lib/esm/types/jos3_functions/conductance.d.ts +13 -0
  143. package/lib/esm/types/jos3_functions/conductance.d.ts.map +1 -0
  144. package/lib/esm/types/jos3_functions/local_bsa.d.ts +19 -0
  145. package/lib/esm/types/jos3_functions/local_bsa.d.ts.map +1 -0
  146. package/lib/esm/types/jos3_functions/matrix.d.ts +63 -0
  147. package/lib/esm/types/jos3_functions/matrix.d.ts.map +1 -0
  148. package/lib/esm/types/jos3_functions/thermoregulation/ava_blood_flow.d.ts +33 -0
  149. package/lib/esm/types/jos3_functions/thermoregulation/ava_blood_flow.d.ts.map +1 -0
  150. package/lib/esm/types/jos3_functions/thermoregulation/basal_met.d.ts +13 -0
  151. package/lib/esm/types/jos3_functions/thermoregulation/basal_met.d.ts.map +1 -0
  152. package/lib/esm/types/jos3_functions/thermoregulation/clo_area_factor.d.ts +9 -0
  153. package/lib/esm/types/jos3_functions/thermoregulation/clo_area_factor.d.ts.map +1 -0
  154. package/lib/esm/types/jos3_functions/thermoregulation/conv_coef.d.ts +16 -0
  155. package/lib/esm/types/jos3_functions/thermoregulation/conv_coef.d.ts.map +1 -0
  156. package/lib/esm/types/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.d.ts +37 -0
  157. package/lib/esm/types/jos3_functions/thermoregulation/cr_ms_fat_blood_flow.d.ts.map +1 -0
  158. package/lib/esm/types/jos3_functions/thermoregulation/dry_r.d.ts +12 -0
  159. package/lib/esm/types/jos3_functions/thermoregulation/dry_r.d.ts.map +1 -0
  160. package/lib/esm/types/jos3_functions/thermoregulation/error_signals.d.ts +27 -0
  161. package/lib/esm/types/jos3_functions/thermoregulation/error_signals.d.ts.map +1 -0
  162. package/lib/esm/types/jos3_functions/thermoregulation/evaporation.d.ts +46 -0
  163. package/lib/esm/types/jos3_functions/thermoregulation/evaporation.d.ts.map +1 -0
  164. package/lib/esm/types/jos3_functions/thermoregulation/fixed_hc.d.ts +5 -0
  165. package/lib/esm/types/jos3_functions/thermoregulation/fixed_hc.d.ts.map +1 -0
  166. package/lib/esm/types/jos3_functions/thermoregulation/fixed_hr.d.ts +9 -0
  167. package/lib/esm/types/jos3_functions/thermoregulation/fixed_hr.d.ts.map +1 -0
  168. package/lib/esm/types/jos3_functions/thermoregulation/local_mbase.d.ts +14 -0
  169. package/lib/esm/types/jos3_functions/thermoregulation/local_mbase.d.ts.map +1 -0
  170. package/lib/esm/types/jos3_functions/thermoregulation/local_q_work.d.ts +12 -0
  171. package/lib/esm/types/jos3_functions/thermoregulation/local_q_work.d.ts.map +1 -0
  172. package/lib/esm/types/jos3_functions/thermoregulation/nonshivering.d.ts +16 -0
  173. package/lib/esm/types/jos3_functions/thermoregulation/nonshivering.d.ts.map +1 -0
  174. package/lib/esm/types/jos3_functions/thermoregulation/operative_temp.d.ts +13 -0
  175. package/lib/esm/types/jos3_functions/thermoregulation/operative_temp.d.ts.map +1 -0
  176. package/lib/esm/types/jos3_functions/thermoregulation/rad_coef.d.ts +10 -0
  177. package/lib/esm/types/jos3_functions/thermoregulation/rad_coef.d.ts.map +1 -0
  178. package/lib/esm/types/jos3_functions/thermoregulation/resp_heat_loss.d.ts +27 -0
  179. package/lib/esm/types/jos3_functions/thermoregulation/resp_heat_loss.d.ts.map +1 -0
  180. package/lib/esm/types/jos3_functions/thermoregulation/shivering.d.ts +27 -0
  181. package/lib/esm/types/jos3_functions/thermoregulation/shivering.d.ts.map +1 -0
  182. package/lib/esm/types/jos3_functions/thermoregulation/skin_blood_flow.d.ts +15 -0
  183. package/lib/esm/types/jos3_functions/thermoregulation/skin_blood_flow.d.ts.map +1 -0
  184. package/lib/esm/types/jos3_functions/thermoregulation/sum_bf.d.ts +15 -0
  185. package/lib/esm/types/jos3_functions/thermoregulation/sum_bf.d.ts.map +1 -0
  186. package/lib/esm/types/jos3_functions/thermoregulation/sum_m.d.ts +39 -0
  187. package/lib/esm/types/jos3_functions/thermoregulation/sum_m.d.ts.map +1 -0
  188. package/lib/esm/types/jos3_functions/thermoregulation/wet_r.d.ts +13 -0
  189. package/lib/esm/types/jos3_functions/thermoregulation/wet_r.d.ts.map +1 -0
  190. package/lib/esm/types/jos3_functions/validate_body_parameters.d.ts +12 -0
  191. package/lib/esm/types/jos3_functions/validate_body_parameters.d.ts.map +1 -0
  192. package/lib/esm/types/jos3_functions/weight_rate.d.ts +20 -0
  193. package/lib/esm/types/jos3_functions/weight_rate.d.ts.map +1 -0
  194. package/lib/esm/types/models/JOS3.d.ts +385 -0
  195. package/lib/esm/types/models/JOS3.d.ts.map +1 -0
  196. package/lib/esm/types/models/index.d.ts +56 -54
  197. package/lib/esm/types/models/index.d.ts.map +1 -1
  198. package/lib/esm/types/supa.d.ts +25 -0
  199. package/lib/esm/types/supa.d.ts.map +1 -0
  200. package/package.json +5 -4
package/README.md CHANGED
@@ -9,12 +9,12 @@
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] |
11
11
 
12
- Package to calculate several thermal comfort indices (e.g. PMV, PPD, SET, adaptive) and convert physical variables.
12
+ Package to calculate thermophysiological, thermal comfort, thermal stress indices, in JavaScript.
13
13
 
14
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
15
 
16
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)
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
20
  [build_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/build.yml
@@ -23,13 +23,17 @@ Please cite us if you use this package: [Tartarini, F., Schiavon, S., 2020. pyth
23
23
  [synk_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/snyk.yml
24
24
  [npm_link]: https://www.npmjs.com/package/jsthermalcomfort
25
25
 
26
+ # Official Documentation Website
27
+
28
+ [https://federicotartarini.github.io/jsthermalcomfort/](https://federicotartarini.github.io/jsthermalcomfort/)
29
+
26
30
  # Installation
27
31
 
28
32
  ```bash
29
33
  npm install jsthermalcomfort
30
34
  ```
31
35
 
32
- if you want to use jsthermalcomfort package without installing it on your local machine, you can import with:
36
+ If you want to use jsthermalcomfort package without installing it on your local machine, you can import with:
33
37
 
34
38
  [`https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/`](https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/)
35
39
 
@@ -57,11 +61,11 @@ You can also import it in the website directly, and caution that you need to mar
57
61
 
58
62
  # Examples and Tutorials
59
63
 
60
- ## [Examples](https://github.com/FedericoTartarini/jsthermalcomfort/tree/main/docs/examples) files on how to use some of the functions
64
+ We developed a few [examples](https://github.com/FedericoTartarini/jsthermalcomfort/tree/main/docs/examples) files on how to use some of the functions.
61
65
 
62
66
  Here is a list of examples running in the browser:
63
67
 
64
- - [PHS](/jsthermalcomfort/examples/phs.html)
68
+ - [PHS](/docs/examples/phs.html)
65
69
 
66
70
  # Contributing
67
71
 
@@ -77,11 +81,16 @@ When [reporting a bug](https://github.com/FedericoTartarini/jsthermalcomfort/iss
77
81
 
78
82
  ## Documentation improvements
79
83
 
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.
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.
81
89
 
82
90
  ## Feature requests and feedback
83
91
 
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)
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)
85
94
 
86
95
  If you are proposing a feature:
87
96
 
@@ -89,7 +98,7 @@ If you are proposing a feature:
89
98
  - Keep the scope as narrow as possible, to make it easier to implement.
90
99
  - Remember that this is a volunteer-driven project, and that code contributions are welcome :)
91
100
 
92
- ## Development
101
+ ## Local development
93
102
 
94
103
  To set up jsthermalcomfort for local development:
95
104
 
@@ -100,6 +109,12 @@ To set up jsthermalcomfort for local development:
100
109
  git clone git@github.com:FedericoTartarini/jsthermalcomfort.git
101
110
  ```
102
111
 
112
+ We use git submodules to pull validation data for the tests, to ensure tests are successful please run:
113
+
114
+ ```bash
115
+ git submodule update --init --recursive
116
+ ```
117
+
103
118
  3. Create a branch for local development. The naming rule for new branch are, as follows:
104
119
 
105
120
  - If this update is for a new feature Feature/feature_name_here
@@ -116,6 +131,12 @@ To set up jsthermalcomfort for local development:
116
131
 
117
132
  4. When you’re done making changes run all tests using Jest:
118
133
 
134
+ - Install dependencies
135
+
136
+ ```bash
137
+ npm install
138
+ ```
139
+
119
140
  ```bash
120
141
  npm run test
121
142
  ```
@@ -152,7 +173,8 @@ To set up jsthermalcomfort for local development:
152
173
  git push origin name-of-your-bugfix-or-feature
153
174
  ```
154
175
 
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:
176
+ 5. Submit a pull request after you have done all your modifications and tested your work. The pull request should
177
+ include a detailed description of your work:
156
178
  - What this pull request is about
157
179
  - Have you tested your work
158
180
  - Will this work affect other component in the product
@@ -166,34 +188,48 @@ For merging, you should:
166
188
  - Include passing tests (run `npm run test`).
167
189
  - Update documentation when there’s new API, functionality etc.
168
190
 
169
- ### Documentation
191
+ ## Documentation
170
192
 
171
- We are using [JSDoc](https://jsdoc.app/) and [documentation.js](https://github.com/documentationjs/documentation) to automatically build the documentation.
193
+ We are using [JSDoc](https://jsdoc.app/) and [documentation.js](https://github.com/documentationjs/documentation) to
194
+ automatically build the documentation.
172
195
 
173
- ### To add a function
196
+ All the files needed to generate the documentation can be found in the `docs_theme` repository.
197
+ After updating the Markdown files, please run the command:
174
198
 
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`.
199
+ ```bash
200
+ npm run docs
201
+ ```
179
202
 
180
- ### Tips
203
+ Please ignore the `docs` folder, this folder contains all the files generated by the above command.
181
204
 
182
- To run a subset of tests you can do the following:
205
+ ## How to add a new model to jsthermalcomfort
183
206
 
184
- ```bash
185
- npm run test -- '<path_to_test_file>' -t '<test_pattern/name>'
186
- ```
207
+ 1. Add a file under `src/models/` with the name of the function/model and document it.
208
+ 2. Add any related functions that are used by your function either in `src/utilities/utilities.js`
209
+ or `src/psychrometrics/`. See existing code as example.
210
+ - In order to add a new function/API to the library you should mark that function as `@public`, add it to its
211
+ corresponding category, for example for models you should do `@memberof models`, and lastly you should give it a
212
+ proper name for the documentation with `@docname`, for example: `@docname Clothing prediction`. It is important to
213
+ note that you should also add the `@public` tag to any types the function exposes/uses.
214
+ 3. Test your function by writing a test in `tests/models/<name_of_model>.test.js`.
215
+ 4. To run a subset of tests you can do the following:
216
+
217
+ ```bash
218
+ npm run test -- '<path_to_test_file>' -t '<test_pattern/name>'
219
+ ```
187
220
 
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.
221
+ If you are using VSCode you can use
222
+ the [Jest Runner extension](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to easily
223
+ run subset of tests.
189
224
 
190
- ### Releases
225
+ ## How to publish a new version of jsthermalcomfort
191
226
 
192
227
  To create a new release do the following:
193
228
 
194
229
  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
230
+ 2. Run `npm run build` to update the `lib` directory (output with types of the library that gets published to NPM)
231
+ 3. Commit the updates
232
+ 4. In GitHub go to Releases -> click `Draft a new release`
233
+ 5. Click `Choose a tag` and type the new version, for example `v0.1.1`
234
+ 6. Write the title and description and click `Publish release`
235
+ 7. This will trigger a GitHub action that will publish the new version to NPM
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const JOS3Defaults = {
4
+ // Body information
5
+ height: 1.72,
6
+ weight: 74.43,
7
+ age: 20,
8
+ body_fat: 15,
9
+ cardiac_index: 2.59,
10
+ blood_flow_rate: 290,
11
+ physical_activity_ratio: 1.25,
12
+ metabolic_rate: 1.0,
13
+ sex: "male",
14
+ posture: "standing",
15
+ bmr_equation: "harris-benedict",
16
+ bsa_equation: "dubois",
17
+ local_bsa: [
18
+ 0.11, 0.029, 0.175, 0.161, 0.221, 0.096, 0.063, 0.05, 0.096, 0.063, 0.05,
19
+ 0.209, 0.112, 0.056, 0.209, 0.112, 0.056,
20
+ ],
21
+ // Environment information
22
+ core_temperature: 37,
23
+ skin_temperature: 34,
24
+ other_body_temperature: 36,
25
+ dry_bulb_air_temperature: 28.8,
26
+ mean_radiant_temperature: 28.8,
27
+ relative_humidity: 50,
28
+ air_speed: 0.1,
29
+ // Clothing information
30
+ clothing_insulation: 0,
31
+ clothing_vapor_permeation_efficiency: 0.45,
32
+ lewis_rate: 16.5, // [K/kPa]
33
+ };
34
+ exports.default = JOS3Defaults;
@@ -0,0 +1,66 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.bfb_rate = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("./JOS3Defaults.js"));
31
+ const bsa_rate_js_1 = require("./bsa_rate.js");
32
+ const validate_body_parameters_js_1 = require("./validate_body_parameters.js");
33
+ const math = __importStar(require("mathjs"));
34
+ /**
35
+ * Calculate the ratio of basal blood flow (BFB) of the standard body (290 L/h).
36
+ *
37
+ * @param {number} height - Body height [m]. The default is 1.72.
38
+ * @param {number} weight - Body weight [kg]. The default is 74.43.
39
+ * @param {string} bsa_equation - The equation name of bsa calculation. Choose a name from "dubois", "takahira", "fujimoto", or "kurazumi". The default is "dubois".
40
+ * @param {number} age - age [years]. The default is 20.
41
+ * @param {number} ci - Cardiac index [L/min/㎡]. The default is 2.59.
42
+ *
43
+ * @returns {number} - Basal blood flow rate.
44
+ */
45
+ function bfb_rate(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation, age = JOS3Defaults_js_1.default.age, ci = JOS3Defaults_js_1.default.cardiac_index) {
46
+ (0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, age);
47
+ ci *= 60;
48
+ if (age < 50) {
49
+ ci *= 1;
50
+ }
51
+ else if (age < 60) {
52
+ ci *= 0.85;
53
+ }
54
+ else if (age < 70) {
55
+ ci *= 0.75;
56
+ }
57
+ else {
58
+ // age >= 70
59
+ ci *= 0.7;
60
+ }
61
+ const bfb_all = ci *
62
+ (0, bsa_rate_js_1.bsa_rate)(height, weight, bsa_equation) *
63
+ math.sum(JOS3Defaults_js_1.default.local_bsa);
64
+ return bfb_all / JOS3Defaults_js_1.default.blood_flow_rate;
65
+ }
66
+ exports.bfb_rate = bfb_rate;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.bsa_rate = void 0;
7
+ const JOS3Defaults_js_1 = __importDefault(require("../jos3_functions/JOS3Defaults.js"));
8
+ const validate_body_parameters_js_1 = require("./validate_body_parameters.js");
9
+ const utilities_js_1 = require("../utilities/utilities.js");
10
+ /**
11
+ * Calculates the body surface area rate based on the given height, weight and
12
+ * BSA equation.
13
+ *
14
+ * @param {number} [height=JOS3Defaults.height] - The height of the person in
15
+ * meters.
16
+ * @param {number} [weight=JOS3Defaults.weight] - The weight of the person in
17
+ * kilograms.
18
+ * @param {string} [bsa_equation=JOS3Defaults.bsa_equation] - The BSA equation
19
+ * to use for calculation.
20
+ *
21
+ * @returns {number} The body surface area rate.
22
+ */
23
+ function bsa_rate(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation) {
24
+ (0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, bsa_equation);
25
+ const bsa_all = (0, utilities_js_1.body_surface_area)(weight, height, bsa_equation);
26
+ return bsa_all / JOS3Defaults_js_1.default.local_bsa.reduce((t, c) => t + c, 0);
27
+ }
28
+ exports.bsa_rate = bsa_rate;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.capacity = void 0;
7
+ const JOS3Defaults_js_1 = __importDefault(require("./JOS3Defaults.js"));
8
+ const validate_body_parameters_js_1 = require("./validate_body_parameters.js");
9
+ const bfb_rate_js_1 = require("./bfb_rate.js");
10
+ const weight_rate_js_1 = require("./weight_rate.js");
11
+ const matrix_js_1 = require("./matrix.js");
12
+ /**
13
+ * Calculate thermal capacity in Joules per Kelvin (J/K).
14
+ * Derived from Yokoyama's model, assuming blood's heat as 1.0 [kcal/L.K].
15
+ *
16
+ * @param {number} [height=JOS3Defaults.height] - Body height in meters. Default
17
+ * is 1.72.
18
+ * @param {number} [weight=JOS3Defaults.weight] - Body weight in kg. Default is
19
+ * 74.43.
20
+ * @param {string} [bsa_equation=JOS3Defaults.bsa_equation] - Equation name for
21
+ * bsa calc. Must be from "dubois","takahira", "fujimoto", "kurazumi".
22
+ * Default is "dubois".
23
+ * @param {number} [age=JOS3Defaults.age] - Age in years. Default is 20.
24
+ * @param {number} [ci=JOS3Defaults.cardiac_index] - Cardiac index in L/min/㎡.
25
+ * Default is 2.59.
26
+
27
+ * @returns {number[]} - Thermal capacity in W/K. Shape is (NUM_NODES).
28
+ */
29
+ function capacity(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation, age = JOS3Defaults_js_1.default.age, ci = JOS3Defaults_js_1.default.cardiac_index) {
30
+ (0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, age);
31
+ // artery [Wh/K]
32
+ let cap_art = [
33
+ 0.096, 0.025, 0.12, 0.111, 0.265, 0.0186, 0.0091, 0.0044, 0.0186, 0.0091,
34
+ 0.0044, 0.0813, 0.04, 0.0103, 0.0813, 0.04, 0.0103,
35
+ ];
36
+ // vein [Wh/K]
37
+ let cap_vein = [
38
+ 0.321, 0.085, 0.424, 0.39, 0.832, 0.046, 0.024, 0.01, 0.046, 0.024, 0.01,
39
+ 0.207, 0.1, 0.024, 0.207, 0.1, 0.024,
40
+ ];
41
+ // superficial vein [Wh/K]
42
+ let cap_sfv = [
43
+ 0, 0, 0, 0, 0, 0.025, 0.015, 0.011, 0.025, 0.015, 0.011, 0.074, 0.05, 0.021,
44
+ 0.074, 0.05, 0.021,
45
+ ];
46
+ // central blood [Wh/K]
47
+ let cap_cb = 1.999;
48
+ // core [Wh/K]
49
+ let cap_cr = [
50
+ 1.7229, 0.564, 10.2975, 9.3935, 4.488, 1.6994, 1.1209, 0.1536, 1.6994,
51
+ 1.1209, 0.1536, 5.3117, 2.867, 0.2097, 5.3117, 2.867, 0.2097,
52
+ ];
53
+ // muscle [Wh/K]
54
+ let cap_ms = [
55
+ 0.305, 0.0, 0.0, 0.0, 7.409, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
56
+ 0.0, 0.0, 0.0,
57
+ ];
58
+ // fat [Wh/K]
59
+ let cap_fat = [
60
+ 0.203, 0.0, 0.0, 0.0, 1.947, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
61
+ 0.0, 0.0, 0.0,
62
+ ];
63
+ // skin [Wh/K]
64
+ let cap_sk = [
65
+ 0.1885, 0.058, 0.441, 0.406, 0.556, 0.126, 0.084, 0.088, 0.126, 0.084,
66
+ 0.088, 0.334, 0.169, 0.107, 0.334, 0.169, 0.107,
67
+ ];
68
+ // Changes the values based on the standard body
69
+ const bfbr = (0, bfb_rate_js_1.bfb_rate)(height, weight, bsa_equation, age, ci);
70
+ const wr = (0, weight_rate_js_1.weight_rate)(weight);
71
+ cap_art = cap_art.map((x) => x * bfbr);
72
+ cap_vein = cap_vein.map((x) => x * bfbr);
73
+ cap_sfv = cap_sfv.map((x) => x * bfbr);
74
+ cap_cb = cap_cb * bfbr;
75
+ cap_cr = cap_cr.map((x) => x * wr);
76
+ cap_ms = cap_ms.map((x) => x * wr);
77
+ cap_fat = cap_fat.map((x) => x * wr);
78
+ cap_sk = cap_sk.map((x) => x * wr);
79
+ let cap_whole = Array(matrix_js_1.NUM_NODES).fill(0);
80
+ cap_whole[0] = cap_cb;
81
+ for (let i = 0; i < matrix_js_1.BODY_NAMES.length; i++) {
82
+ // Dictionary of indices in each body segment
83
+ // key = layer name, value = index of matrix
84
+ let bn = matrix_js_1.BODY_NAMES[i];
85
+ let index_of = matrix_js_1.IDICT[bn];
86
+ // Common
87
+ cap_whole[index_of["artery"]] = cap_art[i];
88
+ cap_whole[index_of["vein"]] = cap_vein[i];
89
+ cap_whole[index_of["core"]] = cap_cr[i];
90
+ cap_whole[index_of["skin"]] = cap_sk[i];
91
+ // Only limbs
92
+ if (i >= 5) {
93
+ cap_whole[index_of["sfvein"]] = cap_sfv[i];
94
+ }
95
+ // If the segment has a muscle or fat layer
96
+ if (index_of["muscle"] !== null || index_of["fat"] !== null) {
97
+ cap_whole[index_of["muscle"]] = cap_ms[i];
98
+ cap_whole[index_of["fat"]] = cap_fat[i];
99
+ }
100
+ }
101
+ return cap_whole.map((x) => x * 3600);
102
+ }
103
+ exports.capacity = capacity;
@@ -0,0 +1,171 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.conductance = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("./JOS3Defaults.js"));
31
+ const validate_body_parameters_js_1 = require("./validate_body_parameters.js");
32
+ const weight_rate_js_1 = require("./weight_rate.js");
33
+ const bsa_rate_js_1 = require("./bsa_rate.js");
34
+ const matrix_js_1 = require("./matrix.js");
35
+ const math = __importStar(require("mathjs"));
36
+ /**
37
+ * Calculate thermal conductance between layers.
38
+
39
+ * @param {number} height - Body height in [m]. Default is 1.72.
40
+ * @param {number} weight - Body weight in [kg]. Default is 74.43.
41
+ * @param {string} bsa_equation - The equation name (str) of bsa calculation. Choose a name from "dubois", "takahira", "fujimoto", or "kurazumi". Default is "dubois".
42
+ * @param {number} fat - Body fat rate in [%]. Default is 15.
43
+
44
+ * @returns {math.Matrix} conductance - Thermal conductance between layers in [W/K]. The shape is (NUM_NODES, NUM_NODES).
45
+ */
46
+ function conductance(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation, fat = JOS3Defaults_js_1.default.body_fat) {
47
+ (0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, undefined, fat);
48
+ let cdt_cr_sk;
49
+ if (fat < 12.5) {
50
+ cdt_cr_sk = math.matrix([
51
+ 1.341, 0.93, 1.879, 1.729, 2.37, 1.557, 1.018, 2.21, 1.557, 1.018, 2.21,
52
+ 2.565, 1.378, 3.404, 2.565, 1.378, 3.404,
53
+ ]);
54
+ }
55
+ else if (fat < 17.5) {
56
+ cdt_cr_sk = math.matrix([
57
+ 1.311, 0.909, 1.785, 1.643, 2.251, 1.501, 0.982, 2.183, 1.501, 0.982,
58
+ 2.183, 2.468, 1.326, 3.37, 2.468, 1.326, 3.37,
59
+ ]);
60
+ }
61
+ else if (fat < 22.5) {
62
+ cdt_cr_sk = math.matrix([
63
+ 1.282, 0.889, 1.698, 1.563, 2.142, 1.448, 0.947, 2.156, 1.448, 0.947,
64
+ 2.156, 2.375, 1.276, 3.337, 2.375, 1.276, 3.337,
65
+ ]);
66
+ }
67
+ else if (fat < 27.5) {
68
+ cdt_cr_sk = math.matrix([
69
+ 1.255, 0.87, 1.618, 1.488, 2.04, 1.396, 0.913, 2.13, 1.396, 0.913, 2.13,
70
+ 2.285, 1.227, 3.304, 2.285, 1.227, 3.304,
71
+ ]);
72
+ }
73
+ else {
74
+ // fat >= 27.5
75
+ cdt_cr_sk = math.matrix([
76
+ 1.227, 0.852, 1.542, 1.419, 1.945, 1.346, 0.88, 1.945, 1.346, 0.88, 1.945,
77
+ 2.198, 1.181, 3.271, 2.198, 1.181, 3.271,
78
+ ]);
79
+ }
80
+ let cdt_cr_ms = math.zeros(17); // core to muscle [W/K]
81
+ let cdt_ms_fat = math.zeros(17); // muscle to fat [W/K]
82
+ let cdt_fat_sk = math.zeros(17); // fat to skin [W/K]
83
+ // head and pelvis consists of 65MN's conductances
84
+ cdt_cr_ms.set([0], 1.601); // head
85
+ cdt_ms_fat.set([0], 13.222);
86
+ cdt_fat_sk.set([0], 16.008);
87
+ cdt_cr_ms.set([4], 3.0813); // pelvis
88
+ cdt_ms_fat.set([4], 10.3738);
89
+ cdt_fat_sk.set([4], 41.4954);
90
+ // vessel to core
91
+ // The shape is a cylinder.
92
+ // It is assumed that the inner is vascular radius, 2.5mm and the outer is
93
+ // stolwijk's core radius.
94
+ // The heat transfer coefficient of the core is assumed as the Michel's
95
+ // counter-flow model 0.66816 [W/(m・K)].
96
+ let cdt_ves_cr = math.matrix([
97
+ 0, 0, 0, 0, 0, 0.586, 0.383, 1.534, 0.586, 0.383, 1.534, 0.81, 0.435, 1.816,
98
+ 0.81, 0.435, 1.816,
99
+ ]);
100
+ // superficial vein to skin
101
+ let cdt_sfv_sk = math.matrix([
102
+ 0, 0, 0, 0, 0, 57.735, 37.768, 16.634, 57.735, 37.768, 16.634, 102.012,
103
+ 54.784, 24.277, 102.012, 54.784, 24.277,
104
+ ]);
105
+ // art to vein (counter-flow) [W/K]
106
+ // The data has been derived Mitchell's model.
107
+ // The values = 15.869 [W/(m・K)] * the segment length [m]
108
+ let cdt_art_vein = math.matrix([
109
+ 0, 0, 0, 0, 0, 0.537, 0.351, 0.762, 0.537, 0.351, 0.762, 0.826, 0.444,
110
+ 0.992, 0.826, 0.444, 0.992,
111
+ ]);
112
+ // Changes values by body size based on the standard body.
113
+ const wr = (0, weight_rate_js_1.weight_rate)(weight);
114
+ const bsar = (0, bsa_rate_js_1.bsa_rate)(height, weight, bsa_equation);
115
+ const adjustSphere = (matrix, range) => {
116
+ let index = math.index(math.range(0, 2));
117
+ let subset = math.subset(matrix, index);
118
+ subset = math.dotDivide(math.dotMultiply(subset, wr), bsar);
119
+ return math.subset(matrix, index, subset);
120
+ };
121
+ const adjustCylinder = (matrix) => {
122
+ let index = math.index(math.range(2, matrix.size()[0]));
123
+ let subset = math.subset(matrix, index);
124
+ subset = math.dotDivide(math.dotMultiply(subset, Math.pow(bsar, 2)), wr);
125
+ return math.subset(matrix, index, subset);
126
+ };
127
+ // head, neck (Sphere shape)
128
+ cdt_cr_sk = adjustSphere(cdt_cr_sk);
129
+ cdt_cr_ms = adjustSphere(cdt_cr_ms);
130
+ cdt_ms_fat = adjustSphere(cdt_ms_fat);
131
+ cdt_fat_sk = adjustSphere(cdt_fat_sk);
132
+ cdt_ves_cr = adjustSphere(cdt_ves_cr);
133
+ cdt_sfv_sk = adjustSphere(cdt_sfv_sk);
134
+ cdt_art_vein = adjustSphere(cdt_art_vein);
135
+ // Others (Cylinder shape)
136
+ cdt_cr_sk = adjustCylinder(cdt_cr_sk);
137
+ cdt_cr_ms = adjustCylinder(cdt_cr_ms);
138
+ cdt_ms_fat = adjustCylinder(cdt_ms_fat);
139
+ cdt_fat_sk = adjustCylinder(cdt_fat_sk);
140
+ cdt_ves_cr = adjustCylinder(cdt_ves_cr);
141
+ cdt_sfv_sk = adjustCylinder(cdt_sfv_sk);
142
+ cdt_art_vein = adjustCylinder(cdt_art_vein);
143
+ const cdt_whole = math.zeros(matrix_js_1.NUM_NODES, matrix_js_1.NUM_NODES);
144
+ for (let i = 0; i < matrix_js_1.BODY_NAMES.length; i++) {
145
+ const bn = matrix_js_1.BODY_NAMES[i];
146
+ // Dictionary of indices in each body segment
147
+ // key = layer name, value = index of matrix
148
+ const index_of = matrix_js_1.IDICT[bn];
149
+ // Common
150
+ cdt_whole.set([index_of["artery"], index_of["vein"]], cdt_art_vein.get([i])); // art to vein
151
+ cdt_whole.set([index_of["artery"], index_of["core"]], cdt_ves_cr.get([i])); // art to cr
152
+ cdt_whole.set([index_of["vein"], index_of["core"]], cdt_ves_cr.get([i])); // vein to cr
153
+ // Only limbs
154
+ if (i >= 5) {
155
+ cdt_whole.set([index_of["sfvein"], index_of["skin"]], cdt_sfv_sk.get([i])); // sfv to sk
156
+ }
157
+ // If the segment has a muscle or fat layer
158
+ if (index_of["muscle"] !== null) {
159
+ // or not indexof["fat"] is None
160
+ cdt_whole.set([index_of["core"], index_of["muscle"]], cdt_cr_ms.get([i])); // cr to ms
161
+ cdt_whole.set([index_of["muscle"], index_of["fat"]], cdt_ms_fat.get([i])); // ms to fat
162
+ cdt_whole.set([index_of["fat"], index_of["skin"]], cdt_fat_sk.get([i])); // fat to sk
163
+ }
164
+ else {
165
+ cdt_whole.set([index_of["core"], index_of["skin"]], cdt_cr_sk.get([i])); // cr to sk
166
+ }
167
+ }
168
+ // Creates a symmetrical matrix
169
+ return math.add(cdt_whole, math.transpose(cdt_whole));
170
+ }
171
+ exports.conductance = conductance;
@@ -0,0 +1,55 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.local_bsa = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("./JOS3Defaults.js"));
31
+ const validate_body_parameters_js_1 = require("./validate_body_parameters.js");
32
+ const bsa_rate_js_1 = require("./bsa_rate.js");
33
+ const math = __importStar(require("mathjs"));
34
+ /**
35
+ * Calculate local body surface area (bsa) [m2].
36
+ *
37
+ * The local body surface area has been derived from 65MN.
38
+ * The head have been divided to head and neck based on Smith's model.
39
+ * head = 0.1396*0.1117/0.1414 (65MN_Head * Smith_Head / Smith_Head+neck)
40
+ * neck = 0.1396*0.0297/0.1414 (65MN_Head * Smith_Neck / Smith_Head+neck)
41
+ *
42
+ * @param {number} [height=JOS3Defaults.height] - Body height [m]
43
+ * @param {number} [weight=JOS3Defaults.weight] - Body weight [kg]
44
+ * @param {string} [bsa_equation=JOS3Defaults.bsa_equation] - The equation name
45
+ * of bsa calculation. Choose a name from "dubois", "takahira", "fujimoto",
46
+ * or "kurazumi".
47
+ *
48
+ * @returns {math.Matrix} local_bsa of length 17 - Local body surface area (bsa) [m2]
49
+ */
50
+ function local_bsa(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation) {
51
+ (0, validate_body_parameters_js_1.validate_body_parameters)(height, weight);
52
+ const bsa = (0, bsa_rate_js_1.bsa_rate)(height, weight, bsa_equation);
53
+ return math.matrix(math.dotMultiply(JOS3Defaults_js_1.default.local_bsa, bsa));
54
+ }
55
+ exports.local_bsa = local_bsa;