@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 BESSConfidenceIntervalEnergyScalingCalculationRequestSchemaData {
|
|
23
23
|
chemistry: number;
|
|
@@ -32,10 +32,7 @@ class BESSConfidenceIntervalEnergyScalingCalculationRequest extends CalculationR
|
|
|
32
32
|
* BESSConfidenceIntervalEnergyScaling calculation request class.
|
|
33
33
|
*
|
|
34
34
|
*/
|
|
35
|
-
constructor(data: {
|
|
36
|
-
chemistry: number,
|
|
37
|
-
confidenceInterval: number
|
|
38
|
-
}) {
|
|
35
|
+
constructor(data: { chemistry: number; confidenceInterval: number }) {
|
|
39
36
|
super();
|
|
40
37
|
this.chemistry = data.chemistry;
|
|
41
38
|
this.confidenceInterval = data.confidenceInterval;
|
|
@@ -56,15 +53,15 @@ export class BESSConfidenceIntervalEnergyScalingCalculationRequestSchema {
|
|
|
56
53
|
}).unknown(true);
|
|
57
54
|
|
|
58
55
|
this.propertyTypes = {
|
|
59
|
-
chemistry:
|
|
60
|
-
confidenceInterval:
|
|
56
|
+
chemistry: 'number',
|
|
57
|
+
confidenceInterval: 'number',
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
validate(data: BESSConfidenceIntervalEnergyScalingCalculationRequestSchemaData): BESSConfidenceIntervalEnergyScalingCalculationRequest {
|
|
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 BESSConfidenceIntervalEnergyScalingCalculation extends CalculationB
|
|
|
84
81
|
* Confidence interval scaling values for a BESS calculation.
|
|
85
82
|
*
|
|
86
83
|
*/
|
|
87
|
-
constructor(data: {
|
|
88
|
-
chemistry: number,
|
|
89
|
-
confidenceInterval: number
|
|
90
|
-
controller?: AbortController;
|
|
91
|
-
}) {
|
|
84
|
+
constructor(data: { chemistry: number; confidenceInterval: number; controller?: AbortController }) {
|
|
92
85
|
super(data.controller);
|
|
93
86
|
this.chemistry = data.chemistry;
|
|
94
87
|
this.confidenceInterval = data.confidenceInterval;
|
|
@@ -98,7 +91,7 @@ export class BESSConfidenceIntervalEnergyScalingCalculation extends CalculationB
|
|
|
98
91
|
try {
|
|
99
92
|
const request = new BESSConfidenceIntervalEnergyScalingCalculationRequest({
|
|
100
93
|
chemistry: this.chemistry,
|
|
101
|
-
confidenceInterval: this.confidenceInterval
|
|
94
|
+
confidenceInterval: this.confidenceInterval,
|
|
102
95
|
});
|
|
103
96
|
|
|
104
97
|
const schema = new BESSConfidenceIntervalEnergyScalingCalculationRequestSchema();
|
|
@@ -140,17 +133,17 @@ export class BESSConfidenceIntervalEnergyScalingCalculation extends CalculationB
|
|
|
140
133
|
}
|
|
141
134
|
|
|
142
135
|
toString() {
|
|
143
|
-
const parts = [
|
|
136
|
+
const parts = ['* BESSConfidenceIntervalEnergyScaling'];
|
|
144
137
|
|
|
145
138
|
parts.push(`kUpper: ${String(this.kUpper)}`);
|
|
146
139
|
parts.push(`kLower: ${String(this.kLower)}`);
|
|
147
140
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
148
|
-
parts.push(
|
|
149
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
150
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
151
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
141
|
+
parts.push('*** messages:');
|
|
142
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
143
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
144
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
152
145
|
|
|
153
|
-
return parts.join(
|
|
146
|
+
return parts.join('\n');
|
|
154
147
|
}
|
|
155
148
|
}
|
|
156
149
|
|
|
@@ -162,14 +155,7 @@ export class BESSConfidenceIntervalEnergyScalingCalculationResponse extends Calc
|
|
|
162
155
|
* BESSConfidenceIntervalEnergyScaling calculation response class.
|
|
163
156
|
*
|
|
164
157
|
*/
|
|
165
|
-
constructor(data: {
|
|
166
|
-
kUpper: number,
|
|
167
|
-
kLower: number,
|
|
168
|
-
resultCode: Enums.ResultCode,
|
|
169
|
-
messages: string[],
|
|
170
|
-
calculationElapsedTime: number,
|
|
171
|
-
operationId: string
|
|
172
|
-
}) {
|
|
158
|
+
constructor(data: { kUpper: number; kLower: number; resultCode: Enums.ResultCode; messages: string[]; calculationElapsedTime: number; operationId: string }) {
|
|
173
159
|
super();
|
|
174
160
|
this.kUpper = data.kUpper;
|
|
175
161
|
this.kLower = data.kLower;
|
|
@@ -180,23 +166,23 @@ export class BESSConfidenceIntervalEnergyScalingCalculationResponse extends Calc
|
|
|
180
166
|
}
|
|
181
167
|
|
|
182
168
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
183
|
-
if (data.kUpper !== undefined && typeof data.kUpper ===
|
|
169
|
+
if (data.kUpper !== undefined && typeof data.kUpper === 'number') {
|
|
184
170
|
this.kUpper = data.kUpper as number;
|
|
185
171
|
}
|
|
186
|
-
if (data.kLower !== undefined && typeof data.kLower ===
|
|
172
|
+
if (data.kLower !== undefined && typeof data.kLower === 'number') {
|
|
187
173
|
this.kLower = data.kLower as number;
|
|
188
174
|
}
|
|
189
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
175
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
190
176
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
191
177
|
}
|
|
192
178
|
this.messages = this.messages ?? [];
|
|
193
179
|
if (data.messages && Array.isArray(data.messages)) {
|
|
194
180
|
this.messages.push(...data.messages);
|
|
195
181
|
}
|
|
196
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
182
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
197
183
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
198
184
|
}
|
|
199
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
185
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
200
186
|
this.operationId = data.operationId as string;
|
|
201
187
|
}
|
|
202
188
|
}
|
|
@@ -229,15 +215,15 @@ export class BESSConfidenceIntervalEnergyScalingCalculationResponseSchema {
|
|
|
229
215
|
}).unknown(true);
|
|
230
216
|
|
|
231
217
|
this.propertyTypes = {
|
|
232
|
-
kUpper:
|
|
233
|
-
kLower:
|
|
218
|
+
kUpper: 'number',
|
|
219
|
+
kLower: 'number',
|
|
234
220
|
};
|
|
235
221
|
}
|
|
236
222
|
|
|
237
223
|
validate(data: BESSConfidenceIntervalEnergyScalingCalculationResponseSchemaData): BESSConfidenceIntervalEnergyScalingCalculationResponse {
|
|
238
224
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
239
225
|
if (error) {
|
|
240
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
226
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
241
227
|
}
|
|
242
228
|
return this.makeCalculationResponse(value);
|
|
243
229
|
}
|
|
@@ -260,10 +246,7 @@ class BESSToxicSourceCalculationRequest extends CalculationRequestBase {
|
|
|
260
246
|
* BESSToxicSource calculation request class.
|
|
261
247
|
*
|
|
262
248
|
*/
|
|
263
|
-
constructor(data: {
|
|
264
|
-
bessUnit: Entities.BESSUnit,
|
|
265
|
-
bessRelease: Entities.BESSRelease
|
|
266
|
-
}) {
|
|
249
|
+
constructor(data: { bessUnit: Entities.BESSUnit; bessRelease: Entities.BESSRelease }) {
|
|
267
250
|
super();
|
|
268
251
|
this.bessUnit = data.bessUnit;
|
|
269
252
|
this.bessRelease = data.bessRelease;
|
|
@@ -284,15 +267,15 @@ export class BESSToxicSourceCalculationRequestSchema {
|
|
|
284
267
|
}).unknown(true);
|
|
285
268
|
|
|
286
269
|
this.propertyTypes = {
|
|
287
|
-
bessUnit:
|
|
288
|
-
bessRelease:
|
|
270
|
+
bessUnit: 'Entities.BESSUnit',
|
|
271
|
+
bessRelease: 'Entities.BESSRelease',
|
|
289
272
|
};
|
|
290
273
|
}
|
|
291
274
|
|
|
292
275
|
validate(data: BESSToxicSourceCalculationRequestSchemaData): BESSToxicSourceCalculationRequest {
|
|
293
276
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
294
277
|
if (error) {
|
|
295
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
278
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
296
279
|
}
|
|
297
280
|
return this.makeCalculationRequest(value);
|
|
298
281
|
}
|
|
@@ -313,11 +296,7 @@ export class BESSToxicSourceCalculation extends CalculationBase {
|
|
|
313
296
|
* Toxic outflow from a BESS unit.
|
|
314
297
|
*
|
|
315
298
|
*/
|
|
316
|
-
constructor(data: {
|
|
317
|
-
bessUnit: Entities.BESSUnit,
|
|
318
|
-
bessRelease: Entities.BESSRelease
|
|
319
|
-
controller?: AbortController;
|
|
320
|
-
}) {
|
|
299
|
+
constructor(data: { bessUnit: Entities.BESSUnit; bessRelease: Entities.BESSRelease; controller?: AbortController }) {
|
|
321
300
|
super(data.controller);
|
|
322
301
|
this.bessUnit = data.bessUnit;
|
|
323
302
|
this.bessRelease = data.bessRelease;
|
|
@@ -327,7 +306,7 @@ export class BESSToxicSourceCalculation extends CalculationBase {
|
|
|
327
306
|
try {
|
|
328
307
|
const request = new BESSToxicSourceCalculationRequest({
|
|
329
308
|
bessUnit: this.bessUnit,
|
|
330
|
-
bessRelease: this.bessRelease
|
|
309
|
+
bessRelease: this.bessRelease,
|
|
331
310
|
});
|
|
332
311
|
|
|
333
312
|
const schema = new BESSToxicSourceCalculationRequestSchema();
|
|
@@ -370,23 +349,23 @@ export class BESSToxicSourceCalculation extends CalculationBase {
|
|
|
370
349
|
}
|
|
371
350
|
|
|
372
351
|
toString() {
|
|
373
|
-
const parts = [
|
|
352
|
+
const parts = ['* BESSToxicSource'];
|
|
374
353
|
|
|
375
354
|
parts.push(`bessMaterial: ${String(this.bessMaterial)}`);
|
|
376
355
|
parts.push(`dischargeResult: ${String(this.dischargeResult)}`);
|
|
377
|
-
parts.push(
|
|
356
|
+
parts.push('*** dischargeRecords:');
|
|
378
357
|
parts.push(
|
|
379
358
|
this.dischargeRecords && this.dischargeRecords.length > 0
|
|
380
|
-
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join(
|
|
381
|
-
:
|
|
359
|
+
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join('\n')
|
|
360
|
+
: 'dischargeRecords does not contain any elements',
|
|
382
361
|
);
|
|
383
362
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
384
|
-
parts.push(
|
|
385
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
386
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
387
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
363
|
+
parts.push('*** messages:');
|
|
364
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
365
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
366
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
388
367
|
|
|
389
|
-
return parts.join(
|
|
368
|
+
return parts.join('\n');
|
|
390
369
|
}
|
|
391
370
|
}
|
|
392
371
|
|
|
@@ -400,13 +379,13 @@ export class BESSToxicSourceCalculationResponse extends CalculationResponseBase
|
|
|
400
379
|
*
|
|
401
380
|
*/
|
|
402
381
|
constructor(data: {
|
|
403
|
-
bessMaterial: Entities.Material
|
|
404
|
-
dischargeResult: Entities.DischargeResult
|
|
405
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
406
|
-
resultCode: Enums.ResultCode
|
|
407
|
-
messages: string[]
|
|
408
|
-
calculationElapsedTime: number
|
|
409
|
-
operationId: string
|
|
382
|
+
bessMaterial: Entities.Material;
|
|
383
|
+
dischargeResult: Entities.DischargeResult;
|
|
384
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
385
|
+
resultCode: Enums.ResultCode;
|
|
386
|
+
messages: string[];
|
|
387
|
+
calculationElapsedTime: number;
|
|
388
|
+
operationId: string;
|
|
410
389
|
}) {
|
|
411
390
|
super();
|
|
412
391
|
this.bessMaterial = data.bessMaterial;
|
|
@@ -428,25 +407,23 @@ export class BESSToxicSourceCalculationResponse extends CalculationResponseBase
|
|
|
428
407
|
this.dischargeResult.initialiseFromDictionary(data.dischargeResult as { [key: string]: unknown });
|
|
429
408
|
}
|
|
430
409
|
if (data.dischargeRecords && Array.isArray(data.dischargeRecords)) {
|
|
431
|
-
this.dischargeRecords = data.dischargeRecords.map(
|
|
432
|
-
(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
|
|
410
|
+
this.dischargeRecords = data.dischargeRecords.map((item) => {
|
|
411
|
+
const record = new Entities.DischargeRecord();
|
|
412
|
+
record.initialiseFromDictionary(item);
|
|
413
|
+
return record;
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
440
417
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
441
418
|
}
|
|
442
419
|
this.messages = this.messages ?? [];
|
|
443
420
|
if (data.messages && Array.isArray(data.messages)) {
|
|
444
421
|
this.messages.push(...data.messages);
|
|
445
422
|
}
|
|
446
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
423
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
447
424
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
448
425
|
}
|
|
449
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
426
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
450
427
|
this.operationId = data.operationId as string;
|
|
451
428
|
}
|
|
452
429
|
}
|
|
@@ -481,16 +458,16 @@ export class BESSToxicSourceCalculationResponseSchema {
|
|
|
481
458
|
}).unknown(true);
|
|
482
459
|
|
|
483
460
|
this.propertyTypes = {
|
|
484
|
-
bessMaterial:
|
|
485
|
-
dischargeResult:
|
|
486
|
-
dischargeRecords:
|
|
461
|
+
bessMaterial: 'Entities.Material',
|
|
462
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
463
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
487
464
|
};
|
|
488
465
|
}
|
|
489
466
|
|
|
490
467
|
validate(data: BESSToxicSourceCalculationResponseSchemaData): BESSToxicSourceCalculationResponse {
|
|
491
468
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
492
469
|
if (error) {
|
|
493
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
470
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
494
471
|
}
|
|
495
472
|
return this.makeCalculationResponse(value);
|
|
496
473
|
}
|
|
@@ -515,11 +492,7 @@ class LongPipeBreachCalculationRequest extends CalculationRequestBase {
|
|
|
515
492
|
* LongPipeBreach calculation request class.
|
|
516
493
|
*
|
|
517
494
|
*/
|
|
518
|
-
constructor(data: {
|
|
519
|
-
pipe: Entities.Pipe,
|
|
520
|
-
pipeBreach: Entities.PipeBreach,
|
|
521
|
-
dischargeParameters: Entities.DischargeParameters
|
|
522
|
-
}) {
|
|
495
|
+
constructor(data: { pipe: Entities.Pipe; pipeBreach: Entities.PipeBreach; dischargeParameters: Entities.DischargeParameters }) {
|
|
523
496
|
super();
|
|
524
497
|
this.pipe = data.pipe;
|
|
525
498
|
this.pipeBreach = data.pipeBreach;
|
|
@@ -542,16 +515,16 @@ export class LongPipeBreachCalculationRequestSchema {
|
|
|
542
515
|
}).unknown(true);
|
|
543
516
|
|
|
544
517
|
this.propertyTypes = {
|
|
545
|
-
pipe:
|
|
546
|
-
pipeBreach:
|
|
547
|
-
dischargeParameters:
|
|
518
|
+
pipe: 'Entities.Pipe',
|
|
519
|
+
pipeBreach: 'Entities.PipeBreach',
|
|
520
|
+
dischargeParameters: 'Entities.DischargeParameters',
|
|
548
521
|
};
|
|
549
522
|
}
|
|
550
523
|
|
|
551
524
|
validate(data: LongPipeBreachCalculationRequestSchemaData): LongPipeBreachCalculationRequest {
|
|
552
525
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
553
526
|
if (error) {
|
|
554
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
527
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
555
528
|
}
|
|
556
529
|
return this.makeCalculationRequest(value);
|
|
557
530
|
}
|
|
@@ -576,12 +549,7 @@ state entity for which pressure gauge is not the right definition, i.e. the fina
|
|
|
576
549
|
flash calculation, etc.
|
|
577
550
|
*
|
|
578
551
|
*/
|
|
579
|
-
constructor(data: {
|
|
580
|
-
pipe: Entities.Pipe,
|
|
581
|
-
pipeBreach: Entities.PipeBreach,
|
|
582
|
-
dischargeParameters: Entities.DischargeParameters
|
|
583
|
-
controller?: AbortController;
|
|
584
|
-
}) {
|
|
552
|
+
constructor(data: { pipe: Entities.Pipe; pipeBreach: Entities.PipeBreach; dischargeParameters: Entities.DischargeParameters; controller?: AbortController }) {
|
|
585
553
|
super(data.controller);
|
|
586
554
|
this.pipe = data.pipe;
|
|
587
555
|
this.pipeBreach = data.pipeBreach;
|
|
@@ -593,7 +561,7 @@ flash calculation, etc.
|
|
|
593
561
|
const request = new LongPipeBreachCalculationRequest({
|
|
594
562
|
pipe: this.pipe,
|
|
595
563
|
pipeBreach: this.pipeBreach,
|
|
596
|
-
dischargeParameters: this.dischargeParameters
|
|
564
|
+
dischargeParameters: this.dischargeParameters,
|
|
597
565
|
});
|
|
598
566
|
|
|
599
567
|
const schema = new LongPipeBreachCalculationRequestSchema();
|
|
@@ -636,23 +604,23 @@ flash calculation, etc.
|
|
|
636
604
|
}
|
|
637
605
|
|
|
638
606
|
toString() {
|
|
639
|
-
const parts = [
|
|
607
|
+
const parts = ['* LongPipeBreach'];
|
|
640
608
|
|
|
641
609
|
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
642
610
|
parts.push(`dischargeResult: ${String(this.dischargeResult)}`);
|
|
643
|
-
parts.push(
|
|
611
|
+
parts.push('*** dischargeRecords:');
|
|
644
612
|
parts.push(
|
|
645
613
|
this.dischargeRecords && this.dischargeRecords.length > 0
|
|
646
|
-
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join(
|
|
647
|
-
:
|
|
614
|
+
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join('\n')
|
|
615
|
+
: 'dischargeRecords does not contain any elements',
|
|
648
616
|
);
|
|
649
617
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
650
|
-
parts.push(
|
|
651
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
652
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
653
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
618
|
+
parts.push('*** messages:');
|
|
619
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
620
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
621
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
654
622
|
|
|
655
|
-
return parts.join(
|
|
623
|
+
return parts.join('\n');
|
|
656
624
|
}
|
|
657
625
|
}
|
|
658
626
|
|
|
@@ -666,13 +634,13 @@ export class LongPipeBreachCalculationResponse extends CalculationResponseBase {
|
|
|
666
634
|
*
|
|
667
635
|
*/
|
|
668
636
|
constructor(data: {
|
|
669
|
-
exitMaterial: Entities.Material
|
|
670
|
-
dischargeResult: Entities.DischargeResult
|
|
671
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
672
|
-
resultCode: Enums.ResultCode
|
|
673
|
-
messages: string[]
|
|
674
|
-
calculationElapsedTime: number
|
|
675
|
-
operationId: string
|
|
637
|
+
exitMaterial: Entities.Material;
|
|
638
|
+
dischargeResult: Entities.DischargeResult;
|
|
639
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
640
|
+
resultCode: Enums.ResultCode;
|
|
641
|
+
messages: string[];
|
|
642
|
+
calculationElapsedTime: number;
|
|
643
|
+
operationId: string;
|
|
676
644
|
}) {
|
|
677
645
|
super();
|
|
678
646
|
this.exitMaterial = data.exitMaterial;
|
|
@@ -694,25 +662,23 @@ export class LongPipeBreachCalculationResponse extends CalculationResponseBase {
|
|
|
694
662
|
this.dischargeResult.initialiseFromDictionary(data.dischargeResult as { [key: string]: unknown });
|
|
695
663
|
}
|
|
696
664
|
if (data.dischargeRecords && Array.isArray(data.dischargeRecords)) {
|
|
697
|
-
this.dischargeRecords = data.dischargeRecords.map(
|
|
698
|
-
(
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
}
|
|
705
|
-
if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
|
|
665
|
+
this.dischargeRecords = data.dischargeRecords.map((item) => {
|
|
666
|
+
const record = new Entities.DischargeRecord();
|
|
667
|
+
record.initialiseFromDictionary(item);
|
|
668
|
+
return record;
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
706
672
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
707
673
|
}
|
|
708
674
|
this.messages = this.messages ?? [];
|
|
709
675
|
if (data.messages && Array.isArray(data.messages)) {
|
|
710
676
|
this.messages.push(...data.messages);
|
|
711
677
|
}
|
|
712
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
678
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
713
679
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
714
680
|
}
|
|
715
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
681
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
716
682
|
this.operationId = data.operationId as string;
|
|
717
683
|
}
|
|
718
684
|
}
|
|
@@ -747,16 +713,16 @@ export class LongPipeBreachCalculationResponseSchema {
|
|
|
747
713
|
}).unknown(true);
|
|
748
714
|
|
|
749
715
|
this.propertyTypes = {
|
|
750
|
-
exitMaterial:
|
|
751
|
-
dischargeResult:
|
|
752
|
-
dischargeRecords:
|
|
716
|
+
exitMaterial: 'Entities.Material',
|
|
717
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
718
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
753
719
|
};
|
|
754
720
|
}
|
|
755
721
|
|
|
756
722
|
validate(data: LongPipeBreachCalculationResponseSchemaData): LongPipeBreachCalculationResponse {
|
|
757
723
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
758
724
|
if (error) {
|
|
759
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
725
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
760
726
|
}
|
|
761
727
|
return this.makeCalculationResponse(value);
|
|
762
728
|
}
|
|
@@ -779,10 +745,7 @@ class VesselCatastrophicRuptureCalculationRequest extends CalculationRequestBase
|
|
|
779
745
|
* VesselCatastrophicRupture calculation request class.
|
|
780
746
|
*
|
|
781
747
|
*/
|
|
782
|
-
constructor(data: {
|
|
783
|
-
vessel: Entities.Vessel,
|
|
784
|
-
dischargeParameters: Entities.DischargeParameters
|
|
785
|
-
}) {
|
|
748
|
+
constructor(data: { vessel: Entities.Vessel; dischargeParameters: Entities.DischargeParameters }) {
|
|
786
749
|
super();
|
|
787
750
|
this.vessel = data.vessel;
|
|
788
751
|
this.dischargeParameters = data.dischargeParameters;
|
|
@@ -803,15 +766,15 @@ export class VesselCatastrophicRuptureCalculationRequestSchema {
|
|
|
803
766
|
}).unknown(true);
|
|
804
767
|
|
|
805
768
|
this.propertyTypes = {
|
|
806
|
-
vessel:
|
|
807
|
-
dischargeParameters:
|
|
769
|
+
vessel: 'Entities.Vessel',
|
|
770
|
+
dischargeParameters: 'Entities.DischargeParameters',
|
|
808
771
|
};
|
|
809
772
|
}
|
|
810
773
|
|
|
811
774
|
validate(data: VesselCatastrophicRuptureCalculationRequestSchemaData): VesselCatastrophicRuptureCalculationRequest {
|
|
812
775
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
813
776
|
if (error) {
|
|
814
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
777
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
815
778
|
}
|
|
816
779
|
return this.makeCalculationRequest(value);
|
|
817
780
|
}
|
|
@@ -832,11 +795,7 @@ export class VesselCatastrophicRuptureCalculation extends CalculationBase {
|
|
|
832
795
|
* Calculates the instantaneous release from a pressure vessel or storage tank. It includes expansion modelling to atmospheric conditions. The discharge mass, temperature, and other outputs are reported back as discharge records. The height of the release is located at the midpoint of the vessel.
|
|
833
796
|
*
|
|
834
797
|
*/
|
|
835
|
-
constructor(data: {
|
|
836
|
-
vessel: Entities.Vessel,
|
|
837
|
-
dischargeParameters: Entities.DischargeParameters
|
|
838
|
-
controller?: AbortController;
|
|
839
|
-
}) {
|
|
798
|
+
constructor(data: { vessel: Entities.Vessel; dischargeParameters: Entities.DischargeParameters; controller?: AbortController }) {
|
|
840
799
|
super(data.controller);
|
|
841
800
|
this.vessel = data.vessel;
|
|
842
801
|
this.dischargeParameters = data.dischargeParameters;
|
|
@@ -846,7 +805,7 @@ export class VesselCatastrophicRuptureCalculation extends CalculationBase {
|
|
|
846
805
|
try {
|
|
847
806
|
const request = new VesselCatastrophicRuptureCalculationRequest({
|
|
848
807
|
vessel: this.vessel,
|
|
849
|
-
dischargeParameters: this.dischargeParameters
|
|
808
|
+
dischargeParameters: this.dischargeParameters,
|
|
850
809
|
});
|
|
851
810
|
|
|
852
811
|
const schema = new VesselCatastrophicRuptureCalculationRequestSchema();
|
|
@@ -889,23 +848,23 @@ export class VesselCatastrophicRuptureCalculation extends CalculationBase {
|
|
|
889
848
|
}
|
|
890
849
|
|
|
891
850
|
toString() {
|
|
892
|
-
const parts = [
|
|
851
|
+
const parts = ['* VesselCatastrophicRupture'];
|
|
893
852
|
|
|
894
853
|
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
895
854
|
parts.push(`dischargeResult: ${String(this.dischargeResult)}`);
|
|
896
|
-
parts.push(
|
|
855
|
+
parts.push('*** dischargeRecords:');
|
|
897
856
|
parts.push(
|
|
898
857
|
this.dischargeRecords && this.dischargeRecords.length > 0
|
|
899
|
-
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join(
|
|
900
|
-
:
|
|
858
|
+
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join('\n')
|
|
859
|
+
: 'dischargeRecords does not contain any elements',
|
|
901
860
|
);
|
|
902
861
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
903
|
-
parts.push(
|
|
904
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
905
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
906
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
862
|
+
parts.push('*** messages:');
|
|
863
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
864
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
865
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
907
866
|
|
|
908
|
-
return parts.join(
|
|
867
|
+
return parts.join('\n');
|
|
909
868
|
}
|
|
910
869
|
}
|
|
911
870
|
|
|
@@ -919,13 +878,13 @@ export class VesselCatastrophicRuptureCalculationResponse extends CalculationRes
|
|
|
919
878
|
*
|
|
920
879
|
*/
|
|
921
880
|
constructor(data: {
|
|
922
|
-
exitMaterial: Entities.Material
|
|
923
|
-
dischargeResult: Entities.DischargeResult
|
|
924
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
925
|
-
resultCode: Enums.ResultCode
|
|
926
|
-
messages: string[]
|
|
927
|
-
calculationElapsedTime: number
|
|
928
|
-
operationId: string
|
|
881
|
+
exitMaterial: Entities.Material;
|
|
882
|
+
dischargeResult: Entities.DischargeResult;
|
|
883
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
884
|
+
resultCode: Enums.ResultCode;
|
|
885
|
+
messages: string[];
|
|
886
|
+
calculationElapsedTime: number;
|
|
887
|
+
operationId: string;
|
|
929
888
|
}) {
|
|
930
889
|
super();
|
|
931
890
|
this.exitMaterial = data.exitMaterial;
|
|
@@ -947,25 +906,23 @@ export class VesselCatastrophicRuptureCalculationResponse extends CalculationRes
|
|
|
947
906
|
this.dischargeResult.initialiseFromDictionary(data.dischargeResult as { [key: string]: unknown });
|
|
948
907
|
}
|
|
949
908
|
if (data.dischargeRecords && Array.isArray(data.dischargeRecords)) {
|
|
950
|
-
this.dischargeRecords = data.dischargeRecords.map(
|
|
951
|
-
(
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
|
|
909
|
+
this.dischargeRecords = data.dischargeRecords.map((item) => {
|
|
910
|
+
const record = new Entities.DischargeRecord();
|
|
911
|
+
record.initialiseFromDictionary(item);
|
|
912
|
+
return record;
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
959
916
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
960
917
|
}
|
|
961
918
|
this.messages = this.messages ?? [];
|
|
962
919
|
if (data.messages && Array.isArray(data.messages)) {
|
|
963
920
|
this.messages.push(...data.messages);
|
|
964
921
|
}
|
|
965
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
922
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
966
923
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
967
924
|
}
|
|
968
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
925
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
969
926
|
this.operationId = data.operationId as string;
|
|
970
927
|
}
|
|
971
928
|
}
|
|
@@ -1000,16 +957,16 @@ export class VesselCatastrophicRuptureCalculationResponseSchema {
|
|
|
1000
957
|
}).unknown(true);
|
|
1001
958
|
|
|
1002
959
|
this.propertyTypes = {
|
|
1003
|
-
exitMaterial:
|
|
1004
|
-
dischargeResult:
|
|
1005
|
-
dischargeRecords:
|
|
960
|
+
exitMaterial: 'Entities.Material',
|
|
961
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
962
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
1006
963
|
};
|
|
1007
964
|
}
|
|
1008
965
|
|
|
1009
966
|
validate(data: VesselCatastrophicRuptureCalculationResponseSchemaData): VesselCatastrophicRuptureCalculationResponse {
|
|
1010
967
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1011
968
|
if (error) {
|
|
1012
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
969
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1013
970
|
}
|
|
1014
971
|
return this.makeCalculationResponse(value);
|
|
1015
972
|
}
|
|
@@ -1034,11 +991,7 @@ class VesselLeakCalculationRequest extends CalculationRequestBase {
|
|
|
1034
991
|
* VesselLeak calculation request class.
|
|
1035
992
|
*
|
|
1036
993
|
*/
|
|
1037
|
-
constructor(data: {
|
|
1038
|
-
vessel: Entities.Vessel,
|
|
1039
|
-
leak: Entities.Leak,
|
|
1040
|
-
dischargeParameters: Entities.DischargeParameters
|
|
1041
|
-
}) {
|
|
994
|
+
constructor(data: { vessel: Entities.Vessel; leak: Entities.Leak; dischargeParameters: Entities.DischargeParameters }) {
|
|
1042
995
|
super();
|
|
1043
996
|
this.vessel = data.vessel;
|
|
1044
997
|
this.leak = data.leak;
|
|
@@ -1061,16 +1014,16 @@ export class VesselLeakCalculationRequestSchema {
|
|
|
1061
1014
|
}).unknown(true);
|
|
1062
1015
|
|
|
1063
1016
|
this.propertyTypes = {
|
|
1064
|
-
vessel:
|
|
1065
|
-
leak:
|
|
1066
|
-
dischargeParameters:
|
|
1017
|
+
vessel: 'Entities.Vessel',
|
|
1018
|
+
leak: 'Entities.Leak',
|
|
1019
|
+
dischargeParameters: 'Entities.DischargeParameters',
|
|
1067
1020
|
};
|
|
1068
1021
|
}
|
|
1069
1022
|
|
|
1070
1023
|
validate(data: VesselLeakCalculationRequestSchemaData): VesselLeakCalculationRequest {
|
|
1071
1024
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1072
1025
|
if (error) {
|
|
1073
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1026
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1074
1027
|
}
|
|
1075
1028
|
return this.makeCalculationRequest(value);
|
|
1076
1029
|
}
|
|
@@ -1092,12 +1045,7 @@ export class VesselLeakCalculation extends CalculationBase {
|
|
|
1092
1045
|
* Calculates the steady state or time-varying leak from a pressure vessel or storage tank. It includes expansion modelling (from the vessel orifice to atmospheric conditions). The discharge rate, temperature, and other time-dependent outputs at a particular time are reported back as discharge records. For steady-state there are always two DischargeRecords generated; for time-varying the number can vary.
|
|
1093
1046
|
*
|
|
1094
1047
|
*/
|
|
1095
|
-
constructor(data: {
|
|
1096
|
-
vessel: Entities.Vessel,
|
|
1097
|
-
leak: Entities.Leak,
|
|
1098
|
-
dischargeParameters: Entities.DischargeParameters
|
|
1099
|
-
controller?: AbortController;
|
|
1100
|
-
}) {
|
|
1048
|
+
constructor(data: { vessel: Entities.Vessel; leak: Entities.Leak; dischargeParameters: Entities.DischargeParameters; controller?: AbortController }) {
|
|
1101
1049
|
super(data.controller);
|
|
1102
1050
|
this.vessel = data.vessel;
|
|
1103
1051
|
this.leak = data.leak;
|
|
@@ -1109,7 +1057,7 @@ export class VesselLeakCalculation extends CalculationBase {
|
|
|
1109
1057
|
const request = new VesselLeakCalculationRequest({
|
|
1110
1058
|
vessel: this.vessel,
|
|
1111
1059
|
leak: this.leak,
|
|
1112
|
-
dischargeParameters: this.dischargeParameters
|
|
1060
|
+
dischargeParameters: this.dischargeParameters,
|
|
1113
1061
|
});
|
|
1114
1062
|
|
|
1115
1063
|
const schema = new VesselLeakCalculationRequestSchema();
|
|
@@ -1152,23 +1100,23 @@ export class VesselLeakCalculation extends CalculationBase {
|
|
|
1152
1100
|
}
|
|
1153
1101
|
|
|
1154
1102
|
toString() {
|
|
1155
|
-
const parts = [
|
|
1103
|
+
const parts = ['* VesselLeak'];
|
|
1156
1104
|
|
|
1157
1105
|
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
1158
1106
|
parts.push(`dischargeResult: ${String(this.dischargeResult)}`);
|
|
1159
|
-
parts.push(
|
|
1107
|
+
parts.push('*** dischargeRecords:');
|
|
1160
1108
|
parts.push(
|
|
1161
1109
|
this.dischargeRecords && this.dischargeRecords.length > 0
|
|
1162
|
-
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join(
|
|
1163
|
-
:
|
|
1110
|
+
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join('\n')
|
|
1111
|
+
: 'dischargeRecords does not contain any elements',
|
|
1164
1112
|
);
|
|
1165
1113
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1166
|
-
parts.push(
|
|
1167
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
1168
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
1169
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
1114
|
+
parts.push('*** messages:');
|
|
1115
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
1116
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
1117
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
1170
1118
|
|
|
1171
|
-
return parts.join(
|
|
1119
|
+
return parts.join('\n');
|
|
1172
1120
|
}
|
|
1173
1121
|
}
|
|
1174
1122
|
|
|
@@ -1182,13 +1130,13 @@ export class VesselLeakCalculationResponse extends CalculationResponseBase {
|
|
|
1182
1130
|
*
|
|
1183
1131
|
*/
|
|
1184
1132
|
constructor(data: {
|
|
1185
|
-
exitMaterial: Entities.Material
|
|
1186
|
-
dischargeResult: Entities.DischargeResult
|
|
1187
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
1188
|
-
resultCode: Enums.ResultCode
|
|
1189
|
-
messages: string[]
|
|
1190
|
-
calculationElapsedTime: number
|
|
1191
|
-
operationId: string
|
|
1133
|
+
exitMaterial: Entities.Material;
|
|
1134
|
+
dischargeResult: Entities.DischargeResult;
|
|
1135
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
1136
|
+
resultCode: Enums.ResultCode;
|
|
1137
|
+
messages: string[];
|
|
1138
|
+
calculationElapsedTime: number;
|
|
1139
|
+
operationId: string;
|
|
1192
1140
|
}) {
|
|
1193
1141
|
super();
|
|
1194
1142
|
this.exitMaterial = data.exitMaterial;
|
|
@@ -1210,25 +1158,23 @@ export class VesselLeakCalculationResponse extends CalculationResponseBase {
|
|
|
1210
1158
|
this.dischargeResult.initialiseFromDictionary(data.dischargeResult as { [key: string]: unknown });
|
|
1211
1159
|
}
|
|
1212
1160
|
if (data.dischargeRecords && Array.isArray(data.dischargeRecords)) {
|
|
1213
|
-
this.dischargeRecords = data.dischargeRecords.map(
|
|
1214
|
-
(
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
-
if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
|
|
1161
|
+
this.dischargeRecords = data.dischargeRecords.map((item) => {
|
|
1162
|
+
const record = new Entities.DischargeRecord();
|
|
1163
|
+
record.initialiseFromDictionary(item);
|
|
1164
|
+
return record;
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
1222
1168
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1223
1169
|
}
|
|
1224
1170
|
this.messages = this.messages ?? [];
|
|
1225
1171
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1226
1172
|
this.messages.push(...data.messages);
|
|
1227
1173
|
}
|
|
1228
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
1174
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
1229
1175
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1230
1176
|
}
|
|
1231
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
1177
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
1232
1178
|
this.operationId = data.operationId as string;
|
|
1233
1179
|
}
|
|
1234
1180
|
}
|
|
@@ -1263,16 +1209,16 @@ export class VesselLeakCalculationResponseSchema {
|
|
|
1263
1209
|
}).unknown(true);
|
|
1264
1210
|
|
|
1265
1211
|
this.propertyTypes = {
|
|
1266
|
-
exitMaterial:
|
|
1267
|
-
dischargeResult:
|
|
1268
|
-
dischargeRecords:
|
|
1212
|
+
exitMaterial: 'Entities.Material',
|
|
1213
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
1214
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
1269
1215
|
};
|
|
1270
1216
|
}
|
|
1271
1217
|
|
|
1272
1218
|
validate(data: VesselLeakCalculationResponseSchemaData): VesselLeakCalculationResponse {
|
|
1273
1219
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1274
1220
|
if (error) {
|
|
1275
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1221
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1276
1222
|
}
|
|
1277
1223
|
return this.makeCalculationResponse(value);
|
|
1278
1224
|
}
|
|
@@ -1297,11 +1243,7 @@ class VesselLineRuptureCalculationRequest extends CalculationRequestBase {
|
|
|
1297
1243
|
* VesselLineRupture calculation request class.
|
|
1298
1244
|
*
|
|
1299
1245
|
*/
|
|
1300
|
-
constructor(data: {
|
|
1301
|
-
vessel: Entities.Vessel,
|
|
1302
|
-
lineRupture: Entities.LineRupture,
|
|
1303
|
-
dischargeParameters: Entities.DischargeParameters
|
|
1304
|
-
}) {
|
|
1246
|
+
constructor(data: { vessel: Entities.Vessel; lineRupture: Entities.LineRupture; dischargeParameters: Entities.DischargeParameters }) {
|
|
1305
1247
|
super();
|
|
1306
1248
|
this.vessel = data.vessel;
|
|
1307
1249
|
this.lineRupture = data.lineRupture;
|
|
@@ -1324,16 +1266,16 @@ export class VesselLineRuptureCalculationRequestSchema {
|
|
|
1324
1266
|
}).unknown(true);
|
|
1325
1267
|
|
|
1326
1268
|
this.propertyTypes = {
|
|
1327
|
-
vessel:
|
|
1328
|
-
lineRupture:
|
|
1329
|
-
dischargeParameters:
|
|
1269
|
+
vessel: 'Entities.Vessel',
|
|
1270
|
+
lineRupture: 'Entities.LineRupture',
|
|
1271
|
+
dischargeParameters: 'Entities.DischargeParameters',
|
|
1330
1272
|
};
|
|
1331
1273
|
}
|
|
1332
1274
|
|
|
1333
1275
|
validate(data: VesselLineRuptureCalculationRequestSchemaData): VesselLineRuptureCalculationRequest {
|
|
1334
1276
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1335
1277
|
if (error) {
|
|
1336
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1278
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1337
1279
|
}
|
|
1338
1280
|
return this.makeCalculationRequest(value);
|
|
1339
1281
|
}
|
|
@@ -1355,12 +1297,7 @@ export class VesselLineRuptureCalculation extends CalculationBase {
|
|
|
1355
1297
|
* Calculations of discharge from a short pipe attached to a vessel.
|
|
1356
1298
|
*
|
|
1357
1299
|
*/
|
|
1358
|
-
constructor(data: {
|
|
1359
|
-
vessel: Entities.Vessel,
|
|
1360
|
-
lineRupture: Entities.LineRupture,
|
|
1361
|
-
dischargeParameters: Entities.DischargeParameters
|
|
1362
|
-
controller?: AbortController;
|
|
1363
|
-
}) {
|
|
1300
|
+
constructor(data: { vessel: Entities.Vessel; lineRupture: Entities.LineRupture; dischargeParameters: Entities.DischargeParameters; controller?: AbortController }) {
|
|
1364
1301
|
super(data.controller);
|
|
1365
1302
|
this.vessel = data.vessel;
|
|
1366
1303
|
this.lineRupture = data.lineRupture;
|
|
@@ -1372,7 +1309,7 @@ export class VesselLineRuptureCalculation extends CalculationBase {
|
|
|
1372
1309
|
const request = new VesselLineRuptureCalculationRequest({
|
|
1373
1310
|
vessel: this.vessel,
|
|
1374
1311
|
lineRupture: this.lineRupture,
|
|
1375
|
-
dischargeParameters: this.dischargeParameters
|
|
1312
|
+
dischargeParameters: this.dischargeParameters,
|
|
1376
1313
|
});
|
|
1377
1314
|
|
|
1378
1315
|
const schema = new VesselLineRuptureCalculationRequestSchema();
|
|
@@ -1415,23 +1352,23 @@ export class VesselLineRuptureCalculation extends CalculationBase {
|
|
|
1415
1352
|
}
|
|
1416
1353
|
|
|
1417
1354
|
toString() {
|
|
1418
|
-
const parts = [
|
|
1355
|
+
const parts = ['* VesselLineRupture'];
|
|
1419
1356
|
|
|
1420
1357
|
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
1421
1358
|
parts.push(`dischargeResult: ${String(this.dischargeResult)}`);
|
|
1422
|
-
parts.push(
|
|
1359
|
+
parts.push('*** dischargeRecords:');
|
|
1423
1360
|
parts.push(
|
|
1424
1361
|
this.dischargeRecords && this.dischargeRecords.length > 0
|
|
1425
|
-
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join(
|
|
1426
|
-
:
|
|
1362
|
+
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join('\n')
|
|
1363
|
+
: 'dischargeRecords does not contain any elements',
|
|
1427
1364
|
);
|
|
1428
1365
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1429
|
-
parts.push(
|
|
1430
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
1431
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
1432
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
1366
|
+
parts.push('*** messages:');
|
|
1367
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
1368
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
1369
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
1433
1370
|
|
|
1434
|
-
return parts.join(
|
|
1371
|
+
return parts.join('\n');
|
|
1435
1372
|
}
|
|
1436
1373
|
}
|
|
1437
1374
|
|
|
@@ -1445,13 +1382,13 @@ export class VesselLineRuptureCalculationResponse extends CalculationResponseBas
|
|
|
1445
1382
|
*
|
|
1446
1383
|
*/
|
|
1447
1384
|
constructor(data: {
|
|
1448
|
-
exitMaterial: Entities.Material
|
|
1449
|
-
dischargeResult: Entities.DischargeResult
|
|
1450
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
1451
|
-
resultCode: Enums.ResultCode
|
|
1452
|
-
messages: string[]
|
|
1453
|
-
calculationElapsedTime: number
|
|
1454
|
-
operationId: string
|
|
1385
|
+
exitMaterial: Entities.Material;
|
|
1386
|
+
dischargeResult: Entities.DischargeResult;
|
|
1387
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
1388
|
+
resultCode: Enums.ResultCode;
|
|
1389
|
+
messages: string[];
|
|
1390
|
+
calculationElapsedTime: number;
|
|
1391
|
+
operationId: string;
|
|
1455
1392
|
}) {
|
|
1456
1393
|
super();
|
|
1457
1394
|
this.exitMaterial = data.exitMaterial;
|
|
@@ -1473,25 +1410,23 @@ export class VesselLineRuptureCalculationResponse extends CalculationResponseBas
|
|
|
1473
1410
|
this.dischargeResult.initialiseFromDictionary(data.dischargeResult as { [key: string]: unknown });
|
|
1474
1411
|
}
|
|
1475
1412
|
if (data.dischargeRecords && Array.isArray(data.dischargeRecords)) {
|
|
1476
|
-
this.dischargeRecords = data.dischargeRecords.map(
|
|
1477
|
-
(
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
}
|
|
1484
|
-
if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
|
|
1413
|
+
this.dischargeRecords = data.dischargeRecords.map((item) => {
|
|
1414
|
+
const record = new Entities.DischargeRecord();
|
|
1415
|
+
record.initialiseFromDictionary(item);
|
|
1416
|
+
return record;
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
1485
1420
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1486
1421
|
}
|
|
1487
1422
|
this.messages = this.messages ?? [];
|
|
1488
1423
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1489
1424
|
this.messages.push(...data.messages);
|
|
1490
1425
|
}
|
|
1491
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
1426
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
1492
1427
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1493
1428
|
}
|
|
1494
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
1429
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
1495
1430
|
this.operationId = data.operationId as string;
|
|
1496
1431
|
}
|
|
1497
1432
|
}
|
|
@@ -1526,16 +1461,16 @@ export class VesselLineRuptureCalculationResponseSchema {
|
|
|
1526
1461
|
}).unknown(true);
|
|
1527
1462
|
|
|
1528
1463
|
this.propertyTypes = {
|
|
1529
|
-
exitMaterial:
|
|
1530
|
-
dischargeResult:
|
|
1531
|
-
dischargeRecords:
|
|
1464
|
+
exitMaterial: 'Entities.Material',
|
|
1465
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
1466
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
1532
1467
|
};
|
|
1533
1468
|
}
|
|
1534
1469
|
|
|
1535
1470
|
validate(data: VesselLineRuptureCalculationResponseSchemaData): VesselLineRuptureCalculationResponse {
|
|
1536
1471
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1537
1472
|
if (error) {
|
|
1538
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1473
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1539
1474
|
}
|
|
1540
1475
|
return this.makeCalculationResponse(value);
|
|
1541
1476
|
}
|
|
@@ -1560,11 +1495,7 @@ class VesselReliefValveCalculationRequest extends CalculationRequestBase {
|
|
|
1560
1495
|
* VesselReliefValve calculation request class.
|
|
1561
1496
|
*
|
|
1562
1497
|
*/
|
|
1563
|
-
constructor(data: {
|
|
1564
|
-
vessel: Entities.Vessel,
|
|
1565
|
-
reliefValve: Entities.ReliefValve,
|
|
1566
|
-
dischargeParameters: Entities.DischargeParameters
|
|
1567
|
-
}) {
|
|
1498
|
+
constructor(data: { vessel: Entities.Vessel; reliefValve: Entities.ReliefValve; dischargeParameters: Entities.DischargeParameters }) {
|
|
1568
1499
|
super();
|
|
1569
1500
|
this.vessel = data.vessel;
|
|
1570
1501
|
this.reliefValve = data.reliefValve;
|
|
@@ -1587,16 +1518,16 @@ export class VesselReliefValveCalculationRequestSchema {
|
|
|
1587
1518
|
}).unknown(true);
|
|
1588
1519
|
|
|
1589
1520
|
this.propertyTypes = {
|
|
1590
|
-
vessel:
|
|
1591
|
-
reliefValve:
|
|
1592
|
-
dischargeParameters:
|
|
1521
|
+
vessel: 'Entities.Vessel',
|
|
1522
|
+
reliefValve: 'Entities.ReliefValve',
|
|
1523
|
+
dischargeParameters: 'Entities.DischargeParameters',
|
|
1593
1524
|
};
|
|
1594
1525
|
}
|
|
1595
1526
|
|
|
1596
1527
|
validate(data: VesselReliefValveCalculationRequestSchemaData): VesselReliefValveCalculationRequest {
|
|
1597
1528
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1598
1529
|
if (error) {
|
|
1599
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1530
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1600
1531
|
}
|
|
1601
1532
|
return this.makeCalculationRequest(value);
|
|
1602
1533
|
}
|
|
@@ -1618,12 +1549,7 @@ export class VesselReliefValveCalculation extends CalculationBase {
|
|
|
1618
1549
|
* Calculations of venting from a relief valve attached to a vessel.
|
|
1619
1550
|
*
|
|
1620
1551
|
*/
|
|
1621
|
-
constructor(data: {
|
|
1622
|
-
vessel: Entities.Vessel,
|
|
1623
|
-
reliefValve: Entities.ReliefValve,
|
|
1624
|
-
dischargeParameters: Entities.DischargeParameters
|
|
1625
|
-
controller?: AbortController;
|
|
1626
|
-
}) {
|
|
1552
|
+
constructor(data: { vessel: Entities.Vessel; reliefValve: Entities.ReliefValve; dischargeParameters: Entities.DischargeParameters; controller?: AbortController }) {
|
|
1627
1553
|
super(data.controller);
|
|
1628
1554
|
this.vessel = data.vessel;
|
|
1629
1555
|
this.reliefValve = data.reliefValve;
|
|
@@ -1635,7 +1561,7 @@ export class VesselReliefValveCalculation extends CalculationBase {
|
|
|
1635
1561
|
const request = new VesselReliefValveCalculationRequest({
|
|
1636
1562
|
vessel: this.vessel,
|
|
1637
1563
|
reliefValve: this.reliefValve,
|
|
1638
|
-
dischargeParameters: this.dischargeParameters
|
|
1564
|
+
dischargeParameters: this.dischargeParameters,
|
|
1639
1565
|
});
|
|
1640
1566
|
|
|
1641
1567
|
const schema = new VesselReliefValveCalculationRequestSchema();
|
|
@@ -1678,23 +1604,23 @@ export class VesselReliefValveCalculation extends CalculationBase {
|
|
|
1678
1604
|
}
|
|
1679
1605
|
|
|
1680
1606
|
toString() {
|
|
1681
|
-
const parts = [
|
|
1607
|
+
const parts = ['* VesselReliefValve'];
|
|
1682
1608
|
|
|
1683
1609
|
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
1684
1610
|
parts.push(`dischargeResult: ${String(this.dischargeResult)}`);
|
|
1685
|
-
parts.push(
|
|
1611
|
+
parts.push('*** dischargeRecords:');
|
|
1686
1612
|
parts.push(
|
|
1687
1613
|
this.dischargeRecords && this.dischargeRecords.length > 0
|
|
1688
|
-
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join(
|
|
1689
|
-
:
|
|
1614
|
+
? this.dischargeRecords.map((point) => `dischargeRecordsElement: ${point}`).join('\n')
|
|
1615
|
+
: 'dischargeRecords does not contain any elements',
|
|
1690
1616
|
);
|
|
1691
1617
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1692
|
-
parts.push(
|
|
1693
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
1694
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
1695
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
1618
|
+
parts.push('*** messages:');
|
|
1619
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
1620
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
1621
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
1696
1622
|
|
|
1697
|
-
return parts.join(
|
|
1623
|
+
return parts.join('\n');
|
|
1698
1624
|
}
|
|
1699
1625
|
}
|
|
1700
1626
|
|
|
@@ -1708,13 +1634,13 @@ export class VesselReliefValveCalculationResponse extends CalculationResponseBas
|
|
|
1708
1634
|
*
|
|
1709
1635
|
*/
|
|
1710
1636
|
constructor(data: {
|
|
1711
|
-
exitMaterial: Entities.Material
|
|
1712
|
-
dischargeResult: Entities.DischargeResult
|
|
1713
|
-
dischargeRecords: Entities.DischargeRecord[]
|
|
1714
|
-
resultCode: Enums.ResultCode
|
|
1715
|
-
messages: string[]
|
|
1716
|
-
calculationElapsedTime: number
|
|
1717
|
-
operationId: string
|
|
1637
|
+
exitMaterial: Entities.Material;
|
|
1638
|
+
dischargeResult: Entities.DischargeResult;
|
|
1639
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
1640
|
+
resultCode: Enums.ResultCode;
|
|
1641
|
+
messages: string[];
|
|
1642
|
+
calculationElapsedTime: number;
|
|
1643
|
+
operationId: string;
|
|
1718
1644
|
}) {
|
|
1719
1645
|
super();
|
|
1720
1646
|
this.exitMaterial = data.exitMaterial;
|
|
@@ -1736,25 +1662,23 @@ export class VesselReliefValveCalculationResponse extends CalculationResponseBas
|
|
|
1736
1662
|
this.dischargeResult.initialiseFromDictionary(data.dischargeResult as { [key: string]: unknown });
|
|
1737
1663
|
}
|
|
1738
1664
|
if (data.dischargeRecords && Array.isArray(data.dischargeRecords)) {
|
|
1739
|
-
this.dischargeRecords = data.dischargeRecords.map(
|
|
1740
|
-
(
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
}
|
|
1747
|
-
if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
|
|
1665
|
+
this.dischargeRecords = data.dischargeRecords.map((item) => {
|
|
1666
|
+
const record = new Entities.DischargeRecord();
|
|
1667
|
+
record.initialiseFromDictionary(item);
|
|
1668
|
+
return record;
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
1748
1672
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1749
1673
|
}
|
|
1750
1674
|
this.messages = this.messages ?? [];
|
|
1751
1675
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1752
1676
|
this.messages.push(...data.messages);
|
|
1753
1677
|
}
|
|
1754
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
1678
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
1755
1679
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1756
1680
|
}
|
|
1757
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
1681
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
1758
1682
|
this.operationId = data.operationId as string;
|
|
1759
1683
|
}
|
|
1760
1684
|
}
|
|
@@ -1789,16 +1713,16 @@ export class VesselReliefValveCalculationResponseSchema {
|
|
|
1789
1713
|
}).unknown(true);
|
|
1790
1714
|
|
|
1791
1715
|
this.propertyTypes = {
|
|
1792
|
-
exitMaterial:
|
|
1793
|
-
dischargeResult:
|
|
1794
|
-
dischargeRecords:
|
|
1716
|
+
exitMaterial: 'Entities.Material',
|
|
1717
|
+
dischargeResult: 'Entities.DischargeResult',
|
|
1718
|
+
dischargeRecords: 'Entities.DischargeRecord[]',
|
|
1795
1719
|
};
|
|
1796
1720
|
}
|
|
1797
1721
|
|
|
1798
1722
|
validate(data: VesselReliefValveCalculationResponseSchemaData): VesselReliefValveCalculationResponse {
|
|
1799
1723
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1800
1724
|
if (error) {
|
|
1801
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1725
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1802
1726
|
}
|
|
1803
1727
|
return this.makeCalculationResponse(value);
|
|
1804
1728
|
}
|
|
@@ -1821,10 +1745,7 @@ class VesselStateCalculationRequest extends CalculationRequestBase {
|
|
|
1821
1745
|
* VesselState calculation request class.
|
|
1822
1746
|
*
|
|
1823
1747
|
*/
|
|
1824
|
-
constructor(data: {
|
|
1825
|
-
material: Entities.Material,
|
|
1826
|
-
materialState: Entities.State
|
|
1827
|
-
}) {
|
|
1748
|
+
constructor(data: { material: Entities.Material; materialState: Entities.State }) {
|
|
1828
1749
|
super();
|
|
1829
1750
|
this.material = data.material;
|
|
1830
1751
|
this.materialState = data.materialState;
|
|
@@ -1845,15 +1766,15 @@ export class VesselStateCalculationRequestSchema {
|
|
|
1845
1766
|
}).unknown(true);
|
|
1846
1767
|
|
|
1847
1768
|
this.propertyTypes = {
|
|
1848
|
-
material:
|
|
1849
|
-
materialState:
|
|
1769
|
+
material: 'Entities.Material',
|
|
1770
|
+
materialState: 'Entities.State',
|
|
1850
1771
|
};
|
|
1851
1772
|
}
|
|
1852
1773
|
|
|
1853
1774
|
validate(data: VesselStateCalculationRequestSchemaData): VesselStateCalculationRequest {
|
|
1854
1775
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1855
1776
|
if (error) {
|
|
1856
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1777
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
1857
1778
|
}
|
|
1858
1779
|
return this.makeCalculationRequest(value);
|
|
1859
1780
|
}
|
|
@@ -1875,11 +1796,7 @@ the vessel conditions (e.g. Pure gas, Stratified Two-Phase vessel, Pressurised L
|
|
|
1875
1796
|
source term models: vessel leak and vessel catastrophic rupture.
|
|
1876
1797
|
*
|
|
1877
1798
|
*/
|
|
1878
|
-
constructor(data: {
|
|
1879
|
-
material: Entities.Material,
|
|
1880
|
-
materialState: Entities.State
|
|
1881
|
-
controller?: AbortController;
|
|
1882
|
-
}) {
|
|
1799
|
+
constructor(data: { material: Entities.Material; materialState: Entities.State; controller?: AbortController }) {
|
|
1883
1800
|
super(data.controller);
|
|
1884
1801
|
this.material = data.material;
|
|
1885
1802
|
this.materialState = data.materialState;
|
|
@@ -1889,7 +1806,7 @@ source term models: vessel leak and vessel catastrophic rupture.
|
|
|
1889
1806
|
try {
|
|
1890
1807
|
const request = new VesselStateCalculationRequest({
|
|
1891
1808
|
material: this.material,
|
|
1892
|
-
materialState: this.materialState
|
|
1809
|
+
materialState: this.materialState,
|
|
1893
1810
|
});
|
|
1894
1811
|
|
|
1895
1812
|
const schema = new VesselStateCalculationRequestSchema();
|
|
@@ -1931,17 +1848,17 @@ source term models: vessel leak and vessel catastrophic rupture.
|
|
|
1931
1848
|
}
|
|
1932
1849
|
|
|
1933
1850
|
toString() {
|
|
1934
|
-
const parts = [
|
|
1851
|
+
const parts = ['* VesselState'];
|
|
1935
1852
|
|
|
1936
1853
|
parts.push(`vesselConditions: ${String(this.vesselConditions)}`);
|
|
1937
1854
|
parts.push(`outputState: ${String(this.outputState)}`);
|
|
1938
1855
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1939
|
-
parts.push(
|
|
1940
|
-
parts.push(`messages: ${this.messages !== undefined ? this.messages :
|
|
1941
|
-
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime :
|
|
1942
|
-
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId :
|
|
1856
|
+
parts.push('*** messages:');
|
|
1857
|
+
parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
|
|
1858
|
+
parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
|
|
1859
|
+
parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
|
|
1943
1860
|
|
|
1944
|
-
return parts.join(
|
|
1861
|
+
return parts.join('\n');
|
|
1945
1862
|
}
|
|
1946
1863
|
}
|
|
1947
1864
|
|
|
@@ -1953,14 +1870,7 @@ export class VesselStateCalculationResponse extends CalculationResponseBase {
|
|
|
1953
1870
|
* VesselState calculation response class.
|
|
1954
1871
|
*
|
|
1955
1872
|
*/
|
|
1956
|
-
constructor(data: {
|
|
1957
|
-
vesselConditions: Enums.VesselConditions,
|
|
1958
|
-
outputState: Entities.State,
|
|
1959
|
-
resultCode: Enums.ResultCode,
|
|
1960
|
-
messages: string[],
|
|
1961
|
-
calculationElapsedTime: number,
|
|
1962
|
-
operationId: string
|
|
1963
|
-
}) {
|
|
1873
|
+
constructor(data: { vesselConditions: Enums.VesselConditions; outputState: Entities.State; resultCode: Enums.ResultCode; messages: string[]; calculationElapsedTime: number; operationId: string }) {
|
|
1964
1874
|
super();
|
|
1965
1875
|
this.vesselConditions = data.vesselConditions;
|
|
1966
1876
|
this.outputState = data.outputState;
|
|
@@ -1971,24 +1881,24 @@ export class VesselStateCalculationResponse extends CalculationResponseBase {
|
|
|
1971
1881
|
}
|
|
1972
1882
|
|
|
1973
1883
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1974
|
-
if (data.vesselConditions !== undefined && (typeof data.vesselConditions ===
|
|
1884
|
+
if (data.vesselConditions !== undefined && (typeof data.vesselConditions === 'string' || typeof data.vesselConditions === 'number')) {
|
|
1975
1885
|
this.vesselConditions = data.vesselConditions as Enums.VesselConditions;
|
|
1976
1886
|
}
|
|
1977
1887
|
if (data.outputState) {
|
|
1978
1888
|
this.outputState = new Entities.State();
|
|
1979
1889
|
this.outputState.initialiseFromDictionary(data.outputState as { [key: string]: unknown });
|
|
1980
1890
|
}
|
|
1981
|
-
if (data.resultCode !== undefined && (typeof data.resultCode ===
|
|
1891
|
+
if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
|
|
1982
1892
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1983
1893
|
}
|
|
1984
1894
|
this.messages = this.messages ?? [];
|
|
1985
1895
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1986
1896
|
this.messages.push(...data.messages);
|
|
1987
1897
|
}
|
|
1988
|
-
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime ===
|
|
1898
|
+
if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
|
|
1989
1899
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1990
1900
|
}
|
|
1991
|
-
if (data.operationId !== undefined && typeof data.operationId ===
|
|
1901
|
+
if (data.operationId !== undefined && typeof data.operationId === 'string') {
|
|
1992
1902
|
this.operationId = data.operationId as string;
|
|
1993
1903
|
}
|
|
1994
1904
|
}
|
|
@@ -2021,15 +1931,15 @@ export class VesselStateCalculationResponseSchema {
|
|
|
2021
1931
|
}).unknown(true);
|
|
2022
1932
|
|
|
2023
1933
|
this.propertyTypes = {
|
|
2024
|
-
vesselConditions:
|
|
2025
|
-
outputState:
|
|
1934
|
+
vesselConditions: 'Enums.VesselConditions',
|
|
1935
|
+
outputState: 'Entities.State',
|
|
2026
1936
|
};
|
|
2027
1937
|
}
|
|
2028
1938
|
|
|
2029
1939
|
validate(data: VesselStateCalculationResponseSchemaData): VesselStateCalculationResponse {
|
|
2030
1940
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2031
1941
|
if (error) {
|
|
2032
|
-
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(
|
|
1942
|
+
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
|
|
2033
1943
|
}
|
|
2034
1944
|
return this.makeCalculationResponse(value);
|
|
2035
1945
|
}
|