altb_pmic / Mbed 2 deprecated GRT_VC_PIDT1_musterloesung

Dependencies:   mbed

PID_Cntrl.h

Committer:
altb2
Date:
2019-05-07
Revision:
1:314e2e3727f2
Parent:
0:4ed9a8952ddc
Child:
3:477db0d9895e

File content as of revision 1:314e2e3727f2:

#ifndef PID_CNTRL_H_
#define PID_CNTRL_H_

// PID Controller Class (Template)
class PID_Cntrl
{
public:

    PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax);

    float operator()(float error) {
        return update((double)error);
    }

    virtual     ~PID_Cntrl();

    void        reset(float initValue);
    float       update(double error);
    
private:
    float e_old,D_old,I_old;
    float tau_f,Ts;
    float Kp,Ki,Kd;
    float uMin, uMax;
    // here some local variables are defined
};

#endif