ETB duty cycle jitter #4833
This commit is contained in:
parent
57c5ff6420
commit
9321aae600
|
@ -208,6 +208,8 @@ bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidPara
|
|||
// Ignore 3% position error before complaining
|
||||
m_errorAccumulator.init(3.0f, etbPeriodSeconds);
|
||||
|
||||
m_dutyIntegrator.init(engineConfiguration->etbDutyThreshold, etbPeriodSeconds);
|
||||
|
||||
reset();
|
||||
|
||||
return true;
|
||||
|
@ -511,7 +513,11 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
|
|||
}
|
||||
|
||||
// Normal case - use PID to compute closed loop part
|
||||
return m_pid.getOutput(target, observation, etbPeriodSeconds);
|
||||
float output = m_pid.getOutput(target, observation, etbPeriodSeconds);
|
||||
m_dutyErrorAccumulator.accumulate(prevOutput - output);
|
||||
prevOutput = output;
|
||||
etbDutyRateOfChange =
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,5 +12,6 @@ float luaAdjustment;"ETB: luaAdjustment"
|
|||
float etbCurrentAdjustedTarget;;"%", 1, 0, -10000, 10000, 3
|
||||
|
||||
bit etbRevLimitActive
|
||||
float etbDutyRateOfChange
|
||||
|
||||
end_struct
|
|
@ -86,6 +86,9 @@ private:
|
|||
// todo: rename to m_targetErrorAccumulator
|
||||
ErrorAccumulator m_errorAccumulator;
|
||||
|
||||
ErrorAccumulator m_dutyIntegrator;
|
||||
float prevOutput;
|
||||
|
||||
// Pedal -> target map
|
||||
const ValueProvider3D* m_pedalMap = nullptr;
|
||||
|
||||
|
|
|
@ -1336,6 +1336,7 @@ gaugeCategory = Throttle Body (incl. ETB)
|
|||
etbTargetGauge = etbTarget, @@GAUGE_NAME_ETB_TARGET@@, "%", 0, 100, 0, 0, 100, 100, 1, 1
|
||||
etbErrorGauge = etb1Error, @@GAUGE_NAME_ETB_ERROR@@, "%", -20, 20, -10, -5, 5, 10, 2, 0
|
||||
etbDutyCycleGauge = etb1DutyCycle, @@GAUGE_NAME_ETB_DUTY@@, "%", -100, 100, -75, -50, 50, 75, 0, 0
|
||||
etbDutyRateOfChangeGauge = etbDutyRateOfChange, "ETB duty ROC", "", -100, 100, -75, -50, 50, 75, 0, 3
|
||||
|
||||
gaugeCategory = Sensors - Raw
|
||||
rawTps1PrimaryGauge = rawTps1Primary, "Raw TPS 1 Primary", "V", 0, 5, 0, 0, 5, 5, 3, 0
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "error_accumulator.h"
|
||||
|
||||
// todo: shall we rename to StatsIntegrator or SomethingIntegrator assuming we see not "Error Accumulator" usages?
|
||||
// todo: ValueIntegrator maybe?
|
||||
float ErrorAccumulator::accumulate(float error) {
|
||||
// We only care about the absolute value of the error
|
||||
error = absF(error);
|
||||
|
|
Loading…
Reference in New Issue