Browse Source

【V3.0.0.19】-增加ekf观测量,区分高频调试信息和低频调试信息,bms升级状态上传更改

CHENJIE-PC\QiXiang_CHENJIE 3 years ago
parent
commit
b1ad1be058

+ 2 - 2
inc/AppConfig.h

@@ -2,7 +2,7 @@
  * @Author       : ChenJie
  * @Date         : 2021-10-14 09:27:15
  * @LastEditors  : ChenJie
- * @LastEditTime : 2021-10-19 10:27:48
+ * @LastEditTime : 2021-10-20 15:11:11
  * @Description  : App Config H file 配置文件,可以针对不同参数进行更改
  * @FilePath     : \PLAT\project\ec616_0h00\apps\qx_app\inc\AppConfig.h
  */
@@ -14,7 +14,7 @@
 #define DATA_MODULE_TYPE (1)           //1表示NB模块,2表示4G cat1
 #define EOLSTATE (0)                   //1表示下线检测跳过,使用默认值,0表示使用下线检测
 #define DEFAULT_SN "RLTEST00000000001" //默认上传的SN编码
-#define APPSWVERSION 0x03000012        //数据模块软件版本号
+#define APPSWVERSION 0x03000013        //数据模块软件版本号
 #define RELAYCONFIG 0                  //继电器配置
 #define TCP_ADD "iotp.fast-fun.cn"     //数据上传的地址
 #define TCP_PORT 8712                  //数据上传的端口

+ 7 - 1
inc/EmbeddedCoder_inc/BCUDisp.h

@@ -110,4 +110,10 @@ extern uint16_T cand_Nr_cellNr;                          /*循环发送的单体
 extern uint16_T cand_Q_cellCap;                          /*循环发送的单体容量; */
 extern uint16_T cand_V_chrgStartStat;                    /*循环发送的充电前单体电压; */
 extern uint16_T cand_Q_reqCp;                            /*循环发送的单体需求均衡容量; */
-extern uint16_T cand_Q_totalCp;                          /*循环发送的单体累计均衡容量; */
+extern uint16_T cand_Q_totalCp;                          /*循环发送的单体累计均衡容量; */
+
+
+extern uint16_T test_efkSocMin;
+extern uint16_T test_efkSocMax;
+extern real_T test_UpMin;
+extern real_T test_UpMax;

+ 17 - 12
src/AppTaskTcp.c

@@ -524,7 +524,7 @@ static void TcpDataInfoAssembleSend()
         VerMsgToTcpInfo.VerInfo.BmsInfo = BMS_INFO;
         VerMsgToTcpInfo.VerInfo.DataModuleType = DATA_MODULE_TYPE;
         VerMsgToTcpInfo.CRC = bcc_chk((UINT8 *)&VerMsgToTcpInfo, sizeof(VerMsgToTcpInfo) - 1);
-        if (NB_Fota_update_flag == FALSE)
+        if (NB_Fota_update_flag == FALSE && BMS_Fota_update_flag == FALSE)
         {
             len = tcpipConnectionSend(socContext.id, (UINT8 *)&VerMsgToTcpInfo, sizeof(VerMsgToTcpInfo), 0, 0, 0);
             if (len > 0)
@@ -539,21 +539,26 @@ static void TcpDataInfoAssembleSend()
             }
         }
     }
