Ver Fonte

【V3.1.243.65】加热逻辑更改,故障清除更改,测试版本

CHENJIE-PC\QiXiang_CHENJIE há 2 anos atrás
pai
commit
74b236f465
4 ficheiros alterados com 71 adições e 79 exclusões
  1. 2 2
      inc/AppConfig.h
  2. 2 1
      src/AppTaskTcp.c
  3. 1 1
      src/EmbeddedCoder_src/BCU.c
  4. 66 75
      src/EmbeddedCoder_src/CDM.c

+ 2 - 2
inc/AppConfig.h

@@ -2,7 +2,7 @@
  * @Author       : ChenJie
  * @Date         : 2021-10-14 09:27:15
  * @LastEditors  : ChenJie
- * @LastEditTime : 2022-01-01 21:03:45
+ * @LastEditTime : 2022-01-04 14:55:18
  * @Description  : App Config H file 配置文件,可以针对不同参数进行更改
  * @FilePath     : \PLAT\project\ec616_0h00\apps\qx_app\inc\AppConfig.h
  */
@@ -16,7 +16,7 @@
 #define DEFAULT_SN "RLTEST00000000001" //默认上传的SN编码
 
 #define APPSWRELEASE 0          //软件测试版本标志位,0-测试,1-发布
-#define APPSWVERSION 0x0301F441 //数据模块软件版本号
+#define APPSWVERSION 0x0301F341 //数据模块软件版本号
 
 #define RELAYCONFIG 1              //继电器配置
 #define TCP_ADD "iotp.fast-fun.cn" //数据上传的地址

+ 2 - 1
src/AppTaskTcp.c

@@ -880,12 +880,13 @@ static void TcpDataInfoRecvHandle()
                     MEMCPY(AppDataInfo.ExpiryTimeArray, ExpiryUTC8TimeArray, 6);
                     AppDataInfo.appDataModify = TRUE;
                     tcpipConnectionSend(socContext.id, TcpCmdAnswer, 31, 0, 0, 0);
-#ifdef USING_PRINTF
+#ifdef USING_PRINTF1
                     printf("rental!\n");
                     for (UINT8 i = 0; i < 6; i++)
                         printf("%d  ", ExpiryUTC8TimeArray[i]);
 #endif
                     BattLockFunc();
+                    ihd_flg_DTCClear = 1;
                 }
                 else
                 {

+ 1 - 1
src/EmbeddedCoder_src/BCU.c

@@ -131,7 +131,7 @@ void BCU(void)
                     ihd_st_disChrgMosControl = DisChargeForbiddenControl == 0;
                     ihd_st_relayControl = RelayForbiddenControl == 0;
 
-					ihd_st_heatStat = battHeatEnableState;
+                    ihd_st_heatStat = battHeatEnableState;
                     // ihd_flg_DTCClear = 1;   //////clear
 
                     //调用算法

+ 66 - 75
src/EmbeddedCoder_src/CDM.c

@@ -11,132 +11,123 @@ void CDM(void)
     real_T cmdn_V_cellUDelt;
     static real_T cdmn_M_P[2][2][cmnc_num_cellUNumMax];
     real_T P[2][2];
-	real_T A[2];
-	real_T K[2];
-	real_T arf;
-	real_T theta[2];
+    real_T A[2];
+    real_T K[2];
+    real_T arf;
+    real_T theta[2];
     static real_T deltaE[cmnc_num_cellUNumMax];
     static real_T deltaR[cmnc_num_cellUNumMax];
-	static int16_T cdmn_I_curr[cdmd_L_rls];
+    static int16_T cdmn_I_curr[cdmd_L_rls];
     uint16_T i;
     static uint8_T cmdn_st_workStat_Delay;
     static uint8_T cdmn_num_Cnt;
 
-
-
-   
     //------模式切换后重置--------------------
     if (cmdn_st_workStat_Delay != 1 && ihd_st_workStat == 1)
     {
         cdmd_flg_firstRun = true;
     }
-	
-   //初值归零---------------------------------
-   if (cdmd_flg_firstRun)
-   {
-	   cdmn_num_Cnt = 0;
-	   for (i = 0; i < cmnc_num_cellUNum; i++)
-	   {
-		   cdmn_M_P[0][0][i] = 10;
-		   cdmn_M_P[0][1][i] = 0;
-		   cdmn_M_P[1][0][i] = 0;
-		   cdmn_M_P[1][1][i] = 10;
-		   deltaE[i] = 0;
-		   deltaR[i] = 0;
-		   cdmv_flg_inval[i] = 1;
-	   }
-   }
-   //记忆区间-----------------------------------
-   	if (pimd_flg_firstRun)
+
+    //初值归零---------------------------------
+    if (cdmd_flg_firstRun)
+    {
+        cdmn_num_Cnt = 0;
+        for (i = 0; i < cmnc_num_cellUNum; i++)
+        {
+            cdmn_M_P[0][0][i] = 10;
+            cdmn_M_P[0][1][i] = 0;
+            cdmn_M_P[1][0][i] = 0;
+            cdmn_M_P[1][1][i] = 10;
+            deltaE[i] = 0;
+            deltaR[i] = 0;
+            cdmv_flg_inval[i] = 1;
+        }
+    }
+    //记忆区间-----------------------------------
+    if (pimd_flg_firstRun)
     {
         for (i = 0; i < cdmd_L_rls; i++)
         {
             cdmn_I_curr[i] = sfmd_I_curr;
         }
-	}
+    }
     else
     {
         for (i = 0; i < cdmd_L_rls - 1; i++)
         {
-            cdmn_I_curr[i] = cdmn_I_curr[i+1];
+            cdmn_I_curr[i] = cdmn_I_curr[i + 1];
         }
         cdmn_I_curr[i] = sfmd_I_curr;
     }
