motor_param.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #ifndef _MOTOR_PARAM_H__
  2. #define _MOTOR_PARAM_H__
  3. #include "bsp/bsp.h"
  4. #include "os/os_types.h"
  5. #include "foc/core/PMSM_FOC_Core.h"
  6. /* 电机外特性map, 每个转速点对应的最大扭矩 */
  7. typedef struct {
  8. s16 rpm;
  9. s16 torque;
  10. }motor_map_t;
  11. typedef struct{
  12. s16 torque;
  13. s16 d;
  14. s16 q;
  15. }torque2dq_t;
  16. typedef struct {
  17. s16 iq;
  18. float lq;
  19. }iq_lq_map_t;
  20. typedef torque2dq_t torque_map_t;
  21. s16 motor_max_torque_for_rpm(s16 rpm);
  22. void motor_mpta_fw_lookup(float rpm, float torque, DQ_t *dq_out);
  23. float motor_get_lq_from_iq(s16 iq);
  24. float motor_get_ebreak_toruqe(float rpm);
  25. #if CONFIG_MOT_TYPE==MOTOR_BLUESHARK_NEW1
  26. #define MOTOR_R 0.010f
  27. #define MOTOR_Ld (0.000120f*0.5f)
  28. #define MOTOR_Lq (0.000200f*0.5f)
  29. #define MOTOR_POLES 4
  30. #define MOTOR_ENC_OFFSET 0.0F
  31. #define CONFIG_MAX_MOTOR_TORQUE 40.0F
  32. #define TRQ_PI_KP 0.14F
  33. #define TRQ_PI_KI 0.15F
  34. #define CONFIG_CURRENT_BANDWITH 1000.0f /* 电流环带宽 */
  35. #define CONFIG_DEFAULT_PHASE_CURR_LIM 200
  36. #define CONFIG_MAX_FW_D_CURR 100.0F //d轴最大的退磁电流
  37. #define MOTOR_NR 0x11
  38. #elif CONFIG_MOT_TYPE==MOTOR_BLUESHARK_A1
  39. #define MOTOR_STATOR_5N
  40. #ifndef MOTOR_STATOR_5N
  41. #define MOTOR_R 0.011f //5N -> 0.0164/2
  42. #define MOTOR_Ld (0.000140F*0.5f) //5N -> 0.000048
  43. #define MOTOR_Lq (0.000356f*0.5f) //5N -> 0.0001335
  44. #define MOTOR_Flux (0.013f)
  45. #else
  46. #define MOTOR_R 0.009f
  47. #define MOTOR_Ld (0.000100F*0.5f) //5N -> 0.000048
  48. #define MOTOR_Lq (0.000240f*0.5f) //5N -> 0.0001335
  49. #define MOTOR_Flux (0.011f)
  50. #endif
  51. #define MOTOR_POLES 4
  52. #define MOTOR_ENC_OFFSET 0.0F
  53. #define CONFIG_MAX_MOTOR_TORQUE 400.0f//45.0F
  54. #define PI_VEL_LIM_KP 0.085F //0.13f
  55. #define PI_VEL_LIM_KI 2.5F
  56. #define PI_VEL_LIM_KD 0.0F
  57. #define PI_VEL_KP 0.1F //0.13f
  58. #define PI_VEL_KI 3.0F
  59. #define PI_VEL_KD 0.0F
  60. #define MOTOR_NR 0x16
  61. //4000->10, 34; 8000->8, 15
  62. #define CONFIG_CURRENT_BANDWITH (800 * 2 * PI) /* 电流环带宽 = bandwith / (2 * pi)*/
  63. #define CONFIG_DEFAULT_PHASE_CURR_LIM 500
  64. #define CONFIG_MAX_FW_D_CURR 300.0F //d轴最大的退磁电流
  65. #define CONFIG_CURRENT_LOOP_DECOUPE //电流环解耦
  66. #elif CONFIG_MOT_TYPE==MOTOR_BLUESHARK_NEW2
  67. #define MOTOR_R 0.013f
  68. #define MOTOR_Ld (0.000140f*0.5f)
  69. #define MOTOR_Lq (0.000320f*0.5f)
  70. #define MOTOR_POLES 4
  71. #define MOTOR_ENC_OFFSET 250.0F
  72. #define CONFIG_MAX_MOTOR_TORQUE 40.0F
  73. #define TRQ_PI_KP 0.14F
  74. #define TRQ_PI_KI 0.15F
  75. #define MOTOR_NR 0x12
  76. #define CONFIG_CURRENT_BANDWITH 1000.0f /* 电流环带宽 */
  77. #define CONFIG_DEFAULT_PHASE_CURR_LIM 200
  78. #define CONFIG_MAX_FW_D_CURR 100.0F //d轴最大的退磁电流
  79. #elif CONFIG_MOT_TYPE==MOTOR_BLUESHARK_ZD_100
  80. #define MOTOR_R 0.008f
  81. #define MOTOR_Lq (0.000125f*0.5f)
  82. #define MOTOR_Ld (0.000091f*0.5f)
  83. #define MOTOR_POLES 5
  84. #define MOTOR_Flux (0.023f)
  85. #define MOTOR_ENC_OFFSET 0.0F
  86. #define CONFIG_MAX_MOTOR_TORQUE 200.0F
  87. #define PI_VEL_LIM_KP 0.085F //0.13f
  88. #define PI_VEL_LIM_KI 2.5F
  89. #define PI_VEL_LIM_KD 0.0F
  90. #define PI_VEL_KP 0.1F //0.13f
  91. #define PI_VEL_KI 3.0F
  92. #define PI_VEL_KD 0.0F
  93. #define MOTOR_NR 0x13
  94. #define CONFIG_CURRENT_BANDWITH (200 * 2 * PI) /* 电流环带宽 */
  95. #define CONFIG_DEFAULT_PHASE_CURR_LIM 200
  96. #define CONFIG_MAX_FW_D_CURR 100.0F //d轴最大的退磁电流
  97. #elif CONFIG_MOT_TYPE==MOTOR_BLUESHARK_OLD
  98. #define MOTOR_R 0.012f
  99. #define MOTOR_Ld (0.000143f*0.5f)
  100. #define MOTOR_Lq (0.000205f*0.5f)
  101. #define MOTOR_POLES 5
  102. #define MOTOR_ENC_OFFSET 180.0F
  103. #define CONFIG_MAX_MOTOR_TORQUE 40.0F
  104. #define TRQ_PI_KP 0.14F
  105. #define TRQ_PI_KI 0.15F
  106. #define MOTOR_NR 0x14
  107. #define CONFIG_CURRENT_BANDWITH 1000.0f /* 电流环带宽 */
  108. #define CONFIG_DEFAULT_PHASE_CURR_LIM 200
  109. #define CONFIG_MAX_FW_D_CURR 100.0F //d轴最大的退磁电流
  110. #elif CONFIG_MOT_TYPE==MOTOR_3505
  111. //编码器电机 3505
  112. #define MOTOR_R 0.08f
  113. #define MOTOR_Ld 0.000032f
  114. #define MOTOR_Lq 0.000032f
  115. #define MOTOR_POLES 10
  116. #define CONFIG_MAX_MOTOR_CURR 20.0F
  117. #define TRQ_PI_KP 0.14F
  118. #define TRQ_PI_KI 0.15F
  119. #define MOTOR_NR 0x15
  120. #define CONFIG_CURRENT_BANDWITH 1000.0f /* 电流环带宽 */
  121. #endif
  122. #endif /* _MOTOR_PARAM_H__ */