123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- /*
- * @Author : ChenJie
- * @Date : 2021-12-27 11:21:08
- * @Version : V3.0
- * @LastEditors : ChenJie
- * @LastEditTime : 2022-05-10 18:48:53
- * @Description : file content
- * @FilePath : \VehicleControl\VehicleControl\src\System\Vehicle\Communication\CanVar.h
- */
- /*
- * CanVar.h
- *
- * Created on: 2021年12月27日
- * 编码
- * Author: QiXiang_CHENJIE
- */
- #ifndef SYSTEM_VEHICLE_COMMUNICATION_CANVAR_H_
- #define SYSTEM_VEHICLE_COMMUNICATION_CANVAR_H_
- #include "Std_Types.h"
- #include "HardwareLib.h"
- #include "AppVar.h"
- /************************************************************
- *BCU->Ebc解码变量存放区
- ************************************************************/
- extern UINT32 BcuInTable[28];
- extern BOOL BcuRxShortError[28];
- extern BOOL BcuRxLongError[28];
- extern UINT8 BcuRxErrorCounter[28];
- extern UINT8 BcuRxFlag[28];
- extern UINT8 BMS_ReqVIN;
- extern UINT8 BMS_ReqHVOff;
- extern UINT8 BMS_ProtocolEditionH;
- extern UINT8 BMS_ProtocolEditionL;
- extern UINT8 BMS_CharDevNum;
- extern UINT8 BMS_FtPosRly;
- extern UINT8 BMS_FtNegRly;
- extern UINT8 BMS_FtPosCharRly1;
- extern UINT8 BMS_FtNegCharRly1;
- extern UINT8 BMS_FtPosCharRly2;
- extern UINT8 BMS_FtNegCharRly2;
- extern UINT8 BMS_FtHeatRly1;
- extern UINT8 BMS_FtHeatRly2;
- extern UINT8 BMS_StPosRly;
- extern UINT8 BMS_StNegRly;
- extern UINT8 BMS_StPreCharRly;
- extern UINT8 BMS_StPosCharRly1;
- extern UINT8 BMS_StNegCharRly1;
- extern UINT8 BMS_StPosCharRly2;
- extern UINT8 BMS_StNegCharRly2;
- extern UINT8 BMS_FtAuxRelayWeld;
- extern UINT8 BMS_BraOpenCirc;
- extern UINT8 BMS_FtBackCharCurrOutLim;
- extern UINT8 BMS_FtPosRlyOpen;
- extern UINT8 BMS_FtNegRlyOpen;
- extern UINT8 BMS_FtPosCharRly1Open;
- extern UINT8 BMS_FtPosCharRly2Open;
- extern UINT8 BMS_FtNegCharRly1Open;
- extern UINT8 BMS_FtNegCharRly2Open;
- extern UINT8 BMS_FtTMSContClose;
- extern UINT8 BMS_FtTMSContOpen;
- extern UINT8 BMS_FtTMS;
- extern UINT8 BMS_Ft24VSpy;
- extern UINT8 BMS_FtPACKSelfProt;
- extern UINT8 BMS_FtCharSockTempOver;
- extern UINT8 BMS_FtTempOutCtrl;
- extern UINT8 BMS_StPosHeatRly;
- extern UINT8 BMS_StNegHeatRly;
- extern UINT8 BMS_CharSysNum;
- extern UINT8 BMS_FtCode;
- extern UINT8 BMS_ST1CheckSum;
- extern UINT8 BMS_ST1Counter;
- extern UINT8 BMS_Mode;
- extern UINT8 BMS_AuxRlySt;
- extern UINT8 BMS_BattBalaSt;
- extern UINT8 BMS_CharGunSt;
- extern UINT8 BMS_CharMode;
- extern UINT8 BMS_CharSt;
- extern UINT8 BMS_FtLvl;
- extern UINT8 BMS_FtCellTempDiff;
- extern UINT8 BMS_FtCellTempHigh;
- extern UINT8 BMS_FtPACKOverVolt;
- extern UINT8 BMS_FtPACKUndeVolt;
- extern UINT8 BMS_FtSOCLow;
- extern UINT8 BMS_FtCellOverVolt;
- extern UINT8 BMS_FtCellUndeVolt;
- extern UINT8 BMS_FtIns;
- extern UINT8 BMS_FtCellOverVoltDiff;
- extern UINT8 BMS_FtCharCurrOver;
- extern UINT8 BMS_FtDisCharCurrOver;
- extern UINT8 BMS_FtCellTempLow;
- extern UINT8 BMS_FtBranVoltDifOver;
- extern UINT8 BMS_FtBMSHardWare;
- extern UINT8 BMS_FtSOCHigh;
- extern UINT8 BMS_FtSOCJump;
- extern UINT8 BMS_FtInCom;
- extern UINT8 BMS_FtSysMism;
- extern UINT8 BMS_FtHvIntLock;
- extern UINT8 BMS_FtSmoke;
- extern UINT8 BMS_FtFire;
- extern UINT8 BMS_FtNum;
- extern UINT8 BMS_PackSOC;
- extern UINT8 BMS_PackSOH;
- extern UINT8 BMS_MaxCellTemp;
- extern UINT8 BMS_MinCellTemp;
- extern UINT8 BMS_AverCellTemp;
- extern UINT8 BMS_MaxCellTempCSC;
- extern UINT8 BMS_MaxCellTempNum;
- extern UINT8 BMS_MinCellTempCSC;
- extern UINT8 BMS_MinCellTempNum;
- extern UINT8 BMS_MaxCellVoltCSC;
- extern UINT8 BMS_MaxCellVoltNum;
- extern UINT8 BMS_MinCellVoltCSC;
- extern UINT8 BMS_MinCellVoltNum;
- extern UINT8 BMS_InsDeteSt;
- extern UINT8 BMS_FtCharInsLow;
- extern UINT8 BMS_FtCurrSenr;
- extern UINT8 BMS_FtHeatingFilm;
- extern UINT8 BMS_FtMainLoopPreChar;
- extern UINT8 BMS_FtAuxLoopPreChar;
- extern UINT8 BMS_FtACANLost;
- extern UINT8 BMS_FtDCDC;
- extern UINT8 BMS_FtSOCDif;
- extern UINT8 BMS_FtCellOverDisChar;
- extern UINT8 BMS_FtCharOver;
- extern UINT8 BMS_FtContDisCharCurrOverLoad;
- extern UINT8 BMS_FtContCharCurrOverLoad;
- extern UINT8 BMS_Gun1DCNegTemp;
- extern UINT8 BMS_Gun1DCPosTemp;
- extern UINT8 BMS_Gun2DCNegTemp;
- extern UINT8 BMS_Gun2DCPosTemp;
- extern UINT8 BMS_CurrHeatSt;
- extern UINT8 BMS_CurrCoolSt;
- extern UINT8 BMS_FtCharCnct;
- extern UINT8 BMS_FtOverDisCharCurrDuringChar;
- extern UINT8 BMS_FtCharNTC;
- extern UINT8 BMS_FtELock;
- extern UINT8 BMS_CellVoltFramNum;
- extern UINT8 BMS_CellTempFramNum;
- extern UINT8 BMS_CSC_Code;
- extern UINT8 BMS_CellTemp[64];
- extern UINT8 BMS_Checksum;
- extern UINT8 BMS_PackComp;
- extern UINT8 BMS_BattCodeLeng;
- extern UINT8 BMS_SN[27];
- extern UINT8 BMS_BattType;
- extern UINT8 BMS_CoolType;
- extern UINT8 BMS_CSC_Total;
- extern UINT8 BMS_CellVoltLevel;
- extern UINT8 BMS_CellMinVolt;
- extern UINT8 BMS_CellMaxVolt;
- extern UINT8 BMS_HVBranNum;
- extern UINT8 BMS_SingleHVBranchCellNum;
- extern UINT8 BMS_ReqMode;
- extern UINT8 BMS_HVCmd;
- extern UINT8 BMS_ChgSts;
- extern UINT8 BMS_HVRelaySts;
- extern UINT8 BMS_SetTemp;
- extern UINT8 BMS_Life;
- extern UINT8 BMS_CRC;
- extern UINT8 TMS_WorkStatus;
- extern UINT8 TMS_HVRelayST;
- extern UINT8 TMS_OutletTemp;
- extern UINT8 TMS_InletTemp;
- extern UINT8 TMS_ErrCode;
- extern UINT8 TMS_FaultLevel;
- extern UINT16 BMS_SoftwareVersion;
- extern UINT16 BMS_HardwareVersion;
- extern UINT16 BMS_PackCurr;
- extern UINT16 BMS_MaxCharCurr;
- extern UINT16 BMS_MaxDisCharCurr;
- extern UINT16 BMS_PosIns;
- extern UINT16 BMS_NegIns;
- extern UINT16 BMS_BattVolt;
- extern UINT16 BMS_LinkVolt;
- extern UINT16 BMS_MaxCellVolt;
- extern UINT16 BMS_AverCellVolt;
- extern UINT16 BMS_MinCellVolt;
- extern UINT16 BMS_ContChrgCurr;
- extern UINT16 BMS_ContDisCharCurr;
- extern UINT16 BMS_CharReqVolt;
- extern UINT16 BMS_CharReqCurr;
- extern UINT16 BMS_SysInsRes;
- extern UINT16 BMS_MaxDisCharPwr;
- extern UINT16 BMS_MaxCharPwr;
- extern UINT16 BMS_ContDisCharPwr;
- extern UINT16 BMS_ContCharPwr;
- extern UINT16 BMS_InstEngyCons;
- extern UINT16 BMS_TotalEngyCons;
- extern UINT16 BMS_SOE;
- extern UINT16 BMS_RmanCharTime;
- extern UINT16 BMS_CharNum;
- extern UINT16 BMS_CellVolt[384];
- extern UINT16 BMS_BattRateCap;
- extern UINT16 BMS_BattRateVolt;
- extern UINT16 BMS_BattRateEngy;
- extern UINT16 BMS_CellTotal;
- extern UINT16 BMS_TempTotal;
- extern UINT16 BMS_SingleCharEngy;
- extern UINT16 BMS_SingleCharCapy;
- extern UINT16 BMS_HVVolt;
- extern UINT16 TMS_ReqPow;
- extern UINT32 BMS_TotalCharEngy;
- extern UINT32 BMS_TotalDisCharEngy;
- extern UINT32 BMS_TotalBackCharEngy;
- extern UINT32 BMS_TotalStaCharEngy;
- extern UINT32 BMS_TotalGunCharEngy;
- extern UINT32 BMS_TotalGunCharCapy;
- extern UINT32 BMS_TotalCharCapy;
- extern UINT32 BMS_TotalDisCharCapy;
- extern UINT32 BMS_TotalBackCharCapy;
- extern UINT32 BMS_TotalStaCharCapy;
- /*Vcu->Ebc*********************************/
- extern UINT32 VcuInTable[4];
- extern UINT8 VcuRxFlag[4];
- extern BOOL VcuRxShortError[4];
- extern BOOL VcuRxLongError[4];
- extern UINT8 VcuRxErrorCounter[4];
- extern UINT8 VCU_Num_VIN[17];
- extern UINT8 VCU_St_VinRecv;
- extern UINT8 VCU_St_BattRly;
- extern UINT8 VCU_St_Check;
- extern UINT8 VCU_St_SysIntLock;
- extern UINT8 VCU_St_Veh;
- extern UINT8 VCU_St_Gear;
- extern UINT8 VCU_Ft_Sys;
- extern UINT8 VCU_Ft_Tran;
- extern UINT8 VCU_Ft_BattSys;
- extern UINT8 VCU_State_Veh;
- extern UINT8 VCU_Counter;
- extern UINT8 VCU_SoftVersion;
- extern UINT8 VCU_St_AccPedal;
- extern UINT8 VCU_St_BrakePedal;
- extern UINT8 VCU_St_ParkBrakeSw;
- /**********************************/
- extern UINT32 EbcOutTable[2][2];
- extern UINT8 EBC_Counter;
- extern UINT8 EBC_LockSt;
- extern UINT8 EBC_CnctSt;
- extern UINT8 EBC_DisCharCnctSt;
- extern UINT8 EBC_CharCnctSt;
- extern UINT8 EBC_FtLvl;
- extern UINT8 EBC_FtCode;
- extern UINT8 EBC_AirPressure;
- extern UINT8 EBC_CharSt;
- extern UINT8 EBC_ActHeatReq;
- extern UINT8 EBC_InhiHVOn;
- extern UINT8 EBC_ReqHVOff;
- extern UINT8 EBC_StopChgCmd;
- extern UINT8 EBC_State;
- extern UINT8 EBC_DisCharPos1Temp;
- extern UINT8 EBC_DischarNeg1Temp;
- extern UINT8 EBC_DisCharPos2Temp;
- extern UINT8 EBC_DisCharNeg2Temp;
- extern UINT8 EBC_ChgPos1Temp;
- extern UINT8 EBC_ChgNeg1Temp;
- extern UINT8 EBC_ChgPos2Temp;
- extern UINT8 EBC_ChgNeg2Temp;
- /*************************************************************
- *Ebc->ble组码变量存放区
- ************************************************************/
- // Ble
- extern uint16 bcud_E_snglChrg; //单次充电能量,精度0.1kwh
- extern uint16 bcud_pct_soc; //电池SOC,精度0.1
- extern uint16 bcud_Q_snglChrg; //单次充电容量,精度0.1Ah
- extern uint16 bcud_V_battU; //电池电压 精度0.1V
- extern uint32 bcud_E_accChrg; //累计充电能量,精度0.1kwh
- extern uint32 bcud_E_accDischrg; //累计放电能量,精度0.1kwh
- extern uint32 bcud_E_accPlugInChrg; //累计插枪充电能量,精度0.1kwh
- extern uint32 bcud_E_accRecovry; //累计回收能量,精度0.1kwh
- extern uint32 bcud_E_accSwapBatt; //累计换电站能量,精度0.1kwh
- extern uint32 bcud_Q_accChrg; //累计充电容量,精度0.1ah
- extern uint32 bcud_Q_accDischrg; //累计放电容量,精度0.1ah
- extern uint32 bcud_Q_accPlugInChrg; //累计插枪充电容量,精度0.1ah
- extern uint32 bcud_Q_accRecovry; //累计回收容量,精度0.1ah
- extern uint32 bcud_Q_accSwapBatt; //累计换电站容量,精度0.1ah
- extern uint32 vcud_M_accDrv; //累计行驶里程,精度0.1km
- extern uint8 bcud_pct_bcuSoh; //电池Soh,精度0.4%
- extern uint8 bcud_st_bcuComun; //电池通讯状态,0-通信中断,1-通信正常
- extern uint8 bcud_st_bcuMainRelay; //主继电器信号,0-保留 1-断开,2-关闭 3-异常
- extern uint8 bcud_st_bcuTmsLiquid; //热管理液位状态,1-液位正常,0-液位过低
- extern uint8 bcud_st_hvWork; //电池高压状态,0-高压开启 1-预充,2-高压关断,3-高压上电故障
- extern uint8 bcuv_Num_battSn[32]; //电池SN号码
- extern uint8 ebcd_flg_pluginLockSig; //互锁接插件信号状态,1-触发,0-无触发
- extern uint8 ebcd_flg_swapAdmit; //允许换电判断:0-不允许,1-允许
- extern uint8 ebcd_Nr_errMax; //故障等级:当前故障最大等级
- extern uint8 ebcd_Num_err1; //故障码1
- extern uint8 ebcd_Num_err2; //故障码2
- extern uint8 ebcd_st_ebcConnect; // Ebc通讯模式,0-无线蓝牙,1-有线连接 ,默认0
- extern uint8 ebcd_st_ebcLockWork; // Ebc解锁模式,0-单步模式,1-自动模式
- extern uint8 ebcd_st_ebcWork; // Ebc当前状态 0-行车,1-通讯,2-换电
- extern uint8 ebcd_st_errTable1; //故障表1,bit0-气压异常,bit1-液位异常,bit2-Flash读取异常
- extern uint8 ebcd_st_errTable2; //故障表2,bit0-互锁异常,bit1-整车CAN异常,bit2-电池CAN异常,bit3-锁钩异常,bit4-升降机异常,bit5-电池位置异常
- extern uint8 ebcd_st_errTable3; //故障表3,bit0-放电互锁异常,bit1-充电互锁异常,bit2-整车高压互锁异常
- extern uint8 ebcd_st_lockSensor; //锁紧传感器信号:bit0-bit3:传感器0-3的状态每,bit:1-触发,0-不触发
- extern uint8 ebcd_st_lockSucJug; //锁紧完成判断:0-完全未锁紧,1-完全锁紧,2-未完全锁紧"
- extern uint8 ebcd_st_pedstSensor; //底座落座传感器:bit0-bit1:传感器0-1的状态,每bit:1-触发,0-无触发
- extern uint8 ebcd_st_pedstSucJug; //电池底座到位判断:0-完全未到位,1-完全到位,2-未完全到位
- extern uint8 ebcd_st_pluginLockSig; //互锁接插件信号具体状态,1-触发,0-无触发
- extern uint8 ebcd_st_unlockSensor; //解锁传感器信号:bit0-bit3:传感器0-3的状态每,bit:1-触发,0-不触发
- extern uint8 ebcd_st_unlockSucJug; //解锁完成判断:0-完全未解锁,1-完全解锁,2-未完全解锁
- // extern uint8 vcud_P_airSensor; //压力传感器气压值:单位Mpa,精度0.01Mpa
- extern uint8 vcud_P_airSensorBack; //后桥气压值,单位Mpa,精度0.01Mpa
- extern uint8 vcud_P_airSensorForward; //前桥气压值,单位Mpa,精度0.01Mpa
- extern uint8 vcud_st_carStart; //整车启动状态,0001-车辆启动状态,0010-熄火,0011-其他状态,1111-无效
- extern uint8 vcud_st_footbrake; //脚刹信号,0-无效,1-有效
- extern uint8 vcud_st_gear; //档位信号,FF-倒挡(R),0-空挡(N),X-前进档(DX)X取1-12
- extern uint8 vcud_st_handbrake; //手刹信号,0-无效,1-有效
- extern uint8 vcud_st_keyOn; //钥匙信号,1-上电,0-下电
- extern uint8 vcud_st_Steer; //方向盘信号,bit0-左侧转向灯,bit1-右侧转向灯,每bit 0-OFF,1-ON
- extern uint8 vcud_st_vcuComun; // vcu通讯状态,0-通信中断,1-通信正常
- extern uint8 vcuv_Num_vin[17]; // VIN码
- extern uint8 bled_flg_lockCmd; //锁钩电磁阀锁紧命令,1-有效,0-无效
- extern uint8 bled_flg_unlockCmd; //锁钩电磁阀解锁命令,1-有效,0-无效
- extern uint8 bled_flg_lockCmdForce; //锁钩电磁阀锁紧强制命令,1-有效,0-无效
- extern uint8 bled_flg_unlockCmdForce; //锁钩电磁阀解锁强制命令,1-有效,0-无效
- extern uint8 bled_flg_topAscendCmd; //顶板上升命令,1-有效,0-无效
- extern uint8 bled_flg_topDescendCmd; //顶板下降命令,1-有效,0-无效
- extern uint8 bled_flg_topAscendCmdForce; //顶板强制上升命令,1-有效,0-无效
- extern uint8 bled_flg_topDescendCmdForce; //顶板强制下降命令,1-有效,0-无效
- extern uint8 bled_flg_openDustReCmd; //除尘打开指令,1-有效,0-无效
- extern uint8 bled_flg_closeDustReCmd; //除尘关闭指令,1-有效,0-无效
- extern uint8 bled_flg_Heart; //心跳维持指令
- extern uint8 bled_flg_getEbcData; //获取ebc数据指令
- extern uint8 bled_flg_getVcuData; //获取vcu数据指令
- extern uint8 bled_flg_getBmsData; //获取bms数据指令
- extern uint8 bled_flg_handShake; //握手指令
- extern uint8 bled_flg_swapBattDone; //换电完成指令
- extern uint8 bled_flg_backToDrv; //回到行驶状态指令
- extern uint8 bled_flg_autoLock; //自动锁定指令
- extern uint8 bled_flg_autoUnlock; //自动解锁指令
- extern uint8 bled_flg_toSwapMod; //换到换电状态
- extern uint8 bled_flg_safeStopCmd; //急停指令
- extern uint32 bled_Nr_softVer; // BLE软件版本
- extern uint8 bled_flg_role; // ble的主从模式 01-主,02-从
- extern uint8 bled_flg_bleConn; // ble蓝牙连接状态
- extern uint8 bled_flg_bleDisconn; // ble蓝牙断开状态
- extern uint8 bled_st_dataTrans; //蓝牙数据传输状态
- //正式变量
- typedef enum
- {
- DriveMode = 0,
- CommuMode = 1,
- SwapMode = 2
- } WorkType;
- extern uint8 ebcd_flg_Can2SendEnbale;
- extern uint8 ebcd_st_toBleAns;
- extern uint8 ebcd_P_airSensor;
- extern uint8 ebcd_T_plugin[4]; //四个接插件温度
- extern uint8 ebcd_flg_forbidHVOn; //禁止高压上电
- extern uint8 ebcb_flg_reqHvOff; //请求高压下电
- extern uint8 ebcd_flg_LockErr; //锁紧机构故障状态
- extern uint8 ebcd_flg_dChrgLockErr; //放电互锁故障状态
- extern uint8 ebcd_flg_chrgLockErr; //充电互锁故障状态
- extern uint8 ebcd_flg_dChgCnctOverTemp; //放电连接器过温标志
- extern uint8 ebcd_st_ebcWork; // Ebc当前状态 0-行车,1-通讯,2-换电
- extern uint8 ebcd_Nr_errMax; //故障等级:当前故障最大等级
- extern uint8 ebcd_Num_faultCode; // ebc故障码,未定义
- extern uint8 ebcd_st_chargingMod; //充电模式,1-车载充电,2-换电站充电
- extern uint8 ebdc_st_lockUpState; //锁止机构状态,0-故障,1-解锁成功,2-上锁成功
- extern uint8 ebdc_st_ConnecState; //换电连接器状态(充电回路&放电回路同时闭合代表闭合,有一路断开则为断开),0_未连接 1_连接
- extern uint8 m_flg_HVlock1; //互锁状态1
- extern uint8 m_flg_HVlock2; //互锁状态2
- extern uint16 Test_LockPressure;
- #define EEPDATA_START_SEC_VAR
- #include "MemMap.h"
- extern uint16 ebcd_Nr_swapBatt; //换电次数
- extern uint16 ebcd_Nr_swapSucBatt; //换电成功次数
- extern uint8 ebcd_flg_ebcManCtrlEn; // EBC手动控制使能
- extern uint8 ebcd_flg_ebcManCtrlMode; // EBC手动控制模式
- extern uint16 LockDelayTime; //锁定延时时间(传感器到位以后延时多少时间确定为锁定成功
- extern uint16 UnlockDelayTime; //解锁延时时间(传感器到位以后延时多少时间确定为解锁成功
- extern uint16 ManuControlTimes;
- extern uint8 sfmv_Num_FltEEsave;
- #define EEPDATA_STOP_SEC_VAR
- #include "MemMap.h"
- extern const uint8 T_table[240];
- extern const uint32 R_table[240];
- extern const uint8 DataPackCounter[21];
- extern const uint8 DataPackBegin[21];
- #endif /* SYSTEM_VEHICLE_COMMUNICATION_CANVAR_H_ */
|