mirror of https://github.com/rusefi/wideband.git
battery stabilization time with a timer
This commit is contained in:
parent
5902009536
commit
35c84cf13b
|
@ -19,6 +19,7 @@ void HeaterControllerBase::Configure(float targetTempC, float targetEsr)
|
|||
|
||||
m_preheatTimer.reset();
|
||||
m_warmupTimer.reset();
|
||||
m_batteryStableTimer.reset();
|
||||
}
|
||||
|
||||
bool HeaterControllerBase::IsRunningClosedLoop() const
|
||||
|
@ -46,15 +47,14 @@ HeaterState HeaterControllerBase::GetNextState(HeaterState currentState, HeaterA
|
|||
// measured voltage too low to auto-start heating
|
||||
if (batteryVoltage < HEATER_BATTETY_OFF_VOLTAGE)
|
||||
{
|
||||
batteryStabTime = batteryStabTimeCounter;
|
||||
m_batteryStableTimer.reset();
|
||||
return HeaterState::NoHeaterSupply;
|
||||
}
|
||||
// measured voltage is high enougth to auto-start heating, wait some time to stabilize
|
||||
if ((batteryVoltage > HEATER_BATTERY_ON_VOLTAGE) && (batteryStabTime > 0))
|
||||
else if (batteryVoltage > HEATER_BATTERY_ON_VOLTAGE)
|
||||
{
|
||||
batteryStabTime--;
|
||||
// measured voltage is high enougth to auto-start heating, wait some time to stabilize
|
||||
heaterAllowed = m_batteryStableTimer.hasElapsedSec(HEATER_BATTERY_STAB_TIME);
|
||||
}
|
||||
heaterAllowed = batteryStabTime == 0;
|
||||
}
|
||||
|
||||
if (!heaterAllowed)
|
||||
|
|
|
@ -40,6 +40,8 @@ public:
|
|||
|
||||
virtual void SetDuty(float duty) const = 0;
|
||||
|
||||
bool GetIsHeatingEnabled(HeaterAllow heaterAllowState, float batteryVoltage);
|
||||
|
||||
HeaterState GetNextState(HeaterState currentState, HeaterAllow haeterAllowState, float batteryVoltage, float sensorTemp);
|
||||
float GetVoltageForState(HeaterState state, float sensorEsr);
|
||||
|
||||
|
@ -53,7 +55,6 @@ private:
|
|||
HEATER_CONTROL_PERIOD
|
||||
};
|
||||
|
||||
int batteryStabTime = batteryStabTimeCounter;
|
||||
float rampVoltage = 0;
|
||||
float heaterVoltage = 0;
|
||||
HeaterState heaterState = HeaterState::Preheat;
|
||||
|
@ -69,6 +70,7 @@ private:
|
|||
const int m_preheatTimeSec;
|
||||
const int m_warmupTimeSec;
|
||||
|
||||
Timer m_batteryStableTimer;
|
||||
Timer m_preheatTimer;
|
||||
Timer m_warmupTimer;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#define HEATER_PREHEAT_TIME 5
|
||||
#define HEATER_WARMUP_TIMEOUT 60
|
||||
|
||||
#define HEATER_BATTERY_STAB_TIME 500
|
||||
#define HEATER_BATTERY_STAB_TIME 0.5f
|
||||
// minimal battery voltage to start heating without CAN command
|
||||
#define HEATER_BATTERY_ON_VOLTAGE 9.5
|
||||
// mininal battery voltage to continue heating
|
||||
|
|
Loading…
Reference in New Issue