jsthermalcomfort 0.1.5 → 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 +26 -14
  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 +3 -2
@@ -0,0 +1,341 @@
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 _a, _b;
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.VINDEX = exports.INDEX = exports.whole_body = exports.local_arr = exports.vessel_blood_flow = exports.NUM_NODES = exports.IDICT = exports.LAYER_NAMES = exports.BODY_NAMES = void 0;
28
+ const math = __importStar(require("mathjs"));
29
+ exports.BODY_NAMES = [
30
+ "head",
31
+ "neck",
32
+ "chest",
33
+ "back",
34
+ "pelvis",
35
+ "left_shoulder",
36
+ "left_arm",
37
+ "left_hand",
38
+ "right_shoulder",
39
+ "right_arm",
40
+ "right_hand",
41
+ "left_thigh",
42
+ "left_leg",
43
+ "left_foot",
44
+ "right_thigh",
45
+ "right_leg",
46
+ "right_foot",
47
+ ];
48
+ exports.LAYER_NAMES = [
49
+ "artery",
50
+ "vein",
51
+ "sfvein",
52
+ "core",
53
+ "muscle",
54
+ "fat",
55
+ "skin",
56
+ ];
57
+ _a = (() => {
58
+ // Defines existing layers as 1 or null
59
+ let index_dict = {};
60
+ ["head", "pelvis"].forEach((key) => {
61
+ index_dict[key] = {
62
+ artery: 1,
63
+ vein: 1,
64
+ sfvein: null,
65
+ core: 1,
66
+ muscle: 1,
67
+ fat: 1,
68
+ skin: 1,
69
+ };
70
+ });
71
+ ["neck", "chest", "back"].forEach((key) => {
72
+ index_dict[key] = {
73
+ artery: 1,
74
+ vein: 1,
75
+ sfvein: null,
76
+ core: 1,
77
+ muscle: null,
78
+ fat: null,
79
+ skin: 1,
80
+ };
81
+ });
82
+ exports.BODY_NAMES.slice(5).forEach((key) => {
83
+ // limb segments
84
+ index_dict[key] = {
85
+ artery: 1,
86
+ vein: 1,
87
+ sfvein: 1,
88
+ core: 1,
89
+ muscle: null,
90
+ fat: null,
91
+ skin: 1,
92
+ };
93
+ });
94
+ // Sets ordered indices in the matrix
95
+ index_dict["CB"] = 0;
96
+ let order_count = 1;
97
+ exports.BODY_NAMES.forEach((bn) => {
98
+ exports.LAYER_NAMES.forEach((ln) => {
99
+ if (index_dict[bn][ln] !== null) {
100
+ index_dict[bn][ln] = order_count;
101
+ order_count += 1;
102
+ }
103
+ });
104
+ });
105
+ return [index_dict, order_count];
106
+ })(), exports.IDICT = _a[0], exports.NUM_NODES = _a[1];
107
+ /**
108
+ * @typedef VesselBloodFlowResult
109
+ * @type {object}
110
+ * @property {math.MathCollection} bf_art - Artery blood flow rate [l/h].
111
+ * @property {math.MathCollection} bf_vein - Vein blood flow rate [l/h].
112
+ */
113
+ /**
114
+ * Get artery and vein blood flow rate [l/h].
115
+ *
116
+ * @param {math.MathCollection} bf_core - Core blood flow rate [l/h].
117
+ * @param {math.MathCollection} bf_muscle - Muscle blood flow rate [l/h].
118
+ * @param {math.MathCollection} bf_fat - Fat blood flow rate [l/h].
119
+ * @param {math.MathCollection} bf_skin - Skin blood flow rate [l/h].
120
+ * @param {number} bf_ava_hand - AVA blood flow rate at hand [l/h].
121
+ * @param {number} bf_ava_foot - AVA blood flow rate at foot [l/h].
122
+ *
123
+ * @returns {VesselBloodFlowResult} bf_artery, bf_vein - Artery and vein blood flow rate [l/h].
124
+ */
125
+ function vessel_blood_flow(bf_core, bf_muscle, bf_fat, bf_skin, bf_ava_hand, bf_ava_foot) {
126
+ let xbf = math.add(bf_core, bf_muscle, bf_fat, bf_skin);
127
+ let bf_art = math.zeros(17);
128
+ let bf_vein = math.zeros(17);
129
+ // head
130
+ bf_art.set([0], xbf.get([0]));
131
+ bf_vein.set([0], xbf.get([0]));
132
+ // neck (+head)
133
+ bf_art.set([1], xbf.get([1]) + xbf.get([0]));
134
+ bf_vein.set([1], xbf.get([1]) + xbf.get([0]));
135
+ // chest
136
+ bf_art.set([2], xbf.get([2]));
137
+ bf_vein.set([2], xbf.get([2]));
138
+ // back
139
+ bf_art.set([3], xbf.get([3]));
140
+ bf_vein.set([3], xbf.get([3]));
141
+ // pelvis (+Thighs, Legs, Feet, AVA_Feet)
142
+ bf_art.set([4], xbf.get([4]) +
143
+ math.sum(xbf.subset(math.index(math.range(11, 17)))) +
144
+ 2 * bf_ava_foot);
145
+ bf_vein.set([4], xbf.get([4]) +
146
+ math.sum(xbf.subset(math.index(math.range(11, 17)))) +
147
+ 2 * bf_ava_foot);
148
+ // L.Shoulder (+Arm, Hand, (arteryのみAVA_Hand))
149
+ bf_art.set([5], math.sum(xbf.subset(math.index(math.range(5, 8)))) + bf_ava_hand);
150
+ bf_vein.set([5], math.sum(xbf.subset(math.index(math.range(5, 8)))));
151
+ // L.Arm (+Hand)
152
+ bf_art.set([6], math.sum(xbf.subset(math.index(math.range(6, 8)))) + bf_ava_hand);
153
+ bf_vein.set([6], math.sum(xbf.subset(math.index(math.range(6, 8)))));
154
+ // L.Hand
155
+ bf_art.set([7], xbf.get([7]) + bf_ava_hand);
156
+ bf_vein.set([7], xbf.get([7]));
157
+ // R.Shoulder (+Arm, Hand, (arteryのみAVA_Hand))
158
+ bf_art.set([8], math.sum(xbf.subset(math.index(math.range(8, 11)))) + bf_ava_hand);
159
+ bf_vein.set([8], math.sum(xbf.subset(math.index(math.range(8, 11)))));
160
+ // R.Arm (+Hand)
161
+ bf_art.set([9], math.sum(xbf.subset(math.index(math.range(9, 11)))) + bf_ava_hand);
162
+ bf_vein.set([9], math.sum(xbf.subset(math.index(math.range(9, 11)))));
163
+ // R.Hand
164
+ bf_art.set([10], xbf.get([10]) + bf_ava_hand);
165
+ bf_vein.set([10], xbf.get([10]));
166
+ // L.Thigh (+Leg, Foot, (arteryのみAVA_Foot))
167
+ bf_art.set([11], math.sum(xbf.subset(math.index(math.range(11, 14)))) + bf_ava_foot);
168
+ bf_vein.set([11], math.sum(xbf.subset(math.index(math.range(11, 14)))));
169
+ // L.Leg (+Foot)
170
+ bf_art.set([12], math.sum(xbf.subset(math.index(math.range(12, 14)))) + bf_ava_foot);
171
+ bf_vein.set([12], math.sum(xbf.subset(math.index(math.range(12, 14)))));
172
+ // L.Foot
173
+ bf_art.set([13], xbf.get([13]) + bf_ava_foot);
174
+ bf_vein.set([13], xbf.get([13]));
175
+ // R.Thigh (+Leg, Foot, (arteryのみAVA_Foot))
176
+ bf_art.set([14], math.sum(xbf.subset(math.index(math.range(14, 17)))) + bf_ava_foot);
177
+ bf_vein.set([14], math.sum(xbf.subset(math.index(math.range(14, 17)))));
178
+ // R.Leg (+Foot)
179
+ bf_art.set([15], math.sum(xbf.subset(math.index(math.range(15, 17)))) + bf_ava_foot);
180
+ bf_vein.set([15], math.sum(xbf.subset(math.index(math.range(15, 17)))));
181
+ // R.Foot
182
+ bf_art.set([16], xbf.get([16]) + bf_ava_foot);
183
+ bf_vein.set([16], xbf.get([16]));
184
+ return { bf_art, bf_vein };
185
+ }
186
+ exports.vessel_blood_flow = vessel_blood_flow;
187
+ /**
188
+ * Create matrix to calculate heat exchange by blood flow in each segment.
189
+ *
190
+ * @param {math.MathCollection} bf_core
191
+ * @param {math.MathCollection} bf_muscle
192
+ * @param {math.MathCollection} bf_fat
193
+ * @param {math.MathCollection} bf_skin
194
+ * @param {number} bf_ava_hand
195
+ * @param {number} bf_ava_foot
196
+ *
197
+ * @returns {math.Matrix} The heat exchange by blood flow in each segment.
198
+ */
199
+ function local_arr(bf_core, bf_muscle, bf_fat, bf_skin, bf_ava_hand, bf_ava_foot) {
200
+ let bf_local = math.zeros(exports.NUM_NODES, exports.NUM_NODES);
201
+ for (let i = 0; i < exports.BODY_NAMES.length; i++) {
202
+ // Dictionary of indicies in each body segment
203
+ // key = layer name, value = index of matrix
204
+ let bn = exports.BODY_NAMES[i];
205
+ let index_of = exports.IDICT[bn];
206
+ // Common
207
+ bf_local.set([index_of["core"], index_of["artery"]], 1.067 * bf_core.get([i])); // art to cr
208
+ bf_local.set([index_of["skin"], index_of["artery"]], 1.067 * bf_skin.get([i])); // art to sk
209
+ bf_local.set([index_of["vein"], index_of["core"]], 1.067 * bf_core.get([i])); // vein to cr
210
+ bf_local.set([index_of["vein"], index_of["skin"]], 1.067 * bf_skin.get([i])); // vein to sk
211
+ // If the segment has a muscle or fat layer
212
+ if (index_of["muscle"] !== null) {
213
+ bf_local.set([index_of["muscle"], index_of["artery"]], 1.067 * bf_muscle.get([i])); // art to ms
214
+ bf_local.set([index_of["vein"], index_of["muscle"]], 1.067 * bf_muscle.get([i])); // vein to ms
215
+ }
216
+ if (index_of["fat"] !== null) {
217
+ bf_local.set([index_of["fat"], index_of["artery"]], 1.067 * bf_fat.get([i])); // art to ft
218
+ bf_local.set([index_of["vein"], index_of["fat"]], 1.067 * bf_fat.get([i])); // vein to ft
219
+ }
220
+ // Only hand
221
+ if (i === 7 || i === 10) {
222
+ bf_local.set([index_of["sfvein"], index_of["artery"]], 1.067 * bf_ava_hand); // art to sfv
223
+ }
224
+ // Only foot
225
+ if (i === 13 || i === 16) {
226
+ bf_local.set([index_of["sfvein"], index_of["artery"]], 1.067 * bf_ava_foot); // art to sfv
227
+ }
228
+ }
229
+ return bf_local;
230
+ }
231
+ exports.local_arr = local_arr;
232
+ /**
233
+ * Create matrix to calculate heat exchange by blood flow between segments. [W/K]
234
+ *
235
+ * @param {math.MathCollection} bf_art
236
+ * @param {math.MathCollection} bf_vein
237
+ * @param {number} bf_ava_hand
238
+ * @param {number} bf_ava_foot
239
+ *
240
+ * @return {math.Matrix}
241
+ */
242
+ function whole_body(bf_art, bf_vein, bf_ava_hand, bf_ava_foot) {
243
+ let arr83 = math.zeros(exports.NUM_NODES, exports.NUM_NODES);
244
+ const flow = (up, down, bloodflow) => arr83.set([down, up], bloodflow * 1.067); // Coefficient = 1.067 [Wh/L.K] Change units [L/h] to [W/K]
245
+ const CB = exports.IDICT["CB"];
246
+ const head = exports.IDICT["head"]["artery"];
247
+ const neck = exports.IDICT["neck"]["artery"];
248
+ const chest = exports.IDICT["chest"]["artery"];
249
+ const back = exports.IDICT["back"]["artery"];
250
+ const pelvis = exports.IDICT["pelvis"]["artery"];
251
+ const left_shoulder = exports.IDICT["left_shoulder"]["artery"];
252
+ const left_arm = exports.IDICT["left_arm"]["artery"];
253
+ const left_hand = exports.IDICT["left_hand"]["artery"];
254
+ const right_shoulder = exports.IDICT["right_shoulder"]["artery"];
255
+ const right_arm = exports.IDICT["right_arm"]["artery"];
256
+ const right_hand = exports.IDICT["right_hand"]["artery"];
257
+ const left_thigh = exports.IDICT["left_thigh"]["artery"];
258
+ const left_leg = exports.IDICT["left_leg"]["artery"];
259
+ const left_foot = exports.IDICT["left_foot"]["artery"];
260
+ const right_thigh = exports.IDICT["right_thigh"]["artery"];
261
+ const right_leg = exports.IDICT["right_leg"]["artery"];
262
+ const right_foot = exports.IDICT["right_foot"]["artery"];
263
+ flow(CB, neck, bf_art.get([1])); // CB to neck.art
264
+ flow(neck, head, bf_art.get([0])); // neck.art to head.art
265
+ flow(head + 1, neck + 1, bf_vein.get([0])); // head.vein to neck.vein
266
+ flow(neck + 1, CB, bf_vein.get([1])); // neck.vein to CB
267
+ flow(CB, chest, bf_art.get([2])); // CB to chest.art
268
+ flow(chest + 1, CB, bf_vein.get([2])); // chest.vein to CB
269
+ flow(CB, back, bf_art.get([3])); // CB to back.art
270
+ flow(back + 1, CB, bf_vein.get([3])); // back.vein to CB
271
+ flow(CB, pelvis, bf_art.get([4])); // CB to pelvis.art
272
+ flow(pelvis + 1, CB, bf_vein.get([4])); // pelvis.vein to CB
273
+ flow(CB, left_shoulder, bf_art.get([5])); // CB to left_shoulder.art
274
+ flow(left_shoulder, left_arm, bf_art.get([6])); // left_shoulder.art to left_arm.art
275
+ flow(left_arm, left_hand, bf_art.get([7])); // left_arm.art to left_hand.art
276
+ flow(left_hand + 1, left_arm + 1, bf_vein.get([7])); // left_hand.vein to left_arm.vein
277
+ flow(left_arm + 1, left_shoulder + 1, bf_vein.get([6])); // left_arm.vein to left_shoulder.vein
278
+ flow(left_shoulder + 1, CB, bf_vein.get([5])); // left_shoulder.vein to CB
279
+ flow(left_hand + 2, left_arm + 2, bf_ava_hand); // left_hand.sfvein to left_arm.sfvein
280
+ flow(left_arm + 2, left_shoulder + 2, bf_ava_hand); // left_arm.sfvein to left_shoulder.sfvein
281
+ flow(left_shoulder + 2, CB, bf_ava_hand); // left_shoulder.sfvein to CB
282
+ flow(CB, right_shoulder, bf_art.get([8])); // CB to right_shoulder.art
283
+ flow(right_shoulder, right_arm, bf_art.get([9])); // right_shoulder.art to right_arm.art
284
+ flow(right_arm, right_hand, bf_art.get([10])); // right_arm.art to right_hand.art
285
+ flow(right_hand + 1, right_arm + 1, bf_vein.get([10])); // right_hand.vein to right_arm.vein
286
+ flow(right_arm + 1, right_shoulder + 1, bf_vein.get([9])); // right_arm.vein to right_shoulder.vein
287
+ flow(right_shoulder + 1, CB, bf_vein.get([8])); // right_shoulder.vein to CB
288
+ flow(right_hand + 2, right_arm + 2, bf_ava_hand); // right_hand.sfvein to right_arm.sfvein
289
+ flow(right_arm + 2, right_shoulder + 2, bf_ava_hand); // right_arm.sfvein to right_shoulder.sfvein
290
+ flow(right_shoulder + 2, CB, bf_ava_hand); // right_shoulder.sfvein to CB
291
+ flow(pelvis, left_thigh, bf_art.get([11])); // pelvis to left_thigh.art
292
+ flow(left_thigh, left_leg, bf_art.get([12])); // left_thigh.art to left_leg.art
293
+ flow(left_leg, left_foot, bf_art.get([13])); // left_leg.art to left_foot.art
294
+ flow(left_foot + 1, left_leg + 1, bf_vein.get([13])); // left_foot.vein to left_leg.vein
295
+ flow(left_leg + 1, left_thigh + 1, bf_vein.get([12])); // left_leg.vein to left_thigh.vein
296
+ flow(left_thigh + 1, pelvis + 1, bf_vein.get([11])); // left_thigh.vein to pelvis
297
+ flow(left_foot + 2, left_leg + 2, bf_ava_foot); // left_foot.sfvein to left_leg.sfvein
298
+ flow(left_leg + 2, left_thigh + 2, bf_ava_foot); // left_leg.sfvein to left_thigh.sfvein
299
+ flow(left_thigh + 2, pelvis + 1, bf_ava_foot); // left_thigh.vein to pelvis
300
+ flow(pelvis, right_thigh, bf_art.get([14])); // pelvis to right_thigh.art
301
+ flow(right_thigh, right_leg, bf_art.get([15])); // right_thigh.art to right_leg.art
302
+ flow(right_leg, right_foot, bf_art.get([16])); // right_leg.art to right_foot.art
303
+ flow(right_foot + 1, right_leg + 1, bf_vein.get([16])); // right_foot.vein to right_leg.vein
304
+ flow(right_leg + 1, right_thigh + 1, bf_vein.get([15])); // right_leg.vein to right_thigh.vein
305
+ flow(right_thigh + 1, pelvis + 1, bf_vein.get([14])); // right_thigh.vein to pelvis
306
+ flow(right_foot + 2, right_leg + 2, bf_ava_foot); // right_foot.sfvein to right_leg.sfvein
307
+ flow(right_leg + 2, right_thigh + 2, bf_ava_foot); // right_leg.sfvein to right_thigh.sfvein
308
+ flow(right_thigh + 2, pelvis + 1, bf_ava_foot); // right_thigh.vein to pelvis
309
+ return arr83;
310
+ }
311
+ exports.whole_body = whole_body;
312
+ _b = (function () {
313
+ const index_by_layer = (layer) => {
314
+ const out_index = [];
315
+ for (const bn of exports.BODY_NAMES) {
316
+ for (const ln of exports.LAYER_NAMES) {
317
+ if (layer.toLowerCase() === ln && exports.IDICT[bn][ln] !== null) {
318
+ out_index.push(exports.IDICT[bn][ln]);
319
+ }
320
+ }
321
+ }
322
+ return out_index;
323
+ };
324
+ const valid_index_by_layer = (key) => {
325
+ const out_index = [];
326
+ for (let i = 0; i < exports.BODY_NAMES.length; i++) {
327
+ const bn = exports.BODY_NAMES[i];
328
+ if (exports.IDICT[bn][key] !== null) {
329
+ out_index.push(i);
330
+ }
331
+ }
332
+ return out_index;
333
+ };
334
+ const index = {};
335
+ const vindex = {};
336
+ for (const key of exports.LAYER_NAMES) {
337
+ index[key] = index_by_layer(key);
338
+ vindex[key] = valid_index_by_layer(key);
339
+ }
340
+ return [index, vindex];
341
+ })(), exports.INDEX = _b[0], exports.VINDEX = _b[1];
@@ -0,0 +1,75 @@
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.ava_blood_flow = void 0;
30
+ const supa_js_1 = require("../../supa.js");
31
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
32
+ const bfb_rate_js_1 = require("../bfb_rate.js");
33
+ const math = __importStar(require("mathjs"));
34
+ /**
35
+ * @typedef AvaBloodFlowResult
36
+ * @type {object}
37
+ * @property {number} bf_ava_hand - AVA blood flow rate at hand [L/h].
38
+ * @property {number} bf_ava_foot - AVA blood flow rate at foot [L/h].
39
+ */
40
+ /**
41
+ * Calculate areteriovenous anastmoses (AVA) blood flow rate [L/h] based on
42
+ * Takemori's model, 1995.
43
+ *
44
+ * @param {math.MathCollection} err_cr - Difference between set-point and body temperatures [°C].
45
+ * @param {math.MathCollection} err_sk - Difference between set-point and body temperatures [°C].
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 a name from "dubois", "takahira", "fujimoto", or "kurazumi"
49
+ * @param {number} [age=20] - age [years]
50
+ * @param {number} [ci=2.59] - Cardiac index [L/min/m2]
51
+ *
52
+ * @returns {AvaBloodFlowResult} AVA blood flow rate at hand and foot [L/h]
53
+ */
54
+ function ava_blood_flow(err_cr, 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, ci = JOS3Defaults_js_1.default.cardiac_index) {
55
+ // Cal. mean error body core temp.
56
+ let cap_bcr = [10.2975, 9.3935, 4.488];
57
+ let err_bcr = math.sum(math.dotMultiply(err_cr.subset(math.index(math.range(2, 5))), cap_bcr)) / math.sum(cap_bcr);
58
+ // Cal. mean error skin temp.
59
+ let err_msk = math.sum(math.dotMultiply(err_sk, JOS3Defaults_js_1.default.local_bsa)) /
60
+ math.sum(JOS3Defaults_js_1.default.local_bsa);
61
+ // Openness of AVA [-]
62
+ let sig_ava_hand = 0.265 * (err_msk + 0.43) + 0.953 * (err_bcr + 0.1905) + 0.9126;
63
+ let sig_ava_foot = 0.265 * (err_msk - 0.997) + 0.953 * (err_bcr + 0.0095) + 0.9126;
64
+ sig_ava_hand = Math.min(sig_ava_hand, 1);
65
+ sig_ava_hand = Math.max(sig_ava_hand, 0);
66
+ sig_ava_foot = Math.min(sig_ava_foot, 1);
67
+ sig_ava_foot = Math.max(sig_ava_foot, 0);
68
+ // Basal blood flow rate to the standard body [-]
69
+ let bfbrate = (0, bfb_rate_js_1.bfb_rate)(height, weight, bsa_equation, age, ci);
70
+ // AVA blood flow rate [L/h]
71
+ let bf_ava_hand = 1.71 * bfbrate * sig_ava_hand;
72
+ let bf_ava_foot = 2.16 * bfbrate * sig_ava_foot;
73
+ return { bf_ava_hand, bf_ava_foot };
74
+ }
75
+ exports.ava_blood_flow = ava_blood_flow;
@@ -0,0 +1,55 @@
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.basal_met = void 0;
7
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
8
+ /**
9
+ * Calculate basal metabolic rate [W].
10
+ *
11
+ * @param {number} [height=1.72] - Body height [m].
12
+ * @param {number} [weight=74.43] - Body weight [kg].
13
+ * @param {number} [age=20] - Age [years].
14
+ * @param {string} [sex="male"] - Choose male or female.
15
+ * @param {string} [bmr_equation="harris-benedict"] - Choose harris-benedict or ganpule.
16
+ *
17
+ * @returns {number} Basal metabolic rate [W].
18
+ */
19
+ function basal_met(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) {
20
+ const valid_equations = [
21
+ "harris-benedict",
22
+ "harris-benedict_origin",
23
+ "japanese",
24
+ "ganpule",
25
+ ];
26
+ if (!valid_equations.includes(bmr_equation)) {
27
+ throw new Error(`Invalid BMR equation. Must be one of ${valid_equations.join(", ")}`);
28
+ }
29
+ let bmr;
30
+ switch (bmr_equation) {
31
+ case "harris-benedict":
32
+ bmr =
33
+ sex === "male"
34
+ ? 88.362 + 13.397 * weight + 500.3 * height - 5.677 * age
35
+ : 447.593 + 9.247 * weight + 479.9 * height - 4.33 * age;
36
+ break;
37
+ case "harris-benedict_origin":
38
+ bmr =
39
+ sex === "male"
40
+ ? 66.473 + 13.7516 * weight + 500.33 * height - 6.755 * age
41
+ : 655.0955 + 9.5634 * weight + 184.96 * height - 4.6756 * age;
42
+ break;
43
+ case "japanese":
44
+ case "ganpule":
45
+ // Ganpule et al., 2007, https://doi.org/10.1038/sj.ejcn.1602645
46
+ bmr =
47
+ sex === "male"
48
+ ? 0.0481 * weight + 2.34 * height - 0.0138 * age - 0.4235
49
+ : 0.0481 * weight + 2.34 * height - 0.0138 * age - 0.9708;
50
+ bmr *= 1000 / 4.186;
51
+ break;
52
+ }
53
+ return bmr * 0.048; // [kcal/day] to [W]
54
+ }
55
+ exports.basal_met = basal_met;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clo_area_factor = void 0;
4
+ /**
5
+ * Calculate clothing area factor
6
+ *
7
+ * @param {math.Matrix} clo - Clothing insulation.
8
+ *
9
+ * @returns {math.Matrix} clothing area factor.
10
+ */
11
+ function clo_area_factor(clo) {
12
+ return clo.map((clo) => (clo < 0.5 ? clo * 0.2 + 1 : clo * 0.1 + 1.05));
13
+ }
14
+ exports.clo_area_factor = clo_area_factor;
@@ -0,0 +1,127 @@
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.conv_coef = void 0;
30
+ const JOS3Defaults_js_1 = __importDefault(require("../JOS3Defaults.js"));
31
+ const math = __importStar(require("mathjs"));
32
+ /**
33
+ * Calculate convective heat transfer coefficient (hc) [W/(m2*K)]
34
+ *
35
+ * @param {string} [posture=JOS3Defaults.posture] - Select posture from standing, sitting, lying, sedentary or supine. The default is "standing".
36
+ * @param {math.Matrix} [v=JOS3Defaults.air_speed] - Air velocity [m/s]. If Iterable is input, its length should be 17. The default is 0.1.
37
+ * @param {math.Matrix} [tdb=JOS3Defaults.dry_bulb_air_temperature] - Air temperature [°C]. If Iterable is input, its length should be 17. The default is 28.8.
38
+ * @param {math.Matrix} [t_skin=JOS3Defaults.skin_temperature] - Skin temperature [°C]. If Iterable is input, its length should be 17. The default is 34.0.
39
+ *
40
+ * @returns {math.Matrix} Convective heat transfer coefficient (hc) [W/(m2*K)].
41
+ *
42
+ * @see {@link https://doi.org/10.3130/aija.62.45_5 | Ichihara et al., 1997}
43
+ * @see {@link https://doi.org/10.20718/jjpa.13.1_17 | Kurazumi et al., 2008}
44
+ */
45
+ function conv_coef(posture = JOS3Defaults_js_1.default.posture, v = math.multiply(math.ones(17), JOS3Defaults_js_1.default.air_speed), tdb = math.multiply(math.ones(17), JOS3Defaults_js_1.default.dry_bulb_air_temperature), t_skin = math.multiply(math.ones(17), JOS3Defaults_js_1.default.skin_temperature)) {
46
+ // Convert v to math.matrix
47
+ v = math.isMatrix(v) ? v : math.matrix(v);
48
+ /**
49
+ * Natural convection
50
+ *
51
+ * @param {string} posture
52
+ * @param {math.Matrix} tdb
53
+ * @param {math.Matrix} t_skin
54
+ *
55
+ * @return {math.Matrix}
56
+ */
57
+ const natural_convection = (posture, tdb, t_skin) => {
58
+ posture = posture.toLowerCase();
59
+ const valid_postures = [
60
+ "standing",
61
+ "sitting",
62
+ "lying",
63
+ "sedentary",
64
+ "supine",
65
+ ];
66
+ if (!valid_postures.includes(posture)) {
67
+ let postures = valid_postures.join(", ");
68
+ throw new Error(`Invalid posture ${posture}. Must be one of ${postures}.`);
69
+ }
70
+ let hc_natural;
71
+ switch (posture) {
72
+ case "standing":
73
+ // Ichihara et al., 1997, https://doi.org/10.3130/aija.62.45_5
74
+ hc_natural = math.matrix([
75
+ 4.48, 4.48, 2.97, 2.91, 2.85, 3.61, 3.55, 3.67, 3.61, 3.55, 3.67, 2.8,
76
+ 2.04, 2.04, 2.8, 2.04, 2.04,
77
+ ]);
78
+ break;
79
+ case "sitting":
80
+ case "sedentary":
81
+ // Ichihara et al., 1997, https://doi.org/10.3130/aija.62.45_5
82
+ hc_natural = math.matrix([
83
+ 4.75, 4.75, 3.12, 2.48, 1.84, 3.76, 3.62, 2.06, 3.76, 3.62, 2.06,
84
+ 2.98, 2.98, 2.62, 2.98, 2.98, 2.62,
85
+ ]);
86
+ break;
87
+ case "lying":
88
+ case "supine":
89
+ // Kurazumi et al., 2008, https://doi.org/10.20718/jjpa.13.1_17
90
+ // The values are applied under cold environment.
91
+ let hc_a = math.matrix([
92
+ 1.105, 1.105, 1.211, 1.211, 1.211, 0.913, 2.081, 2.178, 0.913, 2.081,
93
+ 2.178, 0.945, 0.385, 0.2, 0.945, 0.385, 0.2,
94
+ ]);
95
+ let hc_b = math.matrix([
96
+ 0.345, 0.345, 0.046, 0.046, 0.046, 0.373, 0.85, 0.297, 0.373, 0.85,
97
+ 0.297, 0.447, 0.58, 0.966, 0.447, 0.58, 0.966,
98
+ ]);
99
+ hc_natural = math.dotMultiply(hc_a, math.dotPow(math.abs(math.subtract(tdb, t_skin)), hc_b));
100
+ break;
101
+ }
102
+ return hc_natural;
103
+ };
104
+ /**
105
+ * Forced convection
106
+ *
107
+ * @param v {math.Matrix}
108
+ *
109
+ * @return {math.Matrix}
110
+ */
111
+ const forced_convection = (v) => {
112
+ // Ichihara et al., 1997, https://doi.org/10.3130/aija.62.45_5
113
+ let hc_a = math.matrix([
114
+ 15.0, 15.0, 11.0, 17.0, 13.0, 17.0, 17.0, 20.0, 17.0, 17.0, 20.0, 14.0,
115
+ 15.8, 15.1, 14.0, 15.8, 15.1,
116
+ ]);
117
+ let hc_b = math.matrix([
118
+ 0.62, 0.62, 0.67, 0.49, 0.6, 0.59, 0.61, 0.6, 0.59, 0.61, 0.6, 0.61, 0.74,
119
+ 0.62, 0.61, 0.74, 0.62,
120
+ ]);
121
+ return math.dotMultiply(hc_a, math.dotPow(v, hc_b));
122
+ };
123
+ let hc_natural = natural_convection(posture, tdb, t_skin);
124
+ let hc_forced = forced_convection(v);
125
+ return v.map((z, idx) => z < 0.2 ? hc_natural.get(idx) : hc_forced.get(idx));
126
+ }
127
+ exports.conv_coef = conv_coef;