|
@@ -50,6 +50,7 @@ BMS_VoltEstimat_Struct_t BMS_VoltEstimat;
|
|
|
OBC_SetCustomPara_Struct_t OBC_SetCustomPara;
|
|
|
OBC_ButtonStatus_Struct_t OBC_ButtonStatus = {0, 0, 0};
|
|
|
ULONG ulOBC_ComTimeOutCount = 0;
|
|
|
+ULONG ulBMS_ComTimeOutCount = 0;
|
|
|
UBYTE MC_MotorSPD_rpm_Percent = 0;
|
|
|
UBYTE MC_WorkMode;
|
|
|
UBYTE MC_BC_COM = 1;
|
|
@@ -534,7 +535,7 @@ void Can_voMC_Run_5ms(void)
|
|
|
|
|
|
void Can_voMC_Run_200ms(void)
|
|
|
{
|
|
|
-
|
|
|
+ UWORD TempPower;
|
|
|
Can_GearSt_switch();
|
|
|
SizeMCUP = sizeof(MC_UpcInfo.stAssistInfo);
|
|
|
if (MC_BC_COM == 0)
|
|
@@ -562,22 +563,24 @@ void Can_voMC_Run_200ms(void)
|
|
|
|
|
|
MC_RunInfo.BikeSpeed = cp_stBikeRunInfoPara.BikeSpeedKmH; ///>车速 0.1km/h,地址偏移0
|
|
|
MC_RunInfo.MotorSpeed = (SWORD)((SLONG)scm_uwSpdFbkLpfAbsPu * (SLONG)cof_uwVbRpm >> 15); ///>输出转速 1rpm,地址偏移2
|
|
|
- if (scm_swMotorPwrInLpfWt > 5000)
|
|
|
- {
|
|
|
- scm_swMotorPwrInLpfWt = 5000;
|
|
|
- }
|
|
|
- if (scm_swMotorPwrInLpfWt < 0)
|
|
|
- {
|
|
|
- scm_swMotorPwrInLpfWt = 0;
|
|
|
- }
|
|
|
- if (sysctrl_stPwmState.blPwmOnflg == FALSE)
|
|
|
- {
|
|
|
- scm_swMotorPwrInLpfWt = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- }
|
|
|
- MC_RunInfo.Power = scm_swMotorPwrInLpfWt / 10; ///>电功率 1W,地址偏移4
|
|
|
+// TempPower = scm_swMotorPwrInLpfWt;
|
|
|
+// if (TempPower > 5000)
|
|
|
+// {
|
|
|
+// TempPower = 5000;
|
|
|
+// }
|
|
|
+// if (TempPower < 0)
|
|
|
+// {
|
|
|
+// TempPower = 0;
|
|
|
+// }
|
|
|
+// if (sysctrl_stPwmState.blPwmOnflg == FALSE)
|
|
|
+// {
|
|
|
+// TempPower = 0;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// }
|
|
|
+// MC_RunInfo.Power = TempPower / 10; ///>电功率 1W,地址偏移4
|
|
|
+ MC_RunInfo.Power = (scm_swIqFdbLpfPu * 250 * cof_uwIbAp / 1500) >> 14; //MaxIq = 15A,MaxPower=250W
|
|
|
MC_RunInfo.BusVoltage = (UWORD)((((ULONG)adc_stUpOut.uwVdcLpfPu + (ULONG)BMS_VoltEstimat.uwVdcCompPu) * cof_uwUbVt * 100) >> 14); ///>母线电压 1mV,地址偏移6
|
|
|
//MC_RunInfo.BusCurrent = (UWORD)((ULONG)BMS_VoltEstimat.swIdcPu * cof_uwIbAp * 100 >> 14); ///>母线电流 1mA,地址偏移8
|
|
|
MC_RunInfo.BusCurrent = (scm_swIqFdbLpfPu * cof_uwIbAp * 10) >> 14;
|
|
@@ -592,8 +595,17 @@ void Can_voMC_Run_200ms(void)
|
|
|
|
|
|
if (cp_stBikeRunInfoPara.blGearStUpdate)
|
|
|
{
|
|
|
- MC_RunInfo.PowerPerKm =
|
|
|
- (UBYTE)(*(&cp_stHistoryPara.uwG1AvgPwrConsumption + (cp_stBikeRunInfoPara.uwBikeGear - 1)) / 10); ///>平均功耗 0.01Ah/km ,地址偏移20 /* parasoft-suppress MISRA2004-17_4 "本项目无法更改,后续避免非数组索引指针运算" */
|
|
|
+ if((cp_stBikeRunInfoPara.uwBikeGear > 0) && (cp_stBikeRunInfoPara.uwBikeGear <= 5))
|
|
|
+ {
|
|
|
+ MC_RunInfo.PowerPerKm =
|
|
|
+ *(&cp_stHistoryPara.uwG1AvgPwrConsumption + (cp_stBikeRunInfoPara.uwBikeGear - 1)) / 10; ///>楠炲啿娼庨崝鐔烩偓?0.01Ah/km 閿涘苯婀撮崸鈧�崑蹇曅�20
|
|
|
+ MC_RunInfo.RemainDistance = BMS_RunInfo.RC / MC_RunInfo.PowerPerKm / 10;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MC_RunInfo.PowerPerKm = 0;
|
|
|
+ MC_RunInfo.RemainDistance = 0xffff; //invalid value
|
|
|
+ }
|
|
|
cp_stBikeRunInfoPara.BMSRestChargeLast = BMS_RunInfo.RC;
|
|
|
cp_stBikeRunInfoPara.uwPowerPerKm = 0;
|
|
|
cp_stBikeRunInfoPara.uwAvePowerPerKm = 0;
|
|
@@ -659,61 +671,64 @@ void Can_RemainTrip_Cal(void)
|
|
|
cp_stBikeRunInfoPara.uwAvePowerCNT = 0;
|
|
|
}
|
|
|
|
|
|
- if (cp_stBikeRunInfoPara.uwBikeGear == 1)
|
|
|
- {
|
|
|
- uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG1AvgPwrConsumption);
|
|
|
- cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG1AvgPwrConsumption / 10);
|
|
|
- }
|
|
|
- else if (cp_stBikeRunInfoPara.uwBikeGear == 2)
|
|
|
- {
|
|
|
- uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG2AvgPwrConsumption);
|
|
|
- cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG2AvgPwrConsumption / 10);
|
|
|
- }
|
|
|
- else if (cp_stBikeRunInfoPara.uwBikeGear == 3)
|
|
|
- {
|
|
|
- uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG3AvgPwrConsumption);
|
|
|
- cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG3AvgPwrConsumption / 10);
|
|
|
- }
|
|
|
- else if (cp_stBikeRunInfoPara.uwBikeGear == 4)
|
|
|
- {
|
|
|
- uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG4AvgPwrConsumption);
|
|
|
- cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG4AvgPwrConsumption / 10);
|
|
|
- }
|
|
|
- else if (cp_stBikeRunInfoPara.uwBikeGear == 5)
|
|
|
+ if(cp_stBikeRunInfoPara.uwAvePowerPerKm > 0)
|
|
|
{
|
|
|
- uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG5AvgPwrConsumption);
|
|
|
- cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
- MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG5AvgPwrConsumption / 10);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- uwCruisCoef = 4096;
|
|
|
+ if (cp_stBikeRunInfoPara.uwBikeGear == 1)
|
|
|
+ {
|
|
|
+ uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG1AvgPwrConsumption);
|
|
|
+ cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG1AvgPwrConsumption / 10);
|
|
|
+ }
|
|
|
+ else if (cp_stBikeRunInfoPara.uwBikeGear == 2)
|
|
|
+ {
|
|
|
+ uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG2AvgPwrConsumption);
|
|
|
+ cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG2AvgPwrConsumption / 10);
|
|
|
+ }
|
|
|
+ else if (cp_stBikeRunInfoPara.uwBikeGear == 3)
|
|
|
+ {
|
|
|
+ uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG3AvgPwrConsumption);
|
|
|
+ cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG3AvgPwrConsumption / 10);
|
|
|
+ }
|
|
|
+ else if (cp_stBikeRunInfoPara.uwBikeGear == 4)
|
|
|
+ {
|
|
|
+ uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG4AvgPwrConsumption);
|
|
|
+ cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG4AvgPwrConsumption / 10);
|
|
|
+ }
|
|
|
+ else if (cp_stBikeRunInfoPara.uwBikeGear == 5)
|
|
|
+ {
|
|
|
+ uwCruisCoef = (UWORD)(((ULONG)cp_stBikeRunInfoPara.uwAvePowerPerKm << 12) / cp_stHistoryPara.uwG5AvgPwrConsumption);
|
|
|
+ cp_stHistoryPara.uwG1AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG1AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG2AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG2AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG3AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG3AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG4AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG4AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ cp_stHistoryPara.uwG5AvgPwrConsumption = (UWORD)((ULONG)cp_stHistoryPara.uwG5AvgPwrConsumption * uwCruisCoef >> 12);
|
|
|
+ MC_RunInfo.PowerPerKm = (UBYTE)(cp_stHistoryPara.uwG5AvgPwrConsumption / 10);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uwCruisCoef = 4096;
|
|
|
+ }
|
|
|
+ MC_RunInfo.RemainDistance = BMS_RunInfo.RC / MC_RunInfo.PowerPerKm / 10;
|
|
|
}
|
|
|
- MC_RunInfo.RemainDistance = BMS_RunInfo.RC / MC_RunInfo.PowerPerKm;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -727,6 +742,7 @@ static SLONG slBMSMinVol = 41600;
|
|
|
static SWORD SOC_Cnt, SOC_Value, SOC_MIN;
|
|
|
static ULONG Voltage_Sum;
|
|
|
static BOOL blSOCfirstSet = FALSE;
|
|
|
+static BOOL blSOCSWitch = FALSE;
|
|
|
UWORD Can_SOC_Cal(void)
|
|
|
{
|
|
|
UWORD templenght, VoltageAvg = 0;
|
|
@@ -736,21 +752,18 @@ UWORD Can_SOC_Cal(void)
|
|
|
return (UWORD)0;
|
|
|
}
|
|
|
//开机初始化一次电量
|
|
|
- if (blSOCfirstSet == FALSE)
|
|
|
+ if((cp_ulSystickCnt - ulBMS_ComTimeOutCount) > 3000)
|
|
|
{
|
|
|
- if (MC_RunInfo.BusVoltage >= slBMSMaxVol)
|
|
|
- {
|
|
|
- SOC_Value = 100;
|
|
|
- }
|
|
|
- else if (MC_RunInfo.BusVoltage <= slBMSMinVol)
|
|
|
- {
|
|
|
- SOC_Value = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SOC_Value = (SWORD)(((SLONG)MC_RunInfo.BusVoltage - slBMSMinVol) * 100 / (slBMSMaxVol - slBMSMinVol));
|
|
|
- }
|
|
|
- SOC_MIN = SOC_Value;
|
|
|
+ blSOCSWitch = TRUE; // communication abnormal
|
|
|
+ }
|
|
|
+
|
|
|
+ if(blSOCSWitch == FALSE)
|
|
|
+ {
|
|
|
+ SOC_Value = BMS_RunInfo.SOC;
|
|
|
+ }
|
|
|
+ else if (blSOCfirstSet == FALSE)
|
|
|
+ {
|
|
|
+ SOC_MIN = BMS_RunInfo.SOC;
|
|
|
blSOCfirstSet = TRUE;
|
|
|
}
|
|
|
//1min更新一次电量
|
|
@@ -781,20 +794,21 @@ UWORD Can_SOC_Cal(void)
|
|
|
SOC_Cnt = 0;
|
|
|
Voltage_Sum = 0;
|
|
|
}
|
|
|
+
|
|
|
+ if (SOC_Value > SOC_MIN)
|
|
|
+ {
|
|
|
+ SOC_Value = SOC_MIN;
|
|
|
+ }
|
|
|
+ else if (SOC_Value < 0)
|
|
|
+ {
|
|
|
+ SOC_Value = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // do nothing
|
|
|
+ }
|
|
|
}
|
|
|
- //电量仅递减
|
|
|
- if (SOC_Value > SOC_MIN)
|
|
|
- {
|
|
|
- SOC_Value = SOC_MIN;
|
|
|
- }
|
|
|
- else if (SOC_Value < 0)
|
|
|
- {
|
|
|
- SOC_Value = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // do nothing
|
|
|
- }
|
|
|
+
|
|
|
return (UWORD)SOC_Value;
|
|
|
}
|
|
|
|
|
@@ -806,6 +820,9 @@ void Can_GearSt_switch(void)
|
|
|
{
|
|
|
ulOBC_ComTimeOutCount = cp_ulSystickCnt;
|
|
|
}
|
|
|
+#ifdef RUN_ARCH_SIM
|
|
|
+ ulOBC_ComTimeOutCount = cp_ulSystickCnt;
|
|
|
+#endif
|
|
|
if ((cp_ulSystickCnt - ulOBC_ComTimeOutCount) < 3000) // 控制器与仪表通信中断超过3s,关闭助力
|
|
|
{
|
|
|
if (MC_ControlCode.GearSt <= 0x05)
|