Feature similar to feedback command in simulink
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have an issue with discrete controller I am trying to implement. I discretized a PID controller C and the plant G with the Tustin method. The discretization is stable with the feedback command:
feedback(C*G, 1)
But when I use the normal feedback equation the system becomes unstable:
(C*G)/(1 + C*G)
I read in the feedback command documentation that this is a numerical(?) issue and that the feedback command gives the correct answer. I confirmed this by comparing the frequency response of the system with the normal equation and the feedback command. The DC gain with the normal equation is completely off.
In any other case, I would just use the feedback command, but I would like to use the model in SIMULINK, so I can scope the input u and implement saturation blocks.
How can I implement the correct stable closed-loop system in SIMULINK and still be able to scope the input and add saturation limits?
Thank you in advance!
For reference my C and G are listed below (d indicates discrete):
s = tf('s');
C = 180*( ( s+0.1 )*( s+0.04 ) )/(s*(s+60));
G = 1/(s^2*(0.1*s + 1));
T = 0.05;
Cd = c2d(C, T, 'tustin');
Gd = c2d(Gd, T, 'tustin');
Hd = feedback(Cd*Gd, 1);
Hd2 = Cd*Gd/(1+Cd*Gd);
isstable(Hd)
isstable(Hd2)
0 个评论
采纳的回答
Paul
2021-12-16
Two separate issues.
The first is that, as you've discovered, it's (almost?) always better to use the feedback() command as for Hd, rather than lti algebra, as for Hd2. Having said that, it's also (almost?) always preferred to use the zpk (or ss) form rather than the tf form. Using the zpk form gives the expected result, even for Hd2:
s = tf('s');
C = 180*( ( s+0.1 )*( s+0.04 ) )/(s*(s+60));
G = 1/(s^2*(0.1*s + 1));
Hc = feedback(C*G,1);
T = 0.05;
Cd = c2d(zpk(C), T, 'tustin');
Gd = c2d(zpk(G), T, 'tustin');
Hd = feedback(Cd*Gd, 1);
Hd2 = Cd*Gd/(1+Cd*Gd);
Compare the frequency responses, and show Hd and Hd2 match, and they approximate Hc.
bode(Hd,Hd2,Hc,{1e-4 62})
legend('Hd','Hd2','Hc')
However, isstable() still returns different answers
isstable(Hd)
isstable(Hd2)
Look at Hd and Hd2
Hd
Hd2
All poles of Hd are inside the unit circle, but Hd2 has three poles at z = 1, which is why isstable returns false. But those poles only show up because of the lti algebra and they cancel with three zeros z
minreal(Hd2)
which shows that Hd2 is the same as Hd.
The second issue is the Simulink implementation. In Simulink, there is no need to implement the closed loop system with a single block. Just draw the block digram using one block for the plant and one for the controller. Connect the output of the latter to the input of the former and then implement the feedback loop using a Sum or Subtract block. The plant and controller can each be implemented in an LTI System block. That way you can implement the plant using C or Cd, and the control using G or Gd, depending on what you're really trying to model.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classical Control Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!