Simulink Assignment
Simulink Assignment
Simulink
An exercise to demonstrate the capabilities of the toolbox
Sandeep S Bappoo
040004915
Aims
The main aim of this report is to illustrate the features and capabilities of the
Simulink toolbox. This will be achieved by working through two Simulink tutorial
exercises provided.
Theory: MATLAB and Simulink Toolboxes
Together MATLAB and Simulink allow engineers and other users to effectively
design an embedded control system and accurately predict its performance, by allowing
them to understand the behaviour of the entire system in which the control system will
reside. The graphical, block-diagram parameters of The MathWorks environment lets you
drag-and-drop predefined modelling elements, connect them together, and create models of
dynamic systems. These dynamic systems can be continuous-time, multi-rate discrete-time,
or virtually any combination of the three. You can create custom model elements or reuse
legacy code-based models by incorporating C, FORTRAN, or Ada code directly into the
modelling environment. (5)
The modelling environment is organised hierarchically which means most
important blocks come first and is also self-documenting. System structure and function
can be clearly shown by grouping model elements in virtually any combination. Simulink
is also capable to graphically model event-driven systems using state charts, truth tables,
and flow diagrams. Specialized capability for mechanical and electrical power systems
allows models of these systems to be constructed using modelling elements that correspond
directly to the structure of the physical system, avoiding the need to express them as
mathematical equations. If prototype or actual physical systems are available and
input/output data can be acquired from them, mathematical models can also be created
using system identification techniques. (5)
As soon as a hierarchical element of the model is constructed, that element can be
simulated. Simulation allows specification, requirements, and modelling errors to be found
immediately, rather than waiting until later in the design effort. As the model becomes
larger, through the addition of hierarchical elements or by increasing the complexity of
existing ones, the designer can continue to find and correct errors during simulation by
using the model coverage, performance profiling, and interactive debugging features.
When the physical system model is specified to the required level of detail and simulation
has shown the model to be accurate, the control system can be designed. (5)
Figure 1 illustrates theoretical features and capabilities of Simulink.
Figure 1
Procedure and Results
Exercise 1: Van de Vusse Reactor
Van de Vusse Reactions are a series of chemical reactions which can be described
by Van de Vusse Kinematics equations. These reactions provide differential equations
which can be used to simulate transfer functions of a theoretical Van de Vusse reactor.
Our aim in this exercise is to compare step responses of the Transfer Function and
State Space models, using Simulink for a given reactor. We aim to show that these two
models provide identical step responses. This is to illustrate the versatility of the Simulink
toolbox.
We create the Transfer Function model for the given Van de Vusse reactor.
This is shown below in Figure 2.
Figure 2
We add the scope ‘sink’ block to the simulation to readily view the output which is
shown in
Figure 3
To perform a linear analysis we need to introduce input and output points as shown
in Figure 4.
Figure 4
We then use the Control and Estimation Tools manager (shown in Figure 5) to
perform a linear analysis. This interacts with MATLAB as it is MATLAB which performs
the analysis.
To perform the linear analysis we first specify the transfer function states and
inputs and outputs. The Control and Estimation tool sends the model to the MATLAB
workspace and the model is analysed and displayed using the LTI viewer, which quick
plots the linear result. This is shown in Figure 6. In our case this method does not seem to
be successful. This seems to be because MATLAB is reading the maximum step input as
being 0.2 with which has a conflict with. We couldn’t resolve this conflict but felt that this
feature of the toolbox should be demonstrated.
Figure 5
Figure 6
A= B=
C = (0 1) D = (0 0)
Figure 7
These parameters are entered in the MATLAB command window shown in Figure
9.
We thus start the State-Space model from scratch and discover that the State-Space
block requires two step inputs to form the 2x2. Please see reference (8). This is shown in
Figure 11.
The resultant is shown in Figure 12 and is identical to the Transfer Function Model.
Figure 9
Another method of using Simulink together with MATLAB can be applied to the
State-Space model. In this case we can write some simple M code to view the resultant step
function in MATLAB by sending the output to the workspace using. This would give us
added functionality and easier modifications, i.e. annotating and labelling the output as
well as manipulating the output for use in other forms.
CODE:
%House Keeping
clc, home
Figure 10
This shows the default PID controller provided by Simulink where we can change
the P, I and D values as .
Thus P = ; I = ;D=
Assuming the following parameters: =1.89 ; =1.23.
We obtain the following at the output (Figure 11).
Figure 11
We now replace the default PID controller with a “real” PID controller as shown in
Figure 12.
Figure 12
The main advantage in using the “real” PID controller is that the parameters such as
taud and alpha allow a more ‘Real’ simulation gain.
This is illustrated in Figure 14 where Kc = 1.89, taui = 1.23, taud = 1.5 and alpha =
0.5.
1. http://en.wikipedia.org/wiki/Simulink
2. http://ece.wpi.edu/courses/es3011/sim/simulink.html
3. http://www.mathworks.com/products/simulink/
4. http://www.aut.bme.hu/Portal/Default/DocDownload.aspx?DocId=1e518838-546a-4bca-
8fe9-b513f76dc31a&CultureId=16df90ec-fcf2-466d-8f3e-8c4057561621
5. http://www.mathworks.com/applications/controldesign/description/modsim.html
6. http://safari.oreilly.com/0133536408/art03lev1sec4
7. http://www.owlnet.rice.edu/~mech343/simulink.pdf
8.