Config.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /*
  2. * Config.h
  3. *
  4. * Created on: 2019年4月23日
  5. * Author: foluswen
  6. */
  7. #ifndef CONFIG_H_
  8. #define CONFIG_H_
  9. #include <stdbool.h>
  10. typedef unsigned char byte;
  11. #define MODE_BOOT 0
  12. #define MODE_IDLE 1
  13. #define MODE_AUTHORIZING 2
  14. #define MODE_REASSIGN_CHECK 3
  15. #define MODE_REASSIGN 4
  16. #define MODE_PRECHARGE 5
  17. #define MODE_PREPARE_FOR_EV 6
  18. #define MODE_PREPARE_FOR_EVSE 7
  19. #define MODE_CHARGING 8
  20. #define MODE_TERMINATING 9
  21. #define MODE_COMPLETE 10
  22. #define MODE_ALARM 11
  23. #define MODE_FAULT 12
  24. #define MODE_RESERVATION 13
  25. #define MODE_BOOKING 14
  26. #define MODE_MAINTAIN 15
  27. #define MODE_DEBUG 16
  28. #define MODE_CCS_PRECHARGE_STEP0 17 // ready for ccs precharge processing, For D+ relay to precharge relay
  29. #define MODE_CCS_PRECHARGE_STEP1 18 // waitting for ev board inform to enter to charging, For precharge relay to D+ relay
  30. #define MODE_UPDATE 19
  31. #define GFD_WAIT 0
  32. #define GFD_PASS 1
  33. #define GFD_FAIL 2
  34. #define GFD_WARNING 3
  35. #define PRECHARGE_WAIT 0
  36. #define PRECHARGE_READY 1
  37. #define PRECHARGE_PRERELAY_PASS 2
  38. #define PRECHARGE_CHARELAY_PASS 3
  39. #define BOOTTING 0
  40. #define BOOT_COMPLETE 1
  41. #define uSEC_VAL 1000000
  42. #define mSEC_VAL 1000
  43. #define MAX_GROUP_QUANTITY 4
  44. #define MAX_PSU_MODULE_QUANTITY 62
  45. #define MAX_MODULE_PER_GROUP 12
  46. #define SM_ChargerInfoKey 3000
  47. #define SAFETY_TEST_ENABLE 0
  48. // ********** Audi ********** //
  49. // Model Name: DOYC182000D2AD
  50. // Model Name: DDYC182V0UE2AD
  51. // ********** e4you ********** //
  52. // Model Name: DKYE182000D1E4
  53. // Model Name: DXYE182E00E1E4
  54. // ********** xpeng ********** //
  55. // Model Name: DOYE362000D2XP
  56. // Model Name: DDYE362F0KE2XP
  57. // *********** BYD *********** //
  58. // Model Name: DOYE242000D2BD
  59. // Model Name: DDYE242V0UE2BD
  60. // *********** TCC *********** //
  61. // Model Name: DBYE182000D1PH
  62. enum _SYSTEM_STATUS
  63. {
  64. S_BOOTING = 0,
  65. S_IDLE,
  66. S_AUTHORIZING,
  67. S_REASSIGN_CHECK,
  68. S_REASSIGN,
  69. S_PREPARNING,
  70. S_PREPARING_FOR_EV,
  71. S_PREPARING_FOR_EVSE,
  72. S_CHARGING,
  73. S_TERMINATING,
  74. S_COMPLETE,
  75. S_ALARM,
  76. S_FAULT,
  77. S_RESERVATION,
  78. S_BOOKING,
  79. S_MAINTAIN,
  80. S_DEBUG,
  81. S_CCS_PRECHARGE_ST0,
  82. S_CCS_PRECHARGE_ST1,
  83. S_UPDATE,
  84. S_NONE,
  85. };
  86. enum _AC_SYSTEM_STATUS
  87. {
  88. AC_SYS_NONE = 0,
  89. AC_SYS_A,
  90. AC_SYS_B,
  91. AC_SYS_C,
  92. AC_SYS_D,
  93. AC_SYS_E
  94. };
  95. #define STR_GUN_TYPE_CHADEMO "CHAdeMO"
  96. #define STR_GUN_TYPE_CCS "CCS"
  97. #define STR_GUN_TYPE_GBT "GBT"
  98. #define STR_GUN_TYPE_AC "AC"
  99. #define STR_GUN_TYPE_UNKNOWN "Unknown Type"
  100. enum _GUN_TYPE
  101. {
  102. _Type_Chademo = 0,
  103. _Type_CCS_2,
  104. _Type_GB,
  105. _Type_AC,
  106. _Type_Unknown = 0xFF
  107. };
  108. enum _LCM_INDEX
  109. {
  110. _LCM_INIT = 0x00,
  111. _LCM_IDLE = 0x01,
  112. _LCM_AUTHORIZING = 0x02,
  113. _LCM_AUTHORIZ_COMP = 0x03,
  114. _LCM_AUTHORIZ_FAIL = 0x04,
  115. _LCM_WAIT_FOR_PLUG = 0x05,
  116. _LCM_PRE_CHARGE = 0x06,
  117. _LCM_CHARGING = 0x07,
  118. _LCM_COMPLETE = 0x08,
  119. _LCM_FIX = 0x09,
  120. _LCM_NONE = 0xFF,
  121. };
  122. enum _DispenserAuthorizeStatus
  123. {
  124. _AuthorizeStatus_Idle = 0x00,
  125. _AuthorizeStatus_Wait = 0x01,
  126. _AuthorizeStatus_Busy = 0x02,
  127. _AuthorizeStatus_Done = 0x03,
  128. _AuthorizeStatus_End = 0x04,
  129. };
  130. enum _ConnectorAuthorizeResult
  131. {
  132. _AuthResult_None = 0x00,
  133. _AuthResult_Valid = 0x01,
  134. _AuthResult_Invalid = 0x02,
  135. };
  136. enum _AuthorizedType
  137. {
  138. _AuthType_None = 0x00,
  139. _AuthType_RFID = 0x01,
  140. _AuthType_RemoteStart = 0x02,
  141. };
  142. enum _SELF_TEST_SEQ
  143. {
  144. _STEST_VERSION = 0x00,
  145. _STEST_AC_CONTACTOR = 0x01,
  146. _STEST_PSU_DETECT = 0x02,
  147. _STEST_PSU_CAP = 0x03,
  148. _STEST_FAIL = 0x04,
  149. _STEST_COMPLETE = 0xEE,
  150. };
  151. enum _MODULE_PSU_WORK_STEP
  152. {
  153. INITIAL_START = 0,
  154. GET_PSU_COUNT = 1,
  155. Get_PSU_LOCATION = 2,
  156. Get_PSU_VERSION = 3,
  157. PSU_COUNT_CONFIRM = 4,
  158. GET_SYS_CAP = 5,
  159. BOOTING_COMPLETE = 6,
  160. _WORK_CHARGING = 10,
  161. _TEST_MODE = 20,
  162. _NO_WORKING = 254,
  163. _INIT_PSU_STATUS = 255
  164. };
  165. enum _OFFLINE_POLICY
  166. {
  167. _OFFLINE_POLICY_LOCAL_LIST = 0x00,
  168. _OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
  169. _OFFLINE_POLICY_FREE_CHARGING = 0x02,
  170. _OFFLINE_POLICY_NO_CHARGING = 0x03,
  171. };
  172. enum _REASSIGNED_RESOURCE_STEP
  173. {
  174. _REASSIGNED_NONE = 0, //
  175. _REASSIGNED_PREPARE_M_TO_A = 1, // 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
  176. _REASSIGNED_GET_NEW_CAP = 2, // 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
  177. _REASSIGNED_ADJUST_M_TO_A = 3, // 模塊重新分配完成
  178. _REASSIGNED_RELAY_M_TO_A = 4, // 切斷橋接的 Relay
  179. _REASSIGNED_PREPARE_A_TO_M = 11,
  180. _REASSIGNED_ADJUST_A_TO_M = 12, // 模塊升壓
  181. _REASSIGNED_RELAY_A_TO_M = 13, // 搭接橋接的 Relay
  182. _REASSIGNED_WAITING = 14,
  183. _REASSIGNED_COMP = 15
  184. };
  185. enum _MAIN_CHARGING_MODE
  186. {
  187. _MAIN_CHARGING_MODE_MAX = 0,
  188. _MAIN_CHARGING_MODE_AVER = 1,
  189. };
  190. enum _EXTRA_ERR_PROCESS
  191. {
  192. _EXTRA_ERR_PROCESS_NONE = 0,
  193. _EXTRA_ERR_PROCESS_INUVP = 1,
  194. _EXTRA_ERR_PROCESS_INOVP = 2,
  195. _EXTRA_ERR_PROCESS_PRIMARY = 3,
  196. };
  197. enum _CHARGER_TYPE
  198. {
  199. _CHARGER_TYPE_IEC = 0,
  200. _CHARGER_TYPE_UL = 1,
  201. };
  202. enum _SYS_WIFI_MODE
  203. {
  204. _SYS_WIFI_MODE_DISABLE = 0,
  205. _SYS_WIFI_MODE_STATION = 1,
  206. _SYS_WIFI_MODE_AP = 2
  207. };
  208. enum _LED_INTENSITY_LV
  209. {
  210. _LED_INTENSITY_DARKEST = 0,
  211. _LED_INTENSITY_MEDIUM = 1,
  212. _LED_INTENSITY_BRIGHTEST = 2
  213. };
  214. enum _CCS_COMM_PROTOCOL
  215. {
  216. _CCS_COMM_V2GMessage_DIN70121 = 0x01,
  217. _CCS_COMM_V2GMessage_ISO15118_2014 = 0x02,
  218. _CCS_COMM_V2GMessage_ISO15118_2018 = 0x03
  219. };
  220. enum _ETHERNET_USAGE
  221. {
  222. _ETHERNET_USAGE_NONE = 0,
  223. _ETHERNET_USAGE_LAN,
  224. _ETHERNET_USAGE_WIFI,
  225. _ETHERNET_USAGE_3G_4g
  226. };
  227. enum _CONN_STATUS
  228. {
  229. _Connnection_Disable = 0,
  230. _Connnection_Connected = 1,
  231. _Connnection_Disconnected = 2,
  232. };
  233. enum _LED_INDICATION_STATUS
  234. {
  235. _LED_INDICATION_OFF = 0, // all led off
  236. _LED_INDICATION_RUN = 1, // green led on, red led off
  237. _LED_INDICATION_FAULT = 2, // green led off, red led on
  238. _LED_INDICATION_ON = 3, // all led on
  239. _LED_INDICATION_GREEN_TOGGLE = 4, // green led toggle
  240. _LED_INDICATION_RED_TOGGLE = 5, // red led toggle
  241. };
  242. enum _STANDARD_INDICATION_STATUS
  243. {
  244. _STANDARD_LED_None = 0,
  245. _STANDARD_LED_Disconnection = 1,
  246. _STANDARD_LED_Running = 2,
  247. _STANDARD_LED_Alarm = 3,
  248. };
  249. enum _E4YOU_INDICATION_STATUS
  250. {
  251. _E4YOU_LED_None = 0,
  252. _E4YOU_LED_Disconnection = 1,
  253. _E4YOU_LED_Idle = 2,
  254. _E4YOU_LED_Charging = 3,
  255. _E4YOU_LED_Alarm = 4,
  256. };
  257. enum _QR_MODE
  258. {
  259. _QR_MODE_Default = 0,
  260. _QR_MODE_Customized = 1,
  261. _QR_MODE_ChargeBoxId = 2, // for audi
  262. };
  263. typedef union
  264. {
  265. unsigned int CtrlValue;
  266. struct
  267. {
  268. unsigned int NeedSoftReset:1; // 0: no effect, 1: system need soft reset
  269. unsigned int NeedHardReset:1; // 0: no effect, 1: system need hard reset
  270. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  271. unsigned int PrimaryDisable:1; // 0: primary enable, 1: primary disable
  272. unsigned int RelayBoardDisable:1; // 0: relay board enable, 1: relay board disable
  273. unsigned int FanBoardDisable:1; // 0: fan board enable, 1: fan board disable
  274. unsigned int LedBoardDisable:1; // 0: led board enable, 1: led board disable
  275. unsigned int SecondRelayBoardEnable:1; // 0: second relay disable, 1: second relay enable
  276. unsigned int StandardLedIndication:1; // 0: no led indication, 1: enable standard led indication
  277. unsigned int E4YOULedIndication:1; // 0: no led indication, 1: enable e4you led indication
  278. unsigned int BackendEnable:1; // 0: backend disable, 1: backend enable
  279. unsigned int Wifi4gResetEnable:1; // 0: wifi/4g reset io disable, 1: wifi/4g reset io enable
  280. unsigned int res:20;
  281. }bits;
  282. }SystemControl;
  283. typedef union
  284. {
  285. unsigned int CtrlValue;
  286. struct
  287. {
  288. unsigned int DisableBalance:1; // 0: no effect, 1: disable announce balance
  289. unsigned int FastStandbyTime:1; // 0: no effect, 1: enable fast standby time
  290. unsigned int ChargingSimulation:1; // 0: no effect, 1: enable charging simulation
  291. unsigned int res:29;
  292. }bits;
  293. }TestControl;
  294. typedef union
  295. {
  296. unsigned int CtrlValue;
  297. struct
  298. {
  299. unsigned int MsgMain:1; // 0: no effect, 1: enable debug message in main
  300. unsigned int MsgPrimaryComm:1; // 0: no effect, 1: enable debug message in primary comm
  301. unsigned int MsgPsu:1; // 0: no effect, 1: enable debug message in psu
  302. unsigned int MsgEvComm:1; // 0: no effect, 1: enable debug message in ev comm
  303. unsigned int MsgInternalComm:1; // 0: no effect, 1: enable debug message in internal comm
  304. unsigned int res:27;
  305. }bits;
  306. }DebugControl;
  307. typedef union
  308. {
  309. unsigned int CtrlValue;
  310. struct
  311. {
  312. unsigned int EnableForceCharging:1; // 0: disable, 1: enable force charging
  313. unsigned int StartForceCharging:1; // 0: disable, 1: start force charging
  314. unsigned int res:30;
  315. }bits;
  316. }ForceChargingControl;
  317. typedef struct
  318. {
  319. ForceChargingControl FCtrl;
  320. unsigned short FTargetVoltage; // target voltage, unit: 0.1V
  321. unsigned short FTargetCurrent; // target current, unit: 0.1A
  322. }ForceCharging;
  323. typedef union
  324. {
  325. unsigned int AuthFlag;
  326. struct
  327. {
  328. unsigned int AutoStartEnable:1; // 0: disable, 1: enable auto charging after plug in
  329. unsigned int APPEnable:1; // 0: disable, 1: app auth enable
  330. unsigned int QRCodeEnable:1; // 0: disable, 1: qr code auth enable
  331. unsigned int RFIDEnable:1; // 0: disable, 1: rfid auth enable
  332. unsigned int res:24;
  333. }bits;
  334. }AuthModeInfo;
  335. typedef struct
  336. {
  337. AuthModeInfo AuthMode;
  338. unsigned char QRCodeMode; // 0: default, 1: customized, 2: audi type
  339. unsigned char res[3];
  340. }SystemAuthInfoData;
  341. typedef union
  342. {
  343. unsigned int CtrlValue;
  344. struct
  345. {
  346. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  347. unsigned int DisableDoorSensor:1; // 0: door sensor enable, 1: door sensor disable
  348. unsigned int DisableEmergencyButton:1; // 0: emergency button enable, 1: emergency button disable
  349. unsigned int DoorSensorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  350. unsigned int AcContactorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  351. unsigned int res:27;
  352. }bits;
  353. }PrimaryControl;
  354. typedef union
  355. {
  356. unsigned int CtrlValue;
  357. struct
  358. {
  359. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  360. unsigned int AcContactor:1; // 0: ac contactor off, 1: ac contactor on
  361. unsigned int AcContactorOffByPsu:1; // 0: no effect, 1: ac contactor off
  362. unsigned int AcContactorOffByEmergency:1; // 0: no effect, 1: ac contactor off
  363. unsigned int StandbyCountdown:1; // 0: charger is using, 1: start countdown
  364. unsigned int AcInputDisable:1; // 0: ac input enable, 1: ac input disable
  365. unsigned int DcInputEnable:1; // 0: dc input disable, 1: dc input enable
  366. unsigned int res:25;
  367. }bits;
  368. }RelayControl;
  369. typedef union
  370. {
  371. unsigned int CtrlValue;
  372. struct
  373. {
  374. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  375. unsigned int res:31;
  376. }bits;
  377. }FanControl;
  378. typedef union
  379. {
  380. unsigned int CtrlValue;
  381. struct
  382. {
  383. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  384. unsigned int res:31;
  385. }bits;
  386. }LedFanControl;
  387. typedef union
  388. {
  389. unsigned int CtrlValue;
  390. struct
  391. {
  392. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  393. unsigned int FailureResume:1; // 0: no error, 1: psu failure, need resume
  394. unsigned int res:30;
  395. }bits;
  396. }PsuControl;
  397. typedef struct
  398. {
  399. unsigned char MaxDispenser;
  400. unsigned char MaxConnector;
  401. unsigned char CabinetSwitch;
  402. unsigned char reserved;
  403. SystemControl SysCtrl;
  404. TestControl TestCtrl;
  405. DebugControl DebugCtrl;
  406. PrimaryControl PrimaryCtrl;
  407. RelayControl RelayCtrl;
  408. FanControl FanCtrl;
  409. LedFanControl LedCtrl;
  410. PsuControl PsuCtrl;
  411. ForceCharging FCharging[MAX_GROUP_QUANTITY];
  412. }SysControl;
  413. // ************************************************************************************************* //
  414. typedef struct
  415. {
  416. bool CheckIn;
  417. unsigned char Address;
  418. unsigned char GroupNo;
  419. unsigned char GIndex;
  420. }PsuAddressInfoData;
  421. typedef struct
  422. {
  423. unsigned char GroupPsuQuantity;
  424. unsigned char PsuSN[MAX_MODULE_PER_GROUP];
  425. }GroupInfoData;
  426. typedef struct
  427. {
  428. bool PsuLocationInit;
  429. bool ReInitPsuLocation;
  430. unsigned char TotalPsuQuantity;
  431. GroupInfoData GroupLocationInfo[MAX_GROUP_QUANTITY];
  432. PsuAddressInfoData PsuAddressInfo[MAX_PSU_MODULE_QUANTITY];
  433. }PsuPositionInfoData;
  434. // ************************************************************************************************* //
  435. typedef enum
  436. {
  437. _GROLE_IDLE = 0,
  438. _GROLE_MASTER = 1,
  439. _GROLE_SLAVE = 2,
  440. _GROLE_PREPARE_SWITCH_OFF = 10, // reduce output current capability
  441. _GROLE_SLAVE_POWER_OFF = 11, // power off
  442. _GROLE_SWITCH_OFF_OK = 12, // power off completed
  443. _GROLE_WAIT_IDLE = 13, // wait a while to change to idle, open parallel relay at this state
  444. _GROLE_WAIT_SLAVE = 14, // wait a while to change to slave
  445. _GROLE_PREPARE_ATTACH_ON = 20, // raise voltage to master output voltage
  446. _GROLE_PRECHARGE_READY = 21, // extend pre-charge ready
  447. _GROLE_EXTEND_STOP = 22, // extend capability stop
  448. _GROLE_REQUEST_TO_CHARGING = 30,
  449. _GROLE_TERMINATE = 40,
  450. _GROLE_WAIT_TERMINATED = 41,
  451. _GROLE_NONE = 99,
  452. }_GROUP_ROLE;
  453. typedef union
  454. {
  455. unsigned int CtrlValue[6];
  456. struct
  457. {
  458. unsigned int IdleCtrlValue;
  459. unsigned int MasterCtrlValue;
  460. unsigned int StopChargingCtrlValue;
  461. unsigned int DeratingCtrlValue;
  462. unsigned int ExtendCapabilityCtrlValue;
  463. unsigned int SlaveCtrlValue;
  464. }RoleCtrl;
  465. struct
  466. {
  467. // IdleCtrlValue
  468. unsigned int ChargingRequest:1; // 0: no effect, 1: charging request from main.c
  469. unsigned int ChargingRequestConfirmed:1; // 0: no effect, 1: request confirmed by psu task
  470. unsigned int GroupShareCheck:1; // 0: no effect, 1: check is there any psu can share
  471. unsigned int ShareConfirmed:1; // 0: no effect, 1: psu share confirmed
  472. unsigned int GrabGroupWait:1; // 0: no effect, 1: need to wait grab psu
  473. unsigned int ShareCheckDone:1; // 0: no effect, 1: psu share completed
  474. unsigned int FindGroupPartner:1; // 0: no effect, 1: find available group partner
  475. unsigned int ParallelRelayOn:1; // 0: no effect, 1: set parallel relay on
  476. unsigned int ParallelRelayConfirmed:1; // 0: no effect, 1: parallel relay confirmed
  477. unsigned int GroupingDone:1; // 0: no effect, 1: grouping completed
  478. unsigned int IdleCtrlRes:22;
  479. // MasterCtrlValue
  480. unsigned int CableCheckDone:1; // 0: no effect, 1: CableCheck done
  481. unsigned int InPrechargeMode:1; // 0: no effect, 1: system status in PreCharge mode
  482. unsigned int AlreadyInChargingMode:1; // 0: no effect, 1: system status ever enter charging mode
  483. unsigned int ExtendAvailable:1; // 0: no effect, 1: extend capability is available
  484. unsigned int NeedCurrentBalance:1; // 0: no effect, 1: need to current balance
  485. unsigned int OutputCurrentStable:1; // 0: no effect, 1: output current is stable
  486. unsigned int ReachMaxCurrentDemand:1; // 0: no effect, 1: reach ev max current demand
  487. unsigned int ReachMaxStageCurrent:1; // 0: no effect, 1: reach ev max stage current
  488. unsigned int MasterCtrlRes:24;
  489. // StopChargingCtrlValue
  490. unsigned int StopChargingRequest:1; // 0: no effect, 1: master need to stop
  491. unsigned int StopChargingConfirmed:1; // 0: no effect, 1: stop charging confirmed
  492. unsigned int AllPowerOffDone:1; // 0: no effect, 1: all member power off done
  493. unsigned int AllParallelRelayOff:1; // 0: no effect, 1: all member's parallel relay off
  494. unsigned int AllParallelRelayConfirmed:1; // 0: no effect, 1: all member's parallel relay off confirmed
  495. unsigned int AllMemberStopCompleted:1; // 0: no effect, 1: all member stop completed
  496. unsigned int StopChargingCompleted:1; // 0: no effect, 1: stop charging completed
  497. unsigned int StopChargingCtrlRes:25;
  498. // DeratingCtrlValue
  499. unsigned int NeedDerating:1; // 0: no effect, 1: need derating
  500. unsigned int DeratingConfirmed:1; // 0: no effect, 1: derating confirmed
  501. unsigned int DeratingStart:1; // 0: no effect, 1: derating start
  502. unsigned int DeratingPowerOffDone:1; // 0: no effect, 1: derating member power off done
  503. unsigned int DeratingRelayOff:1; // 0: no effect, 1: set derating member parallel relay off
  504. unsigned int DeratingRelayConfirmed:1; // 0: no effect, 1: derating member parallel relay confirmed
  505. unsigned int DeratingCompleted:1; // 0: no effect, 1: derating completed
  506. unsigned int DeratingCtrlRes:25;
  507. // ExtendCapabilityCtrlValue
  508. unsigned int MorePowerRequest:1; // 0: no effect, 1: need to request more psu
  509. unsigned int MorePowerConfirmed:1; // 0: no effect, 1: request more psu confirmed
  510. unsigned int ExtendPrecharge:1; // 0: no effect, 1: extend group need to pre-charge
  511. unsigned int ExtendPrechargeDone:1; // 0: no effect, 1: extend group pre-charge completed
  512. unsigned int ExtendRelayOn:1; // 0: no effect, 1: extend group parallel relay on
  513. unsigned int ExtendRelayConfirmed:1; // 0: no effect, 1: extend group parallel relay confirmed
  514. unsigned int ExtendCompleted:1; // 0: no effect, 1: extend capability completed
  515. unsigned int ExtendCapabilityCtrlRes:25;
  516. // SlaveCtrlValue
  517. unsigned int SlaveChargingRequest:1; // 0: no effect, 1: request slave to charging after power off
  518. unsigned int CheckSlaveReady:1; // 0: no effect, 1: check if slave is ready
  519. unsigned int WaitSlaveReady:1; // 0: no effect, 1: wait slave is ready
  520. unsigned int SlavePowerOffRequest:1; // 0: no effect, 1: request slave to power off
  521. unsigned int SlavePowerOffConfirmed:1; // 0: no effect, 1: slave power off confirmed
  522. unsigned int SlaveCtrlRes:27;
  523. }bits;
  524. }PsuGroupControl;
  525. typedef struct
  526. {
  527. unsigned char Quantity;
  528. unsigned char RealQuantity;
  529. unsigned char Member[MAX_GROUP_QUANTITY]; // record slave group index
  530. }PsuGroupPartner;
  531. typedef struct
  532. {
  533. unsigned char Index;
  534. unsigned char Role;
  535. unsigned char PreRole;
  536. unsigned char Location;
  537. PsuGroupPartner Partner; // record slave group information
  538. PsuGroupPartner PossibleMember; // record possible slave group information
  539. unsigned char TargetGroup; // target group index + 1
  540. unsigned char ReservedTarget; // reserved target group index + 1
  541. PsuGroupControl GroupCtrl;
  542. unsigned short ReAssignAvailableCurrent; // group available current when reassign, unit: 0.1A
  543. unsigned short ParallelCheck;
  544. unsigned char ParallelConfig[MAX_GROUP_QUANTITY]; // group parallel relay setting
  545. unsigned short GunLoading; // gun output loading, unit: 0.01%
  546. unsigned char GunPsuQuantity; // record psu quantity at this gun
  547. unsigned char res;
  548. }PsuGroupCollectionData;
  549. typedef struct
  550. {
  551. unsigned short GTargetVoltage; // group target voltage config, unit: 0.1V
  552. unsigned short GTargetCurrent; // group target current config, unit: 0.1A
  553. unsigned short OutputLoading; // group output loading, unit: 0.01%
  554. }GroupOutputConfigInfo;
  555. typedef union
  556. {
  557. unsigned short CtrlValue;
  558. struct
  559. {
  560. unsigned short Output_N:1; // 0: set Output_N off, 1: set Output_N on
  561. unsigned short Output_P:1; // 0: set Output_P off, 1: set Output_P on
  562. unsigned short res:14;
  563. }bits;
  564. }PsuGroupOutputRelay;
  565. typedef union
  566. {
  567. unsigned short CtrlValue;
  568. struct
  569. {
  570. unsigned short Location_1_2:1; // 0: set parallel off, 1: set parallel on
  571. unsigned short Location_2_3:1; // 0: set parallel off, 1: set parallel on
  572. unsigned short Location_3_4:1; // 0: set parallel off, 1: set parallel on
  573. unsigned short res:13;
  574. }bits;
  575. }PsuGroupParallelRelay;
  576. typedef struct
  577. {
  578. byte Location[MAX_GROUP_QUANTITY];
  579. byte Layout[MAX_GROUP_QUANTITY];
  580. PsuGroupCollectionData GroupCollection[MAX_GROUP_QUANTITY];
  581. GroupOutputConfigInfo GroupOutput[MAX_GROUP_QUANTITY];
  582. PsuGroupOutputRelay OutputRelayConfig[MAX_GROUP_QUANTITY];
  583. PsuGroupOutputRelay OutputRelayConfirmed[MAX_GROUP_QUANTITY];
  584. PsuGroupParallelRelay ParallelRelayConfig;
  585. PsuGroupParallelRelay ParallelRelayConfirmed;
  586. }PsuGroupingInfoData;
  587. // ************************************************************************************************* //
  588. typedef struct
  589. {
  590. SystemAuthInfoData AuthInfo;
  591. SysControl Control;
  592. PsuPositionInfoData PsuPosition;
  593. PsuGroupingInfoData PsuGrouping;
  594. }ChargerInfoData;
  595. #endif /* CONFIG_H_ */