all of the changes
This commit is contained in:
@@ -6,12 +6,14 @@ namespace fluidsim::port {
|
||||
// Ideal sensors and injectors; calibration parameters are not engine measurements.
|
||||
class Ecu {
|
||||
public:
|
||||
enum class IdleControl { Feedback, FixedOpening };
|
||||
IdleControl idle_control{IdleControl::Feedback};
|
||||
struct IgnitionPoint { float rpm, degrees_btdc; };
|
||||
std::vector<IgnitionPoint> ignition_map{{0, 10}, {15000, 40}};
|
||||
float idle_rpm{1800.0f};
|
||||
float idle_base_opening{0.08f}, idle_max_opening{0.25f};
|
||||
float idle_kp{0.0001f}, idle_ki{0.00004f};
|
||||
float throttle_time_constant{0.08f}, throttle_rate{2.0f}; // seconds, full travel/second
|
||||
float throttle_time_constant{0.001f}, throttle_rate{1000.0f}; // seconds, full travel/second
|
||||
// Zero uses the opening calibration, preserving symmetric response.
|
||||
float throttle_closing_time_constant{}, throttle_closing_rate{};
|
||||
float rev_limit_rpm{10000.0f}, rev_resume_rpm{9750.0f};
|
||||
@@ -20,12 +22,6 @@ public:
|
||||
bool overrun_fuel_cut_enabled{true};
|
||||
float idle_spark_gain{0.0f}, idle_minimum_advance{-5.0f}; // degrees/RPM, degrees BTDC
|
||||
float stoichiometric_afr{14.7f}, power_afr{12.8f};
|
||||
bool boost_control_enabled{false};
|
||||
float maximum_boost{45000}; // Pa gauge, estimated low-pressure B205 calibration
|
||||
float boost_kp{1e-5f}, boost_ki{4e-6f};
|
||||
void control_boost(float dt, float pedal, float rpm, float manifold, float charge, float ambient = 101325);
|
||||
float boost_target() const { return boost_target_; }
|
||||
float wastegate_duty() const { return boost_duty_; }
|
||||
|
||||
void step(float dt, float pedal, float rpm);
|
||||
float fuel_for_air(float trapped_air_mass) const;
|
||||
@@ -33,14 +29,12 @@ public:
|
||||
float throttle_target() const { return target_; }
|
||||
float target_afr() const { return afr_; }
|
||||
float spark_advance() const { return spark_; }
|
||||
bool fuel_cut() const { return limiter_ || (overrun_ && overrun_fuel_cut_enabled) || fault_ || boost_cut_; }
|
||||
bool fuel_cut() const { return limiter_ || (overrun_ && overrun_fuel_cut_enabled) || fault_; }
|
||||
bool rev_limited() const { return limiter_; }
|
||||
bool idle_active() const { return idle_; }
|
||||
bool sensor_fault() const { return fault_; }
|
||||
|
||||
private:
|
||||
float boost_target_{}, boost_duty_{}, boost_integral_{}, filtered_boost_{};
|
||||
bool boost_cut_{};
|
||||
float filtered_rpm_{};
|
||||
bool initialized_{};
|
||||
float opening_{}, target_{}, integral_{}, afr_{14.7f}, spark_{10.0f};
|
||||
|
||||
Reference in New Issue
Block a user