@neutrium/thermo.eos.iapws97 2.0.1 → 2.1.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.
package/src/PH.ts CHANGED
@@ -1,9 +1,7 @@
1
- import {State} from '@neutrium/thermo';
1
+ import { State } from '@neutrium/thermo';
2
2
  import * as NS from './base';
3
3
  import * as PT from './PT';
4
4
 
5
- let R = NS.constants['R'];
6
-
7
5
  //
8
6
  // Comments : Calculate the steam properties using IAWPS for a given pressure and temperature
9
7
  //
@@ -12,18 +10,18 @@ let R = NS.constants['R'];
12
10
  //
13
11
  export function solve(P : number, h : number) : State
14
12
  {
15
- let region = findRegion_PH(P,h),
16
- result = null;
17
-
18
- switch (region)
19
- {
20
- case 1 : result = r1(P,h); break;
21
- case 2 : result = r2(P,h); break;
22
- case 3 : result = r3(P,h); break;
23
- default : throw new Error('Insufficent inputs provided');
24
- }
25
-
26
- return result;
13
+ let region = findRegion_PH(P,h),
14
+ result : State | null = null;
15
+
16
+ switch (region)
17
+ {
18
+ case 1 : result = r1(P,h); break;
19
+ case 2 : result = r2(P,h); break;
20
+ case 3 : result = r3(P,h); break;
21
+ default : throw new Error('(P,h) : Inputs insufficient or out of range');
22
+ }
23
+
24
+ return result;
27
25
  }
28
26
 
29
27
  //
@@ -34,75 +32,75 @@ export function solve(P : number, h : number) : State
34
32
  //
35
33
  function findRegion_PH(P : number, h : number) : number
36
34
  {
37
- let r = PT.r1(P, NS.CONST('MIN_T'));
38
-
39
- // Whats the region max/min for h
40
- if (P >= NS.CONST('MIN_P') && P <= NS.CONST('MAX_P') && h >= r.h )
41
- {
42
- if ( P < NS.CONST('B23_MIN_P') )
43
- {
44
- let Ts = PT.r4_P_Tsat(P);
45
-
46
- r = PT.r1(P, Ts);
47
-
48
- if ( h <= r.h )
49
- {
50
- return 1;
51
- }
52
-
53
- // Check region 2
54
- if ( h < 4000)
55
- {
56
- return 2;
57
- }
58
-
59
- r = PT.r2(P, NS.CONST('R2_MAX_T'));
60
-
61
- if (h <= r.h)
62
- {
63
- return 2;
64
- }
65
-
66
- // Region 5
67
- if ( P < NS.CONST('R5_MAX_P'))
68
- {
69
- r = PT.r5(P, NS.CONST('MAX_T'));
70
-
71
- if (h < r.h)
72
- {
73
- return 5;
74
- }
75
- }
76
- }
77
- else // P >= B23_MIN_P
78
- {
79
- // Region 1 check
80
- r = PT.r1(P, NS.CONST('R3_MIN_T'));
81
-
82
- if (h <= r.h)
83
- {
84
- return 1;
85
- }
86
-
87
- // Region 3
88
- r = PT.r2(P, PT.b23_P_T(P));
89
-
90
- if ( h < r.h)
91
- {
92
- return 3;
93
- }
94
-
95
- // Region 2
96
- r = PT.r2(P, NS.CONST('R2_MAX_T'));
97
-
98
- if (h < r.h)
99
- {
100
- return 2;
101
- }
102
- }
103
- }
104
-
105
- return -1;
35
+ let r = PT.r1(P, NS.CONST('MIN_T'));
36
+
37
+ // Whats the region max/min for h
38
+ if (P >= NS.CONST('MIN_P') && P <= NS.CONST('MAX_P') && h >= r.h! )
39
+ {
40
+ if ( P < NS.CONST('B23_MIN_P') )
41
+ {
42
+ let Ts = PT.r4_P_Tsat(P);
43
+
44
+ r = PT.r1(P, Ts);
45
+
46
+ if ( h <= r.h! )
47
+ {
48
+ return 1;
49
+ }
50
+
51
+ // Check region 2
52
+ if ( h < 4000)
53
+ {
54
+ return 2;
55
+ }
56
+
57
+ r = PT.r2(P, NS.CONST('R2_MAX_T'));
58
+
59
+ if (h <= r.h!)
60
+ {
61
+ return 2;
62
+ }
63
+
64
+ // Region 5
65
+ if ( P < NS.CONST('R5_MAX_P'))
66
+ {
67
+ r = PT.r5(P, NS.CONST('MAX_T'));
68
+
69
+ if (h < r.h!)
70
+ {
71
+ return 5;
72
+ }
73
+ }
74
+ }
75
+ else // P >= B23_MIN_P
76
+ {
77
+ // Region 1 check
78
+ r = PT.r1(P, NS.CONST('R3_MIN_T'));
79
+
80
+ if (h <= r.h!)
81
+ {
82
+ return 1;
83
+ }
84
+
85
+ // Region 3
86
+ r = PT.r2(P, PT.b23_P_T(P));
87
+
88
+ if ( h < r.h!)
89
+ {
90
+ return 3;
91
+ }
92
+
93
+ // Region 2
94
+ r = PT.r2(P, NS.CONST('R2_MAX_T'));
95
+
96
+ if (h < r.h!)
97
+ {
98
+ return 2;
99
+ }
100
+ }
101
+ }
102
+
103
+ return -1;
106
104
  }
