Add Hysteresis to pid controllers
Add hysteresis to pid controllers to lower pwm changes.
It is defaulted to 0 so it should be transparent
to any controller that choses not to implement it.
This is the same pattern used by the stepwise controller.
Tested-by: Unit tests passed
Change-Id: Ib47114285b0017258b7f77eaf067d310f95a0c60
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/pid/ec/pid.hpp b/pid/ec/pid.hpp
index 779ced5..3ab64cd 100644
--- a/pid/ec/pid.hpp
+++ b/pid/ec/pid.hpp
@@ -31,6 +31,8 @@
limits_t out_lim; // clamp of output
double slew_neg;
double slew_pos;
+ double positiveHysteresis;
+ double negativeHysteresis;
} pid_info_t;
double pid(pid_info_t* pidinfoptr, double input, double setpoint);
@@ -47,6 +49,8 @@
ec::limits_t out_lim; // clamp of output
double slew_neg;
double slew_pos;
+ double positiveHysteresis;
+ double negativeHysteresis;
};
} // namespace ec