Add turbocharged twin scenario and cross-platform test harness

This commit is contained in:
2026-10-23 02:27:03 +02:00
parent a859740a95
commit 589d22aa5e
63 changed files with 4903 additions and 771 deletions

View File

@@ -8,11 +8,14 @@
namespace fluidsim::port {
class Ecu;
class Crankshaft {
public:
float omega{400.0f * 2.0f * pi / 60.0f};
float angle{}, previous_angle{}, inertia{0.2f};
float friction_constant{}, friction_viscous{};
float friction_quadratic{}; // Nm / (rad/s)^2, dissipative windage term
float load_torque{}, drivetrain_torque{};
float average_power{}, average_torque{};
@@ -27,8 +30,10 @@ private:
class EngineCylinder : public Component {
public:
Ecu* ecu{}; // Optional ideal electronic fuel/ignition controller.
float bore{0.075f}, stroke{0.068f}, rod{0.112f}, compression{11.5f};
float intake_valve_diameter{0.030f}, exhaust_valve_diameter{0.028f};
int intake_valve_count{1}, exhaust_valve_count{1};
float intake_valve_lift{0.005f}, exhaust_valve_lift{0.005f};
float phase{};
float spark_advance{20.0f}, wiebe_a{5.0f}, wiebe_m{2.0f}, burn_duration{60.0f}, burn_start{5.0f};
@@ -61,6 +66,9 @@ protected:
float random_unit();
static float wrap_degrees(float value, float cycle_degrees = 720.0f);
static bool crossed_angle(float previous, float current, float event) {
return current >= previous ? previous < event && current >= event : event > previous || event <= current;
}
static bool crossed_window_close(float previous, float current, float open, float close);
void update_rev_limiter(float rpm, float dt);
void sync_ports();