107
105
 
108
106
  //
@@ -110,28 +108,28 @@ function findRegion_PH(P : number, h : number) : number
110
108
  //
111
109
  function r1(P : number, h : number) : State
112
110
  {
113
- return PT.r1(P, r1_PH_T(P,h));
111
+ return PT.r1(P, r1_PH_T(P,h));
114
112
  }
115
113
 
116
114
  export function r1_PH_T(P : number, h : number) : number
117
115
  {
118
- let R1_PH_I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, 6],
119
- R1_PH_J = [0, 1, 2, 6, 22, 32, 0, 1, 2, 3, 4, 10, 32, 10, 32, 10, 32, 32, 32, 32],
120
- R1_PH_N = [-238.72489924521, 404.21188637945, 113.49746881718, -5.8457616048039, -0.0001528548241314, -1.0866707695377E-6, -13.391744872602, 43.211039183559, -54.010067170506, 30.535892203916, -6.5964749423638, 0.0093965400878363, 1.157364750534E-7, -0.000025858641282073, -4.0644363084799E-9, 6.6456186191635E-8, 8.0670734103027E-11, -9.3477771213947E-13, 5.8265442020601E-15, -1.5020185953503E-17],
121
- pi = P,
122
- m = h/2500,
123
- T = 0;
124
-
125
- for (var i = 0; i < 20; i++)
126
- {
127
- var N = R1_PH_N[i],
128
- I = R1_PH_I[i],
129
- J = R1_PH_J[i];
130
-
131
- T += N*Math.pow(pi, I)*Math.pow((m+1), J);
132
- }
133
-
134
- return T;
116
+ let R1_PH_I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, 6],
117
+ R1_PH_J = [0, 1, 2, 6, 22, 32, 0, 1, 2, 3, 4, 10, 32, 10, 32, 10, 32, 32, 32, 32],
118
+ R1_PH_N = [-238.72489924521, 404.21188637945, 113.49746881718, -5.8457616048039, -0.0001528548241314, -1.0866707695377E-6, -13.391744872602, 43.211039183559, -54.010067170506, 30.535892203916, -6.5964749423638, 0.0093965400878363, 1.157364750534E-7, -0.000025858641282073, -4.0644363084799E-9, 6.6456186191635E-8, 8.0670734103027E-11, -9.3477771213947E-13, 5.8265442020601E-15, -1.5020185953503E-17],
119
+ pi = P,
120
+ m = h/2500,
121
+ T = 0;
122
+
123
+ for (var i = 0; i < 20; i++)
124
+ {
125
+ var N = R1_PH_N[i],
126
+ I = R1_PH_I[i],
127
+ J = R1_PH_J[i];
128
+
129
+ T += N*Math.pow(pi, I)*Math.pow((m+1), J);
130
+ }
131
+
132
+ return T;
135
133
  }
136
134
 
137
135
  //
@@ -139,32 +137,32 @@ export function r1_PH_T(P : number, h : number) : number
139
137
  //
140
138
  export function r2(P : number, h : number) : State
141
139
  {
142
- let T = r2_PH_T(P,h);
140
+ let T = r2_PH_T(P,h);
143
141
 
144
- return PT.r2(P, T);
142
+ return PT.r2(P, T);
145
143
  }
146
144
 
147
145
  function r2_PH_T(P : number, h : number) : number
148
146
  {
149
- let T : number;
150
-
151
- if (P < NS.CONST('R2_CRT_P'))
152
- {
153
- T = r2A_PH_T(P, h);
154
- }
155
- else
156
- {
157
- if (P < b2bc_H_P(h))
158
- {
159
- T = r2B_PH_T(P,h);
160
- }
161
- else
162
- {
163
- T = r2C_PH_T(P,h);
164
- }
165
- }
166
-
167
- return T;
147
+ let T : number;
148
+
149
+ if (P < NS.CONST('R2_CRT_P'))
150
+ {
151
+ T = r2A_PH_T(P, h);
152
+ }
153
+ else
154
+ {
155
+ if (P < b2bc_H_P(h))
156
+ {
157
+ T = r2B_PH_T(P,h);
158
+ }
159
+ else
160
+ {
161
+ T = r2C_PH_T(P,h);
162
+ }
163
+ }
164
+
165
+ return T;
168
166
  }
169
167
 
170
168
  //
@@ -172,82 +170,82 @@ function r2_PH_T(P : number, h : number) : number
172
170
  // From : Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water
173
171
  // and Steam, September 1997
