|
@@ -247,29 +247,27 @@ MC_CalParam_Struct_t MC_AssistRunMode_Gas_Process(uint16_t SensorData, MC_GearSt
|
|
|
|
|
|
/*车轮速度使用原始数据,滤波后的数据有滞后,影响控制回路*/
|
|
|
wheelSpeed = (int16_t)MC_SpeedSensorData.Speed_Data;
|
|
|
+
|
|
|
/*实时计算电机转速与车轮速的比值*/
|
|
|
SpdMotorDivWheel = (uint32_t)(MC_RunInfo.MotorSpeed * 100) / wheelSpeed ;
|
|
|
-
|
|
|
Tmp = SpdMotorDivWheel;
|
|
|
- SpdMotorDivWheelFlt += ((Tmp<<8) - SpdMotorDivWheelFlt) >> 6;
|
|
|
- SpdMotorDivWheelFlted = SpdMotorDivWheelFlt>>8;
|
|
|
-
|
|
|
+ SpdMotorDivWheelFlt += ((Tmp << 8) - SpdMotorDivWheelFlt) >> 6;
|
|
|
+ SpdMotorDivWheelFlted = SpdMotorDivWheelFlt >> 8;
|
|
|
|
|
|
/*在电机转速与车轮速比值,与实际速比一致时,更新速比*/
|
|
|
- if( ( MC_RunInfo.MotorSpeed > 100 ) && ( wheelSpeed > 0 ))
|
|
|
+ if(( MC_RunInfo.MotorSpeed > 100 ) && ( wheelSpeed > 0 ))
|
|
|
{
|
|
|
/*加速时,更新速比,比较法*/
|
|
|
if((wheelSpeed - wheelSpeedPre ) > 5)
|
|
|
{
|
|
|
- if(( MC_RunInfo.MotorSpeed - DbSpdMotorPre )>0)
|
|
|
+ if(( MC_RunInfo.MotorSpeed - DbSpdMotorPre ) > 0)
|
|
|
{
|
|
|
SpdProportion = SpdMotorDivWheel ;
|
|
|
}
|
|
|
DbSpdMotorPre = MC_RunInfo.MotorSpeed;
|
|
|
}
|
|
|
wheelSpeedPre = wheelSpeed;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
/*求标准差,速比稳定后,更新速比*/
|
|
|
/*此处将数据保存到数组中,标准差计算,时间较长,放在主循环进行*/
|
|
|
if((SpdProportion_CAL_flag==0) && (MC_CalParam.Ref_Speed > 25)) //电机力矩控制量低于25时,认为是空载,此时不更新速比
|
|
@@ -292,24 +290,25 @@ MC_CalParam_Struct_t MC_AssistRunMode_Gas_Process(uint16_t SensorData, MC_GearSt
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ wheelSpeedPre = wheelSpeed;
|
|
|
+ DbSpdMotorPre = MC_RunInfo.MotorSpeed;
|
|
|
+ }
|
|
|
|
|
|
/*电机最高速度,上位机配置参数*/
|
|
|
SpeedMax = MC_MotorParam.Rate_Speed;
|
|
|
Tmp = SensorData + 50 ; //加50偏移量,确保能达到最大值2048
|
|
|
Tmp = Tmp > 2048 ? 2048 : Tmp;
|
|
|
|
|
|
-// /*调试用,根据车速限速值,换算指拨对应的设定车速*/
|
|
|
- dbSpdWheelSet = (Tmp * MC_ConfigParam1.SpeedLimit * 10 )>> 11;
|
|
|
- //if(((int16_t)wheelSpeed - (int16_t)dbSpdWheelSet) < 100 )
|
|
|
- //|| (dbSpdWheelSet < 50 ) )
|
|
|
-// {
|
|
|
-
|
|
|
+ /*调试用,根据车速限速值,换算指拨对应的设定车速*/
|
|
|
+ dbSpdWheelSet = (Tmp * MC_ConfigParam1.SpeedLimit * 10 )>> 11;
|
|
|
+
|
|
|
/*电机转速设定,根据指拨大小、车轮限速值和速比,换算*/
|
|
|
SpeedSet = ((Tmp * MC_ConfigParam1.SpeedLimit * SpdProportion) / 10 >> 11); //(Tmp >> 11) * cd_Speedlimit * ( SpdProportion / 10)
|
|
|
- //SpeedSet = ((Tmp * cd_MotorSpeed) >> 11); //调试
|
|
|
|
|
|
//超过限速值,设定电机转速为0
|
|
|
- if(wheelSpeed > (MC_ConfigParam1.SpeedLimit * 10 + 10))
|
|
|
+ if(wheelSpeed > (MC_ConfigParam1.SpeedLimit * 10 + 20))
|
|
|
{
|
|
|
SpeedSet = 0;
|
|
|
}
|
|
@@ -317,29 +316,29 @@ MC_CalParam_Struct_t MC_AssistRunMode_Gas_Process(uint16_t SensorData, MC_GearSt
|
|
|
SpeedSet = (SpeedSet > 0) ? SpeedSet : 0;
|
|
|
SpeedSet = (SpeedSet < SpeedMax) ? SpeedSet : SpeedMax;
|
|
|
|
|
|
-
|
|
|
- switch (GearSt & 0x0F)//Help_mode:bit4: 0-力矩模式,1-踏频模式;低四位表示助力档位
|
|
|
+ //根据档位调整加速度
|
|
|
+ switch (GearSt & 0x0F)
|
|
|
{
|
|
|
case 0x01:
|
|
|
- accStep = StepCalc(SpeedMax,1,6500);
|
|
|
+ accStep = StepCalc(SpeedMax, 1, 6500);
|
|
|
break;
|
|
|
case 0x02:
|
|
|
- accStep = StepCalc(SpeedMax,1,6000);
|
|
|
+ accStep = StepCalc(SpeedMax, 1, 6000);
|
|
|
break;
|
|
|
case 0x03:
|
|
|
- accStep = StepCalc(SpeedMax,1,5500);
|
|
|
+ accStep = StepCalc(SpeedMax, 1, 5500);
|
|
|
break;
|
|
|
case 0x04:
|
|
|
- accStep = StepCalc(SpeedMax,1,5000);
|
|
|
+ accStep = StepCalc(SpeedMax, 1, 5000);
|
|
|
break;
|
|
|
default:
|
|
|
/*计算周期1ms, 加减速时间为 5.00s 加减速步进计算*/
|
|
|
- accStep = StepCalc(SpeedMax,1,5000);
|
|
|
+ accStep = StepCalc(SpeedMax, 1, 5000);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/*减速步进*/
|
|
|
- decStep = StepCalc(SpeedMax,1,1000);
|
|
|
+ decStep = StepCalc(SpeedMax, 1, 1000);
|
|
|
|
|
|
/* 跟踪启动 */
|
|
|
if(MC_CalParam.Foc_Flag == RESET)
|
|
@@ -353,24 +352,85 @@ MC_CalParam_Struct_t MC_AssistRunMode_Gas_Process(uint16_t SensorData, MC_GearSt
|
|
|
}
|
|
|
|
|
|
/*速度指令的加减速处理*/
|
|
|
- SpeedSetReal = accDecProcess(SpeedSet,accStep,decStep,&SpeedSetMiddle);
|
|
|
+ #if 1 //根据档位设定最高速度
|
|
|
+
|
|
|
+ switch(GearSt & 0x0F)
|
|
|
+ {
|
|
|
+ case 0x01:
|
|
|
+ SpeedSetReal = accDecProcess((SpeedSet * 9) >> 4, accStep, decStep, &SpeedSetMiddle);
|
|
|
+ break;
|
|
|
+ case 0x02:
|
|
|
+ SpeedSetReal = accDecProcess((SpeedSet * 11) >> 4, accStep, decStep, &SpeedSetMiddle);
|
|
|
+ break;
|
|
|
+ case 0x03:
|
|
|
+ SpeedSetReal = accDecProcess((SpeedSet * 13) >> 4, accStep, decStep, &SpeedSetMiddle);
|
|
|
+ break;
|
|
|
+ case 0x04:
|
|
|
+ SpeedSetReal = accDecProcess(SpeedSet, accStep, decStep, &SpeedSetMiddle);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ SpeedSetReal = accDecProcess(SpeedSet, accStep, decStep, &SpeedSetMiddle);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ #else
|
|
|
+
|
|
|
+ SpeedSetReal = accDecProcess(SpeedSet, accStep, decStep, &SpeedSetMiddle);
|
|
|
+
|
|
|
+ #endif
|
|
|
|
|
|
- /*母线电流限流*/
|
|
|
- PID_IMax.hLower_Limit_Output= -(MC_AssisParam.Gear_TURBO.Upper_Iq / 2); //Lower Limit for Output limitation
|
|
|
- PID_IMax.hUpper_Limit_Output= 0; //Upper Limit for Output limitation
|
|
|
- PID_IMax.wLower_Limit_Integral = -((MC_AssisParam.Gear_TURBO.Upper_Iq / 2) << 10); // 放大1024
|
|
|
- PID_IMax.wUpper_Limit_Integral = 0; // 放大1024
|
|
|
- SpdMotorByIdc = PID_Regulator((MC_ConfigParam1.CurrentLimit * 1000) >> 7, MC_RunInfo.BusCurrent >> 7, &PID_ConstantPower); // 母线电流闭环
|
|
|
+ /*限制母线电流*/
|
|
|
+ #if 0 //根据档位设定最大电流,电流环在内环,不稳定
|
|
|
+
|
|
|
+ static uint16_t CurrentLimitPresent; //限流实际值,做升降速处理
|
|
|
+ uint16_t CurrentLimitSet; //限流设置值,不同助力档位更新
|
|
|
+
|
|
|
+ switch(GearSt & 0x0F)
|
|
|
+ {
|
|
|
+ case 0x01://ECO
|
|
|
+ {
|
|
|
+ CurrentLimitSet = (uint32_t)(MC_AssisParam.Gear_ECO.CurrentMax_K * MC_ConfigParam1.CurrentLimit * 1000 >> 17);
|
|
|
+ CurrentLimitPresent = MC_DataSet_Linear_Process(CurrentLimitSet, CurrentLimitPresent, 5 ,1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 0x02://NORM
|
|
|
+ {
|
|
|
+ CurrentLimitSet = (uint32_t)(MC_AssisParam.Gear_NORM.CurrentMax_K * MC_ConfigParam1.CurrentLimit * 1000 >> 17);
|
|
|
+ CurrentLimitPresent = MC_DataSet_Linear_Process(CurrentLimitSet, CurrentLimitPresent, 5 ,1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 0x03://SPORT
|
|
|
+ {
|
|
|
+ CurrentLimitSet = (uint32_t)(MC_AssisParam.Gear_SPORT.CurrentMax_K * MC_ConfigParam1.CurrentLimit * 1000 >> 17);
|
|
|
+ CurrentLimitPresent = MC_DataSet_Linear_Process(CurrentLimitSet, CurrentLimitPresent, 5 ,1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 0x04://TURBO
|
|
|
+ {
|
|
|
+ CurrentLimitSet = (uint32_t)(MC_AssisParam.Gear_TURBO.CurrentMax_K * MC_ConfigParam1.CurrentLimit * 1000 >> 17);
|
|
|
+ CurrentLimitPresent = MC_DataSet_Linear_Process(CurrentLimitSet, CurrentLimitPresent, 5 ,1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default://SMART
|
|
|
+ {
|
|
|
+ CurrentLimitSet = (uint32_t)(MC_AssisParam.Gear_SMART.CurrentMax_K * MC_ConfigParam1.CurrentLimit * 1000 >> 17);
|
|
|
+ CurrentLimitPresent = MC_DataSet_Linear_Process(CurrentLimitSet, CurrentLimitPresent, 5 ,1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpdMotorByIdc = PID_Regulator(CurrentLimitPresent, MC_RunInfo.BusCurrent >> 7, &PID_ConstantPower);
|
|
|
+
|
|
|
+ #else
|
|
|
+
|
|
|
+ SpdMotorByIdc = PID_Regulator((MC_ConfigParam1.CurrentLimit * 1000) >> 7, MC_RunInfo.BusCurrent >> 7, &PID_ConstantPower);
|
|
|
+
|
|
|
+ #endif
|
|
|
|
|
|
/* 电机速度闭环 */
|
|
|
- /*最大力矩为4档的力矩参数*/
|
|
|
+ //最大力矩为4档的力矩参数
|
|
|
PID_MotorSpd.hLower_Limit_Output= -(MC_AssisParam.Gear_TURBO.Upper_Iq / 2);
|
|
|
PID_MotorSpd.hUpper_Limit_Output= (MC_AssisParam.Gear_TURBO.Upper_Iq / 2);
|
|
|
-// PID_MotorSpd.wLower_Limit_Integral = -((ContrlParam.Gear_4st.Upper_Iq / 2) << 10); // 放大1024
|
|
|
-// PID_MotorSpd.wUpper_Limit_Integral = ((ContrlParam.Gear_4st.Upper_Iq / 2) << 10); // 放大1024
|
|
|
- TorQueBySpd = PID_Regulator(SpeedSetReal, \
|
|
|
- MC_RunInfo.MotorSpeed , \
|
|
|
- &PID_MotorSpd); // 电机速度闭环输出
|
|
|
+ TorQueBySpd = PID_Regulator(SpeedSetReal, MC_RunInfo.MotorSpeed, &PID_MotorSpd);
|
|
|
|
|
|
TorQueBySpd += SpdMotorByIdc;
|
|
|
|
|
@@ -394,6 +454,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Gas_Process(uint16_t SensorData, MC_GearSt
|
|
|
|
|
|
uint16_t K_ByVoltage_Result = 1024;
|
|
|
uint16_t K_ByTemperature_Result = 1024;
|
|
|
+
|
|
|
#endif
|
|
|
|
|
|
//速度环控制量为0时停机,防止电机出现异响
|
|
@@ -409,7 +470,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Gas_Process(uint16_t SensorData, MC_GearSt
|
|
|
|
|
|
Ref_Speed_Temp = ((int32_t)TorQueBySpd * K_ByVoltage_Result) >> 10;
|
|
|
Ref_Speed_Temp = ((int32_t)Ref_Speed_Temp * K_ByTemperature_Result) >> 10;
|
|
|
-
|
|
|
+
|
|
|
p_MC_CalParam.Ref_Speed = (int16_t)(Ref_Speed_Temp);
|
|
|
p_MC_CalParam.Foc_Flag = SET;
|
|
|
p_MC_CalParam.AssistRunMode = MC_AssistRunMode_GAS;
|
|
@@ -453,20 +514,25 @@ MC_CalParam_Struct_t MC_AssistRunMode_Walk_Process(MC_WorkMode_Struct_t p_MC_Wor
|
|
|
SpdMotorByIdc = PID_Regulator((MC_ConfigParam1.CurrentLimit * 1000) >> 7, MC_RunInfo.BusCurrent >> 7, &PID_ConstantPower); // 母线电流闭环
|
|
|
}
|
|
|
|
|
|
- //运行模式,设定转速 = 135rpm
|
|
|
+ //运行模式,设定转速 = 设置值
|
|
|
else
|
|
|
{
|
|
|
- if(MC_WalkProcess_Param.MotorSpeedSetBigin < (135 << 5) - 10)
|
|
|
+ uint8_t WalkMode_MotorSpeedSet = 0;
|
|
|
+
|
|
|
+ //新增配置项,兼容旧电机
|
|
|
+ WalkMode_MotorSpeedSet = (MC_ConfigParam1.WalkMode_MotorSpeedSet == 0) ? 135 : MC_ConfigParam1.WalkMode_MotorSpeedSet;
|
|
|
+
|
|
|
+ if(MC_WalkProcess_Param.MotorSpeedSetBigin < (WalkMode_MotorSpeedSet << 5) - 10)
|
|
|
{
|
|
|
MC_WalkProcess_Param.MotorSpeedSetBigin += 1;
|
|
|
}
|
|
|
- else if(MC_WalkProcess_Param.MotorSpeedSetBigin > (135 << 5) + 10)
|
|
|
+ else if(MC_WalkProcess_Param.MotorSpeedSetBigin > (WalkMode_MotorSpeedSet << 5) + 10)
|
|
|
{
|
|
|
MC_WalkProcess_Param.MotorSpeedSetBigin -= 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MC_WalkProcess_Param.MotorSpeedSetBigin = 135 << 5;
|
|
|
+ MC_WalkProcess_Param.MotorSpeedSetBigin = WalkMode_MotorSpeedSet << 5;
|
|
|
}
|
|
|
SpdMotorByIdc = PID_Regulator((MC_ConfigParam1.CurrentLimit * 500) >> 7, MC_RunInfo.BusCurrent >> 7, &PID_ConstantPower); // 母线电流闭环
|
|
|
}
|
|
@@ -475,11 +541,16 @@ MC_CalParam_Struct_t MC_AssistRunMode_Walk_Process(MC_WorkMode_Struct_t p_MC_Wor
|
|
|
TorQueBySpd = PID_Regulator((MC_WalkProcess_Param.MotorSpeedSetBigin >> 5), MC_RunInfo.MotorSpeed, &PID_MotorSpd); // 电机速度闭环输出
|
|
|
TorQueBySpd += SpdMotorByIdc;
|
|
|
|
|
|
- //限制车速低于6km/h
|
|
|
- if(p_MC_WorkMode != MC_WorkMode_Config) //运行模式,推行限速6km/h
|
|
|
+ //限制车速低于设置值
|
|
|
+ if(p_MC_WorkMode != MC_WorkMode_Config) //运行模式,推行限速
|
|
|
{
|
|
|
- TorQueBySpd = (uint16_t)((uint32_t)(TorQueBySpd * Function_Linear_3Stage(55, 0, 55, 128, MC_RunInfo.BikeSpeed)) >> 10);
|
|
|
- if(MC_RunInfo.BikeSpeed > 60)
|
|
|
+ uint8_t WalkMode_SpeedLimit = 0;
|
|
|
+
|
|
|
+ //新增配置项,兼容旧电机
|
|
|
+ WalkMode_SpeedLimit = (MC_ConfigParam1.WalkMode_SpeedLimit == 0) ? 60 : MC_ConfigParam1.WalkMode_SpeedLimit;
|
|
|
+
|
|
|
+ TorQueBySpd = (uint16_t)((uint32_t)(TorQueBySpd * Function_Linear_3Stage((WalkMode_SpeedLimit - 5), 0, (WalkMode_SpeedLimit - 5), 128, MC_RunInfo.BikeSpeed)) >> 10);
|
|
|
+ if(MC_RunInfo.BikeSpeed > WalkMode_SpeedLimit)
|
|
|
{
|
|
|
MC_WalkProcess_Param.MotorSpeedSetBigin = 0;
|
|
|
MC_MotorStop(&MC_StarFlag);
|
|
@@ -583,6 +654,15 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
uint16_t CurrentLimitSet; //限流设置值,不同助力档位更新
|
|
|
|
|
|
static uint8_t TorqueRefEndUpdateCount = 0;
|
|
|
+
|
|
|
+ #define SOFT_SATRT 1
|
|
|
+
|
|
|
+ #if SOFT_SATRT
|
|
|
+ static FlagStatus SoftStartFlag = SET;
|
|
|
+ static uint16_t SoftStartDelayTimeCount = 0;
|
|
|
+ uint16_t SoftStartDelayTime = 0;
|
|
|
+ uint16_t SoftStartAcc = 0;
|
|
|
+ #endif
|
|
|
|
|
|
#if 1
|
|
|
|
|
@@ -649,7 +729,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
#endif
|
|
|
|
|
|
//低力矩停机
|
|
|
- TorqueStopData = (TorqueStartData < 200) ? 100 : (TorqueStartData >> 1);
|
|
|
+ TorqueStopData = (TorqueSensorStartData < 200) ? 100 : (TorqueSensorStartData >> 1);
|
|
|
if(MC_TorqueProcess_Param.TorqueApp >= (TorqueStopData))
|
|
|
{
|
|
|
TorqueStopDelayTimeCnt = HAL_GetTick();
|
|
@@ -674,11 +754,11 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
//启动值判断
|
|
|
if(MC_RunInfo.BikeSpeed > 60)
|
|
|
{
|
|
|
- TorqueStartData = (TorqueStartData < 200 ? 150 : (TorqueStartData > 700 ? 525 : ((TorqueStartData * 3) >> 2)));
|
|
|
+ TorqueStartData = (TorqueSensorStartData < 200 ? 150 : (TorqueSensorStartData > 700 ? 525 : ((TorqueSensorStartData * 3) >> 2)));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- TorqueStartData = (TorqueStartData < 200 ? 150 : (TorqueStartData > 700 ? 525 : TorqueStartData));
|
|
|
+ TorqueStartData = (TorqueSensorStartData < 200 ? 150 : (TorqueSensorStartData > 700 ? 525 : TorqueSensorStartData));
|
|
|
}
|
|
|
if(MC_TorqueProcess_Param.TorqueApp >= TorqueStartData)
|
|
|
{
|
|
@@ -701,6 +781,12 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
MC_TorqueProcess_Param.TorqueRefEnd = 0;
|
|
|
//停机处理
|
|
|
MC_MotorStop(&MC_StarFlag);
|
|
|
+
|
|
|
+ #if SOFT_SATRT
|
|
|
+ //缓启动标志置位
|
|
|
+ SoftStartFlag = SET;
|
|
|
+ SoftStartDelayTimeCount = 0;
|
|
|
+ #endif
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -939,7 +1025,52 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
MC_TorqueProcess_Param.TorqueRefEnd -= TorqueDecStep;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ #if SOFT_SATRT
|
|
|
+ else if(SoftStartFlag == SET) //启动处理
|
|
|
+ {
|
|
|
+ if(MC_ConfigParam1.StarModel == MC_StarMode_DYNAMIC) //强劲模式,无延迟
|
|
|
+ {
|
|
|
+ SoftStartDelayTimeCount = 0;
|
|
|
+ SoftStartFlag = RESET;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(MC_ConfigParam1.StarModel == MC_StarMode_SOFT) //柔和模式,延迟300ms
|
|
|
+ {
|
|
|
+ SoftStartDelayTime = 300; //启动处理延时300ms
|
|
|
+ SoftStartAcc = 30; //30ms递增0.1倍
|
|
|
+ }
|
|
|
+ else //正常模式,延迟100ms
|
|
|
+ {
|
|
|
+ SoftStartDelayTime = 100; //启动处理延时100ms
|
|
|
+ SoftStartAcc = 10; //10ms递增0.1倍
|
|
|
+ }
|
|
|
+ SoftStartDelayTimeCount++;
|
|
|
+ if(SoftStartDelayTimeCount <= SoftStartDelayTime) // 缓启动过程,按照0.1倍率逐步增加加减速斜率
|
|
|
+ {
|
|
|
+ if((MC_TorqueProcess_Param.TorqueRef - MC_TorqueProcess_Param.TorqueRefEnd) > 2)
|
|
|
+ {
|
|
|
+ if((SoftStartDelayTimeCount % (10 - SoftStartDelayTimeCount / SoftStartAcc)) == 0)
|
|
|
+ {
|
|
|
+ MC_TorqueProcess_Param.TorqueRefEnd += TorqueAccStep;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if((MC_TorqueProcess_Param.TorqueRef - MC_TorqueProcess_Param.TorqueRefEnd) < (- 1))
|
|
|
+ {
|
|
|
+ MC_TorqueProcess_Param.TorqueRefEnd -= TorqueDecStep;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SoftStartDelayTimeCount = 0;
|
|
|
+ SoftStartFlag = RESET;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
else //正常骑行
|
|
|
{
|
|
|
if((MC_TorqueProcess_Param.TorqueRef - MC_TorqueProcess_Param.TorqueRefEnd) > 2)
|
|
@@ -954,7 +1085,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
MC_TorqueProcess_Param.TorqueRefEnd = (MC_TorqueProcess_Param.TorqueRefEnd < 6) ? 6 : MC_TorqueProcess_Param.TorqueRefEnd;
|
|
|
|
|
|
//限速点处理
|
|
|
- if( MC_SpeedSensorData.Speed_Data > (MC_ConfigParam1.SpeedLimit * 10 + 20) ) //限速值+2
|
|
|
+ if( MC_SpeedSensorData.Speed_Data > (MC_ConfigParam1.SpeedLimit * 10 + 22) ) //限速值+2.2
|
|
|
{
|
|
|
MC_TorqueProcess_Param.MotorStopLock_Flag = SET;
|
|
|
MC_TorqueProcess_Param.TorqueRefEnd = 0;
|
|
@@ -1240,7 +1371,7 @@ void SpdProportion_calculate(void)
|
|
|
test_StandardDeviation = (int32_t)(SpdProportion_StandardDeviation );
|
|
|
SpdProportion_CAL_flag = 0;
|
|
|
/*更新速比*/
|
|
|
- if(test_StandardDeviation < 20)
|
|
|
+ if(test_StandardDeviation < 30)
|
|
|
{
|
|
|
SpdProportion = test_SpdProportionAver;
|
|
|
}
|