pid.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef PID_H
  2. #define PID_H
  3. class PIDImpl;
  4. class PID
  5. {
  6. public:
  7. // Kp - proportional gain
  8. // Ki - Integral gain
  9. // Kd - derivative gain
  10. // dt - loop interval time
  11. // max - maximum value of manipulated variable
  12. // min - minimum value of manipulated variable
  13. PID( double dt, double max, double min, double Kp, double Kd, double Ki);
  14. // Kp - proportional gain
  15. // Ki - Integral gain
  16. // Kd - derivative gain
  17. // dt - loop interval time
  18. // max - maximum value of manipulated variable
  19. // min - minimum value of manipulated variable
  20. //maxI - maximum value of Intergrate
  21. PID( double dt, double max, double min, double Kp, double Kd, double Ki, double maxI);
  22. // Kp - proportional gain
  23. // Ki - Integral gain
  24. // Kd - derivative gain
  25. // dt - loop interval time
  26. // max - maximum value of manipulated variable
  27. // min - minimum value of manipulated variable
  28. //maxI - maximum value of Intergrate
  29. //maxIstep the max step of increase
  30. //maxDstep the max step of decrese
  31. PID( double dt, double max, double min, double Kp, double Kd, double Ki, double maxI, double maxIstep, double maxDstep);
  32. // Returns the manipulated variable given a setpoint and current process value
  33. double calculate( double setpoint, double pv );
  34. // Returns the manipulated variable given a setpoint and current process value
  35. double calculate_v2( double setpoint, double pv );
  36. //
  37. void reset();
  38. ~PID();
  39. private:
  40. PIDImpl *pimpl;
  41. };
  42. #endif // PID_H