mirror of https://github.com/rusefi/wideband.git
heater fiddling
This commit is contained in:
parent
6de89e81a3
commit
d3f90f2054
|
@ -34,8 +34,8 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
||||||
if (timeCounter <= 0 || sensorEsr < HEATER_CLOSED_LOOP_THRESHOLD_ESR)
|
if (timeCounter <= 0 || sensorEsr < HEATER_CLOSED_LOOP_THRESHOLD_ESR)
|
||||||
{
|
{
|
||||||
// If enough time has elapsed, start the ramp
|
// If enough time has elapsed, start the ramp
|
||||||
// Start the ramp at 50% duty - ~6-7 volts
|
// Start the ramp at 30% duty - ~3-4 volts
|
||||||
rampDuty = 0.5f;
|
rampDuty = 0.3f;
|
||||||
|
|
||||||
// Next phase times out at 15 seconds
|
// Next phase times out at 15 seconds
|
||||||
timeCounter = HEATER_WARMUP_TIMEOUT / HEATER_CONTROL_PERIOD;
|
timeCounter = HEATER_WARMUP_TIMEOUT / HEATER_CONTROL_PERIOD;
|
||||||
|
@ -78,7 +78,21 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Pid heaterPid(0.003f, 0.005f, 0.0005f, 0.6f, HEATER_CONTROL_PERIOD);
|
// oscillates at 0.04 kP
|
||||||
|
|
||||||
|
//static Pid heaterPid(0.04f,0, 0, 0.6f, HEATER_CONTROL_PERIOD);
|
||||||
|
|
||||||
|
// "no overshoot" PID
|
||||||
|
//static Pid heaterPid(0.008f, 0.0288f, 0.0015f, 0.6f, HEATER_CONTROL_PERIOD);
|
||||||
|
|
||||||
|
// PI
|
||||||
|
//static Pid heaterPid(0.02f, 0.0576f, 0.0015f, 0.6f, HEATER_CONTROL_PERIOD);
|
||||||
|
|
||||||
|
// rusefi ETB autotune
|
||||||
|
//static Pid heaterPid(0.014f, 0.018f, 0.0018f, 0.6f, HEATER_CONTROL_PERIOD);
|
||||||
|
|
||||||
|
// rusefi ETB autotune with more PD
|
||||||
|
static Pid heaterPid(0.02f, 0.018f, 0.003f, 0.6f, HEATER_CONTROL_PERIOD);
|
||||||
|
|
||||||
static float GetDutyForState(HeaterState state, float heaterEsr)
|
static float GetDutyForState(HeaterState state, float heaterEsr)
|
||||||
{
|
{
|
||||||
|
@ -88,8 +102,8 @@ static float GetDutyForState(HeaterState state, float heaterEsr)
|
||||||
case HeaterState::WarmupRamp:
|
case HeaterState::WarmupRamp:
|
||||||
if (rampDuty < 0.75f)
|
if (rampDuty < 0.75f)
|
||||||
{
|
{
|
||||||
// 0.4 volt per second, divided by battery voltage and update rate
|
// 0.3 volt per second, divided by battery voltage and update rate
|
||||||
constexpr float rampRateVoltPerSecond = 0.4f;
|
constexpr float rampRateVoltPerSecond = 0.3f;
|
||||||
constexpr float heaterFrequency = 1000.0f / HEATER_CONTROL_PERIOD;
|
constexpr float heaterFrequency = 1000.0f / HEATER_CONTROL_PERIOD;
|
||||||
rampDuty += ((rampRateVoltPerSecond / 14) / heaterFrequency);
|
rampDuty += ((rampRateVoltPerSecond / 14) / heaterFrequency);
|
||||||
}
|
}
|
||||||
|
@ -125,6 +139,11 @@ static void HeaterThread(void*)
|
||||||
state = GetNextState(state, heaterEsr);
|
state = GetNextState(state, heaterEsr);
|
||||||
float duty = GetDutyForState(state, heaterEsr);
|
float duty = GetDutyForState(state, heaterEsr);
|
||||||
|
|
||||||
|
// Limit to 80% duty
|
||||||
|
if (duty > 0.8) {
|
||||||
|
duty = 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
// Pipe the output to the heater driver
|
// Pipe the output to the heater driver
|
||||||
heaterPwm.SetDuty(duty);
|
heaterPwm.SetDuty(duty);
|
||||||
|
|
||||||
|
|
|
@ -46,5 +46,5 @@
|
||||||
|
|
||||||
#define HEATER_CLOSED_LOOP_THRESHOLD_ESR 2000
|
#define HEATER_CLOSED_LOOP_THRESHOLD_ESR 2000
|
||||||
#define HEATER_TARGET_ESR 300
|
#define HEATER_TARGET_ESR 300
|
||||||
#define HEATER_OVERHEAT_ESR 200
|
#define HEATER_OVERHEAT_ESR 150
|
||||||
#define HEATER_UNDERHEAT_ESR 3000
|
#define HEATER_UNDERHEAT_ESR 3000
|
||||||
|
|
Loading…
Reference in New Issue