Beruflich Dokumente
Kultur Dokumente
Evaluation of
Matlab/Simulink
Functionality for Control
Systems Design
EEE4013F – Control Systems
Jeanne Fourie
FRXJEA004
4/4/2011
2
Contents
1. Introduction .................................................................................................................................... 3
2. Matlab and Simulink Defined.......................................................................................................... 3
2.1 Matlab ........................................................................................................................................... 3
Figure 1: Typical Matlab screen ...................................................................................................... 4
2.2 Simulink ......................................................................................................................................... 4
3. Matlab/Simulink in Control System Design .................................................................................... 4
Figure 2: Control System ................................................................................................................. 4
4. Model Analysis ................................................................................................................................ 5
4.1 Laplace Transforms ....................................................................................................................... 5
Figure 3: Matlab code for Laplace Transformation ........................................................................ 6
Figure 4: Command window display for Laplace Transformation .................................................. 6
4.2 Linear Time-Invariant Systems ...................................................................................................... 7
Figure 5: Matlab code for LTI .......................................................................................................... 7
Figure 6: Command window display for LTI .................................................................................... 8
4.4 Root Locus Plots ............................................................................................................................ 9
Figure 7: Root Locus Plot ................................................................................................................ 9
5. Control Configuration Selection.................................................................................................... 10
5.1 SISO Tool ..................................................................................................................................... 10
Figure 8: SISO tool ......................................................................................................................... 10
5.2 Model Analysis and Controller Design Tools .............................................................................. 11
Table 1: Selected Model Analysis and Controller Design Tools .................................................... 11
6. System Simulation and Evaluation ................................................................................................ 11
6.1 Time and Frequency Response ................................................................................................... 11
Table 2: Matlab Response Plot Commands .................................................................................. 11
Figure 9: Step Response of Transfer Function .............................................................................. 12
Figure 10: Bode Plot of Transfer Function .................................................................................... 12
6.2 Simulink ....................................................................................................................................... 13
Figure 11: Block Diagram of Closed Loop Control System ............................................................ 13
Figure 12: Simulink-Created Block Diagram for Water Tank System ............................................ 13
7. Case Study ..................................................................................................................................... 14
7.1 Problem description .................................................................................................................... 14
7.2 Nominal Model ........................................................................................................................... 14
Table 3: Model States, Inputs and Outputs .................................................................................. 14
3
1. Introduction
Control engineering is a highly relevant field in many areas of technological advancement today. The
optimization of dynamic systems through control can lead to more efficient, less expensive, more
environmentally friendly and ultimately better behaved systems. Control theory can be applied to
systems ranging from kitchen appliances to military aircraft.
Designing the necessary control systems, however, can become complex. Luckily, there are many
tools available to simplify and improve the control system design process. One such tool is the
computational programme, Matlab and its simulation tool, Simulink.
This report will briefly describe and thus evaluate both Matlab and Simulink for control system
design purposes.
1
Antonios Andreatos and Anastasios Zagorianos, Matlab GUI Application for Teaching Control Systems, p. 1.
2
Stefan Steinhaus, Comparison of mathematical programs for data analysis, pp. 1-37.
4
2.2 Simulink
Simulink is an integrated Matlab tool that allows dynamic system modeling. It builds on the basis
provided by Matlab’s matrix manipulation structures to present functions specifically suited to
control system design. The Simulink Control System Toolbox, as such, utilises various prewritten
algorithms in the form of m files (Matlab script files) to allow its user to implement standard control
procedures3.
3
The Math Works Inc. Control System Toolbox User's Guide, p. 2.
4
Rao V. Dukkipati, Analysis and Design of Control Systems using MATLAB, p. 1.
5
The general control system design procedure follows the subsequent simplified steps5:
1. Understand the behaviour of the system in question and the control objectives
2. Model the system and simplify this model
3. Analyse the model
4. Select the appropriate control configuration
5. Design the necessary controller
6. Simulate and evaluate the controlled system
7. Implement and evaluate the controlled system
The steps mentioned above in blue can be accomplished using Matlab/Simulink as tools. Some of
these tools and features will be discussed in subsequent sections. The features described below
should not be regarded as an exhaustive representation of Matlab and Simulink’s capabilities in
control system design.
4. Model Analysis
There are three types of models that are important in control system design6:
As this report focuses on Matlab/Simulink functionality is control system design it will not elaborate
in detail on Matlab’s value in dynamic system modeling in general. It suffices to say that Matlab,
with its wide range of computational, mathematical and data handling functions is an ideal tool in
the analysis of system models. This section will deal with the development and analysis of the
nominal model.
In terms of control model analysis, Matlab presents many useful features. Some of these features
will be described below.
5
Dang Doan, Control System Design Steps, p.1.
6
M.S. Tsoeu, M. S. LECTURE NOTES: EEE4013F - Control Systems, pp. 12- 13.
6
Although one is not necessarily required to evaluate integrals to perform the transformation –
extensive lookup tables are available – calculating Laplace transformations is tedious nonetheless.
The following code in Figure 3 is an example of the Laplace transform feature. It computes the
Laplace transform of 𝐹 = 3.5𝑡𝑒 −2𝑡 + 1.25𝑒 −2𝑡 , simplifies it and then uses the novel pretty
function to display it as a fraction. Figure 4 shows the answers returned in the command window.
7
MathWorks, Symbolic Math Toolbox: laplace
7
Matlab presents many ways of dealing with LTI’s8. Firstly, it features various ways of setting up the
system equation in question. SYS = tf(num,den) returns a transfer function, SYS =
zpk(z,p,k) a zero/pole/gain system, SYS = ss(a,b,c,d)a state space setup and SYS =
frd(response, frequencies)returns frequency response data.
The following code in Figure 6 illustrates the transfer function and zero/pole/gain features by
employing an example system,
𝑠+2
𝑠2 + 2𝑠 − 3
8
The Math Works Inc. Control System Toolbox User's Guide, p. 1.3.
8
An alternative method for finding the zero/pole/gain output is to use the command [z, p, k] =
tf2zp(num,den)which returns z = zeros, p = poles and k = gain in the command
window9.
If one wishes to split the system into partial fractions for analysis purposes, the command [r,p,k]
= residue(num,den) can be used to return r, p and k in the following formula10:
Multiple Input, Multiple Output (MIMO) systems can be created similarly as well as LTI arrays for
simple manipulation of a set of models. The command set(SYS) returns an assortment of
information about a system, such as its name, sample time, etc.11
9
Rao V. Dukkipati, Analysis and Design of Control Systems using MATLAB, p. 76.
10
Rao V. Dukkipati, Analysis and Design of Control Systems using MATLAB, p. 75.
11
The Math Works Inc. Control System Toolbox User's Guide, p. 1.5 -1.6.
9
Using the command rlocus(SYS), where SYS refers to the following transfer function:
s+7
---------
s^2 + 5 s
The Root Locus Design GUI can be accessed by typing rltool in the command window. This
graphic user interface allows control system design using root loci12.
12
The Math Works Inc. Control System Toolbox User's Guide, p. 1.23.
10
13
The Math Works Inc. Control System Toolbox User's Guide, p. 1.14.
12
The following figures illustrate some of the commands in table 1 above. (Note: the transfer function
defined as TF in Figure 6 of Section 4.2 is the system plotted in Figures 9 and 10)
6.2 Simulink
Simulink offers various tools for representing and dealing with control systems. Systems can be
represented using block diagrams. Figure 11 is an example of a block diagram representing a closed
loop system.
Block diagrams such as these can be constructed using Simulink and hence their properties can be
evaluated. In order to access the Simulink tool, type simulink in the command window. An
example of a block diagram created with Simulink created for a water tank system is shown in Figure
12.
LTI’s that have already been set up can be imported into Simulink blocks by typing ltiblock into
the command window.
14
Rao V. Dukkipati, Analysis and Design of Control Systems using MATLAB, p. 4.
14
7. Case Study
In order to illustrate Matlab/Simulink’s use in control system design this section considers a case
study. The control system in question is to be designed for an aircraft yaw damper15. See Appendix A
for Matlab code.
The state space model matrices are printed in the command window. (Run the code in Appendix A)
15
The Math Works Inc. Control System Toolbox User's Guide, pp. 9.3-9.19. This case study, including all models
and values, is extracted from this work. Code has been adapted slightly to suit the purposes of this report.
16
Aviation Glossary, Aviation Glossary: Dutch Roll.
15
Conclusions as to potential control approaches can be drawn by plotting the step and impulse
responses of the open loop system.
From Figures 15 it is apparent that the system is indeed lightly damped. As minimal oscillations are
to occur just after the impulse is applied it could be useful to look at the impulse response over a
smaller time frame. (Run the code in Appendix A for the graphs in Figure 15 over a 30 second period)
16
Yaw dampers are usually designed to feature the rudder as a control input and the yaw rate as a
sensed output. Plotting the Bode diagram for an input and output both equal to 1 provides the
following plot:
It is clear from Figure 17 that the system becomes unstable very quickly. The chosen subsystem used
negative feedback. Positive feedback would invert the root loci and stabilise the system. This
achieves a damping ratio of ζ = 0.45. Already this is closer to the objectives set for the controller.
17
One can thus define the closed loop system as the negative of the initially chosen system. Analysis of
the new closed loop system reveals that its impulse response (see Figure 18) is much more
satisfactory than the responses illustrated in Figure 15.
Although the control system still require much fine tuning and the control design process is not
terminated, this case study illustrates Matlab’s usefulness in control system design.
8. Evaluation
The above descriptions of features and tools, as well as the case study undertaken in Section 7,
reveal that Matlab/Simulink is a useful, user friendly computational tool with definite value in
control system design. Tasks necessary for control design but that are tedious or time consuming
when done manually can be carried out efficiently using the tools that Matlab/Simulink provides.
9. Conclusion
The descriptions and case study above lead to the conclusion that Matlab and Simulink are useful,
effective tools in control system design. Various stages of the design process can be dealt with
through Matlab. It is the designer’s choice whether to use Matlab and Simulink as basic tools in low
level design or to exploit Matlab at its full computational power.
17
Stefan Steinhaus, Comparison of mathematical programs for data analysis,pp. 34-37.
18
10. Bibliography
Andreatos, Antonios S, and Anastasios D Zagorianos. "Matlab GUI Application for Teaching Control
Systems." Hellenic Air Force Academy. www.wseas.us/e-
library/conferences/2009/rodos/EDU/EDU32.pdf (accessed March 20, 2011).
Bodemann, Christian D, and Filippo De Rose. "The Successful Development Program with Matlab
Simulink in the Framework of ESA's ATV Project." Vega Group. http://www.vega-
group.com/assets/documents/10000421matlabsimulink.pdf (accessed April 5, 2011).
Doan, Dang. "Control System Design Steps." Scribd. April 13, 2007.
http://www.scribd.com/doc/86108/Control-System-Design-Steps (accessed April 6, 2011).
Dukkipati, Rao V. Analysis and Design of Control Systems using MATLAB. New Delhi: New Age
International (P) Limited, 2006.
Moler, Cleve. "The Growth of Matlab and The Math Works Over Two Decades." Cleve's Corner.
January 2006.
http://www.mathworks.com/company/newsletters/news_notes/clevescorner/jan06.pdf (accessed
April 5, 2011).
Pal´ancz, B´ela, Zolt´an Beny´o, and Levente Kov´acs. "Product Review - Control Sysem Professional
Suite." Wolfram. IEEE Control Systems Magazine. April 2005.
library.wolfram.com/infocenter/articles/5629/csps_rev_ieeecsm0405.pdf (accessed April 4, 2011).
Princeton Satellite Systems. "Wind Turbine Control Toolbox for Matlab." Princeton Satellite Systems.
www.psatellite.com/wct/pdfs/techbrief.pdf - Similar (accessed March 20, 2011).
Steinhaus, Stefan. "Comparison of mathematical programs for data analysis." scientificweb. July 17,
2008. http://www.scientificweb.com/ncrunch/ncrunch5.pdf (accessed April 5, 2011).
The Math Works Inc. "Control System Toolbox User's Guide." MathWorks. 1999. http://www-
lar.deis.unibo.it/~lmarconi/files/control_tb.pdf (accessed March 17, 2011).
Tsoeu, M. S. LECTURE NOTES: EEE4013F - Control Systems. PDF. University of Cape Town.
19
Appendix A
%--------------------------------------------------------------------------
%EEE4013F Reading Assignment.
%This code is an example of the use of Matlab in control system design by
%means of a case study. the case study deals with a yaw damper design for
%an aircraft.
%7 April 2011
%--------------------------------------------------------------------------
%NOTE: As this code plots various functions, only the last function will
%plot. To aid process speed the previous plots are commented out.
%Uncomment plots as necessary.
%--------------------------------------------------------------------------
clc
clear
%Setup aircraft model at MACH 0.8 and H = 40000ft
A = [-0.0558 -0.9968 0.0802 0.0415
0.5980 -0.1150 -0.0318 0
-3.0500 0.3880 -0.4650 0
0 0.0805 1.0000 0];
B = [ 0.0729 0.0000
-4.7500 0.00775
1.5300 0.1430
0 0];
C = [0 1 0 0
0 0 0 1];
D = [0 0
0 0];
%Define and specify state space model
states = {'beta' 'yaw' 'roll' 'phi'};
inputs = {'rudder' 'aileron'};
outputs = {'yaw' 'bank angle'};
sys = ss(A,B,C,D,'statename',states,...
'inputname',inputs,...
'outputname',outputs);
%Display space state model details
sys
%Display open loop eiegenvalues(poles) and plot in s-plane
damp(sys)
%pzmap(sys)
%Plot the open loop impulse response over 30 seconds
%impulse(sys,30)
%Plot Bode diagram
%bode(sys(1,1))
%Define subsystem from rudder to yaw rate
sys11 = sys(1,1);
%Plot subsystem's root loci
%rlocus(sys11)
%Positive feedback poles
[k,poles] = rlocfind(-sys11);
damp(poles)
%Define closed loop system
cl11 = feedback(sys11,-k);
%Display closed loop eigenvalues
damp(cl11)
%Plot closed loop impulse response
impulse(cl11)
%--------------------------------------------------------------------------
%End of code