Frtool - The User's Guide: Frequency Response Controller Design Tool
Frtool - The User's Guide: Frequency Response Controller Design Tool
1.1. Introduction
At this time, Matlab offers a controller design tool based on the root locus method
(rltool). This tool cannot handle systems with time-delay without approximating the
dead-time by a rational transfer function. To solve this problem, we choose to work with
frequency diagrams (Nichols diagrams), where we know that dead-time (τd) will have no
influence on the gain but it will just shift the phase with (-τd*ω).
We considered as important design specs the following ones: robustness, settling time,
maximum overshoot, gain and phase margins .
Given the maximum overshoot as design specification we can compute the damping
factor (ξ) using relation (1.1):
Straightforward we can obtain the peak value (Mr) of the closed-loop frequency-domain
magnitude (Bode) as defined in relation (1.2), which will be a curve on the Nichols plot
as shown in Figure 1.1. You can see that increasing the value of OS from 5% to 35% the
curves become less restrictive (they become smaller) .
To fulfil this specification, the Nichols curve of the open loop system has to be outside or
tangent to the correspondent Mr curve.
The second important design specification is the settling-time. Given the settling-time
and the maximum overshoot specs we can use relations (1.1) and (1.3) to obtain the
natural frequency (ωn) of the equivalent second order system and the damping factor.
Once we know the damping factor and the natural frequency, the value of the –3dB
bandwidth frequency for the closed-loop is obtained with relation (1.4). It will be used as
graphical restriction because frequency is the parameter along the Nichols curve.
Figure 1.2 shows how the bandwidth frequency is displayed on the Nichols plot.
You can see that along the Nichols curve there are multiple red circles corresponding to
the variation of (ωb). To fulfill the settling-time design specification, the circle
corresponding to the related value of (ωb) has to be above the green –3dB line and,
because the value of (ωb) was obtained using also the overshoot spec, the overshoot spec
has to be respected too .
Robustness design spec can be taken into account according to the following definition in
the Nyquist plot (see Figure 1.3). Robustness is the radius of the circle and it can have
values that respect the relation 0<Ro<1. Because we are using the Nichols plot for the
design process, we need to convert this robustness spec from Nyquist to Nichols. Given
the value of (Ro) we can compute the values of the real and imaginary part of the Ro
vector with relation (1.5) and (1.6), where ω is the angle of Ro vector measured as shown
in Figure 1.3 .
Once the real and imaginary parts of a complex number are known, its modulus and
phase can be computed using relations (1.7) and (1.8). As a result of this conversion on
the Nichols plot we will obtain the curves shown in Figure 1.4 corresponding to the
circles from Nyquist .
Robustness spec is fulfilled only when the Nichols curve of the open-loop system
remains outside the restriction curve .
Besides these 3 restrictions we also considered gain and phase margins, because these
two design specs are easy to read on the Nichols characteristics. The gain margin is the
vertical line that starts in the point having 0 dB gain and –180 degrees phase and goes
downward, while the phase margin restriction is the horizontal line starting in the same
point and going to the right side of the graphic. Figure 1.5 illustrates these explanations.
To fulfill these two specs the Nichols curve has to go on the right side of the phase
margin line and below the gain margin line, without crossing any of them .
With all design specs active and fulfilled the Nichols plot from the main window of the
tool should look like the one shown in Figure 1.6 .
1.3. GUI
The FRtool’s graphical user interface (GUI) is powerful, offering a set of useful features
that make this tool easy to use. It has the following windows:
- one in which the Nichols curve of current open loop and restrictions
are shown and which is used to set design specs, do file operations and
design a part of the controller (its gain); from now on we will call it
"main window";
- one in which the user can see step and impulse responses as well as
Bode or Nyquist characteristics, used for checking whether design specs
are fulfilled or not; this one will be called "responses window";
- one for placing controller poles and zeros; this will be called
"controller design window" because this is the window where the user
will “play” with controller's parameters;
- one in which the user can select the transfer functions for the F, P
and H blocks (see Figures 1.7, 1.8) in the control loop; we will call it
"system import window";
- one for importing a predefined/designed controller, in ZPK format,
named "controller import window";
- and one for setting up a design spec, called "constraint window".
1.3.1.Main window
The main window is used to set up the design tool and it is shown in Figure 1.6. As you
see, the window contains three menus (File, Tools and Help), zooming tool, axis for
plotting the open loop Nichols curve, button for loop configuration, system definition
frame, controller gain frame, Ngrid activation/deactivation checkbox, compensator editor
activation button, responses frame, constraints frame, and status frame .
In the following subchapters we will discuss the features available in this window .
1.3.1.1. FILE menu
This menu is used for file operations and it has the following options: import, export of
processes and controllers, Nichols plot/main window prints and, of course, application
exit .
The "Import" option of this menu can be called to get transfer functions from the Matlab
workspace. It has two submenus: one for importing a process and another one for
importing a controller, in both cases placed in the blocks from the control loop shown in
Figure 1.7 or Figure 1.8. In case that system import is requested the system import
window will be activated and in case of controller import request, the controller import
window will be shown (see Figures 1.12 and 1.13).
The "Export" option of the File menu allows user to save current loop configuration by
saving F, P and H transfer functions in Matlab workspace, in case that system export is
requested or by saving K transfer function, in case of controller export request. These
transfer functions can be found in the Matlab workspace with the following names: sysF,
sysP, sysH and sysK .
"Print Nichols" and "Print" options of the File menu will open the Matlab print preview
window. First option will print only the Nichols curve, while the second one will print
the main window as it is displayed .
"Exit" ends the application and closes all sub windows of FRTool .
1.3.1.2. Tools menu
The Tools menu has two submenus: the “Constraints” submenu that allows user to define
the design specs (robustness, overshoot, settling time, phase margin and gain margin) and
the “Simulation” submenu that allows user to define the final time for closed loop
simulations. FRTool will automatically determine a final time for simulation but in case
this value is not satisfactory, the user can define his own final time. For defining these
restrictions FRTool will display a constraint window as shown in Figure 1.11 .
1.3.1.3. Help menu
At this time, only general help and release information are available via the options of
this menu but home page navigation and other features will be added in a future version.
1.3.1.4. Nichols plot axes
Once the system and/or the controller are defined, the Nichols curve of the open loop
system is displayed in the main window, to guide the user in the design process. The
design specs (robustness, settling time, overshoot, gain margin and phase margin) will be
also displayed as graphical restrictions on the same plot (see Figure 1.6). Watching this
plot the designer can see the effect of changing controller parameters and can adjust
these parameters until he fulfils all design specs .
1.3.1.5. Loop configuration button
The button displays continuously the current loop configuration (see Figures 1.7 and 1.8)
and allows user to change the position of the controller from direct loop to feedback.
Placing the process in different blocks on the control loop and changing the loop
configuration, the user can obtain closed loop responses for setpoint and perturbances in
different points of the control loop.
1.3.1.6. System definition frame
The system contained in the P block of the control loop can be defined as well using the
system definition frame. In this case, only the numerator and denominator of the P
system will be affected and no dead-time systems can be defined. Once a system is
imported using the menu option (see import feature), these two textboxes will be
disabled and they will be re-enabled only when all the systems placed in F, P or H blocks
are erased .
1.3.1.7. Controller gain frame
This frame contains a textbox with the value of the gain, two buttons which allow
increasing and decreasing of the gain and a textbox for the step size (how much will be
added or subtracted to/from the current value of the gain, to obtain the new value).
Another way to change the controller’s gain is dragging the bandwidth frequency with
the mouse (only vertical movement is possible because this is the effect of changing the
gain of the open loop).
1.3.1.8. Ngrid and controller editor activation frame
Clicking on the Ngrid checkbox the user can show or hide the constant gain and phase
curves for the Nichols plot (the so-called Ngrid).
The "Edit compensator" button can be used to open or reopen the design window.
1.3.1.9. Responses frame
Using the checkboxes available in this frame, the user can select which responses or
characteristics have to be displayed. For instance, if step response is requested, the user
will click on the "Step" checkbox to activate this type of response. Multiple responses
and/or characteristics can be active at the same time and they will be displayed in the
same window: the “responses window”.
1.3.1.10. Constraints frame
This frame is similar with the “responses frame” but it is used to notify FRtool that a
certain design spec should be taken into account when drawing the graphical constraints.
If the value of that design spec is not already set, the constraint window will be
displayed to input the value of that design spec. Even if defined, a design spec can be
omitted if the corresponding checkbox is unchecked .
1.3.1.11. Status frame
This frame will be used by FRtool to communicate with the user. For example, if a gain
equal to zero will be set, FRtool will display a message to inform the user that he should
change the gain to another value because that one is not allowed .
1.3.2.Responses window
Simulations of closed loop responses and characteristics can be seen in the “responses
window” (see Figure 1.9). This window is shown/hidden automatically by FRtool as
follows: if no responses or characteristics are needed, the window will be hidden; once at
least one response is requested, it will be automatically shown.
All requested responses and characteristics will share the same window and will be
updated every time a change is made to the system or controller parameters.
Right clicking on a characteristic (plot), users can select features like grid on/off, peak
response, settling time, rising time or zoom.
The Print option in the File menu of the “responses window” will display the Matlab
print preview window to print all the responses currently displayed .
This is the second most important window of the frequency design tool (see Figure 1.10)
because it allows users to change the position of the controller poles and zeros and also
to add/remove new/existing poles and zeros. The limits of the axes will be adjusted in
correlation with the pole/zero placements and current limits will be changed using the
zooming tool available in this window, which works in the same way as the one available
in the main window.
Using drag & drop, the user can change the position of the poles and zeros and while
dragging the roots he can see the changes of the Nichols curve in real time. FRtool will
take care of complex conjugated poles, moving the conjugated pole in the appropriate
position. By releasing the mouse button the new position of the pole or zero will be set
and the responses window will be updated, too.
1.3.4.Other windows of FRTool
In most of the cases the easiest way to learn how to use software is to follow a short
demonstration. Therefore, we picked an application and we will try to give a demo of the
design procedure.
Task: considering that the plant has the transfer function given in relation 1.9, design a
phase-lead controller such that the unity feedback closed loop system will satisfy the
following specifications:
• maximum overshoot < 5 %
• settling time < 0.8 seconds
Supposing that FRtool is already installed and working properly on our system we define
the process in the Matlab workspace using relation 1.10 .
If FRtool is not started yet, it can be started with “frtool” command. Once the tool’s main
window is visible we can start using the tool by importing the transfer function of the
process. Clicking on “File/Import/System” menu the system import window will appear
with the “Sys” transfer function in the list. After clicking on the “Sys” name, on the
“àP” button and, finally, on the “Use” button the system is placed into the P block of
the control loop and in the main window is displayed the Nichols plot of the open loop.
At this time the open loop contains only the P transfer function (our system).
Next step is to define the design specs. Clicking on the “Ts” checkbox, constraint
window will be displayed to enter the value of the settling time spec, because it was not
defined yet. After entering this value we proceed with the overshoot design spec in the
same way. Afterwards, the main window of the tool will be the one shown in Figure
1.14.
From now on we have to pick the structure of the controller and design its parameters.
We have to design a phase-lead controller defined by relation 1.11 which leads us to
relation 1.12 .
To have the structure defined in relation 1.11 the controller’s pole and zero have to be
both pure real roots. Furthermore, to fulfill relation 1.12 we will choose the pole’s
location (-25) and the zero’s location (-2). To define them we have to go to the
controller design window and do the following actions: write –25 in the real part
textbox and then press “add pole” button, to define the pole and write –2 in the same
textbox and press “Add zero” button to define the zero. At this time the controller
design window will look like in Figure 1.15 and the main window will be similar to
Figure 1.16.
We don’t know yet the effect of changing the controller’s zero, pole and gain (note: the
static gain of the phase-lead compensator has not been shown explicitly in formula 1.11).
Now we shall test the effect of each one. First we will move the zero from (–2) to (–5)
and we shall try to see the effect on the Nichols curve. Figure 1.17 shows the new
position of the Nichols curve.
Figure 1.18 shows the effect of placing the zero in (-1). We can see that the Nichols
shape becomes more convex when he zero becomes more negative and that the Nichols
curve starts having a peak when the zero is less negative .
Next step is to see the effect of the pole’s position on the Nichols curve. Therefore, we
will first move the pole to (-60) and will obtain the Figure 1.19. The effect of placing the
pole at (-10) is shown in Figure 1.20.
At this time we know the effect of changing the zero and pole’s position and we also
know from theory the effect of the loop gain on the Nichols plot (illustrated in Figure
1.21 and 1.22): when increasing the gain (higher values than 1) the curve will be shifted
up, when decreasing the gain (values between 0 and 1) the Nichols curve will be shifted
down.
Playing a few minutes with the pole/zero placement and gain we can shape the Nichols
curve so that all design specs are fulfilled. The picture of the resulting Nichols curve is
shown in Figure 1.23. You can see that the curve does not cross the OS restriction and
that the bandwidth frequency is above the –3dB green line. This means that all design
specs are fulfilled and we can prove this by taking a look at the closed loop response of
the system (see Figure 1.24). The controller parameters resulting from this design
exercise are listed in Figure 1.23 and the values of overshoot and settling time obtained
are listed in Figure 1.24 .
1.5. FAQ
1.5.1.How can I tune controller parameters?
Controller parameters are gain, poles and zeros. The gain can be tuned using the
controller gain frame placed in the main window or by dragging the red circle
(bandwidth frequency) displayed on the Nichols curve .
The controller poles and zeros can be easily tuned using drag & drop features available in
the controller design window.
When selecting a restriction, FRtool checks first if there is a value defined for this
restriction. If no value is found, the "constraint window" is displayed, to force the user
to give a value to the restriction .
Another way is to select the “Tools/Specs” submenu options and insert the value in the
window that is displayed. In this case the checkbox that activates the restriction has to be
clicked, otherwise the spec is not displayed .
By simply opening the system import window from “File/Import/System” menu option
and clicking on Use, without selecting any system, the blocks from the control loop will
be set to empty .
In order to be able to import a system, the user has to define it as TF or ZPK. Only these
types of systems are displayed in the system import window's list .
In order to be able to import a controller, the user has to define it as ZPK. Only this type
of system is displayed in the controller import window's list .
1.5.6.How will I find my exported systems and controller?
1.5.7.Why, after I define the settling time, it is not displayed on the Nichols
curve?