174
172
  // Simple quadratic pressure-entalphy relationship for the region 2b - 2c boundary
175
- // Exported for unit testing
173
+ // @internal - Exported for unit testing only
176
174
  //
177
175
  export function b2bc_H_P(h : number) : number
178
176
  {
179
- return 0.90584278514723E3 - 0.67955786399241*h + 0.12809002730136E-3*h*h;
177
+ return 0.90584278514723E3 - 0.67955786399241*h + 0.12809002730136E-3*h*h;
180
178
  }
181
179
 
182
- // Exported for testing
180
+ // @internal - Exported for unit testing only
183
181
  export function b2bc_P_H(P : number) : number
184
182
  {
185
- return (2652.6571908428 + Math.pow((P-4.5257578905948)/0.00012809002730136,0.5));
183
+ return (2652.6571908428 + Math.pow((P-4.5257578905948)/0.00012809002730136,0.5));
186
184
  }
187
185
 
188
186
  // Equation 22
189
187
  function r2A_PH_T(P : number, h : number) : number
190
188
  {
191
- let R2A_I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7],
192
- R2A_J = [0, 1, 2, 3, 7, 20, 0, 1, 2, 3, 7, 9, 11, 18, 44, 0, 2, 7, 36, 38, 40, 42, 44, 24, 44, 12, 32, 44, 32, 36, 42, 34, 44, 28],
193
- R2A_N = [1089.8952318288, 849.51654495535, -107.81748091826, 33.153654801263, -7.4232016790248, 11.765048724356, 1.844574935579, -4.1792700549624, 6.2478196935812, -17.344563108114, -200.58176862096, 271.96065473796, -455.11318285818, 3091.9688604755, 252266.40357872, -0.0061707422868339, -0.31078046629583, 11.670873077107, 128127984.04046, -985549096.23276, 2822454697.3002, -3594897141.0703, 1722734991.3197, -13551.334240775, 12848734.66465, 1.3865724283226, 235988.32556514, -13105236.545054, 7399.9835474766, -551966.9703006, 3715408.5996233, 19127.7292396, -415351.64835634, -62.459855192507],
194
- pi = P,
195
- m = h/2000,
196
- T = 0;
197
-
198
- for (let i = 0; i < 34; i++)
199
- {
200
- let N = R2A_N[i],
201
- I = R2A_I[i],
202
- J = R2A_J[i];
203
-
204
- T += N*Math.pow(pi,I)*Math.pow(m-2.1, J);
205
- }
206
-
207
- return T;
189
+ let R2A_I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7],
190
+ R2A_J = [0, 1, 2, 3, 7, 20, 0, 1, 2, 3, 7, 9, 11, 18, 44, 0, 2, 7, 36, 38, 40, 42, 44, 24, 44, 12, 32, 44, 32, 36, 42, 34, 44, 28],
191
+ R2A_N = [1089.8952318288, 849.51654495535, -107.81748091826, 33.153654801263, -7.4232016790248, 11.765048724356, 1.844574935579, -4.1792700549624, 6.2478196935812, -17.344563108114, -200.58176862096, 271.96065473796, -455.11318285818, 3091.9688604755, 252266.40357872, -0.0061707422868339, -0.31078046629583, 11.670873077107, 128127984.04046, -985549096.23276, 2822454697.3002, -3594897141.0703, 1722734991.3197, -13551.334240775, 12848734.66465, 1.3865724283226, 235988.32556514, -13105236.545054, 7399.9835474766, -551966.9703006, 3715408.5996233, 19127.7292396, -415351.64835634, -62.459855192507],
192
+ pi = P,
193
+ m = h/2000,
194
+ T = 0;
195
+
196
+ for (let i = 0; i < 34; i++)
197
+ {
198
+ let N = R2A_N[i],
199
+ I = R2A_I[i],
200
+ J = R2A_J[i];
201
+
202
+ T += N*Math.pow(pi,I)*Math.pow(m-2.1, J);
203
+ }
204
+
205
+ return T;
208
206
  }
209
207
 
210
208
  function r2B_PH_T(P : number, h : number) : number
