@dnv-plant/typescriptpws 1.0.86 → 1.0.88

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.
@@ -6,12 +6,10 @@
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.86
10
- * Date/time: 10 Jul 2025 09:49:06
9
+ * Version: 1.0.89
10
+ * Date/time: 29 Jul 2025 17:59:11
11
11
  * Template: templates/typescriptpws/calculations.razor.
12
- ***********************************************************************/
13
-
14
-
12
+ ***********************************************************************/
15
13
 
16
14
  import * as Enums from "../enums";
17
15
  import * as Entities from "../entities";
@@ -36,12 +34,17 @@ class CalculationBase {
36
34
  messages: string[] = [];
37
35
  calculationElapsedTime?: number = 0.0;
38
36
  operationId?: string = "";
37
+ controller?: AbortController;
38
+
39
+ constructor(controller?: AbortController) {
40
+ this.controller = controller;
41
+ }
39
42
 
40
43
  /**
41
44
  * Post JSON to URL and time the call
42
45
  */
43
46
  async postRequest(url: string, data: string): Promise<AxiosResponse> {
44
- return postRequest(url, data);
47
+ return postRequest(url, data, this.controller);
45
48
  }
46
49
 
47
50
  /**
@@ -173,28 +176,22 @@ class FireballCalculationRequest extends CalculationRequestBase {
173
176
  /**
174
177
  * Fireball calculation request class.
175
178
  *
176
- * @param {Entities.Material} material - a material entity with post-discharge composition.
177
- * @param {Entities.State} state - a state entity.
178
- * @param {Entities.DischargeRecord[]} dischargeRecords - an array of discharge records.
179
- * @param {number} dischargeRecordCount - Number of discharge records.
180
- * @param {Entities.DischargeResult} dischargeResult - Discharge / source term definition.
181
- * @param {Entities.Weather} weather - a weather entity.
182
179
  */
183
- constructor(
180
+ constructor(data: {
184
181
  material: Entities.Material,
185
182
  state: Entities.State,
186
183
  dischargeRecords: Entities.DischargeRecord[],
187
184
  dischargeRecordCount: number,
188
185
  dischargeResult: Entities.DischargeResult,
189
186
  weather: Entities.Weather
190
- ) {
187
+ }) {
191
188
  super();
192
- this.material = material;
193
- this.state = state;
194
- this.dischargeRecords = dischargeRecords;
195
- this.dischargeRecordCount = dischargeRecordCount;
196
- this.dischargeResult = dischargeResult;
197
- this.weather = weather;
189
+ this.material = data.material;
190
+ this.state = data.state;
191
+ this.dischargeRecords = data.dischargeRecords;
192
+ this.dischargeRecordCount = data.dischargeRecordCount;
193
+ this.dischargeResult = data.dischargeResult;
194
+ this.weather = data.weather;
198
195
  }
199
196
  }
200
197
 
@@ -234,14 +231,7 @@ export class FireballCalculationRequestSchema {
234
231
  }
235
232
 
236
233
  makeCalculationRequest(data: FireballCalculationRequestSchemaData): FireballCalculationRequest {
237
- return new FireballCalculationRequest(
238
- data.material,
239
- data.state,
240
- data.dischargeRecords,
241
- data.dischargeRecordCount,
242
- data.dischargeResult,
243
- data.weather
244
- );
234
+ return new FireballCalculationRequest(data);
245
235
  }
246
236
  }
247
237
 
