@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
  /**
@@ -169,22 +172,18 @@ class TankFireCalculationRequest extends CalculationRequestBase {
169
172
  /**
170
173
  * TankFire calculation request class.
171
174
  *
172
- * @param {Entities.AtmosphericStorageTank} atmosphericStorageTank - an atmospheric storage tank entity.
173
- * @param {Entities.Weather} weather - a weather entity.
174
- * @param {Entities.Substrate} substrate - a substrate entity.
175
- * @param {Entities.FlammableParameters} flammableParameters - a flammable parameters entity.
176
175
  */
177
- constructor(
176
+ constructor(data: {
178
177
  atmosphericStorageTank: Entities.AtmosphericStorageTank,
179
178
  weather: Entities.Weather,
180
179
  substrate: Entities.Substrate,
181
180
  flammableParameters: Entities.FlammableParameters
182
- ) {
181
+ }) {
183
182
  super();
184
- this.atmosphericStorageTank = atmosphericStorageTank;
185
- this.weather = weather;
186
- this.substrate = substrate;
187
- this.flammableParameters = flammableParameters;
183
+ this.atmosphericStorageTank = data.atmosphericStorageTank;
184
+ this.weather = data.weather;
185
+ this.substrate = data.substrate;
186
+ this.flammableParameters = data.flammableParameters;
188
187
  }
189
188
  }
190
189
 
@@ -220,12 +219,7 @@ export class TankFireCalculationRequestSchema {
220
219
  }
221
220
 
222
221
  makeCalculationRequest(data: TankFireCalculationRequestSchemaData): TankFireCalculationRequest {
223
- return new TankFireCalculationRequest(
224
- data.atmosphericStorageTank,
225
- data.weather,
226
- data.substrate,
227
- data.flammableParameters
228
- );
222
+ return new TankFireCalculationRequest(data);
229
223
  }
230
224
  }
231
225
 
