ALGO_PID_ATY.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 - 2026 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 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. **********************************************************************************
  28. */
  29. #ifndef __ALGO_PID_ATY_H
  30. #define __ALGO_PID_ATY_H
  31. #include "INCLUDE_ATY.h"
  32. /******************************* For user *************************************/
  33. /******************************************************************************/
  34. typedef struct PID{
  35. double SetPoint; // Set point desired value
  36. double Proportion; // Proportional const
  37. double Integral; // Integral const
  38. double Derivative; // Derivative const
  39. double LastError; // Error[-1]
  40. double PrevError; // Error[-2]
  41. double SumError; // Sums of errors
  42. }PID;
  43. double PidCalc(PID* pidStruct, double nextPoint);
  44. void PidInitZero(PID* pidStruct);
  45. void PidClearZero(PID* pidStruct);
  46. // #define ALGO_PID_ATY_Test_ATY
  47. #ifdef ALGO_PID_ATY_Test_ATY
  48. void ALGO_PID_ATY_Test(void);
  49. #endif /* ALGO_PID_ATY_Test_ATY */
  50. #endif /* __ALGO_PID_ATY_H */
  51. /******************************** End Of File *********************************/