diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-02-28 18:25:43 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-02-28 18:25:43 -0500 |
| commit | ac9ed5d8a5af3cad2f8c70f0bc217ccf97198e5c (patch) | |
| tree | 28fe5d726438522e5af3026c472dedbd7296b7ce /engine.c | |
| parent | bc1d5a436f81561072d7f4f0f0ecb1fa85718c7f (diff) | |
| download | volute-ac9ed5d8a5af3cad2f8c70f0bc217ccf97198e5c.zip | |
engine volume flow rate
Diffstat (limited to 'engine.c')
| -rw-r--r-- | engine.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -3,7 +3,20 @@ #include "unit.h" #include "engine.h" + +/* A four-stroke piston engine takes two revolutions per cycle. */ +#define REV_PER_CYCLE 2.0 + + void init_engine(Engine *e) { memset(e, 0, sizeof(*e)); } + +VolumeFlowRate +volume_flow_rate(const Engine *e) { + double n = as_rpm(e->rpm); + double d = as_cubic_metre(e->displacement); + double ve = e->ve; + return cubic_metre_per_min(n * d * ve / REV_PER_CYCLE); +} |