torqobs.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /************************************************************************
  2. Project: Welling Motor Control Paltform
  3. Filename: torqobs.h
  4. Partner Filename: torqobs.c
  5. Description: The header file of asr.c
  6. Complier: IAR Embedded Workbench for ARM 8.40, IAR Systems.
  7. CPU TYPE : STM32F30x
  8. *************************************************************************
  9. Copyright (c) 2022 Welling Motor Technology(Shanghai) Co. Ltd.
  10. All rights reserved.
  11. *************************************************************************
  12. *************************************************************************
  13. Revising History (ECL of this file):
  14. ************************************************************************/
  15. /************************************************************************
  16. Beginning of File, do not put anything above here except notes
  17. Compiler Directives:
  18. *************************************************************************/
  19. #ifndef TORQOBS_H
  20. #define TORQOBS_H
  21. #include "typedefine.h"
  22. /************************************************************************
  23. Definitions & Macros (#define ...)
  24. *************************************************************************/
  25. /************************************************************************
  26. global varibles Macros (#define ...)
  27. *************************************************************************/
  28. /************************************************************************
  29. TypeDefs & Structure defines
  30. *************************************************************************/
  31. typedef struct
  32. {
  33. UWORD uwRatioJm; // Q0, Ratio of load inertia and motor inertia
  34. UWORD uwMtJm; // Motor rotational inertia
  35. UWORD uwMtFlxWb; // unit: 0.01mWb, Flux linkage
  36. UWORD uwUbVt; // unit: 0.1V, Voltage base
  37. UWORD uwIbAp; // unit: 0.01A, Current base
  38. UWORD uwFbHz; // unit: Hz, Frequency base
  39. UWORD uwFTbsHz; // TBS frequency
  40. UWORD uwPairs; // Pole pairs base
  41. UWORD uwWtcHz; // unit:Hz,Load torque observer bandwidth
  42. } TORQOBS_COEFIN;
  43. typedef struct
  44. {
  45. UWORD uwKpPu;
  46. UWORD uwKitPu;
  47. ULONG uwCur2TorqKPu;
  48. ULONG ulJmPu_Inv;
  49. UWORD uwTCtrPu;
  50. } TORQOBS_COEFOUT;
  51. typedef struct
  52. {
  53. SWORD swIqfbkPu;
  54. SWORD swSpdPu;
  55. SWORD swIqMaxPu;
  56. SWORD swIqMinPu;
  57. }TORQOBS_IN;
  58. typedef struct
  59. {
  60. SWORD swSpdObsPu;
  61. SLONG slSpdObsPu;
  62. SWORD swTorqObsPu;
  63. SWORD swErrZ1Pu;
  64. SLONG slIqLoadPu;
  65. SWORD swIqLoadPu;
  66. SLONG slDeltaTorqPu;
  67. } TORQOBS_OUT;
  68. /************************************************************************
  69. TypeDefs & Structure defines
  70. *************************************************************************/
  71. /************************************************************************
  72. Constant Table
  73. *************************************************************************/
  74. /************************************************************************
  75. Exported Variables:
  76. *************************************************************************/
  77. extern TORQOBS_COEFIN torqobs_stCoefIn;
  78. extern TORQOBS_COEFOUT torqobs_stCoef;
  79. extern TORQOBS_IN torqobs_stCalIn;
  80. extern TORQOBS_OUT torqobs_stCalOut;
  81. /************************************************************************
  82. RAM ALLOCATION:
  83. *************************************************************************/
  84. /************************************************************************
  85. Exported Function Call Prototypes (N/A)
  86. *************************************************************************/
  87. void torqobs_voInit(void);
  88. void torqobs_voCoef(TORQOBS_COEFIN *in, TORQOBS_COEFOUT *out);
  89. void torqobs_voCal(TORQOBS_IN *in, TORQOBS_COEFOUT *cof, TORQOBS_OUT *out);
  90. /************************************************************************
  91. Flag Define (N/A)
  92. *************************************************************************/
  93. #endif
  94. /************************************************************************
  95. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  96. All rights reserved.
  97. *************************************************************************
  98. End of this File (EOF)!
  99. Do not put anything after this part!
  100. *************************************************************************/