|
@@ -54,6 +54,8 @@ GEAR_COEF CadAssistSped;
|
|
|
CADPOWER_STRUCT CadSpdPower;
|
|
|
GEAR_CUR_TRUCT GearCur;
|
|
|
|
|
|
+THROTTLE_POWER_LIMIT_STRUCT Throttle_PowerLimit_K={0, 16384, 10, 10, 16384};
|
|
|
+
|
|
|
/******************************
|
|
|
*
|
|
|
* Function Statement
|
|
@@ -939,7 +941,9 @@ void ass_voAssistCmdDeal(void)
|
|
|
{
|
|
|
tmp_slAssistSpdCmd = (SLONG)ass_stCadAssCoef.swKmhToMSpdPu*(SLONG)ass_MaxSpeed.MaxBikeSpeed>> 4;
|
|
|
}
|
|
|
+ #if 0
|
|
|
tmp_slAssistSpdCmd = (tmp_slAssistSpdCmd << 10) / Bike_RatioCalParam.RatioResult; //前后飞轮传动比
|
|
|
+ #endif
|
|
|
#else
|
|
|
if(ass_stCadAssParaIn.uwThrottlePercent < 650) //850
|
|
|
{
|
|
@@ -950,7 +954,9 @@ void ass_voAssistCmdDeal(void)
|
|
|
{
|
|
|
tmp_slAssistSpdCmd = (SLONG)ass_stCadAssCoef.swKmhToMSpdPu*(SLONG)ass_stCadAssCoef.uwThrottleMaxBikeSpeed >> 4;
|
|
|
}
|
|
|
+ #if 0
|
|
|
tmp_slAssistSpdCmd = (tmp_slAssistSpdCmd << 10) / Bike_RatioCalParam.RatioResult; //前后飞轮传动比
|
|
|
+ #endif
|
|
|
#endif
|
|
|
}
|
|
|
else
|
|
@@ -1849,4 +1855,56 @@ void GearLimitCurHandle(void)
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+void ThrottlePowerLimitCal(BOOL ThrottleModeFlag, UWORD BikeSpeed, UWORD BikeSpeedLimit, SWORD PowerCur, SWORD PowerMax, THROTTLE_POWER_LIMIT_STRUCT* ThrottlePowerLimit)
|
|
|
+{
|
|
|
+ if(ThrottleModeFlag == FALSE) //未进入转把模式,不限制功率
|
|
|
+ {
|
|
|
+ ThrottlePowerLimit->State = 0; //停止
|
|
|
+ ThrottlePowerLimit->K_Init = 16384;
|
|
|
+ ThrottlePowerLimit->K_Result = ThrottlePowerLimit->K_Init;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ switch(ThrottlePowerLimit->State)
|
|
|
+ {
|
|
|
+ case 0: //停止阶段
|
|
|
+ {
|
|
|
+ ThrottlePowerLimit->State = 1;
|
|
|
+ ThrottlePowerLimit->K_Init = 16384;
|
|
|
+ ThrottlePowerLimit->K_Result = ThrottlePowerLimit->K_Init;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 1: //加速阶段
|
|
|
+ {
|
|
|
+ if(BikeSpeed > BikeSpeedLimit)
|
|
|
+ {
|
|
|
+ ThrottlePowerLimit->State = 2;
|
|
|
+ ThrottlePowerLimit->K_Init = (SLONG)(PowerCur << 14) / PowerMax;
|
|
|
+ ThrottlePowerLimit->K_Result = ThrottlePowerLimit->K_Init;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 2: //恒功率阶段
|
|
|
+ {
|
|
|
+ if(BikeSpeed < 100)
|
|
|
+ ThrottlePowerLimit->State = 0;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(BikeSpeed > (BikeSpeedLimit + 10))
|
|
|
+ {
|
|
|
+ //if(ThrottlePowerLimit->K_Result > ThrottlePowerLimit->K_DecStep)
|
|
|
+ // ThrottlePowerLimit->K_Result -= ThrottlePowerLimit->K_DecStep;
|
|
|
+ }
|
|
|
+ else if(BikeSpeed < (BikeSpeedLimit - 10))
|
|
|
+ {
|
|
|
+ //if(ThrottlePowerLimit->K_Result < 16384)
|
|
|
+ // ThrottlePowerLimit->K_Result += ThrottlePowerLimit->K_AccStep;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|