aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-03-01 21:03:11 -0500
committerSam Anthony <sam@samanthony.xyz>2025-03-01 21:03:11 -0500
commit7a3532a160824909863977066193559261efb500 (patch)
tree09d809e23d6c0828d9ab35f653c0282acfe34940
parentf03653774e4529404546f474064c5bf679fa7176 (diff)
downloadvolute-7a3532a160824909863977066193559261efb500.zip
manifold temperature
-rw-r--r--engine.c56
-rw-r--r--engine.h3
2 files changed, 50 insertions, 9 deletions
diff --git a/engine.c b/engine.c
index b4db059..f5d8917 100644
--- a/engine.c
+++ b/engine.c
@@ -18,11 +18,20 @@ static const double C_V_AIR = 718.0;
static const double GAMMA_AIR = C_P_AIR / C_V_AIR;
+static VolumeFlowRate port_volume_flow_rate(const Engine *e);
+static double density_ratio(const Engine *e);
+
+
void
init_engine(Engine *e) {
memset(e, 0, sizeof(*e));
}
+Pressure
+comp_outlet_pressure(const Engine *e) {
+ return e->map + e->intercooler_deltap;
+}
+
/* Pressure ratio across the compressor. */
double
pressure_ratio(const Engine *e) {
@@ -33,11 +42,6 @@ pressure_ratio(const Engine *e) {
return p2 / p1;
}
-Pressure
-comp_outlet_pressure(const Engine *e) {
- return e->map + e->intercooler_deltap;
-}
-
Temperature
comp_outlet_temperature(const Engine *e) {
Temperature t1;
@@ -49,10 +53,46 @@ comp_outlet_temperature(const Engine *e) {
return t1 * pow(p2/p1, (GAMMA_AIR-1.0)/GAMMA_AIR);
}
+Temperature
+manifold_temperature(const Engine *e) {
+ Temperature t1, t2;
+
+ t1 = e->ambient_temperature;
+ t2 = comp_outlet_temperature(e);
+ return t2 - (t2 - t1)*e->intercooler_efficiency;
+}
+
+/* Volume flow rate throught the compressor inlet. */
VolumeFlowRate
volume_flow_rate(const Engine *e) {
- double n = as_rpm(e->rpm);
- double d = as_cubic_metre(e->displacement);
- double ve = e->ve;
+ VolumeFlowRate v3;
+ double r;
+
+ v3 = port_volume_flow_rate(e);
+ r = density_ratio(e);
+ return v3 * r;
+}
+
+/* Volume flow rate through the intake ports. */
+static VolumeFlowRate
+port_volume_flow_rate(const Engine *e) {
+ double n, d, ve;
+
+ n = as_rpm(e->rpm);
+ d = as_cubic_metre(e->displacement);
+ ve = e->ve;
return cubic_metre_per_min(n * d * ve / REV_PER_CYCLE);
}
+
+/* Density ratio between the ports and the compressor inlet. */
+static double
+density_ratio(const Engine *e) {
+ Pressure p1, p3;
+ Temperature t1, t3;
+
+ p1 = e->ambient_pressure;
+ p3 = e->map;
+ t1 = e->ambient_temperature;
+ t3 = manifold_temperature(e);
+ return (p1 * t3) / (p3 * t1);
+}
diff --git a/engine.h b/engine.h
index 4e5c5af..f27220c 100644
--- a/engine.h
+++ b/engine.h
@@ -12,6 +12,7 @@ typedef struct {
void init_engine(Engine *e);
Pressure comp_outlet_pressure(const Engine *e);
-Temperature comp_outlet_temperature(const Engine *e);
double pressure_ratio(const Engine *e);
+Temperature comp_outlet_temperature(const Engine *e);
+Temperature manifold_temperature(const Engine *e);
VolumeFlowRate volume_flow_rate(const Engine *e);