cmd_torque_gen.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. * @file cmd_torque_gen.h
  3. * @author Zhang, Kai(zhangkai71@midea.com)
  4. * @brief Time task control
  5. * @version 0.1
  6. * @date 2021-09-27
  7. *
  8. * @copyright Copyright (c) 2021
  9. *
  10. */
  11. #ifndef CMD_TORQUE_GEN_H
  12. #define CMD_TORQUE_GEN_H
  13. #include "typedefine.h"
  14. /****************************************
  15. *
  16. * Definitions & Macros
  17. *
  18. ****************************************/
  19. /***************************************
  20. *
  21. * Type Definations
  22. *
  23. ***************************************/
  24. /**
  25. * @brief torque command input
  26. *
  27. */
  28. typedef struct
  29. {
  30. SWORD swTorqCmdRpm;
  31. SWORD swTorqNowPu;
  32. } CMD_TORQ_IN;
  33. /**
  34. * @brief torque command coefficient input
  35. *
  36. */
  37. typedef struct
  38. {
  39. ULONG ulAccelPu;
  40. ULONG ulDecelPu;
  41. SWORD swBrakeSpdDeltaPu;
  42. } CMD_TORQ_COF_IN;
  43. /**
  44. * @brief torque command output
  45. *
  46. */
  47. typedef struct
  48. {
  49. SWORD swNewTorqRefPu;
  50. SWORD swOldTorqRefPu;
  51. SWORD swNewCmdDir;
  52. SWORD swOldCmdDir;
  53. // FlagStatus blConsVolBrakeFlg;
  54. BOOL blConsVolBrakeFlg;
  55. SWORD swIntRefPu; // Q14, command pu ,(electrical value)
  56. SLONG slIntRefPu;
  57. SWORD swMotorDir;
  58. } CMD_TORQ_OUT;
  59. /**
  60. * @brief torque command coefficient
  61. *
  62. */
  63. typedef struct
  64. {
  65. ULONG ulAccelPu;
  66. ULONG ulDecelPu;
  67. SWORD swBrakeSpdDeltaPu;
  68. } CMD_TORQ_COF;
  69. typedef struct
  70. {
  71. CMD_TORQ_COF Coef; ///< Coefficient of current PI controller
  72. CMD_TORQ_OUT Out; ///< Output of current PU controller
  73. } CMD_TORQ_CONTROL;
  74. /****************************************
  75. *
  76. * Exported variable
  77. *
  78. ****************************************/
  79. /***************************************
  80. *
  81. * Function Definations
  82. *
  83. ***************************************/
  84. /**
  85. * @brief Process when switching state from Ready to Run
  86. *
  87. */
  88. void cmd_voTorqInit(void);
  89. /**
  90. * @brief Process of FSM during SysInit state
  91. *
  92. */
  93. void cmd_voTorqOut(void);
  94. /**
  95. * @brief Process of FSM during SysRdy state
  96. *
  97. */
  98. void cmd_voTorqCoef(void);
  99. #endif