@dnv-plant/typescriptpws 1.0.95 → 1.0.96-alpha.2289077
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/index.ts +2 -2
- package/package.json +1 -1
- package/src/calculations/applicationTools.ts +36 -47
- package/src/calculations/calculationBase.ts +27 -61
- package/src/calculations/discharge.ts +274 -364
- package/src/calculations/dispersion.ts +80 -88
- package/src/calculations/dispersionView.ts +360 -439
- package/src/calculations/fireball.ts +64 -70
- package/src/calculations/jetFire.ts +104 -118
- package/src/calculations/lateExplosion.ts +150 -154
- package/src/calculations/linkedRunners.ts +1025 -1095
- package/src/calculations/poolFire.ts +64 -70
- package/src/calculations/properties.ts +37 -50
- package/src/calculations/radiation.ts +467 -575
- package/src/calculations/standalones.ts +55 -66
- package/src/calculations/toxics.ts +65 -77
- package/src/calculations/utilities.ts +322 -479
- package/src/constants.ts +14 -14
- package/src/entities.ts +752 -1000
- package/src/entity-schemas.ts +1279 -1286
- package/src/enums.ts +11 -11
- package/src/materials.ts +86 -256
- package/src/utilities.ts +41 -50
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
|
-
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
*
|
|
4
|
-
* DO NOT MODIFY THIS FILE
|
|
5
|
-
* This file is maintained by DNV.
|
|
6
|
-
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
|
-
* Please contact DNV if you believe changes are required.
|
|
8
|
-
*
|
|
9
|
-
* Version: 1.0.
|
|
10
|
-
* Date/time:
|
|
11
|
-
* Template: templates/typescriptpws/calculations.razor.
|
|
12
|
-
***********************************************************************/
|
|
13
|
-
|
|
14
|
-
import * as Enums from
|
|
15
|
-
import * as Entities from
|
|
16
|
-
import * as EntitySchemas from
|
|
17
|
-
import { getAnalyticsApiTarget, getClientAliasId } from
|
|
18
|
-
import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from
|
|
19
|
-
|
|
20
|
-
import Joi from
|
|
2
|
+
* This file has been auto-generated by a code generation tool.
|
|
3
|
+
*
|
|
4
|
+
* DO NOT MODIFY THIS FILE
|
|
5
|
+
* This file is maintained by DNV.
|
|
6
|
+
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
|
+
* Please contact DNV if you believe changes are required.
|
|
8
|
+
*
|
|
9
|
+
* Version: 1.0.96
|
|
10
|
+
* Date/time: 4 Apr 2026 08:17:52
|
|
11
|
+
* Template: templates/typescriptpws/calculations.razor.
|
|
12
|
+
***********************************************************************/
|
|
13
|
+
|
|
14
|
+
import * as Enums from '../enums';
|
|
15
|
+
import * as Entities from '../entities';
|
|
16
|
+
import * as EntitySchemas from '../entity-schemas';
|
|
17
|
+
import { getAnalyticsApiTarget, getClientAliasId } from '../utilities';
|
|
18
|
+
import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from './calculationBase';
|
|
19
|
+
|
|
20
|
+
import Joi from 'joi';
|
|
21
21
|
|
|
22
22
|
export interface PoolFireCalculationRequestSchemaData {
|
|
23
23
|
material: Entities.Material;
|
|
@@ -41,12 +41,12 @@ class PoolFireCalculationRequest extends CalculationRequestBase {
|
|
|
41
41
|
*
|
|
42
42
|
*/
|
|
43
43
|
constructor(data: {
|
|
44
|
-
material: Entities.Material
|
|
45
|
-
poolRecords: Entities.PoolRecord[]
|
|
46
|
-
poolRecordCount: number
|
|
47
|
-
weather: Entities.Weather
|
|
48
|
-
substrate: Entities.Substrate
|
|
49
|
-
flammableParameters: Entities.FlammableParameters
|
|
44
|
+
material: Entities.Material;
|
|
45
|
+
poolRecords: Entities.PoolRecord[];
|
|
46
|
+
poolRecordCount: number;
|
|
47
|
+
weather: Entities.Weather;
|
|
48
|
+
substrate: Entities.Substrate;
|
|
49
|
+
flammableParameters: Entities.FlammableParameters;
|
|
50
50
|
}) {
|
|
51
51
|
super();
|
|
52
52
|
this.material = data.material;
|
|
@@ -76,19 +76,19 @@ export class PoolFireCalculationRequestSchema {
|
|
|
76
76
|
}).unknown(true);
|
|
77
77
|
|
|
78
78
|
this.propertyTypes = {
|
|
79
|
-
material:
|
|
80
|
-
poolRecords:
|
|
81
|
-
poolRecordCount:
|
|
82
|
-
weather:
|
|
83
|
-
substrate:
|
|
84
|
-
flammableParameters:
|
|
79
|
+
material: 'Entities.Material',
|
|
80
|
+
poolRecords: 'Entities.PoolRecord[]',
|
|
81
|
+
poolRecordCount: 'number',
|
|
82
|
+
weather: 'Entities.Weather',
|
|
83
|
+
substrate: 'Entities.Substrate',
|
|
84
|
+
flammableParameters: 'Entities.FlammableParameters',
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
validate(data: PoolFireCalculationRequestSchemaData): PoolFireCalculationRequest {
|
|
89
89
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
90
90
|
if (error) {
|
|
91
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
91
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
92
92
|
}
|
|
93
93
|
return this.makeCalculationRequest(value);
|
|
94
94
|
}
|
|
@@ -113,12 +113,12 @@ export class PoolFireCalculation extends CalculationBase {
|
|
|
113
113
|
*
|
|
114
114
|
*/
|
|
115
115
|
constructor(data: {
|
|
116
|
-
material: Entities.Material
|
|
117
|
-
poolRecords: Entities.PoolRecord[]
|
|
118
|
-
poolRecordCount: number
|
|
119
|
-
weather: Entities.Weather
|
|
120
|
-
substrate: Entities.Substrate
|
|
121
|
-
flammableParameters: Entities.FlammableParameters
|
|
116
|
+
material: Entities.Material;
|
|
117
|
+
poolRecords: Entities.PoolRecord[];
|
|
118
|
+
poolRecordCount: number;
|
|
119
|
+
weather: Entities.Weather;
|
|
120
|
+
substrate: Entities.Substrate;
|
|
121
|
+
flammableParameters: Entities.FlammableParameters;
|
|
122
122
|
controller?: AbortController;
|
|
123
123
|
}) {
|
|
124
124
|
super(data.controller);
|
|
@@ -138,7 +138,7 @@ export class PoolFireCalculation extends CalculationBase {
|
|
|
138
138
|
poolRecordCount: this.poolRecordCount,
|
|
139
139
|
weather: this.weather,
|
|
140
140
|
substrate: this.substrate,
|
|
141
|
-
flammableParameters: this.flammableParameters
|
|
141
|
+
flammableParameters: this.flammableParameters,
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
const schema = new PoolFireCalculationRequestSchema();
|
|
@@ -180,22 +180,18 @@ export class PoolFireCalculation extends CalculationBase {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
toString() {
|
|
183
|
-
const parts = [
|
|
183
|
+
const parts = ['* PoolFire'];
|
|
184
184
|
|
|
185
185
|
parts.push(`poolFireFlameResult: ${String(this.poolFireFlameResult)}`);
|
|
186
|
-
parts.push(
|
|
187
|
-
parts.push(
|
|
188
|
-
this.flameRecords && this.flameRecords.length > 0
|
|
189
|
-
? this.flameRecords.map((point) => `flameRecordsElement: ${point}`).join("\n")
|
|
190
|
-
: "flameRecords does not contain any elements"
|
|
191
|
-
);
|
|
186
|
+
parts.push('*** flameRecords:');
|
|
187
|
+
parts.push(this.flameRecords && this.flameRecords.length > 0 ? this.flameRecords.map((point) => `flameRecordsElement: ${point}`).join('\n') : 'flameRecords does not contain any elements');
|
|
192
188
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
193
|
-
parts.push(
|
|
194
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
195
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
196
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
189
|
+
parts.push('*** messages:');
|
|
190
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
191
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
192
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
197
193
|
|
|
198
|
-
return parts.join(
|
|
194
|
+
return parts.join('\n');
|
|
199
195
|
}
|
|
200
196
|
}
|
|
201
197
|
|
|
@@ -208,12 +204,12 @@ export class PoolFireCalculationResponse extends CalculationResponseBase {
|
|
|
208
204
|
*
|
|
209
205
|
*/
|
|
210
206
|
constructor(data: {
|
|
211
|
-
poolFireFlameResult: Entities.PoolFireFlameResult
|
|
212
|
-
flameRecords: Entities.FlameRecord[]
|
|
213
|
-
resultCode: Enums.ResultCode
|
|
214
|
-
messages: string[]
|
|
215
|
-
calculationElapsedTime: number
|
|
216
|
-
operationId: string
|
|
207
|
+
poolFireFlameResult: Entities.PoolFireFlameResult;
|
|
208
|
+
flameRecords: Entities.FlameRecord[];
|
|
209
|
+
resultCode: Enums.ResultCode;
|
|
210
|
+
messages: string[];
|
|
211
|
+
calculationElapsedTime: number;
|
|
212
|
+
operationId: string;
|
|
217
213
|
}) {
|
|
218
214
|
super();
|
|
219
215
|
this.poolFireFlameResult = data.poolFireFlameResult;
|
|
@@ -230,25 +226,23 @@ export class PoolFireCalculationResponse extends CalculationResponseBase {
|
|
|
230
226
|
this.poolFireFlameResult.initialiseFromDictionary(data.poolFireFlameResult as { [key: string]: unknown });
|
|
231
227
|
}
|
|
232
228
|
if (data.flameRecords && Array.isArray(data.flameRecords)) {
|
|
233
|
-
this.flameRecords = data.flameRecords.map(
|
|
234
|
-
(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
);
|
|
229
|
+
this.flameRecords = data.flameRecords.map((item) => {
|
|
230
|
+
const record = new Entities.FlameRecord();
|
|
231
|
+
record.initialiseFromDictionary(item);
|
|
232
|
+
return record;
|
|
233
|
+
});
|
|
240
234
|
}
|
|
241
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
235
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
242
236
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
243
237
|
}
|
|
244
238
|
this.messages = this.messages ?? [];
|
|
245
239
|
if (data.messages && Array.isArray(data.messages)) {
|
|
246
240
|
this.messages.push(...data.messages);
|
|
247
241
|
}
|
|
248
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
242
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
249
243
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
250
244
|
}
|
|
251
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
245
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
252
246
|
this.operationId = data.operationId as string;
|
|
253
247
|
}
|
|
254
248
|
}
|
|
@@ -281,15 +275,15 @@ export class PoolFireCalculationResponseSchema {
|
|
|
281
275
|
}).unknown(true);
|
|
282
276
|
|
|
283
277
|
this.propertyTypes = {
|
|
284
|
-
poolFireFlameResult:
|
|
285
|
-
flameRecords:
|
|
278
|
+
poolFireFlameResult: 'Entities.PoolFireFlameResult',
|
|
279
|
+
flameRecords: 'Entities.FlameRecord[]',
|
|
286
280
|
};
|
|
287
281
|
}
|
|
288
282
|
|
|
289
283
|
validate(data: PoolFireCalculationResponseSchemaData): PoolFireCalculationResponse {
|
|
290
284
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
291
285
|
if (error) {
|
|
292
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
286
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
293
287
|
}
|
|
294
288
|
return this.makeCalculationResponse(value);
|
|
295
289
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
|
-
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
*
|
|
4
|
-
* DO NOT MODIFY THIS FILE
|
|
5
|
-
* This file is maintained by DNV.
|
|
6
|
-
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
|
-
* Please contact DNV if you believe changes are required.
|
|
8
|
-
*
|
|
9
|
-
* Version: 1.0.
|
|
10
|
-
* Date/time:
|
|
11
|
-
* Template: templates/typescriptpws/calculations.razor.
|
|
12
|
-
***********************************************************************/
|
|
13
|
-
|
|
14
|
-
import * as Enums from
|
|
15
|
-
import * as Entities from
|
|
16
|
-
import * as EntitySchemas from
|
|
17
|
-
import { getAnalyticsApiTarget, getClientAliasId } from
|
|
18
|
-
import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from
|
|
19
|
-
|
|
20
|
-
import Joi from
|
|
2
|
+
* This file has been auto-generated by a code generation tool.
|
|
3
|
+
*
|
|
4
|
+
* DO NOT MODIFY THIS FILE
|
|
5
|
+
* This file is maintained by DNV.
|
|
6
|
+
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
|
+
* Please contact DNV if you believe changes are required.
|
|
8
|
+
*
|
|
9
|
+
* Version: 1.0.96
|
|
10
|
+
* Date/time: 4 Apr 2026 08:17:52
|
|
11
|
+
* Template: templates/typescriptpws/calculations.razor.
|
|
12
|
+
***********************************************************************/
|
|
13
|
+
|
|
14
|
+
import * as Enums from '../enums';
|
|
15
|
+
import * as Entities from '../entities';
|
|
16
|
+
import * as EntitySchemas from '../entity-schemas';
|
|
17
|
+
import { getAnalyticsApiTarget, getClientAliasId } from '../utilities';
|
|
18
|
+
import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from './calculationBase';
|
|
19
|
+
|
|
20
|
+
import Joi from 'joi';
|
|
21
21
|
|
|
22
22
|
export interface FlashCalculationRequestSchemaData {
|
|
23
23
|
material: Entities.Material;
|
|
@@ -32,10 +32,7 @@ class FlashCalculationRequest extends CalculationRequestBase {
|
|
|
32
32
|
* Flash calculation request class.
|
|
33
33
|
*
|
|
34
34
|
*/
|
|
35
|
-
constructor(data: {
|
|
36
|
-
material: Entities.Material,
|
|
37
|
-
materialState: Entities.State
|
|
38
|
-
}) {
|
|
35
|
+
constructor(data: { material: Entities.Material; materialState: Entities.State }) {
|
|
39
36
|
super();
|
|
40
37
|
this.material = data.material;
|
|
41
38
|
this.materialState = data.materialState;
|
|
@@ -56,15 +53,15 @@ export class FlashCalculationRequestSchema {
|
|
|
56
53
|
}).unknown(true);
|
|
57
54
|
|
|
58
55
|
this.propertyTypes = {
|
|
59
|
-
material:
|
|
60
|
-
materialState:
|
|
56
|
+
material: 'Entities.Material',
|
|
57
|
+
materialState: 'Entities.State',
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
validate(data: FlashCalculationRequestSchemaData): FlashCalculationRequest {
|
|
65
62
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
66
63
|
if (error) {
|
|
67
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
64
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
68
65
|
}
|
|
69
66
|
return this.makeCalculationRequest(value);
|
|
70
67
|
}
|
|
@@ -84,11 +81,7 @@ export class FlashCalculation extends CalculationBase {
|
|
|
84
81
|
to obtain the fluid properties.
|
|
85
82
|
*
|
|
86
83
|
*/
|
|
87
|
-
constructor(data: {
|
|
88
|
-
material: Entities.Material,
|
|
89
|
-
materialState: Entities.State
|
|
90
|
-
controller?: AbortController;
|
|
91
|
-
}) {
|
|
84
|
+
constructor(data: { material: Entities.Material; materialState: Entities.State; controller?: AbortController }) {
|
|
92
85
|
super(data.controller);
|
|
93
86
|
this.material = data.material;
|
|
94
87
|
this.materialState = data.materialState;
|
|
@@ -98,7 +91,7 @@ to obtain the fluid properties.
|
|
|
98
91
|
try {
|
|
99
92
|
const request = new FlashCalculationRequest({
|
|
100
93
|
material: this.material,
|
|
101
|
-
materialState: this.materialState
|
|
94
|
+
materialState: this.materialState,
|
|
102
95
|
});
|
|
103
96
|
|
|
104
97
|
const schema = new FlashCalculationRequestSchema();
|
|
@@ -139,16 +132,16 @@ to obtain the fluid properties.
|
|
|
139
132
|
}
|
|
140
133
|
|
|
141
134
|
toString() {
|
|
142
|
-
const parts = [
|
|
135
|
+
const parts = ['* Flash'];
|
|
143
136
|
|
|
144
137
|
parts.push(`flashResult: ${String(this.flashResult)}`);
|
|
145
138
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
146
|
-
parts.push(
|
|
147
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
148
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
149
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
139
|
+
parts.push('*** messages:');
|
|
140
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
141
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
142
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
150
143
|
|
|
151
|
-
return parts.join(
|
|
144
|
+
return parts.join('\n');
|
|
152
145
|
}
|
|
153
146
|
}
|
|
154
147
|
|
|
@@ -159,13 +152,7 @@ export class FlashCalculationResponse extends CalculationResponseBase {
|
|
|
159
152
|
* Flash calculation response class.
|
|
160
153
|
*
|
|
161
154
|
*/
|
|
162
|
-
constructor(data: {
|
|
163
|
-
flashResult: Entities.FlashResult,
|
|
164
|
-
resultCode: Enums.ResultCode,
|
|
165
|
-
messages: string[],
|
|
166
|
-
calculationElapsedTime: number,
|
|
167
|
-
operationId: string
|
|
168
|
-
}) {
|
|
155
|
+
constructor(data: { flashResult: Entities.FlashResult; resultCode: Enums.ResultCode; messages: string[]; calculationElapsedTime: number; operationId: string }) {
|
|
169
156
|
super();
|
|
170
157
|
this.flashResult = data.flashResult;
|
|
171
158
|
this.resultCode = data.resultCode;
|
|
@@ -179,17 +166,17 @@ export class FlashCalculationResponse extends CalculationResponseBase {
|
|
|
179
166
|
this.flashResult = new Entities.FlashResult();
|
|
180
167
|
this.flashResult.initialiseFromDictionary(data.flashResult as { [key: string]: unknown });
|
|
181
168
|
}
|
|
182
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
169
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
183
170
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
184
171
|
}
|
|
185
172
|
this.messages = this.messages ?? [];
|
|
186
173
|
if (data.messages && Array.isArray(data.messages)) {
|
|
187
174
|
this.messages.push(...data.messages);
|
|
188
175
|
}
|
|
189
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
176
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
190
177
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
191
178
|
}
|
|
192
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
179
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
193
180
|
this.operationId = data.operationId as string;
|
|
194
181
|
}
|
|
195
182
|
}
|
|
@@ -220,14 +207,14 @@ export class FlashCalculationResponseSchema {
|
|
|
220
207
|
}).unknown(true);
|
|
221
208
|
|
|
222
209
|
this.propertyTypes = {
|
|
223
|
-
flashResult:
|
|
210
|
+
flashResult: 'Entities.FlashResult',
|
|
224
211
|
};
|
|
225
212
|
}
|
|
226
213
|
|
|
227
214
|
validate(data: FlashCalculationResponseSchemaData): FlashCalculationResponse {
|
|
228
215
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
229
216
|
if (error) {
|
|
230
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
217
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
231
218
|
}
|
|
232
219
|
return this.makeCalculationResponse(value);
|
|
233
220
|
}
|