@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,165 @@
|
|
|
1
|
+
import { VesselLineRuptureLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DispersionParameters,
|
|
9
|
+
DispersionOutputConfig,
|
|
10
|
+
FlammableParameters,
|
|
11
|
+
FlammableOutputConfig,
|
|
12
|
+
ExplosionParameters,
|
|
13
|
+
ExplosionOutputConfig,
|
|
14
|
+
ExplosionConfinedVolume,
|
|
15
|
+
DischargeParameters,
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
ResultCode,
|
|
19
|
+
AtmosphericStabilityClass,
|
|
20
|
+
SpecialConcentration,
|
|
21
|
+
WindProfileFlag,
|
|
22
|
+
} from "../../../src/enums";
|
|
23
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
24
|
+
|
|
25
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
26
|
+
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAccessToken(accessToken);
|
|
32
|
+
|
|
33
|
+
describe("VesselLineRuptureLinkedRunCalculation - VLR_164", () => {
|
|
34
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
35
|
+
const material = new Material({
|
|
36
|
+
name: "N-HEXANE",
|
|
37
|
+
components: [new MaterialComponent({ name: "N-HEXANE", moleFraction: 1.0 })],
|
|
38
|
+
componentCount: 1,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const loadCalc = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
42
|
+
material,
|
|
43
|
+
9876,
|
|
44
|
+
7e5,
|
|
45
|
+
250,
|
|
46
|
+
0.1,
|
|
47
|
+
33.0,
|
|
48
|
+
1.0,
|
|
49
|
+
1.1
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
53
|
+
const loadResultCode = await loadCalc.run();
|
|
54
|
+
|
|
55
|
+
if (loadCalc.messages.length > 0) {
|
|
56
|
+
console.log("Messages:");
|
|
57
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
61
|
+
|
|
62
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
63
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 3.0323298714998153) / 3.0323298714998153).toBeLessThan(1e-3);
|
|
64
|
+
expect(Math.abs(loadCalc.vessel!.location.z! + 1.7170445294165657) / 1.7170445294165657).toBeLessThan(1e-3);
|
|
65
|
+
expect(Math.abs(loadCalc.lineRupture!.pipeDiameter! - 0.1) / 0.1).toBeLessThan(1e-3);
|
|
66
|
+
expect(Math.abs(loadCalc.lineRupture!.pipeHeightFraction! - 0.8960253813259087) / 0.8960253813259087).toBeLessThan(1e-3);
|
|
67
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const weather = new Weather({
|
|
71
|
+
windSpeed: 2.0,
|
|
72
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_CD,
|
|
73
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const substrate = new Substrate();
|
|
77
|
+
|
|
78
|
+
const dispersionParams = [
|
|
79
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
80
|
+
new DispersionParameters({ averagingTime: 600.0 }),
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const dispersionOutputConfigsFlammable = [
|
|
84
|
+
new DispersionOutputConfig({
|
|
85
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
86
|
+
elevation: 0.0,
|
|
87
|
+
}),
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const dispersionOutputConfigsToxic = [
|
|
91
|
+
new DispersionOutputConfig({
|
|
92
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
93
|
+
concentration: 5e-5,
|
|
94
|
+
elevation: 0.0,
|
|
95
|
+
}),
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const flammableParameters = new FlammableParameters();
|
|
99
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
100
|
+
const explosionParameters = new ExplosionParameters();
|
|
101
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
102
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
103
|
+
|
|
104
|
+
const ruptureCalc = new VesselLineRuptureLinkedRunCalculation(
|
|
105
|
+
loadCalc.vessel!,
|
|
106
|
+
loadCalc.lineRupture!,
|
|
107
|
+
new DischargeParameters(),
|
|
108
|
+
substrate,
|
|
109
|
+
weather,
|
|
110
|
+
dispersionParams,
|
|
111
|
+
dispersionParams.length,
|
|
112
|
+
0.0,
|
|
113
|
+
flammableParameters,
|
|
114
|
+
explosionParameters,
|
|
115
|
+
dispersionOutputConfigsFlammable,
|
|
116
|
+
dispersionOutputConfigsFlammable.length,
|
|
117
|
+
dispersionOutputConfigsToxic,
|
|
118
|
+
dispersionOutputConfigsToxic.length,
|
|
119
|
+
flammableOutputConfigs,
|
|
120
|
+
flammableOutputConfigs.length,
|
|
121
|
+
explosionOutputConfigs,
|
|
122
|
+
explosionOutputConfigs.length,
|
|
123
|
+
explosionConfinedVolumes,
|
|
124
|
+
explosionConfinedVolumes.length
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
console.log("Running vessel_line_rupture_linked_run_calculation...");
|
|
128
|
+
const resultCode = await ruptureCalc.run();
|
|
129
|
+
|
|
130
|
+
if (ruptureCalc.messages.length > 0) {
|
|
131
|
+
console.log("Messages:");
|
|
132
|
+
ruptureCalc.messages.forEach((msg) => console.log(msg));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
136
|
+
|
|
137
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
138
|
+
expect(Math.abs(ruptureCalc.dischargeRecord!.massFlow! - 85.71385795899046) / 85.71385795899046).toBeLessThan(1e-3);
|
|
139
|
+
expect(Math.abs(ruptureCalc.jetFireFlameResult!.flameLength! - 41.515902270698355) / 41.515902270698355).toBeLessThan(1e-3);
|
|
140
|
+
expect(Math.abs(ruptureCalc.poolFireFlameResult!.flameDiameter! - 58.542781829833984) / 58.542781829833984).toBeLessThan(1e-3);
|
|
141
|
+
expect(ruptureCalc.flamConcContourPoints!.length).toBe(1456);
|
|
142
|
+
expect(ruptureCalc.toxicConcContourPoints!.length).toBe(629);
|
|
143
|
+
expect(Math.abs(ruptureCalc.areaFootprintFlamConc![0] - 893.3122239763907) / 893.3122239763907).toBeLessThan(1e-3);
|
|
144
|
+
expect(Math.abs(ruptureCalc.areaFootprintToxicConc![0] - 266309.7656022776) / 266309.7656022776).toBeLessThan(1e-3);
|
|
145
|
+
expect(Math.abs(ruptureCalc.areaContourJet![0] - 17220.13186859785) / 17220.13186859785).toBeLessThan(1e-3);
|
|
146
|
+
expect(Math.abs(ruptureCalc.areaContourPool![0] - 20853.779839337778) / 20853.779839337778).toBeLessThan(1e-3);
|
|
147
|
+
expect(Math.abs(ruptureCalc.explosionOverpressureResults![0].explodedMass! - 5.945743734375853) / 5.945743734375853).toBeLessThan(1e-3);
|
|
148
|
+
expect(Math.abs(ruptureCalc.explosionOverpressureResults![0].maximumDistance! - 148.38430628846515) / 148.38430628846515).toBeLessThan(1e-3);
|
|
149
|
+
|
|
150
|
+
console.log(`Mass flow = ${ruptureCalc.dischargeRecord!.massFlow}`);
|
|
151
|
+
console.log(`Flame length = ${ruptureCalc.jetFireFlameResult!.flameLength}`);
|
|
152
|
+
console.log(`Flame diameter = ${ruptureCalc.poolFireFlameResult!.flameDiameter}`);
|
|
153
|
+
console.log(`Flam contour length = ${ruptureCalc.flamConcContourPoints!.length}`);
|
|
154
|
+
console.log(`Toxic contour length = ${ruptureCalc.toxicConcContourPoints!.length}`);
|
|
155
|
+
console.log(`Flam area = ${ruptureCalc.areaFootprintFlamConc![0]}`);
|
|
156
|
+
console.log(`Toxic area = ${ruptureCalc.areaFootprintToxicConc![0]}`);
|
|
157
|
+
console.log(`Jet area = ${ruptureCalc.areaContourJet![0]}`);
|
|
158
|
+
console.log(`Pool area = ${ruptureCalc.areaContourPool![0]}`);
|
|
159
|
+
console.log(`Exploded mass = ${ruptureCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
160
|
+
console.log(`Explosion max distance = ${ruptureCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
161
|
+
console.log(`SUCCESS: vessel_line_rupture_linked_run_calculation (${ruptureCalc.calculationElapsedTime}ms)`);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { VesselReliefValveLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForReliefValveScenarioCalculation} from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DispersionParameters,
|
|
9
|
+
FlammableParameters,
|
|
10
|
+
ExplosionParameters,
|
|
11
|
+
ExplosionOutputConfig,
|
|
12
|
+
ExplosionConfinedVolume,
|
|
13
|
+
FlammableOutputConfig,
|
|
14
|
+
DispersionOutputConfig,
|
|
15
|
+
DischargeParameters,
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
ResultCode,
|
|
19
|
+
AtmosphericStabilityClass,
|
|
20
|
+
SpecialConcentration,
|
|
21
|
+
WindProfileFlag,
|
|
22
|
+
} from "../../../src/enums";
|
|
23
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
24
|
+
|
|
25
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
26
|
+
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAccessToken(accessToken);
|
|
32
|
+
|
|
33
|
+
describe("VesselReliefValveLinkedRunCalculation - VLR_165", () => {
|
|
34
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
35
|
+
const material = new Material({
|
|
36
|
+
name: "PROPANE",
|
|
37
|
+
components: [new MaterialComponent({ name: "PROPANE", moleFraction: 1.0 })],
|
|
38
|
+
componentCount: 1,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const loadCalc = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
42
|
+
material,
|
|
43
|
+
1e3,
|
|
44
|
+
11e5,
|
|
45
|
+
350,
|
|
46
|
+
0.15,
|
|
47
|
+
0.5,
|
|
48
|
+
10.0,
|
|
49
|
+
1.0,
|
|
50
|
+
0.35
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
54
|
+
const loadResultCode = await loadCalc.run();
|
|
55
|
+
|
|
56
|
+
if (loadCalc.messages.length > 0) {
|
|
57
|
+
console.log("Messages:");
|
|
58
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
62
|
+
|
|
63
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
64
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 4.665573040127879) / 4.665573040127879).toBeLessThan(1e-3);
|
|
65
|
+
expect(Math.abs(loadCalc.vessel!.location!.z! + 1.3327865200639395) / 1.3327865200639395).toBeLessThan(1e-3);
|
|
66
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeDiameter! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
67
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeHeightFraction! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
68
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const weather = new Weather({
|
|
72
|
+
windSpeed: 10.0,
|
|
73
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_A_,
|
|
74
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const substrate = new Substrate();
|
|
78
|
+
|
|
79
|
+
const dispersionParams = [
|
|
80
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
81
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const dispersionOutputConfigsFlammable = [
|
|
85
|
+
new DispersionOutputConfig({
|
|
86
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
87
|
+
elevation: 0.0,
|
|
88
|
+
}),
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const dispersionOutputConfigsToxic = [
|
|
92
|
+
new DispersionOutputConfig({
|
|
93
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
94
|
+
concentration: 5e-5,
|
|
95
|
+
elevation: 0.0,
|
|
96
|
+
}),
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const flammableParameters = new FlammableParameters();
|
|
100
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
101
|
+
const explosionParameters = new ExplosionParameters();
|
|
102
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
103
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
104
|
+
|
|
105
|
+
const reliefCalc = new VesselReliefValveLinkedRunCalculation(
|
|
106
|
+
loadCalc.vessel!,
|
|
107
|
+
loadCalc.reliefValve!,
|
|
108
|
+
new DischargeParameters(),
|
|
109
|
+
substrate,
|
|
110
|
+
weather,
|
|
111
|
+
dispersionParams,
|
|
112
|
+
dispersionParams.length,
|
|
113
|
+
0.0,
|
|
114
|
+
flammableParameters,
|
|
115
|
+
explosionParameters,
|
|
116
|
+
dispersionOutputConfigsFlammable,
|
|
117
|
+
dispersionOutputConfigsFlammable.length,
|
|
118
|
+
dispersionOutputConfigsToxic,
|
|
119
|
+
dispersionOutputConfigsToxic.length,
|
|
120
|
+
flammableOutputConfigs,
|
|
121
|
+
flammableOutputConfigs.length,
|
|
122
|
+
explosionOutputConfigs,
|
|
123
|
+
explosionOutputConfigs.length,
|
|
124
|
+
explosionConfinedVolumes,
|
|
125
|
+
explosionConfinedVolumes.length
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
console.log("Running vessel_relief_valve_linked_run_calculation...");
|
|
129
|
+
const resultCode = await reliefCalc.run();
|
|
130
|
+
|
|
131
|
+
if (reliefCalc.messages.length > 0) {
|
|
132
|
+
console.log("Messages:");
|
|
133
|
+
reliefCalc.messages.forEach((msg) => console.log(msg));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
137
|
+
|
|
138
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
139
|
+
expect(Math.abs(reliefCalc.dischargeRecord!.massFlow! - 52.423581478093844) / 52.423581478093844).toBeLessThan(1e-3);
|
|
140
|
+
expect(Math.abs(reliefCalc.jetFireFlameResult!.flameLength! - 67.47188617179833) / 67.47188617179833).toBeLessThan(1e-3);
|
|
141
|
+
expect(reliefCalc.poolFireFlameResult!.flameDiameter!).toBe(0.0);
|
|
142
|
+
expect(reliefCalc.flamConcContourPoints!.length).toBe(0);
|
|
143
|
+
expect(reliefCalc.toxicConcContourPoints!.length).toBe(629);
|
|
144
|
+
expect(reliefCalc.areaFootprintFlamConc![0]).toBe(0.0);
|
|
145
|
+
expect(Math.abs(reliefCalc.areaFootprintToxicConc![0] - 81936.99336133621) / 81936.99336133621).toBeLessThan(1e-3);
|
|
146
|
+
expect(Math.abs(reliefCalc.areaContourJet![0] - 20491.484283624566) / 20491.484283624566).toBeLessThan(1e-3);
|
|
147
|
+
expect(reliefCalc.areaContourPool![0]).toBe(0.0);
|
|
148
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].explodedMass! - 20.535225036338556) / 20.535225036338556).toBeLessThan(1e-3);
|
|
149
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].maximumDistance! - 149.87854518675923) / 149.87854518675923).toBeLessThan(1e-3);
|
|
150
|
+
|
|
151
|
+
console.log(`Mass flow = ${reliefCalc.dischargeRecord!.massFlow}`);
|
|
152
|
+
console.log(`Flame length = ${reliefCalc.jetFireFlameResult!.flameLength}`);
|
|
153
|
+
console.log(`Flame diameter = ${reliefCalc.poolFireFlameResult!.flameDiameter}`);
|
|
154
|
+
console.log(`Flam contour length = ${reliefCalc.flamConcContourPoints!.length}`);
|
|
155
|
+
console.log(`Toxic contour length = ${reliefCalc.toxicConcContourPoints!.length}`);
|
|
156
|
+
console.log(`Flam area = ${reliefCalc.areaFootprintFlamConc![0]}`);
|
|
157
|
+
console.log(`Toxic area = ${reliefCalc.areaFootprintToxicConc![0]}`);
|
|
158
|
+
console.log(`Jet area = ${reliefCalc.areaContourJet![0]}`);
|
|
159
|
+
console.log(`Pool area = ${reliefCalc.areaContourPool![0]}`);
|
|
160
|
+
console.log(`Exploded mass = ${reliefCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
161
|
+
console.log(`Explosion max distance = ${reliefCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
162
|
+
console.log(`SUCCESS: vessel_relief_valve_linked_run_calculation (${reliefCalc.calculationElapsedTime}ms)`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { VesselReliefValveLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForReliefValveScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DispersionParameters,
|
|
9
|
+
FlammableParameters,
|
|
10
|
+
ExplosionParameters,
|
|
11
|
+
ExplosionOutputConfig,
|
|
12
|
+
ExplosionConfinedVolume,
|
|
13
|
+
FlammableOutputConfig,
|
|
14
|
+
DispersionOutputConfig,
|
|
15
|
+
DischargeParameters,
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
ResultCode,
|
|
19
|
+
AtmosphericStabilityClass,
|
|
20
|
+
SpecialConcentration,
|
|
21
|
+
WindProfileFlag,
|
|
22
|
+
} from "../../../src/enums";
|
|
23
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
24
|
+
|
|
25
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
26
|
+
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAccessToken(accessToken);
|
|
32
|
+
|
|
33
|
+
describe("VesselReliefValveLinkedRunCalculation - VLR_166", () => {
|
|
34
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
35
|
+
const material = new Material({
|
|
36
|
+
name: "PROPANE",
|
|
37
|
+
components: [new MaterialComponent({ name: "PROPANE", moleFraction: 1.0 })],
|
|
38
|
+
componentCount: 1,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const loadCalc = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
42
|
+
material,
|
|
43
|
+
1e3,
|
|
44
|
+
11e5,
|
|
45
|
+
350,
|
|
46
|
+
0.15,
|
|
47
|
+
0.5,
|
|
48
|
+
10.0,
|
|
49
|
+
1.0,
|
|
50
|
+
0.35
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
54
|
+
const loadResultCode = await loadCalc.run();
|
|
55
|
+
|
|
56
|
+
if (loadCalc.messages.length > 0) {
|
|
57
|
+
console.log("Messages:");
|
|
58
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
62
|
+
|
|
63
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
64
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 4.665573040127879) / 4.665573040127879).toBeLessThan(1e-3);
|
|
65
|
+
expect(Math.abs(loadCalc.vessel!.location!.z! + 1.3327865200639395) / 1.3327865200639395).toBeLessThan(1e-3);
|
|
66
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeDiameter! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
67
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeHeightFraction! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
68
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const weather = new Weather({
|
|
72
|
+
windSpeed: 1.5,
|
|
73
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_F,
|
|
74
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const substrate = new Substrate();
|
|
78
|
+
|
|
79
|
+
const dispersionParams = [
|
|
80
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
81
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const dispersionOutputConfigsFlammable = [
|
|
85
|
+
new DispersionOutputConfig({
|
|
86
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
87
|
+
elevation: 1.0,
|
|
88
|
+
}),
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const dispersionOutputConfigsToxic = [
|
|
92
|
+
new DispersionOutputConfig({
|
|
93
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
94
|
+
concentration: 5e-5,
|
|
95
|
+
elevation: 0.0,
|
|
96
|
+
}),
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const flammableParameters = new FlammableParameters();
|
|
100
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
101
|
+
const explosionParameters = new ExplosionParameters();
|
|
102
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
103
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
104
|
+
|
|
105
|
+
const reliefCalc = new VesselReliefValveLinkedRunCalculation(
|
|
106
|
+
loadCalc.vessel!,
|
|
107
|
+
loadCalc.reliefValve!,
|
|
108
|
+
new DischargeParameters(),
|
|
109
|
+
substrate,
|
|
110
|
+
weather,
|
|
111
|
+
dispersionParams,
|
|
112
|
+
dispersionParams.length,
|
|
113
|
+
0.0,
|
|
114
|
+
flammableParameters,
|
|
115
|
+
explosionParameters,
|
|
116
|
+
dispersionOutputConfigsFlammable,
|
|
117
|
+
dispersionOutputConfigsFlammable.length,
|
|
118
|
+
dispersionOutputConfigsToxic,
|
|
119
|
+
dispersionOutputConfigsToxic.length,
|
|
120
|
+
flammableOutputConfigs,
|
|
121
|
+
flammableOutputConfigs.length,
|
|
122
|
+
explosionOutputConfigs,
|
|
123
|
+
explosionOutputConfigs.length,
|
|
124
|
+
explosionConfinedVolumes,
|
|
125
|
+
explosionConfinedVolumes.length
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
console.log("Running vessel_relief_valve_linked_run_calculation...");
|
|
129
|
+
const resultCode = await reliefCalc.run();
|
|
130
|
+
|
|
131
|
+
if (reliefCalc.messages.length > 0) {
|
|
132
|
+
console.log("Messages:");
|
|
133
|
+
reliefCalc.messages.forEach((msg) => console.log(msg));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
137
|
+
|
|
138
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
139
|
+
expect(Math.abs(reliefCalc.dischargeRecord!.massFlow! - 52.423581478093844) / 52.423581478093844).toBeLessThan(1e-3);
|
|
140
|
+
expect(Math.abs(reliefCalc.jetFireFlameResult!.flameLength! - 104.0295077327639) / 104.0295077327639).toBeLessThan(1e-3);
|
|
141
|
+
expect(reliefCalc.poolFireFlameResult!.flameDiameter!).toBe(0.0);
|
|
142
|
+
expect(reliefCalc.flamConcContourPoints!.length).toBe(525);
|
|
143
|
+
expect(reliefCalc.toxicConcContourPoints!.length).toBe(533);
|
|
144
|
+
expect(Math.abs(reliefCalc.areaFootprintFlamConc![0] - 2.3264037495948804) / 2.3264037495948804).toBeLessThan(1e-3);
|
|
145
|
+
expect(Math.abs(reliefCalc.areaFootprintToxicConc![0] - 28984.72248507072) / 28984.72248507072).toBeLessThan(1e-3);
|
|
146
|
+
expect(Math.abs(reliefCalc.areaContourJet![0] - 21777.94192310462) / 21777.94192310462).toBeLessThan(1e-3);
|
|
147
|
+
expect(reliefCalc.areaContourPool![0]).toBe(0.0);
|
|
148
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].explodedMass! - 93.15833898482984) / 93.15833898482984).toBeLessThan(1e-3);
|
|
149
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].maximumDistance! - 278.44898736729385) / 278.44898736729385).toBeLessThan(1e-3);
|
|
150
|
+
|
|
151
|
+
console.log(`SUCCESS: vessel_relief_valve_linked_run_calculation (${reliefCalc.calculationElapsedTime}ms)`);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { VesselReliefValveLinkedRunCalculation } from "../../../src/calculations/linkedRunners";
|
|
2
|
+
import { LoadMassInventoryVesselForReliefValveScenarioCalculation } from "../../../src/calculations/utilities";
|
|
3
|
+
import {
|
|
4
|
+
Material,
|
|
5
|
+
MaterialComponent,
|
|
6
|
+
Weather,
|
|
7
|
+
Substrate,
|
|
8
|
+
DispersionParameters,
|
|
9
|
+
FlammableParameters,
|
|
10
|
+
ExplosionParameters,
|
|
11
|
+
ExplosionOutputConfig,
|
|
12
|
+
ExplosionConfinedVolume,
|
|
13
|
+
FlammableOutputConfig,
|
|
14
|
+
DispersionOutputConfig,
|
|
15
|
+
DischargeParameters,
|
|
16
|
+
} from "../../../src/entities";
|
|
17
|
+
import {
|
|
18
|
+
ResultCode,
|
|
19
|
+
AtmosphericStabilityClass,
|
|
20
|
+
WindProfileFlag,
|
|
21
|
+
SpecialConcentration,
|
|
22
|
+
} from "../../../src/enums";
|
|
23
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
24
|
+
|
|
25
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
26
|
+
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAccessToken(accessToken);
|
|
32
|
+
|
|
33
|
+
describe("VesselReliefValveLinkedRunCalculation - VLR_167", () => {
|
|
34
|
+
it("should run the calculation and validate regression outputs", async () => {
|
|
35
|
+
const material = new Material({
|
|
36
|
+
name: "METHANE+ETHANE",
|
|
37
|
+
components: [
|
|
38
|
+
new MaterialComponent({ name: "METHANE", moleFraction: 0.9 }),
|
|
39
|
+
new MaterialComponent({ name: "ETHANE", moleFraction: 0.1 }),
|
|
40
|
+
],
|
|
41
|
+
componentCount: 2,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const loadCalc = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
45
|
+
material,
|
|
46
|
+
1e5,
|
|
47
|
+
11e5,
|
|
48
|
+
250,
|
|
49
|
+
0.5,
|
|
50
|
+
0.5,
|
|
51
|
+
10.0,
|
|
52
|
+
100.0,
|
|
53
|
+
0.0
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
57
|
+
const loadResultCode = await loadCalc.run();
|
|
58
|
+
|
|
59
|
+
if (loadCalc.messages.length > 0) {
|
|
60
|
+
console.log("Messages:");
|
|
61
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
65
|
+
|
|
66
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
67
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 27.049130317992706) / 27.049130317992706).toBeLessThan(1e-3);
|
|
68
|
+
expect(Math.abs(loadCalc.vessel!.location!.z! - 86.47543484100365) / 86.47543484100365).toBeLessThan(1e-3);
|
|
69
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeDiameter! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
70
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeHeightFraction! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
71
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const weather = new Weather({
|
|
75
|
+
windSpeed: 10.0,
|
|
76
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_A_,
|
|
77
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const substrate = new Substrate();
|
|
81
|
+
|
|
82
|
+
const dispersionParams = [
|
|
83
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
84
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const dispersionOutputConfigsFlammable = [
|
|
88
|
+
new DispersionOutputConfig({
|
|
89
|
+
specialConcentration: SpecialConcentration.UFL,
|
|
90
|
+
elevation: 100.0,
|
|
91
|
+
}),
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const dispersionOutputConfigsToxic = [
|
|
95
|
+
new DispersionOutputConfig({
|
|
96
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
97
|
+
concentration: 5e-5,
|
|
98
|
+
elevation: 0.0,
|
|
99
|
+
}),
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
const flammableParameters = new FlammableParameters();
|
|
103
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
104
|
+
const explosionParameters = new ExplosionParameters();
|
|
105
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
106
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
107
|
+
|
|
108
|
+
const reliefCalc = new VesselReliefValveLinkedRunCalculation(
|
|
109
|
+
loadCalc.vessel!,
|
|
110
|
+
loadCalc.reliefValve!,
|
|
111
|
+
new DischargeParameters(),
|
|
112
|
+
substrate,
|
|
113
|
+
weather,
|
|
114
|
+
dispersionParams,
|
|
115
|
+
dispersionParams.length,
|
|
116
|
+
0.0,
|
|
117
|
+
flammableParameters,
|
|
118
|
+
explosionParameters,
|
|
119
|
+
dispersionOutputConfigsFlammable,
|
|
120
|
+
dispersionOutputConfigsFlammable.length,
|
|
121
|
+
dispersionOutputConfigsToxic,
|
|
122
|
+
dispersionOutputConfigsToxic.length,
|
|
123
|
+
flammableOutputConfigs,
|
|
124
|
+
flammableOutputConfigs.length,
|
|
125
|
+
explosionOutputConfigs,
|
|
126
|
+
explosionOutputConfigs.length,
|
|
127
|
+
explosionConfinedVolumes,
|
|
128
|
+
explosionConfinedVolumes.length
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
console.log("Running vessel_relief_valve_linked_run_calculation...");
|
|
132
|
+
const resultCode = await reliefCalc.run();
|
|
133
|
+
|
|
134
|
+
if (reliefCalc.messages.length > 0) {
|
|
135
|
+
console.log("Messages:");
|
|
136
|
+
reliefCalc.messages.forEach((msg) => console.log(msg));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
140
|
+
|
|
141
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
142
|
+
expect(Math.abs(reliefCalc.dischargeRecord!.massFlow! - 369.13836776138595) / 369.13836776138595).toBeLessThan(1e-3);
|
|
143
|
+
expect(Math.abs(reliefCalc.jetFireFlameResult!.flameLength! - 151.4811492829443) / 151.4811492829443).toBeLessThan(1e-3);
|
|
144
|
+
expect(reliefCalc.poolFireFlameResult!.flameDiameter!).toBe(0.0);
|
|
145
|
+
expect(reliefCalc.flamConcContourPoints!.length).toBe(567);
|
|
146
|
+
expect(reliefCalc.toxicConcContourPoints!.length).toBe(571);
|
|
147
|
+
expect(Math.abs(reliefCalc.areaFootprintFlamConc![0] - 85.0390022446118) / 85.0390022446118).toBeLessThan(1e-3);
|
|
148
|
+
expect(Math.abs(reliefCalc.areaFootprintToxicConc![0] - 1382535.239460099) / 1382535.239460099).toBeLessThan(1e-3);
|
|
149
|
+
expect(Math.abs(reliefCalc.areaContourJet![0] - 73937.1111499988) / 73937.1111499988).toBeLessThan(1e-3);
|
|
150
|
+
expect(reliefCalc.areaContourPool![0]).toBe(0.0);
|
|
151
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].explodedMass! - 165.104366741059) / 165.104366741059).toBeLessThan(1e-3);
|
|
152
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].maximumDistance! - 355.66691837931484) / 355.66691837931484).toBeLessThan(1e-3);
|
|
153
|
+
|
|
154
|
+
console.log(`SUCCESS: vessel_relief_valve_linked_run_calculation (${reliefCalc.calculationElapsedTime}ms)`);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|