Browse Source

【V3.0.0.18】-进行了继电器配置,屏蔽了故障动作,新增未完成下线检测闪故障灯,新增下线检测未完成初始值获取均查表,更改加热板判断阈值。

CHENJIE-PC\QiXiang_CHENJIE 3 years ago
parent
commit
b29b37f2d6

+ 5 - 5
inc/AppConfig.h

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

+ 1 - 1
inc/EmbeddedCoder_inc/BCUCal.h

@@ -15,7 +15,7 @@ extern const uint16_T cmnm_R_ohm[13];       /* 电池放电参数的Ro数组;
 extern const uint16_T cmnm_R_polar[13];       /* 电池放电参数的Rp数组; */
 extern const uint16_T cmnm_V_ocv[13];       /* 电池放电参数的OCV数组; */
 extern const uint16_T cmnm_pct_soc[13];                         /* 电池放电参数的SOC数组; */
-extern const uint16_T cmnc_V_chrgFulV;                     /* 充满电的截至电压; */
+extern const uint16_T cmnc_V_chrgFul;                     /* 充满电的截至电压; */
 
 extern const int16_T sfmc_I_chrgCurrOverThr;                 /* 充电电流阈值 */
 extern const int16_T sfmc_I_disChrgCurrOverThr;              /* 放电电流阈值 */

+ 7 - 0
inc/EmbeddedCoder_inc/BCUDisp.h

@@ -47,6 +47,8 @@ extern uint16_T ihv_V_cellU[28];                         /*电池单体电压(
 extern boolean_T ihd_st_chrgMosControl;    
 extern boolean_T ihd_st_disChrgMosControl; 
 extern boolean_T ihd_st_relayControl;    
+extern uint8_T ihd_st_heatForceControl;
+extern uint8_T ihd_st_EOLState;
 
 extern int16_T sfmd_I_curr;                              /*处理后整包电流 */
 extern uint16_T sfmd_T_modTMax;                          /*处理后模组温度最小 */
@@ -99,6 +101,11 @@ extern uint16_T sohv_Q_packCapArrEo[10];                 /*10次整包容量(
 extern uint16_T sohv_V_chrgStartStatEi[28];              /*充电开始时刻的单体电压(数组)读取量; */
 extern uint16_T sohv_V_chrgStartStatEo[28];              /*充电开始时刻的单体电压(数组)写入量; */
 
+extern uint8_T cmd_st_chrgMod;                           /* 充电模式  */
+extern uint8_T cmd_st_chrgSt;                            /* 充电状态  */
+extern uint16_T cmd_I_chrgCurrReq;                       /* 充电需求电流  */
+extern uint8_T cmd_idx_chrgEndReason;                    /* 充电结束原因  */
+
 extern uint16_T cand_Nr_cellNr;                          /*循环发送的单体编号; */
 extern uint16_T cand_Q_cellCap;                          /*循环发送的单体容量; */
 extern uint16_T cand_V_chrgStartStat;                    /*循环发送的充电前单体电压; */

+ 2 - 2
src/AppFunc.c

@@ -3,7 +3,7 @@
  * @Date         : 2021-10-14 09:27:15
  * @Version      : V3.0
  * @LastEditors  : ChenJie
- * @LastEditTime : 2021-10-18 15:43:29
+ * @LastEditTime : 2021-10-19 11:54:15
  * @Description  : 应用层函数定义区,UTF-8
  * @FilePath     : \PLAT\project\ec616_0h00\apps\qx_app\src\AppFunc.c
  */
@@ -545,7 +545,7 @@ void LEDDisplay(void)
 				if ((((battWarningState >> 10) & 0x01) == 0x01) && ((battWarningState & 0xFFFFFBFF) == 0x00))
 					return;
 			}
