Skip to content

Commit 453c574

Browse files
committed
wip calibration dilution
1 parent ba5ae24 commit 453c574

File tree

5 files changed

+80
-29
lines changed

5 files changed

+80
-29
lines changed

src/components/CalibrationInlet.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,8 @@ import { OrificeSelector } from "./OrificeSelector";
2929
import { PressureSlider } from "./PressureSlider";
3030
import { ConcentrationSelector } from "./ConcentrationSelector";
3131
import { Cd } from "@/config/site";
32-
import { logSonicNozzleFlowCalculation } from "@/utilities";
33-
34-
export type FlowData = {
35-
massFlow: number; // kg/s
36-
p_crit: number; // kPa
37-
A: number; // area of the orifice in m²
38-
properties: PropertiesGERGResult; // Gas properties
39-
molarMass: number; // g/mol
40-
Rs: number; // J/(kg·K)
41-
rho: number; // kg/m³
42-
rho_out: number; // kg/m³
43-
};
32+
import { FlowData, logSonicNozzleFlowCalculation } from "@/utilities";
33+
4434
interface CalibrationInletProps {
4535
label: string;
4636
pressure: number;

src/components/GasInlet.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,9 @@ import { useEffect } from "react";
2828
import { GasSelector } from "./GasSelector";
2929
import { OrificeSelector } from "./OrificeSelector";
3030
import { PressureSlider } from "./PressureSlider";
31-
import { logSonicNozzleFlowCalculation } from "@/utilities";
31+
import { FlowData, logSonicNozzleFlowCalculation } from "@/utilities";
3232
import { Cd } from "@/config/site";
3333

34-
export type FlowData = {
35-
massFlow: number; // kg/s
36-
p_crit: number; // kPa
37-
A: number; // area of the orifice in m²
38-
properties: PropertiesGERGResult; // Gas properties
39-
molarMass: number; // g/mol
40-
Rs: number; // J/(kg·K)
41-
rho: number; // kg/m³
42-
rho_out: number; // kg/m³
43-
};
4434
interface GasInletProps {
4535
label: string;
4636
pressure: number;

src/pages/calibrationgas.tsx

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ import { Button } from "@heroui/button";
2727

2828
import { title } from "@/components/primitives";
2929
import DefaultLayout from "@/layouts/default";
30-
import { FlowData, GasInlet } from "@/components/GasInlet";
30+
import { GasInlet } from "@/components/GasInlet";
3131
import { CalibrationInlet } from "@/components/CalibrationInlet";
3232
import { SonicNozzleTable } from "@/components/SonicNozzleTable";
33+
import { FlowData } from "@/utilities";
34+
import { Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from "@heroui/table";
35+
import { ScientificNotation } from "@sctg/scientific-notation";
3336

3437
export default function CalibrationGasPage() {
3538
const [temperature, setTemperature] = useState<number>(293.15);
@@ -173,6 +176,64 @@ export default function CalibrationGasPage() {
173176
/>
174177
)}
175178
</div>
179+
<Table removeWrapper aria-label="Flow Results" className="mt-4">
180+
<TableHeader>
181+
<TableColumn>Parameter</TableColumn>
182+
<TableColumn>Value</TableColumn>
183+
<TableColumn>Unit</TableColumn>
184+
</TableHeader>
185+
<TableBody>
186+
<TableRow key="flow1">
187+
<TableCell>Flow 1 Mass Flow</TableCell>
188+
<TableCell>
189+
<span
190+
dangerouslySetInnerHTML={{
191+
__html: ScientificNotation.toScientificNotationHTML(
192+
inlet1FlowData.massFlow,
193+
5,
194+
),
195+
}}
196+
/>
197+
</TableCell>
198+
<TableCell>kg/s</TableCell>
199+
</TableRow>
200+
<TableRow key="flow2">
201+
<TableCell>Flow 2 Mass Flow</TableCell>
202+
<TableCell>
203+
<span
204+
dangerouslySetInnerHTML={{
205+
__html: ScientificNotation.toScientificNotationHTML(
206+
inlet2FlowData.massFlow,
207+
5,
208+
),
209+
}}
210+
/>
211+
</TableCell>
212+
<TableCell>kg/s</TableCell>
213+
</TableRow>
214+
<TableRow key="concentration">
215+
<TableCell>Concentration of Gas 2 in total flow</TableCell>
216+
<TableCell>
217+
{(
218+
(inlet2FlowData.massFlow /
219+
(inlet1FlowData.massFlow + inlet2FlowData.massFlow)) *
220+
100
221+
).toPrecision(5)}
222+
</TableCell>
223+
<TableCell>%</TableCell>
224+
</TableRow>
225+
<TableRow key="criticalPressure">
226+
<TableCell>Flow Critical Pressure</TableCell>
227+
<TableCell>
228+
{Math.min(
229+
inlet1FlowData.p_crit,
230+
inlet2FlowData.p_crit,
231+
).toPrecision(5)}
232+
</TableCell>
233+
<TableCell>kPa</TableCell>
234+
</TableRow>
235+
</TableBody>
236+
</Table>
176237
</section>
177238
</DefaultLayout>
178239
);

src/pages/dilution.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ import {
3333
import { useState } from "react";
3434
import { ScientificNotation } from "@sctg/scientific-notation";
3535

36-
import { FlowData, GasInlet } from "@/components/GasInlet";
36+
import { GasInlet } from "@/components/GasInlet";
3737
import { title } from "@/components/primitives";
3838
import { SonicNozzleTable } from "@/components/SonicNozzleTable";
3939
import DefaultLayout from "@/layouts/default";
40+
import { FlowData } from "@/utilities";
4041

4142
export default function DilutionPage() {
4243
const [selectedGasInlet1, setSelectedGasInlet1] = useState<GasMixtureExt>(

src/utilities/index.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import { type FlowData } from "@/components/GasInlet";
21
import { Cd, Cd_max, Cd_min } from "@/config/site";
3-
import { type GasMixtureExt } from "@sctg/aga8-js";
2+
import { PropertiesGERGResult, type GasMixtureExt } from "@sctg/aga8-js";
43

5-
export
6-
function logSonicNozzleFlowCalculation(
4+
export type FlowData = {
5+
massFlow: number; // kg/s
6+
p_crit: number; // kPa
7+
A: number; // area of the orifice in m²
8+
properties: PropertiesGERGResult; // Gas properties
9+
molarMass: number; // g/mol
10+
Rs: number; // J/(kg·K)
11+
rho: number; // kg/m³
12+
rho_out: number; // kg/m³
13+
};
14+
15+
export function logSonicNozzleFlowCalculation(
716
gas: GasMixtureExt,
817
temperature: number,
918
pressure: number,

0 commit comments

Comments
 (0)