AppGlobalVar.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /***
  2. * @Author: chenjie
  3. * @Date: 2022-10-27
  4. * @LastEditTime: 2022-11-10
  5. * @LastEditors: chenjie
  6. * @Description:
  7. * @FilePath: \S32K146_4G\code\app\AppGlobalVar.h
  8. * @Copyright (c) 2022 by chenjie, All Rights Reserved.
  9. */
  10. #ifndef APPGLOBALVAR_H_
  11. #define APPGLOBALVAR_H_
  12. #define APP_CAN_ENABLE
  13. #include "hal_adapter.h"
  14. #define BATT_SN_LEN 17
  15. extern const uint32 AppSwVersion;
  16. extern const uint8 DataModuleType;
  17. extern const uint16 HwVersion;
  18. extern const uint32 BlSwVersion;
  19. extern const uint32 DrvSwVersion;
  20. extern const uint8 BmsManuFacture;
  21. extern const uint8 BmsInfo;
  22. #define BMS_CELL_MAX_NUM 384
  23. #define BMS_TEMP_MAX_NUM 64
  24. typedef struct _AppDataType
  25. {
  26. uint8 BattCellCount;
  27. uint8 BattTempCount;
  28. } AppDataBody;
  29. extern bool TcpSysReboot;
  30. extern uint8 TcpbattSN[17];
  31. extern uint8 VIN[17];
  32. extern volatile uint32 TimerCounter;
  33. extern uint32 BattTempR[4];
  34. extern uint16 ErrorArray[10];
  35. extern uint8 Fota_update_flag;
  36. extern boolean Fota_Process_Going;
  37. extern uint8 Fota_error_flag;
  38. extern uint16 DeviceSpeed;
  39. typedef struct
  40. {
  41. uint8 RealLen;
  42. uint8 *DataPtr;
  43. } QueueDataTrans_Type;
  44. /*GPS*/
  45. extern QueueHandle_t GpsDataQueueHandle;
  46. extern sint16 xyzData[3];
  47. /*Hal_Can*/
  48. extern real_T returnFreq[3][5];
  49. extern real_T returnP[3][5];
  50. extern uint8 CanIf_u8TxConfirmCnt;
  51. extern boolean CanIf_bTxFlag;
  52. extern uint8 CanIf_u8RxIndicationCnt;
  53. extern boolean CanIf_bRxFlag;
  54. extern QueueHandle_t CanRecvQueueHandle0;
  55. extern QueueHandle_t CanRecvQueueHandle1;
  56. extern QueueHandle_t CanRecvQueueHandle2;
  57. extern TaskHandle_t Uart_Hal_RecvTask_Handle, Uart_Hal_SendTask_Handle, MainTask_Handle, Uart0Task_Handle, CanTask_Handle, GpsTask_Handle, Uart_4G_Task_Handle,BBox_BCU_Task_Handle;
  58. extern SemaphoreHandle_t sleep_mutex;
  59. extern uint8 CSQValue;
  60. extern sint8 SocketId;
  61. extern sint8 RegChkRet;
  62. extern char WebSiteIp[20];
  63. extern const char WebSiteName[];
  64. extern uint16 WebSitePort;
  65. extern char ImeiNum[15];
  66. extern char IccidNum[20];
  67. extern uint8 TcpWorkState;
  68. extern uint8 DeviceErrNum;
  69. extern uint8 globalSaveFlag;
  70. typedef struct _AppEppType
  71. {
  72. uint32 battDischrgAccCap;//单位mah
  73. uint32 battChrgAccCap;//单位mah
  74. uint32 battDischrgAccEnrg;//单位wh
  75. uint32 battChrgAccEnrg;//单位wh
  76. uint16 battCycleTimes;
  77. uint32 AccMileage;
  78. uint32 battBackChrgAccCap; //动能回收安时 mah
  79. uint32 battBackChrgAccEngy; //动能回收能量
  80. } AppEppBody;
  81. typedef struct _AppConfigType
  82. {
  83. bool appSaveFlg;
  84. bool eolFlg;
  85. uint8 deviceSn[17];
  86. AppEppBody AppDataInfo;
  87. uint8 re[128];
  88. } AppConfigBody;
  89. extern AppConfigBody AppConfigInfo;
  90. typedef struct _BcuSaveHader
  91. {
  92. uint8 crc;
  93. }BcuSaveHader;
  94. typedef struct _BcuAppSaveType
  95. {
  96. //uint8 16 byte
  97. //real time
  98. uint8 bcuSaveFlg;
  99. uint8 ihd_tm_yearE;
  100. uint8 ihd_tm_monthE;
  101. uint8 ihd_tm_dayE;
  102. uint8 ihd_tm_hourE;
  103. uint8 ihd_tm_minE;
  104. uint8 ihd_tm_secE;
  105. uint8 reU8[9];
  106. //uint16 2*8=16byte
  107. uint16 damd_Nr_totalStaChrgE;
  108. uint16 damd_Nr_totalChgE;
  109. uint16 damd_Nr_totalVehChrgE;
  110. uint16 reU16[5];
  111. //float 4*24=96byte
  112. float socd_pct_bcuSocE;
  113. float socd_pct_battSocE;
  114. float damd_Q_totalChrgCpE;
  115. float damd_E_totalChrgEngE;
  116. float damd_Q_totalRegenCpE;
  117. float damd_E_totalRegenEngE;
  118. float damd_Q_totalDisChrgCpE;
  119. float damd_E_totalDisChrgEngE;
  120. float damd_Q_totalVehChrgCpE;
  121. float damd_E_totalVehChrgEngE;
  122. float damd_Q_totalSatChrgCpE;
  123. float damd_E_totalSatChrgEngE;
  124. float reU32[12];
  125. } BcuAppSaveBody;
  126. typedef struct _BcuSaveType
  127. {
  128. BcuSaveHader header;
  129. BcuAppSaveBody BcuAppSaveDataInfo;
  130. }BcuSaveType;
  131. extern BcuSaveType BcuSaveDataInfo;
  132. #ifdef APP_CAN_ENABLE
  133. extern uint8 vehicleStatus;
  134. extern uint8 bmsHVOn;
  135. extern uint8 currentGearPosition;
  136. extern uint8 parkingBreakStatus;
  137. extern uint8 breakingStatus;
  138. extern uint32 ODO;
  139. extern uint8 dcdcWorkStatus;
  140. extern uint8 numOfChrgableSubsys;
  141. extern uint8 chrgableSubsysCode;
  142. extern uint16 vcuDCVol;
  143. // EBC
  144. extern uint8 ebcStatus;
  145. extern uint8 ebcAskHVOn;
  146. extern uint8 ebcAskHVOff;
  147. extern uint8 retainLockSignal;
  148. extern uint8 dischargeLockSignal;
  149. extern uint8 chargeLockSignal;
  150. extern uint8 chargeFlag;
  151. extern UINT32 BcuInTable[28];
  152. extern BOOL BcuRxShortError[28];
  153. extern BOOL BcuRxLongError[28];
  154. extern UINT8 BcuRxErrorCounter[28];
  155. extern UINT8 BcuRxFlag[28];
  156. extern UINT8 BMS_CellRecvFlg;
  157. extern UINT8 canRecvFramNum[BMS_CELL_MAX_NUM/3];
  158. extern UINT8 BMS_ReqVIN;
  159. extern UINT8 BMS_ReqHVOff;
  160. extern UINT8 BMS_ProtocolEditionH;
  161. extern UINT8 BMS_ProtocolEditionL;
  162. extern UINT8 BMS_CharDevNum;
  163. extern UINT8 BMS_FtPosRly;
  164. extern UINT8 BMS_FtNegRly;
  165. extern UINT8 BMS_FtPosCharRly1;
  166. extern UINT8 BMS_FtNegCharRly1;
  167. extern UINT8 BMS_FtPosCharRly2;
  168. extern UINT8 BMS_FtNegCharRly2;
  169. extern UINT8 BMS_FtHeatRly1;
  170. extern UINT8 BMS_FtHeatRly2;
  171. extern UINT8 BMS_StPosRly;
  172. extern UINT8 BMS_StNegRly;
  173. extern UINT8 BMS_StPreCharRly;
  174. extern UINT8 BMS_StPosCharRly1;
  175. extern UINT8 BMS_StNegCharRly1;
  176. extern UINT8 BMS_StPosCharRly2;
  177. extern UINT8 BMS_StNegCharRly2;
  178. extern UINT8 BMS_FtAuxRelayWeld;
  179. extern UINT8 BMS_BraOpenCirc;
  180. extern UINT8 BMS_FtBackCharCurrOutLim;
  181. extern UINT8 BMS_FtPosRlyOpen;
  182. extern UINT8 BMS_FtNegRlyOpen;
  183. extern UINT8 BMS_FtPosCharRly1Open;
  184. extern UINT8 BMS_FtPosCharRly2Open;
  185. extern UINT8 BMS_FtNegCharRly1Open;
  186. extern UINT8 BMS_FtNegCharRly2Open;
  187. extern UINT8 BMS_FtTMSContClose;
  188. extern UINT8 BMS_FtTMSContOpen;
  189. extern UINT8 BMS_FtTMS;
  190. extern UINT8 BMS_Ft24VSpy;
  191. extern UINT8 BMS_FtPACKSelfProt;
  192. extern UINT8 BMS_FtCharSockTempOver;
  193. extern UINT8 BMS_FtTempOutCtrl;
  194. extern UINT8 BMS_StPosHeatRly;
  195. extern UINT8 BMS_StNegHeatRly;
  196. extern UINT8 BMS_CharSysNum;
  197. extern UINT8 BMS_FtCode;
  198. extern UINT8 BMS_ST1CheckSum;
  199. extern UINT8 BMS_ST1Counter;
  200. extern UINT8 BMS_Mode;
  201. extern UINT8 BMS_AuxRlySt;
  202. extern UINT8 BMS_BattBalaSt;
  203. extern UINT8 BMS_CharGunSt;
  204. extern UINT8 BMS_CharMode;
  205. extern UINT8 BMS_CharSt;
  206. extern UINT8 BMS_FtLvl;
  207. extern UINT8 BMS_FtCellTempDiff;
  208. extern UINT8 BMS_FtCellTempHigh;
  209. extern UINT8 BMS_FtPACKOverVolt;
  210. extern UINT8 BMS_FtPACKUndeVolt;
  211. extern UINT8 BMS_FtSOCLow;
  212. extern UINT8 BMS_FtCellOverVolt;
  213. extern UINT8 BMS_FtCellUndeVolt;
  214. extern UINT8 BMS_FtIns;
  215. extern UINT8 BMS_FtCellOverVoltDiff;
  216. extern UINT8 BMS_FtCharCurrOver;
  217. extern UINT8 BMS_FtDisCharCurrOver;
  218. extern UINT8 BMS_FtCellTempLow;
  219. extern UINT8 BMS_FtBranVoltDifOver;
  220. extern UINT8 BMS_FtBMSHardWare;
  221. extern UINT8 BMS_FtSOCHigh;
  222. extern UINT8 BMS_FtSOCJump;
  223. extern UINT8 BMS_FtInCom;
  224. extern UINT8 BMS_FtSysMism;
  225. extern UINT8 BMS_FtHvIntLock;
  226. extern UINT8 BMS_FtSmoke;
  227. extern UINT8 BMS_FtFire;
  228. extern UINT8 BMS_FtNum;
  229. extern UINT8 BMS_PackSOC;
  230. extern UINT8 BMS_PackSOH;
  231. extern UINT8 BMS_MaxCellTemp;
  232. extern UINT8 BMS_MinCellTemp;
  233. extern UINT8 BMS_AverCellTemp;
  234. extern UINT8 BMS_MaxCellTempCSC;
  235. extern UINT8 BMS_MaxCellTempNum;
  236. extern UINT8 BMS_MinCellTempCSC;
  237. extern UINT8 BMS_MinCellTempNum;
  238. extern UINT8 BMS_MaxCellVoltCSC;
  239. extern UINT8 BMS_MaxCellVoltNum;
  240. extern UINT8 BMS_MinCellVoltCSC;
  241. extern UINT8 BMS_MinCellVoltNum;
  242. extern UINT8 BMS_InsDeteSt;
  243. extern UINT8 BMS_FtCharInsLow;
  244. extern UINT8 BMS_FtCurrSenr;
  245. extern UINT8 BMS_FtHeatingFilm;
  246. extern UINT8 BMS_FtMainLoopPreChar;
  247. extern UINT8 BMS_FtAuxLoopPreChar;
  248. extern UINT8 BMS_FtACANLost;
  249. extern UINT8 BMS_FtDCDC;
  250. extern UINT8 BMS_FtSOCDif;
  251. extern UINT8 BMS_FtCellOverDisChar;
  252. extern UINT8 BMS_FtCharOver;
  253. extern UINT8 BMS_FtContDisCharCurrOverLoad;
  254. extern UINT8 BMS_FtContCharCurrOverLoad;
  255. extern UINT8 BMS_Gun1DCNegTemp;
  256. extern UINT8 BMS_Gun1DCPosTemp;
  257. extern UINT8 BMS_Gun2DCNegTemp;
  258. extern UINT8 BMS_Gun2DCPosTemp;
  259. extern UINT8 BMS_CurrHeatSt;
  260. extern UINT8 BMS_CurrCoolSt;
  261. extern UINT8 BMS_FtCharCnct;
  262. extern UINT8 BMS_FtOverDisCharCurrDuringChar;
  263. extern UINT8 BMS_FtCharNTC;
  264. extern UINT8 BMS_FtELock;
  265. extern UINT8 BMS_CellVoltFramNum;
  266. extern UINT8 BMS_CellTempFramNum;
  267. extern UINT8 BMS_CSC_Code;
  268. extern UINT8 BMS_CellTemp[BMS_TEMP_MAX_NUM];
  269. extern UINT8 BMS_Checksum;
  270. extern UINT8 BMS_PackComp;
  271. extern UINT8 BMS_BattCodeLeng;
  272. extern UINT8 BMS_SN[27];
  273. extern UINT8 BMS_BattType;
  274. extern UINT8 BMS_CoolType;
  275. extern UINT8 BMS_CSC_Total;
  276. extern UINT8 BMS_CellVoltLevel;
  277. extern UINT8 BMS_CellMinVolt;
  278. extern UINT8 BMS_CellMaxVolt;
  279. extern UINT8 BMS_HVBranNum;
  280. extern UINT8 BMS_SingleHVBranchCellNum;
  281. extern UINT8 BMS_ReqMode;
  282. extern UINT8 BMS_HVCmd;
  283. extern UINT8 BMS_ChgSts;
  284. extern UINT8 BMS_HVRelaySts;
  285. extern UINT8 BMS_SetTemp;
  286. extern UINT8 BMS_Life;
  287. extern UINT8 BMS_CRC;
  288. extern UINT8 TMS_WorkStatus;
  289. extern UINT8 TMS_HVRelayST;
  290. extern UINT8 TMS_OutletTemp;
  291. extern UINT8 TMS_InletTemp;
  292. extern UINT8 TMS_ErrCode;
  293. extern UINT8 TMS_FaultLevel;
  294. extern UINT16 BMS_SoftwareVersion;
  295. extern UINT16 BMS_HardwareVersion;
  296. extern UINT16 BMS_PackCurr;
  297. extern UINT16 BMS_MaxCharCurr;
  298. extern UINT16 BMS_MaxDisCharCurr;
  299. extern UINT16 BMS_PosIns;
  300. extern UINT16 BMS_NegIns;
  301. extern UINT16 BMS_BattVolt;
  302. extern UINT16 BMS_LinkVolt;
  303. extern UINT16 BMS_MaxCellVolt;
  304. extern UINT16 BMS_AverCellVolt;
  305. extern UINT16 BMS_MinCellVolt;
  306. extern UINT16 BMS_ContChrgCurr;
  307. extern UINT16 BMS_ContDisCharCurr;
  308. extern UINT16 BMS_CharReqVolt;
  309. extern UINT16 BMS_CharReqCurr;
  310. extern UINT16 BMS_SysInsRes;
  311. extern UINT16 BMS_MaxDisCharPwr;
  312. extern UINT16 BMS_MaxCharPwr;
  313. extern UINT16 BMS_ContDisCharPwr;
  314. extern UINT16 BMS_ContCharPwr;
  315. extern UINT16 BMS_InstEngyCons;
  316. extern UINT16 BMS_TotalEngyCons;
  317. extern UINT16 BMS_SOE;
  318. extern UINT16 BMS_RmanCharTime;
  319. extern UINT16 BMS_CharNum;
  320. extern UINT16 BMS_CellVolt[BMS_CELL_MAX_NUM];
  321. extern UINT16 BMS_BattRateCap;
  322. extern UINT16 BMS_BattRateVolt;
  323. extern UINT16 BMS_BattRateEngy;
  324. extern UINT16 BMS_CellTotal;
  325. extern UINT16 BMS_TempTotal;
  326. extern UINT16 BMS_SingleCharEngy;
  327. extern UINT16 BMS_SingleCharCapy;
  328. extern UINT16 BMS_HVVolt;
  329. extern UINT16 TMS_ReqPow;
  330. extern UINT32 BMS_TotalCharEngy;
  331. extern UINT32 BMS_TotalDischarEngy;
  332. extern UINT32 BMS_TotalBackCharEngy;
  333. extern UINT32 BMS_TotalStaCharEngy;
  334. extern UINT32 BMS_TotalGunCharEngy;
  335. extern UINT32 BMS_TotalGunCharCapy;
  336. extern UINT32 BMS_TotalCharCapy;
  337. extern UINT32 BMS_TotalDischarCapy;
  338. extern UINT32 BMS_TotalBackCharCapy;
  339. extern UINT32 BMS_TotalStaCharCapy;
  340. #endif
  341. /************************************************************
  342. *BBox计算变量定义区
  343. ************************************************************/
  344. extern UINT8 BBox_DataReadyFlag;
  345. extern UINT8 BBox_VCUConSt;
  346. extern UINT8 BBox_PackSOC;
  347. extern UINT8 BBox_PackSOH;
  348. extern UINT32 BBox_TotalCharEngy;
  349. extern UINT32 BBox_TotalDischarEngy;
  350. extern UINT32 BBox_TotalBackCharEngy;
  351. extern UINT32 BBox_TotalStaCharEngy;
  352. extern UINT32 BBox_TotalGunCharEngy;
  353. extern UINT32 BBox_TotalGunCharCapy;
  354. extern UINT32 BBox_TotalCharCapy;
  355. extern UINT32 BBox_TotalDischarCapy;
  356. extern UINT32 BBox_TotalBackCharCapy;
  357. extern UINT32 BBox_TotalStaCharCapy;
  358. extern UINT32 BBox_Dq_Dv_MAX;
  359. extern UINT32 BBox_Dq_Dv_MIN;
  360. extern float BBox_SocCorrectionValue;
  361. #endif /* APPGLOBALVAR_H_ */