Эх сурвалжийг харах

二段加减油门判断step_val 大于阈值才启动二段模式

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 3 жил өмнө
parent
commit
50051eb091

+ 1 - 1
Applications/foc/core/PMSM_FOC_Core.c

@@ -425,7 +425,7 @@ u8 PMSM_FOC_CtrlMode(void) {
 		}else if ((preMode == CTRL_MODE_CURRENT) && (gFoc_Ctrl.out.n_RunMode == CTRL_MODE_TRQ)) {
 			PI_Controller_Reset(gFoc_Ctrl.pi_torque, gFoc_Ctrl.in.s_targetTorque);
 		}else if ((preMode == CTRL_MODE_TRQ) && (gFoc_Ctrl.out.n_RunMode == CTRL_MODE_CURRENT_BRK)) {
-			float real_trq = PMSM_FOC_Get_Real_Torque();
+			float real_trq = PMSM_FOC_Get_Real_Torque() * 0.9f;
 			eCtrl_reset_Current(min(real_trq, gFoc_Ctrl.in.s_targetTorque));
 			eCtrl_set_TgtCurrent(-PMSM_FOC_GeteBrkPhaseCurrent());
 		}	

+ 18 - 8
Applications/foc/core/e_ctrl.h

@@ -190,17 +190,27 @@ static void eRamp_set_X2_target(e_Ramp *ramp, float c) {
 
 	float step_ms = CONFIG_eCTRL_STEP_TS;	
 	if (delta > 0) {
-		float first_delta = min(delta, 10.0f);
-		ramp->first_target = c_now + first_delta;
-		ramp->first_step = 0.05f;
-		delta -= first_delta;
 		step_val = (delta)/(ramp->acct/step_ms);
+		if (step_val > 0.1f) {
+			float first_delta = min(delta, 5.0f);
+			ramp->first_target = c_now + first_delta;
+			ramp->first_step = 0.1f;
+			delta -= first_delta;
+			step_val = (delta)/(ramp->acct/step_ms);
+		}else {
+			ramp->first_target = ramp->first_step = 0.0f;
+		}
 	}else if (delta < 0){
-		float first_delta = MAX(delta, -5.0f);
-		ramp->first_target = c_now + first_delta;
-		ramp->first_step = -0.05f;
-		delta -= first_delta;
 		step_val = (delta)/(ramp->dect/step_ms);
+		if (ABS(step_val) > 0.1f) {
+			float first_delta = MAX(delta, -5.0f);
+			ramp->first_target = c_now + first_delta;
+			ramp->first_step = -0.1f;
+			delta -= first_delta;
+			step_val = (delta)/(ramp->dect/step_ms);
+		}else {
+			ramp->first_target = ramp->first_step = 0.0f;
+		}
 	}else {
 		step_val = 0;
 		ramp->first_step = ramp->first_target = 0;