Matlab 中的 PID 补偿

PID Compensation in Matlab

我正在尝试使用 Matlab 设计 PID 补偿器。 我正在执行以下操作:

我的植物有这个传递函数:

plant 


       ( 0.0195 s - 6.5  )/ (1.74e-06 s^2 - 0.003 s - 1)

因此,使用 PID 调节功能,指定所需的交叉频率:

>> [info,pid_c] = pidtune(plant,'PID',(2E6/6)*2*pi)

info =


  Kp + Ki * 1/s


  with Kp = 162, Ki = 1.96e+08

Continuous-time PI controller in parallel form.


pid_c =

                Stable: 1
    CrossoverFrequency: 2.0944e+06
           PhaseMargin: 60.0000

但是,当我关闭循环并分析系统的极点时,我发现右半平面中有一个极点:

>> pid_c = 162 + 1.96E8/s

pid_c =

(  162 s + 1.96e08 ) /  s

Continuous-time transfer function.

>> sys=feedback(plant*pid_c,1)

sys =

         (3.159 s^2 + 3.821e06 s - 1.274e09 )/ ( 1.74e-06 s^3 + 3.156 s^2 + 3.821e06 s - 1.274e09)

Continuous-time transfer function.

>> pole(sys)

ans =

   1.0e+06 *

  -0.9071 + 1.1721i

  -0.9071 - 1.1721i

   0.0003 <==== RSP pole

我的直觉告诉我应该通过在 PID 的分子上加上一个 (s+0.0003) 来避开这个极点:

>> pid_c=pid_c*(s+0.0003)

pid_c =

(  162 s^2 + 1.96e08 s + 5.88e04 )/  s

但是根本不起作用,我的闭环传递函数是这样的:

sys =

  (3.159 s^3 + 3.821e06 s^2 - 1.274e09 s - 3.822e05) /  (3.159 s^3 + 3.821e06 s^2 - 1.274e09 s - 3.822e05)

当然那是错误的。

非常感谢您的帮助。

问题是因为您没有正确调用 pidtune。返回的第一个变量是控制器,第二个是关于闭环稳定性的信息,而不是相反。来自 documentation:

[C,info] = pidtune(...) returns the data structure info, which contains information about closed-loop stability, the selected open-loop gain crossover frequency, and the actual phase margin.

所以我会将代码更改为:

[pid_c,info] = pidtune(plant,'PID',(2E6/6)*2*pi);
sys=minreal(feedback(pid_c*plant,1));
pole(sys)

您犯的第二个错误是极点不在 0.0003,而是在 0.0003 * 1e6。如果您要依赖屏幕上显示的内容,您至少应该使用 format long g 以获得更多有效数字。

另外,请注意我已经使用 minreal 来计算闭环传递函数的最小实现,因为你似乎混合了非常大和非常小的数字,不是一个好的组合.