-			if (getbit(sfmd_st_fltAct, 1) == 1) //电池存在故障
+			if (getbit(sfmd_st_fltAct, 1) == 1 || AppNVMData.EOLState == 0) //电池存在故障,或者未完成下线检测
 			{
 				if (ErrorLightTimer < (UINT8)(LEDFlashPeriod * DutyRatio))
 				{

+ 26 - 22
src/AppTaskUart.c

@@ -2,7 +2,7 @@
  * @Author       : ChenJie
  * @Date         : 2021-10-14 09:27:15
  * @LastEditors  : ChenJie
- * @LastEditTime : 2021-10-18 11:39:42
+ * @LastEditTime : 2021-10-19 10:27:36
  * @Description  : file content
  * @FilePath     : \PLAT\project\ec616_0h00\apps\qx_app\src\AppTaskUart.c
  */
@@ -293,9 +293,10 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle, UartBuffer UartAnswerDat
 	DischargePermitState = getbit((UartAnswerData.data[(0x1B + AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP) * 2 + 1]), 0); //放电允许状态,1-允许,0禁止
 	RelayControlState = getbit((UartAnswerData.data[(0x09 + AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP) * 2 + 1]), 0);	  //继电器状态,1-继电器断开,0-继电器吸合
 	//控制集中处理
-
+	UINT8 BcuFltAct = 0;
+	BcuFltAct = sfmd_st_fltAct & 0x00;
 	//控制充电禁止
-	if (getbit(sfmd_st_fltAct, 6) == 0)
+	if (getbit(BcuFltAct, 6) == 0)
 	{
 		if (maxCellVol > 4180 && maxCellVol < 5000)
 		{
@@ -306,12 +307,12 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle, UartBuffer UartAnswerDat
 			ChargeForbiddenControl = 0;
 		}
 	}
-	else if (getbit(sfmd_st_fltAct, 6) == 1)
+	else if (getbit(BcuFltAct, 6) == 1)
 	{
 		ChargeForbiddenControl = 1;
 	}
 	//控制放电禁止
-	if (getbit(sfmd_st_fltAct, 5) == 0)
+	if (getbit(BcuFltAct, 5) == 0)
 	{
 		if (AppDataInfo.BattLock == FALSE)
 		{
@@ -322,12 +323,12 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle, UartBuffer UartAnswerDat
 			DisChargeForbiddenControl = 1;
 		}
 	}
-	else if (getbit(sfmd_st_fltAct, 5) == 1)
+	else if (getbit(BcuFltAct, 5) == 1)
 	{
 		DisChargeForbiddenControl = 1;
 	}
 	//控制继电器断开
-	if (getbit(sfmd_st_fltAct, 3) == 0)
+	if (getbit(BcuFltAct, 3) == 0)
 	{
 		if (AppDataInfo.RelayControl == TRUE)
 		{
@@ -338,7 +339,7 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle, UartBuffer UartAnswerDat
 			RelayForbiddenControl = 0;
 		}
 	}
-	else if (getbit(sfmd_st_fltAct, 3) == 1)
+	else if (getbit(BcuFltAct, 3) == 1)
 	{
 		RelayForbiddenControl = 1;
 	}
@@ -383,25 +384,28 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle, UartBuffer UartAnswerDat
 		UartWriteData.Data[1] = (ChargePermitState << 1) | 0x01;
 		osMessageQueuePut(UartWriteCmdHandle, &UartWriteData, 0, 10);
 	}
-	if ((RelayForbiddenControl == 1) && (RelayControlState == 0x00)) //将继电器断开
+	if (RELAYCONFIG == 1)
 	{
+		if ((RelayForbiddenControl == 1) && (RelayControlState == 0x00)) //将继电器断开
+		{
 #ifdef USING_PRINTF1
-		printf("[%d]try to cut relay \n", __LINE__);
+			printf("[%d]try to cut relay \n", __LINE__);
 #endif
-		UartWriteData.WriteCmd = 0x04;
-		UartWriteData.Data[0] = 0x80;
-		UartWriteData.Data[1] = 0x00 | (ChargePermitState << 1) | DischargePermitState;
-		osMessageQueuePut(UartWriteCmdHandle, &UartWriteData, 0, 10);
-	}
-	else if ((RelayForbiddenControl == 0) && (RelayControlState == 0x01)) //继电器闭合
-	{
+			UartWriteData.WriteCmd = 0x04;
+			UartWriteData.Data[0] = 0x80;
+			UartWriteData.Data[1] = 0x00 | (ChargePermitState << 1) | DischargePermitState;
+			osMessageQueuePut(UartWriteCmdHandle, &UartWriteData, 0, 10);
+		}
+		else if ((RelayForbiddenControl == 0) && (RelayControlState == 0x01)) //继电器闭合
+		{
 #ifdef USING_PRINTF1
-		printf("[%d]try to close relay \n", __LINE__);
+			printf("[%d]try to close relay \n", __LINE__);
 #endif
-		UartWriteData.WriteCmd = 0x04;
-		UartWriteData.Data[0] = 0x00;
-		UartWriteData.Data[1] = 0x00 | (ChargePermitState << 1) | DischargePermitState;
-		osMessageQueuePut(UartWriteCmdHandle, &UartWriteData, 0, 10);
+			UartWriteData.WriteCmd = 0x04;
+			UartWriteData.Data[0] = 0x00;
+			UartWriteData.Data[1] = 0x00 | (ChargePermitState << 1) | DischargePermitState;
+			osMessageQueuePut(UartWriteCmdHandle, &UartWriteData, 0, 10);
+		}
 	}
 }
 /**

+ 5 - 5
src/BCU.c

@@ -36,6 +36,7 @@ void BCU(void)
             sfmd_flg_mainCirClosFltEi = BcuDataInfo.sfmd_flg_mainCirClosFltE;
             sfmd_flg_heatCirClosFltEi = BcuDataInfo.sfmd_flg_heatCirClosFltE;
             sfmd_flg_heatCirOpenFltEi = BcuDataInfo.sfmd_flg_heatCirOpenFltE;
+            ihd_st_EOLState = AppNVMData.EOLState;
             PROC_BCU_STATE_SWITCH(PROCESS_STATE_WORK);
             break;
         }
@@ -92,11 +93,10 @@ void BCU(void)
                     ihd_flg_disChrgModTLowFlt = ((battWarningState >> 22) & 0x01) == 1;
                     ihd_flg_chrgModTLowFlt = ((battWarningState >> 23) & 0x01) == 1;
                     ihd_flg_currOpenFlt = 0;
-					ihd_st_chrgMosControl    = ChargeForbiddenControl == 0;
-					ihd_st_disChrgMosControl = DisChargeForbiddenControl  == 0;
-				    ihd_st_relayControl      = RelayForbiddenControl  == 0;
-				   
-
+                    ihd_st_chrgMosControl = ChargeForbiddenControl == 0;
+                    ihd_st_disChrgMosControl = DisChargeForbiddenControl == 0;
+                    ihd_st_relayControl = RelayForbiddenControl == 0;
+                    ihd_st_heatForceControl = HeatForceControl;
                     //=============================================================================
                     SFM();
                     TMS();

+ 83 - 88
src/EmbeddedCoder_src/BCUCal.c

@@ -1,105 +1,100 @@
 
 #include "rtwtypes.h"
 
-const uint16_T blcc_R_esr = 1000U;                          /* 均衡电阻 */
-const uint16_T blcc_T_close = 125U;                         /* 均衡暂停温度; */
-const uint16_T blcc_T_open = 100U;                          /* 均衡暂停恢复温度; */
-const uint16_T blcc_V_low = 10U;                            /* 均衡开启电压阈值 */
+const uint16_T blcc_R_esr = 1000U;  /* 均衡电阻 */
+const uint16_T blcc_T_close = 125U; /* 均衡暂停温度; */
+const uint16_T blcc_T_open = 100U;  /* 均衡暂停恢复温度; */
+const uint16_T blcc_V_low = 10U;    /* 均衡开启电压阈值 */
 
