@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,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VesselReliefValveLinkedRunCalculation,
|
|
3
|
+
} from "../../../src/calculations/linkedRunners";
|
|
4
|
+
import {
|
|
5
|
+
LoadMassInventoryVesselForReliefValveScenarioCalculation,
|
|
6
|
+
} from "../../../src/calculations/utilities";
|
|
7
|
+
import {
|
|
8
|
+
Material,
|
|
9
|
+
MaterialComponent,
|
|
10
|
+
Weather,
|
|
11
|
+
Substrate,
|
|
12
|
+
DispersionParameters,
|
|
13
|
+
FlammableParameters,
|
|
14
|
+
ExplosionParameters,
|
|
15
|
+
ExplosionOutputConfig,
|
|
16
|
+
ExplosionConfinedVolume,
|
|
17
|
+
FlammableOutputConfig,
|
|
18
|
+
DispersionOutputConfig,
|
|
19
|
+
DischargeParameters,
|
|
20
|
+
} from "../../../src/entities";
|
|
21
|
+
import {
|
|
22
|
+
ResultCode,
|
|
23
|
+
AtmosphericStabilityClass,
|
|
24
|
+
SpecialConcentration,
|
|
25
|
+
WindProfileFlag,
|
|
26
|
+
} from "../../../src/enums";
|
|
27
|
+
import { setAccessToken } from "../../../src/utilities";
|
|
28
|
+
|
|
29
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
30
|
+
if (!accessToken) {
|
|
31
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
32
|
+
}
|
|
33
|
+
setAccessToken(accessToken);
|
|
34
|
+
|
|
35
|
+
describe("VesselReliefValveLinkedRunCalculation - VLR_168", () => {
|
|
36
|
+
it("should run the hydrogen scenario and validate regression outputs", async () => {
|
|
37
|
+
const material = new Material({
|
|
38
|
+
name: "HYDROGEN",
|
|
39
|
+
components: [new MaterialComponent({ name: "HYDROGEN", moleFraction: 1.0 })],
|
|
40
|
+
componentCount: 1,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const loadCalc = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
44
|
+
material,
|
|
45
|
+
9876,
|
|
46
|
+
7e5,
|
|
47
|
+
250,
|
|
48
|
+
0.05,
|
|
49
|
+
0.1,
|
|
50
|
+
33.0,
|
|
51
|
+
1.0,
|
|
52
|
+
1.1
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
56
|
+
const loadResultCode = await loadCalc.run();
|
|
57
|
+
|
|
58
|
+
if (loadCalc.messages.length > 0) {
|
|
59
|
+
console.log("Messages:");
|
|
60
|
+
loadCalc.messages.forEach((msg) => console.log(msg));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
expect(loadResultCode).toBe(ResultCode.SUCCESS);
|
|
64
|
+
|
|
65
|
+
if (loadResultCode === ResultCode.SUCCESS) {
|
|
66
|
+
expect(Math.abs(loadCalc.vessel!.diameter! - 30.344485738881644) / 30.344485738881644).toBeLessThan(1e-3);
|
|
67
|
+
expect(Math.abs(loadCalc.vessel!.location!.z! + 14.172242869440822) / 14.172242869440822).toBeLessThan(1e-3);
|
|
68
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeDiameter! - 0.1) / 0.1).toBeLessThan(1e-3);
|
|
69
|
+
expect(Math.abs(loadCalc.reliefValve!.pipeHeightFraction! - 0.5) / 0.5).toBeLessThan(1e-3);
|
|
70
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${loadCalc.calculationElapsedTime}ms)`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const weather = new Weather({
|
|
74
|
+
windSpeed: 10.0,
|
|
75
|
+
stabilityClass: AtmosphericStabilityClass.STABILITY_A_,
|
|
76
|
+
windProfileFlag: WindProfileFlag.LOGARITHMIC_PROFILE,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const substrate = new Substrate();
|
|
80
|
+
|
|
81
|
+
const dispersionParams = [
|
|
82
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
83
|
+
new DispersionParameters({ averagingTime: 18.75 }),
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const dispersionOutputConfigsFlammable = [
|
|
87
|
+
new DispersionOutputConfig({
|
|
88
|
+
specialConcentration: SpecialConcentration.LFL_FRACTION,
|
|
89
|
+
elevation: 0.0,
|
|
90
|
+
}),
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
const dispersionOutputConfigsToxic = [
|
|
94
|
+
new DispersionOutputConfig({
|
|
95
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
96
|
+
concentration: 5e-5,
|
|
97
|
+
elevation: 0.0,
|
|
98
|
+
}),
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const flammableParameters = new FlammableParameters();
|
|
102
|
+
const flammableOutputConfigs = [new FlammableOutputConfig()];
|
|
103
|
+
const explosionParameters = new ExplosionParameters();
|
|
104
|
+
const explosionOutputConfigs = [new ExplosionOutputConfig()];
|
|
105
|
+
const explosionConfinedVolumes = [new ExplosionConfinedVolume()];
|
|
106
|
+
|
|
107
|
+
const reliefCalc = new VesselReliefValveLinkedRunCalculation(
|
|
108
|
+
loadCalc.vessel!,
|
|
109
|
+
loadCalc.reliefValve!,
|
|
110
|
+
new DischargeParameters(),
|
|
111
|
+
substrate,
|
|
112
|
+
weather,
|
|
113
|
+
dispersionParams,
|
|
114
|
+
dispersionParams.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
|
+
console.log("Running vessel_relief_valve_linked_run_calculation...");
|
|
131
|
+
const resultCode = await reliefCalc.run();
|
|
132
|
+
|
|
133
|
+
if (reliefCalc.messages.length > 0) {
|
|
134
|
+
console.log("Messages:");
|
|
135
|
+
reliefCalc.messages.forEach((msg) => console.log(msg));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
139
|
+
|
|
140
|
+
if (resultCode === ResultCode.SUCCESS) {
|
|
141
|
+
expect(Math.abs(reliefCalc.dischargeRecord!.massFlow! - 0.9443675979173782) / 0.9443675979173782).toBeLessThan(1e-3);
|
|
142
|
+
expect(Math.abs(reliefCalc.jetFireFlameResult!.flameLength! - 11.028079519540297) / 11.028079519540297).toBeLessThan(1e-3);
|
|
143
|
+
expect(reliefCalc.poolFireFlameResult!.flameDiameter!).toBe(0.0);
|
|
144
|
+
expect(reliefCalc.flamConcContourPoints!.length).toBe(0);
|
|
145
|
+
expect(reliefCalc.toxicConcContourPoints!.length).toBe(603);
|
|
146
|
+
expect(reliefCalc.areaFootprintFlamConc![0]).toBe(0.0);
|
|
147
|
+
expect(Math.abs(reliefCalc.areaFootprintToxicConc![0] - 33801.6456631375) / 33801.6456631375).toBeLessThan(1e-3);
|
|
148
|
+
expect(Math.abs(reliefCalc.areaContourJet![0] - 396.48256520388253) / 396.48256520388253).toBeLessThan(1e-3);
|
|
149
|
+
expect(reliefCalc.areaContourPool![0]).toBe(0.0);
|
|
150
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].explodedMass! - 0.20630565247270963) / 0.20630565247270963).toBeLessThan(1e-3);
|
|
151
|
+
expect(Math.abs(reliefCalc.explosionOverpressureResults![0].maximumDistance! - 45.518593970444364) / 45.518593970444364).toBeLessThan(1e-3);
|
|
152
|
+
|
|
153
|
+
console.log(`Mass flow = ${reliefCalc.dischargeRecord!.massFlow}`);
|
|
154
|
+
console.log(`Flame length = ${reliefCalc.jetFireFlameResult!.flameLength}`);
|
|
155
|
+
console.log(`Flame diameter = ${reliefCalc.poolFireFlameResult!.flameDiameter}`);
|
|
156
|
+
console.log(`Flam contour length = ${reliefCalc.flamConcContourPoints!.length}`);
|
|
157
|
+
console.log(`Toxic contour length = ${reliefCalc.toxicConcContourPoints!.length}`);
|
|
158
|
+
console.log(`Flam area = ${reliefCalc.areaFootprintFlamConc![0]}`);
|
|
159
|
+
console.log(`Toxic area = ${reliefCalc.areaFootprintToxicConc![0]}`);
|
|
160
|
+
console.log(`Jet area = ${reliefCalc.areaContourJet![0]}`);
|
|
161
|
+
console.log(`Pool area = ${reliefCalc.areaContourPool![0]}`);
|
|
162
|
+
console.log(`Exploded mass = ${reliefCalc.explosionOverpressureResults![0].explodedMass}`);
|
|
163
|
+
console.log(`Explosion max distance = ${reliefCalc.explosionOverpressureResults![0].maximumDistance}`);
|
|
164
|
+
console.log(`SUCCESS: vessel_relief_valve_linked_run_calculation (${reliefCalc.calculationElapsedTime}ms)`);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase126.test.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../src/calculations/utilities";
|
|
3
|
+
import { ResultCode } from "../../src/enums";
|
|
4
|
+
import { setAccessToken } from "../../src/utilities";
|
|
5
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
6
|
+
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setAccessToken(accessToken);
|
|
12
|
+
|
|
13
|
+
describe("Load Mass Inventory Vessel for Line Rupture Scenario - Test Case 126", () => {
|
|
14
|
+
test("should run the calculation and perform regression check", async () => {
|
|
15
|
+
const material = new Material({
|
|
16
|
+
name: "PROPANE",
|
|
17
|
+
components: [
|
|
18
|
+
new MaterialComponent({ name: "PROPANE", moleFraction: 1.0 }),
|
|
19
|
+
],
|
|
20
|
+
componentCount: 1,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const mass = 1e3;
|
|
24
|
+
const pressure = 11e5;
|
|
25
|
+
const temperature = 250;
|
|
26
|
+
const pipeLength = 10.0;
|
|
27
|
+
const pipeDiameter = 0.5;
|
|
28
|
+
const releaseElevation = 1.0;
|
|
29
|
+
const releaseAngle = 0.35;
|
|
30
|
+
|
|
31
|
+
const calculation = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
32
|
+
material,
|
|
33
|
+
mass,
|
|
34
|
+
pressure,
|
|
35
|
+
temperature,
|
|
36
|
+
pipeDiameter,
|
|
37
|
+
pipeLength,
|
|
38
|
+
releaseElevation,
|
|
39
|
+
releaseAngle,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
43
|
+
const resultCode = await calculation.run();
|
|
44
|
+
|
|
45
|
+
if (calculation.messages.length > 0) {
|
|
46
|
+
console.log("Messages:");
|
|
47
|
+
calculation.messages.forEach((msg) => console.log(msg));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
51
|
+
|
|
52
|
+
const expectedDiameter = 1.521293357476972;
|
|
53
|
+
const expectedElevation = -0.3626191519898414;
|
|
54
|
+
const expectedPipeDiameter = 0.5;
|
|
55
|
+
const expectedPipeHeightFraction = 0.8956978253357473;
|
|
56
|
+
|
|
57
|
+
const vessel = calculation.vessel!;
|
|
58
|
+
const lineRupture = calculation.lineRupture!;
|
|
59
|
+
|
|
60
|
+
const diameterError = Math.abs((vessel.diameter - expectedDiameter) / expectedDiameter);
|
|
61
|
+
const elevationError = Math.abs((vessel.location.z - expectedElevation) / expectedElevation);
|
|
62
|
+
const pipeDiameterError = Math.abs((lineRupture.pipeDiameter! - expectedPipeDiameter) / expectedPipeDiameter);
|
|
63
|
+
const pipeHeightFractionError = Math.abs((lineRupture.pipeHeightFraction - expectedPipeHeightFraction) / expectedPipeHeightFraction);
|
|
64
|
+
|
|
65
|
+
expect(diameterError).toBeLessThan(1e-3);
|
|
66
|
+
expect(elevationError).toBeLessThan(1e-3);
|
|
67
|
+
expect(pipeDiameterError).toBeLessThan(1e-3);
|
|
68
|
+
expect(pipeHeightFractionError).toBeLessThan(1e-3);
|
|
69
|
+
|
|
70
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${calculation.calculationElapsedTime}ms)`);
|
|
71
|
+
});
|
|
72
|
+
});
|
package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase127.test.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../src/calculations/utilities";
|
|
3
|
+
import { ResultCode } from "../../src/enums";
|
|
4
|
+
import { setAccessToken } from "../../src/utilities";
|
|
5
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
6
|
+
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setAccessToken(accessToken);
|
|
12
|
+
|
|
13
|
+
describe("Load Mass Inventory Vessel for Line Rupture Scenario - Test Case 127", () => {
|
|
14
|
+
test("should run the calculation and perform regression check", async () => {
|
|
15
|
+
const material = new Material({
|
|
16
|
+
name: "METHANE+ETHANE",
|
|
17
|
+
components: [
|
|
18
|
+
new MaterialComponent({ name: "METHANE", moleFraction: 0.9 }),
|
|
19
|
+
new MaterialComponent({ name: "ETHANE", moleFraction: 0.1 }),
|
|
20
|
+
],
|
|
21
|
+
componentCount: 2,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const mass = 1e5;
|
|
25
|
+
const pressure = 11e5;
|
|
26
|
+
const temperature = 250;
|
|
27
|
+
const pipeDiameter = 0.5;
|
|
28
|
+
const pipeLength = 10.0;
|
|
29
|
+
const releaseElevation = 100.0;
|
|
30
|
+
const releaseAngle = 0.0;
|
|
31
|
+
|
|
32
|
+
const calculation = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
33
|
+
material,
|
|
34
|
+
mass,
|
|
35
|
+
pressure,
|
|
36
|
+
temperature,
|
|
37
|
+
pipeDiameter,
|
|
38
|
+
pipeLength,
|
|
39
|
+
releaseElevation,
|
|
40
|
+
releaseAngle
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
44
|
+
const resultCode = await calculation.run();
|
|
45
|
+
|
|
46
|
+
if (calculation.messages.length > 0) {
|
|
47
|
+
console.log("Messages:");
|
|
48
|
+
calculation.messages.forEach((msg) => console.log(msg));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
52
|
+
|
|
53
|
+
const expectedDiameter = 27.049130317992706;
|
|
54
|
+
const expectedElevation = 86.47543484100365;
|
|
55
|
+
const expectedPipeDiameter = 0.5;
|
|
56
|
+
const expectedPipeHeightFraction = 0.5;
|
|
57
|
+
|
|
58
|
+
const vessel = calculation.vessel!;
|
|
59
|
+
const lineRupture = calculation.lineRupture!;
|
|
60
|
+
|
|
61
|
+
const diameterError = Math.abs((vessel.diameter - expectedDiameter) / expectedDiameter);
|
|
62
|
+
const elevationError = Math.abs((vessel.location.z - expectedElevation) / expectedElevation);
|
|
63
|
+
const pipeDiameterError = Math.abs((lineRupture.pipeDiameter! - expectedPipeDiameter) / expectedPipeDiameter);
|
|
64
|
+
const pipeHeightFractionError = Math.abs((lineRupture.pipeHeightFraction - expectedPipeHeightFraction) / expectedPipeHeightFraction);
|
|
65
|
+
|
|
66
|
+
expect(diameterError).toBeLessThan(1e-3);
|
|
67
|
+
expect(elevationError).toBeLessThan(1e-3);
|
|
68
|
+
expect(pipeDiameterError).toBeLessThan(1e-3);
|
|
69
|
+
expect(pipeHeightFractionError).toBeLessThan(1e-3);
|
|
70
|
+
|
|
71
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${calculation.calculationElapsedTime}ms)`);
|
|
72
|
+
});
|
|
73
|
+
});
|
package/tests/load-mass-inventory-vessel-for-line-rupture-scenario-calculation/testCase128.test.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { LoadMassInventoryVesselForLineRuptureScenarioCalculation } from "../../src/calculations/utilities";
|
|
3
|
+
import { ResultCode } from "../../src/enums";
|
|
4
|
+
import { setAccessToken } from "../../src/utilities";
|
|
5
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
6
|
+
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setAccessToken(accessToken);
|
|
12
|
+
|
|
13
|
+
describe("Load Mass Inventory Vessel for Line Rupture Scenario - Test Case 128", () => {
|
|
14
|
+
test("should run the calculation and perform regression check", async () => {
|
|
15
|
+
const material = new Material({
|
|
16
|
+
name: "N-HEXANE",
|
|
17
|
+
components: [
|
|
18
|
+
new MaterialComponent({ name: "N-HEXANE", moleFraction: 1.0 }),
|
|
19
|
+
],
|
|
20
|
+
componentCount: 1,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const mass = 9876;
|
|
24
|
+
const pressure = 7e5;
|
|
25
|
+
const temperature = 250;
|
|
26
|
+
const pipeLength = 33.0;
|
|
27
|
+
const pipeDiameter = 0.1;
|
|
28
|
+
const releaseElevation = 1.0;
|
|
29
|
+
const releaseAngle = 1.1;
|
|
30
|
+
|
|
31
|
+
const calculation = new LoadMassInventoryVesselForLineRuptureScenarioCalculation(
|
|
32
|
+
material,
|
|
33
|
+
mass,
|
|
34
|
+
pressure,
|
|
35
|
+
temperature,
|
|
36
|
+
pipeDiameter,
|
|
37
|
+
pipeLength,
|
|
38
|
+
releaseElevation,
|
|
39
|
+
releaseAngle
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
console.log("Running load_mass_inventory_vessel_for_line_rupture_scenario_calculation...");
|
|
43
|
+
const resultCode = await calculation.run();
|
|
44
|
+
|
|
45
|
+
if (calculation.messages.length > 0) {
|
|
46
|
+
console.log("Messages:");
|
|
47
|
+
calculation.messages.forEach((msg) => console.log(msg));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
51
|
+
|
|
52
|
+
const expectedDiameter = 3.0323298714998153;
|
|
53
|
+
const expectedElevation = -1.7170445294165657;
|
|
54
|
+
const expectedPipeDiameter = 0.1;
|
|
55
|
+
const expectedPipeHeightFraction = 0.8960253813259087;
|
|
56
|
+
|
|
57
|
+
const vessel = calculation.vessel!;
|
|
58
|
+
const lineRupture = calculation.lineRupture!;
|
|
59
|
+
|
|
60
|
+
const diameterError = Math.abs((vessel.diameter - expectedDiameter) / expectedDiameter);
|
|
61
|
+
const elevationError = Math.abs((vessel.location.z - expectedElevation) / expectedElevation);
|
|
62
|
+
const pipeDiameterError = Math.abs((lineRupture.pipeDiameter! - expectedPipeDiameter) / expectedPipeDiameter);
|
|
63
|
+
const pipeHeightFractionError = Math.abs((lineRupture.pipeHeightFraction - expectedPipeHeightFraction) / expectedPipeHeightFraction);
|
|
64
|
+
|
|
65
|
+
expect(diameterError).toBeLessThan(1e-3);
|
|
66
|
+
expect(elevationError).toBeLessThan(1e-3);
|
|
67
|
+
expect(pipeDiameterError).toBeLessThan(1e-3);
|
|
68
|
+
expect(pipeHeightFractionError).toBeLessThan(1e-3);
|
|
69
|
+
|
|
70
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_line_rupture_scenario_calculation (${calculation.calculationElapsedTime}ms)`);
|
|
71
|
+
});
|
|
72
|
+
});
|
package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase103.test.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { LoadMassInventoryVesselForReliefValveScenarioCalculation } from "../../src/calculations/utilities";
|
|
3
|
+
import { ResultCode } from "../../src/enums";
|
|
4
|
+
import { setAccessToken } from "../../src/utilities";
|
|
5
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
6
|
+
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setAccessToken(accessToken);
|
|
12
|
+
|
|
13
|
+
describe("Load Mass Inventory Vessel for Relief Valve Scenario - Test Case 103", () => {
|
|
14
|
+
test("should run the calculation and perform regression check", async () => {
|
|
15
|
+
const material = new Material({
|
|
16
|
+
name: "PROPANE",
|
|
17
|
+
components: [
|
|
18
|
+
new MaterialComponent({ name: "PROPANE", moleFraction: 1.0 }),
|
|
19
|
+
],
|
|
20
|
+
componentCount: 1,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const mass = 1e3;
|
|
24
|
+
const pressure = 11e5;
|
|
25
|
+
const temperature = 250;
|
|
26
|
+
const constrictionSize = 0.15;
|
|
27
|
+
const pipeDiameter = 0.5;
|
|
28
|
+
const pipeLength = 10.0;
|
|
29
|
+
const releaseElevation = 1.0;
|
|
30
|
+
const releaseAngle = 0.35;
|
|
31
|
+
|
|
32
|
+
const calculation = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
33
|
+
material,
|
|
34
|
+
mass,
|
|
35
|
+
pressure,
|
|
36
|
+
temperature,
|
|
37
|
+
constrictionSize,
|
|
38
|
+
pipeDiameter,
|
|
39
|
+
pipeLength,
|
|
40
|
+
releaseElevation,
|
|
41
|
+
releaseAngle
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
45
|
+
const resultCode = await calculation.run();
|
|
46
|
+
|
|
47
|
+
if (calculation.messages.length > 0) {
|
|
48
|
+
console.log("Messages:");
|
|
49
|
+
calculation.messages.forEach((msg) => console.log(msg));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
53
|
+
|
|
54
|
+
const expectedDiameter = 1.521293357476972;
|
|
55
|
+
const expectedElevation = -0.3626191519898414;
|
|
56
|
+
const expectedPipeDiameter = 0.5;
|
|
57
|
+
const expectedPipeHeightFraction = 0.8956978253357473;
|
|
58
|
+
|
|
59
|
+
const vessel = calculation.vessel!;
|
|
60
|
+
const reliefValve = calculation.reliefValve!;
|
|
61
|
+
|
|
62
|
+
const diameterError = Math.abs((vessel.diameter - expectedDiameter) / expectedDiameter);
|
|
63
|
+
const elevationError = Math.abs((vessel.location.z - expectedElevation) / expectedElevation);
|
|
64
|
+
const pipeDiameterError = Math.abs((reliefValve.pipeDiameter! - expectedPipeDiameter) / expectedPipeDiameter);
|
|
65
|
+
const pipeHeightFractionError = Math.abs((reliefValve.pipeHeightFraction - expectedPipeHeightFraction) / expectedPipeHeightFraction);
|
|
66
|
+
|
|
67
|
+
expect(diameterError).toBeLessThan(1e-3);
|
|
68
|
+
expect(elevationError).toBeLessThan(1e-3);
|
|
69
|
+
expect(pipeDiameterError).toBeLessThan(1e-3);
|
|
70
|
+
expect(pipeHeightFractionError).toBeLessThan(1e-3);
|
|
71
|
+
|
|
72
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${calculation.calculationElapsedTime}ms)`);
|
|
73
|
+
});
|
|
74
|
+
});
|
package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase104.test.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { LoadMassInventoryVesselForReliefValveScenarioCalculation } from "../../src/calculations/utilities";
|
|
3
|
+
import { ResultCode } from "../../src/enums";
|
|
4
|
+
import { setAccessToken } from "../../src/utilities";
|
|
5
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
6
|
+
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setAccessToken(accessToken);
|
|
12
|
+
|
|
13
|
+
describe("Load Mass Inventory Vessel for Relief Valve Scenario - Test Case 104", () => {
|
|
14
|
+
test("should run the calculation and perform regression check", async () => {
|
|
15
|
+
const material = new Material({
|
|
16
|
+
name: "METHANE+ETHANE",
|
|
17
|
+
components: [
|
|
18
|
+
new MaterialComponent({ name: "METHANE", moleFraction: 0.9 }),
|
|
19
|
+
new MaterialComponent({ name: "ETHANE", moleFraction: 0.1 }),
|
|
20
|
+
],
|
|
21
|
+
componentCount: 2,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
let mass = 1e5
|
|
25
|
+
let pressure = 11e5
|
|
26
|
+
let temperature = 250
|
|
27
|
+
let constrictionSize = 0.5
|
|
28
|
+
let pipeDiameter = 0.5
|
|
29
|
+
let pipeLength = 10.0
|
|
30
|
+
let releaseElevation = 100.0
|
|
31
|
+
let releaseAngle = 0.0
|
|
32
|
+
|
|
33
|
+
const calculation = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
34
|
+
material,
|
|
35
|
+
mass,
|
|
36
|
+
pressure,
|
|
37
|
+
temperature,
|
|
38
|
+
constrictionSize,
|
|
39
|
+
pipeDiameter,
|
|
40
|
+
pipeLength,
|
|
41
|
+
releaseElevation,
|
|
42
|
+
releaseAngle,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
46
|
+
const resultCode = await calculation.run();
|
|
47
|
+
|
|
48
|
+
if (calculation.messages.length > 0) {
|
|
49
|
+
console.log("Messages:");
|
|
50
|
+
calculation.messages.forEach((msg) => console.log(msg));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
54
|
+
|
|
55
|
+
const expectedDiameter = 27.049130317992706;
|
|
56
|
+
const expectedElevation = 86.47543484100365;
|
|
57
|
+
const expectedPipeDiameter = 0.5;
|
|
58
|
+
const expectedPipeHeightFraction = 0.5;
|
|
59
|
+
|
|
60
|
+
const vessel = calculation.vessel!;
|
|
61
|
+
const reliefValve = calculation.reliefValve!;
|
|
62
|
+
|
|
63
|
+
const diameterError = Math.abs((vessel.diameter - expectedDiameter) / expectedDiameter);
|
|
64
|
+
const elevationError = Math.abs((vessel.location.z - expectedElevation) / expectedElevation);
|
|
65
|
+
const pipeDiameterError = Math.abs((reliefValve.pipeDiameter! - expectedPipeDiameter) / expectedPipeDiameter);
|
|
66
|
+
const pipeHeightFractionError = Math.abs((reliefValve.pipeHeightFraction - expectedPipeHeightFraction) / expectedPipeHeightFraction);
|
|
67
|
+
|
|
68
|
+
expect(diameterError).toBeLessThan(1e-3);
|
|
69
|
+
expect(elevationError).toBeLessThan(1e-3);
|
|
70
|
+
expect(pipeDiameterError).toBeLessThan(1e-3);
|
|
71
|
+
expect(pipeHeightFractionError).toBeLessThan(1e-3);
|
|
72
|
+
|
|
73
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${calculation.calculationElapsedTime}ms)`);
|
|
74
|
+
});
|
|
75
|
+
});
|
package/tests/load-mass-inventory-vessel-for-relief-valve-scenario-calculation/testCase105.test.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { LoadMassInventoryVesselForReliefValveScenarioCalculation } from "../../src/calculations/utilities";
|
|
3
|
+
import { ResultCode } from "../../src/enums";
|
|
4
|
+
import { setAccessToken } from "../../src/utilities";
|
|
5
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
6
|
+
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setAccessToken(accessToken);
|
|
12
|
+
|
|
13
|
+
describe("Load Mass Inventory Vessel for Relief Valve Scenario - Test Case 105", () => {
|
|
14
|
+
test("should run the calculation and perform regression check", async () => {
|
|
15
|
+
const material = new Material({
|
|
16
|
+
name: "N-HEXANE",
|
|
17
|
+
components: [
|
|
18
|
+
new MaterialComponent({ name: "N-HEXANE", moleFraction: 1.0 }),
|
|
19
|
+
],
|
|
20
|
+
componentCount: 1,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const mass = 9876;
|
|
24
|
+
const pressure = 7e5;
|
|
25
|
+
const temperature = 250;
|
|
26
|
+
const constrictionSize = 0.05;
|
|
27
|
+
const pipeDiameter = 0.1;
|
|
28
|
+
const pipeLength = 33.0;
|
|
29
|
+
const releaseElevation = 1.0;
|
|
30
|
+
const releaseAngle = 1.1;
|
|
31
|
+
|
|
32
|
+
const calculation = new LoadMassInventoryVesselForReliefValveScenarioCalculation(
|
|
33
|
+
material,
|
|
34
|
+
mass,
|
|
35
|
+
pressure,
|
|
36
|
+
temperature,
|
|
37
|
+
constrictionSize,
|
|
38
|
+
pipeDiameter,
|
|
39
|
+
pipeLength,
|
|
40
|
+
releaseElevation,
|
|
41
|
+
releaseAngle,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
console.log("Running load_mass_inventory_vessel_for_relief_valve_scenario_calculation...");
|
|
45
|
+
const resultCode = await calculation.run();
|
|
46
|
+
|
|
47
|
+
if (calculation.messages.length > 0) {
|
|
48
|
+
console.log("Messages:");
|
|
49
|
+
calculation.messages.forEach((msg) => console.log(msg));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
53
|
+
|
|
54
|
+
const expectedDiameter = 3.0323298714998153;
|
|
55
|
+
const expectedElevation = -1.7170445294165657;
|
|
56
|
+
const expectedPipeDiameter = 0.1;
|
|
57
|
+
const expectedPipeHeightFraction = 0.8960253813259087;
|
|
58
|
+
|
|
59
|
+
const vessel = calculation.vessel!;
|
|
60
|
+
const reliefValve = calculation.reliefValve!;
|
|
61
|
+
|
|
62
|
+
const diameterError = Math.abs((vessel.diameter - expectedDiameter) / expectedDiameter);
|
|
63
|
+
const elevationError = Math.abs((vessel.location.z - expectedElevation) / expectedElevation);
|
|
64
|
+
const pipeDiameterError = Math.abs((reliefValve.pipeDiameter! - expectedPipeDiameter) / expectedPipeDiameter);
|
|
65
|
+
const pipeHeightFractionError = Math.abs((reliefValve.pipeHeightFraction - expectedPipeHeightFraction) / expectedPipeHeightFraction);
|
|
66
|
+
|
|
67
|
+
expect(diameterError).toBeLessThan(1e-3);
|
|
68
|
+
expect(elevationError).toBeLessThan(1e-3);
|
|
69
|
+
expect(pipeDiameterError).toBeLessThan(1e-3);
|
|
70
|
+
expect(pipeHeightFractionError).toBeLessThan(1e-3);
|
|
71
|
+
|
|
72
|
+
console.log(`SUCCESS: load_mass_inventory_vessel_for_relief_valve_scenario_calculation (${calculation.calculationElapsedTime}ms)`);
|
|
73
|
+
});
|
|
74
|
+
});
|