@dnv-plant/typescriptpws 1.0.70 → 1.0.73-alpha.1902063
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
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/index.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnv-plant/typescriptpws",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.73-alpha.1902063",
|
|
4
4
|
"description": "Integrate Phast models with our versatile APIs for enhanced customization and efficiency.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"typescript": "^5.7.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
"@types/jsonwebtoken": "^9.0.8",
|
|
20
|
+
"@types/jest": "^29.5.14",
|
|
21
|
+
"jest": "^29.7.0",
|
|
22
|
+
"ts-jest": "^29.3.0"
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:29
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/constants.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:27
|
|
5
5
|
* Template: templates/typescriptpws/constants.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/entities.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:28
|
|
5
5
|
* Template: templates/typescriptpws/entities.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/entity-schemas.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:28
|
|
5
5
|
* Template: templates/typescriptpws/entityschemas.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/enums.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:27
|
|
5
5
|
* Template: templates/typescriptpws/enums.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/materials.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:27
|
|
5
5
|
* Template: templates/typescriptpws/materials.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -34,12 +34,12 @@ export class MaterialCasIdInfo {
|
|
|
34
34
|
*
|
|
35
35
|
* @param {string} id - A unique identifier of the material.
|
|
36
36
|
* @param {string} name - The name of the material.
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {number} casId - The CAS ID of the material.
|
|
38
38
|
*/
|
|
39
39
|
constructor(
|
|
40
40
|
readonly id: string,
|
|
41
41
|
readonly name: string,
|
|
42
|
-
readonly casId:
|
|
42
|
+
readonly casId: number
|
|
43
43
|
) {}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -75,7 +75,7 @@ export class MaterialCasIdInfoSchema {
|
|
|
75
75
|
this.schema = Joi.object({
|
|
76
76
|
id: Joi.string().guid({ version: "uuidv4" }).required(),
|
|
77
77
|
name: Joi.string().required(),
|
|
78
|
-
casId: Joi.
|
|
78
|
+
casId: Joi.number().required(),
|
|
79
79
|
}).unknown(true);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -85,7 +85,7 @@ export class MaterialCasIdInfoSchema {
|
|
|
85
85
|
* @returns A MaterialCasIdInfo instance.
|
|
86
86
|
* @throws Error if validation fails.
|
|
87
87
|
*/
|
|
88
|
-
makeMaterialInfo(data: { id: string; name: string; casId:
|
|
88
|
+
makeMaterialInfo(data: { id: string; name: string; casId: number }): MaterialCasIdInfo {
|
|
89
89
|
const { error, value } = this.schema.validate(data);
|
|
90
90
|
if (error) {
|
|
91
91
|
throw new Error(`Validation error: ${error.details[0].message}`);
|
|
@@ -100,12 +100,12 @@ export class MaterialEntityDescriptor {
|
|
|
100
100
|
*
|
|
101
101
|
* @param {string} id - A unique identifier of the material.
|
|
102
102
|
* @param {string} name - The name of the material.
|
|
103
|
-
* @param {
|
|
103
|
+
* @param {number} casId - The CAS ID of the material.
|
|
104
104
|
*/
|
|
105
105
|
constructor(
|
|
106
106
|
readonly id: string,
|
|
107
107
|
readonly name: string,
|
|
108
|
-
readonly casId:
|
|
108
|
+
readonly casId: number
|
|
109
109
|
) {}
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -117,7 +117,7 @@ export class MaterialEntityDescriptorSchema {
|
|
|
117
117
|
id: Joi.string().guid({ version: "uuidv4" }).required(),
|
|
118
118
|
displayName: Joi.string().required(),
|
|
119
119
|
extendedProperties: Joi.object({
|
|
120
|
-
casId: Joi.
|
|
120
|
+
casId: Joi.number().required(),
|
|
121
121
|
}).required(),
|
|
122
122
|
}).unknown(true);
|
|
123
123
|
}
|
|
@@ -130,7 +130,7 @@ export class MaterialEntityDescriptorSchema {
|
|
|
130
130
|
makeMaterialInfo(data: {
|
|
131
131
|
id: string;
|
|
132
132
|
displayName: string;
|
|
133
|
-
extendedProperties: { casId:
|
|
133
|
+
extendedProperties: { casId: number };
|
|
134
134
|
}): MaterialEntityDescriptor {
|
|
135
135
|
const { error, value } = this.schema.validate(data);
|
|
136
136
|
if (error) {
|
|
@@ -190,15 +190,15 @@ export async function getAllCasIds(): Promise<MaterialCasIdInfo[]> {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
export async function getMaterialByCasId(casId:
|
|
193
|
+
export async function getMaterialByCasId(casId: number): Promise<Material[]> {
|
|
194
194
|
try {
|
|
195
195
|
// Generate the URL
|
|
196
196
|
const apiTarget = getMaterialsApiTarget();
|
|
197
197
|
const clientAliasId = getClientAliasId();
|
|
198
|
-
const url = `${apiTarget}
|
|
198
|
+
const url = `${apiTarget}cas/${casId}?clientId=${clientAliasId}`;
|
|
199
199
|
|
|
200
200
|
// Fetch and validate the data
|
|
201
|
-
return getDataFromUrl(url, new MaterialSchema()) as Promise<Material>;
|
|
201
|
+
return getDataFromUrl(url, new MaterialSchema(), true) as Promise<Material[]>;
|
|
202
202
|
} catch (error: unknown) {
|
|
203
203
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
204
204
|
throw new Error(`Error retrieving material with CAS ID ${casId}: ${errorMessage}`);
|
|
@@ -262,7 +262,7 @@ export async function getComponentByName(name: string): Promise<MaterialComponen
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
export async function getComponentByCasId(casId:
|
|
265
|
+
export async function getComponentByCasId(casId: number) {
|
|
266
266
|
try {
|
|
267
267
|
// Generate the URL
|
|
268
268
|
const apiTarget = getMaterialsApiTarget();
|
package/src/utilities.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.73
|
|
4
|
+
* Date/time: 09 May 2025 10:28:26
|
|
5
5
|
* Template: templates/typescriptpws/utilities.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {VesselCatastrophicRuptureCalculation, VesselStateCalculation } from "../../src/calculations/discharge";
|
|
2
|
+
import { ConcentrationAtPointCalculation } from "../../src/calculations/dispersionView";
|
|
3
|
+
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
+
import { Bund, DischargeParameters, DispersionOutputConfig, DispersionParameters, Material, MaterialComponent, State, Substrate, Vessel, Weather} from "../../src/entities";
|
|
5
|
+
import { AtmosphericStabilityClass, ResultCode, SurfaceType, 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('Test Case 116', () => {
|
|
16
|
+
test('Concentration at point calculation for ETHANE, BUTANE, and PROPANE', async () => {
|
|
17
|
+
|
|
18
|
+
// Define the material and its components
|
|
19
|
+
const material = new Material({
|
|
20
|
+
name: "ETHANE_BUTANE_PROPANE",
|
|
21
|
+
components: [
|
|
22
|
+
new MaterialComponent({ name: "ETHANE", moleFraction: 0.5 }),
|
|
23
|
+
new MaterialComponent({ name: "N-BUTANE", moleFraction: 0.3 }),
|
|
24
|
+
new MaterialComponent({ name: "PROPANE", moleFraction: 0.2 })
|
|
25
|
+
],
|
|
26
|
+
componentCount: 3
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Define the state of the vessel
|
|
30
|
+
const state = new State({
|
|
31
|
+
temperature: 265.0,
|
|
32
|
+
pressure: 5.0e5,
|
|
33
|
+
liquidFraction: 0.8
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Define the surface type and related parameters
|
|
37
|
+
const surfaceType = SurfaceType.LAND;
|
|
38
|
+
const surfaceRoughness = 0.2;
|
|
39
|
+
const windSpeed = 5.0;
|
|
40
|
+
const stabilityClass = AtmosphericStabilityClass.STABILITY_A_;
|
|
41
|
+
const endPointConcentration = 0.0;
|
|
42
|
+
const specifyBund = true;
|
|
43
|
+
const bundHeight = 1.0;
|
|
44
|
+
const bundDiameter = 8.0;
|
|
45
|
+
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
46
|
+
|
|
47
|
+
// Create a vessel state calculation using the material and state
|
|
48
|
+
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
49
|
+
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
50
|
+
|
|
51
|
+
// Check the result of vessel state calculation
|
|
52
|
+
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
53
|
+
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
54
|
+
console.log(`VesselConditions = ${vesselStateCalculation.vesselConditions}`);
|
|
55
|
+
|
|
56
|
+
// Create a vessel for the catastrophic rupture calculation
|
|
57
|
+
const vessel = new Vessel({
|
|
58
|
+
state: vesselStateCalculation.outputState!,
|
|
59
|
+
material: vesselStateCalculation.material,
|
|
60
|
+
liquidFillFractionByVolume: 0.8,
|
|
61
|
+
shape: VesselShape.VERTICAL_CYLINDER,
|
|
62
|
+
vesselConditions: vesselStateCalculation.vesselConditions
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const dischargeParameters = new DischargeParameters();
|
|
66
|
+
const vesselCatastrophicRuptureCalculation = new VesselCatastrophicRuptureCalculation(vessel, dischargeParameters);
|
|
67
|
+
const ruptureResultCode = await vesselCatastrophicRuptureCalculation.run();
|
|
68
|
+
|
|
69
|
+
// Check the result of vessel catastrophic rupture calculation
|
|
70
|
+
expect(ruptureResultCode).toBe(ResultCode.SUCCESS);
|
|
71
|
+
console.log(`SUCCESS: vessel_catastrophic_rupture_calculation (${vesselCatastrophicRuptureCalculation.calculationElapsedTime}ms)`);
|
|
72
|
+
console.log(`Length of discharge records = ${vesselCatastrophicRuptureCalculation.dischargeRecords!.length}`);
|
|
73
|
+
console.log(`Mass released = ${vesselCatastrophicRuptureCalculation.dischargeResult!.releaseMass}`);
|
|
74
|
+
console.log(`End of discharge = ${vesselCatastrophicRuptureCalculation.dischargeRecords![vesselCatastrophicRuptureCalculation.dischargeRecords!.length - 1].time}`);
|
|
75
|
+
|
|
76
|
+
// Set up entities for the dispersion calculation
|
|
77
|
+
const bund = new Bund({
|
|
78
|
+
specifyBund: specifyBund,
|
|
79
|
+
bundHeight: bundHeight,
|
|
80
|
+
bundDiameter: bundDiameter
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const substrate = new Substrate({
|
|
84
|
+
bund: bund,
|
|
85
|
+
surfaceType: surfaceType,
|
|
86
|
+
surfaceRoughness: surfaceRoughness
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const weather = new Weather({
|
|
90
|
+
windSpeed: windSpeed,
|
|
91
|
+
stabilityClass: stabilityClass,
|
|
92
|
+
windProfileFlag: windProfileFlag
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const dispersionParameters = new DispersionParameters();
|
|
96
|
+
const dispersionCalculation = new DispersionCalculation(
|
|
97
|
+
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
98
|
+
substrate,
|
|
99
|
+
vesselCatastrophicRuptureCalculation.dischargeResult!,
|
|
100
|
+
vesselCatastrophicRuptureCalculation.dischargeRecords!,
|
|
101
|
+
vesselCatastrophicRuptureCalculation.dischargeRecords!.length,
|
|
102
|
+
weather,
|
|
103
|
+
dispersionParameters,
|
|
104
|
+
endPointConcentration
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const dispersionResultCode = await dispersionCalculation.run();
|
|
108
|
+
|
|
109
|
+
// Check the result of the dispersion calculation
|
|
110
|
+
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
111
|
+
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
112
|
+
console.log(`Length of dispersion records = ${dispersionCalculation.dispersionRecords!.length}`);
|
|
113
|
+
console.log(`Minimum concentration = ${dispersionCalculation.scalarUdmOutputs!.minimumConcentration}`);
|
|
114
|
+
console.log(`Observer count = ${dispersionCalculation.scalarUdmOutputs!.observerCount}`);
|
|
115
|
+
console.log(`Final centreline concentration = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].centrelineConcentration}`);
|
|
116
|
+
console.log(`Final downwind distance = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].downwindDistance}`);
|
|
117
|
+
|
|
118
|
+
// Set up the entities for concentration at point calculation
|
|
119
|
+
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
120
|
+
concentration: endPointConcentration,
|
|
121
|
+
downwindDistance: 10,
|
|
122
|
+
elevation: 1,
|
|
123
|
+
time: 2
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const concentrationAtPointCalculation = new ConcentrationAtPointCalculation(
|
|
127
|
+
dispersionCalculation.scalarUdmOutputs!,
|
|
128
|
+
weather,
|
|
129
|
+
dispersionCalculation.dispersionRecords!,
|
|
130
|
+
dispersionCalculation.dispersionRecords!.length,
|
|
131
|
+
substrate,
|
|
132
|
+
dispersionOutputConfig,
|
|
133
|
+
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
134
|
+
dispersionParameters
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const concentrationResultCode = await concentrationAtPointCalculation.run();
|
|
138
|
+
|
|
139
|
+
// Check the result of concentration at point calculation
|
|
140
|
+
expect(concentrationResultCode).toBe(ResultCode.SUCCESS);
|
|
141
|
+
|
|
142
|
+
const expectedConcentration = 0.01953923028190563;
|
|
143
|
+
expect(Math.abs(concentrationAtPointCalculation.concentration! - expectedConcentration) / expectedConcentration).toBeLessThan(1e-3);
|
|
144
|
+
console.log(`SUCCESS: concentration_at_point_calculation (${concentrationAtPointCalculation.calculationElapsedTime}ms)`);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { VesselCatastrophicRuptureCalculation, VesselStateCalculation } from "../../src/calculations/discharge";
|
|
2
|
+
import { ConcentrationAtPointCalculation } from "../../src/calculations/dispersionView";
|
|
3
|
+
import { DispersionCalculation } from "../../src/calculations/dispersion";
|
|
4
|
+
import { Bund, DischargeParameters, DispersionOutputConfig, DispersionParameters, Material, MaterialComponent, State, Substrate, Vessel, Weather } from "../../src/entities";
|
|
5
|
+
import { AtmosphericStabilityClass, ResultCode, SurfaceType, 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('Test Case 117', () => {
|
|
16
|
+
test('Concentration at point calculation for HEXANE', async () => {
|
|
17
|
+
|
|
18
|
+
// Define the material and its components
|
|
19
|
+
const material = new Material({
|
|
20
|
+
name: "HEXANE",
|
|
21
|
+
components: [new MaterialComponent({ name: "N-HEXANE", moleFraction: 1.0 })],
|
|
22
|
+
componentCount: 1
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Define the state of the vessel
|
|
26
|
+
const state = new State({
|
|
27
|
+
temperature: 280.0,
|
|
28
|
+
pressure: 2.0e5,
|
|
29
|
+
liquidFraction: 0.8
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Define the surface type and related parameters
|
|
33
|
+
const surfaceType = SurfaceType.WATER;
|
|
34
|
+
const surfaceRoughness = 0.05;
|
|
35
|
+
const windSpeed = 2.0;
|
|
36
|
+
const stabilityClass = AtmosphericStabilityClass.STABILITY_F;
|
|
37
|
+
const endPointConcentration = 0.0;
|
|
38
|
+
const specifyBund = true;
|
|
39
|
+
const bundHeight = 1.0;
|
|
40
|
+
const bundDiameter = 8.0;
|
|
41
|
+
const windProfileFlag = WindProfileFlag.LOGARITHMIC_PROFILE;
|
|
42
|
+
|
|
43
|
+
// Create a vessel state calculation using the material and state
|
|
44
|
+
const vesselStateCalculation = new VesselStateCalculation(material, state);
|
|
45
|
+
const vesselStateResultCode = await vesselStateCalculation.run();
|
|
46
|
+
|
|
47
|
+
// Check the result of vessel state calculation
|
|
48
|
+
expect(vesselStateResultCode).toBe(ResultCode.SUCCESS);
|
|
49
|
+
console.log(`SUCCESS: vessel_state_calculation (${vesselStateCalculation.calculationElapsedTime}ms)`);
|
|
50
|
+
console.log(`VesselConditions = ${vesselStateCalculation.vesselConditions}`);
|
|
51
|
+
|
|
52
|
+
// Create a vessel for the catastrophic rupture calculation
|
|
53
|
+
const vessel = new Vessel({
|
|
54
|
+
state: vesselStateCalculation.outputState!,
|
|
55
|
+
material: vesselStateCalculation.material,
|
|
56
|
+
liquidFillFractionByVolume: 0.8,
|
|
57
|
+
shape: VesselShape.VERTICAL_CYLINDER,
|
|
58
|
+
vesselConditions: vesselStateCalculation.vesselConditions
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const dischargeParameters = new DischargeParameters();
|
|
62
|
+
const vesselCatastrophicRuptureCalculation = new VesselCatastrophicRuptureCalculation(vessel, dischargeParameters);
|
|
63
|
+
const ruptureResultCode = await vesselCatastrophicRuptureCalculation.run();
|
|
64
|
+
|
|
65
|
+
// Check the result of vessel catastrophic rupture calculation
|
|
66
|
+
expect(ruptureResultCode).toBe(ResultCode.SUCCESS);
|
|
67
|
+
console.log(`SUCCESS: vessel_catastrophic_rupture_calculation (${vesselCatastrophicRuptureCalculation.calculationElapsedTime}ms)`);
|
|
68
|
+
console.log(`Length of discharge records = ${vesselCatastrophicRuptureCalculation.dischargeRecords!.length}`);
|
|
69
|
+
console.log(`Mass released = ${vesselCatastrophicRuptureCalculation.dischargeResult!.releaseMass}`);
|
|
70
|
+
console.log(`End of discharge = ${vesselCatastrophicRuptureCalculation.dischargeRecords![vesselCatastrophicRuptureCalculation.dischargeRecords!.length - 1].time}`);
|
|
71
|
+
|
|
72
|
+
// Set up entities for the dispersion calculation
|
|
73
|
+
const bund = new Bund({
|
|
74
|
+
specifyBund: specifyBund,
|
|
75
|
+
bundHeight: bundHeight,
|
|
76
|
+
bundDiameter: bundDiameter
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const substrate = new Substrate({
|
|
80
|
+
bund: bund,
|
|
81
|
+
surfaceType: surfaceType,
|
|
82
|
+
surfaceRoughness: surfaceRoughness
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const weather = new Weather({
|
|
86
|
+
windSpeed: windSpeed,
|
|
87
|
+
stabilityClass: stabilityClass,
|
|
88
|
+
windProfileFlag: windProfileFlag
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const dispersionParameters = new DispersionParameters();
|
|
92
|
+
const dispersionCalculation = new DispersionCalculation(
|
|
93
|
+
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
94
|
+
substrate,
|
|
95
|
+
vesselCatastrophicRuptureCalculation.dischargeResult!,
|
|
96
|
+
vesselCatastrophicRuptureCalculation.dischargeRecords!,
|
|
97
|
+
vesselCatastrophicRuptureCalculation.dischargeRecords!.length,
|
|
98
|
+
weather,
|
|
99
|
+
dispersionParameters,
|
|
100
|
+
endPointConcentration
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const dispersionResultCode = await dispersionCalculation.run();
|
|
104
|
+
|
|
105
|
+
// Check the result of the dispersion calculation
|
|
106
|
+
expect(dispersionResultCode).toBe(ResultCode.SUCCESS);
|
|
107
|
+
console.log(`SUCCESS: dispersion_calculation (${dispersionCalculation.calculationElapsedTime}ms)`);
|
|
108
|
+
console.log(`Length of dispersion records = ${dispersionCalculation.dispersionRecords!.length}`);
|
|
109
|
+
console.log(`Minimum concentration = ${dispersionCalculation.scalarUdmOutputs!.minimumConcentration}`);
|
|
110
|
+
console.log(`Observer count = ${dispersionCalculation.scalarUdmOutputs!.observerCount}`);
|
|
111
|
+
console.log(`Final centreline concentration = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].centrelineConcentration}`);
|
|
112
|
+
console.log(`Final downwind distance = ${dispersionCalculation.dispersionRecords![dispersionCalculation.dispersionRecords!.length - 1].downwindDistance}`);
|
|
113
|
+
|
|
114
|
+
// Set up the entities for concentration at point calculation
|
|
115
|
+
const dispersionOutputConfig = new DispersionOutputConfig({
|
|
116
|
+
concentration: endPointConcentration,
|
|
117
|
+
downwindDistance: 0,
|
|
118
|
+
elevation: 1,
|
|
119
|
+
time: 0.1
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const concentrationAtPointCalculation = new ConcentrationAtPointCalculation(
|
|
123
|
+
dispersionCalculation.scalarUdmOutputs!,
|
|
124
|
+
weather,
|
|
125
|
+
dispersionCalculation.dispersionRecords!,
|
|
126
|
+
dispersionCalculation.dispersionRecords!.length,
|
|
127
|
+
substrate,
|
|
128
|
+
dispersionOutputConfig,
|
|
129
|
+
vesselCatastrophicRuptureCalculation.exitMaterial!,
|
|
130
|
+
dispersionParameters
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const concentrationResultCode = await concentrationAtPointCalculation.run();
|
|
134
|
+
|
|
135
|
+
// Check the result of concentration at point calculation
|
|
136
|
+
expect(concentrationResultCode).toBe(ResultCode.SUCCESS);
|
|
137
|
+
|
|
138
|
+
const expectedConcentration = 0.7320545904622022;
|
|
139
|
+
expect(Math.abs(concentrationAtPointCalculation.concentration! - expectedConcentration) / expectedConcentration).toBeLessThan(1e-3);
|
|
140
|
+
console.log(`SUCCESS: concentration_at_point_calculation (${concentrationAtPointCalculation.calculationElapsedTime}ms)`);
|
|
141
|
+
});
|
|
142
|
+
});
|