-const uint16_T cmnc_Q_ratedCp = 600U;                       /* 电池容量; */
-const uint16_T cmnc_num_cellUNum = 17U;                     /* 电压采样点实际个数; */
-const uint16_T cmnc_num_modTNum = 4U;                       /* 温度采样点实际个数; */
-const uint16_T cmnc_tm_parkTime = 1800U;                    /* 静置时间阈值; */
-const uint16_T cmnm_F_polar[13] = { 3880U, 5062U, 10906U, 10798U, 12885U, 12990U,14331U, 10754U, 9378U, 10340U, 10592U, 11946U, 11515U } ; /* 电池放电参数的C数组; */
-const uint16_T cmnm_R_ohm[13] = { 2181U, 2043U, 2040U, 1927U, 1850U, 1802U,1771U, 1743U, 1733U, 1728U, 1748U, 1762U, 1789U } ;       /* 电池放电参数的Ro数组; */
-const uint16_T cmnm_R_polar[13] = { 1837U, 1055U, 1352U, 1453U, 1181U, 1125U,1205U, 1283U, 1228U, 1187U, 1104U, 1170U, 1049U } ;       /* 电池放电参数的Rp数组; */
-const uint16_T cmnm_V_ocv[13] = { 3234U, 3444U, 3476U, 3553U, 3610U, 3638U,3674U, 3758U, 3845U, 3942U, 4051U, 4106U, 4175U } ;       /* 电池放电参数的OCV数组; */
-const uint16_T cmnm_pct_soc[13] = { 0U, 50U, 100U, 200U, 300U, 400U, 500U, 600U,700U, 800U, 900U, 950U, 1000U } ;                         /* 电池放电参数的SOC数组; */
-const uint16_T cmnc_V_chrgFulV = 4200U;                     /* 充满电的截至电压; */
+const uint16_T cmnc_Q_ratedCp = 600U;                                                                                                    /* 电池容量; */
+const uint16_T cmnc_num_cellUNum = 17U;                                                                                                  /* 电压采样点实际个数; */
+const uint16_T cmnc_num_modTNum = 4U;                                                                                                    /* 温度采样点实际个数; */
+const uint16_T cmnc_tm_parkTime = 1800U;                                                                                                 /* 静置时间阈值; */
+const uint16_T cmnm_F_polar[13] = {3880U, 5062U, 10906U, 10798U, 12885U, 12990U, 14331U, 10754U, 9378U, 10340U, 10592U, 11946U, 11515U}; /* 电池放电参数的C数组; */
+const uint16_T cmnm_R_ohm[13] = {2181U, 2043U, 2040U, 1927U, 1850U, 1802U, 1771U, 1743U, 1733U, 1728U, 1748U, 1762U, 1789U};             /* 电池放电参数的Ro数组; */
+const uint16_T cmnm_R_polar[13] = {1837U, 1055U, 1352U, 1453U, 1181U, 1125U, 1205U, 1283U, 1228U, 1187U, 1104U, 1170U, 1049U};           /* 电池放电参数的Rp数组; */
+const uint16_T cmnm_V_ocv[13] = {3234U, 3444U, 3476U, 3553U, 3610U, 3638U, 3674U, 3758U, 3845U, 3942U, 4051U, 4106U, 4175U};             /* 电池放电参数的OCV数组; */
+const uint16_T cmnm_pct_soc[13] = {0U, 50U, 100U, 200U, 300U, 400U, 500U, 600U, 700U, 800U, 900U, 950U, 1000U};                          /* 电池放电参数的SOC数组; */
+const uint16_T cmnc_V_chrgFul = 4200U;                                                                                                   /* 充满电的截至电压; */
 
