diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-03-01 20:30:23 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-03-01 20:30:23 -0500 |
| commit | f03653774e4529404546f474064c5bf679fa7176 (patch) | |
| tree | b881365d1b43d9a16fae1530bef98acab52d55bb /engine.c | |
| parent | f7970f9b769369220ed3c607a27081b8ea93e409 (diff) | |
| download | volute-f03653774e4529404546f474064c5bf679fa7176.zip | |
add compressor outlet temperature output
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); |