211
209
  {
212
- let R2B_PH_I = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 7, 7, 9, 9],
213
- R2B_PH_J = [0, 1, 2, 12, 18, 24, 28, 40, 0, 2, 6, 12, 18, 24, 28, 40, 2, 8, 18, 40, 1, 2, 12, 24, 2, 12, 18, 24, 28, 40, 18, 24, 40, 28, 2, 28, 1, 40],
214
- R2B_PH_N = [1489.5041079516, 743.07798314034, -97.708318797837, 2.4742464705674, -0.63281320016026, 1.1385952129658, -0.47811863648625, 0.0085208123431544, 0.93747147377932, 3.3593118604916, 3.3809355601454, 0.16844539671904, 0.73875745236695, -0.47128737436186, 0.15020273139707, -0.002176411421975, -0.021810755324761, -0.10829784403677, -0.046333324635812, 0.000071280351959551, 0.00011032831789999, 0.00018955248387902, 0.0030891541160537, 0.0013555504554949, 2.8640237477456E-7, -0.000010779857357512, -0.000076462712454814, 0.000014052392818316, -0.000031083814331434, -1.0302738212103E-6, 2.821728163504E-7, 1.2704902271945E-6, 7.3803353468292E-8, -1.1030139238909E-8, -8.1456365207833E-14, -2.5180545682962E-11, -1.7565233969407E-18, 8.6934156344163E-15],
215
- pi = P,
216
- m = h/2000,
217
- T = 0;
218
-
219
- for (let i = 0; i < 38; i++)
220
- {
221
- var N = R2B_PH_N[i],
222
- I = R2B_PH_I[i],
223
- J = R2B_PH_J[i];
224
-
225
- T += N*Math.pow((pi-2), I)*Math.pow((m-2.6), J);
226
- }
227
-
228
- return T;
210
+ let R2B_PH_I = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 7, 7, 9, 9],
211
+ R2B_PH_J = [0, 1, 2, 12, 18, 24, 28, 40, 0, 2, 6, 12, 18, 24, 28, 40, 2, 8, 18, 40, 1, 2, 12, 24, 2, 12, 18, 24, 28, 40, 18, 24, 40, 28, 2, 28, 1, 40],
212
+ R2B_PH_N = [1489.5041079516, 743.07798314034, -97.708318797837, 2.4742464705674, -0.63281320016026, 1.1385952129658, -0.47811863648625, 0.0085208123431544, 0.93747147377932, 3.3593118604916, 3.3809355601454, 0.16844539671904, 0.73875745236695, -0.47128737436186, 0.15020273139707, -0.002176411421975, -0.021810755324761, -0.10829784403677, -0.046333324635812, 0.000071280351959551, 0.00011032831789999, 0.00018955248387902, 0.0030891541160537, 0.0013555504554949, 2.8640237477456E-7, -0.000010779857357512, -0.000076462712454814, 0.000014052392818316, -0.000031083814331434, -1.0302738212103E-6, 2.821728163504E-7, 1.2704902271945E-6, 7.3803353468292E-8, -1.1030139238909E-8, -8.1456365207833E-14, -2.5180545682962E-11, -1.7565233969407E-18, 8.6934156344163E-15],
213
+ pi = P,
214
+ m = h/2000,
215
+ T = 0;
216
+
217
+ for (let i = 0; i < 38; i++)
218
+ {
219
+ var N = R2B_PH_N[i],
220
+ I = R2B_PH_I[i],
221
+ J = R2B_PH_J[i];
222
+
223
+ T += N*Math.pow((pi-2), I)*Math.pow((m-2.6), J);
224
+ }
225
+
226
+ return T;
229
227
  }
230
228
 
231
229
  // Equation 24
232
230
  function r2C_PH_T(P : number, h : number) : number
233
231
  {
234
- let R2C_PH_I = [-7, -7, -6, -6, -5, -5, -2, -2, -1, -1, 0, 0, 1, 1, 2, 6, 6, 6, 6, 6, 6, 6, 6],
235
- R2C_PH_J = [0, 4, 0, 2, 0, 2, 0, 1, 0, 2, 0, 1, 4, 8, 4, 0, 1, 4, 10, 12, 16, 20, 22],
236
- R2C_PH_N = [-3236839855524.2, 7326335090218.1, 358250899454.47, -583401318515.9, -10783068217.47, 20825544563.171, 610747.83564516, 859777.2253558, -25745.72360417, 31081.088422714, 1208.2315865936, 482.19755109255, 3.7966001272486, -10.842984880077, -0.04536417267666, 1.4559115658698E-13, 1.126159740723E-12, -1.7804982240686E-11, 1.2324579690832E-7, -1.1606921130984E-6, 0.000027846367088554, -0.00059270038474176, 0.0012918582991878],
237
- pi = P,
238
- m = h/2000,
239
- T = 0;
240
-
241
- for (let i = 0; i < 23; i++)
242
- {
243
- let N = R2C_PH_N[i],
244
- I = R2C_PH_I[i],
245
- J = R2C_PH_J[i];
246
-
247
- T += N*Math.pow(pi+25, I)*Math.pow(m-1.8, J);
248
- }
249
-
250
- return T;
232
+ let R2C_PH_I = [-7, -7, -6, -6, -5, -5, -2, -2, -1, -1, 0, 0, 1, 1, 2, 6, 6, 6, 6, 6, 6, 6, 6],
233
+ R2C_PH_J = [0, 4, 0, 2, 0, 2, 0, 1, 0, 2, 0, 1, 4, 8, 4, 0, 1, 4, 10, 12, 16, 20, 22],
234
+ R2C_PH_N = [-3236839855524.2, 7326335090218.1, 358250899454.47, -583401318515.9, -10783068217.47, 20825544563.171, 610747.83564516, 859777.2253558, -25745.72360417, 31081.088422714, 1208.2315865936, 482.19755109255, 3.7966001272486, -10.842984880077, -0.04536417267666, 1.4559115658698E-13, 1.126159740723E-12, -1.7804982240686E-11, 1.2324579690832E-7, -1.1606921130984E-6, 0.000027846367088554, -0.00059270038474176, 0.0012918582991878],
235
+ pi = P,
236
+ m = h/2000,
237
+ T = 0;
238
+
239
+ for (let i = 0; i < 23; i++)
240
+ {
241
+ let N = R2C_PH_N[i],
242
+ I = R2C_PH_I[i],
243
+ J = R2C_PH_J[i];
244
+
245
+ T += N*Math.pow(pi+25, I)*Math.pow(m-1.8, J);
246
+ }
247
+
248
+ return T;
251
249
  }