-const uint16_T sfmc_I_chrgCurrOverThr = 600;                 /* 充电电流阈值 */
-const uint16_T sfmc_I_disChrgCurrOverThr = 600;              /* 放电电流阈值 */
-const uint16_T sfmc_T_ACPlugTOverThrFlt1 = 120;              /* 慢充插头温度过高1级故障诊断阈值 */
-const uint16_T sfmc_T_ACPlugTOverThrFlt2 = 125;              /* 慢充插头温度过高2级故障诊断阈值 */
-const uint16_T sfmc_T_ACPlugTOverThrRec1 = 110;              /* 慢充插头温度过高1级故障恢复阈值 */
-const uint16_T sfmc_T_ACPlugTOverThrRec2 = 110;              /* 慢充插头温度过高2级故障恢复阈值 */
-const uint16_T sfmc_T_DCPlugTOverThrFlt1 = 120;              /* 快充插头温度过高1级故障诊断阈值 */
-const uint16_T sfmc_T_DCPlugTOverThrFlt2 = 125;              /* 快充插头温度过高2级故障诊断阈值 */
-const uint16_T sfmc_T_DCPlugTOverThrRec1 = 110;              /* 快充插头温度过高1级故障恢复阈值 */
-const uint16_T sfmc_T_DCPlugTOverThrRec2 = 110;              /* 快充插头温度过高2级故障恢复阈值 */
-const uint16_T sfmc_T_chrgModTLowThrFlt1 = 42U;             /* 充电模组温度过低1级故障诊断阈值 */
-const uint16_T sfmc_T_chrgModTLowThrFlt2 = 40U;             /* 充电模组温度过低2级故障诊断阈值 */
-const uint16_T sfmc_T_chrgModTLowThrRec1 = 45U;             /* 充电模组温度过低1级故障恢复阈值 */
-const uint16_T sfmc_T_chrgModTLowThrRec2 = 45U;             /* 充电模组温度过低2级故障恢复阈值 */
-const uint16_T sfmc_T_chrgModTOverThrFlt1 = 97U;            /* 充电模组温度过高1级故障诊断阈值 */
-const uint16_T sfmc_T_chrgModTOverThrFlt2 = 100U;           /* 充电模组温度过高2级故障诊断阈值 */
-const uint16_T sfmc_T_chrgModTOverThrRec1 = 90U;            /* 充电模组温度过高1级故障恢复阈值 */
-const uint16_T sfmc_T_chrgModTOverThrRec2 = 90U;            /* 充电模组温度过高2级故障恢复阈值 */
-const uint16_T sfmc_T_chrgMosTOverThrFlt1 = 120;             /* 充电Mos温度过高1级故障诊断阈值 */
-const uint16_T sfmc_T_chrgMosTOverThrFlt2 = 125;             /* 充电Mos温度过高2级故障诊断阈值 */
-const uint16_T sfmc_T_chrgMosTOverThrRec1 = 110;             /* 充电Mos温度过高1级故障恢复阈值 */
-const uint16_T sfmc_T_chrgMosTOverThrRec2 = 110;             /* 充电Mos温度过高2级故障恢复阈值 */
+const uint16_T sfmc_I_chrgCurrOverThr = 600;      /* 充电电流阈值 */
+const uint16_T sfmc_I_disChrgCurrOverThr = 600;   /* 放电电流阈值 */
+const uint16_T sfmc_T_ACPlugTOverThrFlt1 = 90;    /* 慢充插头温度过高1级故障诊断阈值 */
+const uint16_T sfmc_T_ACPlugTOverThrFlt2 = 100;   /* 慢充插头温度过高2级故障诊断阈值 */
+const uint16_T sfmc_T_ACPlugTOverThrRec1 = 80;    /* 慢充插头温度过高1级故障恢复阈值 */
+const uint16_T sfmc_T_ACPlugTOverThrRec2 = 80;    /* 慢充插头温度过高2级故障恢复阈值 */
+const uint16_T sfmc_T_DCPlugTOverThrFlt1 = 90;    /* 快充插头温度过高1级故障诊断阈值 */
+const uint16_T sfmc_T_DCPlugTOverThrFlt2 = 100;   /* 快充插头温度过高2级故障诊断阈值 */
+const uint16_T sfmc_T_DCPlugTOverThrRec1 = 80;    /* 快充插头温度过高1级故障恢复阈值 */
+const uint16_T sfmc_T_DCPlugTOverThrRec2 = 80;    /* 快充插头温度过高2级故障恢复阈值 */
+const uint16_T sfmc_T_chrgModTLowThrFlt1 = 42U;   /* 充电模组温度过低1级故障诊断阈值 */
+const uint16_T sfmc_T_chrgModTLowThrFlt2 = 40U;   /* 充电模组温度过低2级故障诊断阈值 */
+const uint16_T sfmc_T_chrgModTLowThrRec1 = 45U;   /* 充电模组温度过低1级故障恢复阈值 */
+const uint16_T sfmc_T_chrgModTLowThrRec2 = 45U;   /* 充电模组温度过低2级故障恢复阈值 */
+const uint16_T sfmc_T_chrgModTOverThrFlt1 = 97U;  /* 充电模组温度过高1级故障诊断阈值 */
+const uint16_T sfmc_T_chrgModTOverThrFlt2 = 100U; /* 充电模组温度过高2级故障诊断阈值 */
+const uint16_T sfmc_T_chrgModTOverThrRec1 = 90U;  /* 充电模组温度过高1级故障恢复阈值 */
+const uint16_T sfmc_T_chrgModTOverThrRec2 = 90U;  /* 充电模组温度过高2级故障恢复阈值 */
+const uint16_T sfmc_T_chrgMosTOverThrFlt1 = 120;  /* 充电Mos温度过高1级故障诊断阈值 */
+const uint16_T sfmc_T_chrgMosTOverThrFlt2 = 125;  /* 充电Mos温度过高2级故障诊断阈值 */
+const uint16_T sfmc_T_chrgMosTOverThrRec1 = 110;  /* 充电Mos温度过高1级故障恢复阈值 */
+const uint16_T sfmc_T_chrgMosTOverThrRec2 = 110;  /* 充电Mos温度过高2级故障恢复阈值 */
 
