|
@@ -15,7 +15,7 @@ static uint8 BattSendFlg = 0;
|
|
|
static void UDSAnsFunc(uint8 *rawData);
|
|
|
static void UdsAns(bool PosFlg, uint8 UdsService, uint8 UdsSubService, uint8 Idx, uint8 *AnsData, uint8 AnsDataLen);
|
|
|
static void BattSendFunc(void);
|
|
|
-
|
|
|
+static void CalAccAhFunc(void);
|
|
|
void CanTask(void *pvParameters)
|
|
|
{
|
|
|
uint32 timerCANIdle = 0x00;
|
|
@@ -66,7 +66,39 @@ void CanTask(void *pvParameters)
|
|
|
timerCANIdle = timerCANIdle + 100;
|
|
|
BcuRxDiagnose();
|
|
|
timerCounterNow = TimerCounter;
|
|
|
+ //累计放电Ah和充电Ah积分计算
|
|
|
+ CalAccAhFunc();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+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(BMS_CharSt==1)//1是正在充电
|
|
|
+ {
|
|
|
+ tmp_ChrgAh = tmp_ChrgAh + (float)((BMS_PackCurr - 10000)/360);
|
|
|
+ }
|
|
|
+ else//放电计算
|
|
|
+ {
|
|
|
+ tmp_DischrgAh = tmp_DischrgAh + (float)((BMS_PackCurr - 10000)/360);
|
|
|
+ }
|
|
|
+ if(tmp_ChrgAh>1000)
|
|
|
+ {
|
|
|
+ AppConfigInfo.AppDataInfo.battChrgAccCap = AppConfigInfo.AppDataInfo.battChrgAccCap + (uint32)tmp_ChrgAh;
|
|
|
+ tmp_ChrgAh = 0;
|
|
|
+ AppConfigInfo.appSaveFlg = 1;
|
|
|
+ }
|
|
|
+ if(tmp_DischrgAh>1000)
|
|
|
+ {
|
|
|
+ AppConfigInfo.AppDataInfo.battDischrgAccCap = AppConfigInfo.AppDataInfo.battDischrgAccCap + (uint32)tmp_DischrgAh;
|
|
|
+ tmp_DischrgAh = 0;
|
|
|
+ AppConfigInfo.appSaveFlg = 1;
|
|
|
}
|
|
|
+ BMS_TotalCharCapy = AppConfigInfo.AppDataInfo.battChrgAccCap/100;
|
|
|
+ BMS_TotalDisCharCapy = AppConfigInfo.AppDataInfo.battDischrgAccCap/100;
|
|
|
}
|
|
|
}
|
|
|
// 注意解码超限问题
|
|
@@ -1203,9 +1235,9 @@ void BcuRxMsgSetInvalidValue(uint32 ID)
|
|
|
BMS_TotalGunCharCapy = 0xFFFFFFFF;
|
|
|
break;
|
|
|
case 0x18F4D0F3:
|
|
|
- BMS_TotalCharCapy = 0xFFFFFFFF;
|
|
|
- BMS_TotalDisCharCapy = 0xFFFFFFFF;
|
|
|
- BMS_SingleCharCapy = 0xFFFF;
|
|
|
+// BMS_TotalCharCapy = 0xFFFFFFFF;
|
|
|
+// BMS_TotalDisCharCapy = 0xFFFFFFFF;
|
|
|
+// BMS_SingleCharCapy = 0xFFFF;
|
|
|
break;
|
|
|
case 0x18F5D0F3:
|
|
|
BMS_TotalBackCharCapy = 0xFFFFFFFF;
|