252
250
 
253
251
  //
@@ -255,21 +253,21 @@ function r2C_PH_T(P : number, h : number) : number
255
253
  //
256
254
  function r3(P : number, h : number) : State
257
255
  {
258
- let T : number,
259
- rho : number;
260
-
261
- if (h < b3ab_P_H(P))
262
- {
263
- T = r3A_PH_T(P,h);
264
- rho = r3A_PH_V(P,h);
265
- }
266
- else
267
- {
268
- T = r3B_PH_T(P,h);
269
- rho = r3B_PH_V(P,h);
270
- }
271
-
272
- return PT.r3(P, T, rho);
256
+ let T : number,
257
+ rho : number;
258
+
259
+ if (h < b3ab_P_H(P))
260
+ {
261
+ T = r3A_PH_T(P,h);
262
+ rho = r3A_PH_V(P,h);
263
+ }
264
+ else
265
+ {
266
+ T = r3B_PH_T(P,h);
267
+ rho = r3B_PH_V(P,h);
268
+ }
269
+
270
+ return PT.r3(P, T, rho);
273
271
  }
274
272
 
275
273
  //
@@ -278,119 +276,119 @@ function r3(P : number, h : number) : State
278
276
  // T(p,h), v(p,h) and T(p,s), v(p,s) for Region 3 of the IAPWS Industrial
279
277
  // Formulation 1997 for the Thermodynamic Properties of Water and Steam
280
278
  // Polynomial to match the critical isentropic line (but does not match exactly)
281
- // Exported for unit testing
279
+ // @internal - Exported for unit testing only
282
280
  //
283
281
  export function b3ab_P_H(P : number) : number
284
282
  {
285
- return 2014.64004206875 + 3.74696550136983*P + -0.0219921901054187*P*P + 0.000087513168600995*P*P*P;
283
+ return 2014.64004206875 + 3.74696550136983*P + -0.0219921901054187*P*P + 0.000087513168600995*P*P*P;
286
284
  }
287
285
 
288
286
  function r3A_PH_T(P : number, h : number) : number
289
287
  {
290
- let R3A_PH_I = [-12, -12, -12, -12, -12, -12, -12, -12, -10, -10, -10, -8, -8, -8, -8, -5, -3, -2, -2, -2, -1, -1, 0, 0, 1, 3, 3, 4, 4, 10, 12],
291
- R3A_PH_J = [0, 1, 2, 6, 14, 16, 20, 22, 1, 5, 12, 0, 2, 4, 10, 2, 0, 1, 3, 4, 0, 2, 0, 1, 1, 0, 1, 0, 3, 4, 5],
292
- R3A_PH_N = [-1.33645667811215E-7, 4.55912656802978E-6, -1.46294640700979E-5, 0.0063934131297008, 372.783927268847, -7186.54377460447, 573494.7521034, -2675693.29111439, -3.34066283302614E-5, -0.0245479214069597, 47.8087847764996, 7.64664131818904E-6, 0.00128350627676972, 0.0171219081377331, -8.51007304583213, -0.0136513461629781, -3.84460997596657E-6, 0.00337423807911655, -0.551624873066791, 0.72920227710747, -0.00992522757376041, -0.119308831407288, 0.793929190615421, 0.454270731799386, 0.20999859125991, -0.00642109823904738, -0.023515586860454, 0.00252233108341612, -0.00764885133368119, 0.0136176427574291, -0.0133027883575669],
293
- pi = P/100,
294
- m = h/2300,
295
- T = 0;
296
-
297
- for (let i = 0; i < 31; i++)
298
- {
299
- let N = R3A_PH_N[i],
300
- I = R3A_PH_I[i],
301
- J = R3A_PH_J[i];
302
-
303
- T += N*Math.pow((pi+0.240),I)*Math.pow((m-0.615),J);
304
- }
305
-
306
- return 760*T;
288
+ let R3A_PH_I = [-12, -12, -12, -12, -12, -12, -12, -12, -10, -10, -10, -8, -8, -8, -8, -5, -3, -2, -2, -2, -1, -1, 0, 0, 1, 3, 3, 4, 4, 10, 12],
289
+ R3A_PH_J = [0, 1, 2, 6, 14, 16, 20, 22, 1, 5, 12, 0, 2, 4, 10, 2, 0, 1, 3, 4, 0, 2, 0, 1, 1, 0, 1, 0, 3, 4, 5],
290
+ R3A_PH_N = [-1.33645667811215E-7, 4.55912656802978E-6, -1.46294640700979E-5, 0.0063934131297008, 372.783927268847, -7186.54377460447, 573494.7521034, -2675693.29111439, -3.34066283302614E-5, -0.0245479214069597, 47.8087847764996, 7.64664131818904E-6, 0.00128350627676972, 0.0171219081377331, -8.51007304583213, -0.0136513461629781, -3.84460997596657E-6, 0.00337423807911655, -0.551624873066791, 0.72920227710747, -0.00992522757376041, -0.119308831407288, 0.793929190615421, 0.454270731799386, 0.20999859125991, -0.00642109823904738, -0.023515586860454, 0.00252233108341612, -0.00764885133368119, 0.0136176427574291, -0.0133027883575669],
291
+ pi = P/100,
292
+ m = h/2300,
293
+ T = 0;
294
+
295
+ for (let i = 0; i < 31; i++)
296
+ {
297
+ let N = R3A_PH_N[i],
298
+ I = R3A_PH_I[i],
299
+ J = R3A_PH_J[i];
300
+
301
+ T += N*Math.pow((pi+0.240),I)*Math.pow((m-0.615),J);
302
+ }
303
+
304
+ return 760*T;
307
305
  }
