[toc]
This note is written mainly for learning Feedback Control via reading Feedback Control of Dynamic Systems and some papers. The pictures, if not marked specially, are from the original book.
Thanks for fellow xzy's support.
Written by Bingchuan Wei
- Control is the process of making a system variable adhere to a particular value, called the reference value. A system designed to follow a changing reference is called tracking control or a servo. A system designed to maintain an output fixed regardless of the disturbances present is called a regulating control or a regulator.
- A simple feedback system consists of the **process **whose output is to be controlled, the actuator/plant whose output causes the process output to change, a reference command signal, and output sensors that measure these signals, and the controller that implements the logic by which the control signal that commands the actuator is calculated.
- A well-designed feedback con
- trol system will be stable, track a desired input or setpoint , reject disturbances, and be insensitive (or robust) to changes in the math model used for design.
- The theory and design techniques of control have come to be divided into two categories: classical control methods use Laplace transforms (or z-transform) and were the dominant methods for control design until modern control methods based on ODEs in state form were introduced into the field starting in the 1960s.
s=tf(‘s’); % sets up the mode to define the transfer function
sys = (1/1000)/(s + 50/1000); % defines the transfer function
step(500*sys); % plots the step response for u = 500.
tf() function usage step() function usage
The control situation where the sensor and actuator are rigidly attached to one another is called collocated control, while the other is called non-collocated control
A simple graph of a quadrotor:
The sensors used in quadrotor are mainly ultrasound(to get the distance from a surface), camera(to detect the motion of the surrounding to judge the motion of drone), IMU, pressure sensor(to get the altitude). The diagonal rotors(eg. 1 and 3) are driven in the same direction(CW or CCW), the reaction the rotor exerts on the drone consists of the lift force and the reaction torque. To control Pitch and roll, the diagonal rotor must speed up and slow down simultaneously. To control yaw, the diagonal rotor must all speed up or slow down.
The MUX(multiplexer) block in simulink can combine the signal from multi channl and draw them in a same diagram.
For systems with flexible parts in it(like a rod), the dynamic equation will always a high order equation. eg.
To simplify the distributed parameter, we can regrad the system as two or more rigid bodies connected by springs, the result is sometimes called a lumped parameter model.
Operational amplifier is basic in circuit system.A operation amplifier's symbol and its schematic are shown below:
The third picture means the v+ is connected to the GND.
Basic equation of operational amplifier are: $$ i_{+} = i_{-} = 0 \ v_{+} -v_{-} = 0 $$
The dynamic response for a singal with the form
The plot where the frequency response of $ \cos(\omega t)$ is drawn with amplitude and phase apart is called bode plot. The following code is an example for bode plot in Matlab
k = 1;
tf=(‘s’);
sysH = 1/(s+k);
function
w = logspace(-2,2);
[mag,phase] = bode(sysH,w);
loglog(w,squeeze(mag));
semilogx(w,squeeze(phase));
% define Laplace variable
% define system by its transfer
% set frequency w to 50 values from 10^-2 to 10^2
% compute frequency response
% log–log plot of magnitude
% semi-log plot of phase
The usage of several functions :
%code block 1
num = 2; % form numerator
den = poly([-2;-1;-4]); % form denominator polynomial from its roots
[r,p,k] = residue(num,den); % compute the residues
%code block 2
s=tf(‘s’); % define Laplace variable
sysH=0.001/(s^2+0.05*s); % form transfer function
p=pole(sysH); % compute poles
[z,k]=zero(sysH); % compute zeros and transfer function gain
%block 3
s=tf('s'); % define Laplace variable
sysG=0.0002/s ^2; % define system by its transfer function
t=0:0.01:10; % set up time vector with dt = 0.01 sec
% pulse of 25N, at 5 sec, for 0.1 sec duration
u1=[zeros(1,500)
25*ones(1,10)
zeros(1,491)]; % pulse input
[y1]=lsim(sysG,u1,t); % linear simulation
ff=180/pi; % conversion factor from radians to degrees
y1=ff*y1; % output in degrees
plot(t,u1); % plot input signal
plot(t,y1); % plot output response
The usage of several functions :
$G_1$is called Forward Gain, $G_1G_2$is called Loop Gain. Set the s = 0, we get DC gain, which is the gain for a step input.
The diagram can be transformed to facilitate the analysis
The feedback in (c) is called Unity Feedback
The standard form of the second order system is
$$
H(s) = \frac{\omega_n^2}{s^2+2\zeta\omega_ns+\omega_n^2}
$$
where
The standard impulse response : $$ h(t) = \frac{\omega_n}{\sqrt{1-\zeta^2}}e^{-\sigma t}\sin(\omega_d t) $$ The standard step response: $$ y(t) = 1-\frac{e^{-\sigma t}}{\sqrt{1-\zeta^2}}\cos(\omega_dt-\beta) $$ where $$ \sigma = \zeta\omega_n\ \omega_d=\sqrt{1-\zeta^2}\omega_n\ \beta = \arctan(\frac{\zeta}{\sqrt{1-\zeta^2}}) $$ According to the standard response, we can analyze the domain specifications
-
Rise Time
For a second-order system with no zeros, we have $$ t_r = \frac{1.8}{\omega_n} $$
-
Overshoot and Peak time
Analytically, we have $$ t_p = \frac{\pi}{\omega_d}\ M_p = e^{-\pi\tan\beta} $$
-
Settling Time
Define the settling time as that value of when the decaying exponential reaches 1%: $$ t_s = \frac{4.6}{\sigma} $$
In s-plane, the above relationship can help us to choose the reasonable poles location.
Basically, a zero in
At the level of transient analysis, the zeros exert their influence by modifying the coefficients of the Mode. In general, a zero near a pole reduces the amount of that term in the total response.
The analysis of zeros is deviding the tf into the two parts, the former being the initial response, the latter regarded as the derivative of the inital response multiplied by a constant.
The zero in the right half plane is called RHP or nonminimum-phase zero
Placing the complex zeros near the locations of the lightly damped poles may provide sufficient improvement in step response performance.
We can get the following experience:
-
A zero in the left half-plane (LHP) will increase the overshoot if the zero is within a
factor of 4 of the real part of the complex poles. .
-
A zero in the RHP will depress the overshoot (and may cause the step response to
start out in the wrong direction).
-
An additional pole in the LHP will increase the rise time significantly if the extra pole is
within a factor of 4 of the real part of the complex poles.
For some explanation, see https://courses.engr.illinois.edu/ece486/fa2017/documents/lecture_notes/effects_zero_pole.pdf
Thic section mainly foucs on the LTI system's stability.
A basic condition for the stability is:
An LTI system is said to be stable if all the roots of the transfer function denominator polynomial have negative real parts , and is unstable otherwise.
A system is said to have bounded input–bounded output (BIBO) stability if every bounded input results in a bounded output.
We can get a equivalent condition of BIBO:
The system with impulse response being h(t) is BIBO-stable if and only-if: $$ \int_{-\infty}^{\infty}|h(\tau)|d\tau < \infty $$
If all poles are LHP, the stability is called internal stability. If there are no repeated pure imaginary pole, the stability is called neutrally stable.
The most simple necessary condition
A necessary (but not sufficient) condition for stability is that all the coefficients of the characteristic polynomial be positive.
Attention must be paid in using this criterion is than all coefficients must be positive. If 0 and negative appears, another methoed must be taken.
The sufficient and necessary condition of BIBO stable is given by Routh-Hurwitz criterion. Routh-Hurwitz criterion not only gives the result of stability, but gives the number of LHP roots.
Matlab can be used to draw the implicit function using fimplicit
This part mainly discusses LTI SISO system.
The general structure of open-loop system is :
If
What matters is that the poles in d(s) can not be cancelled out by the zero of b(s), even if it is reasonable in mathematics, a slight noise will cause the system break down. We can conclude that
An open-loop structure can not be used to make an unstable plant to be stable, and therefore cannot be used if the plant is already unstable.
Another fatal point of open-loop is that the controller has nothing to do with the disturbance W(s), so the loop-control can't be used as a regulator .
The general structure of feedback system is :
The basic equations are $$ Y_{cl} = \frac{D_{cl}G}{1+D_{cl}G}R+\frac{G}{1+D_{cl}G}W-\frac{D_{cl}G}{1+D_{cl}G}V\ E_{cl} = \frac{1}{1+D_{cl}G}R-\frac{G}{1+D_{cl}G}W+\frac{D_{cl}G}{1+D_{cl}G}V $$ We define $$ S = \frac{1}{1+D_{cl}G}\ \mathcal{J} =\frac{D_{cl}G}{1+D_{cl}G}\ $$ then $$ Y_{cl} = \mathcal{J}R+GSW-\mathcal{J}V\ E_{cl} = SR-GSW+\mathcal{J}V $$
According to the basic equation, if we increase the
The method of the dilemma is to design the controller that has different gains in the different frequency. Since the W(s) and V(s) have different properties. The environment disturbances are always of low frequency, somtimes are just a bias, while the sensor disturbances are always of high frequency.
We define the sensitivity in open loop system:
$$
S_{G}^{T} = \frac{\frac{dT_{ol}}{T_{ol}}}{\frac{dG}{G}}
$$
Since
Similarly, we can define the same concept in closed-loop system:
$$
S_{G}^{T} = \frac{\frac{dT_{cl}}{T_{cl}}}{\frac{dG}{G}}
$$
We get
$$
S_{G}^{T} = \frac{1}{1+D_{cl}G}
$$
We see
For the case where there is a non-unity pre filter F (s) following the reference input, R(s) , and non-unity sensor dynamics H (s) , the equations for the system output and the various sensitivity functions need to be re-derived.
In the general tracking problem, the reference input can often be adequately approximated as if it were a polynomial in time. So it's useful to analyze steady-state errors in stable systems with polynomial inputs.
We have
$$
\mathcal{L}(\frac{t^k}{k!}) = \frac{1}{s^{k+1}}
$$
If there are n integral in
The system's steady-state error is decided by n and k
n and k relationship | Steady-state error |
---|---|
n > k | 0 |
n < k | |
n = k = 0 | |
n is called Systme Type,
We see that a system has no steady-state error only if system type is higher than the order of reference point.
The other perspective regarding the system type is that for an unit-feedback system, if parameters in Plant change without the moving of zero poles, then the steady-state error will still be zero, which is called robust property of unity feedback system
For non-unitfeedback system, system type can be defined via close-loop transfer function
If we set reference to 0, namely, a regulator, then the error is caused by the disturbance W(s). We can take the W(s) as the reference point and define system type the same way above.
-
P controller
$u(t) = k_pe(t)$ ,$k_p$ for proportional gainFor a simple 2-order system, the system is 0 type. With the increase of
$k_p$ , the steady-state error will decrease, but the settling time will not be improved. The damping will decrease, which means that the oscillation will increase. System type of disturbance W(s) is also 0, which means that a step disturbance will also cause a steady-state error.For systems beyond second order, the situation is more complicated. A higher gain will increase the speed of response but typically at the cost of a larger transient overshoot and less overall damping.
-
I controller
$u(t) = k_I\int_{t_0}^{t}e(\tau)d\tau$ ,$k_I$ for integral gainIntegral feedback results in zero steady- state output error in both tracking and disturbance rejection. Since addition of integral control to the G(s) typically makes the system a Type 1, the **robust property ** is reserved.
However, integral control typically decreases the damping or stability of a system.
-
D controller
$u(t) = k_d\dot{e}(t)$ ,$k_d$ for derivative gainDerivative control is almost never used by itself; it is usually augmented by proportional control. Since the D controller takes control action based on the trend in the error signal, it is said to have an “anticipatory” behavior.
Sometimes the D controller is used as below to cancell the abrupt change in W(s):
The basic idea of feedforward control is that if we can get the inverse of the DC gain of G(s), we can directly send the error into the plant to compensate for the error as shown below:
For a closed-loop system, the characteristic equation $$ 1+D_c(s)G(s)H(s) = 0 $$ can be written as root locus form: $$ 1+KL(s) = 0 $$ where K is our concerned parameter,
The breakaway points(root move away from the real axis) and the break-in points(root move into the real axis) are important in root locus.
Grenerally, it's hard to get the root locus explicitly. Evans proposed a set of rules to draw root locus.
If the parameter K is real and positive, we call the locus positive locus or
Set
-
The n branches of the locus start at the poles of L(s) and m of these branches end on the zeros of L(s).
-
The loci are on the real axis to the left of an odd number of poles and zeros.
-
The asymptotic line of loci: (n-m) branches of the loci are asymptotic to lines at angles
$\phi_l$ radiating out from the point$s = \alpha$ on the real axis, where
- The break-in point and breakaway points satisfy the equation
$\frac{dK}{ds} = 0$ , and K must be positive. - Departure angle and arrival angle.
- The intersection point with imaginary axis: Routh Criterion.
These guildlines can only limit the root locus to some types, but not give locus definitely.
For now, Matlab will draw root locus perfectly so the above rules seem to be useless, but these rules give us a new perspective to check our controller. For example, when we add a zero near the pole, according to the rule of departure angle we may well expect that root will be shifted to LHP.
Using root locus method, we can choose a propotional gain to move poles. However, for many processes, it's not enough changing gain. Under these situations, it's nessasary to change the prossess itself, which is called compensation. Three main compensations are used:
- Lead compensation: approximates the function of PD control and acts mainly to speed up a response by lowering rise time and decreasing the transient overshoot.
- Lag compensation: approximates the function of PI control, and is usually used to improve the steady-state accuracy of the system.
- Notch compensation: used to achieve stability for systems with lightly damped flexible modes.
is called lead compensation and lag compensation for z < p and z >p respectively. They get their name by the phase impact on frequency analysis. The compensation introduces a phase change by $$ \phi = \tan^{-1}(\frac{\omega}{z})-\tan^{-1}(\frac{\omega}{p}) $$
For PD control, noise from the sensor may be amplified, so lead compensation is proposed. If p is not that far from the z, then the total effect of lead compensation is not a pure derivative. So there is a tradeoff for p.
Though lag compensation has the same form with lead compensation, they differ with each other by the choose of z and p. Lead compensation use such z and p as to cancell the pole of the plant and get a higher damping ratio. Lag compensation is usually used after the lead compensation to lower the steady state error by elevate the DC gain. By choosing z and p far smaller than natural frequency, lag compensation don not destroy our effect in lead compensation What we want is just the ratio of z/p.
Notch compensation is used to prevent the resonance in system by changing their phase.
Sometimes it's useful to introduce more than one feedback loop, by introducing inner and outer loop, we can design more stable system. For example:
The frequency-response method is the most-widely used method in feedback control system for the effect of alleviating the uncertainties. It is also cost-effective since the method only needs the response of sinusoidal input without the knowledge of the poles and zeros for the system.
A linear system’s response to sinusoidal inputs is called the system’s frequency response.
The first thing we see is the frequency response of the linear constant system with transfer function G(s): $$ Input: u(t) = A\sin(\omega_0t)1(t)\ U(s) = \frac{A\omega_0}{s^2+\omega_0^2}\ Y(s)=G(s)U(s)=\sum_{i=1}^{n}\frac{\alpha_i}{s-p_i}+\frac{\alpha_0}{s+j\omega_0}+\frac{\alpha_0^*}{s-j\omega_0},where \quad |\alpha_0|=\frac{A}{2}|G(j\omega_0)|\ y(t) = \sum_{i=1}^{n}e^{p_it}+2|\alpha_0|\cos(\omega_0t+\phi)=AM\cos(\omega_0t+\phi)\ M=|G(j\omega_0)|\ \phi= \angle G(j\omega_0) $$
The important part is the frequency response of such a system will converge to a sin term if the system is stable. M and
Two characteristic value for frequency-response is bandwidth and resonant peak. Bandwidth can be defined as the frequency where magnitude drops to a certain ratio. It can be used to measure the response speed, The resonant peak can be used to measure the overshoot.
The idea in Bode’s method is to plot magnitude curves using a logarithmic scale and phase curves using a linear scale, based on
$$
\lg(Me^{i\phi})=\lg(M)+i\phi\lg(e)
$$
If we use db as the unit for magnitude, the graph becomes the magnitude in decibels versus
The unit of
The draw Bode Graph, a good way is to write the transfer function in the bode form: $$ KG(s) = K_0\frac{(j\omega\tau_1 + 1)(j\omega\tau_2 + 1)\cdots}{(j\omega)^n(j\omega\tau_a + 1)(j\omega\tau_b + 1)\cdots}\ \lg(KG(s)) = \lg K_0 +\lg (j\omega\tau_1 + 1) + \lg (j\omega\tau_1 + 1)-\lg (j\omega\tau_a + 1)- \lg (j\omega)^n\cdots $$ We can analyze the result by dividing the result into three classes, for each class, what matters is Asymptote, Slope on the trasition point, Value on the trasition point :
-
$K_0(j\omega)^n$ $\lg K_0(j\omega)^n = \lg K_0 + n\log (j\omega)$ The graph for this case is a line with slope of n or 20*n(db/decade)
-
$(j\omega\tau_1 + 1)$ $(j\omega\tau_1 + 1) \approx 1 ,\omega\approx0,(j\omega\tau_1 + 1)\approx j\omega\tau_1,\omega \to \infty$ The breakpoint
$\omega = 1 /\tau_1$ is a trasition point with the slope of 1 or 20(db/decade) -
$((\frac{j\omega}{\omega_n})^2+2\zeta(\frac{j\omega}{\omega_n}+1)$ The breakpoint
$\omega = \omega_n$ with the slope of 2 or 40 (db/decade)
Since the phase angle are sumed for the composite curve, we can draw approximate graph for each interval.
All above discussion are based on a fact that
When
For a simple system like:
From the Root locus, we know that the neurtral stability condition is
$$
|KG(s)| = 1 \quad \angle G(s) = 180^{\circ}
$$
According to Bode Graph, we can find the
The Nyquist Criterion gives a perfect clarification of the relationship between the open-loop frequency response and the number of closed-loop poles of the system in the RHP. It is based on the argument principle.
argument principle:
A contour map of a complex function will encircle the origin (Z-P) times, where Z is the number of zeros and P is the number of poles of the function inside the contour.
The method of drawing a contour and analyze the contour map of the transfer function is called a contour evaluation. For a system with
More often, engineers want to get the K range where the system is stable. To do this, we can do contour evaluation for G(s) and to check its encirclements of -1/K. Since the poles of G(s) can always be gotten, we calculate the (N+P) to get the zeros of the system, which is the poles of the original system.
The Gain Margin(GM) is the factor by which the gain can be increased (or decreased in certain cases) before instability results based on the current state if the argument condition is satisfied. If |GM| > 0, the system is stable.
The Phase Margin(PM) is the amount by which the phase exceeds
The term crossover frequency, is often used to refer to the frequency at which the magnitude is unity, or 0 db.
GM and PM are clear both on Bode plot and Nyquist plot.
For any first- or second-order system.
Vector Margin is also introduced to remove the ambiguity.
The basic aim for state-space design is to determine the compensation.
State-Variable Form $$ \dot{\bold{x}} = \bold{Ax}+\bold{Bu}\ \bold{y} = \bold{Cx}+\bold{Du} $$ A is called system matrix, B is called input matrix, C is called output matrix, D is called direct transmission term.
For a SISO systme, u is a scalar, so is y.
sys = ss(A, B, C, D)
step(sys)
We can transform between ss description and tf description
[num den] = ss2tf(A,B,C,D)
[z p k] = ss2zp(A,B,C,D)
[z p k] = tf2zp(num, den)
First thing we want to know to is how to transfer from transfer function to a state space. For a transfer function, the state space is not unique, there are several basic forms for choosing state variables, which are called canonical forms.
For a transfer funciton $$ G(s) = \frac{b(s)}{a(s)} = \frac{b_1s^{n-1}+b_2s^{n-2}+\cdots+b_n}{s^n+a_1s^{n-1}+\cdots+a_n} $$ We have https://en.wikibooks.org/wiki/Control_Systems/Standard_Forms
A natural idea is: whether a state-variable form can be transformed to one of the above canonical forms?
For controller canonical form, we can explictyly give the transformation matrix if the controllability matrix $$ C = [B\quad AB\quad \cdots \quad A^{n-1}B] $$ is nonsingular. We call this state-variable form Controllable.
Once a state-space is chosen, you cannot change its controllablity using nonsingluar linear transformation.
For modal form, we see it's equvalent to the diagonalizablity of A.
For observer canonical form, we can transform to it if observability matrix $$ \mathcal{C} = \begin{pmatrix} C \ CA \ \vdots \ CA^{n-1} \end{pmatrix} $$ is nonsingular(or full rank for column )
We apply Laplace transformaition to the state-variable form $$ G(s) = C(sI-A)^{-1}B+D $$ What we are intererted is the state-variable form of zeors and poles.
If
If
We finally get $$ \begin{pmatrix} z_iI-A & -B \ C & D \end{pmatrix} \begin{pmatrix} x_0 \ u_0 \end{pmatrix} = 0 $$
This is the basic structure of a feedback control system.
Assume we've got enough sensors that we know
Then we can caculate the poles of system using $$ \det(sI - (A-BK)) = 0 $$ since we have n free parameteres in K, we can shift poles to where I want with large freedom. Two ways can be used to determine K under a given set of poles. One is transform the state-space to control canonical forms, the other is Ackerman method. $$ K = [0 \cdots 0 \quad1]C^{-1}\alpha_c(A) \ \alpha_c(A) = A^n+p_1A^{n-1}+\cdots+p_nI \ C = [B \quad AB \cdots A^{n-1}B] $$ For a proof, see https://en.wikipedia.org/wiki/Ackermann%27s_formula
When system is not controllable, we can not shift its poles at will. Uncontrollable systems have certain modes, or subsystems, that are unaffected by the control. This usually means that parts of the system are physically disconnected from the input(Like there is a zero in B). No mathematical test can replace the control engineer’s understanding of the physical system. Often the physical situation is such that every mode is controllable to some degree, and, while the mathematical tests indicate the system is controllable, certain modes are so weakly controllable that designs to control them are virtually useless. The system has to work harder and harder to achieve control as controllability slips away and thus drive the actuators into saturation. To move the poles a long way requires large gains.
Recall that a reference point is the value we want y to track. In steady state, we want
$$
\vec{x} = \vec{x}{ss} \quad \vec{\dot{x}} = 0\
y = y{ss} = r_{ss} \
u = u_{ss} \
$$
Suppose that $\vec{x}{ss} = N_xr{ss}, u_{ss} = N_ur_{ss}$, plug these in our plant, we get
$$
\begin{pmatrix}
A & B\
C & D
\end{pmatrix}
\begin{pmatrix}
N_x\
N_u
\end{pmatrix} =\begin{pmatrix}
0\
1
\end{pmatrix}
$$
It's natural for us to set $u = u_{ss} - K(\vec{x}-\vec{x}{ss})$
$$
u = -K\vec{x}+(N_u+KN{x})r
$$
That is (
or ,which is more rubust sometimes.
By now, we have established our control law, if we caculate the zeros of the system $$ \vec{\dot{x}} = (A-BK)\vec{x}+\bar{N}u $$ we find its exactly the same as the initial system, that is :
==When full-state feedback is used , the zeros remain unchanged by the feedback.==
One problem wasn't solved is where we should place our poles. There are two ways to decide poles, one is to choose a pair of dominant poles to mimic the second-order system, the other is based on LQR.
For a typical system, we define the tracking error z and loss
Estimator is used when not all variables in state space is used for feedback. What we want is to reconstruct the system using part of the observed variable. Namely, get real
If we construct a model with the same dynamics with process, than we can well expect the output
We define error
We can connect the full state feedback with this to check whether our estimate works.
Roughly speaking, observability refers to our ability to deduce information about all the modes of the system by monitoring only the sensed outputs. Unobservability results when some mode or subsystem is disconnected physically from the output and therefore no longer appears in the measurements.
We have Ackerman formula for observablity $$ L = \alpha_e(A)\mathcal{C}^{-1}\begin{pmatrix} 0 \ 0 \ \vdots \ 1 \end{pmatrix} $$
If we've got some good sensors to measure some of the state variables, then not all of them need estimating. The reduced-order estimator reduces the order of the estimator by the number (1 in this text) of sensed outputs. The key point in mechanism of reduced-order is to see terms containing measured variables as some kind of input and measurement and use the same techs as full-order estimator.
There are always two kinds of noise existing in control: process noise
Just like what we did in LQR method, we introduce q as the ratio of