ALGO_PID_ATY.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * @file ALGO_PID_ATY.h
  3. *
  4. * @param Project ALGO_Algorithm_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2023 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Familiar functions of CRC for all codes
  20. *
  21. * @version
  22. * - 1_01_200318 > ATY
  23. * -# Preliminary version, first Release
  24. * - 1_02_200318 > ATY
  25. * -# Add Conditional Compilation
  26. * -# Add user port
  27. * -Undone
  28. **********************************************************************************
  29. */
  30. #ifndef __ALGO_PID_ATY_H
  31. #define __ALGO_PID_ATY_H
  32. #include "INCLUDE_ATY.h"
  33. /******************************* For user *************************************/
  34. // #define __DEBUG_ALGO_PID_ATY
  35. /******************************************************************************/
  36. typedef struct PID{
  37. double SetPoint; // Set point desired value
  38. double Proportion; // Proportional const
  39. double Integral; // Integral const
  40. double Derivative; // Derivative const
  41. double LastError; // Error[-1]
  42. double PrevError; // Error[-2]
  43. double SumError; // Sums of errors
  44. }PID;
  45. double PidCalc(PID* pidStruct, double nextPoint);
  46. void PidInitZero(PID* pidStruct);
  47. void PidClearZero(PID* pidStruct);
  48. #ifdef __DEBUG_ALGO_PID_ATY
  49. void Actuator(double rDelta);
  50. void PidControl(void);
  51. #endif /* __DEBUG_ALGO_PID_ATY */
  52. #endif /* __ALGO_PID_ATY_H */
  53. /******************************** End Of File *********************************/