-const uint16_T sfmc_T_disChrgModTLowThrFlt1 = 25U;          /* 放电模组温度过低1级故障诊断阈值 */
-const uint16_T sfmc_T_disChrgModTLowThrFlt2 = 20U;          /* 放电模组温度过低2级故障诊断阈值 */
-const uint16_T sfmc_T_disChrgModTLowThrRec1 = 30U;          /* 放电模组温度过低1级故障恢复阈值 */
-const uint16_T sfmc_T_disChrgModTLowThrRec2 = 30U;          /* 放电模组温度过低2级故障恢复阈值 */
-const uint16_T sfmc_T_disChrgModTOverThrFlt1 = 97U;         /* 放电模组温度过高1级故障诊断阈值 */
-const uint16_T sfmc_T_disChrgModTOverThrFlt2 = 100U;        /* 放电模组温度过高2级故障诊断阈值 */
-const uint16_T sfmc_T_disChrgModTOverThrRec1 = 90U;         /* 放电模组温度过高1级故障恢复阈值 */
-const uint16_T sfmc_T_disChrgModTOverThrRec2 = 90U;         /* 放电模组温度过高2级故障恢复阈值 */
+const uint16_T sfmc_T_disChrgModTLowThrFlt1 = 25U;   /* 放电模组温度过低1级故障诊断阈值 */
+const uint16_T sfmc_T_disChrgModTLowThrFlt2 = 20U;   /* 放电模组温度过低2级故障诊断阈值 */
+const uint16_T sfmc_T_disChrgModTLowThrRec1 = 30U;   /* 放电模组温度过低1级故障恢复阈值 */
+const uint16_T sfmc_T_disChrgModTLowThrRec2 = 30U;   /* 放电模组温度过低2级故障恢复阈值 */
+const uint16_T sfmc_T_disChrgModTOverThrFlt1 = 97U;  /* 放电模组温度过高1级故障诊断阈值 */
+const uint16_T sfmc_T_disChrgModTOverThrFlt2 = 100U; /* 放电模组温度过高2级故障诊断阈值 */
+const uint16_T sfmc_T_disChrgModTOverThrRec1 = 90U;  /* 放电模组温度过高1级故障恢复阈值 */
+const uint16_T sfmc_T_disChrgModTOverThrRec2 = 90U;  /* 放电模组温度过高2级故障恢复阈值 */
 const uint16_T sfmc_T_disChrgMosTOverThrFlt1 = 120U;
 const uint16_T sfmc_T_disChrgMosTOverThrRec1 = 110U;
 const uint16_T sfmc_T_disChrgMosTOverThrFlt2 = 125U;
 const uint16_T sfmc_T_disChrgMosTOverThrRec2 = 110U;
 
-const uint16_T sfmc_T_heatPanTOverThrFlt1 = 125;             /* 加热板温度过高1级故障诊断阈值 */
-const uint16_T sfmc_T_heatPanTOverThrFlt2 = 130;             /* 加热板温度过高2级故障诊断阈值 */
-const uint16_T sfmc_T_heatPanTOverThrRec1 = 120;             /* 加热板温度过高1级故障恢复阈值 */
-const uint16_T sfmc_T_heatPanTOverThrRec2 = 120;             /* 加热板温度过高2级故障恢复阈值 */
-const uint16_T sfmc_T_modTDiffThrFlt1 = 20;                  /* 模组温差过大1级故障诊断阈值 */
-const uint16_T sfmc_T_modTDiffThrFlt2 = 25;                  /* 模组温差过大2级故障诊断阈值 */
-const uint16_T sfmc_T_modTDiffThrRec1 = 15;                  /* 模组温差过大1级故障恢复阈值 */
-const uint16_T sfmc_T_modTDiffThrRec2 = 15;                  /* 模组温差过大2级故障恢复阈值 */
+const uint16_T sfmc_T_heatPanTOverThrFlt1 = 85; /* 加热板温度过高1级故障诊断阈值 */
+const uint16_T sfmc_T_heatPanTOverThrFlt2 = 90; /* 加热板温度过高2级故障诊断阈值 */
+const uint16_T sfmc_T_heatPanTOverThrRec1 = 80; /* 加热板温度过高1级故障恢复阈值 */
+const uint16_T sfmc_T_heatPanTOverThrRec2 = 80; /* 加热板温度过高2级故障恢复阈值 */
+const uint16_T sfmc_T_modTDiffThrFlt1 = 20;     /* 模组温差过大1级故障诊断阈值 */
+const uint16_T sfmc_T_modTDiffThrFlt2 = 25;     /* 模组温差过大2级故障诊断阈值 */
+const uint16_T sfmc_T_modTDiffThrRec1 = 15;     /* 模组温差过大1级故障恢复阈值 */
+const uint16_T sfmc_T_modTDiffThrRec2 = 15;     /* 模组温差过大2级故障恢复阈值 */
 
