@dnv-plant/typescriptpws 1.0.16 → 1.0.17-alpha.1802121

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,7 +1,7 @@
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.17
4
+ * Date/time: 14 Feb 2025 17:00:54
5
5
  * Template: templates/typescriptpws/entities.razor.
6
6
  ***********************************************************************/
7
7
 
@@ -11,7 +11,7 @@ class EntityBase {
11
11
  /**
12
12
  * Base class for all entities.
13
13
  */
14
- initialiseFromDictionary(data: { [key: string]: any }): void {
14
+ initialiseFromDictionary(data: { [key: string]: unknown }): void {
15
15
  // Implementation goes here
16
16
  }
17
17
 
@@ -32,7 +32,11 @@ export class LocalPosition extends EntityBase {
32
32
  * @param {number} y - y coordinate. (default value is 0)
33
33
  * @param {number} z - z coordinate. (default value is 0)
34
34
  */
35
- constructor(x: number = 0, y: number = 0, z: number = 0) {
35
+ constructor(
36
+ x: number = 0,
37
+ y: number = 0,
38
+ z: number = 0
39
+ ) {
36
40
  super();
37
41
  this.x = x;
38
42
  this.y = y;
@@ -40,11 +44,17 @@ export class LocalPosition extends EntityBase {
40
44
  }
41
45
 
42
46
  /** Initialise the entity with data from a dictionary. */
43
- initialiseFromDictionary(data: { [key: string]: any }) {
47
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
44
48
  super.initialiseFromDictionary(data);
45
- this.x = parseFloat(data.x);
46
- this.y = parseFloat(data.y);
47
- this.z = parseFloat(data.z);
49
+ if (data.x !== undefined && typeof data.x === "number") {
50
+ this.x = data.x as number;
51
+ }
52
+ if (data.y !== undefined && typeof data.y === "number") {
53
+ this.y = data.y as number;
54
+ }
55
+ if (data.z !== undefined && typeof data.z === "number") {
56
+ this.z = data.z as number;
57
+ }
48
58
  }
49
59
 
50
60
  toString() {
@@ -66,28 +76,33 @@ export class Asset extends EntityBase {
66
76
  *
67
77
  * @param {LocalPosition} location - Location of the asset.
68
78
  */
69
- constructor(location: LocalPosition = new LocalPosition()) {
79
+ constructor(
80
+ location: LocalPosition = new LocalPosition()
81
+ ) {
70
82
  super();
71
83
  this.location = location;
72
84
  }
73
85
 
74
86
  /** Initialise the entity with data from a dictionary. */
75
- initialiseFromDictionary(data: { [key: string]: any }) {
87
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
76
88
  super.initialiseFromDictionary(data);
77
89
  if (data.location) {
78
90
  this.location = new LocalPosition();
79
- this.location.initialiseFromDictionary(data.location);
91
+ this.location.initialiseFromDictionary(data.location as { [key: string]: unknown });
80
92
  }
81
93
  }
82
94
 
83
95
  toString() {
84
- const parts = ["* Asset", `location: ${this.location?.toString()}`];
96
+ const parts = [
97
+ "* Asset",
98
+ `location: ${this.location?.toString()}`,
99
+ ];
85
100
  return parts.join("\n");
86
101
  }
87
102
  }
88
103
 
89
104
  export class MaterialComponent extends EntityBase {
90
- name?: string;
105
+ name: string;
91
106
  moleFraction: number;
92
107
 
93
108
  /**
@@ -96,17 +111,24 @@ export class MaterialComponent extends EntityBase {
96
111
  * @param {string} name - Name of the component.
97
112
  * @param {number} moleFraction - Mole fraction of the component in the material. (default value is 1)
98
113
  */
99
- constructor(name?: string, moleFraction: number = 1) {
114
+ constructor(
115
+ name: string = "",
116
+ moleFraction: number = 1
117
+ ) {
100
118
  super();
101
119
  this.name = name;
102
120
  this.moleFraction = moleFraction;
103
121
  }
104
122
 
105
123
  /** Initialise the entity with data from a dictionary. */
106
- initialiseFromDictionary(data: { [key: string]: any }) {
124
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
107
125
  super.initialiseFromDictionary(data);
108
- this.name = data.name?.toString();
109
- this.moleFraction = parseFloat(data.moleFraction);
126
+ if (data.name !== undefined && typeof data.name === "string") {
127
+ this.name = data.name as string;
128
+ }
129
+ if (data.moleFraction !== undefined && typeof data.moleFraction === "number") {
130
+ this.moleFraction = data.moleFraction as number;
131
+ }
110
132
  }
111
133
 
112
134
  toString() {
@@ -120,7 +142,7 @@ export class MaterialComponent extends EntityBase {
120
142
  }
121
143
 
122
144
  export class Material extends EntityBase {
123
- name?: string;
145
+ name: string;
124
146
  components: MaterialComponent[];
125
147
  componentCount: number;
126
148
  propertyTemplate?: Enums.PropertyTemplate;
@@ -134,7 +156,7 @@ export class Material extends EntityBase {
134
156
  * @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
157
  */
136
158
  constructor(
137
- name?: string,
159
+ name: string = "",
138
160
  components: MaterialComponent[] = [new MaterialComponent()],
139
161
  componentCount: number = 1,
140
162
  propertyTemplate: Enums.PropertyTemplate = Enums.PropertyTemplate.PHAST_MC
@@ -147,31 +169,32 @@ export class Material extends EntityBase {
147
169
  }
148
170
 
149
171
  /** Initialise the entity with data from a dictionary. */
150
- initialiseFromDictionary(data: { [key: string]: any }) {
172
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
151
173
  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)
174
+ if (data.name !== undefined && typeof data.name === "string") {
175
+ this.name = data.name as string;
176
+ }
177
+ if (data.components && Array.isArray(data.components)) {
178
+ this.components = data.components.map(
179
+ (item) => {
180
+ const record = new MaterialComponent();
181
+ record.initialiseFromDictionary(item);
182
+ return record;
183
+ }
156
184
  );
157
185
  }
158
- this.componentCount = parseInt(data.componentCount);
159
- this.propertyTemplate = this.parseEnumValue(
160
- data.propertyTemplate,
161
- Enums.PropertyTemplate
162
- );
186
+ if (data.componentCount !== undefined && typeof data.componentCount === "number") {
187
+ this.componentCount = data.componentCount as number;
188
+ }
189
+ if (data.propertyTemplate !== undefined && (typeof data.propertyTemplate === "string" || typeof data.propertyTemplate === "number")) {
190
+ this.propertyTemplate = this.parseEnumValue(data.propertyTemplate, Enums.PropertyTemplate);
191
+ }
163
192
  }
164
193
 
165
- private parseEnumValue<T extends object>(
166
- value: any,
167
- enumType: T
168
- ): T[keyof T] | undefined {
194
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
169
195
  if (typeof value === "string" && value in enumType) {
170
196
  return enumType[value as keyof T];
171
- } else if (
172
- typeof value === "number" &&
173
- Object.values(enumType).includes(value)
174
- ) {
197
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
175
198
  return value as T[keyof T];
176
199
  }
177
200
  return undefined; // Return undefined if the value does not match the enum
@@ -181,7 +204,7 @@ export class Material extends EntityBase {
181
204
  const parts = [
182
205
  "* Material",
183
206
  `name: ${this.name}`,
184
- this.components?.map((item: any) => item?.toString()).join("\n"),
207
+ this.components?.map((item) => item?.toString()).join("\n"),
185
208
  `componentCount: ${this.componentCount}`,
186
209
  `propertyTemplate: ${this.propertyTemplate}`,
187
210
  ];
@@ -221,28 +244,29 @@ export class State extends EntityBase {
221
244
  }
222
245
 
223
246
  /** Initialise the entity with data from a dictionary. */
224
- initialiseFromDictionary(data: { [key: string]: any }) {
247
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
225
248
  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 {
249
+ if (data.pressure !== undefined && typeof data.pressure === "number") {
250
+ this.pressure = data.pressure as number;
251
+ }
252
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
253
+ this.temperature = data.temperature as number;
254
+ }
255
+ if (data.liquidFraction !== undefined && typeof data.liquidFraction === "number") {
256
+ this.liquidFraction = data.liquidFraction as number;
257
+ }
258
+ if (data.flashFlag !== undefined && (typeof data.flashFlag === "string" || typeof data.flashFlag === "number")) {
259
+ this.flashFlag = this.parseEnumValue(data.flashFlag, Enums.FluidSpec);
260
+ }
261
+ if (data.mixtureModelling !== undefined && (typeof data.mixtureModelling === "string" || typeof data.mixtureModelling === "number")) {
262
+ this.mixtureModelling = this.parseEnumValue(data.mixtureModelling, Enums.MixtureModelling);
263
+ }
264
+ }
265
+
266
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
240
267
  if (typeof value === "string" && value in enumType) {
241
268
  return enumType[value as keyof T];
242
- } else if (
243
- typeof value === "number" &&
244
- Object.values(enumType).includes(value)
245
- ) {
269
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
246
270
  return value as T[keyof T];
247
271
  }
248
272
  return undefined; // Return undefined if the value does not match the enum
@@ -295,21 +319,25 @@ export class AtmosphericStorageTank extends Asset {
295
319
  }
296
320
 
297
321
  /** Initialise the entity with data from a dictionary. */
298
- initialiseFromDictionary(data: { [key: string]: any }) {
322
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
299
323
  super.initialiseFromDictionary(data);
300
324
  if (data.state) {
301
325
  this.state = new State();
302
- this.state.initialiseFromDictionary(data.state);
326
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
327
+ }
328
+ if (data.diameter !== undefined && typeof data.diameter === "number") {
329
+ this.diameter = data.diameter as number;
330
+ }
331
+ if (data.height !== undefined && typeof data.height === "number") {
332
+ this.height = data.height as number;
303
333
  }
304
- this.diameter = parseFloat(data.diameter);
305
- this.height = parseFloat(data.height);
306
334
  if (data.material) {
307
335
  this.material = new Material();
308
- this.material.initialiseFromDictionary(data.material);
336
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
337
+ }
338
+ if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume === "number") {
339
+ this.liquidFillFractionByVolume = data.liquidFillFractionByVolume as number;
309
340
  }
310
- this.liquidFillFractionByVolume = parseFloat(
311
- data.liquidFillFractionByVolume
312
- );
313
341
  }
314
342
 
315
343
  toString() {
@@ -350,11 +378,17 @@ export class Bund extends EntityBase {
350
378
  }
351
379
 
352
380
  /** Initialise the entity with data from a dictionary. */
353
- initialiseFromDictionary(data: { [key: string]: any }) {
381
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
354
382
  super.initialiseFromDictionary(data);
355
- this.bundHeight = parseFloat(data.bundHeight);
356
- this.bundDiameter = parseFloat(data.bundDiameter);
357
- this.specifyBund = data.specifyBund;
383
+ if (data.bundHeight !== undefined && typeof data.bundHeight === "number") {
384
+ this.bundHeight = data.bundHeight as number;
385
+ }
386
+ if (data.bundDiameter !== undefined && typeof data.bundDiameter === "number") {
387
+ this.bundDiameter = data.bundDiameter as number;
388
+ }
389
+ if (data.specifyBund !== undefined && typeof data.specifyBund === "boolean") {
390
+ this.specifyBund = data.specifyBund as boolean;
391
+ }
358
392
  }
359
393
 
360
394
  toString() {
@@ -373,17 +407,20 @@ export class Scenario extends EntityBase {
373
407
  * Base struct/class for all scenario types.
374
408
  *
375
409
  */
376
- constructor() {
410
+ constructor(
411
+ ) {
377
412
  super();
378
413
  }
379
414
 
380
415
  /** Initialise the entity with data from a dictionary. */
381
- initialiseFromDictionary(data: { [key: string]: any }) {
416
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
382
417
  super.initialiseFromDictionary(data);
383
418
  }
384
419
 
385
420
  toString() {
386
- const parts = ["* Scenario"];
421
+ const parts = [
422
+ "* Scenario",
423
+ ];
387
424
  return parts.join("\n");
388
425
  }
389
426
  }
@@ -393,17 +430,20 @@ export class Instantaneous extends Scenario {
393
430
  * Base struct/class for instantaneous release scenarios.
394
431
  *
395
432
  */
396
- constructor() {
433
+ constructor(
434
+ ) {
397
435
  super();
398
436
  }
399
437
 
400
438
  /** Initialise the entity with data from a dictionary. */
401
- initialiseFromDictionary(data: { [key: string]: any }) {
439
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
402
440
  super.initialiseFromDictionary(data);
403
441
  }
404
442
 
405
443
  toString() {
406
- const parts = ["* Instantaneous"];
444
+ const parts = [
445
+ "* Instantaneous",
446
+ ];
407
447
  return parts.join("\n");
408
448
  }
409
449
  }
@@ -413,17 +453,20 @@ export class CatastrophicRupture extends Instantaneous {
413
453
  * 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
454
  *
415
455
  */
416
- constructor() {
456
+ constructor(
457
+ ) {
417
458
  super();
418
459
  }
419
460
 
420
461
  /** Initialise the entity with data from a dictionary. */
421
- initialiseFromDictionary(data: { [key: string]: any }) {
462
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
422
463
  super.initialiseFromDictionary(data);
423
464
  }
424
465
 
425
466
  toString() {
426
- const parts = ["* CatastrophicRupture"];
467
+ const parts = [
468
+ "* CatastrophicRupture",
469
+ ];
427
470
  return parts.join("\n");
428
471
  }
429
472
  }
@@ -448,12 +491,14 @@ export class ConcentrationRecord extends EntityBase {
448
491
  }
449
492
 
450
493
  /** Initialise the entity with data from a dictionary. */
451
- initialiseFromDictionary(data: { [key: string]: any }) {
494
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
452
495
  super.initialiseFromDictionary(data);
453
- this.concentration = parseFloat(data.concentration);
496
+ if (data.concentration !== undefined && typeof data.concentration === "number") {
497
+ this.concentration = data.concentration as number;
498
+ }
454
499
  if (data.position) {
455
500
  this.position = new LocalPosition();
456
- this.position.initialiseFromDictionary(data.position);
501
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
457
502
  }
458
503
  }
459
504
 
@@ -491,11 +536,17 @@ export class ConstantMaterialResult extends EntityBase {
491
536
  }
492
537
 
493
538
  /** Initialise the entity with data from a dictionary. */
494
- initialiseFromDictionary(data: { [key: string]: any }) {
539
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
495
540
  super.initialiseFromDictionary(data);
496
- this.criticalPressure = parseFloat(data.criticalPressure);
497
- this.criticalTemperature = parseFloat(data.criticalTemperature);
498
- this.totalMolecularWeight = parseFloat(data.totalMolecularWeight);
541
+ if (data.criticalPressure !== undefined && typeof data.criticalPressure === "number") {
542
+ this.criticalPressure = data.criticalPressure as number;
543
+ }
544
+ if (data.criticalTemperature !== undefined && typeof data.criticalTemperature === "number") {
545
+ this.criticalTemperature = data.criticalTemperature as number;
546
+ }
547
+ if (data.totalMolecularWeight !== undefined && typeof data.totalMolecularWeight === "number") {
548
+ this.totalMolecularWeight = data.totalMolecularWeight as number;
549
+ }
499
550
  }
500
551
 
501
552
  toString() {
@@ -518,32 +569,24 @@ export class DischargeParameters extends EntityBase {
518
569
  * @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
570
  */
520
571
  constructor(
521
- flashAtOrifice: Enums.FlashAtOrifice = Enums.FlashAtOrifice
522
- .DISALLOW_LIQUID_FLASH
572
+ flashAtOrifice: Enums.FlashAtOrifice = Enums.FlashAtOrifice.DISALLOW_LIQUID_FLASH
523
573
  ) {
524
574
  super();
525
575
  this.flashAtOrifice = flashAtOrifice;
526
576
  }
527
577
 
528
578
  /** Initialise the entity with data from a dictionary. */
529
- initialiseFromDictionary(data: { [key: string]: any }) {
579
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
530
580
  super.initialiseFromDictionary(data);
531
- this.flashAtOrifice = this.parseEnumValue(
532
- data.flashAtOrifice,
533
- Enums.FlashAtOrifice
534
- );
581
+ if (data.flashAtOrifice !== undefined && (typeof data.flashAtOrifice === "string" || typeof data.flashAtOrifice === "number")) {
582
+ this.flashAtOrifice = this.parseEnumValue(data.flashAtOrifice, Enums.FlashAtOrifice);
583
+ }
535
584
  }
536
585
 
537
- private parseEnumValue<T extends object>(
538
- value: any,
539
- enumType: T
540
- ): T[keyof T] | undefined {
586
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
541
587
  if (typeof value === "string" && value in enumType) {
542
588
  return enumType[value as keyof T];
543
- } else if (
544
- typeof value === "number" &&
545
- Object.values(enumType).includes(value)
546
- ) {
589
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
547
590
  return value as T[keyof T];
548
591
  }
549
592
  return undefined; // Return undefined if the value does not match the enum
@@ -606,26 +649,38 @@ export class DischargeRecord extends EntityBase {
606
649
  }
607
650
 
608
651
  /** Initialise the entity with data from a dictionary. */
609
- initialiseFromDictionary(data: { [key: string]: any }) {
652
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
610
653
  super.initialiseFromDictionary(data);
611
- this.time = parseFloat(data.time);
612
- this.massFlow = parseFloat(data.massFlow);
654
+ if (data.time !== undefined && typeof data.time === "number") {
655
+ this.time = data.time as number;
656
+ }
657
+ if (data.massFlow !== undefined && typeof data.massFlow === "number") {
658
+ this.massFlow = data.massFlow as number;
659
+ }
613
660
  if (data.finalState) {
614
661
  this.finalState = new State();
615
- this.finalState.initialiseFromDictionary(data.finalState);
662
+ this.finalState.initialiseFromDictionary(data.finalState as { [key: string]: unknown });
663
+ }
664
+ if (data.finalVelocity !== undefined && typeof data.finalVelocity === "number") {
665
+ this.finalVelocity = data.finalVelocity as number;
616
666
  }
617
- this.finalVelocity = parseFloat(data.finalVelocity);
618
667
  if (data.orificeState) {
619
668
  this.orificeState = new State();
620
- this.orificeState.initialiseFromDictionary(data.orificeState);
669
+ this.orificeState.initialiseFromDictionary(data.orificeState as { [key: string]: unknown });
670
+ }
671
+ if (data.orificeVelocity !== undefined && typeof data.orificeVelocity === "number") {
672
+ this.orificeVelocity = data.orificeVelocity as number;
621
673
  }
622
- this.orificeVelocity = parseFloat(data.orificeVelocity);
623
674
  if (data.storageState) {
624
675
  this.storageState = new State();
625
- this.storageState.initialiseFromDictionary(data.storageState);
676
+ this.storageState.initialiseFromDictionary(data.storageState as { [key: string]: unknown });
677
+ }
678
+ if (data.dropletDiameter !== undefined && typeof data.dropletDiameter === "number") {
679
+ this.dropletDiameter = data.dropletDiameter as number;
680
+ }
681
+ if (data.expandedDiameter !== undefined && typeof data.expandedDiameter === "number") {
682
+ this.expandedDiameter = data.expandedDiameter as number;
626
683
  }
627
- this.dropletDiameter = parseFloat(data.dropletDiameter);
628
- this.expandedDiameter = parseFloat(data.expandedDiameter);
629
684
  }
630
685
 
631
686
  toString() {
@@ -685,27 +740,35 @@ export class DischargeResult extends EntityBase {
685
740
  }
686
741
 
687
742
  /** Initialise the entity with data from a dictionary. */
688
- initialiseFromDictionary(data: { [key: string]: any }) {
743
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
689
744
  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 {
745
+ if (data.expansionEnergy !== undefined && typeof data.expansionEnergy === "number") {
746
+ this.expansionEnergy = data.expansionEnergy as number;
747
+ }
748
+ if (data.releaseMass !== undefined && typeof data.releaseMass === "number") {
749
+ this.releaseMass = data.releaseMass as number;
750
+ }
751
+ if (data.height !== undefined && typeof data.height === "number") {
752
+ this.height = data.height as number;
753
+ }
754
+ if (data.angle !== undefined && typeof data.angle === "number") {
755
+ this.angle = data.angle as number;
756
+ }
757
+ if (data.holeDiameter !== undefined && typeof data.holeDiameter === "number") {
758
+ this.holeDiameter = data.holeDiameter as number;
759
+ }
760
+ if (data.releaseType !== undefined && (typeof data.releaseType === "string" || typeof data.releaseType === "number")) {
761
+ this.releaseType = this.parseEnumValue(data.releaseType, Enums.DynamicType);
762
+ }
763
+ if (data.preDilutionAirRate !== undefined && typeof data.preDilutionAirRate === "number") {
764
+ this.preDilutionAirRate = data.preDilutionAirRate as number;
765
+ }
766
+ }
767
+
768
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
703
769
  if (typeof value === "string" && value in enumType) {
704
770
  return enumType[value as keyof T];
705
- } else if (
706
- typeof value === "number" &&
707
- Object.values(enumType).includes(value)
708
- ) {
771
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
709
772
  return value as T[keyof T];
710
773
  }
711
774
  return undefined; // Return undefined if the value does not match the enum
@@ -737,7 +800,7 @@ export class DispersionOutputConfig extends EntityBase {
737
800
  contourType?: Enums.ContourType;
738
801
  lflFractionValue: number;
739
802
  componentToTrackIndex: number;
740
- componentToTrackName?: string;
803
+ componentToTrackName: string;
741
804
 
742
805
  /**
743
806
  * Dispersion plotting and reporting parameters.
@@ -759,14 +822,13 @@ export class DispersionOutputConfig extends EntityBase {
759
822
  time: number = 60,
760
823
  resolution: Enums.Resolution = Enums.Resolution.MEDIUM,
761
824
  elevation: number = 1,
762
- specialConcentration: Enums.SpecialConcentration = Enums
763
- .SpecialConcentration.MIN,
825
+ specialConcentration: Enums.SpecialConcentration = Enums.SpecialConcentration.MIN,
764
826
  concentration: number = 0,
765
827
  crosswindDistance: number = 0,
766
828
  contourType: Enums.ContourType = Enums.ContourType.FOOTPRINT,
767
829
  lflFractionValue: number = 0.5,
768
830
  componentToTrackIndex: number = -1,
769
- componentToTrackName?: string
831
+ componentToTrackName: string = ""
770
832
  ) {
771
833
  super();
772
834
  this.downwindDistance = downwindDistance;
@@ -783,34 +845,47 @@ export class DispersionOutputConfig extends EntityBase {
783
845
  }
784
846
 
785
847
  /** Initialise the entity with data from a dictionary. */
786
- initialiseFromDictionary(data: { [key: string]: any }) {
848
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
787
849
  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 {
850
+ if (data.downwindDistance !== undefined && typeof data.downwindDistance === "number") {
851
+ this.downwindDistance = data.downwindDistance as number;
852
+ }
853
+ if (data.time !== undefined && typeof data.time === "number") {
854
+ this.time = data.time as number;
855
+ }
856
+ if (data.resolution !== undefined && (typeof data.resolution === "string" || typeof data.resolution === "number")) {
857
+ this.resolution = this.parseEnumValue(data.resolution, Enums.Resolution);
858
+ }
859
+ if (data.elevation !== undefined && typeof data.elevation === "number") {
860
+ this.elevation = data.elevation as number;
861
+ }
862
+ if (data.specialConcentration !== undefined && (typeof data.specialConcentration === "string" || typeof data.specialConcentration === "number")) {
863
+ this.specialConcentration = this.parseEnumValue(data.specialConcentration, Enums.SpecialConcentration);
864
+ }
865
+ if (data.concentration !== undefined && typeof data.concentration === "number") {
866
+ this.concentration = data.concentration as number;
867
+ }
868
+ if (data.crosswindDistance !== undefined && typeof data.crosswindDistance === "number") {
869
+ this.crosswindDistance = data.crosswindDistance as number;
870
+ }
871
+ if (data.contourType !== undefined && (typeof data.contourType === "string" || typeof data.contourType === "number")) {
872
+ this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
873
+ }
874
+ if (data.lflFractionValue !== undefined && typeof data.lflFractionValue === "number") {
875
+ this.lflFractionValue = data.lflFractionValue as number;
876
+ }
877
+ if (data.componentToTrackIndex !== undefined && typeof data.componentToTrackIndex === "number") {
878
+ this.componentToTrackIndex = data.componentToTrackIndex as number;
879
+ }
880
+ if (data.componentToTrackName !== undefined && typeof data.componentToTrackName === "string") {
881
+ this.componentToTrackName = data.componentToTrackName as string;
882
+ }
883
+ }
884
+
885
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
808
886
  if (typeof value === "string" && value in enumType) {
809
887
  return enumType[value as keyof T];
810
- } else if (
811
- typeof value === "number" &&
812
- Object.values(enumType).includes(value)
813
- ) {
888
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
814
889
  return value as T[keyof T];
815
890
  }
816
891
  return undefined; // Return undefined if the value does not match the enum
@@ -863,8 +938,7 @@ export class DispersionParameters extends EntityBase {
863
938
  */
864
939
  constructor(
865
940
  relativeTolerance: number = 0.001,
866
- rainoutThermoFlag: Enums.RainoutThermoFlag = Enums.RainoutThermoFlag
867
- .RAINOUT_NON_EQUILIBRIUM,
941
+ rainoutThermoFlag: Enums.RainoutThermoFlag = Enums.RainoutThermoFlag.RAINOUT_NON_EQUILIBRIUM,
868
942
  fixedStepSize: number = 0.01,
869
943
  outputStepMultiplier: number = 1.2,
870
944
  maxDispersionDistance: number = 50000,
@@ -888,33 +962,44 @@ export class DispersionParameters extends EntityBase {
888
962
  }
889
963
 
890
964
  /** Initialise the entity with data from a dictionary. */
891
- initialiseFromDictionary(data: { [key: string]: any }) {
965
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
892
966
  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 {
967
+ if (data.relativeTolerance !== undefined && typeof data.relativeTolerance === "number") {
968
+ this.relativeTolerance = data.relativeTolerance as number;
969
+ }
970
+ if (data.rainoutThermoFlag !== undefined && (typeof data.rainoutThermoFlag === "string" || typeof data.rainoutThermoFlag === "number")) {
971
+ this.rainoutThermoFlag = this.parseEnumValue(data.rainoutThermoFlag, Enums.RainoutThermoFlag);
972
+ }
973
+ if (data.fixedStepSize !== undefined && typeof data.fixedStepSize === "number") {
974
+ this.fixedStepSize = data.fixedStepSize as number;
975
+ }
976
+ if (data.outputStepMultiplier !== undefined && typeof data.outputStepMultiplier === "number") {
977
+ this.outputStepMultiplier = data.outputStepMultiplier as number;
978
+ }
979
+ if (data.maxDispersionDistance !== undefined && typeof data.maxDispersionDistance === "number") {
980
+ this.maxDispersionDistance = data.maxDispersionDistance as number;
981
+ }
982
+ if (data.maxDispersionHeight !== undefined && typeof data.maxDispersionHeight === "number") {
983
+ this.maxDispersionHeight = data.maxDispersionHeight as number;
984
+ }
985
+ if (data.numberOfReleaseObservers !== undefined && typeof data.numberOfReleaseObservers === "number") {
986
+ this.numberOfReleaseObservers = data.numberOfReleaseObservers as number;
987
+ }
988
+ if (data.numberOfPoolObservers !== undefined && typeof data.numberOfPoolObservers === "number") {
989
+ this.numberOfPoolObservers = data.numberOfPoolObservers as number;
990
+ }
991
+ if (data.averagingTime !== undefined && typeof data.averagingTime === "number") {
992
+ this.averagingTime = data.averagingTime as number;
993
+ }
994
+ if (data.lflFractionToStop !== undefined && typeof data.lflFractionToStop === "number") {
995
+ this.lflFractionToStop = data.lflFractionToStop as number;
996
+ }
997
+ }
998
+
999
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
912
1000
  if (typeof value === "string" && value in enumType) {
913
1001
  return enumType[value as keyof T];
914
- } else if (
915
- typeof value === "number" &&
916
- Object.values(enumType).includes(value)
917
- ) {
1002
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
918
1003
  return value as T[keyof T];
919
1004
  }
920
1005
  return undefined; // Return undefined if the value does not match the enum
@@ -1038,8 +1123,7 @@ export class DispersionRecord extends EntityBase {
1038
1123
  this.centrelineConcentration = centrelineConcentration;
1039
1124
  this.downwindDistance = downwindDistance;
1040
1125
  this.time = time;
1041
- this.centrelineConcentrationUncorrected =
1042
- centrelineConcentrationUncorrected;
1126
+ this.centrelineConcentrationUncorrected = centrelineConcentrationUncorrected;
1043
1127
  this.crosswindRadius = crosswindRadius;
1044
1128
  this.verticalRadius = verticalRadius;
1045
1129
  this.crosswindExponent = crosswindExponent;
@@ -1067,51 +1151,101 @@ export class DispersionRecord extends EntityBase {
1067
1151
  }
1068
1152
 
1069
1153
  /** Initialise the entity with data from a dictionary. */
1070
- initialiseFromDictionary(data: { [key: string]: any }) {
1154
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1071
1155
  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 {
1156
+ if (data.observerIndex !== undefined && typeof data.observerIndex === "number") {
1157
+ this.observerIndex = data.observerIndex as number;
1158
+ }
1159
+ if (data.centrelineConcentration !== undefined && typeof data.centrelineConcentration === "number") {
1160
+ this.centrelineConcentration = data.centrelineConcentration as number;
1161
+ }
1162
+ if (data.downwindDistance !== undefined && typeof data.downwindDistance === "number") {
1163
+ this.downwindDistance = data.downwindDistance as number;
1164
+ }
1165
+ if (data.time !== undefined && typeof data.time === "number") {
1166
+ this.time = data.time as number;
1167
+ }
1168
+ if (data.centrelineConcentrationUncorrected !== undefined && typeof data.centrelineConcentrationUncorrected === "number") {
1169
+ this.centrelineConcentrationUncorrected = data.centrelineConcentrationUncorrected as number;
1170
+ }
1171
+ if (data.crosswindRadius !== undefined && typeof data.crosswindRadius === "number") {
1172
+ this.crosswindRadius = data.crosswindRadius as number;
1173
+ }
1174
+ if (data.verticalRadius !== undefined && typeof data.verticalRadius === "number") {
1175
+ this.verticalRadius = data.verticalRadius as number;
1176
+ }
1177
+ if (data.crosswindExponent !== undefined && typeof data.crosswindExponent === "number") {
1178
+ this.crosswindExponent = data.crosswindExponent as number;
1179
+ }
1180
+ if (data.verticalExponent !== undefined && typeof data.verticalExponent === "number") {
1181
+ this.verticalExponent = data.verticalExponent as number;
1182
+ }
1183
+ if (data.theta !== undefined && typeof data.theta === "number") {
1184
+ this.theta = data.theta as number;
1185
+ }
1186
+ if (data.centrelineHeight !== undefined && typeof data.centrelineHeight === "number") {
1187
+ this.centrelineHeight = data.centrelineHeight as number;
1188
+ }
1189
+ if (data.liquidFraction !== undefined && typeof data.liquidFraction === "number") {
1190
+ this.liquidFraction = data.liquidFraction as number;
1191
+ }
1192
+ if (data.vapourTemperature !== undefined && typeof data.vapourTemperature === "number") {
1193
+ this.vapourTemperature = data.vapourTemperature as number;
1194
+ }
1195
+ if (data.massConc !== undefined && typeof data.massConc === "number") {
1196
+ this.massConc = data.massConc as number;
1197
+ }
1198
+ if (data.velocity !== undefined && typeof data.velocity === "number") {
1199
+ this.velocity = data.velocity as number;
1200
+ }
1201
+ if (data.massFlow !== undefined && typeof data.massFlow === "number") {
1202
+ this.massFlow = data.massFlow as number;
1203
+ }
1204
+ if (data.profileFlag !== undefined && typeof data.profileFlag === "number") {
1205
+ this.profileFlag = data.profileFlag as number;
1206
+ }
1207
+ if (data.elevFlag !== undefined && typeof data.elevFlag === "number") {
1208
+ this.elevFlag = data.elevFlag as number;
1209
+ }
1210
+ if (data.rhoCloud !== undefined && typeof data.rhoCloud === "number") {
1211
+ this.rhoCloud = data.rhoCloud as number;
1212
+ }
1213
+ if (data.liqTemp !== undefined && typeof data.liqTemp === "number") {
1214
+ this.liqTemp = data.liqTemp as number;
1215
+ }
1216
+ if (data.effectiveWidth !== undefined && typeof data.effectiveWidth === "number") {
1217
+ this.effectiveWidth = data.effectiveWidth as number;
1218
+ }
1219
+ if (data.effectiveHeight !== undefined && typeof data.effectiveHeight === "number") {
1220
+ this.effectiveHeight = data.effectiveHeight as number;
1221
+ }
1222
+ if (data.passTranDist !== undefined && typeof data.passTranDist === "number") {
1223
+ this.passTranDist = data.passTranDist as number;
1224
+ }
1225
+ if (data.downwindRadius !== undefined && typeof data.downwindRadius === "number") {
1226
+ this.downwindRadius = data.downwindRadius as number;
1227
+ }
1228
+ if (data.dropletDiameter !== undefined && typeof data.dropletDiameter === "number") {
1229
+ this.dropletDiameter = data.dropletDiameter as number;
1230
+ }
1231
+ if (data.dropletHeight !== undefined && typeof data.dropletHeight === "number") {
1232
+ this.dropletHeight = data.dropletHeight as number;
1233
+ }
1234
+ if (data.dropletDistance !== undefined && typeof data.dropletDistance === "number") {
1235
+ this.dropletDistance = data.dropletDistance as number;
1236
+ }
1237
+ if (data.mass !== undefined && typeof data.mass === "number") {
1238
+ this.mass = data.mass as number;
1239
+ }
1240
+ if (data.instCon !== undefined && (typeof data.instCon === "string" || typeof data.instCon === "number")) {
1241
+ this.instCon = this.parseEnumValue(data.instCon, Enums.DynamicType);
1242
+ }
1243
+ }
1244
+
1245
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1109
1246
  if (typeof value === "string" && value in enumType) {
1110
1247
  return enumType[value as keyof T];
1111
- } else if (
1112
- typeof value === "number" &&
1113
- Object.values(enumType).includes(value)
1114
- ) {
1248
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1115
1249
  return value as T[keyof T];
1116
1250
  }
1117
1251
  return undefined; // Return undefined if the value does not match the enum
@@ -1164,17 +1298,24 @@ export class ExplosionConfinedVolume extends EntityBase {
1164
1298
  * @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
1299
  * @param {number} confinedVolume - The volume of the cloud that is contained in the area of confinement. (default value is 1)
1166
1300
  */
1167
- constructor(confinedStrength: number = 7, confinedVolume: number = 1) {
1301
+ constructor(
1302
+ confinedStrength: number = 7,
1303
+ confinedVolume: number = 1
1304
+ ) {
1168
1305
  super();
1169
1306
  this.confinedStrength = confinedStrength;
1170
1307
  this.confinedVolume = confinedVolume;
1171
1308
  }
1172
1309
 
1173
1310
  /** Initialise the entity with data from a dictionary. */
1174
- initialiseFromDictionary(data: { [key: string]: any }) {
1311
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1175
1312
  super.initialiseFromDictionary(data);
1176
- this.confinedStrength = parseFloat(data.confinedStrength);
1177
- this.confinedVolume = parseFloat(data.confinedVolume);
1313
+ if (data.confinedStrength !== undefined && typeof data.confinedStrength === "number") {
1314
+ this.confinedStrength = data.confinedStrength as number;
1315
+ }
1316
+ if (data.confinedVolume !== undefined && typeof data.confinedVolume === "number") {
1317
+ this.confinedVolume = data.confinedVolume as number;
1318
+ }
1178
1319
  }
1179
1320
 
1180
1321
  toString() {
@@ -1199,8 +1340,7 @@ export class ExplosionOutputConfig extends EntityBase {
1199
1340
  */
1200
1341
  constructor(
1201
1342
  overpressureLevel: number = 2068,
1202
- meConfinedMethod: Enums.MEConfinedMethod = Enums.MEConfinedMethod
1203
- .UNIFORM_CONFINED
1343
+ meConfinedMethod: Enums.MEConfinedMethod = Enums.MEConfinedMethod.UNIFORM_CONFINED
1204
1344
  ) {
1205
1345
  super();
1206
1346
  this.overpressureLevel = overpressureLevel;
@@ -1208,25 +1348,20 @@ export class ExplosionOutputConfig extends EntityBase {
1208
1348
  }
1209
1349
 
1210
1350
  /** Initialise the entity with data from a dictionary. */
1211
- initialiseFromDictionary(data: { [key: string]: any }) {
1351
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1212
1352
  super.initialiseFromDictionary(data);
1213
- this.overpressureLevel = parseFloat(data.overpressureLevel);
1214
- this.meConfinedMethod = this.parseEnumValue(
1215
- data.meConfinedMethod,
1216
- Enums.MEConfinedMethod
1217
- );
1353
+ if (data.overpressureLevel !== undefined && typeof data.overpressureLevel === "number") {
1354
+ this.overpressureLevel = data.overpressureLevel as number;
1355
+ }
1356
+ if (data.meConfinedMethod !== undefined && (typeof data.meConfinedMethod === "string" || typeof data.meConfinedMethod === "number")) {
1357
+ this.meConfinedMethod = this.parseEnumValue(data.meConfinedMethod, Enums.MEConfinedMethod);
1358
+ }
1218
1359
  }
1219
1360
 
1220
- private parseEnumValue<T extends object>(
1221
- value: any,
1222
- enumType: T
1223
- ): T[keyof T] | undefined {
1361
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1224
1362
  if (typeof value === "string" && value in enumType) {
1225
1363
  return enumType[value as keyof T];
1226
- } else if (
1227
- typeof value === "number" &&
1228
- Object.values(enumType).includes(value)
1229
- ) {
1364
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1230
1365
  return value as T[keyof T];
1231
1366
  }
1232
1367
  return undefined; // Return undefined if the value does not match the enum
@@ -1278,14 +1413,26 @@ export class ExplosionOverpressureResult extends EntityBase {
1278
1413
  }
1279
1414
 
1280
1415
  /** Initialise the entity with data from a dictionary. */
1281
- initialiseFromDictionary(data: { [key: string]: any }) {
1416
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1282
1417
  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);
1418
+ if (data.overpressure !== undefined && typeof data.overpressure === "number") {
1419
+ this.overpressure = data.overpressure as number;
1420
+ }
1421
+ if (data.explosionCentre !== undefined && typeof data.explosionCentre === "number") {
1422
+ this.explosionCentre = data.explosionCentre as number;
1423
+ }
1424
+ if (data.maximumDistance !== undefined && typeof data.maximumDistance === "number") {
1425
+ this.maximumDistance = data.maximumDistance as number;
1426
+ }
1427
+ if (data.explodedMass !== undefined && typeof data.explodedMass === "number") {
1428
+ this.explodedMass = data.explodedMass as number;
1429
+ }
1430
+ if (data.ignitionTime !== undefined && typeof data.ignitionTime === "number") {
1431
+ this.ignitionTime = data.ignitionTime as number;
1432
+ }
1433
+ if (data.radius !== undefined && typeof data.radius === "number") {
1434
+ this.radius = data.radius as number;
1435
+ }
1289
1436
  }
1290
1437
 
1291
1438
  toString() {
@@ -1310,15 +1457,19 @@ export class ExplosionParameters extends EntityBase {
1310
1457
  *
1311
1458
  * @param {number} explosionUniformStrength - The confined strength in the multi-energy uniform confined method. (default value is 10.0)
1312
1459
  */
1313
- constructor(explosionUniformStrength: number = 10.0) {
1460
+ constructor(
1461
+ explosionUniformStrength: number = 10.0
1462
+ ) {
1314
1463
  super();
1315
1464
  this.explosionUniformStrength = explosionUniformStrength;
1316
1465
  }
1317
1466
 
1318
1467
  /** Initialise the entity with data from a dictionary. */
1319
- initialiseFromDictionary(data: { [key: string]: any }) {
1468
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1320
1469
  super.initialiseFromDictionary(data);
1321
- this.explosionUniformStrength = parseFloat(data.explosionUniformStrength);
1470
+ if (data.explosionUniformStrength !== undefined && typeof data.explosionUniformStrength === "number") {
1471
+ this.explosionUniformStrength = data.explosionUniformStrength as number;
1472
+ }
1322
1473
  }
1323
1474
 
1324
1475
  toString() {
@@ -1358,12 +1509,20 @@ export class FlameRecord extends EntityBase {
1358
1509
  }
1359
1510
 
1360
1511
  /** Initialise the entity with data from a dictionary. */
1361
- initialiseFromDictionary(data: { [key: string]: any }) {
1512
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1362
1513
  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);
1514
+ if (data.xCoordinate !== undefined && typeof data.xCoordinate === "number") {
1515
+ this.xCoordinate = data.xCoordinate as number;
1516
+ }
1517
+ if (data.zCoordinate !== undefined && typeof data.zCoordinate === "number") {
1518
+ this.zCoordinate = data.zCoordinate as number;
1519
+ }
1520
+ if (data.rCoordinate !== undefined && typeof data.rCoordinate === "number") {
1521
+ this.rCoordinate = data.rCoordinate as number;
1522
+ }
1523
+ if (data.phiCoordinate !== undefined && typeof data.phiCoordinate === "number") {
1524
+ this.phiCoordinate = data.phiCoordinate as number;
1525
+ }
1367
1526
  }
1368
1527
 
1369
1528
  toString() {
@@ -1410,25 +1569,29 @@ export class FlameResult extends EntityBase {
1410
1569
  }
1411
1570
 
1412
1571
  /** Initialise the entity with data from a dictionary. */
1413
- initialiseFromDictionary(data: { [key: string]: any }) {
1572
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1414
1573
  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);
1574
+ if (data.time !== undefined && typeof data.time === "number") {
1575
+ this.time = data.time as number;
1576
+ }
1577
+ if (data.surfaceEmissivePower !== undefined && typeof data.surfaceEmissivePower === "number") {
1578
+ this.surfaceEmissivePower = data.surfaceEmissivePower as number;
1579
+ }
1580
+ if (data.flameLength !== undefined && typeof data.flameLength === "number") {
1581
+ this.flameLength = data.flameLength as number;
1582
+ }
1583
+ if (data.flameDiameter !== undefined && typeof data.flameDiameter === "number") {
1584
+ this.flameDiameter = data.flameDiameter as number;
1585
+ }
1586
+ if (data.fireType !== undefined && (typeof data.fireType === "string" || typeof data.fireType === "number")) {
1587
+ this.fireType = this.parseEnumValue(data.fireType, Enums.FireType);
1588
+ }
1420
1589
  }
1421
1590
 
1422
- private parseEnumValue<T extends object>(
1423
- value: any,
1424
- enumType: T
1425
- ): T[keyof T] | undefined {
1591
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1426
1592
  if (typeof value === "string" && value in enumType) {
1427
1593
  return enumType[value as keyof T];
1428
- } else if (
1429
- typeof value === "number" &&
1430
- Object.values(enumType).includes(value)
1431
- ) {
1594
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1432
1595
  return value as T[keyof T];
1433
1596
  }
1434
1597
  return undefined; // Return undefined if the value does not match the enum
@@ -1467,15 +1630,15 @@ export class Transect extends EntityBase {
1467
1630
  }
1468
1631
 
1469
1632
  /** Initialise the entity with data from a dictionary. */
1470
- initialiseFromDictionary(data: { [key: string]: any }) {
1633
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1471
1634
  super.initialiseFromDictionary(data);
1472
1635
  if (data.transectStartPoint) {
1473
1636
  this.transectStartPoint = new LocalPosition();
1474
- this.transectStartPoint.initialiseFromDictionary(data.transectStartPoint);
1637
+ this.transectStartPoint.initialiseFromDictionary(data.transectStartPoint as { [key: string]: unknown });
1475
1638
  }
1476
1639
  if (data.transectEndPoint) {
1477
1640
  this.transectEndPoint = new LocalPosition();
1478
- this.transectEndPoint.initialiseFromDictionary(data.transectEndPoint);
1641
+ this.transectEndPoint.initialiseFromDictionary(data.transectEndPoint as { [key: string]: unknown });
1479
1642
  }
1480
1643
  }
1481
1644
 
@@ -1541,42 +1704,46 @@ export class FlammableOutputConfig extends EntityBase {
1541
1704
  }
1542
1705
 
1543
1706
  /** Initialise the entity with data from a dictionary. */
1544
- initialiseFromDictionary(data: { [key: string]: any }) {
1707
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1545
1708
  super.initialiseFromDictionary(data);
1546
1709
  if (data.position) {
1547
1710
  this.position = new LocalPosition();
1548
- this.position.initialiseFromDictionary(data.position);
1711
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
1549
1712
  }
1550
1713
  if (data.transect) {
1551
1714
  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 {
1715
+ this.transect.initialiseFromDictionary(data.transect as { [key: string]: unknown });
1716
+ }
1717
+ if (data.radiationType !== undefined && (typeof data.radiationType === "string" || typeof data.radiationType === "number")) {
1718
+ this.radiationType = this.parseEnumValue(data.radiationType, Enums.RadiationType);
1719
+ }
1720
+ if (data.contourType !== undefined && (typeof data.contourType === "string" || typeof data.contourType === "number")) {
1721
+ this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
1722
+ }
1723
+ if (data.radiationLevel !== undefined && typeof data.radiationLevel === "number") {
1724
+ this.radiationLevel = data.radiationLevel as number;
1725
+ }
1726
+ if (data.radiationResolution !== undefined && (typeof data.radiationResolution === "string" || typeof data.radiationResolution === "number")) {
1727
+ this.radiationResolution = this.parseEnumValue(data.radiationResolution, Enums.Resolution);
1728
+ }
1729
+ if (data.fixedOrientation !== undefined && typeof data.fixedOrientation === "number") {
1730
+ this.fixedOrientation = data.fixedOrientation as number;
1731
+ }
1732
+ if (data.orientation !== undefined && typeof data.orientation === "number") {
1733
+ this.orientation = data.orientation as number;
1734
+ }
1735
+ if (data.fixedInclination !== undefined && typeof data.fixedInclination === "number") {
1736
+ this.fixedInclination = data.fixedInclination as number;
1737
+ }
1738
+ if (data.inclination !== undefined && typeof data.inclination === "number") {
1739
+ this.inclination = data.inclination as number;
1740
+ }
1741
+ }
1742
+
1743
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1574
1744
  if (typeof value === "string" && value in enumType) {
1575
1745
  return enumType[value as keyof T];
1576
- } else if (
1577
- typeof value === "number" &&
1578
- Object.values(enumType).includes(value)
1579
- ) {
1746
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1580
1747
  return value as T[keyof T];
1581
1748
  }
1582
1749
  return undefined; // Return undefined if the value does not match the enum
@@ -1636,31 +1803,32 @@ export class FlammableParameters extends EntityBase {
1636
1803
  }
1637
1804
 
1638
1805
  /** Initialise the entity with data from a dictionary. */
1639
- initialiseFromDictionary(data: { [key: string]: any }) {
1806
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1640
1807
  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 {
1808
+ if (data.maxExposureDuration !== undefined && typeof data.maxExposureDuration === "number") {
1809
+ this.maxExposureDuration = data.maxExposureDuration as number;
1810
+ }
1811
+ if (data.radiationRelativeTolerance !== undefined && typeof data.radiationRelativeTolerance === "number") {
1812
+ this.radiationRelativeTolerance = data.radiationRelativeTolerance as number;
1813
+ }
1814
+ if (data.poolFireType !== undefined && (typeof data.poolFireType === "string" || typeof data.poolFireType === "number")) {
1815
+ this.poolFireType = this.parseEnumValue(data.poolFireType, Enums.PoolFireType);
1816
+ }
1817
+ if (data.jetFireAutoSelect !== undefined && typeof data.jetFireAutoSelect === "boolean") {
1818
+ this.jetFireAutoSelect = data.jetFireAutoSelect as boolean;
1819
+ }
1820
+ if (data.timeAveraging !== undefined && typeof data.timeAveraging === "boolean") {
1821
+ this.timeAveraging = data.timeAveraging as boolean;
1822
+ }
1823
+ if (data.timeOfInterest !== undefined && typeof data.timeOfInterest === "number") {
1824
+ this.timeOfInterest = data.timeOfInterest as number;
1825
+ }
1826
+ }
1827
+
1828
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1658
1829
  if (typeof value === "string" && value in enumType) {
1659
1830
  return enumType[value as keyof T];
1660
- } else if (
1661
- typeof value === "number" &&
1662
- Object.values(enumType).includes(value)
1663
- ) {
1831
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1664
1832
  return value as T[keyof T];
1665
1833
  }
1666
1834
  return undefined; // Return undefined if the value does not match the enum
@@ -1756,36 +1924,62 @@ export class FlashResult extends EntityBase {
1756
1924
  }
1757
1925
 
1758
1926
  /** Initialise the entity with data from a dictionary. */
1759
- initialiseFromDictionary(data: { [key: string]: any }) {
1927
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1760
1928
  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 {
1929
+ if (data.pressure !== undefined && typeof data.pressure === "number") {
1930
+ this.pressure = data.pressure as number;
1931
+ }
1932
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
1933
+ this.temperature = data.temperature as number;
1934
+ }
1935
+ if (data.liquidMoleFraction !== undefined && typeof data.liquidMoleFraction === "number") {
1936
+ this.liquidMoleFraction = data.liquidMoleFraction as number;
1937
+ }
1938
+ if (data.liquidDensity !== undefined && typeof data.liquidDensity === "number") {
1939
+ this.liquidDensity = data.liquidDensity as number;
1940
+ }
1941
+ if (data.vapourDensity !== undefined && typeof data.vapourDensity === "number") {
1942
+ this.vapourDensity = data.vapourDensity as number;
1943
+ }
1944
+ if (data.liquidEntropy !== undefined && typeof data.liquidEntropy === "number") {
1945
+ this.liquidEntropy = data.liquidEntropy as number;
1946
+ }
1947
+ if (data.vapourEntropy !== undefined && typeof data.vapourEntropy === "number") {
1948
+ this.vapourEntropy = data.vapourEntropy as number;
1949
+ }
1950
+ if (data.liquidEnthalpy !== undefined && typeof data.liquidEnthalpy === "number") {
1951
+ this.liquidEnthalpy = data.liquidEnthalpy as number;
1952
+ }
1953
+ if (data.vapourEnthalpy !== undefined && typeof data.vapourEnthalpy === "number") {
1954
+ this.vapourEnthalpy = data.vapourEnthalpy as number;
1955
+ }
1956
+ if (data.bubblePointPressure !== undefined && typeof data.bubblePointPressure === "number") {
1957
+ this.bubblePointPressure = data.bubblePointPressure as number;
1958
+ }
1959
+ if (data.bubblePointTemperature !== undefined && typeof data.bubblePointTemperature === "number") {
1960
+ this.bubblePointTemperature = data.bubblePointTemperature as number;
1961
+ }
1962
+ if (data.dewPointPressure !== undefined && typeof data.dewPointPressure === "number") {
1963
+ this.dewPointPressure = data.dewPointPressure as number;
1964
+ }
1965
+ if (data.dewPointTemperature !== undefined && typeof data.dewPointTemperature === "number") {
1966
+ this.dewPointTemperature = data.dewPointTemperature as number;
1967
+ }
1968
+ if (data.totalFluidDensity !== undefined && typeof data.totalFluidDensity === "number") {
1969
+ this.totalFluidDensity = data.totalFluidDensity as number;
1970
+ }
1971
+ if (data.liquidMassFraction !== undefined && typeof data.liquidMassFraction === "number") {
1972
+ this.liquidMassFraction = data.liquidMassFraction as number;
1973
+ }
1974
+ if (data.fluidPhase !== undefined && (typeof data.fluidPhase === "string" || typeof data.fluidPhase === "number")) {
1975
+ this.fluidPhase = this.parseEnumValue(data.fluidPhase, Enums.Phase);
1976
+ }
1977
+ }
1978
+
1979
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1783
1980
  if (typeof value === "string" && value in enumType) {
1784
1981
  return enumType[value as keyof T];
1785
- } else if (
1786
- typeof value === "number" &&
1787
- Object.values(enumType).includes(value)
1788
- ) {
1982
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1789
1983
  return value as T[keyof T];
1790
1984
  }
1791
1985
  return undefined; // Return undefined if the value does not match the enum
@@ -1827,8 +2021,7 @@ export class ReleaseOverTime extends Scenario {
1827
2021
  */
1828
2022
  constructor(
1829
2023
  releaseAngle: number = 0.0,
1830
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
1831
- .INITIAL_RATE
2024
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE
1832
2025
  ) {
1833
2026
  super();
1834
2027
  this.releaseAngle = releaseAngle;
@@ -1836,25 +2029,20 @@ export class ReleaseOverTime extends Scenario {
1836
2029
  }
1837
2030
 
1838
2031
  /** Initialise the entity with data from a dictionary. */
1839
- initialiseFromDictionary(data: { [key: string]: any }) {
2032
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1840
2033
  super.initialiseFromDictionary(data);
1841
- this.releaseAngle = parseFloat(data.releaseAngle);
1842
- this.timeVaryingOption = this.parseEnumValue(
1843
- data.timeVaryingOption,
1844
- Enums.TimeVaryingOption
1845
- );
2034
+ if (data.releaseAngle !== undefined && typeof data.releaseAngle === "number") {
2035
+ this.releaseAngle = data.releaseAngle as number;
2036
+ }
2037
+ if (data.timeVaryingOption !== undefined && (typeof data.timeVaryingOption === "string" || typeof data.timeVaryingOption === "number")) {
2038
+ this.timeVaryingOption = this.parseEnumValue(data.timeVaryingOption, Enums.TimeVaryingOption);
2039
+ }
1846
2040
  }
1847
2041
 
1848
- private parseEnumValue<T extends object>(
1849
- value: any,
1850
- enumType: T
1851
- ): T[keyof T] | undefined {
2042
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
1852
2043
  if (typeof value === "string" && value in enumType) {
1853
2044
  return enumType[value as keyof T];
1854
- } else if (
1855
- typeof value === "number" &&
1856
- Object.values(enumType).includes(value)
1857
- ) {
2045
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
1858
2046
  return value as T[keyof T];
1859
2047
  }
1860
2048
  return undefined; // Return undefined if the value does not match the enum
@@ -1887,8 +2075,7 @@ export class Leak extends ReleaseOverTime {
1887
2075
  constructor(
1888
2076
  holeDiameter?: number,
1889
2077
  releaseAngle: number = 0.0,
1890
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
1891
- .INITIAL_RATE,
2078
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
1892
2079
  holeHeightFraction: number = 0.5,
1893
2080
  releaseElevation: number = 1
1894
2081
  ) {
@@ -1899,11 +2086,17 @@ export class Leak extends ReleaseOverTime {
1899
2086
  }
1900
2087
 
1901
2088
  /** Initialise the entity with data from a dictionary. */
1902
- initialiseFromDictionary(data: { [key: string]: any }) {
2089
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1903
2090
  super.initialiseFromDictionary(data);
1904
- this.holeDiameter = parseFloat(data.holeDiameter);
1905
- this.holeHeightFraction = parseFloat(data.holeHeightFraction);
1906
- this.releaseElevation = parseFloat(data.releaseElevation);
2091
+ if (data.holeDiameter !== undefined && typeof data.holeDiameter === "number") {
2092
+ this.holeDiameter = data.holeDiameter as number;
2093
+ }
2094
+ if (data.holeHeightFraction !== undefined && typeof data.holeHeightFraction === "number") {
2095
+ this.holeHeightFraction = data.holeHeightFraction as number;
2096
+ }
2097
+ if (data.releaseElevation !== undefined && typeof data.releaseElevation === "number") {
2098
+ this.releaseElevation = data.releaseElevation as number;
2099
+ }
1907
2100
  }
1908
2101
 
1909
2102
  toString() {
@@ -1939,8 +2132,7 @@ export class LineRupture extends ReleaseOverTime {
1939
2132
  pipeDiameter?: number,
1940
2133
  pipeLength?: number,
1941
2134
  releaseAngle: number = 0.0,
1942
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
1943
- .INITIAL_RATE,
2135
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
1944
2136
  pipeRoughness: number = 0.000045,
1945
2137
  pipeHeightFraction: number = 0.5
1946
2138
  ) {
@@ -1952,12 +2144,20 @@ export class LineRupture extends ReleaseOverTime {
1952
2144
  }
1953
2145
 
1954
2146
  /** Initialise the entity with data from a dictionary. */
1955
- initialiseFromDictionary(data: { [key: string]: any }) {
2147
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
1956
2148
  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);
2149
+ if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === "number") {
2150
+ this.pipeDiameter = data.pipeDiameter as number;
2151
+ }
2152
+ if (data.pipeLength !== undefined && typeof data.pipeLength === "number") {
2153
+ this.pipeLength = data.pipeLength as number;
2154
+ }
2155
+ if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === "number") {
2156
+ this.pipeRoughness = data.pipeRoughness as number;
2157
+ }
2158
+ if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === "number") {
2159
+ this.pipeHeightFraction = data.pipeHeightFraction as number;
2160
+ }
1961
2161
  }
1962
2162
 
1963
2163
  toString() {
@@ -1975,9 +2175,9 @@ export class LineRupture extends ReleaseOverTime {
1975
2175
  }
1976
2176
 
1977
2177
  export class MaterialComponentDataItem extends EntityBase {
1978
- description?: string;
2178
+ description: string;
1979
2179
  equationNumber?: number;
1980
- equationString?: string;
2180
+ equationString: string;
1981
2181
  equationCoefficients?: number[];
1982
2182
  calculationLimits?: number[];
1983
2183
  supercriticalExtrapolation: number;
@@ -1995,9 +2195,9 @@ export class MaterialComponentDataItem extends EntityBase {
1995
2195
  * @param {number} fractionTc - Fraction of critical temperature. (default value is 1)
1996
2196
  */
1997
2197
  constructor(
1998
- description?: string,
2198
+ description: string = "",
1999
2199
  equationNumber?: number,
2000
- equationString?: string,
2200
+ equationString: string = "",
2001
2201
  equationCoefficients?: number[],
2002
2202
  calculationLimits?: number[],
2003
2203
  supercriticalExtrapolation: number = 0,
@@ -2014,21 +2214,29 @@ export class MaterialComponentDataItem extends EntityBase {
2014
2214
  }
2015
2215
 
2016
2216
  /** Initialise the entity with data from a dictionary. */
2017
- initialiseFromDictionary(data: { [key: string]: any }) {
2217
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2018
2218
  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);
2219
+ if (data.description !== undefined && typeof data.description === "string") {
2220
+ this.description = data.description as string;
2221
+ }
2222
+ if (data.equationNumber !== undefined && typeof data.equationNumber === "number") {
2223
+ this.equationNumber = data.equationNumber as number;
2224
+ }
2225
+ if (data.equationString !== undefined && typeof data.equationString === "string") {
2226
+ this.equationString = data.equationString as string;
2227
+ }
2228
+ if (data.equationCoefficients && Array.isArray(data.equationCoefficients)) {
2229
+ this.equationCoefficients = (data.equationCoefficients ?? []).map((item) => parseFloat(item));
2230
+ }
2231
+ if (data.calculationLimits && Array.isArray(data.calculationLimits)) {
2232
+ this.calculationLimits = (data.calculationLimits ?? []).map((item) => parseFloat(item));
2233
+ }
2234
+ if (data.supercriticalExtrapolation !== undefined && typeof data.supercriticalExtrapolation === "number") {
2235
+ this.supercriticalExtrapolation = data.supercriticalExtrapolation as number;
2236
+ }
2237
+ if (data.fractionTc !== undefined && typeof data.fractionTc === "number") {
2238
+ this.fractionTc = data.fractionTc as number;
2239
+ }
2032
2240
  }
2033
2241
 
2034
2242
  toString() {
@@ -2037,10 +2245,8 @@ export class MaterialComponentDataItem extends EntityBase {
2037
2245
  `description: ${this.description}`,
2038
2246
  `equationNumber: ${this.equationNumber}`,
2039
2247
  `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"),
2248
+ this.equationCoefficients?.map((item) => item?.toString()).join("\n"),
2249
+ this.calculationLimits?.map((item) => item?.toString()).join("\n"),
2044
2250
  `supercriticalExtrapolation: ${this.supercriticalExtrapolation}`,
2045
2251
  `fractionTc: ${this.fractionTc}`,
2046
2252
  ];
@@ -2049,7 +2255,7 @@ export class MaterialComponentDataItem extends EntityBase {
2049
2255
  }
2050
2256
 
2051
2257
  export class MaterialComponentData extends EntityBase {
2052
- name?: string;
2258
+ name: string;
2053
2259
  dipprVersion?: number;
2054
2260
  casId?: number;
2055
2261
  dataItem: MaterialComponentDataItem[];
@@ -2065,7 +2271,7 @@ export class MaterialComponentData extends EntityBase {
2065
2271
  * @param {boolean} nonStandard - Description of new property.
2066
2272
  */
2067
2273
  constructor(
2068
- name?: string,
2274
+ name: string = "",
2069
2275
  dipprVersion?: number,
2070
2276
  casId?: number,
2071
2277
  dataItem: MaterialComponentDataItem[] = [new MaterialComponentDataItem()],
@@ -2080,17 +2286,29 @@ export class MaterialComponentData extends EntityBase {
2080
2286
  }
2081
2287
 
2082
2288
  /** Initialise the entity with data from a dictionary. */
2083
- initialiseFromDictionary(data: { [key: string]: any }) {
2289
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2084
2290
  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)
2291
+ if (data.name !== undefined && typeof data.name === "string") {
2292
+ this.name = data.name as string;
2293
+ }
2294
+ if (data.dipprVersion !== undefined && typeof data.dipprVersion === "number") {
2295
+ this.dipprVersion = data.dipprVersion as number;
2296
+ }
2297
+ if (data.casId !== undefined && typeof data.casId === "number") {
2298
+ this.casId = data.casId as number;
2299
+ }
2300
+ if (data.dataItem && Array.isArray(data.dataItem)) {
2301
+ this.dataItem = data.dataItem.map(
2302
+ (item) => {
2303
+ const record = new MaterialComponentDataItem();
2304
+ record.initialiseFromDictionary(item);
2305
+ return record;
2306
+ }
2091
2307
  );
2092
2308
  }
2093
- this.nonStandard = data.nonStandard;
2309
+ if (data.nonStandard !== undefined && typeof data.nonStandard === "boolean") {
2310
+ this.nonStandard = data.nonStandard as boolean;
2311
+ }
2094
2312
  }
2095
2313
 
2096
2314
  toString() {
@@ -2099,7 +2317,7 @@ export class MaterialComponentData extends EntityBase {
2099
2317
  `name: ${this.name}`,
2100
2318
  `dipprVersion: ${this.dipprVersion}`,
2101
2319
  `casId: ${this.casId}`,
2102
- this.dataItem?.map((item: any) => item?.toString()).join("\n"),
2320
+ this.dataItem?.map((item) => item?.toString()).join("\n"),
2103
2321
  `nonStandard: ${this.nonStandard}`,
2104
2322
  ];
2105
2323
  return parts.join("\n");
@@ -2160,8 +2378,7 @@ export class MixtureConstantPropertiesResult extends EntityBase {
2160
2378
  emissivePowerLengthScale?: number,
2161
2379
  laminarBurningVelocity?: number,
2162
2380
  flammableToxicFlag: Enums.FlammableToxic = Enums.FlammableToxic.INERT,
2163
- luminousSmokyFlame: Enums.LuminousSmokyFlame = Enums.LuminousSmokyFlame
2164
- .GENERAL
2381
+ luminousSmokyFlame: Enums.LuminousSmokyFlame = Enums.LuminousSmokyFlame.GENERAL
2165
2382
  ) {
2166
2383
  super();
2167
2384
  this.lowerFlammabilityLimit = lowerFlammabilityLimit;
@@ -2183,42 +2400,62 @@ export class MixtureConstantPropertiesResult extends EntityBase {
2183
2400
  }
2184
2401
 
2185
2402
  /** Initialise the entity with data from a dictionary. */
2186
- initialiseFromDictionary(data: { [key: string]: any }) {
2403
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2187
2404
  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 {
2405
+ if (data.lowerFlammabilityLimit !== undefined && typeof data.lowerFlammabilityLimit === "number") {
2406
+ this.lowerFlammabilityLimit = data.lowerFlammabilityLimit as number;
2407
+ }
2408
+ if (data.upperFlammabilityLimit !== undefined && typeof data.upperFlammabilityLimit === "number") {
2409
+ this.upperFlammabilityLimit = data.upperFlammabilityLimit as number;
2410
+ }
2411
+ if (data.criticalPressure !== undefined && typeof data.criticalPressure === "number") {
2412
+ this.criticalPressure = data.criticalPressure as number;
2413
+ }
2414
+ if (data.criticalTemperature !== undefined && typeof data.criticalTemperature === "number") {
2415
+ this.criticalTemperature = data.criticalTemperature as number;
2416
+ }
2417
+ if (data.flashPoint !== undefined && typeof data.flashPoint === "number") {
2418
+ this.flashPoint = data.flashPoint as number;
2419
+ }
2420
+ if (data.heatCombustion !== undefined && typeof data.heatCombustion === "number") {
2421
+ this.heatCombustion = data.heatCombustion as number;
2422
+ }
2423
+ if (data.maximumBurnRate !== undefined && typeof data.maximumBurnRate === "number") {
2424
+ this.maximumBurnRate = data.maximumBurnRate as number;
2425
+ }
2426
+ if (data.maximumSEP !== undefined && typeof data.maximumSEP === "number") {
2427
+ this.maximumSEP = data.maximumSEP as number;
2428
+ }
2429
+ if (data.molecularWeight !== undefined && typeof data.molecularWeight === "number") {
2430
+ this.molecularWeight = data.molecularWeight as number;
2431
+ }
2432
+ if (data.bubblePoint !== undefined && typeof data.bubblePoint === "number") {
2433
+ this.bubblePoint = data.bubblePoint as number;
2434
+ }
2435
+ if (data.poolFireBurnRateLength !== undefined && typeof data.poolFireBurnRateLength === "number") {
2436
+ this.poolFireBurnRateLength = data.poolFireBurnRateLength as number;
2437
+ }
2438
+ if (data.dewPoint !== undefined && typeof data.dewPoint === "number") {
2439
+ this.dewPoint = data.dewPoint as number;
2440
+ }
2441
+ if (data.emissivePowerLengthScale !== undefined && typeof data.emissivePowerLengthScale === "number") {
2442
+ this.emissivePowerLengthScale = data.emissivePowerLengthScale as number;
2443
+ }
2444
+ if (data.laminarBurningVelocity !== undefined && typeof data.laminarBurningVelocity === "number") {
2445
+ this.laminarBurningVelocity = data.laminarBurningVelocity as number;
2446
+ }
2447
+ if (data.flammableToxicFlag !== undefined && (typeof data.flammableToxicFlag === "string" || typeof data.flammableToxicFlag === "number")) {
2448
+ this.flammableToxicFlag = this.parseEnumValue(data.flammableToxicFlag, Enums.FlammableToxic);
2449
+ }
2450
+ if (data.luminousSmokyFlame !== undefined && (typeof data.luminousSmokyFlame === "string" || typeof data.luminousSmokyFlame === "number")) {
2451
+ this.luminousSmokyFlame = this.parseEnumValue(data.luminousSmokyFlame, Enums.LuminousSmokyFlame);
2452
+ }
2453
+ }
2454
+
2455
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2216
2456
  if (typeof value === "string" && value in enumType) {
2217
2457
  return enumType[value as keyof T];
2218
- } else if (
2219
- typeof value === "number" &&
2220
- Object.values(enumType).includes(value)
2221
- ) {
2458
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2222
2459
  return value as T[keyof T];
2223
2460
  }
2224
2461
  return undefined; // Return undefined if the value does not match the enum
@@ -2290,32 +2527,44 @@ export class Pipe extends Asset {
2290
2527
  }
2291
2528
 
2292
2529
  /** Initialise the entity with data from a dictionary. */
2293
- initialiseFromDictionary(data: { [key: string]: any }) {
2530
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2294
2531
  super.initialiseFromDictionary(data);
2295
- if (data.nodes) {
2296
- this.nodes = data.nodes.map((item: any) =>
2297
- new LocalPosition().initialiseFromDictionary(item)
2532
+ if (data.nodes && Array.isArray(data.nodes)) {
2533
+ this.nodes = data.nodes.map(
2534
+ (item) => {
2535
+ const record = new LocalPosition();
2536
+ record.initialiseFromDictionary(item);
2537
+ return record;
2538
+ }
2298
2539
  );
2299
2540
  }
2300
- this.nodeCount = parseInt(data.nodeCount);
2301
- this.diameter = parseFloat(data.diameter);
2541
+ if (data.nodeCount !== undefined && typeof data.nodeCount === "number") {
2542
+ this.nodeCount = data.nodeCount as number;
2543
+ }
2544
+ if (data.diameter !== undefined && typeof data.diameter === "number") {
2545
+ this.diameter = data.diameter as number;
2546
+ }
2302
2547
  if (data.material) {
2303
2548
  this.material = new Material();
2304
- this.material.initialiseFromDictionary(data.material);
2549
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
2305
2550
  }
2306
2551
  if (data.state) {
2307
2552
  this.state = new State();
2308
- this.state.initialiseFromDictionary(data.state);
2553
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
2554
+ }
2555
+ if (data.roughness !== undefined && typeof data.roughness === "number") {
2556
+ this.roughness = data.roughness as number;
2557
+ }
2558
+ if (data.pumpedInflow !== undefined && typeof data.pumpedInflow === "number") {
2559
+ this.pumpedInflow = data.pumpedInflow as number;
2309
2560
  }
2310
- this.roughness = parseFloat(data.roughness);
2311
- this.pumpedInflow = parseFloat(data.pumpedInflow);
2312
2561
  }
2313
2562
 
2314
2563
  toString() {
2315
2564
  const parts = [
2316
2565
  "* Pipe",
2317
2566
  `location: ${this.location?.toString()}`,
2318
- this.nodes?.map((item: any) => item?.toString()).join("\n"),
2567
+ this.nodes?.map((item) => item?.toString()).join("\n"),
2319
2568
  `nodeCount: ${this.nodeCount}`,
2320
2569
  `diameter: ${this.diameter}`,
2321
2570
  `material: ${this.material?.toString()}`,
@@ -2342,8 +2591,7 @@ export class PipeBreach extends ReleaseOverTime {
2342
2591
  constructor(
2343
2592
  distanceDownstream?: number,
2344
2593
  releaseAngle: number = 0.0,
2345
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
2346
- .INITIAL_RATE,
2594
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
2347
2595
  relativeAperture: number = 1
2348
2596
  ) {
2349
2597
  super(releaseAngle, timeVaryingOption);
@@ -2352,10 +2600,14 @@ export class PipeBreach extends ReleaseOverTime {
2352
2600
  }
2353
2601
 
2354
2602
  /** Initialise the entity with data from a dictionary. */
2355
- initialiseFromDictionary(data: { [key: string]: any }) {
2603
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2356
2604
  super.initialiseFromDictionary(data);
2357
- this.distanceDownstream = parseFloat(data.distanceDownstream);
2358
- this.relativeAperture = parseFloat(data.relativeAperture);
2605
+ if (data.distanceDownstream !== undefined && typeof data.distanceDownstream === "number") {
2606
+ this.distanceDownstream = data.distanceDownstream as number;
2607
+ }
2608
+ if (data.relativeAperture !== undefined && typeof data.relativeAperture === "number") {
2609
+ this.relativeAperture = data.relativeAperture as number;
2610
+ }
2359
2611
  }
2360
2612
 
2361
2613
  toString() {
@@ -2396,11 +2648,11 @@ export class PoolFireFlameResult extends FlameResult {
2396
2648
  }
2397
2649
 
2398
2650
  /** Initialise the entity with data from a dictionary. */
2399
- initialiseFromDictionary(data: { [key: string]: any }) {
2651
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2400
2652
  super.initialiseFromDictionary(data);
2401
- this.poolZoneSEP = (data.poolZoneSEP ?? []).map((item: any) =>
2402
- parseFloat(item)
2403
- );
2653
+ if (data.poolZoneSEP && Array.isArray(data.poolZoneSEP)) {
2654
+ this.poolZoneSEP = (data.poolZoneSEP ?? []).map((item) => parseFloat(item));
2655
+ }
2404
2656
  }
2405
2657
 
2406
2658
  toString() {
@@ -2410,7 +2662,7 @@ export class PoolFireFlameResult extends FlameResult {
2410
2662
  `surfaceEmissivePower: ${this.surfaceEmissivePower}`,
2411
2663
  `flameLength: ${this.flameLength}`,
2412
2664
  `flameDiameter: ${this.flameDiameter}`,
2413
- this.poolZoneSEP?.map((item: any) => item?.toString()).join("\n"),
2665
+ this.poolZoneSEP?.map((item) => item?.toString()).join("\n"),
2414
2666
  `fireType: ${this.fireType}`,
2415
2667
  ];
2416
2668
  return parts.join("\n");
@@ -2481,21 +2733,47 @@ export class PoolRecord extends EntityBase {
2481
2733
  }
2482
2734
 
2483
2735
  /** Initialise the entity with data from a dictionary. */
2484
- initialiseFromDictionary(data: { [key: string]: any }) {
2736
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2485
2737
  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);
2738
+ if (data.time !== undefined && typeof data.time === "number") {
2739
+ this.time = data.time as number;
2740
+ }
2741
+ if (data.massSpilt !== undefined && typeof data.massSpilt === "number") {
2742
+ this.massSpilt = data.massSpilt as number;
2743
+ }
2744
+ if (data.massVaporised !== undefined && typeof data.massVaporised === "number") {
2745
+ this.massVaporised = data.massVaporised as number;
2746
+ }
2747
+ if (data.massDissolved !== undefined && typeof data.massDissolved === "number") {
2748
+ this.massDissolved = data.massDissolved as number;
2749
+ }
2750
+ if (data.massRemaining !== undefined && typeof data.massRemaining === "number") {
2751
+ this.massRemaining = data.massRemaining as number;
2752
+ }
2753
+ if (data.vapourisationRate !== undefined && typeof data.vapourisationRate === "number") {
2754
+ this.vapourisationRate = data.vapourisationRate as number;
2755
+ }
2756
+ if (data.solutionRate !== undefined && typeof data.solutionRate === "number") {
2757
+ this.solutionRate = data.solutionRate as number;
2758
+ }
2759
+ if (data.effectiveRadius !== undefined && typeof data.effectiveRadius === "number") {
2760
+ this.effectiveRadius = data.effectiveRadius as number;
2761
+ }
2762
+ if (data.depth !== undefined && typeof data.depth === "number") {
2763
+ this.depth = data.depth as number;
2764
+ }
2765
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
2766
+ this.temperature = data.temperature as number;
2767
+ }
2768
+ if (data.spillRate !== undefined && typeof data.spillRate === "number") {
2769
+ this.spillRate = data.spillRate as number;
2770
+ }
2771
+ if (data.actualRadius !== undefined && typeof data.actualRadius === "number") {
2772
+ this.actualRadius = data.actualRadius as number;
2773
+ }
2774
+ if (data.poolCentre !== undefined && typeof data.poolCentre === "number") {
2775
+ this.poolCentre = data.poolCentre as number;
2776
+ }
2499
2777
  }
2500
2778
 
2501
2779
  toString() {
@@ -2543,11 +2821,17 @@ export class PoolVapourisationParameters extends EntityBase {
2543
2821
  }
2544
2822
 
2545
2823
  /** Initialise the entity with data from a dictionary. */
2546
- initialiseFromDictionary(data: { [key: string]: any }) {
2824
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2547
2825
  super.initialiseFromDictionary(data);
2548
- this.toxicsCutoffRate = parseFloat(data.toxicsCutoffRate);
2549
- this.flammableCutoffRate = parseFloat(data.flammableCutoffRate);
2550
- this.relativeTolerance = parseFloat(data.relativeTolerance);
2826
+ if (data.toxicsCutoffRate !== undefined && typeof data.toxicsCutoffRate === "number") {
2827
+ this.toxicsCutoffRate = data.toxicsCutoffRate as number;
2828
+ }
2829
+ if (data.flammableCutoffRate !== undefined && typeof data.flammableCutoffRate === "number") {
2830
+ this.flammableCutoffRate = data.flammableCutoffRate as number;
2831
+ }
2832
+ if (data.relativeTolerance !== undefined && typeof data.relativeTolerance === "number") {
2833
+ this.relativeTolerance = data.relativeTolerance as number;
2834
+ }
2551
2835
  }
2552
2836
 
2553
2837
  toString() {
@@ -2585,29 +2869,24 @@ export class RadiationRecord extends EntityBase {
2585
2869
  }
2586
2870
 
2587
2871
  /** Initialise the entity with data from a dictionary. */
2588
- initialiseFromDictionary(data: { [key: string]: any }) {
2872
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2589
2873
  super.initialiseFromDictionary(data);
2590
2874
  if (data.position) {
2591
2875
  this.position = new LocalPosition();
2592
- this.position.initialiseFromDictionary(data.position);
2876
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
2877
+ }
2878
+ if (data.radiationResult !== undefined && typeof data.radiationResult === "number") {
2879
+ this.radiationResult = data.radiationResult as number;
2880
+ }
2881
+ if (data.radiationType !== undefined && (typeof data.radiationType === "string" || typeof data.radiationType === "number")) {
2882
+ this.radiationType = this.parseEnumValue(data.radiationType, Enums.RadiationType);
2593
2883
  }
2594
- this.radiationResult = parseFloat(data.radiationResult);
2595
- this.radiationType = this.parseEnumValue(
2596
- data.radiationType,
2597
- Enums.RadiationType
2598
- );
2599
2884
  }
2600
2885
 
2601
- private parseEnumValue<T extends object>(
2602
- value: any,
2603
- enumType: T
2604
- ): T[keyof T] | undefined {
2886
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2605
2887
  if (typeof value === "string" && value in enumType) {
2606
2888
  return enumType[value as keyof T];
2607
- } else if (
2608
- typeof value === "number" &&
2609
- Object.values(enumType).includes(value)
2610
- ) {
2889
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2611
2890
  return value as T[keyof T];
2612
2891
  }
2613
2892
  return undefined; // Return undefined if the value does not match the enum
@@ -2647,8 +2926,7 @@ export class ReliefValve extends ReleaseOverTime {
2647
2926
  pipeDiameter?: number,
2648
2927
  pipeLength?: number,
2649
2928
  releaseAngle: number = 0.0,
2650
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
2651
- .INITIAL_RATE,
2929
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
2652
2930
  pipeRoughness: number = 0.000045,
2653
2931
  pipeHeightFraction: number = 0.5
2654
2932
  ) {
@@ -2661,15 +2939,23 @@ export class ReliefValve extends ReleaseOverTime {
2661
2939
  }
2662
2940
 
2663
2941
  /** Initialise the entity with data from a dictionary. */
2664
- initialiseFromDictionary(data: { [key: string]: any }) {
2942
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2665
2943
  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);
2944
+ if (data.reliefValveConstrictionDiameter !== undefined && typeof data.reliefValveConstrictionDiameter === "number") {
2945
+ this.reliefValveConstrictionDiameter = data.reliefValveConstrictionDiameter as number;
2946
+ }
2947
+ if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === "number") {
2948
+ this.pipeDiameter = data.pipeDiameter as number;
2949
+ }
2950
+ if (data.pipeLength !== undefined && typeof data.pipeLength === "number") {
2951
+ this.pipeLength = data.pipeLength as number;
2952
+ }
2953
+ if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === "number") {
2954
+ this.pipeRoughness = data.pipeRoughness as number;
2955
+ }
2956
+ if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === "number") {
2957
+ this.pipeHeightFraction = data.pipeHeightFraction as number;
2958
+ }
2673
2959
  }
2674
2960
 
2675
2961
  toString() {
@@ -2727,27 +3013,35 @@ export class ScalarUdmOutputs extends EntityBase {
2727
3013
  }
2728
3014
 
2729
3015
  /** Initialise the entity with data from a dictionary. */
2730
- initialiseFromDictionary(data: { [key: string]: any }) {
3016
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2731
3017
  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 {
3018
+ if (data.observerCount !== undefined && typeof data.observerCount === "number") {
3019
+ this.observerCount = data.observerCount as number;
3020
+ }
3021
+ if (data.recordCount !== undefined && typeof data.recordCount === "number") {
3022
+ this.recordCount = data.recordCount as number;
3023
+ }
3024
+ if (data.minimumConcentration !== undefined && typeof data.minimumConcentration === "number") {
3025
+ this.minimumConcentration = data.minimumConcentration as number;
3026
+ }
3027
+ if (data.windPower !== undefined && typeof data.windPower === "number") {
3028
+ this.windPower = data.windPower as number;
3029
+ }
3030
+ if (data.frictionVelocity !== undefined && typeof data.frictionVelocity === "number") {
3031
+ this.frictionVelocity = data.frictionVelocity as number;
3032
+ }
3033
+ if (data.dispersionReleaseDuration !== undefined && typeof data.dispersionReleaseDuration === "number") {
3034
+ this.dispersionReleaseDuration = data.dispersionReleaseDuration as number;
3035
+ }
3036
+ if (data.cloudType !== undefined && (typeof data.cloudType === "string" || typeof data.cloudType === "number")) {
3037
+ this.cloudType = this.parseEnumValue(data.cloudType, Enums.DynamicType);
3038
+ }
3039
+ }
3040
+
3041
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2745
3042
  if (typeof value === "string" && value in enumType) {
2746
3043
  return enumType[value as keyof T];
2747
- } else if (
2748
- typeof value === "number" &&
2749
- Object.values(enumType).includes(value)
2750
- ) {
3044
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2751
3045
  return value as T[keyof T];
2752
3046
  }
2753
3047
  return undefined; // Return undefined if the value does not match the enum
@@ -2788,8 +3082,7 @@ export class ShortPipeRupture extends ReleaseOverTime {
2788
3082
  pipeLength?: number,
2789
3083
  pipeDiameter?: number,
2790
3084
  releaseAngle: number = 0.0,
2791
- timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption
2792
- .INITIAL_RATE,
3085
+ timeVaryingOption: Enums.TimeVaryingOption = Enums.TimeVaryingOption.INITIAL_RATE,
2793
3086
  pipeRoughness: number = 0.000045,
2794
3087
  pipeHeightFraction: number = 0.5
2795
3088
  ) {
@@ -2801,12 +3094,20 @@ export class ShortPipeRupture extends ReleaseOverTime {
2801
3094
  }
2802
3095
 
2803
3096
  /** Initialise the entity with data from a dictionary. */
2804
- initialiseFromDictionary(data: { [key: string]: any }) {
3097
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2805
3098
  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);
3099
+ if (data.pipeLength !== undefined && typeof data.pipeLength === "number") {
3100
+ this.pipeLength = data.pipeLength as number;
3101
+ }
3102
+ if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === "number") {
3103
+ this.pipeDiameter = data.pipeDiameter as number;
3104
+ }
3105
+ if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === "number") {
3106
+ this.pipeRoughness = data.pipeRoughness as number;
3107
+ }
3108
+ if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === "number") {
3109
+ this.pipeHeightFraction = data.pipeHeightFraction as number;
3110
+ }
2810
3111
  }
2811
3112
 
2812
3113
  toString() {
@@ -2843,17 +3144,15 @@ export class Structure extends EntityBase {
2843
3144
  }
2844
3145
 
2845
3146
  /** Initialise the entity with data from a dictionary. */
2846
- initialiseFromDictionary(data: { [key: string]: any }) {
3147
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2847
3148
  super.initialiseFromDictionary(data);
2848
3149
  if (data.explosionConfinedVolume) {
2849
3150
  this.explosionConfinedVolume = new ExplosionConfinedVolume();
2850
- this.explosionConfinedVolume.initialiseFromDictionary(
2851
- data.explosionConfinedVolume
2852
- );
3151
+ this.explosionConfinedVolume.initialiseFromDictionary(data.explosionConfinedVolume as { [key: string]: unknown });
2853
3152
  }
2854
3153
  if (data.location) {
2855
3154
  this.location = new LocalPosition();
2856
- this.location.initialiseFromDictionary(data.location);
3155
+ this.location.initialiseFromDictionary(data.location as { [key: string]: unknown });
2857
3156
  }
2858
3157
  }
2859
3158
 
@@ -2895,30 +3194,27 @@ export class Substrate extends EntityBase {
2895
3194
  }
2896
3195
 
2897
3196
  /** Initialise the entity with data from a dictionary. */
2898
- initialiseFromDictionary(data: { [key: string]: any }) {
3197
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2899
3198
  super.initialiseFromDictionary(data);
2900
3199
  if (data.bund) {
2901
3200
  this.bund = new Bund();
2902
- this.bund.initialiseFromDictionary(data.bund);
3201
+ this.bund.initialiseFromDictionary(data.bund as { [key: string]: unknown });
3202
+ }
3203
+ if (data.surfaceRoughness !== undefined && typeof data.surfaceRoughness === "number") {
3204
+ this.surfaceRoughness = data.surfaceRoughness as number;
3205
+ }
3206
+ if (data.surfaceType !== undefined && (typeof data.surfaceType === "string" || typeof data.surfaceType === "number")) {
3207
+ this.surfaceType = this.parseEnumValue(data.surfaceType, Enums.SurfaceType);
3208
+ }
3209
+ if (data.poolSurfaceType !== undefined && (typeof data.poolSurfaceType === "string" || typeof data.poolSurfaceType === "number")) {
3210
+ this.poolSurfaceType = this.parseEnumValue(data.poolSurfaceType, Enums.PoolSurfaceType);
2903
3211
  }
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
3212
  }
2911
3213
 
2912
- private parseEnumValue<T extends object>(
2913
- value: any,
2914
- enumType: T
2915
- ): T[keyof T] | undefined {
3214
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2916
3215
  if (typeof value === "string" && value in enumType) {
2917
3216
  return enumType[value as keyof T];
2918
- } else if (
2919
- typeof value === "number" &&
2920
- Object.values(enumType).includes(value)
2921
- ) {
3217
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2922
3218
  return value as T[keyof T];
2923
3219
  }
2924
3220
  return undefined; // Return undefined if the value does not match the enum
@@ -2960,29 +3256,24 @@ export class ToxicRecord extends EntityBase {
2960
3256
  }
2961
3257
 
2962
3258
  /** Initialise the entity with data from a dictionary. */
2963
- initialiseFromDictionary(data: { [key: string]: any }) {
3259
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
2964
3260
  super.initialiseFromDictionary(data);
2965
3261
  if (data.position) {
2966
3262
  this.position = new LocalPosition();
2967
- this.position.initialiseFromDictionary(data.position);
3263
+ this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
3264
+ }
3265
+ if (data.toxicResult !== undefined && typeof data.toxicResult === "number") {
3266
+ this.toxicResult = data.toxicResult as number;
3267
+ }
3268
+ if (data.toxicResultType !== undefined && (typeof data.toxicResultType === "string" || typeof data.toxicResultType === "number")) {
3269
+ this.toxicResultType = this.parseEnumValue(data.toxicResultType, Enums.ToxicResultType);
2968
3270
  }
2969
- this.toxicResult = parseFloat(data.toxicResult);
2970
- this.toxicResultType = this.parseEnumValue(
2971
- data.toxicResultType,
2972
- Enums.ToxicResultType
2973
- );
2974
3271
  }
2975
3272
 
2976
- private parseEnumValue<T extends object>(
2977
- value: any,
2978
- enumType: T
2979
- ): T[keyof T] | undefined {
3273
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
2980
3274
  if (typeof value === "string" && value in enumType) {
2981
3275
  return enumType[value as keyof T];
2982
- } else if (
2983
- typeof value === "number" &&
2984
- Object.values(enumType).includes(value)
2985
- ) {
3276
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
2986
3277
  return value as T[keyof T];
2987
3278
  }
2988
3279
  return undefined; // Return undefined if the value does not match the enum
@@ -3049,40 +3340,43 @@ export class Vessel extends Asset {
3049
3340
  }
3050
3341
 
3051
3342
  /** Initialise the entity with data from a dictionary. */
3052
- initialiseFromDictionary(data: { [key: string]: any }) {
3343
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3053
3344
  super.initialiseFromDictionary(data);
3054
3345
  if (data.state) {
3055
3346
  this.state = new State();
3056
- this.state.initialiseFromDictionary(data.state);
3347
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
3057
3348
  }
3058
3349
  if (data.material) {
3059
3350
  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 {
3351
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
3352
+ }
3353
+ if (data.diameter !== undefined && typeof data.diameter === "number") {
3354
+ this.diameter = data.diameter as number;
3355
+ }
3356
+ if (data.height !== undefined && typeof data.height === "number") {
3357
+ this.height = data.height as number;
3358
+ }
3359
+ if (data.length !== undefined && typeof data.length === "number") {
3360
+ this.length = data.length as number;
3361
+ }
3362
+ if (data.width !== undefined && typeof data.width === "number") {
3363
+ this.width = data.width as number;
3364
+ }
3365
+ if (data.shape !== undefined && (typeof data.shape === "string" || typeof data.shape === "number")) {
3366
+ this.shape = this.parseEnumValue(data.shape, Enums.VesselShape);
3367
+ }
3368
+ if (data.vesselConditions !== undefined && (typeof data.vesselConditions === "string" || typeof data.vesselConditions === "number")) {
3369
+ this.vesselConditions = this.parseEnumValue(data.vesselConditions, Enums.VesselConditions);
3370
+ }
3371
+ if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume === "number") {
3372
+ this.liquidFillFractionByVolume = data.liquidFillFractionByVolume as number;
3373
+ }
3374
+ }
3375
+
3376
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
3080
3377
  if (typeof value === "string" && value in enumType) {
3081
3378
  return enumType[value as keyof T];
3082
- } else if (
3083
- typeof value === "number" &&
3084
- Object.values(enumType).includes(value)
3085
- ) {
3379
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
3086
3380
  return value as T[keyof T];
3087
3381
  }
3088
3382
  return undefined; // Return undefined if the value does not match the enum
@@ -3142,26 +3436,32 @@ export class VesselLeakMaxFlammableCloudResults extends EntityBase {
3142
3436
  }
3143
3437
 
3144
3438
  /** Initialise the entity with data from a dictionary. */
3145
- initialiseFromDictionary(data: { [key: string]: any }) {
3439
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3146
3440
  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 {
3441
+ if (data.dischargeRate !== undefined && typeof data.dischargeRate === "number") {
3442
+ this.dischargeRate = data.dischargeRate as number;
3443
+ }
3444
+ if (data.expandedTemperature !== undefined && typeof data.expandedTemperature === "number") {
3445
+ this.expandedTemperature = data.expandedTemperature as number;
3446
+ }
3447
+ if (data.lflExtent !== undefined && typeof data.lflExtent === "number") {
3448
+ this.lflExtent = data.lflExtent as number;
3449
+ }
3450
+ if (data.lflArea !== undefined && typeof data.lflArea === "number") {
3451
+ this.lflArea = data.lflArea as number;
3452
+ }
3453
+ if (data.lflHeight !== undefined && typeof data.lflHeight === "number") {
3454
+ this.lflHeight = data.lflHeight as number;
3455
+ }
3456
+ if (data.phase !== undefined && (typeof data.phase === "string" || typeof data.phase === "number")) {
3457
+ this.phase = this.parseEnumValue(data.phase, Enums.Phase);
3458
+ }
3459
+ }
3460
+
3461
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
3159
3462
  if (typeof value === "string" && value in enumType) {
3160
3463
  return enumType[value as keyof T];
3161
- } else if (
3162
- typeof value === "number" &&
3163
- Object.values(enumType).includes(value)
3164
- ) {
3464
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
3165
3465
  return value as T[keyof T];
3166
3466
  }
3167
3467
  return undefined; // Return undefined if the value does not match the enum
@@ -3207,17 +3507,19 @@ export class VesselSphere extends Asset {
3207
3507
  }
3208
3508
 
3209
3509
  /** Initialise the entity with data from a dictionary. */
3210
- initialiseFromDictionary(data: { [key: string]: any }) {
3510
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3211
3511
  super.initialiseFromDictionary(data);
3212
3512
  if (data.state) {
3213
3513
  this.state = new State();
3214
- this.state.initialiseFromDictionary(data.state);
3514
+ this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
3215
3515
  }
3216
3516
  if (data.material) {
3217
3517
  this.material = new Material();
3218
- this.material.initialiseFromDictionary(data.material);
3518
+ this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
3519
+ }
3520
+ if (data.massInventory !== undefined && typeof data.massInventory === "number") {
3521
+ this.massInventory = data.massInventory as number;
3219
3522
  }
3220
- this.massInventory = parseFloat(data.massInventory);
3221
3523
  }
3222
3524
 
3223
3525
  toString() {
@@ -3252,8 +3554,7 @@ export class Weather extends EntityBase {
3252
3554
  */
3253
3555
  constructor(
3254
3556
  windSpeed: number = 5,
3255
- stabilityClass: Enums.AtmosphericStabilityClass = Enums
3256
- .AtmosphericStabilityClass.STABILITY_D,
3557
+ stabilityClass: Enums.AtmosphericStabilityClass = Enums.AtmosphericStabilityClass.STABILITY_D,
3257
3558
  temperature: number = 283,
3258
3559
  relativeHumidity: number = 0.7,
3259
3560
  mixingLayerHeight: number = 800,
@@ -3269,29 +3570,32 @@ export class Weather extends EntityBase {
3269
3570
  }
3270
3571
 
3271
3572
  /** Initialise the entity with data from a dictionary. */
3272
- initialiseFromDictionary(data: { [key: string]: any }) {
3573
+ initialiseFromDictionary(data: { [key: string]: unknown }) {
3273
3574
  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 {
3575
+ if (data.windSpeed !== undefined && typeof data.windSpeed === "number") {
3576
+ this.windSpeed = data.windSpeed as number;
3577
+ }
3578
+ if (data.stabilityClass !== undefined && (typeof data.stabilityClass === "string" || typeof data.stabilityClass === "number")) {
3579
+ this.stabilityClass = this.parseEnumValue(data.stabilityClass, Enums.AtmosphericStabilityClass);
3580
+ }
3581
+ if (data.temperature !== undefined && typeof data.temperature === "number") {
3582
+ this.temperature = data.temperature as number;
3583
+ }
3584
+ if (data.relativeHumidity !== undefined && typeof data.relativeHumidity === "number") {
3585
+ this.relativeHumidity = data.relativeHumidity as number;
3586
+ }
3587
+ if (data.mixingLayerHeight !== undefined && typeof data.mixingLayerHeight === "number") {
3588
+ this.mixingLayerHeight = data.mixingLayerHeight as number;
3589
+ }
3590
+ if (data.solarRadiation !== undefined && typeof data.solarRadiation === "number") {
3591
+ this.solarRadiation = data.solarRadiation as number;
3592
+ }
3593
+ }
3594
+
3595
+ private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
3289
3596
  if (typeof value === "string" && value in enumType) {
3290
3597
  return enumType[value as keyof T];
3291
- } else if (
3292
- typeof value === "number" &&
3293
- Object.values(enumType).includes(value)
3294
- ) {
3598
+ } else if (typeof value === "number" && Object.values(enumType).includes(value)) {
3295
3599
  return value as T[keyof T];
3296
3600
  }
3297
3601
  return undefined; // Return undefined if the value does not match the enum