Load engines from TOML and improve scenario audio and carb tuning
Migrate 32 engine definitions into validated startup-loaded TOML files and separate configuration and snapshots from scenario assembly. Add camera-based stereo propagation from shared pipe geometry, preserve exhaust character, tune carburetor mixtures and idle, use ignition cuts for carb engines, and support returning to the scenario menu. Validation: full Windows build and all 14 CTest checks passed.
This commit is contained in:
@@ -10,12 +10,16 @@ namespace fluidsim::port {
|
||||
|
||||
class Ecu;
|
||||
|
||||
class Crankshaft {
|
||||
public:
|
||||
float omega{400.0f * 2.0f * pi / 60.0f};
|
||||
float angle{}, previous_angle{}, inertia{0.2f};
|
||||
struct CrankshaftConfig {
|
||||
float inertia{0.2f};
|
||||
float friction_constant{}, friction_viscous{};
|
||||
float friction_quadratic{}; // Nm / (rad/s)^2, dissipative windage term
|
||||
};
|
||||
|
||||
class Crankshaft : public CrankshaftConfig {
|
||||
public:
|
||||
float omega{400.0f * 2.0f * pi / 60.0f};
|
||||
float angle{}, previous_angle{};
|
||||
float load_torque{}, drivetrain_torque{};
|
||||
float average_power{}, average_torque{};
|
||||
|
||||
@@ -28,18 +32,22 @@ private:
|
||||
float power_sum_{}, torque_sum_{};
|
||||
};
|
||||
|
||||
class EngineCylinder : public Component {
|
||||
public:
|
||||
Ecu* ecu{}; // Optional ideal electronic fuel/ignition controller.
|
||||
bool transported_fuel{}; // Upstream carb meters the fuel species.
|
||||
struct CylinderConfig {
|
||||
float intake_open{340}, intake_close{590}, exhaust_open{130}, exhaust_close{390};
|
||||
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};
|
||||
float afr{14.7f}, fuel_lhv{44.0e6f}, energy_variation{0.05f}, misfire_probability{};
|
||||
float wall_area{0.02f}, heat_transfer{100.0f}, ambient_temperature{300.0f};
|
||||
};
|
||||
|
||||
class EngineCylinder : public Component, public CylinderConfig {
|
||||
public:
|
||||
Ecu* ecu{};
|
||||
bool transported_fuel{};
|
||||
float phase{};
|
||||
bool rev_limit_enabled{};
|
||||
float rev_limit_rpm{7500.0f}, rev_limit_cut_time{0.05f}, rev_limit_hysteresis{200.0f};
|
||||
float air_mass{}, exhaust_mass{}, energy{}, volume{}, pressure{101325.0f};
|
||||
@@ -78,7 +86,6 @@ protected:
|
||||
|
||||
class FourStrokeCylinder final : public EngineCylinder {
|
||||
public:
|
||||
float intake_open{340.0f}, intake_close{590.0f}, exhaust_open{130.0f}, exhaust_close{390.0f};
|
||||
float valve_area(float cycle_degrees, bool inlet) const override;
|
||||
void pre_step(Crankshaft& crank, float dt, float throttle) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user