308
306
 
309
- // Exported for testing
307
+ // @internal - Exported for unit testing only
310
308
  export function r3A_PH_V(P : number, h : number) : number
311
309
  {
312
- let R3A_PH_v_I = [-12, -12, -12, -12, -10, -10, -10, -8, -8, -6, -6, -6, -4, -4, -3, -2, -2, -1, -1, -1, -1, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 8],
313
- R3A_PH_v_J = [6, 8, 12, 18, 4, 7, 10, 5, 12, 3, 4, 22, 2, 3, 7, 3, 16, 0, 1, 2, 3, 0, 1, 0, 1, 2, 0, 2, 0, 2, 2, 2],
314
- R3A_PH_v_N = [0.00529944062966028, -0.170099690234461, 11.1323814312927, -2178.98123145125, -0.000506061827980875, 0.556495239685324, -9.43672726094016, -0.297856807561527, 93.9353943717186, 0.0192944939465981, 0.421740664704763, -3689141.2628233, -0.00737566847600639, -0.354753242424366, -1.99768169338727, 1.15456297059049, 5683.6687581596, 0.00808169540124668, 0.172416341519307, 1.04270175292927, -0.297691372792847, 0.560394465163593, 0.275234661176914, -0.148347894866012, -0.0651142513478515, -2.92468715386302, 0.0664876096952665, 3.52335014263844, -0.0146340792313332, -2.24503486668184, 1.10533464706142, -0.0408757344495612],
315
- pi = P/100,
316
- m = h/2100,
317
- v = 0;
318
-
319
- for (let i = 0; i < 32; i++)
320
- {
321
- let N = R3A_PH_v_N[i],
322
- I = R3A_PH_v_I[i],
323
- J = R3A_PH_v_J[i];
324
-
325
- v += N*Math.pow((pi+0.128), I)*Math.pow((m-0.727), J);
326
- }
327
-
328
- return 0.0028*v;
310
+ let R3A_PH_v_I = [-12, -12, -12, -12, -10, -10, -10, -8, -8, -6, -6, -6, -4, -4, -3, -2, -2, -1, -1, -1, -1, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 8],
311
+ R3A_PH_v_J = [6, 8, 12, 18, 4, 7, 10, 5, 12, 3, 4, 22, 2, 3, 7, 3, 16, 0, 1, 2, 3, 0, 1, 0, 1, 2, 0, 2, 0, 2, 2, 2],
312
+ R3A_PH_v_N = [0.00529944062966028, -0.170099690234461, 11.1323814312927, -2178.98123145125, -0.000506061827980875, 0.556495239685324, -9.43672726094016, -0.297856807561527, 93.9353943717186, 0.0192944939465981, 0.421740664704763, -3689141.2628233, -0.00737566847600639, -0.354753242424366, -1.99768169338727, 1.15456297059049, 5683.6687581596, 0.00808169540124668, 0.172416341519307, 1.04270175292927, -0.297691372792847, 0.560394465163593, 0.275234661176914, -0.148347894866012, -0.0651142513478515, -2.92468715386302, 0.0664876096952665, 3.52335014263844, -0.0146340792313332, -2.24503486668184, 1.10533464706142, -0.0408757344495612],
313
+ pi = P/100,
314
+ m = h/2100,
315
+ v = 0;
316
+
317
+ for (let i = 0; i < 32; i++)
318
+ {
319
+ let N = R3A_PH_v_N[i],
320
+ I = R3A_PH_v_I[i],
321
+ J = R3A_PH_v_J[i];
322
+
323
+ v += N*Math.pow((pi+0.128), I)*Math.pow((m-0.727), J);
324
+ }
325
+
326
+ return 0.0028*v;
329
327
  }
