123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857 |
- /*
- * Config.h
- *
- * Created on: 2019年4月23日
- * Author: foluswen
- */
- #ifndef CONFIG_H_
- #define CONFIG_H_
- #include <stdbool.h>
- typedef unsigned char byte;
- #define MODE_BOOT 0
- #define MODE_IDLE 1
- #define MODE_AUTHORIZING 2
- #define MODE_REASSIGN_CHECK 3
- #define MODE_REASSIGN 4
- #define MODE_PRECHARGE 5
- #define MODE_PREPARE_FOR_EV 6
- #define MODE_PREPARE_FOR_EVSE 7
- #define MODE_CHARGING 8
- #define MODE_TERMINATING 9
- #define MODE_COMPLETE 10
- #define MODE_ALARM 11
- #define MODE_FAULT 12
- #define MODE_RESERVATION 13
- #define MODE_BOOKING 14
- #define MODE_MAINTAIN 15
- #define MODE_DEBUG 16
- #define MODE_CCS_PRECHARGE_STEP0 17 // ready for ccs precharge processing, For D+ relay to precharge relay
- #define MODE_CCS_PRECHARGE_STEP1 18 // waitting for ev board inform to enter to charging, For precharge relay to D+ relay
- #define MODE_UPDATE 19
- #define GFD_WAIT 0
- #define GFD_PASS 1
- #define GFD_FAIL 2
- #define GFD_WARNING 3
- #define PRECHARGE_WAIT 0
- #define PRECHARGE_READY 1
- #define PRECHARGE_PRERELAY_PASS 2
- #define PRECHARGE_CHARELAY_PASS 3
- #define BOOTTING 0
- #define BOOT_COMPLETE 1
- #define uSEC_VAL 1000000
- #define mSEC_VAL 1000
- #define MAX_GROUP_QUANTITY 4
- #define MAX_PSU_MODULE_QUANTITY 62
- #define MAX_MODULE_PER_GROUP 12
- #define SM_ChargerInfoKey 3000
- #define SAFETY_TEST_ENABLE 0
- #define MAX_SLAVE_CABINET_QUANTITY 4
- #define MASTER_ETH1_IP "192.168.100.1"
- #define MASTER_ETH1_SUBMASK "255.255.255.0"
- #define SLAVE_ETH1_IP "192.168.0.10"
- #define SLAVE_ETH1_SUBMASK "255.255.255.0"
- #define AUTHORIZE_COMPLETED_TIME 3
- #define STARTTRANSATION_IMMEDIATELY
- // ********** Audi ********** //
- // Model Name: DOYC182000D2AD
- // Model Name: DDYC182V0UE2AD
- // ********** e4you ********** //
- // Model Name: DKYE182000D1E4
- // Model Name: DXYE182E00E1E4
- // ********** xpeng ********** //
- // Model Name: DOYE362000D2XP
- // Model Name: DDYE362F0KE2XP
- // *********** BYD *********** //
- // Model Name: DOYE242000D2BD
- // Model Name: DDYE242V0UE2BD
- // *********** TCC *********** //
- // Model Name: DBYE182000D1PH
- // Model Name: DBYC182000D1TC
- // Model Name: DDYC182V0EE1TC
- #define STR_LITTLE_ENDIAN "Little Endian"
- #define STR_BIG_ENDIAN "Big Endian"
- enum _SYSTEM_STATUS
- {
- S_BOOTING = 0,
- S_IDLE,
- S_AUTHORIZING,
- S_REASSIGN_CHECK,
- S_REASSIGN,
- S_PREPARNING,
- S_PREPARING_FOR_EV,
- S_PREPARING_FOR_EVSE,
- S_CHARGING,
- S_TERMINATING,
- S_COMPLETE,
- S_ALARM,
- S_FAULT,
- S_RESERVATION,
- S_BOOKING,
- S_MAINTAIN,
- S_DEBUG,
- S_CCS_PRECHARGE_ST0,
- S_CCS_PRECHARGE_ST1,
- S_UPDATE,
- S_NONE,
- };
- enum _AC_SYSTEM_STATUS
- {
- AC_SYS_NONE = 0,
- AC_SYS_A,
- AC_SYS_B,
- AC_SYS_C,
- AC_SYS_D,
- AC_SYS_E
- };
- #define STR_GUN_TYPE_CHADEMO "CHAdeMO"
- #define STR_GUN_TYPE_CCS "CCS"
- #define STR_GUN_TYPE_GBT "GBT"
- #define STR_GUN_TYPE_AC "AC"
- #define STR_GUN_TYPE_UNKNOWN "Unknown Type"
- enum _GUN_TYPE
- {
- _Type_Chademo = 0,
- _Type_CCS_2,
- _Type_GB,
- _Type_AC,
- _Type_Unknown = 0xFF
- };
- enum _LCM_INDEX
- {
- _LCM_INIT = 0x00,
- _LCM_IDLE = 0x01,
- _LCM_AUTHORIZING = 0x02,
- _LCM_AUTHORIZ_COMP = 0x03,
- _LCM_AUTHORIZ_FAIL = 0x04,
- _LCM_WAIT_FOR_PLUG = 0x05,
- _LCM_PRE_CHARGE = 0x06,
- _LCM_CHARGING = 0x07,
- _LCM_COMPLETE = 0x08,
- _LCM_FIX = 0x09,
- _LCM_NONE = 0xFF,
- };
- enum _DispenserAuthorizeStatus
- {
- _AuthorizeStatus_Idle = 0x00,
- _AuthorizeStatus_Wait = 0x01,
- _AuthorizeStatus_Busy = 0x02,
- _AuthorizeStatus_Done = 0x03,
- _AuthorizeStatus_End = 0x04,
- };
- enum _ConnectorAuthorizeResult
- {
- _AuthResult_None = 0x00,
- _AuthResult_Valid = 0x01,
- _AuthResult_Invalid = 0x02,
- };
- enum _AuthorizedType
- {
- _AuthType_None = 0x00,
- _AuthType_RFID = 0x01,
- _AuthType_RemoteStart = 0x02,
- };
- enum _SELF_TEST_SEQ
- {
- _STEST_VERSION = 0x00,
- _STEST_CabinetSwitch = 0x01,
- _STEST_AC_CONTACTOR = 0x02,
- _STEST_PSU_DETECT = 0x03,
- _STEST_PSU_CAP = 0x04,
- _STEST_PSU_RETRY = 0x05,
- _STEST_EMG_BTN = 0x06,
- _STEST_FAIL = 0x07,
- _STEST_COMPLETE = 0xEE,
- };
- enum _MODULE_PSU_WORK_STEP
- {
- INITIAL_START = 0,
- GET_PSU_COUNT = 1,
- Get_PSU_LOCATION = 2,
- Get_PSU_VERSION = 3,
- PSU_COUNT_CONFIRM = 4,
- GET_SYS_CAP = 5,
- BOOTING_COMPLETE = 6,
- _WORK_CHARGING = 10,
- _TEST_MODE = 20,
- _NO_WORKING = 254,
- _INIT_PSU_STATUS = 255
- };
- enum _OFFLINE_POLICY
- {
- _OFFLINE_POLICY_LOCAL_LIST = 0x00,
- _OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
- _OFFLINE_POLICY_FREE_CHARGING = 0x02,
- _OFFLINE_POLICY_NO_CHARGING = 0x03,
- };
- enum _REASSIGNED_RESOURCE_STEP
- {
- _REASSIGNED_NONE = 0, //
- _REASSIGNED_PREPARE_M_TO_A = 1, // 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
- _REASSIGNED_GET_NEW_CAP = 2, // 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
- _REASSIGNED_ADJUST_M_TO_A = 3, // 模塊重新分配完成
- _REASSIGNED_RELAY_M_TO_A = 4, // 切斷橋接的 Relay
- _REASSIGNED_PREPARE_A_TO_M = 11,
- _REASSIGNED_ADJUST_A_TO_M = 12, // 模塊升壓
- _REASSIGNED_RELAY_A_TO_M = 13, // 搭接橋接的 Relay
- _REASSIGNED_WAITING = 14,
- _REASSIGNED_COMP = 15
- };
- enum _MAIN_CHARGING_MODE
- {
- _MAIN_CHARGING_MODE_MAX = 0,
- _MAIN_CHARGING_MODE_AVER = 1,
- };
- enum _EXTRA_ERR_PROCESS
- {
- _EXTRA_ERR_PROCESS_NONE = 0,
- _EXTRA_ERR_PROCESS_INUVP = 1,
- _EXTRA_ERR_PROCESS_INOVP = 2,
- _EXTRA_ERR_PROCESS_PRIMARY = 3,
- };
- enum _CHARGER_TYPE
- {
- _CHARGER_TYPE_IEC = 0,
- _CHARGER_TYPE_UL = 1,
- };
- enum _SYS_WIFI_MODE
- {
- _SYS_WIFI_MODE_DISABLE = 0,
- _SYS_WIFI_MODE_STATION = 1,
- _SYS_WIFI_MODE_AP = 2
- };
- enum _LED_INTENSITY_LV
- {
- _LED_INTENSITY_DARKEST = 0,
- _LED_INTENSITY_MEDIUM = 1,
- _LED_INTENSITY_BRIGHTEST = 2
- };
- enum _CCS_COMM_PROTOCOL
- {
- _CCS_COMM_V2GMessage_DIN70121 = 0x01,
- _CCS_COMM_V2GMessage_ISO15118_2014 = 0x02,
- _CCS_COMM_V2GMessage_ISO15118_2018 = 0x03
- };
- enum _ETHERNET_USAGE
- {
- _ETHERNET_USAGE_NONE = 0,
- _ETHERNET_USAGE_LAN,
- _ETHERNET_USAGE_WIFI,
- _ETHERNET_USAGE_3G_4g
- };
- #define STR_CONN_DISABLE "Disable"
- #define STR_CONN_CONNECTED "Connected"
- #define STR_CONN_DISCONNECTED "Disconnected"
- #define STR_DARKEST "Darkest"
- #define STR_MEDIUM "Medium"
- #define STR_BRIGHTEST "Brightest"
- enum _CONN_STATUS
- {
- _Connnection_Disable = 0,
- _Connnection_Connected = 1,
- _Connnection_Disconnected = 2,
- };
- enum _LED_INDICATION_STATUS
- {
- _LED_INDICATION_OFF = 0, // all led off
- _LED_INDICATION_RUN = 1, // green led on, red led off
- _LED_INDICATION_FAULT = 2, // green led off, red led on
- _LED_INDICATION_ON = 3, // all led on
- _LED_INDICATION_GREEN_TOGGLE = 4, // green led toggle
- _LED_INDICATION_RED_TOGGLE = 5, // red led toggle
- };
- enum _STANDARD_INDICATION_STATUS
- {
- _STANDARD_LED_None = 0,
- _STANDARD_LED_Disconnection = 1,
- _STANDARD_LED_Running = 2,
- _STANDARD_LED_Alarm = 3,
- };
- enum _E4YOU_INDICATION_STATUS
- {
- _E4YOU_LED_None = 0,
- _E4YOU_LED_Disconnection = 1,
- _E4YOU_LED_Idle = 2,
- _E4YOU_LED_Charging = 3,
- _E4YOU_LED_Alarm = 4,
- };
- #define STR_QR_DEFAULT "Default"
- #define STR_QR_CUSTOMIZED "Customized"
- #define STR_QR_CHARGEBOXID "ChargeBoxId"
- enum _QR_MODE
- {
- _QR_MODE_Default = 0,
- _QR_MODE_Customized = 1,
- _QR_MODE_ChargeBoxId = 2, // for audi
- };
- enum _CUSTOMER_CODE
- {
- _CUSTOMER_CODE_Phihong = 0,
- _CUSTOMER_CODE_Audi = 1,
- _CUSTOMER_CODE_E4U = 2,
- _CUSTOMER_CODE_UCar = 3,
- _CUSTOMER_CODE_TCC = 4,
- };
- #define STR_CABINET_ROLE_NONE "Single"
- #define STR_CABINET_ROLE_MASTER "Master"
- #define STR_CABINET_ROLE_SLAVE "Slave"
- enum _CABINET_ROLE
- {
- _CROLE_SINGLE = 0, // single power cabinet mode
- _CROLE_MASTER = 1, // power cabinet master mode
- _CROLE_SLAVE = 2, // power cabinet slave mode
- };
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
- unsigned int NeedSoftReset:1; // 0: no effect, 1: system need soft reset
- unsigned int NeedHardReset:1; // 0: no effect, 1: system need hard reset
- unsigned int PrimaryDisable:1; // 0: primary enable, 1: primary disable
- unsigned int RelayBoardDisable:1; // 0: relay board enable, 1: relay board disable
- unsigned int FanBoardDisable:1; // 0: fan board enable, 1: fan board disable
- unsigned int LedBoardDisable:1; // 0: led board enable, 1: led board disable
- unsigned int SecondRelayBoardEnable:1; // 0: second relay disable, 1: second relay enable
- unsigned int DOLedIndication:1; // 0: no led indication, 1: enable DO Model led indication
- unsigned int DKLedIndication:1; // 0: no led indication, 1: enable DK Model led indication
- unsigned int BackendEnable:1; // 0: backend disable, 1: backend enable
- unsigned int Wifi4gResetEnable:1; // 0: wifi/4g reset io disable, 1: wifi/4g reset io enable
- unsigned int PsuInit:1; // 0: no effect, 1: psu is initialized
- unsigned int res:18;
- }bits;
- }SystemControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int DisableBalance:1; // 0: no effect, 1: disable announce balance
- unsigned int FastStandbyTime:1; // 0: no effect, 1: enable fast standby time
- unsigned int ChargingSimulation:1; // 0: no effect, 1: enable charging simulation
- unsigned int res:29;
- }bits;
- }TestControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int MsgMain:1; // 0: no effect, 1: enable debug message in main
- unsigned int MsgPrimaryComm:1; // 0: no effect, 1: enable debug message in primary comm
- unsigned int MsgPsu:1; // 0: no effect, 1: enable debug message in psu
- unsigned int MsgEvComm:1; // 0: no effect, 1: enable debug message in ev comm
- unsigned int MsgInternalComm:1; // 0: no effect, 1: enable debug message in internal comm
- unsigned int res:27;
- }bits;
- }DebugControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int EnableForceCharging:1; // 0: disable, 1: enable force charging
- unsigned int StartForceCharging:1; // 0: disable, 1: start force charging
- unsigned int res:30;
- }bits;
- }ForceChargingControl;
- typedef struct
- {
- ForceChargingControl FCtrl;
- unsigned short FTargetVoltage; // target voltage, unit: 0.1V
- unsigned short FTargetCurrent; // target current, unit: 0.1A
- }ForceCharging;
- typedef union
- {
- unsigned int AuthFlag;
- struct
- {
- unsigned int AutoStartEnable:1; // 0: disable, 1: enable auto charging after plug in
- unsigned int APPEnable:1; // 0: disable, 1: app auth enable
- unsigned int QRCodeEnable:1; // 0: disable, 1: qr code auth enable
- unsigned int RFIDEnable:1; // 0: disable, 1: rfid auth enable
- unsigned int res:24;
- }bits;
- }AuthModeInfo;
- typedef struct
- {
- AuthModeInfo AuthMode;
- unsigned char QRCodeMode; // 0: default, 1: customized, 2: audi type
- unsigned char res[3];
- }SystemAuthInfoData;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
- unsigned int Paused:1; // 0: no effect, 1: primary paused
- unsigned int DisableDoorSensor:1; // 0: door sensor enable, 1: door sensor disable
- unsigned int DisableEmergencyButton:1; // 0: emergency button enable, 1: emergency button disable
- unsigned int DoorSensorReverse:1; // 0: the same as ds's, 1: status is different from ds's
- unsigned int AcContactorReverse:1; // 0: the same as ds's, 1: status is different from ds's
- unsigned int CabinetSwitchDetect:1; // 0: no effect, 1: need detect cabinet switch
- unsigned int res:24;
- }bits;
- }PrimaryControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
- unsigned int Paused:1; // 0: no effect, 1: relay paused
- unsigned int AcContactor:1; // 0: ac contactor off, 1: ac contactor on
- unsigned int AcContactorOffByPsu:1; // 0: no effect, 1: ac contactor off
- unsigned int AcContactorOffByEmergency:1; // 0: no effect, 1: ac contactor off
- unsigned int StandbyCountdown:1; // 0: charger is using, 1: start countdown
- unsigned int AcInputDisable:1; // 0: ac input enable, 1: ac input disable
- unsigned int DcInputEnable:1; // 0: dc input disable, 1: dc input enable
- unsigned int res:23;
- }bits;
- }RelayControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
- unsigned int Paused:1; // 0: no effect, 1: fan paused
- unsigned int res:29;
- }bits;
- }FanControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
- unsigned int Paused:1; // 0: no effect, 1: led paused
- unsigned int res:29;
- }bits;
- }LedFanControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
- unsigned int Paused:1; // 0: no effect, 1: psu paused
- unsigned int FailureResume:1; // 0: no error, 1: psu failure, need resume
- unsigned int CommunicationLost:1; // 0: no error, 1: psu communication lost
- unsigned int res:27;
- }bits;
- }PsuControl;
- typedef struct
- {
- int TxCnt;
- int RxCnt;
- int LostCnt;
- int CommCnt;
- }DevideCommInfo;
- typedef struct
- {
- DevideCommInfo PrimaryComm;
- DevideCommInfo Relay1Comm;
- DevideCommInfo Relay2Comm;
- DevideCommInfo FanComm;
- DevideCommInfo LedComm;
- DevideCommInfo PsuComm;
- }CommInfoData;
- typedef struct
- {
- unsigned char MaxDispenser;
- unsigned char MaxConnector;
- unsigned char CabinetSwitch;
- unsigned char CabinetRole;
- unsigned char SelfTestStep;
- unsigned char CustomerCode;
- unsigned short ChargerRatingPower; // unit: 0.1kw, charger rating power, parsing from model name
- CommInfoData CommInfo;
- SystemControl SysCtrl;
- TestControl TestCtrl;
- DebugControl DebugCtrl;
- PrimaryControl PrimaryCtrl;
- RelayControl RelayCtrl;
- FanControl FanCtrl;
- LedFanControl LedCtrl;
- PsuControl PsuCtrl;
- ForceCharging FCharging[MAX_GROUP_QUANTITY];
- unsigned char GunAvailable[MAX_GROUP_QUANTITY];
- unsigned char PsuInitQuantity[MAX_GROUP_QUANTITY];
- }SysControl;
- // ************************************************************************************************* //
- typedef struct
- {
- bool CheckIn;
- unsigned char Address;
- unsigned char GroupNo;
- unsigned char GIndex;
- }PsuAddressInfoData;
- typedef struct
- {
- unsigned char GroupPsuQuantity;
- unsigned char res;
- unsigned char PsuSN[MAX_MODULE_PER_GROUP];
- }GroupInfoData;
- typedef struct
- {
- bool PsuLocationInit;
- bool ReInitPsuLocation;
- unsigned char TotalPsuQuantity;
- GroupInfoData GroupLocationInfo[MAX_GROUP_QUANTITY];
- PsuAddressInfoData PsuAddressInfo[MAX_PSU_MODULE_QUANTITY];
- }PsuPositionInfoData;
- // ************************************************************************************************* //
- typedef enum
- {
- _GROLE_IDLE = 0,
- _GROLE_MASTER = 1,
- _GROLE_SLAVE = 2,
- _GROLE_PREPARE_SWITCH_OFF = 10, // reduce output current capability
- _GROLE_SLAVE_POWER_OFF = 11, // power off
- _GROLE_SWITCH_OFF_OK = 12, // power off completed
- _GROLE_WAIT_IDLE = 13, // wait a while to change to idle, open parallel relay at this state
- _GROLE_WAIT_SLAVE = 14, // wait a while to change to slave
- _GROLE_PREPARE_ATTACH_ON = 20, // raise voltage to master output voltage
- _GROLE_PRECHARGE_READY = 21, // extend pre-charge ready
- _GROLE_EXTEND_STOP = 22, // extend capability stop
- _GROLE_REQUEST_TO_CHARGING = 30,
- _GROLE_TERMINATE = 40,
- _GROLE_WAIT_TERMINATED = 41,
- _GROLE_NONE = 99,
- }_GROUP_ROLE;
- typedef union
- {
- unsigned int CtrlValue[6];
- struct
- {
- unsigned int IdleCtrlValue;
- unsigned int MasterCtrlValue;
- unsigned int StopChargingCtrlValue;
- unsigned int DeratingCtrlValue;
- unsigned int ExtendCapabilityCtrlValue;
- unsigned int SlaveCtrlValue;
- }RoleCtrl;
- struct
- {
- // IdleCtrlValue
- unsigned int ChargingRequest:1; // 0: no effect, 1: charging request from main.c
- unsigned int ChargingRequestConfirmed:1; // 0: no effect, 1: request confirmed by psu task
- unsigned int GroupShareCheck:1; // 0: no effect, 1: check is there any psu can share
- unsigned int ShareConfirmed:1; // 0: no effect, 1: psu share confirmed
- unsigned int GrabGroupWait:1; // 0: no effect, 1: need to wait grab psu
- unsigned int ShareCheckDone:1; // 0: no effect, 1: psu share completed
- unsigned int FindGroupPartner:1; // 0: no effect, 1: find available group partner
- unsigned int ParallelRelayOn:1; // 0: no effect, 1: set parallel relay on
- unsigned int ParallelRelayConfirmed:1; // 0: no effect, 1: parallel relay confirmed
- unsigned int GroupingDone:1; // 0: no effect, 1: grouping completed
- unsigned int IdleCtrlRes:22;
- // MasterCtrlValue
- unsigned int CableCheckDone:1; // 0: no effect, 1: CableCheck done
- unsigned int InPrechargeMode:1; // 0: no effect, 1: system status in PreCharge mode
- unsigned int AlreadyInChargingMode:1; // 0: no effect, 1: system status ever enter charging mode
- unsigned int ExtendAvailable:1; // 0: no effect, 1: extend capability is available
- unsigned int NeedCurrentBalance:1; // 0: no effect, 1: need to current balance
- unsigned int OutputCurrentStable:1; // 0: no effect, 1: output current is stable
- unsigned int ReachMaxCurrentDemand:1; // 0: no effect, 1: reach ev max current demand
- unsigned int ReachMaxStageCurrent:1; // 0: no effect, 1: reach ev max stage current
- unsigned int MasterCtrlRes:24;
- // StopChargingCtrlValue
- unsigned int StopChargingRequest:1; // 0: no effect, 1: master need to stop
- unsigned int StopChargingConfirmed:1; // 0: no effect, 1: stop charging confirmed
- unsigned int AllPowerOffDone:1; // 0: no effect, 1: all member power off done
- unsigned int AllParallelRelayOff:1; // 0: no effect, 1: all member's parallel relay off
- unsigned int AllParallelRelayConfirmed:1; // 0: no effect, 1: all member's parallel relay off confirmed
- unsigned int AllMemberStopCompleted:1; // 0: no effect, 1: all member stop completed
- unsigned int StopChargingCompleted:1; // 0: no effect, 1: stop charging completed
- unsigned int StopChargingCtrlRes:25;
- // DeratingCtrlValue
- unsigned int NeedDerating:1; // 0: no effect, 1: need derating
- unsigned int DeratingConfirmed:1; // 0: no effect, 1: derating confirmed
- unsigned int DeratingStart:1; // 0: no effect, 1: derating start
- unsigned int DeratingPowerOffDone:1; // 0: no effect, 1: derating member power off done
- unsigned int DeratingRelayOff:1; // 0: no effect, 1: set derating member parallel relay off
- unsigned int DeratingRelayConfirmed:1; // 0: no effect, 1: derating member parallel relay confirmed
- unsigned int DeratingCompleted:1; // 0: no effect, 1: derating completed
- unsigned int DeratingCtrlRes:25;
- // ExtendCapabilityCtrlValue
- unsigned int MorePowerRequest:1; // 0: no effect, 1: need to request more psu
- unsigned int MorePowerConfirmed:1; // 0: no effect, 1: request more psu confirmed
- unsigned int ExtendPrecharge:1; // 0: no effect, 1: extend group need to pre-charge
- unsigned int ExtendPrechargeDone:1; // 0: no effect, 1: extend group pre-charge completed
- unsigned int ExtendRelayOn:1; // 0: no effect, 1: extend group parallel relay on
- unsigned int ExtendRelayConfirmed:1; // 0: no effect, 1: extend group parallel relay confirmed
- unsigned int ExtendCompleted:1; // 0: no effect, 1: extend capability completed
- unsigned int ExtendCapabilityCtrlRes:25;
- // SlaveCtrlValue
- unsigned int SlaveChargingRequest:1; // 0: no effect, 1: request slave to charging after power off
- unsigned int CheckSlaveReady:1; // 0: no effect, 1: check if slave is ready
- unsigned int WaitSlaveReady:1; // 0: no effect, 1: wait slave is ready
- unsigned int SlavePowerOffRequest:1; // 0: no effect, 1: request slave to power off
- unsigned int SlavePowerOffConfirmed:1; // 0: no effect, 1: slave power off confirmed
- unsigned int SlaveCtrlRes:27;
- }bits;
- }PsuGroupControl;
- typedef struct
- {
- unsigned char Quantity;
- unsigned char RealQuantity;
- unsigned char Member[MAX_GROUP_QUANTITY]; // record slave group index
- }PsuGroupPartner;
- typedef struct
- {
- unsigned char Index;
- unsigned char Role;
- unsigned char PreRole;
- unsigned char Location;
- PsuGroupPartner Partner; // record slave group information
- PsuGroupPartner PossibleMember; // record possible slave group information
- unsigned char TargetGroup; // target group index + 1
- unsigned char ReservedTarget; // reserved target group index + 1
- PsuGroupControl GroupCtrl;
- unsigned short ReAssignAvailableCurrent; // group available current when reassign, unit: 0.1A
- unsigned short ParallelCheck;
- unsigned char ParallelConfig[MAX_GROUP_QUANTITY]; // group parallel relay setting
- unsigned short GunLoading; // gun output loading, unit: 0.01%
- unsigned char GunPsuQuantity; // record psu quantity at this gun
- unsigned char res;
- }PsuGroupCollectionData;
- typedef struct
- {
- unsigned short GTargetVoltage; // group target voltage config, unit: 0.1V
- unsigned short GTargetCurrent; // group target current config, unit: 0.1A
- unsigned short OutputLoading; // group output loading, unit: 0.01%
- }GroupOutputConfigInfo;
- typedef union
- {
- unsigned short CtrlValue;
- struct
- {
- unsigned short Output_N:1; // 0: set Output_N off, 1: set Output_N on
- unsigned short Output_P:1; // 0: set Output_P off, 1: set Output_P on
- unsigned short res:14;
- }bits;
- }PsuGroupOutputRelay;
- typedef union
- {
- unsigned short CtrlValue;
- struct
- {
- unsigned short Location_1_2:1; // 0: set parallel off, 1: set parallel on
- unsigned short Location_2_3:1; // 0: set parallel off, 1: set parallel on
- unsigned short Location_3_4:1; // 0: set parallel off, 1: set parallel on
- unsigned short Location_4_5:1; // 0: set parallel off, 1: set parallel on
- unsigned short res:12;
- }bits;
- }PsuGroupParallelRelay;
- typedef struct
- {
- byte Location[MAX_GROUP_QUANTITY];
- byte Layout[MAX_GROUP_QUANTITY];
- PsuGroupCollectionData GroupCollection[MAX_GROUP_QUANTITY];
- GroupOutputConfigInfo GroupOutput[MAX_GROUP_QUANTITY];
- PsuGroupOutputRelay OutputRelayConfig[MAX_GROUP_QUANTITY];
- PsuGroupOutputRelay OutputRelayConfirmed[MAX_GROUP_QUANTITY];
- PsuGroupParallelRelay ParallelRelayConfig;
- PsuGroupParallelRelay ParallelRelayConfirmed;
- }PsuGroupingInfoData;
- // ************************************************************************************************* //
- typedef enum
- {
- _SCONN_FREE = 0,
- _SCONN_WAIT = 1,
- _SCONN_MATCHED = 2,
- }_SOCKET_CONN_STATUS;
- typedef enum
- {
- _DeviceStatus_DisConnect = 0x00, // _DS_None , slave cabinet in re-connection
- _DeviceStatus_Identification = 0x01, // _DS_Identification , slave cabinet in identification
- _DeviceStatus_Idle = 0x02, // _DS_Idle , slave cabinet in idle
- _DeviceStatus_Alarm = 0x03, // _DS_Alarm , slave cabinet in alarm
- _DeviceStatus_Charging = 0x04, // _DS_Charging , no use in slave cabinet
- _DeviceStatus_Timeout = 0x05, // _DS_Timeout , no use in slave cabinet
- _DeviceStatus_RetryWait = 0x06,
- }_DEVICE_STATUS;
- typedef enum
- {
- _Parallel_None = 0,
- _Parallel_Wait = 1, // ac contactor off, 3s
- _Parallel_Working = 2, // ac contactor on and start re-initial psu
- _Parallel_Done = 3, // re-initial psu done
- }_PARALLEL_STATUS;
- typedef struct
- {
- unsigned char Status; // 0: free, 1: WaitModelName, 2: DispenserMatched
- unsigned char DeviceIndex; // record device index
- unsigned int IpAddress; // record device ip address
- unsigned char DuplicateIp; // 0: unique ip, 1: duplicate ip
- unsigned char res;
- }SocketConnInfoData;
- typedef struct
- {
- unsigned char LocalStatus; // 0: None, 1: Identification, 2: Idle, 3: Alarm, 4: Charging, 5: _DS_Timeout
- unsigned char SlaveID;
- unsigned char ModelName[64]; //charger model name
- unsigned char SerialNumber[64]; //charger system serial number
- unsigned char SystemId[128]; //charger system ID
- unsigned char CsuBootLoadFwRev[32]; //CSU board bootloader firmware version
- unsigned char CsuKernelFwRev[32]; //CSU board OS kernel firmware version
- unsigned char CsuRootFsFwRev[32]; //CSU board root file system firmware version
- unsigned char CsuPrimFwRev[32]; //CSU board root file system firmware version
- unsigned char LcmFwRev[32]; //LCM module firmware version
- unsigned char PsuPrimFwRev[32]; //PSU primary firmware version
- unsigned char PsuSecFwRev[32]; //PSU secondary firmware version
- unsigned char FanModuleFwRev[32]; //Fan module firmware version
- unsigned char RelayModuleFwRev[32]; //Relay control module firmware version
- unsigned char TelcomModemFwRev[32]; //the 3G/4G modem firmware version
- unsigned char LedModuleFwRev[32]; //LED control module firmware version
- unsigned char Connector1FwRev[32]; //Connector1 module firmware version
- unsigned char Connector2FwRev[32]; //Connector2 module firmware version
- unsigned char AcContactorSetting; // 0: OFF, 1: ON Master -> Slave
- unsigned char AcContactorState; // 0: OFF, 1: ON Slave -> Master
- unsigned char OutputRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
- unsigned char GunOutputRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
- unsigned char ParallelRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
- unsigned char ParallelRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
- unsigned char UpdateRequest; // 0: no effect, 1: need to update
- unsigned char res;
- char FwFileName[128];
- unsigned char SocketChannel; // record socket index
- unsigned char IpDuplicatedFlag; // 0: no effect, 1: ip is duplicated
- unsigned char ParallelRequest; // 0: no effect, 1: parallel request
- unsigned char ParallelConfirm; // 0: no effect, 1: parallel confirm
- unsigned short ParallelPower; // parallel power, unit: 0.1kw
- }SlaveCabinetInfoData;
- typedef struct
- {
- unsigned char ParallelStatus; // 0: parallel none, 1: wait, 2: in paralleling, 3: parallel done
- unsigned char ParallelCabinetQuantity; // record max dispenser quantity
- unsigned char PresentParallelCabinetQuantity; // present slave cabinet quantity
- unsigned char res;
- SlaveCabinetInfoData PCabinet[MAX_SLAVE_CABINET_QUANTITY];
- unsigned char PCUpdateState[MAX_SLAVE_CABINET_QUANTITY]; // 0: Not in Update, 1: Updating, 2: Updated
- unsigned short TotalParallelPower; // max total parallel power, unit: 0.1kw
- }ParallelCabinetInfoData;
- typedef struct
- {
- unsigned char SCabinetStatus;
- unsigned char SCabinetID;
- unsigned char SOutputRelay[MAX_GROUP_QUANTITY]; // parallel cabinet output relay state
- unsigned char SParallelRelay[MAX_GROUP_QUANTITY]; // parallel cabinet parallel relay state
- unsigned char SAcContactor; // slave cabinet ac contactor state
- unsigned char NeedUpgrade; // 1: Need Upgrade, 2: No Update
- unsigned char UpgradeState; // 0: Not in Update, 1: Updating, 2: Updated
- unsigned char res;
- char FwFileName[128];
- }SlaveCabinetControl;
- // ************************************************************************************************* //
- typedef struct
- {
- SystemAuthInfoData AuthInfo;
- SysControl Control;
- PsuPositionInfoData PsuPosition;
- PsuGroupingInfoData PsuGrouping;
- SocketConnInfoData CabinetConnInfo[MAX_SLAVE_CABINET_QUANTITY];
- ParallelCabinetInfoData ParallelCabinet;
- SlaveCabinetControl SCabinetControl;
- }ChargerInfoData;
- #endif /* CONFIG_H_ */
|