@dnv-plant/typescriptpws 1.0.70 → 1.0.73-alpha.1902013
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/jest.config.js +5 -0
- package/package.json +6 -6
- package/src/calculations/applicationTools.ts +2 -2
- package/src/calculations/discharge.ts +2 -2
- package/src/calculations/dispersion.ts +2 -2
- package/src/calculations/dispersionView.ts +2 -2
- package/src/calculations/fireball.ts +2 -2
- package/src/calculations/jetFire.ts +2 -2
- package/src/calculations/lateExplosion.ts +2 -2
- package/src/calculations/linkedRunners.ts +2 -2
- package/src/calculations/poolFire.ts +2 -2
- package/src/calculations/properties.ts +2 -2
- package/src/calculations/radiation.ts +2 -2
- package/src/calculations/standalones.ts +2 -2
- package/src/calculations/toxics.ts +2 -2
- package/src/calculations/utilities.ts +2 -2
- package/src/constants.ts +2 -2
- package/src/entities.ts +2 -2
- package/src/entity-schemas.ts +2 -2
- package/src/enums.ts +2 -2
- package/src/materials.ts +14 -14
- package/src/utilities.ts +2 -2
- package/tests/concentration-at-point-calculation/testCase116.test.ts +146 -0
- package/tests/concentration-at-point-calculation/testCase117.test.ts +142 -0
- package/tests/concentration-at-point-calculation/testCase118.test.ts +143 -0
- package/tests/concentration-at-point-calculation/testCase119.test.ts +149 -0
- package/tests/concentration-at-point-calculation/testCase120.test.ts +155 -0
- package/tests/constants/testConstants.test.ts +23 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase129.test.ts +74 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase130.test.ts +73 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase131.test.ts +73 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase132.test.ts +73 -0
- package/tests/convert-comp-mass-to-mole-calculation/testCase133.test.ts +73 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase134.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase135.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase136.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase137.test.ts +72 -0
- package/tests/convert-comp-mole-to-mass-calculation/testCase138.test.ts +72 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase64.test.ts +194 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase65.test.ts +197 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase66.test.ts +194 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase67.test.ts +198 -0
- package/tests/distances-and-ellipses-to-radiation-levels-calculation/testCase68.test.ts +178 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase31a.test.ts +158 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase32a.test.ts +156 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase33a.test.ts +158 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase34a.test.ts +165 -0
- package/tests/distances-and-footprints-to-concentration-levels-calculation/testCase35a.test.ts +188 -0
- package/tests/distances-to-conc-levels-calculation/testCase121.test.ts +149 -0
- package/tests/distances-to-conc-levels-calculation/testCase122.test.ts +145 -0
- package/tests/distances-to-conc-levels-calculation/testCase123.test.ts +150 -0
- package/tests/distances-to-conc-levels-calculation/testCase124.test.ts +154 -0
- package/tests/distances-to-conc-levels-calculation/testCase125.test.ts +157 -0
- package/tests/entities/testVessel.test.ts +49 -0
- package/tests/fireball-calculation/testCase89.test.ts +151 -0
- package/tests/fireball-calculation/testCase90.test.ts +153 -0
- package/tests/fireball-calculation/testCase91.test.ts +152 -0
- package/tests/fireball-calculation/testCse92.test.ts +150 -0
- package/tests/flash-calculation/testCase26.test.ts +71 -0
- package/tests/flash-calculation/testCase27.test.ts +69 -0
- package/tests/flash-calculation/testCase28.test.ts +69 -0
- package/tests/flash-calculation/testCase29.test.ts +67 -0
- package/tests/flash-calculation/testCase30.test.ts +70 -0
- package/tests/general/operation-id-demo.test.ts +64 -0
- package/tests/get-component-by-id/get-component-by-id-METHANE.test.ts +35 -0
- package/tests/get-mass-from-vessel-calculation/testCase139.test.ts +65 -0
- package/tests/jet-fire-calculation/testCase36.test.ts +141 -0
- package/tests/jet-fire-calculation/testCase37.test.ts +148 -0
- package/tests/jet-fire-calculation/testCase38.test.ts +147 -0
- package/tests/jet-fire-calculation/testCase39.test.ts +146 -0
- package/tests/jet-fire-calculation/testCase40.test.ts +152 -0
- package/tests/late-explosion-calculation/testCase46.test.ts +157 -0
- package/tests/late-explosion-calculation/testCase47.test.ts +149 -0
- package/tests/late-explosion-calculation/testCase48.test.ts +176 -0
- package/tests/late-explosion-calculation/testCase49.test.ts +178 -0
- package/tests/late-explosion-calculation/testCase50.test.ts +176 -0
- package/tests/late-explosion-calculation/testCase74.test.ts +166 -0
- package/tests/late-explosion-calculation/testCase75.test.ts +163 -0
- package/tests/late-explosion-calculation/testCase76.test.ts +174 -0
- package/tests/late-explosion-calculation/testCase77.test.ts +175 -0
- package/tests/late-explosion-calculation/testCase78.test.ts +175 -0
- package/tests/lethality-distance-calculation/testCase60.test.ts +142 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-153.test.ts +121 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-154.test.ts +167 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-155.test.ts +202 -0
- package/tests/linked-runners/user-defined-source-linked-run/test-uds-156.test.ts +201 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-157.test.ts +182 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-158.test.ts +200 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-159.test.ts +158 -0
- package/tests/linked-runners/vessel-leak-linked-run/test-vl-160.test.ts +165 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-161.test.ts +161 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-162.test.ts +167 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-163.test.ts +177 -0
- package/tests/linked-runners/vessel-line-rupture-linked-run/test-vlr-164.test.ts +165 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-165.test.ts +166 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-166.test.ts +154 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-167.test.ts +157 -0
- package/tests/linked-runners/vessel-relief-valve-linked-run/test-vrv-168.test.ts +168 -0
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase126.test.ts +72 -0
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase127.test.ts +73 -0
- package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase128.test.ts +72 -0
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase103.test.ts +74 -0
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase104.test.ts +75 -0
- package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase105.test.ts +74 -0
- package/tests/long-pipe-calculation/testCase55.test.ts +88 -0
- package/tests/long-pipe-calculation/testCase56.test.ts +90 -0
- package/tests/long-pipe-calculation/testCase57.test.ts +88 -0
- package/tests/long-pipe-calculation/testCase58.test.ts +88 -0
- package/tests/long-pipe-calculation/testCase59.test.ts +88 -0
- package/tests/materials/test-get-component-by-cas-id-1-2-PROPYLENE-OXIDE.test.ts +23 -0
- package/tests/materials/test-get-component-by-cas-id-CARBON-MONOXIDE.test.ts +25 -0
- package/tests/materials/test-get-component-by-cas-id-METHANE.test.ts +22 -0
- package/tests/materials/test-get-component-by-id-1-2-PROPYLENE-OXIDE.test.ts +23 -0
- package/tests/materials/test-get-component-by-id-CARBON-MONOXIDE.test.ts +22 -0
- package/tests/materials/test-get-component-by-id-METHANE.test.ts +22 -0
- package/tests/materials/test-get-component-by-name-1-2-PROPYLENE-OXIDE.test.ts +24 -0
- package/tests/materials/test-get-component-by-name-CARBON-MONOXIDE.test.ts +23 -0
- package/tests/materials/test-get-component-by-name-METHANE.test.ts +25 -0
- package/tests/materials/test-get-components.test.ts +47 -0
- package/tests/materials/test-get-dippr-components.test.ts +28 -0
- package/tests/materials/test-get-dnv-components.test.ts +28 -0
- package/tests/materials/test-get-material-by-cas-id-1-2-PROPYLENE-OXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-cas-id-CARBON-MONOXIDE.test.ts +31 -0
- package/tests/materials/test-get-material-by-cas-id-METHANE.test.ts +30 -0
- package/tests/materials/test-get-material-by-cas-id-ZERO.test.ts +31 -0
- package/tests/materials/test-get-material-by-id-1-2-PROPYLENE-OXIDE.test.ts +30 -0
- package/tests/materials/test-get-material-by-id-CARBON-MONOXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-id-METHANE.test.ts +29 -0
- package/tests/materials/test-get-material-by-name-1-2-PROPYLENE-OXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-name-CARBON-MONOXIDE.test.ts +29 -0
- package/tests/materials/test-get-material-by-name-METHANE.test.ts +29 -0
- package/tests/materials/test-get-materials.test.ts +32 -0
- package/tests/max-conc-distance-calculation/testCase106.test.ts +146 -0
- package/tests/max-conc-distance-calculation/testCase107.test.ts +148 -0
- package/tests/max-conc-distance-calculation/testCase108.test.ts +172 -0
- package/tests/max-conc-distance-calculation/testCase109.test.ts +146 -0
- package/tests/max-conc-distance-calculation/testCase110.test.ts +146 -0
- package/tests/max-conc-footprint-calculation/testCase31.test.ts +169 -0
- package/tests/max-conc-footprint-calculation/testCase32.test.ts +183 -0
- package/tests/max-conc-footprint-calculation/testCase33.test.ts +161 -0
- package/tests/max-conc-footprint-calculation/testCase34.test.ts +172 -0
- package/tests/max-conc-footprint-calculation/testCase35.test.ts +188 -0
- package/tests/max-distance-to-conc-calculation/testCase111.test.ts +138 -0
- package/tests/max-distance-to-conc-calculation/testCase112.test.ts +174 -0
- package/tests/max-distance-to-conc-calculation/testCase113.test.ts +153 -0
- package/tests/max-distance-to-conc-calculation/testCase114.test.ts +162 -0
- package/tests/max-distance-to-conc-calculation/testCase115.test.ts +167 -0
- package/tests/mixture-constant-properties-calculation/testCase97.test.ts +83 -0
- package/tests/mixture-constant-properties-calculation/testCase98.test.ts +90 -0
- package/tests/mixture-constant-properties-calculation/testCase99.test.ts +87 -0
- package/tests/pool-fire-calculation/testCase41.test.ts +153 -0
- package/tests/pool-fire-calculation/testCase41a.test.ts +141 -0
- package/tests/pool-fire-calculation/testCase42.test.ts +169 -0
- package/tests/pool-fire-calculation/testCase42a.test.ts +175 -0
- package/tests/pool-fire-calculation/testCase43.test.ts +161 -0
- package/tests/pool-fire-calculation/testCase43a.test.ts +157 -0
- package/tests/pool-fire-calculation/testCase44.test.ts +147 -0
- package/tests/pool-fire-calculation/testCase44a.test.ts +152 -0
- package/tests/pool-fire-calculation/testCase45.test.ts +176 -0
- package/tests/pool-fire-calculation/testCase45a.test.ts +182 -0
- package/tests/radiation-at-ponts/testCase69.test.ts +167 -0
- package/tests/radiation-at-ponts/testCase70.test.ts +179 -0
- package/tests/radiation-at-ponts/testCase71.test.ts +150 -0
- package/tests/radiation-at-ponts/testCase72.test.ts +166 -0
- package/tests/radiation-at-ponts/testCase73.test.ts +169 -0
- package/tests/radiation-contour-calculation/testCase51.test.ts +127 -0
- package/tests/radiation-contour-calculation/testCase52.test.ts +126 -0
- package/tests/radiation-contour-calculation/testCase53.test.ts +126 -0
- package/tests/radiation-contour-calculation/testCase54.test.ts +131 -0
- package/tests/relief-valve-min-temperature-calculation/testCase140.test.ts +49 -0
- package/tests/set-mixing-layer-height/testCase100.test.ts +36 -0
- package/tests/set-mixing-layer-height/testCase101.test.ts +36 -0
- package/tests/set-mixing-layer-height/testCase102.test.ts +36 -0
- package/tests/set-phase-to-be-released-for-leak-calculation/testCase150.test.ts +67 -0
- package/tests/set-phase-to-be-released-for-line-rupture-calculation/testCase151.test.ts +67 -0
- package/tests/set-phase-to-be-released-for-relief-valve-calculation/TestCase152.test.ts +61 -0
- package/tests/sideview/testCase31b.test.ts +150 -0
- package/tests/sideview/testCase32b.test.ts +145 -0
- package/tests/sideview/testCase33b.test.ts +130 -0
- package/tests/sideview/testCase34b.test.ts +153 -0
- package/tests/sideview/testCase35b.test.ts +140 -0
- package/tests/tank-fire-calculation/testCase79.test.ts +61 -0
- package/tests/tank-fire-calculation/testCase80.test.ts +67 -0
- package/tests/tank-fire-calculation/testCase81.test.ts +68 -0
- package/tests/tank-fire-calculation/testCase82.test.ts +68 -0
- package/tests/tank-fire-calculation/testCase83.test.ts +73 -0
- package/tests/utilities/convert-camel-case-to-snake-case.test.ts +7 -0
- package/tests/utilities/convert-snake-case-to-camel-case.test.ts +7 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase1.test.ts +83 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase2.test.ts +82 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase3.test.ts +91 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase4.test.ts +85 -0
- package/tests/vessel-catastrophic-rupture-calculation/testCase5.test.ts +84 -0
- package/tests/vessel-leak-calculation/testCase10.test.ts +108 -0
- package/tests/vessel-leak-calculation/testCase6.test.ts +113 -0
- package/tests/vessel-leak-calculation/testCase7.test.ts +123 -0
- package/tests/vessel-leak-calculation/testCase8.test.ts +102 -0
- package/tests/vessel-leak-calculation/testCase9.test.ts +106 -0
- package/tests/vessel-line-rupture-calculation/vlr-ammonia.test.ts +84 -0
- package/tests/vessel-line-rupture-calculation/vlr-ethaneMethane.test.ts +82 -0
- package/tests/vessel-line-rupture-calculation/vlr-nDecane.test.ts +79 -0
- package/tests/vessel-line-rupture-calculation/vlr-oxygen.test.ts +77 -0
- package/tests/vessel-line-rupture-calculation/vlr-propane.test.ts +77 -0
- package/tests/vessel-relief-valve-calculation/vrv-chlorine.test.ts +99 -0
- package/tests/vessel-relief-valve-calculation/vrv-hydrogen.test.ts +96 -0
- package/tests/vessel-relief-valve-calculation/vrv-methane.test.ts +80 -0
- package/tests/vessel-relief-valve-calculation/vrv-methaneH2s.test.ts +86 -0
- package/tests/vessel-relief-valve-calculation/vrv-nitrogen.test.ts +80 -0
- package/tests/vessel-state-calculation/vs-ammonia.test.ts +56 -0
- package/tests/vessel-state-calculation/vs-butane.test.ts +57 -0
- package/tests/vessel-state-calculation/vs-chlorine.test.ts +56 -0
- package/tests/vessel-state-calculation/vs-methane.test.ts +57 -0
- package/tests/vessel-state-calculation/vs-naturalGas.test.ts +59 -0
- package/tests/vessel-state-calculation/vs-nitrogenPentane.test.ts +58 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { VesselLeakLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLeakScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import { Material, MaterialComponent, Weather, Substrate, DischargeParameters, FlammableParameters, DispersionParameters, ExplosionParameters, ExplosionOutputConfig, ExplosionConfinedVolume, FlammableOutputConfig, DispersionOutputConfig } from "../../../src/entities";
|
|
4
|
+
import { ResultCode, AtmosphericStabilityClass, SpecialConcentration, WindProfileFlag } from "../../../src/enums";
|
|
5
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
6
|
+
|
|
7
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
8
|
+
|
|
9
|
+
if (!accessToken) {
|
|
10
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
setAccessToken(accessToken);
|
|
14
|
+
|
|
15
|
+
describe("VesselLeakLinkedRunCalculation - VLR_157", () => {
|
|
16
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
17
|
+
// Create material with Ammonia
|
|
18
|
+
const material = new Material({
|
|
19
|
+
name: "AMMONIA",
|
|
20
|
+
components: [new MaterialComponent({ name: "AMMONIA", moleFraction: 1.0 })],
|
|
21
|
+
componentCount: 1
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Create a load mass inventory vessel for leak scenario calculation using the material
|
|
25
|
+
const loadMassInventoryVesselForLeakScenarioCalculation = new LoadMassInventoryVesselForLeakScenarioCalculation(
|
|
26
|
+
material,
|
|
27
|
+
1e3,
|
|
28
|
+
11e5,
|
|
29
|
+
250,
|
|
30
|
+
0.008,
|
|
31
|
+
1.0,
|
|
32
|
+
0.35
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Run the calculation
|
|
36
|
+
console.log('Running load_mass_inventory_vessel_for_leak_scenario_calculation...');
|
|
37
|
+
const loadResultCode = await loadMassInventoryVesselForLeakScenarioCalculation.run();
|
|
38
|
+
|
|
39
|
+
// Print any messages
|
|
40
|
+
if (loadMassInventoryVesselForLeakScenarioCalculation.messages.length > 0) {
|
|
41
|
+
console.log('Messages:');
|
|
42
|
+
loadMassInventoryVesselForLeakScenarioCalculation.messages.forEach((msg) => console.log(msg));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
46
|
+
|
|
47
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
48
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_leak_scenario_calculation (${loadMassInventoryVesselForLeakScenarioCalculation.calculationElapsedTime}ms)`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Define the weather conditions
|
|
52
|
+
const weather = new Weather({
|
|
53
|
+
windSpeed: 5.0,
|
|
54
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_B,
|
|
55
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Define the substrate
|
|
59
|
+
const substrate = new Substrate();
|
|
60
|
+
|
|
61
|
+
// Define the dispersion parameters
|
|
62
|
+
const dispersionParameters = [
|
|
63
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
64
|
+
new DispersionParameters({ averagingTime: 18.75 })
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// Define the dispersion output configuration
|
|
68
|
+
const dispersionOutputConfigsFlammable = [
|
|
69
|
+
new DispersionOutputConfig({
|
|
70
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
71
|
+
elevation: 0.0
|
|
72
|
+
})
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
const dispersionOutputConfigsToxic = [
|
|
76
|
+
new DispersionOutputConfig({
|
|
77
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
78
|
+
concentration: 5e-5,
|
|
79
|
+
elevation: 0.0
|
|
80
|
+
})
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
// Define the flammable parameters
|
|
84
|
+
const flammableParameters = new FlammableParameters();
|
|
85
|
+
|
|
86
|
+
// Define the flammable output configuration
|
|
87
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
88
|
+
|
|
89
|
+
// Define the explosion parameters
|
|
90
|
+
const explosionParameters = new ExplosionParameters();
|
|
91
|
+
|
|
92
|
+
// Define the explosion output configuration
|
|
93
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
94
|
+
|
|
95
|
+
// Define the explosion confined volumes
|
|
96
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
97
|
+
|
|
98
|
+
// Create the vessel leak linked run calculation
|
|
99
|
+
const vesselLeakLinkedRunCalculation = new VesselLeakLinkedRunCalculation(
|
|
100
|
+
loadMassInventoryVesselForLeakScenarioCalculation.vessel!,
|
|
101
|
+
loadMassInventoryVesselForLeakScenarioCalculation.leak!,
|
|
102
|
+
new DischargeParameters(),
|
|
103
|
+
substrate,
|
|
104
|
+
weather,
|
|
105
|
+
dispersionParameters,
|
|
106
|
+
dispersionParameters.length,
|
|
107
|
+
0.0,
|
|
108
|
+
flammableParameters,
|
|
109
|
+
explosionParameters,
|
|
110
|
+
dispersionOutputConfigsFlammable,
|
|
111
|
+
dispersionOutputConfigsFlammable.length,
|
|
112
|
+
dispersionOutputConfigsToxic,
|
|
113
|
+
dispersionOutputConfigsToxic.length,
|
|
114
|
+
flammableOutputConfigs,
|
|
115
|
+
flammableOutputConfigs.length,
|
|
116
|
+
explosionOutputConfigs,
|
|
117
|
+
explosionOutputConfigs.length,
|
|
118
|
+
explosionConfinedVolumes,
|
|
119
|
+
explosionConfinedVolumes.length
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// Run the calculation
|
|
123
|
+
console.log('Running vessel_leak_linked_run_calculation...');
|
|
124
|
+
const resultCode = await vesselLeakLinkedRunCalculation.run();
|
|
125
|
+
|
|
126
|
+
// Print any messages
|
|
127
|
+
if (vesselLeakLinkedRunCalculation.messages.length > 0) {
|
|
128
|
+
console.log('Messages:');
|
|
129
|
+
vesselLeakLinkedRunCalculation.messages.forEach((msg) => console.log(msg));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
133
|
+
|
|
134
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
135
|
+
// Check if the results match expected values within tolerance
|
|
136
|
+
expect(
|
|
137
|
+
Math.abs(vesselLeakLinkedRunCalculation.dischargeRecord!.massFlow! - 1.2425987768572015) / 1.2425987768572015
|
|
138
|
+
).toBeLessThan(1e-3);
|
|
139
|
+
|
|
140
|
+
expect(
|
|
141
|
+
Math.abs(vesselLeakLinkedRunCalculation.jetFireFlameResult!.flameLength! - 20.59055621597361) / 20.59055621597361
|
|
142
|
+
).toBeLessThan(1e-3);
|
|
143
|
+
|
|
144
|
+
expect(vesselLeakLinkedRunCalculation.poolFireFlameResult!.flameDiameter).toBe(0.0);
|
|
145
|
+
|
|
146
|
+
expect(vesselLeakLinkedRunCalculation.flamConcContourPoints!.length).toBe(0);
|
|
147
|
+
|
|
148
|
+
expect(vesselLeakLinkedRunCalculation.toxicConcContourPoints!.length).toBe(603);
|
|
149
|
+
|
|
150
|
+
expect(vesselLeakLinkedRunCalculation.areaFootprintFlamConc![0]).toBe(0.0);
|
|
151
|
+
|
|
152
|
+
expect(
|
|
153
|
+
Math.abs(vesselLeakLinkedRunCalculation.areaFootprintToxicConc![0] - 28937.347548819664) / 28937.347548819664
|
|
154
|
+
).toBeLessThan(1e-3);
|
|
155
|
+
|
|
156
|
+
expect(
|
|
157
|
+
Math.abs(vesselLeakLinkedRunCalculation.areaContourJet![0] - 239.35604734762828) / 239.35604734762828
|
|
158
|
+
).toBeLessThan(1e-3);
|
|
159
|
+
|
|
160
|
+
expect(vesselLeakLinkedRunCalculation.areaContourPool![0]).toBe(0.0);
|
|
161
|
+
|
|
162
|
+
expect(vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].explodedMass).toBe(0.0);
|
|
163
|
+
|
|
164
|
+
expect(vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].maximumDistance).toBe(0.0);
|
|
165
|
+
|
|
166
|
+
// Log key results
|
|
167
|
+
console.log(`Mass flow = ${vesselLeakLinkedRunCalculation.dischargeRecord!.massFlow}`);
|
|
168
|
+
console.log(`Flame length = ${vesselLeakLinkedRunCalculation.jetFireFlameResult!.flameLength}`);
|
|
169
|
+
console.log(`Flame diameter = ${vesselLeakLinkedRunCalculation.poolFireFlameResult!.flameDiameter}`);
|
|
170
|
+
console.log(`Length of the dispersion flammable contour array = ${vesselLeakLinkedRunCalculation.flamConcContourPoints!.length}`);
|
|
171
|
+
console.log(`Length of the dispersion toxic contour array = ${vesselLeakLinkedRunCalculation.toxicConcContourPoints!.length}`);
|
|
172
|
+
console.log(`Area of the flammable cloud = ${vesselLeakLinkedRunCalculation.areaFootprintFlamConc![0]}`);
|
|
173
|
+
console.log(`Area of the toxic cloud = ${vesselLeakLinkedRunCalculation.areaFootprintToxicConc![0]}`);
|
|
174
|
+
console.log(`Area of the jet fire = ${vesselLeakLinkedRunCalculation.areaContourJet![0]}`);
|
|
175
|
+
console.log(`Area of the pool = ${vesselLeakLinkedRunCalculation.areaContourPool![0]}`);
|
|
176
|
+
console.log(`Flammable mass = ${vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].explodedMass}`);
|
|
177
|
+
console.log(`Explosion maximum distance = ${vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].maximumDistance}`);
|
|
178
|
+
|
|
179
|
+
console.log(`SUCCESS: vessel_leak_linked_run_calculation (${vesselLeakLinkedRunCalculation.calculationElapsedTime}ms)`);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { VesselLeakLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLeakScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import { Material, MaterialComponent, Weather, Substrate, DischargeParameters, FlammableParameters, DispersionParameters, ExplosionParameters, ExplosionOutputConfig, ExplosionConfinedVolume, FlammableOutputConfig, DispersionOutputConfig } from "../../../src/entities";
|
|
4
|
+
import { ResultCode, AtmosphericStabilityClass, SpecialConcentration, WindProfileFlag, MixtureModelling } from "../../../src/enums";
|
|
5
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
6
|
+
|
|
7
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
8
|
+
|
|
9
|
+
if (!accessToken) {
|
|
10
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
setAccessToken(accessToken);
|
|
14
|
+
|
|
15
|
+
describe("VesselLeakLinkedRunCalculation - VLR_158", () => {
|
|
16
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
17
|
+
// Create material with a mixture of propane, butane, and pentane
|
|
18
|
+
const material = new Material({
|
|
19
|
+
name: "PROPANE+N-BUTANE+N-PENTANE",
|
|
20
|
+
components: [
|
|
21
|
+
new MaterialComponent({ name: "PROPANE", moleFraction: 0.1 }),
|
|
22
|
+
new MaterialComponent({ name: "N-BUTANE", moleFraction: 0.3 }),
|
|
23
|
+
new MaterialComponent({ name: "N-PENTANE", moleFraction: 0.6 })
|
|
24
|
+
],
|
|
25
|
+
componentCount: 3
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Create a load mass inventory vessel for leak scenario calculation using the material
|
|
29
|
+
const loadMassInventoryVesselForLeakScenarioCalculation = new LoadMassInventoryVesselForLeakScenarioCalculation(
|
|
30
|
+
material,
|
|
31
|
+
1e4,
|
|
32
|
+
6e5,
|
|
33
|
+
250,
|
|
34
|
+
0.08,
|
|
35
|
+
1.0,
|
|
36
|
+
0.0
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Run the calculation
|
|
40
|
+
console.log('Running load_mass_inventory_vessel_for_leak_scenario_calculation...');
|
|
41
|
+
const loadResultCode = await loadMassInventoryVesselForLeakScenarioCalculation.run();
|
|
42
|
+
|
|
43
|
+
// Print any messages
|
|
44
|
+
if (loadMassInventoryVesselForLeakScenarioCalculation.messages.length > 0) {
|
|
45
|
+
console.log('Messages:');
|
|
46
|
+
loadMassInventoryVesselForLeakScenarioCalculation.messages.forEach((msg) => console.log(msg));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
50
|
+
|
|
51
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
52
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_leak_scenario_calculation (${loadMassInventoryVesselForLeakScenarioCalculation.calculationElapsedTime}ms)`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Define the weather conditions
|
|
56
|
+
const weather = new Weather({
|
|
57
|
+
windSpeed: 5.0,
|
|
58
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_B,
|
|
59
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Define the substrate
|
|
63
|
+
const substrate = new Substrate();
|
|
64
|
+
|
|
65
|
+
// Define the dispersion parameters
|
|
66
|
+
const dispersionParameters = [
|
|
67
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
68
|
+
new DispersionParameters({ averagingTime: 18.75 })
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
// Define the dispersion output configuration
|
|
72
|
+
const dispersionOutputConfigsFlammable = [
|
|
73
|
+
new DispersionOutputConfig({
|
|
74
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
75
|
+
elevation: 0.0
|
|
76
|
+
})
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const dispersionOutputConfigsToxic = [
|
|
80
|
+
new DispersionOutputConfig({
|
|
81
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
82
|
+
concentration: 5e-5,
|
|
83
|
+
elevation: 0.0
|
|
84
|
+
})
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
// Define the flammable parameters
|
|
88
|
+
const flammableParameters = new FlammableParameters();
|
|
89
|
+
|
|
90
|
+
// Define the flammable output configuration
|
|
91
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
92
|
+
|
|
93
|
+
// Define the explosion parameters
|
|
94
|
+
const explosionParameters = new ExplosionParameters();
|
|
95
|
+
|
|
96
|
+
// Define the explosion output configuration
|
|
97
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
98
|
+
|
|
99
|
+
// Define the explosion confined volumes
|
|
100
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
101
|
+
|
|
102
|
+
// Set mixture modeling to MC_MULTIPLE_AEROSOL
|
|
103
|
+
const vessel = loadMassInventoryVesselForLeakScenarioCalculation.vessel!;
|
|
104
|
+
vessel.state!.mixtureModelling = MixtureModelling.MC_MULTIPLE_AEROSOL;
|
|
105
|
+
|
|
106
|
+
// Create the vessel leak linked run calculation
|
|
107
|
+
const vesselLeakLinkedRunCalculation = new VesselLeakLinkedRunCalculation(
|
|
108
|
+
vessel,
|
|
109
|
+
loadMassInventoryVesselForLeakScenarioCalculation.leak!,
|
|
110
|
+
new DischargeParameters(),
|
|
111
|
+
substrate,
|
|
112
|
+
weather,
|
|
113
|
+
dispersionParameters,
|
|
114
|
+
dispersionParameters.length,
|
|
115
|
+
0.0,
|
|
116
|
+
flammableParameters,
|
|
117
|
+
explosionParameters,
|
|
118
|
+
dispersionOutputConfigsFlammable,
|
|
119
|
+
dispersionOutputConfigsFlammable.length,
|
|
120
|
+
dispersionOutputConfigsToxic,
|
|
121
|
+
dispersionOutputConfigsToxic.length,
|
|
122
|
+
flammableOutputConfigs,
|
|
123
|
+
flammableOutputConfigs.length,
|
|
124
|
+
explosionOutputConfigs,
|
|
125
|
+
explosionOutputConfigs.length,
|
|
126
|
+
explosionConfinedVolumes,
|
|
127
|
+
explosionConfinedVolumes.length
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
// Run the calculation
|
|
131
|
+
console.log('Running vessel_leak_linked_run_calculation...');
|
|
132
|
+
const resultCode = await vesselLeakLinkedRunCalculation.run();
|
|
133
|
+
|
|
134
|
+
// Print any messages
|
|
135
|
+
if (vesselLeakLinkedRunCalculation.messages.length > 0) {
|
|
136
|
+
console.log('Messages:');
|
|
137
|
+
vesselLeakLinkedRunCalculation.messages.forEach((msg) => console.log(msg));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
141
|
+
|
|
142
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
143
|
+
// Check if the results match expected values within tolerance
|
|
144
|
+
expect(
|
|
145
|
+
Math.abs(vesselLeakLinkedRunCalculation.dischargeRecord!.massFlow! - 79.92636564283663) / 79.92636564283663
|
|
146
|
+
).toBeLessThan(1e-3);
|
|
147
|
+
|
|
148
|
+
expect(
|
|
149
|
+
Math.abs(vesselLeakLinkedRunCalculation.jetFireFlameResult!.flameLength! - 77.05440102800145) / 77.05440102800145
|
|
150
|
+
).toBeLessThan(1e-3);
|
|
151
|
+
|
|
152
|
+
expect(
|
|
153
|
+
Math.abs(vesselLeakLinkedRunCalculation.poolFireFlameResult!.flameDiameter! - 41.782142639160156) / 41.782142639160156
|
|
154
|
+
).toBeLessThan(1e-3);
|
|
155
|
+
|
|
156
|
+
expect(vesselLeakLinkedRunCalculation.flamConcContourPoints!.length).toBe(601);
|
|
157
|
+
|
|
158
|
+
expect(vesselLeakLinkedRunCalculation.toxicConcContourPoints!.length).toBe(693);
|
|
159
|
+
|
|
160
|
+
expect(
|
|
161
|
+
Math.abs(vesselLeakLinkedRunCalculation.areaFootprintFlamConc![0] - 11080.56953438209) / 11080.56953438209
|
|
162
|
+
).toBeLessThan(1e-3);
|
|
163
|
+
|
|
164
|
+
expect(
|
|
165
|
+
Math.abs(vesselLeakLinkedRunCalculation.areaFootprintToxicConc![0] - 445160.15045601147) / 445160.15045601147
|
|
166
|
+
).toBeLessThan(1e-3);
|
|
167
|
+
|
|
168
|
+
expect(
|
|
169
|
+
Math.abs(vesselLeakLinkedRunCalculation.areaContourJet![0] - 61978.79874189871) / 61978.79874189871
|
|
170
|
+
).toBeLessThan(1e-3);
|
|
171
|
+
|
|
172
|
+
expect(
|
|
173
|
+
Math.abs(vesselLeakLinkedRunCalculation.areaContourPool![0] - 14778.202000753792) / 14778.202000753792
|
|
174
|
+
).toBeLessThan(1e-3);
|
|
175
|
+
|
|
176
|
+
expect(
|
|
177
|
+
Math.abs(vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].explodedMass! - 680.3354816239089) / 680.3354816239089
|
|
178
|
+
).toBeLessThan(1e-3);
|
|
179
|
+
|
|
180
|
+
expect(
|
|
181
|
+
Math.abs(vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].maximumDistance! - 552.0412952025639) / 552.0412952025639
|
|
182
|
+
).toBeLessThan(1e-3);
|
|
183
|
+
|
|
184
|
+
// Log key results
|
|
185
|
+
console.log(`Mass flow = ${vesselLeakLinkedRunCalculation.dischargeRecord!.massFlow}`);
|
|
186
|
+
console.log(`Flame length = ${vesselLeakLinkedRunCalculation.jetFireFlameResult!.flameLength}`);
|
|
187
|
+
console.log(`Flame diameter = ${vesselLeakLinkedRunCalculation.poolFireFlameResult!.flameDiameter}`);
|
|
188
|
+
console.log(`Length of the dispersion flammable contour array = ${vesselLeakLinkedRunCalculation.flamConcContourPoints!.length}`);
|
|
189
|
+
console.log(`Length of the dispersion toxic contour array = ${vesselLeakLinkedRunCalculation.toxicConcContourPoints!.length}`);
|
|
190
|
+
console.log(`Area of the flammable cloud = ${vesselLeakLinkedRunCalculation.areaFootprintFlamConc![0]}`);
|
|
191
|
+
console.log(`Area of the toxic cloud = ${vesselLeakLinkedRunCalculation.areaFootprintToxicConc![0]}`);
|
|
192
|
+
console.log(`Area of the jet fire = ${vesselLeakLinkedRunCalculation.areaContourJet![0]}`);
|
|
193
|
+
console.log(`Area of the pool = ${vesselLeakLinkedRunCalculation.areaContourPool![0]}`);
|
|
194
|
+
console.log(`Flammable mass = ${vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].explodedMass}`);
|
|
195
|
+
console.log(`Explosion maximum distance = ${vesselLeakLinkedRunCalculation.explosionOverpressureResults![0].maximumDistance}`);
|
|
196
|
+
|
|
197
|
+
console.log(`SUCCESS: vessel_leak_linked_run_calculation (${vesselLeakLinkedRunCalculation.calculationElapsedTime}ms)`);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { VesselLeakLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLeakScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material, MaterialComponent, Weather, Substrate, DischargeParameters,
|
|
5
|
+
FlammableParameters, DispersionParameters, ExplosionParameters,
|
|
6
|
+
ExplosionOutputConfig, ExplosionConfinedVolume, FlammableOutputConfig,
|
|
7
|
+
DispersionOutputConfig
|
|
8
|
+
} from "../../../src/entities";
|
|
9
|
+
import {
|
|
10
|
+
ResultCode, AtmosphericStabilityClass, SpecialConcentration,
|
|
11
|
+
WindProfileFlag, MixtureModelling
|
|
12
|
+
} from "../../../src/enums";
|
|
13
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
14
|
+
|
|
15
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
16
|
+
|
|
17
|
+
if (!accessToken) {
|
|
18
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setAccessToken(accessToken);
|
|
22
|
+
|
|
23
|
+
describe("VesselLeakLinkedRunCalculation - VLR_159", () => {
|
|
24
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
25
|
+
const material = new Material({
|
|
26
|
+
name: "H2S+N-BUTANE",
|
|
27
|
+
components: [
|
|
28
|
+
new MaterialComponent({ name: "HYDROGEN SULFIDE", moleFraction: 0.02 }),
|
|
29
|
+
new MaterialComponent({ name: "N-BUTANE", moleFraction: 0.98 })
|
|
30
|
+
],
|
|
31
|
+
componentCount: 2
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const loadCalc = new LoadMassInventoryVesselForLeakScenarioCalculation(
|
|
35
|
+
material,
|
|
36
|
+
1e4, // mass
|
|
37
|
+
6e5, // pressure
|
|
38
|
+
250, // temperature
|
|
39
|
+
0.08, // hole size
|
|
40
|
+
1.0, // release elevation
|
|
41
|
+
0.0 // release angle
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
console.log("Running load_mass_inventory_vessel_for_leak_scenario_calculation...");
|
|
45
|
+
const loadResult = await loadCalc.run();
|
|
46
|
+
|
|
47
|
+
if (loadCalc.messages.length > 0) {
|
|
48
|
+
console.log("Messages:");
|
|
49
|
+
loadCalc.messages.forEach(msg => console.log(msg));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
expect(loadResult).toBe(ResultCode.SUCCESS);
|
|
53
|
+
|
|
54
|
+
if (loadResult === ResultCode.SUCCESS) {
|
|
55
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_leak_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const weather = new Weather({
|
|
59
|
+
windSpeed: 5.0,
|
|
60
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_B,
|
|
61
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const substrate = new Substrate();
|
|
65
|
+
|
|
66
|
+
const dispersionParams = [
|
|
67
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
68
|
+
new DispersionParameters({ averagingTime: 18.75 })
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const flamOutputConfigs = [
|
|
72
|
+
new DispersionOutputConfig({
|
|
73
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
74
|
+
elevation: 0.0
|
|
75
|
+
})
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
const toxicOutputConfigs = [
|
|
79
|
+
new DispersionOutputConfig({
|
|
80
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
81
|
+
concentration: 5e-5,
|
|
82
|
+
elevation: 0.0
|
|
83
|
+
})
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const flammableParams = new FlammableParameters();
|
|
87
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
88
|
+
const explosionParams = new ExplosionParameters();
|
|
89
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
90
|
+
const confinedVolumes = [new ExplosionConfinedVolume()];
|
|
91
|
+
|
|
92
|
+
const vessel = loadCalc.vessel!;
|
|
93
|
+
vessel.state!.mixtureModelling = MixtureModelling.MC_MULTIPLE_AEROSOL;
|
|
94
|
+
|
|
95
|
+
const vlrCalc = new VesselLeakLinkedRunCalculation(
|
|
96
|
+
vessel,
|
|
97
|
+
loadCalc.leak!,
|
|
98
|
+
new DischargeParameters(),
|
|
99
|
+
substrate,
|
|
100
|
+
weather,
|
|
101
|
+
dispersionParams,
|
|
102
|
+
dispersionParams.length,
|
|
103
|
+
0.0,
|
|
104
|
+
flammableParams,
|
|
105
|
+
explosionParams,
|
|
106
|
+
flamOutputConfigs,
|
|
107
|
+
flamOutputConfigs.length,
|
|
108
|
+
toxicOutputConfigs,
|
|
109
|
+
toxicOutputConfigs.length,
|
|
110
|
+
flammableOutputConfigs,
|
|
111
|
+
flammableOutputConfigs.length,
|
|
112
|
+
explosionOutputConfigs,
|
|
113
|
+
explosionOutputConfigs.length,
|
|
114
|
+
confinedVolumes,
|
|
115
|
+
confinedVolumes.length
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
console.log("Running vessel_leak_linked_run_calculation...");
|
|
119
|
+
const result = await vlrCalc.run();
|
|
120
|
+
|
|
121
|
+
if (vlrCalc.messages.length > 0) {
|
|
122
|
+
console.log("Messages:");
|
|
123
|
+
vlrCalc.messages.forEach(msg => console.log(msg));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
expect(result).toBe(ResultCode.SUCCESS);
|
|
127
|
+
|
|
128
|
+
if (result === ResultCode.SUCCESS) {
|
|
129
|
+
const relErr = (actual: number, expected: number) => Math.abs(actual - expected) / expected;
|
|
130
|
+
|
|
131
|
+
expect(relErr(vlrCalc.dischargeRecord!.massFlow!, 78.2703129718767)).toBeLessThan(1e-3);
|
|
132
|
+
expect(relErr(vlrCalc.jetFireFlameResult!.flameLength!, 79.83450740611565)).toBeLessThan(1e-3);
|
|
133
|
+
expect(relErr(vlrCalc.poolFireFlameResult!.flameDiameter!, 40.45197677612305)).toBeLessThan(1e-3);
|
|
134
|
+
expect(vlrCalc.flamConcContourPoints!.length).toBe(593);
|
|
135
|
+
expect(vlrCalc.toxicConcContourPoints!.length).toBe(695);
|
|
136
|
+
expect(relErr(vlrCalc.areaFootprintFlamConc![0], 11956.182247202978)).toBeLessThan(1e-3);
|
|
137
|
+
expect(relErr(vlrCalc.areaFootprintToxicConc![0], 508942.11044945125)).toBeLessThan(1e-3);
|
|
138
|
+
expect(relErr(vlrCalc.areaContourJet![0], 59421.0918161459)).toBeLessThan(1e-3);
|
|
139
|
+
expect(relErr(vlrCalc.areaContourPool![0], 89742.0801748534)).toBeLessThan(1e-3);
|
|
140
|
+
expect(relErr(vlrCalc.explosionOverpressureResults![0].explodedMass!, 599.1546378493579)).toBeLessThan(1e-3);
|
|
141
|
+
expect(relErr(vlrCalc.explosionOverpressureResults![0].maximumDistance!, 536.4452979306577)).toBeLessThan(1e-3);
|
|
142
|
+
|
|
143
|
+
// Logs
|
|
144
|
+
console.log(`Mass flow = ${vlrCalc.dischargeRecord!.massFlow}`);
|
|
145
|
+
console.log(`Flame length = ${vlrCalc.jetFireFlameResult!.flameLength}`);
|
|
146
|
+
console.log(`Flame diameter = ${vlrCalc.poolFireFlameResult!.flameDiameter}`);
|
|
147
|
+
console.log(`Flammable contour points = ${vlrCalc.flamConcContourPoints!.length}`);
|
|
148
|
+
console.log(`Toxic contour points = ${vlrCalc.toxicConcContourPoints!.length}`);
|
|
149
|
+
console.log(`Area flammable cloud = ${vlrCalc.areaFootprintFlamConc![0]}`);
|
|
150
|
+
console.log(`Area toxic cloud = ${vlrCalc.areaFootprintToxicConc![0]}`);
|
|
151
|
+
console.log(`Area jet fire = ${vlrCalc.areaContourJet![0]}`);
|
|
152
|
+
console.log(`Area pool fire = ${vlrCalc.areaContourPool![0]}`);
|
|
153
|
+
console.log(`Exploded mass = ${vlrCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
154
|
+
console.log(`Explosion max distance = ${vlrCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
155
|
+
console.log(`SUCCESS: vessel_leak_linked_run_calculation (${vlrCalc.calculationElapsedTime}ms)`);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|