330
328
 
331
329
  function r3B_PH_T(P : number, h : number) : number
332
330
  {
333
- let R3B_PH_I = [-12, -12, -10, -10, -10, -10, -10, -8, -8, -8, -8, -8, -6, -6, -6, -4, -4, -3, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 1, 3, 5, 6, 8],
334
- R3B_PH_J = [0, 1, 0, 1, 5, 10, 12, 0, 1, 2, 4, 10, 0, 1, 2, 0, 1, 5, 0, 4, 2, 4, 6, 10, 14, 16, 0, 2, 1, 1, 1, 1, 1, ],
335
- R3B_PH_N = [0.000032325457364492, -0.000127575556587181, -0.000475851877356068, 0.00156183014181602, 0.105724860113781, -85.8514221132534, 724.140095480911, 0.00296475810273257, -0.00592721983365988, -0.0126305422818666, -0.115716196364853, 84.9000969739595, -0.0108602260086615, 0.0154304475328851, 0.0750455441524466, 0.0252520973612982, -0.0602507901232996, -3.07622221350501, -0.0574011959864879, 5.03471360939849, -0.925081888584834, 3.91733882917546, -77.314600713019, 9493.08762098587, -1410437.19679409, 8491662.30819026, 0.861095729446704, 0.32334644281172, 0.873281936020439, -0.436653048526683, 0.286596714529479, -0.131778331276228, 0.00676682064330275],
336
- pi = P/100,
337
- m = h/2800,
338
- T = 0;
339
-
340
- for (let i = 0; i < 33; i++)
341
- {
342
- let N = R3B_PH_N[i],
343
- I = R3B_PH_I[i],
344
- J = R3B_PH_J[i];
345
-
346
- T += N*Math.pow((pi+0.298),I)*Math.pow((m-0.720),J);
347
- }
348
-
349
- return 860*T;
331
+ let R3B_PH_I = [-12, -12, -10, -10, -10, -10, -10, -8, -8, -8, -8, -8, -6, -6, -6, -4, -4, -3, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 1, 3, 5, 6, 8],
332
+ R3B_PH_J = [0, 1, 0, 1, 5, 10, 12, 0, 1, 2, 4, 10, 0, 1, 2, 0, 1, 5, 0, 4, 2, 4, 6, 10, 14, 16, 0, 2, 1, 1, 1, 1, 1, ],
333
+ R3B_PH_N = [0.000032325457364492, -0.000127575556587181, -0.000475851877356068, 0.00156183014181602, 0.105724860113781, -85.8514221132534, 724.140095480911, 0.00296475810273257, -0.00592721983365988, -0.0126305422818666, -0.115716196364853, 84.9000969739595, -0.0108602260086615, 0.0154304475328851, 0.0750455441524466, 0.0252520973612982, -0.0602507901232996, -3.07622221350501, -0.0574011959864879, 5.03471360939849, -0.925081888584834, 3.91733882917546, -77.314600713019, 9493.08762098587, -1410437.19679409, 8491662.30819026, 0.861095729446704, 0.32334644281172, 0.873281936020439, -0.436653048526683, 0.286596714529479, -0.131778331276228, 0.00676682064330275],
334
+ pi = P/100,
335
+ m = h/2800,
336
+ T = 0;
337
+
338
+ for (let i = 0; i < 33; i++)
339
+ {
340
+ let N = R3B_PH_N[i],
341
+ I = R3B_PH_I[i],
342
+ J = R3B_PH_J[i];
343
+
344
+ T += N*Math.pow((pi+0.298),I)*Math.pow((m-0.720),J);
345
+ }
346
+
347
+ return 860*T;
350
348
  }
351
349
 
352
- // Exported for unit testing
350
+ // @internal - Exported for unit testing only
353
351
  export function r3B_PH_V(P : number, h : number) : number
