mirror of https://github.com/rusefi/wideband.git
filter pump output
This commit is contained in:
parent
3fe5b76975
commit
2d5d6a0026
|
@ -43,7 +43,10 @@ static void SamplingThread(void*)
|
||||||
nernstAc = f_abs(r2_opposite_phase - r_2);
|
nernstAc = f_abs(r2_opposite_phase - r_2);
|
||||||
nernstDc = (r2_opposite_phase + r_2) / 2;
|
nernstDc = (r2_opposite_phase + r_2) / 2;
|
||||||
|
|
||||||
pumpCurrentSenseVoltage = 0.7f * pumpCurrentSenseVoltage + 0.3f * (result.PumpCurrentVoltage - result.VirtualGroundVoltageInt);
|
// Exponential moving average (aka first order lpf)
|
||||||
|
pumpCurrentSenseVoltage =
|
||||||
|
(1 - PUMP_FILTER_ALPHA) * pumpCurrentSenseVoltage +
|
||||||
|
PUMP_FILTER_ALPHA * (result.PumpCurrentVoltage - result.VirtualGroundVoltageInt);
|
||||||
|
|
||||||
// Shift history over by one
|
// Shift history over by one
|
||||||
r_3 = r_2;
|
r_3 = r_2;
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
// LSU sense resistor - 61.9 ohms
|
// LSU sense resistor - 61.9 ohms
|
||||||
#define LSU_SENSE_R (61.9f)
|
#define LSU_SENSE_R (61.9f)
|
||||||
|
|
||||||
|
// Pump low pass filter alpha
|
||||||
|
// sampling at 2.5khz, alpha of 0.1 gives about 42hz bandwidth
|
||||||
|
#define PUMP_FILTER_ALPHA (0.1f)
|
||||||
|
|
||||||
// *******************************
|
// *******************************
|
||||||
// Pump controller
|
// Pump controller
|
||||||
// *******************************
|
// *******************************
|
||||||
|
|
Loading…
Reference in New Issue