-const uint16_T sfmc_V_battULowThrFlt1 = 590U;               /* 总压欠压1级故障诊断阈值 */
-const uint16_T sfmc_V_battULowThrFlt2 = 580U;               /* 总压欠压2级故障诊断阈值 */
-const uint16_T sfmc_V_battULowThrRec1 = 600U;               /* 总压欠压1级故障恢复阈值 */
-const uint16_T sfmc_V_battULowThrRec2 = 600U;               /* 总压欠压2级故障恢复阈值 */
-const uint16_T sfmc_V_battUOverThrFlt1 = 850U;              /* 总压过压1级故障诊断阈值 */
-const uint16_T sfmc_V_battUOverThrFlt2 = 860U;              /* 总压过压2级故障诊断阈值 */
-const uint16_T sfmc_V_battUOverThrRec1 = 840U;              /* 总压过压1级故障恢复阈值 */
-const uint16_T sfmc_V_battUOverThrRec2 = 840U;              /* 总压过压2级故障恢复阈值 */
-const uint16_T sfmc_V_cellULowThrFlt1 = 2950U;              /* 单体电压欠压1级故障诊断阈值 */
-const uint16_T sfmc_V_cellULowThrFlt2 = 2900U;              /* 单体电压欠压2级故障诊断阈值 */
-const uint16_T sfmc_V_cellULowThrRec1 = 3000U;              /* 单体电压欠压1级故障恢复阈值 */
-const uint16_T sfmc_V_cellULowThrRec2 = 3000U;              /* 单体电压欠压2级故障恢复阈值 */
-const uint16_T sfmc_V_cellUOverThrFlt1 = 4250U;             /* 单体电压过压1级故障诊断阈值 */
-const uint16_T sfmc_V_cellUOverThrFlt2 = 4300U;             /* 单体电压过压2级故障诊断阈值 */
-const uint16_T sfmc_V_cellUOverThrRec1 = 4200U;             /* 单体电压过压1级故障恢复阈值 */
-const uint16_T sfmc_V_cellUOverThrRec2 = 4200U;             /* 单体电压过压2级故障恢复阈值 */
-const uint16_T sfmc_flg_cellUDiffThrFlt1 = 250U;            /* 压差过大1级故障诊断阈值 */
-const uint16_T sfmc_flg_cellUDiffThrFlt2 = 300U;            /* 压差过大2级故障诊断阈值 */
-const uint16_T sfmc_flg_cellUDiffThrRec1 = 250U;            /* 压差过大1级故障恢复阈值 */
-const uint16_T sfmc_flg_cellUDiffThrRec2 = 250U;            /* 压差过大2级故障恢复阈值 */
+const uint16_T sfmc_V_battULowThrFlt1 = 590U;    /* 总压欠压1级故障诊断阈值 */
+const uint16_T sfmc_V_battULowThrFlt2 = 580U;    /* 总压欠压2级故障诊断阈值 */
+const uint16_T sfmc_V_battULowThrRec1 = 600U;    /* 总压欠压1级故障恢复阈值 */
+const uint16_T sfmc_V_battULowThrRec2 = 600U;    /* 总压欠压2级故障恢复阈值 */
+const uint16_T sfmc_V_battUOverThrFlt1 = 850U;   /* 总压过压1级故障诊断阈值 */
+const uint16_T sfmc_V_battUOverThrFlt2 = 860U;   /* 总压过压2级故障诊断阈值 */
+const uint16_T sfmc_V_battUOverThrRec1 = 840U;   /* 总压过压1级故障恢复阈值 */
+const uint16_T sfmc_V_battUOverThrRec2 = 840U;   /* 总压过压2级故障恢复阈值 */
+const uint16_T sfmc_V_cellULowThrFlt1 = 2950U;   /* 单体电压欠压1级故障诊断阈值 */
+const uint16_T sfmc_V_cellULowThrFlt2 = 2900U;   /* 单体电压欠压2级故障诊断阈值 */
+const uint16_T sfmc_V_cellULowThrRec1 = 3000U;   /* 单体电压欠压1级故障恢复阈值 */
+const uint16_T sfmc_V_cellULowThrRec2 = 3000U;   /* 单体电压欠压2级故障恢复阈值 */
+const uint16_T sfmc_V_cellUOverThrFlt1 = 4250U;  /* 单体电压过压1级故障诊断阈值 */
+const uint16_T sfmc_V_cellUOverThrFlt2 = 4300U;  /* 单体电压过压2级故障诊断阈值 */
+const uint16_T sfmc_V_cellUOverThrRec1 = 4200U;  /* 单体电压过压1级故障恢复阈值 */
+const uint16_T sfmc_V_cellUOverThrRec2 = 4200U;  /* 单体电压过压2级故障恢复阈值 */
+const uint16_T sfmc_flg_cellUDiffThrFlt1 = 250U; /* 压差过大1级故障诊断阈值 */
+const uint16_T sfmc_flg_cellUDiffThrFlt2 = 300U; /* 压差过大2级故障诊断阈值 */
+const uint16_T sfmc_flg_cellUDiffThrRec1 = 250U; /* 压差过大1级故障恢复阈值 */
+const uint16_T sfmc_flg_cellUDiffThrRec2 = 250U; /* 压差过大2级故障恢复阈值 */
 
