@dnv-plant/typescriptpws 1.0.16 → 1.0.18-alpha.1805813

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/src/entities.ts CHANGED
@@ -1,22 +1,45 @@
1
1
  /***********************************************************************
2
2
  * This file has been auto-generated by a code generation tool.
3
- * Version: 1.0.16
4
- * Date/time: 07 Feb 2025 13:02:17
3
+ * Version: 1.0.18
4
+ * Date/time: 18 Feb 2025 14:37:49
5
5
  * Template: templates/typescriptpws/entities.razor.
6
6
  ***********************************************************************/
7
7
 
8
8
  import * as Enums from "./enums";
9
9
 
10
10
  class EntityBase {
11
+ id?: string;
12
+ typeId?: string;
13
+ displayName?: string;
14
+
15
+ constructor(id?: string, typeId?: string, displayName?: string) {
16
+ this.id = id;
17
+ this.typeId = typeId;
18
+ this.displayName = displayName;
19
+ }
11
20
  /**
12
21
  * Base class for all entities.
13
22
  */
14
- initialiseFromDictionary(data: { [key: string]: any }): void {
15
- // Implementation goes here
23
+ initialiseFromDictionary(data: { [key: string]: unknown }): void {
24
+ if (data.id !== undefined && typeof data.id === "string") {
25
+ this.id = data.id as string;
26
+ }
27
+ if (data.typeId !== undefined && typeof data.typeId === "string") {
28
+ this.typeId = data.typeId as string;
29
+ }
30
+ if (data.displayName !== undefined && typeof data.displayName === "string") {
31
+ this.displayName = data.displayName as string;
32
+ }
16
33
  }
17
34
 
18
35
  toString() {
19
- // Implementation goes here
36
+ const parts = [
37
+ "* EntityBase",
38
+ `id: ${this.id}`,
39
+ `typeId: ${this.typeId}`,
40
+ `displayName: ${this.displayName}`,
41
+ ];
42
+ return parts.join("\n");
20
43
  }
21
44
  }
22
45
 
@@ -32,7 +55,11 @@ export class LocalPosition extends EntityBase {
32
55
  * @param {number} y - y coordinate. (default value is 0)
33
56
  * @param {number} z - z coordinate. (default value is 0)
34
57
  */
35
- constructor(x: number = 0, y: number = 0, z: number = 0) {
58
+ constructor(
59
+ x: number = 0,
60
+ y: number = 0,
61
+ z: number = 0
62
+ ) {
36
63
  super();
37
64
  this.x = x;
38
65
  this.y = y;
@@ -40,11 +67,17 @@ export class LocalPosition extends EntityBase {
40
67
  }
41
68
 
42
69
  /** Initialise the entity with data from a dictionary. */
43
- initialiseFromDictionary(data: { [key: string]: any }) {
70
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
44
71
  super.initialiseFromDictionary(data);
45
- this.x = parseFloat(data.x);
46
- this.y = parseFloat(data.y);
47
- this.z = parseFloat(data.z);
72
+ if (data.x !== undefined && typeof data.x === "number") {
73
+ this.x = data.x as number;
74
+ }
75
+ if (data.y !== undefined && typeof data.y === "number") {
76
+ this.y = data.y as number;
77
+ }
78
+ if (data.z !== undefined && typeof data.z === "number") {
79
+ this.z = data.z as number;
80
+ }
48
81
  }
49
82
 
50
83
  toString() {
@@ -66,28 +99,33 @@ export class Asset extends EntityBase {
66
99
  *
67
100
  * @param {LocalPosition} location - Location of the asset.
68
101
  */
69
- constructor(location: LocalPosition = new LocalPosition()) {
102
+ constructor(
103
+ location: LocalPosition = new LocalPosition()
104
+ ) {
70
105
  super();
71
106
  this.location = location;
72
107
  }
73
108
 
74
109
  /** Initialise the entity with data from a dictionary. */
75
- initialiseFromDictionary(data: { [key: string]: any }) {
110
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
76
111
  super.initialiseFromDictionary(data);
77
112
  if (data.location) {
78
113
  this.location = new LocalPosition();
79
- this.location.initialiseFromDictionary(data.location);
114
+ this.location.initialiseFromDictionary(data.location as { [key: string]: unknown });
80
115
  }
81
116
  }
82
117
 
83
118
  toString() {
84
- const parts = ["* Asset", `location: ${this.location?.toString()}`];
119
+ const parts = [
120
+ "* Asset",
121
+ `location: ${this.location?.toString()}`,
122
+ ];
85
123
  return parts.join("\n");
86
124
  }
87
125
  }
88
126
 
89
127
  export class MaterialComponent extends EntityBase {
90
- name?: string;
128
+ name: string;
91
129
  moleFraction: number;
92
130
 
93
131
  /**
@@ -96,17 +134,24 @@ export class MaterialComponent extends EntityBase {
96
134
  * @param {string} name - Name of the component.
97
135
  * @param {number} moleFraction - Mole fraction of the component in the material. (default value is 1)
98
136
  */
99
- constructor(name?: string, moleFraction: number = 1) {
137
+ constructor(
138
+ name: string = "",
139
+ moleFraction: number = 1
140
+ ) {
100
141
  super();
101
142
  this.name = name;
102
143
  this.moleFraction = moleFraction;
103
144
  }
104
145
 
105
146
  /** Initialise the entity with data from a dictionary. */
106
- initialiseFromDictionary(data: { [key: string]: any }) {
147
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
107
148
  super.initialiseFromDictionary(data);
108
- this.name = data.name?.toString();
109
- this.moleFraction = parseFloat(data.moleFraction);
149
+ if (data.name !== undefined && typeof data.name === "string") {
150
+ this.name = data.name as string;
151
+ }
152
+ if (data.moleFraction !== undefined && typeof data.moleFraction === "number") {
153
+ this.moleFraction = data.moleFraction as number;
154
+ }
110
155
  }
111
156
 
112
157
  toString() {
@@ -120,7 +165,7 @@ export class MaterialComponent extends EntityBase {
120
165
  }
121
166
 
122
167
  export class Material extends EntityBase {
123
- name?: string;
168
+ name: string;
124
169
  components: MaterialComponent[];
125
170
  componentCount: number;
126
171
  propertyTemplate?: Enums.PropertyTemplate;
@@ -134,7 +179,7 @@ export class Material extends EntityBase {
134
179
  * @param {Enums.PropertyTemplate} propertyTemplate - The template to be used for the selection of calculation methods for material properties. (default value is Enums.PropertyTemplate.PHAST_MC)
135
180
  */
136
181
  constructor(
137
- name?: string,
182
+ name: string = "",
138
183
  components: MaterialComponent[] = [new MaterialComponent()],
139
184
  componentCount: number = 1,
140
185
  propertyTemplate: Enums.PropertyTemplate = Enums.PropertyTemplate.PHAST_MC
@@ -147,31 +192,32 @@ export class Material extends EntityBase {
147
192
  }
148
193
 
149
194
  /** Initialise the entity with data from a dictionary. */
150
- initialiseFromDictionary(data: { [key: string]: any }) {
195
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
151
196
  super.initialiseFromDictionary(data);
152
- this.name = data.name?.toString();
153
- if (data.components) {
154
- this.components = data.components.map((item: any) =>
155
- new MaterialComponent().initialiseFromDictionary(item)
197
+ if (data.name !== undefined && typeof data.name === "string") {
198
+ this.name = data.name as string;
199
+ }
200
+ if (data.components && Array.isArray(data.components)) {
201
+ this.components = data.components.map(
202
+ (item) => {
203
+ const record = new MaterialComponent();
204
+ record.initialiseFromDictionary(item);
205
+ return record;
206
+ }
156
207
  );
157
208
  }
158
- this.componentCount = parseInt(data.componentCount);
159
- this.propertyTemplate = this.parseEnumValue(
160
- data.propertyTemplate,
161
- Enums.PropertyTemplate
162
- );
209
+ if (data.componentCount !== undefined && typeof data.componentCount === "number") {
210
+ this.componentCount = data.componentCount as number;
211
+ }
212
+ if (data.propertyTemplate !== undefined && (typeof data.propertyTemplate === "string" || typeof data.propertyTemplate === "number")) {
213
+ this.propertyTemplate = this.parseEnumValue(data.propertyTemplate, Enums.PropertyTemplate);
214
+ }
163
215
  }
164
216
 
165
- private parseEnumValue<T extends object>(
166
- value: any,
167
- enumType: T
168
- ): T[keyof T] | undefined {
217
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
169
218
  if (typeof value === "string" && value in enumType) {
170
219
  return enumType[value as keyof T];
171
- } else if (
172
- typeof value === "number" &&
173
- Object.values(enumType).includes(value)
174
- ) {
220
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
175
221
  return value as T[keyof T];
176
222
  }
177
223
  return undefined; // Return undefined if the value does not match the enum
@@ -181,7 +227,7 @@ export class Material extends EntityBase {
181
227
  const parts = [
182
228
  "* Material",
183
229
  `name: ${this.name}`,
184
- this.components?.map((item: any) => item?.toString()).join("\n"),
230
+ this.components?.map((item) => item?.toString()).join("\n"),
185
231
  `componentCount: ${this.componentCount}`,
186
232
  `propertyTemplate: ${this.propertyTemplate}`,
187
233
  ];
@@ -221,28 +267,29 @@ export class State extends EntityBase {
221
267
  }
222
268
 
223
269
  /** Initialise the entity with data from a dictionary. */
224
- initialiseFromDictionary(data: { [key: string]: any }) {
270
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
225
271
  super.initialiseFromDictionary(data);
226
- this.pressure = parseFloat(data.pressure);
227
- this.temperature = parseFloat(data.temperature);
228
- this.liquidFraction = parseFloat(data.liquidFraction);
229
- this.flashFlag = this.parseEnumValue(data.flashFlag, Enums.FluidSpec);
230
- this.mixtureModelling = this.parseEnumValue(
231
- data.mixtureModelling,
232
- Enums.MixtureModelling
233
- );
234
- }
235
-
236
- private parseEnumValue<T extends object>(
237
- value: any,
238
- enumType: T
239
- ): T[keyof T] | undefined {
272
+ if (data.pressure !== undefined && typeof data.pressure === "number") {
273
+ this.pressure = data.pressure as number;
274
+ }
275
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
276
+ this.temperature = data.temperature as number;
277
+ }
278
+ if (data.liquidFraction !== undefined && typeof data.liquidFraction === "number") {
279
+ this.liquidFraction = data.liquidFraction as number;
280
+ }
281
+ if (data.flashFlag !== undefined && (typeof data.flashFlag === "string" || typeof data.flashFlag === "number")) {
282
+ this.flashFlag = this.parseEnumValue(data.flashFlag, Enums.FluidSpec);
283
+ }
284
+ if (data.mixtureModelling !== undefined && (typeof data.mixtureModelling === "string" || typeof data.mixtureModelling === "number")) {
285
+ this.mixtureModelling = this.parseEnumValue(data.mixtureModelling, Enums.MixtureModelling);
286
+ }
287
+ }
288
+
289
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
240
290
  if (typeof value === "string" && value in enumType) {
241
291
  return enumType[value as keyof T];
242
- } else if (
243
- typeof value === "number" &&
244
- Object.values(enumType).includes(value)
245
- ) {
292
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
246
293
  return value as T[keyof T];
247
294
  }
248
295
  return undefined; // Return undefined if the value does not match the enum
@@ -295,21 +342,25 @@ export class AtmosphericStorageTank extends Asset {
295
342
  }
296
343
 
297
344
  /** Initialise the entity with data from a dictionary. */
298
- initialiseFromDictionary(data: { [key: string]: any }) {
345
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
299
346
  super.initialiseFromDictionary(data);
300
347
  if (data.state) {
301
348
  this.state = new State();
302
- this.state.initialiseFromDictionary(data.state);
349
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
350
+ }
351
+ if (data.diameter !== undefined && typeof data.diameter === "number") {
352
+ this.diameter = data.diameter as number;
353
+ }
354
+ if (data.height !== undefined && typeof data.height === "number") {
355
+ this.height = data.height as number;
303
356
  }
304
- this.diameter = parseFloat(data.diameter);
305
- this.height = parseFloat(data.height);
306
357
  if (data.material) {
307
358
  this.material = new Material();
308
- this.material.initialiseFromDictionary(data.material);
359
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
360
+ }
361
+ if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume === "number") {
362
+ this.liquidFillFractionByVolume = data.liquidFillFractionByVolume as number;
309
363
  }
310
- this.liquidFillFractionByVolume = parseFloat(
311
- data.liquidFillFractionByVolume
312
- );
313
364
  }
314
365
 
315
366
  toString() {
@@ -350,11 +401,17 @@ export class Bund extends EntityBase {
350
401
  }
351
402
 
352
403
  /** Initialise the entity with data from a dictionary. */
353
- initialiseFromDictionary(data: { [key: string]: any }) {
404
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
354
405
  super.initialiseFromDictionary(data);
355
- this.bundHeight = parseFloat(data.bundHeight);
356
- this.bundDiameter = parseFloat(data.bundDiameter);
357
- this.specifyBund = data.specifyBund;
406
+ if (data.bundHeight !== undefined && typeof data.bundHeight === "number") {
407
+ this.bundHeight = data.bundHeight as number;
408
+ }
409
+ if (data.bundDiameter !== undefined && typeof data.bundDiameter === "number") {
410
+ this.bundDiameter = data.bundDiameter as number;
411
+ }
412
+ if (data.specifyBund !== undefined && typeof data.specifyBund === "boolean") {
413
+ this.specifyBund = data.specifyBund as boolean;
414
+ }
358
415
  }
359
416
 
360
417
  toString() {
@@ -373,17 +430,20 @@ export class Scenario extends EntityBase {
373
430
  * Base struct/class for all scenario types.
374
431
  *
375
432
  */
376
- constructor() {
433
+ constructor(
434
+ ) {
377
435
  super();
378
436
  }
379
437
 
380
438
  /** Initialise the entity with data from a dictionary. */
381
- initialiseFromDictionary(data: { [key: string]: any }) {
439
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
382
440
  super.initialiseFromDictionary(data);
383
441
  }
384
442
 
385
443
  toString() {
386
- const parts = ["* Scenario"];
444
+ const parts = [
445
+ "* Scenario",
446
+ ];
387
447
  return parts.join("\n");
388
448
  }
389
449
  }
@@ -393,17 +453,20 @@ export class Instantaneous extends Scenario {
393
453
  * Base struct/class for instantaneous release scenarios.
394
454
  *
395
455
  */
396
- constructor() {
456
+ constructor(
457
+ ) {
397
458
  super();
398
459
  }
399
460
 
400
461
  /** Initialise the entity with data from a dictionary. */
401
- initialiseFromDictionary(data: { [key: string]: any }) {
462
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
402
463
  super.initialiseFromDictionary(data);
403
464
  }
404
465
 
405
466
  toString() {
406
- const parts = ["* Instantaneous"];
467
+ const parts = [
468
+ "* Instantaneous",
469
+ ];
407
470
  return parts.join("\n");
408
471
  }
409
472
  }
@@ -413,17 +476,20 @@ export class CatastrophicRupture extends Instantaneous {
413
476
  * An instanaeous release of the entire inventory of an associated vessel, intended to model an incident in which the vessel is destroyed by an impact, a crack, or some other failure which propagates very quickly.
414
477
  *
415
478
  */
416
- constructor() {
479
+ constructor(
480
+ ) {
417
481
  super();
418
482
  }
419
483
 
420
484
  /** Initialise the entity with data from a dictionary. */
421
- initialiseFromDictionary(data: { [key: string]: any }) {
485
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
422
486
  super.initialiseFromDictionary(data);
423
487
  }
424
488
 
425
489
  toString() {
426
- const parts = ["* CatastrophicRupture"];
490
+ const parts = [
491
+ "* CatastrophicRupture",
492
+ ];
427
493
  return parts.join("\n");
428
494
  }
429
495
  }
@@ -448,12 +514,14 @@ export class ConcentrationRecord extends EntityBase {
448
514
  }
449
515
 
450
516
  /** Initialise the entity with data from a dictionary. */
451
- initialiseFromDictionary(data: { [key: string]: any }) {
517
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
452
518
  super.initialiseFromDictionary(data);
453
- this.concentration = parseFloat(data.concentration);
519
+ if (data.concentration !== undefined && typeof data.concentration === "number") {
520
+ this.concentration = data.concentration as number;
521
+ }
454
522
  if (data.position) {
455
523
  this.position = new LocalPosition();
456
- this.position.initialiseFromDictionary(data.position);
524
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
457
525
  }
458
526
  }
459
527
 
@@ -491,11 +559,17 @@ export class ConstantMaterialResult extends EntityBase {
491
559
  }
492
560
 
493
561
  /** Initialise the entity with data from a dictionary. */
494
- initialiseFromDictionary(data: { [key: string]: any }) {
562
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
495
563
  super.initialiseFromDictionary(data);
496
- this.criticalPressure = parseFloat(data.criticalPressure);
497
- this.criticalTemperature = parseFloat(data.criticalTemperature);
498
- this.totalMolecularWeight = parseFloat(data.totalMolecularWeight);
564
+ if (data.criticalPressure !== undefined && typeof data.criticalPressure === "number") {
565
+ this.criticalPressure = data.criticalPressure as number;
566
+ }
567
+ if (data.criticalTemperature !== undefined && typeof data.criticalTemperature === "number") {
568
+ this.criticalTemperature = data.criticalTemperature as number;
569
+ }
570
+ if (data.totalMolecularWeight !== undefined && typeof data.totalMolecularWeight === "number") {
571
+ this.totalMolecularWeight = data.totalMolecularWeight as number;
572
+ }
499
573
  }
500
574
 
501
575
  toString() {
@@ -518,32 +592,24 @@ export class DischargeParameters extends EntityBase {
518
592
  * @param {Enums.FlashAtOrifice} flashAtOrifice - Whether discharge calculations should allow the phase to change between storage and orifice conditions. (default value is Enums.FlashAtOrifice.DISALLOW_LIQUID_FLASH)
519
593
  */
520
594
  constructor(
521
- flashAtOrifice: Enums.FlashAtOrifice = Enums.FlashAtOrifice
522
- .DISALLOW_LIQUID_FLASH
595
+ flashAtOrifice: Enums.FlashAtOrifice = Enums.FlashAtOrifice.DISALLOW_LIQUID_FLASH
523
596
  ) {
524
597
  super();
525
598
  this.flashAtOrifice = flashAtOrifice;
526
599
  }
527
600
 
528
601
  /** Initialise the entity with data from a dictionary. */
529
- initialiseFromDictionary(data: { [key: string]: any }) {
602
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
530
603
  super.initialiseFromDictionary(data);
531
- this.flashAtOrifice = this.parseEnumValue(
532
- data.flashAtOrifice,
533
- Enums.FlashAtOrifice
534
- );
604
+ if (data.flashAtOrifice !== undefined && (typeof data.flashAtOrifice === "string" || typeof data.flashAtOrifice === "number")) {
605
+ this.flashAtOrifice = this.parseEnumValue(data.flashAtOrifice, Enums.FlashAtOrifice);
606
+ }
535
607
  }
536
608
 
537
- private parseEnumValue<T extends object>(
538
- value: any,
539
- enumType: T
540
- ): T[keyof T] | undefined {
609
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
541
610
  if (typeof value === "string" && value in enumType) {
542
611
  return enumType[value as keyof T];
543
- } else if (
544
- typeof value === "number" &&
545
- Object.values(enumType).includes(value)
546
- ) {
612
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
547
613
  return value as T[keyof T];
548
614
  }
549
615
  return undefined; // Return undefined if the value does not match the enum
@@ -606,26 +672,38 @@ export class DischargeRecord extends EntityBase {
606
672
  }
607
673
 
608
674
  /** Initialise the entity with data from a dictionary. */
609
- initialiseFromDictionary(data: { [key: string]: any }) {
675
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
610
676
  super.initialiseFromDictionary(data);
611
- this.time = parseFloat(data.time);
612
- this.massFlow = parseFloat(data.massFlow);
677
+ if (data.time !== undefined && typeof data.time === "number") {
678
+ this.time = data.time as number;
679
+ }
680
+ if (data.massFlow !== undefined && typeof data.massFlow === "number") {
681
+ this.massFlow = data.massFlow as number;
682
+ }
613
683
  if (data.finalState) {
614
684
  this.finalState = new State();
615
- this.finalState.initialiseFromDictionary(data.finalState);
685
+ this.finalState.initialiseFromDictionary(data.finalState as { [key: string]: unknown });
686
+ }
687
+ if (data.finalVelocity !== undefined && typeof data.finalVelocity === "number") {
688
+ this.finalVelocity = data.finalVelocity as number;
616
689
  }
617
- this.finalVelocity = parseFloat(data.finalVelocity);
618
690
  if (data.orificeState) {
619
691
  this.orificeState = new State();
620
- this.orificeState.initialiseFromDictionary(data.orificeState);
692
+ this.orificeState.initialiseFromDictionary(data.orificeState as { [key: string]: unknown });
693
+ }
694
+ if (data.orificeVelocity !== undefined && typeof data.orificeVelocity === "number") {
695
+ this.orificeVelocity = data.orificeVelocity as number;
621
696
  }
622
- this.orificeVelocity = parseFloat(data.orificeVelocity);
623
697
  if (data.storageState) {
624
698
  this.storageState = new State();
625
- this.storageState.initialiseFromDictionary(data.storageState);
699
+ this.storageState.initialiseFromDictionary(data.storageState as { [key: string]: unknown });
700
+ }
701
+ if (data.dropletDiameter !== undefined && typeof data.dropletDiameter === "number") {
702
+ this.dropletDiameter = data.dropletDiameter as number;
703
+ }
704
+ if (data.expandedDiameter !== undefined && typeof data.expandedDiameter === "number") {
705
+ this.expandedDiameter = data.expandedDiameter as number;
626
706
  }
627
- this.dropletDiameter = parseFloat(data.dropletDiameter);
628
- this.expandedDiameter = parseFloat(data.expandedDiameter);
629
707
  }
630
708
 
631
709
  toString() {
@@ -685,27 +763,35 @@ export class DischargeResult extends EntityBase {
685
763
  }
686
764
 
687
765
  /** Initialise the entity with data from a dictionary. */
688
- initialiseFromDictionary(data: { [key: string]: any }) {
766
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
689
767
  super.initialiseFromDictionary(data);
690
- this.expansionEnergy = parseFloat(data.expansionEnergy);
691
- this.releaseMass = parseFloat(data.releaseMass);
692
- this.height = parseFloat(data.height);
693
- this.angle = parseFloat(data.angle);
694
- this.holeDiameter = parseFloat(data.holeDiameter);
695
- this.releaseType = this.parseEnumValue(data.releaseType, Enums.DynamicType);
696
- this.preDilutionAirRate = parseFloat(data.preDilutionAirRate);
697
- }
698
-
699
- private parseEnumValue<T extends object>(
700
- value: any,
701
- enumType: T
702
- ): T[keyof T] | undefined {
768
+ if (data.expansionEnergy !== undefined && typeof data.expansionEnergy === "number") {
769
+ this.expansionEnergy = data.expansionEnergy as number;
770
+ }
771
+ if (data.releaseMass !== undefined && typeof data.releaseMass === "number") {
772
+ this.releaseMass = data.releaseMass as number;
773
+ }
774
+ if (data.height !== undefined && typeof data.height === "number") {
775
+ this.height = data.height as number;
776
+ }
777
+ if (data.angle !== undefined && typeof data.angle === "number") {
778
+ this.angle = data.angle as number;
779
+ }
780
+ if (data.holeDiameter !== undefined && typeof data.holeDiameter === "number") {
781
+ this.holeDiameter = data.holeDiameter as number;
782
+ }
783
+ if (data.releaseType !== undefined && (typeof data.releaseType === "string" || typeof data.releaseType === "number")) {
784
+ this.releaseType = this.parseEnumValue(data.releaseType, Enums.DynamicType);
785
+ }
786
+ if (data.preDilutionAirRate !== undefined && typeof data.preDilutionAirRate === "number") {
787
+ this.preDilutionAirRate = data.preDilutionAirRate as number;
788
+ }
789
+ }
790
+
791
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
703
792
  if (typeof value === "string" && value in enumType) {
704
793
  return enumType[value as keyof T];
705
- } else if (
706
- typeof value === "number" &&
707
- Object.values(enumType).includes(value)
708
- ) {
794
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
709
795
  return value as T[keyof T];
710
796
  }
711
797
  return undefined; // Return undefined if the value does not match the enum
@@ -737,7 +823,7 @@ export class DispersionOutputConfig extends EntityBase {
737
823
  contourType?: Enums.ContourType;
738
824
  lflFractionValue: number;
739
825
  componentToTrackIndex: number;
740
- componentToTrackName?: string;
826
+ componentToTrackName: string;
741
827
 
742
828
  /**
743
829
  * Dispersion plotting and reporting parameters.
@@ -759,14 +845,13 @@ export class DispersionOutputConfig extends EntityBase {
759
845
  time: number = 60,
760
846
  resolution: Enums.Resolution = Enums.Resolution.MEDIUM,
761
847
  elevation: number = 1,
762
- specialConcentration: Enums.SpecialConcentration = Enums
763
- .SpecialConcentration.MIN,
848
+ specialConcentration: Enums.SpecialConcentration = Enums.SpecialConcentration.MIN,
764
849
  concentration: number = 0,
765
850
  crosswindDistance: number = 0,
766
851
  contourType: Enums.ContourType = Enums.ContourType.FOOTPRINT,
767
852
  lflFractionValue: number = 0.5,
768
853
  componentToTrackIndex: number = -1,
769
- componentToTrackName?: string
854
+ componentToTrackName: string = ""
770
855
  ) {
771
856
  super();
772
857
  this.downwindDistance = downwindDistance;
@@ -783,34 +868,47 @@ export class DispersionOutputConfig extends EntityBase {
783
868
  }
784
869
 
785
870
  /** Initialise the entity with data from a dictionary. */
786
- initialiseFromDictionary(data: { [key: string]: any }) {
871
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
787
872
  super.initialiseFromDictionary(data);
788
- this.downwindDistance = parseFloat(data.downwindDistance);
789
- this.time = parseFloat(data.time);
790
- this.resolution = this.parseEnumValue(data.resolution, Enums.Resolution);
791
- this.elevation = parseFloat(data.elevation);
792
- this.specialConcentration = this.parseEnumValue(
793
- data.specialConcentration,
794
- Enums.SpecialConcentration
795
- );
796
- this.concentration = parseFloat(data.concentration);
797
- this.crosswindDistance = parseFloat(data.crosswindDistance);
798
- this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
799
- this.lflFractionValue = parseFloat(data.lflFractionValue);
800
- this.componentToTrackIndex = parseInt(data.componentToTrackIndex);
801
- this.componentToTrackName = data.componentToTrackName?.toString();
802
- }
803
-
804
- private parseEnumValue<T extends object>(
805
- value: any,
806
- enumType: T
807
- ): T[keyof T] | undefined {
873
+ if (data.downwindDistance !== undefined && typeof data.downwindDistance === "number") {
874
+ this.downwindDistance = data.downwindDistance as number;
875
+ }
876
+ if (data.time !== undefined && typeof data.time === "number") {
877
+ this.time = data.time as number;
878
+ }
879
+ if (data.resolution !== undefined && (typeof data.resolution === "string" || typeof data.resolution === "number")) {
880
+ this.resolution = this.parseEnumValue(data.resolution, Enums.Resolution);
881
+ }
882
+ if (data.elevation !== undefined && typeof data.elevation === "number") {
883
+ this.elevation = data.elevation as number;
884
+ }
885
+ if (data.specialConcentration !== undefined && (typeof data.specialConcentration === "string" || typeof data.specialConcentration === "number")) {
886
+ this.specialConcentration = this.parseEnumValue(data.specialConcentration, Enums.SpecialConcentration);
887
+ }
888
+ if (data.concentration !== undefined && typeof data.concentration === "number") {
889
+ this.concentration = data.concentration as number;
890
+ }
891
+ if (data.crosswindDistance !== undefined && typeof data.crosswindDistance === "number") {
892
+ this.crosswindDistance = data.crosswindDistance as number;
893
+ }
894
+ if (data.contourType !== undefined && (typeof data.contourType === "string" || typeof data.contourType === "number")) {
895
+ this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
896
+ }
897
+ if (data.lflFractionValue !== undefined && typeof data.lflFractionValue === "number") {
898
+ this.lflFractionValue = data.lflFractionValue as number;
899
+ }
900
+ if (data.componentToTrackIndex !== undefined && typeof data.componentToTrackIndex === "number") {
901
+ this.componentToTrackIndex = data.componentToTrackIndex as number;
902
+ }
903
+ if (data.componentToTrackName !== undefined && typeof data.componentToTrackName === "string") {
904
+ this.componentToTrackName = data.componentToTrackName as string;
905
+ }
906
+ }
907
+
908
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
808
909
  if (typeof value === "string" && value in enumType) {
809
910
  return enumType[value as keyof T];
810
- } else if (
811
- typeof value === "number" &&
812
- Object.values(enumType).includes(value)
813
- ) {
911
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
814
912
  return value as T[keyof T];
815
913
  }
816
914
  return undefined; // Return undefined if the value does not match the enum
@@ -863,8 +961,7 @@ export class DispersionParameters extends EntityBase {
863
961
  */
864
962
  constructor(
865
963
  relativeTolerance: number = 0.001,
866
- rainoutThermoFlag: Enums.RainoutThermoFlag = Enums.RainoutThermoFlag
867
- .RAINOUT_NON_EQUILIBRIUM,
964
+ rainoutThermoFlag: Enums.RainoutThermoFlag = Enums.RainoutThermoFlag.RAINOUT_NON_EQUILIBRIUM,
868
965
  fixedStepSize: number = 0.01,
869
966
  outputStepMultiplier: number = 1.2,
870
967
  maxDispersionDistance: number = 50000,
@@ -888,33 +985,44 @@ export class DispersionParameters extends EntityBase {
888
985
  }
889
986
 
890
987
  /** Initialise the entity with data from a dictionary. */
891
- initialiseFromDictionary(data: { [key: string]: any }) {
988
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
892
989
  super.initialiseFromDictionary(data);
893
- this.relativeTolerance = parseFloat(data.relativeTolerance);
894
- this.rainoutThermoFlag = this.parseEnumValue(
895
- data.rainoutThermoFlag,
896
- Enums.RainoutThermoFlag
897
- );
898
- this.fixedStepSize = parseFloat(data.fixedStepSize);
899
- this.outputStepMultiplier = parseFloat(data.outputStepMultiplier);
900
- this.maxDispersionDistance = parseFloat(data.maxDispersionDistance);
901
- this.maxDispersionHeight = parseFloat(data.maxDispersionHeight);
902
- this.numberOfReleaseObservers = parseInt(data.numberOfReleaseObservers);
903
- this.numberOfPoolObservers = parseInt(data.numberOfPoolObservers);
904
- this.averagingTime = parseFloat(data.averagingTime);
905
- this.lflFractionToStop = parseFloat(data.lflFractionToStop);
906
- }
907
-
908
- private parseEnumValue<T extends object>(
909
- value: any,
910
- enumType: T
911
- ): T[keyof T] | undefined {
990
+ if (data.relativeTolerance !== undefined && typeof data.relativeTolerance === "number") {
991
+ this.relativeTolerance = data.relativeTolerance as number;
992
+ }
993
+ if (data.rainoutThermoFlag !== undefined && (typeof data.rainoutThermoFlag === "string" || typeof data.rainoutThermoFlag === "number")) {
994
+ this.rainoutThermoFlag = this.parseEnumValue(data.rainoutThermoFlag, Enums.RainoutThermoFlag);
995
+ }
996
+ if (data.fixedStepSize !== undefined && typeof data.fixedStepSize === "number") {
997
+ this.fixedStepSize = data.fixedStepSize as number;
998
+ }
999
+ if (data.outputStepMultiplier !== undefined && typeof data.outputStepMultiplier === "number") {
1000
+ this.outputStepMultiplier = data.outputStepMultiplier as number;
1001
+ }
1002
+ if (data.maxDispersionDistance !== undefined && typeof data.maxDispersionDistance === "number") {
1003
+ this.maxDispersionDistance = data.maxDispersionDistance as number;
1004
+ }
1005
+ if (data.maxDispersionHeight !== undefined && typeof data.maxDispersionHeight === "number") {
1006
+ this.maxDispersionHeight = data.maxDispersionHeight as number;
1007
+ }
1008
+ if (data.numberOfReleaseObservers !== undefined && typeof data.numberOfReleaseObservers === "number") {
1009
+ this.numberOfReleaseObservers = data.numberOfReleaseObservers as number;
1010
+ }
1011
+ if (data.numberOfPoolObservers !== undefined && typeof data.numberOfPoolObservers === "number") {
1012
+ this.numberOfPoolObservers = data.numberOfPoolObservers as number;
1013
+ }
1014
+ if (data.averagingTime !== undefined && typeof data.averagingTime === "number") {
1015
+ this.averagingTime = data.averagingTime as number;
1016
+ }
1017
+ if (data.lflFractionToStop !== undefined && typeof data.lflFractionToStop === "number") {
1018
+ this.lflFractionToStop = data.lflFractionToStop as number;
1019
+ }
1020
+ }
1021
+
1022
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
912
1023
  if (typeof value === "string" && value in enumType) {
913
1024
  return enumType[value as keyof T];
914
- } else if (
915
- typeof value === "number" &&
916
- Object.values(enumType).includes(value)
917
- ) {
1025
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
918
1026
  return value as T[keyof T];
919
1027
  }
920
1028
  return undefined; // Return undefined if the value does not match the enum
@@ -1038,8 +1146,7 @@ export class DispersionRecord extends EntityBase {
1038
1146
  this.centrelineConcentration = centrelineConcentration;
1039
1147
  this.downwindDistance = downwindDistance;
1040
1148
  this.time = time;
1041
- this.centrelineConcentrationUncorrected =
1042
- centrelineConcentrationUncorrected;
1149
+ this.centrelineConcentrationUncorrected = centrelineConcentrationUncorrected;
1043
1150
  this.crosswindRadius = crosswindRadius;
1044
1151
  this.verticalRadius = verticalRadius;
1045
1152
  this.crosswindExponent = crosswindExponent;
@@ -1067,51 +1174,101 @@ export class DispersionRecord extends EntityBase {
1067
1174
  }
1068
1175
 
1069
1176
  /** Initialise the entity with data from a dictionary. */
1070
- initialiseFromDictionary(data: { [key: string]: any }) {
1177
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1071
1178
  super.initialiseFromDictionary(data);
1072
- this.observerIndex = parseInt(data.observerIndex);
1073
- this.centrelineConcentration = parseFloat(data.centrelineConcentration);
1074
- this.downwindDistance = parseFloat(data.downwindDistance);
1075
- this.time = parseFloat(data.time);
1076
- this.centrelineConcentrationUncorrected = parseFloat(
1077
- data.centrelineConcentrationUncorrected
1078
- );
1079
- this.crosswindRadius = parseFloat(data.crosswindRadius);
1080
- this.verticalRadius = parseFloat(data.verticalRadius);
1081
- this.crosswindExponent = parseFloat(data.crosswindExponent);
1082
- this.verticalExponent = parseFloat(data.verticalExponent);
1083
- this.theta = parseFloat(data.theta);
1084
- this.centrelineHeight = parseFloat(data.centrelineHeight);
1085
- this.liquidFraction = parseFloat(data.liquidFraction);
1086
- this.vapourTemperature = parseFloat(data.vapourTemperature);
1087
- this.massConc = parseFloat(data.massConc);
1088
- this.velocity = parseFloat(data.velocity);
1089
- this.massFlow = parseFloat(data.massFlow);
1090
- this.profileFlag = parseInt(data.profileFlag);
1091
- this.elevFlag = parseInt(data.elevFlag);
1092
- this.rhoCloud = parseFloat(data.rhoCloud);
1093
- this.liqTemp = parseFloat(data.liqTemp);
1094
- this.effectiveWidth = parseFloat(data.effectiveWidth);
1095
- this.effectiveHeight = parseFloat(data.effectiveHeight);
1096
- this.passTranDist = parseFloat(data.passTranDist);
1097
- this.downwindRadius = parseFloat(data.downwindRadius);
1098
- this.dropletDiameter = parseFloat(data.dropletDiameter);
1099
- this.dropletHeight = parseFloat(data.dropletHeight);
1100
- this.dropletDistance = parseFloat(data.dropletDistance);
1101
- this.mass = parseFloat(data.mass);
1102
- this.instCon = this.parseEnumValue(data.instCon, Enums.DynamicType);
1103
- }
1104
-
1105
- private parseEnumValue<T extends object>(
1106
- value: any,
1107
- enumType: T
1108
- ): T[keyof T] | undefined {
1179
+ if (data.observerIndex !== undefined && typeof data.observerIndex === "number") {
1180
+ this.observerIndex = data.observerIndex as number;
1181
+ }
1182
+ if (data.centrelineConcentration !== undefined && typeof data.centrelineConcentration === "number") {
1183
+ this.centrelineConcentration = data.centrelineConcentration as number;
1184
+ }
1185
+ if (data.downwindDistance !== undefined && typeof data.downwindDistance === "number") {
1186
+ this.downwindDistance = data.downwindDistance as number;
1187
+ }
1188
+ if (data.time !== undefined && typeof data.time === "number") {
1189
+ this.time = data.time as number;
1190
+ }
1191
+ if (data.centrelineConcentrationUncorrected !== undefined && typeof data.centrelineConcentrationUncorrected === "number") {
1192
+ this.centrelineConcentrationUncorrected = data.centrelineConcentrationUncorrected as number;
1193
+ }
1194
+ if (data.crosswindRadius !== undefined && typeof data.crosswindRadius === "number") {
1195
+ this.crosswindRadius = data.crosswindRadius as number;
1196
+ }
1197
+ if (data.verticalRadius !== undefined && typeof data.verticalRadius === "number") {
1198
+ this.verticalRadius = data.verticalRadius as number;
1199
+ }
1200
+ if (data.crosswindExponent !== undefined && typeof data.crosswindExponent === "number") {
1201
+ this.crosswindExponent = data.crosswindExponent as number;
1202
+ }
1203
+ if (data.verticalExponent !== undefined && typeof data.verticalExponent === "number") {
1204
+ this.verticalExponent = data.verticalExponent as number;
1205
+ }
1206
+ if (data.theta !== undefined && typeof data.theta === "number") {
1207
+ this.theta = data.theta as number;
1208
+ }
1209
+ if (data.centrelineHeight !== undefined && typeof data.centrelineHeight === "number") {
1210
+ this.centrelineHeight = data.centrelineHeight as number;
1211
+ }
1212
+ if (data.liquidFraction !== undefined && typeof data.liquidFraction === "number") {
1213
+ this.liquidFraction = data.liquidFraction as number;
1214
+ }
1215
+ if (data.vapourTemperature !== undefined && typeof data.vapourTemperature === "number") {
1216
+ this.vapourTemperature = data.vapourTemperature as number;
1217
+ }
1218
+ if (data.massConc !== undefined && typeof data.massConc === "number") {
1219
+ this.massConc = data.massConc as number;
1220
+ }
1221
+ if (data.velocity !== undefined && typeof data.velocity === "number") {
1222
+ this.velocity = data.velocity as number;
1223
+ }
1224
+ if (data.massFlow !== undefined && typeof data.massFlow === "number") {
1225
+ this.massFlow = data.massFlow as number;
1226
+ }
1227
+ if (data.profileFlag !== undefined && typeof data.profileFlag === "number") {
1228
+ this.profileFlag = data.profileFlag as number;
1229
+ }
1230
+ if (data.elevFlag !== undefined && typeof data.elevFlag === "number") {
1231
+ this.elevFlag = data.elevFlag as number;
1232
+ }
1233
+ if (data.rhoCloud !== undefined && typeof data.rhoCloud === "number") {
1234
+ this.rhoCloud = data.rhoCloud as number;
1235
+ }
1236
+ if (data.liqTemp !== undefined && typeof data.liqTemp === "number") {
1237
+ this.liqTemp = data.liqTemp as number;
1238
+ }
1239
+ if (data.effectiveWidth !== undefined && typeof data.effectiveWidth === "number") {
1240
+ this.effectiveWidth = data.effectiveWidth as number;
1241
+ }
1242
+ if (data.effectiveHeight !== undefined && typeof data.effectiveHeight === "number") {
1243
+ this.effectiveHeight = data.effectiveHeight as number;
1244
+ }
1245
+ if (data.passTranDist !== undefined && typeof data.passTranDist === "number") {
1246
+ this.passTranDist = data.passTranDist as number;
1247
+ }
1248
+ if (data.downwindRadius !== undefined && typeof data.downwindRadius === "number") {
1249
+ this.downwindRadius = data.downwindRadius as number;
1250
+ }
1251
+ if (data.dropletDiameter !== undefined && typeof data.dropletDiameter === "number") {
1252
+ this.dropletDiameter = data.dropletDiameter as number;
1253
+ }
1254
+ if (data.dropletHeight !== undefined && typeof data.dropletHeight === "number") {
1255
+ this.dropletHeight = data.dropletHeight as number;
1256
+ }
1257
+ if (data.dropletDistance !== undefined && typeof data.dropletDistance === "number") {
1258
+ this.dropletDistance = data.dropletDistance as number;
1259
+ }
1260
+ if (data.mass !== undefined && typeof data.mass === "number") {
1261
+ this.mass = data.mass as number;
1262
+ }
1263
+ if (data.instCon !== undefined && (typeof data.instCon === "string" || typeof data.instCon === "number")) {
1264
+ this.instCon = this.parseEnumValue(data.instCon, Enums.DynamicType);
1265
+ }
1266
+ }
1267
+
1268
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1109
1269
  if (typeof value === "string" && value in enumType) {
1110
1270
  return enumType[value as keyof T];
1111
- } else if (
1112
- typeof value === "number" &&
1113
- Object.values(enumType).includes(value)
1114
- ) {
1271
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1115
1272
  return value as T[keyof T];
1116
1273
  }
1117
1274
  return undefined; // Return undefined if the value does not match the enum
@@ -1164,17 +1321,24 @@ export class ExplosionConfinedVolume extends EntityBase {
1164
1321
  * @param {number} confinedStrength - The degree of confinement in the area or source, described by an integer between 3 (lowest) and 10 (highest). (default value is 7)
1165
1322
  * @param {number} confinedVolume - The volume of the cloud that is contained in the area of confinement. (default value is 1)
1166
1323
  */
1167
- constructor(confinedStrength: number = 7, confinedVolume: number = 1) {
1324
+ constructor(
1325
+ confinedStrength: number = 7,
1326
+ confinedVolume: number = 1
1327
+ ) {
1168
1328
  super();
1169
1329
  this.confinedStrength = confinedStrength;
1170
1330
  this.confinedVolume = confinedVolume;
1171
1331
  }
1172
1332
 
1173
1333
  /** Initialise the entity with data from a dictionary. */
1174
- initialiseFromDictionary(data: { [key: string]: any }) {
1334
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1175
1335
  super.initialiseFromDictionary(data);
1176
- this.confinedStrength = parseFloat(data.confinedStrength);
1177
- this.confinedVolume = parseFloat(data.confinedVolume);
1336
+ if (data.confinedStrength !== undefined && typeof data.confinedStrength === "number") {
1337
+ this.confinedStrength = data.confinedStrength as number;
1338
+ }
1339
+ if (data.confinedVolume !== undefined && typeof data.confinedVolume === "number") {
1340
+ this.confinedVolume = data.confinedVolume as number;
1341
+ }
1178
1342
  }
1179
1343
 
1180
1344
  toString() {
@@ -1199,8 +1363,7 @@ export class ExplosionOutputConfig extends EntityBase {
1199
1363
  */
1200
1364
  constructor(
1201
1365
  overpressureLevel: number = 2068,
1202
- meConfinedMethod: Enums.MEConfinedMethod = Enums.MEConfinedMethod
1203
- .UNIFORM_CONFINED
1366
+ meConfinedMethod: Enums.MEConfinedMethod = Enums.MEConfinedMethod.UNIFORM_CONFINED
1204
1367
  ) {
1205
1368
  super();
1206
1369
  this.overpressureLevel = overpressureLevel;
@@ -1208,25 +1371,20 @@ export class ExplosionOutputConfig extends EntityBase {
1208
1371
  }
1209
1372
 
1210
1373
  /** Initialise the entity with data from a dictionary. */
1211
- initialiseFromDictionary(data: { [key: string]: any }) {
1374
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1212
1375
  super.initialiseFromDictionary(data);
1213
- this.overpressureLevel = parseFloat(data.overpressureLevel);
1214
- this.meConfinedMethod = this.parseEnumValue(
1215
- data.meConfinedMethod,
1216
- Enums.MEConfinedMethod
1217
- );
1376
+ if (data.overpressureLevel !== undefined && typeof data.overpressureLevel === "number") {
1377
+ this.overpressureLevel = data.overpressureLevel as number;
1378
+ }
1379
+ if (data.meConfinedMethod !== undefined && (typeof data.meConfinedMethod === "string" || typeof data.meConfinedMethod === "number")) {
1380
+ this.meConfinedMethod = this.parseEnumValue(data.meConfinedMethod, Enums.MEConfinedMethod);
1381
+ }
1218
1382
  }
1219
1383
 
1220
- private parseEnumValue<T extends object>(
1221
- value: any,
1222
- enumType: T
1223
- ): T[keyof T] | undefined {
1384
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1224
1385
  if (typeof value === "string" && value in enumType) {
1225
1386
  return enumType[value as keyof T];
1226
- } else if (
1227
- typeof value === "number" &&
1228
- Object.values(enumType).includes(value)
1229
- ) {
1387
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1230
1388
  return value as T[keyof T];
1231
1389
  }
1232
1390
  return undefined; // Return undefined if the value does not match the enum
@@ -1278,14 +1436,26 @@ export class ExplosionOverpressureResult extends EntityBase {
1278
1436
  }
1279
1437
 
1280
1438
  /** Initialise the entity with data from a dictionary. */
1281
- initialiseFromDictionary(data: { [key: string]: any }) {
1439
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1282
1440
  super.initialiseFromDictionary(data);
1283
- this.overpressure = parseFloat(data.overpressure);
1284
- this.explosionCentre = parseFloat(data.explosionCentre);
1285
- this.maximumDistance = parseFloat(data.maximumDistance);
1286
- this.explodedMass = parseFloat(data.explodedMass);
1287
- this.ignitionTime = parseFloat(data.ignitionTime);
1288
- this.radius = parseFloat(data.radius);
1441
+ if (data.overpressure !== undefined && typeof data.overpressure === "number") {
1442
+ this.overpressure = data.overpressure as number;
1443
+ }
1444
+ if (data.explosionCentre !== undefined && typeof data.explosionCentre === "number") {
1445
+ this.explosionCentre = data.explosionCentre as number;
1446
+ }
1447
+ if (data.maximumDistance !== undefined && typeof data.maximumDistance === "number") {
1448
+ this.maximumDistance = data.maximumDistance as number;
1449
+ }
1450
+ if (data.explodedMass !== undefined && typeof data.explodedMass === "number") {
1451
+ this.explodedMass = data.explodedMass as number;
1452
+ }
1453
+ if (data.ignitionTime !== undefined && typeof data.ignitionTime === "number") {
1454
+ this.ignitionTime = data.ignitionTime as number;
1455
+ }
1456
+ if (data.radius !== undefined && typeof data.radius === "number") {
1457
+ this.radius = data.radius as number;
1458
+ }
1289
1459
  }
1290
1460
 
1291
1461
  toString() {
@@ -1310,15 +1480,19 @@ export class ExplosionParameters extends EntityBase {
1310
1480
  *
1311
1481
  * @param {number} explosionUniformStrength - The confined strength in the multi-energy uniform confined method. (default value is 10.0)
1312
1482
  */
1313
- constructor(explosionUniformStrength: number = 10.0) {
1483
+ constructor(
1484
+ explosionUniformStrength: number = 10.0
1485
+ ) {
1314
1486
  super();
1315
1487
  this.explosionUniformStrength = explosionUniformStrength;
1316
1488
  }
1317
1489
 
1318
1490
  /** Initialise the entity with data from a dictionary. */
1319
- initialiseFromDictionary(data: { [key: string]: any }) {
1491
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1320
1492
  super.initialiseFromDictionary(data);
1321
- this.explosionUniformStrength = parseFloat(data.explosionUniformStrength);
1493
+ if (data.explosionUniformStrength !== undefined && typeof data.explosionUniformStrength === "number") {
1494
+ this.explosionUniformStrength = data.explosionUniformStrength as number;
1495
+ }
1322
1496
  }
1323
1497
 
1324
1498
  toString() {
@@ -1358,12 +1532,20 @@ export class FlameRecord extends EntityBase {
1358
1532
  }
1359
1533
 
1360
1534
  /** Initialise the entity with data from a dictionary. */
1361
- initialiseFromDictionary(data: { [key: string]: any }) {
1535
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1362
1536
  super.initialiseFromDictionary(data);
1363
- this.xCoordinate = parseFloat(data.xCoordinate);
1364
- this.zCoordinate = parseFloat(data.zCoordinate);
1365
- this.rCoordinate = parseFloat(data.rCoordinate);
1366
- this.phiCoordinate = parseFloat(data.phiCoordinate);
1537
+ if (data.xCoordinate !== undefined && typeof data.xCoordinate === "number") {
1538
+ this.xCoordinate = data.xCoordinate as number;
1539
+ }
1540
+ if (data.zCoordinate !== undefined && typeof data.zCoordinate === "number") {
1541
+ this.zCoordinate = data.zCoordinate as number;
1542
+ }
1543
+ if (data.rCoordinate !== undefined && typeof data.rCoordinate === "number") {
1544
+ this.rCoordinate = data.rCoordinate as number;
1545
+ }
1546
+ if (data.phiCoordinate !== undefined && typeof data.phiCoordinate === "number") {
1547
+ this.phiCoordinate = data.phiCoordinate as number;
1548
+ }
1367
1549
  }
1368
1550
 
1369
1551
  toString() {
@@ -1410,25 +1592,29 @@ export class FlameResult extends EntityBase {
1410
1592
  }
1411
1593
 
1412
1594
  /** Initialise the entity with data from a dictionary. */
1413
- initialiseFromDictionary(data: { [key: string]: any }) {
1595
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1414
1596
  super.initialiseFromDictionary(data);
1415
- this.time = parseFloat(data.time);
1416
- this.surfaceEmissivePower = parseFloat(data.surfaceEmissivePower);
1417
- this.flameLength = parseFloat(data.flameLength);
1418
- this.flameDiameter = parseFloat(data.flameDiameter);
1419
- this.fireType = this.parseEnumValue(data.fireType, Enums.FireType);
1597
+ if (data.time !== undefined && typeof data.time === "number") {
1598
+ this.time = data.time as number;
1599
+ }
1600
+ if (data.surfaceEmissivePower !== undefined && typeof data.surfaceEmissivePower === "number") {
1601
+ this.surfaceEmissivePower = data.surfaceEmissivePower as number;
1602
+ }
1603
+ if (data.flameLength !== undefined && typeof data.flameLength === "number") {
1604
+ this.flameLength = data.flameLength as number;
1605
+ }
1606
+ if (data.flameDiameter !== undefined && typeof data.flameDiameter === "number") {
1607
+ this.flameDiameter = data.flameDiameter as number;
1608
+ }
1609
+ if (data.fireType !== undefined && (typeof data.fireType === "string" || typeof data.fireType === "number")) {
1610
+ this.fireType = this.parseEnumValue(data.fireType, Enums.FireType);
1611
+ }
1420
1612
  }
1421
1613
 
1422
- private parseEnumValue<T extends object>(
1423
- value: any,
1424
- enumType: T
1425
- ): T[keyof T] | undefined {
1614
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1426
1615
  if (typeof value === "string" && value in enumType) {
1427
1616
  return enumType[value as keyof T];
1428
- } else if (
1429
- typeof value === "number" &&
1430
- Object.values(enumType).includes(value)
1431
- ) {
1617
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1432
1618
  return value as T[keyof T];
1433
1619
  }
1434
1620
  return undefined; // Return undefined if the value does not match the enum
@@ -1467,15 +1653,15 @@ export class Transect extends EntityBase {
1467
1653
  }
1468
1654
 
1469
1655
  /** Initialise the entity with data from a dictionary. */
1470
- initialiseFromDictionary(data: { [key: string]: any }) {
1656
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1471
1657
  super.initialiseFromDictionary(data);
1472
1658
  if (data.transectStartPoint) {
1473
1659
  this.transectStartPoint = new LocalPosition();
1474
- this.transectStartPoint.initialiseFromDictionary(data.transectStartPoint);
1660
+ this.transectStartPoint.initialiseFromDictionary(data.transectStartPoint as { [key: string]: unknown });
1475
1661
  }
1476
1662
  if (data.transectEndPoint) {
1477
1663
  this.transectEndPoint = new LocalPosition();
1478
- this.transectEndPoint.initialiseFromDictionary(data.transectEndPoint);
1664
+ this.transectEndPoint.initialiseFromDictionary(data.transectEndPoint as { [key: string]: unknown });
1479
1665
  }
1480
1666
  }
1481
1667
 
@@ -1541,42 +1727,46 @@ export class FlammableOutputConfig extends EntityBase {
1541
1727
  }
1542
1728
 
1543
1729
  /** Initialise the entity with data from a dictionary. */
1544
- initialiseFromDictionary(data: { [key: string]: any }) {
1730
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1545
1731
  super.initialiseFromDictionary(data);
1546
1732
  if (data.position) {
1547
1733
  this.position = new LocalPosition();
1548
- this.position.initialiseFromDictionary(data.position);
1734
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
1549
1735
  }
1550
1736
  if (data.transect) {
1551
1737
  this.transect = new Transect();
1552
- this.transect.initialiseFromDictionary(data.transect);
1553
- }
1554
- this.radiationType = this.parseEnumValue(
1555
- data.radiationType,
1556
- Enums.RadiationType
1557
- );
1558
- this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
1559
- this.radiationLevel = parseFloat(data.radiationLevel);
1560
- this.radiationResolution = this.parseEnumValue(
1561
- data.radiationResolution,
1562
- Enums.Resolution
1563
- );
1564
- this.fixedOrientation = parseInt(data.fixedOrientation);
1565
- this.orientation = parseFloat(data.orientation);
1566
- this.fixedInclination = parseInt(data.fixedInclination);
1567
- this.inclination = parseFloat(data.inclination);
1568
- }
1569
-
1570
- private parseEnumValue<T extends object>(
1571
- value: any,
1572
- enumType: T
1573
- ): T[keyof T] | undefined {
1738
+ this.transect.initialiseFromDictionary(data.transect as { [key: string]: unknown });
1739
+ }
1740
+ if (data.radiationType !== undefined && (typeof data.radiationType === "string" || typeof data.radiationType === "number")) {
1741
+ this.radiationType = this.parseEnumValue(data.radiationType, Enums.RadiationType);
1742
+ }
1743
+ if (data.contourType !== undefined && (typeof data.contourType === "string" || typeof data.contourType === "number")) {
1744
+ this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
1745
+ }
1746
+ if (data.radiationLevel !== undefined && typeof data.radiationLevel === "number") {
1747
+ this.radiationLevel = data.radiationLevel as number;
1748
+ }
1749
+ if (data.radiationResolution !== undefined && (typeof data.radiationResolution === "string" || typeof data.radiationResolution === "number")) {
1750
+ this.radiationResolution = this.parseEnumValue(data.radiationResolution, Enums.Resolution);
1751
+ }
1752
+ if (data.fixedOrientation !== undefined && typeof data.fixedOrientation === "number") {
1753
+ this.fixedOrientation = data.fixedOrientation as number;
1754
+ }
1755
+ if (data.orientation !== undefined && typeof data.orientation === "number") {
1756
+ this.orientation = data.orientation as number;
1757
+ }
1758
+ if (data.fixedInclination !== undefined && typeof data.fixedInclination === "number") {
1759
+ this.fixedInclination = data.fixedInclination as number;
1760
+ }
1761
+ if (data.inclination !== undefined && typeof data.inclination === "number") {
1762
+ this.inclination = data.inclination as number;
1763
+ }
1764
+ }
1765
+
1766
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1574
1767
  if (typeof value === "string" && value in enumType) {
1575
1768
  return enumType[value as keyof T];
1576
- } else if (
1577
- typeof value === "number" &&
1578
- Object.values(enumType).includes(value)
1579
- ) {
1769
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1580
1770
  return value as T[keyof T];
1581
1771
  }
1582
1772
  return undefined; // Return undefined if the value does not match the enum
@@ -1636,31 +1826,32 @@ export class FlammableParameters extends EntityBase {
1636
1826
  }
1637
1827
 
1638
1828
  /** Initialise the entity with data from a dictionary. */
1639
- initialiseFromDictionary(data: { [key: string]: any }) {
1829
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1640
1830
  super.initialiseFromDictionary(data);
1641
- this.maxExposureDuration = parseFloat(data.maxExposureDuration);
1642
- this.radiationRelativeTolerance = parseFloat(
1643
- data.radiationRelativeTolerance
1644
- );
1645
- this.poolFireType = this.parseEnumValue(
1646
- data.poolFireType,
1647
- Enums.PoolFireType
1648
- );
1649
- this.jetFireAutoSelect = data.jetFireAutoSelect;
1650
- this.timeAveraging = data.timeAveraging;
1651
- this.timeOfInterest = parseFloat(data.timeOfInterest);
1652
- }
1653
-
1654
- private parseEnumValue<T extends object>(
1655
- value: any,
1656
- enumType: T
1657
- ): T[keyof T] | undefined {
1831
+ if (data.maxExposureDuration !== undefined && typeof data.maxExposureDuration === "number") {
1832
+ this.maxExposureDuration = data.maxExposureDuration as number;
1833
+ }
1834
+ if (data.radiationRelativeTolerance !== undefined && typeof data.radiationRelativeTolerance === "number") {
1835
+ this.radiationRelativeTolerance = data.radiationRelativeTolerance as number;
1836
+ }
1837
+ if (data.poolFireType !== undefined && (typeof data.poolFireType === "string" || typeof data.poolFireType === "number")) {
1838
+ this.poolFireType = this.parseEnumValue(data.poolFireType, Enums.PoolFireType);
1839
+ }
1840
+ if (data.jetFireAutoSelect !== undefined && typeof data.jetFireAutoSelect === "boolean") {
1841
+ this.jetFireAutoSelect = data.jetFireAutoSelect as boolean;
1842
+ }
1843
+ if (data.timeAveraging !== undefined && typeof data.timeAveraging === "boolean") {
1844
+ this.timeAveraging = data.timeAveraging as boolean;
1845
+ }
1846
+ if (data.timeOfInterest !== undefined && typeof data.timeOfInterest === "number") {
1847
+ this.timeOfInterest = data.timeOfInterest as number;
1848
+ }
1849
+ }
1850
+
1851
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1658
1852
  if (typeof value === "string" && value in enumType) {
1659
1853
  return enumType[value as keyof T];
1660
- } else if (
1661
- typeof value === "number" &&
1662
- Object.values(enumType).includes(value)
1663
- ) {
1854
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1664
1855
  return value as T[keyof T];
1665
1856
  }
1666
1857
  return undefined; // Return undefined if the value does not match the enum
@@ -1756,36 +1947,62 @@ export class FlashResult extends EntityBase {
1756
1947
  }
1757
1948
 
1758
1949
  /** Initialise the entity with data from a dictionary. */
1759
- initialiseFromDictionary(data: { [key: string]: any }) {
1950
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1760
1951
  super.initialiseFromDictionary(data);
1761
- this.pressure = parseFloat(data.pressure);
1762
- this.temperature = parseFloat(data.temperature);
1763
- this.liquidMoleFraction = parseFloat(data.liquidMoleFraction);
1764
- this.liquidDensity = parseFloat(data.liquidDensity);
1765
- this.vapourDensity = parseFloat(data.vapourDensity);
1766
- this.liquidEntropy = parseFloat(data.liquidEntropy);
1767
- this.vapourEntropy = parseFloat(data.vapourEntropy);
1768
- this.liquidEnthalpy = parseFloat(data.liquidEnthalpy);
1769
- this.vapourEnthalpy = parseFloat(data.vapourEnthalpy);
1770
- this.bubblePointPressure = parseFloat(data.bubblePointPressure);
1771
- this.bubblePointTemperature = parseFloat(data.bubblePointTemperature);
1772
- this.dewPointPressure = parseFloat(data.dewPointPressure);
1773
- this.dewPointTemperature = parseFloat(data.dewPointTemperature);
1774
- this.totalFluidDensity = parseFloat(data.totalFluidDensity);
1775
- this.liquidMassFraction = parseFloat(data.liquidMassFraction);
1776
- this.fluidPhase = this.parseEnumValue(data.fluidPhase, Enums.Phase);
1777
- }
1778
-
1779
- private parseEnumValue<T extends object>(
1780
- value: any,
1781
- enumType: T
1782
- ): T[keyof T] | undefined {
1952
+ if (data.pressure !== undefined && typeof data.pressure === "number") {
1953
+ this.pressure = data.pressure as number;
1954
+ }
1955
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
1956
+ this.temperature = data.temperature as number;
1957
+ }
1958
+ if (data.liquidMoleFraction !== undefined && typeof data.liquidMoleFraction === "number") {
1959
+ this.liquidMoleFraction = data.liquidMoleFraction as number;
1960
+ }
1961
+ if (data.liquidDensity !== undefined && typeof data.liquidDensity === "number") {
1962
+ this.liquidDensity = data.liquidDensity as number;
1963
+ }
1964
+ if (data.vapourDensity !== undefined && typeof data.vapourDensity === "number") {
1965
+ this.vapourDensity = data.vapourDensity as number;
1966
+ }
1967
+ if (data.liquidEntropy !== undefined && typeof data.liquidEntropy === "number") {
1968
+ this.liquidEntropy = data.liquidEntropy as number;
1969
+ }
1970
+ if (data.vapourEntropy !== undefined && typeof data.vapourEntropy === "number") {
1971
+ this.vapourEntropy = data.vapourEntropy as number;
1972
+ }
1973
+ if (data.liquidEnthalpy !== undefined && typeof data.liquidEnthalpy === "number") {
1974
+ this.liquidEnthalpy = data.liquidEnthalpy as number;
1975
+ }
1976
+ if (data.vapourEnthalpy !== undefined && typeof data.vapourEnthalpy === "number") {
1977
+ this.vapourEnthalpy = data.vapourEnthalpy as number;
1978
+ }
1979
+ if (data.bubblePointPressure !== undefined && typeof data.bubblePointPressure === "number") {
1980
+ this.bubblePointPressure = data.bubblePointPressure as number;
1981
+ }
1982
+ if (data.bubblePointTemperature !== undefined && typeof data.bubblePointTemperature === "number") {
1983
+ this.bubblePointTemperature = data.bubblePointTemperature as number;
1984
+ }
1985
+ if (data.dewPointPressure !== undefined && typeof data.dewPointPressure === "number") {
1986
+ this.dewPointPressure = data.dewPointPressure as number;
1987
+ }
1988
+ if (data.dewPointTemperature !== undefined && typeof data.dewPointTemperature === "number") {
1989
+ this.dewPointTemperature = data.dewPointTemperature as number;
1990
+ }
1991
+ if (data.totalFluidDensity !== undefined && typeof data.totalFluidDensity === "number") {
1992
+ this.totalFluidDensity = data.totalFluidDensity as number;
1993
+ }
1994
+ if (data.liquidMassFraction !== undefined && typeof data.liquidMassFraction === "number") {
1995
+ this.liquidMassFraction = data.liquidMassFraction as number;
1996
+ }
1997
+ if (data.fluidPhase !== undefined && (typeof data.fluidPhase === "string" || typeof data.fluidPhase === "number")) {
1998
+ this.fluidPhase = this.parseEnumValue(data.fluidPhase, Enums.Phase);
1999
+ }
2000
+ }
2001
+
2002
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1783
2003
  if (typeof value === "string" && value in enumType) {
1784
2004
  return enumType[value as keyof T];
1785
- } else if (
1786
- typeof value === "number" &&
1787
- Object.values(enumType).includes(value)
1788
- ) {
2005
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1789
2006
  return value as T[keyof T];
1790
2007
  }
1791
2008
  return undefined; // Return undefined if the value does not match the enum
@@ -1827,8 +2044,7 @@ export class ReleaseOverTime extends Scenario {
1827
2044
  */
1828
2045
  constructor(
1829
2046
  releaseAngle: number = 0.0,
1830
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
1831
- .INITIAL_RATE
2047
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE
1832
2048
  ) {
1833
2049
  super();
1834
2050
  this.releaseAngle = releaseAngle;
@@ -1836,25 +2052,20 @@ export class ReleaseOverTime extends Scenario {
1836
2052
  }
1837
2053
 
1838
2054
  /** Initialise the entity with data from a dictionary. */
1839
- initialiseFromDictionary(data: { [key: string]: any }) {
2055
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1840
2056
  super.initialiseFromDictionary(data);
1841
- this.releaseAngle = parseFloat(data.releaseAngle);
1842
- this.timeVaryingOption = this.parseEnumValue(
1843
- data.timeVaryingOption,
1844
- Enums.TimeVaryingOption
1845
- );
2057
+ if (data.releaseAngle !== undefined && typeof data.releaseAngle === "number") {
2058
+ this.releaseAngle = data.releaseAngle as number;
2059
+ }
2060
+ if (data.timeVaryingOption !== undefined && (typeof data.timeVaryingOption === "string" || typeof data.timeVaryingOption === "number")) {
2061
+ this.timeVaryingOption = this.parseEnumValue(data.timeVaryingOption, Enums.TimeVaryingOption);
2062
+ }
1846
2063
  }
1847
2064
 
1848
- private parseEnumValue<T extends object>(
1849
- value: any,
1850
- enumType: T
1851
- ): T[keyof T] | undefined {
2065
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1852
2066
  if (typeof value === "string" && value in enumType) {
1853
2067
  return enumType[value as keyof T];
1854
- } else if (
1855
- typeof value === "number" &&
1856
- Object.values(enumType).includes(value)
1857
- ) {
2068
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1858
2069
  return value as T[keyof T];
1859
2070
  }
1860
2071
  return undefined; // Return undefined if the value does not match the enum
@@ -1887,8 +2098,7 @@ export class Leak extends ReleaseOverTime {
1887
2098
  constructor(
1888
2099
  holeDiameter?: number,
1889
2100
  releaseAngle: number = 0.0,
1890
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
1891
- .INITIAL_RATE,
2101
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
1892
2102
  holeHeightFraction: number = 0.5,
1893
2103
  releaseElevation: number = 1
1894
2104
  ) {
@@ -1899,11 +2109,17 @@ export class Leak extends ReleaseOverTime {
1899
2109
  }
1900
2110
 
1901
2111
  /** Initialise the entity with data from a dictionary. */
1902
- initialiseFromDictionary(data: { [key: string]: any }) {
2112
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1903
2113
  super.initialiseFromDictionary(data);
1904
- this.holeDiameter = parseFloat(data.holeDiameter);
1905
- this.holeHeightFraction = parseFloat(data.holeHeightFraction);
1906
- this.releaseElevation = parseFloat(data.releaseElevation);
2114
+ if (data.holeDiameter !== undefined && typeof data.holeDiameter === "number") {
2115
+ this.holeDiameter = data.holeDiameter as number;
2116
+ }
2117
+ if (data.holeHeightFraction !== undefined && typeof data.holeHeightFraction === "number") {
2118
+ this.holeHeightFraction = data.holeHeightFraction as number;
2119
+ }
2120
+ if (data.releaseElevation !== undefined && typeof data.releaseElevation === "number") {
2121
+ this.releaseElevation = data.releaseElevation as number;
2122
+ }
1907
2123
  }
1908
2124
 
1909
2125
  toString() {
@@ -1939,8 +2155,7 @@ export class LineRupture extends ReleaseOverTime {
1939
2155
  pipeDiameter?: number,
1940
2156
  pipeLength?: number,
1941
2157
  releaseAngle: number = 0.0,
1942
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
1943
- .INITIAL_RATE,
2158
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
1944
2159
  pipeRoughness: number = 0.000045,
1945
2160
  pipeHeightFraction: number = 0.5
1946
2161
  ) {
@@ -1952,12 +2167,20 @@ export class LineRupture extends ReleaseOverTime {
1952
2167
  }
1953
2168
 
1954
2169
  /** Initialise the entity with data from a dictionary. */
1955
- initialiseFromDictionary(data: { [key: string]: any }) {
2170
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1956
2171
  super.initialiseFromDictionary(data);
1957
- this.pipeDiameter = parseFloat(data.pipeDiameter);
1958
- this.pipeLength = parseFloat(data.pipeLength);
1959
- this.pipeRoughness = parseFloat(data.pipeRoughness);
1960
- this.pipeHeightFraction = parseFloat(data.pipeHeightFraction);
2172
+ if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === "number") {
2173
+ this.pipeDiameter = data.pipeDiameter as number;
2174
+ }
2175
+ if (data.pipeLength !== undefined && typeof data.pipeLength === "number") {
2176
+ this.pipeLength = data.pipeLength as number;
2177
+ }
2178
+ if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === "number") {
2179
+ this.pipeRoughness = data.pipeRoughness as number;
2180
+ }
2181
+ if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === "number") {
2182
+ this.pipeHeightFraction = data.pipeHeightFraction as number;
2183
+ }
1961
2184
  }
1962
2185
 
1963
2186
  toString() {
@@ -1975,9 +2198,9 @@ export class LineRupture extends ReleaseOverTime {
1975
2198
  }
1976
2199
 
1977
2200
  export class MaterialComponentDataItem extends EntityBase {
1978
- description?: string;
2201
+ description: string;
1979
2202
  equationNumber?: number;
1980
- equationString?: string;
2203
+ equationString: string;
1981
2204
  equationCoefficients?: number[];
1982
2205
  calculationLimits?: number[];
1983
2206
  supercriticalExtrapolation: number;
@@ -1995,9 +2218,9 @@ export class MaterialComponentDataItem extends EntityBase {
1995
2218
  * @param {number} fractionTc - Fraction of critical temperature. (default value is 1)
1996
2219
  */
1997
2220
  constructor(
1998
- description?: string,
2221
+ description: string = "",
1999
2222
  equationNumber?: number,
2000
- equationString?: string,
2223
+ equationString: string = "",
2001
2224
  equationCoefficients?: number[],
2002
2225
  calculationLimits?: number[],
2003
2226
  supercriticalExtrapolation: number = 0,
@@ -2014,21 +2237,29 @@ export class MaterialComponentDataItem extends EntityBase {
2014
2237
  }
2015
2238
 
2016
2239
  /** Initialise the entity with data from a dictionary. */
2017
- initialiseFromDictionary(data: { [key: string]: any }) {
2240
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2018
2241
  super.initialiseFromDictionary(data);
2019
- this.description = data.description?.toString();
2020
- this.equationNumber = parseInt(data.equationNumber);
2021
- this.equationString = data.equationString?.toString();
2022
- this.equationCoefficients = (data.equationCoefficients ?? []).map(
2023
- (item: any) => parseFloat(item)
2024
- );
2025
- this.calculationLimits = (data.calculationLimits ?? []).map((item: any) =>
2026
- parseFloat(item)
2027
- );
2028
- this.supercriticalExtrapolation = parseFloat(
2029
- data.supercriticalExtrapolation
2030
- );
2031
- this.fractionTc = parseFloat(data.fractionTc);
2242
+ if (data.description !== undefined && typeof data.description === "string") {
2243
+ this.description = data.description as string;
2244
+ }
2245
+ if (data.equationNumber !== undefined && typeof data.equationNumber === "number") {
2246
+ this.equationNumber = data.equationNumber as number;
2247
+ }
2248
+ if (data.equationString !== undefined && typeof data.equationString === "string") {
2249
+ this.equationString = data.equationString as string;
2250
+ }
2251
+ if (data.equationCoefficients && Array.isArray(data.equationCoefficients)) {
2252
+ this.equationCoefficients = (data.equationCoefficients ?? []).map((item) => parseFloat(item));
2253
+ }
2254
+ if (data.calculationLimits && Array.isArray(data.calculationLimits)) {
2255
+ this.calculationLimits = (data.calculationLimits ?? []).map((item) => parseFloat(item));
2256
+ }
2257
+ if (data.supercriticalExtrapolation !== undefined && typeof data.supercriticalExtrapolation === "number") {
2258
+ this.supercriticalExtrapolation = data.supercriticalExtrapolation as number;
2259
+ }
2260
+ if (data.fractionTc !== undefined && typeof data.fractionTc === "number") {
2261
+ this.fractionTc = data.fractionTc as number;
2262
+ }
2032
2263
  }
2033
2264
 
2034
2265
  toString() {
@@ -2037,10 +2268,8 @@ export class MaterialComponentDataItem extends EntityBase {
2037
2268
  `description: ${this.description}`,
2038
2269
  `equationNumber: ${this.equationNumber}`,
2039
2270
  `equationString: ${this.equationString}`,
2040
- this.equationCoefficients
2041
- ?.map((item: any) => item?.toString())
2042
- .join("\n"),
2043
- this.calculationLimits?.map((item: any) => item?.toString()).join("\n"),
2271
+ this.equationCoefficients?.map((item) => item?.toString()).join("\n"),
2272
+ this.calculationLimits?.map((item) => item?.toString()).join("\n"),
2044
2273
  `supercriticalExtrapolation: ${this.supercriticalExtrapolation}`,
2045
2274
  `fractionTc: ${this.fractionTc}`,
2046
2275
  ];
@@ -2049,7 +2278,7 @@ export class MaterialComponentDataItem extends EntityBase {
2049
2278
  }
2050
2279
 
2051
2280
  export class MaterialComponentData extends EntityBase {
2052
- name?: string;
2281
+ name: string;
2053
2282
  dipprVersion?: number;
2054
2283
  casId?: number;
2055
2284
  dataItem: MaterialComponentDataItem[];
@@ -2065,7 +2294,7 @@ export class MaterialComponentData extends EntityBase {
2065
2294
  * @param {boolean} nonStandard - Description of new property.
2066
2295
  */
2067
2296
  constructor(
2068
- name?: string,
2297
+ name: string = "",
2069
2298
  dipprVersion?: number,
2070
2299
  casId?: number,
2071
2300
  dataItem: MaterialComponentDataItem[] = [new MaterialComponentDataItem()],
@@ -2080,17 +2309,29 @@ export class MaterialComponentData extends EntityBase {
2080
2309
  }
2081
2310
 
2082
2311
  /** Initialise the entity with data from a dictionary. */
2083
- initialiseFromDictionary(data: { [key: string]: any }) {
2312
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2084
2313
  super.initialiseFromDictionary(data);
2085
- this.name = data.name?.toString();
2086
- this.dipprVersion = parseInt(data.dipprVersion);
2087
- this.casId = parseInt(data.casId);
2088
- if (data.dataItem) {
2089
- this.dataItem = data.dataItem.map((item: any) =>
2090
- new MaterialComponentDataItem().initialiseFromDictionary(item)
2314
+ if (data.name !== undefined && typeof data.name === "string") {
2315
+ this.name = data.name as string;
2316
+ }
2317
+ if (data.dipprVersion !== undefined && typeof data.dipprVersion === "number") {
2318
+ this.dipprVersion = data.dipprVersion as number;
2319
+ }
2320
+ if (data.casId !== undefined && typeof data.casId === "number") {
2321
+ this.casId = data.casId as number;
2322
+ }
2323
+ if (data.dataItem && Array.isArray(data.dataItem)) {
2324
+ this.dataItem = data.dataItem.map(
2325
+ (item) => {
2326
+ const record = new MaterialComponentDataItem();
2327
+ record.initialiseFromDictionary(item);
2328
+ return record;
2329
+ }
2091
2330
  );
2092
2331
  }
2093
- this.nonStandard = data.nonStandard;
2332
+ if (data.nonStandard !== undefined && typeof data.nonStandard === "boolean") {
2333
+ this.nonStandard = data.nonStandard as boolean;
2334
+ }
2094
2335
  }
2095
2336
 
2096
2337
  toString() {
@@ -2099,7 +2340,7 @@ export class MaterialComponentData extends EntityBase {
2099
2340
  `name: ${this.name}`,
2100
2341
  `dipprVersion: ${this.dipprVersion}`,
2101
2342
  `casId: ${this.casId}`,
2102
- this.dataItem?.map((item: any) => item?.toString()).join("\n"),
2343
+ this.dataItem?.map((item) => item?.toString()).join("\n"),
2103
2344
  `nonStandard: ${this.nonStandard}`,
2104
2345
  ];
2105
2346
  return parts.join("\n");
@@ -2160,8 +2401,7 @@ export class MixtureConstantPropertiesResult extends EntityBase {
2160
2401
  emissivePowerLengthScale?: number,
2161
2402
  laminarBurningVelocity?: number,
2162
2403
  flammableToxicFlag: Enums.FlammableToxic = Enums.FlammableToxic.INERT,
2163
- luminousSmokyFlame: Enums.LuminousSmokyFlame = Enums.LuminousSmokyFlame
2164
- .GENERAL
2404
+ luminousSmokyFlame: Enums.LuminousSmokyFlame = Enums.LuminousSmokyFlame.GENERAL
2165
2405
  ) {
2166
2406
  super();
2167
2407
  this.lowerFlammabilityLimit = lowerFlammabilityLimit;
@@ -2183,42 +2423,62 @@ export class MixtureConstantPropertiesResult extends EntityBase {
2183
2423
  }
2184
2424
 
2185
2425
  /** Initialise the entity with data from a dictionary. */
2186
- initialiseFromDictionary(data: { [key: string]: any }) {
2426
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2187
2427
  super.initialiseFromDictionary(data);
2188
- this.lowerFlammabilityLimit = parseFloat(data.lowerFlammabilityLimit);
2189
- this.upperFlammabilityLimit = parseFloat(data.upperFlammabilityLimit);
2190
- this.criticalPressure = parseFloat(data.criticalPressure);
2191
- this.criticalTemperature = parseFloat(data.criticalTemperature);
2192
- this.flashPoint = parseFloat(data.flashPoint);
2193
- this.heatCombustion = parseFloat(data.heatCombustion);
2194
- this.maximumBurnRate = parseFloat(data.maximumBurnRate);
2195
- this.maximumSEP = parseFloat(data.maximumSEP);
2196
- this.molecularWeight = parseFloat(data.molecularWeight);
2197
- this.bubblePoint = parseFloat(data.bubblePoint);
2198
- this.poolFireBurnRateLength = parseFloat(data.poolFireBurnRateLength);
2199
- this.dewPoint = parseFloat(data.dewPoint);
2200
- this.emissivePowerLengthScale = parseFloat(data.emissivePowerLengthScale);
2201
- this.laminarBurningVelocity = parseFloat(data.laminarBurningVelocity);
2202
- this.flammableToxicFlag = this.parseEnumValue(
2203
- data.flammableToxicFlag,
2204
- Enums.FlammableToxic
2205
- );
2206
- this.luminousSmokyFlame = this.parseEnumValue(
2207
- data.luminousSmokyFlame,
2208
- Enums.LuminousSmokyFlame
2209
- );
2210
- }
2211
-
2212
- private parseEnumValue<T extends object>(
2213
- value: any,
2214
- enumType: T
2215
- ): T[keyof T] | undefined {
2428
+ if (data.lowerFlammabilityLimit !== undefined && typeof data.lowerFlammabilityLimit === "number") {
2429
+ this.lowerFlammabilityLimit = data.lowerFlammabilityLimit as number;
2430
+ }
2431
+ if (data.upperFlammabilityLimit !== undefined && typeof data.upperFlammabilityLimit === "number") {
2432
+ this.upperFlammabilityLimit = data.upperFlammabilityLimit as number;
2433
+ }
2434
+ if (data.criticalPressure !== undefined && typeof data.criticalPressure === "number") {
2435
+ this.criticalPressure = data.criticalPressure as number;
2436
+ }
2437
+ if (data.criticalTemperature !== undefined && typeof data.criticalTemperature === "number") {
2438
+ this.criticalTemperature = data.criticalTemperature as number;
2439
+ }
2440
+ if (data.flashPoint !== undefined && typeof data.flashPoint === "number") {
2441
+ this.flashPoint = data.flashPoint as number;
2442
+ }
2443
+ if (data.heatCombustion !== undefined && typeof data.heatCombustion === "number") {
2444
+ this.heatCombustion = data.heatCombustion as number;
2445
+ }
2446
+ if (data.maximumBurnRate !== undefined && typeof data.maximumBurnRate === "number") {
2447
+ this.maximumBurnRate = data.maximumBurnRate as number;
2448
+ }
2449
+ if (data.maximumSEP !== undefined && typeof data.maximumSEP === "number") {
2450
+ this.maximumSEP = data.maximumSEP as number;
2451
+ }
2452
+ if (data.molecularWeight !== undefined && typeof data.molecularWeight === "number") {
2453
+ this.molecularWeight = data.molecularWeight as number;
2454
+ }
2455
+ if (data.bubblePoint !== undefined && typeof data.bubblePoint === "number") {
2456
+ this.bubblePoint = data.bubblePoint as number;
2457
+ }
2458
+ if (data.poolFireBurnRateLength !== undefined && typeof data.poolFireBurnRateLength === "number") {
2459
+ this.poolFireBurnRateLength = data.poolFireBurnRateLength as number;
2460
+ }
2461
+ if (data.dewPoint !== undefined && typeof data.dewPoint === "number") {
2462
+ this.dewPoint = data.dewPoint as number;
2463
+ }
2464
+ if (data.emissivePowerLengthScale !== undefined && typeof data.emissivePowerLengthScale === "number") {
2465
+ this.emissivePowerLengthScale = data.emissivePowerLengthScale as number;
2466
+ }
2467
+ if (data.laminarBurningVelocity !== undefined && typeof data.laminarBurningVelocity === "number") {
2468
+ this.laminarBurningVelocity = data.laminarBurningVelocity as number;
2469
+ }
2470
+ if (data.flammableToxicFlag !== undefined && (typeof data.flammableToxicFlag === "string" || typeof data.flammableToxicFlag === "number")) {
2471
+ this.flammableToxicFlag = this.parseEnumValue(data.flammableToxicFlag, Enums.FlammableToxic);
2472
+ }
2473
+ if (data.luminousSmokyFlame !== undefined && (typeof data.luminousSmokyFlame === "string" || typeof data.luminousSmokyFlame === "number")) {
2474
+ this.luminousSmokyFlame = this.parseEnumValue(data.luminousSmokyFlame, Enums.LuminousSmokyFlame);
2475
+ }
2476
+ }
2477
+
2478
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2216
2479
  if (typeof value === "string" && value in enumType) {
2217
2480
  return enumType[value as keyof T];
2218
- } else if (
2219
- typeof value === "number" &&
2220
- Object.values(enumType).includes(value)
2221
- ) {
2481
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2222
2482
  return value as T[keyof T];
2223
2483
  }
2224
2484
  return undefined; // Return undefined if the value does not match the enum
@@ -2290,32 +2550,44 @@ export class Pipe extends Asset {
2290
2550
  }
2291
2551
 
2292
2552
  /** Initialise the entity with data from a dictionary. */
2293
- initialiseFromDictionary(data: { [key: string]: any }) {
2553
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2294
2554
  super.initialiseFromDictionary(data);
2295
- if (data.nodes) {
2296
- this.nodes = data.nodes.map((item: any) =>
2297
- new LocalPosition().initialiseFromDictionary(item)
2555
+ if (data.nodes && Array.isArray(data.nodes)) {
2556
+ this.nodes = data.nodes.map(
2557
+ (item) => {
2558
+ const record = new LocalPosition();
2559
+ record.initialiseFromDictionary(item);
2560
+ return record;
2561
+ }
2298
2562
  );
2299
2563
  }
2300
- this.nodeCount = parseInt(data.nodeCount);
2301
- this.diameter = parseFloat(data.diameter);
2564
+ if (data.nodeCount !== undefined && typeof data.nodeCount === "number") {
2565
+ this.nodeCount = data.nodeCount as number;
2566
+ }
2567
+ if (data.diameter !== undefined && typeof data.diameter === "number") {
2568
+ this.diameter = data.diameter as number;
2569
+ }
2302
2570
  if (data.material) {
2303
2571
  this.material = new Material();
2304
- this.material.initialiseFromDictionary(data.material);
2572
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
2305
2573
  }
2306
2574
  if (data.state) {
2307
2575
  this.state = new State();
2308
- this.state.initialiseFromDictionary(data.state);
2576
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
2577
+ }
2578
+ if (data.roughness !== undefined && typeof data.roughness === "number") {
2579
+ this.roughness = data.roughness as number;
2580
+ }
2581
+ if (data.pumpedInflow !== undefined && typeof data.pumpedInflow === "number") {
2582
+ this.pumpedInflow = data.pumpedInflow as number;
2309
2583
  }
2310
- this.roughness = parseFloat(data.roughness);
2311
- this.pumpedInflow = parseFloat(data.pumpedInflow);
2312
2584
  }
2313
2585
 
2314
2586
  toString() {
2315
2587
  const parts = [
2316
2588
  "* Pipe",
2317
2589
  `location: ${this.location?.toString()}`,
2318
- this.nodes?.map((item: any) => item?.toString()).join("\n"),
2590
+ this.nodes?.map((item) => item?.toString()).join("\n"),
2319
2591
  `nodeCount: ${this.nodeCount}`,
2320
2592
  `diameter: ${this.diameter}`,
2321
2593
  `material: ${this.material?.toString()}`,
@@ -2342,8 +2614,7 @@ export class PipeBreach extends ReleaseOverTime {
2342
2614
  constructor(
2343
2615
  distanceDownstream?: number,
2344
2616
  releaseAngle: number = 0.0,
2345
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
2346
- .INITIAL_RATE,
2617
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
2347
2618
  relativeAperture: number = 1
2348
2619
  ) {
2349
2620
  super(releaseAngle, timeVaryingOption);
@@ -2352,10 +2623,14 @@ export class PipeBreach extends ReleaseOverTime {
2352
2623
  }
2353
2624
 
2354
2625
  /** Initialise the entity with data from a dictionary. */
2355
- initialiseFromDictionary(data: { [key: string]: any }) {
2626
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2356
2627
  super.initialiseFromDictionary(data);
2357
- this.distanceDownstream = parseFloat(data.distanceDownstream);
2358
- this.relativeAperture = parseFloat(data.relativeAperture);
2628
+ if (data.distanceDownstream !== undefined && typeof data.distanceDownstream === "number") {
2629
+ this.distanceDownstream = data.distanceDownstream as number;
2630
+ }
2631
+ if (data.relativeAperture !== undefined && typeof data.relativeAperture === "number") {
2632
+ this.relativeAperture = data.relativeAperture as number;
2633
+ }
2359
2634
  }
2360
2635
 
2361
2636
  toString() {
@@ -2396,11 +2671,11 @@ export class PoolFireFlameResult extends FlameResult {
2396
2671
  }
2397
2672
 
2398
2673
  /** Initialise the entity with data from a dictionary. */
2399
- initialiseFromDictionary(data: { [key: string]: any }) {
2674
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2400
2675
  super.initialiseFromDictionary(data);
2401
- this.poolZoneSEP = (data.poolZoneSEP ?? []).map((item: any) =>
2402
- parseFloat(item)
2403
- );
2676
+ if (data.poolZoneSEP && Array.isArray(data.poolZoneSEP)) {
2677
+ this.poolZoneSEP = (data.poolZoneSEP ?? []).map((item) => parseFloat(item));
2678
+ }
2404
2679
  }
2405
2680
 
2406
2681
  toString() {
@@ -2410,7 +2685,7 @@ export class PoolFireFlameResult extends FlameResult {
2410
2685
  `surfaceEmissivePower: ${this.surfaceEmissivePower}`,
2411
2686
  `flameLength: ${this.flameLength}`,
2412
2687
  `flameDiameter: ${this.flameDiameter}`,
2413
- this.poolZoneSEP?.map((item: any) => item?.toString()).join("\n"),
2688
+ this.poolZoneSEP?.map((item) => item?.toString()).join("\n"),
2414
2689
  `fireType: ${this.fireType}`,
2415
2690
  ];
2416
2691
  return parts.join("\n");
@@ -2481,21 +2756,47 @@ export class PoolRecord extends EntityBase {
2481
2756
  }
2482
2757
 
2483
2758
  /** Initialise the entity with data from a dictionary. */
2484
- initialiseFromDictionary(data: { [key: string]: any }) {
2759
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2485
2760
  super.initialiseFromDictionary(data);
2486
- this.time = parseFloat(data.time);
2487
- this.massSpilt = parseFloat(data.massSpilt);
2488
- this.massVaporised = parseFloat(data.massVaporised);
2489
- this.massDissolved = parseFloat(data.massDissolved);
2490
- this.massRemaining = parseFloat(data.massRemaining);
2491
- this.vapourisationRate = parseFloat(data.vapourisationRate);
2492
- this.solutionRate = parseFloat(data.solutionRate);
2493
- this.effectiveRadius = parseFloat(data.effectiveRadius);
2494
- this.depth = parseFloat(data.depth);
2495
- this.temperature = parseFloat(data.temperature);
2496
- this.spillRate = parseFloat(data.spillRate);
2497
- this.actualRadius = parseFloat(data.actualRadius);
2498
- this.poolCentre = parseFloat(data.poolCentre);
2761
+ if (data.time !== undefined && typeof data.time === "number") {
2762
+ this.time = data.time as number;
2763
+ }
2764
+ if (data.massSpilt !== undefined && typeof data.massSpilt === "number") {
2765
+ this.massSpilt = data.massSpilt as number;
2766
+ }
2767
+ if (data.massVaporised !== undefined && typeof data.massVaporised === "number") {
2768
+ this.massVaporised = data.massVaporised as number;
2769
+ }
2770
+ if (data.massDissolved !== undefined && typeof data.massDissolved === "number") {
2771
+ this.massDissolved = data.massDissolved as number;
2772
+ }
2773
+ if (data.massRemaining !== undefined && typeof data.massRemaining === "number") {
2774
+ this.massRemaining = data.massRemaining as number;
2775
+ }
2776
+ if (data.vapourisationRate !== undefined && typeof data.vapourisationRate === "number") {
2777
+ this.vapourisationRate = data.vapourisationRate as number;
2778
+ }
2779
+ if (data.solutionRate !== undefined && typeof data.solutionRate === "number") {
2780
+ this.solutionRate = data.solutionRate as number;
2781
+ }
2782
+ if (data.effectiveRadius !== undefined && typeof data.effectiveRadius === "number") {
2783
+ this.effectiveRadius = data.effectiveRadius as number;
2784
+ }
2785
+ if (data.depth !== undefined && typeof data.depth === "number") {
2786
+ this.depth = data.depth as number;
2787
+ }
2788
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
2789
+ this.temperature = data.temperature as number;
2790
+ }
2791
+ if (data.spillRate !== undefined && typeof data.spillRate === "number") {
2792
+ this.spillRate = data.spillRate as number;
2793
+ }
2794
+ if (data.actualRadius !== undefined && typeof data.actualRadius === "number") {
2795
+ this.actualRadius = data.actualRadius as number;
2796
+ }
2797
+ if (data.poolCentre !== undefined && typeof data.poolCentre === "number") {
2798
+ this.poolCentre = data.poolCentre as number;
2799
+ }
2499
2800
  }
2500
2801
 
2501
2802
  toString() {
@@ -2543,11 +2844,17 @@ export class PoolVapourisationParameters extends EntityBase {
2543
2844
  }
2544
2845
 
2545
2846
  /** Initialise the entity with data from a dictionary. */
2546
- initialiseFromDictionary(data: { [key: string]: any }) {
2847
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2547
2848
  super.initialiseFromDictionary(data);
2548
- this.toxicsCutoffRate = parseFloat(data.toxicsCutoffRate);
2549
- this.flammableCutoffRate = parseFloat(data.flammableCutoffRate);
2550
- this.relativeTolerance = parseFloat(data.relativeTolerance);
2849
+ if (data.toxicsCutoffRate !== undefined && typeof data.toxicsCutoffRate === "number") {
2850
+ this.toxicsCutoffRate = data.toxicsCutoffRate as number;
2851
+ }
2852
+ if (data.flammableCutoffRate !== undefined && typeof data.flammableCutoffRate === "number") {
2853
+ this.flammableCutoffRate = data.flammableCutoffRate as number;
2854
+ }
2855
+ if (data.relativeTolerance !== undefined && typeof data.relativeTolerance === "number") {
2856
+ this.relativeTolerance = data.relativeTolerance as number;
2857
+ }
2551
2858
  }
2552
2859
 
2553
2860
  toString() {
@@ -2585,29 +2892,24 @@ export class RadiationRecord extends EntityBase {
2585
2892
  }
2586
2893
 
2587
2894
  /** Initialise the entity with data from a dictionary. */
2588
- initialiseFromDictionary(data: { [key: string]: any }) {
2895
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2589
2896
  super.initialiseFromDictionary(data);
2590
2897
  if (data.position) {
2591
2898
  this.position = new LocalPosition();
2592
- this.position.initialiseFromDictionary(data.position);
2899
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
2900
+ }
2901
+ if (data.radiationResult !== undefined && typeof data.radiationResult === "number") {
2902
+ this.radiationResult = data.radiationResult as number;
2903
+ }
2904
+ if (data.radiationType !== undefined && (typeof data.radiationType === "string" || typeof data.radiationType === "number")) {
2905
+ this.radiationType = this.parseEnumValue(data.radiationType, Enums.RadiationType);
2593
2906
  }
2594
- this.radiationResult = parseFloat(data.radiationResult);
2595
- this.radiationType = this.parseEnumValue(
2596
- data.radiationType,
2597
- Enums.RadiationType
2598
- );
2599
2907
  }
2600
2908
 
2601
- private parseEnumValue<T extends object>(
2602
- value: any,
2603
- enumType: T
2604
- ): T[keyof T] | undefined {
2909
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2605
2910
  if (typeof value === "string" && value in enumType) {
2606
2911
  return enumType[value as keyof T];
2607
- } else if (
2608
- typeof value === "number" &&
2609
- Object.values(enumType).includes(value)
2610
- ) {
2912
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2611
2913
  return value as T[keyof T];
2612
2914
  }
2613
2915
  return undefined; // Return undefined if the value does not match the enum
@@ -2647,8 +2949,7 @@ export class ReliefValve extends ReleaseOverTime {
2647
2949
  pipeDiameter?: number,
2648
2950
  pipeLength?: number,
2649
2951
  releaseAngle: number = 0.0,
2650
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
2651
- .INITIAL_RATE,
2952
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
2652
2953
  pipeRoughness: number = 0.000045,
2653
2954
  pipeHeightFraction: number = 0.5
2654
2955
  ) {
@@ -2661,15 +2962,23 @@ export class ReliefValve extends ReleaseOverTime {
2661
2962
  }
2662
2963
 
2663
2964
  /** Initialise the entity with data from a dictionary. */
2664
- initialiseFromDictionary(data: { [key: string]: any }) {
2965
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2665
2966
  super.initialiseFromDictionary(data);
2666
- this.reliefValveConstrictionDiameter = parseFloat(
2667
- data.reliefValveConstrictionDiameter
2668
- );
2669
- this.pipeDiameter = parseFloat(data.pipeDiameter);
2670
- this.pipeLength = parseFloat(data.pipeLength);
2671
- this.pipeRoughness = parseFloat(data.pipeRoughness);
2672
- this.pipeHeightFraction = parseFloat(data.pipeHeightFraction);
2967
+ if (data.reliefValveConstrictionDiameter !== undefined && typeof data.reliefValveConstrictionDiameter === "number") {
2968
+ this.reliefValveConstrictionDiameter = data.reliefValveConstrictionDiameter as number;
2969
+ }
2970
+ if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === "number") {
2971
+ this.pipeDiameter = data.pipeDiameter as number;
2972
+ }
2973
+ if (data.pipeLength !== undefined && typeof data.pipeLength === "number") {
2974
+ this.pipeLength = data.pipeLength as number;
2975
+ }
2976
+ if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === "number") {
2977
+ this.pipeRoughness = data.pipeRoughness as number;
2978
+ }
2979
+ if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === "number") {
2980
+ this.pipeHeightFraction = data.pipeHeightFraction as number;
2981
+ }
2673
2982
  }
2674
2983
 
2675
2984
  toString() {
@@ -2727,27 +3036,35 @@ export class ScalarUdmOutputs extends EntityBase {
2727
3036
  }
2728
3037
 
2729
3038
  /** Initialise the entity with data from a dictionary. */
2730
- initialiseFromDictionary(data: { [key: string]: any }) {
3039
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2731
3040
  super.initialiseFromDictionary(data);
2732
- this.observerCount = parseInt(data.observerCount);
2733
- this.recordCount = parseInt(data.recordCount);
2734
- this.minimumConcentration = parseFloat(data.minimumConcentration);
2735
- this.windPower = parseFloat(data.windPower);
2736
- this.frictionVelocity = parseFloat(data.frictionVelocity);
2737
- this.dispersionReleaseDuration = parseFloat(data.dispersionReleaseDuration);
2738
- this.cloudType = this.parseEnumValue(data.cloudType, Enums.DynamicType);
2739
- }
2740
-
2741
- private parseEnumValue<T extends object>(
2742
- value: any,
2743
- enumType: T
2744
- ): T[keyof T] | undefined {
3041
+ if (data.observerCount !== undefined && typeof data.observerCount === "number") {
3042
+ this.observerCount = data.observerCount as number;
3043
+ }
3044
+ if (data.recordCount !== undefined && typeof data.recordCount === "number") {
3045
+ this.recordCount = data.recordCount as number;
3046
+ }
3047
+ if (data.minimumConcentration !== undefined && typeof data.minimumConcentration === "number") {
3048
+ this.minimumConcentration = data.minimumConcentration as number;
3049
+ }
3050
+ if (data.windPower !== undefined && typeof data.windPower === "number") {
3051
+ this.windPower = data.windPower as number;
3052
+ }
3053
+ if (data.frictionVelocity !== undefined && typeof data.frictionVelocity === "number") {
3054
+ this.frictionVelocity = data.frictionVelocity as number;
3055
+ }
3056
+ if (data.dispersionReleaseDuration !== undefined && typeof data.dispersionReleaseDuration === "number") {
3057
+ this.dispersionReleaseDuration = data.dispersionReleaseDuration as number;
3058
+ }
3059
+ if (data.cloudType !== undefined && (typeof data.cloudType === "string" || typeof data.cloudType === "number")) {
3060
+ this.cloudType = this.parseEnumValue(data.cloudType, Enums.DynamicType);
3061
+ }
3062
+ }
3063
+
3064
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2745
3065
  if (typeof value === "string" && value in enumType) {
2746
3066
  return enumType[value as keyof T];
2747
- } else if (
2748
- typeof value === "number" &&
2749
- Object.values(enumType).includes(value)
2750
- ) {
3067
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2751
3068
  return value as T[keyof T];
2752
3069
  }
2753
3070
  return undefined; // Return undefined if the value does not match the enum
@@ -2788,8 +3105,7 @@ export class ShortPipeRupture extends ReleaseOverTime {
2788
3105
  pipeLength?: number,
2789
3106
  pipeDiameter?: number,
2790
3107
  releaseAngle: number = 0.0,
2791
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
2792
- .INITIAL_RATE,
3108
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
2793
3109
  pipeRoughness: number = 0.000045,
2794
3110
  pipeHeightFraction: number = 0.5
2795
3111
  ) {
@@ -2801,12 +3117,20 @@ export class ShortPipeRupture extends ReleaseOverTime {
2801
3117
  }
2802
3118
 
2803
3119
  /** Initialise the entity with data from a dictionary. */
2804
- initialiseFromDictionary(data: { [key: string]: any }) {
3120
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2805
3121
  super.initialiseFromDictionary(data);
2806
- this.pipeLength = parseFloat(data.pipeLength);
2807
- this.pipeDiameter = parseFloat(data.pipeDiameter);
2808
- this.pipeRoughness = parseFloat(data.pipeRoughness);
2809
- this.pipeHeightFraction = parseFloat(data.pipeHeightFraction);
3122
+ if (data.pipeLength !== undefined && typeof data.pipeLength === "number") {
3123
+ this.pipeLength = data.pipeLength as number;
3124
+ }
3125
+ if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === "number") {
3126
+ this.pipeDiameter = data.pipeDiameter as number;
3127
+ }
3128
+ if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === "number") {
3129
+ this.pipeRoughness = data.pipeRoughness as number;
3130
+ }
3131
+ if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === "number") {
3132
+ this.pipeHeightFraction = data.pipeHeightFraction as number;
3133
+ }
2810
3134
  }
2811
3135
 
2812
3136
  toString() {
@@ -2843,17 +3167,15 @@ export class Structure extends EntityBase {
2843
3167
  }
2844
3168
 
2845
3169
  /** Initialise the entity with data from a dictionary. */
2846
- initialiseFromDictionary(data: { [key: string]: any }) {
3170
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2847
3171
  super.initialiseFromDictionary(data);
2848
3172
  if (data.explosionConfinedVolume) {
2849
3173
  this.explosionConfinedVolume = new ExplosionConfinedVolume();
2850
- this.explosionConfinedVolume.initialiseFromDictionary(
2851
- data.explosionConfinedVolume
2852
- );
3174
+ this.explosionConfinedVolume.initialiseFromDictionary(data.explosionConfinedVolume as { [key: string]: unknown });
2853
3175
  }
2854
3176
  if (data.location) {
2855
3177
  this.location = new LocalPosition();
2856
- this.location.initialiseFromDictionary(data.location);
3178
+ this.location.initialiseFromDictionary(data.location as { [key: string]: unknown });
2857
3179
  }
2858
3180
  }
2859
3181
 
@@ -2895,30 +3217,27 @@ export class Substrate extends EntityBase {
2895
3217
  }
2896
3218
 
2897
3219
  /** Initialise the entity with data from a dictionary. */
2898
- initialiseFromDictionary(data: { [key: string]: any }) {
3220
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2899
3221
  super.initialiseFromDictionary(data);
2900
3222
  if (data.bund) {
2901
3223
  this.bund = new Bund();
2902
- this.bund.initialiseFromDictionary(data.bund);
3224
+ this.bund.initialiseFromDictionary(data.bund as { [key: string]: unknown });
3225
+ }
3226
+ if (data.surfaceRoughness !== undefined && typeof data.surfaceRoughness === "number") {
3227
+ this.surfaceRoughness = data.surfaceRoughness as number;
3228
+ }
3229
+ if (data.surfaceType !== undefined && (typeof data.surfaceType === "string" || typeof data.surfaceType === "number")) {
3230
+ this.surfaceType = this.parseEnumValue(data.surfaceType, Enums.SurfaceType);
3231
+ }
3232
+ if (data.poolSurfaceType !== undefined && (typeof data.poolSurfaceType === "string" || typeof data.poolSurfaceType === "number")) {
3233
+ this.poolSurfaceType = this.parseEnumValue(data.poolSurfaceType, Enums.PoolSurfaceType);
2903
3234
  }
2904
- this.surfaceRoughness = parseFloat(data.surfaceRoughness);
2905
- this.surfaceType = this.parseEnumValue(data.surfaceType, Enums.SurfaceType);
2906
- this.poolSurfaceType = this.parseEnumValue(
2907
- data.poolSurfaceType,
2908
- Enums.PoolSurfaceType
2909
- );
2910
3235
  }
2911
3236
 
2912
- private parseEnumValue<T extends object>(
2913
- value: any,
2914
- enumType: T
2915
- ): T[keyof T] | undefined {
3237
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2916
3238
  if (typeof value === "string" && value in enumType) {
2917
3239
  return enumType[value as keyof T];
2918
- } else if (
2919
- typeof value === "number" &&
2920
- Object.values(enumType).includes(value)
2921
- ) {
3240
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2922
3241
  return value as T[keyof T];
2923
3242
  }
2924
3243
  return undefined; // Return undefined if the value does not match the enum
@@ -2960,29 +3279,24 @@ export class ToxicRecord extends EntityBase {
2960
3279
  }
2961
3280
 
2962
3281
  /** Initialise the entity with data from a dictionary. */
2963
- initialiseFromDictionary(data: { [key: string]: any }) {
3282
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2964
3283
  super.initialiseFromDictionary(data);
2965
3284
  if (data.position) {
2966
3285
  this.position = new LocalPosition();
2967
- this.position.initialiseFromDictionary(data.position);
3286
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
3287
+ }
3288
+ if (data.toxicResult !== undefined && typeof data.toxicResult === "number") {
3289
+ this.toxicResult = data.toxicResult as number;
3290
+ }
3291
+ if (data.toxicResultType !== undefined && (typeof data.toxicResultType === "string" || typeof data.toxicResultType === "number")) {
3292
+ this.toxicResultType = this.parseEnumValue(data.toxicResultType, Enums.ToxicResultType);
2968
3293
  }
2969
- this.toxicResult = parseFloat(data.toxicResult);
2970
- this.toxicResultType = this.parseEnumValue(
2971
- data.toxicResultType,
2972
- Enums.ToxicResultType
2973
- );
2974
3294
  }
2975
3295
 
2976
- private parseEnumValue<T extends object>(
2977
- value: any,
2978
- enumType: T
2979
- ): T[keyof T] | undefined {
3296
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2980
3297
  if (typeof value === "string" && value in enumType) {
2981
3298
  return enumType[value as keyof T];
2982
- } else if (
2983
- typeof value === "number" &&
2984
- Object.values(enumType).includes(value)
2985
- ) {
3299
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2986
3300
  return value as T[keyof T];
2987
3301
  }
2988
3302
  return undefined; // Return undefined if the value does not match the enum
@@ -3049,40 +3363,43 @@ export class Vessel extends Asset {
3049
3363
  }
3050
3364
 
3051
3365
  /** Initialise the entity with data from a dictionary. */
3052
- initialiseFromDictionary(data: { [key: string]: any }) {
3366
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3053
3367
  super.initialiseFromDictionary(data);
3054
3368
  if (data.state) {
3055
3369
  this.state = new State();
3056
- this.state.initialiseFromDictionary(data.state);
3370
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
3057
3371
  }
3058
3372
  if (data.material) {
3059
3373
  this.material = new Material();
3060
- this.material.initialiseFromDictionary(data.material);
3061
- }
3062
- this.diameter = parseFloat(data.diameter);
3063
- this.height = parseFloat(data.height);
3064
- this.length = parseFloat(data.length);
3065
- this.width = parseFloat(data.width);
3066
- this.shape = this.parseEnumValue(data.shape, Enums.VesselShape);
3067
- this.vesselConditions = this.parseEnumValue(
3068
- data.vesselConditions,
3069
- Enums.VesselConditions
3070
- );
3071
- this.liquidFillFractionByVolume = parseFloat(
3072
- data.liquidFillFractionByVolume
3073
- );
3074
- }
3075
-
3076
- private parseEnumValue<T extends object>(
3077
- value: any,
3078
- enumType: T
3079
- ): T[keyof T] | undefined {
3374
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
3375
+ }
3376
+ if (data.diameter !== undefined && typeof data.diameter === "number") {
3377
+ this.diameter = data.diameter as number;
3378
+ }
3379
+ if (data.height !== undefined && typeof data.height === "number") {
3380
+ this.height = data.height as number;
3381
+ }
3382
+ if (data.length !== undefined && typeof data.length === "number") {
3383
+ this.length = data.length as number;
3384
+ }
3385
+ if (data.width !== undefined && typeof data.width === "number") {
3386
+ this.width = data.width as number;
3387
+ }
3388
+ if (data.shape !== undefined && (typeof data.shape === "string" || typeof data.shape === "number")) {
3389
+ this.shape = this.parseEnumValue(data.shape, Enums.VesselShape);
3390
+ }
3391
+ if (data.vesselConditions !== undefined && (typeof data.vesselConditions === "string" || typeof data.vesselConditions === "number")) {
3392
+ this.vesselConditions = this.parseEnumValue(data.vesselConditions, Enums.VesselConditions);
3393
+ }
3394
+ if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume === "number") {
3395
+ this.liquidFillFractionByVolume = data.liquidFillFractionByVolume as number;
3396
+ }
3397
+ }
3398
+
3399
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
3080
3400
  if (typeof value === "string" && value in enumType) {
3081
3401
  return enumType[value as keyof T];
3082
- } else if (
3083
- typeof value === "number" &&
3084
- Object.values(enumType).includes(value)
3085
- ) {
3402
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
3086
3403
  return value as T[keyof T];
3087
3404
  }
3088
3405
  return undefined; // Return undefined if the value does not match the enum
@@ -3142,26 +3459,32 @@ export class VesselLeakMaxFlammableCloudResults extends EntityBase {
3142
3459
  }
3143
3460
 
3144
3461
  /** Initialise the entity with data from a dictionary. */
3145
- initialiseFromDictionary(data: { [key: string]: any }) {
3462
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3146
3463
  super.initialiseFromDictionary(data);
3147
- this.dischargeRate = parseFloat(data.dischargeRate);
3148
- this.expandedTemperature = parseFloat(data.expandedTemperature);
3149
- this.lflExtent = parseFloat(data.lflExtent);
3150
- this.lflArea = parseFloat(data.lflArea);
3151
- this.lflHeight = parseFloat(data.lflHeight);
3152
- this.phase = this.parseEnumValue(data.phase, Enums.Phase);
3153
- }
3154
-
3155
- private parseEnumValue<T extends object>(
3156
- value: any,
3157
- enumType: T
3158
- ): T[keyof T] | undefined {
3464
+ if (data.dischargeRate !== undefined && typeof data.dischargeRate === "number") {
3465
+ this.dischargeRate = data.dischargeRate as number;
3466
+ }
3467
+ if (data.expandedTemperature !== undefined && typeof data.expandedTemperature === "number") {
3468
+ this.expandedTemperature = data.expandedTemperature as number;
3469
+ }
3470
+ if (data.lflExtent !== undefined && typeof data.lflExtent === "number") {
3471
+ this.lflExtent = data.lflExtent as number;
3472
+ }
3473
+ if (data.lflArea !== undefined && typeof data.lflArea === "number") {
3474
+ this.lflArea = data.lflArea as number;
3475
+ }
3476
+ if (data.lflHeight !== undefined && typeof data.lflHeight === "number") {
3477
+ this.lflHeight = data.lflHeight as number;
3478
+ }
3479
+ if (data.phase !== undefined && (typeof data.phase === "string" || typeof data.phase === "number")) {
3480
+ this.phase = this.parseEnumValue(data.phase, Enums.Phase);
3481
+ }
3482
+ }
3483
+
3484
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
3159
3485
  if (typeof value === "string" && value in enumType) {
3160
3486
  return enumType[value as keyof T];
3161
- } else if (
3162
- typeof value === "number" &&
3163
- Object.values(enumType).includes(value)
3164
- ) {
3487
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
3165
3488
  return value as T[keyof T];
3166
3489
  }
3167
3490
  return undefined; // Return undefined if the value does not match the enum
@@ -3207,17 +3530,19 @@ export class VesselSphere extends Asset {
3207
3530
  }
3208
3531
 
3209
3532
  /** Initialise the entity with data from a dictionary. */
3210
- initialiseFromDictionary(data: { [key: string]: any }) {
3533
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3211
3534
  super.initialiseFromDictionary(data);
3212
3535
  if (data.state) {
3213
3536
  this.state = new State();
3214
- this.state.initialiseFromDictionary(data.state);
3537
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
3215
3538
  }
3216
3539
  if (data.material) {
3217
3540
  this.material = new Material();
3218
- this.material.initialiseFromDictionary(data.material);
3541
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
3542
+ }
3543
+ if (data.massInventory !== undefined && typeof data.massInventory === "number") {
3544
+ this.massInventory = data.massInventory as number;
3219
3545
  }
3220
- this.massInventory = parseFloat(data.massInventory);
3221
3546
  }
3222
3547
 
3223
3548
  toString() {
@@ -3252,8 +3577,7 @@ export class Weather extends EntityBase {
3252
3577
  */
3253
3578
  constructor(
3254
3579
  windSpeed: number = 5,
3255
- stabilityClass: Enums.AtmosphericStabilityClass = Enums
3256
- .AtmosphericStabilityClass.STABILITY_D,
3580
+ stabilityClass: Enums.AtmosphericStabilityClass = Enums.AtmosphericStabilityClass.STABILITY_D,
3257
3581
  temperature: number = 283,
3258
3582
  relativeHumidity: number = 0.7,
3259
3583
  mixingLayerHeight: number = 800,
@@ -3269,29 +3593,32 @@ export class Weather extends EntityBase {
3269
3593
  }
3270
3594
 
3271
3595
  /** Initialise the entity with data from a dictionary. */
3272
- initialiseFromDictionary(data: { [key: string]: any }) {
3596
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3273
3597
  super.initialiseFromDictionary(data);
3274
- this.windSpeed = parseFloat(data.windSpeed);
3275
- this.stabilityClass = this.parseEnumValue(
3276
- data.stabilityClass,
3277
- Enums.AtmosphericStabilityClass
3278
- );
3279
- this.temperature = parseFloat(data.temperature);
3280
- this.relativeHumidity = parseFloat(data.relativeHumidity);
3281
- this.mixingLayerHeight = parseFloat(data.mixingLayerHeight);
3282
- this.solarRadiation = parseFloat(data.solarRadiation);
3283
- }
3284
-
3285
- private parseEnumValue<T extends object>(
3286
- value: any,
3287
- enumType: T
3288
- ): T[keyof T] | undefined {
3598
+ if (data.windSpeed !== undefined && typeof data.windSpeed === "number") {
3599
+ this.windSpeed = data.windSpeed as number;
3600
+ }
3601
+ if (data.stabilityClass !== undefined && (typeof data.stabilityClass === "string" || typeof data.stabilityClass === "number")) {
3602
+ this.stabilityClass = this.parseEnumValue(data.stabilityClass, Enums.AtmosphericStabilityClass);
3603
+ }
3604
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
3605
+ this.temperature = data.temperature as number;
3606
+ }
3607
+ if (data.relativeHumidity !== undefined && typeof data.relativeHumidity === "number") {
3608
+ this.relativeHumidity = data.relativeHumidity as number;
3609
+ }
3610
+ if (data.mixingLayerHeight !== undefined && typeof data.mixingLayerHeight === "number") {
3611
+ this.mixingLayerHeight = data.mixingLayerHeight as number;
3612
+ }
3613
+ if (data.solarRadiation !== undefined && typeof data.solarRadiation === "number") {
3614
+ this.solarRadiation = data.solarRadiation as number;
3615
+ }
3616
+ }
3617
+
3618
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
3289
3619
  if (typeof value === "string" && value in enumType) {
3290
3620
  return enumType[value as keyof T];
3291
- } else if (
3292
- typeof value === "number" &&
3293
- Object.values(enumType).includes(value)
3294
- ) {
3621
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
3295
3622
  return value as T[keyof T];
3296
3623
  }
3297
3624
  return undefined; // Return undefined if the value does not match the enum