Example H8.5

MATLAB code for example 8.5 from the book "Regeltechniek voor het HBO"

Design of a controller in the frequency domain

Copyright (c) 2022, Studieboeken Specialist Permission is granted to copy, modify and redistribute this file, provided that this header message is retained.
Table of Contents

Given situation

Figure 8.30 shows a third order process controlled by .
In the second and third plot from above in figure 8.31 the Bode plots of the process are shown. In these plots we see the gain and phase shift of the process as a function of the frequency f in Hz on a log scale:
and .

Bode plot of PI- anf PD- controllers

In the top and bottom plot of figure 8.31 are shown already the Bode plots of two controllers we will use in this example (in these controllers a and b are the so called tame factors):
a tamed PI-controller ,
and a tamed PD-controller .

Bode plot PI Controller

In the top of figure 8.31 to the left, the gain of only the I-action of the tamed PI-controller is displayed (so ):
.
In the bottom to the left the phase is displayed:
.
So we see, that in this tamed PI-action the gain for small frequencies is limited to +20 dB (in a pure I-action this would be the impractical value infinite) and at increasing frequencies the phase shift does not remain (as in a pure I-action), but it goes back to zero.

Bode plot PD Controller

In the top of figure 8.31 to the right the gain of only the D-action of this tamed PD-controller is displayed (): .
In the bottom to the right the phase is displayed: .
So we see, that In this PD-action the gain is limited to dB for big frequencies (in a pure D-action this would be the impractical value infinite) and the phase shift is not constant , but less and only for a limited part of the frequencies.

Note on omega and f

Note aside: In the frequency domain it is usual to note ω as independent variable instead of f. We prefer to do that here too, and if necessery we switch to .
For a fast response we need a system with a broad bandwidth. To understand this just look at a system with certain time constants. The biggest one (let's say ) determines in the s-domain the pole () closest to the imaginary axis, and thus the slowest transient (see figure 3.11). The biggest also determines the smallest break frequency in the Bode plots (and thus the bandwidth of the low pass filter as we call this process in electronics). So for a fast response we want a relative small , which means a broad bandwidth (and in the s-plane a big distance to the imaginary axis). Beside that, we have to pay attention to the stability in the frequency domain by using the phase margin criterion FM and gain margin criterionVM. The exact relationship between characteristics in the frequency domain and the time domain (as we saw between s- domain and t-domain for overshoot, peak time, ) is hard to give, except for stability.
Suppose in the frequency domain we want a and a . Moreover we want an (if possible, because normally this requires a big gain of the controller and that often means a risk for the stability, overshoot, etc.).
Based on these requirements, the following control actions are designed for the process in figure 8.30:

Determine gain of the P-controller

P-action: .
1) Phase margin :
For the requirement: we have to look in the Bode plot of the process (plus P-action, but that phase shift is zero for positive ) where the phase shift That is the case at 1.2 Hz (third plot from above in figure 8.31) and for that frequency we see in the second plot from above: dB. The phase margin criterion says, the maximum gain allowed for that frequency is 1 ( dB, because ), so the gain of the P-action must be dB, which means .
2) Gain margin 2:
For the requirement: we have to look in the Bode plot of the process (plus P-action) where the phase shift As you can see in the third plot from above in figure 8.31 that is the case at 3.5 Hz, and for that frequency we see in the second plot from above: dB. Our gain margin criterion of 2 says, the maximum allowed gain for that frequency is ( dB), so the maximum allowed gain of the P-action is dB, which means .
So the criterion for the phase margin is decisive: .
The static error for equals:
.
The desired value we don't achieve.

Determine parameters of PD-controller

Tamed PD-action:
.
In this controller we won't choose the tame factor a too big. This means that the D-action does not react too strongly to changes, then for an increasing value of a the nominator is going to overrule the denominator and the D-action becomes more and more a pure D-action. That means we get a very strong reaction on changes, which we don't like in most of the practical situations. Especially the wear in mechanical systeems will be to big in that case.
As you can see in the upper plot to the right of figure 8.31 for big frequencies:
.
For the phase shift is:
.
For and this equals zero and in between there is lead and somewhere a maximum, depending on the value of . It can be proved that for this maximum is at 3.5 Hz (if you don't believe, just simulate it in MATLAB).
Now the value of hase to be determined ( and ).
1) Phase margin :
For the requirement: we have to look in the Bode plot of process plus D-action where the phase shift . In the bottom two plots of and in figure 8.31 we can see this is the case for Hz: of the process and of the PD-controller. In the top two plots of figure 8.31 for Hz we can see the total gain of the process () plus controller () is dB. The phase margin criterium says, the maximum gain allowed for that frequency is 1 ( dB), so the maximum gain of the P-action allowed to be is dB .
Note aside: consecutive gains in dBs can simply be added up; this is much easier than consecutive amplification factors which would have to be multiplied with each other. This is a big advantage of calculating with dBs.
2) Gain margin 2:
For the requirement: we have to look in the Bode plot of the process and D-action where the total phase shift As you can see in the two bottom plots in figure 8.31 this is the case at 6.5 Hz ( and ). In the second plot from the top in figure 8.31 we see that the gain of the process for that frequency is dB and in the top plot we see that the gain for that frequency of 6.5 Hz is dB. So the total gain is dB. The gain margin criterion says, the maximum permitted gain for that frequency is ( dB), so the permitted gain of the P-action of the PD-controller is 0 dB: .
Of course the smaller of the two values of is decisive: .
For the static behaviour of the system for we get:
.
So %, and the required 1 % is again not achieved.

