Ver código fonte

在转换工作模式后重启 驻车时间不清零 (进入充放电模式,驻车时间清0)

tengfei.qi@fast-fun.com.cn 2 anos atrás
pai
commit
1b2f0404b3

+ 1 - 1
inc/AppConfig.h

@@ -15,7 +15,7 @@
 #define EOLSTATE (0)                   // 1表示下线检测跳过,使用默认值,0表示使用下线检测
 #define DEFAULT_SN "RLTEST00000000001" //默认上传的SN编码
 
-#define APPSWRELEASE 1          //软件测试版本标志位,0-测试,1-发布
+#define APPSWRELEASE 0          //软件测试版本标志位,0-测试,1-发布
 #define APPSWVERSION 0x03010041 //数据模块软件版本号
 
 #define RELAYCONFIG 1              //继电器配置

+ 6 - 7
src/AppTaskTcp.c

@@ -578,16 +578,15 @@ static void TcpDataInfoAssembleSend()
         UINT8 rbuf[1000];
         static UINT8 Debugcounter = 0;
         sprintf((char *)rbuf, "B-%d,%d,%d,%d,%d,,\
-                                %d,%d,%d,%d,%d,%d,,\
-                                %d,%d,%d,%d,%d,%d,%d,,\
                                 %d,%d,%d,%d,%d,,\
-                                %d,%d,%d,%d,%d,%d,%d,,\
+                                %d,%d,%d,%d,%d,,\
+                                %d,%d,%d,%d,%d,,\
+                                %d,%d,%d,%d,%d,%d,%d,%d,,\
                                 %d,%d,%d,,",
                 socd_pct_ahSoc, socd_pct_ekfSoc, socd_pct_battSoc, socd_pct_bcuSoc, pimd_pct_battSoc,
-                sfmd_I_curr, sfmd_V_cellUMax, sfmd_V_cellUMin, sfmv_V_cellU[0], sfmv_V_cellU[1], sfmv_V_cellU[2],
-                cand_idx_cellNr, appv_V_cellU[cand_idx_cellNr - 1], cand_Q_cellCap, ihd_tm_parkTime, sohd_Q_chrgEo, iscv_Q_remainCpEi[cand_idx_cellNr - 1], iscd_tm_totalEi,
-                pimd_V_ocv, pimd_R_ohm, pimd_R_polar, pimd_F_polar, pimd_flg_inval,
-                pimv_V_cellOcv[0], pimv_V_cellOcv[1], pimv_V_cellOcv[2], pimv_R_cellOhm[0], pimv_R_cellOhm[1], pimv_R_cellOhm[2], pimv_R_cellOhm[sfmd_idx_cellUMin],
+                sfmd_I_curr, sfmd_V_cellUMax, sfmd_V_cellUMin, sfmv_V_cellU[0],ihd_tm_parkTime,
+                cand_idx_cellNr, cand_Q_cellCap, sohd_Q_chrgEo, iscv_Q_remainCpEi[cand_idx_cellNr - 1], iscd_tm_totalEi,
+                pimd_V_ocv, pimd_R_ohm, pimd_R_polar, pimd_F_polar, pimd_flg_inval, pimv_R_cellOhm[sfmd_idx_cellUMin],ArrMax(pimv_R_cellOhm, 20),ArrMin(pimv_R_cellOhm, 20),
                 iscd_flg_flt[0], iscd_flg_flt[1], iscd_flg_flt[2]);
         if (Debugcounter % 5 == 0)
         {

+ 16 - 8
src/EmbeddedCoder_src/BCU.c

@@ -13,6 +13,7 @@ void BCU(void)
 {
     uint16_T i;
     uint16_T RecvCounter = 0;
+	static boolean_T Flg;
     while (TRUE)
     {
         if (UartRecvFlag == 1 || RecvCounter >= 15)
@@ -37,6 +38,7 @@ void BCU(void)
         case PROCESS_STATE_INIT:
         {
             BCU_Init();
+			Flg = 1;
             cmnc_num_cellUNum = AppDataInfo.BattCellCount; /* 电压采样点实际个数; */
             cmnc_num_modTNum = AppDataInfo.BattTempCount;  /* 温度采样点实际个数; */
 			ihd_st_EOLState = AppNVMData.EOLState;
@@ -59,8 +61,6 @@ void BCU(void)
             sfmd_flg_heatRunFltEi = BcuDataInfo.sfmd_flg_heatRunFltE;
             sfmd_flg_iscFltEi = BcuDataInfo.sfmd_flg_iscFltE;
             ihd_tm_parkTime = BcuDataInfo.ihd_tm_parkTimeE;
-			BcuDataInfo.ihd_tm_parkTimeE = 0;
-            BcuDataInfo.appDataModify = TRUE;
             PROC_BCU_STATE_SWITCH(PROCESS_STATE_WORK);
             break;
         }
@@ -90,7 +90,7 @@ void BCU(void)
                         PROC_BCU_STATE_SWITCH(PROCESS_STATE_SLEEP);
                         break;
                     }
-                    // printf("time:%d\n",ihd_tm_parkTime);
+                    //printf("time:%d,%d\n",ihd_tm_parkTime,ihd_st_workStat);
                     //
 
                     //数据获取
@@ -147,18 +147,26 @@ void BCU(void)
                     }
 
                     //
-                    if (BattWorkStateDelay == 0)
+                    if (ihd_st_workStat == 0)
                     {
                         memcpy(appv_V_cellU, sfmv_V_cellU, sizeof(sfmv_V_cellU));
                     }
-
+                   
+                    if(Flg == 1 && ihd_st_workStat != 0)
+                    {
+                        BcuDataInfo.ihd_tm_parkTimeE = 0;							
+					    BcuDataInfo.appDataModify = TRUE;
+					    Flg = 0;
+                    }
+                    
+ 
                     if (ihd_st_wakeUpStat == 8)
                     {
-						if (bcud_flg_firstRun)
+						if(bcud_flg_firstRun)
 						{
                            appd_st_preCyc = 1;
 						}
-						if(BattWorkStateDelay != 0)
+						if(ihd_st_workStat != 0)
 						{
 						   appd_st_preCyc = 0;
                         }
@@ -179,7 +187,7 @@ void BCU(void)
                 if (TimeCounter % 10 == 0)
                 {
                     ihd_tm_parkTime++;
-                    // printf("time:%d\n",ihd_tm_parkTime);
+                    //printf("time:%d\n",ihd_tm_parkTime);
                 }
                 if (TimeCounter % 1000 == 0)
                 {

+ 4 - 5
src/EmbeddedCoder_src/CDM.c

@@ -107,10 +107,9 @@ void CDM(void)
                 cdmn_M_P[1][0][i] = P[1][0];
                 cdmn_M_P[1][1][i] = P[1][1];
             }
-            if (arf > 0.04 || arf < -0.04)
-            {
-                cdmv_flg_inval[i] = true;
-            }
+
+            cdmv_flg_inval[i] = (arf > 0.04 || arf < -0.04);
+
 
             deltaE[i] = theta[0];
             deltaR[i] = theta[1];
@@ -123,7 +122,7 @@ void CDM(void)
     }
     else
     {
-        memset(cdmv_flg_inval, 0, sizeof(cdmv_flg_inval));
+       
         memset(cdmv_V_deltOCV, 0, sizeof(cdmv_V_deltOCV));
         memset(cdmv_R_deltOhm, 0, sizeof(cdmv_R_deltOhm));
     }

+ 16 - 27
src/EmbeddedCoder_src/PIM.c

@@ -100,11 +100,7 @@ void PIM(void)
         //参数更新
         
         temp = (real_T)pimn_V_volt[pimd_L_rls - 1] * 0.001 - (theta[0] * A[0] + theta[1] * A[1] + theta[2] * A[2] + theta[3] * A[3]);
-        test_U1 =temp;
-        if (temp > 0.03 || temp < -0.03)
-        {
-            pimn_flg_inval = 1;
-        }
+		pimn_flg_inval = (temp > 0.03 || temp < -0.03);
         for(i = 0;i < 4;i++)
         {
             theta[i] = theta[i] + K[i] * temp;
@@ -180,10 +176,10 @@ void PIM(void)
         pimd_R_ohm   = (uint16_T)(pimn_R_ohm   * 1000 * 1000);
         pimd_R_polar = (uint16_T)(pimn_R_polar * 1000 * 1000);
         pimd_F_polar = (uint16_T)(pimn_F_polar * 1000);
-		if(pimd_V_ocv > 4400 || pimd_V_ocv < 1000 || pimd_R_ohm < 1000 || pimd_R_ohm > 10000)
-		{
-		   pimn_flg_inval = 1;
-		}
+        if(pimd_V_ocv > 4400 || pimd_V_ocv < 1000 || pimd_R_ohm < 1000 || pimd_R_ohm > 10000)
+        {
+            pimn_flg_inval = 1;
+        }
     }
     else
     {
@@ -201,30 +197,23 @@ void PIM(void)
         pimv_R_cellOhm[i]   = pimd_R_ohm + cdmv_R_deltOhm[i];
         pimv_pct_cellSoc[i] = look1_u16tu16(pimv_V_cellOcv[i], cmnm_V_ocv, cmnm_pct_soc, 13);
         if((!pimn_flg_inval && !cdmv_flg_inval[i]))
-        {   
-			if (pimv_V_cellOcv[i] > 4400 || pimv_V_cellOcv[i] < 1000 || pimv_R_cellOhm[i] < 1000 || pimv_R_cellOhm[i] > 10000)
-			{ 
-				pimd_flg_inval = 1;
-			}
-			else
-			{
-			    pimv_flg_inval[i]  = 0;
-			}
+        {
+            pimv_flg_inval[i] = (pimv_V_cellOcv[i] > 4400 || pimv_V_cellOcv[i] < 1000 || pimv_R_cellOhm[i] < 1000 || pimv_R_cellOhm[i] > 10000);
         }
         else
         {
             pimv_flg_inval[i] = 1;
         }
     }
-	pimd_flg_inval = 0;
-	for(i = 0;i < cmnc_num_cellUNum;i++)
-	{
-       if(pimv_flg_inval[i] == 1)
-       {
-           pimd_flg_inval = 1;
-		   break;
-       }
-	}
+    pimd_flg_inval = 0;
+    for(i = 0;i < cmnc_num_cellUNum;i++)
+    {
+        if(pimv_flg_inval[i] == 1)
+        {
+            pimd_flg_inval = 1;
+            break;
+        }
+    }
     // 整包SOC
     socMin = 1000;
     socMax = 0;