-    if (send_counter % 10 == 0)
+    UINT8 DebugFeq = 1;
+    if (send_counter % DebugFeq == 0)
     {
         DebugMsgtoTcpType DebugMsgInfo;
         UINT16 BufferLen = 0;
         UINT8 rbuf[1000];
-        sprintf((char *)rbuf, "%x,%d,%d,%d,,\
-                                %d,%d,%d,%d,,\
-                                %d,%d,%d,%d,%d,%d,%d,,\
-                                %d,%d,%d,%d,%d,%d,%d,,\
-                                %d,%d",
-                battProtectState, AppDataInfo.RelayControl, chargerConnectState, PowerVoltage,
-                tmsd_st_heatAct, sfmd_num_fltNum, sfmd_st_fltAct, sfmd_st_fltLevel,
-                socd_pct_ahSoc, socd_pct_ekfSoc, socd_pct_estSoc, socd_pct_battSoc, socd_pct_bcuSoc, battSOC * 10, sohv_Q_packCapArrEo[9],
-                sohd_Q_chrgEo, sohd_flg_chrgEndEo, cand_Nr_cellNr, cand_Q_cellCap, cand_V_chrgStartStat, cand_Q_reqCp, cand_Q_totalCp,
-                AppDataInfo.ExpiryTimeArray[1], AppDataInfo.ExpiryTimeArray[2]);
+        if (send_counter % (60 / DebugFeq) == 0)
+        {
+            sprintf((char *)rbuf, "A-%x,%d,%d,%x,%x,%d,%d",
+                    battProtectState, AppDataInfo.RelayControl, chargerConnectState, PowerVoltage, BMSupdatestatus,
+                    AppDataInfo.ExpiryTimeArray[1], AppDataInfo.ExpiryTimeArray[2]);
+        }
+        else if (send_counter % DebugFeq == 0)
+        {
+            sprintf((char *)rbuf, "B-%d,%d,%d,%d,%d,%d,\
+                                %d,%d,%d,%d,%d,%d,%d,%f,%f",
+                    socd_pct_ahSoc, socd_pct_ekfSoc, socd_pct_estSoc, socd_pct_battSoc, socd_pct_bcuSoc, battSOC * 10,
+                    battI, maxCellVol, minCellVol, battCellU[0], battCellU[1], test_efkSocMin, test_efkSocMax, test_UpMin, test_UpMax);
+        }
+
         BufferLen = strlen(rbuf);
         SendBuffer = malloc(BufferLen + sizeof(DebugMsgInfo));
         memcpy(SendBuffer + sizeof(DebugMsgInfo) - 1, rbuf, BufferLen);

+ 1 - 4
src/AppTaskUart.c

@@ -2,7 +2,7 @@
  * @Author       : ChenJie
  * @Date         : 2021-10-14 09:27:15
  * @LastEditors  : ChenJie
- * @LastEditTime : 2021-10-19 10:27:36
+ * @LastEditTime : 2021-10-20 15:05:30
  * @Description  : file content
  * @FilePath     : \PLAT\project\ec616_0h00\apps\qx_app\src\AppTaskUart.c
  */
@@ -187,9 +187,6 @@ static void UartTask(void *arg)
 			BMSupdatestatus = SP_BMS_Update_Service();
 #elif BMS_MANUFACTURE == 2
 			BMSupdatestatus = MS_BMS_Update_Service();
-#endif
-#ifdef DEBUGLOG
-			Debug_printf("B-U-S:%d\n", BMSupdatestatus);
 #endif
 			PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
 			BMS_Fota_update_flag = FALSE;

+ 7 - 2
src/EmbeddedCoder_src/BCUDisp.c

@@ -1,4 +1,5 @@
 
+
 #include "BCUDisp.h"
 
 uint8_T tmsd_st_heatAct;                          /*热管理请求状态; */
@@ -50,7 +51,6 @@ boolean_T ihd_st_relayControl;
 uint8_T ihd_st_heatForceControl;             
 uint8_T ihd_st_EOLState;
 
-					
 int16_T sfmd_I_curr;                              /*处理后整包电流 */
 uint16_T sfmd_T_modTMax;                          /*处理后模组温度最小 */
 uint16_T sfmd_T_modTMin;                          /*处理后模组温度最大 */
@@ -111,4 +111,9 @@ uint16_T cand_Nr_cellNr;                          /*循环发送的单体编号
 uint16_T cand_Q_cellCap;                          /*循环发送的单体容量; */
 uint16_T cand_V_chrgStartStat;                    /*循环发送的充电前单体电压; */
 uint16_T cand_Q_reqCp;                            /*循环发送的单体需求均衡容量; */
-uint16_T cand_Q_totalCp;                          /*循环发送的单体累计均衡容量; */
+uint16_T cand_Q_totalCp;                          /*循环发送的单体累计均衡容量; */
+
+uint16_T test_efkSocMin;
+uint16_T test_efkSocMax;
+real_T test_UpMin;
+real_T test_UpMax;

+ 20 - 18
src/EmbeddedCoder_src/SOC.c

@@ -146,10 +146,10 @@ void SOC(void)
     {
         soc_Min_Delay = (real_T)socn_pct_battSocEE * 0.1;
         Up_Min_Delay  = 0;
-        P_Min_Delay[0] = 1000;
+        P_Min_Delay[0] = 10;
 		P_Min_Delay[1] = 0;
 		P_Min_Delay[2] = 0;
-		P_Min_Delay[3] = 1000;
+		P_Min_Delay[3] = 10;
     }
     //参数查表
     ocv = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Min_Delay * 10),(&(cmnm_pct_soc[0])), (&(cmnm_V_ocv[0])),   12U) * 0.001;
@@ -171,14 +171,14 @@ void SOC(void)
     soc1 = soc_Min_Delay * A[0] + B[0] * battcurr;
     Up1  = Up_Min_Delay  * A[3] + B[1] * battcurr;
     UL= ocv + battcurr * Ro + Up1;
