@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 LateExplosionCalculationRequestSchemaData {
|
|
23
23
|
material: Entities.Material;
|
|
@@ -53,18 +53,18 @@ class LateExplosionCalculationRequest extends CalculationRequestBase {
|
|
|
53
53
|
*
|
|
54
54
|
*/
|
|
55
55
|
constructor(data: {
|
|
56
|
-
material: Entities.Material
|
|
57
|
-
scalarUdmOutputs: Entities.ScalarUdmOutputs
|
|
58
|
-
weather: Entities.Weather
|
|
59
|
-
dispersionRecords: Entities.DispersionRecord[]
|
|
60
|
-
dispersionRecordCount: number
|
|
61
|
-
substrate: Entities.Substrate
|
|
62
|
-
dispersionOutputConfig: Entities.DispersionOutputConfig
|
|
63
|
-
explosionOutputConfig: Entities.ExplosionOutputConfig
|
|
64
|
-
explosionParameters: Entities.ExplosionParameters
|
|
65
|
-
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[]
|
|
66
|
-
explosionConfinedVolumeCount: number
|
|
67
|
-
dispersionParameters: Entities.DispersionParameters
|
|
56
|
+
material: Entities.Material;
|
|
57
|
+
scalarUdmOutputs: Entities.ScalarUdmOutputs;
|
|
58
|
+
weather: Entities.Weather;
|
|
59
|
+
dispersionRecords: Entities.DispersionRecord[];
|
|
60
|
+
dispersionRecordCount: number;
|
|
61
|
+
substrate: Entities.Substrate;
|
|
62
|
+
dispersionOutputConfig: Entities.DispersionOutputConfig;
|
|
63
|
+
explosionOutputConfig: Entities.ExplosionOutputConfig;
|
|
64
|
+
explosionParameters: Entities.ExplosionParameters;
|
|
65
|
+
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
66
|
+
explosionConfinedVolumeCount: number;
|
|
67
|
+
dispersionParameters: Entities.DispersionParameters;
|
|
68
68
|
}) {
|
|
69
69
|
super();
|
|
70
70
|
this.material = data.material;
|
|
@@ -106,25 +106,25 @@ export class LateExplosionCalculationRequestSchema {
|
|
|
106
106
|
}).unknown(true);
|
|
107
107
|
|
|
108
108
|
this.propertyTypes = {
|
|
109
|
-
material:
|
|
110
|
-
scalarUdmOutputs:
|
|
111
|
-
weather:
|
|
112
|
-
dispersionRecords:
|
|
113
|
-
dispersionRecordCount:
|
|
114
|
-
substrate:
|
|
115
|
-
dispersionOutputConfig:
|
|
116
|
-
explosionOutputConfig:
|
|
117
|
-
explosionParameters:
|
|
118
|
-
explosionConfinedVolumes:
|
|
119
|
-
explosionConfinedVolumeCount:
|
|
120
|
-
dispersionParameters:
|
|
109
|
+
material: 'Entities.Material',
|
|
110
|
+
scalarUdmOutputs: 'Entities.ScalarUdmOutputs',
|
|
111
|
+
weather: 'Entities.Weather',
|
|
112
|
+
dispersionRecords: 'Entities.DispersionRecord[]',
|
|
113
|
+
dispersionRecordCount: 'number',
|
|
114
|
+
substrate: 'Entities.Substrate',
|
|
115
|
+
dispersionOutputConfig: 'Entities.DispersionOutputConfig',
|
|
116
|
+
explosionOutputConfig: 'Entities.ExplosionOutputConfig',
|
|
117
|
+
explosionParameters: 'Entities.ExplosionParameters',
|
|
118
|
+
explosionConfinedVolumes: 'Entities.ExplosionConfinedVolume[]',
|
|
119
|
+
explosionConfinedVolumeCount: 'number',
|
|
120
|
+
dispersionParameters: 'Entities.DispersionParameters',
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
validate(data: LateExplosionCalculationRequestSchemaData): LateExplosionCalculationRequest {
|
|
125
125
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
126
126
|
if (error) {
|
|
127
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
127
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
128
128
|
}
|
|
129
129
|
return this.makeCalculationRequest(value);
|
|
130
130
|
}
|
|
@@ -155,18 +155,18 @@ export class LateExplosionCalculation extends CalculationBase {
|
|
|
155
155
|
*
|
|
156
156
|
*/
|
|
157
157
|
constructor(data: {
|
|
158
|
-
material: Entities.Material
|
|
159
|
-
scalarUdmOutputs: Entities.ScalarUdmOutputs
|
|
160
|
-
weather: Entities.Weather
|
|
161
|
-
dispersionRecords: Entities.DispersionRecord[]
|
|
162
|
-
dispersionRecordCount: number
|
|
163
|
-
substrate: Entities.Substrate
|
|
164
|
-
dispersionOutputConfig: Entities.DispersionOutputConfig
|
|
165
|
-
explosionOutputConfig: Entities.ExplosionOutputConfig
|
|
166
|
-
explosionParameters: Entities.ExplosionParameters
|
|
167
|
-
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[]
|
|
168
|
-
explosionConfinedVolumeCount: number
|
|
169
|
-
dispersionParameters: Entities.DispersionParameters
|
|
158
|
+
material: Entities.Material;
|
|
159
|
+
scalarUdmOutputs: Entities.ScalarUdmOutputs;
|
|
160
|
+
weather: Entities.Weather;
|
|
161
|
+
dispersionRecords: Entities.DispersionRecord[];
|
|
162
|
+
dispersionRecordCount: number;
|
|
163
|
+
substrate: Entities.Substrate;
|
|
164
|
+
dispersionOutputConfig: Entities.DispersionOutputConfig;
|
|
165
|
+
explosionOutputConfig: Entities.ExplosionOutputConfig;
|
|
166
|
+
explosionParameters: Entities.ExplosionParameters;
|
|
167
|
+
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
168
|
+
explosionConfinedVolumeCount: number;
|
|
169
|
+
dispersionParameters: Entities.DispersionParameters;
|
|
170
170
|
controller?: AbortController;
|
|
171
171
|
}) {
|
|
172
172
|
super(data.controller);
|
|
@@ -198,7 +198,7 @@ export class LateExplosionCalculation extends CalculationBase {
|
|
|
198
198
|
explosionParameters: this.explosionParameters,
|
|
199
199
|
explosionConfinedVolumes: this.explosionConfinedVolumes,
|
|
200
200
|
explosionConfinedVolumeCount: this.explosionConfinedVolumeCount,
|
|
201
|
-
dispersionParameters: this.dispersionParameters
|
|
201
|
+
dispersionParameters: this.dispersionParameters,
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
const schema = new LateExplosionCalculationRequestSchema();
|
|
@@ -240,17 +240,17 @@ export class LateExplosionCalculation extends CalculationBase {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
toString() {
|
|
243
|
-
const parts = [
|
|
243
|
+
const parts = ['* LateExplosion'];
|
|
244
244
|
|
|
245
245
|
parts.push(`explosionUnifConfOverpressureResult: ${String(this.explosionUnifConfOverpressureResult)}`);
|
|
246
246
|
parts.push(`explosionUnconfOverpressureResult: ${String(this.explosionUnconfOverpressureResult)}`);
|
|
247
247
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
248
|
-
parts.push(
|
|
249
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
250
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
251
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
248
|
+
parts.push('*** messages:');
|
|
249
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
250
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
251
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
252
252
|
|
|
253
|
-
return parts.join(
|
|
253
|
+
return parts.join('\n');
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -263,12 +263,12 @@ export class LateExplosionCalculationResponse extends CalculationResponseBase {
|
|
|
263
263
|
*
|
|
264
264
|
*/
|
|
265
265
|
constructor(data: {
|
|
266
|
-
explosionUnifConfOverpressureResult: Entities.ExplosionOverpressureResult
|
|
267
|
-
explosionUnconfOverpressureResult: Entities.ExplosionOverpressureResult
|
|
268
|
-
resultCode: Enums.ResultCode
|
|
269
|
-
messages: string[]
|
|
270
|
-
calculationElapsedTime: number
|
|
271
|
-
operationId: string
|
|
266
|
+
explosionUnifConfOverpressureResult: Entities.ExplosionOverpressureResult;
|
|
267
|
+
explosionUnconfOverpressureResult: Entities.ExplosionOverpressureResult;
|
|
268
|
+
resultCode: Enums.ResultCode;
|
|
269
|
+
messages: string[];
|
|
270
|
+
calculationElapsedTime: number;
|
|
271
|
+
operationId: string;
|
|
272
272
|
}) {
|
|
273
273
|
super();
|
|
274
274
|
this.explosionUnifConfOverpressureResult = data.explosionUnifConfOverpressureResult;
|
|
@@ -288,17 +288,17 @@ export class LateExplosionCalculationResponse extends CalculationResponseBase {
|
|
|
288
288
|
this.explosionUnconfOverpressureResult = new Entities.ExplosionOverpressureResult();
|
|
289
289
|
this.explosionUnconfOverpressureResult.initialiseFromDictionary(data.explosionUnconfOverpressureResult as { [key: string]: unknown });
|
|
290
290
|
}
|
|
291
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
291
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
292
292
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
293
293
|
}
|
|
294
294
|
this.messages = this.messages ?? [];
|
|
295
295
|
if (data.messages && Array.isArray(data.messages)) {
|
|
296
296
|
this.messages.push(...data.messages);
|
|
297
297
|
}
|
|
298
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
298
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
299
299
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
300
300
|
}
|
|
301
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
301
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
302
302
|
this.operationId = data.operationId as string;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
@@ -331,15 +331,15 @@ export class LateExplosionCalculationResponseSchema {
|
|
|
331
331
|
}).unknown(true);
|
|
332
332
|
|
|
333
333
|
this.propertyTypes = {
|
|
334
|
-
explosionUnifConfOverpressureResult:
|
|
335
|
-
explosionUnconfOverpressureResult:
|
|
334
|
+
explosionUnifConfOverpressureResult: 'Entities.ExplosionOverpressureResult',
|
|
335
|
+
explosionUnconfOverpressureResult: 'Entities.ExplosionOverpressureResult',
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
validate(data: LateExplosionCalculationResponseSchemaData): LateExplosionCalculationResponse {
|
|
340
340
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
341
341
|
if (error) {
|
|
342
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
342
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
343
343
|
}
|
|
344
344
|
return this.makeCalculationResponse(value);
|
|
345
345
|
}
|
|
@@ -385,19 +385,19 @@ class LateExplosionToOPLevelsCalculationRequest extends CalculationRequestBase {
|
|
|
385
385
|
*
|
|
386
386
|
*/
|
|
387
387
|
constructor(data: {
|
|
388
|
-
material: Entities.Material
|
|
389
|
-
scalarUdmOutputs: Entities.ScalarUdmOutputs
|
|
390
|
-
weather: Entities.Weather
|
|
391
|
-
dispersionRecords: Entities.DispersionRecord[]
|
|
392
|
-
dispersionRecordCount: number
|
|
393
|
-
substrate: Entities.Substrate
|
|
394
|
-
dispersionOutputConfig: Entities.DispersionOutputConfig
|
|
395
|
-
explosionOutputConfigs: Entities.ExplosionOutputConfig[]
|
|
396
|
-
explosionOutputConfigCount: number
|
|
397
|
-
explosionParameters: Entities.ExplosionParameters
|
|
398
|
-
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[]
|
|
399
|
-
explosionConfinedVolumeCount: number
|
|
400
|
-
dispersionParameters: Entities.DispersionParameters
|
|
388
|
+
material: Entities.Material;
|
|
389
|
+
scalarUdmOutputs: Entities.ScalarUdmOutputs;
|
|
390
|
+
weather: Entities.Weather;
|
|
391
|
+
dispersionRecords: Entities.DispersionRecord[];
|
|
392
|
+
dispersionRecordCount: number;
|
|
393
|
+
substrate: Entities.Substrate;
|
|
394
|
+
dispersionOutputConfig: Entities.DispersionOutputConfig;
|
|
395
|
+
explosionOutputConfigs: Entities.ExplosionOutputConfig[];
|
|
396
|
+
explosionOutputConfigCount: number;
|
|
397
|
+
explosionParameters: Entities.ExplosionParameters;
|
|
398
|
+
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
399
|
+
explosionConfinedVolumeCount: number;
|
|
400
|
+
dispersionParameters: Entities.DispersionParameters;
|
|
401
401
|
}) {
|
|
402
402
|
super();
|
|
403
403
|
this.material = data.material;
|
|
@@ -441,26 +441,26 @@ export class LateExplosionToOPLevelsCalculationRequestSchema {
|
|
|
441
441
|
}).unknown(true);
|
|
442
442
|
|
|
443
443
|
this.propertyTypes = {
|
|
444
|
-
material:
|
|
445
|
-
scalarUdmOutputs:
|
|
446
|
-
weather:
|
|
447
|
-
dispersionRecords:
|
|
448
|
-
dispersionRecordCount:
|
|
449
|
-
substrate:
|
|
450
|
-
dispersionOutputConfig:
|
|
451
|
-
explosionOutputConfigs:
|
|
452
|
-
explosionOutputConfigCount:
|
|
453
|
-
explosionParameters:
|
|
454
|
-
explosionConfinedVolumes:
|
|
455
|
-
explosionConfinedVolumeCount:
|
|
456
|
-
dispersionParameters:
|
|
444
|
+
material: 'Entities.Material',
|
|
445
|
+
scalarUdmOutputs: 'Entities.ScalarUdmOutputs',
|
|
446
|
+
weather: 'Entities.Weather',
|
|
447
|
+
dispersionRecords: 'Entities.DispersionRecord[]',
|
|
448
|
+
dispersionRecordCount: 'number',
|
|
449
|
+
substrate: 'Entities.Substrate',
|
|
450
|
+
dispersionOutputConfig: 'Entities.DispersionOutputConfig',
|
|
451
|
+
explosionOutputConfigs: 'Entities.ExplosionOutputConfig[]',
|
|
452
|
+
explosionOutputConfigCount: 'number',
|
|
453
|
+
explosionParameters: 'Entities.ExplosionParameters',
|
|
454
|
+
explosionConfinedVolumes: 'Entities.ExplosionConfinedVolume[]',
|
|
455
|
+
explosionConfinedVolumeCount: 'number',
|
|
456
|
+
dispersionParameters: 'Entities.DispersionParameters',
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
validate(data: LateExplosionToOPLevelsCalculationRequestSchemaData): LateExplosionToOPLevelsCalculationRequest {
|
|
461
461
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
462
462
|
if (error) {
|
|
463
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
463
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
464
464
|
}
|
|
465
465
|
return this.makeCalculationRequest(value);
|
|
466
466
|
}
|
|
@@ -492,19 +492,19 @@ export class LateExplosionToOPLevelsCalculation extends CalculationBase {
|
|
|
492
492
|
*
|
|
493
493
|
*/
|
|
494
494
|
constructor(data: {
|
|
495
|
-
material: Entities.Material
|
|
496
|
-
scalarUdmOutputs: Entities.ScalarUdmOutputs
|
|
497
|
-
weather: Entities.Weather
|
|
498
|
-
dispersionRecords: Entities.DispersionRecord[]
|
|
499
|
-
dispersionRecordCount: number
|
|
500
|
-
substrate: Entities.Substrate
|
|
501
|
-
dispersionOutputConfig: Entities.DispersionOutputConfig
|
|
502
|
-
explosionOutputConfigs: Entities.ExplosionOutputConfig[]
|
|
503
|
-
explosionOutputConfigCount: number
|
|
504
|
-
explosionParameters: Entities.ExplosionParameters
|
|
505
|
-
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[]
|
|
506
|
-
explosionConfinedVolumeCount: number
|
|
507
|
-
dispersionParameters: Entities.DispersionParameters
|
|
495
|
+
material: Entities.Material;
|
|
496
|
+
scalarUdmOutputs: Entities.ScalarUdmOutputs;
|
|
497
|
+
weather: Entities.Weather;
|
|
498
|
+
dispersionRecords: Entities.DispersionRecord[];
|
|
499
|
+
dispersionRecordCount: number;
|
|
500
|
+
substrate: Entities.Substrate;
|
|
501
|
+
dispersionOutputConfig: Entities.DispersionOutputConfig;
|
|
502
|
+
explosionOutputConfigs: Entities.ExplosionOutputConfig[];
|
|
503
|
+
explosionOutputConfigCount: number;
|
|
504
|
+
explosionParameters: Entities.ExplosionParameters;
|
|
505
|
+
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
506
|
+
explosionConfinedVolumeCount: number;
|
|
507
|
+
dispersionParameters: Entities.DispersionParameters;
|
|
508
508
|
controller?: AbortController;
|
|
509
509
|
}) {
|
|
510
510
|
super(data.controller);
|
|
@@ -538,7 +538,7 @@ export class LateExplosionToOPLevelsCalculation extends CalculationBase {
|
|
|
538
538
|
explosionParameters: this.explosionParameters,
|
|
539
539
|
explosionConfinedVolumes: this.explosionConfinedVolumes,
|
|
540
540
|
explosionConfinedVolumeCount: this.explosionConfinedVolumeCount,
|
|
541
|
-
dispersionParameters: this.dispersionParameters
|
|
541
|
+
dispersionParameters: this.dispersionParameters,
|
|
542
542
|
});
|
|
543
543
|
|
|
544
544
|
const schema = new LateExplosionToOPLevelsCalculationRequestSchema();
|
|
@@ -580,27 +580,27 @@ export class LateExplosionToOPLevelsCalculation extends CalculationBase {
|
|
|
580
580
|
}
|
|
581
581
|
|
|
582
582
|
toString() {
|
|
583
|
-
const parts = [
|
|
583
|
+
const parts = ['* LateExplosionToOPLevels'];
|
|
584
584
|
|
|
585
|
-
parts.push(
|
|
585
|
+
parts.push('*** explosionUnifConfOverpressureResults:');
|
|
586
586
|
parts.push(
|
|
587
587
|
this.explosionUnifConfOverpressureResults && this.explosionUnifConfOverpressureResults.length > 0
|
|
588
|
-
? this.explosionUnifConfOverpressureResults.map((point) => `explosionUnifConfOverpressureResultsElement: ${point}`).join(
|
|
589
|
-
:
|
|
588
|
+
? this.explosionUnifConfOverpressureResults.map((point) => `explosionUnifConfOverpressureResultsElement: ${point}`).join('\n')
|
|
589
|
+
: 'explosionUnifConfOverpressureResults does not contain any elements',
|
|
590
590
|
);
|
|
591
|
-
parts.push(
|
|
591
|
+
parts.push('*** explosionUnconfOverpressureResults:');
|
|
592
592
|
parts.push(
|
|
593
593
|
this.explosionUnconfOverpressureResults && this.explosionUnconfOverpressureResults.length > 0
|
|
594
|
-
? this.explosionUnconfOverpressureResults.map((point) => `explosionUnconfOverpressureResultsElement: ${point}`).join(
|
|
595
|
-
:
|
|
594
|
+
? this.explosionUnconfOverpressureResults.map((point) => `explosionUnconfOverpressureResultsElement: ${point}`).join('\n')
|
|
595
|
+
: 'explosionUnconfOverpressureResults does not contain any elements',
|
|
596
596
|
);
|
|
597
597
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
598
|
-
parts.push(
|
|
599
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
600
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
601
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
598
|
+
parts.push('*** messages:');
|
|
599
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
600
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
601
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
602
602
|
|
|
603
|
-
return parts.join(
|
|
603
|
+
return parts.join('\n');
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
|
|
@@ -613,12 +613,12 @@ export class LateExplosionToOPLevelsCalculationResponse extends CalculationRespo
|
|
|
613
613
|
*
|
|
614
614
|
*/
|
|
615
615
|
constructor(data: {
|
|
616
|
-
explosionUnifConfOverpressureResults: Entities.ExplosionOverpressureResult[]
|
|
617
|
-
explosionUnconfOverpressureResults: Entities.ExplosionOverpressureResult[]
|
|
618
|
-
resultCode: Enums.ResultCode
|
|
619
|
-
messages: string[]
|
|
620
|
-
calculationElapsedTime: number
|
|
621
|
-
operationId: string
|
|
616
|
+
explosionUnifConfOverpressureResults: Entities.ExplosionOverpressureResult[];
|
|
617
|
+
explosionUnconfOverpressureResults: Entities.ExplosionOverpressureResult[];
|
|
618
|
+
resultCode: Enums.ResultCode;
|
|
619
|
+
messages: string[];
|
|
620
|
+
calculationElapsedTime: number;
|
|
621
|
+
operationId: string;
|
|
622
622
|
}) {
|
|
623
623
|
super();
|
|
624
624
|
this.explosionUnifConfOverpressureResults = data.explosionUnifConfOverpressureResults;
|
|
@@ -631,34 +631,30 @@ export class LateExplosionToOPLevelsCalculationResponse extends CalculationRespo
|
|
|
631
631
|
|
|
632
632
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
633
633
|
if (data.explosionUnifConfOverpressureResults && Array.isArray(data.explosionUnifConfOverpressureResults)) {
|
|
634
|
-
this.explosionUnifConfOverpressureResults = data.explosionUnifConfOverpressureResults.map(
|
|
635
|
-
(
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
);
|
|
634
|
+
this.explosionUnifConfOverpressureResults = data.explosionUnifConfOverpressureResults.map((item) => {
|
|
635
|
+
const record = new Entities.ExplosionOverpressureResult();
|
|
636
|
+
record.initialiseFromDictionary(item);
|
|
637
|
+
return record;
|
|
638
|
+
});
|
|
641
639
|
}
|
|
642
640
|
if (data.explosionUnconfOverpressureResults && Array.isArray(data.explosionUnconfOverpressureResults)) {
|
|
643
|
-
this.explosionUnconfOverpressureResults = data.explosionUnconfOverpressureResults.map(
|
|
644
|
-
(
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
);
|
|
641
|
+
this.explosionUnconfOverpressureResults = data.explosionUnconfOverpressureResults.map((item) => {
|
|
642
|
+
const record = new Entities.ExplosionOverpressureResult();
|
|
643
|
+
record.initialiseFromDictionary(item);
|
|
644
|
+
return record;
|
|
645
|
+
});
|
|
650
646
|
}
|
|
651
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
647
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
652
648
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
653
649
|
}
|
|
654
650
|
this.messages = this.messages ?? [];
|
|
655
651
|
if (data.messages && Array.isArray(data.messages)) {
|
|
656
652
|
this.messages.push(...data.messages);
|
|
657
653
|
}
|
|
658
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
654
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
659
655
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
660
656
|
}
|
|
661
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
657
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
662
658
|
this.operationId = data.operationId as string;
|
|
663
659
|
}
|
|
664
660
|
}
|
|
@@ -691,15 +687,15 @@ export class LateExplosionToOPLevelsCalculationResponseSchema {
|
|
|
691
687
|
}).unknown(true);
|
|
692
688
|
|
|
693
689
|
this.propertyTypes = {
|
|
694
|
-
explosionUnifConfOverpressureResults:
|
|
695
|
-
explosionUnconfOverpressureResults:
|
|
690
|
+
explosionUnifConfOverpressureResults: 'Entities.ExplosionOverpressureResult[]',
|
|
691
|
+
explosionUnconfOverpressureResults: 'Entities.ExplosionOverpressureResult[]',
|
|
696
692
|
};
|
|
697
693
|
}
|
|
698
694
|
|
|
699
695
|
validate(data: LateExplosionToOPLevelsCalculationResponseSchemaData): LateExplosionToOPLevelsCalculationResponse {
|
|
700
696
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
701
697
|
if (error) {
|
|
702
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
698
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
703
699
|
}
|
|
704
700
|
return this.makeCalculationResponse(value);
|
|
705
701
|
}
|