Template for group 4

Dependencies:   mbed

Fork of RT2_P3_students by RT2_P3_students

PI_Cntrl.h

Committer:
altb
Date:
2018-04-17
Revision:
6:8ed679044a72
Parent:
1:a30512c3ac73

File content as of revision 6:8ed679044a72:

#ifndef PI_CNTRL_H_
#define PI_CNTRL_H_


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);

};
    
    
#endif      // PI_CNTRL_H_