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/pidcontroller.hpp b/pid/pidcontroller.hpp
index 9ed3be2..3d38c2a 100644
--- a/pid/pidcontroller.hpp
+++ b/pid/pidcontroller.hpp
@@ -49,6 +49,11 @@
return &_pid_info;
}
+ double getLastInput(void)
+ {
+ return lastInput;
+ }
+
protected:
ZoneInterface* _owner;
@@ -57,4 +62,5 @@
ec::pid_info_t _pid_info;
double _setpoint;
std::string _id;
+ double lastInput = std::numeric_limits<double>::quiet_NaN();
};