354
352
  {
355
- let R3B_PH_v_I = [-12, -12, -8, -8, -8, -8, -8, -8, -6, -6, -6, -6, -6, -6, -4, -4, -4, -3, -3, -2, -2, -1, -1, -1, -1, 0, 1, 1, 2, 2],
356
- R3B_PH_v_J = [0, 1, 0, 1, 3, 6, 7, 8, 0, 1, 2, 5, 6, 10, 3, 6, 10, 0, 2, 1, 2, 0, 1, 4, 5, 0, 0, 1, 2, 6],
357
- R3B_PH_v_N = [-2.25196934336318E-09, 1.40674363313486E-08, 2.3378408528056E-06, -3.31833715229001E-05, 0.00107956778514318, -0.271382067378863, 1.07202262490333, -0.853821329075382, -2.15214194340526E-05, 0.00076965608822273, -0.00431136580433864, 0.453342167309331, -0.507749535873652, -100.475154528389, -0.219201924648793, -3.21087965668917, 607.567815637771, 0.000557686450685932, 0.18749904002955, 0.00905368030448107, 0.285417173048685, 0.0329924030996098, 0.239897419685483, 4.82754995951394, -11.8035753702231, 0.169490044091791, -0.0179967222507787, 0.0371810116332674, -0.0536288335065096, 1.6069710109252],
358
- pi = P/100,
359
- m = h/2800,
360
- v = 0;
361
-
362
- for (let i = 0; i < 30; i++)
363
- {
364
- let N = R3B_PH_v_N[i],
365
- I = R3B_PH_v_I[i],
366
- J = R3B_PH_v_J[i];
367
-
368
- v += N*Math.pow(pi + 0.0661, I)*Math.pow(m - 0.720, J);
369
- }
370
-
371
- return 0.0088*v;
353
+ let R3B_PH_v_I = [-12, -12, -8, -8, -8, -8, -8, -8, -6, -6, -6, -6, -6, -6, -4, -4, -4, -3, -3, -2, -2, -1, -1, -1, -1, 0, 1, 1, 2, 2],
354
+ R3B_PH_v_J = [0, 1, 0, 1, 3, 6, 7, 8, 0, 1, 2, 5, 6, 10, 3, 6, 10, 0, 2, 1, 2, 0, 1, 4, 5, 0, 0, 1, 2, 6],
355
+ R3B_PH_v_N = [-2.25196934336318E-09, 1.40674363313486E-08, 2.3378408528056E-06, -3.31833715229001E-05, 0.00107956778514318, -0.271382067378863, 1.07202262490333, -0.853821329075382, -2.15214194340526E-05, 0.00076965608822273, -0.00431136580433864, 0.453342167309331, -0.507749535873652, -100.475154528389, -0.219201924648793, -3.21087965668917, 607.567815637771, 0.000557686450685932, 0.18749904002955, 0.00905368030448107, 0.285417173048685, 0.0329924030996098, 0.239897419685483, 4.82754995951394, -11.8035753702231, 0.169490044091791, -0.0179967222507787, 0.0371810116332674, -0.0536288335065096, 1.6069710109252],
356
+ pi = P/100,
357
+ m = h/2800,
358
+ v = 0;
359
+
360
+ for (let i = 0; i < 30; i++)
361
+ {
362
+ let N = R3B_PH_v_N[i],
363
+ I = R3B_PH_v_I[i],
364
+ J = R3B_PH_v_J[i];
365
+
366
+ v += N*Math.pow(pi + 0.0661, I)*Math.pow(m - 0.720, J);
367
+ }
368
+
369
+ return 0.0088*v;
372
370
  }
373
371
 
374
372
  //
375
373
  // Region 4
376
374
  //
377
- // Exported for unit testing
375
+ // @internal - Exported for unit testing only
378
376
  export function r4_H_Psat(h : number) : number
379
377
  {
380
- let R4_I = [0, 1, 1, 1, 1, 5, 7, 8, 14, 20, 22, 24 ,28, 36],
381
- R4_J = [0, 1, 3, 4, 36, 3, 0, 24, 16, 16, 3, 18, 8, 24],
382
- R4_N = [0.600073641753024, -9.36203654849857, 2.46590798594147E1, -1.07014222858224E2, -9.15821315805768E13, -8.62332011700662E3, -2.35837344740032E1, 2.52304969384128E17, -3.89718771997719E18, -3.33775713645296E22, 3.56499469636328E10, -1.48547544720641E26, 3.30611514838798E18, 8.13641294467829E37],
383
- mu = h/2600,
384
- p = 0;
385
-
386
- for (let i = 0; i < 14; i++)
387
- {
388
- let N = R4_N[i],
389
- I = R4_I[i],
390
- J = R4_J[i];
391
-
392
- p += N*Math.pow(mu - 1.02, I)*Math.pow(mu - 0.608, J);
393
- }
394
-
395
- return 22*p;
378
+ let R4_I = [0, 1, 1, 1, 1, 5, 7, 8, 14, 20, 22, 24 ,28, 36],
379
+ R4_J = [0, 1, 3, 4, 36, 3, 0, 24, 16, 16, 3, 18, 8, 24],
380
+ R4_N = [0.600073641753024, -9.36203654849857, 2.46590798594147E1, -1.07014222858224E2, -9.15821315805768E13, -8.62332011700662E3, -2.35837344740032E1, 2.52304969384128E17, -3.89718771997719E18, -3.33775713645296E22, 3.56499469636328E10, -1.48547544720641E26, 3.30611514838798E18, 8.13641294467829E37],
381
+ mu = h/2600,
382
+ p = 0;
383
+
384
+ for (let i = 0; i < 14; i++)
385
+ {
386
+ let N = R4_N[i],
387
+ I = R4_I[i],
388
+ J = R4_J[i];
389
+
390
+ p += N*Math.pow(mu - 1.02, I)*Math.pow(mu - 0.608, J);
391
+ }
392
+
393
+ return 22*p;
396
394
  }