jsthermalcomfort 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.goodBye = exports.helloWorld = exports.heatIndex = void 0;
3
+ exports.phs = exports.heatIndex = exports.p_sat = void 0;
4
+ /**
5
+ * Calculates vapour pressure of water at different temperatures
6
+ * @param {number} tdb - air temperature, [°C]
7
+ * @returns {number} - operative temperature, [Pa]
8
+ */
9
+ function p_sat(tdb) {
10
+ const c_to_k = 273.15;
11
+ const ta_k = tdb + c_to_k;
12
+ const c1 = -5674.5359;
13
+ const c2 = 6.3925247;
14
+ const c3 = -0.9677843 * Math.pow(10, -2);
15
+ const c4 = 0.62215701 * Math.pow(10, -6);
16
+ const c5 = 0.20747825 * Math.pow(10, -8);
17
+ const c6 = -0.9484024 * Math.pow(10, -12);
18
+ const c7 = 4.1635019;
19
+ const c8 = -5800.2206;
20
+ const c9 = 1.3914993;
21
+ const c10 = -0.048640239;
22
+ const c11 = 0.41764768 * Math.pow(10, -4);
23
+ const c12 = -0.14452093 * Math.pow(10, -7);
24
+ const c13 = 6.5459673;
25
+ let pascals;
26
+ if (ta_k < c_to_k) {
27
+ pascals = Math.exp(c1 / ta_k +
28
+ c2 +
29
+ ta_k * (c3 + ta_k * (c4 + ta_k * (c5 + c6 * ta_k))) +
30
+ c7 * Math.log(ta_k));
31
+ }
32
+ else {
33
+ pascals = Math.exp(c8 / ta_k +
34
+ c9 +
35
+ ta_k * (c10 + ta_k * (c11 + ta_k * c12)) +
36
+ c13 * Math.log(ta_k));
37
+ }
38
+ return Math.round(pascals * 10) / 10;
39
+ }
40
+ exports.p_sat = p_sat;
4
41
  /**
5
42
  * Calculates the Heat Index (HI). It combines air temperature and relative humidity to determine an apparent temperature.
6
43
  *
@@ -57,18 +94,343 @@ function heatIndex(tdb, rh, options = {}) {
57
94
  }
58
95
  }
59
96
  exports.heatIndex = heatIndex;
60
- function helloWorld() {
61
- const message = 'Hello World from my example modern npm package!';
62
- return message;
63
- }
64
- exports.helloWorld = helloWorld;
65
- function goodBye() {
66
- const message = 'Goodbye from my example modern npm package!';
67
- return message;
97
+ /**
98
+ * Calculates the Predicted Heat Strain (PHS) index based in compliance with
99
+ * the ISO 7933:2004 Standard [8]_. The ISO 7933 provides a method for the
100
+ * analytical evaluation and interpretation of the thermal stress experienced
101
+ * by a subject in a hot environment. It describes a method for predicting the
102
+ * sweat rate and the internal core temperature that the human body will
103
+ * develop in response to the working conditions.
104
+ * The PHS model can be used to predict the: heat by respiratory convection, heat flow
105
+ * by respiratory evaporation, steady state mean skin temperature, instantaneous value
106
+ * of skin temperature, heat accumulation associated with the metabolic rate, maximum
107
+ * evaporative heat flow at the skin surface, predicted sweat rate, predicted evaporative
108
+ * heat flow, and rectal temperature.
109
+ * @param {number} tdb - dry bulb air temperature, default in [°C]
110
+ * @param {number} tr - mean radiant temperature, default in [°C]
111
+ * @param {number} v - air speed, default in [m/s]
112
+ * @param {number} rh - relative humidity, [%]
113
+ * @param {number} met - metabolic rate, [W/(m2)]
114
+ * @param {number} clo - clothing insulation, [clo]
115
+ * @param {number} posture - a numeric value presenting posture of person [sitting=1, standing=2, crouching=3]
116
+ * @param {number} wme - external work, [W/(m2)] default 0
117
+ * @param {number} i_mst - static moisture permeability index, [dimensionless], default 0.38
118
+ * @param {number} a_p - fraction of the body surface covered by the reflective clothing, [dimensionless], default 0.54
119
+ * @param {number} drink - 1 if workers can drink freely, 0 otherwise, default 1
120
+ * @param {number} weight - body weight, [kg], default 75
121
+ * @param {number} height - height, [m], default 1.8
122
+ * @param {number} walk_sp - walking speed, [m/s], default 0
123
+ * @param {number} theta - angle between walking direction and wind direction [degrees], default 0
124
+ * @param {number} acclimatized - 100 if acclimatised subject, 0 otherwise, default 100
125
+ * @param {number} duration - duration of the work sequence, [minutes], default 480
126
+ * @param {number} f_r - emissivity of the reflective clothing, [dimensionless], default 0.97
127
+ * @param {number} t_sk - mean skin temperature when worker starts working, [°C], default 34.1
128
+ * @param {number} t_cr - mean core temperature when worker starts working, [°C], default 36.8
129
+ * @param {number} t_re - mean rectal temperature when worker starts working, [°C], default false
130
+ * @param {number} t_cr_eq - mean core temperature as a function of met when worker starts working, [°C], default false
131
+ * @param {number} sweat_rate - default 0
132
+ * @returns {[number]} - an array of the following results:
133
+ */
134
+ function phs(tdb, tr, rh, v, met, clo, posture, wme = 0, i_mst = 0.38, a_p = 0.54, drink = 1, weight = 75, height = 1.8, walk_sp = 0, theta = 0, acclimatized = 100, duration = 480, f_r = 0.97, t_sk = 34.1, t_cr = 36.8, t_re = 999, t_cr_eq = 999, t_sk_t_cr_wg = 0.3, sw_tot = 0, round = true) {
135
+ const p_a = ((p_sat(tdb) / 1000) * rh) / 100;
136
+ if (t_re == 999) {
137
+ t_re = t_cr;
138
+ }
139
+ if (t_cr_eq == 999) {
140
+ t_cr_eq = t_cr;
141
+ }
142
+ // DuBois body surface area [m2]
143
+ const a_dubois = 0.202 * Math.pow(weight, 0.425) * Math.pow(height, 0.725);
144
+ const sp_heat = (57.83 * weight) / a_dubois; // specific heat of the body
145
+ let d_lim_t_re = 0; // maximum allowable exposure time for heat storage [min]
146
+ // maximum allowable exposure time for water loss, mean subject [min]
147
+ let d_lim_loss_50 = 0;
148
+ // maximum allowable exposure time for water loss, 95 % of the working population [min]
149
+ let d_lim_loss_95 = 0;
150
+ // maximum water loss to protect a mean subject [g]
151
+ const d_max_50 = 0.075 * weight * 1000;
152
+ // maximum water loss to protect 95 % of the working population [g]
153
+ const d_max_95 = 0.05 * weight * 1000;
154
+ // exponential averaging constants
155
+ const const_t_eq = Math.exp(-1 / 10);
156
+ const const_t_sk = Math.exp(-1 / 3);
157
+ const const_sw = Math.exp(-1 / 10);
158
+ let sweat_rate = sw_tot;
159
+ let def_dir = 0;
160
+ if (theta !== 0) {
161
+ // def_dir = 1 for unidirectional walking, def_dir = 0 for omni-directional walking
162
+ def_dir = 1;
163
+ }
164
+ let def_speed = 0;
165
+ if (walk_sp !== 0) {
166
+ def_speed = 1;
167
+ }
168
+ // radiating area dubois
169
+ let a_r_du = 0.7;
170
+ if (posture === 2) {
171
+ a_r_du = 0.77;
172
+ }
173
+ if (posture === 3) {
174
+ a_r_du = 0.67;
175
+ }
176
+ // evaluation of the max sweat rate as a function of the metabolic rate
177
+ let sw_max = (met - 32) * a_dubois;
178
+ if (sw_max > 400) {
179
+ sw_max = 400;
180
+ }
181
+ if (sw_max < 250) {
182
+ sw_max = 250;
183
+ }
184
+ if (acclimatized >= 50) {
185
+ sw_max = sw_max * 1.25;
186
+ }
187
+ // max skin wettedness
188
+ let w_max = 0.85;
189
+ if (acclimatized > 50) {
190
+ w_max = 1;
191
+ }
192
+ // static clothing insulation
193
+ const i_cl_st = clo * 0.155;
194
+ const fcl = 1 + 0.3 * clo;
195
+ // Static boundary layer thermal insulation in quiet air
196
+ const i_a_st = 0.111;
197
+ // Total static insulation
198
+ const i_tot_st = i_cl_st + i_a_st / fcl;
199
+ let v_r = v;
200
+ if (def_speed > 0) {
201
+ if (def_dir === 1) {
202
+ // Unidirectional walking
203
+ v_r = Math.abs(v - walk_sp * Math.cos((3.14159 * theta) / 180));
204
+ }
205
+ else {
206
+ // Omni-directional walking IF
207
+ if (v < walk_sp) {
208
+ v_r = walk_sp;
209
+ }
210
+ else {
211
+ v_r = v;
212
+ }
213
+ }
214
+ }
215
+ else {
216
+ walk_sp = 0.0052 * (met - 58);
217
+ if (walk_sp > 0.7) {
218
+ walk_sp = 0.7;
219
+ }
220
+ v_r = v;
221
+ }
222
+ // Dynamic clothing insulation - correction for wind (Var) and walking speed
223
+ let v_ux = v_r;
224
+ if (v_r > 3) {
225
+ v_ux = 3;
226
+ }
227
+ let w_a_ux = walk_sp;
228
+ if (walk_sp > 1.5) {
229
+ w_a_ux = 1.5;
230
+ }
231
+ // correction for the dynamic total dry thermal insulation at or above 0.6 clo
232
+ let corr_cl = 1.044 *
233
+ Math.exp((0.066 * v_ux - 0.398) * v_ux + (0.094 * w_a_ux - 0.378) * w_a_ux);
234
+ if (corr_cl > 1) {
235
+ corr_cl = 1;
236
+ }
237
+ // correction for the dynamic total dry thermal insulation at 0 clo
238
+ let corr_ia = Math.exp((0.047 * v_r - 0.472) * v_r + (0.117 * w_a_ux - 0.342) * w_a_ux);
239
+ if (corr_ia > 1) {
240
+ corr_ia = 1;
241
+ }
242
+ let corr_tot = corr_cl;
243
+ if (clo <= 0.6) {
244
+ corr_tot = ((0.6 - clo) * corr_ia + clo * corr_cl) / 0.6;
245
+ }
246
+ // total dynamic clothing insulation
247
+ let i_tot_dyn = i_tot_st * corr_tot;
248
+ // dynamic boundary layer thermal insulation
249
+ let i_a_dyn = corr_ia * i_a_st;
250
+ let i_cl_dyn = i_tot_dyn - i_a_dyn / fcl;
251
+ // correction for the dynamic permeability index
252
+ let corr_e = (2.6 * corr_tot - 6.5) * corr_tot + 4.9;
253
+ let im_dyn = i_mst * corr_e;
254
+ if (im_dyn > 0.9) {
255
+ im_dyn = 0.9;
256
+ }
257
+ let r_t_dyn = i_tot_dyn / im_dyn / 16.7;
258
+ let t_exp = 28.56 + 0.115 * tdb + 0.641 * p_a; // expired air temperature
259
+ // respiratory convective heat flow [W/m2]
260
+ let c_res = 0.001516 * met * (t_exp - tdb);
261
+ // respiratory evaporative heat flow [W/m2]
262
+ let e_res = 0.00127 * met * (59.34 + 0.53 * tdb - 11.63 * p_a);
263
+ let z = 3.5 + 5.2 * v_r;
264
+ if (v_r > 1) {
265
+ z = 8.7 * Math.pow(v_r, 0.6);
266
+ }
267
+ // Dynamic convective heat transfer coefficient
268
+ let hc_dyn = 2.38 * Math.pow(Math.abs(t_sk - tdb), 0.25);
269
+ if (z > hc_dyn) {
270
+ hc_dyn = z;
271
+ }
272
+ let aux_r = 5.67e-8 * a_r_du;
273
+ let f_cl_r = (1 - a_p) * 0.97 + a_p * f_r;
274
+ let h_r;
275
+ let t_cl;
276
+ let t_cl_new;
277
+ let sw_req;
278
+ let e_v_eff;
279
+ let k;
280
+ let wp = 0;
281
+ let e_p;
282
+ let sw_tot_g = 0;
283
+ for (let time = 1; time <= duration; time++) {
284
+ const t_sk0 = t_sk;
285
+ const t_re0 = t_re;
286
+ const t_cr0 = t_cr;
287
+ const t_cr_eq0 = t_cr_eq;
288
+ const t_sk_t_cr_wg0 = t_sk_t_cr_wg;
289
+ // equilibrium core temperature associated to the metabolic rate
290
+ const t_cr_eq_m = 0.0036 * met + 36.6;
291
+ // Core temperature at this minute, by exponential averaging
292
+ t_cr_eq = t_cr_eq0 * const_t_eq + t_cr_eq_m * (1 - const_t_eq);
293
+ // Heat storage associated with this core temperature increase during the last minute
294
+ const d_stored_eq = sp_heat * (t_cr_eq - t_cr_eq0) * (1 - t_sk_t_cr_wg0);
295
+ // skin temperature prediction -- clothed model
296
+ let t_sk_eq_cl = 12.165 + 0.02017 * tdb + 0.04361 * tr + 0.19354 * p_a - 0.25315 * v;
297
+ t_sk_eq_cl = t_sk_eq_cl + 0.005346 * met + 0.51274 * t_re;
298
+ // nude model
299
+ let t_sk_eq_nu = 7.191 + 0.064 * tdb + 0.061 * tr + 0.198 * p_a - 0.348 * v;
300
+ t_sk_eq_nu = t_sk_eq_nu + 0.616 * t_re;
301
+ let t_sk_eq = t_sk_eq_nu + 2.5 * (t_sk_eq_cl - t_sk_eq_nu) * (clo - 0.2);
302
+ if (clo >= 0.6) {
303
+ t_sk_eq = t_sk_eq_cl;
304
+ }
305
+ else if (clo <= 0.2) {
306
+ t_sk_eq = t_sk_eq_nu;
307
+ }
308
+ // skin temperature [C]
309
+ t_sk = t_sk0 * const_t_sk + t_sk_eq * (1 - const_t_sk);
310
+ // Saturated water vapour pressure at the surface of the skin
311
+ const p_sk = 0.6105 * Math.exp((17.27 * t_sk) / (t_sk + 237.3));
312
+ t_cl = tr + 0.1; // clothing surface temperature
313
+ while (true) {
314
+ // radiative heat transfer coefficient
315
+ h_r =
316
+ (f_cl_r * aux_r * (Math.pow(t_cl + 273, 4) - Math.pow(tr + 273, 4))) /
317
+ (t_cl - tr);
318
+ let t_cl_new = (fcl * (hc_dyn * tdb + h_r * tr) + t_sk / i_cl_dyn) /
319
+ (fcl * (hc_dyn + h_r) + 1 / i_cl_dyn);
320
+ if (Math.abs(t_cl - t_cl_new) <= 0.001) {
321
+ break;
322
+ }
323
+ t_cl = (t_cl + t_cl_new) / 2;
324
+ }
325
+ let convection = fcl * hc_dyn * (t_cl - tdb);
326
+ let radiation = fcl * h_r * (t_cl - tr);
327
+ // maximum evaporative heat flow at the skin surface [W/m2]
328
+ let e_max = (p_sk - p_a) / r_t_dyn;
329
+ // required evaporative heat flow [W/m2]
330
+ let e_req = met - d_stored_eq - wme - c_res - e_res - convection - radiation;
331
+ // required skin wettedness
332
+ let w_req = e_req / e_max;
333
+ if (e_req <= 0) {
334
+ e_req = 0;
335
+ sw_req = 0; // required sweat rate [W/m2]
336
+ }
337
+ else if (e_max <= 0) {
338
+ e_max = 0;
339
+ sw_req = sw_max;
340
+ }
341
+ else if (w_req >= 1.7) {
342
+ sw_req = sw_max;
343
+ }
344
+ else {
345
+ e_v_eff = 1 - Math.pow(w_req, 2) / 2;
346
+ if (w_req > 1) {
347
+ e_v_eff = Math.pow(2 - w_req, 2) / 2;
348
+ }
349
+ sw_req = e_req / e_v_eff;
350
+ if (sw_req > sw_max) {
351
+ sw_req = sw_max;
352
+ }
353
+ }
354
+ sweat_rate = sweat_rate * const_sw + sw_req * (1 - const_sw);
355
+ if (sweat_rate <= 0) {
356
+ e_p = 0; // predicted evaporative heat flow [W/m2]
357
+ sweat_rate = 0;
358
+ }
359
+ else {
360
+ k = e_max / sweat_rate;
361
+ wp = 1;
362
+ if (k >= 0.5) {
363
+ wp = -k + Math.sqrt(k * k + 2);
364
+ }
365
+ if (wp > w_max) {
366
+ wp = w_max;
367
+ }
368
+ e_p = wp * e_max;
369
+ }
370
+ // body heat storage rate [W/m2]
371
+ let d_storage = e_req - e_p + d_stored_eq;
372
+ let t_cr_new = t_cr0;
373
+ while (true) {
374
+ t_sk_t_cr_wg = 0.3 - 0.09 * (t_cr_new - 36.8);
375
+ if (t_sk_t_cr_wg > 0.3) {
376
+ t_sk_t_cr_wg = 0.3;
377
+ }
378
+ if (t_sk_t_cr_wg < 0.1) {
379
+ t_sk_t_cr_wg = 0.1;
380
+ }
381
+ t_cr =
382
+ d_storage / sp_heat +
383
+ (t_sk0 * t_sk_t_cr_wg0) / 2 -
384
+ (t_sk * t_sk_t_cr_wg) / 2;
385
+ t_cr = (t_cr + t_cr0 * (1 - t_sk_t_cr_wg0 / 2)) / (1 - t_sk_t_cr_wg / 2);
386
+ if (Math.abs(t_cr - t_cr_new) <= 0.001) {
387
+ break;
388
+ }
389
+ t_cr_new = (t_cr_new + t_cr) / 2;
390
+ }
391
+ t_re = t_re0 + (2 * t_cr - 1.962 * t_re0 - 1.31) / 9;
392
+ if (d_lim_t_re == 0 && t_re >= 38) {
393
+ d_lim_t_re = time;
394
+ }
395
+ sw_tot = sw_tot + sweat_rate + e_res;
396
+ sw_tot_g = (sw_tot * 2.67 * a_dubois) / 1.8 / 60;
397
+ if (d_lim_loss_50 == 0 && sw_tot_g >= d_max_50) {
398
+ d_lim_loss_50 = time;
399
+ }
400
+ if (d_lim_loss_95 == 0 && sw_tot_g >= d_max_95) {
401
+ d_lim_loss_95 = time;
402
+ }
403
+ if (drink == 0) {
404
+ d_lim_loss_95 = d_lim_loss_95 * 0.6;
405
+ d_lim_loss_50 = d_lim_loss_95;
406
+ }
407
+ }
408
+ if (d_lim_loss_50 == 0) {
409
+ d_lim_loss_50 = duration;
410
+ }
411
+ if (d_lim_loss_95 == 0) {
412
+ d_lim_loss_95 = duration;
413
+ }
414
+ if (d_lim_t_re == 0) {
415
+ d_lim_t_re = duration;
416
+ }
417
+ return {
418
+ t_re: round ? Math.round(t_re * 10) / 10 : t_re,
419
+ t_sk: round ? Math.round(t_sk * 10) / 10 : t_sk,
420
+ t_cr: round ? Math.round(t_cr * 10) / 10 : t_cr,
421
+ t_cr_eq: round ? Math.round(t_cr_eq * 10) / 10 : t_cr_eq,
422
+ t_sk_t_cr_wg: round ? Math.round(t_sk_t_cr_wg * 100) / 100 : t_sk_t_cr_wg,
423
+ sweat_rate: round ? Math.round(sweat_rate * 10) / 10 : sweat_rate,
424
+ sw_tot_g: round ? Math.round(sw_tot_g * 10) / 10 : sw_tot_g,
425
+ d_lim_loss_50: round ? Math.round(d_lim_loss_50 * 10) / 10 : d_lim_loss_50,
426
+ d_lim_loss_95: round ? Math.round(d_lim_loss_95 * 10) / 10 : d_lim_loss_95,
427
+ d_lim_t_re: round ? Math.round(d_lim_t_re * 10) / 10 : d_lim_t_re,
428
+ wp: round ? Math.round(wp * 100) / 100 : wp,
429
+ };
68
430
  }