-    P1[0] = P_Min_Delay[0] + 0.002;
-    P1[1] = P_Min_Delay[1] * A[3] +0.002;
-    P1[2] = P_Min_Delay[2] * A[3] +0.002;
-    P1[3] = P_Min_Delay[3] * A[3] * A[3] +0.002;
+    P1[0] = P_Min_Delay[0] + 0.001;
+    P1[1] = P_Min_Delay[1] * A[3] + 0.001;
+    P1[2] = P_Min_Delay[2] * A[3] + 0.001;
+    P1[3] = P_Min_Delay[3] * A[3] * A[3] + 0.001;
 	
     //增益
-    K[0] = (P1[0] * H[0] + P1[2])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] +0.5 );
-    K[1] = (P1[1] * H[0] + P1[3])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] +0.5 );
+    K[0] = (P1[0] * H[0] + P1[2])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] + 0.5 );
+    K[1] = (P1[1] * H[0] + P1[3])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] + 0.5 );
 	
     //后验
     deltU  = (real_T)sfmd_V_cellUMin * 0.001 - UL;
@@ -194,7 +194,7 @@ void SOC(void)
     }
 	
     Up_Min_Delay  = Up1 + K[1] * deltU;
-	
+	test_UpMin = Up_Min_Delay;
     //P更新
     P_Min_Delay[0] = (1 - K[0] * H[0]) * P1[0] -K[0]* P1[1];
     P_Min_Delay[1] = -K[1] * H[0] * P1[0] + P1[1] * (1 - K[1]);
@@ -210,10 +210,10 @@ void SOC(void)
     {
         soc_Max_Delay  = (real_T)socn_pct_battSocEE * 0.1;
         Up_Max_Delay   = 0;
-        P_Max_Delay[0] = 1000;
+        P_Max_Delay[0] = 10;
 		P_Max_Delay[1] = 0;
 		P_Max_Delay[2] = 0;
-		P_Max_Delay[3] = 1000;
+		P_Max_Delay[3] = 10;
     }
     // 参数查表
     ocv = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Max_Delay * 10),(&(cmnm_pct_soc[0])), (&(cmnm_V_ocv[0])),  12U) * 0.001;
@@ -236,14 +236,14 @@ void SOC(void)
     Up1  = Up_Max_Delay  * A[3] + B[1] * battcurr;
     UL= ocv + battcurr * Ro + Up1;
 	
-    P1[0] = P_Max_Delay[0] + 0.002;
-    P1[1] = P_Max_Delay[1] * A[3] +0.002;
-    P1[2] = P_Max_Delay[2] * A[3] +0.002;
-    P1[3] = P_Max_Delay[3] * A[3] * A[3] +0.002;
+    P1[0] = P_Max_Delay[0] + 0.001;
+    P1[1] = P_Max_Delay[1] * A[3] + 0.001;
+    P1[2] = P_Max_Delay[2] * A[3] + 0.002;
+    P1[3] = P_Max_Delay[3] * A[3] * A[3] + 0.001;
 	
     //增益
-    K[0] = (P1[0] * H[0] + P1[2])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] +0.5 );
-    K[1] = (P1[1] * H[0] + P1[3])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] +0.5 );
+    K[0] = (P1[0] * H[0] + P1[2])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] + 0.5 );
+    K[1] = (P1[1] * H[0] + P1[3])/( H[0] * P1[0] * H[0] + P1[1] * H[0] + H[0] * P1[2] + P1[3] + 0.5 );
 	
     //后验
     deltU  = (real_T)sfmd_V_cellUMax * 0.001 - UL;
@@ -259,7 +259,7 @@ void SOC(void)
     }
     Up_Max_Delay  = Up1 + K[1] * deltU;
 
-	
+	test_UpMax = Up_Max_Delay;
     //P更新
     P_Max_Delay[0] = (1 - K[0] * H[0]) * P1[0] -K[0] * P1[1];
     P_Max_Delay[1] = -K[1] * H[0] * P1[0] + P1[1] * (1 - K[1]);
@@ -284,6 +284,8 @@ void SOC(void)
         factor=(uint16_T)(((uint16_T)((  (uint32_T)  (EKFSOCMin - 200)  << 6) / (800 - (EKFSOCMax-EKFSOCMin) - 200)) * 25U) >> 4);
     }
 	socd_pct_ekfSoc = (uint16_T)( (  (1 - (real_T)(factor * 0.01)) * (real_T) (EKFSOCMin * 0.1) +  (real_T)(factor * 0.01) * (real_T)( EKFSOCMax * 0.1)  ) * 10); 
+	test_efkSocMin  = EKFSOCMin;
+	test_efkSocMax  = EKFSOCMax;
 
 	//printf("4----factor:%d,socd_pct_ekfSoc:%d,EKFSOCMax:%d,EKFSOCMin:%d,\n",factor,socd_pct_ekfSoc,EKFSOCMax,EKFSOCMin);
     //======================================================================