From 9e6a82e0bfe9cf0a884dc110293f497aa21bdb6d Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sun, 2 Mar 2025 14:24:56 -0500 Subject: calculate mass flow rate at ambient conditions --- engine.c | 16 ++++++++++++++++ engine.h | 1 + test.c | 1 + test.h | 1 + test_engine.c | 23 +++++++++++++++++++++-- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/engine.c b/engine.c index ad1932e..d0a1b38 100644 --- a/engine.c +++ b/engine.c @@ -17,6 +17,9 @@ static const double C_V_AIR = 718.0; /* Heat capacity ratio of dry air at T=300K [J/(kg*K)]. */ static const double GAMMA_AIR = C_P_AIR / C_V_AIR; +/* Gas constant of air [J/(kg*K)]. */ +static const double R_AIR = 287.05; + static VolumeFlowRate port_volume_flow_rate(const Engine *e); static double density_ratio(const Engine *e); @@ -100,3 +103,16 @@ density_ratio(const Engine *e) { t3 = manifold_temperature(e); return (p3 * t1) / (p1 * t3); } + +/* Mass flow rate through the engine (corrected to ambient conditions). */ +MassFlowRate +mass_flow_rate(const Engine *e) { + Pressure p; + VolumeFlowRate v; + Temperature t; + + p = e->ambient_pressure; + v = volume_flow_rate(e); + t = e->ambient_temperature; + return (p * v) / (R_AIR * t); +} diff --git a/engine.h b/engine.h index f27220c..92b8b68 100644 --- a/engine.h +++ b/engine.h @@ -16,3 +16,4 @@ double pressure_ratio(const Engine *e); Temperature comp_outlet_temperature(const Engine *e); Temperature manifold_temperature(const Engine *e); VolumeFlowRate volume_flow_rate(const Engine *e); +MassFlowRate mass_flow_rate(const Engine *e); diff --git a/test.c b/test.c index 592092b..460c320 100644 --- a/test.c +++ b/test.c @@ -62,4 +62,5 @@ main(void) { test_comp_outlet_temperature(); test_manifold_temperature(); test_volume_flow_rate(); + test_mass_flow_rate(); } diff --git a/test.h b/test.h index fc1865c..9e127f6 100644 --- a/test.h +++ b/test.h @@ -68,3 +68,4 @@ void test_comp_outlet_temperature_adiabatic(void); void test_comp_outlet_temperature(void); void test_manifold_temperature(void); void test_volume_flow_rate(void); +void test_mass_flow_rate(void); diff --git a/test_engine.c b/test_engine.c index 76e58fa..4acfa17 100644 --- a/test_engine.c +++ b/test_engine.c @@ -72,7 +72,7 @@ void test_volume_flow_rate(void) { Pressure p_ambient, p_boost, map; - p_ambient = millibar(982.052713333343); + p_ambient = inch_mercury(30); p_boost = psi(10); map = p_ambient + p_boost; Engine e = { @@ -84,5 +84,24 @@ test_volume_flow_rate(void) { .ve = percent(80), .comp_efficiency = percent(65), }; - test(volume_flow_rate(&e), cubic_metre_per_sec(0.1855992)); + test(volume_flow_rate(&e), cubic_metre_per_sec(0.184086)); +} + +void +test_mass_flow_rate(void) { + Pressure p_ambient, p_boost, map; + + p_ambient = inch_mercury(30); + p_boost = psi(10); + map = p_ambient + p_boost; + Engine e = { + .displacement = cubic_inch(250), + .rpm = rpm(5000), + .map = map, + .ambient_temperature = fahrenheit(70), + .ambient_pressure = p_ambient, + .ve = percent(80), + .comp_efficiency = percent(65), + }; + test(mass_flow_rate(&e), kilo_per_sec(0.2214056)); } -- cgit v1.2.3