|
@@ -275,7 +275,7 @@ void ass_voParameterInit(void)
|
|
|
ass_stCadAssCoef.uwFluxPu = ((ULONG)M_FLUX_WB << 12) / ((ULONG)VBASE * 1000000 / ((ULONG) 2 * 31416 * FBASE / 1000));
|
|
|
ass_stCadAssCoef.swKmhToMSpdPu = 889L*(SLONG)ass_stCadAssCoef.uwMotorPoles*(SLONG)ass_stCadAssCoef.uwMechRationMotor/((SLONG)ass_stCadAssCoef.uwWheelCircumferenceCm * (SLONG)FBASE);
|
|
|
ass_stCadAssCoef.slBSpdPuToMSpdPu = ((SLONG)ass_stCadAssCoef.uwMechRationMotor * ass_stCadAssCoef.uwMotorPoles);
|
|
|
- ass_stCadAssCoef.swMSpdpuLimit = (SWORD)((SLONG)ass_stCadAssCoef.swKmhToMSpdPu*(SLONG)(ass_stCadAssCoef.uwAssistMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4);
|
|
|
+ ass_stCadAssCoef.swMSpdpuLimit = (SWORD)(((SLONG)ass_stCadAssCoef.swKmhToMSpdPu*(SLONG)(ass_stCadAssCoef.uwAssistMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4) / 10);
|
|
|
ass_stCadAssCoef.swAssistSectionComp = _IQ14(1.0/3.0);
|
|
|
|
|
|
/** Module Input Parameter Initial */
|
|
@@ -336,13 +336,13 @@ void ass_voAssistCoefCal(void)
|
|
|
/** Bike and assist parameter config */
|
|
|
ass_stCadAssCoef.uwWheelCircumferenceCm = ass_ParaCong.uwWheelPerimeter + ass_ParaCong.swDeltPerimeter;
|
|
|
ass_stCadAssCoef.uwMechRationMotor = ass_ParaCong.uwMechRationMotor;
|
|
|
- ass_stCadAssCoef.uwAssistMaxBikeSpeed = ((ass_ParaSet.uwAssistLimitBikeSpdStart+ass_ParaCong.swDeltaBikeSpeedLimit)<<4) + 8; // 骑行助力限速
|
|
|
- ass_stCadAssCoef.uwThrottleMaxBikeSpeed = ((ass_ParaCong.uwThrottleMaxSpdKmH+ass_ParaCong.swDeltaBikeSpeedLimit)<<4) + 8;
|
|
|
- ass_stCadAssCoef.uwCartMaxBikeSpeed = (ass_ParaCong.uwCartSpdKmH<<4) + 2;
|
|
|
+ ass_stCadAssCoef.uwAssistMaxBikeSpeed = ((ass_ParaSet.uwAssistLimitBikeSpdStart + ass_ParaCong.swDeltaBikeSpeedLimit) << 4) + 80; // 骑行助力限速
|
|
|
+ ass_stCadAssCoef.uwThrottleMaxBikeSpeed = ((ass_ParaCong.uwThrottleMaxSpdKmH + ass_ParaCong.swDeltaBikeSpeedLimit) << 4) + 80;
|
|
|
+ ass_stCadAssCoef.uwCartMaxBikeSpeed = (ass_ParaCong.uwCartSpdKmH << 4) + 20;
|
|
|
if(cp_stFlg.RunModelSelect == TorqAssist)
|
|
|
{
|
|
|
cadence_stFreGetCof.uwNumbersPulses = cadence_stFreGetCof.uwTorque_NumbersPulses;
|
|
|
- }
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
cadence_stFreGetCof.uwNumbersPulses=cadence_stFreGetCof.uwCad_NumbersPulses;
|
|
@@ -359,11 +359,9 @@ void ass_voAssistCoefCal(void)
|
|
|
ass_stCadAssCoef.slBSpdPuToMSpdPu = ((SLONG)ass_stCadAssCoef.uwMechRationMotor * ass_stCadAssCoef.uwMotorPoles);
|
|
|
|
|
|
/** Motor Max Speed calculate according to bike speed limit */
|
|
|
-
|
|
|
-
|
|
|
- tmp_slAssistSpdLimit = ((SLONG)ass_stCadAssCoef.swKmhToMSpdPu*((SLONG) ass_stCadAssCoef.uwThrottleMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4) / 10;
|
|
|
+ tmp_slAssistSpdLimit = ((SLONG)ass_stCadAssCoef.swKmhToMSpdPu*((SLONG) ass_stCadAssCoef.uwThrottleMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4) / 10;
|
|
|
ass_stCadAssCoef.swThrottleMaxspd= (SWORD)tmp_slAssistSpdLimit;
|
|
|
- tmp_slAssistSpdLimit = ((SWORD)((SLONG)ass_stCadAssCoef.swKmhToMSpdPu*((SLONG)ass_stCadAssCoef.uwAssistMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4)) / 10;
|
|
|
+ tmp_slAssistSpdLimit = ((SWORD)((SLONG)ass_stCadAssCoef.swKmhToMSpdPu*((SLONG)ass_stCadAssCoef.uwAssistMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4)) / 10;
|
|
|
ass_stCadAssCoef.swAssistMaxSpd=(SWORD)tmp_slAssistSpdLimit;
|
|
|
|
|
|
#if(THROTTLEGEAR !=0)
|
|
@@ -381,9 +379,9 @@ void ass_voAssistCoefCal(void)
|
|
|
CadAssistSped.uwGearFour =(UWORD)( ass_stCadAssCoef.uwThrottleMaxBikeSpeed *CAD_FOUR_SPEED_PERCENT/100 );
|
|
|
CadAssistSped.uwGearFive =(UWORD)( ass_stCadAssCoef.uwThrottleMaxBikeSpeed *CAD_FIVE_SPEED_PERCENT/100 );//
|
|
|
#endif
|
|
|
- if(ass_ParaSet.uwAssistLimitBikeSpdStart >= 25)
|
|
|
+ if(ass_ParaSet.uwAssistLimitBikeSpdStart >= 250) //没用到
|
|
|
{
|
|
|
- ass_stCadAssCoef.swAssistSectionComp = ((25L<<14)/(3L*ass_ParaSet.uwAssistLimitBikeSpdStart));
|
|
|
+ ass_stCadAssCoef.swAssistSectionComp = ((250L << 14) / (3L * ass_ParaSet.uwAssistLimitBikeSpdStart));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1155,14 +1153,14 @@ void ass_voAssistCmdDeal(void)
|
|
|
*/
|
|
|
void ass_voAssMaxCurCal(void)
|
|
|
{
|
|
|
- /** Local variable */
|
|
|
- /** Calculate the Speed use for speed limit */
|
|
|
+ /* Local variable */
|
|
|
+ /* Calculate the Speed use for speed limit */
|
|
|
SLONG tmp_slMotorSpd = (SLONG)ass_stCadAssParaIn.swSpdFbkPu * (SLONG)ass_stCadAssParaIn.swDirection;
|
|
|
- /** Calculate the err of current speed and limit speed */
|
|
|
+ /* Calculate the err of current speed and limit speed */
|
|
|
SLONG tmp_slSpdLimitErr = tmp_slMotorSpd - ((SLONG)ass_stCadAssCoef.swMSpdpuLimit - (((SLONG)ass_stCadAssCoef.swKmhToMSpdPu * ASS_SPD_LIMIT_ERR >> 4) / 10));
|
|
|
SLONG tmp_slSpdLimitCoef = 0;
|
|
|
|
|
|
- /** Calculate the q axis current limit by speed limit */
|
|
|
+ /* Calculate the q axis current limit by speed limit */
|
|
|
if (tmp_slSpdLimitErr <= 0)
|
|
|
{
|
|
|
ass_stCadAssParaPro.swCurrentMaxPu = ass_stCadAssCoef.uwCofCurMaxPu;
|
|
@@ -1179,7 +1177,7 @@ void ass_voAssMaxCurCal(void)
|
|
|
ass_stCadAssParaPro.swCurrentMaxPu = 0; /**< Q14 */
|
|
|
}
|
|
|
|
|
|
- /** Calculate the min value of speed limit,flux limit,power limit and Bms limit. Q14 */
|
|
|
+ /* Calculate the min value of speed limit,flux limit,power limit and Bms limit. Q14 */
|
|
|
ass_stCadAssParaPro.swCurrentMaxPu = (ass_stCadAssParaPro.swCurrentMaxPu < ass_stCadAssParaIn.swPwrIqLimitPu) ? ass_stCadAssParaPro.swCurrentMaxPu : ass_stCadAssParaIn.swPwrIqLimitPu;
|
|
|
ass_stCadAssParaPro.swCurrentMaxPu = (ass_stCadAssParaPro.swCurrentMaxPu < ass_stCadAssParaIn.swFlxIqLimitPu) ? ass_stCadAssParaPro.swCurrentMaxPu : ass_stCadAssParaIn.swFlxIqLimitPu;
|
|
|
ass_stCadAssParaPro.swCurrentMaxPu = (ass_stCadAssParaPro.swCurrentMaxPu < ass_stCadAssParaIn.uwBmsIqLimitPu) ? ass_stCadAssParaPro.swCurrentMaxPu : ass_stCadAssParaIn.uwBmsIqLimitPu;
|
|
@@ -1610,7 +1608,7 @@ void ass_voAssistFunc(void)
|
|
|
ass_stCadAssParaPro.swSpdFbkPuRec[((ass_stCadAssParaPro.uw1msCnt)%10)] = ass_stCadAssParaIn.swSpdFbkPu;
|
|
|
ass_stCadAssParaPro.swSpdFbkPuAcc = (SWORD)((SLONG)ass_stCadAssParaIn.swSpdFbkPu - (SLONG)ass_stCadAssParaPro.swSpdFbkPuRec[((ass_stCadAssParaPro.uw1msCnt + 1)%10)]);
|
|
|
|
|
|
- ass_voAssMaxCurCal();
|
|
|
+ ass_voAssMaxCurCal();
|
|
|
ass_voAssInitVoltageCal();
|
|
|
|
|
|
//Calculate the Assist Current
|