@dnv-plant/typescriptpws 1.0.95 → 1.0.96-alpha.2289077
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +2 -2
- package/package.json +1 -1
- package/src/calculations/applicationTools.ts +36 -47
- package/src/calculations/calculationBase.ts +27 -61
- package/src/calculations/discharge.ts +274 -364
- package/src/calculations/dispersion.ts +80 -88
- package/src/calculations/dispersionView.ts +360 -439
- package/src/calculations/fireball.ts +64 -70
- package/src/calculations/jetFire.ts +104 -118
- package/src/calculations/lateExplosion.ts +150 -154
- package/src/calculations/linkedRunners.ts +1025 -1095
- package/src/calculations/poolFire.ts +64 -70
- package/src/calculations/properties.ts +37 -50
- package/src/calculations/radiation.ts +467 -575
- package/src/calculations/standalones.ts +55 -66
- package/src/calculations/toxics.ts +65 -77
- package/src/calculations/utilities.ts +322 -479
- package/src/constants.ts +14 -14
- package/src/entities.ts +752 -1000
- package/src/entity-schemas.ts +1279 -1286
- package/src/enums.ts +11 -11
- package/src/materials.ts +86 -256
- package/src/utilities.ts +41 -50
package/src/entities.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
|
-
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
*
|
|
4
|
-
* DO NOT MODIFY THIS FILE
|
|
5
|
-
* This file is maintained by DNV.
|
|
6
|
-
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
|
-
* Please contact DNV if you believe changes are required.
|
|
8
|
-
*
|
|
9
|
-
* Version: 1.0.
|
|
10
|
-
* Date/time:
|
|
11
|
-
* Template: templates/typescriptpws/entities.razor.
|
|
12
|
-
***********************************************************************/
|
|
13
|
-
|
|
14
|
-
import * as Enums from
|
|
2
|
+
* This file has been auto-generated by a code generation tool.
|
|
3
|
+
*
|
|
4
|
+
* DO NOT MODIFY THIS FILE
|
|
5
|
+
* This file is maintained by DNV.
|
|
6
|
+
* Editing it may lead to inconsistent results and limit DNV's ability to provide support.
|
|
7
|
+
* Please contact DNV if you believe changes are required.
|
|
8
|
+
*
|
|
9
|
+
* Version: 1.0.96
|
|
10
|
+
* Date/time: 4 Apr 2026 08:17:52
|
|
11
|
+
* Template: templates/typescriptpws/entities.razor.
|
|
12
|
+
***********************************************************************/
|
|
13
|
+
|
|
14
|
+
import * as Enums from './enums';
|
|
15
15
|
|
|
16
16
|
class EntityBase {
|
|
17
17
|
id?: string;
|
|
@@ -27,25 +27,20 @@ class EntityBase {
|
|
|
27
27
|
* Base class for all entities.
|
|
28
28
|
*/
|
|
29
29
|
initialiseFromDictionary(data: { [key: string]: unknown }): void {
|
|
30
|
-
if (data.id !== undefined && typeof data.id ===
|
|
30
|
+
if (data.id !== undefined && typeof data.id === 'string') {
|
|
31
31
|
this.id = data.id as string;
|
|
32
32
|
}
|
|
33
|
-
if (data.typeId !== undefined && typeof data.typeId ===
|
|
33
|
+
if (data.typeId !== undefined && typeof data.typeId === 'string') {
|
|
34
34
|
this.typeId = data.typeId as string;
|
|
35
35
|
}
|
|
36
|
-
if (data.displayName !== undefined && typeof data.displayName ===
|
|
36
|
+
if (data.displayName !== undefined && typeof data.displayName === 'string') {
|
|
37
37
|
this.displayName = data.displayName as string;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
toString() {
|
|
42
|
-
const parts = [
|
|
43
|
-
|
|
44
|
-
`id: ${this.id}`,
|
|
45
|
-
`typeId: ${this.typeId}`,
|
|
46
|
-
`displayName: ${this.displayName}`,
|
|
47
|
-
];
|
|
48
|
-
return parts.join("\n");
|
|
42
|
+
const parts = ['* EntityBase', `id: ${this.id}`, `typeId: ${this.typeId}`, `displayName: ${this.displayName}`];
|
|
43
|
+
return parts.join('\n');
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
46
|
|
|
@@ -62,43 +57,30 @@ export class LocalPosition extends EntityBase {
|
|
|
62
57
|
* @param {number} options.y - y coordinate. [m] (default value is 0)
|
|
63
58
|
* @param {number} options.z - z coordinate. [m] (default value is 0)
|
|
64
59
|
*/
|
|
65
|
-
constructor(options?: {
|
|
66
|
-
id?: string;
|
|
67
|
-
typeId?: string;
|
|
68
|
-
displayName?: string;
|
|
69
|
-
x?: number;
|
|
70
|
-
y?: number;
|
|
71
|
-
z?: number;
|
|
72
|
-
}) {
|
|
60
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; x?: number; y?: number; z?: number }) {
|
|
73
61
|
super(options?.id, options?.typeId, options?.displayName);
|
|
74
|
-
this.x = options?.x ?? 0;
|
|
75
|
-
this.y = options?.y ?? 0;
|
|
76
|
-
this.z = options?.z ?? 0;
|
|
62
|
+
this.x = options?.x ?? 0;
|
|
63
|
+
this.y = options?.y ?? 0;
|
|
64
|
+
this.z = options?.z ?? 0;
|
|
77
65
|
}
|
|
78
66
|
|
|
79
67
|
/** Initialise the entity with data from a dictionary. */
|
|
80
68
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
81
69
|
super.initialiseFromDictionary(data);
|
|
82
|
-
if (data.x !== undefined && typeof data.x ===
|
|
70
|
+
if (data.x !== undefined && typeof data.x === 'number') {
|
|
83
71
|
this.x = data.x as number;
|
|
84
72
|
}
|
|
85
|
-
if (data.y !== undefined && typeof data.y ===
|
|
73
|
+
if (data.y !== undefined && typeof data.y === 'number') {
|
|
86
74
|
this.y = data.y as number;
|
|
87
75
|
}
|
|
88
|
-
if (data.z !== undefined && typeof data.z ===
|
|
76
|
+
if (data.z !== undefined && typeof data.z === 'number') {
|
|
89
77
|
this.z = data.z as number;
|
|
90
78
|
}
|
|
91
79
|
}
|
|
92
80
|
|
|
93
81
|
toString() {
|
|
94
|
-
const parts = [
|
|
95
|
-
|
|
96
|
-
"* LocalPosition",
|
|
97
|
-
`x: ${this.x}`,
|
|
98
|
-
`y: ${this.y}`,
|
|
99
|
-
`z: ${this.z}`,
|
|
100
|
-
];
|
|
101
|
-
return parts.join("\n");
|
|
82
|
+
const parts = [super.toString(), '* LocalPosition', `x: ${this.x}`, `y: ${this.y}`, `z: ${this.z}`];
|
|
83
|
+
return parts.join('\n');
|
|
102
84
|
}
|
|
103
85
|
}
|
|
104
86
|
|
|
@@ -111,14 +93,9 @@ export class Asset extends EntityBase {
|
|
|
111
93
|
* @param {Object} options - Initialisation options
|
|
112
94
|
* @param {LocalPosition} options.location - Location of the asset.
|
|
113
95
|
*/
|
|
114
|
-
constructor(options?: {
|
|
115
|
-
id?: string;
|
|
116
|
-
typeId?: string;
|
|
117
|
-
displayName?: string;
|
|
118
|
-
location?: LocalPosition;
|
|
119
|
-
}) {
|
|
96
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; location?: LocalPosition }) {
|
|
120
97
|
super(options?.id, options?.typeId, options?.displayName);
|
|
121
|
-
this.location = options?.location ?? new LocalPosition();
|
|
98
|
+
this.location = options?.location ?? new LocalPosition();
|
|
122
99
|
}
|
|
123
100
|
|
|
124
101
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -131,12 +108,8 @@ export class Asset extends EntityBase {
|
|
|
131
108
|
}
|
|
132
109
|
|
|
133
110
|
toString() {
|
|
134
|
-
const parts = [
|
|
135
|
-
|
|
136
|
-
"* Asset",
|
|
137
|
-
`location: ${this.location?.toString()}`,
|
|
138
|
-
];
|
|
139
|
-
return parts.join("\n");
|
|
111
|
+
const parts = [super.toString(), '* Asset', `location: ${this.location?.toString()}`];
|
|
112
|
+
return parts.join('\n');
|
|
140
113
|
}
|
|
141
114
|
}
|
|
142
115
|
|
|
@@ -151,37 +124,26 @@ export class MaterialComponent extends EntityBase {
|
|
|
151
124
|
* @param {string} options.name - Name of the component. (default value is "")
|
|
152
125
|
* @param {number} options.moleFraction - Mole fraction of the component in the material. [fraction] (default value is 1)
|
|
153
126
|
*/
|
|
154
|
-
constructor(options?: {
|
|
155
|
-
id?: string;
|
|
156
|
-
typeId?: string;
|
|
157
|
-
displayName?: string;
|
|
158
|
-
name?: string;
|
|
159
|
-
moleFraction?: number;
|
|
160
|
-
}) {
|
|
127
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; name?: string; moleFraction?: number }) {
|
|
161
128
|
super(options?.id, options?.typeId, options?.displayName);
|
|
162
|
-
this.name = options?.name ??
|
|
163
|
-
this.moleFraction = options?.moleFraction ?? 1;
|
|
129
|
+
this.name = options?.name ?? '';
|
|
130
|
+
this.moleFraction = options?.moleFraction ?? 1;
|
|
164
131
|
}
|
|
165
132
|
|
|
166
133
|
/** Initialise the entity with data from a dictionary. */
|
|
167
134
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
168
135
|
super.initialiseFromDictionary(data);
|
|
169
|
-
if (data.name !== undefined && typeof data.name ===
|
|
136
|
+
if (data.name !== undefined && typeof data.name === 'string') {
|
|
170
137
|
this.name = data.name as string;
|
|
171
138
|
}
|
|
172
|
-
if (data.moleFraction !== undefined && typeof data.moleFraction ===
|
|
139
|
+
if (data.moleFraction !== undefined && typeof data.moleFraction === 'number') {
|
|
173
140
|
this.moleFraction = data.moleFraction as number;
|
|
174
141
|
}
|
|
175
142
|
}
|
|
176
143
|
|
|
177
144
|
toString() {
|
|
178
|
-
const parts = [
|
|
179
|
-
|
|
180
|
-
"* MaterialComponent",
|
|
181
|
-
`name: ${this.name}`,
|
|
182
|
-
`moleFraction: ${this.moleFraction}`,
|
|
183
|
-
];
|
|
184
|
-
return parts.join("\n");
|
|
145
|
+
const parts = [super.toString(), '* MaterialComponent', `name: ${this.name}`, `moleFraction: ${this.moleFraction}`];
|
|
146
|
+
return parts.join('\n');
|
|
185
147
|
}
|
|
186
148
|
}
|
|
187
149
|
|
|
@@ -200,49 +162,39 @@ export class Material extends EntityBase {
|
|
|
200
162
|
* @param {number} options.componentCount - Number of components in the material. (default value is 1)
|
|
201
163
|
* @param {Enums.PropertyTemplate} options.propertyTemplate - The template to be used for the selection of calculation methods for material properties. (default value is Enums.PropertyTemplate.PHAST_MC)
|
|
202
164
|
*/
|
|
203
|
-
constructor(options?: {
|
|
204
|
-
id?: string;
|
|
205
|
-
typeId?: string;
|
|
206
|
-
displayName?: string;
|
|
207
|
-
name?: string;
|
|
208
|
-
components?: MaterialComponent[];
|
|
209
|
-
componentCount?: number;
|
|
210
|
-
propertyTemplate?: Enums.PropertyTemplate;
|
|
211
|
-
}) {
|
|
165
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; name?: string; components?: MaterialComponent[]; componentCount?: number; propertyTemplate?: Enums.PropertyTemplate }) {
|
|
212
166
|
super(options?.id, options?.typeId, options?.displayName);
|
|
213
|
-
this.components = options?.components ?? [new MaterialComponent()];
|
|
214
|
-
this.name = options?.name ??
|
|
215
|
-
this.componentCount = options?.componentCount ?? 1;
|
|
216
|
-
this.propertyTemplate = options?.propertyTemplate ?? Enums.PropertyTemplate.PHAST_MC;
|
|
167
|
+
this.components = options?.components ?? [new MaterialComponent()];
|
|
168
|
+
this.name = options?.name ?? '';
|
|
169
|
+
this.componentCount = options?.componentCount ?? 1;
|
|
170
|
+
this.propertyTemplate = options?.propertyTemplate ?? Enums.PropertyTemplate.PHAST_MC;
|
|
217
171
|
}
|
|
218
172
|
|
|
219
173
|
/** Initialise the entity with data from a dictionary. */
|
|
220
174
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
221
175
|
super.initialiseFromDictionary(data);
|
|
222
176
|
if (data.components && Array.isArray(data.components)) {
|
|
223
|
-
this.components = data.components.map(
|
|
224
|
-
(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (data.name !== undefined && typeof data.name === "string") {
|
|
177
|
+
this.components = data.components.map((item) => {
|
|
178
|
+
const record = new MaterialComponent();
|
|
179
|
+
record.initialiseFromDictionary(item);
|
|
180
|
+
return record;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (data.name !== undefined && typeof data.name === 'string') {
|
|
232
184
|
this.name = data.name as string;
|
|
233
185
|
}
|
|
234
|
-
if (data.componentCount !== undefined && typeof data.componentCount ===
|
|
186
|
+
if (data.componentCount !== undefined && typeof data.componentCount === 'number') {
|
|
235
187
|
this.componentCount = data.componentCount as number;
|
|
236
188
|
}
|
|
237
|
-
if (data.propertyTemplate !== undefined && (typeof data.propertyTemplate ===
|
|
189
|
+
if (data.propertyTemplate !== undefined && (typeof data.propertyTemplate === 'string' || typeof data.propertyTemplate === 'number')) {
|
|
238
190
|
this.propertyTemplate = this.parseEnumValue(data.propertyTemplate, Enums.PropertyTemplate);
|
|
239
191
|
}
|
|
240
192
|
}
|
|
241
193
|
|
|
242
194
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
243
|
-
if (typeof value ===
|
|
195
|
+
if (typeof value === 'string' && value in enumType) {
|
|
244
196
|
return enumType[value as keyof T];
|
|
245
|
-
} else if (typeof value ===
|
|
197
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
246
198
|
return value as T[keyof T];
|
|
247
199
|
}
|
|
248
200
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -251,13 +203,13 @@ export class Material extends EntityBase {
|
|
|
251
203
|
toString() {
|
|
252
204
|
const parts = [
|
|
253
205
|
super.toString(),
|
|
254
|
-
|
|
255
|
-
this.components?.map((item) => item?.toString()).join(
|
|
206
|
+
'* Material',
|
|
207
|
+
this.components?.map((item) => item?.toString()).join('\n'),
|
|
256
208
|
`name: ${this.name}`,
|
|
257
209
|
`componentCount: ${this.componentCount}`,
|
|
258
210
|
`propertyTemplate: ${this.propertyTemplate}`,
|
|
259
211
|
];
|
|
260
|
-
return parts.join(
|
|
212
|
+
return parts.join('\n');
|
|
261
213
|
}
|
|
262
214
|
}
|
|
263
215
|
|
|
@@ -289,37 +241,37 @@ export class State extends EntityBase {
|
|
|
289
241
|
mixtureModelling?: Enums.MixtureModelling;
|
|
290
242
|
}) {
|
|
291
243
|
super(options?.id, options?.typeId, options?.displayName);
|
|
292
|
-
this.pressure = options?.pressure;
|
|
293
|
-
this.temperature = options?.temperature;
|
|
294
|
-
this.liquidFraction = options?.liquidFraction;
|
|
295
|
-
this.flashFlag = options?.flashFlag ?? Enums.FluidSpec.TP;
|
|
296
|
-
this.mixtureModelling = options?.mixtureModelling ?? Enums.MixtureModelling.PC;
|
|
244
|
+
this.pressure = options?.pressure;
|
|
245
|
+
this.temperature = options?.temperature;
|
|
246
|
+
this.liquidFraction = options?.liquidFraction;
|
|
247
|
+
this.flashFlag = options?.flashFlag ?? Enums.FluidSpec.TP;
|
|
248
|
+
this.mixtureModelling = options?.mixtureModelling ?? Enums.MixtureModelling.PC;
|
|
297
249
|
}
|
|
298
250
|
|
|
299
251
|
/** Initialise the entity with data from a dictionary. */
|
|
300
252
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
301
253
|
super.initialiseFromDictionary(data);
|
|
302
|
-
if (data.pressure !== undefined && typeof data.pressure ===
|
|
254
|
+
if (data.pressure !== undefined && typeof data.pressure === 'number') {
|
|
303
255
|
this.pressure = data.pressure as number;
|
|
304
256
|
}
|
|
305
|
-
if (data.temperature !== undefined && typeof data.temperature ===
|
|
257
|
+
if (data.temperature !== undefined && typeof data.temperature === 'number') {
|
|
306
258
|
this.temperature = data.temperature as number;
|
|
307
259
|
}
|
|
308
|
-
if (data.liquidFraction !== undefined && typeof data.liquidFraction ===
|
|
260
|
+
if (data.liquidFraction !== undefined && typeof data.liquidFraction === 'number') {
|
|
309
261
|
this.liquidFraction = data.liquidFraction as number;
|
|
310
262
|
}
|
|
311
|
-
if (data.flashFlag !== undefined && (typeof data.flashFlag ===
|
|
263
|
+
if (data.flashFlag !== undefined && (typeof data.flashFlag === 'string' || typeof data.flashFlag === 'number')) {
|
|
312
264
|
this.flashFlag = this.parseEnumValue(data.flashFlag, Enums.FluidSpec);
|
|
313
265
|
}
|
|
314
|
-
if (data.mixtureModelling !== undefined && (typeof data.mixtureModelling ===
|
|
266
|
+
if (data.mixtureModelling !== undefined && (typeof data.mixtureModelling === 'string' || typeof data.mixtureModelling === 'number')) {
|
|
315
267
|
this.mixtureModelling = this.parseEnumValue(data.mixtureModelling, Enums.MixtureModelling);
|
|
316
268
|
}
|
|
317
269
|
}
|
|
318
270
|
|
|
319
271
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
320
|
-
if (typeof value ===
|
|
272
|
+
if (typeof value === 'string' && value in enumType) {
|
|
321
273
|
return enumType[value as keyof T];
|
|
322
|
-
} else if (typeof value ===
|
|
274
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
323
275
|
return value as T[keyof T];
|
|
324
276
|
}
|
|
325
277
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -328,14 +280,14 @@ export class State extends EntityBase {
|
|
|
328
280
|
toString() {
|
|
329
281
|
const parts = [
|
|
330
282
|
super.toString(),
|
|
331
|
-
|
|
283
|
+
'* State',
|
|
332
284
|
`pressure: ${this.pressure}`,
|
|
333
285
|
`temperature: ${this.temperature}`,
|
|
334
286
|
`liquidFraction: ${this.liquidFraction}`,
|
|
335
287
|
`flashFlag: ${this.flashFlag}`,
|
|
336
288
|
`mixtureModelling: ${this.mixtureModelling}`,
|
|
337
289
|
];
|
|
338
|
-
return parts.join(
|
|
290
|
+
return parts.join('\n');
|
|
339
291
|
}
|
|
340
292
|
}
|
|
341
293
|
|
|
@@ -369,11 +321,11 @@ export class AtmosphericStorageTank extends Asset {
|
|
|
369
321
|
liquidFillFractionByVolume?: number;
|
|
370
322
|
}) {
|
|
371
323
|
super(options);
|
|
372
|
-
this.state = options?.state ?? new State();
|
|
373
|
-
this.diameter = options?.diameter;
|
|
374
|
-
this.height = options?.height;
|
|
375
|
-
this.material = options?.material ?? new Material();
|
|
376
|
-
this.liquidFillFractionByVolume = options?.liquidFillFractionByVolume ?? 0.9;
|
|
324
|
+
this.state = options?.state ?? new State();
|
|
325
|
+
this.diameter = options?.diameter;
|
|
326
|
+
this.height = options?.height;
|
|
327
|
+
this.material = options?.material ?? new Material();
|
|
328
|
+
this.liquidFillFractionByVolume = options?.liquidFillFractionByVolume ?? 0.9;
|
|
377
329
|
}
|
|
378
330
|
|
|
379
331
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -383,17 +335,17 @@ export class AtmosphericStorageTank extends Asset {
|
|
|
383
335
|
this.state = new State();
|
|
384
336
|
this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
|
|
385
337
|
}
|
|
386
|
-
if (data.diameter !== undefined && typeof data.diameter ===
|
|
338
|
+
if (data.diameter !== undefined && typeof data.diameter === 'number') {
|
|
387
339
|
this.diameter = data.diameter as number;
|
|
388
340
|
}
|
|
389
|
-
if (data.height !== undefined && typeof data.height ===
|
|
341
|
+
if (data.height !== undefined && typeof data.height === 'number') {
|
|
390
342
|
this.height = data.height as number;
|
|
391
343
|
}
|
|
392
344
|
if (data.material) {
|
|
393
345
|
this.material = new Material();
|
|
394
346
|
this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
|
|
395
347
|
}
|
|
396
|
-
if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume ===
|
|
348
|
+
if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume === 'number') {
|
|
397
349
|
this.liquidFillFractionByVolume = data.liquidFillFractionByVolume as number;
|
|
398
350
|
}
|
|
399
351
|
}
|
|
@@ -401,7 +353,7 @@ export class AtmosphericStorageTank extends Asset {
|
|
|
401
353
|
toString() {
|
|
402
354
|
const parts = [
|
|
403
355
|
super.toString(),
|
|
404
|
-
|
|
356
|
+
'* AtmosphericStorageTank',
|
|
405
357
|
`location: ${this.location?.toString()}`,
|
|
406
358
|
`state: ${this.state?.toString()}`,
|
|
407
359
|
`diameter: ${this.diameter}`,
|
|
@@ -409,7 +361,7 @@ export class AtmosphericStorageTank extends Asset {
|
|
|
409
361
|
`material: ${this.material?.toString()}`,
|
|
410
362
|
`liquidFillFractionByVolume: ${this.liquidFillFractionByVolume}`,
|
|
411
363
|
];
|
|
412
|
-
return parts.join(
|
|
364
|
+
return parts.join('\n');
|
|
413
365
|
}
|
|
414
366
|
}
|
|
415
367
|
|
|
@@ -418,11 +370,7 @@ export class Scenario extends EntityBase {
|
|
|
418
370
|
* Base struct/class for all scenario types.
|
|
419
371
|
*
|
|
420
372
|
*/
|
|
421
|
-
constructor(options?: {
|
|
422
|
-
id?: string;
|
|
423
|
-
typeId?: string;
|
|
424
|
-
displayName?: string;
|
|
425
|
-
}) {
|
|
373
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string }) {
|
|
426
374
|
super(options?.id, options?.typeId, options?.displayName);
|
|
427
375
|
}
|
|
428
376
|
|
|
@@ -432,11 +380,8 @@ export class Scenario extends EntityBase {
|
|
|
432
380
|
}
|
|
433
381
|
|
|
434
382
|
toString() {
|
|
435
|
-
const parts = [
|
|
436
|
-
|
|
437
|
-
"* Scenario",
|
|
438
|
-
];
|
|
439
|
-
return parts.join("\n");
|
|
383
|
+
const parts = [super.toString(), '* Scenario'];
|
|
384
|
+
return parts.join('\n');
|
|
440
385
|
}
|
|
441
386
|
}
|
|
442
387
|
|
|
@@ -451,46 +396,35 @@ export class ReleaseOverTime extends Scenario {
|
|
|
451
396
|
* @param {number} options.releaseAngle - Angle of release above a horizontal plane. [rad] (default value is 0.0)
|
|
452
397
|
* @param {Enums.TimeVaryingOption} options.timeVaryingOption - Whether the release is a time-varying release or a steady state release using the initial rate. (default value is Enums.TimeVaryingOption.INITIAL_RATE)
|
|
453
398
|
*/
|
|
454
|
-
constructor(options?: {
|
|
455
|
-
id?: string;
|
|
456
|
-
typeId?: string;
|
|
457
|
-
displayName?: string;
|
|
458
|
-
releaseAngle?: number;
|
|
459
|
-
timeVaryingOption?: Enums.TimeVaryingOption;
|
|
460
|
-
}) {
|
|
399
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; releaseAngle?: number; timeVaryingOption?: Enums.TimeVaryingOption }) {
|
|
461
400
|
super(options);
|
|
462
|
-
this.releaseAngle = options?.releaseAngle ?? 0.0;
|
|
463
|
-
this.timeVaryingOption = options?.timeVaryingOption ?? Enums.TimeVaryingOption.INITIAL_RATE;
|
|
401
|
+
this.releaseAngle = options?.releaseAngle ?? 0.0;
|
|
402
|
+
this.timeVaryingOption = options?.timeVaryingOption ?? Enums.TimeVaryingOption.INITIAL_RATE;
|
|
464
403
|
}
|
|
465
404
|
|
|
466
405
|
/** Initialise the entity with data from a dictionary. */
|
|
467
406
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
468
407
|
super.initialiseFromDictionary(data);
|
|
469
|
-
if (data.releaseAngle !== undefined && typeof data.releaseAngle ===
|
|
408
|
+
if (data.releaseAngle !== undefined && typeof data.releaseAngle === 'number') {
|
|
470
409
|
this.releaseAngle = data.releaseAngle as number;
|
|
471
410
|
}
|
|
472
|
-
if (data.timeVaryingOption !== undefined && (typeof data.timeVaryingOption ===
|
|
411
|
+
if (data.timeVaryingOption !== undefined && (typeof data.timeVaryingOption === 'string' || typeof data.timeVaryingOption === 'number')) {
|
|
473
412
|
this.timeVaryingOption = this.parseEnumValue(data.timeVaryingOption, Enums.TimeVaryingOption);
|
|
474
413
|
}
|
|
475
414
|
}
|
|
476
415
|
|
|
477
416
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
478
|
-
if (typeof value ===
|
|
417
|
+
if (typeof value === 'string' && value in enumType) {
|
|
479
418
|
return enumType[value as keyof T];
|
|
480
|
-
} else if (typeof value ===
|
|
419
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
481
420
|
return value as T[keyof T];
|
|
482
421
|
}
|
|
483
422
|
return undefined; // Return undefined if the value does not match the enum
|
|
484
423
|
}
|
|
485
424
|
|
|
486
425
|
toString() {
|
|
487
|
-
const parts = [
|
|
488
|
-
|
|
489
|
-
"* ReleaseOverTime",
|
|
490
|
-
`releaseAngle: ${this.releaseAngle}`,
|
|
491
|
-
`timeVaryingOption: ${this.timeVaryingOption}`,
|
|
492
|
-
];
|
|
493
|
-
return parts.join("\n");
|
|
426
|
+
const parts = [super.toString(), '* ReleaseOverTime', `releaseAngle: ${this.releaseAngle}`, `timeVaryingOption: ${this.timeVaryingOption}`];
|
|
427
|
+
return parts.join('\n');
|
|
494
428
|
}
|
|
495
429
|
}
|
|
496
430
|
|
|
@@ -523,25 +457,25 @@ export class BESSRelease extends ReleaseOverTime {
|
|
|
523
457
|
timeVaryingOption?: Enums.TimeVaryingOption;
|
|
524
458
|
}) {
|
|
525
459
|
super(options);
|
|
526
|
-
this.height = options?.height;
|
|
527
|
-
this.area = options?.area;
|
|
528
|
-
this.temperature = options?.temperature;
|
|
529
|
-
this.duration = options?.duration;
|
|
460
|
+
this.height = options?.height;
|
|
461
|
+
this.area = options?.area;
|
|
462
|
+
this.temperature = options?.temperature;
|
|
463
|
+
this.duration = options?.duration;
|
|
530
464
|
}
|
|
531
465
|
|
|
532
466
|
/** Initialise the entity with data from a dictionary. */
|
|
533
467
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
534
468
|
super.initialiseFromDictionary(data);
|
|
535
|
-
if (data.height !== undefined && typeof data.height ===
|
|
469
|
+
if (data.height !== undefined && typeof data.height === 'number') {
|
|
536
470
|
this.height = data.height as number;
|
|
537
471
|
}
|
|
538
|
-
if (data.area !== undefined && typeof data.area ===
|
|
472
|
+
if (data.area !== undefined && typeof data.area === 'number') {
|
|
539
473
|
this.area = data.area as number;
|
|
540
474
|
}
|
|
541
|
-
if (data.temperature !== undefined && typeof data.temperature ===
|
|
475
|
+
if (data.temperature !== undefined && typeof data.temperature === 'number') {
|
|
542
476
|
this.temperature = data.temperature as number;
|
|
543
477
|
}
|
|
544
|
-
if (data.duration !== undefined && typeof data.duration ===
|
|
478
|
+
if (data.duration !== undefined && typeof data.duration === 'number') {
|
|
545
479
|
this.duration = data.duration as number;
|
|
546
480
|
}
|
|
547
481
|
}
|
|
@@ -549,7 +483,7 @@ export class BESSRelease extends ReleaseOverTime {
|
|
|
549
483
|
toString() {
|
|
550
484
|
const parts = [
|
|
551
485
|
super.toString(),
|
|
552
|
-
|
|
486
|
+
'* BESSRelease',
|
|
553
487
|
`height: ${this.height}`,
|
|
554
488
|
`area: ${this.area}`,
|
|
555
489
|
`temperature: ${this.temperature}`,
|
|
@@ -557,7 +491,7 @@ export class BESSRelease extends ReleaseOverTime {
|
|
|
557
491
|
`releaseAngle: ${this.releaseAngle}`,
|
|
558
492
|
`timeVaryingOption: ${this.timeVaryingOption}`,
|
|
559
493
|
];
|
|
560
|
-
return parts.join(
|
|
494
|
+
return parts.join('\n');
|
|
561
495
|
}
|
|
562
496
|
}
|
|
563
497
|
|
|
@@ -573,48 +507,35 @@ export class BESSUnit extends Asset {
|
|
|
573
507
|
* @param {number} options.energyCapacity - The energy capacity of the installation. [J]
|
|
574
508
|
* @param {Enums.BESSChemistry} options.chemistry - The chemistry type of the BESS unit. (default value is Enums.BESSChemistry.LFP)
|
|
575
509
|
*/
|
|
576
|
-
constructor(options?: {
|
|
577
|
-
id?: string;
|
|
578
|
-
typeId?: string;
|
|
579
|
-
displayName?: string;
|
|
580
|
-
location?: LocalPosition;
|
|
581
|
-
energyCapacity?: number;
|
|
582
|
-
chemistry?: Enums.BESSChemistry;
|
|
583
|
-
}) {
|
|
510
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; location?: LocalPosition; energyCapacity?: number; chemistry?: Enums.BESSChemistry }) {
|
|
584
511
|
super(options);
|
|
585
|
-
this.energyCapacity = options?.energyCapacity;
|
|
586
|
-
this.chemistry = options?.chemistry ?? Enums.BESSChemistry.LFP;
|
|
512
|
+
this.energyCapacity = options?.energyCapacity;
|
|
513
|
+
this.chemistry = options?.chemistry ?? Enums.BESSChemistry.LFP;
|
|
587
514
|
}
|
|
588
515
|
|
|
589
516
|
/** Initialise the entity with data from a dictionary. */
|
|
590
517
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
591
518
|
super.initialiseFromDictionary(data);
|
|
592
|
-
if (data.energyCapacity !== undefined && typeof data.energyCapacity ===
|
|
519
|
+
if (data.energyCapacity !== undefined && typeof data.energyCapacity === 'number') {
|
|
593
520
|
this.energyCapacity = data.energyCapacity as number;
|
|
594
521
|
}
|
|
595
|
-
if (data.chemistry !== undefined && (typeof data.chemistry ===
|
|
522
|
+
if (data.chemistry !== undefined && (typeof data.chemistry === 'string' || typeof data.chemistry === 'number')) {
|
|
596
523
|
this.chemistry = this.parseEnumValue(data.chemistry, Enums.BESSChemistry);
|
|
597
524
|
}
|
|
598
525
|
}
|
|
599
526
|
|
|
600
527
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
601
|
-
if (typeof value ===
|
|
528
|
+
if (typeof value === 'string' && value in enumType) {
|
|
602
529
|
return enumType[value as keyof T];
|
|
603
|
-
} else if (typeof value ===
|
|
530
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
604
531
|
return value as T[keyof T];
|
|
605
532
|
}
|
|
606
533
|
return undefined; // Return undefined if the value does not match the enum
|
|
607
534
|
}
|
|
608
535
|
|
|
609
536
|
toString() {
|
|
610
|
-
const parts = [
|
|
611
|
-
|
|
612
|
-
"* BESSUnit",
|
|
613
|
-
`location: ${this.location?.toString()}`,
|
|
614
|
-
`energyCapacity: ${this.energyCapacity}`,
|
|
615
|
-
`chemistry: ${this.chemistry}`,
|
|
616
|
-
];
|
|
617
|
-
return parts.join("\n");
|
|
537
|
+
const parts = [super.toString(), '* BESSUnit', `location: ${this.location?.toString()}`, `energyCapacity: ${this.energyCapacity}`, `chemistry: ${this.chemistry}`];
|
|
538
|
+
return parts.join('\n');
|
|
618
539
|
}
|
|
619
540
|
}
|
|
620
541
|
|
|
@@ -631,43 +552,30 @@ export class Bund extends EntityBase {
|
|
|
631
552
|
* @param {number} options.bundDiameter - The diameter of the (circular) bund. [m] (default value is 0.0)
|
|
632
553
|
* @param {boolean} options.specifyBund - Whether to model the effect of a bund on the spreading of a liquid pool. (default value is false)
|
|
633
554
|
*/
|
|
634
|
-
constructor(options?: {
|
|
635
|
-
id?: string;
|
|
636
|
-
typeId?: string;
|
|
637
|
-
displayName?: string;
|
|
638
|
-
bundHeight?: number;
|
|
639
|
-
bundDiameter?: number;
|
|
640
|
-
specifyBund?: boolean;
|
|
641
|
-
}) {
|
|
555
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; bundHeight?: number; bundDiameter?: number; specifyBund?: boolean }) {
|
|
642
556
|
super(options?.id, options?.typeId, options?.displayName);
|
|
643
|
-
this.bundHeight = options?.bundHeight ?? 0.0;
|
|
644
|
-
this.bundDiameter = options?.bundDiameter ?? 0.0;
|
|
645
|
-
this.specifyBund = options?.specifyBund ?? false;
|
|
557
|
+
this.bundHeight = options?.bundHeight ?? 0.0;
|
|
558
|
+
this.bundDiameter = options?.bundDiameter ?? 0.0;
|
|
559
|
+
this.specifyBund = options?.specifyBund ?? false;
|
|
646
560
|
}
|
|
647
561
|
|
|
648
562
|
/** Initialise the entity with data from a dictionary. */
|
|
649
563
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
650
564
|
super.initialiseFromDictionary(data);
|
|
651
|
-
if (data.bundHeight !== undefined && typeof data.bundHeight ===
|
|
565
|
+
if (data.bundHeight !== undefined && typeof data.bundHeight === 'number') {
|
|
652
566
|
this.bundHeight = data.bundHeight as number;
|
|
653
567
|
}
|
|
654
|
-
if (data.bundDiameter !== undefined && typeof data.bundDiameter ===
|
|
568
|
+
if (data.bundDiameter !== undefined && typeof data.bundDiameter === 'number') {
|
|
655
569
|
this.bundDiameter = data.bundDiameter as number;
|
|
656
570
|
}
|
|
657
|
-
if (data.specifyBund !== undefined && typeof data.specifyBund ===
|
|
571
|
+
if (data.specifyBund !== undefined && typeof data.specifyBund === 'boolean') {
|
|
658
572
|
this.specifyBund = data.specifyBund as boolean;
|
|
659
573
|
}
|
|
660
574
|
}
|
|
661
575
|
|
|
662
576
|
toString() {
|
|
663
|
-
const parts = [
|
|
664
|
-
|
|
665
|
-
"* Bund",
|
|
666
|
-
`bundHeight: ${this.bundHeight}`,
|
|
667
|
-
`bundDiameter: ${this.bundDiameter}`,
|
|
668
|
-
`specifyBund: ${this.specifyBund}`,
|
|
669
|
-
];
|
|
670
|
-
return parts.join("\n");
|
|
577
|
+
const parts = [super.toString(), '* Bund', `bundHeight: ${this.bundHeight}`, `bundDiameter: ${this.bundDiameter}`, `specifyBund: ${this.specifyBund}`];
|
|
578
|
+
return parts.join('\n');
|
|
671
579
|
}
|
|
672
580
|
}
|
|
673
581
|
|
|
@@ -676,11 +584,7 @@ export class Instantaneous extends Scenario {
|
|
|
676
584
|
* Base struct/class for instantaneous release scenarios.
|
|
677
585
|
*
|
|
678
586
|
*/
|
|
679
|
-
constructor(options?: {
|
|
680
|
-
id?: string;
|
|
681
|
-
typeId?: string;
|
|
682
|
-
displayName?: string;
|
|
683
|
-
}) {
|
|
587
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string }) {
|
|
684
588
|
super(options);
|
|
685
589
|
}
|
|
686
590
|
|
|
@@ -690,11 +594,8 @@ export class Instantaneous extends Scenario {
|
|
|
690
594
|
}
|
|
691
595
|
|
|
692
596
|
toString() {
|
|
693
|
-
const parts = [
|
|
694
|
-
|
|
695
|
-
"* Instantaneous",
|
|
696
|
-
];
|
|
697
|
-
return parts.join("\n");
|
|
597
|
+
const parts = [super.toString(), '* Instantaneous'];
|
|
598
|
+
return parts.join('\n');
|
|
698
599
|
}
|
|
699
600
|
}
|
|
700
601
|
|
|
@@ -703,11 +604,7 @@ export class CatastrophicRupture extends Instantaneous {
|
|
|
703
604
|
* 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.
|
|
704
605
|
*
|
|
705
606
|
*/
|
|
706
|
-
constructor(options?: {
|
|
707
|
-
id?: string;
|
|
708
|
-
typeId?: string;
|
|
709
|
-
displayName?: string;
|
|
710
|
-
}) {
|
|
607
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string }) {
|
|
711
608
|
super(options);
|
|
712
609
|
}
|
|
713
610
|
|
|
@@ -717,11 +614,8 @@ export class CatastrophicRupture extends Instantaneous {
|
|
|
717
614
|
}
|
|
718
615
|
|
|
719
616
|
toString() {
|
|
720
|
-
const parts = [
|
|
721
|
-
|
|
722
|
-
"* CatastrophicRupture",
|
|
723
|
-
];
|
|
724
|
-
return parts.join("\n");
|
|
617
|
+
const parts = [super.toString(), '* CatastrophicRupture'];
|
|
618
|
+
return parts.join('\n');
|
|
725
619
|
}
|
|
726
620
|
}
|
|
727
621
|
|
|
@@ -736,22 +630,16 @@ export class ConcentrationRecord extends EntityBase {
|
|
|
736
630
|
* @param {number} options.concentration - Cloud concentration at an x, y, z position. [fraction]
|
|
737
631
|
* @param {LocalPosition} options.position - x, y, z position.
|
|
738
632
|
*/
|
|
739
|
-
constructor(options?: {
|
|
740
|
-
id?: string;
|
|
741
|
-
typeId?: string;
|
|
742
|
-
displayName?: string;
|
|
743
|
-
concentration?: number;
|
|
744
|
-
position?: LocalPosition;
|
|
745
|
-
}) {
|
|
633
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; concentration?: number; position?: LocalPosition }) {
|
|
746
634
|
super(options?.id, options?.typeId, options?.displayName);
|
|
747
|
-
this.concentration = options?.concentration;
|
|
748
|
-
this.position = options?.position ?? new LocalPosition();
|
|
635
|
+
this.concentration = options?.concentration;
|
|
636
|
+
this.position = options?.position ?? new LocalPosition();
|
|
749
637
|
}
|
|
750
638
|
|
|
751
639
|
/** Initialise the entity with data from a dictionary. */
|
|
752
640
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
753
641
|
super.initialiseFromDictionary(data);
|
|
754
|
-
if (data.concentration !== undefined && typeof data.concentration ===
|
|
642
|
+
if (data.concentration !== undefined && typeof data.concentration === 'number') {
|
|
755
643
|
this.concentration = data.concentration as number;
|
|
756
644
|
}
|
|
757
645
|
if (data.position) {
|
|
@@ -761,13 +649,8 @@ export class ConcentrationRecord extends EntityBase {
|
|
|
761
649
|
}
|
|
762
650
|
|
|
763
651
|
toString() {
|
|
764
|
-
const parts = [
|
|
765
|
-
|
|
766
|
-
"* ConcentrationRecord",
|
|
767
|
-
`concentration: ${this.concentration}`,
|
|
768
|
-
`position: ${this.position?.toString()}`,
|
|
769
|
-
];
|
|
770
|
-
return parts.join("\n");
|
|
652
|
+
const parts = [super.toString(), '* ConcentrationRecord', `concentration: ${this.concentration}`, `position: ${this.position?.toString()}`];
|
|
653
|
+
return parts.join('\n');
|
|
771
654
|
}
|
|
772
655
|
}
|
|
773
656
|
|
|
@@ -784,30 +667,23 @@ export class ConstantMaterialResult extends EntityBase {
|
|
|
784
667
|
* @param {number} options.criticalTemperature - The critical temperature of the material. [K]
|
|
785
668
|
* @param {number} options.totalMolecularWeight - The total molecular weight of the material. [kg/kmol]
|
|
786
669
|
*/
|
|
787
|
-
constructor(options?: {
|
|
788
|
-
id?: string;
|
|
789
|
-
typeId?: string;
|
|
790
|
-
displayName?: string;
|
|
791
|
-
criticalPressure?: number;
|
|
792
|
-
criticalTemperature?: number;
|
|
793
|
-
totalMolecularWeight?: number;
|
|
794
|
-
}) {
|
|
670
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; criticalPressure?: number; criticalTemperature?: number; totalMolecularWeight?: number }) {
|
|
795
671
|
super(options?.id, options?.typeId, options?.displayName);
|
|
796
|
-
this.criticalPressure = options?.criticalPressure;
|
|
797
|
-
this.criticalTemperature = options?.criticalTemperature;
|
|
798
|
-
this.totalMolecularWeight = options?.totalMolecularWeight;
|
|
672
|
+
this.criticalPressure = options?.criticalPressure;
|
|
673
|
+
this.criticalTemperature = options?.criticalTemperature;
|
|
674
|
+
this.totalMolecularWeight = options?.totalMolecularWeight;
|
|
799
675
|
}
|
|
800
676
|
|
|
801
677
|
/** Initialise the entity with data from a dictionary. */
|
|
802
678
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
803
679
|
super.initialiseFromDictionary(data);
|
|
804
|
-
if (data.criticalPressure !== undefined && typeof data.criticalPressure ===
|
|
680
|
+
if (data.criticalPressure !== undefined && typeof data.criticalPressure === 'number') {
|
|
805
681
|
this.criticalPressure = data.criticalPressure as number;
|
|
806
682
|
}
|
|
807
|
-
if (data.criticalTemperature !== undefined && typeof data.criticalTemperature ===
|
|
683
|
+
if (data.criticalTemperature !== undefined && typeof data.criticalTemperature === 'number') {
|
|
808
684
|
this.criticalTemperature = data.criticalTemperature as number;
|
|
809
685
|
}
|
|
810
|
-
if (data.totalMolecularWeight !== undefined && typeof data.totalMolecularWeight ===
|
|
686
|
+
if (data.totalMolecularWeight !== undefined && typeof data.totalMolecularWeight === 'number') {
|
|
811
687
|
this.totalMolecularWeight = data.totalMolecularWeight as number;
|
|
812
688
|
}
|
|
813
689
|
}
|
|
@@ -815,12 +691,12 @@ export class ConstantMaterialResult extends EntityBase {
|
|
|
815
691
|
toString() {
|
|
816
692
|
const parts = [
|
|
817
693
|
super.toString(),
|
|
818
|
-
|
|
694
|
+
'* ConstantMaterialResult',
|
|
819
695
|
`criticalPressure: ${this.criticalPressure}`,
|
|
820
696
|
`criticalTemperature: ${this.criticalTemperature}`,
|
|
821
697
|
`totalMolecularWeight: ${this.totalMolecularWeight}`,
|
|
822
698
|
];
|
|
823
|
-
return parts.join(
|
|
699
|
+
return parts.join('\n');
|
|
824
700
|
}
|
|
825
701
|
}
|
|
826
702
|
|
|
@@ -833,40 +709,31 @@ export class DischargeParameters extends EntityBase {
|
|
|
833
709
|
* @param {Object} options - Initialisation options
|
|
834
710
|
* @param {Enums.FlashAtOrifice} options.flashAtOrifice - Whether discharge calculations should allow the phase to change between storage and orifice conditions. (default value is Enums.FlashAtOrifice.DISALLOW_LIQUID_FLASH)
|
|
835
711
|
*/
|
|
836
|
-
constructor(options?: {
|
|
837
|
-
id?: string;
|
|
838
|
-
typeId?: string;
|
|
839
|
-
displayName?: string;
|
|
840
|
-
flashAtOrifice?: Enums.FlashAtOrifice;
|
|
841
|
-
}) {
|
|
712
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; flashAtOrifice?: Enums.FlashAtOrifice }) {
|
|
842
713
|
super(options?.id, options?.typeId, options?.displayName);
|
|
843
|
-
this.flashAtOrifice = options?.flashAtOrifice ?? Enums.FlashAtOrifice.DISALLOW_LIQUID_FLASH;
|
|
714
|
+
this.flashAtOrifice = options?.flashAtOrifice ?? Enums.FlashAtOrifice.DISALLOW_LIQUID_FLASH;
|
|
844
715
|
}
|
|
845
716
|
|
|
846
717
|
/** Initialise the entity with data from a dictionary. */
|
|
847
718
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
848
719
|
super.initialiseFromDictionary(data);
|
|
849
|
-
if (data.flashAtOrifice !== undefined && (typeof data.flashAtOrifice ===
|
|
720
|
+
if (data.flashAtOrifice !== undefined && (typeof data.flashAtOrifice === 'string' || typeof data.flashAtOrifice === 'number')) {
|
|
850
721
|
this.flashAtOrifice = this.parseEnumValue(data.flashAtOrifice, Enums.FlashAtOrifice);
|
|
851
722
|
}
|
|
852
723
|
}
|
|
853
724
|
|
|
854
725
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
855
|
-
if (typeof value ===
|
|
726
|
+
if (typeof value === 'string' && value in enumType) {
|
|
856
727
|
return enumType[value as keyof T];
|
|
857
|
-
} else if (typeof value ===
|
|
728
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
858
729
|
return value as T[keyof T];
|
|
859
730
|
}
|
|
860
731
|
return undefined; // Return undefined if the value does not match the enum
|
|
861
732
|
}
|
|
862
733
|
|
|
863
734
|
toString() {
|
|
864
|
-
const parts = [
|
|
865
|
-
|
|
866
|
-
"* DischargeParameters",
|
|
867
|
-
`flashAtOrifice: ${this.flashAtOrifice}`,
|
|
868
|
-
];
|
|
869
|
-
return parts.join("\n");
|
|
735
|
+
const parts = [super.toString(), '* DischargeParameters', `flashAtOrifice: ${this.flashAtOrifice}`];
|
|
736
|
+
return parts.join('\n');
|
|
870
737
|
}
|
|
871
738
|
}
|
|
872
739
|
|
|
@@ -910,48 +777,48 @@ export class DischargeRecord extends EntityBase {
|
|
|
910
777
|
expandedDiameter?: number;
|
|
911
778
|
}) {
|
|
912
779
|
super(options?.id, options?.typeId, options?.displayName);
|
|
913
|
-
this.time = options?.time;
|
|
914
|
-
this.massFlow = options?.massFlow;
|
|
915
|
-
this.finalState = options?.finalState ?? new State();
|
|
916
|
-
this.finalVelocity = options?.finalVelocity;
|
|
917
|
-
this.orificeState = options?.orificeState ?? new State();
|
|
918
|
-
this.orificeVelocity = options?.orificeVelocity;
|
|
919
|
-
this.storageState = options?.storageState ?? new State();
|
|
920
|
-
this.dropletDiameter = options?.dropletDiameter;
|
|
921
|
-
this.expandedDiameter = options?.expandedDiameter ?? 0.0;
|
|
780
|
+
this.time = options?.time;
|
|
781
|
+
this.massFlow = options?.massFlow;
|
|
782
|
+
this.finalState = options?.finalState ?? new State();
|
|
783
|
+
this.finalVelocity = options?.finalVelocity;
|
|
784
|
+
this.orificeState = options?.orificeState ?? new State();
|
|
785
|
+
this.orificeVelocity = options?.orificeVelocity;
|
|
786
|
+
this.storageState = options?.storageState ?? new State();
|
|
787
|
+
this.dropletDiameter = options?.dropletDiameter;
|
|
788
|
+
this.expandedDiameter = options?.expandedDiameter ?? 0.0;
|
|
922
789
|
}
|
|
923
790
|
|
|
924
791
|
/** Initialise the entity with data from a dictionary. */
|
|
925
792
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
926
793
|
super.initialiseFromDictionary(data);
|
|
927
|
-
if (data.time !== undefined && typeof data.time ===
|
|
794
|
+
if (data.time !== undefined && typeof data.time === 'number') {
|
|
928
795
|
this.time = data.time as number;
|
|
929
796
|
}
|
|
930
|
-
if (data.massFlow !== undefined && typeof data.massFlow ===
|
|
797
|
+
if (data.massFlow !== undefined && typeof data.massFlow === 'number') {
|
|
931
798
|
this.massFlow = data.massFlow as number;
|
|
932
799
|
}
|
|
933
800
|
if (data.finalState) {
|
|
934
801
|
this.finalState = new State();
|
|
935
802
|
this.finalState.initialiseFromDictionary(data.finalState as { [key: string]: unknown });
|
|
936
803
|
}
|
|
937
|
-
if (data.finalVelocity !== undefined && typeof data.finalVelocity ===
|
|
804
|
+
if (data.finalVelocity !== undefined && typeof data.finalVelocity === 'number') {
|
|
938
805
|
this.finalVelocity = data.finalVelocity as number;
|
|
939
806
|
}
|
|
940
807
|
if (data.orificeState) {
|
|
941
808
|
this.orificeState = new State();
|
|
942
809
|
this.orificeState.initialiseFromDictionary(data.orificeState as { [key: string]: unknown });
|
|
943
810
|
}
|
|
944
|
-
if (data.orificeVelocity !== undefined && typeof data.orificeVelocity ===
|
|
811
|
+
if (data.orificeVelocity !== undefined && typeof data.orificeVelocity === 'number') {
|
|
945
812
|
this.orificeVelocity = data.orificeVelocity as number;
|
|
946
813
|
}
|
|
947
814
|
if (data.storageState) {
|
|
948
815
|
this.storageState = new State();
|
|
949
816
|
this.storageState.initialiseFromDictionary(data.storageState as { [key: string]: unknown });
|
|
950
817
|
}
|
|
951
|
-
if (data.dropletDiameter !== undefined && typeof data.dropletDiameter ===
|
|
818
|
+
if (data.dropletDiameter !== undefined && typeof data.dropletDiameter === 'number') {
|
|
952
819
|
this.dropletDiameter = data.dropletDiameter as number;
|
|
953
820
|
}
|
|
954
|
-
if (data.expandedDiameter !== undefined && typeof data.expandedDiameter ===
|
|
821
|
+
if (data.expandedDiameter !== undefined && typeof data.expandedDiameter === 'number') {
|
|
955
822
|
this.expandedDiameter = data.expandedDiameter as number;
|
|
956
823
|
}
|
|
957
824
|
}
|
|
@@ -959,7 +826,7 @@ export class DischargeRecord extends EntityBase {
|
|
|
959
826
|
toString() {
|
|
960
827
|
const parts = [
|
|
961
828
|
super.toString(),
|
|
962
|
-
|
|
829
|
+
'* DischargeRecord',
|
|
963
830
|
`time: ${this.time}`,
|
|
964
831
|
`massFlow: ${this.massFlow}`,
|
|
965
832
|
`finalState: ${this.finalState?.toString()}`,
|
|
@@ -970,7 +837,7 @@ export class DischargeRecord extends EntityBase {
|
|
|
970
837
|
`dropletDiameter: ${this.dropletDiameter}`,
|
|
971
838
|
`expandedDiameter: ${this.expandedDiameter}`,
|
|
972
839
|
];
|
|
973
|
-
return parts.join(
|
|
840
|
+
return parts.join('\n');
|
|
974
841
|
}
|
|
975
842
|
}
|
|
976
843
|
|
|
@@ -1008,45 +875,45 @@ export class DischargeResult extends EntityBase {
|
|
|
1008
875
|
preDilutionAirRate?: number;
|
|
1009
876
|
}) {
|
|
1010
877
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1011
|
-
this.expansionEnergy = options?.expansionEnergy;
|
|
1012
|
-
this.releaseMass = options?.releaseMass;
|
|
1013
|
-
this.height = options?.height;
|
|
1014
|
-
this.angle = options?.angle;
|
|
1015
|
-
this.holeDiameter = options?.holeDiameter;
|
|
1016
|
-
this.releaseType = options?.releaseType ?? Enums.DynamicType.UNSET;
|
|
1017
|
-
this.preDilutionAirRate = options?.preDilutionAirRate ?? 0;
|
|
878
|
+
this.expansionEnergy = options?.expansionEnergy;
|
|
879
|
+
this.releaseMass = options?.releaseMass;
|
|
880
|
+
this.height = options?.height;
|
|
881
|
+
this.angle = options?.angle;
|
|
882
|
+
this.holeDiameter = options?.holeDiameter;
|
|
883
|
+
this.releaseType = options?.releaseType ?? Enums.DynamicType.UNSET;
|
|
884
|
+
this.preDilutionAirRate = options?.preDilutionAirRate ?? 0;
|
|
1018
885
|
}
|
|
1019
886
|
|
|
1020
887
|
/** Initialise the entity with data from a dictionary. */
|
|
1021
888
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1022
889
|
super.initialiseFromDictionary(data);
|
|
1023
|
-
if (data.expansionEnergy !== undefined && typeof data.expansionEnergy ===
|
|
890
|
+
if (data.expansionEnergy !== undefined && typeof data.expansionEnergy === 'number') {
|
|
1024
891
|
this.expansionEnergy = data.expansionEnergy as number;
|
|
1025
892
|
}
|
|
1026
|
-
if (data.releaseMass !== undefined && typeof data.releaseMass ===
|
|
893
|
+
if (data.releaseMass !== undefined && typeof data.releaseMass === 'number') {
|
|
1027
894
|
this.releaseMass = data.releaseMass as number;
|
|
1028
895
|
}
|
|
1029
|
-
if (data.height !== undefined && typeof data.height ===
|
|
896
|
+
if (data.height !== undefined && typeof data.height === 'number') {
|
|
1030
897
|
this.height = data.height as number;
|
|
1031
898
|
}
|
|
1032
|
-
if (data.angle !== undefined && typeof data.angle ===
|
|
899
|
+
if (data.angle !== undefined && typeof data.angle === 'number') {
|
|
1033
900
|
this.angle = data.angle as number;
|
|
1034
901
|
}
|
|
1035
|
-
if (data.holeDiameter !== undefined && typeof data.holeDiameter ===
|
|
902
|
+
if (data.holeDiameter !== undefined && typeof data.holeDiameter === 'number') {
|
|
1036
903
|
this.holeDiameter = data.holeDiameter as number;
|
|
1037
904
|
}
|
|
1038
|
-
if (data.releaseType !== undefined && (typeof data.releaseType ===
|
|
905
|
+
if (data.releaseType !== undefined && (typeof data.releaseType === 'string' || typeof data.releaseType === 'number')) {
|
|
1039
906
|
this.releaseType = this.parseEnumValue(data.releaseType, Enums.DynamicType);
|
|
1040
907
|
}
|
|
1041
|
-
if (data.preDilutionAirRate !== undefined && typeof data.preDilutionAirRate ===
|
|
908
|
+
if (data.preDilutionAirRate !== undefined && typeof data.preDilutionAirRate === 'number') {
|
|
1042
909
|
this.preDilutionAirRate = data.preDilutionAirRate as number;
|
|
1043
910
|
}
|
|
1044
911
|
}
|
|
1045
912
|
|
|
1046
913
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
1047
|
-
if (typeof value ===
|
|
914
|
+
if (typeof value === 'string' && value in enumType) {
|
|
1048
915
|
return enumType[value as keyof T];
|
|
1049
|
-
} else if (typeof value ===
|
|
916
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
1050
917
|
return value as T[keyof T];
|
|
1051
918
|
}
|
|
1052
919
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -1055,7 +922,7 @@ export class DischargeResult extends EntityBase {
|
|
|
1055
922
|
toString() {
|
|
1056
923
|
const parts = [
|
|
1057
924
|
super.toString(),
|
|
1058
|
-
|
|
925
|
+
'* DischargeResult',
|
|
1059
926
|
`expansionEnergy: ${this.expansionEnergy}`,
|
|
1060
927
|
`releaseMass: ${this.releaseMass}`,
|
|
1061
928
|
`height: ${this.height}`,
|
|
@@ -1064,7 +931,7 @@ export class DischargeResult extends EntityBase {
|
|
|
1064
931
|
`releaseType: ${this.releaseType}`,
|
|
1065
932
|
`preDilutionAirRate: ${this.preDilutionAirRate}`,
|
|
1066
933
|
];
|
|
1067
|
-
return parts.join(
|
|
934
|
+
return parts.join('\n');
|
|
1068
935
|
}
|
|
1069
936
|
}
|
|
1070
937
|
|
|
@@ -1114,61 +981,61 @@ export class DispersionOutputConfig extends EntityBase {
|
|
|
1114
981
|
componentToTrackName?: string;
|
|
1115
982
|
}) {
|
|
1116
983
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1117
|
-
this.downwindDistance = options?.downwindDistance ?? 100;
|
|
1118
|
-
this.time = options?.time ?? 60;
|
|
1119
|
-
this.resolution = options?.resolution ?? Enums.Resolution.MEDIUM;
|
|
1120
|
-
this.elevation = options?.elevation ?? 1;
|
|
1121
|
-
this.specialConcentration = options?.specialConcentration ?? Enums.SpecialConcentration.MIN;
|
|
1122
|
-
this.concentration = options?.concentration ?? 0;
|
|
1123
|
-
this.crosswindDistance = options?.crosswindDistance ?? 0;
|
|
1124
|
-
this.contourType = options?.contourType ?? Enums.ContourType.FOOTPRINT;
|
|
1125
|
-
this.lflFractionValue = options?.lflFractionValue ?? 0.5;
|
|
1126
|
-
this.componentToTrackIndex = options?.componentToTrackIndex ?? -1;
|
|
1127
|
-
this.componentToTrackName = options?.componentToTrackName ??
|
|
984
|
+
this.downwindDistance = options?.downwindDistance ?? 100;
|
|
985
|
+
this.time = options?.time ?? 60;
|
|
986
|
+
this.resolution = options?.resolution ?? Enums.Resolution.MEDIUM;
|
|
987
|
+
this.elevation = options?.elevation ?? 1;
|
|
988
|
+
this.specialConcentration = options?.specialConcentration ?? Enums.SpecialConcentration.MIN;
|
|
989
|
+
this.concentration = options?.concentration ?? 0;
|
|
990
|
+
this.crosswindDistance = options?.crosswindDistance ?? 0;
|
|
991
|
+
this.contourType = options?.contourType ?? Enums.ContourType.FOOTPRINT;
|
|
992
|
+
this.lflFractionValue = options?.lflFractionValue ?? 0.5;
|
|
993
|
+
this.componentToTrackIndex = options?.componentToTrackIndex ?? -1;
|
|
994
|
+
this.componentToTrackName = options?.componentToTrackName ?? '';
|
|
1128
995
|
}
|
|
1129
996
|
|
|
1130
997
|
/** Initialise the entity with data from a dictionary. */
|
|
1131
998
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1132
999
|
super.initialiseFromDictionary(data);
|
|
1133
|
-
if (data.downwindDistance !== undefined && typeof data.downwindDistance ===
|
|
1000
|
+
if (data.downwindDistance !== undefined && typeof data.downwindDistance === 'number') {
|
|
1134
1001
|
this.downwindDistance = data.downwindDistance as number;
|
|
1135
1002
|
}
|
|
1136
|
-
if (data.time !== undefined && typeof data.time ===
|
|
1003
|
+
if (data.time !== undefined && typeof data.time === 'number') {
|
|
1137
1004
|
this.time = data.time as number;
|
|
1138
1005
|
}
|
|
1139
|
-
if (data.resolution !== undefined && (typeof data.resolution ===
|
|
1006
|
+
if (data.resolution !== undefined && (typeof data.resolution === 'string' || typeof data.resolution === 'number')) {
|
|
1140
1007
|
this.resolution = this.parseEnumValue(data.resolution, Enums.Resolution);
|
|
1141
1008
|
}
|
|
1142
|
-
if (data.elevation !== undefined && typeof data.elevation ===
|
|
1009
|
+
if (data.elevation !== undefined && typeof data.elevation === 'number') {
|
|
1143
1010
|
this.elevation = data.elevation as number;
|
|
1144
1011
|
}
|
|
1145
|
-
if (data.specialConcentration !== undefined && (typeof data.specialConcentration ===
|
|
1012
|
+
if (data.specialConcentration !== undefined && (typeof data.specialConcentration === 'string' || typeof data.specialConcentration === 'number')) {
|
|
1146
1013
|
this.specialConcentration = this.parseEnumValue(data.specialConcentration, Enums.SpecialConcentration);
|
|
1147
1014
|
}
|
|
1148
|
-
if (data.concentration !== undefined && typeof data.concentration ===
|
|
1015
|
+
if (data.concentration !== undefined && typeof data.concentration === 'number') {
|
|
1149
1016
|
this.concentration = data.concentration as number;
|
|
1150
1017
|
}
|
|
1151
|
-
if (data.crosswindDistance !== undefined && typeof data.crosswindDistance ===
|
|
1018
|
+
if (data.crosswindDistance !== undefined && typeof data.crosswindDistance === 'number') {
|
|
1152
1019
|
this.crosswindDistance = data.crosswindDistance as number;
|
|
1153
1020
|
}
|
|
1154
|
-
if (data.contourType !== undefined && (typeof data.contourType ===
|
|
1021
|
+
if (data.contourType !== undefined && (typeof data.contourType === 'string' || typeof data.contourType === 'number')) {
|
|
1155
1022
|
this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
|
|
1156
1023
|
}
|
|
1157
|
-
if (data.lflFractionValue !== undefined && typeof data.lflFractionValue ===
|
|
1024
|
+
if (data.lflFractionValue !== undefined && typeof data.lflFractionValue === 'number') {
|
|
1158
1025
|
this.lflFractionValue = data.lflFractionValue as number;
|
|
1159
1026
|
}
|
|
1160
|
-
if (data.componentToTrackIndex !== undefined && typeof data.componentToTrackIndex ===
|
|
1027
|
+
if (data.componentToTrackIndex !== undefined && typeof data.componentToTrackIndex === 'number') {
|
|
1161
1028
|
this.componentToTrackIndex = data.componentToTrackIndex as number;
|
|
1162
1029
|
}
|
|
1163
|
-
if (data.componentToTrackName !== undefined && typeof data.componentToTrackName ===
|
|
1030
|
+
if (data.componentToTrackName !== undefined && typeof data.componentToTrackName === 'string') {
|
|
1164
1031
|
this.componentToTrackName = data.componentToTrackName as string;
|
|
1165
1032
|
}
|
|
1166
1033
|
}
|
|
1167
1034
|
|
|
1168
1035
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
1169
|
-
if (typeof value ===
|
|
1036
|
+
if (typeof value === 'string' && value in enumType) {
|
|
1170
1037
|
return enumType[value as keyof T];
|
|
1171
|
-
} else if (typeof value ===
|
|
1038
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
1172
1039
|
return value as T[keyof T];
|
|
1173
1040
|
}
|
|
1174
1041
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -1177,7 +1044,7 @@ export class DispersionOutputConfig extends EntityBase {
|
|
|
1177
1044
|
toString() {
|
|
1178
1045
|
const parts = [
|
|
1179
1046
|
super.toString(),
|
|
1180
|
-
|
|
1047
|
+
'* DispersionOutputConfig',
|
|
1181
1048
|
`downwindDistance: ${this.downwindDistance}`,
|
|
1182
1049
|
`time: ${this.time}`,
|
|
1183
1050
|
`resolution: ${this.resolution}`,
|
|
@@ -1190,7 +1057,7 @@ export class DispersionOutputConfig extends EntityBase {
|
|
|
1190
1057
|
`componentToTrackIndex: ${this.componentToTrackIndex}`,
|
|
1191
1058
|
`componentToTrackName: ${this.componentToTrackName}`,
|
|
1192
1059
|
];
|
|
1193
|
-
return parts.join(
|
|
1060
|
+
return parts.join('\n');
|
|
1194
1061
|
}
|
|
1195
1062
|
}
|
|
1196
1063
|
|
|
@@ -1237,57 +1104,57 @@ export class DispersionParameters extends EntityBase {
|
|
|
1237
1104
|
lflFractionToStop?: number;
|
|
1238
1105
|
}) {
|
|
1239
1106
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1240
|
-
this.relativeTolerance = options?.relativeTolerance ?? 0.0001;
|
|
1241
|
-
this.rainoutThermoFlag = options?.rainoutThermoFlag ?? Enums.RainoutThermoFlag.RAINOUT_NON_EQUILIBRIUM;
|
|
1242
|
-
this.fixedStepSize = options?.fixedStepSize ?? 0.01;
|
|
1243
|
-
this.outputStepMultiplier = options?.outputStepMultiplier ?? 1.2;
|
|
1244
|
-
this.maxDispersionDistance = options?.maxDispersionDistance ?? 50000;
|
|
1245
|
-
this.maxDispersionHeight = options?.maxDispersionHeight ?? 1000;
|
|
1246
|
-
this.numberOfReleaseObservers = options?.numberOfReleaseObservers ?? 5;
|
|
1247
|
-
this.numberOfPoolObservers = options?.numberOfPoolObservers ?? 10;
|
|
1248
|
-
this.averagingTime = options?.averagingTime ?? 18.75;
|
|
1249
|
-
this.lflFractionToStop = options?.lflFractionToStop ?? 0.5;
|
|
1107
|
+
this.relativeTolerance = options?.relativeTolerance ?? 0.0001;
|
|
1108
|
+
this.rainoutThermoFlag = options?.rainoutThermoFlag ?? Enums.RainoutThermoFlag.RAINOUT_NON_EQUILIBRIUM;
|
|
1109
|
+
this.fixedStepSize = options?.fixedStepSize ?? 0.01;
|
|
1110
|
+
this.outputStepMultiplier = options?.outputStepMultiplier ?? 1.2;
|
|
1111
|
+
this.maxDispersionDistance = options?.maxDispersionDistance ?? 50000;
|
|
1112
|
+
this.maxDispersionHeight = options?.maxDispersionHeight ?? 1000;
|
|
1113
|
+
this.numberOfReleaseObservers = options?.numberOfReleaseObservers ?? 5;
|
|
1114
|
+
this.numberOfPoolObservers = options?.numberOfPoolObservers ?? 10;
|
|
1115
|
+
this.averagingTime = options?.averagingTime ?? 18.75;
|
|
1116
|
+
this.lflFractionToStop = options?.lflFractionToStop ?? 0.5;
|
|
1250
1117
|
}
|
|
1251
1118
|
|
|
1252
1119
|
/** Initialise the entity with data from a dictionary. */
|
|
1253
1120
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1254
1121
|
super.initialiseFromDictionary(data);
|
|
1255
|
-
if (data.relativeTolerance !== undefined && typeof data.relativeTolerance ===
|
|
1122
|
+
if (data.relativeTolerance !== undefined && typeof data.relativeTolerance === 'number') {
|
|
1256
1123
|
this.relativeTolerance = data.relativeTolerance as number;
|
|
1257
1124
|
}
|
|
1258
|
-
if (data.rainoutThermoFlag !== undefined && (typeof data.rainoutThermoFlag ===
|
|
1125
|
+
if (data.rainoutThermoFlag !== undefined && (typeof data.rainoutThermoFlag === 'string' || typeof data.rainoutThermoFlag === 'number')) {
|
|
1259
1126
|
this.rainoutThermoFlag = this.parseEnumValue(data.rainoutThermoFlag, Enums.RainoutThermoFlag);
|
|
1260
1127
|
}
|
|
1261
|
-
if (data.fixedStepSize !== undefined && typeof data.fixedStepSize ===
|
|
1128
|
+
if (data.fixedStepSize !== undefined && typeof data.fixedStepSize === 'number') {
|
|
1262
1129
|
this.fixedStepSize = data.fixedStepSize as number;
|
|
1263
1130
|
}
|
|
1264
|
-
if (data.outputStepMultiplier !== undefined && typeof data.outputStepMultiplier ===
|
|
1131
|
+
if (data.outputStepMultiplier !== undefined && typeof data.outputStepMultiplier === 'number') {
|
|
1265
1132
|
this.outputStepMultiplier = data.outputStepMultiplier as number;
|
|
1266
1133
|
}
|
|
1267
|
-
if (data.maxDispersionDistance !== undefined && typeof data.maxDispersionDistance ===
|
|
1134
|
+
if (data.maxDispersionDistance !== undefined && typeof data.maxDispersionDistance === 'number') {
|
|
1268
1135
|
this.maxDispersionDistance = data.maxDispersionDistance as number;
|
|
1269
1136
|
}
|
|
1270
|
-
if (data.maxDispersionHeight !== undefined && typeof data.maxDispersionHeight ===
|
|
1137
|
+
if (data.maxDispersionHeight !== undefined && typeof data.maxDispersionHeight === 'number') {
|
|
1271
1138
|
this.maxDispersionHeight = data.maxDispersionHeight as number;
|
|
1272
1139
|
}
|
|
1273
|
-
if (data.numberOfReleaseObservers !== undefined && typeof data.numberOfReleaseObservers ===
|
|
1140
|
+
if (data.numberOfReleaseObservers !== undefined && typeof data.numberOfReleaseObservers === 'number') {
|
|
1274
1141
|
this.numberOfReleaseObservers = data.numberOfReleaseObservers as number;
|
|
1275
1142
|
}
|
|
1276
|
-
if (data.numberOfPoolObservers !== undefined && typeof data.numberOfPoolObservers ===
|
|
1143
|
+
if (data.numberOfPoolObservers !== undefined && typeof data.numberOfPoolObservers === 'number') {
|
|
1277
1144
|
this.numberOfPoolObservers = data.numberOfPoolObservers as number;
|
|
1278
1145
|
}
|
|
1279
|
-
if (data.averagingTime !== undefined && typeof data.averagingTime ===
|
|
1146
|
+
if (data.averagingTime !== undefined && typeof data.averagingTime === 'number') {
|
|
1280
1147
|
this.averagingTime = data.averagingTime as number;
|
|
1281
1148
|
}
|
|
1282
|
-
if (data.lflFractionToStop !== undefined && typeof data.lflFractionToStop ===
|
|
1149
|
+
if (data.lflFractionToStop !== undefined && typeof data.lflFractionToStop === 'number') {
|
|
1283
1150
|
this.lflFractionToStop = data.lflFractionToStop as number;
|
|
1284
1151
|
}
|
|
1285
1152
|
}
|
|
1286
1153
|
|
|
1287
1154
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
1288
|
-
if (typeof value ===
|
|
1155
|
+
if (typeof value === 'string' && value in enumType) {
|
|
1289
1156
|
return enumType[value as keyof T];
|
|
1290
|
-
} else if (typeof value ===
|
|
1157
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
1291
1158
|
return value as T[keyof T];
|
|
1292
1159
|
}
|
|
1293
1160
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -1296,7 +1163,7 @@ export class DispersionParameters extends EntityBase {
|
|
|
1296
1163
|
toString() {
|
|
1297
1164
|
const parts = [
|
|
1298
1165
|
super.toString(),
|
|
1299
|
-
|
|
1166
|
+
'* DispersionParameters',
|
|
1300
1167
|
`relativeTolerance: ${this.relativeTolerance}`,
|
|
1301
1168
|
`rainoutThermoFlag: ${this.rainoutThermoFlag}`,
|
|
1302
1169
|
`fixedStepSize: ${this.fixedStepSize}`,
|
|
@@ -1308,7 +1175,7 @@ export class DispersionParameters extends EntityBase {
|
|
|
1308
1175
|
`averagingTime: ${this.averagingTime}`,
|
|
1309
1176
|
`lflFractionToStop: ${this.lflFractionToStop}`,
|
|
1310
1177
|
];
|
|
1311
|
-
return parts.join(
|
|
1178
|
+
return parts.join('\n');
|
|
1312
1179
|
}
|
|
1313
1180
|
}
|
|
1314
1181
|
|
|
@@ -1412,133 +1279,133 @@ export class DispersionRecord extends EntityBase {
|
|
|
1412
1279
|
instCon?: Enums.DynamicType;
|
|
1413
1280
|
}) {
|
|
1414
1281
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1415
|
-
this.observerIndex = options?.observerIndex;
|
|
1416
|
-
this.centrelineConcentration = options?.centrelineConcentration;
|
|
1417
|
-
this.downwindDistance = options?.downwindDistance;
|
|
1418
|
-
this.time = options?.time;
|
|
1419
|
-
this.centrelineConcentrationUncorrected = options?.centrelineConcentrationUncorrected;
|
|
1420
|
-
this.crosswindRadius = options?.crosswindRadius;
|
|
1421
|
-
this.verticalRadius = options?.verticalRadius;
|
|
1422
|
-
this.crosswindExponent = options?.crosswindExponent;
|
|
1423
|
-
this.verticalExponent = options?.verticalExponent;
|
|
1424
|
-
this.theta = options?.theta;
|
|
1425
|
-
this.centrelineHeight = options?.centrelineHeight;
|
|
1426
|
-
this.liquidFraction = options?.liquidFraction;
|
|
1427
|
-
this.vapourTemperature = options?.vapourTemperature;
|
|
1428
|
-
this.massConc = options?.massConc;
|
|
1429
|
-
this.velocity = options?.velocity;
|
|
1430
|
-
this.massFlow = options?.massFlow;
|
|
1431
|
-
this.profileFlag = options?.profileFlag;
|
|
1432
|
-
this.elevFlag = options?.elevFlag;
|
|
1433
|
-
this.rhoCloud = options?.rhoCloud;
|
|
1434
|
-
this.liqTemp = options?.liqTemp;
|
|
1435
|
-
this.effectiveWidth = options?.effectiveWidth;
|
|
1436
|
-
this.effectiveHeight = options?.effectiveHeight;
|
|
1437
|
-
this.passTranDist = options?.passTranDist;
|
|
1438
|
-
this.downwindRadius = options?.downwindRadius;
|
|
1439
|
-
this.dropletDiameter = options?.dropletDiameter;
|
|
1440
|
-
this.dropletHeight = options?.dropletHeight;
|
|
1441
|
-
this.dropletDistance = options?.dropletDistance;
|
|
1442
|
-
this.mass = options?.mass;
|
|
1443
|
-
this.instCon = options?.instCon ?? Enums.DynamicType.UNSET;
|
|
1282
|
+
this.observerIndex = options?.observerIndex;
|
|
1283
|
+
this.centrelineConcentration = options?.centrelineConcentration;
|
|
1284
|
+
this.downwindDistance = options?.downwindDistance;
|
|
1285
|
+
this.time = options?.time;
|
|
1286
|
+
this.centrelineConcentrationUncorrected = options?.centrelineConcentrationUncorrected;
|
|
1287
|
+
this.crosswindRadius = options?.crosswindRadius;
|
|
1288
|
+
this.verticalRadius = options?.verticalRadius;
|
|
1289
|
+
this.crosswindExponent = options?.crosswindExponent;
|
|
1290
|
+
this.verticalExponent = options?.verticalExponent;
|
|
1291
|
+
this.theta = options?.theta;
|
|
1292
|
+
this.centrelineHeight = options?.centrelineHeight;
|
|
1293
|
+
this.liquidFraction = options?.liquidFraction;
|
|
1294
|
+
this.vapourTemperature = options?.vapourTemperature;
|
|
1295
|
+
this.massConc = options?.massConc;
|
|
1296
|
+
this.velocity = options?.velocity;
|
|
1297
|
+
this.massFlow = options?.massFlow;
|
|
1298
|
+
this.profileFlag = options?.profileFlag;
|
|
1299
|
+
this.elevFlag = options?.elevFlag;
|
|
1300
|
+
this.rhoCloud = options?.rhoCloud;
|
|
1301
|
+
this.liqTemp = options?.liqTemp;
|
|
1302
|
+
this.effectiveWidth = options?.effectiveWidth;
|
|
1303
|
+
this.effectiveHeight = options?.effectiveHeight;
|
|
1304
|
+
this.passTranDist = options?.passTranDist;
|
|
1305
|
+
this.downwindRadius = options?.downwindRadius;
|
|
1306
|
+
this.dropletDiameter = options?.dropletDiameter;
|
|
1307
|
+
this.dropletHeight = options?.dropletHeight;
|
|
1308
|
+
this.dropletDistance = options?.dropletDistance;
|
|
1309
|
+
this.mass = options?.mass;
|
|
1310
|
+
this.instCon = options?.instCon ?? Enums.DynamicType.UNSET;
|
|
1444
1311
|
}
|
|
1445
1312
|
|
|
1446
1313
|
/** Initialise the entity with data from a dictionary. */
|
|
1447
1314
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1448
1315
|
super.initialiseFromDictionary(data);
|
|
1449
|
-
if (data.observerIndex !== undefined && typeof data.observerIndex ===
|
|
1316
|
+
if (data.observerIndex !== undefined && typeof data.observerIndex === 'number') {
|
|
1450
1317
|
this.observerIndex = data.observerIndex as number;
|
|
1451
1318
|
}
|
|
1452
|
-
if (data.centrelineConcentration !== undefined && typeof data.centrelineConcentration ===
|
|
1319
|
+
if (data.centrelineConcentration !== undefined && typeof data.centrelineConcentration === 'number') {
|
|
1453
1320
|
this.centrelineConcentration = data.centrelineConcentration as number;
|
|
1454
1321
|
}
|
|
1455
|
-
if (data.downwindDistance !== undefined && typeof data.downwindDistance ===
|
|
1322
|
+
if (data.downwindDistance !== undefined && typeof data.downwindDistance === 'number') {
|
|
1456
1323
|
this.downwindDistance = data.downwindDistance as number;
|
|
1457
1324
|
}
|
|
1458
|
-
if (data.time !== undefined && typeof data.time ===
|
|
1325
|
+
if (data.time !== undefined && typeof data.time === 'number') {
|
|
1459
1326
|
this.time = data.time as number;
|
|
1460
1327
|
}
|
|
1461
|
-
if (data.centrelineConcentrationUncorrected !== undefined && typeof data.centrelineConcentrationUncorrected ===
|
|
1328
|
+
if (data.centrelineConcentrationUncorrected !== undefined && typeof data.centrelineConcentrationUncorrected === 'number') {
|
|
1462
1329
|
this.centrelineConcentrationUncorrected = data.centrelineConcentrationUncorrected as number;
|
|
1463
1330
|
}
|
|
1464
|
-
if (data.crosswindRadius !== undefined && typeof data.crosswindRadius ===
|
|
1331
|
+
if (data.crosswindRadius !== undefined && typeof data.crosswindRadius === 'number') {
|
|
1465
1332
|
this.crosswindRadius = data.crosswindRadius as number;
|
|
1466
1333
|
}
|
|
1467
|
-
if (data.verticalRadius !== undefined && typeof data.verticalRadius ===
|
|
1334
|
+
if (data.verticalRadius !== undefined && typeof data.verticalRadius === 'number') {
|
|
1468
1335
|
this.verticalRadius = data.verticalRadius as number;
|
|
1469
1336
|
}
|
|
1470
|
-
if (data.crosswindExponent !== undefined && typeof data.crosswindExponent ===
|
|
1337
|
+
if (data.crosswindExponent !== undefined && typeof data.crosswindExponent === 'number') {
|
|
1471
1338
|
this.crosswindExponent = data.crosswindExponent as number;
|
|
1472
1339
|
}
|
|
1473
|
-
if (data.verticalExponent !== undefined && typeof data.verticalExponent ===
|
|
1340
|
+
if (data.verticalExponent !== undefined && typeof data.verticalExponent === 'number') {
|
|
1474
1341
|
this.verticalExponent = data.verticalExponent as number;
|
|
1475
1342
|
}
|
|
1476
|
-
if (data.theta !== undefined && typeof data.theta ===
|
|
1343
|
+
if (data.theta !== undefined && typeof data.theta === 'number') {
|
|
1477
1344
|
this.theta = data.theta as number;
|
|
1478
1345
|
}
|
|
1479
|
-
if (data.centrelineHeight !== undefined && typeof data.centrelineHeight ===
|
|
1346
|
+
if (data.centrelineHeight !== undefined && typeof data.centrelineHeight === 'number') {
|
|
1480
1347
|
this.centrelineHeight = data.centrelineHeight as number;
|
|
1481
1348
|
}
|
|
1482
|
-
if (data.liquidFraction !== undefined && typeof data.liquidFraction ===
|
|
1349
|
+
if (data.liquidFraction !== undefined && typeof data.liquidFraction === 'number') {
|
|
1483
1350
|
this.liquidFraction = data.liquidFraction as number;
|
|
1484
1351
|
}
|
|
1485
|
-
if (data.vapourTemperature !== undefined && typeof data.vapourTemperature ===
|
|
1352
|
+
if (data.vapourTemperature !== undefined && typeof data.vapourTemperature === 'number') {
|
|
1486
1353
|
this.vapourTemperature = data.vapourTemperature as number;
|
|
1487
1354
|
}
|
|
1488
|
-
if (data.massConc !== undefined && typeof data.massConc ===
|
|
1355
|
+
if (data.massConc !== undefined && typeof data.massConc === 'number') {
|
|
1489
1356
|
this.massConc = data.massConc as number;
|
|
1490
1357
|
}
|
|
1491
|
-
if (data.velocity !== undefined && typeof data.velocity ===
|
|
1358
|
+
if (data.velocity !== undefined && typeof data.velocity === 'number') {
|
|
1492
1359
|
this.velocity = data.velocity as number;
|
|
1493
1360
|
}
|
|
1494
|
-
if (data.massFlow !== undefined && typeof data.massFlow ===
|
|
1361
|
+
if (data.massFlow !== undefined && typeof data.massFlow === 'number') {
|
|
1495
1362
|
this.massFlow = data.massFlow as number;
|
|
1496
1363
|
}
|
|
1497
|
-
if (data.profileFlag !== undefined && typeof data.profileFlag ===
|
|
1364
|
+
if (data.profileFlag !== undefined && typeof data.profileFlag === 'number') {
|
|
1498
1365
|
this.profileFlag = data.profileFlag as number;
|
|
1499
1366
|
}
|
|
1500
|
-
if (data.elevFlag !== undefined && typeof data.elevFlag ===
|
|
1367
|
+
if (data.elevFlag !== undefined && typeof data.elevFlag === 'number') {
|
|
1501
1368
|
this.elevFlag = data.elevFlag as number;
|
|
1502
1369
|
}
|
|
1503
|
-
if (data.rhoCloud !== undefined && typeof data.rhoCloud ===
|
|
1370
|
+
if (data.rhoCloud !== undefined && typeof data.rhoCloud === 'number') {
|
|
1504
1371
|
this.rhoCloud = data.rhoCloud as number;
|
|
1505
1372
|
}
|
|
1506
|
-
if (data.liqTemp !== undefined && typeof data.liqTemp ===
|
|
1373
|
+
if (data.liqTemp !== undefined && typeof data.liqTemp === 'number') {
|
|
1507
1374
|
this.liqTemp = data.liqTemp as number;
|
|
1508
1375
|
}
|
|
1509
|
-
if (data.effectiveWidth !== undefined && typeof data.effectiveWidth ===
|
|
1376
|
+
if (data.effectiveWidth !== undefined && typeof data.effectiveWidth === 'number') {
|
|
1510
1377
|
this.effectiveWidth = data.effectiveWidth as number;
|
|
1511
1378
|
}
|
|
1512
|
-
if (data.effectiveHeight !== undefined && typeof data.effectiveHeight ===
|
|
1379
|
+
if (data.effectiveHeight !== undefined && typeof data.effectiveHeight === 'number') {
|
|
1513
1380
|
this.effectiveHeight = data.effectiveHeight as number;
|
|
1514
1381
|
}
|
|
1515
|
-
if (data.passTranDist !== undefined && typeof data.passTranDist ===
|
|
1382
|
+
if (data.passTranDist !== undefined && typeof data.passTranDist === 'number') {
|
|
1516
1383
|
this.passTranDist = data.passTranDist as number;
|
|
1517
1384
|
}
|
|
1518
|
-
if (data.downwindRadius !== undefined && typeof data.downwindRadius ===
|
|
1385
|
+
if (data.downwindRadius !== undefined && typeof data.downwindRadius === 'number') {
|
|
1519
1386
|
this.downwindRadius = data.downwindRadius as number;
|
|
1520
1387
|
}
|
|
1521
|
-
if (data.dropletDiameter !== undefined && typeof data.dropletDiameter ===
|
|
1388
|
+
if (data.dropletDiameter !== undefined && typeof data.dropletDiameter === 'number') {
|
|
1522
1389
|
this.dropletDiameter = data.dropletDiameter as number;
|
|
1523
1390
|
}
|
|
1524
|
-
if (data.dropletHeight !== undefined && typeof data.dropletHeight ===
|
|
1391
|
+
if (data.dropletHeight !== undefined && typeof data.dropletHeight === 'number') {
|
|
1525
1392
|
this.dropletHeight = data.dropletHeight as number;
|
|
1526
1393
|
}
|
|
1527
|
-
if (data.dropletDistance !== undefined && typeof data.dropletDistance ===
|
|
1394
|
+
if (data.dropletDistance !== undefined && typeof data.dropletDistance === 'number') {
|
|
1528
1395
|
this.dropletDistance = data.dropletDistance as number;
|
|
1529
1396
|
}
|
|
1530
|
-
if (data.mass !== undefined && typeof data.mass ===
|
|
1397
|
+
if (data.mass !== undefined && typeof data.mass === 'number') {
|
|
1531
1398
|
this.mass = data.mass as number;
|
|
1532
1399
|
}
|
|
1533
|
-
if (data.instCon !== undefined && (typeof data.instCon ===
|
|
1400
|
+
if (data.instCon !== undefined && (typeof data.instCon === 'string' || typeof data.instCon === 'number')) {
|
|
1534
1401
|
this.instCon = this.parseEnumValue(data.instCon, Enums.DynamicType);
|
|
1535
1402
|
}
|
|
1536
1403
|
}
|
|
1537
1404
|
|
|
1538
1405
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
1539
|
-
if (typeof value ===
|
|
1406
|
+
if (typeof value === 'string' && value in enumType) {
|
|
1540
1407
|
return enumType[value as keyof T];
|
|
1541
|
-
} else if (typeof value ===
|
|
1408
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
1542
1409
|
return value as T[keyof T];
|
|
1543
1410
|
}
|
|
1544
1411
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -1547,7 +1414,7 @@ export class DispersionRecord extends EntityBase {
|
|
|
1547
1414
|
toString() {
|
|
1548
1415
|
const parts = [
|
|
1549
1416
|
super.toString(),
|
|
1550
|
-
|
|
1417
|
+
'* DispersionRecord',
|
|
1551
1418
|
`observerIndex: ${this.observerIndex}`,
|
|
1552
1419
|
`centrelineConcentration: ${this.centrelineConcentration}`,
|
|
1553
1420
|
`downwindDistance: ${this.downwindDistance}`,
|
|
@@ -1578,7 +1445,7 @@ export class DispersionRecord extends EntityBase {
|
|
|
1578
1445
|
`mass: ${this.mass}`,
|
|
1579
1446
|
`instCon: ${this.instCon}`,
|
|
1580
1447
|
];
|
|
1581
|
-
return parts.join(
|
|
1448
|
+
return parts.join('\n');
|
|
1582
1449
|
}
|
|
1583
1450
|
}
|
|
1584
1451
|
|
|
@@ -1593,37 +1460,26 @@ export class ExplosionConfinedVolume extends EntityBase {
|
|
|
1593
1460
|
* @param {number} options.confinedStrength - The degree of confinement in the area or source, described by an integer between 3 (lowest) and 10 (highest). (default value is 7)
|
|
1594
1461
|
* @param {number} options.confinedVolume - The volume of the cloud that is contained in the area of confinement. [m3] (default value is 1)
|
|
1595
1462
|
*/
|
|
1596
|
-
constructor(options?: {
|
|
1597
|
-
id?: string;
|
|
1598
|
-
typeId?: string;
|
|
1599
|
-
displayName?: string;
|
|
1600
|
-
confinedStrength?: number;
|
|
1601
|
-
confinedVolume?: number;
|
|
1602
|
-
}) {
|
|
1463
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; confinedStrength?: number; confinedVolume?: number }) {
|
|
1603
1464
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1604
|
-
this.confinedStrength = options?.confinedStrength ?? 7;
|
|
1605
|
-
this.confinedVolume = options?.confinedVolume ?? 1;
|
|
1465
|
+
this.confinedStrength = options?.confinedStrength ?? 7;
|
|
1466
|
+
this.confinedVolume = options?.confinedVolume ?? 1;
|
|
1606
1467
|
}
|
|
1607
1468
|
|
|
1608
1469
|
/** Initialise the entity with data from a dictionary. */
|
|
1609
1470
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1610
1471
|
super.initialiseFromDictionary(data);
|
|
1611
|
-
if (data.confinedStrength !== undefined && typeof data.confinedStrength ===
|
|
1472
|
+
if (data.confinedStrength !== undefined && typeof data.confinedStrength === 'number') {
|
|
1612
1473
|
this.confinedStrength = data.confinedStrength as number;
|
|
1613
1474
|
}
|
|
1614
|
-
if (data.confinedVolume !== undefined && typeof data.confinedVolume ===
|
|
1475
|
+
if (data.confinedVolume !== undefined && typeof data.confinedVolume === 'number') {
|
|
1615
1476
|
this.confinedVolume = data.confinedVolume as number;
|
|
1616
1477
|
}
|
|
1617
1478
|
}
|
|
1618
1479
|
|
|
1619
1480
|
toString() {
|
|
1620
|
-
const parts = [
|
|
1621
|
-
|
|
1622
|
-
"* ExplosionConfinedVolume",
|
|
1623
|
-
`confinedStrength: ${this.confinedStrength}`,
|
|
1624
|
-
`confinedVolume: ${this.confinedVolume}`,
|
|
1625
|
-
];
|
|
1626
|
-
return parts.join("\n");
|
|
1481
|
+
const parts = [super.toString(), '* ExplosionConfinedVolume', `confinedStrength: ${this.confinedStrength}`, `confinedVolume: ${this.confinedVolume}`];
|
|
1482
|
+
return parts.join('\n');
|
|
1627
1483
|
}
|
|
1628
1484
|
}
|
|
1629
1485
|
|
|
@@ -1638,46 +1494,35 @@ export class ExplosionOutputConfig extends EntityBase {
|
|
|
1638
1494
|
* @param {number} options.overpressureLevel - Overpressure of interest for explosions. [N/m2] (default value is 2068)
|
|
1639
1495
|
* @param {Enums.MEConfinedMethod} options.meConfinedMethod - The multi energy confined method for modelling the effects of explosions. (default value is Enums.MEConfinedMethod.UNIFORM_CONFINED)
|
|
1640
1496
|
*/
|
|
1641
|
-
constructor(options?: {
|
|
1642
|
-
id?: string;
|
|
1643
|
-
typeId?: string;
|
|
1644
|
-
displayName?: string;
|
|
1645
|
-
overpressureLevel?: number;
|
|
1646
|
-
meConfinedMethod?: Enums.MEConfinedMethod;
|
|
1647
|
-
}) {
|
|
1497
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; overpressureLevel?: number; meConfinedMethod?: Enums.MEConfinedMethod }) {
|
|
1648
1498
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1649
|
-
this.overpressureLevel = options?.overpressureLevel ?? 2068;
|
|
1650
|
-
this.meConfinedMethod = options?.meConfinedMethod ?? Enums.MEConfinedMethod.UNIFORM_CONFINED;
|
|
1499
|
+
this.overpressureLevel = options?.overpressureLevel ?? 2068;
|
|
1500
|
+
this.meConfinedMethod = options?.meConfinedMethod ?? Enums.MEConfinedMethod.UNIFORM_CONFINED;
|
|
1651
1501
|
}
|
|
1652
1502
|
|
|
1653
1503
|
/** Initialise the entity with data from a dictionary. */
|
|
1654
1504
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1655
1505
|
super.initialiseFromDictionary(data);
|
|
1656
|
-
if (data.overpressureLevel !== undefined && typeof data.overpressureLevel ===
|
|
1506
|
+
if (data.overpressureLevel !== undefined && typeof data.overpressureLevel === 'number') {
|
|
1657
1507
|
this.overpressureLevel = data.overpressureLevel as number;
|
|
1658
1508
|
}
|
|
1659
|
-
if (data.meConfinedMethod !== undefined && (typeof data.meConfinedMethod ===
|
|
1509
|
+
if (data.meConfinedMethod !== undefined && (typeof data.meConfinedMethod === 'string' || typeof data.meConfinedMethod === 'number')) {
|
|
1660
1510
|
this.meConfinedMethod = this.parseEnumValue(data.meConfinedMethod, Enums.MEConfinedMethod);
|
|
1661
1511
|
}
|
|
1662
1512
|
}
|
|
1663
1513
|
|
|
1664
1514
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
1665
|
-
if (typeof value ===
|
|
1515
|
+
if (typeof value === 'string' && value in enumType) {
|
|
1666
1516
|
return enumType[value as keyof T];
|
|
1667
|
-
} else if (typeof value ===
|
|
1517
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
1668
1518
|
return value as T[keyof T];
|
|
1669
1519
|
}
|
|
1670
1520
|
return undefined; // Return undefined if the value does not match the enum
|
|
1671
1521
|
}
|
|
1672
1522
|
|
|
1673
1523
|
toString() {
|
|
1674
|
-
const parts = [
|
|
1675
|
-
|
|
1676
|
-
"* ExplosionOutputConfig",
|
|
1677
|
-
`overpressureLevel: ${this.overpressureLevel}`,
|
|
1678
|
-
`meConfinedMethod: ${this.meConfinedMethod}`,
|
|
1679
|
-
];
|
|
1680
|
-
return parts.join("\n");
|
|
1524
|
+
const parts = [super.toString(), '* ExplosionOutputConfig', `overpressureLevel: ${this.overpressureLevel}`, `meConfinedMethod: ${this.meConfinedMethod}`];
|
|
1525
|
+
return parts.join('\n');
|
|
1681
1526
|
}
|
|
1682
1527
|
}
|
|
1683
1528
|
|
|
@@ -1712,33 +1557,33 @@ export class ExplosionOverpressureResult extends EntityBase {
|
|
|
1712
1557
|
radius?: number;
|
|
1713
1558
|
}) {
|
|
1714
1559
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1715
|
-
this.overpressure = options?.overpressure;
|
|
1716
|
-
this.explosionCentre = options?.explosionCentre;
|
|
1717
|
-
this.maximumDistance = options?.maximumDistance;
|
|
1718
|
-
this.explodedMass = options?.explodedMass;
|
|
1719
|
-
this.ignitionTime = options?.ignitionTime;
|
|
1720
|
-
this.radius = options?.radius;
|
|
1560
|
+
this.overpressure = options?.overpressure;
|
|
1561
|
+
this.explosionCentre = options?.explosionCentre;
|
|
1562
|
+
this.maximumDistance = options?.maximumDistance;
|
|
1563
|
+
this.explodedMass = options?.explodedMass;
|
|
1564
|
+
this.ignitionTime = options?.ignitionTime;
|
|
1565
|
+
this.radius = options?.radius;
|
|
1721
1566
|
}
|
|
1722
1567
|
|
|
1723
1568
|
/** Initialise the entity with data from a dictionary. */
|
|
1724
1569
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1725
1570
|
super.initialiseFromDictionary(data);
|
|
1726
|
-
if (data.overpressure !== undefined && typeof data.overpressure ===
|
|
1571
|
+
if (data.overpressure !== undefined && typeof data.overpressure === 'number') {
|
|
1727
1572
|
this.overpressure = data.overpressure as number;
|
|
1728
1573
|
}
|
|
1729
|
-
if (data.explosionCentre !== undefined && typeof data.explosionCentre ===
|
|
1574
|
+
if (data.explosionCentre !== undefined && typeof data.explosionCentre === 'number') {
|
|
1730
1575
|
this.explosionCentre = data.explosionCentre as number;
|
|
1731
1576
|
}
|
|
1732
|
-
if (data.maximumDistance !== undefined && typeof data.maximumDistance ===
|
|
1577
|
+
if (data.maximumDistance !== undefined && typeof data.maximumDistance === 'number') {
|
|
1733
1578
|
this.maximumDistance = data.maximumDistance as number;
|
|
1734
1579
|
}
|
|
1735
|
-
if (data.explodedMass !== undefined && typeof data.explodedMass ===
|
|
1580
|
+
if (data.explodedMass !== undefined && typeof data.explodedMass === 'number') {
|
|
1736
1581
|
this.explodedMass = data.explodedMass as number;
|
|
1737
1582
|
}
|
|
1738
|
-
if (data.ignitionTime !== undefined && typeof data.ignitionTime ===
|
|
1583
|
+
if (data.ignitionTime !== undefined && typeof data.ignitionTime === 'number') {
|
|
1739
1584
|
this.ignitionTime = data.ignitionTime as number;
|
|
1740
1585
|
}
|
|
1741
|
-
if (data.radius !== undefined && typeof data.radius ===
|
|
1586
|
+
if (data.radius !== undefined && typeof data.radius === 'number') {
|
|
1742
1587
|
this.radius = data.radius as number;
|
|
1743
1588
|
}
|
|
1744
1589
|
}
|
|
@@ -1746,7 +1591,7 @@ export class ExplosionOverpressureResult extends EntityBase {
|
|
|
1746
1591
|
toString() {
|
|
1747
1592
|
const parts = [
|
|
1748
1593
|
super.toString(),
|
|
1749
|
-
|
|
1594
|
+
'* ExplosionOverpressureResult',
|
|
1750
1595
|
`overpressure: ${this.overpressure}`,
|
|
1751
1596
|
`explosionCentre: ${this.explosionCentre}`,
|
|
1752
1597
|
`maximumDistance: ${this.maximumDistance}`,
|
|
@@ -1754,7 +1599,7 @@ export class ExplosionOverpressureResult extends EntityBase {
|
|
|
1754
1599
|
`ignitionTime: ${this.ignitionTime}`,
|
|
1755
1600
|
`radius: ${this.radius}`,
|
|
1756
1601
|
];
|
|
1757
|
-
return parts.join(
|
|
1602
|
+
return parts.join('\n');
|
|
1758
1603
|
}
|
|
1759
1604
|
}
|
|
1760
1605
|
|
|
@@ -1767,31 +1612,22 @@ export class ExplosionParameters extends EntityBase {
|
|
|
1767
1612
|
* @param {Object} options - Initialisation options
|
|
1768
1613
|
* @param {number} options.explosionUniformStrength - The confined strength in the multi-energy uniform confined method. (default value is 10.0)
|
|
1769
1614
|
*/
|
|
1770
|
-
constructor(options?: {
|
|
1771
|
-
id?: string;
|
|
1772
|
-
typeId?: string;
|
|
1773
|
-
displayName?: string;
|
|
1774
|
-
explosionUniformStrength?: number;
|
|
1775
|
-
}) {
|
|
1615
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; explosionUniformStrength?: number }) {
|
|
1776
1616
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1777
|
-
this.explosionUniformStrength = options?.explosionUniformStrength ?? 10.0;
|
|
1617
|
+
this.explosionUniformStrength = options?.explosionUniformStrength ?? 10.0;
|
|
1778
1618
|
}
|
|
1779
1619
|
|
|
1780
1620
|
/** Initialise the entity with data from a dictionary. */
|
|
1781
1621
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1782
1622
|
super.initialiseFromDictionary(data);
|
|
1783
|
-
if (data.explosionUniformStrength !== undefined && typeof data.explosionUniformStrength ===
|
|
1623
|
+
if (data.explosionUniformStrength !== undefined && typeof data.explosionUniformStrength === 'number') {
|
|
1784
1624
|
this.explosionUniformStrength = data.explosionUniformStrength as number;
|
|
1785
1625
|
}
|
|
1786
1626
|
}
|
|
1787
1627
|
|
|
1788
1628
|
toString() {
|
|
1789
|
-
const parts = [
|
|
1790
|
-
|
|
1791
|
-
"* ExplosionParameters",
|
|
1792
|
-
`explosionUniformStrength: ${this.explosionUniformStrength}`,
|
|
1793
|
-
];
|
|
1794
|
-
return parts.join("\n");
|
|
1629
|
+
const parts = [super.toString(), '* ExplosionParameters', `explosionUniformStrength: ${this.explosionUniformStrength}`];
|
|
1630
|
+
return parts.join('\n');
|
|
1795
1631
|
}
|
|
1796
1632
|
}
|
|
1797
1633
|
|
|
@@ -1810,35 +1646,27 @@ export class FlameRecord extends EntityBase {
|
|
|
1810
1646
|
* @param {number} options.rCoordinate - The radius of the frustum base or tip. [m]
|
|
1811
1647
|
* @param {number} options.phiCoordinate - Inclination of the frustum base or tip from the vertical. [rad]
|
|
1812
1648
|
*/
|
|
1813
|
-
constructor(options?: {
|
|
1814
|
-
id?: string;
|
|
1815
|
-
typeId?: string;
|
|
1816
|
-
displayName?: string;
|
|
1817
|
-
xCoordinate?: number;
|
|
1818
|
-
zCoordinate?: number;
|
|
1819
|
-
rCoordinate?: number;
|
|
1820
|
-
phiCoordinate?: number;
|
|
1821
|
-
}) {
|
|
1649
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; xCoordinate?: number; zCoordinate?: number; rCoordinate?: number; phiCoordinate?: number }) {
|
|
1822
1650
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1823
|
-
this.xCoordinate = options?.xCoordinate;
|
|
1824
|
-
this.zCoordinate = options?.zCoordinate;
|
|
1825
|
-
this.rCoordinate = options?.rCoordinate;
|
|
1826
|
-
this.phiCoordinate = options?.phiCoordinate;
|
|
1651
|
+
this.xCoordinate = options?.xCoordinate;
|
|
1652
|
+
this.zCoordinate = options?.zCoordinate;
|
|
1653
|
+
this.rCoordinate = options?.rCoordinate;
|
|
1654
|
+
this.phiCoordinate = options?.phiCoordinate;
|
|
1827
1655
|
}
|
|
1828
1656
|
|
|
1829
1657
|
/** Initialise the entity with data from a dictionary. */
|
|
1830
1658
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1831
1659
|
super.initialiseFromDictionary(data);
|
|
1832
|
-
if (data.xCoordinate !== undefined && typeof data.xCoordinate ===
|
|
1660
|
+
if (data.xCoordinate !== undefined && typeof data.xCoordinate === 'number') {
|
|
1833
1661
|
this.xCoordinate = data.xCoordinate as number;
|
|
1834
1662
|
}
|
|
1835
|
-
if (data.zCoordinate !== undefined && typeof data.zCoordinate ===
|
|
1663
|
+
if (data.zCoordinate !== undefined && typeof data.zCoordinate === 'number') {
|
|
1836
1664
|
this.zCoordinate = data.zCoordinate as number;
|
|
1837
1665
|
}
|
|
1838
|
-
if (data.rCoordinate !== undefined && typeof data.rCoordinate ===
|
|
1666
|
+
if (data.rCoordinate !== undefined && typeof data.rCoordinate === 'number') {
|
|
1839
1667
|
this.rCoordinate = data.rCoordinate as number;
|
|
1840
1668
|
}
|
|
1841
|
-
if (data.phiCoordinate !== undefined && typeof data.phiCoordinate ===
|
|
1669
|
+
if (data.phiCoordinate !== undefined && typeof data.phiCoordinate === 'number') {
|
|
1842
1670
|
this.phiCoordinate = data.phiCoordinate as number;
|
|
1843
1671
|
}
|
|
1844
1672
|
}
|
|
@@ -1846,13 +1674,13 @@ export class FlameRecord extends EntityBase {
|
|
|
1846
1674
|
toString() {
|
|
1847
1675
|
const parts = [
|
|
1848
1676
|
super.toString(),
|
|
1849
|
-
|
|
1677
|
+
'* FlameRecord',
|
|
1850
1678
|
`xCoordinate: ${this.xCoordinate}`,
|
|
1851
1679
|
`zCoordinate: ${this.zCoordinate}`,
|
|
1852
1680
|
`rCoordinate: ${this.rCoordinate}`,
|
|
1853
1681
|
`phiCoordinate: ${this.phiCoordinate}`,
|
|
1854
1682
|
];
|
|
1855
|
-
return parts.join(
|
|
1683
|
+
return parts.join('\n');
|
|
1856
1684
|
}
|
|
1857
1685
|
}
|
|
1858
1686
|
|
|
@@ -1888,48 +1716,47 @@ export class FlameResult extends EntityBase {
|
|
|
1888
1716
|
fireType?: Enums.FireType;
|
|
1889
1717
|
liftOffHeight?: number;
|
|
1890
1718
|
liftOffTime?: number;
|
|
1891
|
-
|
|
1892
1719
|
}) {
|
|
1893
1720
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1894
|
-
this.time = options?.time;
|
|
1895
|
-
this.surfaceEmissivePower = options?.surfaceEmissivePower;
|
|
1896
|
-
this.flameLength = options?.flameLength;
|
|
1897
|
-
this.flameDiameter = options?.flameDiameter;
|
|
1721
|
+
this.time = options?.time;
|
|
1722
|
+
this.surfaceEmissivePower = options?.surfaceEmissivePower;
|
|
1723
|
+
this.flameLength = options?.flameLength;
|
|
1724
|
+
this.flameDiameter = options?.flameDiameter;
|
|
1898
1725
|
this.fireType = options?.fireType ?? Enums.FireType.NO_FIRE;
|
|
1899
|
-
this.liftOffHeight = options?.liftOffHeight;
|
|
1726
|
+
this.liftOffHeight = options?.liftOffHeight;
|
|
1900
1727
|
this.liftOffTime = options?.liftOffTime;
|
|
1901
1728
|
}
|
|
1902
1729
|
|
|
1903
1730
|
/** Initialise the entity with data from a dictionary. */
|
|
1904
1731
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1905
1732
|
super.initialiseFromDictionary(data);
|
|
1906
|
-
if (data.time !== undefined && typeof data.time ===
|
|
1733
|
+
if (data.time !== undefined && typeof data.time === 'number') {
|
|
1907
1734
|
this.time = data.time as number;
|
|
1908
1735
|
}
|
|
1909
|
-
if (data.surfaceEmissivePower !== undefined && typeof data.surfaceEmissivePower ===
|
|
1736
|
+
if (data.surfaceEmissivePower !== undefined && typeof data.surfaceEmissivePower === 'number') {
|
|
1910
1737
|
this.surfaceEmissivePower = data.surfaceEmissivePower as number;
|
|
1911
1738
|
}
|
|
1912
|
-
if (data.flameLength !== undefined && typeof data.flameLength ===
|
|
1739
|
+
if (data.flameLength !== undefined && typeof data.flameLength === 'number') {
|
|
1913
1740
|
this.flameLength = data.flameLength as number;
|
|
1914
1741
|
}
|
|
1915
|
-
if (data.flameDiameter !== undefined && typeof data.flameDiameter ===
|
|
1742
|
+
if (data.flameDiameter !== undefined && typeof data.flameDiameter === 'number') {
|
|
1916
1743
|
this.flameDiameter = data.flameDiameter as number;
|
|
1917
1744
|
}
|
|
1918
|
-
if (data.fireType !== undefined && (typeof data.fireType ===
|
|
1745
|
+
if (data.fireType !== undefined && (typeof data.fireType === 'string' || typeof data.fireType === 'number')) {
|
|
1919
1746
|
this.fireType = this.parseEnumValue(data.fireType, Enums.FireType);
|
|
1920
1747
|
}
|
|
1921
|
-
if (data.liftOffHeight !== undefined && typeof data.liftOffHeight ===
|
|
1748
|
+
if (data.liftOffHeight !== undefined && typeof data.liftOffHeight === 'number') {
|
|
1922
1749
|
this.liftOffHeight = data.liftOffHeight as number;
|
|
1923
1750
|
}
|
|
1924
|
-
if (data.liftOffTime !== undefined && typeof data.liftOffTime ===
|
|
1751
|
+
if (data.liftOffTime !== undefined && typeof data.liftOffTime === 'number') {
|
|
1925
1752
|
this.liftOffTime = data.liftOffTime as number;
|
|
1926
1753
|
}
|
|
1927
1754
|
}
|
|
1928
1755
|
|
|
1929
1756
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
1930
|
-
if (typeof value ===
|
|
1757
|
+
if (typeof value === 'string' && value in enumType) {
|
|
1931
1758
|
return enumType[value as keyof T];
|
|
1932
|
-
} else if (typeof value ===
|
|
1759
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
1933
1760
|
return value as T[keyof T];
|
|
1934
1761
|
}
|
|
1935
1762
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -1938,7 +1765,7 @@ export class FlameResult extends EntityBase {
|
|
|
1938
1765
|
toString() {
|
|
1939
1766
|
const parts = [
|
|
1940
1767
|
super.toString(),
|
|
1941
|
-
|
|
1768
|
+
'* FlameResult',
|
|
1942
1769
|
`time: ${this.time}`,
|
|
1943
1770
|
`surfaceEmissivePower: ${this.surfaceEmissivePower}`,
|
|
1944
1771
|
`flameLength: ${this.flameLength}`,
|
|
@@ -1947,7 +1774,7 @@ export class FlameResult extends EntityBase {
|
|
|
1947
1774
|
`liftOffHeight: ${this.liftOffHeight}`,
|
|
1948
1775
|
`liftOffTime: ${this.liftOffTime}`,
|
|
1949
1776
|
];
|
|
1950
|
-
return parts.join(
|
|
1777
|
+
return parts.join('\n');
|
|
1951
1778
|
}
|
|
1952
1779
|
}
|
|
1953
1780
|
|
|
@@ -1962,16 +1789,10 @@ export class Transect extends EntityBase {
|
|
|
1962
1789
|
* @param {LocalPosition} options.transectStartPoint - Cartesian coordinates of the start point of the transect.
|
|
1963
1790
|
* @param {LocalPosition} options.transectEndPoint - Cartesian coordinates of the end point of the transect.
|
|
1964
1791
|
*/
|
|
1965
|
-
constructor(options?: {
|
|
1966
|
-
id?: string;
|
|
1967
|
-
typeId?: string;
|
|
1968
|
-
displayName?: string;
|
|
1969
|
-
transectStartPoint?: LocalPosition;
|
|
1970
|
-
transectEndPoint?: LocalPosition;
|
|
1971
|
-
}) {
|
|
1792
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; transectStartPoint?: LocalPosition; transectEndPoint?: LocalPosition }) {
|
|
1972
1793
|
super(options?.id, options?.typeId, options?.displayName);
|
|
1973
|
-
this.transectStartPoint = options?.transectStartPoint ?? new LocalPosition();
|
|
1974
|
-
this.transectEndPoint = options?.transectEndPoint ?? new LocalPosition();
|
|
1794
|
+
this.transectStartPoint = options?.transectStartPoint ?? new LocalPosition();
|
|
1795
|
+
this.transectEndPoint = options?.transectEndPoint ?? new LocalPosition();
|
|
1975
1796
|
}
|
|
1976
1797
|
|
|
1977
1798
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -1988,13 +1809,8 @@ export class Transect extends EntityBase {
|
|
|
1988
1809
|
}
|
|
1989
1810
|
|
|
1990
1811
|
toString() {
|
|
1991
|
-
const parts = [
|
|
1992
|
-
|
|
1993
|
-
"* Transect",
|
|
1994
|
-
`transectStartPoint: ${this.transectStartPoint?.toString()}`,
|
|
1995
|
-
`transectEndPoint: ${this.transectEndPoint?.toString()}`,
|
|
1996
|
-
];
|
|
1997
|
-
return parts.join("\n");
|
|
1812
|
+
const parts = [super.toString(), '* Transect', `transectStartPoint: ${this.transectStartPoint?.toString()}`, `transectEndPoint: ${this.transectEndPoint?.toString()}`];
|
|
1813
|
+
return parts.join('\n');
|
|
1998
1814
|
}
|
|
1999
1815
|
}
|
|
2000
1816
|
|
|
@@ -2041,16 +1857,16 @@ export class FlammableOutputConfig extends EntityBase {
|
|
|
2041
1857
|
inclination?: number;
|
|
2042
1858
|
}) {
|
|
2043
1859
|
super(options?.id, options?.typeId, options?.displayName);
|
|
2044
|
-
this.position = options?.position ?? new LocalPosition();
|
|
2045
|
-
this.transect = options?.transect ?? new Transect();
|
|
2046
|
-
this.radiationType = options?.radiationType ?? Enums.RadiationType.INTENSITY;
|
|
2047
|
-
this.contourType = options?.contourType ?? Enums.ContourType.FOOTPRINT_ELLIPSE;
|
|
2048
|
-
this.radiationLevel = options?.radiationLevel ?? 4000;
|
|
2049
|
-
this.radiationResolution = options?.radiationResolution ?? Enums.Resolution.MEDIUM;
|
|
2050
|
-
this.fixedOrientation = options?.fixedOrientation ?? 0;
|
|
2051
|
-
this.orientation = options?.orientation ?? 0;
|
|
2052
|
-
this.fixedInclination = options?.fixedInclination ?? 0;
|
|
2053
|
-
this.inclination = options?.inclination ?? 0;
|
|
1860
|
+
this.position = options?.position ?? new LocalPosition();
|
|
1861
|
+
this.transect = options?.transect ?? new Transect();
|
|
1862
|
+
this.radiationType = options?.radiationType ?? Enums.RadiationType.INTENSITY;
|
|
1863
|
+
this.contourType = options?.contourType ?? Enums.ContourType.FOOTPRINT_ELLIPSE;
|
|
1864
|
+
this.radiationLevel = options?.radiationLevel ?? 4000;
|
|
1865
|
+
this.radiationResolution = options?.radiationResolution ?? Enums.Resolution.MEDIUM;
|
|
1866
|
+
this.fixedOrientation = options?.fixedOrientation ?? 0;
|
|
1867
|
+
this.orientation = options?.orientation ?? 0;
|
|
1868
|
+
this.fixedInclination = options?.fixedInclination ?? 0;
|
|
1869
|
+
this.inclination = options?.inclination ?? 0;
|
|
2054
1870
|
}
|
|
2055
1871
|
|
|
2056
1872
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -2064,36 +1880,36 @@ export class FlammableOutputConfig extends EntityBase {
|
|
|
2064
1880
|
this.transect = new Transect();
|
|
2065
1881
|
this.transect.initialiseFromDictionary(data.transect as { [key: string]: unknown });
|
|
2066
1882
|
}
|
|
2067
|
-
if (data.radiationType !== undefined && (typeof data.radiationType ===
|
|
1883
|
+
if (data.radiationType !== undefined && (typeof data.radiationType === 'string' || typeof data.radiationType === 'number')) {
|
|
2068
1884
|
this.radiationType = this.parseEnumValue(data.radiationType, Enums.RadiationType);
|
|
2069
1885
|
}
|
|
2070
|
-
if (data.contourType !== undefined && (typeof data.contourType ===
|
|
1886
|
+
if (data.contourType !== undefined && (typeof data.contourType === 'string' || typeof data.contourType === 'number')) {
|
|
2071
1887
|
this.contourType = this.parseEnumValue(data.contourType, Enums.ContourType);
|
|
2072
1888
|
}
|
|
2073
|
-
if (data.radiationLevel !== undefined && typeof data.radiationLevel ===
|
|
1889
|
+
if (data.radiationLevel !== undefined && typeof data.radiationLevel === 'number') {
|
|
2074
1890
|
this.radiationLevel = data.radiationLevel as number;
|
|
2075
1891
|
}
|
|
2076
|
-
if (data.radiationResolution !== undefined && (typeof data.radiationResolution ===
|
|
1892
|
+
if (data.radiationResolution !== undefined && (typeof data.radiationResolution === 'string' || typeof data.radiationResolution === 'number')) {
|
|
2077
1893
|
this.radiationResolution = this.parseEnumValue(data.radiationResolution, Enums.Resolution);
|
|
2078
1894
|
}
|
|
2079
|
-
if (data.fixedOrientation !== undefined && typeof data.fixedOrientation ===
|
|
1895
|
+
if (data.fixedOrientation !== undefined && typeof data.fixedOrientation === 'number') {
|
|
2080
1896
|
this.fixedOrientation = data.fixedOrientation as number;
|
|
2081
1897
|
}
|
|
2082
|
-
if (data.orientation !== undefined && typeof data.orientation ===
|
|
1898
|
+
if (data.orientation !== undefined && typeof data.orientation === 'number') {
|
|
2083
1899
|
this.orientation = data.orientation as number;
|
|
2084
1900
|
}
|
|
2085
|
-
if (data.fixedInclination !== undefined && typeof data.fixedInclination ===
|
|
1901
|
+
if (data.fixedInclination !== undefined && typeof data.fixedInclination === 'number') {
|
|
2086
1902
|
this.fixedInclination = data.fixedInclination as number;
|
|
2087
1903
|
}
|
|
2088
|
-
if (data.inclination !== undefined && typeof data.inclination ===
|
|
1904
|
+
if (data.inclination !== undefined && typeof data.inclination === 'number') {
|
|
2089
1905
|
this.inclination = data.inclination as number;
|
|
2090
1906
|
}
|
|
2091
1907
|
}
|
|
2092
1908
|
|
|
2093
1909
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
2094
|
-
if (typeof value ===
|
|
1910
|
+
if (typeof value === 'string' && value in enumType) {
|
|
2095
1911
|
return enumType[value as keyof T];
|
|
2096
|
-
} else if (typeof value ===
|
|
1912
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
2097
1913
|
return value as T[keyof T];
|
|
2098
1914
|
}
|
|
2099
1915
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -2102,7 +1918,7 @@ export class FlammableOutputConfig extends EntityBase {
|
|
|
2102
1918
|
toString() {
|
|
2103
1919
|
const parts = [
|
|
2104
1920
|
super.toString(),
|
|
2105
|
-
|
|
1921
|
+
'* FlammableOutputConfig',
|
|
2106
1922
|
`position: ${this.position?.toString()}`,
|
|
2107
1923
|
`transect: ${this.transect?.toString()}`,
|
|
2108
1924
|
`radiationType: ${this.radiationType}`,
|
|
@@ -2114,7 +1930,7 @@ export class FlammableOutputConfig extends EntityBase {
|
|
|
2114
1930
|
`fixedInclination: ${this.fixedInclination}`,
|
|
2115
1931
|
`inclination: ${this.inclination}`,
|
|
2116
1932
|
];
|
|
2117
|
-
return parts.join(
|
|
1933
|
+
return parts.join('\n');
|
|
2118
1934
|
}
|
|
2119
1935
|
}
|
|
2120
1936
|
|
|
@@ -2149,41 +1965,41 @@ export class FlammableParameters extends EntityBase {
|
|
|
2149
1965
|
timeOfInterest?: number;
|
|
2150
1966
|
}) {
|
|
2151
1967
|
super(options?.id, options?.typeId, options?.displayName);
|
|
2152
|
-
this.maxExposureDuration = options?.maxExposureDuration ?? 20;
|
|
2153
|
-
this.radiationRelativeTolerance = options?.radiationRelativeTolerance ?? 0.01;
|
|
2154
|
-
this.poolFireType = options?.poolFireType ?? Enums.PoolFireType.LATE;
|
|
2155
|
-
this.jetFireAutoSelect = options?.jetFireAutoSelect ?? false;
|
|
2156
|
-
this.timeAveraging = options?.timeAveraging ?? true;
|
|
2157
|
-
this.timeOfInterest = options?.timeOfInterest ?? 20;
|
|
1968
|
+
this.maxExposureDuration = options?.maxExposureDuration ?? 20;
|
|
1969
|
+
this.radiationRelativeTolerance = options?.radiationRelativeTolerance ?? 0.01;
|
|
1970
|
+
this.poolFireType = options?.poolFireType ?? Enums.PoolFireType.LATE;
|
|
1971
|
+
this.jetFireAutoSelect = options?.jetFireAutoSelect ?? false;
|
|
1972
|
+
this.timeAveraging = options?.timeAveraging ?? true;
|
|
1973
|
+
this.timeOfInterest = options?.timeOfInterest ?? 20;
|
|
2158
1974
|
}
|
|
2159
1975
|
|
|
2160
1976
|
/** Initialise the entity with data from a dictionary. */
|
|
2161
1977
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2162
1978
|
super.initialiseFromDictionary(data);
|
|
2163
|
-
if (data.maxExposureDuration !== undefined && typeof data.maxExposureDuration ===
|
|
1979
|
+
if (data.maxExposureDuration !== undefined && typeof data.maxExposureDuration === 'number') {
|
|
2164
1980
|
this.maxExposureDuration = data.maxExposureDuration as number;
|
|
2165
1981
|
}
|
|
2166
|
-
if (data.radiationRelativeTolerance !== undefined && typeof data.radiationRelativeTolerance ===
|
|
1982
|
+
if (data.radiationRelativeTolerance !== undefined && typeof data.radiationRelativeTolerance === 'number') {
|
|
2167
1983
|
this.radiationRelativeTolerance = data.radiationRelativeTolerance as number;
|
|
2168
1984
|
}
|
|
2169
|
-
if (data.poolFireType !== undefined && (typeof data.poolFireType ===
|
|
1985
|
+
if (data.poolFireType !== undefined && (typeof data.poolFireType === 'string' || typeof data.poolFireType === 'number')) {
|
|
2170
1986
|
this.poolFireType = this.parseEnumValue(data.poolFireType, Enums.PoolFireType);
|
|
2171
1987
|
}
|
|
2172
|
-
if (data.jetFireAutoSelect !== undefined && typeof data.jetFireAutoSelect ===
|
|
1988
|
+
if (data.jetFireAutoSelect !== undefined && typeof data.jetFireAutoSelect === 'boolean') {
|
|
2173
1989
|
this.jetFireAutoSelect = data.jetFireAutoSelect as boolean;
|
|
2174
1990
|
}
|
|
2175
|
-
if (data.timeAveraging !== undefined && typeof data.timeAveraging ===
|
|
1991
|
+
if (data.timeAveraging !== undefined && typeof data.timeAveraging === 'boolean') {
|
|
2176
1992
|
this.timeAveraging = data.timeAveraging as boolean;
|
|
2177
1993
|
}
|
|
2178
|
-
if (data.timeOfInterest !== undefined && typeof data.timeOfInterest ===
|
|
1994
|
+
if (data.timeOfInterest !== undefined && typeof data.timeOfInterest === 'number') {
|
|
2179
1995
|
this.timeOfInterest = data.timeOfInterest as number;
|
|
2180
1996
|
}
|
|
2181
1997
|
}
|
|
2182
1998
|
|
|
2183
1999
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
2184
|
-
if (typeof value ===
|
|
2000
|
+
if (typeof value === 'string' && value in enumType) {
|
|
2185
2001
|
return enumType[value as keyof T];
|
|
2186
|
-
} else if (typeof value ===
|
|
2002
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
2187
2003
|
return value as T[keyof T];
|
|
2188
2004
|
}
|
|
2189
2005
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -2192,7 +2008,7 @@ export class FlammableParameters extends EntityBase {
|
|
|
2192
2008
|
toString() {
|
|
2193
2009
|
const parts = [
|
|
2194
2010
|
super.toString(),
|
|
2195
|
-
|
|
2011
|
+
'* FlammableParameters',
|
|
2196
2012
|
`maxExposureDuration: ${this.maxExposureDuration}`,
|
|
2197
2013
|
`radiationRelativeTolerance: ${this.radiationRelativeTolerance}`,
|
|
2198
2014
|
`poolFireType: ${this.poolFireType}`,
|
|
@@ -2200,7 +2016,7 @@ export class FlammableParameters extends EntityBase {
|
|
|
2200
2016
|
`timeAveraging: ${this.timeAveraging}`,
|
|
2201
2017
|
`timeOfInterest: ${this.timeOfInterest}`,
|
|
2202
2018
|
];
|
|
2203
|
-
return parts.join(
|
|
2019
|
+
return parts.join('\n');
|
|
2204
2020
|
}
|
|
2205
2021
|
}
|
|
2206
2022
|
|
|
@@ -2265,81 +2081,81 @@ export class FlashResult extends EntityBase {
|
|
|
2265
2081
|
fluidPhase?: Enums.Phase;
|
|
2266
2082
|
}) {
|
|
2267
2083
|
super(options?.id, options?.typeId, options?.displayName);
|
|
2268
|
-
this.pressure = options?.pressure;
|
|
2269
|
-
this.temperature = options?.temperature;
|
|
2270
|
-
this.liquidMoleFraction = options?.liquidMoleFraction;
|
|
2271
|
-
this.liquidDensity = options?.liquidDensity;
|
|
2272
|
-
this.vapourDensity = options?.vapourDensity;
|
|
2273
|
-
this.liquidEntropy = options?.liquidEntropy;
|
|
2274
|
-
this.vapourEntropy = options?.vapourEntropy;
|
|
2275
|
-
this.liquidEnthalpy = options?.liquidEnthalpy;
|
|
2276
|
-
this.vapourEnthalpy = options?.vapourEnthalpy;
|
|
2277
|
-
this.bubblePointPressure = options?.bubblePointPressure;
|
|
2278
|
-
this.bubblePointTemperature = options?.bubblePointTemperature;
|
|
2279
|
-
this.dewPointPressure = options?.dewPointPressure;
|
|
2280
|
-
this.dewPointTemperature = options?.dewPointTemperature;
|
|
2281
|
-
this.totalFluidDensity = options?.totalFluidDensity;
|
|
2282
|
-
this.liquidMassFraction = options?.liquidMassFraction;
|
|
2283
|
-
this.fluidPhase = options?.fluidPhase ?? Enums.Phase.UNSET;
|
|
2084
|
+
this.pressure = options?.pressure;
|
|
2085
|
+
this.temperature = options?.temperature;
|
|
2086
|
+
this.liquidMoleFraction = options?.liquidMoleFraction;
|
|
2087
|
+
this.liquidDensity = options?.liquidDensity;
|
|
2088
|
+
this.vapourDensity = options?.vapourDensity;
|
|
2089
|
+
this.liquidEntropy = options?.liquidEntropy;
|
|
2090
|
+
this.vapourEntropy = options?.vapourEntropy;
|
|
2091
|
+
this.liquidEnthalpy = options?.liquidEnthalpy;
|
|
2092
|
+
this.vapourEnthalpy = options?.vapourEnthalpy;
|
|
2093
|
+
this.bubblePointPressure = options?.bubblePointPressure;
|
|
2094
|
+
this.bubblePointTemperature = options?.bubblePointTemperature;
|
|
2095
|
+
this.dewPointPressure = options?.dewPointPressure;
|
|
2096
|
+
this.dewPointTemperature = options?.dewPointTemperature;
|
|
2097
|
+
this.totalFluidDensity = options?.totalFluidDensity;
|
|
2098
|
+
this.liquidMassFraction = options?.liquidMassFraction;
|
|
2099
|
+
this.fluidPhase = options?.fluidPhase ?? Enums.Phase.UNSET;
|
|
2284
2100
|
}
|
|
2285
2101
|
|
|
2286
2102
|
/** Initialise the entity with data from a dictionary. */
|
|
2287
2103
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2288
2104
|
super.initialiseFromDictionary(data);
|
|
2289
|
-
if (data.pressure !== undefined && typeof data.pressure ===
|
|
2105
|
+
if (data.pressure !== undefined && typeof data.pressure === 'number') {
|
|
2290
2106
|
this.pressure = data.pressure as number;
|
|
2291
2107
|
}
|
|
2292
|
-
if (data.temperature !== undefined && typeof data.temperature ===
|
|
2108
|
+
if (data.temperature !== undefined && typeof data.temperature === 'number') {
|
|
2293
2109
|
this.temperature = data.temperature as number;
|
|
2294
2110
|
}
|
|
2295
|
-
if (data.liquidMoleFraction !== undefined && typeof data.liquidMoleFraction ===
|
|
2111
|
+
if (data.liquidMoleFraction !== undefined && typeof data.liquidMoleFraction === 'number') {
|
|
2296
2112
|
this.liquidMoleFraction = data.liquidMoleFraction as number;
|
|
2297
2113
|
}
|
|
2298
|
-
if (data.liquidDensity !== undefined && typeof data.liquidDensity ===
|
|
2114
|
+
if (data.liquidDensity !== undefined && typeof data.liquidDensity === 'number') {
|
|
2299
2115
|
this.liquidDensity = data.liquidDensity as number;
|
|
2300
2116
|
}
|
|
2301
|
-
if (data.vapourDensity !== undefined && typeof data.vapourDensity ===
|
|
2117
|
+
if (data.vapourDensity !== undefined && typeof data.vapourDensity === 'number') {
|
|
2302
2118
|
this.vapourDensity = data.vapourDensity as number;
|
|
2303
2119
|
}
|
|
2304
|
-
if (data.liquidEntropy !== undefined && typeof data.liquidEntropy ===
|
|
2120
|
+
if (data.liquidEntropy !== undefined && typeof data.liquidEntropy === 'number') {
|
|
2305
2121
|
this.liquidEntropy = data.liquidEntropy as number;
|
|
2306
2122
|
}
|
|
2307
|
-
if (data.vapourEntropy !== undefined && typeof data.vapourEntropy ===
|
|
2123
|
+
if (data.vapourEntropy !== undefined && typeof data.vapourEntropy === 'number') {
|
|
2308
2124
|
this.vapourEntropy = data.vapourEntropy as number;
|
|
2309
2125
|
}
|
|
2310
|
-
if (data.liquidEnthalpy !== undefined && typeof data.liquidEnthalpy ===
|
|
2126
|
+
if (data.liquidEnthalpy !== undefined && typeof data.liquidEnthalpy === 'number') {
|
|
2311
2127
|
this.liquidEnthalpy = data.liquidEnthalpy as number;
|
|
2312
2128
|
}
|
|
2313
|
-
if (data.vapourEnthalpy !== undefined && typeof data.vapourEnthalpy ===
|
|
2129
|
+
if (data.vapourEnthalpy !== undefined && typeof data.vapourEnthalpy === 'number') {
|
|
2314
2130
|
this.vapourEnthalpy = data.vapourEnthalpy as number;
|
|
2315
2131
|
}
|
|
2316
|
-
if (data.bubblePointPressure !== undefined && typeof data.bubblePointPressure ===
|
|
2132
|
+
if (data.bubblePointPressure !== undefined && typeof data.bubblePointPressure === 'number') {
|
|
2317
2133
|
this.bubblePointPressure = data.bubblePointPressure as number;
|
|
2318
2134
|
}
|
|
2319
|
-
if (data.bubblePointTemperature !== undefined && typeof data.bubblePointTemperature ===
|
|
2135
|
+
if (data.bubblePointTemperature !== undefined && typeof data.bubblePointTemperature === 'number') {
|
|
2320
2136
|
this.bubblePointTemperature = data.bubblePointTemperature as number;
|
|
2321
2137
|
}
|
|
2322
|
-
if (data.dewPointPressure !== undefined && typeof data.dewPointPressure ===
|
|
2138
|
+
if (data.dewPointPressure !== undefined && typeof data.dewPointPressure === 'number') {
|
|
2323
2139
|
this.dewPointPressure = data.dewPointPressure as number;
|
|
2324
2140
|
}
|
|
2325
|
-
if (data.dewPointTemperature !== undefined && typeof data.dewPointTemperature ===
|
|
2141
|
+
if (data.dewPointTemperature !== undefined && typeof data.dewPointTemperature === 'number') {
|
|
2326
2142
|
this.dewPointTemperature = data.dewPointTemperature as number;
|
|
2327
2143
|
}
|
|
2328
|
-
if (data.totalFluidDensity !== undefined && typeof data.totalFluidDensity ===
|
|
2144
|
+
if (data.totalFluidDensity !== undefined && typeof data.totalFluidDensity === 'number') {
|
|
2329
2145
|
this.totalFluidDensity = data.totalFluidDensity as number;
|
|
2330
2146
|
}
|
|
2331
|
-
if (data.liquidMassFraction !== undefined && typeof data.liquidMassFraction ===
|
|
2147
|
+
if (data.liquidMassFraction !== undefined && typeof data.liquidMassFraction === 'number') {
|
|
2332
2148
|
this.liquidMassFraction = data.liquidMassFraction as number;
|
|
2333
2149
|
}
|
|
2334
|
-
if (data.fluidPhase !== undefined && (typeof data.fluidPhase ===
|
|
2150
|
+
if (data.fluidPhase !== undefined && (typeof data.fluidPhase === 'string' || typeof data.fluidPhase === 'number')) {
|
|
2335
2151
|
this.fluidPhase = this.parseEnumValue(data.fluidPhase, Enums.Phase);
|
|
2336
2152
|
}
|
|
2337
2153
|
}
|
|
2338
2154
|
|
|
2339
2155
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
2340
|
-
if (typeof value ===
|
|
2156
|
+
if (typeof value === 'string' && value in enumType) {
|
|
2341
2157
|
return enumType[value as keyof T];
|
|
2342
|
-
} else if (typeof value ===
|
|
2158
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
2343
2159
|
return value as T[keyof T];
|
|
2344
2160
|
}
|
|
2345
2161
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -2348,7 +2164,7 @@ export class FlashResult extends EntityBase {
|
|
|
2348
2164
|
toString() {
|
|
2349
2165
|
const parts = [
|
|
2350
2166
|
super.toString(),
|
|
2351
|
-
|
|
2167
|
+
'* FlashResult',
|
|
2352
2168
|
`pressure: ${this.pressure}`,
|
|
2353
2169
|
`temperature: ${this.temperature}`,
|
|
2354
2170
|
`liquidMoleFraction: ${this.liquidMoleFraction}`,
|
|
@@ -2366,7 +2182,7 @@ export class FlashResult extends EntityBase {
|
|
|
2366
2182
|
`liquidMassFraction: ${this.liquidMassFraction}`,
|
|
2367
2183
|
`fluidPhase: ${this.fluidPhase}`,
|
|
2368
2184
|
];
|
|
2369
|
-
return parts.join(
|
|
2185
|
+
return parts.join('\n');
|
|
2370
2186
|
}
|
|
2371
2187
|
}
|
|
2372
2188
|
|
|
@@ -2396,21 +2212,21 @@ export class Leak extends ReleaseOverTime {
|
|
|
2396
2212
|
releaseElevation?: number;
|
|
2397
2213
|
}) {
|
|
2398
2214
|
super(options);
|
|
2399
|
-
this.holeDiameter = options?.holeDiameter;
|
|
2400
|
-
this.holeHeightFraction = options?.holeHeightFraction ?? 0.5;
|
|
2401
|
-
this.releaseElevation = options?.releaseElevation ?? 1;
|
|
2215
|
+
this.holeDiameter = options?.holeDiameter;
|
|
2216
|
+
this.holeHeightFraction = options?.holeHeightFraction ?? 0.5;
|
|
2217
|
+
this.releaseElevation = options?.releaseElevation ?? 1;
|
|
2402
2218
|
}
|
|
2403
2219
|
|
|
2404
2220
|
/** Initialise the entity with data from a dictionary. */
|
|
2405
2221
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2406
2222
|
super.initialiseFromDictionary(data);
|
|
2407
|
-
if (data.holeDiameter !== undefined && typeof data.holeDiameter ===
|
|
2223
|
+
if (data.holeDiameter !== undefined && typeof data.holeDiameter === 'number') {
|
|
2408
2224
|
this.holeDiameter = data.holeDiameter as number;
|
|
2409
2225
|
}
|
|
2410
|
-
if (data.holeHeightFraction !== undefined && typeof data.holeHeightFraction ===
|
|
2226
|
+
if (data.holeHeightFraction !== undefined && typeof data.holeHeightFraction === 'number') {
|
|
2411
2227
|
this.holeHeightFraction = data.holeHeightFraction as number;
|
|
2412
2228
|
}
|
|
2413
|
-
if (data.releaseElevation !== undefined && typeof data.releaseElevation ===
|
|
2229
|
+
if (data.releaseElevation !== undefined && typeof data.releaseElevation === 'number') {
|
|
2414
2230
|
this.releaseElevation = data.releaseElevation as number;
|
|
2415
2231
|
}
|
|
2416
2232
|
}
|
|
@@ -2418,14 +2234,14 @@ export class Leak extends ReleaseOverTime {
|
|
|
2418
2234
|
toString() {
|
|
2419
2235
|
const parts = [
|
|
2420
2236
|
super.toString(),
|
|
2421
|
-
|
|
2237
|
+
'* Leak',
|
|
2422
2238
|
`holeDiameter: ${this.holeDiameter}`,
|
|
2423
2239
|
`releaseAngle: ${this.releaseAngle}`,
|
|
2424
2240
|
`timeVaryingOption: ${this.timeVaryingOption}`,
|
|
2425
2241
|
`holeHeightFraction: ${this.holeHeightFraction}`,
|
|
2426
2242
|
`releaseElevation: ${this.releaseElevation}`,
|
|
2427
2243
|
];
|
|
2428
|
-
return parts.join(
|
|
2244
|
+
return parts.join('\n');
|
|
2429
2245
|
}
|
|
2430
2246
|
}
|
|
2431
2247
|
|
|
@@ -2458,25 +2274,25 @@ export class LineRupture extends ReleaseOverTime {
|
|
|
2458
2274
|
pipeHeightFraction?: number;
|
|
2459
2275
|
}) {
|
|
2460
2276
|
super(options);
|
|
2461
|
-
this.pipeDiameter = options?.pipeDiameter;
|
|
2462
|
-
this.pipeLength = options?.pipeLength;
|
|
2463
|
-
this.pipeRoughness = options?.pipeRoughness ?? 0.000045;
|
|
2464
|
-
this.pipeHeightFraction = options?.pipeHeightFraction ?? 0.5;
|
|
2277
|
+
this.pipeDiameter = options?.pipeDiameter;
|
|
2278
|
+
this.pipeLength = options?.pipeLength;
|
|
2279
|
+
this.pipeRoughness = options?.pipeRoughness ?? 0.000045;
|
|
2280
|
+
this.pipeHeightFraction = options?.pipeHeightFraction ?? 0.5;
|
|
2465
2281
|
}
|
|
2466
2282
|
|
|
2467
2283
|
/** Initialise the entity with data from a dictionary. */
|
|
2468
2284
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2469
2285
|
super.initialiseFromDictionary(data);
|
|
2470
|
-
if (data.pipeDiameter !== undefined && typeof data.pipeDiameter ===
|
|
2286
|
+
if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === 'number') {
|
|
2471
2287
|
this.pipeDiameter = data.pipeDiameter as number;
|
|
2472
2288
|
}
|
|
2473
|
-
if (data.pipeLength !== undefined && typeof data.pipeLength ===
|
|
2289
|
+
if (data.pipeLength !== undefined && typeof data.pipeLength === 'number') {
|
|
2474
2290
|
this.pipeLength = data.pipeLength as number;
|
|
2475
2291
|
}
|
|
2476
|
-
if (data.pipeRoughness !== undefined && typeof data.pipeRoughness ===
|
|
2292
|
+
if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === 'number') {
|
|
2477
2293
|
this.pipeRoughness = data.pipeRoughness as number;
|
|
2478
2294
|
}
|
|
2479
|
-
if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction ===
|
|
2295
|
+
if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === 'number') {
|
|
2480
2296
|
this.pipeHeightFraction = data.pipeHeightFraction as number;
|
|
2481
2297
|
}
|
|
2482
2298
|
}
|
|
@@ -2484,7 +2300,7 @@ export class LineRupture extends ReleaseOverTime {
|
|
|
2484
2300
|
toString() {
|
|
2485
2301
|
const parts = [
|
|
2486
2302
|
super.toString(),
|
|
2487
|
-
|
|
2303
|
+
'* LineRupture',
|
|
2488
2304
|
`pipeDiameter: ${this.pipeDiameter}`,
|
|
2489
2305
|
`pipeLength: ${this.pipeLength}`,
|
|
2490
2306
|
`releaseAngle: ${this.releaseAngle}`,
|
|
@@ -2492,7 +2308,7 @@ export class LineRupture extends ReleaseOverTime {
|
|
|
2492
2308
|
`pipeRoughness: ${this.pipeRoughness}`,
|
|
2493
2309
|
`pipeHeightFraction: ${this.pipeHeightFraction}`,
|
|
2494
2310
|
];
|
|
2495
|
-
return parts.join(
|
|
2311
|
+
return parts.join('\n');
|
|
2496
2312
|
}
|
|
2497
2313
|
}
|
|
2498
2314
|
|
|
@@ -2530,19 +2346,19 @@ export class MaterialComponentDataItem extends EntityBase {
|
|
|
2530
2346
|
fractionTc?: number;
|
|
2531
2347
|
}) {
|
|
2532
2348
|
super(options?.id, options?.typeId, options?.displayName);
|
|
2533
|
-
this.equationNumber = options?.equationNumber;
|
|
2534
|
-
this.equationCoefficients = options?.equationCoefficients;
|
|
2535
|
-
this.calculationLimits = options?.calculationLimits;
|
|
2536
|
-
this.description = options?.description ??
|
|
2537
|
-
this.equationString = options?.equationString ??
|
|
2538
|
-
this.supercriticalExtrapolation = options?.supercriticalExtrapolation ?? 0;
|
|
2539
|
-
this.fractionTc = options?.fractionTc ?? 1;
|
|
2349
|
+
this.equationNumber = options?.equationNumber;
|
|
2350
|
+
this.equationCoefficients = options?.equationCoefficients;
|
|
2351
|
+
this.calculationLimits = options?.calculationLimits;
|
|
2352
|
+
this.description = options?.description ?? '';
|
|
2353
|
+
this.equationString = options?.equationString ?? '';
|
|
2354
|
+
this.supercriticalExtrapolation = options?.supercriticalExtrapolation ?? 0;
|
|
2355
|
+
this.fractionTc = options?.fractionTc ?? 1;
|
|
2540
2356
|
}
|
|
2541
2357
|
|
|
2542
2358
|
/** Initialise the entity with data from a dictionary. */
|
|
2543
2359
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2544
2360
|
super.initialiseFromDictionary(data);
|
|
2545
|
-
if (data.equationNumber !== undefined && typeof data.equationNumber ===
|
|
2361
|
+
if (data.equationNumber !== undefined && typeof data.equationNumber === 'number') {
|
|
2546
2362
|
this.equationNumber = data.equationNumber as number;
|
|
2547
2363
|
}
|
|
2548
2364
|
if (data.equationCoefficients && Array.isArray(data.equationCoefficients)) {
|
|
@@ -2551,16 +2367,16 @@ export class MaterialComponentDataItem extends EntityBase {
|
|
|
2551
2367
|
if (data.calculationLimits && Array.isArray(data.calculationLimits)) {
|
|
2552
2368
|
this.calculationLimits = (data.calculationLimits ?? []).map((item) => parseFloat(item));
|
|
2553
2369
|
}
|
|
2554
|
-
if (data.description !== undefined && typeof data.description ===
|
|
2370
|
+
if (data.description !== undefined && typeof data.description === 'string') {
|
|
2555
2371
|
this.description = data.description as string;
|
|
2556
2372
|
}
|
|
2557
|
-
if (data.equationString !== undefined && typeof data.equationString ===
|
|
2373
|
+
if (data.equationString !== undefined && typeof data.equationString === 'string') {
|
|
2558
2374
|
this.equationString = data.equationString as string;
|
|
2559
2375
|
}
|
|
2560
|
-
if (data.supercriticalExtrapolation !== undefined && typeof data.supercriticalExtrapolation ===
|
|
2376
|
+
if (data.supercriticalExtrapolation !== undefined && typeof data.supercriticalExtrapolation === 'number') {
|
|
2561
2377
|
this.supercriticalExtrapolation = data.supercriticalExtrapolation as number;
|
|
2562
2378
|
}
|
|
2563
|
-
if (data.fractionTc !== undefined && typeof data.fractionTc ===
|
|
2379
|
+
if (data.fractionTc !== undefined && typeof data.fractionTc === 'number') {
|
|
2564
2380
|
this.fractionTc = data.fractionTc as number;
|
|
2565
2381
|
}
|
|
2566
2382
|
}
|
|
@@ -2568,16 +2384,16 @@ export class MaterialComponentDataItem extends EntityBase {
|
|
|
2568
2384
|
toString() {
|
|
2569
2385
|
const parts = [
|
|
2570
2386
|
super.toString(),
|
|
2571
|
-
|
|
2387
|
+
'* MaterialComponentDataItem',
|
|
2572
2388
|
`equationNumber: ${this.equationNumber}`,
|
|
2573
|
-
this.equationCoefficients?.map((item) => item?.toString()).join(
|
|
2574
|
-
this.calculationLimits?.map((item) => item?.toString()).join(
|
|
2389
|
+
this.equationCoefficients?.map((item) => item?.toString()).join('\n'),
|
|
2390
|
+
this.calculationLimits?.map((item) => item?.toString()).join('\n'),
|
|
2575
2391
|
`description: ${this.description}`,
|
|
2576
2392
|
`equationString: ${this.equationString}`,
|
|
2577
2393
|
`supercriticalExtrapolation: ${this.supercriticalExtrapolation}`,
|
|
2578
2394
|
`fractionTc: ${this.fractionTc}`,
|
|
2579
2395
|
];
|
|
2580
|
-
return parts.join(
|
|
2396
|
+
return parts.join('\n');
|
|
2581
2397
|
}
|
|
2582
2398
|
}
|
|
2583
2399
|
|
|
@@ -2596,41 +2412,31 @@ export class MaterialComponentData extends EntityBase {
|
|
|
2596
2412
|
* @param {number} options.casId - CAS id.
|
|
2597
2413
|
* @param {MaterialComponentDataItem[]} options.dataItem - List of data items defining the material component data.
|
|
2598
2414
|
*/
|
|
2599
|
-
constructor(options?: {
|
|
2600
|
-
id?: string;
|
|
2601
|
-
typeId?: string;
|
|
2602
|
-
displayName?: string;
|
|
2603
|
-
name?: string;
|
|
2604
|
-
dipprVersion?: number;
|
|
2605
|
-
casId?: number;
|
|
2606
|
-
dataItem?: MaterialComponentDataItem[];
|
|
2607
|
-
}) {
|
|
2415
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; name?: string; dipprVersion?: number; casId?: number; dataItem?: MaterialComponentDataItem[] }) {
|
|
2608
2416
|
super(options?.id, options?.typeId, options?.displayName);
|
|
2609
|
-
this.dipprVersion = options?.dipprVersion;
|
|
2610
|
-
this.casId = options?.casId;
|
|
2611
|
-
this.dataItem = options?.dataItem ?? [new MaterialComponentDataItem()];
|
|
2612
|
-
this.name = options?.name ??
|
|
2417
|
+
this.dipprVersion = options?.dipprVersion;
|
|
2418
|
+
this.casId = options?.casId;
|
|
2419
|
+
this.dataItem = options?.dataItem ?? [new MaterialComponentDataItem()];
|
|
2420
|
+
this.name = options?.name ?? '';
|
|
2613
2421
|
}
|
|
2614
2422
|
|
|
2615
2423
|
/** Initialise the entity with data from a dictionary. */
|
|
2616
2424
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2617
2425
|
super.initialiseFromDictionary(data);
|
|
2618
|
-
if (data.dipprVersion !== undefined && typeof data.dipprVersion ===
|
|
2426
|
+
if (data.dipprVersion !== undefined && typeof data.dipprVersion === 'number') {
|
|
2619
2427
|
this.dipprVersion = data.dipprVersion as number;
|
|
2620
2428
|
}
|
|
2621
|
-
if (data.casId !== undefined && typeof data.casId ===
|
|
2429
|
+
if (data.casId !== undefined && typeof data.casId === 'number') {
|
|
2622
2430
|
this.casId = data.casId as number;
|
|
2623
2431
|
}
|
|
2624
2432
|
if (data.dataItem && Array.isArray(data.dataItem)) {
|
|
2625
|
-
this.dataItem = data.dataItem.map(
|
|
2626
|
-
(
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
}
|
|
2633
|
-
if (data.name !== undefined && typeof data.name === "string") {
|
|
2433
|
+
this.dataItem = data.dataItem.map((item) => {
|
|
2434
|
+
const record = new MaterialComponentDataItem();
|
|
2435
|
+
record.initialiseFromDictionary(item);
|
|
2436
|
+
return record;
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
if (data.name !== undefined && typeof data.name === 'string') {
|
|
2634
2440
|
this.name = data.name as string;
|
|
2635
2441
|
}
|
|
2636
2442
|
}
|
|
@@ -2638,13 +2444,13 @@ export class MaterialComponentData extends EntityBase {
|
|
|
2638
2444
|
toString() {
|
|
2639
2445
|
const parts = [
|
|
2640
2446
|
super.toString(),
|
|
2641
|
-
|
|
2447
|
+
'* MaterialComponentData',
|
|
2642
2448
|
`dipprVersion: ${this.dipprVersion}`,
|
|
2643
2449
|
`casId: ${this.casId}`,
|
|
2644
|
-
this.dataItem?.map((item) => item?.toString()).join(
|
|
2450
|
+
this.dataItem?.map((item) => item?.toString()).join('\n'),
|
|
2645
2451
|
`name: ${this.name}`,
|
|
2646
2452
|
];
|
|
2647
|
-
return parts.join(
|
|
2453
|
+
return parts.join('\n');
|
|
2648
2454
|
}
|
|
2649
2455
|
}
|
|
2650
2456
|
|
|
@@ -2709,81 +2515,81 @@ export class MixtureConstantPropertiesResult extends EntityBase {
|
|
|
2709
2515
|
luminousSmokyFlame?: Enums.LuminousSmokyFlame;
|
|
2710
2516
|
}) {
|
|
2711
2517
|
super(options?.id, options?.typeId, options?.displayName);
|
|
2712
|
-
this.lowerFlammabilityLimit = options?.lowerFlammabilityLimit;
|
|
2713
|
-
this.upperFlammabilityLimit = options?.upperFlammabilityLimit;
|
|
2714
|
-
this.criticalPressure = options?.criticalPressure;
|
|
2715
|
-
this.criticalTemperature = options?.criticalTemperature;
|
|
2716
|
-
this.flashPoint = options?.flashPoint;
|
|
2717
|
-
this.heatCombustion = options?.heatCombustion;
|
|
2718
|
-
this.maximumBurnRate = options?.maximumBurnRate;
|
|
2719
|
-
this.maximumSEP = options?.maximumSEP;
|
|
2720
|
-
this.molecularWeight = options?.molecularWeight;
|
|
2721
|
-
this.bubblePoint = options?.bubblePoint;
|
|
2722
|
-
this.poolFireBurnRateLength = options?.poolFireBurnRateLength;
|
|
2723
|
-
this.dewPoint = options?.dewPoint;
|
|
2724
|
-
this.emissivePowerLengthScale = options?.emissivePowerLengthScale;
|
|
2725
|
-
this.laminarBurningVelocity = options?.laminarBurningVelocity;
|
|
2726
|
-
this.flammableToxicFlag = options?.flammableToxicFlag ?? Enums.FlammableToxic.INERT;
|
|
2727
|
-
this.luminousSmokyFlame = options?.luminousSmokyFlame ?? Enums.LuminousSmokyFlame.GENERAL;
|
|
2518
|
+
this.lowerFlammabilityLimit = options?.lowerFlammabilityLimit;
|
|
2519
|
+
this.upperFlammabilityLimit = options?.upperFlammabilityLimit;
|
|
2520
|
+
this.criticalPressure = options?.criticalPressure;
|
|
2521
|
+
this.criticalTemperature = options?.criticalTemperature;
|
|
2522
|
+
this.flashPoint = options?.flashPoint;
|
|
2523
|
+
this.heatCombustion = options?.heatCombustion;
|
|
2524
|
+
this.maximumBurnRate = options?.maximumBurnRate;
|
|
2525
|
+
this.maximumSEP = options?.maximumSEP;
|
|
2526
|
+
this.molecularWeight = options?.molecularWeight;
|
|
2527
|
+
this.bubblePoint = options?.bubblePoint;
|
|
2528
|
+
this.poolFireBurnRateLength = options?.poolFireBurnRateLength;
|
|
2529
|
+
this.dewPoint = options?.dewPoint;
|
|
2530
|
+
this.emissivePowerLengthScale = options?.emissivePowerLengthScale;
|
|
2531
|
+
this.laminarBurningVelocity = options?.laminarBurningVelocity;
|
|
2532
|
+
this.flammableToxicFlag = options?.flammableToxicFlag ?? Enums.FlammableToxic.INERT;
|
|
2533
|
+
this.luminousSmokyFlame = options?.luminousSmokyFlame ?? Enums.LuminousSmokyFlame.GENERAL;
|
|
2728
2534
|
}
|
|
2729
2535
|
|
|
2730
2536
|
/** Initialise the entity with data from a dictionary. */
|
|
2731
2537
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2732
2538
|
super.initialiseFromDictionary(data);
|
|
2733
|
-
if (data.lowerFlammabilityLimit !== undefined && typeof data.lowerFlammabilityLimit ===
|
|
2539
|
+
if (data.lowerFlammabilityLimit !== undefined && typeof data.lowerFlammabilityLimit === 'number') {
|
|
2734
2540
|
this.lowerFlammabilityLimit = data.lowerFlammabilityLimit as number;
|
|
2735
2541
|
}
|
|
2736
|
-
if (data.upperFlammabilityLimit !== undefined && typeof data.upperFlammabilityLimit ===
|
|
2542
|
+
if (data.upperFlammabilityLimit !== undefined && typeof data.upperFlammabilityLimit === 'number') {
|
|
2737
2543
|
this.upperFlammabilityLimit = data.upperFlammabilityLimit as number;
|
|
2738
2544
|
}
|
|
2739
|
-
if (data.criticalPressure !== undefined && typeof data.criticalPressure ===
|
|
2545
|
+
if (data.criticalPressure !== undefined && typeof data.criticalPressure === 'number') {
|
|
2740
2546
|
this.criticalPressure = data.criticalPressure as number;
|
|
2741
2547
|
}
|
|
2742
|
-
if (data.criticalTemperature !== undefined && typeof data.criticalTemperature ===
|
|
2548
|
+
if (data.criticalTemperature !== undefined && typeof data.criticalTemperature === 'number') {
|
|
2743
2549
|
this.criticalTemperature = data.criticalTemperature as number;
|
|
2744
2550
|
}
|
|
2745
|
-
if (data.flashPoint !== undefined && typeof data.flashPoint ===
|
|
2551
|
+
if (data.flashPoint !== undefined && typeof data.flashPoint === 'number') {
|
|
2746
2552
|
this.flashPoint = data.flashPoint as number;
|
|
2747
2553
|
}
|
|
2748
|
-
if (data.heatCombustion !== undefined && typeof data.heatCombustion ===
|
|
2554
|
+
if (data.heatCombustion !== undefined && typeof data.heatCombustion === 'number') {
|
|
2749
2555
|
this.heatCombustion = data.heatCombustion as number;
|
|
2750
2556
|
}
|
|
2751
|
-
if (data.maximumBurnRate !== undefined && typeof data.maximumBurnRate ===
|
|
2557
|
+
if (data.maximumBurnRate !== undefined && typeof data.maximumBurnRate === 'number') {
|
|
2752
2558
|
this.maximumBurnRate = data.maximumBurnRate as number;
|
|
2753
2559
|
}
|
|
2754
|
-
if (data.maximumSEP !== undefined && typeof data.maximumSEP ===
|
|
2560
|
+
if (data.maximumSEP !== undefined && typeof data.maximumSEP === 'number') {
|
|
2755
2561
|
this.maximumSEP = data.maximumSEP as number;
|
|
2756
2562
|
}
|
|
2757
|
-
if (data.molecularWeight !== undefined && typeof data.molecularWeight ===
|
|
2563
|
+
if (data.molecularWeight !== undefined && typeof data.molecularWeight === 'number') {
|
|
2758
2564
|
this.molecularWeight = data.molecularWeight as number;
|
|
2759
2565
|
}
|
|
2760
|
-
if (data.bubblePoint !== undefined && typeof data.bubblePoint ===
|
|
2566
|
+
if (data.bubblePoint !== undefined && typeof data.bubblePoint === 'number') {
|
|
2761
2567
|
this.bubblePoint = data.bubblePoint as number;
|
|
2762
2568
|
}
|
|
2763
|
-
if (data.poolFireBurnRateLength !== undefined && typeof data.poolFireBurnRateLength ===
|
|
2569
|
+
if (data.poolFireBurnRateLength !== undefined && typeof data.poolFireBurnRateLength === 'number') {
|
|
2764
2570
|
this.poolFireBurnRateLength = data.poolFireBurnRateLength as number;
|
|
2765
2571
|
}
|
|
2766
|
-
if (data.dewPoint !== undefined && typeof data.dewPoint ===
|
|
2572
|
+
if (data.dewPoint !== undefined && typeof data.dewPoint === 'number') {
|
|
2767
2573
|
this.dewPoint = data.dewPoint as number;
|
|
2768
2574
|
}
|
|
2769
|
-
if (data.emissivePowerLengthScale !== undefined && typeof data.emissivePowerLengthScale ===
|
|
2575
|
+
if (data.emissivePowerLengthScale !== undefined && typeof data.emissivePowerLengthScale === 'number') {
|
|
2770
2576
|
this.emissivePowerLengthScale = data.emissivePowerLengthScale as number;
|
|
2771
2577
|
}
|
|
2772
|
-
if (data.laminarBurningVelocity !== undefined && typeof data.laminarBurningVelocity ===
|
|
2578
|
+
if (data.laminarBurningVelocity !== undefined && typeof data.laminarBurningVelocity === 'number') {
|
|
2773
2579
|
this.laminarBurningVelocity = data.laminarBurningVelocity as number;
|
|
2774
2580
|
}
|
|
2775
|
-
if (data.flammableToxicFlag !== undefined && (typeof data.flammableToxicFlag ===
|
|
2581
|
+
if (data.flammableToxicFlag !== undefined && (typeof data.flammableToxicFlag === 'string' || typeof data.flammableToxicFlag === 'number')) {
|
|
2776
2582
|
this.flammableToxicFlag = this.parseEnumValue(data.flammableToxicFlag, Enums.FlammableToxic);
|
|
2777
2583
|
}
|
|
2778
|
-
if (data.luminousSmokyFlame !== undefined && (typeof data.luminousSmokyFlame ===
|
|
2584
|
+
if (data.luminousSmokyFlame !== undefined && (typeof data.luminousSmokyFlame === 'string' || typeof data.luminousSmokyFlame === 'number')) {
|
|
2779
2585
|
this.luminousSmokyFlame = this.parseEnumValue(data.luminousSmokyFlame, Enums.LuminousSmokyFlame);
|
|
2780
2586
|
}
|
|
2781
2587
|
}
|
|
2782
2588
|
|
|
2783
2589
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
2784
|
-
if (typeof value ===
|
|
2590
|
+
if (typeof value === 'string' && value in enumType) {
|
|
2785
2591
|
return enumType[value as keyof T];
|
|
2786
|
-
} else if (typeof value ===
|
|
2592
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
2787
2593
|
return value as T[keyof T];
|
|
2788
2594
|
}
|
|
2789
2595
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -2792,7 +2598,7 @@ export class MixtureConstantPropertiesResult extends EntityBase {
|
|
|
2792
2598
|
toString() {
|
|
2793
2599
|
const parts = [
|
|
2794
2600
|
super.toString(),
|
|
2795
|
-
|
|
2601
|
+
'* MixtureConstantPropertiesResult',
|
|
2796
2602
|
`lowerFlammabilityLimit: ${this.lowerFlammabilityLimit}`,
|
|
2797
2603
|
`upperFlammabilityLimit: ${this.upperFlammabilityLimit}`,
|
|
2798
2604
|
`criticalPressure: ${this.criticalPressure}`,
|
|
@@ -2810,7 +2616,7 @@ export class MixtureConstantPropertiesResult extends EntityBase {
|
|
|
2810
2616
|
`flammableToxicFlag: ${this.flammableToxicFlag}`,
|
|
2811
2617
|
`luminousSmokyFlame: ${this.luminousSmokyFlame}`,
|
|
2812
2618
|
];
|
|
2813
|
-
return parts.join(
|
|
2619
|
+
return parts.join('\n');
|
|
2814
2620
|
}
|
|
2815
2621
|
}
|
|
2816
2622
|
|
|
@@ -2850,31 +2656,29 @@ export class Pipe extends Asset {
|
|
|
2850
2656
|
pumpedInflow?: number;
|
|
2851
2657
|
}) {
|
|
2852
2658
|
super(options);
|
|
2853
|
-
this.nodes = options?.nodes ?? [new LocalPosition()];
|
|
2854
|
-
this.nodeCount = options?.nodeCount;
|
|
2855
|
-
this.diameter = options?.diameter;
|
|
2856
|
-
this.material = options?.material ?? new Material();
|
|
2857
|
-
this.state = options?.state ?? new State();
|
|
2858
|
-
this.roughness = options?.roughness ?? 4.5e-5;
|
|
2859
|
-
this.pumpedInflow = options?.pumpedInflow ?? 0;
|
|
2659
|
+
this.nodes = options?.nodes ?? [new LocalPosition()];
|
|
2660
|
+
this.nodeCount = options?.nodeCount;
|
|
2661
|
+
this.diameter = options?.diameter;
|
|
2662
|
+
this.material = options?.material ?? new Material();
|
|
2663
|
+
this.state = options?.state ?? new State();
|
|
2664
|
+
this.roughness = options?.roughness ?? 4.5e-5;
|
|
2665
|
+
this.pumpedInflow = options?.pumpedInflow ?? 0;
|
|
2860
2666
|
}
|
|
2861
2667
|
|
|
2862
2668
|
/** Initialise the entity with data from a dictionary. */
|
|
2863
2669
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2864
2670
|
super.initialiseFromDictionary(data);
|
|
2865
2671
|
if (data.nodes && Array.isArray(data.nodes)) {
|
|
2866
|
-
this.nodes = data.nodes.map(
|
|
2867
|
-
(
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2874
|
-
if (data.nodeCount !== undefined && typeof data.nodeCount === "number") {
|
|
2672
|
+
this.nodes = data.nodes.map((item) => {
|
|
2673
|
+
const record = new LocalPosition();
|
|
2674
|
+
record.initialiseFromDictionary(item);
|
|
2675
|
+
return record;
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2678
|
+
if (data.nodeCount !== undefined && typeof data.nodeCount === 'number') {
|
|
2875
2679
|
this.nodeCount = data.nodeCount as number;
|
|
2876
2680
|
}
|
|
2877
|
-
if (data.diameter !== undefined && typeof data.diameter ===
|
|
2681
|
+
if (data.diameter !== undefined && typeof data.diameter === 'number') {
|
|
2878
2682
|
this.diameter = data.diameter as number;
|
|
2879
2683
|
}
|
|
2880
2684
|
if (data.material) {
|
|
@@ -2885,10 +2689,10 @@ export class Pipe extends Asset {
|
|
|
2885
2689
|
this.state = new State();
|
|
2886
2690
|
this.state.initialiseFromDictionary(data.state as { [key: string]: unknown });
|
|
2887
2691
|
}
|
|
2888
|
-
if (data.roughness !== undefined && typeof data.roughness ===
|
|
2692
|
+
if (data.roughness !== undefined && typeof data.roughness === 'number') {
|
|
2889
2693
|
this.roughness = data.roughness as number;
|
|
2890
2694
|
}
|
|
2891
|
-
if (data.pumpedInflow !== undefined && typeof data.pumpedInflow ===
|
|
2695
|
+
if (data.pumpedInflow !== undefined && typeof data.pumpedInflow === 'number') {
|
|
2892
2696
|
this.pumpedInflow = data.pumpedInflow as number;
|
|
2893
2697
|
}
|
|
2894
2698
|
}
|
|
@@ -2896,9 +2700,9 @@ export class Pipe extends Asset {
|
|
|
2896
2700
|
toString() {
|
|
2897
2701
|
const parts = [
|
|
2898
2702
|
super.toString(),
|
|
2899
|
-
|
|
2703
|
+
'* Pipe',
|
|
2900
2704
|
`location: ${this.location?.toString()}`,
|
|
2901
|
-
this.nodes?.map((item) => item?.toString()).join(
|
|
2705
|
+
this.nodes?.map((item) => item?.toString()).join('\n'),
|
|
2902
2706
|
`nodeCount: ${this.nodeCount}`,
|
|
2903
2707
|
`diameter: ${this.diameter}`,
|
|
2904
2708
|
`material: ${this.material?.toString()}`,
|
|
@@ -2906,7 +2710,7 @@ export class Pipe extends Asset {
|
|
|
2906
2710
|
`roughness: ${this.roughness}`,
|
|
2907
2711
|
`pumpedInflow: ${this.pumpedInflow}`,
|
|
2908
2712
|
];
|
|
2909
|
-
return parts.join(
|
|
2713
|
+
return parts.join('\n');
|
|
2910
2714
|
}
|
|
2911
2715
|
}
|
|
2912
2716
|
|
|
@@ -2933,17 +2737,17 @@ export class PipeBreach extends ReleaseOverTime {
|
|
|
2933
2737
|
relativeAperture?: number;
|
|
2934
2738
|
}) {
|
|
2935
2739
|
super(options);
|
|
2936
|
-
this.distanceDownstream = options?.distanceDownstream;
|
|
2937
|
-
this.relativeAperture = options?.relativeAperture ?? 1;
|
|
2740
|
+
this.distanceDownstream = options?.distanceDownstream;
|
|
2741
|
+
this.relativeAperture = options?.relativeAperture ?? 1;
|
|
2938
2742
|
}
|
|
2939
2743
|
|
|
2940
2744
|
/** Initialise the entity with data from a dictionary. */
|
|
2941
2745
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2942
2746
|
super.initialiseFromDictionary(data);
|
|
2943
|
-
if (data.distanceDownstream !== undefined && typeof data.distanceDownstream ===
|
|
2747
|
+
if (data.distanceDownstream !== undefined && typeof data.distanceDownstream === 'number') {
|
|
2944
2748
|
this.distanceDownstream = data.distanceDownstream as number;
|
|
2945
2749
|
}
|
|
2946
|
-
if (data.relativeAperture !== undefined && typeof data.relativeAperture ===
|
|
2750
|
+
if (data.relativeAperture !== undefined && typeof data.relativeAperture === 'number') {
|
|
2947
2751
|
this.relativeAperture = data.relativeAperture as number;
|
|
2948
2752
|
}
|
|
2949
2753
|
}
|
|
@@ -2951,18 +2755,19 @@ export class PipeBreach extends ReleaseOverTime {
|
|
|
2951
2755
|
toString() {
|
|
2952
2756
|
const parts = [
|
|
2953
2757
|
super.toString(),
|
|
2954
|
-
|
|
2758
|
+
'* PipeBreach',
|
|
2955
2759
|
`distanceDownstream: ${this.distanceDownstream}`,
|
|
2956
2760
|
`releaseAngle: ${this.releaseAngle}`,
|
|
2957
2761
|
`timeVaryingOption: ${this.timeVaryingOption}`,
|
|
2958
2762
|
`relativeAperture: ${this.relativeAperture}`,
|
|
2959
2763
|
];
|
|
2960
|
-
return parts.join(
|
|
2764
|
+
return parts.join('\n');
|
|
2961
2765
|
}
|
|
2962
2766
|
}
|
|
2963
2767
|
|
|
2964
2768
|
export class PoolFireFlameResult extends FlameResult {
|
|
2965
2769
|
poolZoneSEP?: number[];
|
|
2770
|
+
poolCentre?: number;
|
|
2966
2771
|
|
|
2967
2772
|
/**
|
|
2968
2773
|
* Flame results for a pool fire.
|
|
@@ -2973,6 +2778,7 @@ export class PoolFireFlameResult extends FlameResult {
|
|
|
2973
2778
|
* @param {number} options.flameLength - Length of the flame. [m]
|
|
2974
2779
|
* @param {number} options.flameDiameter - Diameter of the flame. [m]
|
|
2975
2780
|
* @param {number[]} options.poolZoneSEP - Surface emissive power from each of the two pool fire zones. [W/m2]
|
|
2781
|
+
* @param {number} options.poolCentre - The downwind distance to the centre of the pool fire. [m]
|
|
2976
2782
|
* @param {Enums.FireType} options.fireType - Type of fire. (default value is Enums.FireType.NO_FIRE)
|
|
2977
2783
|
* @param {number} options.liftOffHeight - Fireball centre height. [m]
|
|
2978
2784
|
* @param {number} options.liftOffTime - Time to lift off. [s]
|
|
@@ -2986,12 +2792,14 @@ export class PoolFireFlameResult extends FlameResult {
|
|
|
2986
2792
|
flameLength?: number;
|
|
2987
2793
|
flameDiameter?: number;
|
|
2988
2794
|
poolZoneSEP?: number[];
|
|
2795
|
+
poolCentre?: number;
|
|
2989
2796
|
fireType?: Enums.FireType;
|
|
2990
2797
|
liftOffHeight?: number;
|
|
2991
2798
|
liftOffTime?: number;
|
|
2992
2799
|
}) {
|
|
2993
2800
|
super(options);
|
|
2994
|
-
this.poolZoneSEP = options?.poolZoneSEP;
|
|
2801
|
+
this.poolZoneSEP = options?.poolZoneSEP;
|
|
2802
|
+
this.poolCentre = options?.poolCentre;
|
|
2995
2803
|
}
|
|
2996
2804
|
|
|
2997
2805
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -3000,22 +2808,26 @@ export class PoolFireFlameResult extends FlameResult {
|
|
|
3000
2808
|
if (data.poolZoneSEP && Array.isArray(data.poolZoneSEP)) {
|
|
3001
2809
|
this.poolZoneSEP = (data.poolZoneSEP ?? []).map((item) => parseFloat(item));
|
|
3002
2810
|
}
|
|
2811
|
+
if (data.poolCentre !== undefined && typeof data.poolCentre === 'number') {
|
|
2812
|
+
this.poolCentre = data.poolCentre as number;
|
|
2813
|
+
}
|
|
3003
2814
|
}
|
|
3004
2815
|
|
|
3005
2816
|
toString() {
|
|
3006
2817
|
const parts = [
|
|
3007
2818
|
super.toString(),
|
|
3008
|
-
|
|
2819
|
+
'* PoolFireFlameResult',
|
|
3009
2820
|
`time: ${this.time}`,
|
|
3010
2821
|
`surfaceEmissivePower: ${this.surfaceEmissivePower}`,
|
|
3011
2822
|
`flameLength: ${this.flameLength}`,
|
|
3012
2823
|
`flameDiameter: ${this.flameDiameter}`,
|
|
3013
|
-
this.poolZoneSEP?.map((item) => item?.toString()).join(
|
|
2824
|
+
this.poolZoneSEP?.map((item) => item?.toString()).join('\n'),
|
|
2825
|
+
`poolCentre: ${this.poolCentre}`,
|
|
3014
2826
|
`fireType: ${this.fireType}`,
|
|
3015
2827
|
`liftOffHeight: ${this.liftOffHeight}`,
|
|
3016
2828
|
`liftOffTime: ${this.liftOffTime}`,
|
|
3017
2829
|
];
|
|
3018
|
-
return parts.join(
|
|
2830
|
+
return parts.join('\n');
|
|
3019
2831
|
}
|
|
3020
2832
|
}
|
|
3021
2833
|
|
|
@@ -3071,61 +2883,61 @@ export class PoolRecord extends EntityBase {
|
|
|
3071
2883
|
poolCentre?: number;
|
|
3072
2884
|
}) {
|
|
3073
2885
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3074
|
-
this.time = options?.time;
|
|
3075
|
-
this.massSpilt = options?.massSpilt;
|
|
3076
|
-
this.massVaporised = options?.massVaporised;
|
|
3077
|
-
this.massDissolved = options?.massDissolved;
|
|
3078
|
-
this.massRemaining = options?.massRemaining;
|
|
3079
|
-
this.vapourisationRate = options?.vapourisationRate;
|
|
3080
|
-
this.solutionRate = options?.solutionRate;
|
|
3081
|
-
this.effectiveRadius = options?.effectiveRadius;
|
|
3082
|
-
this.depth = options?.depth;
|
|
3083
|
-
this.temperature = options?.temperature;
|
|
3084
|
-
this.spillRate = options?.spillRate;
|
|
3085
|
-
this.actualRadius = options?.actualRadius;
|
|
3086
|
-
this.poolCentre = options?.poolCentre;
|
|
2886
|
+
this.time = options?.time;
|
|
2887
|
+
this.massSpilt = options?.massSpilt;
|
|
2888
|
+
this.massVaporised = options?.massVaporised;
|
|
2889
|
+
this.massDissolved = options?.massDissolved;
|
|
2890
|
+
this.massRemaining = options?.massRemaining;
|
|
2891
|
+
this.vapourisationRate = options?.vapourisationRate;
|
|
2892
|
+
this.solutionRate = options?.solutionRate;
|
|
2893
|
+
this.effectiveRadius = options?.effectiveRadius;
|
|
2894
|
+
this.depth = options?.depth;
|
|
2895
|
+
this.temperature = options?.temperature;
|
|
2896
|
+
this.spillRate = options?.spillRate;
|
|
2897
|
+
this.actualRadius = options?.actualRadius;
|
|
2898
|
+
this.poolCentre = options?.poolCentre;
|
|
3087
2899
|
}
|
|
3088
2900
|
|
|
3089
2901
|
/** Initialise the entity with data from a dictionary. */
|
|
3090
2902
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3091
2903
|
super.initialiseFromDictionary(data);
|
|
3092
|
-
if (data.time !== undefined && typeof data.time ===
|
|
2904
|
+
if (data.time !== undefined && typeof data.time === 'number') {
|
|
3093
2905
|
this.time = data.time as number;
|
|
3094
2906
|
}
|
|
3095
|
-
if (data.massSpilt !== undefined && typeof data.massSpilt ===
|
|
2907
|
+
if (data.massSpilt !== undefined && typeof data.massSpilt === 'number') {
|
|
3096
2908
|
this.massSpilt = data.massSpilt as number;
|
|
3097
2909
|
}
|
|
3098
|
-
if (data.massVaporised !== undefined && typeof data.massVaporised ===
|
|
2910
|
+
if (data.massVaporised !== undefined && typeof data.massVaporised === 'number') {
|
|
3099
2911
|
this.massVaporised = data.massVaporised as number;
|
|
3100
2912
|
}
|
|
3101
|
-
if (data.massDissolved !== undefined && typeof data.massDissolved ===
|
|
2913
|
+
if (data.massDissolved !== undefined && typeof data.massDissolved === 'number') {
|
|
3102
2914
|
this.massDissolved = data.massDissolved as number;
|
|
3103
2915
|
}
|
|
3104
|
-
if (data.massRemaining !== undefined && typeof data.massRemaining ===
|
|
2916
|
+
if (data.massRemaining !== undefined && typeof data.massRemaining === 'number') {
|
|
3105
2917
|
this.massRemaining = data.massRemaining as number;
|
|
3106
2918
|
}
|
|
3107
|
-
if (data.vapourisationRate !== undefined && typeof data.vapourisationRate ===
|
|
2919
|
+
if (data.vapourisationRate !== undefined && typeof data.vapourisationRate === 'number') {
|
|
3108
2920
|
this.vapourisationRate = data.vapourisationRate as number;
|
|
3109
2921
|
}
|
|
3110
|
-
if (data.solutionRate !== undefined && typeof data.solutionRate ===
|
|
2922
|
+
if (data.solutionRate !== undefined && typeof data.solutionRate === 'number') {
|
|
3111
2923
|
this.solutionRate = data.solutionRate as number;
|
|
3112
2924
|
}
|
|
3113
|
-
if (data.effectiveRadius !== undefined && typeof data.effectiveRadius ===
|
|
2925
|
+
if (data.effectiveRadius !== undefined && typeof data.effectiveRadius === 'number') {
|
|
3114
2926
|
this.effectiveRadius = data.effectiveRadius as number;
|
|
3115
2927
|
}
|
|
3116
|
-
if (data.depth !== undefined && typeof data.depth ===
|
|
2928
|
+
if (data.depth !== undefined && typeof data.depth === 'number') {
|
|
3117
2929
|
this.depth = data.depth as number;
|
|
3118
2930
|
}
|
|
3119
|
-
if (data.temperature !== undefined && typeof data.temperature ===
|
|
2931
|
+
if (data.temperature !== undefined && typeof data.temperature === 'number') {
|
|
3120
2932
|
this.temperature = data.temperature as number;
|
|
3121
2933
|
}
|
|
3122
|
-
if (data.spillRate !== undefined && typeof data.spillRate ===
|
|
2934
|
+
if (data.spillRate !== undefined && typeof data.spillRate === 'number') {
|
|
3123
2935
|
this.spillRate = data.spillRate as number;
|
|
3124
2936
|
}
|
|
3125
|
-
if (data.actualRadius !== undefined && typeof data.actualRadius ===
|
|
2937
|
+
if (data.actualRadius !== undefined && typeof data.actualRadius === 'number') {
|
|
3126
2938
|
this.actualRadius = data.actualRadius as number;
|
|
3127
2939
|
}
|
|
3128
|
-
if (data.poolCentre !== undefined && typeof data.poolCentre ===
|
|
2940
|
+
if (data.poolCentre !== undefined && typeof data.poolCentre === 'number') {
|
|
3129
2941
|
this.poolCentre = data.poolCentre as number;
|
|
3130
2942
|
}
|
|
3131
2943
|
}
|
|
@@ -3133,7 +2945,7 @@ export class PoolRecord extends EntityBase {
|
|
|
3133
2945
|
toString() {
|
|
3134
2946
|
const parts = [
|
|
3135
2947
|
super.toString(),
|
|
3136
|
-
|
|
2948
|
+
'* PoolRecord',
|
|
3137
2949
|
`time: ${this.time}`,
|
|
3138
2950
|
`massSpilt: ${this.massSpilt}`,
|
|
3139
2951
|
`massVaporised: ${this.massVaporised}`,
|
|
@@ -3148,7 +2960,7 @@ export class PoolRecord extends EntityBase {
|
|
|
3148
2960
|
`actualRadius: ${this.actualRadius}`,
|
|
3149
2961
|
`poolCentre: ${this.poolCentre}`,
|
|
3150
2962
|
];
|
|
3151
|
-
return parts.join(
|
|
2963
|
+
return parts.join('\n');
|
|
3152
2964
|
}
|
|
3153
2965
|
}
|
|
3154
2966
|
|
|
@@ -3165,30 +2977,23 @@ export class PoolVapourisationParameters extends EntityBase {
|
|
|
3165
2977
|
* @param {number} options.flammableCutoffRate - The rate below which pool vaporisation calculations for flammable releases stop and any remaining mass in the pool contributes to pool fire effects only. [kg/s] (default value is 0.1)
|
|
3166
2978
|
* @param {number} options.relativeTolerance - Controls the step size used by the pool modelling in the integrations of the differential equations for the pool behaviour so as to maximize computational efficiency while minimising the errors involved. [fraction] (default value is 0.001)
|
|
3167
2979
|
*/
|
|
3168
|
-
constructor(options?: {
|
|
3169
|
-
id?: string;
|
|
3170
|
-
typeId?: string;
|
|
3171
|
-
displayName?: string;
|
|
3172
|
-
toxicsCutoffRate?: number;
|
|
3173
|
-
flammableCutoffRate?: number;
|
|
3174
|
-
relativeTolerance?: number;
|
|
3175
|
-
}) {
|
|
2980
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; toxicsCutoffRate?: number; flammableCutoffRate?: number; relativeTolerance?: number }) {
|
|
3176
2981
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3177
|
-
this.toxicsCutoffRate = options?.toxicsCutoffRate ?? 0.001;
|
|
3178
|
-
this.flammableCutoffRate = options?.flammableCutoffRate ?? 0.1;
|
|
3179
|
-
this.relativeTolerance = options?.relativeTolerance ?? 0.001;
|
|
2982
|
+
this.toxicsCutoffRate = options?.toxicsCutoffRate ?? 0.001;
|
|
2983
|
+
this.flammableCutoffRate = options?.flammableCutoffRate ?? 0.1;
|
|
2984
|
+
this.relativeTolerance = options?.relativeTolerance ?? 0.001;
|
|
3180
2985
|
}
|
|
3181
2986
|
|
|
3182
2987
|
/** Initialise the entity with data from a dictionary. */
|
|
3183
2988
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3184
2989
|
super.initialiseFromDictionary(data);
|
|
3185
|
-
if (data.toxicsCutoffRate !== undefined && typeof data.toxicsCutoffRate ===
|
|
2990
|
+
if (data.toxicsCutoffRate !== undefined && typeof data.toxicsCutoffRate === 'number') {
|
|
3186
2991
|
this.toxicsCutoffRate = data.toxicsCutoffRate as number;
|
|
3187
2992
|
}
|
|
3188
|
-
if (data.flammableCutoffRate !== undefined && typeof data.flammableCutoffRate ===
|
|
2993
|
+
if (data.flammableCutoffRate !== undefined && typeof data.flammableCutoffRate === 'number') {
|
|
3189
2994
|
this.flammableCutoffRate = data.flammableCutoffRate as number;
|
|
3190
2995
|
}
|
|
3191
|
-
if (data.relativeTolerance !== undefined && typeof data.relativeTolerance ===
|
|
2996
|
+
if (data.relativeTolerance !== undefined && typeof data.relativeTolerance === 'number') {
|
|
3192
2997
|
this.relativeTolerance = data.relativeTolerance as number;
|
|
3193
2998
|
}
|
|
3194
2999
|
}
|
|
@@ -3196,12 +3001,12 @@ export class PoolVapourisationParameters extends EntityBase {
|
|
|
3196
3001
|
toString() {
|
|
3197
3002
|
const parts = [
|
|
3198
3003
|
super.toString(),
|
|
3199
|
-
|
|
3004
|
+
'* PoolVapourisationParameters',
|
|
3200
3005
|
`toxicsCutoffRate: ${this.toxicsCutoffRate}`,
|
|
3201
3006
|
`flammableCutoffRate: ${this.flammableCutoffRate}`,
|
|
3202
3007
|
`relativeTolerance: ${this.relativeTolerance}`,
|
|
3203
3008
|
];
|
|
3204
|
-
return parts.join(
|
|
3009
|
+
return parts.join('\n');
|
|
3205
3010
|
}
|
|
3206
3011
|
}
|
|
3207
3012
|
|
|
@@ -3218,18 +3023,11 @@ export class RadiationRecord extends EntityBase {
|
|
|
3218
3023
|
* @param {number} options.radiationResult - The value for the RadiationType at the specified position.
|
|
3219
3024
|
* @param {Enums.RadiationType} options.radiationType - The type of radiation result of interest. (default value is Enums.RadiationType.UNSET)
|
|
3220
3025
|
*/
|
|
3221
|
-
constructor(options?: {
|
|
3222
|
-
id?: string;
|
|
3223
|
-
typeId?: string;
|
|
3224
|
-
displayName?: string;
|
|
3225
|
-
position?: LocalPosition;
|
|
3226
|
-
radiationResult?: number;
|
|
3227
|
-
radiationType?: Enums.RadiationType;
|
|
3228
|
-
}) {
|
|
3026
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; position?: LocalPosition; radiationResult?: number; radiationType?: Enums.RadiationType }) {
|
|
3229
3027
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3230
|
-
this.position = options?.position ?? new LocalPosition();
|
|
3231
|
-
this.radiationResult = options?.radiationResult;
|
|
3232
|
-
this.radiationType = options?.radiationType ?? Enums.RadiationType.UNSET;
|
|
3028
|
+
this.position = options?.position ?? new LocalPosition();
|
|
3029
|
+
this.radiationResult = options?.radiationResult;
|
|
3030
|
+
this.radiationType = options?.radiationType ?? Enums.RadiationType.UNSET;
|
|
3233
3031
|
}
|
|
3234
3032
|
|
|
3235
3033
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -3239,32 +3037,26 @@ export class RadiationRecord extends EntityBase {
|
|
|
3239
3037
|
this.position = new LocalPosition();
|
|
3240
3038
|
this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
|
|
3241
3039
|
}
|
|
3242
|
-
if (data.radiationResult !== undefined && typeof data.radiationResult ===
|
|
3040
|
+
if (data.radiationResult !== undefined && typeof data.radiationResult === 'number') {
|
|
3243
3041
|
this.radiationResult = data.radiationResult as number;
|
|
3244
3042
|
}
|
|
3245
|
-
if (data.radiationType !== undefined && (typeof data.radiationType ===
|
|
3043
|
+
if (data.radiationType !== undefined && (typeof data.radiationType === 'string' || typeof data.radiationType === 'number')) {
|
|
3246
3044
|
this.radiationType = this.parseEnumValue(data.radiationType, Enums.RadiationType);
|
|
3247
3045
|
}
|
|
3248
3046
|
}
|
|
3249
3047
|
|
|
3250
3048
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
3251
|
-
if (typeof value ===
|
|
3049
|
+
if (typeof value === 'string' && value in enumType) {
|
|
3252
3050
|
return enumType[value as keyof T];
|
|
3253
|
-
} else if (typeof value ===
|
|
3051
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
3254
3052
|
return value as T[keyof T];
|
|
3255
3053
|
}
|
|
3256
3054
|
return undefined; // Return undefined if the value does not match the enum
|
|
3257
3055
|
}
|
|
3258
3056
|
|
|
3259
3057
|
toString() {
|
|
3260
|
-
const parts = [
|
|
3261
|
-
|
|
3262
|
-
"* RadiationRecord",
|
|
3263
|
-
`position: ${this.position?.toString()}`,
|
|
3264
|
-
`radiationResult: ${this.radiationResult}`,
|
|
3265
|
-
`radiationType: ${this.radiationType}`,
|
|
3266
|
-
];
|
|
3267
|
-
return parts.join("\n");
|
|
3058
|
+
const parts = [super.toString(), '* RadiationRecord', `position: ${this.position?.toString()}`, `radiationResult: ${this.radiationResult}`, `radiationType: ${this.radiationType}`];
|
|
3059
|
+
return parts.join('\n');
|
|
3268
3060
|
}
|
|
3269
3061
|
}
|
|
3270
3062
|
|
|
@@ -3300,29 +3092,29 @@ export class ReliefValve extends ReleaseOverTime {
|
|
|
3300
3092
|
pipeHeightFraction?: number;
|
|
3301
3093
|
}) {
|
|
3302
3094
|
super(options);
|
|
3303
|
-
this.reliefValveConstrictionDiameter = options?.reliefValveConstrictionDiameter;
|
|
3304
|
-
this.pipeDiameter = options?.pipeDiameter;
|
|
3305
|
-
this.pipeLength = options?.pipeLength;
|
|
3306
|
-
this.pipeRoughness = options?.pipeRoughness ?? 0.000045;
|
|
3307
|
-
this.pipeHeightFraction = options?.pipeHeightFraction ?? 0.5;
|
|
3095
|
+
this.reliefValveConstrictionDiameter = options?.reliefValveConstrictionDiameter;
|
|
3096
|
+
this.pipeDiameter = options?.pipeDiameter;
|
|
3097
|
+
this.pipeLength = options?.pipeLength;
|
|
3098
|
+
this.pipeRoughness = options?.pipeRoughness ?? 0.000045;
|
|
3099
|
+
this.pipeHeightFraction = options?.pipeHeightFraction ?? 0.5;
|
|
3308
3100
|
}
|
|
3309
3101
|
|
|
3310
3102
|
/** Initialise the entity with data from a dictionary. */
|
|
3311
3103
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3312
3104
|
super.initialiseFromDictionary(data);
|
|
3313
|
-
if (data.reliefValveConstrictionDiameter !== undefined && typeof data.reliefValveConstrictionDiameter ===
|
|
3105
|
+
if (data.reliefValveConstrictionDiameter !== undefined && typeof data.reliefValveConstrictionDiameter === 'number') {
|
|
3314
3106
|
this.reliefValveConstrictionDiameter = data.reliefValveConstrictionDiameter as number;
|
|
3315
3107
|
}
|
|
3316
|
-
if (data.pipeDiameter !== undefined && typeof data.pipeDiameter ===
|
|
3108
|
+
if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === 'number') {
|
|
3317
3109
|
this.pipeDiameter = data.pipeDiameter as number;
|
|
3318
3110
|
}
|
|
3319
|
-
if (data.pipeLength !== undefined && typeof data.pipeLength ===
|
|
3111
|
+
if (data.pipeLength !== undefined && typeof data.pipeLength === 'number') {
|
|
3320
3112
|
this.pipeLength = data.pipeLength as number;
|
|
3321
3113
|
}
|
|
3322
|
-
if (data.pipeRoughness !== undefined && typeof data.pipeRoughness ===
|
|
3114
|
+
if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === 'number') {
|
|
3323
3115
|
this.pipeRoughness = data.pipeRoughness as number;
|
|
3324
3116
|
}
|
|
3325
|
-
if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction ===
|
|
3117
|
+
if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === 'number') {
|
|
3326
3118
|
this.pipeHeightFraction = data.pipeHeightFraction as number;
|
|
3327
3119
|
}
|
|
3328
3120
|
}
|
|
@@ -3330,7 +3122,7 @@ export class ReliefValve extends ReleaseOverTime {
|
|
|
3330
3122
|
toString() {
|
|
3331
3123
|
const parts = [
|
|
3332
3124
|
super.toString(),
|
|
3333
|
-
|
|
3125
|
+
'* ReliefValve',
|
|
3334
3126
|
`reliefValveConstrictionDiameter: ${this.reliefValveConstrictionDiameter}`,
|
|
3335
3127
|
`pipeDiameter: ${this.pipeDiameter}`,
|
|
3336
3128
|
`pipeLength: ${this.pipeLength}`,
|
|
@@ -3339,7 +3131,7 @@ export class ReliefValve extends ReleaseOverTime {
|
|
|
3339
3131
|
`pipeRoughness: ${this.pipeRoughness}`,
|
|
3340
3132
|
`pipeHeightFraction: ${this.pipeHeightFraction}`,
|
|
3341
3133
|
];
|
|
3342
|
-
return parts.join(
|
|
3134
|
+
return parts.join('\n');
|
|
3343
3135
|
}
|
|
3344
3136
|
}
|
|
3345
3137
|
|
|
@@ -3374,33 +3166,33 @@ export class SafetySystem extends EntityBase {
|
|
|
3374
3166
|
blowdownValveSize?: number;
|
|
3375
3167
|
}) {
|
|
3376
3168
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3377
|
-
this.isolationTime = options?.isolationTime ?? 0.0;
|
|
3378
|
-
this.isolationSuccess = options?.isolationSuccess ?? true;
|
|
3379
|
-
this.massAddedIsolationFailure = options?.massAddedIsolationFailure ?? 0.0;
|
|
3380
|
-
this.blowdownTime = options?.blowdownTime ?? 0.0;
|
|
3381
|
-
this.blowdownSuccess = options?.blowdownSuccess ?? false;
|
|
3382
|
-
this.blowdownValveSize = options?.blowdownValveSize ?? 0.025;
|
|
3169
|
+
this.isolationTime = options?.isolationTime ?? 0.0;
|
|
3170
|
+
this.isolationSuccess = options?.isolationSuccess ?? true;
|
|
3171
|
+
this.massAddedIsolationFailure = options?.massAddedIsolationFailure ?? 0.0;
|
|
3172
|
+
this.blowdownTime = options?.blowdownTime ?? 0.0;
|
|
3173
|
+
this.blowdownSuccess = options?.blowdownSuccess ?? false;
|
|
3174
|
+
this.blowdownValveSize = options?.blowdownValveSize ?? 0.025;
|
|
3383
3175
|
}
|
|
3384
3176
|
|
|
3385
3177
|
/** Initialise the entity with data from a dictionary. */
|
|
3386
3178
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3387
3179
|
super.initialiseFromDictionary(data);
|
|
3388
|
-
if (data.isolationTime !== undefined && typeof data.isolationTime ===
|
|
3180
|
+
if (data.isolationTime !== undefined && typeof data.isolationTime === 'number') {
|
|
3389
3181
|
this.isolationTime = data.isolationTime as number;
|
|
3390
3182
|
}
|
|
3391
|
-
if (data.isolationSuccess !== undefined && typeof data.isolationSuccess ===
|
|
3183
|
+
if (data.isolationSuccess !== undefined && typeof data.isolationSuccess === 'boolean') {
|
|
3392
3184
|
this.isolationSuccess = data.isolationSuccess as boolean;
|
|
3393
3185
|
}
|
|
3394
|
-
if (data.massAddedIsolationFailure !== undefined && typeof data.massAddedIsolationFailure ===
|
|
3186
|
+
if (data.massAddedIsolationFailure !== undefined && typeof data.massAddedIsolationFailure === 'number') {
|
|
3395
3187
|
this.massAddedIsolationFailure = data.massAddedIsolationFailure as number;
|
|
3396
3188
|
}
|
|
3397
|
-
if (data.blowdownTime !== undefined && typeof data.blowdownTime ===
|
|
3189
|
+
if (data.blowdownTime !== undefined && typeof data.blowdownTime === 'number') {
|
|
3398
3190
|
this.blowdownTime = data.blowdownTime as number;
|
|
3399
3191
|
}
|
|
3400
|
-
if (data.blowdownSuccess !== undefined && typeof data.blowdownSuccess ===
|
|
3192
|
+
if (data.blowdownSuccess !== undefined && typeof data.blowdownSuccess === 'boolean') {
|
|
3401
3193
|
this.blowdownSuccess = data.blowdownSuccess as boolean;
|
|
3402
3194
|
}
|
|
3403
|
-
if (data.blowdownValveSize !== undefined && typeof data.blowdownValveSize ===
|
|
3195
|
+
if (data.blowdownValveSize !== undefined && typeof data.blowdownValveSize === 'number') {
|
|
3404
3196
|
this.blowdownValveSize = data.blowdownValveSize as number;
|
|
3405
3197
|
}
|
|
3406
3198
|
}
|
|
@@ -3408,7 +3200,7 @@ export class SafetySystem extends EntityBase {
|
|
|
3408
3200
|
toString() {
|
|
3409
3201
|
const parts = [
|
|
3410
3202
|
super.toString(),
|
|
3411
|
-
|
|
3203
|
+
'* SafetySystem',
|
|
3412
3204
|
`isolationTime: ${this.isolationTime}`,
|
|
3413
3205
|
`isolationSuccess: ${this.isolationSuccess}`,
|
|
3414
3206
|
`massAddedIsolationFailure: ${this.massAddedIsolationFailure}`,
|
|
@@ -3416,7 +3208,7 @@ export class SafetySystem extends EntityBase {
|
|
|
3416
3208
|
`blowdownSuccess: ${this.blowdownSuccess}`,
|
|
3417
3209
|
`blowdownValveSize: ${this.blowdownValveSize}`,
|
|
3418
3210
|
];
|
|
3419
|
-
return parts.join(
|
|
3211
|
+
return parts.join('\n');
|
|
3420
3212
|
}
|
|
3421
3213
|
}
|
|
3422
3214
|
|
|
@@ -3454,45 +3246,45 @@ export class ScalarUdmOutputs extends EntityBase {
|
|
|
3454
3246
|
cloudType?: Enums.DynamicType;
|
|
3455
3247
|
}) {
|
|
3456
3248
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3457
|
-
this.observerCount = options?.observerCount;
|
|
3458
|
-
this.recordCount = options?.recordCount;
|
|
3459
|
-
this.minimumConcentration = options?.minimumConcentration;
|
|
3460
|
-
this.windPower = options?.windPower;
|
|
3461
|
-
this.frictionVelocity = options?.frictionVelocity;
|
|
3462
|
-
this.dispersionReleaseDuration = options?.dispersionReleaseDuration;
|
|
3463
|
-
this.cloudType = options?.cloudType ?? Enums.DynamicType.UNSET;
|
|
3249
|
+
this.observerCount = options?.observerCount;
|
|
3250
|
+
this.recordCount = options?.recordCount;
|
|
3251
|
+
this.minimumConcentration = options?.minimumConcentration;
|
|
3252
|
+
this.windPower = options?.windPower;
|
|
3253
|
+
this.frictionVelocity = options?.frictionVelocity;
|
|
3254
|
+
this.dispersionReleaseDuration = options?.dispersionReleaseDuration;
|
|
3255
|
+
this.cloudType = options?.cloudType ?? Enums.DynamicType.UNSET;
|
|
3464
3256
|
}
|
|
3465
3257
|
|
|
3466
3258
|
/** Initialise the entity with data from a dictionary. */
|
|
3467
3259
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3468
3260
|
super.initialiseFromDictionary(data);
|
|
3469
|
-
if (data.observerCount !== undefined && typeof data.observerCount ===
|
|
3261
|
+
if (data.observerCount !== undefined && typeof data.observerCount === 'number') {
|
|
3470
3262
|
this.observerCount = data.observerCount as number;
|
|
3471
3263
|
}
|
|
3472
|
-
if (data.recordCount !== undefined && typeof data.recordCount ===
|
|
3264
|
+
if (data.recordCount !== undefined && typeof data.recordCount === 'number') {
|
|
3473
3265
|
this.recordCount = data.recordCount as number;
|
|
3474
3266
|
}
|
|
3475
|
-
if (data.minimumConcentration !== undefined && typeof data.minimumConcentration ===
|
|
3267
|
+
if (data.minimumConcentration !== undefined && typeof data.minimumConcentration === 'number') {
|
|
3476
3268
|
this.minimumConcentration = data.minimumConcentration as number;
|
|
3477
3269
|
}
|
|
3478
|
-
if (data.windPower !== undefined && typeof data.windPower ===
|
|
3270
|
+
if (data.windPower !== undefined && typeof data.windPower === 'number') {
|
|
3479
3271
|
this.windPower = data.windPower as number;
|
|
3480
3272
|
}
|
|
3481
|
-
if (data.frictionVelocity !== undefined && typeof data.frictionVelocity ===
|
|
3273
|
+
if (data.frictionVelocity !== undefined && typeof data.frictionVelocity === 'number') {
|
|
3482
3274
|
this.frictionVelocity = data.frictionVelocity as number;
|
|
3483
3275
|
}
|
|
3484
|
-
if (data.dispersionReleaseDuration !== undefined && typeof data.dispersionReleaseDuration ===
|
|
3276
|
+
if (data.dispersionReleaseDuration !== undefined && typeof data.dispersionReleaseDuration === 'number') {
|
|
3485
3277
|
this.dispersionReleaseDuration = data.dispersionReleaseDuration as number;
|
|
3486
3278
|
}
|
|
3487
|
-
if (data.cloudType !== undefined && (typeof data.cloudType ===
|
|
3279
|
+
if (data.cloudType !== undefined && (typeof data.cloudType === 'string' || typeof data.cloudType === 'number')) {
|
|
3488
3280
|
this.cloudType = this.parseEnumValue(data.cloudType, Enums.DynamicType);
|
|
3489
3281
|
}
|
|
3490
3282
|
}
|
|
3491
3283
|
|
|
3492
3284
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
3493
|
-
if (typeof value ===
|
|
3285
|
+
if (typeof value === 'string' && value in enumType) {
|
|
3494
3286
|
return enumType[value as keyof T];
|
|
3495
|
-
} else if (typeof value ===
|
|
3287
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
3496
3288
|
return value as T[keyof T];
|
|
3497
3289
|
}
|
|
3498
3290
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -3501,7 +3293,7 @@ export class ScalarUdmOutputs extends EntityBase {
|
|
|
3501
3293
|
toString() {
|
|
3502
3294
|
const parts = [
|
|
3503
3295
|
super.toString(),
|
|
3504
|
-
|
|
3296
|
+
'* ScalarUdmOutputs',
|
|
3505
3297
|
`observerCount: ${this.observerCount}`,
|
|
3506
3298
|
`recordCount: ${this.recordCount}`,
|
|
3507
3299
|
`minimumConcentration: ${this.minimumConcentration}`,
|
|
@@ -3510,7 +3302,7 @@ export class ScalarUdmOutputs extends EntityBase {
|
|
|
3510
3302
|
`dispersionReleaseDuration: ${this.dispersionReleaseDuration}`,
|
|
3511
3303
|
`cloudType: ${this.cloudType}`,
|
|
3512
3304
|
];
|
|
3513
|
-
return parts.join(
|
|
3305
|
+
return parts.join('\n');
|
|
3514
3306
|
}
|
|
3515
3307
|
}
|
|
3516
3308
|
|
|
@@ -3543,25 +3335,25 @@ export class ShortPipeRupture extends ReleaseOverTime {
|
|
|
3543
3335
|
pipeHeightFraction?: number;
|
|
3544
3336
|
}) {
|
|
3545
3337
|
super(options);
|
|
3546
|
-
this.pipeLength = options?.pipeLength;
|
|
3547
|
-
this.pipeDiameter = options?.pipeDiameter;
|
|
3548
|
-
this.pipeRoughness = options?.pipeRoughness ?? 0.000045;
|
|
3549
|
-
this.pipeHeightFraction = options?.pipeHeightFraction ?? 0.5;
|
|
3338
|
+
this.pipeLength = options?.pipeLength;
|
|
3339
|
+
this.pipeDiameter = options?.pipeDiameter;
|
|
3340
|
+
this.pipeRoughness = options?.pipeRoughness ?? 0.000045;
|
|
3341
|
+
this.pipeHeightFraction = options?.pipeHeightFraction ?? 0.5;
|
|
3550
3342
|
}
|
|
3551
3343
|
|
|
3552
3344
|
/** Initialise the entity with data from a dictionary. */
|
|
3553
3345
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3554
3346
|
super.initialiseFromDictionary(data);
|
|
3555
|
-
if (data.pipeLength !== undefined && typeof data.pipeLength ===
|
|
3347
|
+
if (data.pipeLength !== undefined && typeof data.pipeLength === 'number') {
|
|
3556
3348
|
this.pipeLength = data.pipeLength as number;
|
|
3557
3349
|
}
|
|
3558
|
-
if (data.pipeDiameter !== undefined && typeof data.pipeDiameter ===
|
|
3350
|
+
if (data.pipeDiameter !== undefined && typeof data.pipeDiameter === 'number') {
|
|
3559
3351
|
this.pipeDiameter = data.pipeDiameter as number;
|
|
3560
3352
|
}
|
|
3561
|
-
if (data.pipeRoughness !== undefined && typeof data.pipeRoughness ===
|
|
3353
|
+
if (data.pipeRoughness !== undefined && typeof data.pipeRoughness === 'number') {
|
|
3562
3354
|
this.pipeRoughness = data.pipeRoughness as number;
|
|
3563
3355
|
}
|
|
3564
|
-
if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction ===
|
|
3356
|
+
if (data.pipeHeightFraction !== undefined && typeof data.pipeHeightFraction === 'number') {
|
|
3565
3357
|
this.pipeHeightFraction = data.pipeHeightFraction as number;
|
|
3566
3358
|
}
|
|
3567
3359
|
}
|
|
@@ -3569,7 +3361,7 @@ export class ShortPipeRupture extends ReleaseOverTime {
|
|
|
3569
3361
|
toString() {
|
|
3570
3362
|
const parts = [
|
|
3571
3363
|
super.toString(),
|
|
3572
|
-
|
|
3364
|
+
'* ShortPipeRupture',
|
|
3573
3365
|
`pipeLength: ${this.pipeLength}`,
|
|
3574
3366
|
`pipeDiameter: ${this.pipeDiameter}`,
|
|
3575
3367
|
`releaseAngle: ${this.releaseAngle}`,
|
|
@@ -3577,7 +3369,7 @@ export class ShortPipeRupture extends ReleaseOverTime {
|
|
|
3577
3369
|
`pipeRoughness: ${this.pipeRoughness}`,
|
|
3578
3370
|
`pipeHeightFraction: ${this.pipeHeightFraction}`,
|
|
3579
3371
|
];
|
|
3580
|
-
return parts.join(
|
|
3372
|
+
return parts.join('\n');
|
|
3581
3373
|
}
|
|
3582
3374
|
}
|
|
3583
3375
|
|
|
@@ -3592,16 +3384,10 @@ export class Structure extends EntityBase {
|
|
|
3592
3384
|
* @param {ExplosionConfinedVolume} options.explosionConfinedVolume - Confined explosion volume data.
|
|
3593
3385
|
* @param {LocalPosition} options.location - Location of the structure.
|
|
3594
3386
|
*/
|
|
3595
|
-
constructor(options?: {
|
|
3596
|
-
id?: string;
|
|
3597
|
-
typeId?: string;
|
|
3598
|
-
displayName?: string;
|
|
3599
|
-
explosionConfinedVolume?: ExplosionConfinedVolume;
|
|
3600
|
-
location?: LocalPosition;
|
|
3601
|
-
}) {
|
|
3387
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; explosionConfinedVolume?: ExplosionConfinedVolume; location?: LocalPosition }) {
|
|
3602
3388
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3603
|
-
this.explosionConfinedVolume = options?.explosionConfinedVolume ?? new ExplosionConfinedVolume();
|
|
3604
|
-
this.location = options?.location ?? new LocalPosition();
|
|
3389
|
+
this.explosionConfinedVolume = options?.explosionConfinedVolume ?? new ExplosionConfinedVolume();
|
|
3390
|
+
this.location = options?.location ?? new LocalPosition();
|
|
3605
3391
|
}
|
|
3606
3392
|
|
|
3607
3393
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -3618,13 +3404,8 @@ export class Structure extends EntityBase {
|
|
|
3618
3404
|
}
|
|
3619
3405
|
|
|
3620
3406
|
toString() {
|
|
3621
|
-
const parts = [
|
|
3622
|
-
|
|
3623
|
-
"* Structure",
|
|
3624
|
-
`explosionConfinedVolume: ${this.explosionConfinedVolume?.toString()}`,
|
|
3625
|
-
`location: ${this.location?.toString()}`,
|
|
3626
|
-
];
|
|
3627
|
-
return parts.join("\n");
|
|
3407
|
+
const parts = [super.toString(), '* Structure', `explosionConfinedVolume: ${this.explosionConfinedVolume?.toString()}`, `location: ${this.location?.toString()}`];
|
|
3408
|
+
return parts.join('\n');
|
|
3628
3409
|
}
|
|
3629
3410
|
}
|
|
3630
3411
|
|
|
@@ -3643,20 +3424,12 @@ export class Substrate extends EntityBase {
|
|
|
3643
3424
|
* @param {Enums.SurfaceType} options.surfaceType - Surface over which the dispersion occurs. (default value is Enums.SurfaceType.LAND)
|
|
3644
3425
|
* @param {Enums.PoolSurfaceType} options.poolSurfaceType - Surface onto which the liquid which rains out will spread. (default value is Enums.PoolSurfaceType.CONCRETE)
|
|
3645
3426
|
*/
|
|
3646
|
-
constructor(options?: {
|
|
3647
|
-
id?: string;
|
|
3648
|
-
typeId?: string;
|
|
3649
|
-
displayName?: string;
|
|
3650
|
-
bund?: Bund;
|
|
3651
|
-
surfaceRoughness?: number;
|
|
3652
|
-
surfaceType?: Enums.SurfaceType;
|
|
3653
|
-
poolSurfaceType?: Enums.PoolSurfaceType;
|
|
3654
|
-
}) {
|
|
3427
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; bund?: Bund; surfaceRoughness?: number; surfaceType?: Enums.SurfaceType; poolSurfaceType?: Enums.PoolSurfaceType }) {
|
|
3655
3428
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3656
|
-
this.bund = options?.bund ?? new Bund();
|
|
3657
|
-
this.surfaceRoughness = options?.surfaceRoughness ?? 0.183;
|
|
3658
|
-
this.surfaceType = options?.surfaceType ?? Enums.SurfaceType.LAND;
|
|
3659
|
-
this.poolSurfaceType = options?.poolSurfaceType ?? Enums.PoolSurfaceType.CONCRETE;
|
|
3429
|
+
this.bund = options?.bund ?? new Bund();
|
|
3430
|
+
this.surfaceRoughness = options?.surfaceRoughness ?? 0.183;
|
|
3431
|
+
this.surfaceType = options?.surfaceType ?? Enums.SurfaceType.LAND;
|
|
3432
|
+
this.poolSurfaceType = options?.poolSurfaceType ?? Enums.PoolSurfaceType.CONCRETE;
|
|
3660
3433
|
}
|
|
3661
3434
|
|
|
3662
3435
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -3666,21 +3439,21 @@ export class Substrate extends EntityBase {
|
|
|
3666
3439
|
this.bund = new Bund();
|
|
3667
3440
|
this.bund.initialiseFromDictionary(data.bund as { [key: string]: unknown });
|
|
3668
3441
|
}
|
|
3669
|
-
if (data.surfaceRoughness !== undefined && typeof data.surfaceRoughness ===
|
|
3442
|
+
if (data.surfaceRoughness !== undefined && typeof data.surfaceRoughness === 'number') {
|
|
3670
3443
|
this.surfaceRoughness = data.surfaceRoughness as number;
|
|
3671
3444
|
}
|
|
3672
|
-
if (data.surfaceType !== undefined && (typeof data.surfaceType ===
|
|
3445
|
+
if (data.surfaceType !== undefined && (typeof data.surfaceType === 'string' || typeof data.surfaceType === 'number')) {
|
|
3673
3446
|
this.surfaceType = this.parseEnumValue(data.surfaceType, Enums.SurfaceType);
|
|
3674
3447
|
}
|
|
3675
|
-
if (data.poolSurfaceType !== undefined && (typeof data.poolSurfaceType ===
|
|
3448
|
+
if (data.poolSurfaceType !== undefined && (typeof data.poolSurfaceType === 'string' || typeof data.poolSurfaceType === 'number')) {
|
|
3676
3449
|
this.poolSurfaceType = this.parseEnumValue(data.poolSurfaceType, Enums.PoolSurfaceType);
|
|
3677
3450
|
}
|
|
3678
3451
|
}
|
|
3679
3452
|
|
|
3680
3453
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
3681
|
-
if (typeof value ===
|
|
3454
|
+
if (typeof value === 'string' && value in enumType) {
|
|
3682
3455
|
return enumType[value as keyof T];
|
|
3683
|
-
} else if (typeof value ===
|
|
3456
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
3684
3457
|
return value as T[keyof T];
|
|
3685
3458
|
}
|
|
3686
3459
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -3689,13 +3462,13 @@ export class Substrate extends EntityBase {
|
|
|
3689
3462
|
toString() {
|
|
3690
3463
|
const parts = [
|
|
3691
3464
|
super.toString(),
|
|
3692
|
-
|
|
3465
|
+
'* Substrate',
|
|
3693
3466
|
`bund: ${this.bund?.toString()}`,
|
|
3694
3467
|
`surfaceRoughness: ${this.surfaceRoughness}`,
|
|
3695
3468
|
`surfaceType: ${this.surfaceType}`,
|
|
3696
3469
|
`poolSurfaceType: ${this.poolSurfaceType}`,
|
|
3697
3470
|
];
|
|
3698
|
-
return parts.join(
|
|
3471
|
+
return parts.join('\n');
|
|
3699
3472
|
}
|
|
3700
3473
|
}
|
|
3701
3474
|
|
|
@@ -3712,18 +3485,11 @@ export class ToxicRecord extends EntityBase {
|
|
|
3712
3485
|
* @param {number} options.toxicResult - The value for the ToxicResultType at the specified position.
|
|
3713
3486
|
* @param {Enums.ToxicResultType} options.toxicResultType - The type of toxic result. (default value is Enums.ToxicResultType.UNSET)
|
|
3714
3487
|
*/
|
|
3715
|
-
constructor(options?: {
|
|
3716
|
-
id?: string;
|
|
3717
|
-
typeId?: string;
|
|
3718
|
-
displayName?: string;
|
|
3719
|
-
position?: LocalPosition;
|
|
3720
|
-
toxicResult?: number;
|
|
3721
|
-
toxicResultType?: Enums.ToxicResultType;
|
|
3722
|
-
}) {
|
|
3488
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; position?: LocalPosition; toxicResult?: number; toxicResultType?: Enums.ToxicResultType }) {
|
|
3723
3489
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3724
|
-
this.position = options?.position ?? new LocalPosition();
|
|
3725
|
-
this.toxicResult = options?.toxicResult;
|
|
3726
|
-
this.toxicResultType = options?.toxicResultType ?? Enums.ToxicResultType.UNSET;
|
|
3490
|
+
this.position = options?.position ?? new LocalPosition();
|
|
3491
|
+
this.toxicResult = options?.toxicResult;
|
|
3492
|
+
this.toxicResultType = options?.toxicResultType ?? Enums.ToxicResultType.UNSET;
|
|
3727
3493
|
}
|
|
3728
3494
|
|
|
3729
3495
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -3733,32 +3499,26 @@ export class ToxicRecord extends EntityBase {
|
|
|
3733
3499
|
this.position = new LocalPosition();
|
|
3734
3500
|
this.position.initialiseFromDictionary(data.position as { [key: string]: unknown });
|
|
3735
3501
|
}
|
|
3736
|
-
if (data.toxicResult !== undefined && typeof data.toxicResult ===
|
|
3502
|
+
if (data.toxicResult !== undefined && typeof data.toxicResult === 'number') {
|
|
3737
3503
|
this.toxicResult = data.toxicResult as number;
|
|
3738
3504
|
}
|
|
3739
|
-
if (data.toxicResultType !== undefined && (typeof data.toxicResultType ===
|
|
3505
|
+
if (data.toxicResultType !== undefined && (typeof data.toxicResultType === 'string' || typeof data.toxicResultType === 'number')) {
|
|
3740
3506
|
this.toxicResultType = this.parseEnumValue(data.toxicResultType, Enums.ToxicResultType);
|
|
3741
3507
|
}
|
|
3742
3508
|
}
|
|
3743
3509
|
|
|
3744
3510
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
3745
|
-
if (typeof value ===
|
|
3511
|
+
if (typeof value === 'string' && value in enumType) {
|
|
3746
3512
|
return enumType[value as keyof T];
|
|
3747
|
-
} else if (typeof value ===
|
|
3513
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
3748
3514
|
return value as T[keyof T];
|
|
3749
3515
|
}
|
|
3750
3516
|
return undefined; // Return undefined if the value does not match the enum
|
|
3751
3517
|
}
|
|
3752
3518
|
|
|
3753
3519
|
toString() {
|
|
3754
|
-
const parts = [
|
|
3755
|
-
|
|
3756
|
-
"* ToxicRecord",
|
|
3757
|
-
`position: ${this.position?.toString()}`,
|
|
3758
|
-
`toxicResult: ${this.toxicResult}`,
|
|
3759
|
-
`toxicResultType: ${this.toxicResultType}`,
|
|
3760
|
-
];
|
|
3761
|
-
return parts.join("\n");
|
|
3520
|
+
const parts = [super.toString(), '* ToxicRecord', `position: ${this.position?.toString()}`, `toxicResult: ${this.toxicResult}`, `toxicResultType: ${this.toxicResultType}`];
|
|
3521
|
+
return parts.join('\n');
|
|
3762
3522
|
}
|
|
3763
3523
|
}
|
|
3764
3524
|
|
|
@@ -3807,16 +3567,16 @@ export class Vessel extends Asset {
|
|
|
3807
3567
|
liquidFillFractionByVolume?: number;
|
|
3808
3568
|
}) {
|
|
3809
3569
|
super(options);
|
|
3810
|
-
this.state = options?.state ?? new State();
|
|
3811
|
-
this.material = options?.material ?? new Material();
|
|
3812
|
-
this.safetySystem = options?.safetySystem ?? new SafetySystem();
|
|
3813
|
-
this.diameter = options?.diameter ?? 2;
|
|
3814
|
-
this.height = options?.height ?? 4;
|
|
3815
|
-
this.length = options?.length ?? 4;
|
|
3816
|
-
this.width = options?.width ?? 2.0;
|
|
3817
|
-
this.shape = options?.shape ?? Enums.VesselShape.HORIZONTAL_CYLINDER;
|
|
3818
|
-
this.vesselConditions = options?.vesselConditions ?? Enums.VesselConditions.UNSET;
|
|
3819
|
-
this.liquidFillFractionByVolume = options?.liquidFillFractionByVolume ?? 0.0;
|
|
3570
|
+
this.state = options?.state ?? new State();
|
|
3571
|
+
this.material = options?.material ?? new Material();
|
|
3572
|
+
this.safetySystem = options?.safetySystem ?? new SafetySystem();
|
|
3573
|
+
this.diameter = options?.diameter ?? 2;
|
|
3574
|
+
this.height = options?.height ?? 4;
|
|
3575
|
+
this.length = options?.length ?? 4;
|
|
3576
|
+
this.width = options?.width ?? 2.0;
|
|
3577
|
+
this.shape = options?.shape ?? Enums.VesselShape.HORIZONTAL_CYLINDER;
|
|
3578
|
+
this.vesselConditions = options?.vesselConditions ?? Enums.VesselConditions.UNSET;
|
|
3579
|
+
this.liquidFillFractionByVolume = options?.liquidFillFractionByVolume ?? 0.0;
|
|
3820
3580
|
}
|
|
3821
3581
|
|
|
3822
3582
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -3834,33 +3594,33 @@ export class Vessel extends Asset {
|
|
|
3834
3594
|
this.safetySystem = new SafetySystem();
|
|
3835
3595
|
this.safetySystem.initialiseFromDictionary(data.safetySystem as { [key: string]: unknown });
|
|
3836
3596
|
}
|
|
3837
|
-
if (data.diameter !== undefined && typeof data.diameter ===
|
|
3597
|
+
if (data.diameter !== undefined && typeof data.diameter === 'number') {
|
|
3838
3598
|
this.diameter = data.diameter as number;
|
|
3839
3599
|
}
|
|
3840
|
-
if (data.height !== undefined && typeof data.height ===
|
|
3600
|
+
if (data.height !== undefined && typeof data.height === 'number') {
|
|
3841
3601
|
this.height = data.height as number;
|
|
3842
3602
|
}
|
|
3843
|
-
if (data.length !== undefined && typeof data.length ===
|
|
3603
|
+
if (data.length !== undefined && typeof data.length === 'number') {
|
|
3844
3604
|
this.length = data.length as number;
|
|
3845
3605
|
}
|
|
3846
|
-
if (data.width !== undefined && typeof data.width ===
|
|
3606
|
+
if (data.width !== undefined && typeof data.width === 'number') {
|
|
3847
3607
|
this.width = data.width as number;
|
|
3848
3608
|
}
|
|
3849
|
-
if (data.shape !== undefined && (typeof data.shape ===
|
|
3609
|
+
if (data.shape !== undefined && (typeof data.shape === 'string' || typeof data.shape === 'number')) {
|
|
3850
3610
|
this.shape = this.parseEnumValue(data.shape, Enums.VesselShape);
|
|
3851
3611
|
}
|
|
3852
|
-
if (data.vesselConditions !== undefined && (typeof data.vesselConditions ===
|
|
3612
|
+
if (data.vesselConditions !== undefined && (typeof data.vesselConditions === 'string' || typeof data.vesselConditions === 'number')) {
|
|
3853
3613
|
this.vesselConditions = this.parseEnumValue(data.vesselConditions, Enums.VesselConditions);
|
|
3854
3614
|
}
|
|
3855
|
-
if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume ===
|
|
3615
|
+
if (data.liquidFillFractionByVolume !== undefined && typeof data.liquidFillFractionByVolume === 'number') {
|
|
3856
3616
|
this.liquidFillFractionByVolume = data.liquidFillFractionByVolume as number;
|
|
3857
3617
|
}
|
|
3858
3618
|
}
|
|
3859
3619
|
|
|
3860
3620
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
3861
|
-
if (typeof value ===
|
|
3621
|
+
if (typeof value === 'string' && value in enumType) {
|
|
3862
3622
|
return enumType[value as keyof T];
|
|
3863
|
-
} else if (typeof value ===
|
|
3623
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
3864
3624
|
return value as T[keyof T];
|
|
3865
3625
|
}
|
|
3866
3626
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -3869,7 +3629,7 @@ export class Vessel extends Asset {
|
|
|
3869
3629
|
toString() {
|
|
3870
3630
|
const parts = [
|
|
3871
3631
|
super.toString(),
|
|
3872
|
-
|
|
3632
|
+
'* Vessel',
|
|
3873
3633
|
`location: ${this.location?.toString()}`,
|
|
3874
3634
|
`state: ${this.state?.toString()}`,
|
|
3875
3635
|
`material: ${this.material?.toString()}`,
|
|
@@ -3882,7 +3642,7 @@ export class Vessel extends Asset {
|
|
|
3882
3642
|
`vesselConditions: ${this.vesselConditions}`,
|
|
3883
3643
|
`liquidFillFractionByVolume: ${this.liquidFillFractionByVolume}`,
|
|
3884
3644
|
];
|
|
3885
|
-
return parts.join(
|
|
3645
|
+
return parts.join('\n');
|
|
3886
3646
|
}
|
|
3887
3647
|
}
|
|
3888
3648
|
|
|
@@ -3917,41 +3677,41 @@ export class VesselLeakMaxFlammableCloudResults extends EntityBase {
|
|
|
3917
3677
|
phase?: Enums.Phase;
|
|
3918
3678
|
}) {
|
|
3919
3679
|
super(options?.id, options?.typeId, options?.displayName);
|
|
3920
|
-
this.dischargeRate = options?.dischargeRate;
|
|
3921
|
-
this.expandedTemperature = options?.expandedTemperature;
|
|
3922
|
-
this.lflExtent = options?.lflExtent;
|
|
3923
|
-
this.lflArea = options?.lflArea;
|
|
3924
|
-
this.lflHeight = options?.lflHeight;
|
|
3925
|
-
this.phase = options?.phase ?? Enums.Phase.UNSET;
|
|
3680
|
+
this.dischargeRate = options?.dischargeRate;
|
|
3681
|
+
this.expandedTemperature = options?.expandedTemperature;
|
|
3682
|
+
this.lflExtent = options?.lflExtent;
|
|
3683
|
+
this.lflArea = options?.lflArea;
|
|
3684
|
+
this.lflHeight = options?.lflHeight;
|
|
3685
|
+
this.phase = options?.phase ?? Enums.Phase.UNSET;
|
|
3926
3686
|
}
|
|
3927
3687
|
|
|
3928
3688
|
/** Initialise the entity with data from a dictionary. */
|
|
3929
3689
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
3930
3690
|
super.initialiseFromDictionary(data);
|
|
3931
|
-
if (data.dischargeRate !== undefined && typeof data.dischargeRate ===
|
|
3691
|
+
if (data.dischargeRate !== undefined && typeof data.dischargeRate === 'number') {
|
|
3932
3692
|
this.dischargeRate = data.dischargeRate as number;
|
|
3933
3693
|
}
|
|
3934
|
-
if (data.expandedTemperature !== undefined && typeof data.expandedTemperature ===
|
|
3694
|
+
if (data.expandedTemperature !== undefined && typeof data.expandedTemperature === 'number') {
|
|
3935
3695
|
this.expandedTemperature = data.expandedTemperature as number;
|
|
3936
3696
|
}
|
|
3937
|
-
if (data.lflExtent !== undefined && typeof data.lflExtent ===
|
|
3697
|
+
if (data.lflExtent !== undefined && typeof data.lflExtent === 'number') {
|
|
3938
3698
|
this.lflExtent = data.lflExtent as number;
|
|
3939
3699
|
}
|
|
3940
|
-
if (data.lflArea !== undefined && typeof data.lflArea ===
|
|
3700
|
+
if (data.lflArea !== undefined && typeof data.lflArea === 'number') {
|
|
3941
3701
|
this.lflArea = data.lflArea as number;
|
|
3942
3702
|
}
|
|
3943
|
-
if (data.lflHeight !== undefined && typeof data.lflHeight ===
|
|
3703
|
+
if (data.lflHeight !== undefined && typeof data.lflHeight === 'number') {
|
|
3944
3704
|
this.lflHeight = data.lflHeight as number;
|
|
3945
3705
|
}
|
|
3946
|
-
if (data.phase !== undefined && (typeof data.phase ===
|
|
3706
|
+
if (data.phase !== undefined && (typeof data.phase === 'string' || typeof data.phase === 'number')) {
|
|
3947
3707
|
this.phase = this.parseEnumValue(data.phase, Enums.Phase);
|
|
3948
3708
|
}
|
|
3949
3709
|
}
|
|
3950
3710
|
|
|
3951
3711
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
3952
|
-
if (typeof value ===
|
|
3712
|
+
if (typeof value === 'string' && value in enumType) {
|
|
3953
3713
|
return enumType[value as keyof T];
|
|
3954
|
-
} else if (typeof value ===
|
|
3714
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
3955
3715
|
return value as T[keyof T];
|
|
3956
3716
|
}
|
|
3957
3717
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -3960,7 +3720,7 @@ export class VesselLeakMaxFlammableCloudResults extends EntityBase {
|
|
|
3960
3720
|
toString() {
|
|
3961
3721
|
const parts = [
|
|
3962
3722
|
super.toString(),
|
|
3963
|
-
|
|
3723
|
+
'* VesselLeakMaxFlammableCloudResults',
|
|
3964
3724
|
`dischargeRate: ${this.dischargeRate}`,
|
|
3965
3725
|
`expandedTemperature: ${this.expandedTemperature}`,
|
|
3966
3726
|
`lflExtent: ${this.lflExtent}`,
|
|
@@ -3968,7 +3728,7 @@ export class VesselLeakMaxFlammableCloudResults extends EntityBase {
|
|
|
3968
3728
|
`lflHeight: ${this.lflHeight}`,
|
|
3969
3729
|
`phase: ${this.phase}`,
|
|
3970
3730
|
];
|
|
3971
|
-
return parts.join(
|
|
3731
|
+
return parts.join('\n');
|
|
3972
3732
|
}
|
|
3973
3733
|
}
|
|
3974
3734
|
|
|
@@ -3986,19 +3746,11 @@ export class VesselSphere extends Asset {
|
|
|
3986
3746
|
* @param {Material} options.material - Material in the vessel.
|
|
3987
3747
|
* @param {number} options.massInventory - Mass of the material in the vessel. [kg]
|
|
3988
3748
|
*/
|
|
3989
|
-
constructor(options?: {
|
|
3990
|
-
id?: string;
|
|
3991
|
-
typeId?: string;
|
|
3992
|
-
displayName?: string;
|
|
3993
|
-
location?: LocalPosition;
|
|
3994
|
-
state?: State;
|
|
3995
|
-
material?: Material;
|
|
3996
|
-
massInventory?: number;
|
|
3997
|
-
}) {
|
|
3749
|
+
constructor(options?: { id?: string; typeId?: string; displayName?: string; location?: LocalPosition; state?: State; material?: Material; massInventory?: number }) {
|
|
3998
3750
|
super(options);
|
|
3999
|
-
this.state = options?.state ?? new State();
|
|
4000
|
-
this.material = options?.material ?? new Material();
|
|
4001
|
-
this.massInventory = options?.massInventory;
|
|
3751
|
+
this.state = options?.state ?? new State();
|
|
3752
|
+
this.material = options?.material ?? new Material();
|
|
3753
|
+
this.massInventory = options?.massInventory;
|
|
4002
3754
|
}
|
|
4003
3755
|
|
|
4004
3756
|
/** Initialise the entity with data from a dictionary. */
|
|
@@ -4012,7 +3764,7 @@ export class VesselSphere extends Asset {
|
|
|
4012
3764
|
this.material = new Material();
|
|
4013
3765
|
this.material.initialiseFromDictionary(data.material as { [key: string]: unknown });
|
|
4014
3766
|
}
|
|
4015
|
-
if (data.massInventory !== undefined && typeof data.massInventory ===
|
|
3767
|
+
if (data.massInventory !== undefined && typeof data.massInventory === 'number') {
|
|
4016
3768
|
this.massInventory = data.massInventory as number;
|
|
4017
3769
|
}
|
|
4018
3770
|
}
|
|
@@ -4020,13 +3772,13 @@ export class VesselSphere extends Asset {
|
|
|
4020
3772
|
toString() {
|
|
4021
3773
|
const parts = [
|
|
4022
3774
|
super.toString(),
|
|
4023
|
-
|
|
3775
|
+
'* VesselSphere',
|
|
4024
3776
|
`location: ${this.location?.toString()}`,
|
|
4025
3777
|
`state: ${this.state?.toString()}`,
|
|
4026
3778
|
`material: ${this.material?.toString()}`,
|
|
4027
3779
|
`massInventory: ${this.massInventory}`,
|
|
4028
3780
|
];
|
|
4029
|
-
return parts.join(
|
|
3781
|
+
return parts.join('\n');
|
|
4030
3782
|
}
|
|
4031
3783
|
}
|
|
4032
3784
|
|
|
@@ -4064,45 +3816,45 @@ export class Weather extends EntityBase {
|
|
|
4064
3816
|
windProfileFlag?: Enums.WindProfileFlag;
|
|
4065
3817
|
}) {
|
|
4066
3818
|
super(options?.id, options?.typeId, options?.displayName);
|
|
4067
|
-
this.windSpeed = options?.windSpeed ?? 5;
|
|
4068
|
-
this.stabilityClass = options?.stabilityClass ?? Enums.AtmosphericStabilityClass.STABILITY_D;
|
|
4069
|
-
this.temperature = options?.temperature ?? 283;
|
|
4070
|
-
this.relativeHumidity = options?.relativeHumidity ?? 0.7;
|
|
4071
|
-
this.mixingLayerHeight = options?.mixingLayerHeight ?? 800;
|
|
4072
|
-
this.solarRadiation = options?.solarRadiation ?? 500;
|
|
4073
|
-
this.windProfileFlag = options?.windProfileFlag ?? Enums.WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
3819
|
+
this.windSpeed = options?.windSpeed ?? 5;
|
|
3820
|
+
this.stabilityClass = options?.stabilityClass ?? Enums.AtmosphericStabilityClass.STABILITY_D;
|
|
3821
|
+
this.temperature = options?.temperature ?? 283;
|
|
3822
|
+
this.relativeHumidity = options?.relativeHumidity ?? 0.7;
|
|
3823
|
+
this.mixingLayerHeight = options?.mixingLayerHeight ?? 800;
|
|
3824
|
+
this.solarRadiation = options?.solarRadiation ?? 500;
|
|
3825
|
+
this.windProfileFlag = options?.windProfileFlag ?? Enums.WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
4074
3826
|
}
|
|
4075
3827
|
|
|
4076
3828
|
/** Initialise the entity with data from a dictionary. */
|
|
4077
3829
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
4078
3830
|
super.initialiseFromDictionary(data);
|
|
4079
|
-
if (data.windSpeed !== undefined && typeof data.windSpeed ===
|
|
3831
|
+
if (data.windSpeed !== undefined && typeof data.windSpeed === 'number') {
|
|
4080
3832
|
this.windSpeed = data.windSpeed as number;
|
|
4081
3833
|
}
|
|
4082
|
-
if (data.stabilityClass !== undefined && (typeof data.stabilityClass ===
|
|
3834
|
+
if (data.stabilityClass !== undefined && (typeof data.stabilityClass === 'string' || typeof data.stabilityClass === 'number')) {
|
|
4083
3835
|
this.stabilityClass = this.parseEnumValue(data.stabilityClass, Enums.AtmosphericStabilityClass);
|
|
4084
3836
|
}
|
|
4085
|
-
if (data.temperature !== undefined && typeof data.temperature ===
|
|
3837
|
+
if (data.temperature !== undefined && typeof data.temperature === 'number') {
|
|
4086
3838
|
this.temperature = data.temperature as number;
|
|
4087
3839
|
}
|
|
4088
|
-
if (data.relativeHumidity !== undefined && typeof data.relativeHumidity ===
|
|
3840
|
+
if (data.relativeHumidity !== undefined && typeof data.relativeHumidity === 'number') {
|
|
4089
3841
|
this.relativeHumidity = data.relativeHumidity as number;
|
|
4090
3842
|
}
|
|
4091
|
-
if (data.mixingLayerHeight !== undefined && typeof data.mixingLayerHeight ===
|
|
3843
|
+
if (data.mixingLayerHeight !== undefined && typeof data.mixingLayerHeight === 'number') {
|
|
4092
3844
|
this.mixingLayerHeight = data.mixingLayerHeight as number;
|
|
4093
3845
|
}
|
|
4094
|
-
if (data.solarRadiation !== undefined && typeof data.solarRadiation ===
|
|
3846
|
+
if (data.solarRadiation !== undefined && typeof data.solarRadiation === 'number') {
|
|
4095
3847
|
this.solarRadiation = data.solarRadiation as number;
|
|
4096
3848
|
}
|
|
4097
|
-
if (data.windProfileFlag !== undefined && (typeof data.windProfileFlag ===
|
|
3849
|
+
if (data.windProfileFlag !== undefined && (typeof data.windProfileFlag === 'string' || typeof data.windProfileFlag === 'number')) {
|
|
4098
3850
|
this.windProfileFlag = this.parseEnumValue(data.windProfileFlag, Enums.WindProfileFlag);
|
|
4099
3851
|
}
|
|
4100
3852
|
}
|
|
4101
3853
|
|
|
4102
3854
|
private parseEnumValue<T extends object>(value: unknown, enumType: T): T[keyof T] | undefined {
|
|
4103
|
-
if (typeof value ===
|
|
3855
|
+
if (typeof value === 'string' && value in enumType) {
|
|
4104
3856
|
return enumType[value as keyof T];
|
|
4105
|
-
} else if (typeof value ===
|
|
3857
|
+
} else if (typeof value === 'number' && Object.values(enumType).includes(value)) {
|
|
4106
3858
|
return value as T[keyof T];
|
|
4107
3859
|
}
|
|
4108
3860
|
return undefined; // Return undefined if the value does not match the enum
|
|
@@ -4111,7 +3863,7 @@ export class Weather extends EntityBase {
|
|
|
4111
3863
|
toString() {
|
|
4112
3864
|
const parts = [
|
|
4113
3865
|
super.toString(),
|
|
4114
|
-
|
|
3866
|
+
'* Weather',
|
|
4115
3867
|
`windSpeed: ${this.windSpeed}`,
|
|
4116
3868
|
`stabilityClass: ${this.stabilityClass}`,
|
|
4117
3869
|
`temperature: ${this.temperature}`,
|
|
@@ -4120,6 +3872,6 @@ export class Weather extends EntityBase {
|
|
|
4120
3872
|
`solarRadiation: ${this.solarRadiation}`,
|
|
4121
3873
|
`windProfileFlag: ${this.windProfileFlag}`,
|
|
4122
3874
|
];
|
|
4123
|
-
return parts.join(
|
|
3875
|
+
return parts.join('\n');
|
|
4124
3876
|
}
|
|
4125
3877
|
}
|