-const uint16_T sohc_Q_countThr = 60U;                       /*                    */
-const uint16_T sohc_Q_updateDeltThr = 200U;                 /*                    */
+const uint16_T sohc_Q_countThr = 60U;       /*                    */
+const uint16_T sohc_Q_updateDeltThr = 200U; /*                    */
 
-const uint16_T socc_pct_battSocLow = 0U;                    /* SOC下限值; */
-const uint16_T socc_pct_battSocUp = 1000U;                  /* SOC上限值; */
-const int16_T socm_I_chrgCor[3] = { 50, 100, 150 } ;   /* 充电CCV对应的电流数据; */
-const int16_T socm_I_disChrgCor[3] = { -300, -100, -60 } ; /* 放电CCV对应的电流数据; */
-const uint16_T socm_V_chrgCor[3] = { 4160U, 4175U, 4188U } ;/* 充电CCV对应的电压; */
-const uint16_T socm_V_disChrgCor[3] = { 3303U, 3359U, 3368U } ; /* 放电CCV对应的电压; */
+const uint16_T socc_pct_battSocLow = 0U;                     /* SOC下限值; */
+const uint16_T socc_pct_battSocUp = 1000U;                   /* SOC上限值; */
+const int16_T socm_I_chrgCor[3] = {50, 100, 150};            /* 充电CCV对应的电流数据; */
+const int16_T socm_I_disChrgCor[3] = {-300, -100, -60};      /* 放电CCV对应的电流数据; */
+const uint16_T socm_V_chrgCor[3] = {4160U, 4175U, 4188U};    /* 充电CCV对应的电压; */
+const uint16_T socm_V_disChrgCor[3] = {3303U, 3359U, 3368U}; /* 放电CCV对应的电压; */
 const uint16_T socc_pct_chrgCor = 980;
 const uint16_T socc_pct_disChrgCor = 50;
 
-
-
-
-const uint16_T tmsc_T_openThr = 45U;                         /* 热管理开启温度; */
-const uint16_T tmsc_T_closeMinThr = 50U;                     /* 热管理关闭温度(最低模组); */
-const uint16_T tmsc_T_closeMaxThr = 70U;                     /* 热管理开启温度(最高模组); */
-
-
+const uint16_T tmsc_T_openThr = 45U;     /* 热管理开启温度; */
+const uint16_T tmsc_T_closeMinThr = 50U; /* 热管理关闭温度(最低模组); */
+const uint16_T tmsc_T_closeMaxThr = 70U; /* 热管理开启温度(最高模组); */

+ 7 - 0
src/EmbeddedCoder_src/BCUDisp.c

@@ -47,6 +47,8 @@ uint16_T ihv_V_cellU[28];                         /*电池单体电压(数组
 boolean_T ihd_st_chrgMosControl;    
 boolean_T ihd_st_disChrgMosControl; 
 boolean_T ihd_st_relayControl;    
+uint8_T ihd_st_heatForceControl;             
+uint8_T ihd_st_EOLState;
 
 					
 int16_T sfmd_I_curr;                              /*处理后整包电流 */
@@ -100,6 +102,11 @@ uint16_T sohv_Q_packCapArrEo[10];                 /*10次整包容量(数组
 uint16_T sohv_V_chrgStartStatEi[28];              /*充电开始时刻的单体电压(数组)读取量; */
 uint16_T sohv_V_chrgStartStatEo[28];              /*充电开始时刻的单体电压(数组)写入量; */
 
+uint8_T cmd_st_chrgMod;                           /* 充电模式  */
+uint8_T cmd_st_chrgSt;                            /* 充电状态  */
+uint16_T cmd_I_chrgCurrReq;                       /* 充电需求电流  */
+uint8_T cmd_idx_chrgEndReason;                    /* 充电结束原因  */
+        
 uint16_T cand_Nr_cellNr;                          /*循环发送的单体编号; */
 uint16_T cand_Q_cellCap;                          /*循环发送的单体容量; */
 uint16_T cand_V_chrgStartStat;                    /*循环发送的充电前单体电压; */

+ 2 - 2
src/EmbeddedCoder_src/SOC.c

