Protect.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #ifndef __Protect_H_
  2. #define __Protect_H_
  3. #include "FU68xx_5.h"
  4. #include <Myproject.h>
  5. typedef enum
  6. {
  7. FaultNoSource = 0, // 无故障
  8. FaultHardOVCurrent = 1, // 硬件过流
  9. FaultSoftOVCurrent = 2, // 软件过流
  10. FaultUnderVoltage = 3, // 欠压保护 OK
  11. FaultOverVoltage = 4, // 过压保护 OK
  12. FaultLossPhase = 5, // 缺相保护
  13. FaultStall = 6, // 堵转保护
  14. FaultStart = 7, // 启动保护 NO
  15. FaultPFC = 8, // PFC保护
  16. FaultIpmTemp = 9, // IPM温度保护 OK
  17. Faultcummution = 10, // 通信保护
  18. FaultIbusOffset = 11, //pianzhi
  19. FaultGuanTempSensor = 12, //pianzhi
  20. FaultHuanTempSensor = 13, //pianzhi
  21. FaultshuruLoss = 14,
  22. } FaultStateType;
  23. typedef enum
  24. {
  25. PFCFaultNoSource = 0, // 无故障
  26. PFCFaultHardOVCurrent = 1, // 硬件过流
  27. PFCFaultOverVoltage = 2, // 过压保护
  28. PFCFaultIbusOffset = 3,
  29. } PFCFaultStateType;
  30. typedef struct
  31. {
  32. uint16 IbusOffsetRecoverCnt; ///偏执电压保护恢复时间
  33. uint16 OverVoltDetecCnt; // 过压检测计数
  34. uint16 UnderVoltDetecCnt; // 欠压检测计数
  35. uint16 VoltRecoverCnt; // 过压恢复计数
  36. uint8 IbusOffsetProtectTimes; //偏执电压保护次数
  37. uint16 CurrentGP03Count;
  38. }PFCFaultVarible;
  39. typedef struct
  40. {
  41. uint16 SecondStartTimes; // 二次启动保护的次数
  42. uint16 StallTimes; // 堵转保护次数
  43. uint16 LossPHTimes; // 缺相保护次数
  44. uint16 CurrentPretectTimes; // 过流保护次数
  45. uint8 StartFlag; // 启动保护的标志位,用于判断哪个方法起作用
  46. uint8 StallFlag; // 堵转保护的标志位,用于判断哪个方法起作用
  47. uint8 IbusOffsetProtectTimes; //偏执电压保护次数
  48. uint8 shurulossTimes;
  49. }ProtectVarible;
  50. typedef struct
  51. {
  52. uint8 segment; // 分段执行
  53. //voltage protect
  54. uint16 OverVoltDetecCnt; // 过压检测计数
  55. uint16 UnderVoltDetecCnt; // 欠压检测计数
  56. uint16 VoltRecoverCnt; // 过压恢复计数
  57. uint16 OverTempDetecCnt; // 过温检测计数
  58. uint16 OverHuantempDetecCnt; // 过温检测计数
  59. uint16 OverGuantempDetecCnt; // 过温检测计数
  60. uint16 TempRecoverCnt; // 过温恢复计数
  61. uint16 HuantempRecoverCnt; // 过温恢复计数
  62. uint16 GuantempRecoverCnt; // 过温恢复计数
  63. uint32 CurrentRecoverCnt; // 过流保护恢复计数
  64. uint8 IbusOffsetRecoverCnt; ///偏执电压保护恢复次数
  65. //stall protect
  66. uint16 StallDelayCnt; // 堵转延迟判断计时
  67. uint16 StallDectEs; // method 1,与ES相关
  68. uint16 StallDectEs2; // method 1,与ES相关
  69. uint16 StallDectSpeed; // method 2,与速度相关
  70. uint32 StallReCount; // 堵转保护恢复计数
  71. //Loss Phase protect
  72. uint16 Lphasecnt; // 缺相保护计时
  73. uint16 AOpencnt ; // A缺相计数
  74. uint16 BOpencnt ; // B缺相计数
  75. uint16 COpencnt ; // C缺相计数
  76. uint16 mcLossPHRecCount; // 缺相恢复计数
  77. uint16 shurulossRecCount; // 缺相恢复计数
  78. int16 shurulossCnt;
  79. int32 CurrentASum;
  80. int32 CurrentBSum;
  81. int32 CurrentCSum;
  82. int16 CurrentAAlign;
  83. int16 CurrentBAlign;
  84. int16 CurrentCAlign;
  85. //start protect
  86. int16 StartESCount; // 启动保护判断ES的计数
  87. int16 StartEsCnt; // 启动保护判断ES的计时
  88. int16 StartDelay; // 启动保护判断ES的延迟
  89. int16 StartFocmode; // 启动保护判断FOCMODE状态的计时
  90. int16 StartSpeedCnt; // 启动保护判断速度和ES的计时
  91. uint32 commu_time;
  92. }FaultVarible;
  93. extern FaultStateType xdata mcFaultSource;
  94. extern PFCFaultStateType xdata PFCFaultSource;
  95. extern ProtectVarible xdata mcProtectTime;
  96. extern FaultVarible idata mcFaultDect;
  97. extern PFCFaultVarible idata PFCFaultDect;
  98. extern void Fault_OverUnderVoltage(void);
  99. extern void Fault_Overcurrent(void);
  100. extern void Fault_OverCurrentRecover(void);
  101. extern void Fault_Stall(void);
  102. extern void Fault_phaseloss(void);
  103. extern void Fault_IPMOverTemp(void);
  104. extern void PFCFault_OverUnderVoltage(void);
  105. extern void PFCFault_Overcurrent(void);
  106. extern void Fault_Detection(void);
  107. extern void PFCFault_Detection(void);
  108. #endif