#ifndef PID_H
#define PID_H


class PIDImpl;
class PID
{
    public:
        // Kp -  proportional gain
        // Ki -  Integral gain
        // Kd -  derivative gain
        // dt -  loop interval time
        // max - maximum value of manipulated variable
        // min - minimum value of manipulated variable
        PID( double dt, double max, double min, double Kp, double Kd, double Ki);

        // Kp -  proportional gain
        // Ki -  Integral gain
        // Kd -  derivative gain
        // dt -  loop interval time
        // max - maximum value of manipulated variable
        // min - minimum value of manipulated variable
        //maxI - maximum value of Intergrate
        PID( double dt, double max, double min, double Kp, double Kd, double Ki, double maxI);

        // Kp -  proportional gain
        // Ki -  Integral gain
        // Kd -  derivative gain
        // dt -  loop interval time
        // max - maximum value of manipulated variable
        // min - minimum value of manipulated variable
        //maxI - maximum value of Intergrate
        //maxIstep  the max step of increase
        //maxDstep  the max step of decrese
        PID( double dt, double max, double min, double Kp, double Kd, double Ki, double maxI, double maxIstep, double maxDstep);


        // Returns the manipulated variable given a setpoint and current process value
        double calculate( double setpoint, double pv );

        // Returns the manipulated variable given a setpoint and current process value
        double calculate_v2( double setpoint, double pv );

        //
        void reset();
        ~PID();

    private:
        PIDImpl *pimpl;
};

#endif // PID_H