@@ -240,32 +234,29 @@ export class TankFireCalculation extends CalculationBase {
240
234
  /**
241
235
  * Calculates the flame result and flame coordinates from a pool fire in an open roof tank. The calculations are driven from the atmospheric storage tank entity and are analogous to the standalone pool fire model.
242
236
  *
243
- * @param {Entities.AtmosphericStorageTank} atmosphericStorageTank - an atmospheric storage tank entity.
244
- * @param {Entities.Weather} weather - a weather entity.
245
- * @param {Entities.Substrate} substrate - a substrate entity.
246
- * @param {Entities.FlammableParameters} flammableParameters - a flammable parameters entity.
247
237
  */
248
- constructor(
238
+ constructor(data: {
249
239
  atmosphericStorageTank: Entities.AtmosphericStorageTank,
250
240
  weather: Entities.Weather,
251
241
  substrate: Entities.Substrate,
252
242
  flammableParameters: Entities.FlammableParameters
253
- ) {
254
- super();
255
- this.atmosphericStorageTank = atmosphericStorageTank;
256
- this.weather = weather;
257
- this.substrate = substrate;
258
- this.flammableParameters = flammableParameters;
243
+ controller?: AbortController;
244
+ }) {
245
+ super(data.controller);
246
+ this.atmosphericStorageTank = data.atmosphericStorageTank;
247
+ this.weather = data.weather;
248
+ this.substrate = data.substrate;
249
+ this.flammableParameters = data.flammableParameters;
259
250
  }
260
251
 
261
252
  async run() {
262
253
  try {
263
- const request = new TankFireCalculationRequest(
264
- this.atmosphericStorageTank,
265
- this.weather,
266
- this.substrate,
267
- this.flammableParameters
268
- );
254
+ const request = new TankFireCalculationRequest({
255
+ atmosphericStorageTank: this.atmosphericStorageTank,
256
+ weather: this.weather,
257
+ substrate: this.substrate,
258
+ flammableParameters: this.flammableParameters
259
+ });
269
260
 
270
261
  const schema = new TankFireCalculationRequestSchema();
271
262
  const validatedRequest = schema.validate(request);
@@ -332,24 +323,22 @@ export class TankFireCalculationResponse extends CalculationResponseBase {
332
323
  /**
333
324
  * TankFire calculation response class.
334
325
  *
335
- * @param {Entities.PoolFireFlameResult} poolFireFlameResult - Scalar flame results.
336
- * @param {Entities.FlameRecord[]} flameRecords - an array of pool fire flame records.
337
326
  */
338
- constructor(
327
+ constructor(data: {
339
328
  poolFireFlameResult: Entities.PoolFireFlameResult,
340
329
  flameRecords: Entities.FlameRecord[],
341
330
  resultCode: Enums.ResultCode,
342
331
  messages: string[],
343
332
  calculationElapsedTime: number,
344
333
  operationId: string
345
- ) {
334
+ }) {
346
335
  super();
347
- this.poolFireFlameResult = poolFireFlameResult;
348
- this.flameRecords = flameRecords;
349
- this.resultCode = resultCode;
350
- this.messages = messages;
351
- this.calculationElapsedTime = calculationElapsedTime;
352
- this.operationId = operationId;
336
+ this.poolFireFlameResult = data.poolFireFlameResult;
337
+ this.flameRecords = data.flameRecords;
338
+ this.resultCode = data.resultCode;
339
+ this.messages = data.messages;
340
+ this.calculationElapsedTime = data.calculationElapsedTime;
341
+ this.operationId = data.operationId;
353
342
  }
354
343
 
355
344
  initialiseFromDictionary(data: { [key: string]: unknown }) {
@@ -423,13 +412,6 @@ export class TankFireCalculationResponseSchema {
423
412
  }
424
413
 
425
414
  makeCalculationResponse(data: TankFireCalculationResponseSchemaData): TankFireCalculationResponse {
426
- return new TankFireCalculationResponse(
427
- data.poolFireFlameResult,
428
- data.flameRecords,
429
- data.resultCode,
430
- data.messages,
431
- data.calculationElapsedTime,
432
- data.operationId
433
- );
415
+ return new TankFireCalculationResponse(data);
434
416
  }
435
417
  }
@@ -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
  /**
@@ -177,16 +180,8 @@ class LethalityDistanceCalculationRequest extends CalculationRequestBase {
177
180
  /**
178
181
  * LethalityDistance calculation request class.
179
182
  *
180
- * @param {Entities.Material} material - a material entity with post-discharge composition.
181
- * @param {Entities.ScalarUdmOutputs} scalarUdmOutputs - Scalar dispersion results.
182
- * @param {Entities.Weather} weather - a weather entity.
183
- * @param {Entities.DispersionRecord[]} dispersionRecords - an array of dispersion records.
184
- * @param {number} dispersionRecordCount - Number of dispersion records.
185
- * @param {Entities.Substrate} substrate - a substrate entity.
186
- * @param {Entities.DispersionOutputConfig} dispersionOutputConfig - a dispersion output config entity.
187
- * @param {Entities.DispersionParameters} dispersionParameters - a dispersion parameters entity.
188
183
  */
189
- constructor(
184
+ constructor(data: {
190
185
  material: Entities.Material,
191
186
  scalarUdmOutputs: Entities.ScalarUdmOutputs,
192
187
  weather: Entities.Weather,
@@ -195,16 +190,16 @@ class LethalityDistanceCalculationRequest extends CalculationRequestBase {
195
190
  substrate: Entities.Substrate,
196
191
  dispersionOutputConfig: Entities.DispersionOutputConfig,
197
192
  dispersionParameters: Entities.DispersionParameters
198
- ) {
193
+ }) {
199
194
  super();
200
- this.material = material;
201
- this.scalarUdmOutputs = scalarUdmOutputs;
202
- this.weather = weather;
203
- this.dispersionRecords = dispersionRecords;
204
- this.dispersionRecordCount = dispersionRecordCount;
205
- this.substrate = substrate;
206
- this.dispersionOutputConfig = dispersionOutputConfig;
207
- this.dispersionParameters = dispersionParameters;
195
+ this.material = data.material;
196
+ this.scalarUdmOutputs = data.scalarUdmOutputs;
197
+ this.weather = data.weather;
198
+ this.dispersionRecords = data.dispersionRecords;
199
+ this.dispersionRecordCount = data.dispersionRecordCount;
200
+ this.substrate = data.substrate;
201
+ this.dispersionOutputConfig = data.dispersionOutputConfig;
202
+ this.dispersionParameters = data.dispersionParameters;
208
203
  }
209
204
  }
210
205
 
@@ -248,16 +243,7 @@ export class LethalityDistanceCalculationRequestSchema {
248
243
  }
249
244
 
250
245
  makeCalculationRequest(data: LethalityDistanceCalculationRequestSchemaData): LethalityDistanceCalculationRequest {
251
- return new LethalityDistanceCalculationRequest(
252
- data.material,
253
- data.scalarUdmOutputs,
254
- data.weather,
255
- data.dispersionRecords,
256
- data.dispersionRecordCount,
257
- data.substrate,
258
- data.dispersionOutputConfig,
259
- data.dispersionParameters
260
- );
246
+ return new LethalityDistanceCalculationRequest(data);
261
247
  }
262
248
  }
263
249
 
@@ -275,16 +261,8 @@ export class LethalityDistanceCalculation extends CalculationBase {
275
261
  /**
276
262
  * Probability of death vs distance from a dispersing toxic cloud, down to the minimum probability of death. Integrates dose over time at each location and uses probit relations to convert to a probability of death. A successful dispersion calculation is required as inputfirst.
277
263
  *
278
- * @param {Entities.Material} material - a material entity with post-discharge composition.
279
- * @param {Entities.ScalarUdmOutputs} scalarUdmOutputs - Scalar dispersion results.
280
- * @param {Entities.Weather} weather - a weather entity.
281
- * @param {Entities.DispersionRecord[]} dispersionRecords - an array of dispersion records.
282
- * @param {number} dispersionRecordCount - Number of dispersion records.
283
- * @param {Entities.Substrate} substrate - a substrate entity.
284
- * @param {Entities.DispersionOutputConfig} dispersionOutputConfig - a dispersion output config entity.
285
- * @param {Entities.DispersionParameters} dispersionParameters - a dispersion parameters entity.
286
264
  */
287
- constructor(
265
+ constructor(data: {
288
266
  material: Entities.Material,
289
267
  scalarUdmOutputs: Entities.ScalarUdmOutputs,
290
268
  weather: Entities.Weather,
@@ -293,30 +271,31 @@ export class LethalityDistanceCalculation extends CalculationBase {
293
271
  substrate: Entities.Substrate,
294
272
  dispersionOutputConfig: Entities.DispersionOutputConfig,
295
273
  dispersionParameters: Entities.DispersionParameters
296
- ) {
297
- super();
298
- this.material = material;
299
- this.scalarUdmOutputs = scalarUdmOutputs;
300
- this.weather = weather;
301
- this.dispersionRecords = dispersionRecords;
302
- this.dispersionRecordCount = dispersionRecordCount;
303
- this.substrate = substrate;
304
- this.dispersionOutputConfig = dispersionOutputConfig;
305
- this.dispersionParameters = dispersionParameters;
274
+ controller?: AbortController;
275
+ }) {
276
+ super(data.controller);
277
+ this.material = data.material;
278
+ this.scalarUdmOutputs = data.scalarUdmOutputs;
279
+ this.weather = data.weather;
280
+ this.dispersionRecords = data.dispersionRecords;
281
+ this.dispersionRecordCount = data.dispersionRecordCount;
282
+ this.substrate = data.substrate;
283
+ this.dispersionOutputConfig = data.dispersionOutputConfig;
284
+ this.dispersionParameters = data.dispersionParameters;
306
285
  }
307
286
 
308
287
  async run() {
309
288
  try {
310
- const request = new LethalityDistanceCalculationRequest(
311
- this.material,
312
- this.scalarUdmOutputs,
313
- this.weather,
314
- this.dispersionRecords,
315
- this.dispersionRecordCount,
316
- this.substrate,
317
- this.dispersionOutputConfig,
318
- this.dispersionParameters
319
- );
289
+ const request = new LethalityDistanceCalculationRequest({
290
+ material: this.material,
291
+ scalarUdmOutputs: this.scalarUdmOutputs,
292
+ weather: this.weather,
293
+ dispersionRecords: this.dispersionRecords,
294
+ dispersionRecordCount: this.dispersionRecordCount,
295
+ substrate: this.substrate,
296
+ dispersionOutputConfig: this.dispersionOutputConfig,
297
+ dispersionParameters: this.dispersionParameters
298
+ });
320
299
 
321
300
  const schema = new LethalityDistanceCalculationRequestSchema();
322
301
  const validatedRequest = schema.validate(request);
@@ -380,21 +359,20 @@ export class LethalityDistanceCalculationResponse extends CalculationResponseBas
380
359
  /**
381
360
  * LethalityDistance calculation response class.
382
361
  *
383
- * @param {Entities.ToxicRecord[]} toxicRecords - an array of toxic records.
384
362
  */
385
- constructor(
363
+ constructor(data: {
386
364
  toxicRecords: Entities.ToxicRecord[],
387
365
  resultCode: Enums.ResultCode,
388
366
  messages: string[],
389
367
  calculationElapsedTime: number,
390
368
  operationId: string
391
- ) {
369
+ }) {
392
370
  super();
393
- this.toxicRecords = toxicRecords;
394
- this.resultCode = resultCode;
395
- this.messages = messages;
396
- this.calculationElapsedTime = calculationElapsedTime;
397
- this.operationId = operationId;
371
+ this.toxicRecords = data.toxicRecords;
372
+ this.resultCode = data.resultCode;
373
+ this.messages = data.messages;
374
+ this.calculationElapsedTime = data.calculationElapsedTime;
375
+ this.operationId = data.operationId;
398
376
  }
399
377
 
400
378
  initialiseFromDictionary(data: { [key: string]: unknown }) {
@@ -461,12 +439,6 @@ export class LethalityDistanceCalculationResponseSchema {
461
439
  }
462
440
 
463
441
  makeCalculationResponse(data: LethalityDistanceCalculationResponseSchemaData): LethalityDistanceCalculationResponse {
464
- return new LethalityDistanceCalculationResponse(
465
- data.toxicRecords,
466
- data.resultCode,
467
- data.messages,
468
- data.calculationElapsedTime,
469
- data.operationId
470
- );
442
+ return new LethalityDistanceCalculationResponse(data);
471
443
  }
472
444
  }