PfcSet.h 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef __PfcSET_H_
  2. #define __PfcSET_H_
  3. #include <Myproject.h>
  4. #define PFC_ValueX(Curr_Value) (Curr_Value * PFC_RSHUNT * PFC_AMPGAIN / (HW_ADC_REF))
  5. #define PFC_Value(Curr_Value) _Q15(PFC_ValueX(Curr_Value))
  6. /*PFC参数设置------------------------------------------------------------------*/
  7. #define PFCEnable (0) // PFC使能
  8. #define PFCPWM_FREQUENCY (16.0) //80 // (kHz) 载波频率 //高频41K,低频16K
  9. #define PFCPWM_ARR (uint16)(MCU_CLOCK * 500 / PFCPWM_FREQUENCY)
  10. /*AC电压采样分压电路参数*/
  11. #define ACRV1 (420.0) // (kΩ) AC电压分压电阻1
  12. #define ACRV2 (200.0) // (kΩ) AC电压分压电阻2
  13. #define ACRV3 (3.3) // (kΩ) AC电压分压电阻3
  14. #define ACRV ((ACRV1 + ACRV2 + ACRV3) / ACRV3) // AC电压分压比
  15. #define HW_BOARD_ACVOLT_MAX (HW_ADC_REF * ACRV) // (V) ADC可测得的最大母线电压
  16. /* PFC电流采样电阻参数设置 */
  17. #define PFC_RSHUNT (0.01) //0.005
  18. #define PFC_AMPGAIN (9.56)
  19. /* PFC过流设置 */
  20. #define PFCOverCurrentProtectEnable (1) // 使能PFC过流保护
  21. #define PFCOverCurrentValue (18.0) // (A) DAC模式下的PFC过流值 19
  22. #define PFCOVERCURRENT (0) //过流
  23. #define PFCOVERCURRENTLimt (1) //限流
  24. #define PFCOverCurrentProtectMode (PFCOVERCURRENTLimt) //过流保护选择
  25. #define PFC_UDCREF_Selct (1) // 目标电压选择方式
  26. #define PFC_UDCREF_ZengL (15) // 在原基础电压上增加此值,作为PFC的目标电压值
  27. #define PFC_UDCREF _Q15(350.0 / HW_BOARD_VOLT_MAX) //PFC目标电压
  28. #define PFC_UDCREF_Max _Q15(380.0 / HW_BOARD_VOLT_MAX) //PFC目标电压最大值
  29. #define PFC_UDCREF_Min _Q15(300.0 / HW_BOARD_VOLT_MAX) //PFC目标电压最大值
  30. #define PFC_VOLTAGEPROTECT _Q15(420.0 / HW_BOARD_VOLT_MAX) //PFC交流输入保护电压
  31. #define PFC_VOLTAGEPROTECT_RECOVER _Q15(395.0 / HW_BOARD_VOLT_MAX) //PFC交流输入恢复电压
  32. #define PFC_VOLTAGEPRO_RECOVEREN (1) //保护恢复使能位
  33. #define PFC_UDCREFINC (1)
  34. #define PFC_OUTINC (2) //15
  35. /*PFC电压环PI*/
  36. #define PFC_UKP _Q10(4.003) //0.018
  37. #define PFC_UKI _Q15(0.0508) //_Q15(0.0005)
  38. #define PFC_UKPL _Q10(0.0001)
  39. #define PFC_UKIL _Q15(0.0001) //_Q15(0.0005)
  40. /*PFC电压环输出限制*/
  41. #define PFC_UOUTMAX _Q15(0.98) // 电压环最大限幅值 PFC_Value(Curr_Value)
  42. #define PFC_UOUTMIN _Q15(0.00) // 电压环最小限幅值
  43. /*PFC电流环PI*///高频适时P:5.0. I:0.1
  44. #define PFC_IKP _Q10(3.0)
  45. #define PFC_IKI _Q15(0.3)//太大,有电感啸叫 太小小功率时电压波动
  46. #define PFC_IKPL _Q10(3.0)
  47. #define PFC_IKIL _Q15(0.3)
  48. /*PFC电流环输出限制*/
  49. #define PFC_IOUTMAX _Q15(0.97) // 电流环最大限幅值
  50. #define PFC_IOUTMIN _Q15(0.00) //0.02
  51. #define KmSetValue (60)//60
  52. #define SAMPLEDIV0 (1) // UAC采样频率=载波频率
  53. #define SAMPLEDIV2 (2) // UAC采样频率=载波频率/2
  54. #define SAMPLEDIV4 (4) // UAC采样频率=载波频率/4
  55. #define SAMPLEDIV8 (8) // UAC采样频率=载波频率/8
  56. #define SAMPLEFREQ (SAMPLEDIV4)
  57. #define UAC_N (int8)(1000 * PFCPWM_FREQUENCY / (SAMPLEFREQ * 65 * 32)) // PFC载波频率/65/采样频率系数
  58. #endif