Просмотр исходного кода

1. dq电流输出低通滤波器系数需要设置下限,不能等于0
2. 阶跃响应修改,不需要运行mot_contrl的slow task

Signed-off-by: huhui <huhui@sharkgulf.com>

huhui 2 лет назад
Родитель
Сommit
e4fd39c1bb
2 измененных файлов с 7 добавлено и 4 удалено
  1. 4 3
      Applications/foc/core/controller.c
  2. 3 1
      Applications/foc/motor/motor.c

+ 4 - 3
Applications/foc/core/controller.c

@@ -234,6 +234,9 @@ bool mot_contrl_update(mot_contrl_t *ctrl) {
 	}else {
 		foc->in.mot_angle = enc_angle;
 	}
+#ifdef CONFIG_DQ_STEP_RESPONSE
+	foc->in.mot_angle = 0;
+#endif
 	foc->in.mot_velocity = enc_vel;
 	foc->in.dc_vol = get_vbus_float();
 	foc->in.b_openloop = ctrl->mode_running == CTRL_MODE_OPEN;
@@ -246,9 +249,7 @@ bool mot_contrl_update(mot_contrl_t *ctrl) {
 	foc_update(foc);
 
 	float lowpass = foc->mot_vel_radusPers * FOC_CTRL_US * 2;
-	if (lowpass > 1) {
-		lowpass = 1;
-	}
+	lowpass = fclamp(lowpass, 0.001f, 1.0f);
 	LowPass_Filter(ctrl->out_idq_filterd.d, foc->out.curr_dq.d ,lowpass);
 	LowPass_Filter(ctrl->out_idq_filterd.q, foc->out.curr_dq.q ,lowpass);
 	return true;

+ 3 - 1
Applications/foc/motor/motor.c

@@ -1458,7 +1458,7 @@ static bool mc_can_restart_foc(void) {
 	}
 	return can_start;
 }
-
+static void mc_motor_runstop(void) __attribute__((unused));
 static void mc_motor_runstop(void) {
 	u32 mask;
 	if (mot_contrl_is_start(&motor.controller) && mc_can_stop_foc()) {
@@ -1583,8 +1583,10 @@ void Sched_MC_mTask(void) {
 	}
 	/* 堵转处理 */
 	if (mc_run_stall_process(runMode) || (motor.mode == CTRL_MODE_CURRENT)) {
+#ifndef CONFIG_DQ_STEP_RESPONSE
 		mot_contrl_slow_task(&motor.controller);
 		mc_motor_runstop();
+#endif
 		if (motor.b_ind_start) {
 			mot_params_flux_stop();
 		}