aboutsummaryrefslogtreecommitdiffstats
path: root/test_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'test_engine.c')
-rw-r--r--test_engine.c82
1 files changed, 81 insertions, 1 deletions
diff --git a/test_engine.c b/test_engine.c
index 12f0c21..76e58fa 100644
--- a/test_engine.c
+++ b/test_engine.c
@@ -5,4 +5,84 @@
#include "unit.h"
#include "engine.h"
-/* TODO */
+void
+test_comp_outlet_pressure(void) {
+ Engine e;
+ init_engine(&e);
+ e.map = millibar(2000);
+ e.intercooler_deltap = psi(0.4);
+ test(comp_outlet_pressure(&e), millibar(2027.579029173));
+}
+
+void
+test_pressure_ratio(void) {
+ Engine e = {
+ .ambient_pressure = psi(14.3),
+ .map = psi(14.3+18),
+ };
+ test(pressure_ratio(&e), 2.2587413);
+
+}
+void
+test_pressure_ratio_intercooled(void) {
+ Engine e = {
+ .ambient_pressure = psi(14.3),
+ .map = psi(14.3+18),
+ .intercooler_deltap = psi(0.4),
+ };
+ test(pressure_ratio(&e), 2.2867133);
+}
+
+void
+test_comp_outlet_temperature_adiabatic(void) {
+ Engine e = {
+ .ambient_temperature = fahrenheit(70),
+ .ambient_pressure = psi(14.7),
+ .map = psi(31.7),
+ .comp_efficiency = percent(100),
+ };
+ test(comp_outlet_temperature(&e), kelvin(366.4715514));
+}
+
+void
+test_comp_outlet_temperature(void) {
+ Engine e = {
+ .ambient_temperature = fahrenheit(70),
+ .ambient_pressure = psi(14.7),
+ .map = psi(31.7),
+ .comp_efficiency = percent(70),
+ };
+ test(comp_outlet_temperature(&e), kelvin(397.418883));
+}
+
+void
+test_manifold_temperature(void) {
+ Engine e = {
+ .ambient_temperature = fahrenheit(80),
+ .ambient_pressure = millibar(1015.9166),
+ .map = millibar(2031.8332),
+ .comp_efficiency = percent(70),
+ .intercooler_efficiency = percent(70),
+ };
+ test(manifold_temperature(&e), kelvin(327.9429247));
+}
+
+
+void
+test_volume_flow_rate(void) {
+ Pressure p_ambient, p_boost, map;
+
+ p_ambient = millibar(982.052713333343);
+ 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(volume_flow_rate(&e), cubic_metre_per_sec(0.1855992));
+}