Browse Source

测试版本V0.2.0.6,增加累计安时积分,增加变频上传

LAPTOP-KB7QFH2U\ChenJie-PC 1 year ago
parent
commit
625d798c20
3 changed files with 10 additions and 9 deletions
  1. 3 3
      code/app/AppGlobalVar.c
  2. 6 5
      code/app/AppTaskCan.c
  3. 1 1
      code/app/AppTaskUart1.c

+ 3 - 3
code/app/AppGlobalVar.c

@@ -35,10 +35,10 @@ uint16 WebSitePort = 8812;
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x0002FF06;
+const uint32 AppSwVersion = 0x00020006;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
-const uint32 BlSwVersion = 0x00000001;
+const uint32 BlSwVersion = 0x00000002;
 const uint32 DrvSwVersion = 0x00000004;
 const uint8 BmsManuFacture = 0xff;
 const uint8 BmsInfo = 0xff;
@@ -181,7 +181,7 @@ UINT8 BMS_CharSysNum = 0x00;					// 可充电储能子系统总数(保留),,Re-1
 UINT8 BMS_FtCode = 0x00;						// 电池系统故障码,详见附表电池系统故障码列表,Re-1,Off-0,
 UINT8 BMS_ST1CheckSum = 0x00;					// B2V_ST1的CheckSum,Byte0=Byte1 XOR Byte2 XOR Byte3 XOR Byte4 XOR Byte5 XOR Byte6 XOR Byte7,Re-1,Off-0,
 UINT8 BMS_ST1Counter = 0x00;					// B2V_ST1的生命信号,0~14循环,15:信号无效,Re-1,Off-0,
-UINT8 BMS_Mode = 0x00;							// BMS当前状态,0:预留;1:高压上电;2:高压下电;3:无效;,Re-1,Off-0,
+UINT8 BMS_Mode = 0x00;							// BMS当前状态,和新版协议不匹配
 UINT8 BMS_AuxRlySt = 0x00;						// 附件继电器状态,0:开启;1:闭合;,Re-1,Off-0,
 UINT8 BMS_BattBalaSt = 0x00;					// BMS当前均衡状态,0:未开启均衡;1:开启均衡;,Re-1,Off-0,
 UINT8 BMS_CharGunSt = 0x00;						// 直流充电枪连接状态,0:未连接1 : 连接, Re - 1, Off - 0,

+ 6 - 5
code/app/AppTaskCan.c

@@ -75,15 +75,16 @@ static void CalAccAhFunc(void)//100ms运行一次
 {
 	static float tmp_DischrgAh = 0;//mah
 	static float tmp_ChrgAh = 0;//mah
-	if(BcuRxLongError[3]==0 && (BcuRxLongError[24]==1||BcuRxShortError[24]==1))//在CAN消息正常,且累计丢帧的情况下,高压上电时进行计算
+//	if(BcuRxLongError[3]==0 && (BcuRxLongError[24]==1||BcuRxShortError[24]==1))//在CAN消息正常,CAN[24]存在时间长的问题,不建议用丢帧处理
+	if(BcuRxLongError[3]==0 && BMS_Mode==0)
 	{
 		if(BMS_CharSt==1)//1是正在充电
 		{
-			tmp_ChrgAh = tmp_ChrgAh + (float)((BMS_PackCurr - 10000)/360);
+			tmp_ChrgAh = tmp_ChrgAh + (float)(abs(BMS_PackCurr - 10000)/360);
 		}
 		else//放电计算
 		{
-			tmp_DischrgAh = tmp_DischrgAh + (float)((BMS_PackCurr - 10000)/360);
+			tmp_DischrgAh = tmp_DischrgAh + (float)(abs(BMS_PackCurr - 10000)/360);
 		}
 		if(tmp_ChrgAh>1000)
 		{
@@ -97,9 +98,9 @@ static void CalAccAhFunc(void)//100ms运行一次
 			tmp_DischrgAh = 0;
 			AppConfigInfo.appSaveFlg = 1;
 		}
-		BMS_TotalCharCapy = AppConfigInfo.AppDataInfo.battChrgAccCap/100;
-		BMS_TotalDisCharCapy = AppConfigInfo.AppDataInfo.battDischrgAccCap/100;
 	}
+	BMS_TotalCharCapy = AppConfigInfo.AppDataInfo.battChrgAccCap/100;
+	BMS_TotalDisCharCapy = AppConfigInfo.AppDataInfo.battDischrgAccCap/100;
 }
 // 注意解码超限问题
 void BcuDecodeFunction(uint32 ID, uint8 *rawData)

+ 1 - 1
code/app/AppTaskUart1.c

@@ -255,7 +255,7 @@ static void TcpDataSendFeqHandFunc(uint8* DataIdx)
 		TcpDataFeq.GpsFeqCnt[1] = 60*3;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 10;
 	}
-	else if(BMS_Mode==1)//放电中
+	else if(BMS_Mode==0)//放电中
 	{
 		TcpDataFeq.GpsFeqCnt[1] = 10;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 30;