diff options
| -rw-r--r-- | engine.c | 13 | ||||
| -rw-r--r-- | engine.h | 1 | ||||
| -rw-r--r-- | test.c | 1 | ||||
| -rw-r--r-- | test.h | 1 | ||||
| -rw-r--r-- | test_engine.c | 19 | ||||
| -rw-r--r-- | unit.h | 4 |
6 files changed, 39 insertions, 0 deletions
@@ -116,3 +116,16 @@ mass_flow_rate(const Engine *e) { t = e->ambient_temperature; return (p * v) / (R_AIR * t); } + +/* Mass flow rate through the engine (corrected to standard conditions). */ +MassFlowRate +mass_flow_rate_corrected(const Engine *e) { + Pressure p; + Temperature t; + VolumeFlowRate v; + + p = STANDARD_PRESSURE; + t = STANDARD_TEMPERATURE; + v = volume_flow_rate(e); + return (p * v) / (R_AIR * t); +} @@ -17,3 +17,4 @@ 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); +MassFlowRate mass_flow_rate_corrected(const Engine *e); @@ -63,4 +63,5 @@ main(void) { test_manifold_temperature(); test_volume_flow_rate(); test_mass_flow_rate(); + test_mass_flow_rate_corrected(); } @@ -69,3 +69,4 @@ void test_comp_outlet_temperature(void); void test_manifold_temperature(void); void test_volume_flow_rate(void); void test_mass_flow_rate(void); +void test_mass_flow_rate_corrected(void); diff --git a/test_engine.c b/test_engine.c index 4acfa17..2ac6e6e 100644 --- a/test_engine.c +++ b/test_engine.c @@ -105,3 +105,22 @@ test_mass_flow_rate(void) { }; test(mass_flow_rate(&e), kilo_per_sec(0.2214056)); } + +void +test_mass_flow_rate_corrected(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_corrected(&e), kilo_per_sec(0.2216067)); +} @@ -1,3 +1,7 @@ +#define STANDARD_PRESSURE millibar(1013) +#define STANDARD_TEMPERATURE celsius(20) + + typedef double AngularSpeed; typedef AngularSpeed (*AngularSpeedMaker)(double); typedef double (*AngularSpeedReader)(AngularSpeed); |