-	
 
     //放电使能----------------------------------------
-    if (ihd_st_workStat == 1 && ihd_st_heatStat == 0) 
-    { 
-        for (i = 1; i < 2; i++)
+    if (ihd_st_workStat == 1 && ihd_st_heatStat == 0)
+    {
+        for (i = 1; i < cmnc_num_cellUNum; i++)
         {
             //新增
-            cmdn_V_cellUDelt =  (real_T)(sfmv_V_cellU[i] - sfmv_V_cellU[0]) * 0.001;   // #0单体为基准
+            cmdn_V_cellUDelt = (real_T)(sfmv_V_cellU[i] - sfmv_V_cellU[0]) * 0.001; // #0单体为基准
             A[0] = 1;
-			A[1] = (real_T)cdmn_I_curr[cdmd_L_rls - 1] * 0.1;
+            A[1] = (real_T)cdmn_I_curr[cdmd_L_rls - 1] * 0.1;
 
             theta[0] = deltaE[i];
-		    theta[1] = deltaR[i];
-            K[0] = (cdmn_M_P[0][0][i] * A[0] + cdmn_M_P[0][1][i] * A[1])/(1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] +  (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1] );
-			K[1] = (cdmn_M_P[1][0][i] * A[0] + cdmn_M_P[1][1][i] * A[1])/(1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] +  (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1] );	
+            theta[1] = deltaR[i];
+            K[0] = (cdmn_M_P[0][0][i] * A[0] + cdmn_M_P[0][1][i] * A[1]) / (1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] + (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1]);
+            K[1] = (cdmn_M_P[1][0][i] * A[0] + cdmn_M_P[1][1][i] * A[1]) / (1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] + (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1]);
 
-		
             arf = cmdn_V_cellUDelt - (theta[0] * A[0] + theta[1] * A[1]);
-			theta[0] = theta[0] + K[0] * arf;
-			theta[1] = theta[1] + K[1] * arf;
-
+            theta[0] = theta[0] + K[0] * arf;
+            theta[1] = theta[1] + K[1] * arf;
 
-			P[0][0] = cdmn_M_P[0][0][i] - K[0] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);
-			P[0][1] = cdmn_M_P[0][1][i] - K[0] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);	
-			P[1][0] = cdmn_M_P[1][0][i] - K[1] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);	
-			P[1][1] = cdmn_M_P[1][1][i] - K[1] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);	
+            P[0][0] = cdmn_M_P[0][0][i] - K[0] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);
+            P[0][1] = cdmn_M_P[0][1][i] - K[0] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);
+            P[1][0] = cdmn_M_P[1][0][i] - K[1] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);
+            P[1][1] = cdmn_M_P[1][1][i] - K[1] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);
 
             cdmn_M_P[0][0][i] = P[0][0];
             cdmn_M_P[0][1][i] = P[0][1];
             cdmn_M_P[1][0][i] = P[1][0];
             cdmn_M_P[1][1][i] = P[1][1];
 
