diff options
Diffstat (limited to 'engine.c')
| -rw-r--r-- | engine.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,4 @@ +#include <math.h> #include <string.h> #include "unit.h" @@ -5,7 +6,16 @@ /* A four-stroke piston engine takes two revolutions per cycle. */ -#define REV_PER_CYCLE 2.0 +static const double REV_PER_CYCLE = 2.0; + +/* Specific heat of dry air at constant pressure at T=300K [J/(kg*K)]. */ +static const double C_P_AIR = 1005.0; + +/* Specific heat of dry air at constant volume at T=300K [J/(kg*K)]. */ +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; void @@ -28,6 +38,17 @@ comp_outlet_pressure(const Engine *e) { return e->map + e->intercooler_deltap; } +Temperature +comp_outlet_temperature(const Engine *e) { + Temperature t1; + Pressure p1, p2; + + t1 = e->ambient_temperature; + p1 = e->ambient_pressure; + p2 = comp_outlet_pressure(e); + return t1 * pow(p2/p1, (GAMMA_AIR-1.0)/GAMMA_AIR); +} + VolumeFlowRate volume_flow_rate(const Engine *e) { double n = as_rpm(e->rpm); |