@@ -117,7 +117,7 @@ void SOC(void)
     //=====================================================================
     if(FirstRun_SOC)
     {   //
-        if ((socd_pct_battSocEi > 1000) || (socd_pct_bcuSocEi > 1000) )
+        if ((socd_pct_battSocEi > 1000) || (socd_pct_bcuSocEi > 1000)  || (ihd_st_EOLState == 0))
         {
             socn_pct_battSocEE =  look1_iu16lu16n16tu16_binlcase(sfmd_V_cellUAvrg,(&(cmnm_V_ocv[0])), (&(cmnm_pct_soc[0])), 12U);
             socn_pct_bcuSocEE  =  look1_iu16lu16n16tu16_binlcase(sfmd_V_cellUAvrg,(&(cmnm_V_ocv[0])), (&(cmnm_pct_soc[0])), 12U);
@@ -371,7 +371,7 @@ void SOC(void)
             overFlg = 1;
         }
         //
-        if(sfmd_V_cellUMax >= cmnc_V_chrgFulV)
+        if(sfmd_V_cellUMax >= cmnc_V_chrgFul)
         {
             fulCntl = (fulCntl + 1) > 250 ? 250 : (fulCntl + 1);
         }

+ 25 - 18
src/EmbeddedCoder_src/TMS.c

@@ -1,10 +1,18 @@
+/*
+ * @Author       : ChenJie
+ * @Date         : 2021-10-19 10:17:10
+ * @Version      : V3.0
+ * @LastEditors  : ChenJie
+ * @LastEditTime : 2021-10-19 12:09:12
+ * @Description  : file content
+ * @FilePath     : \PLAT\project\ec616_0h00\apps\qx_app\src\EmbeddedCoder_src\TMS.c
+ */
 #include "TMS.h"
 
-
 boolean_T FirstRun_TMS;
 void TMS_Init(void)
 {
-    FirstRun_TMS =true;
+    FirstRun_TMS = true;
 }
 
 void TMS(void)
@@ -12,7 +20,7 @@ void TMS(void)
     static uint8_T TminLowNr;
     static uint8_T TminOverNr;
     static uint8_T TmaxOverNr;
-    
+
     //初始值
     if (FirstRun_TMS)
     {
@@ -21,7 +29,7 @@ void TMS(void)
         TminOverNr = 0;
         TmaxOverNr = 0;
     }
-    
+
     //
     if (sfmd_T_modTMin < tmsc_T_openThr)
     {
@@ -49,40 +57,39 @@ void TMS(void)
     {
         TmaxOverNr = 0;
     }
-    
+
     //================================温度判定 开关热管理状态===============================
     if (tmsd_st_heatAct == 0)
     {
-        if(TminLowNr >= 20 && ((ihd_st_chrgConnect == 0 && socd_pct_battSoc > 100) || ihd_st_chrgConnect == 1))
+        if (TminLowNr >= 20 && ((ihd_st_chrgConnect == 0 && socd_pct_battSoc > 100) || ihd_st_chrgConnect == 1))
         {
             tmsd_st_heatAct = 1;
         }
     }
     else
     {
-        if(TmaxOverNr >= 20 || TminOverNr >= 20 || (ihd_st_chrgConnect == 0 && socd_pct_battSoc < 50))
+        if (TmaxOverNr >= 20 || TminOverNr >= 20 || (ihd_st_chrgConnect == 0 && socd_pct_battSoc < 50))
         {
             tmsd_st_heatAct = 0;
         }
     }
-	 
+
     //因故障关闭热管理
-	if (((sfmd_st_fltAct >> 4) & 0x01) == 1)
-	{
-	    tmsd_st_heatAct = 0;
-	}
-	
+    if (((sfmd_st_fltAct >> 4) & 0x01) == 1)
+    {
+        tmsd_st_heatAct = 0;
+    }
+
     //强制控制加热回路
-    if(HeatForceControl == 1)
+    if (ihd_st_heatForceControl == 1)
     {
         tmsd_st_heatAct = 1;
     }
-    if(HeatForceControl == 2)
+    if (ihd_st_heatForceControl == 2)
     {
         tmsd_st_heatAct = 0;
     }
-        
-    FirstRun_TMS = false;
-	//printf("TminLowNr:%d,TmaxOverNr:%d,TminOverNr:%d,ihd_st_chrgConnect:%d,socd_pct_battSoc:%d,sfmd_st_fltAct:%d,HeatForceControl:%d,tmsd_st_heatAct:%d\n",TminLowNr,TmaxOverNr,TminOverNr,ihd_st_chrgConnect,socd_pct_battSoc,sfmd_st_fltAct,HeatForceControl,tmsd_st_heatAct);
 
+    FirstRun_TMS = false;
+    //printf("TminLowNr:%d,TmaxOverNr:%d,TminOverNr:%d,ihd_st_chrgConnect:%d,socd_pct_battSoc:%d,sfmd_st_fltAct:%d,HeatForceControl:%d,tmsd_st_heatAct:%d\n",TminLowNr,TmaxOverNr,TminOverNr,ihd_st_chrgConnect,socd_pct_battSoc,sfmd_st_fltAct,HeatForceControl,tmsd_st_heatAct);
 }