Library for control puposes
Fork of Cntrl_Lib by
Diff: PI_Cntrl.h
- Revision:
- 0:e2a7d7f91e49
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PI_Cntrl.h Fri Sep 28 08:34:20 2018 +0000 @@ -0,0 +1,29 @@ +class PI_Cntrl +{ +public: + + PI_Cntrl(float Kp, float Tn, float Ts); + PI_Cntrl(float Kp, float Tn, float Ts, float uMax); + PI_Cntrl(float Kp, float Tn, float Ts, float uMax, float uMin); + + float operator()(float error) { + return doStep((double)error); + } + + virtual ~PI_Cntrl(); + + void reset(float initValue); + float doStep(double error); + +private: + + double b0; + double b1; + double b2; + double s; + double uMax; + double uMin; + + void setCoefficients(float Kp, float Tn, float Ts); + +}; \ No newline at end of file