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 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'engine.c') 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); +} -- cgit v1.2.3