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
@@ -0,0 +1,86 @@
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.cr_ms_fat_blood_flow = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const bfb_rate_js_1 = require("../bfb_rate.js");
32
+ const matrix_js_1 = require("../matrix.js");
33
+ const math = __importStar(require("mathjs"));
34
+ /**
35
+ * @typedef CrMsFatBloodFlowResult
36
+ * @type {object}
37
+ * @property {math.MathCollection} bf_core - Core blood flow rate [L/h].
38
+ * @property {math.MathCollection} bf_muscle - Muscle blood flow rate [L/h].
39
+ * @property {math.MathCollection} bf_fat - Fat blood flow rate [L/h].
40
+ */
41
+ /**
42
+ * Calculate core, muscle and fat blood flow rate [L/h].
43
+ *
44
+ * @param {math.MathCollection} q_work - Heat production by work [W].
45
+ * @param {math.MathCollection} q_shiv - Heat production by shivering [W].
46
+ * @param {number} [height=1.72] - Body height [m].
47
+ * @param {number} [weight=74.43] - Body weight [kg].
48
+ * @param {string} [bsa_equation="dubois"] - The equation name of bsa calculation. Choose from "dubois","takahira", "fujimoto", or "kurazumi".
49
+ * @param {number} [age=20] - Age [years].
50
+ * @param {number} [ci=2.59] - Cardiac index [L/min/㎡].
51
+ *
52
+ * @returns {CrMsFatBloodFlowResult} - Core, muscle and fat blood flow rate [L/h].
53
+ */
54
+ function cr_ms_fat_blood_flow(q_work, q_shiv, 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) {
55
+ // Basal blood flow rate [L/h]
56
+ // core, CBFB
57
+ let bfb_core = math.matrix([
58
+ 35.251, 15.24, 89.214, 87.663, 18.686, 1.808, 0.94, 0.217, 1.808, 0.94,
59
+ 0.217, 1.406, 0.164, 0.08, 1.406, 0.164, 0.08,
60
+ ]);
61
+ // muscle, MSBFB
62
+ let bfb_muscle = math.matrix([
63
+ 0.682, 0.0, 0.0, 0.0, 12.614, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
64
+ 0.0, 0.0, 0.0,
65
+ ]);
66
+ // fat, FTBFB
67
+ let bfb_fat = math.matrix([
68
+ 0.265, 0.0, 0.0, 0.0, 2.219, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
69
+ 0.0, 0.0, 0.0,
70
+ ]);
71
+ let bfbrate = (0, bfb_rate_js_1.bfb_rate)(height, weight, bsa_equation, age, ci);
72
+ let bf_core = math.dotMultiply(bfb_core, bfbrate);
73
+ let bf_muscle = math.dotMultiply(bfb_muscle, bfbrate);
74
+ let bf_fat = math.dotMultiply(bfb_fat, bfbrate);
75
+ for (let i = 0; i < matrix_js_1.BODY_NAMES.length; i++) {
76
+ let bn = matrix_js_1.BODY_NAMES[i];
77
+ if (matrix_js_1.IDICT[bn]["muscle"] !== null) {
78
+ bf_muscle.set([i], bf_muscle.get([i]) + (q_work.get([i]) + q_shiv.get([i])) / 1.163);
79
+ }
80
+ else {
81
+ bf_core.set([i], bf_core.get([i]) + (q_work.get([i]) + q_shiv.get([i])) / 1.163);
82
+ }
83
+ }
84
+ return { bf_core, bf_muscle, bf_fat };
85
+ }
86
+ exports.cr_ms_fat_blood_flow = cr_ms_fat_blood_flow;
@@ -0,0 +1,47 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.dry_r = void 0;
27
+ const clo_area_factor_js_1 = require("./clo_area_factor.js");
28
+ const math = __importStar(require("mathjs"));
29
+ /**
30
+ * Calculate total sensible thermal resistance (between the skin and ambient air).
31
+ *
32
+ * @param {math.Matrix} hc - Convective heat transfer coefficient (hc) [W/(m2*K)].
33
+ * @param {math.Matrix} hr - Radiative heat transfer coefficient (hr) [W/(m2*K)].
34
+ * @param {math.Matrix} clo - Clothing insulation [clo].
35
+ *
36
+ * @returns {math.Matrix} Total sensible thermal resistance between skin and ambient.
37
+ */
38
+ function dry_r(hc, hr, clo) {
39
+ if (hc.toArray().some((x) => x < 0) || hr.toArray().some((x) => x < 0)) {
40
+ throw new Error("Input parameters hc and hr must be non-negative.");
41
+ }
42
+ let fcl = (0, clo_area_factor_js_1.clo_area_factor)(clo);
43
+ let r_a = math.dotDivide(1, math.add(hc, hr));
44
+ let r_cl = math.dotMultiply(0.155, clo);
45
+ return math.add(math.dotDivide(r_a, fcl), r_cl);
46
+ }
47
+ exports.dry_r = dry_r;
@@ -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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.error_signals = void 0;
27
+ const math = __importStar(require("mathjs"));
28
+ /**
29
+ * @typedef ErrorSignalsResult
30
+ * @type {object}
31
+ * @property {number} wrms - Warm signal [°C].
32
+ * @property {number} clds - Cold signal [°C].
33
+ */
34
+ /**
35
+ * Calculate WRMS and CLDS signals of thermoregulation.
36
+ *
37
+ * @param {math.MathCollection} [err_sk=0] - Difference between set-point and skin temperatures [°C].
38
+ * If the provided value is an array, its length should be 17.
39
+ *
40
+ * @returns {ErrorSignalsResult} an object containing the results of the calculation.
41
+ */
42
+ function error_signals(err_sk = math.zeros(17)) {
43
+ let receptor = math.matrix([
44
+ 0.0549, 0.0146, 0.1492, 0.1321, 0.2122, 0.0227, 0.0117, 0.0923, 0.0227,
45
+ 0.0117, 0.0923, 0.0501, 0.0251, 0.0167, 0.0501, 0.0251, 0.0167,
46
+ ]);
47
+ let wrm = err_sk.map((n) => math.max(n, 0));
48
+ wrm = math.dotMultiply(wrm, receptor);
49
+ let wrms = math.sum(wrm);
50
+ let cld = err_sk.map((n) => math.min(n, 0));
51
+ cld = math.dotMultiply(cld, math.dotMultiply(receptor, -1));
52
+ let clds = math.sum(cld);
53
+ return { wrms, clds };
54
+ }
55
+ exports.error_signals = error_signals;
@@ -0,0 +1,94 @@
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.evaporation = exports.antoine = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const error_signals_js_1 = require("./error_signals.js");
32
+ const bsa_rate_js_1 = require("../bsa_rate.js");
33
+ const math = __importStar(require("mathjs"));
34
+ /**
35
+ * Calculates the Antoine equation for a given temperature value.
36
+ *
37
+ * @param {number} x - The temperature value in Kelvin.
38
+ * @returns {number} - The vapor pressure calculated using the Antoine equation.
39
+ */
40
+ const antoine = (x) => Math.pow(Math.E, (16.6536 - 4030.183 / (x + 235)));
41
+ exports.antoine = antoine;
42
+ /**
43
+ * @typedef EvaporationResult
44
+ * @type {object}
45
+ * @property {math.MathCollection} wet - Local skin wettedness [-].
46
+ * @property {math.MathCollection} e_sk - Evaporative heat loss at the skin by sweating and diffuse [W].
47
+ * @property {math.MathCollection} e_max - Maximum evaporative heat loss at the skin [W].
48
+ * @property {math.MathCollection} e_sweat - Evaporative heat loss at the skin by only sweating [W].
49
+ */
50
+ /**
51
+ * Calculate evaporative heat loss.
52
+ *
53
+ * @param {math.MathCollection} err_cr - Difference between set-point and body temperatures [°C].
54
+ * @param {math.MathCollection} err_sk - Difference between set-point and body temperatures [°C].
55
+ * @param {math.MathCollection} t_skin - Skin temperatures [°C].
56
+ * @param {math.MathCollection} tdb - Air temperatures at local body segments [°C].
57
+ * @param {math.MathCollection} rh - Relative humidity at local body segments [%].
58
+ * @param {math.MathCollection} ret - Total evaporative thermal resistances [m2.K/W].
59
+ * @param {number} [height=1.72] - Body height [m].
60
+ * @param {number} [weight=74.43] - Body weight [kg].
61
+ * @param {string} [bsa_equation="dubois"] - The equation name (str) of bsa calculation. Choose a name from "dubois", "takahira", "fujimoto", or "kurazumi".
62
+ * @param {number} [age=20] - age [years].
63
+ *
64
+ * @returns {EvaporationResult} an object containing the results of the calculation.
65
+ */
66
+ function evaporation(err_cr, err_sk, t_skin, tdb, rh, ret, 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) {
67
+ let { wrms, clds } = (0, error_signals_js_1.error_signals)(err_sk);
68
+ let bsar = (0, bsa_rate_js_1.bsa_rate)(height, weight, bsa_equation);
69
+ let bsa = math.dotMultiply(JOS3Defaults_js_1.default.local_bsa, bsar);
70
+ let p_a = math.dotDivide(math.dotMultiply(tdb.map(exports.antoine), rh), 100);
71
+ let p_sk_s = t_skin.map(exports.antoine);
72
+ let e_max = math.dotMultiply(math.dotDivide(math.subtract(p_sk_s, p_a), ret), bsa);
73
+ e_max = e_max.map((e_max) => (e_max === 0 ? 0.001 : e_max));
74
+ let skin_sweat = [
75
+ 0.064, 0.017, 0.146, 0.129, 0.206, 0.051, 0.026, 0.0155, 0.051, 0.026,
76
+ 0.0155, 0.073, 0.036, 0.0175, 0.073, 0.036, 0.0175,
77
+ ];
78
+ let sig_sweat = 371.2 * err_cr.get([0]) + 33.64 * (wrms - clds);
79
+ sig_sweat = sig_sweat > 0 ? sig_sweat : 0;
80
+ sig_sweat *= bsar;
81
+ let sd_sweat = age < 60
82
+ ? math.ones(17)
83
+ : math.matrix([
84
+ 0.69, 0.69, 0.59, 0.52, 0.4, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.4,
85
+ 0.4, 0.4, 0.4, 0.4, 0.4,
86
+ ]);
87
+ let e_sweat = math.multiply(skin_sweat, sig_sweat, sd_sweat, math.dotPow(2, math.divide(err_sk, 10)));
88
+ let wet = math.add(0.06, math.multiply(0.94, math.dotDivide(e_sweat, e_max)));
89
+ wet = wet.map((n) => (n > 1 ? 1 : n));
90
+ let e_sk = math.dotMultiply(wet, e_max);
91
+ e_sweat = math.dotMultiply(math.divide(math.subtract(wet, 0.06), 0.94), e_max);
92
+ return { wet, e_sk, e_max, e_sweat };
93
+ }
94
+ exports.evaporation = evaporation;
@@ -0,0 +1,42 @@
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.fixed_hc = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const math = __importStar(require("mathjs"));
32
+ /**
33
+ * Fixes hc values to fit two-node-model's values.
34
+ */
35
+ function fixed_hc(hc, v) {
36
+ const local_bsa_sum = math.sum(JOS3Defaults_js_1.default.local_bsa);
37
+ let mean_hc = math.sum(math.dotMultiply(hc, JOS3Defaults_js_1.default.local_bsa)) / local_bsa_sum;
38
+ let mean_va = math.sum(math.dotMultiply(v, JOS3Defaults_js_1.default.local_bsa)) / local_bsa_sum;
39
+ let mean_hc_whole = Math.max(3, 8.600001 * Math.pow(mean_va, 0.53));
40
+ return math.dotDivide(math.dotMultiply(hc, mean_hc_whole), mean_hc);
41
+ }
42
+ exports.fixed_hc = fixed_hc;
@@ -0,0 +1,43 @@
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.fixed_hr = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const math = __importStar(require("mathjs"));
32
+ /**
33
+ * Fixes hr values to fit two-node-model's values.
34
+ *
35
+ * @param {math.MathCollection} hr
36
+ * @return {math.Matrix}
37
+ */
38
+ function fixed_hr(hr) {
39
+ let mean_hr = math.sum(math.dotMultiply(hr, JOS3Defaults_js_1.default.local_bsa)) /
40
+ math.sum(JOS3Defaults_js_1.default.local_bsa);
41
+ return math.dotDivide(math.dotMultiply(hr, 4.7), mean_hr);
42
+ }
43
+ exports.fixed_hr = fixed_hr;
@@ -0,0 +1,70 @@
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_mbase = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const basal_met_js_1 = require("./basal_met.js");
32
+ const math = __importStar(require("mathjs"));
33
+ /**
34
+ * Calculate local basal metabolic rate [W].
35
+ *
36
+ * @param {number} [height=1.72] - Body height [m].
37
+ * @param {number} [weight=74.43] - Body weight [kg].
38
+ * @param {number} [age=20] - Age [years].
39
+ * @param {string} [sex='male'] - Sex (male or female).
40
+ * @param {string} [bmr_equation='harris-benedict'] - BMR equation to use (harris-benedict or ganpule).
41
+ *
42
+ * @returns {[math.MathCollection, math.MathCollection, math.MathCollection, math.MathCollection]} mbase - Local basal metabolic rate (Mbase) [W].
43
+ */
44
+ function local_mbase(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, age = JOS3Defaults_js_1.default.age, sex = JOS3Defaults_js_1.default.sex, bmr_equation = JOS3Defaults_js_1.default.bmr_equation) {
45
+ let mbase_all = (0, basal_met_js_1.basal_met)(height, weight, age, sex, bmr_equation);
46
+ let mbf_cr = math.matrix([
47
+ 0.19551, 0.00324, 0.28689, 0.25677, 0.09509, 0.01435, 0.00409, 0.00106,
48
+ 0.01435, 0.00409, 0.00106, 0.01557, 0.00422, 0.0025, 0.01557, 0.00422,
49
+ 0.0025,
50
+ ]);
51
+ let mbf_ms = math.matrix([
52
+ 0.00252, 0.0, 0.0, 0.0, 0.04804, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
53
+ 0.0, 0.0, 0.0, 0.0,
54
+ ]);
55
+ let mbf_fat = math.matrix([
56
+ 0.00127, 0.0, 0.0, 0.0, 0.0095, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
57
+ 0.0, 0.0, 0.0,
58
+ ]);
59
+ let mbf_sk = math.matrix([
60
+ 0.00152, 0.00033, 0.00211, 0.00187, 0.003, 0.00059, 0.00031, 0.00059,
61
+ 0.00059, 0.00031, 0.00059, 0.00144, 0.00027, 0.00118, 0.00144, 0.00027,
62
+ 0.00118,
63
+ ]);
64
+ let mbase_cr = math.dotMultiply(mbf_cr, mbase_all);
65
+ let mbase_ms = math.dotMultiply(mbf_ms, mbase_all);
66
+ let mbase_fat = math.dotMultiply(mbf_fat, mbase_all);
67
+ let mbase_sk = math.dotMultiply(mbf_sk, mbase_all);
68
+ return [mbase_cr, mbase_ms, mbase_fat, mbase_sk];
69
+ }
70
+ exports.local_mbase = local_mbase;
@@ -0,0 +1,48 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.local_q_work = void 0;
27
+ const math = __importStar(require("mathjs"));
28
+ /**
29
+ * Calculate local thermogenesis by work [W].
30
+ *
31
+ * @param {number} bmr - Basal metabolic rate [W]
32
+ * @param {number} par - Physical activity ratio [-]
33
+ * @throws {Error} If par is less than 1
34
+ *
35
+ * @return {math.MathCollection} q_work - Local thermogenesis by work [W]
36
+ */
37
+ function local_q_work(bmr, par) {
38
+ if (par < 1) {
39
+ throw new Error("par must be greater than or equal to 1");
40
+ }
41
+ let q_work_all = (par - 1) * bmr;
42
+ let workf = math.matrix([
43
+ 0, 0, 0.091, 0.08, 0.129, 0.0262, 0.0139, 0.005, 0.0262, 0.0139, 0.005,
44
+ 0.201, 0.099, 0.005, 0.201, 0.099, 0.005,
45
+ ]);
46
+ return math.dotMultiply(workf, q_work_all);
47
+ }
48
+ exports.local_q_work = local_q_work;
@@ -0,0 +1,95 @@
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.nonshivering = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const error_signals_js_1 = require("./error_signals.js");
32
+ const bsa_rate_js_1 = require("../bsa_rate.js");
33
+ const math = __importStar(require("mathjs"));
34
+ /**
35
+ * Calculate local metabolic rate by non-shivering [W]
36
+ *
37
+ * @param {math.MathCollection} err_sk - Difference between set-point and body temperatures [°C].
38
+ * @param {number} [height=1.72] - Body height [m].
39
+ * @param {number} [weight=74.43] - Body weight [kg].
40
+ * @param {string} [bsa_equation="dubois"] - The equation name (str) of bsa calculation. Choose a name from "dubois", "takahira", "fujimoto", or "kurazumi".
41
+ * @param {number} [age=20] - age [years].
42
+ * @param {boolean} [cold_acclimation=false] - Whether the subject acclimates cold environment or not.
43
+ * @param {boolean} [batpositive=true] - Whether BAT activity is positive or not.
44
+ *
45
+ * @returns {math.MathCollection} q_nst - Local metabolic rate by non-shivering [W].
46
+ */
47
+ function nonshivering(err_sk, 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, cold_acclimation = false, batpositive = true) {
48
+ // NST (Non-Shivering Thermogenesis) model, Asaka, 2016
49
+ let { clds } = (0, error_signals_js_1.error_signals)(err_sk);
50
+ // BMI (Body Mass Index)
51
+ let bmi = weight / Math.pow(height, 2);
52
+ // BAT: brown adipose tissue [SUV]
53
+ let bat = Math.pow(10, (-0.10502 * bmi + 2.7708));
54
+ if (age < 30) {
55
+ bat *= 1.61;
56
+ }
57
+ else if (age < 40) {
58
+ bat *= 1.0;
59
+ }
60
+ else {
61
+ bat *= 0.8;
62
+ }
63
+ if (cold_acclimation) {
64
+ bat += 3.46;
65
+ }
66
+ if (!batpositive) {
67
+ // incidence age factor: T.Yoneshiro 2011
68
+ if (age < 30) {
69
+ bat *= 44 / 83;
70
+ }
71
+ else if (age < 40) {
72
+ bat *= 15 / 38;
73
+ }
74
+ else if (age < 50) {
75
+ bat *= 7 / 26;
76
+ }
77
+ else if (age < 60) {
78
+ bat *= 1 / 8;
79
+ }
80
+ else {
81
+ bat *= 0;
82
+ }
83
+ }
84
+ // NST limit
85
+ let thres = 1.8 * bat + 2.43 + 5.62; // [W]
86
+ let sig_nst = 2.8 * clds; // [W]
87
+ sig_nst = Math.min(sig_nst, thres);
88
+ let nstf = math.matrix([
89
+ 0.0, 0.19, 0.0, 0.19, 0.19, 0.215, 0.0, 0.0, 0.215, 0.0, 0.0, 0.0, 0.0, 0.0,
90
+ 0.0, 0.0, 0.0,
91
+ ]);
92
+ let bsar = (0, bsa_rate_js_1.bsa_rate)(height, weight, bsa_equation);
93
+ return math.dotMultiply(math.dotMultiply(bsar, nstf), sig_nst);
94
+ }
95
+ exports.nonshivering = nonshivering;
@@ -0,0 +1,42 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.operative_temp = void 0;
27
+ const supa_js_1 = require("../../supa.js");
28
+ const math = __importStar(require("mathjs"));
29
+ /**
30
+ * Calculate operative temperature [°C]
31
+ *
32
+ * @param {math.MathCollection} tdb - Air temperature [°C]
33
+ * @param {math.MathCollection} tr - Mean radiant temperature [°C]
34
+ * @param {math.MathCollection} hc - Convective heat transfer coefficient [W/(m2*K)]
35
+ * @param {math.MathCollection} hr - Radiative heat transfer coefficient [W/(m2*K)]
36
+
37
+ * @returns {math.MathCollection} Operative temperature [°C]
38
+ */
39
+ function operative_temp(tdb, tr, hc, hr) {
40
+ return math.dotDivide(math.add(math.dotMultiply(hc, tdb), math.dotMultiply(hr, tr)), math.add(hc, hr));
41
+ }
42
+ exports.operative_temp = operative_temp;