@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,162 @@
|
|
|
1
|
+
import { Material, MaterialComponent, State, Vessel, Bund, Substrate, DischargeParameters, Weather, DispersionParameters, DispersionOutputConfig, LineRupture } from "../../src/entities";
|
|
2
|
+
import { VesselCatastrophicRuptureCalculation, VesselStateCalculation, VesselLeakCalculation, VesselLineRuptureCalculation } from "../../src/calculations/discharge";
|
|
3
|
+
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
+
import { MaxDistanceToConcCalculation } from "../../src/calculations/dispersionView";
|
|
5
|
+
import { ResultCode, SurfaceType, AtmosphericStabilityClass, VesselShape, TimeVaryingOption, SpecialConcentration, WindProfileFlag } from "../../src/enums";
|
|
6
|
+
import { setAccessToken } from "../../src/utilities";
|
|
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("Max Distance to Concentration Calculation - Test Case 114", () => {
|
|
16
|
+
test("should calculate max distance to concentration correctly", async () => {
|
|
17
|
+
const stateTemperature = 290.0;
|
|
18
|
+
const statePressure = 7.0e6;
|
|
19
|
+
const stateLiquidFraction = 1.0;
|
|
20
|
+
const surfaceType = SurfaceType.LAND;
|
|
21
|
+
const surfaceRoughness = 0.183;
|
|
22
|
+
const windSpeed = 1.5;
|
|
23
|
+
const stabilityClass = AtmosphericStabilityClass.STABILITY_D;
|
|
24
|
+
const endPointConcentration = 0.0;
|
|
25
|
+
const specifyBund = true;
|
|
26
|
+
const bundHeight = 0.5;
|
|
27
|
+
const bundDiameter = 5.0;
|
|
28
|
+
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
29
|
+
|
|
30
|
+
const state = new State({
|
|
31
|
+
temperature: stateTemperature,
|
|
32
|
+
pressure: statePressure,
|
|
33
|
+
liquidFraction: stateLiquidFraction,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const material = new Material({
|
|
37
|
+
name: "AMMONIA",
|
|
38
|
+
components: [new MaterialComponent({ name: "AMMONIA", moleFraction: 1.0 })],
|
|
39
|
+
componentCount: 1,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
43
|
+
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
44
|
+
|
|
45
|
+
if (vesselStateCalculation.messages.length > 0) {
|
|
46
|
+
console.log("Messages:");
|
|
47
|
+
vesselStateCalculation.messages.forEach((msg) => console.log(msg));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
51
|
+
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
52
|
+
|
|
53
|
+
const vessel = new Vessel({
|
|
54
|
+
state,
|
|
55
|
+
material,
|
|
56
|
+
vesselConditions: vesselStateCalculation.vesselConditions,
|
|
57
|
+
liquidFillFractionByVolume: 0.7,
|
|
58
|
+
shape: VesselShape.VESSEL_CUBOID,
|
|
59
|
+
height: 2,
|
|
60
|
+
width: 1,
|
|
61
|
+
length: 3,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const lineRupture = new LineRupture({
|
|
65
|
+
pipeDiameter: 0.1,
|
|
66
|
+
pipeLength: 1.0,
|
|
67
|
+
pipeHeightFraction: 0.1,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const vesselLineRuptureCalculation = new VesselLineRuptureCalculation(
|
|
71
|
+
vessel,
|
|
72
|
+
lineRupture,
|
|
73
|
+
new DischargeParameters()
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const vesselLineRuptureResultCode = await vesselLineRuptureCalculation.run();
|
|
77
|
+
|
|
78
|
+
if (vesselLineRuptureCalculation.messages.length > 0) {
|
|
79
|
+
console.log("Messages:");
|
|
80
|
+
vesselLineRuptureCalculation.messages.forEach((msg) => console.log(msg));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
expect(vesselLineRuptureResultCode).toBe(ResultCode.SUCCESS);
|
|
84
|
+
console.log(`SUCCESS: vessel_line_rupture_calculation (${vesselLineRuptureCalculation.calculationElapsedTime}ms)`);
|
|
85
|
+
|
|
86
|
+
const bund = new Bund({
|
|
87
|
+
specifyBund,
|
|
88
|
+
bundHeight,
|
|
89
|
+
bundDiameter,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const substrate = new Substrate({
|
|
93
|
+
bund,
|
|
94
|
+
surfaceType,
|
|
95
|
+
surfaceRoughness,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const weather = new Weather({
|
|
99
|
+
windSpeed: windSpeed,
|
|
100
|
+
stabilityClass: stabilityClass,
|
|
101
|
+
windProfileFlag: windProfileFlag
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const dispersionParameters = new DispersionParameters();
|
|
105
|
+
|
|
106
|
+
const dispersionCalculation = new DispersionCalculation(
|
|
107
|
+
vesselLineRuptureCalculation.exitMaterial!,
|
|
108
|
+
substrate,
|
|
109
|
+
vesselLineRuptureCalculation.dischargeResult!,
|
|
110
|
+
vesselLineRuptureCalculation.dischargeRecords!,
|
|
111
|
+
vesselLineRuptureCalculation.dischargeRecords!.length,
|
|
112
|
+
weather,
|
|
113
|
+
dispersionParameters,
|
|
114
|
+
endPointConcentration
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const dispersionResultCode = await dispersionCalculation.run();
|
|
118
|
+
|
|
119
|
+
if (dispersionCalculation.messages.length > 0) {
|
|
120
|
+
console.log("Messages:");
|
|
121
|
+
dispersionCalculation.messages.forEach((msg) => console.log(msg));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
125
|
+
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
126
|
+
|
|
127
|
+
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
128
|
+
concentration: endPointConcentration,
|
|
129
|
+
elevation: 1.0,
|
|
130
|
+
specialConcentration: SpecialConcentration.LFL,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const maxDistanceToConcCalculation = new MaxDistanceToConcCalculation(
|
|
134
|
+
dispersionCalculation.scalarUdmOutputs!,
|
|
135
|
+
weather,
|
|
136
|
+
dispersionCalculation.dispersionRecords!,
|
|
137
|
+
dispersionCalculation.dispersionRecords!.length,
|
|
138
|
+
substrate,
|
|
139
|
+
dispersionOutputConfig,
|
|
140
|
+
dispersionParameters,
|
|
141
|
+
vesselLineRuptureCalculation.exitMaterial!
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const maxDistanceResultCode = await maxDistanceToConcCalculation.run();
|
|
145
|
+
|
|
146
|
+
if (maxDistanceToConcCalculation.messages.length > 0) {
|
|
147
|
+
console.log("Messages:");
|
|
148
|
+
maxDistanceToConcCalculation.messages.forEach((msg) => console.log(msg));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
expect(maxDistanceResultCode).toBe(ResultCode.SUCCESS);
|
|
152
|
+
|
|
153
|
+
const expectedDistance = 42.28674862332736;
|
|
154
|
+
const distanceError = Math.abs(
|
|
155
|
+
(maxDistanceToConcCalculation.distance! - expectedDistance) / expectedDistance
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
expect(distanceError).toBeLessThan(1e-3);
|
|
159
|
+
console.log(`SUCCESS: max_distance_to_conc_calculation (${maxDistanceToConcCalculation.calculationElapsedTime}ms)`);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Material, MaterialComponent, State, Vessel, Bund, Substrate, DischargeParameters, Weather, DispersionParameters, DispersionOutputConfig, ReliefValve } from "../../src/entities";
|
|
2
|
+
import { VesselCatastrophicRuptureCalculation, VesselStateCalculation, VesselReliefValveCalculation } from "../../src/calculations/discharge";
|
|
3
|
+
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
+
import { MaxDistanceToConcCalculation } from "../../src/calculations/dispersionView";
|
|
5
|
+
import { ResultCode, SurfaceType, AtmosphericStabilityClass, VesselShape, TimeVaryingOption, SpecialConcentration, WindProfileFlag } from "../../src/enums";
|
|
6
|
+
import { setAccessToken } from "../../src/utilities";
|
|
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("Max Distance to Concentration Calculation - Test Case 115", () => {
|
|
16
|
+
test("should calculate max distance to concentration for CHLORINE vessel with relief valve", async () => {
|
|
17
|
+
// Define vessel and relief valve parameters
|
|
18
|
+
const stateTemperature = 320.0;
|
|
19
|
+
const statePressure = 1.0e6;
|
|
20
|
+
const stateLiquidFraction = 1.0;
|
|
21
|
+
const vesselShape = VesselShape.HORIZONTAL_CYLINDER;
|
|
22
|
+
const vesselDiameter = 2.0;
|
|
23
|
+
const vesselLength = 5.0;
|
|
24
|
+
const liquidFillFractionByVolume = 0.7;
|
|
25
|
+
|
|
26
|
+
const reliefValvePipeDiameter = 0.02;
|
|
27
|
+
const reliefValvePipeLength = 10.0;
|
|
28
|
+
const reliefValvePipeHeightFraction = 1.0;
|
|
29
|
+
const reliefValveConstrictionDiameter = 0.02;
|
|
30
|
+
|
|
31
|
+
const surfaceType = SurfaceType.LAND;
|
|
32
|
+
const surfaceRoughness = 0.183;
|
|
33
|
+
const windSpeed = 1.5;
|
|
34
|
+
const stabilityClass = AtmosphericStabilityClass.STABILITY_D;
|
|
35
|
+
|
|
36
|
+
const endPointConcentration = 0.0;
|
|
37
|
+
const specifyBund = true;
|
|
38
|
+
const bundHeight = 0.5;
|
|
39
|
+
const bundDiameter = 5.0;
|
|
40
|
+
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
41
|
+
|
|
42
|
+
// Define state and material
|
|
43
|
+
const state = new State({
|
|
44
|
+
temperature: stateTemperature,
|
|
45
|
+
pressure: statePressure,
|
|
46
|
+
liquidFraction: stateLiquidFraction,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const material = new Material({
|
|
50
|
+
name: "CHLORINE",
|
|
51
|
+
components: [new MaterialComponent({ name: "CHLORINE", moleFraction: 1.0 })],
|
|
52
|
+
componentCount: 1,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Run VesselStateCalculation
|
|
56
|
+
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
57
|
+
const stateResult = await vesselStateCalculation.run();
|
|
58
|
+
|
|
59
|
+
if (vesselStateCalculation.messages.length > 0) {
|
|
60
|
+
console.log("Messages:");
|
|
61
|
+
vesselStateCalculation.messages.forEach((msg) => console.log(msg));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
expect(stateResult).toBe(ResultCode.SUCCESS);
|
|
65
|
+
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
66
|
+
|
|
67
|
+
// Define Vessel
|
|
68
|
+
const vessel = new Vessel({
|
|
69
|
+
state,
|
|
70
|
+
material,
|
|
71
|
+
vesselConditions: vesselStateCalculation.vesselConditions,
|
|
72
|
+
liquidFillFractionByVolume: liquidFillFractionByVolume,
|
|
73
|
+
shape: vesselShape,
|
|
74
|
+
diameter: vesselDiameter,
|
|
75
|
+
length: vesselLength,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Define Relief Valve
|
|
79
|
+
const reliefValve = new ReliefValve({
|
|
80
|
+
pipeDiameter: reliefValvePipeDiameter,
|
|
81
|
+
pipeLength: reliefValvePipeLength,
|
|
82
|
+
pipeHeightFraction: reliefValvePipeHeightFraction,
|
|
83
|
+
reliefValveConstrictionDiameter: reliefValveConstrictionDiameter,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Run VesselReliefValveCalculation
|
|
87
|
+
const vesselReliefValveCalculation = new VesselReliefValveCalculation(
|
|
88
|
+
vessel,
|
|
89
|
+
reliefValve,
|
|
90
|
+
new DischargeParameters()
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const reliefResult = await vesselReliefValveCalculation.run();
|
|
94
|
+
|
|
95
|
+
if (vesselReliefValveCalculation.messages.length > 0) {
|
|
96
|
+
console.log("Messages:");
|
|
97
|
+
vesselReliefValveCalculation.messages.forEach((msg) => console.log(msg));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
expect(reliefResult).toBe(ResultCode.SUCCESS);
|
|
101
|
+
console.log(`SUCCESS: vessel_relief_valve_calculation (${vesselReliefValveCalculation.calculationElapsedTime}ms)`);
|
|
102
|
+
console.log(`Release mass: ${vesselReliefValveCalculation.dischargeResult?.releaseMass} kg`);
|
|
103
|
+
|
|
104
|
+
// Set up DispersionCalculation
|
|
105
|
+
const bund = new Bund({ specifyBund, bundHeight, bundDiameter });
|
|
106
|
+
const substrate = new Substrate({ bund, surfaceType, surfaceRoughness });
|
|
107
|
+
const weather = new Weather({ windSpeed: windSpeed, stabilityClass: stabilityClass, windProfileFlag: windProfileFlag });
|
|
108
|
+
const dispersionParameters = new DispersionParameters();
|
|
109
|
+
|
|
110
|
+
const dispersionCalculation = new DispersionCalculation(
|
|
111
|
+
vesselReliefValveCalculation.exitMaterial!,
|
|
112
|
+
substrate,
|
|
113
|
+
vesselReliefValveCalculation.dischargeResult!,
|
|
114
|
+
vesselReliefValveCalculation.dischargeRecords!,
|
|
115
|
+
vesselReliefValveCalculation.dischargeRecords!.length,
|
|
116
|
+
weather,
|
|
117
|
+
dispersionParameters,
|
|
118
|
+
endPointConcentration
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const dispersionResult = await dispersionCalculation.run();
|
|
122
|
+
|
|
123
|
+
if (dispersionCalculation.messages.length > 0) {
|
|
124
|
+
console.log("Messages:");
|
|
125
|
+
dispersionCalculation.messages.forEach((msg) => console.log(msg));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
expect(dispersionResult).toBe(ResultCode.SUCCESS);
|
|
129
|
+
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
130
|
+
|
|
131
|
+
// Set up MaxDistanceToConcCalculation
|
|
132
|
+
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
133
|
+
concentration: 1e-4,
|
|
134
|
+
elevation: 3.5,
|
|
135
|
+
specialConcentration: SpecialConcentration.NOT_DEFINED,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const maxDistanceToConcCalculation = new MaxDistanceToConcCalculation(
|
|
139
|
+
dispersionCalculation.scalarUdmOutputs!,
|
|
140
|
+
weather,
|
|
141
|
+
dispersionCalculation.dispersionRecords!,
|
|
142
|
+
dispersionCalculation.dispersionRecords!.length,
|
|
143
|
+
substrate,
|
|
144
|
+
dispersionOutputConfig,
|
|
145
|
+
dispersionParameters,
|
|
146
|
+
vesselReliefValveCalculation.exitMaterial!
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const maxDistResult = await maxDistanceToConcCalculation.run();
|
|
150
|
+
|
|
151
|
+
if (maxDistanceToConcCalculation.messages.length > 0) {
|
|
152
|
+
console.log("Messages:");
|
|
153
|
+
maxDistanceToConcCalculation.messages.forEach((msg) => console.log(msg));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
expect(maxDistResult).toBe(ResultCode.SUCCESS);
|
|
157
|
+
|
|
158
|
+
const expectedDistance = 319.19195887085976;
|
|
159
|
+
const actualDistance = maxDistanceToConcCalculation.distance!;
|
|
160
|
+
const distanceError = Math.abs((actualDistance - expectedDistance) / expectedDistance);
|
|
161
|
+
|
|
162
|
+
expect(distanceError).toBeLessThan(1e-3);
|
|
163
|
+
|
|
164
|
+
console.log(`SUCCESS: max_distance_to_conc_calculation (${maxDistanceToConcCalculation.calculationElapsedTime}ms)`);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { MixtureConstantPropertiesCalculation } from "../../src/calculations/applicationTools";
|
|
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
|
+
// Define the test case
|
|
13
|
+
describe("Mixture Constant Properties Calculation - Test Case 97", () => {
|
|
14
|
+
test("should calculate the correct mixture constant properties", async () => {
|
|
15
|
+
// Set the material
|
|
16
|
+
const material = new Material(
|
|
17
|
+
{
|
|
18
|
+
name: "NATURAL GAS",
|
|
19
|
+
components:
|
|
20
|
+
[
|
|
21
|
+
new MaterialComponent({name: "METHANE", moleFraction: 0.85}),
|
|
22
|
+
new MaterialComponent({name: "ETHANE", moleFraction: 0.1}),
|
|
23
|
+
new MaterialComponent({name: "PROPANE", moleFraction: 0.05}),
|
|
24
|
+
],
|
|
25
|
+
componentCount: 3
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Create a mixture constant properties calculation using the material
|
|
29
|
+
const mixtureConstantPropertiesCalculation = new MixtureConstantPropertiesCalculation(material);
|
|
30
|
+
|
|
31
|
+
// Run the calculation
|
|
32
|
+
console.log('Running mixtureConstantPropertiesCalculation...');
|
|
33
|
+
const resultCode = await mixtureConstantPropertiesCalculation.run();
|
|
34
|
+
|
|
35
|
+
// Print any messages
|
|
36
|
+
if (mixtureConstantPropertiesCalculation.messages.length > 0) {
|
|
37
|
+
console.log('Messages:');
|
|
38
|
+
mixtureConstantPropertiesCalculation.messages.forEach((message) => console.log(message));
|
|
39
|
+
}
|
|
40
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
41
|
+
// Check the result code and assertions
|
|
42
|
+
|
|
43
|
+
expect(
|
|
44
|
+
Math.abs(
|
|
45
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.lowerFlammabilityLimit! - 0.04402515723270441) /
|
|
46
|
+
0.04402515723270441
|
|
47
|
+
)
|
|
48
|
+
).toBeLessThan(1e-3);
|
|
49
|
+
expect(
|
|
50
|
+
Math.abs(
|
|
51
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.upperFlammabilityLimit! - 0.14286869340232858) /
|
|
52
|
+
0.14286869340232858
|
|
53
|
+
)
|
|
54
|
+
).toBeLessThan(1e-3);
|
|
55
|
+
expect(
|
|
56
|
+
Math.abs(
|
|
57
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.criticalPressure! - 4608750.0) /
|
|
58
|
+
4608750.0
|
|
59
|
+
)
|
|
60
|
+
).toBeLessThan(1e-3);
|
|
61
|
+
expect(
|
|
62
|
+
Math.abs(
|
|
63
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.criticalTemperature! - 210.991) /
|
|
64
|
+
210.991
|
|
65
|
+
)
|
|
66
|
+
).toBeLessThan(1e-3);
|
|
67
|
+
expect(
|
|
68
|
+
Math.abs(
|
|
69
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.molecularWeight! - 18.847806000000002) /
|
|
70
|
+
18.847806000000002
|
|
71
|
+
)
|
|
72
|
+
).toBeLessThan(1e-3);
|
|
73
|
+
expect(
|
|
74
|
+
Math.abs(
|
|
75
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.bubblePoint! - 113.67514401917592) /
|
|
76
|
+
113.67514401917592
|
|
77
|
+
)
|
|
78
|
+
).toBeLessThan(1e-3);
|
|
79
|
+
|
|
80
|
+
console.log(`SUCCESS: mixtureConstantPropertiesCalculation (${mixtureConstantPropertiesCalculation.calculationElapsedTime}ms)`);
|
|
81
|
+
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { MixtureConstantPropertiesCalculation } from "../../src/calculations/applicationTools";
|
|
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
|
+
// Define the test case
|
|
13
|
+
describe("Mixture Constant Properties Calculation - Test Case 98", () => {
|
|
14
|
+
test("should calculate the correct mixture constant properties", async () => {
|
|
15
|
+
// Set the material
|
|
16
|
+
const material = new Material(
|
|
17
|
+
{
|
|
18
|
+
name: "GASOLINE",
|
|
19
|
+
components: [
|
|
20
|
+
new MaterialComponent({ name: "N-OCTANE", moleFraction: 0.77 }),
|
|
21
|
+
new MaterialComponent({ name: "N-HEPTANE", moleFraction: 0.13 }),
|
|
22
|
+
new MaterialComponent({ name: "N-NONANE", moleFraction: 0.05 }),
|
|
23
|
+
new MaterialComponent({ name: "TOLUENE", moleFraction: 0.05 }),
|
|
24
|
+
],
|
|
25
|
+
componentCount: 4,
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Create a mixture constant properties calculation using the material
|
|
30
|
+
const mixtureConstantPropertiesCalculation = new MixtureConstantPropertiesCalculation(material);
|
|
31
|
+
|
|
32
|
+
// Run the calculation
|
|
33
|
+
console.log('Running mixtureConstantPropertiesCalculation...');
|
|
34
|
+
const resultCode = await mixtureConstantPropertiesCalculation.run();
|
|
35
|
+
|
|
36
|
+
// Print any messages
|
|
37
|
+
if (mixtureConstantPropertiesCalculation.messages.length > 0) {
|
|
38
|
+
console.log('Messages:');
|
|
39
|
+
mixtureConstantPropertiesCalculation.messages.forEach((message) => console.log(message));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check if the result code is success
|
|
43
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
44
|
+
|
|
45
|
+
// Validate regression results with a tolerance of 1e-3
|
|
46
|
+
expect(
|
|
47
|
+
Math.abs(
|
|
48
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.lowerFlammabilityLimit! - 0.00970712693329131) /
|
|
49
|
+
0.00970712693329131
|
|
50
|
+
)
|
|
51
|
+
).toBeLessThan(1e-3);
|
|
52
|
+
|
|
53
|
+
expect(
|
|
54
|
+
Math.abs(
|
|
55
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.upperFlammabilityLimit! - 0.06500456558538582) /
|
|
56
|
+
0.06500456558538582
|
|
57
|
+
)
|
|
58
|
+
).toBeLessThan(1e-3);
|
|
59
|
+
|
|
60
|
+
expect(
|
|
61
|
+
Math.abs(
|
|
62
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.criticalPressure! - 2593400.0) /
|
|
63
|
+
2593400.0
|
|
64
|
+
)
|
|
65
|
+
).toBeLessThan(1e-3);
|
|
66
|
+
|
|
67
|
+
expect(
|
|
68
|
+
Math.abs(
|
|
69
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.criticalTemperature! - 567.4425) /
|
|
70
|
+
567.4425
|
|
71
|
+
)
|
|
72
|
+
).toBeLessThan(1e-3);
|
|
73
|
+
|
|
74
|
+
expect(
|
|
75
|
+
Math.abs(
|
|
76
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.molecularWeight! - 112.00188860000002) /
|
|
77
|
+
112.00188860000002
|
|
78
|
+
)
|
|
79
|
+
).toBeLessThan(1e-3);
|
|
80
|
+
|
|
81
|
+
expect(
|
|
82
|
+
Math.abs(
|
|
83
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.bubblePoint! - 393.99970870791725) /
|
|
84
|
+
393.99970870791725
|
|
85
|
+
)
|
|
86
|
+
).toBeLessThan(1e-3);
|
|
87
|
+
|
|
88
|
+
console.log(`SUCCESS: mixtureConstantPropertiesCalculation (${mixtureConstantPropertiesCalculation.calculationElapsedTime}ms)`);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Material, MaterialComponent } from "../../src/entities";
|
|
2
|
+
import { MixtureConstantPropertiesCalculation } from "../../src/calculations/applicationTools";
|
|
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
|
+
// Define the test case
|
|
13
|
+
describe("Mixture Constant Properties Calculation - Test Case 99", () => {
|
|
14
|
+
test("should calculate the correct mixture constant properties", async () => {
|
|
15
|
+
// Set the material
|
|
16
|
+
const material = new Material({
|
|
17
|
+
name: "ORIMULSION",
|
|
18
|
+
components: [
|
|
19
|
+
new MaterialComponent({ name: "N-DODECANE", moleFraction: 0.50 }),
|
|
20
|
+
new MaterialComponent({ name: "TOLUENE", moleFraction: 0.20 }),
|
|
21
|
+
new MaterialComponent({ name: "WATER", moleFraction: 0.30 }),
|
|
22
|
+
],
|
|
23
|
+
componentCount: 3,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Create a mixture constant properties calculation using the material
|
|
27
|
+
const mixtureConstantPropertiesCalculation = new MixtureConstantPropertiesCalculation(material);
|
|
28
|
+
|
|
29
|
+
// Run the calculation
|
|
30
|
+
console.log('Running mixtureConstantPropertiesCalculation...');
|
|
31
|
+
const resultCode = await mixtureConstantPropertiesCalculation.run();
|
|
32
|
+
|
|
33
|
+
// Print any messages
|
|
34
|
+
if (mixtureConstantPropertiesCalculation.messages.length > 0) {
|
|
35
|
+
console.log('Messages:');
|
|
36
|
+
mixtureConstantPropertiesCalculation.messages.forEach((message) => console.log(message));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Ensure the result code is successful
|
|
40
|
+
expect(resultCode).toBe(ResultCode.SUCCESS);
|
|
41
|
+
|
|
42
|
+
// Check each property with tolerance
|
|
43
|
+
expect(
|
|
44
|
+
Math.abs(
|
|
45
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.lowerFlammabilityLimit! - 0.009850746268656717) /
|
|
46
|
+
0.009850746268656717
|
|
47
|
+
)
|
|
48
|
+
).toBeLessThan(1e-3);
|
|
49
|
+
|
|
50
|
+
expect(
|
|
51
|
+
Math.abs(
|
|
52
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.upperFlammabilityLimit! - 0.0767991169977925) /
|
|
53
|
+
0.0767991169977925
|
|
54
|
+
)
|
|
55
|
+
).toBeLessThan(1e-3);
|
|
56
|
+
|
|
57
|
+
expect(
|
|
58
|
+
Math.abs(
|
|
59
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.criticalPressure! - 8350800.0) /
|
|
60
|
+
8350800.0
|
|
61
|
+
)
|
|
62
|
+
).toBeLessThan(1e-3);
|
|
63
|
+
|
|
64
|
+
expect(
|
|
65
|
+
Math.abs(
|
|
66
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.criticalTemperature! - 641.4788) /
|
|
67
|
+
641.4788
|
|
68
|
+
)
|
|
69
|
+
).toBeLessThan(1e-3);
|
|
70
|
+
|
|
71
|
+
expect(
|
|
72
|
+
Math.abs(
|
|
73
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.molecularWeight! - 108.999688) /
|
|
74
|
+
108.999688
|
|
75
|
+
)
|
|
76
|
+
).toBeLessThan(1e-3);
|
|
77
|
+
|
|
78
|
+
expect(
|
|
79
|
+
Math.abs(
|
|
80
|
+
(mixtureConstantPropertiesCalculation.mixConstantPropResult!.bubblePoint! - 397.76504890039934) /
|
|
81
|
+
397.76504890039934
|
|
82
|
+
)
|
|
83
|
+
).toBeLessThan(1e-3);
|
|
84
|
+
|
|
85
|
+
console.log(`SUCCESS: mixtureConstantPropertiesCalculation (${mixtureConstantPropertiesCalculation.calculationElapsedTime}ms)`);
|
|
86
|
+
});
|
|
87
|
+
});
|