Module_InternalComm.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef _MODULE_INTERNAL_COMM_H_
  2. #define _MODULE_INTERNAL_COMM_H_
  3. //------------------------------------------------------------------------------
  4. #define RELAY_CHECK_TIME (5) // s
  5. #define OUTPUT_VOL_CHK_TIME (200) // ms
  6. #define TEN_MINUTES (600) // s
  7. //#define TEN_MINUTES 5
  8. #define ENV_TEMP_MIN (45)
  9. #define ENV_TEMP_MAX (50)
  10. #define DEFAULT_AC_INDEX (2)
  11. #define COLOR_MAX_LV (100)
  12. #define COLOR_MIN_LV (0)
  13. #define AC_DEFAULT_VOL (220)
  14. #define NDEFAULT_AC_INDEX (2)
  15. #define OVP_UVP_CHK_COUNT (3)
  16. #define VIN_MAX_VOLTAGE_IEC (285) // 大於該值 : OVP
  17. #define VIN_MAX_REV_VOLTAGE_IEC (275) // 小於賦歸 OVP
  18. #define VIN_MIN_VOLTAGE_IEC (160) // 小於該值 : UVP
  19. #define VIN_MIN_REV_VOLTAGE_IEC (170) // 大於賦歸 UVP
  20. #define VIN_MAX_VOLTAGE_UL (315) // 大於該值 : OVP // 美規 (W)
  21. #define VIN_MAX_REV_VOLTAGE_UL (305) // 小於賦歸 OVP
  22. #define VIN_MIN_VOLTAGE_UL (210) // 小於該值 : UVP
  23. #define VIN_MIN_REV_VOLTAGE_UL (220) // 大於賦歸 UVP
  24. #define VIN_DROP_VOLTAGE (150) // 小於該值 : ac drop
  25. #define VOUT_MAX_VOLTAGE (995)
  26. #define VOUT_MIN_VOLTAGE (150)
  27. #define IOUT_MAX_CURRENT (50)
  28. #define MAX_FAN_SPEED (14000)
  29. #define MIN_FAN_SPEED (3000)
  30. #define NORMAL_FAN_SPEED (7000)
  31. // GFD Status
  32. #define GFD_IDLE (0)
  33. #define GFD_CABLECHK (1)
  34. #define GFD_PRECHARGE (2)
  35. #define GFD_CHARGING (3)
  36. // LED Intensity (rate)
  37. #define LED_INTENSITY_DARKEST (0.2)
  38. #define LED_INTENSITY_MEDIUM (0.6)
  39. #define LED_INTENSITY_BRIGHTEST (1)
  40. // EE Spec
  41. #define LED_BRIGHTNESS_LV_HIGH (1)
  42. #define LED_BRIGHTNESS_LV_MID (0.5)
  43. #define LED_BRIGHTNESS_LV_LOW (0.2)
  44. // 最小切換 Relay 電壓
  45. #define SELF_TO_CHANGE_RELAY_STATUS (600)
  46. // 透過電壓確認 Relay 是否搭上的依據電壓
  47. #define CHECK_RELAY_STATUS (300)
  48. #define CHECK_RELAY_STATUS_GAP (100)
  49. // 安全在停止充電程序中斷開 Relay 的電流
  50. #define SEFETY_SWITCH_RELAY_CUR (50)//20 DS60-120 modify
  51. // 確認 Relay Welding 電壓
  52. #define RELAY_WELDING_DET (300)
  53. #define AC_OVP (1)
  54. #define AC_UVP (2)
  55. #define AC_OCP (4)
  56. #define AC_OTP (8)
  57. #define AC_GMI_FAULT (16)
  58. #define AC_CP_ERROR (32)
  59. #define AC_AC_LEAKAGE (64)
  60. #define AC_DC_LEAKAGE (128)
  61. #define AC_SYSTEM_SELFTEST_FAULT (256)
  62. #define AC_HANDSHAKE_TIMEOUT (512)
  63. #define AC_EMC_STOP (1024)
  64. #define AC_RELAY_WELDING (2048)
  65. #define AC_GF_MODULE_FAULT (4096)
  66. #define AC_SHUTTER_FAULT (8192)
  67. #define AC_LOCKER_FAULT (16384)
  68. #define AC_POWER_DROP (32768)
  69. #define AC_CIRCUIT_SHORT (65536)
  70. #define AC_ROTARY_SWITCH_FAULT (131072)
  71. #define AC_RELAY_DRIVE_FAULT (262144)
  72. #define log_info(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  73. #define log_warn(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  74. #define log_error(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  75. //------------------------------------------------------------------------------
  76. typedef struct StGunPNState {
  77. uint8_t GunP: 1;
  78. uint8_t GunN: 1;
  79. uint8_t Reserved: 6;
  80. } GunPNState;
  81. typedef struct StPreCharginState {
  82. uint8_t AcContactor : 1; //bit 0
  83. uint8_t CcsPrecharge : 1; //bit 1
  84. uint8_t Reserved: 6;
  85. } PreChargingState;
  86. #endif /* _MODULE_INTERNAL_COMM_H_ */