@@ -258,40 +248,35 @@ export class FireballCalculation extends CalculationBase {
258
248
  /**
259
249
  * Calculates a fireball produced from an instantaneous or (short duration) time-varying source term. The output can be used can be used to run radiation models for prediction of thermal effects.
260
250
  *
261
- * @param {Entities.Material} material - a material entity with post-discharge composition.
262
- * @param {Entities.State} state - a state entity.
263
- * @param {Entities.DischargeRecord[]} dischargeRecords - an array of discharge records.
264
- * @param {number} dischargeRecordCount - Number of discharge records.
265
- * @param {Entities.DischargeResult} dischargeResult - Discharge / source term definition.
266
- * @param {Entities.Weather} weather - a weather entity.
267
251
  */
268
- constructor(
252
+ constructor(data: {
269
253
  material: Entities.Material,
270
254
  state: Entities.State,
271
255
  dischargeRecords: Entities.DischargeRecord[],
272
256
  dischargeRecordCount: number,
273
257
  dischargeResult: Entities.DischargeResult,
274
258
  weather: Entities.Weather
275
- ) {
276
- super();
277
- this.material = material;
278
- this.state = state;
279
- this.dischargeRecords = dischargeRecords;
280
- this.dischargeRecordCount = dischargeRecordCount;
281
- this.dischargeResult = dischargeResult;
282
- this.weather = weather;
259
+ controller?: AbortController;
260
+ }) {
261
+ super(data.controller);
262
+ this.material = data.material;
263
+ this.state = data.state;
264
+ this.dischargeRecords = data.dischargeRecords;
265
+ this.dischargeRecordCount = data.dischargeRecordCount;
266
+ this.dischargeResult = data.dischargeResult;
267
+ this.weather = data.weather;
283
268
  }
284
269
 
285
270
  async run() {
286
271
  try {
287
- const request = new FireballCalculationRequest(
288
- this.material,
289
- this.state,
290
- this.dischargeRecords,
291
- this.dischargeRecordCount,
292
- this.dischargeResult,
293
- this.weather
294
- );
272
+ const request = new FireballCalculationRequest({
273
+ material: this.material,
274
+ state: this.state,
275
+ dischargeRecords: this.dischargeRecords,
276
+ dischargeRecordCount: this.dischargeRecordCount,
277
+ dischargeResult: this.dischargeResult,
278
+ weather: this.weather
279
+ });
295
280
 
296
281
  const schema = new FireballCalculationRequestSchema();
297
282
  const validatedRequest = schema.validate(request);
@@ -358,24 +343,22 @@ export class FireballCalculationResponse extends CalculationResponseBase {
358
343
  /**
359
344
  * Fireball calculation response class.
360
345
  *
361
- * @param {Entities.FlameResult} flameResult - Flame scalar result.
362
- * @param {Entities.FlameRecord[]} flameRecords - an array of fireball flame records.
363
346
  */
364
- constructor(
347
+ constructor(data: {
365
348
  flameResult: Entities.FlameResult,
366
349
  flameRecords: Entities.FlameRecord[],
367
350
  resultCode: Enums.ResultCode,
368
351
  messages: string[],
369
352
  calculationElapsedTime: number,
370
353
  operationId: string
371
- ) {
354
+ }) {
372
355
  super();
373
- this.flameResult = flameResult;
374
- this.flameRecords = flameRecords;
375
- this.resultCode = resultCode;
376
- this.messages = messages;
377
- this.calculationElapsedTime = calculationElapsedTime;
378
- this.operationId = operationId;
356
+ this.flameResult = data.flameResult;
357
+ this.flameRecords = data.flameRecords;
358
+ this.resultCode = data.resultCode;
359
+ this.messages = data.messages;
360
+ this.calculationElapsedTime = data.calculationElapsedTime;
361
+ this.operationId = data.operationId;
379
362
  }
380
363
 
381
364
  initialiseFromDictionary(data: { [key: string]: unknown }) {
@@ -449,13 +432,6 @@ export class FireballCalculationResponseSchema {
449
432
  }
450
433
 
451
434
  makeCalculationResponse(data: FireballCalculationResponseSchemaData): FireballCalculationResponse {
452
- return new FireballCalculationResponse(
453
- data.flameResult,
454
- data.flameRecords,
455
- data.resultCode,
456
- data.messages,
457
- data.calculationElapsedTime,
458
- data.operationId
459
- );
435
+ return new FireballCalculationResponse(data);
460
436
  }
461
437
  }
@@ -6,12 +6,10 @@
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.86
10
- * Date/time: 10 Jul 2025 09:49:06
9
+ * Version: 1.0.89
10
+ * Date/time: 29 Jul 2025 17:59:11
11
11
  * Template: templates/typescriptpws/calculations.razor.
12
- ***********************************************************************/
13
-
14
-
12
+ ***********************************************************************/
15
13
 
16
14
  import * as Enums from "../enums";
17
15
  import * as Entities from "../entities";
@@ -36,12 +34,17 @@ class CalculationBase {
36
34
  messages: string[] = [];
37
35
  calculationElapsedTime?: number = 0.0;
38
36
  operationId?: string = "";
37
+ controller?: AbortController;
38
+
39
+ constructor(controller?: AbortController) {
40
+ this.controller = controller;
41
+ }
39
42
 
40
43
  /**
41
44
  * Post JSON to URL and time the call
42
45
  */
43
46
  async postRequest(url: string, data: string): Promise<AxiosResponse> {
44
- return postRequest(url, data);
47
+ return postRequest(url, data, this.controller);
45
48
  }
46
49
 
47
50
  /**
@@ -175,15 +178,8 @@ class JetFireCalculationRequest extends CalculationRequestBase {
175
178
  /**
176
179
  * JetFire calculation request class.
177
180
  *
178
- * @param {Entities.Material} material - a material entity with post-discharge composition.
179
- * @param {Entities.DischargeRecord[]} dischargeRecords - Discharge / source term definition.
180
- * @param {number} dischargeRecordCount - Number of discharge records.
181
- * @param {Entities.DischargeResult} dischargeResult - Discharge / source term definition.
182
- * @param {Entities.Weather} weather - a weather entity.
183
- * @param {Entities.Substrate} substrate - a substrate entity.
184
- * @param {Entities.FlammableParameters} flammableParameters - a flammable parameters entity.
185
181
  */
186
- constructor(
182
+ constructor(data: {
187
183
  material: Entities.Material,
188
184
  dischargeRecords: Entities.DischargeRecord[],
189
185
  dischargeRecordCount: number,
@@ -191,15 +187,15 @@ class JetFireCalculationRequest extends CalculationRequestBase {
191
187
  weather: Entities.Weather,
192
188
  substrate: Entities.Substrate,
193
189
  flammableParameters: Entities.FlammableParameters
194
- ) {
190
+ }) {
195
191
  super();
196
- this.material = material;
197
- this.dischargeRecords = dischargeRecords;
198
- this.dischargeRecordCount = dischargeRecordCount;
199
- this.dischargeResult = dischargeResult;
200
- this.weather = weather;
201
- this.substrate = substrate;
202
- this.flammableParameters = flammableParameters;
192
+ this.material = data.material;
193
+ this.dischargeRecords = data.dischargeRecords;
194
+ this.dischargeRecordCount = data.dischargeRecordCount;
195
+ this.dischargeResult = data.dischargeResult;
196
+ this.weather = data.weather;
197
+ this.substrate = data.substrate;
198
+ this.flammableParameters = data.flammableParameters;
203
199
  }
204
200
  }
205
201
 
@@ -241,15 +237,7 @@ export class JetFireCalculationRequestSchema {
241
237
  }
242
238
 
243
239
  makeCalculationRequest(data: JetFireCalculationRequestSchemaData): JetFireCalculationRequest {
244
- return new JetFireCalculationRequest(
245
- data.material,
246
- data.dischargeRecords,
247
- data.dischargeRecordCount,
248
- data.dischargeResult,
249
- data.weather,
250
- data.substrate,
251
- data.flammableParameters
252
- );
240
+ return new JetFireCalculationRequest(data);
253
241
  }
254
242
  }
255
243
 
@@ -269,15 +257,8 @@ export class JetFireCalculation extends CalculationBase {
269
257
  use average discharge data based on the averaging time for jet fires of 20 s. For continuous releases the model will use the
270
258
  initial constant discharge data provided.
271
259
  *
272
- * @param {Entities.Material} material - a material entity with post-discharge composition.
273
- * @param {Entities.DischargeRecord[]} dischargeRecords - Discharge / source term definition.
274
- * @param {number} dischargeRecordCount - Number of discharge records.
275
- * @param {Entities.DischargeResult} dischargeResult - Discharge / source term definition.
276
- * @param {Entities.Weather} weather - a weather entity.
277
- * @param {Entities.Substrate} substrate - a substrate entity.
278
- * @param {Entities.FlammableParameters} flammableParameters - a flammable parameters entity.
279
260
  */
280
- constructor(
261
+ constructor(data: {
281
262
  material: Entities.Material,
282
263
  dischargeRecords: Entities.DischargeRecord[],
283
264
  dischargeRecordCount: number,
@@ -285,28 +266,29 @@ initial constant discharge data provided.
285
266
  weather: Entities.Weather,
286
267
  substrate: Entities.Substrate,
287
268
  flammableParameters: Entities.FlammableParameters
288
- ) {
289
- super();
290
- this.material = material;
291
- this.dischargeRecords = dischargeRecords;
292
- this.dischargeRecordCount = dischargeRecordCount;
293
- this.dischargeResult = dischargeResult;
294
- this.weather = weather;
295
- this.substrate = substrate;
296
- this.flammableParameters = flammableParameters;
269
+ controller?: AbortController;
270
+ }) {
271
+ super(data.controller);
272
+ this.material = data.material;
273
+ this.dischargeRecords = data.dischargeRecords;
274
+ this.dischargeRecordCount = data.dischargeRecordCount;
275
+ this.dischargeResult = data.dischargeResult;
276
+ this.weather = data.weather;
277
+ this.substrate = data.substrate;
278
+ this.flammableParameters = data.flammableParameters;
297
279
  }
298
280
 
299
281
  async run() {
300
282
  try {
301
- const request = new JetFireCalculationRequest(
302
- this.material,
303
- this.dischargeRecords,
304
- this.dischargeRecordCount,
305
- this.dischargeResult,
306
- this.weather,
307
- this.substrate,
308
- this.flammableParameters
309
- );
283
+ const request = new JetFireCalculationRequest({
284
+ material: this.material,
285
+ dischargeRecords: this.dischargeRecords,
286
+ dischargeRecordCount: this.dischargeRecordCount,
287
+ dischargeResult: this.dischargeResult,
288
+ weather: this.weather,
289
+ substrate: this.substrate,
290
+ flammableParameters: this.flammableParameters
291
+ });
310
292
 
311
293
  const schema = new JetFireCalculationRequestSchema();
312
294
  const validatedRequest = schema.validate(request);
@@ -373,24 +355,22 @@ export class JetFireCalculationResponse extends CalculationResponseBase {
373
355
  /**
374
356
  * JetFire calculation response class.
375
357
  *
376
- * @param {Entities.FlameResult} flameResult - Flame scalar results.
377
- * @param {Entities.FlameRecord[]} flameRecords - an array of jet fire flame records.
378
358
  */
379
- constructor(
359
+ constructor(data: {
380
360
  flameResult: Entities.FlameResult,
381
361
  flameRecords: Entities.FlameRecord[],
382
362
  resultCode: Enums.ResultCode,
383
363
  messages: string[],
384
364
  calculationElapsedTime: number,
385
365
  operationId: string
386
- ) {
366
+ }) {
387
367
  super();
388
- this.flameResult = flameResult;
389
- this.flameRecords = flameRecords;
390
- this.resultCode = resultCode;
391
- this.messages = messages;
392
- this.calculationElapsedTime = calculationElapsedTime;
393
- this.operationId = operationId;
368
+ this.flameResult = data.flameResult;
369
+ this.flameRecords = data.flameRecords;
370
+ this.resultCode = data.resultCode;
371
+ this.messages = data.messages;
372
+ this.calculationElapsedTime = data.calculationElapsedTime;
373
+ this.operationId = data.operationId;
394
374
  }
395
375
 
396
376
  initialiseFromDictionary(data: { [key: string]: unknown }) {
@@ -464,14 +444,7 @@ export class JetFireCalculationResponseSchema {
464
444
  }
465
445
 
466
446
  makeCalculationResponse(data: JetFireCalculationResponseSchemaData): JetFireCalculationResponse {
467
- return new JetFireCalculationResponse(
468
- data.flameResult,
469
- data.flameRecords,
470
- data.resultCode,
471
- data.messages,
472
- data.calculationElapsedTime,
473
- data.operationId
474
- );
447
+ return new JetFireCalculationResponse(data);
475
448
  }
476
449
  }
477
450
 
@@ -493,25 +466,20 @@ class ModifyFuelRateForJetFireCalculationRequest extends CalculationRequestBase
493
466
  /**
494
467
  * ModifyFuelRateForJetFire calculation request class.
495
468
  *
496
- * @param {Entities.DischargeRecord[]} dischargeRecords - Discharge records.
497
- * @param {number} dischargeRecordCount - Number of discharge records.
498
- * @param {Entities.PoolRecord[]} poolRecords - Pool records.
499
- * @param {number} poolRecordCount - Number of pool records.
500
- * @param {Entities.FlammableParameters} flammableParameters - Flammable parameters.
501
469
  */
502
- constructor(
470
+ constructor(data: {
503
471
  dischargeRecords: Entities.DischargeRecord[],
504
472
  dischargeRecordCount: number,
505
473
  poolRecords: Entities.PoolRecord[],
506
474
  poolRecordCount: number,
507
475
  flammableParameters: Entities.FlammableParameters
508
- ) {
476
+ }) {
509
477
  super();
510
- this.dischargeRecords = dischargeRecords;
511
- this.dischargeRecordCount = dischargeRecordCount;
512
- this.poolRecords = poolRecords;
513
- this.poolRecordCount = poolRecordCount;
514
- this.flammableParameters = flammableParameters;
478
+ this.dischargeRecords = data.dischargeRecords;
479
+ this.dischargeRecordCount = data.dischargeRecordCount;
480
+ this.poolRecords = data.poolRecords;
481
+ this.poolRecordCount = data.poolRecordCount;
482
+ this.flammableParameters = data.flammableParameters;
515
483
  }
516
484
  }
517
485
 
@@ -549,13 +517,7 @@ export class ModifyFuelRateForJetFireCalculationRequestSchema {
549
517
  }
550
518
 
551
519
  makeCalculationRequest(data: ModifyFuelRateForJetFireCalculationRequestSchemaData): ModifyFuelRateForJetFireCalculationRequest {
552
- return new ModifyFuelRateForJetFireCalculationRequest(
553
- data.dischargeRecords,
554
- data.dischargeRecordCount,
555
- data.poolRecords,
556
- data.poolRecordCount,
557
- data.flammableParameters
558
- );
520
+ return new ModifyFuelRateForJetFireCalculationRequest(data);
559
521
  }
560
522
  }
561
523
 
@@ -575,36 +537,32 @@ taken into account. In cases where 33% or more of the discharged mass vaporises,
575
537
  (Hasegawa and Sato, 1977 and Roberts, 1982) found that the whole discharged mass should be the fuel mass used in fire models. CCPS later
576
538
  adapted this to a rule set of 33%. Thus, this correction only applies for cases where more than 67% of the mass rains out.
577
539
  *
578
- * @param {Entities.DischargeRecord[]} dischargeRecords - Discharge records.
579
- * @param {number} dischargeRecordCount - Number of discharge records.
580
- * @param {Entities.PoolRecord[]} poolRecords - Pool records.
581
- * @param {number} poolRecordCount - Number of pool records.
582
- * @param {Entities.FlammableParameters} flammableParameters - Flammable parameters.
583
540
  */
584
- constructor(
541
+ constructor(data: {
585
542
  dischargeRecords: Entities.DischargeRecord[],
586
543
  dischargeRecordCount: number,
587
544
  poolRecords: Entities.PoolRecord[],
588
545
  poolRecordCount: number,
589
546
  flammableParameters: Entities.FlammableParameters
590
- ) {
591
- super();
592
- this.dischargeRecords = dischargeRecords;
593
- this.dischargeRecordCount = dischargeRecordCount;
594
- this.poolRecords = poolRecords;
595
- this.poolRecordCount = poolRecordCount;
596
- this.flammableParameters = flammableParameters;
547
+ controller?: AbortController;
548
+ }) {
549
+ super(data.controller);
550
+ this.dischargeRecords = data.dischargeRecords;
551
+ this.dischargeRecordCount = data.dischargeRecordCount;
552
+ this.poolRecords = data.poolRecords;
553
+ this.poolRecordCount = data.poolRecordCount;
554
+ this.flammableParameters = data.flammableParameters;
597
555
  }
598
556
 
599
557
  async run() {
600
558
  try {
601
- const request = new ModifyFuelRateForJetFireCalculationRequest(
602
- this.dischargeRecords,
603
- this.dischargeRecordCount,
604
- this.poolRecords,
605
- this.poolRecordCount,
606
- this.flammableParameters
607
- );
559
+ const request = new ModifyFuelRateForJetFireCalculationRequest({
560
+ dischargeRecords: this.dischargeRecords,
561
+ dischargeRecordCount: this.dischargeRecordCount,
562
+ poolRecords: this.poolRecords,
563
+ poolRecordCount: this.poolRecordCount,
564
+ flammableParameters: this.flammableParameters
565
+ });
608
566
 
609
567
  const schema = new ModifyFuelRateForJetFireCalculationRequestSchema();
610
568
  const validatedRequest = schema.validate(request);
@@ -668,21 +626,20 @@ export class ModifyFuelRateForJetFireCalculationResponse extends CalculationResp
668
626
  /**
669
627
  * ModifyFuelRateForJetFire calculation response class.
670
628
  *
671
- * @param {Entities.DischargeRecord[]} modDischargeRecords - Modified discharge records.
672
629
  */
673
- constructor(
630
+ constructor(data: {
674
631
  modDischargeRecords: Entities.DischargeRecord[],
675
632
  resultCode: Enums.ResultCode,
676
633
  messages: string[],
677
634
  calculationElapsedTime: number,
678
635
  operationId: string
679
- ) {
636
+ }) {
680
637
  super();
681
- this.modDischargeRecords = modDischargeRecords;
682
- this.resultCode = resultCode;
683
- this.messages = messages;
684
- this.calculationElapsedTime = calculationElapsedTime;
685
- this.operationId = operationId;
638
+ this.modDischargeRecords = data.modDischargeRecords;
639
+ this.resultCode = data.resultCode;
640
+ this.messages = data.messages;
641
+ this.calculationElapsedTime = data.calculationElapsedTime;
642
+ this.operationId = data.operationId;
686
643
  }
687
644
 
688
645
  initialiseFromDictionary(data: { [key: string]: unknown }) {
@@ -749,12 +706,6 @@ export class ModifyFuelRateForJetFireCalculationResponseSchema {
749
706
  }
750
707
 
751
708
  makeCalculationResponse(data: ModifyFuelRateForJetFireCalculationResponseSchemaData): ModifyFuelRateForJetFireCalculationResponse {
752
- return new ModifyFuelRateForJetFireCalculationResponse(
753
- data.modDischargeRecords,
754
- data.resultCode,
755
- data.messages,
756
- data.calculationElapsedTime,
757
- data.operationId
758
- );
709
+ return new ModifyFuelRateForJetFireCalculationResponse(data);
759
710
  }
760
711
  }