@dnv-plant/typescriptpws 1.0.85 → 1.0.86
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 +2 -2
- package/src/calculations/discharge.ts +2 -2
- package/src/calculations/dispersion.ts +2 -2
- package/src/calculations/dispersionView.ts +2 -2
- package/src/calculations/fireball.ts +2 -2
- package/src/calculations/jetFire.ts +2 -2
- package/src/calculations/lateExplosion.ts +2 -2
- package/src/calculations/linkedRunners.ts +337 -337
- package/src/calculations/poolFire.ts +2 -2
- package/src/calculations/properties.ts +2 -2
- package/src/calculations/radiation.ts +2 -2
- package/src/calculations/standalones.ts +2 -2
- package/src/calculations/toxics.ts +2 -2
- package/src/calculations/utilities.ts +2 -2
- package/src/constants.ts +2 -2
- package/src/entities.ts +2 -2
- package/src/entity-schemas.ts +2 -2
- package/src/enums.ts +2 -2
- package/src/materials.ts +2 -2
- package/src/utilities.ts +2 -2
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
7
|
* Please contact DNV if you believe changes are required.
|
|
8
8
|
*
|
|
9
|
-
* Version: 1.0.
|
|
10
|
-
* Date/time:
|
|
9
|
+
* Version: 1.0.86
|
|
10
|
+
* Date/time: 10 Jul 2025 09:49:06
|
|
11
11
|
* Template: templates/typescriptpws/calculations.razor.
|
|
12
12
|
***********************************************************************/
|
|
13
13
|
|
|
@@ -153,11 +153,15 @@ class CalculationFailedResponseSchema {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
export interface
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
export interface UserDefinedSourceLinkedRunCalculationRequestSchemaData {
|
|
157
|
+
material: Entities.Material;
|
|
158
|
+
dischargeResult: Entities.DischargeResult;
|
|
159
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
160
|
+
dischargeRecordCount: number;
|
|
161
|
+
phaseToBeReleased: Enums.Phase;
|
|
162
|
+
dischargeParameters: Entities.DischargeParameters;
|
|
160
163
|
substrate: Entities.Substrate;
|
|
164
|
+
weather: Entities.Weather;
|
|
161
165
|
dispersionParameters: Entities.DispersionParameters[];
|
|
162
166
|
dispersionParameterCount: number;
|
|
163
167
|
endPointConcentration: number;
|
|
@@ -175,11 +179,15 @@ export interface BESSLinkedRunnerCalculationRequestSchemaData {
|
|
|
175
179
|
explosionConfinedVolumeCount: number;
|
|
176
180
|
}
|
|
177
181
|
|
|
178
|
-
class
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
class UserDefinedSourceLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
183
|
+
material: Entities.Material;
|
|
184
|
+
dischargeResult: Entities.DischargeResult;
|
|
185
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
186
|
+
dischargeRecordCount: number;
|
|
187
|
+
phaseToBeReleased: Enums.Phase;
|
|
188
|
+
dischargeParameters: Entities.DischargeParameters;
|
|
182
189
|
substrate: Entities.Substrate;
|
|
190
|
+
weather: Entities.Weather;
|
|
183
191
|
dispersionParameters: Entities.DispersionParameters[];
|
|
184
192
|
dispersionParameterCount: number;
|
|
185
193
|
endPointConcentration: number;
|
|
@@ -197,12 +205,16 @@ class BESSLinkedRunnerCalculationRequest extends CalculationRequestBase {
|
|
|
197
205
|
explosionConfinedVolumeCount: number;
|
|
198
206
|
|
|
199
207
|
/**
|
|
200
|
-
*
|
|
208
|
+
* UserDefinedSourceLinkedRun calculation request class.
|
|
201
209
|
*
|
|
202
|
-
* @param {Entities.
|
|
203
|
-
* @param {Entities.
|
|
204
|
-
* @param {Entities.
|
|
210
|
+
* @param {Entities.Material} material - a material entity.
|
|
211
|
+
* @param {Entities.DischargeResult} dischargeResult - Scalar discharge data.
|
|
212
|
+
* @param {Entities.DischargeRecord[]} dischargeRecords - an array of discharge records.
|
|
213
|
+
* @param {number} dischargeRecordCount - Number of discharge records.
|
|
214
|
+
* @param {Enums.Phase} phaseToBeReleased - Phase to be released ( vapour, two-phase or liquid).
|
|
215
|
+
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
205
216
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
217
|
+
* @param {Entities.Weather} weather - a weather entity.
|
|
206
218
|
* @param {Entities.DispersionParameters[]} dispersionParameters - an array of dispersion parameters.
|
|
207
219
|
* @param {number} dispersionParameterCount - Number of dispersion parameters.
|
|
208
220
|
* @param {number} endPointConcentration - Concentration at which the dispersion calculations will terminate (v/v fraction).
|
|
@@ -220,10 +232,14 @@ class BESSLinkedRunnerCalculationRequest extends CalculationRequestBase {
|
|
|
220
232
|
* @param {number} explosionConfinedVolumeCount - Number of explosion confined volumes.
|
|
221
233
|
*/
|
|
222
234
|
constructor(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
235
|
+
material: Entities.Material,
|
|
236
|
+
dischargeResult: Entities.DischargeResult,
|
|
237
|
+
dischargeRecords: Entities.DischargeRecord[],
|
|
238
|
+
dischargeRecordCount: number,
|
|
239
|
+
phaseToBeReleased: Enums.Phase,
|
|
240
|
+
dischargeParameters: Entities.DischargeParameters,
|
|
226
241
|
substrate: Entities.Substrate,
|
|
242
|
+
weather: Entities.Weather,
|
|
227
243
|
dispersionParameters: Entities.DispersionParameters[],
|
|
228
244
|
dispersionParameterCount: number,
|
|
229
245
|
endPointConcentration: number,
|
|
@@ -241,10 +257,14 @@ class BESSLinkedRunnerCalculationRequest extends CalculationRequestBase {
|
|
|
241
257
|
explosionConfinedVolumeCount: number
|
|
242
258
|
) {
|
|
243
259
|
super();
|
|
244
|
-
this.
|
|
245
|
-
this.
|
|
246
|
-
this.
|
|
260
|
+
this.material = material;
|
|
261
|
+
this.dischargeResult = dischargeResult;
|
|
262
|
+
this.dischargeRecords = dischargeRecords;
|
|
263
|
+
this.dischargeRecordCount = dischargeRecordCount;
|
|
264
|
+
this.phaseToBeReleased = phaseToBeReleased;
|
|
265
|
+
this.dischargeParameters = dischargeParameters;
|
|
247
266
|
this.substrate = substrate;
|
|
267
|
+
this.weather = weather;
|
|
248
268
|
this.dispersionParameters = dispersionParameters;
|
|
249
269
|
this.dispersionParameterCount = dispersionParameterCount;
|
|
250
270
|
this.endPointConcentration = endPointConcentration;
|
|
@@ -263,19 +283,23 @@ class BESSLinkedRunnerCalculationRequest extends CalculationRequestBase {
|
|
|
263
283
|
}
|
|
264
284
|
}
|
|
265
285
|
|
|
266
|
-
export class
|
|
286
|
+
export class UserDefinedSourceLinkedRunCalculationRequestSchema {
|
|
267
287
|
schema: Joi.ObjectSchema;
|
|
268
288
|
propertyTypes: Record<string, string>;
|
|
269
289
|
|
|
270
290
|
/**
|
|
271
|
-
* Schema for the
|
|
291
|
+
* Schema for the UserDefinedSourceLinkedRun calculation request.
|
|
272
292
|
*/
|
|
273
293
|
constructor() {
|
|
274
294
|
this.schema = Joi.object({
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
295
|
+
material: new EntitySchemas.MaterialSchema().schema,
|
|
296
|
+
dischargeResult: new EntitySchemas.DischargeResultSchema().schema,
|
|
297
|
+
dischargeRecords: Joi.array().items(new EntitySchemas.DischargeRecordSchema().schema).allow(null),
|
|
298
|
+
dischargeRecordCount: Joi.number().integer(),
|
|
299
|
+
phaseToBeReleased: Joi.string().valid(...Object.values(Enums.Phase)),
|
|
300
|
+
dischargeParameters: new EntitySchemas.DischargeParametersSchema().schema,
|
|
278
301
|
substrate: new EntitySchemas.SubstrateSchema().schema,
|
|
302
|
+
weather: new EntitySchemas.WeatherSchema().schema,
|
|
279
303
|
dispersionParameters: Joi.array().items(new EntitySchemas.DispersionParametersSchema().schema).allow(null),
|
|
280
304
|
dispersionParameterCount: Joi.number().integer(),
|
|
281
305
|
endPointConcentration: Joi.number().unsafe(),
|
|
@@ -294,10 +318,14 @@ export class BESSLinkedRunnerCalculationRequestSchema {
|
|
|
294
318
|
}).unknown(true);
|
|
295
319
|
|
|
296
320
|
this.propertyTypes = {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
321
|
+
material: "Entities.Material",
|
|
322
|
+
dischargeResult: "Entities.DischargeResult",
|
|
323
|
+
dischargeRecords: "Entities.DischargeRecord[]",
|
|
324
|
+
dischargeRecordCount: "number",
|
|
325
|
+
phaseToBeReleased: "Enums.Phase",
|
|
326
|
+
dischargeParameters: "Entities.DischargeParameters",
|
|
300
327
|
substrate: "Entities.Substrate",
|
|
328
|
+
weather: "Entities.Weather",
|
|
301
329
|
dispersionParameters: "Entities.DispersionParameters[]",
|
|
302
330
|
dispersionParameterCount: "number",
|
|
303
331
|
endPointConcentration: "number",
|
|
@@ -316,7 +344,7 @@ export class BESSLinkedRunnerCalculationRequestSchema {
|
|
|
316
344
|
};
|
|
317
345
|
}
|
|
318
346
|
|
|
319
|
-
validate(data:
|
|
347
|
+
validate(data: UserDefinedSourceLinkedRunCalculationRequestSchemaData): UserDefinedSourceLinkedRunCalculationRequest {
|
|
320
348
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
321
349
|
if (error) {
|
|
322
350
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -324,12 +352,16 @@ export class BESSLinkedRunnerCalculationRequestSchema {
|
|
|
324
352
|
return this.makeCalculationRequest(value);
|
|
325
353
|
}
|
|
326
354
|
|
|
327
|
-
makeCalculationRequest(data:
|
|
328
|
-
return new
|
|
329
|
-
data.
|
|
330
|
-
data.
|
|
331
|
-
data.
|
|
355
|
+
makeCalculationRequest(data: UserDefinedSourceLinkedRunCalculationRequestSchemaData): UserDefinedSourceLinkedRunCalculationRequest {
|
|
356
|
+
return new UserDefinedSourceLinkedRunCalculationRequest(
|
|
357
|
+
data.material,
|
|
358
|
+
data.dischargeResult,
|
|
359
|
+
data.dischargeRecords,
|
|
360
|
+
data.dischargeRecordCount,
|
|
361
|
+
data.phaseToBeReleased,
|
|
362
|
+
data.dischargeParameters,
|
|
332
363
|
data.substrate,
|
|
364
|
+
data.weather,
|
|
333
365
|
data.dispersionParameters,
|
|
334
366
|
data.dispersionParameterCount,
|
|
335
367
|
data.endPointConcentration,
|
|
@@ -349,11 +381,15 @@ export class BESSLinkedRunnerCalculationRequestSchema {
|
|
|
349
381
|
}
|
|
350
382
|
}
|
|
351
383
|
|
|
352
|
-
export class
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
384
|
+
export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
385
|
+
material: Entities.Material;
|
|
386
|
+
dischargeResult: Entities.DischargeResult;
|
|
387
|
+
dischargeRecords: Entities.DischargeRecord[];
|
|
388
|
+
dischargeRecordCount: number;
|
|
389
|
+
phaseToBeReleased: Enums.Phase;
|
|
390
|
+
dischargeParameters: Entities.DischargeParameters;
|
|
356
391
|
substrate: Entities.Substrate;
|
|
392
|
+
weather: Entities.Weather;
|
|
357
393
|
dispersionParameters: Entities.DispersionParameters[];
|
|
358
394
|
dispersionParameterCount: number;
|
|
359
395
|
endPointConcentration: number;
|
|
@@ -369,8 +405,6 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
369
405
|
explosionOutputConfigCount: number;
|
|
370
406
|
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
371
407
|
explosionConfinedVolumeCount: number;
|
|
372
|
-
exitMaterial?: Entities.Material;
|
|
373
|
-
dischargeRecord?: Entities.DischargeRecord;
|
|
374
408
|
distancesToJetFireRadiation?: number[];
|
|
375
409
|
jetContourPoints?: Entities.LocalPosition[];
|
|
376
410
|
nJetContourPoints?: number[];
|
|
@@ -394,12 +428,16 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
394
428
|
poolFireFlameResult?: Entities.PoolFireFlameResult;
|
|
395
429
|
|
|
396
430
|
/**
|
|
397
|
-
* Calculates maximum distance to a number of concentration levels for
|
|
431
|
+
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given the discharge inputs and weather definition.
|
|
398
432
|
*
|
|
399
|
-
* @param {Entities.
|
|
400
|
-
* @param {Entities.
|
|
401
|
-
* @param {Entities.
|
|
433
|
+
* @param {Entities.Material} material - a material entity.
|
|
434
|
+
* @param {Entities.DischargeResult} dischargeResult - Scalar discharge data.
|
|
435
|
+
* @param {Entities.DischargeRecord[]} dischargeRecords - an array of discharge records.
|
|
436
|
+
* @param {number} dischargeRecordCount - Number of discharge records.
|
|
437
|
+
* @param {Enums.Phase} phaseToBeReleased - Phase to be released ( vapour, two-phase or liquid).
|
|
438
|
+
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
402
439
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
440
|
+
* @param {Entities.Weather} weather - a weather entity.
|
|
403
441
|
* @param {Entities.DispersionParameters[]} dispersionParameters - an array of dispersion parameters.
|
|
404
442
|
* @param {number} dispersionParameterCount - Number of dispersion parameters.
|
|
405
443
|
* @param {number} endPointConcentration - Concentration at which the dispersion calculations will terminate (v/v fraction).
|
|
@@ -417,10 +455,14 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
417
455
|
* @param {number} explosionConfinedVolumeCount - Number of explosion confined volumes.
|
|
418
456
|
*/
|
|
419
457
|
constructor(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
458
|
+
material: Entities.Material,
|
|
459
|
+
dischargeResult: Entities.DischargeResult,
|
|
460
|
+
dischargeRecords: Entities.DischargeRecord[],
|
|
461
|
+
dischargeRecordCount: number,
|
|
462
|
+
phaseToBeReleased: Enums.Phase,
|
|
463
|
+
dischargeParameters: Entities.DischargeParameters,
|
|
423
464
|
substrate: Entities.Substrate,
|
|
465
|
+
weather: Entities.Weather,
|
|
424
466
|
dispersionParameters: Entities.DispersionParameters[],
|
|
425
467
|
dispersionParameterCount: number,
|
|
426
468
|
endPointConcentration: number,
|
|
@@ -438,10 +480,14 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
438
480
|
explosionConfinedVolumeCount: number
|
|
439
481
|
) {
|
|
440
482
|
super();
|
|
441
|
-
this.
|
|
442
|
-
this.
|
|
443
|
-
this.
|
|
483
|
+
this.material = material;
|
|
484
|
+
this.dischargeResult = dischargeResult;
|
|
485
|
+
this.dischargeRecords = dischargeRecords;
|
|
486
|
+
this.dischargeRecordCount = dischargeRecordCount;
|
|
487
|
+
this.phaseToBeReleased = phaseToBeReleased;
|
|
488
|
+
this.dischargeParameters = dischargeParameters;
|
|
444
489
|
this.substrate = substrate;
|
|
490
|
+
this.weather = weather;
|
|
445
491
|
this.dispersionParameters = dispersionParameters;
|
|
446
492
|
this.dispersionParameterCount = dispersionParameterCount;
|
|
447
493
|
this.endPointConcentration = endPointConcentration;
|
|
@@ -461,11 +507,15 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
461
507
|
|
|
462
508
|
async run() {
|
|
463
509
|
try {
|
|
464
|
-
const request = new
|
|
465
|
-
this.
|
|
466
|
-
this.
|
|
467
|
-
this.
|
|
510
|
+
const request = new UserDefinedSourceLinkedRunCalculationRequest(
|
|
511
|
+
this.material,
|
|
512
|
+
this.dischargeResult,
|
|
513
|
+
this.dischargeRecords,
|
|
514
|
+
this.dischargeRecordCount,
|
|
515
|
+
this.phaseToBeReleased,
|
|
516
|
+
this.dischargeParameters,
|
|
468
517
|
this.substrate,
|
|
518
|
+
this.weather,
|
|
469
519
|
this.dispersionParameters,
|
|
470
520
|
this.dispersionParameterCount,
|
|
471
521
|
this.endPointConcentration,
|
|
@@ -483,24 +533,22 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
483
533
|
this.explosionConfinedVolumeCount
|
|
484
534
|
);
|
|
485
535
|
|
|
486
|
-
const schema = new
|
|
536
|
+
const schema = new UserDefinedSourceLinkedRunCalculationRequestSchema();
|
|
487
537
|
const validatedRequest = schema.validate(request);
|
|
488
538
|
|
|
489
539
|
const requestJson = JSON.stringify(validatedRequest);
|
|
490
|
-
const url = `${getAnalyticsApiTarget()}
|
|
540
|
+
const url = `${getAnalyticsApiTarget()}userdefinedsourcelinkedrun?clientId=${getClientAliasId()}`;
|
|
491
541
|
|
|
492
542
|
this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
|
|
493
543
|
|
|
494
544
|
const { data } = await this.postRequest(url, requestJson);
|
|
495
545
|
|
|
496
|
-
const responseSchema = new
|
|
546
|
+
const responseSchema = new UserDefinedSourceLinkedRunCalculationResponseSchema();
|
|
497
547
|
const validatedResponse = responseSchema.validate(data);
|
|
498
548
|
|
|
499
549
|
this.resultCode = validatedResponse.resultCode;
|
|
500
550
|
if (this.resultCode === Enums.ResultCode.SUCCESS) {
|
|
501
551
|
Object.assign(this, {
|
|
502
|
-
exitMaterial: validatedResponse.exitMaterial,
|
|
503
|
-
dischargeRecord: validatedResponse.dischargeRecord,
|
|
504
552
|
distancesToJetFireRadiation: validatedResponse.distancesToJetFireRadiation,
|
|
505
553
|
jetContourPoints: validatedResponse.jetContourPoints,
|
|
506
554
|
nJetContourPoints: validatedResponse.nJetContourPoints,
|
|
@@ -543,10 +591,8 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
543
591
|
}
|
|
544
592
|
|
|
545
593
|
toString() {
|
|
546
|
-
const parts = ["*
|
|
594
|
+
const parts = ["* UserDefinedSourceLinkedRun"];
|
|
547
595
|
|
|
548
|
-
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
549
|
-
parts.push(`dischargeRecord: ${String(this.dischargeRecord)}`);
|
|
550
596
|
parts.push("*** distancesToJetFireRadiation:");
|
|
551
597
|
parts.push(
|
|
552
598
|
this.distancesToJetFireRadiation && this.distancesToJetFireRadiation.length > 0
|
|
@@ -673,9 +719,7 @@ export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
|
673
719
|
}
|
|
674
720
|
}
|
|
675
721
|
|
|
676
|
-
export class
|
|
677
|
-
exitMaterial: Entities.Material;
|
|
678
|
-
dischargeRecord: Entities.DischargeRecord;
|
|
722
|
+
export class UserDefinedSourceLinkedRunCalculationResponse extends CalculationResponseBase {
|
|
679
723
|
distancesToJetFireRadiation: number[];
|
|
680
724
|
jetContourPoints: Entities.LocalPosition[];
|
|
681
725
|
nJetContourPoints: number[];
|
|
@@ -699,10 +743,8 @@ export class BESSLinkedRunnerCalculationResponse extends CalculationResponseBase
|
|
|
699
743
|
poolFireFlameResult: Entities.PoolFireFlameResult;
|
|
700
744
|
|
|
701
745
|
/**
|
|
702
|
-
*
|
|
746
|
+
* UserDefinedSourceLinkedRun calculation response class.
|
|
703
747
|
*
|
|
704
|
-
* @param {Entities.Material} exitMaterial - Exit material from the BESS unit, dependent on BESS chemistry.
|
|
705
|
-
* @param {Entities.DischargeRecord} dischargeRecord - a discharge record entity.
|
|
706
748
|
* @param {number[]} distancesToJetFireRadiation - an array of distances to jet fire radiation levels, ordered according to the flammable output configs.
|
|
707
749
|
* @param {Entities.LocalPosition[]} jetContourPoints - an array of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
708
750
|
* @param {number[]} nJetContourPoints - an array of the number of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
@@ -726,8 +768,6 @@ export class BESSLinkedRunnerCalculationResponse extends CalculationResponseBase
|
|
|
726
768
|
* @param {Entities.PoolFireFlameResult} poolFireFlameResult - a pool fire flame results entity, for pool fire.
|
|
727
769
|
*/
|
|
728
770
|
constructor(
|
|
729
|
-
exitMaterial: Entities.Material,
|
|
730
|
-
dischargeRecord: Entities.DischargeRecord,
|
|
731
771
|
distancesToJetFireRadiation: number[],
|
|
732
772
|
jetContourPoints: Entities.LocalPosition[],
|
|
733
773
|
nJetContourPoints: number[],
|
|
@@ -755,8 +795,6 @@ export class BESSLinkedRunnerCalculationResponse extends CalculationResponseBase
|
|
|
755
795
|
operationId: string
|
|
756
796
|
) {
|
|
757
797
|
super();
|
|
758
|
-
this.exitMaterial = exitMaterial;
|
|
759
|
-
this.dischargeRecord = dischargeRecord;
|
|
760
798
|
this.distancesToJetFireRadiation = distancesToJetFireRadiation;
|
|
761
799
|
this.jetContourPoints = jetContourPoints;
|
|
762
800
|
this.nJetContourPoints = nJetContourPoints;
|
|
@@ -785,14 +823,6 @@ export class BESSLinkedRunnerCalculationResponse extends CalculationResponseBase
|
|
|
785
823
|
}
|
|
786
824
|
|
|
787
825
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
788
|
-
if (data.exitMaterial) {
|
|
789
|
-
this.exitMaterial = new Entities.Material();
|
|
790
|
-
this.exitMaterial.initialiseFromDictionary(data.exitMaterial as { [key: string]: unknown });
|
|
791
|
-
}
|
|
792
|
-
if (data.dischargeRecord) {
|
|
793
|
-
this.dischargeRecord = new Entities.DischargeRecord();
|
|
794
|
-
this.dischargeRecord.initialiseFromDictionary(data.dischargeRecord as { [key: string]: unknown });
|
|
795
|
-
}
|
|
796
826
|
if (data.distancesToJetFireRadiation && Array.isArray(data.distancesToJetFireRadiation)) {
|
|
797
827
|
this.distancesToJetFireRadiation = data.distancesToJetFireRadiation.map((item) => parseFloat(item));
|
|
798
828
|
}
|
|
@@ -904,9 +934,7 @@ export class BESSLinkedRunnerCalculationResponse extends CalculationResponseBase
|
|
|
904
934
|
}
|
|
905
935
|
}
|
|
906
936
|
|
|
907
|
-
export interface
|
|
908
|
-
exitMaterial: Entities.Material;
|
|
909
|
-
dischargeRecord: Entities.DischargeRecord;
|
|
937
|
+
export interface UserDefinedSourceLinkedRunCalculationResponseSchemaData {
|
|
910
938
|
distancesToJetFireRadiation: number[];
|
|
911
939
|
jetContourPoints: Entities.LocalPosition[];
|
|
912
940
|
nJetContourPoints: number[];
|
|
@@ -934,17 +962,15 @@ export interface BESSLinkedRunnerCalculationResponseSchemaData {
|
|
|
934
962
|
operationId: string;
|
|
935
963
|
}
|
|
936
964
|
|
|
937
|
-
export class
|
|
965
|
+
export class UserDefinedSourceLinkedRunCalculationResponseSchema {
|
|
938
966
|
schema: Joi.ObjectSchema;
|
|
939
967
|
propertyTypes: Record<string, string>;
|
|
940
968
|
|
|
941
969
|
/**
|
|
942
|
-
* Schema for the
|
|
970
|
+
* Schema for the UserDefinedSourceLinkedRun calculation response.
|
|
943
971
|
*/
|
|
944
972
|
constructor() {
|
|
945
973
|
this.schema = Joi.object({
|
|
946
|
-
exitMaterial: new EntitySchemas.MaterialSchema().schema,
|
|
947
|
-
dischargeRecord: new EntitySchemas.DischargeRecordSchema().schema,
|
|
948
974
|
distancesToJetFireRadiation: Joi.array().items(Joi.number().unsafe()).allow(null),
|
|
949
975
|
jetContourPoints: Joi.array().items(new EntitySchemas.LocalPositionSchema().schema).allow(null),
|
|
950
976
|
nJetContourPoints: Joi.array().items(Joi.number().integer()).allow(null),
|
|
@@ -973,8 +999,6 @@ export class BESSLinkedRunnerCalculationResponseSchema {
|
|
|
973
999
|
}).unknown(true);
|
|
974
1000
|
|
|
975
1001
|
this.propertyTypes = {
|
|
976
|
-
exitMaterial: "Entities.Material",
|
|
977
|
-
dischargeRecord: "Entities.DischargeRecord",
|
|
978
1002
|
distancesToJetFireRadiation: "number[]",
|
|
979
1003
|
jetContourPoints: "Entities.LocalPosition[]",
|
|
980
1004
|
nJetContourPoints: "number[]",
|
|
@@ -999,7 +1023,7 @@ export class BESSLinkedRunnerCalculationResponseSchema {
|
|
|
999
1023
|
};
|
|
1000
1024
|
}
|
|
1001
1025
|
|
|
1002
|
-
validate(data:
|
|
1026
|
+
validate(data: UserDefinedSourceLinkedRunCalculationResponseSchemaData): UserDefinedSourceLinkedRunCalculationResponse {
|
|
1003
1027
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1004
1028
|
if (error) {
|
|
1005
1029
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -1007,10 +1031,8 @@ export class BESSLinkedRunnerCalculationResponseSchema {
|
|
|
1007
1031
|
return this.makeCalculationResponse(value);
|
|
1008
1032
|
}
|
|
1009
1033
|
|
|
1010
|
-
makeCalculationResponse(data:
|
|
1011
|
-
return new
|
|
1012
|
-
data.exitMaterial,
|
|
1013
|
-
data.dischargeRecord,
|
|
1034
|
+
makeCalculationResponse(data: UserDefinedSourceLinkedRunCalculationResponseSchemaData): UserDefinedSourceLinkedRunCalculationResponse {
|
|
1035
|
+
return new UserDefinedSourceLinkedRunCalculationResponse(
|
|
1014
1036
|
data.distancesToJetFireRadiation,
|
|
1015
1037
|
data.jetContourPoints,
|
|
1016
1038
|
data.nJetContourPoints,
|
|
@@ -1040,12 +1062,9 @@ export class BESSLinkedRunnerCalculationResponseSchema {
|
|
|
1040
1062
|
}
|
|
1041
1063
|
}
|
|
1042
1064
|
|
|
1043
|
-
export interface
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
dischargeRecords: Entities.DischargeRecord[];
|
|
1047
|
-
dischargeRecordCount: number;
|
|
1048
|
-
phaseToBeReleased: Enums.Phase;
|
|
1065
|
+
export interface VesselLeakLinkedRunCalculationRequestSchemaData {
|
|
1066
|
+
vessel: Entities.Vessel;
|
|
1067
|
+
leak: Entities.Leak;
|
|
1049
1068
|
dischargeParameters: Entities.DischargeParameters;
|
|
1050
1069
|
substrate: Entities.Substrate;
|
|
1051
1070
|
weather: Entities.Weather;
|
|
@@ -1066,12 +1085,9 @@ export interface UserDefinedSourceLinkedRunCalculationRequestSchemaData {
|
|
|
1066
1085
|
explosionConfinedVolumeCount: number;
|
|
1067
1086
|
}
|
|
1068
1087
|
|
|
1069
|
-
class
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
dischargeRecords: Entities.DischargeRecord[];
|
|
1073
|
-
dischargeRecordCount: number;
|
|
1074
|
-
phaseToBeReleased: Enums.Phase;
|
|
1088
|
+
class VesselLeakLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
1089
|
+
vessel: Entities.Vessel;
|
|
1090
|
+
leak: Entities.Leak;
|
|
1075
1091
|
dischargeParameters: Entities.DischargeParameters;
|
|
1076
1092
|
substrate: Entities.Substrate;
|
|
1077
1093
|
weather: Entities.Weather;
|
|
@@ -1092,13 +1108,10 @@ class UserDefinedSourceLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
1092
1108
|
explosionConfinedVolumeCount: number;
|
|
1093
1109
|
|
|
1094
1110
|
/**
|
|
1095
|
-
*
|
|
1111
|
+
* VesselLeakLinkedRun calculation request class.
|
|
1096
1112
|
*
|
|
1097
|
-
* @param {Entities.
|
|
1098
|
-
* @param {Entities.
|
|
1099
|
-
* @param {Entities.DischargeRecord[]} dischargeRecords - an array of discharge records.
|
|
1100
|
-
* @param {number} dischargeRecordCount - Number of discharge records.
|
|
1101
|
-
* @param {Enums.Phase} phaseToBeReleased - Phase to be released ( vapour, two-phase or liquid).
|
|
1113
|
+
* @param {Entities.Vessel} vessel - a vessel entity.
|
|
1114
|
+
* @param {Entities.Leak} leak - a leak entity.
|
|
1102
1115
|
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
1103
1116
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
1104
1117
|
* @param {Entities.Weather} weather - a weather entity.
|
|
@@ -1119,11 +1132,8 @@ class UserDefinedSourceLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
1119
1132
|
* @param {number} explosionConfinedVolumeCount - Number of explosion confined volumes.
|
|
1120
1133
|
*/
|
|
1121
1134
|
constructor(
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
dischargeRecords: Entities.DischargeRecord[],
|
|
1125
|
-
dischargeRecordCount: number,
|
|
1126
|
-
phaseToBeReleased: Enums.Phase,
|
|
1135
|
+
vessel: Entities.Vessel,
|
|
1136
|
+
leak: Entities.Leak,
|
|
1127
1137
|
dischargeParameters: Entities.DischargeParameters,
|
|
1128
1138
|
substrate: Entities.Substrate,
|
|
1129
1139
|
weather: Entities.Weather,
|
|
@@ -1144,11 +1154,8 @@ class UserDefinedSourceLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
1144
1154
|
explosionConfinedVolumeCount: number
|
|
1145
1155
|
) {
|
|
1146
1156
|
super();
|
|
1147
|
-
this.
|
|
1148
|
-
this.
|
|
1149
|
-
this.dischargeRecords = dischargeRecords;
|
|
1150
|
-
this.dischargeRecordCount = dischargeRecordCount;
|
|
1151
|
-
this.phaseToBeReleased = phaseToBeReleased;
|
|
1157
|
+
this.vessel = vessel;
|
|
1158
|
+
this.leak = leak;
|
|
1152
1159
|
this.dischargeParameters = dischargeParameters;
|
|
1153
1160
|
this.substrate = substrate;
|
|
1154
1161
|
this.weather = weather;
|
|
@@ -1170,20 +1177,17 @@ class UserDefinedSourceLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
1170
1177
|
}
|
|
1171
1178
|
}
|
|
1172
1179
|
|
|
1173
|
-
export class
|
|
1180
|
+
export class VesselLeakLinkedRunCalculationRequestSchema {
|
|
1174
1181
|
schema: Joi.ObjectSchema;
|
|
1175
1182
|
propertyTypes: Record<string, string>;
|
|
1176
1183
|
|
|
1177
1184
|
/**
|
|
1178
|
-
* Schema for the
|
|
1185
|
+
* Schema for the VesselLeakLinkedRun calculation request.
|
|
1179
1186
|
*/
|
|
1180
1187
|
constructor() {
|
|
1181
1188
|
this.schema = Joi.object({
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
dischargeRecords: Joi.array().items(new EntitySchemas.DischargeRecordSchema().schema).allow(null),
|
|
1185
|
-
dischargeRecordCount: Joi.number().integer(),
|
|
1186
|
-
phaseToBeReleased: Joi.string().valid(...Object.values(Enums.Phase)),
|
|
1189
|
+
vessel: new EntitySchemas.VesselSchema().schema,
|
|
1190
|
+
leak: new EntitySchemas.LeakSchema().schema,
|
|
1187
1191
|
dischargeParameters: new EntitySchemas.DischargeParametersSchema().schema,
|
|
1188
1192
|
substrate: new EntitySchemas.SubstrateSchema().schema,
|
|
1189
1193
|
weather: new EntitySchemas.WeatherSchema().schema,
|
|
@@ -1205,11 +1209,8 @@ export class UserDefinedSourceLinkedRunCalculationRequestSchema {
|
|
|
1205
1209
|
}).unknown(true);
|
|
1206
1210
|
|
|
1207
1211
|
this.propertyTypes = {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
dischargeRecords: "Entities.DischargeRecord[]",
|
|
1211
|
-
dischargeRecordCount: "number",
|
|
1212
|
-
phaseToBeReleased: "Enums.Phase",
|
|
1212
|
+
vessel: "Entities.Vessel",
|
|
1213
|
+
leak: "Entities.Leak",
|
|
1213
1214
|
dischargeParameters: "Entities.DischargeParameters",
|
|
1214
1215
|
substrate: "Entities.Substrate",
|
|
1215
1216
|
weather: "Entities.Weather",
|
|
@@ -1231,7 +1232,7 @@ export class UserDefinedSourceLinkedRunCalculationRequestSchema {
|
|
|
1231
1232
|
};
|
|
1232
1233
|
}
|
|
1233
1234
|
|
|
1234
|
-
validate(data:
|
|
1235
|
+
validate(data: VesselLeakLinkedRunCalculationRequestSchemaData): VesselLeakLinkedRunCalculationRequest {
|
|
1235
1236
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1236
1237
|
if (error) {
|
|
1237
1238
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -1239,13 +1240,10 @@ export class UserDefinedSourceLinkedRunCalculationRequestSchema {
|
|
|
1239
1240
|
return this.makeCalculationRequest(value);
|
|
1240
1241
|
}
|
|
1241
1242
|
|
|
1242
|
-
makeCalculationRequest(data:
|
|
1243
|
-
return new
|
|
1244
|
-
data.
|
|
1245
|
-
data.
|
|
1246
|
-
data.dischargeRecords,
|
|
1247
|
-
data.dischargeRecordCount,
|
|
1248
|
-
data.phaseToBeReleased,
|
|
1243
|
+
makeCalculationRequest(data: VesselLeakLinkedRunCalculationRequestSchemaData): VesselLeakLinkedRunCalculationRequest {
|
|
1244
|
+
return new VesselLeakLinkedRunCalculationRequest(
|
|
1245
|
+
data.vessel,
|
|
1246
|
+
data.leak,
|
|
1249
1247
|
data.dischargeParameters,
|
|
1250
1248
|
data.substrate,
|
|
1251
1249
|
data.weather,
|
|
@@ -1268,12 +1266,9 @@ export class UserDefinedSourceLinkedRunCalculationRequestSchema {
|
|
|
1268
1266
|
}
|
|
1269
1267
|
}
|
|
1270
1268
|
|
|
1271
|
-
export class
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
dischargeRecords: Entities.DischargeRecord[];
|
|
1275
|
-
dischargeRecordCount: number;
|
|
1276
|
-
phaseToBeReleased: Enums.Phase;
|
|
1269
|
+
export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
1270
|
+
vessel: Entities.Vessel;
|
|
1271
|
+
leak: Entities.Leak;
|
|
1277
1272
|
dischargeParameters: Entities.DischargeParameters;
|
|
1278
1273
|
substrate: Entities.Substrate;
|
|
1279
1274
|
weather: Entities.Weather;
|
|
@@ -1292,6 +1287,7 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1292
1287
|
explosionOutputConfigCount: number;
|
|
1293
1288
|
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
1294
1289
|
explosionConfinedVolumeCount: number;
|
|
1290
|
+
dischargeRecord?: Entities.DischargeRecord;
|
|
1295
1291
|
distancesToJetFireRadiation?: number[];
|
|
1296
1292
|
jetContourPoints?: Entities.LocalPosition[];
|
|
1297
1293
|
nJetContourPoints?: number[];
|
|
@@ -1315,13 +1311,10 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1315
1311
|
poolFireFlameResult?: Entities.PoolFireFlameResult;
|
|
1316
1312
|
|
|
1317
1313
|
/**
|
|
1318
|
-
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given
|
|
1314
|
+
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given a vessel, leak and weather definition.
|
|
1319
1315
|
*
|
|
1320
|
-
* @param {Entities.
|
|
1321
|
-
* @param {Entities.
|
|
1322
|
-
* @param {Entities.DischargeRecord[]} dischargeRecords - an array of discharge records.
|
|
1323
|
-
* @param {number} dischargeRecordCount - Number of discharge records.
|
|
1324
|
-
* @param {Enums.Phase} phaseToBeReleased - Phase to be released ( vapour, two-phase or liquid).
|
|
1316
|
+
* @param {Entities.Vessel} vessel - a vessel entity.
|
|
1317
|
+
* @param {Entities.Leak} leak - a leak entity.
|
|
1325
1318
|
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
1326
1319
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
1327
1320
|
* @param {Entities.Weather} weather - a weather entity.
|
|
@@ -1342,11 +1335,8 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1342
1335
|
* @param {number} explosionConfinedVolumeCount - Number of explosion confined volumes.
|
|
1343
1336
|
*/
|
|
1344
1337
|
constructor(
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
dischargeRecords: Entities.DischargeRecord[],
|
|
1348
|
-
dischargeRecordCount: number,
|
|
1349
|
-
phaseToBeReleased: Enums.Phase,
|
|
1338
|
+
vessel: Entities.Vessel,
|
|
1339
|
+
leak: Entities.Leak,
|
|
1350
1340
|
dischargeParameters: Entities.DischargeParameters,
|
|
1351
1341
|
substrate: Entities.Substrate,
|
|
1352
1342
|
weather: Entities.Weather,
|
|
@@ -1367,11 +1357,8 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1367
1357
|
explosionConfinedVolumeCount: number
|
|
1368
1358
|
) {
|
|
1369
1359
|
super();
|
|
1370
|
-
this.
|
|
1371
|
-
this.
|
|
1372
|
-
this.dischargeRecords = dischargeRecords;
|
|
1373
|
-
this.dischargeRecordCount = dischargeRecordCount;
|
|
1374
|
-
this.phaseToBeReleased = phaseToBeReleased;
|
|
1360
|
+
this.vessel = vessel;
|
|
1361
|
+
this.leak = leak;
|
|
1375
1362
|
this.dischargeParameters = dischargeParameters;
|
|
1376
1363
|
this.substrate = substrate;
|
|
1377
1364
|
this.weather = weather;
|
|
@@ -1394,12 +1381,9 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1394
1381
|
|
|
1395
1382
|
async run() {
|
|
1396
1383
|
try {
|
|
1397
|
-
const request = new
|
|
1398
|
-
this.
|
|
1399
|
-
this.
|
|
1400
|
-
this.dischargeRecords,
|
|
1401
|
-
this.dischargeRecordCount,
|
|
1402
|
-
this.phaseToBeReleased,
|
|
1384
|
+
const request = new VesselLeakLinkedRunCalculationRequest(
|
|
1385
|
+
this.vessel,
|
|
1386
|
+
this.leak,
|
|
1403
1387
|
this.dischargeParameters,
|
|
1404
1388
|
this.substrate,
|
|
1405
1389
|
this.weather,
|
|
@@ -1420,22 +1404,23 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1420
1404
|
this.explosionConfinedVolumeCount
|
|
1421
1405
|
);
|
|
1422
1406
|
|
|
1423
|
-
const schema = new
|
|
1407
|
+
const schema = new VesselLeakLinkedRunCalculationRequestSchema();
|
|
1424
1408
|
const validatedRequest = schema.validate(request);
|
|
1425
1409
|
|
|
1426
1410
|
const requestJson = JSON.stringify(validatedRequest);
|
|
1427
|
-
const url = `${getAnalyticsApiTarget()}
|
|
1411
|
+
const url = `${getAnalyticsApiTarget()}vesselleaklinkedrun?clientId=${getClientAliasId()}`;
|
|
1428
1412
|
|
|
1429
1413
|
this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
|
|
1430
1414
|
|
|
1431
1415
|
const { data } = await this.postRequest(url, requestJson);
|
|
1432
1416
|
|
|
1433
|
-
const responseSchema = new
|
|
1417
|
+
const responseSchema = new VesselLeakLinkedRunCalculationResponseSchema();
|
|
1434
1418
|
const validatedResponse = responseSchema.validate(data);
|
|
1435
1419
|
|
|
1436
1420
|
this.resultCode = validatedResponse.resultCode;
|
|
1437
1421
|
if (this.resultCode === Enums.ResultCode.SUCCESS) {
|
|
1438
1422
|
Object.assign(this, {
|
|
1423
|
+
dischargeRecord: validatedResponse.dischargeRecord,
|
|
1439
1424
|
distancesToJetFireRadiation: validatedResponse.distancesToJetFireRadiation,
|
|
1440
1425
|
jetContourPoints: validatedResponse.jetContourPoints,
|
|
1441
1426
|
nJetContourPoints: validatedResponse.nJetContourPoints,
|
|
@@ -1478,8 +1463,9 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1478
1463
|
}
|
|
1479
1464
|
|
|
1480
1465
|
toString() {
|
|
1481
|
-
const parts = ["*
|
|
1466
|
+
const parts = ["* VesselLeakLinkedRun"];
|
|
1482
1467
|
|
|
1468
|
+
parts.push(`dischargeRecord: ${String(this.dischargeRecord)}`);
|
|
1483
1469
|
parts.push("*** distancesToJetFireRadiation:");
|
|
1484
1470
|
parts.push(
|
|
1485
1471
|
this.distancesToJetFireRadiation && this.distancesToJetFireRadiation.length > 0
|
|
@@ -1606,7 +1592,8 @@ export class UserDefinedSourceLinkedRunCalculation extends CalculationBase {
|
|
|
1606
1592
|
}
|
|
1607
1593
|
}
|
|
1608
1594
|
|
|
1609
|
-
export class
|
|
1595
|
+
export class VesselLeakLinkedRunCalculationResponse extends CalculationResponseBase {
|
|
1596
|
+
dischargeRecord: Entities.DischargeRecord;
|
|
1610
1597
|
distancesToJetFireRadiation: number[];
|
|
1611
1598
|
jetContourPoints: Entities.LocalPosition[];
|
|
1612
1599
|
nJetContourPoints: number[];
|
|
@@ -1630,8 +1617,9 @@ export class UserDefinedSourceLinkedRunCalculationResponse extends CalculationRe
|
|
|
1630
1617
|
poolFireFlameResult: Entities.PoolFireFlameResult;
|
|
1631
1618
|
|
|
1632
1619
|
/**
|
|
1633
|
-
*
|
|
1620
|
+
* VesselLeakLinkedRun calculation response class.
|
|
1634
1621
|
*
|
|
1622
|
+
* @param {Entities.DischargeRecord} dischargeRecord - a discharge record entity.
|
|
1635
1623
|
* @param {number[]} distancesToJetFireRadiation - an array of distances to jet fire radiation levels, ordered according to the flammable output configs.
|
|
1636
1624
|
* @param {Entities.LocalPosition[]} jetContourPoints - an array of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
1637
1625
|
* @param {number[]} nJetContourPoints - an array of the number of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
@@ -1655,6 +1643,7 @@ export class UserDefinedSourceLinkedRunCalculationResponse extends CalculationRe
|
|
|
1655
1643
|
* @param {Entities.PoolFireFlameResult} poolFireFlameResult - a pool fire flame results entity, for pool fire.
|
|
1656
1644
|
*/
|
|
1657
1645
|
constructor(
|
|
1646
|
+
dischargeRecord: Entities.DischargeRecord,
|
|
1658
1647
|
distancesToJetFireRadiation: number[],
|
|
1659
1648
|
jetContourPoints: Entities.LocalPosition[],
|
|
1660
1649
|
nJetContourPoints: number[],
|
|
@@ -1682,6 +1671,7 @@ export class UserDefinedSourceLinkedRunCalculationResponse extends CalculationRe
|
|
|
1682
1671
|
operationId: string
|
|
1683
1672
|
) {
|
|
1684
1673
|
super();
|
|
1674
|
+
this.dischargeRecord = dischargeRecord;
|
|
1685
1675
|
this.distancesToJetFireRadiation = distancesToJetFireRadiation;
|
|
1686
1676
|
this.jetContourPoints = jetContourPoints;
|
|
1687
1677
|
this.nJetContourPoints = nJetContourPoints;
|
|
@@ -1710,6 +1700,10 @@ export class UserDefinedSourceLinkedRunCalculationResponse extends CalculationRe
|
|
|
1710
1700
|
}
|
|
1711
1701
|
|
|
1712
1702
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1703
|
+
if (data.dischargeRecord) {
|
|
1704
|
+
this.dischargeRecord = new Entities.DischargeRecord();
|
|
1705
|
+
this.dischargeRecord.initialiseFromDictionary(data.dischargeRecord as { [key: string]: unknown });
|
|
1706
|
+
}
|
|
1713
1707
|
if (data.distancesToJetFireRadiation && Array.isArray(data.distancesToJetFireRadiation)) {
|
|
1714
1708
|
this.distancesToJetFireRadiation = data.distancesToJetFireRadiation.map((item) => parseFloat(item));
|
|
1715
1709
|
}
|
|
@@ -1821,7 +1815,8 @@ export class UserDefinedSourceLinkedRunCalculationResponse extends CalculationRe
|
|
|
1821
1815
|
}
|
|
1822
1816
|
}
|
|
1823
1817
|
|
|
1824
|
-
export interface
|
|
1818
|
+
export interface VesselLeakLinkedRunCalculationResponseSchemaData {
|
|
1819
|
+
dischargeRecord: Entities.DischargeRecord;
|
|
1825
1820
|
distancesToJetFireRadiation: number[];
|
|
1826
1821
|
jetContourPoints: Entities.LocalPosition[];
|
|
1827
1822
|
nJetContourPoints: number[];
|
|
@@ -1849,15 +1844,16 @@ export interface UserDefinedSourceLinkedRunCalculationResponseSchemaData {
|
|
|
1849
1844
|
operationId: string;
|
|
1850
1845
|
}
|
|
1851
1846
|
|
|
1852
|
-
export class
|
|
1847
|
+
export class VesselLeakLinkedRunCalculationResponseSchema {
|
|
1853
1848
|
schema: Joi.ObjectSchema;
|
|
1854
1849
|
propertyTypes: Record<string, string>;
|
|
1855
1850
|
|
|
1856
1851
|
/**
|
|
1857
|
-
* Schema for the
|
|
1852
|
+
* Schema for the VesselLeakLinkedRun calculation response.
|
|
1858
1853
|
*/
|
|
1859
1854
|
constructor() {
|
|
1860
1855
|
this.schema = Joi.object({
|
|
1856
|
+
dischargeRecord: new EntitySchemas.DischargeRecordSchema().schema,
|
|
1861
1857
|
distancesToJetFireRadiation: Joi.array().items(Joi.number().unsafe()).allow(null),
|
|
1862
1858
|
jetContourPoints: Joi.array().items(new EntitySchemas.LocalPositionSchema().schema).allow(null),
|
|
1863
1859
|
nJetContourPoints: Joi.array().items(Joi.number().integer()).allow(null),
|
|
@@ -1886,6 +1882,7 @@ export class UserDefinedSourceLinkedRunCalculationResponseSchema {
|
|
|
1886
1882
|
}).unknown(true);
|
|
1887
1883
|
|
|
1888
1884
|
this.propertyTypes = {
|
|
1885
|
+
dischargeRecord: "Entities.DischargeRecord",
|
|
1889
1886
|
distancesToJetFireRadiation: "number[]",
|
|
1890
1887
|
jetContourPoints: "Entities.LocalPosition[]",
|
|
1891
1888
|
nJetContourPoints: "number[]",
|
|
@@ -1910,7 +1907,7 @@ export class UserDefinedSourceLinkedRunCalculationResponseSchema {
|
|
|
1910
1907
|
};
|
|
1911
1908
|
}
|
|
1912
1909
|
|
|
1913
|
-
validate(data:
|
|
1910
|
+
validate(data: VesselLeakLinkedRunCalculationResponseSchemaData): VesselLeakLinkedRunCalculationResponse {
|
|
1914
1911
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1915
1912
|
if (error) {
|
|
1916
1913
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -1918,8 +1915,9 @@ export class UserDefinedSourceLinkedRunCalculationResponseSchema {
|
|
|
1918
1915
|
return this.makeCalculationResponse(value);
|
|
1919
1916
|
}
|
|
1920
1917
|
|
|
1921
|
-
makeCalculationResponse(data:
|
|
1922
|
-
return new
|
|
1918
|
+
makeCalculationResponse(data: VesselLeakLinkedRunCalculationResponseSchemaData): VesselLeakLinkedRunCalculationResponse {
|
|
1919
|
+
return new VesselLeakLinkedRunCalculationResponse(
|
|
1920
|
+
data.dischargeRecord,
|
|
1923
1921
|
data.distancesToJetFireRadiation,
|
|
1924
1922
|
data.jetContourPoints,
|
|
1925
1923
|
data.nJetContourPoints,
|
|
@@ -1949,9 +1947,9 @@ export class UserDefinedSourceLinkedRunCalculationResponseSchema {
|
|
|
1949
1947
|
}
|
|
1950
1948
|
}
|
|
1951
1949
|
|
|
1952
|
-
export interface
|
|
1950
|
+
export interface VesselLineRuptureLinkedRunCalculationRequestSchemaData {
|
|
1953
1951
|
vessel: Entities.Vessel;
|
|
1954
|
-
|
|
1952
|
+
lineRupture: Entities.LineRupture;
|
|
1955
1953
|
dischargeParameters: Entities.DischargeParameters;
|
|
1956
1954
|
substrate: Entities.Substrate;
|
|
1957
1955
|
weather: Entities.Weather;
|
|
@@ -1972,9 +1970,9 @@ export interface VesselLeakLinkedRunCalculationRequestSchemaData {
|
|
|
1972
1970
|
explosionConfinedVolumeCount: number;
|
|
1973
1971
|
}
|
|
1974
1972
|
|
|
1975
|
-
class
|
|
1973
|
+
class VesselLineRuptureLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
1976
1974
|
vessel: Entities.Vessel;
|
|
1977
|
-
|
|
1975
|
+
lineRupture: Entities.LineRupture;
|
|
1978
1976
|
dischargeParameters: Entities.DischargeParameters;
|
|
1979
1977
|
substrate: Entities.Substrate;
|
|
1980
1978
|
weather: Entities.Weather;
|
|
@@ -1995,10 +1993,10 @@ class VesselLeakLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
|
1995
1993
|
explosionConfinedVolumeCount: number;
|
|
1996
1994
|
|
|
1997
1995
|
/**
|
|
1998
|
-
*
|
|
1996
|
+
* VesselLineRuptureLinkedRun calculation request class.
|
|
1999
1997
|
*
|
|
2000
1998
|
* @param {Entities.Vessel} vessel - a vessel entity.
|
|
2001
|
-
* @param {Entities.
|
|
1999
|
+
* @param {Entities.LineRupture} lineRupture - a line rupture entity.
|
|
2002
2000
|
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
2003
2001
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
2004
2002
|
* @param {Entities.Weather} weather - a weather entity.
|
|
@@ -2020,7 +2018,7 @@ class VesselLeakLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
|
2020
2018
|
*/
|
|
2021
2019
|
constructor(
|
|
2022
2020
|
vessel: Entities.Vessel,
|
|
2023
|
-
|
|
2021
|
+
lineRupture: Entities.LineRupture,
|
|
2024
2022
|
dischargeParameters: Entities.DischargeParameters,
|
|
2025
2023
|
substrate: Entities.Substrate,
|
|
2026
2024
|
weather: Entities.Weather,
|
|
@@ -2042,7 +2040,7 @@ class VesselLeakLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
|
2042
2040
|
) {
|
|
2043
2041
|
super();
|
|
2044
2042
|
this.vessel = vessel;
|
|
2045
|
-
this.
|
|
2043
|
+
this.lineRupture = lineRupture;
|
|
2046
2044
|
this.dischargeParameters = dischargeParameters;
|
|
2047
2045
|
this.substrate = substrate;
|
|
2048
2046
|
this.weather = weather;
|
|
@@ -2064,17 +2062,17 @@ class VesselLeakLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
|
2064
2062
|
}
|
|
2065
2063
|
}
|
|
2066
2064
|
|
|
2067
|
-
export class
|
|
2065
|
+
export class VesselLineRuptureLinkedRunCalculationRequestSchema {
|
|
2068
2066
|
schema: Joi.ObjectSchema;
|
|
2069
2067
|
propertyTypes: Record<string, string>;
|
|
2070
2068
|
|
|
2071
2069
|
/**
|
|
2072
|
-
* Schema for the
|
|
2070
|
+
* Schema for the VesselLineRuptureLinkedRun calculation request.
|
|
2073
2071
|
*/
|
|
2074
2072
|
constructor() {
|
|
2075
2073
|
this.schema = Joi.object({
|
|
2076
2074
|
vessel: new EntitySchemas.VesselSchema().schema,
|
|
2077
|
-
|
|
2075
|
+
lineRupture: new EntitySchemas.LineRuptureSchema().schema,
|
|
2078
2076
|
dischargeParameters: new EntitySchemas.DischargeParametersSchema().schema,
|
|
2079
2077
|
substrate: new EntitySchemas.SubstrateSchema().schema,
|
|
2080
2078
|
weather: new EntitySchemas.WeatherSchema().schema,
|
|
@@ -2097,7 +2095,7 @@ export class VesselLeakLinkedRunCalculationRequestSchema {
|
|
|
2097
2095
|
|
|
2098
2096
|
this.propertyTypes = {
|
|
2099
2097
|
vessel: "Entities.Vessel",
|
|
2100
|
-
|
|
2098
|
+
lineRupture: "Entities.LineRupture",
|
|
2101
2099
|
dischargeParameters: "Entities.DischargeParameters",
|
|
2102
2100
|
substrate: "Entities.Substrate",
|
|
2103
2101
|
weather: "Entities.Weather",
|
|
@@ -2119,7 +2117,7 @@ export class VesselLeakLinkedRunCalculationRequestSchema {
|
|
|
2119
2117
|
};
|
|
2120
2118
|
}
|
|
2121
2119
|
|
|
2122
|
-
validate(data:
|
|
2120
|
+
validate(data: VesselLineRuptureLinkedRunCalculationRequestSchemaData): VesselLineRuptureLinkedRunCalculationRequest {
|
|
2123
2121
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2124
2122
|
if (error) {
|
|
2125
2123
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -2127,10 +2125,10 @@ export class VesselLeakLinkedRunCalculationRequestSchema {
|
|
|
2127
2125
|
return this.makeCalculationRequest(value);
|
|
2128
2126
|
}
|
|
2129
2127
|
|
|
2130
|
-
makeCalculationRequest(data:
|
|
2131
|
-
return new
|
|
2128
|
+
makeCalculationRequest(data: VesselLineRuptureLinkedRunCalculationRequestSchemaData): VesselLineRuptureLinkedRunCalculationRequest {
|
|
2129
|
+
return new VesselLineRuptureLinkedRunCalculationRequest(
|
|
2132
2130
|
data.vessel,
|
|
2133
|
-
data.
|
|
2131
|
+
data.lineRupture,
|
|
2134
2132
|
data.dischargeParameters,
|
|
2135
2133
|
data.substrate,
|
|
2136
2134
|
data.weather,
|
|
@@ -2153,9 +2151,9 @@ export class VesselLeakLinkedRunCalculationRequestSchema {
|
|
|
2153
2151
|
}
|
|
2154
2152
|
}
|
|
2155
2153
|
|
|
2156
|
-
export class
|
|
2154
|
+
export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
2157
2155
|
vessel: Entities.Vessel;
|
|
2158
|
-
|
|
2156
|
+
lineRupture: Entities.LineRupture;
|
|
2159
2157
|
dischargeParameters: Entities.DischargeParameters;
|
|
2160
2158
|
substrate: Entities.Substrate;
|
|
2161
2159
|
weather: Entities.Weather;
|
|
@@ -2198,10 +2196,10 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2198
2196
|
poolFireFlameResult?: Entities.PoolFireFlameResult;
|
|
2199
2197
|
|
|
2200
2198
|
/**
|
|
2201
|
-
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given a vessel,
|
|
2199
|
+
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given a vessel, line rupture and weather definition.
|
|
2202
2200
|
*
|
|
2203
2201
|
* @param {Entities.Vessel} vessel - a vessel entity.
|
|
2204
|
-
* @param {Entities.
|
|
2202
|
+
* @param {Entities.LineRupture} lineRupture - a line rupture entity.
|
|
2205
2203
|
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
2206
2204
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
2207
2205
|
* @param {Entities.Weather} weather - a weather entity.
|
|
@@ -2223,7 +2221,7 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2223
2221
|
*/
|
|
2224
2222
|
constructor(
|
|
2225
2223
|
vessel: Entities.Vessel,
|
|
2226
|
-
|
|
2224
|
+
lineRupture: Entities.LineRupture,
|
|
2227
2225
|
dischargeParameters: Entities.DischargeParameters,
|
|
2228
2226
|
substrate: Entities.Substrate,
|
|
2229
2227
|
weather: Entities.Weather,
|
|
@@ -2245,7 +2243,7 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2245
2243
|
) {
|
|
2246
2244
|
super();
|
|
2247
2245
|
this.vessel = vessel;
|
|
2248
|
-
this.
|
|
2246
|
+
this.lineRupture = lineRupture;
|
|
2249
2247
|
this.dischargeParameters = dischargeParameters;
|
|
2250
2248
|
this.substrate = substrate;
|
|
2251
2249
|
this.weather = weather;
|
|
@@ -2268,9 +2266,9 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2268
2266
|
|
|
2269
2267
|
async run() {
|
|
2270
2268
|
try {
|
|
2271
|
-
const request = new
|
|
2269
|
+
const request = new VesselLineRuptureLinkedRunCalculationRequest(
|
|
2272
2270
|
this.vessel,
|
|
2273
|
-
this.
|
|
2271
|
+
this.lineRupture,
|
|
2274
2272
|
this.dischargeParameters,
|
|
2275
2273
|
this.substrate,
|
|
2276
2274
|
this.weather,
|
|
@@ -2291,17 +2289,17 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2291
2289
|
this.explosionConfinedVolumeCount
|
|
2292
2290
|
);
|
|
2293
2291
|
|
|
2294
|
-
const schema = new
|
|
2292
|
+
const schema = new VesselLineRuptureLinkedRunCalculationRequestSchema();
|
|
2295
2293
|
const validatedRequest = schema.validate(request);
|
|
2296
2294
|
|
|
2297
2295
|
const requestJson = JSON.stringify(validatedRequest);
|
|
2298
|
-
const url = `${getAnalyticsApiTarget()}
|
|
2296
|
+
const url = `${getAnalyticsApiTarget()}vessellinerupturelinkedrun?clientId=${getClientAliasId()}`;
|
|
2299
2297
|
|
|
2300
2298
|
this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
|
|
2301
2299
|
|
|
2302
2300
|
const { data } = await this.postRequest(url, requestJson);
|
|
2303
2301
|
|
|
2304
|
-
const responseSchema = new
|
|
2302
|
+
const responseSchema = new VesselLineRuptureLinkedRunCalculationResponseSchema();
|
|
2305
2303
|
const validatedResponse = responseSchema.validate(data);
|
|
2306
2304
|
|
|
2307
2305
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -2350,7 +2348,7 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2350
2348
|
}
|
|
2351
2349
|
|
|
2352
2350
|
toString() {
|
|
2353
|
-
const parts = ["*
|
|
2351
|
+
const parts = ["* VesselLineRuptureLinkedRun"];
|
|
2354
2352
|
|
|
2355
2353
|
parts.push(`dischargeRecord: ${String(this.dischargeRecord)}`);
|
|
2356
2354
|
parts.push("*** distancesToJetFireRadiation:");
|
|
@@ -2479,7 +2477,7 @@ export class VesselLeakLinkedRunCalculation extends CalculationBase {
|
|
|
2479
2477
|
}
|
|
2480
2478
|
}
|
|
2481
2479
|
|
|
2482
|
-
export class
|
|
2480
|
+
export class VesselLineRuptureLinkedRunCalculationResponse extends CalculationResponseBase {
|
|
2483
2481
|
dischargeRecord: Entities.DischargeRecord;
|
|
2484
2482
|
distancesToJetFireRadiation: number[];
|
|
2485
2483
|
jetContourPoints: Entities.LocalPosition[];
|
|
@@ -2504,7 +2502,7 @@ export class VesselLeakLinkedRunCalculationResponse extends CalculationResponseB
|
|
|
2504
2502
|
poolFireFlameResult: Entities.PoolFireFlameResult;
|
|
2505
2503
|
|
|
2506
2504
|
/**
|
|
2507
|
-
*
|
|
2505
|
+
* VesselLineRuptureLinkedRun calculation response class.
|
|
2508
2506
|
*
|
|
2509
2507
|
* @param {Entities.DischargeRecord} dischargeRecord - a discharge record entity.
|
|
2510
2508
|
* @param {number[]} distancesToJetFireRadiation - an array of distances to jet fire radiation levels, ordered according to the flammable output configs.
|
|
@@ -2702,7 +2700,7 @@ export class VesselLeakLinkedRunCalculationResponse extends CalculationResponseB
|
|
|
2702
2700
|
}
|
|
2703
2701
|
}
|
|
2704
2702
|
|
|
2705
|
-
export interface
|
|
2703
|
+
export interface VesselLineRuptureLinkedRunCalculationResponseSchemaData {
|
|
2706
2704
|
dischargeRecord: Entities.DischargeRecord;
|
|
2707
2705
|
distancesToJetFireRadiation: number[];
|
|
2708
2706
|
jetContourPoints: Entities.LocalPosition[];
|
|
@@ -2731,12 +2729,12 @@ export interface VesselLeakLinkedRunCalculationResponseSchemaData {
|
|
|
2731
2729
|
operationId: string;
|
|
2732
2730
|
}
|
|
2733
2731
|
|
|
2734
|
-
export class
|
|
2732
|
+
export class VesselLineRuptureLinkedRunCalculationResponseSchema {
|
|
2735
2733
|
schema: Joi.ObjectSchema;
|
|
2736
2734
|
propertyTypes: Record<string, string>;
|
|
2737
2735
|
|
|
2738
2736
|
/**
|
|
2739
|
-
* Schema for the
|
|
2737
|
+
* Schema for the VesselLineRuptureLinkedRun calculation response.
|
|
2740
2738
|
*/
|
|
2741
2739
|
constructor() {
|
|
2742
2740
|
this.schema = Joi.object({
|
|
@@ -2794,7 +2792,7 @@ export class VesselLeakLinkedRunCalculationResponseSchema {
|
|
|
2794
2792
|
};
|
|
2795
2793
|
}
|
|
2796
2794
|
|
|
2797
|
-
validate(data:
|
|
2795
|
+
validate(data: VesselLineRuptureLinkedRunCalculationResponseSchemaData): VesselLineRuptureLinkedRunCalculationResponse {
|
|
2798
2796
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2799
2797
|
if (error) {
|
|
2800
2798
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -2802,8 +2800,8 @@ export class VesselLeakLinkedRunCalculationResponseSchema {
|
|
|
2802
2800
|
return this.makeCalculationResponse(value);
|
|
2803
2801
|
}
|
|
2804
2802
|
|
|
2805
|
-
makeCalculationResponse(data:
|
|
2806
|
-
return new
|
|
2803
|
+
makeCalculationResponse(data: VesselLineRuptureLinkedRunCalculationResponseSchemaData): VesselLineRuptureLinkedRunCalculationResponse {
|
|
2804
|
+
return new VesselLineRuptureLinkedRunCalculationResponse(
|
|
2807
2805
|
data.dischargeRecord,
|
|
2808
2806
|
data.distancesToJetFireRadiation,
|
|
2809
2807
|
data.jetContourPoints,
|
|
@@ -2834,9 +2832,9 @@ export class VesselLeakLinkedRunCalculationResponseSchema {
|
|
|
2834
2832
|
}
|
|
2835
2833
|
}
|
|
2836
2834
|
|
|
2837
|
-
export interface
|
|
2835
|
+
export interface VesselReliefValveLinkedRunCalculationRequestSchemaData {
|
|
2838
2836
|
vessel: Entities.Vessel;
|
|
2839
|
-
|
|
2837
|
+
reliefValve: Entities.ReliefValve;
|
|
2840
2838
|
dischargeParameters: Entities.DischargeParameters;
|
|
2841
2839
|
substrate: Entities.Substrate;
|
|
2842
2840
|
weather: Entities.Weather;
|
|
@@ -2857,9 +2855,9 @@ export interface VesselLineRuptureLinkedRunCalculationRequestSchemaData {
|
|
|
2857
2855
|
explosionConfinedVolumeCount: number;
|
|
2858
2856
|
}
|
|
2859
2857
|
|
|
2860
|
-
class
|
|
2858
|
+
class VesselReliefValveLinkedRunCalculationRequest extends CalculationRequestBase {
|
|
2861
2859
|
vessel: Entities.Vessel;
|
|
2862
|
-
|
|
2860
|
+
reliefValve: Entities.ReliefValve;
|
|
2863
2861
|
dischargeParameters: Entities.DischargeParameters;
|
|
2864
2862
|
substrate: Entities.Substrate;
|
|
2865
2863
|
weather: Entities.Weather;
|
|
@@ -2880,10 +2878,10 @@ class VesselLineRuptureLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
2880
2878
|
explosionConfinedVolumeCount: number;
|
|
2881
2879
|
|
|
2882
2880
|
/**
|
|
2883
|
-
*
|
|
2881
|
+
* VesselReliefValveLinkedRun calculation request class.
|
|
2884
2882
|
*
|
|
2885
2883
|
* @param {Entities.Vessel} vessel - a vessel entity.
|
|
2886
|
-
* @param {Entities.
|
|
2884
|
+
* @param {Entities.ReliefValve} reliefValve - a relief valve entity.
|
|
2887
2885
|
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
2888
2886
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
2889
2887
|
* @param {Entities.Weather} weather - a weather entity.
|
|
@@ -2905,7 +2903,7 @@ class VesselLineRuptureLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
2905
2903
|
*/
|
|
2906
2904
|
constructor(
|
|
2907
2905
|
vessel: Entities.Vessel,
|
|
2908
|
-
|
|
2906
|
+
reliefValve: Entities.ReliefValve,
|
|
2909
2907
|
dischargeParameters: Entities.DischargeParameters,
|
|
2910
2908
|
substrate: Entities.Substrate,
|
|
2911
2909
|
weather: Entities.Weather,
|
|
@@ -2927,7 +2925,7 @@ class VesselLineRuptureLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
2927
2925
|
) {
|
|
2928
2926
|
super();
|
|
2929
2927
|
this.vessel = vessel;
|
|
2930
|
-
this.
|
|
2928
|
+
this.reliefValve = reliefValve;
|
|
2931
2929
|
this.dischargeParameters = dischargeParameters;
|
|
2932
2930
|
this.substrate = substrate;
|
|
2933
2931
|
this.weather = weather;
|
|
@@ -2949,17 +2947,17 @@ class VesselLineRuptureLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
2949
2947
|
}
|
|
2950
2948
|
}
|
|
2951
2949
|
|
|
2952
|
-
export class
|
|
2950
|
+
export class VesselReliefValveLinkedRunCalculationRequestSchema {
|
|
2953
2951
|
schema: Joi.ObjectSchema;
|
|
2954
2952
|
propertyTypes: Record<string, string>;
|
|
2955
2953
|
|
|
2956
2954
|
/**
|
|
2957
|
-
* Schema for the
|
|
2955
|
+
* Schema for the VesselReliefValveLinkedRun calculation request.
|
|
2958
2956
|
*/
|
|
2959
2957
|
constructor() {
|
|
2960
2958
|
this.schema = Joi.object({
|
|
2961
2959
|
vessel: new EntitySchemas.VesselSchema().schema,
|
|
2962
|
-
|
|
2960
|
+
reliefValve: new EntitySchemas.ReliefValveSchema().schema,
|
|
2963
2961
|
dischargeParameters: new EntitySchemas.DischargeParametersSchema().schema,
|
|
2964
2962
|
substrate: new EntitySchemas.SubstrateSchema().schema,
|
|
2965
2963
|
weather: new EntitySchemas.WeatherSchema().schema,
|
|
@@ -2982,7 +2980,7 @@ export class VesselLineRuptureLinkedRunCalculationRequestSchema {
|
|
|
2982
2980
|
|
|
2983
2981
|
this.propertyTypes = {
|
|
2984
2982
|
vessel: "Entities.Vessel",
|
|
2985
|
-
|
|
2983
|
+
reliefValve: "Entities.ReliefValve",
|
|
2986
2984
|
dischargeParameters: "Entities.DischargeParameters",
|
|
2987
2985
|
substrate: "Entities.Substrate",
|
|
2988
2986
|
weather: "Entities.Weather",
|
|
@@ -3004,7 +3002,7 @@ export class VesselLineRuptureLinkedRunCalculationRequestSchema {
|
|
|
3004
3002
|
};
|
|
3005
3003
|
}
|
|
3006
3004
|
|
|
3007
|
-
validate(data:
|
|
3005
|
+
validate(data: VesselReliefValveLinkedRunCalculationRequestSchemaData): VesselReliefValveLinkedRunCalculationRequest {
|
|
3008
3006
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
3009
3007
|
if (error) {
|
|
3010
3008
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -3012,10 +3010,10 @@ export class VesselLineRuptureLinkedRunCalculationRequestSchema {
|
|
|
3012
3010
|
return this.makeCalculationRequest(value);
|
|
3013
3011
|
}
|
|
3014
3012
|
|
|
3015
|
-
makeCalculationRequest(data:
|
|
3016
|
-
return new
|
|
3013
|
+
makeCalculationRequest(data: VesselReliefValveLinkedRunCalculationRequestSchemaData): VesselReliefValveLinkedRunCalculationRequest {
|
|
3014
|
+
return new VesselReliefValveLinkedRunCalculationRequest(
|
|
3017
3015
|
data.vessel,
|
|
3018
|
-
data.
|
|
3016
|
+
data.reliefValve,
|
|
3019
3017
|
data.dischargeParameters,
|
|
3020
3018
|
data.substrate,
|
|
3021
3019
|
data.weather,
|
|
@@ -3038,9 +3036,9 @@ export class VesselLineRuptureLinkedRunCalculationRequestSchema {
|
|
|
3038
3036
|
}
|
|
3039
3037
|
}
|
|
3040
3038
|
|
|
3041
|
-
export class
|
|
3039
|
+
export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
3042
3040
|
vessel: Entities.Vessel;
|
|
3043
|
-
|
|
3041
|
+
reliefValve: Entities.ReliefValve;
|
|
3044
3042
|
dischargeParameters: Entities.DischargeParameters;
|
|
3045
3043
|
substrate: Entities.Substrate;
|
|
3046
3044
|
weather: Entities.Weather;
|
|
@@ -3083,10 +3081,10 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3083
3081
|
poolFireFlameResult?: Entities.PoolFireFlameResult;
|
|
3084
3082
|
|
|
3085
3083
|
/**
|
|
3086
|
-
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given a vessel,
|
|
3084
|
+
* Calculates maximum distance to a number of concentration, radiation and overpressure levels for flammable and toxic materials, given a vessel, relief valve and weather definition.
|
|
3087
3085
|
*
|
|
3088
3086
|
* @param {Entities.Vessel} vessel - a vessel entity.
|
|
3089
|
-
* @param {Entities.
|
|
3087
|
+
* @param {Entities.ReliefValve} reliefValve - a relief valve entity.
|
|
3090
3088
|
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
3091
3089
|
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
3092
3090
|
* @param {Entities.Weather} weather - a weather entity.
|
|
@@ -3108,7 +3106,7 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3108
3106
|
*/
|
|
3109
3107
|
constructor(
|
|
3110
3108
|
vessel: Entities.Vessel,
|
|
3111
|
-
|
|
3109
|
+
reliefValve: Entities.ReliefValve,
|
|
3112
3110
|
dischargeParameters: Entities.DischargeParameters,
|
|
3113
3111
|
substrate: Entities.Substrate,
|
|
3114
3112
|
weather: Entities.Weather,
|
|
@@ -3130,7 +3128,7 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3130
3128
|
) {
|
|
3131
3129
|
super();
|
|
3132
3130
|
this.vessel = vessel;
|
|
3133
|
-
this.
|
|
3131
|
+
this.reliefValve = reliefValve;
|
|
3134
3132
|
this.dischargeParameters = dischargeParameters;
|
|
3135
3133
|
this.substrate = substrate;
|
|
3136
3134
|
this.weather = weather;
|
|
@@ -3153,9 +3151,9 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3153
3151
|
|
|
3154
3152
|
async run() {
|
|
3155
3153
|
try {
|
|
3156
|
-
const request = new
|
|
3154
|
+
const request = new VesselReliefValveLinkedRunCalculationRequest(
|
|
3157
3155
|
this.vessel,
|
|
3158
|
-
this.
|
|
3156
|
+
this.reliefValve,
|
|
3159
3157
|
this.dischargeParameters,
|
|
3160
3158
|
this.substrate,
|
|
3161
3159
|
this.weather,
|
|
@@ -3176,17 +3174,17 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3176
3174
|
this.explosionConfinedVolumeCount
|
|
3177
3175
|
);
|
|
3178
3176
|
|
|
3179
|
-
const schema = new
|
|
3177
|
+
const schema = new VesselReliefValveLinkedRunCalculationRequestSchema();
|
|
3180
3178
|
const validatedRequest = schema.validate(request);
|
|
3181
3179
|
|
|
3182
3180
|
const requestJson = JSON.stringify(validatedRequest);
|
|
3183
|
-
const url = `${getAnalyticsApiTarget()}
|
|
3181
|
+
const url = `${getAnalyticsApiTarget()}vesselreliefvalvelinkedrun?clientId=${getClientAliasId()}`;
|
|
3184
3182
|
|
|
3185
3183
|
this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
|
|
3186
3184
|
|
|
3187
3185
|
const { data } = await this.postRequest(url, requestJson);
|
|
3188
3186
|
|
|
3189
|
-
const responseSchema = new
|
|
3187
|
+
const responseSchema = new VesselReliefValveLinkedRunCalculationResponseSchema();
|
|
3190
3188
|
const validatedResponse = responseSchema.validate(data);
|
|
3191
3189
|
|
|
3192
3190
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -3235,7 +3233,7 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3235
3233
|
}
|
|
3236
3234
|
|
|
3237
3235
|
toString() {
|
|
3238
|
-
const parts = ["*
|
|
3236
|
+
const parts = ["* VesselReliefValveLinkedRun"];
|
|
3239
3237
|
|
|
3240
3238
|
parts.push(`dischargeRecord: ${String(this.dischargeRecord)}`);
|
|
3241
3239
|
parts.push("*** distancesToJetFireRadiation:");
|
|
@@ -3364,7 +3362,7 @@ export class VesselLineRuptureLinkedRunCalculation extends CalculationBase {
|
|
|
3364
3362
|
}
|
|
3365
3363
|
}
|
|
3366
3364
|
|
|
3367
|
-
export class
|
|
3365
|
+
export class VesselReliefValveLinkedRunCalculationResponse extends CalculationResponseBase {
|
|
3368
3366
|
dischargeRecord: Entities.DischargeRecord;
|
|
3369
3367
|
distancesToJetFireRadiation: number[];
|
|
3370
3368
|
jetContourPoints: Entities.LocalPosition[];
|
|
@@ -3389,13 +3387,13 @@ export class VesselLineRuptureLinkedRunCalculationResponse extends CalculationRe
|
|
|
3389
3387
|
poolFireFlameResult: Entities.PoolFireFlameResult;
|
|
3390
3388
|
|
|
3391
3389
|
/**
|
|
3392
|
-
*
|
|
3390
|
+
* VesselReliefValveLinkedRun calculation response class.
|
|
3393
3391
|
*
|
|
3394
3392
|
* @param {Entities.DischargeRecord} dischargeRecord - a discharge record entity.
|
|
3395
3393
|
* @param {number[]} distancesToJetFireRadiation - an array of distances to jet fire radiation levels, ordered according to the flammable output configs.
|
|
3396
|
-
* @param {Entities.LocalPosition[]} jetContourPoints - an array of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
3397
|
-
* @param {number[]} nJetContourPoints - an array of the number of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
3398
|
-
* @param {number[]} areaContourJet - an array of areas of the jet fire
|
|
3394
|
+
* @param {Entities.LocalPosition[]} jetContourPoints - an array of jet fire radiation ellipse contour points, ordered according to the flammable output configs.
|
|
3395
|
+
* @param {number[]} nJetContourPoints - an array of the number of jet fire radiation ellipse contour points, ordered according to the flammable output configs.
|
|
3396
|
+
* @param {number[]} areaContourJet - an array of areas of the jet fire ellipses, ordered according to the flammable output configs.
|
|
3399
3397
|
* @param {number[]} distancesToFlamConcentration - an array of distances to flammable concentration levels, ordered according to the dispersion output configs for flammable concentrations of interest.
|
|
3400
3398
|
* @param {number[]} flamConcentrationsUsed - an array of flammable concentration levels used in the calculations, ordered according to the dispersion output configs for flammable concentrations of interest.
|
|
3401
3399
|
* @param {Entities.LocalPosition[]} flamConcContourPoints - an array of maximum flammable concentration footprint contour points, ordered according to the dispersion output configs for flammable concentrations of interest.
|
|
@@ -3404,7 +3402,7 @@ export class VesselLineRuptureLinkedRunCalculationResponse extends CalculationRe
|
|
|
3404
3402
|
* @param {number[]} distancesToPoolFireRadiation - an array of distances to pool fire radiation levels, ordered according to the flammable output configs.
|
|
3405
3403
|
* @param {Entities.LocalPosition[]} poolContourPoints - an array of pool fire radiation contour points, ordered according to the flammable output configs.
|
|
3406
3404
|
* @param {number[]} nPoolContourPoints - an array of the number of pool fire radiation contour points, ordered according to the flammable output configs.
|
|
3407
|
-
* @param {number[]} areaContourPool - an array of areas of the pool fire
|
|
3405
|
+
* @param {number[]} areaContourPool - an array of areas of the pool fire ellipses, ordered according to the flammable output configs.
|
|
3408
3406
|
* @param {Entities.ExplosionOverpressureResult[]} explosionOverpressureResults - an array of explosion overpressure results, ordered according to the explosion output configs.
|
|
3409
3407
|
* @param {number[]} distancesToToxicConcentration - an array of distances to toxic concentration levels, ordered according to the dispersion output configs for toxic concentrations of interest.
|
|
3410
3408
|
* @param {number[]} toxicConcentrationUsed - an array of toxic concentration levels used in the calculations, ordered according to the dispersion output configs for toxic concentrations of interest.
|
|
@@ -3587,7 +3585,7 @@ export class VesselLineRuptureLinkedRunCalculationResponse extends CalculationRe
|
|
|
3587
3585
|
}
|
|
3588
3586
|
}
|
|
3589
3587
|
|
|
3590
|
-
export interface
|
|
3588
|
+
export interface VesselReliefValveLinkedRunCalculationResponseSchemaData {
|
|
3591
3589
|
dischargeRecord: Entities.DischargeRecord;
|
|
3592
3590
|
distancesToJetFireRadiation: number[];
|
|
3593
3591
|
jetContourPoints: Entities.LocalPosition[];
|
|
@@ -3616,12 +3614,12 @@ export interface VesselLineRuptureLinkedRunCalculationResponseSchemaData {
|
|
|
3616
3614
|
operationId: string;
|
|
3617
3615
|
}
|
|
3618
3616
|
|
|
3619
|
-
export class
|
|
3617
|
+
export class VesselReliefValveLinkedRunCalculationResponseSchema {
|
|
3620
3618
|
schema: Joi.ObjectSchema;
|
|
3621
3619
|
propertyTypes: Record<string, string>;
|
|
3622
3620
|
|
|
3623
3621
|
/**
|
|
3624
|
-
* Schema for the
|
|
3622
|
+
* Schema for the VesselReliefValveLinkedRun calculation response.
|
|
3625
3623
|
*/
|
|
3626
3624
|
constructor() {
|
|
3627
3625
|
this.schema = Joi.object({
|
|
@@ -3679,7 +3677,7 @@ export class VesselLineRuptureLinkedRunCalculationResponseSchema {
|
|
|
3679
3677
|
};
|
|
3680
3678
|
}
|
|
3681
3679
|
|
|
3682
|
-
validate(data:
|
|
3680
|
+
validate(data: VesselReliefValveLinkedRunCalculationResponseSchemaData): VesselReliefValveLinkedRunCalculationResponse {
|
|
3683
3681
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
3684
3682
|
if (error) {
|
|
3685
3683
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -3687,8 +3685,8 @@ export class VesselLineRuptureLinkedRunCalculationResponseSchema {
|
|
|
3687
3685
|
return this.makeCalculationResponse(value);
|
|
3688
3686
|
}
|
|
3689
3687
|
|
|
3690
|
-
makeCalculationResponse(data:
|
|
3691
|
-
return new
|
|
3688
|
+
makeCalculationResponse(data: VesselReliefValveLinkedRunCalculationResponseSchemaData): VesselReliefValveLinkedRunCalculationResponse {
|
|
3689
|
+
return new VesselReliefValveLinkedRunCalculationResponse(
|
|
3692
3690
|
data.dischargeRecord,
|
|
3693
3691
|
data.distancesToJetFireRadiation,
|
|
3694
3692
|
data.jetContourPoints,
|
|
@@ -3719,12 +3717,11 @@ export class VesselLineRuptureLinkedRunCalculationResponseSchema {
|
|
|
3719
3717
|
}
|
|
3720
3718
|
}
|
|
3721
3719
|
|
|
3722
|
-
export interface
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
dischargeParameters: Entities.DischargeParameters;
|
|
3726
|
-
substrate: Entities.Substrate;
|
|
3720
|
+
export interface BESSLinkedRunnerCalculationRequestSchemaData {
|
|
3721
|
+
bessUnit: Entities.BESSUnit;
|
|
3722
|
+
bessRelease: Entities.BESSRelease;
|
|
3727
3723
|
weather: Entities.Weather;
|
|
3724
|
+
substrate: Entities.Substrate;
|
|
3728
3725
|
dispersionParameters: Entities.DispersionParameters[];
|
|
3729
3726
|
dispersionParameterCount: number;
|
|
3730
3727
|
endPointConcentration: number;
|
|
@@ -3742,12 +3739,11 @@ export interface VesselReliefValveLinkedRunCalculationRequestSchemaData {
|
|
|
3742
3739
|
explosionConfinedVolumeCount: number;
|
|
3743
3740
|
}
|
|
3744
3741
|
|
|
3745
|
-
class
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
dischargeParameters: Entities.DischargeParameters;
|
|
3749
|
-
substrate: Entities.Substrate;
|
|
3742
|
+
class BESSLinkedRunnerCalculationRequest extends CalculationRequestBase {
|
|
3743
|
+
bessUnit: Entities.BESSUnit;
|
|
3744
|
+
bessRelease: Entities.BESSRelease;
|
|
3750
3745
|
weather: Entities.Weather;
|
|
3746
|
+
substrate: Entities.Substrate;
|
|
3751
3747
|
dispersionParameters: Entities.DispersionParameters[];
|
|
3752
3748
|
dispersionParameterCount: number;
|
|
3753
3749
|
endPointConcentration: number;
|
|
@@ -3765,13 +3761,12 @@ class VesselReliefValveLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
3765
3761
|
explosionConfinedVolumeCount: number;
|
|
3766
3762
|
|
|
3767
3763
|
/**
|
|
3768
|
-
*
|
|
3764
|
+
* BESSLinkedRunner calculation request class.
|
|
3769
3765
|
*
|
|
3770
|
-
* @param {Entities.
|
|
3771
|
-
* @param {Entities.
|
|
3772
|
-
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
3773
|
-
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
3766
|
+
* @param {Entities.BESSUnit} bessUnit - a BESS unit entity.
|
|
3767
|
+
* @param {Entities.BESSRelease} bessRelease - a BESS release entity.
|
|
3774
3768
|
* @param {Entities.Weather} weather - a weather entity.
|
|
3769
|
+
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
3775
3770
|
* @param {Entities.DispersionParameters[]} dispersionParameters - an array of dispersion parameters.
|
|
3776
3771
|
* @param {number} dispersionParameterCount - Number of dispersion parameters.
|
|
3777
3772
|
* @param {number} endPointConcentration - Concentration at which the dispersion calculations will terminate (v/v fraction).
|
|
@@ -3789,11 +3784,10 @@ class VesselReliefValveLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
3789
3784
|
* @param {number} explosionConfinedVolumeCount - Number of explosion confined volumes.
|
|
3790
3785
|
*/
|
|
3791
3786
|
constructor(
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
dischargeParameters: Entities.DischargeParameters,
|
|
3795
|
-
substrate: Entities.Substrate,
|
|
3787
|
+
bessUnit: Entities.BESSUnit,
|
|
3788
|
+
bessRelease: Entities.BESSRelease,
|
|
3796
3789
|
weather: Entities.Weather,
|
|
3790
|
+
substrate: Entities.Substrate,
|
|
3797
3791
|
dispersionParameters: Entities.DispersionParameters[],
|
|
3798
3792
|
dispersionParameterCount: number,
|
|
3799
3793
|
endPointConcentration: number,
|
|
@@ -3811,11 +3805,10 @@ class VesselReliefValveLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
3811
3805
|
explosionConfinedVolumeCount: number
|
|
3812
3806
|
) {
|
|
3813
3807
|
super();
|
|
3814
|
-
this.
|
|
3815
|
-
this.
|
|
3816
|
-
this.dischargeParameters = dischargeParameters;
|
|
3817
|
-
this.substrate = substrate;
|
|
3808
|
+
this.bessUnit = bessUnit;
|
|
3809
|
+
this.bessRelease = bessRelease;
|
|
3818
3810
|
this.weather = weather;
|
|
3811
|
+
this.substrate = substrate;
|
|
3819
3812
|
this.dispersionParameters = dispersionParameters;
|
|
3820
3813
|
this.dispersionParameterCount = dispersionParameterCount;
|
|
3821
3814
|
this.endPointConcentration = endPointConcentration;
|
|
@@ -3834,20 +3827,19 @@ class VesselReliefValveLinkedRunCalculationRequest extends CalculationRequestBas
|
|
|
3834
3827
|
}
|
|
3835
3828
|
}
|
|
3836
3829
|
|
|
3837
|
-
export class
|
|
3830
|
+
export class BESSLinkedRunnerCalculationRequestSchema {
|
|
3838
3831
|
schema: Joi.ObjectSchema;
|
|
3839
3832
|
propertyTypes: Record<string, string>;
|
|
3840
3833
|
|
|
3841
3834
|
/**
|
|
3842
|
-
* Schema for the
|
|
3835
|
+
* Schema for the BESSLinkedRunner calculation request.
|
|
3843
3836
|
*/
|
|
3844
3837
|
constructor() {
|
|
3845
3838
|
this.schema = Joi.object({
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
dischargeParameters: new EntitySchemas.DischargeParametersSchema().schema,
|
|
3849
|
-
substrate: new EntitySchemas.SubstrateSchema().schema,
|
|
3839
|
+
bessUnit: new EntitySchemas.BESSUnitSchema().schema,
|
|
3840
|
+
bessRelease: new EntitySchemas.BESSReleaseSchema().schema,
|
|
3850
3841
|
weather: new EntitySchemas.WeatherSchema().schema,
|
|
3842
|
+
substrate: new EntitySchemas.SubstrateSchema().schema,
|
|
3851
3843
|
dispersionParameters: Joi.array().items(new EntitySchemas.DispersionParametersSchema().schema).allow(null),
|
|
3852
3844
|
dispersionParameterCount: Joi.number().integer(),
|
|
3853
3845
|
endPointConcentration: Joi.number().unsafe(),
|
|
@@ -3866,11 +3858,10 @@ export class VesselReliefValveLinkedRunCalculationRequestSchema {
|
|
|
3866
3858
|
}).unknown(true);
|
|
3867
3859
|
|
|
3868
3860
|
this.propertyTypes = {
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
dischargeParameters: "Entities.DischargeParameters",
|
|
3872
|
-
substrate: "Entities.Substrate",
|
|
3861
|
+
bessUnit: "Entities.BESSUnit",
|
|
3862
|
+
bessRelease: "Entities.BESSRelease",
|
|
3873
3863
|
weather: "Entities.Weather",
|
|
3864
|
+
substrate: "Entities.Substrate",
|
|
3874
3865
|
dispersionParameters: "Entities.DispersionParameters[]",
|
|
3875
3866
|
dispersionParameterCount: "number",
|
|
3876
3867
|
endPointConcentration: "number",
|
|
@@ -3889,7 +3880,7 @@ export class VesselReliefValveLinkedRunCalculationRequestSchema {
|
|
|
3889
3880
|
};
|
|
3890
3881
|
}
|
|
3891
3882
|
|
|
3892
|
-
validate(data:
|
|
3883
|
+
validate(data: BESSLinkedRunnerCalculationRequestSchemaData): BESSLinkedRunnerCalculationRequest {
|
|
3893
3884
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
3894
3885
|
if (error) {
|
|
3895
3886
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -3897,13 +3888,12 @@ export class VesselReliefValveLinkedRunCalculationRequestSchema {
|
|
|
3897
3888
|
return this.makeCalculationRequest(value);
|
|
3898
3889
|
}
|
|
3899
3890
|
|
|
3900
|
-
makeCalculationRequest(data:
|
|
3901
|
-
return new
|
|
3902
|
-
data.
|
|
3903
|
-
data.
|
|
3904
|
-
data.dischargeParameters,
|
|
3905
|
-
data.substrate,
|
|
3891
|
+
makeCalculationRequest(data: BESSLinkedRunnerCalculationRequestSchemaData): BESSLinkedRunnerCalculationRequest {
|
|
3892
|
+
return new BESSLinkedRunnerCalculationRequest(
|
|
3893
|
+
data.bessUnit,
|
|
3894
|
+
data.bessRelease,
|
|
3906
3895
|
data.weather,
|
|
3896
|
+
data.substrate,
|
|
3907
3897
|
data.dispersionParameters,
|
|
3908
3898
|
data.dispersionParameterCount,
|
|
3909
3899
|
data.endPointConcentration,
|
|
@@ -3923,12 +3913,11 @@ export class VesselReliefValveLinkedRunCalculationRequestSchema {
|
|
|
3923
3913
|
}
|
|
3924
3914
|
}
|
|
3925
3915
|
|
|
3926
|
-
export class
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
dischargeParameters: Entities.DischargeParameters;
|
|
3930
|
-
substrate: Entities.Substrate;
|
|
3916
|
+
export class BESSLinkedRunnerCalculation extends CalculationBase {
|
|
3917
|
+
bessUnit: Entities.BESSUnit;
|
|
3918
|
+
bessRelease: Entities.BESSRelease;
|
|
3931
3919
|
weather: Entities.Weather;
|
|
3920
|
+
substrate: Entities.Substrate;
|
|
3932
3921
|
dispersionParameters: Entities.DispersionParameters[];
|
|
3933
3922
|
dispersionParameterCount: number;
|
|
3934
3923
|
endPointConcentration: number;
|
|
@@ -3944,6 +3933,7 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
3944
3933
|
explosionOutputConfigCount: number;
|
|
3945
3934
|
explosionConfinedVolumes: Entities.ExplosionConfinedVolume[];
|
|
3946
3935
|
explosionConfinedVolumeCount: number;
|
|
3936
|
+
exitMaterial?: Entities.Material;
|
|
3947
3937
|
dischargeRecord?: Entities.DischargeRecord;
|
|
3948
3938
|
distancesToJetFireRadiation?: number[];
|
|
3949
3939
|
jetContourPoints?: Entities.LocalPosition[];
|
|
@@ -3968,13 +3958,12 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
3968
3958
|
poolFireFlameResult?: Entities.PoolFireFlameResult;
|
|
3969
3959
|
|
|
3970
3960
|
/**
|
|
3971
|
-
* Calculates maximum distance to a number of concentration
|
|
3961
|
+
* Calculates maximum distance to a number of concentration levels for toxic materials, given a BESS unit, BESS release and weather definition.
|
|
3972
3962
|
*
|
|
3973
|
-
* @param {Entities.
|
|
3974
|
-
* @param {Entities.
|
|
3975
|
-
* @param {Entities.DischargeParameters} dischargeParameters - a discharge parameters entity.
|
|
3976
|
-
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
3963
|
+
* @param {Entities.BESSUnit} bessUnit - a BESS unit entity.
|
|
3964
|
+
* @param {Entities.BESSRelease} bessRelease - a BESS release entity.
|
|
3977
3965
|
* @param {Entities.Weather} weather - a weather entity.
|
|
3966
|
+
* @param {Entities.Substrate} substrate - a substrate entity.
|
|
3978
3967
|
* @param {Entities.DispersionParameters[]} dispersionParameters - an array of dispersion parameters.
|
|
3979
3968
|
* @param {number} dispersionParameterCount - Number of dispersion parameters.
|
|
3980
3969
|
* @param {number} endPointConcentration - Concentration at which the dispersion calculations will terminate (v/v fraction).
|
|
@@ -3992,11 +3981,10 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
3992
3981
|
* @param {number} explosionConfinedVolumeCount - Number of explosion confined volumes.
|
|
3993
3982
|
*/
|
|
3994
3983
|
constructor(
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
dischargeParameters: Entities.DischargeParameters,
|
|
3998
|
-
substrate: Entities.Substrate,
|
|
3984
|
+
bessUnit: Entities.BESSUnit,
|
|
3985
|
+
bessRelease: Entities.BESSRelease,
|
|
3999
3986
|
weather: Entities.Weather,
|
|
3987
|
+
substrate: Entities.Substrate,
|
|
4000
3988
|
dispersionParameters: Entities.DispersionParameters[],
|
|
4001
3989
|
dispersionParameterCount: number,
|
|
4002
3990
|
endPointConcentration: number,
|
|
@@ -4014,11 +4002,10 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
4014
4002
|
explosionConfinedVolumeCount: number
|
|
4015
4003
|
) {
|
|
4016
4004
|
super();
|
|
4017
|
-
this.
|
|
4018
|
-
this.
|
|
4019
|
-
this.dischargeParameters = dischargeParameters;
|
|
4020
|
-
this.substrate = substrate;
|
|
4005
|
+
this.bessUnit = bessUnit;
|
|
4006
|
+
this.bessRelease = bessRelease;
|
|
4021
4007
|
this.weather = weather;
|
|
4008
|
+
this.substrate = substrate;
|
|
4022
4009
|
this.dispersionParameters = dispersionParameters;
|
|
4023
4010
|
this.dispersionParameterCount = dispersionParameterCount;
|
|
4024
4011
|
this.endPointConcentration = endPointConcentration;
|
|
@@ -4038,12 +4025,11 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
4038
4025
|
|
|
4039
4026
|
async run() {
|
|
4040
4027
|
try {
|
|
4041
|
-
const request = new
|
|
4042
|
-
this.
|
|
4043
|
-
this.
|
|
4044
|
-
this.dischargeParameters,
|
|
4045
|
-
this.substrate,
|
|
4028
|
+
const request = new BESSLinkedRunnerCalculationRequest(
|
|
4029
|
+
this.bessUnit,
|
|
4030
|
+
this.bessRelease,
|
|
4046
4031
|
this.weather,
|
|
4032
|
+
this.substrate,
|
|
4047
4033
|
this.dispersionParameters,
|
|
4048
4034
|
this.dispersionParameterCount,
|
|
4049
4035
|
this.endPointConcentration,
|
|
@@ -4061,22 +4047,23 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
4061
4047
|
this.explosionConfinedVolumeCount
|
|
4062
4048
|
);
|
|
4063
4049
|
|
|
4064
|
-
const schema = new
|
|
4050
|
+
const schema = new BESSLinkedRunnerCalculationRequestSchema();
|
|
4065
4051
|
const validatedRequest = schema.validate(request);
|
|
4066
4052
|
|
|
4067
4053
|
const requestJson = JSON.stringify(validatedRequest);
|
|
4068
|
-
const url = `${getAnalyticsApiTarget()}
|
|
4054
|
+
const url = `${getAnalyticsApiTarget()}batteryhazardlinkedrun?clientId=${getClientAliasId()}`;
|
|
4069
4055
|
|
|
4070
4056
|
this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
|
|
4071
4057
|
|
|
4072
4058
|
const { data } = await this.postRequest(url, requestJson);
|
|
4073
4059
|
|
|
4074
|
-
const responseSchema = new
|
|
4060
|
+
const responseSchema = new BESSLinkedRunnerCalculationResponseSchema();
|
|
4075
4061
|
const validatedResponse = responseSchema.validate(data);
|
|
4076
4062
|
|
|
4077
4063
|
this.resultCode = validatedResponse.resultCode;
|
|
4078
4064
|
if (this.resultCode === Enums.ResultCode.SUCCESS) {
|
|
4079
4065
|
Object.assign(this, {
|
|
4066
|
+
exitMaterial: validatedResponse.exitMaterial,
|
|
4080
4067
|
dischargeRecord: validatedResponse.dischargeRecord,
|
|
4081
4068
|
distancesToJetFireRadiation: validatedResponse.distancesToJetFireRadiation,
|
|
4082
4069
|
jetContourPoints: validatedResponse.jetContourPoints,
|
|
@@ -4120,8 +4107,9 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
4120
4107
|
}
|
|
4121
4108
|
|
|
4122
4109
|
toString() {
|
|
4123
|
-
const parts = ["*
|
|
4110
|
+
const parts = ["* BESSLinkedRunner"];
|
|
4124
4111
|
|
|
4112
|
+
parts.push(`exitMaterial: ${String(this.exitMaterial)}`);
|
|
4125
4113
|
parts.push(`dischargeRecord: ${String(this.dischargeRecord)}`);
|
|
4126
4114
|
parts.push("*** distancesToJetFireRadiation:");
|
|
4127
4115
|
parts.push(
|
|
@@ -4249,7 +4237,8 @@ export class VesselReliefValveLinkedRunCalculation extends CalculationBase {
|
|
|
4249
4237
|
}
|
|
4250
4238
|
}
|
|
4251
4239
|
|
|
4252
|
-
export class
|
|
4240
|
+
export class BESSLinkedRunnerCalculationResponse extends CalculationResponseBase {
|
|
4241
|
+
exitMaterial: Entities.Material;
|
|
4253
4242
|
dischargeRecord: Entities.DischargeRecord;
|
|
4254
4243
|
distancesToJetFireRadiation: number[];
|
|
4255
4244
|
jetContourPoints: Entities.LocalPosition[];
|
|
@@ -4274,13 +4263,14 @@ export class VesselReliefValveLinkedRunCalculationResponse extends CalculationRe
|
|
|
4274
4263
|
poolFireFlameResult: Entities.PoolFireFlameResult;
|
|
4275
4264
|
|
|
4276
4265
|
/**
|
|
4277
|
-
*
|
|
4266
|
+
* BESSLinkedRunner calculation response class.
|
|
4278
4267
|
*
|
|
4268
|
+
* @param {Entities.Material} exitMaterial - Exit material from the BESS unit, dependent on BESS chemistry.
|
|
4279
4269
|
* @param {Entities.DischargeRecord} dischargeRecord - a discharge record entity.
|
|
4280
4270
|
* @param {number[]} distancesToJetFireRadiation - an array of distances to jet fire radiation levels, ordered according to the flammable output configs.
|
|
4281
|
-
* @param {Entities.LocalPosition[]} jetContourPoints - an array of jet fire radiation
|
|
4282
|
-
* @param {number[]} nJetContourPoints - an array of the number of jet fire radiation
|
|
4283
|
-
* @param {number[]} areaContourJet - an array of areas of the jet fire
|
|
4271
|
+
* @param {Entities.LocalPosition[]} jetContourPoints - an array of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
4272
|
+
* @param {number[]} nJetContourPoints - an array of the number of jet fire radiation contour points, ordered according to the flammable output configs.
|
|
4273
|
+
* @param {number[]} areaContourJet - an array of areas of the jet fire contours, ordered according to the flammable output configs.
|
|
4284
4274
|
* @param {number[]} distancesToFlamConcentration - an array of distances to flammable concentration levels, ordered according to the dispersion output configs for flammable concentrations of interest.
|
|
4285
4275
|
* @param {number[]} flamConcentrationsUsed - an array of flammable concentration levels used in the calculations, ordered according to the dispersion output configs for flammable concentrations of interest.
|
|
4286
4276
|
* @param {Entities.LocalPosition[]} flamConcContourPoints - an array of maximum flammable concentration footprint contour points, ordered according to the dispersion output configs for flammable concentrations of interest.
|
|
@@ -4289,7 +4279,7 @@ export class VesselReliefValveLinkedRunCalculationResponse extends CalculationRe
|
|
|
4289
4279
|
* @param {number[]} distancesToPoolFireRadiation - an array of distances to pool fire radiation levels, ordered according to the flammable output configs.
|
|
4290
4280
|
* @param {Entities.LocalPosition[]} poolContourPoints - an array of pool fire radiation contour points, ordered according to the flammable output configs.
|
|
4291
4281
|
* @param {number[]} nPoolContourPoints - an array of the number of pool fire radiation contour points, ordered according to the flammable output configs.
|
|
4292
|
-
* @param {number[]} areaContourPool - an array of areas of the pool fire
|
|
4282
|
+
* @param {number[]} areaContourPool - an array of areas of the pool fire contours, ordered according to the flammable output configs.
|
|
4293
4283
|
* @param {Entities.ExplosionOverpressureResult[]} explosionOverpressureResults - an array of explosion overpressure results, ordered according to the explosion output configs.
|
|
4294
4284
|
* @param {number[]} distancesToToxicConcentration - an array of distances to toxic concentration levels, ordered according to the dispersion output configs for toxic concentrations of interest.
|
|
4295
4285
|
* @param {number[]} toxicConcentrationUsed - an array of toxic concentration levels used in the calculations, ordered according to the dispersion output configs for toxic concentrations of interest.
|
|
@@ -4300,6 +4290,7 @@ export class VesselReliefValveLinkedRunCalculationResponse extends CalculationRe
|
|
|
4300
4290
|
* @param {Entities.PoolFireFlameResult} poolFireFlameResult - a pool fire flame results entity, for pool fire.
|
|
4301
4291
|
*/
|
|
4302
4292
|
constructor(
|
|
4293
|
+
exitMaterial: Entities.Material,
|
|
4303
4294
|
dischargeRecord: Entities.DischargeRecord,
|
|
4304
4295
|
distancesToJetFireRadiation: number[],
|
|
4305
4296
|
jetContourPoints: Entities.LocalPosition[],
|
|
@@ -4328,6 +4319,7 @@ export class VesselReliefValveLinkedRunCalculationResponse extends CalculationRe
|
|
|
4328
4319
|
operationId: string
|
|
4329
4320
|
) {
|
|
4330
4321
|
super();
|
|
4322
|
+
this.exitMaterial = exitMaterial;
|
|
4331
4323
|
this.dischargeRecord = dischargeRecord;
|
|
4332
4324
|
this.distancesToJetFireRadiation = distancesToJetFireRadiation;
|
|
4333
4325
|
this.jetContourPoints = jetContourPoints;
|
|
@@ -4357,6 +4349,10 @@ export class VesselReliefValveLinkedRunCalculationResponse extends CalculationRe
|
|
|
4357
4349
|
}
|
|
4358
4350
|
|
|
4359
4351
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
4352
|
+
if (data.exitMaterial) {
|
|
4353
|
+
this.exitMaterial = new Entities.Material();
|
|
4354
|
+
this.exitMaterial.initialiseFromDictionary(data.exitMaterial as { [key: string]: unknown });
|
|
4355
|
+
}
|
|
4360
4356
|
if (data.dischargeRecord) {
|
|
4361
4357
|
this.dischargeRecord = new Entities.DischargeRecord();
|
|
4362
4358
|
this.dischargeRecord.initialiseFromDictionary(data.dischargeRecord as { [key: string]: unknown });
|
|
@@ -4472,7 +4468,8 @@ export class VesselReliefValveLinkedRunCalculationResponse extends CalculationRe
|
|
|
4472
4468
|
}
|
|
4473
4469
|
}
|
|
4474
4470
|
|
|
4475
|
-
export interface
|
|
4471
|
+
export interface BESSLinkedRunnerCalculationResponseSchemaData {
|
|
4472
|
+
exitMaterial: Entities.Material;
|
|
4476
4473
|
dischargeRecord: Entities.DischargeRecord;
|
|
4477
4474
|
distancesToJetFireRadiation: number[];
|
|
4478
4475
|
jetContourPoints: Entities.LocalPosition[];
|
|
@@ -4501,15 +4498,16 @@ export interface VesselReliefValveLinkedRunCalculationResponseSchemaData {
|
|
|
4501
4498
|
operationId: string;
|
|
4502
4499
|
}
|
|
4503
4500
|
|
|
4504
|
-
export class
|
|
4501
|
+
export class BESSLinkedRunnerCalculationResponseSchema {
|
|
4505
4502
|
schema: Joi.ObjectSchema;
|
|
4506
4503
|
propertyTypes: Record<string, string>;
|
|
4507
4504
|
|
|
4508
4505
|
/**
|
|
4509
|
-
* Schema for the
|
|
4506
|
+
* Schema for the BESSLinkedRunner calculation response.
|
|
4510
4507
|
*/
|
|
4511
4508
|
constructor() {
|
|
4512
4509
|
this.schema = Joi.object({
|
|
4510
|
+
exitMaterial: new EntitySchemas.MaterialSchema().schema,
|
|
4513
4511
|
dischargeRecord: new EntitySchemas.DischargeRecordSchema().schema,
|
|
4514
4512
|
distancesToJetFireRadiation: Joi.array().items(Joi.number().unsafe()).allow(null),
|
|
4515
4513
|
jetContourPoints: Joi.array().items(new EntitySchemas.LocalPositionSchema().schema).allow(null),
|
|
@@ -4539,6 +4537,7 @@ export class VesselReliefValveLinkedRunCalculationResponseSchema {
|
|
|
4539
4537
|
}).unknown(true);
|
|
4540
4538
|
|
|
4541
4539
|
this.propertyTypes = {
|
|
4540
|
+
exitMaterial: "Entities.Material",
|
|
4542
4541
|
dischargeRecord: "Entities.DischargeRecord",
|
|
4543
4542
|
distancesToJetFireRadiation: "number[]",
|
|
4544
4543
|
jetContourPoints: "Entities.LocalPosition[]",
|
|
@@ -4564,7 +4563,7 @@ export class VesselReliefValveLinkedRunCalculationResponseSchema {
|
|
|
4564
4563
|
};
|
|
4565
4564
|
}
|
|
4566
4565
|
|
|
4567
|
-
validate(data:
|
|
4566
|
+
validate(data: BESSLinkedRunnerCalculationResponseSchemaData): BESSLinkedRunnerCalculationResponse {
|
|
4568
4567
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
4569
4568
|
if (error) {
|
|
4570
4569
|
throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
|
|
@@ -4572,8 +4571,9 @@ export class VesselReliefValveLinkedRunCalculationResponseSchema {
|
|
|
4572
4571
|
return this.makeCalculationResponse(value);
|
|
4573
4572
|
}
|
|
4574
4573
|
|
|
4575
|
-
makeCalculationResponse(data:
|
|
4576
|
-
return new
|
|
4574
|
+
makeCalculationResponse(data: BESSLinkedRunnerCalculationResponseSchemaData): BESSLinkedRunnerCalculationResponse {
|
|
4575
|
+
return new BESSLinkedRunnerCalculationResponse(
|
|
4576
|
+
data.exitMaterial,
|
|
4577
4577
|
data.dischargeRecord,
|
|
4578
4578
|
data.distancesToJetFireRadiation,
|
|
4579
4579
|
data.jetContourPoints,
|