123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- #include <BBox_Bcu.h>
- static process_Rte gProcess_Rte_Task;
- #define PROC_RTE_STATE_SWITCH(a) (gProcess_Rte_Task = a)
- //=========================================================================
- //=========================================================================
- //=========================================================================
- void BBox_BCU_Task(void *pvParameters)
- {
- uint16_T i;
- uint16_T RecvCounter = 0;
- static boolean_T Flg;
- //鍚姩寤惰繜娌″仛
- PROC_RTE_STATE_SWITCH(PROCESS_STATE_INIT);
- while (true)
- {
- switch (gProcess_Rte_Task)
- {
- //=========================鍒濆鍖�===============================
- case PROCESS_STATE_INIT:
- {
- BCU_initialize();
- BCUEEDataRead();
- PROC_RTE_STATE_SWITCH(PROCESS_STATE_WORK);
- break;
- }
- //============================宸ヤ綔妯″紡==========================
- case PROCESS_STATE_WORK:
- {
- if (TimerCounter % 100 == 0 && BBox_DataReadyFlag==1)
- {
- IH_Data_Update();
- /*
- bswv_V_cellU = 0;
- bswv_T_modT = 0;
- bswd_tm_month = 0;
- bswd_tm_day = 0;
- bswd_tm_hour = 0;
- bswd_tm_min = 0;
- bswd_tm_sec = 0;
- bswd_tm_year = 0;
- hvmd_st_operMod_T1 = 0;
- dcmd_st_chrgMod_T1 = 0;
- dcmd_st_chrgSts_T1 = 0;
- ihd_I_battCurr_T1 = 0;
- ihd_V_battU_T1 = 0;
- */
- // Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
- BCU_step();
- //
- if (socd_flg_EEsave == 1)
- {
- BCUEEDataSave();
- }
- // Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_ON);
- OH_Data_Update();
- }
- vTaskDelay(pdMS_TO_TICKS(10));
- break;
- }
- default:
- {
- PROC_RTE_STATE_SWITCH(PROCESS_STATE_INIT);
- break;
- }
- }
- }
- }
- //=========================鏁版嵁瀛樺偍========================================
- void BCUEEDataRead(void)
- {
- // memset(rtev_flg_EESt, 0, sizeof(rtev_flg_EESt));
- //时间
- ihd_tm_yearEi = BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_yearE;
- ihd_tm_monthEi = BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_monthE;
- ihd_tm_dayEi = BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_dayE;
- ihd_tm_hourEi = BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_hourE;
- ihd_tm_minEi = BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_minE;
- ihd_tm_secEi = BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_secE;
- //SOC
- socd_pct_bcuSocEi = BcuSaveDataInfo.BcuAppSaveDataInfo.socd_pct_bcuSocE;
- socd_pct_battSocEi = BcuSaveDataInfo.BcuAppSaveDataInfo.socd_pct_battSocE;
- sohd_pct_bcuSoh = BcuSaveDataInfo.BcuAppSaveDataInfo.sohd_pct_bcuSohE;
- /*/SOH
- sohd_flg_countEi = BcuSaveDataInfo.BcuAppSaveDataInfo.sohd_flg_countE;
- sohd_Q_chrgEi = BcuSaveDataInfo.BcuAppSaveDataInfo.sohd_Q_chrgE;
- memcpy(sohv_Q_cellCapEi, BcuSaveDataInfo.BcuAppSaveDataInfo.sohv_Q_cellCapE, sizeof(sohv_Q_cellCapEi));
- memcpy(sohv_V_cellUEi, BcuSaveDataInfo.BcuAppSaveDataInfo.sohv_V_cellUE, sizeof(sohv_V_cellUEi));
- memcpy(sohv_Q_packCapEi, BcuSaveDataInfo.BcuAppSaveDataInfo.sohv_Q_packCapE, sizeof(sohv_Q_packCapEi));
- //SOR
- memcpy(sorv_ohm_cellREi, BcuSaveDataInfo.BcuAppSaveDataInfo.sorv_ohm_cellRE, sizeof(sorv_ohm_cellREi));
- //BLC
- memcpy(blcv_Q_totalCpEi, BcuSaveDataInfo.BcuAppSaveDataInfo.blcv_Q_totalCpE, sizeof(blcv_Q_totalCpEi));
- memcpy(blcv_Q_reqCpEi, BcuSaveDataInfo.BcuAppSaveDataInfo.blcv_Q_reqCpE, sizeof(blcv_Q_reqCpEi));
- //ISC
- iscd_tm_chrgEi = BcuSaveDataInfo.BcuAppSaveDataInfo.iscd_tm_chrgE;
- iscd_tm_staticEi = BcuSaveDataInfo.BcuAppSaveDataInfo.iscd_tm_staticE;
- memcpy(iscv_ohm_chrgEi, BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_ohm_chrgE, sizeof(iscv_ohm_chrgEi));
- memcpy(iscv_ohm_staticEi, BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_ohm_staticE, sizeof(iscv_ohm_staticEi));
- memcpy(iscv_Q_chrgEi, BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_Q_chrgE, sizeof(iscv_Q_chrgEi));
- memcpy(iscv_Q_staticEi, BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_Q_staticE, sizeof(iscv_Q_staticEi));
- *///DAM
- //uint16
- damd_Nr_totalStaChrgEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Nr_totalStaChrgE;
- damd_Nr_totalChgEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Nr_totalChgE;
- damd_Nr_totalVehChrgEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Nr_totalVehChrgE ;
- //float
- damd_Q_totalChrgCpEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalChrgCpE;
- damd_E_totalChrgEngEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalChrgEngE;
- damd_Q_totalRegenCpEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalRegenCpE;
- damd_E_totalRegenEngEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalRegenEngE;
- damd_Q_totalDisChrgCpEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalDisChrgCpE;
- damd_E_totalDisChrgEngEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalDisChrgEngE;
- damd_Q_totalVehChrgCpEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalVehChrgCpE;
- damd_E_totalVehChrgEngEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalVehChrgEngE;
- damd_Q_totalSatChrgCpEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalSatChrgCpE ;
- damd_E_totalSatChrgEngEi = BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalSatChrgEngE;
- }
- void BCUEEDataSave(void)
- {
- BcuSaveDataInfo.BcuAppSaveDataInfo.bcuSaveFlg = TRUE;
- //
- BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_yearE = ihd_tm_yearEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_monthE = ihd_tm_monthEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_dayE = ihd_tm_dayEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_hourE = ihd_tm_hourEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_minE = ihd_tm_minEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.ihd_tm_secE = ihd_tm_secEo;
- //SOC
- BcuSaveDataInfo.BcuAppSaveDataInfo.socd_pct_bcuSocE = socd_pct_bcuSocEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.socd_pct_battSocE = socd_pct_battSocEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.sohd_pct_bcuSohE = sohd_pct_bcuSoh;
- /*/SOH
- BcuSaveDataInfo.BcuAppSaveDataInfo.sohd_flg_countE = sohd_flg_countEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.sohd_Q_chrgE = sohd_Q_chrgEo;
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.sohv_Q_cellCapE, sohv_Q_cellCapEo,sizeof(sohv_Q_cellCapEo));
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.sohv_V_cellUE,sohv_V_cellUEo, sizeof(sohv_V_cellUEo));
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.sohv_Q_packCapE,sohv_Q_packCapEo, sizeof(sohv_Q_packCapEo));
- //SOR
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.sorv_ohm_cellRE,sorv_ohm_cellREo, sizeof(sorv_ohm_cellREo));
- //BLC
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.blcv_Q_totalCpE, blcv_Q_totalCpEo,sizeof(blcv_Q_totalCpEo));
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.blcv_Q_reqCpE, blcv_Q_reqCpEo,sizeof(blcv_Q_reqCpEo));
- //ISC
- BcuSaveDataInfo.BcuAppSaveDataInfo.iscd_tm_chrgE = iscd_tm_chrgEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.iscd_tm_staticE = iscd_tm_staticEo;
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_ohm_chrgE, iscv_ohm_chrgEo,sizeof(iscv_ohm_chrgEo));
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_ohm_staticE, iscv_ohm_staticEo,sizeof(iscv_ohm_staticEo));
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_Q_chrgE, iscv_Q_chrgEo,sizeof(iscv_Q_chrgEo));
- memcpy(BcuSaveDataInfo.BcuAppSaveDataInfo.iscv_Q_staticE, iscv_Q_staticEo,sizeof(iscv_Q_staticEo));
- *///DAM
- //uint16
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Nr_totalStaChrgE = damd_Nr_totalStaChrgEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Nr_totalChgE = damd_Nr_totalChgEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Nr_totalVehChrgE = damd_Nr_totalVehChrgEo;
- //float
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalChrgCpE = damd_Q_totalChrgCpEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalChrgEngE = damd_E_totalChrgEngEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalRegenCpE = damd_Q_totalRegenCpEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalRegenEngE = damd_E_totalRegenEngEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalDisChrgCpE = damd_Q_totalDisChrgCpEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalDisChrgEngE = damd_E_totalDisChrgEngEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalVehChrgCpE = damd_Q_totalVehChrgCpEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalVehChrgEngE = damd_E_totalVehChrgEngEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_Q_totalSatChrgCpE = damd_Q_totalSatChrgCpEo;
- BcuSaveDataInfo.BcuAppSaveDataInfo.damd_E_totalSatChrgEngE = damd_E_totalSatChrgEngEo;
- }
|