CurrentDecoupledControl.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef __CURRENT_DECOUPLED_CONTROL_H_
  2. #define __CURRENT_DECOUPLED_CONTROL_H_
  3. #define DQCurrentKpKiCalEnable (1)
  4. #define CURRENT_DECOUPLED_CONTROL_LD 0.0055 //(LD)
  5. #define CURRENT_DECOUPLED_CONTROL_LQ 0.011//(LQ)
  6. #define CURRENT_DECOUPLED_CONTROL_PSI (Psi*0.9)
  7. typedef struct
  8. {
  9. int16 Omega;
  10. int16 DCurrent0;
  11. int16 QCurrent0;
  12. int16 DCurrent;
  13. int16 QCurrent;
  14. int16 DcVoltage;
  15. int16 DDutyQ15;
  16. int16 QDutyQ15;
  17. int16 DCurrentDecoupledControlK;
  18. int16 QCurrentDecoupledControlK1;
  19. int16 QCurrentDecoupledControlK2;
  20. int16 QCurrentDecoupledControlK3;
  21. int16 DVoltageComponent;
  22. int16 DVoltageComponentAbs;
  23. int16 QVoltageComponent;
  24. int16 QVoltageComponentAbs;
  25. int16 QVoltageComponent1;
  26. int16 QVoltageComponent2;
  27. }CurrentDecoupledControlTypeDef;
  28. typedef struct
  29. {
  30. int16 DCurrentKpk;
  31. int16 QCurrentKpk;
  32. int16 DCurrentKik;
  33. int16 QCurrentKik;
  34. int16 KpwmkValue;
  35. int16 DCurrentKp;
  36. int16 QCurrentKp;
  37. int16 DCurrentKi;
  38. int16 QCurrentKi;
  39. int16 KpwmValue;
  40. }DQCurrentPITypeDef;
  41. //#define D_CURRENT_DECOUPLED_CONTROL_K _Q11(MAX_OMEG_RAD_SEC * CURRENT_DECOUPLED_CONTROL_LQ * HW_BOARD_CURR_BASE / HW_BOARD_VOLTAGE_BASE)//D轴解耦系数
  42. //#define Q_CURRENT_DECOUPLED_CONTROL_K1 _Q13(MAX_OMEG_RAD_SEC * CURRENT_DECOUPLED_CONTROL_PSI / HW_BOARD_VOLTAGE_BASE)//Q轴解耦系数1
  43. //#define Q_CURRENT_DECOUPLED_CONTROL_K2 _Q11(MAX_OMEG_RAD_SEC * CURRENT_DECOUPLED_CONTROL_LD * HW_BOARD_CURR_BASE / HW_BOARD_VOLTAGE_BASE)//Q轴解耦系数2
  44. #define h (20.0)//中频带宽
  45. //#define DCurrentKi_K (uint16)(CURRENT_DECOUPLED_CONTROL_LD * (h + 1.0) / 4.5 / h / h / TPWM_VALUE)
  46. //#define DCurrentKp_K (uint16)(CURRENT_DECOUPLED_CONTROL_LD * (h + 1.0) / 3.0 / h / TPWM_VALUE)
  47. //#define QCurrentKi_K (uint16)(CURRENT_DECOUPLED_CONTROL_LQ * (h + 1.0) / 4.5 / h / h / TPWM_VALUE)
  48. //#define QCurrentKp_K (uint16)(CURRENT_DECOUPLED_CONTROL_LQ * (h + 1.0) / 3.0 / h / TPWM_VALUE)
  49. //#define Kpwmk (uint16)(HW_BOARD_VOLTAGE_BASE / HW_BOARD_CURR_BASE)//逆变器增益系数
  50. extern CurrentDecoupledControlTypeDef xdata mcCurrentDecoupledControl;
  51. extern DQCurrentPITypeDef xdata DQCurrentPI;
  52. extern void CurrentDecoupledControlFunction(void);
  53. //extern void CurrentDecoupledControlFunctionInit(void);
  54. extern void DQCurrentKpKiCal(void);
  55. extern void CurrentDecoupledControlFunctionInit(float MotorLd , float MotorLq , float MotorPsi , float VoltageBase , float CurrentBase , float OmegaRadSec);
  56. extern void DQCurrentKpKiCalInit(float MotorLd , float MotorLq , float Ts , float VoltageBase , float CurrentBase , float hValue);
  57. #endif