Template for group 4

Dependencies:   mbed

Fork of RT2_P3_students by RT2_P3_students

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PI_Cntrl.h Source File

PI_Cntrl.h

00001 #ifndef PI_CNTRL_H_
00002 #define PI_CNTRL_H_
00003 
00004 
00005 class PI_Cntrl
00006 {
00007 public:
00008 
00009     PI_Cntrl(float Kp, float Tn, float Ts);
00010     PI_Cntrl(float Kp, float Tn, float Ts, float uMax);
00011     PI_Cntrl(float Kp, float Tn, float Ts, float uMax, float uMin);
00012 
00013     float operator()(float error) {
00014         return doStep((double)error);
00015     }
00016 
00017     virtual     ~PI_Cntrl();
00018 
00019     void        reset(float initValue);
00020     float       doStep(double error);
00021 
00022 private:
00023 
00024     double b0;
00025     double b1;
00026     double b2;
00027     double s;
00028     double uMax;
00029     double uMin;
00030     
00031     void        setCoefficients(float Kp, float Tn, float Ts);
00032 
00033 };
00034     
00035     
00036 #endif      // PI_CNTRL_H_