@dnv-plant/typescriptpws 1.0.95 → 1.0.96
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 DispersionCalculationRequestSchemaData {
|
|
23
23
|
material: Entities.Material;
|
|
@@ -45,14 +45,14 @@ class DispersionCalculationRequest extends CalculationRequestBase {
|
|
|
45
45
|
*
|
|
46
46
|
*/
|
|
47
47
|
constructor(data: {
|
|
48
|
-
material: Entities.Material
|
|
49
|
-
substrate: Entities.Substrate
|
|
50
|
-
dischargeResult: Entities.DischargeResult
|
|
51
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
52
|
-
dischargeRecordCount: number
|
|
53
|
-
weather: Entities.Weather
|
|
54
|
-
dispersionParameters: Entities.DispersionParameters
|
|
55
|
-
endPointConcentration: number
|
|
48
|
+
material: Entities.Material;
|
|
49
|
+
substrate: Entities.Substrate;
|
|
50
|
+
dischargeResult: Entities.DischargeResult;
|
|
51
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
52
|
+
dischargeRecordCount: number;
|
|
53
|
+
weather: Entities.Weather;
|
|
54
|
+
dispersionParameters: Entities.DispersionParameters;
|
|
55
|
+
endPointConcentration: number;
|
|
56
56
|
}) {
|
|
57
57
|
super();
|
|
58
58
|
this.material = data.material;
|
|
@@ -86,21 +86,21 @@ export class DispersionCalculationRequestSchema {
|
|
|
86
86
|
}).unknown(true);
|
|
87
87
|
|
|
88
88
|
this.propertyTypes = {
|
|
89
|
-
material:
|
|
90
|
-
substrate:
|
|
91
|
-
dischargeResult:
|
|
92
|
-
dischargeRecords:
|
|
93
|
-
dischargeRecordCount:
|
|
94
|
-
weather:
|
|
95
|
-
dispersionParameters:
|
|
96
|
-
endPointConcentration:
|
|
89
|
+
material: 'Entities.Material',
|
|
90
|
+
substrate: 'Entities.Substrate',
|
|
91
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
92
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
93
|
+
dischargeRecordCount: 'number',
|
|
94
|
+
weather: 'Entities.Weather',
|
|
95
|
+
dispersionParameters: 'Entities.DispersionParameters',
|
|
96
|
+
endPointConcentration: 'number',
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
validate(data: DispersionCalculationRequestSchemaData): DispersionCalculationRequest {
|
|
101
101
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
102
102
|
if (error) {
|
|
103
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
103
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
104
104
|
}
|
|
105
105
|
return this.makeCalculationRequest(value);
|
|
106
106
|
}
|
|
@@ -130,14 +130,14 @@ Time-varying scenarios with mixtures are not currently handled and will give an
|
|
|
130
130
|
*
|
|
131
131
|
*/
|
|
132
132
|
constructor(data: {
|
|
133
|
-
material: Entities.Material
|
|
134
|
-
substrate: Entities.Substrate
|
|
135
|
-
dischargeResult: Entities.DischargeResult
|
|
136
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
137
|
-
dischargeRecordCount: number
|
|
138
|
-
weather: Entities.Weather
|
|
139
|
-
dispersionParameters: Entities.DispersionParameters
|
|
140
|
-
endPointConcentration: number
|
|
133
|
+
material: Entities.Material;
|
|
134
|
+
substrate: Entities.Substrate;
|
|
135
|
+
dischargeResult: Entities.DischargeResult;
|
|
136
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
137
|
+
dischargeRecordCount: number;
|
|
138
|
+
weather: Entities.Weather;
|
|
139
|
+
dispersionParameters: Entities.DispersionParameters;
|
|
140
|
+
endPointConcentration: number;
|
|
141
141
|
controller?: AbortController;
|
|
142
142
|
}) {
|
|
143
143
|
super(data.controller);
|
|
@@ -161,7 +161,7 @@ Time-varying scenarios with mixtures are not currently handled and will give an
|
|
|
161
161
|
dischargeRecordCount: this.dischargeRecordCount,
|
|
162
162
|
weather: this.weather,
|
|
163
163
|
dispersionParameters: this.dispersionParameters,
|
|
164
|
-
endPointConcentration: this.endPointConcentration
|
|
164
|
+
endPointConcentration: this.endPointConcentration,
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
const schema = new DispersionCalculationRequestSchema();
|
|
@@ -204,28 +204,24 @@ Time-varying scenarios with mixtures are not currently handled and will give an
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
toString() {
|
|
207
|
-
const parts = [
|
|
207
|
+
const parts = ['* Dispersion'];
|
|
208
208
|
|
|
209
209
|
parts.push(`scalarUdmOutputs: ${String(this.scalarUdmOutputs)}`);
|
|
210
|
-
parts.push(
|
|
210
|
+
parts.push('*** dispersionRecords:');
|
|
211
211
|
parts.push(
|
|
212
212
|
this.dispersionRecords && this.dispersionRecords.length > 0
|
|
213
|
-
? this.dispersionRecords.map((point) => `dispersionRecordsElement: ${point}`).join(
|
|
214
|
-
:
|
|
215
|
-
);
|
|
216
|
-
parts.push("*** poolRecords:");
|
|
217
|
-
parts.push(
|
|
218
|
-
this.poolRecords && this.poolRecords.length > 0
|
|
219
|
-
? this.poolRecords.map((point) => `poolRecordsElement: ${point}`).join("\n")
|
|
220
|
-
: "poolRecords does not contain any elements"
|
|
213
|
+
? this.dispersionRecords.map((point) => `dispersionRecordsElement: ${point}`).join('\n')
|
|
214
|
+
: 'dispersionRecords does not contain any elements',
|
|
221
215
|
);
|
|
216
|
+
parts.push('*** poolRecords:');
|
|
217
|
+
parts.push(this.poolRecords && this.poolRecords.length > 0 ? this.poolRecords.map((point) => `poolRecordsElement: ${point}`).join('\n') : 'poolRecords does not contain any elements');
|
|
222
218
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
223
|
-
parts.push(
|
|
224
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
225
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
226
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
219
|
+
parts.push('*** messages:');
|
|
220
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
221
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
222
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
227
223
|
|
|
228
|
-
return parts.join(
|
|
224
|
+
return parts.join('\n');
|
|
229
225
|
}
|
|
230
226
|
}
|
|
231
227
|
|
|
@@ -239,13 +235,13 @@ export class DispersionCalculationResponse extends CalculationResponseBase {
|
|
|
239
235
|
*
|
|
240
236
|
*/
|
|
241
237
|
constructor(data: {
|
|
242
|
-
scalarUdmOutputs: Entities.ScalarUdmOutputs
|
|
243
|
-
dispersionRecords: Entities.DispersionRecord[]
|
|
244
|
-
poolRecords: Entities.PoolRecord[]
|
|
245
|
-
resultCode: Enums.ResultCode
|
|
246
|
-
messages: string[]
|
|
247
|
-
calculationElapsedTime: number
|
|
248
|
-
operationId: string
|
|
238
|
+
scalarUdmOutputs: Entities.ScalarUdmOutputs;
|
|
239
|
+
dispersionRecords: Entities.DispersionRecord[];
|
|
240
|
+
poolRecords: Entities.PoolRecord[];
|
|
241
|
+
resultCode: Enums.ResultCode;
|
|
242
|
+
messages: string[];
|
|
243
|
+
calculationElapsedTime: number;
|
|
244
|
+
operationId: string;
|
|
249
245
|
}) {
|
|
250
246
|
super();
|
|
251
247
|
this.scalarUdmOutputs = data.scalarUdmOutputs;
|
|
@@ -263,34 +259,30 @@ export class DispersionCalculationResponse extends CalculationResponseBase {
|
|
|
263
259
|
this.scalarUdmOutputs.initialiseFromDictionary(data.scalarUdmOutputs as { [key: string]: unknown });
|
|
264
260
|
}
|
|
265
261
|
if (data.dispersionRecords && Array.isArray(data.dispersionRecords)) {
|
|
266
|
-
this.dispersionRecords = data.dispersionRecords.map(
|
|
267
|
-
(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
);
|
|
262
|
+
this.dispersionRecords = data.dispersionRecords.map((item) => {
|
|
263
|
+
const record = new Entities.DispersionRecord();
|
|
264
|
+
record.initialiseFromDictionary(item);
|
|
265
|
+
return record;
|
|
266
|
+
});
|
|
273
267
|
}
|
|
274
268
|
if (data.poolRecords && Array.isArray(data.poolRecords)) {
|
|
275
|
-
this.poolRecords = data.poolRecords.map(
|
|
276
|
-
(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
);
|
|
269
|
+
this.poolRecords = data.poolRecords.map((item) => {
|
|
270
|
+
const record = new Entities.PoolRecord();
|
|
271
|
+
record.initialiseFromDictionary(item);
|
|
272
|
+
return record;
|
|
273
|
+
});
|
|
282
274
|
}
|
|
283
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
275
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
284
276
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
285
277
|
}
|
|
286
278
|
this.messages = this.messages ?? [];
|
|
287
279
|
if (data.messages && Array.isArray(data.messages)) {
|
|
288
280
|
this.messages.push(...data.messages);
|
|
289
281
|
}
|
|
290
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
282
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
291
283
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
292
284
|
}
|
|
293
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
285
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
294
286
|
this.operationId = data.operationId as string;
|
|
295
287
|
}
|
|
296
288
|
}
|
|
@@ -325,16 +317,16 @@ export class DispersionCalculationResponseSchema {
|
|
|
325
317
|
}).unknown(true);
|
|
326
318
|
|
|
327
319
|
this.propertyTypes = {
|
|
328
|
-
scalarUdmOutputs:
|
|
329
|
-
dispersionRecords:
|
|
330
|
-
poolRecords:
|
|
320
|
+
scalarUdmOutputs: 'Entities.ScalarUdmOutputs',
|
|
321
|
+
dispersionRecords: 'Entities.DispersionRecord[]',
|
|
322
|
+
poolRecords: 'Entities.PoolRecord[]',
|
|
331
323
|
};
|
|
332
324
|
}
|
|
333
325
|
|
|
334
326
|
validate(data: DispersionCalculationResponseSchemaData): DispersionCalculationResponse {
|
|
335
327
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
336
328
|
if (error) {
|
|
337
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
329
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
338
330
|
}
|
|
339
331
|
return this.makeCalculationResponse(value);
|
|
340
332
|
}
|