69
- exports.goodBye = goodBye;
431
+ exports.phs = phs;
70
432
  exports.default = {
71
- helloWorld,
72
433
  heatIndex,
73
- goodBye,
434
+ phs,
435
+ p_sat,
74
436
  };
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Calculates vapour pressure of water at different temperatures
3
+ * @param {number} tdb - air temperature, [°C]
4
+ * @returns {number} - operative temperature, [Pa]
5
+ */
6
+ export declare function p_sat(tdb: number): number;
1
7
  interface HeatIndexOptions {
2
8
  round?: boolean;
3
9
  units?: "SI" | "IP";
@@ -17,12 +23,60 @@ interface HeatIndexOptions {
17
23
  * const hi = heatIndex(25, 50); // returns 25.9
18
24
  */
19
25
  export declare function heatIndex(tdb: number, rh: number, options?: HeatIndexOptions): number;
20
- export declare function helloWorld(): string;
21
- export declare function goodBye(): string;
26
+ /**
27
+ * Calculates the Predicted Heat Strain (PHS) index based in compliance with
28
+ * the ISO 7933:2004 Standard [8]_. The ISO 7933 provides a method for the
29
+ * analytical evaluation and interpretation of the thermal stress experienced
30
+ * by a subject in a hot environment. It describes a method for predicting the
31
+ * sweat rate and the internal core temperature that the human body will
32
+ * develop in response to the working conditions.
33
+ * The PHS model can be used to predict the: heat by respiratory convection, heat flow
34
+ * by respiratory evaporation, steady state mean skin temperature, instantaneous value
35
+ * of skin temperature, heat accumulation associated with the metabolic rate, maximum
36
+ * evaporative heat flow at the skin surface, predicted sweat rate, predicted evaporative
37
+ * heat flow, and rectal temperature.
38
+ * @param {number} tdb - dry bulb air temperature, default in [°C]
39
+ * @param {number} tr - mean radiant temperature, default in [°C]
40
+ * @param {number} v - air speed, default in [m/s]
41
+ * @param {number} rh - relative humidity, [%]
42
+ * @param {number} met - metabolic rate, [W/(m2)]
43
+ * @param {number} clo - clothing insulation, [clo]
44
+ * @param {number} posture - a numeric value presenting posture of person [sitting=1, standing=2, crouching=3]
45
+ * @param {number} wme - external work, [W/(m2)] default 0
46
+ * @param {number} i_mst - static moisture permeability index, [dimensionless], default 0.38
47
+ * @param {number} a_p - fraction of the body surface covered by the reflective clothing, [dimensionless], default 0.54
48
+ * @param {number} drink - 1 if workers can drink freely, 0 otherwise, default 1
49
+ * @param {number} weight - body weight, [kg], default 75
50
+ * @param {number} height - height, [m], default 1.8
51
+ * @param {number} walk_sp - walking speed, [m/s], default 0
52
+ * @param {number} theta - angle between walking direction and wind direction [degrees], default 0
53
+ * @param {number} acclimatized - 100 if acclimatised subject, 0 otherwise, default 100
54
+ * @param {number} duration - duration of the work sequence, [minutes], default 480
55
+ * @param {number} f_r - emissivity of the reflective clothing, [dimensionless], default 0.97
56
+ * @param {number} t_sk - mean skin temperature when worker starts working, [°C], default 34.1
57
+ * @param {number} t_cr - mean core temperature when worker starts working, [°C], default 36.8
58
+ * @param {number} t_re - mean rectal temperature when worker starts working, [°C], default false
59
+ * @param {number} t_cr_eq - mean core temperature as a function of met when worker starts working, [°C], default false
60
+ * @param {number} sweat_rate - default 0
61
+ * @returns {[number]} - an array of the following results:
62
+ */
63
+ export declare function phs(tdb: number, tr: number, rh: number, v: number, met: number, clo: number, posture: number, wme?: number, i_mst?: number, a_p?: number, drink?: number, weight?: number, height?: number, walk_sp?: number, theta?: number, acclimatized?: number, duration?: number, f_r?: number, t_sk?: number, t_cr?: number, t_re?: number, t_cr_eq?: number, t_sk_t_cr_wg?: number, sw_tot?: number, round?: boolean): {
64
+ t_re: number;
65
+ t_sk: number;
66
+ t_cr: number;
67
+ t_cr_eq: number;
68
+ t_sk_t_cr_wg: number;
69
+ sweat_rate: number;
70
+ sw_tot_g: number;
71
+ d_lim_loss_50: number;
72
+ d_lim_loss_95: number;
73
+ d_lim_t_re: number;
74
+ wp: number;
75
+ };
22
76
  declare const _default: {
23
- helloWorld: typeof helloWorld;
24
77
  heatIndex: typeof heatIndex;
25
- goodBye: typeof goodBye;
78
+ phs: typeof phs;
79
+ p_sat: typeof p_sat;
26
80
  };
27
81
  export default _default;
28
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAyCzF;AAED,wBAAgB,UAAU,WAGzB;AAED,wBAAgB,OAAO,WAGtB;;;;;;AAED,wBAIE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmCzC;AAED,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAyCR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,GAAG,CACjB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAU,EACf,KAAK,GAAE,MAAa,EACpB,GAAG,GAAE,MAAa,EAClB,KAAK,GAAE,MAAU,EACjB,MAAM,GAAE,MAAW,EACnB,MAAM,GAAE,MAAY,EACpB,OAAO,GAAE,MAAU,EACnB,KAAK,GAAE,MAAU,EACjB,YAAY,GAAE,MAAY,EAC1B,QAAQ,GAAE,MAAY,EACtB,GAAG,GAAE,MAAa,EAClB,IAAI,GAAE,MAAa,EACnB,IAAI,GAAE,MAAa,EACnB,IAAI,GAAE,MAAY,EAClB,OAAO,GAAE,MAAY,EACrB,YAAY,GAAE,MAAY,EAC1B,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,OAAc;;;;;;;;;;;;EA6TtB;;;;;;AAED,wBAIE"}
package/lib/esm/index.mjs CHANGED
@@ -1,3 +1,39 @@
1
+ /**
2
+ * Calculates vapour pressure of water at different temperatures
3
+ * @param {number} tdb - air temperature, [°C]
4
+ * @returns {number} - operative temperature, [Pa]
5
+ */
6
+ export function p_sat(tdb) {
7
+ const c_to_k = 273.15;
8
+ const ta_k = tdb + c_to_k;
9
+ const c1 = -5674.5359;
10
+ const c2 = 6.3925247;
11
+ const c3 = -0.9677843 * Math.pow(10, -2);
12
+ const c4 = 0.62215701 * Math.pow(10, -6);
13
+ const c5 = 0.20747825 * Math.pow(10, -8);
14
+ const c6 = -0.9484024 * Math.pow(10, -12);
15
+ const c7 = 4.1635019;
16
+ const c8 = -5800.2206;
17
+ const c9 = 1.3914993;
18
+ const c10 = -0.048640239;
19
+ const c11 = 0.41764768 * Math.pow(10, -4);
20
+ const c12 = -0.14452093 * Math.pow(10, -7);
21
+ const c13 = 6.5459673;
22
+ let pascals;
23
+ if (ta_k < c_to_k) {
24
+ pascals = Math.exp(c1 / ta_k +
25
+ c2 +
26
+ ta_k * (c3 + ta_k * (c4 + ta_k * (c5 + c6 * ta_k))) +
27
+ c7 * Math.log(ta_k));
28
+ }
29
+ else {
30
+ pascals = Math.exp(c8 / ta_k +
31
+ c9 +
32
+ ta_k * (c10 + ta_k * (c11 + ta_k * c12)) +
33
+ c13 * Math.log(ta_k));
34
+ }
35
+ return Math.round(pascals * 10) / 10;
36
+ }
1
37
  /**
2
38
  * Calculates the Heat Index (HI). It combines air temperature and relative humidity to determine an apparent temperature.
3
39
  *
@@ -53,16 +89,342 @@ export function heatIndex(tdb, rh, options = {}) {
53
89
  return hi;
54
90
  }
55
91
  }
56
- export function helloWorld() {
57
- const message = 'Hello World from my example modern npm package!';
58
- return message;
59
- }
60
- export function goodBye() {
61
- const message = 'Goodbye from my example modern npm package!';
62
- return message;
92
+ /**
93
+ * Calculates the Predicted Heat Strain (PHS) index based in compliance with
94
+ * the ISO 7933:2004 Standard [8]_. The ISO 7933 provides a method for the
95
+ * analytical evaluation and interpretation of the thermal stress experienced
96
+ * by a subject in a hot environment. It describes a method for predicting the
97
+ * sweat rate and the internal core temperature that the human body will
98
+ * develop in response to the working conditions.
99
+ * The PHS model can be used to predict the: heat by respiratory convection, heat flow
100
+ * by respiratory evaporation, steady state mean skin temperature, instantaneous value
101
+ * of skin temperature, heat accumulation associated with the metabolic rate, maximum
102
+ * evaporative heat flow at the skin surface, predicted sweat rate, predicted evaporative
103
+ * heat flow, and rectal temperature.
104
+ * @param {number} tdb - dry bulb air temperature, default in [°C]
105
+ * @param {number} tr - mean radiant temperature, default in [°C]
106
+ * @param {number} v - air speed, default in [m/s]
107
+ * @param {number} rh - relative humidity, [%]
108
+ * @param {number} met - metabolic rate, [W/(m2)]
109
+ * @param {number} clo - clothing insulation, [clo]
110
+ * @param {number} posture - a numeric value presenting posture of person [sitting=1, standing=2, crouching=3]
111
+ * @param {number} wme - external work, [W/(m2)] default 0
112
+ * @param {number} i_mst - static moisture permeability index, [dimensionless], default 0.38
113
+ * @param {number} a_p - fraction of the body surface covered by the reflective clothing, [dimensionless], default 0.54
114
+ * @param {number} drink - 1 if workers can drink freely, 0 otherwise, default 1
115
+ * @param {number} weight - body weight, [kg], default 75
116
+ * @param {number} height - height, [m], default 1.8
117
+ * @param {number} walk_sp - walking speed, [m/s], default 0
118
+ * @param {number} theta - angle between walking direction and wind direction [degrees], default 0
119
+ * @param {number} acclimatized - 100 if acclimatised subject, 0 otherwise, default 100
120
+ * @param {number} duration - duration of the work sequence, [minutes], default 480
121
+ * @param {number} f_r - emissivity of the reflective clothing, [dimensionless], default 0.97
122
+ * @param {number} t_sk - mean skin temperature when worker starts working, [°C], default 34.1
123
+ * @param {number} t_cr - mean core temperature when worker starts working, [°C], default 36.8
124
+ * @param {number} t_re - mean rectal temperature when worker starts working, [°C], default false
125
+ * @param {number} t_cr_eq - mean core temperature as a function of met when worker starts working, [°C], default false
126
+ * @param {number} sweat_rate - default 0
127
+ * @returns {[number]} - an array of the following results:
128
+ */
129
+ export function phs(tdb, tr, rh, v, met, clo, posture, wme = 0, i_mst = 0.38, a_p = 0.54, drink = 1, weight = 75, height = 1.8, walk_sp = 0, theta = 0, acclimatized = 100, duration = 480, f_r = 0.97, t_sk = 34.1, t_cr = 36.8, t_re = 999, t_cr_eq = 999, t_sk_t_cr_wg = 0.3, sw_tot = 0, round = true) {
130
+ const p_a = ((p_sat(tdb) / 1000) * rh) / 100;
131
+ if (t_re == 999) {
132
+ t_re = t_cr;
133
+ }
134
+ if (t_cr_eq == 999) {
135
+ t_cr_eq = t_cr;
136
+ }
137
+ // DuBois body surface area [m2]
138
+ const a_dubois = 0.202 * Math.pow(weight, 0.425) * Math.pow(height, 0.725);
139
+ const sp_heat = (57.83 * weight) / a_dubois; // specific heat of the body
140
+ let d_lim_t_re = 0; // maximum allowable exposure time for heat storage [min]
141
+ // maximum allowable exposure time for water loss, mean subject [min]
142
+ let d_lim_loss_50 = 0;
143
+ // maximum allowable exposure time for water loss, 95 % of the working population [min]
144
+ let d_lim_loss_95 = 0;
145
+ // maximum water loss to protect a mean subject [g]
146
+ const d_max_50 = 0.075 * weight * 1000;
147
+ // maximum water loss to protect 95 % of the working population [g]
148
+ const d_max_95 = 0.05 * weight * 1000;
149
+ // exponential averaging constants
150
+ const const_t_eq = Math.exp(-1 / 10);
151
+ const const_t_sk = Math.exp(-1 / 3);
152
+ const const_sw = Math.exp(-1 / 10);
153
+ let sweat_rate = sw_tot;
154
+ let def_dir = 0;
155
+ if (theta !== 0) {
156
+ // def_dir = 1 for unidirectional walking, def_dir = 0 for omni-directional walking
157
+ def_dir = 1;
158
+ }
159
+ let def_speed = 0;
160
+ if (walk_sp !== 0) {
161
+ def_speed = 1;
162
+ }
163
+ // radiating area dubois
164
+ let a_r_du = 0.7;
165
+ if (posture === 2) {
166
+ a_r_du = 0.77;
167
+ }
168
+ if (posture === 3) {
169
+ a_r_du = 0.67;
170
+ }
171
+ // evaluation of the max sweat rate as a function of the metabolic rate
172
+ let sw_max = (met - 32) * a_dubois;
173
+ if (sw_max > 400) {
174
+ sw_max = 400;
175
+ }
176
+ if (sw_max < 250) {
177
+ sw_max = 250;
178
+ }
179
+ if (acclimatized >= 50) {
180
+ sw_max = sw_max * 1.25;
181
+ }
182
+ // max skin wettedness
183
+ let w_max = 0.85;
184
+ if (acclimatized > 50) {
185
+ w_max = 1;
186
+ }
187
+ // static clothing insulation
188
+ const i_cl_st = clo * 0.155;
189
+ const fcl = 1 + 0.3 * clo;
190
+ // Static boundary layer thermal insulation in quiet air
191
+ const i_a_st = 0.111;
192
+ // Total static insulation
193
+ const i_tot_st = i_cl_st + i_a_st / fcl;
194
+ let v_r = v;
195
+ if (def_speed > 0) {
196
+ if (def_dir === 1) {
197
+ // Unidirectional walking
198
+ v_r = Math.abs(v - walk_sp * Math.cos((3.14159 * theta) / 180));
199
+ }
200
+ else {
201
+ // Omni-directional walking IF
202
+ if (v < walk_sp) {
203
+ v_r = walk_sp;
204
+ }
205
+ else {
206
+ v_r = v;
207
+ }
208
+ }
209
+ }
210
+ else {
211
+ walk_sp = 0.0052 * (met - 58);
212
+ if (walk_sp > 0.7) {
213
+ walk_sp = 0.7;
214
+ }
215
+ v_r = v;
216
+ }
217
+ // Dynamic clothing insulation - correction for wind (Var) and walking speed
218
+ let v_ux = v_r;
219
+ if (v_r > 3) {
220
+ v_ux = 3;
221
+ }
222
+ let w_a_ux = walk_sp;
223
+ if (walk_sp > 1.5) {
224
+ w_a_ux = 1.5;
225
+ }
226
+ // correction for the dynamic total dry thermal insulation at or above 0.6 clo
227
+ let corr_cl = 1.044 *
228
+ Math.exp((0.066 * v_ux - 0.398) * v_ux + (0.094 * w_a_ux - 0.378) * w_a_ux);
229
+ if (corr_cl > 1) {
230
+ corr_cl = 1;
231
+ }
232
+ // correction for the dynamic total dry thermal insulation at 0 clo
233
+ let corr_ia = Math.exp((0.047 * v_r - 0.472) * v_r + (0.117 * w_a_ux - 0.342) * w_a_ux);
234
+ if (corr_ia > 1) {
235
+ corr_ia = 1;
236
+ }
237
+ let corr_tot = corr_cl;
238
+ if (clo <= 0.6) {
239
+ corr_tot = ((0.6 - clo) * corr_ia + clo * corr_cl) / 0.6;
240
+ }
241
+ // total dynamic clothing insulation
242
+ let i_tot_dyn = i_tot_st * corr_tot;
243
+ // dynamic boundary layer thermal insulation
244
+ let i_a_dyn = corr_ia * i_a_st;
245
+ let i_cl_dyn = i_tot_dyn - i_a_dyn / fcl;
246
+ // correction for the dynamic permeability index
247
+ let corr_e = (2.6 * corr_tot - 6.5) * corr_tot + 4.9;
248
+ let im_dyn = i_mst * corr_e;
249
+ if (im_dyn > 0.9) {
250
+ im_dyn = 0.9;
251
+ }
252
+ let r_t_dyn = i_tot_dyn / im_dyn / 16.7;
253
+ let t_exp = 28.56 + 0.115 * tdb + 0.641 * p_a; // expired air temperature
254
+ // respiratory convective heat flow [W/m2]
255
+ let c_res = 0.001516 * met * (t_exp - tdb);
256
+ // respiratory evaporative heat flow [W/m2]
257
+ let e_res = 0.00127 * met * (59.34 + 0.53 * tdb - 11.63 * p_a);
258
+ let z = 3.5 + 5.2 * v_r;
259
+ if (v_r > 1) {
260
+ z = 8.7 * Math.pow(v_r, 0.6);
261
+ }
262
+ // Dynamic convective heat transfer coefficient
263
+ let hc_dyn = 2.38 * Math.pow(Math.abs(t_sk - tdb), 0.25);
264
+ if (z > hc_dyn) {
265
+ hc_dyn = z;
266
+ }
267
+ let aux_r = 5.67e-8 * a_r_du;
268
+ let f_cl_r = (1 - a_p) * 0.97 + a_p * f_r;
269
+ let h_r;
270
+ let t_cl;
271
+ let t_cl_new;
272
+ let sw_req;
273
+ let e_v_eff;
274
+ let k;
275
+ let wp = 0;
276
+ let e_p;
277
+ let sw_tot_g = 0;
278
+ for (let time = 1; time <= duration; time++) {
279
+ const t_sk0 = t_sk;
280
+ const t_re0 = t_re;
281
+ const t_cr0 = t_cr;
282
+ const t_cr_eq0 = t_cr_eq;
283
+ const t_sk_t_cr_wg0 = t_sk_t_cr_wg;
284
+ // equilibrium core temperature associated to the metabolic rate
285
+ const t_cr_eq_m = 0.0036 * met + 36.6;
286
+ // Core temperature at this minute, by exponential averaging
287
+ t_cr_eq = t_cr_eq0 * const_t_eq + t_cr_eq_m * (1 - const_t_eq);
288
+ // Heat storage associated with this core temperature increase during the last minute
289
+ const d_stored_eq = sp_heat * (t_cr_eq - t_cr_eq0) * (1 - t_sk_t_cr_wg0);
290
+ // skin temperature prediction -- clothed model
291
+ let t_sk_eq_cl = 12.165 + 0.02017 * tdb + 0.04361 * tr + 0.19354 * p_a - 0.25315 * v;
292
+ t_sk_eq_cl = t_sk_eq_cl + 0.005346 * met + 0.51274 * t_re;
293
+ // nude model
294
+ let t_sk_eq_nu = 7.191 + 0.064 * tdb + 0.061 * tr + 0.198 * p_a - 0.348 * v;
295
+ t_sk_eq_nu = t_sk_eq_nu + 0.616 * t_re;
296
+ let t_sk_eq = t_sk_eq_nu + 2.5 * (t_sk_eq_cl - t_sk_eq_nu) * (clo - 0.2);
297
+ if (clo >= 0.6) {
298
+ t_sk_eq = t_sk_eq_cl;
299
+ }
300
+ else if (clo <= 0.2) {
301
+ t_sk_eq = t_sk_eq_nu;
302
+ }
303
+ // skin temperature [C]
304
+ t_sk = t_sk0 * const_t_sk + t_sk_eq * (1 - const_t_sk);
305
+ // Saturated water vapour pressure at the surface of the skin
306
+ const p_sk = 0.6105 * Math.exp((17.27 * t_sk) / (t_sk + 237.3));
307
+ t_cl = tr + 0.1; // clothing surface temperature
308
+ while (true) {
309
+ // radiative heat transfer coefficient
310
+ h_r =
311
+ (f_cl_r * aux_r * (Math.pow(t_cl + 273, 4) - Math.pow(tr + 273, 4))) /
312
+ (t_cl - tr);
313
+ let t_cl_new = (fcl * (hc_dyn * tdb + h_r * tr) + t_sk / i_cl_dyn) /
314
+ (fcl * (hc_dyn + h_r) + 1 / i_cl_dyn);
315
+ if (Math.abs(t_cl - t_cl_new) <= 0.001) {
316
+ break;
317
+ }
318
+ t_cl = (t_cl + t_cl_new) / 2;
319
+ }
320
+ let convection = fcl * hc_dyn * (t_cl - tdb);
321
+ let radiation = fcl * h_r * (t_cl - tr);
322
+ // maximum evaporative heat flow at the skin surface [W/m2]
323
+ let e_max = (p_sk - p_a) / r_t_dyn;
324
+ // required evaporative heat flow [W/m2]
325
+ let e_req = met - d_stored_eq - wme - c_res - e_res - convection - radiation;
326
+ // required skin wettedness
327
+ let w_req = e_req / e_max;
328
+ if (e_req <= 0) {
329
+ e_req = 0;
330
+ sw_req = 0; // required sweat rate [W/m2]
331
+ }
332
+ else if (e_max <= 0) {
333
+ e_max = 0;
334
+ sw_req = sw_max;
335
+ }
336
+ else if (w_req >= 1.7) {
337
+ sw_req = sw_max;
338
+ }
339
+ else {
340
+ e_v_eff = 1 - Math.pow(w_req, 2) / 2;
341
+ if (w_req > 1) {
342
+ e_v_eff = Math.pow(2 - w_req, 2) / 2;
343
+ }
344
+ sw_req = e_req / e_v_eff;
345
+ if (sw_req > sw_max) {
346
+ sw_req = sw_max;
347
+ }
348
+ }
349
+ sweat_rate = sweat_rate * const_sw + sw_req * (1 - const_sw);
350
+ if (sweat_rate <= 0) {
351
+ e_p = 0; // predicted evaporative heat flow [W/m2]
352
+ sweat_rate = 0;
353
+ }
354
+ else {
355
+ k = e_max / sweat_rate;
356
+ wp = 1;
357
+ if (k >= 0.5) {
358
+ wp = -k + Math.sqrt(k * k + 2);
359
+ }
360
+ if (wp > w_max) {
361
+ wp = w_max;
362
+ }
363
+ e_p = wp * e_max;
364
+ }
365
+ // body heat storage rate [W/m2]
366
+ let d_storage = e_req - e_p + d_stored_eq;
367
+ let t_cr_new = t_cr0;
368
+ while (true) {
369
+ t_sk_t_cr_wg = 0.3 - 0.09 * (t_cr_new - 36.8);
370
+ if (t_sk_t_cr_wg > 0.3) {
371
+ t_sk_t_cr_wg = 0.3;
372
+ }
373
+ if (t_sk_t_cr_wg < 0.1) {
374
+ t_sk_t_cr_wg = 0.1;
375
+ }
376
+ t_cr =
377
+ d_storage / sp_heat +
378
+ (t_sk0 * t_sk_t_cr_wg0) / 2 -
379
+ (t_sk * t_sk_t_cr_wg) / 2;
380
+ t_cr = (t_cr + t_cr0 * (1 - t_sk_t_cr_wg0 / 2)) / (1 - t_sk_t_cr_wg / 2);
381
+ if (Math.abs(t_cr - t_cr_new) <= 0.001) {
382
+ break;
383
+ }
384
+ t_cr_new = (t_cr_new + t_cr) / 2;
385
+ }
386
+ t_re = t_re0 + (2 * t_cr - 1.962 * t_re0 - 1.31) / 9;
387
+ if (d_lim_t_re == 0 && t_re >= 38) {
388
+ d_lim_t_re = time;
389
+ }
390
+ sw_tot = sw_tot + sweat_rate + e_res;
391
+ sw_tot_g = (sw_tot * 2.67 * a_dubois) / 1.8 / 60;
392
+ if (d_lim_loss_50 == 0 && sw_tot_g >= d_max_50) {
393
+ d_lim_loss_50 = time;
394
+ }
395
+ if (d_lim_loss_95 == 0 && sw_tot_g >= d_max_95) {
396
+ d_lim_loss_95 = time;
397
+ }
398
+ if (drink == 0) {
399
+ d_lim_loss_95 = d_lim_loss_95 * 0.6;
400
+ d_lim_loss_50 = d_lim_loss_95;
401
+ }
402
+ }
403
+ if (d_lim_loss_50 == 0) {
404
+ d_lim_loss_50 = duration;
405
+ }
406
+ if (d_lim_loss_95 == 0) {
407
+ d_lim_loss_95 = duration;
408
+ }
409
+ if (d_lim_t_re == 0) {
410
+ d_lim_t_re = duration;
411
+ }
412
+ return {
413
+ t_re: round ? Math.round(t_re * 10) / 10 : t_re,
414
+ t_sk: round ? Math.round(t_sk * 10) / 10 : t_sk,
415
+ t_cr: round ? Math.round(t_cr * 10) / 10 : t_cr,
416
+ t_cr_eq: round ? Math.round(t_cr_eq * 10) / 10 : t_cr_eq,
417
+ t_sk_t_cr_wg: round ? Math.round(t_sk_t_cr_wg * 100) / 100 : t_sk_t_cr_wg,
418
+ sweat_rate: round ? Math.round(sweat_rate * 10) / 10 : sweat_rate,
419
+ sw_tot_g: round ? Math.round(sw_tot_g * 10) / 10 : sw_tot_g,
420
+ d_lim_loss_50: round ? Math.round(d_lim_loss_50 * 10) / 10 : d_lim_loss_50,
421
+ d_lim_loss_95: round ? Math.round(d_lim_loss_95 * 10) / 10 : d_lim_loss_95,
422
+ d_lim_t_re: round ? Math.round(d_lim_t_re * 10) / 10 : d_lim_t_re,
423
+ wp: round ? Math.round(wp * 100) / 100 : wp,
424
+ };
63
425
  }
64
426
  export default {
65
- helloWorld,
66
427
  heatIndex,
67
- goodBye,
428
+ phs,
429
+ p_sat,
68
430
  };
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Calculates vapour pressure of water at different temperatures
3
+ * @param {number} tdb - air temperature, [°C]
4
+ * @returns {number} - operative temperature, [Pa]
5
+ */
6
+ export declare function p_sat(tdb: number): number;
1
7
  interface HeatIndexOptions {
2
8
  round?: boolean;
3
9
  units?: "SI" | "IP";
@@ -17,12 +23,60 @@ interface HeatIndexOptions {
17
23
  * const hi = heatIndex(25, 50); // returns 25.9
18
24
  */
19
25
  export declare function heatIndex(tdb: number, rh: number, options?: HeatIndexOptions): number;
20
- export declare function helloWorld(): string;
21
- export declare function goodBye(): string;
26
+ /**
27
+ * Calculates the Predicted Heat Strain (PHS) index based in compliance with
28
+ * the ISO 7933:2004 Standard [8]_. The ISO 7933 provides a method for the
29
+ * analytical evaluation and interpretation of the thermal stress experienced
30
+ * by a subject in a hot environment. It describes a method for predicting the
31
+ * sweat rate and the internal core temperature that the human body will
32
+ * develop in response to the working conditions.
33
+ * The PHS model can be used to predict the: heat by respiratory convection, heat flow
34
+ * by respiratory evaporation, steady state mean skin temperature, instantaneous value
35
+ * of skin temperature, heat accumulation associated with the metabolic rate, maximum
36
+ * evaporative heat flow at the skin surface, predicted sweat rate, predicted evaporative
37
+ * heat flow, and rectal temperature.
38
+ * @param {number} tdb - dry bulb air temperature, default in [°C]
39
+ * @param {number} tr - mean radiant temperature, default in [°C]
40
+ * @param {number} v - air speed, default in [m/s]
41
+ * @param {number} rh - relative humidity, [%]
42
+ * @param {number} met - metabolic rate, [W/(m2)]
43
+ * @param {number} clo - clothing insulation, [clo]
44
+ * @param {number} posture - a numeric value presenting posture of person [sitting=1, standing=2, crouching=3]
45
+ * @param {number} wme - external work, [W/(m2)] default 0
46
+ * @param {number} i_mst - static moisture permeability index, [dimensionless], default 0.38
47
+ * @param {number} a_p - fraction of the body surface covered by the reflective clothing, [dimensionless], default 0.54
48
+ * @param {number} drink - 1 if workers can drink freely, 0 otherwise, default 1
49
+ * @param {number} weight - body weight, [kg], default 75
50
+ * @param {number} height - height, [m], default 1.8
51
+ * @param {number} walk_sp - walking speed, [m/s], default 0
52
+ * @param {number} theta - angle between walking direction and wind direction [degrees], default 0
53
+ * @param {number} acclimatized - 100 if acclimatised subject, 0 otherwise, default 100
54
+ * @param {number} duration - duration of the work sequence, [minutes], default 480
55
+ * @param {number} f_r - emissivity of the reflective clothing, [dimensionless], default 0.97
56
+ * @param {number} t_sk - mean skin temperature when worker starts working, [°C], default 34.1
57
+ * @param {number} t_cr - mean core temperature when worker starts working, [°C], default 36.8
58
+ * @param {number} t_re - mean rectal temperature when worker starts working, [°C], default false
59
+ * @param {number} t_cr_eq - mean core temperature as a function of met when worker starts working, [°C], default false
60
+ * @param {number} sweat_rate - default 0
61
+ * @returns {[number]} - an array of the following results:
62
+ */
63
+ export declare function phs(tdb: number, tr: number, rh: number, v: number, met: number, clo: number, posture: number, wme?: number, i_mst?: number, a_p?: number, drink?: number, weight?: number, height?: number, walk_sp?: number, theta?: number, acclimatized?: number, duration?: number, f_r?: number, t_sk?: number, t_cr?: number, t_re?: number, t_cr_eq?: number, t_sk_t_cr_wg?: number, sw_tot?: number, round?: boolean): {
64
+ t_re: number;
65
+ t_sk: number;
66
+ t_cr: number;
67
+ t_cr_eq: number;
68
+ t_sk_t_cr_wg: number;
69
+ sweat_rate: number;
70
+ sw_tot_g: number;
71
+ d_lim_loss_50: number;
72
+ d_lim_loss_95: number;
73
+ d_lim_t_re: number;
74
+ wp: number;
75
+ };
22
76
  declare const _default: {
23
- helloWorld: typeof helloWorld;
24
77
  heatIndex: typeof heatIndex;
25
- goodBye: typeof goodBye;
78
+ phs: typeof phs;
79
+ p_sat: typeof p_sat;
26
80
  };
27
81
  export default _default;
28
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAyCzF;AAED,wBAAgB,UAAU,WAGzB;AAED,wBAAgB,OAAO,WAGtB;;;;;;AAED,wBAIE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmCzC;AAED,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAyCR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,GAAG,CACjB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAU,EACf,KAAK,GAAE,MAAa,EACpB,GAAG,GAAE,MAAa,EAClB,KAAK,GAAE,MAAU,EACjB,MAAM,GAAE,MAAW,EACnB,MAAM,GAAE,MAAY,EACpB,OAAO,GAAE,MAAU,EACnB,KAAK,GAAE,MAAU,EACjB,YAAY,GAAE,MAAY,EAC1B,QAAQ,GAAE,MAAY,EACtB,GAAG,GAAE,MAAa,EAClB,IAAI,GAAE,MAAa,EACnB,IAAI,GAAE,MAAa,EACnB,IAAI,GAAE,MAAY,EAClB,OAAO,GAAE,MAAY,EACrB,YAAY,GAAE,MAAY,EAC1B,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,OAAc;;;;;;;;;;;;EA6TtB;;;;;;AAED,wBAIE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsthermalcomfort",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A JavaScript package to calculate thermal comfort indices (e.g., Predicted Mean Vote, Standard Effective Temperature, Predicted Heat Strain).",
5
5
  "exports": {
6
6
  ".": {