Determine parameters of PI-controller

Tamed PI-action: .
The goal usually is achieved by adding an I-action to the controller, because then a factor (or ) is added to the controller (see the Laplace-rules: integrating in the time domain means multiplying with in the s-domain). For static behaviour of the controller (so we then substitute ) this means a gain of of the controller, and the gain of the total system in figure 8.30 becomes:
%,
so ! This would be the case for a PI-controller with pure I-action.
In this example we demand a maximum value of , so it must be possible to have a static gain of the controller less than the unpractical value . That's why we use the tamed PI-action as shown before: takes care of the proportial action and for the tamed I-action. In the top and to the left of figure 8.31 we see for small frequencies that the gain is dB, so dB. .
In order not to suffer from additional phase lag of the I-action ( in a pure case) at the frequency where the FM-criterion is applied, is choosen such that the phase shift of the I-action is already over at the frequency where the process has a phase shift of . In figure 8.31 in the second plot from the bottom this is the case at 1.2 Hz, which means: rad/s.
The phase lag of the PI-action for equals:
.
For and this equals zero and in between the phase shift is negative (because of the factor 10) and there are two breakpoints ( and ). In the break point the shift is . If we want no phase shift anymore of the I-action at the point where the process has already a phase shift of ( rad/s), then should not equal rad/s but much less, let's say a factor 10 smaller: or . With these values for b and the ransfer function of the tamed PI-controller becomes:
.
For finally we must require that:
,
, but we have to investigate wether the FM and VM are still met (turns out to be not quite the case):
1) Phase margin :
For the requirement: we have to look in the Bode plot of process plus I-action where the phase shift . From the two bottom plots of and in figure 8.31 we can see this is the case for Hz: of the process and (almost) zero of the PI-controller. From the two top plots of figure 8.31 we can see the total gain of process () and controller () in Hz equals: dB. The phase margin criterion says, the maximum gain allowed for that frequency is 1 ( dB), so the maximum gain of the P-action allowed to be is dB .
2) Gain margin 2:
For the requirement: we have to look in the Bode plot of the process plus I-action where the total phase shift As you can see in the two bottom plots in figure 8.31 this is the case at 3.5 Hz, because and (to the left in the bottom plot). In figure 8.31 we see in the second plot from the top that the gain of the process for that frequency is dB and in the top plot to the left that . So the total gain at 3.5 Hz is: dB. Our gain margin criterion says, the maximum permitted gain for that frequency is ( dB), so the permitted gain of the P-action of the PI-controller is dB .
Of course the smaller of the two values of is decisive: .
For the static behaviour of the system for we get: %.
So %, and the required goal of 1 % is not yet reached. May be there is a better value for b and/or . Instead of starting the calculations by hand again it is much easier to let the computer do that, but not randomly of course. With the knowledge gained in this example we can point him in the right direction.

Determine parameters of PID-controller

PID-controller: .
For the benefits of both PI- and PD-controller they must be combined to a PID-controller. We will determine the maximum value of for the FM and VM criterion with seconds, and seconds.
1) Phase margin :
For the requirement: we have to look in the Bode plots of process plus I-action plus D-action where the phase shift . From the two bottom plots of , and in figure 8.31 we see this is the case for Hz: of the process, zero of the PI-controller and of the PD-controller. From the two top plots in figure 8.31 we can see the total gain of the process (), PI-controller () an PD-controller () in Hz is dB. The phase margin criterion says, the maximum gain allowed for that frequency is 1 ( dB), so the maximum gain of the P-action allowed to be is 2 dB .
2) Gain margin 2:
For the requirement: we have to look in the Bode plot of the process, I-action and D-action where the total phase shift As you can see in the two bottom plots in figure 8.31 this is the case at 6.5 Hz, because , and . In figure 8.31 we see in the two top plots for Hz: dB. Our gain margin criterion of 2 says, the maximum permitted gain for that frequency is ( dB), so the permitted gain of the P-action of the PID-controller is:
0 dB .
Of course the smaller of the two values of is decisive: .
The static error for is:
and thus !
As said before, what a step response looks like in this case remains to be investigated.