|
@@ -998,38 +998,34 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_Process(uint16_t SenorData, MC_Gear
|
|
|
}
|
|
|
|
|
|
|
|
|
-uint16_t torqueApp;
|
|
|
-uint16_t torque_NM;
|
|
|
-uint16_t torqueRank=0;
|
|
|
-uint16_t torqueRankLast=0;
|
|
|
-static uint16_t torqueRankBak=0;
|
|
|
-uint16_t candenceCount;
|
|
|
-uint8_t flagUpDown=0;
|
|
|
-
|
|
|
-static int32_t tmpFltSum=0;
|
|
|
-int16_t tmpFlted=0;
|
|
|
+uint16_t candenceCount; //踏频磁环信号计数变量,全局变量
|
|
|
|
|
|
-int16_t torqueApp2;
|
|
|
-
|
|
|
-int16_t torqueAppRef=0;
|
|
|
+uint16_t torqueApp;
|
|
|
+uint16_t torque_NM; //力矩值,单位NM
|
|
|
+uint16_t torqueRank=0; //由踏频采样后的力矩值,得出的力矩给定
|
|
|
+static uint16_t torqueRankLast=0; //力矩给定历史值
|
|
|
+static uint16_t torqueRankBak=0; //力矩给定历史值备份
|
|
|
+static uint8_t flagUpDown=0; //输入力矩上升、下降的标志位
|
|
|
|
|
|
-uint8_t flagCandence=0;
|
|
|
-int16_t torqueAppLag=0;
|
|
|
-int16_t torqueAppRatio=0;
|
|
|
-int16_t torqueAppResult=0;
|
|
|
+static int32_t tmpFltSum=0; //输入力矩滤波的静态变量
|
|
|
+int16_t tmpFlted=0; //输入力矩滤波的临时变量
|
|
|
|
|
|
-int16_t torqueAppAccStep= 5; //84;
|
|
|
-int16_t torqueAppDecStep=1; //14
|
|
|
+int16_t torqueApp2; //力矩计算的临时变量
|
|
|
|
|
|
-uint16_t candenceBakAtTop=0;
|
|
|
-uint16_t torqueByCandenceDec=0;
|
|
|
+uint8_t flagCandence=0; //踏频信号更新标志
|
|
|
+int16_t torqueAppLag=0; //力局地经过加减速处理后的临时变量
|
|
|
+int16_t torqueAppRatio=0; //力矩值计算助力比后的临时变量
|
|
|
|
|
|
-int16_t torqueDataFromCadence=0;
|
|
|
+int16_t torqueAppAccStep= 5; //力矩给定升速斜率
|
|
|
+int16_t torqueAppDecStep=1; //力矩给定减速斜率
|
|
|
|
|
|
-int32_t Taping_activeFlt=0; //踏频实时值滤波中间量
|
|
|
-int32_t Taping_activeFlted = 0; //踏频实时值滤波值
|
|
|
+uint16_t candenceBakAtTop=0; //踏频最大值备份
|
|
|
+uint16_t torqueByCandenceDec=0; //由踏频变化计算的力矩减弱量
|
|
|
+int16_t torqueDataFromCadence=0; //经过踏频信号采样的力矩值
|
|
|
+int32_t Taping_activeFlt=0; //踏频实时值滤波中间量
|
|
|
+int32_t Taping_activeFlted = 0; //踏频实时值滤波值
|
|
|
|
|
|
-#define TORQUE_TMP 28
|
|
|
+#define TORQUE_TMP 28 //力矩AD值与1NM的换算系数
|
|
|
|
|
|
MC_CalParam_Struct_t MC_AssistRunMode_Torque_compensation(uint16_t SenorData, MC_GearSt_Struct_t GearSt)
|
|
|
{
|
|
@@ -1213,6 +1209,9 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_compensation(uint16_t SenorData, MC
|
|
|
if(GearSt == 0x33)
|
|
|
{
|
|
|
torqueAppRatio = ((int32_t)torqueApp * torqueApp / (MC_AssisParam.Gear_SMART.i_Sport_TH));
|
|
|
+
|
|
|
+ torqueAppRatio = (int16_t)((int32_t)torqueAppRatio * MC_ConfigParam1.UserAdjParam_SMART.Assist_K_GAIN / 100); //上位机助力比增益调节
|
|
|
+
|
|
|
//给定上限
|
|
|
torqueAppRatio = (torqueAppRatio > MC_AssisParam.Gear_SMART.Upper_Iq) ? MC_AssisParam.Gear_SMART.Upper_Iq : torqueAppRatio;
|
|
|
|
|
@@ -1233,6 +1232,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_compensation(uint16_t SenorData, MC
|
|
|
//torqueAppRatio = torqueApp * 0.5;
|
|
|
//torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 51 ,410, 1300, torqueApp)) >> 10 ); //0.4
|
|
|
torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 51 ,MC_AssisParam.Gear_ECO.Gain_K, 1300, torqueApp)) >> 10 ); //0.4
|
|
|
+ torqueAppRatio = (int16_t)((int32_t)torqueAppRatio * MC_ConfigParam1.UserAdjParam_ECO.Assist_K_GAIN / 100); //上位机助力比增益调节
|
|
|
|
|
|
//给定上限
|
|
|
torqueAppRatio = (torqueAppRatio > MC_AssisParam.Gear_ECO.Upper_Iq) ? MC_AssisParam.Gear_ECO.Upper_Iq : torqueAppRatio;
|
|
@@ -1249,6 +1249,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_compensation(uint16_t SenorData, MC
|
|
|
//torqueAppRatio = torqueApp * 0.8;
|
|
|
//torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 102 ,717, 1300, torqueApp)) >> 10 ); //0.7
|
|
|
torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 102 ,MC_AssisParam.Gear_NORM.Gain_K, 1300, torqueApp)) >> 10 ); //0.7
|
|
|
+ torqueAppRatio = (int16_t)((int32_t)torqueAppRatio * MC_ConfigParam1.UserAdjParam_NORM.Assist_K_GAIN / 100); //上位机助力比增益调节
|
|
|
|
|
|
//给定上限
|
|
|
torqueAppRatio = (torqueAppRatio > MC_AssisParam.Gear_NORM.Upper_Iq) ? MC_AssisParam.Gear_NORM.Upper_Iq : torqueAppRatio;
|
|
@@ -1267,6 +1268,7 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_compensation(uint16_t SenorData, MC
|
|
|
//torqueAppRatio = torqueApp * 1.0;
|
|
|
//torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 204 ,1024, 1300, torqueApp)) >> 10 ); //1.0
|
|
|
torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 204 , MC_AssisParam.Gear_SPORT.Gain_K, 1300, torqueApp)) >> 10 ); //1.0
|
|
|
+ torqueAppRatio = (int16_t)((int32_t)torqueAppRatio * MC_ConfigParam1.UserAdjParam_SPORT.Assist_K_GAIN / 100); //上位机助力比增益调节
|
|
|
|
|
|
//给定上限
|
|
|
torqueAppRatio = (torqueAppRatio > MC_AssisParam.Gear_SPORT.Upper_Iq) ? MC_AssisParam.Gear_SPORT.Upper_Iq : torqueAppRatio;;
|
|
@@ -1285,7 +1287,8 @@ MC_CalParam_Struct_t MC_AssistRunMode_Torque_compensation(uint16_t SenorData, MC
|
|
|
//torqueAppRatio = torqueApp * 1.5;
|
|
|
//torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 307 ,1536, 1300, torqueApp)) >> 10 ); // 1.5
|
|
|
torqueAppRatio = (int16_t)((uint32_t)(torqueApp * Coefficient_GainCal( 307 ,MC_AssisParam.Gear_TURBO.Gain_K, 1300, torqueApp)) >> 10 ); // 1.5
|
|
|
-
|
|
|
+ torqueAppRatio = (int16_t)((int32_t)torqueAppRatio * MC_ConfigParam1.UserAdjParam_TURBO.Assist_K_GAIN / 100); //上位机助力比增益调节
|
|
|
+
|
|
|
//给定上限
|
|
|
torqueAppRatio = (torqueAppRatio > MC_AssisParam.Gear_TURBO.Upper_Iq) ? MC_AssisParam.Gear_TURBO.Upper_Iq : torqueAppRatio;
|
|
|
|