-			//删去
-            if(cdmn_num_Cnt > cdmd_L_rls)
+            //删去
+            if (cdmn_num_Cnt > cdmd_L_rls)
             {
-            	A[0] = 1;
-				A[1] = (real_T)cdmn_I_curr[0] * 0.1;
-	         	K[0] = (cdmn_M_P[0][0][i] * A[0] + cdmn_M_P[0][1][i] * A[1])/(1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] +  (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1] );
-				K[1] = (cdmn_M_P[1][0][i] * A[0] + cdmn_M_P[1][1][i] * A[1])/(1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] +  (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1] );	
-			  
-				P[0][0] = cdmn_M_P[0][0][i] + K[0] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);
-				P[0][1] = cdmn_M_P[0][1][i] + K[0] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);	
-				P[1][0] = cdmn_M_P[1][0][i] + K[1] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);	
-				P[1][1] = cdmn_M_P[1][1][i] + K[1] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);	
-		
-            	cdmn_M_P[0][0][i] = P[0][0];
-            	cdmn_M_P[0][1][i] = P[0][1];
-            	cdmn_M_P[1][0][i] = P[1][0];
-            	cdmn_M_P[1][1][i] = P[1][1];
+                A[0] = 1;
+                A[1] = (real_T)cdmn_I_curr[0] * 0.1;
+                K[0] = (cdmn_M_P[0][0][i] * A[0] + cdmn_M_P[0][1][i] * A[1]) / (1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] + (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1]);
+                K[1] = (cdmn_M_P[1][0][i] * A[0] + cdmn_M_P[1][1][i] * A[1]) / (1 + (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]) * A[0] + (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]) * A[1]);
+
+                P[0][0] = cdmn_M_P[0][0][i] + K[0] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);
+                P[0][1] = cdmn_M_P[0][1][i] + K[0] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);
+                P[1][0] = cdmn_M_P[1][0][i] + K[1] * (A[0] * cdmn_M_P[0][0][i] + A[1] * cdmn_M_P[1][0][i]);
+                P[1][1] = cdmn_M_P[1][1][i] + K[1] * (A[0] * cdmn_M_P[0][1][i] + A[1] * cdmn_M_P[1][1][i]);
+
+                cdmn_M_P[0][0][i] = P[0][0];
+                cdmn_M_P[0][1][i] = P[0][1];
+                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)
+            if (arf > 0.04 || arf < -0.04)
             {
                 cdmv_flg_inval[i] = true;
             }
-			
-			deltaE[i] = theta[0];
+
+            deltaE[i] = theta[0];
             deltaR[i] = theta[1];
-			test_U[i] = arf;
-			cdmv_V_deltOCV[i] = (int16_T)(deltaE[i]  * 1000);
-            cdmv_R_deltOhm[i] = (int16_T)(deltaR[i]  * 1000 * 1000);
+            test_U[i] = arf;
+            cdmv_V_deltOCV[i] = (int16_T)(deltaE[i] * 1000);
+            cdmv_R_deltOhm[i] = (int16_T)(deltaR[i] * 1000 * 1000);
         }
         //
         cdmn_num_Cnt = cdmn_num_Cnt + 1;
     }
     else
     {
-        memset(cdmv_flg_inval,0,sizeof(cdmv_V_deltOCV));
-		memset(cdmv_V_deltOCV,0,sizeof(cdmv_V_deltOCV));
-		memset(cdmv_R_deltOhm,0,sizeof(cdmv_R_deltOhm));
+        memset(cdmv_flg_inval, 0, sizeof(cdmv_V_deltOCV));
+        memset(cdmv_V_deltOCV, 0, sizeof(cdmv_V_deltOCV));
+        memset(cdmv_R_deltOhm, 0, sizeof(cdmv_R_deltOhm));
     }
-	
-	
+
     cdmd_flg_firstRun = false;
-	cmdn_st_workStat_Delay = ihd_st_workStat;
+    cmdn_st_workStat_Delay = ihd_st_workStat;
 }
-
-