Automated control systems¶
This example shows how to obtain frequency response data for a SISO model of a proportional-integral controller dynamic system.
The PI controller can make the error between the desired value and the actual value become zero. This means that it can achieve accuracy in regulation.
Its setup is quite simple. Only two parameters need to be adjusted: the gain (Kr) and the integration time constant (Ti). With these parameters, the minimum regulation error can be achieved.
Reference materials for some libraries:
Pkg.add(["ControlSystems"])
# Установка новой библиотеки может занять около минуты
using ControlSystems
using Plots;
gr()
#plotlyjs() # для интерактивных графиков
print("Библиотеки готовы!")
Connect SISO systems described in the state space¶
P1 = ssrand(1,1,1);
P2 = ssrand(1,1,1);
append(P1, P2)
Study of the transfer function response¶
Plot the LAFFC of an open and closed system $$P(s) = \frac{1}{(s+1)^4}$$ using the function gangoffourplot()
, to draw conclusions about the sensitivity of the system to oscillations at different frequencies.
P = ControlSystems.tf(1,[1,1])^4
gangoffourplot( P, tf(1), titlefont = font(9), guidefont = font(8))
The graphs show that the system is too sensitive at frequencies around $\omega = 0.8$ rad/s.
Setting the PI controller¶
Set up a PI controller for the system $$P(s) = \frac{1}{(s+1)^4}$$$
Use the function loopshapingPI
, specifying that the system should have a phase margin of 60 degrees around the frequency $\omega = 0.8$ rad/s.
Plot 4 graphs - the LAFCC for the open and closed system using the function gangoffourplot
and the Nyquist hodograph using the function nyquistplot
.
using ControlSystems, Plots
P = tf(1,[1,1])^4
ωp = 0.8
C,kp,ki = loopshapingPI(P, ωp, phasemargin=60, form=:parallel)
p1 = gangoffourplot(P, [tf(1), C]);
p2 = nyquistplot([P, P*C], ylims=(-1,1), xlims=(-1.5,1.5));
plot(p1,p2, layout=(2,1), size=(800,800))
Conclusion¶
In the exploded example, the automated control system of the PI controller has been analysed.
The response of the transfer function was also studied and the PI controller was adjusted.