@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,47 @@
|
|
|
1
|
+
import { getComponents } from "../../src/materials";
|
|
2
|
+
import { setAccessToken } from "../../src/utilities";
|
|
3
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
4
|
+
|
|
5
|
+
if (!accessToken) {
|
|
6
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setAccessToken(accessToken);
|
|
10
|
+
|
|
11
|
+
describe('getComponents function', () => {
|
|
12
|
+
it('should fetch DNV components', async () => {
|
|
13
|
+
console.log('Running get_components for DNV components');
|
|
14
|
+
|
|
15
|
+
// Fetch DNV components (ID 1 in this case)
|
|
16
|
+
const components = await getComponents(1);
|
|
17
|
+
|
|
18
|
+
// Assert that components are returned
|
|
19
|
+
expect(components).not.toBeNull();
|
|
20
|
+
|
|
21
|
+
if (components) {
|
|
22
|
+
// Print out the list of component names
|
|
23
|
+
console.log('DNV components:');
|
|
24
|
+
components.forEach((component) => {
|
|
25
|
+
console.log(`${component.name}, ${component.id}`);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should fetch DIPPR components', async () => {
|
|
31
|
+
console.log('Running get_components for DIPPR components');
|
|
32
|
+
|
|
33
|
+
// Fetch DIPPR components (ID 2 in this case)
|
|
34
|
+
const components = await getComponents(2);
|
|
35
|
+
|
|
36
|
+
// Assert that components are returned
|
|
37
|
+
expect(components).not.toBeNull();
|
|
38
|
+
|
|
39
|
+
if (components) {
|
|
40
|
+
// Print out the list of component names
|
|
41
|
+
console.log('DIPPR components:');
|
|
42
|
+
components.forEach((component) => {
|
|
43
|
+
console.log(`${component.name}, ${component.id}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getDipprComponents } from "../../src/materials";
|
|
2
|
+
import { setAccessToken } from "../../src/utilities";
|
|
3
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
4
|
+
|
|
5
|
+
if (!accessToken) {
|
|
6
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setAccessToken(accessToken);
|
|
10
|
+
|
|
11
|
+
describe('getDipprComponents Test', () => {
|
|
12
|
+
test('should retrieve DIPPR components successfully', async () => {
|
|
13
|
+
console.log('Running get_dippr_components');
|
|
14
|
+
|
|
15
|
+
// Call the method to fetch DIPPR components
|
|
16
|
+
const dipprComponents = await getDipprComponents();
|
|
17
|
+
|
|
18
|
+
// Assert if there are no components returned
|
|
19
|
+
expect(dipprComponents).not.toBeNull();
|
|
20
|
+
expect(dipprComponents.length).toBeGreaterThan(0); // Ensure there's at least one component
|
|
21
|
+
|
|
22
|
+
// Log out the names of the components
|
|
23
|
+
console.log('Components:');
|
|
24
|
+
dipprComponents.forEach((component) => {
|
|
25
|
+
console.log(component.name);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getDnvComponents } from "../../src/materials";
|
|
2
|
+
import { setAccessToken } from "../../src/utilities";
|
|
3
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
4
|
+
|
|
5
|
+
if (!accessToken) {
|
|
6
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setAccessToken(accessToken);
|
|
10
|
+
|
|
11
|
+
describe('get_dnv_components', () => {
|
|
12
|
+
test('should return a list of DNV components', async () => {
|
|
13
|
+
console.log('Running get_dnv_components');
|
|
14
|
+
|
|
15
|
+
// Invoke the method to fetch the DNV components
|
|
16
|
+
const dnvComponents = await getDnvComponents();
|
|
17
|
+
|
|
18
|
+
// Assert if no components were returned
|
|
19
|
+
expect(dnvComponents).not.toBeNull();
|
|
20
|
+
expect(dnvComponents.length).toBeGreaterThan(0); // Make sure there's at least one component
|
|
21
|
+
|
|
22
|
+
// Print out the list of component names
|
|
23
|
+
console.log('Components:');
|
|
24
|
+
dnvComponents.forEach((component: { name: string }) => {
|
|
25
|
+
console.log(component.name);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getMaterialByCasId } from "../../src/materials";;
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
// Define the test
|
|
12
|
+
describe('getMaterialByCasId - Test Case 1,2-PROPYLENE OXIDE', () => {
|
|
13
|
+
it('should return the material for CAS ID 75569 as 1,2-PROPYLENE OXIDE', async () => {
|
|
14
|
+
console.log('Running getMaterialByCasId');
|
|
15
|
+
|
|
16
|
+
// Call the function to get materials by CAS ID
|
|
17
|
+
const material = await getMaterialByCasId(75569);
|
|
18
|
+
|
|
19
|
+
// Check that materials is not null and has at least one entry
|
|
20
|
+
expect(material).not.toBeNull();
|
|
21
|
+
|
|
22
|
+
// Check if the material name is 1,2-PROPYLENE OXIDE
|
|
23
|
+
const foundMaterialName = material[0].name === '1,2-PROPYLENE OXIDE';
|
|
24
|
+
expect(foundMaterialName).toBe(true);
|
|
25
|
+
|
|
26
|
+
// Log the materials for verification
|
|
27
|
+
console.log('Material:', material[0].name);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getMaterialByCasId } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
|
|
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
|
+
// Define the test
|
|
14
|
+
describe('getMaterialByCasId - Test Case 2, CARBON MONOXIDE', () => {
|
|
15
|
+
it('should return the material for CAS ID 630080 as CARBON MONOXIDE', async () => {
|
|
16
|
+
console.log('Running getMaterialByCasId');
|
|
17
|
+
|
|
18
|
+
// Call the function to get materials by CAS ID
|
|
19
|
+
const material = await getMaterialByCasId(630080);
|
|
20
|
+
|
|
21
|
+
// Check that material is not null
|
|
22
|
+
expect(material).not.toBeNull();
|
|
23
|
+
|
|
24
|
+
// Check if the material name is CARBON MONOXIDE
|
|
25
|
+
const foundMaterialName = material[0].name === 'CARBON MONOXIDE';
|
|
26
|
+
expect(foundMaterialName).toBe(true);
|
|
27
|
+
|
|
28
|
+
// Log the materials for verification
|
|
29
|
+
console.log('Material:', material[0].name);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getMaterialByCasId } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterialByCasId - Test Case METHANE', () => {
|
|
14
|
+
it('should return the material for CAS ID 74828 as METHANE', async () => {
|
|
15
|
+
console.log('Running getMaterialByCasId');
|
|
16
|
+
|
|
17
|
+
// Call the function to get materials by CAS ID
|
|
18
|
+
const material = await getMaterialByCasId(74828);
|
|
19
|
+
|
|
20
|
+
// Check that material is not null
|
|
21
|
+
expect(material).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Check if the material name is METHANE
|
|
24
|
+
const foundMaterialName = material[0].name === 'METHANE';
|
|
25
|
+
expect(foundMaterialName).toBe(true);
|
|
26
|
+
|
|
27
|
+
// Log the material for verification
|
|
28
|
+
console.log('Material:', material[0].name);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getMaterialByCasId } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Disabled this test because it is not possible to get a material by CASID=0.
|
|
13
|
+
|
|
14
|
+
describe.skip('getMaterialByCasId - Disabled Test Case for CAS ID 0', () => {
|
|
15
|
+
/**
|
|
16
|
+
* Test to get the material by CASID=0.
|
|
17
|
+
* This test is intentionally disabled since fetching material by CAS ID 0 is not supported.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
it('should not return a material for CAS ID 0', async () => {
|
|
21
|
+
console.log('Running getMaterialByCasId for CAS ID 0');
|
|
22
|
+
|
|
23
|
+
const material = await getMaterialByCasId(0);
|
|
24
|
+
|
|
25
|
+
// Assert that the material is not null
|
|
26
|
+
expect(material).not.toBeNull();
|
|
27
|
+
|
|
28
|
+
// Log material details for inspection
|
|
29
|
+
console.log('Material:', material);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getMaterialById } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
|
|
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
|
+
// Define the test
|
|
14
|
+
describe('getMaterialById - Test Case for 1,2-PROPYLENE OXIDE', () => {
|
|
15
|
+
it('should return the material for ID 00b93527-dcea-48b6-bc03-a98aae6e630a as 1,2-PROPYLENE OXIDE', async () => {
|
|
16
|
+
console.log('Running getMaterialById');
|
|
17
|
+
|
|
18
|
+
// Call the function to get material by ID
|
|
19
|
+
const material: Material = await getMaterialById('00b93527-dcea-48b6-bc03-a98aae6e630a');
|
|
20
|
+
|
|
21
|
+
// Assert the material is not null
|
|
22
|
+
expect(material).not.toBeNull();
|
|
23
|
+
|
|
24
|
+
// Assert the material name is 1,2-PROPYLENE OXIDE
|
|
25
|
+
expect(material.name).toBe('1,2-PROPYLENE OXIDE');
|
|
26
|
+
|
|
27
|
+
// Log the result
|
|
28
|
+
console.log('Material:', material);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getMaterialById } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterialById - Test Case for CARBON MONOXIDE', () => {
|
|
14
|
+
it('should return the material for ID 12ad526e-de43-4c44-9643-a7250d29ba94 as CARBON MONOXIDE', async () => {
|
|
15
|
+
console.log('Running getMaterialById');
|
|
16
|
+
|
|
17
|
+
// Call the function to get material by ID
|
|
18
|
+
const material = await getMaterialById('12ad526e-de43-4c44-9643-a7250d29ba94');
|
|
19
|
+
|
|
20
|
+
// Assert the material is not null
|
|
21
|
+
expect(material).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Assert the material name is CARBON MONOXIDE
|
|
24
|
+
expect(material.name).toBe('CARBON MONOXIDE');
|
|
25
|
+
|
|
26
|
+
// Log the material for verification
|
|
27
|
+
console.log('Material:', material);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getMaterialById } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterialById - Test Case for METHANE', () => {
|
|
14
|
+
it('should return the material for ID 13fb9798-78d7-41ee-af93-a7e4464dc7c1 as METHANE', async () => {
|
|
15
|
+
console.log('Running getMaterialById');
|
|
16
|
+
|
|
17
|
+
// Call the function to get material by ID
|
|
18
|
+
const material = await getMaterialById('13fb9798-78d7-41ee-af93-a7e4464dc7c1');
|
|
19
|
+
|
|
20
|
+
// Assert the material is not null
|
|
21
|
+
expect(material).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Assert the material name is METHANE
|
|
24
|
+
expect(material.name).toBe('METHANE');
|
|
25
|
+
|
|
26
|
+
// Log the material for verification
|
|
27
|
+
console.log('Material:', material);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getMaterialByName } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterialByName - Test Case for 1,2-PROPYLENE OXIDE', () => {
|
|
14
|
+
it('should return the material named 1,2-PROPYLENE OXIDE', async () => {
|
|
15
|
+
console.log('Running getMaterialByName');
|
|
16
|
+
|
|
17
|
+
// Call the function to get material by name
|
|
18
|
+
const material = await getMaterialByName('1,2-PROPYLENE OXIDE');
|
|
19
|
+
|
|
20
|
+
// Assert the material is not null
|
|
21
|
+
expect(material).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Assert the name matches exactly
|
|
24
|
+
expect(material.name).toBe('1,2-PROPYLENE OXIDE');
|
|
25
|
+
|
|
26
|
+
// Log the result for verification
|
|
27
|
+
console.log('Material:', material);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getMaterialByName } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterialByName - Test Case for CARBON MONOXIDE', () => {
|
|
14
|
+
it('should return the material named CARBON MONOXIDE', async () => {
|
|
15
|
+
console.log('Running getMaterialByName');
|
|
16
|
+
|
|
17
|
+
// Call the function to get material by name
|
|
18
|
+
const material = await getMaterialByName('CARBON MONOXIDE');
|
|
19
|
+
|
|
20
|
+
// Assert the material is not null
|
|
21
|
+
expect(material).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Assert the material name is CARBON MONOXIDE
|
|
24
|
+
expect(material.name).toBe('CARBON MONOXIDE');
|
|
25
|
+
|
|
26
|
+
// Log the material for verification
|
|
27
|
+
console.log('Material:', material);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getMaterialByName } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterialByName - Test Case for METHANE', () => {
|
|
14
|
+
it('should return the material for name METHANE', async () => {
|
|
15
|
+
console.log('Running getMaterialByName');
|
|
16
|
+
|
|
17
|
+
// Call the function to get material by name
|
|
18
|
+
const material = await getMaterialByName('METHANE');
|
|
19
|
+
|
|
20
|
+
// Assert the material is not null
|
|
21
|
+
expect(material).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Assert the material name is METHANE
|
|
24
|
+
expect(material.name).toBe('METHANE');
|
|
25
|
+
|
|
26
|
+
// Log the material for verification
|
|
27
|
+
console.log('Material:', material);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getMaterials } from "../../src/materials";
|
|
2
|
+
import { Material } from "../../src/entities";
|
|
3
|
+
import { setAccessToken } from "../../src/utilities";
|
|
4
|
+
const accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
5
|
+
|
|
6
|
+
if (!accessToken) {
|
|
7
|
+
throw new Error("ACCESS_TOKEN environment variable is not set.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
setAccessToken(accessToken);
|
|
11
|
+
|
|
12
|
+
// Define the test
|
|
13
|
+
describe('getMaterials - Test Case for retrieving all materials', () => {
|
|
14
|
+
it('should return a list of materials', async () => {
|
|
15
|
+
console.log('Running getMaterials');
|
|
16
|
+
|
|
17
|
+
// Call the function to get the list of materials
|
|
18
|
+
const materials = await getMaterials();
|
|
19
|
+
|
|
20
|
+
// Assert materials is not null
|
|
21
|
+
expect(materials).not.toBeNull();
|
|
22
|
+
|
|
23
|
+
// Assert we got at least one material (optional but helpful)
|
|
24
|
+
expect(materials.length).toBeGreaterThan(0);
|
|
25
|
+
|
|
26
|
+
// Log the materials' names
|
|
27
|
+
console.log('Materials:');
|
|
28
|
+
materials.forEach((material: Material) => {
|
|
29
|
+
console.log(material.name);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Material, MaterialComponent, State, Vessel, Substrate, Weather, DischargeParameters, DispersionParameters, DispersionOutputConfig } from "../../src/entities";
|
|
2
|
+
import { VesselStateCalculation, VesselCatastrophicRuptureCalculation } from "../../src/calculations/discharge";
|
|
3
|
+
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
+
import { MaxConcDistanceCalculation } from "../../src/calculations/dispersionView";
|
|
5
|
+
import { ResultCode, SurfaceType, AtmosphericStabilityClass, Resolution, SpecialConcentration, VesselShape, 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 Concentration Distance Calculation - Test Case 106", () => {
|
|
16
|
+
test("should run max concentration distance calculation with regression check", async () => {
|
|
17
|
+
const materialName = "AMMONIA";
|
|
18
|
+
const endPointConcentration = 0.0;
|
|
19
|
+
const elevation = 3.0;
|
|
20
|
+
const resolution = Resolution.LOW;
|
|
21
|
+
const specialConcentration = SpecialConcentration.MIN;
|
|
22
|
+
const lflFraction = 0.8;
|
|
23
|
+
const componentToTrackName = "";
|
|
24
|
+
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
25
|
+
|
|
26
|
+
const material = new Material({
|
|
27
|
+
name: materialName,
|
|
28
|
+
components: [new MaterialComponent({ name: materialName })],
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const state = new State({
|
|
32
|
+
temperature: 265.0,
|
|
33
|
+
pressure: 5.0e5,
|
|
34
|
+
liquidFraction: 0.0,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
38
|
+
const vesselStateResult = await vesselStateCalculation.run();
|
|
39
|
+
|
|
40
|
+
if (vesselStateCalculation.messages.length > 0) {
|
|
41
|
+
console.log("Messages:");
|
|
42
|
+
vesselStateCalculation.messages.forEach((msg) => console.log(msg));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
expect(vesselStateResult).toBe(ResultCode.SUCCESS);
|
|
46
|
+
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
47
|
+
|
|
48
|
+
const vessel = new Vessel({
|
|
49
|
+
state,
|
|
50
|
+
material,
|
|
51
|
+
liquidFillFractionByVolume: 0.8,
|
|
52
|
+
shape: VesselShape.VERTICAL_CYLINDER,
|
|
53
|
+
vesselConditions: vesselStateCalculation.vesselConditions,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const dischargeParameters = new DischargeParameters();
|
|
57
|
+
const vesselCatastrophicRuptureCalculation = new VesselCatastrophicRuptureCalculation(vessel, dischargeParameters);
|
|
58
|
+
|
|
59
|
+
const ruptureResult = await vesselCatastrophicRuptureCalculation.run();
|
|
60
|
+
|
|
61
|
+
if (vesselCatastrophicRuptureCalculation.messages.length > 0) {
|
|
62
|
+
console.log("Messages:");
|
|
63
|
+
vesselCatastrophicRuptureCalculation.messages.forEach((msg) => console.log(msg));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
expect(ruptureResult).toBe(ResultCode.SUCCESS);
|
|
67
|
+
console.log(`SUCCESS: vessel_catastrophic_rupture_calculation (${vesselCatastrophicRuptureCalculation.calculationElapsedTime}ms)`);
|
|
68
|
+
|
|
69
|
+
const substrate = new Substrate();
|
|
70
|
+
const weather = new Weather({windProfileFlag: windProfileFlag});
|
|
71
|
+
const dispersionParameters = new DispersionParameters();
|
|
72
|
+
|
|
73
|
+
const dispersionCalculation = new DispersionCalculation(
|
|
74
|
+
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
75
|
+
substrate,
|
|
76
|
+
vesselCatastrophicRuptureCalculation.dischargeResult!,
|
|
77
|
+
vesselCatastrophicRuptureCalculation.dischargeRecords!,
|
|
78
|
+
vesselCatastrophicRuptureCalculation.dischargeRecords!.length,
|
|
79
|
+
weather,
|
|
80
|
+
dispersionParameters,
|
|
81
|
+
endPointConcentration
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const dispersionResult = await dispersionCalculation.run();
|
|
85
|
+
|
|
86
|
+
if (dispersionCalculation.messages.length > 0) {
|
|
87
|
+
console.log("Messages:");
|
|
88
|
+
dispersionCalculation.messages.forEach((msg) => console.log(msg));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
expect(dispersionResult).toBe(ResultCode.SUCCESS);
|
|
92
|
+
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
93
|
+
console.log(`Length dispersion records = ${dispersionCalculation.dispersionRecords!.length}`);
|
|
94
|
+
console.log(`Minimum concentration = ${dispersionCalculation.scalarUdmOutputs!.minimumConcentration}`);
|
|
95
|
+
console.log(`Observer count = ${dispersionCalculation.scalarUdmOutputs!.observerCount}`);
|
|
96
|
+
const lastDispersionRecord = dispersionCalculation.dispersionRecords!.at(-1)!;
|
|
97
|
+
console.log(`Final centreline concentration = ${lastDispersionRecord.centrelineConcentration}`);
|
|
98
|
+
console.log(`Final downwind distance = ${lastDispersionRecord.downwindDistance}`);
|
|
99
|
+
|
|
100
|
+
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
101
|
+
concentration: endPointConcentration,
|
|
102
|
+
elevation,
|
|
103
|
+
resolution,
|
|
104
|
+
specialConcentration,
|
|
105
|
+
lflFractionValue: lflFraction,
|
|
106
|
+
componentToTrackName,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const maxConcDistanceCalculation = new MaxConcDistanceCalculation(
|
|
110
|
+
dispersionCalculation.scalarUdmOutputs!,
|
|
111
|
+
weather,
|
|
112
|
+
dispersionCalculation.dispersionRecords!,
|
|
113
|
+
dispersionCalculation.dispersionRecords!.length,
|
|
114
|
+
substrate,
|
|
115
|
+
dispersionOutputConfig,
|
|
116
|
+
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
117
|
+
dispersionParameters
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const maxDistanceResult = await maxConcDistanceCalculation.run();
|
|
121
|
+
|
|
122
|
+
if (maxConcDistanceCalculation.messages.length > 0) {
|
|
123
|
+
console.log("Messages:");
|
|
124
|
+
maxConcDistanceCalculation.messages.forEach((msg) => console.log(msg));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
expect(maxDistanceResult).toBe(ResultCode.SUCCESS);
|
|
128
|
+
|
|
129
|
+
const records = maxConcDistanceCalculation.concentrationRecords!;
|
|
130
|
+
expect(records.length).toBe(26);
|
|
131
|
+
|
|
132
|
+
const lastRecord = records.at(-1)!;
|
|
133
|
+
|
|
134
|
+
const expectedConcentration = 0.0012711289961270592;
|
|
135
|
+
const expectedX = 842.991655276627;
|
|
136
|
+
|
|
137
|
+
const concError = Math.abs((lastRecord.concentration! - expectedConcentration) / expectedConcentration);
|
|
138
|
+
const xError = Math.abs((lastRecord.position.x - expectedX) / expectedX);
|
|
139
|
+
|
|
140
|
+
expect(concError).toBeLessThan(1e-3);
|
|
141
|
+
expect(xError).toBeLessThan(1e-3);
|
|
142
|
+
|
|
143
|
+
console.log(`SUCCESS: max_conc_distance_calculation (${maxConcDistanceCalculation.calculationElapsedTime}ms)`);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|