Test of pmic GPA with filter

Dependencies:   mbed

Fork of nucf446-cuboid-balance1_strong by RT2_Cuboid_demo

PI_Cntrl.h

Committer:
pmic
Date:
2018-04-10
Revision:
26:492c7ab05e67
Parent:
15:1e8e90b4e3a1

File content as of revision 26:492c7ab05e67:

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

};