0% found this document useful (0 votes)
43 views19 pages

Simulink Assignment

The document discusses the capabilities of the Simulink toolbox integrated with MATLAB, emphasizing its use for modeling, simulation, and analysis of control systems. It outlines the advantages of MATLAB and Simulink, including graphical modeling and the ability to simulate dynamic systems, and presents exercises demonstrating the comparison of Transfer Function and State Space models for a Van de Vusse reactor. The report concludes with insights into the use of PID controllers and the potential for further exercises using Simulink.

Uploaded by

scribd100225
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views19 pages

Simulink Assignment

The document discusses the capabilities of the Simulink toolbox integrated with MATLAB, emphasizing its use for modeling, simulation, and analysis of control systems. It outlines the advantages of MATLAB and Simulink, including graphical modeling and the ability to simulate dynamic systems, and presents exercises demonstrating the comparison of Transfer Function and State Space models for a Van de Vusse reactor. The report concludes with insights into the use of PID controllers and the potential for further exercises using Simulink.

Uploaded by

scribd100225
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

Division of Electronic Engineering and Physics

Simulink
An exercise to demonstrate the capabilities of the toolbox

Sandeep S Bappoo

040004915

Date: 21/11/2007 EG40004 Control and Dynamical Systems


Table of Contents
Abstract
Introduction
One of the major tools, popular with Control Engineers is MATLAB. MATLAB is
essentially a high performance programming language for technical computing. The
software environment integrates computation, visualization and programming where
problems and their solutions are expressed in mathematical notation or visually. Typical
functions are matrix manipulation, function plotting, implementation of algorithms,
creation of user interfaces etc. it is also possible to interface with other programming
languages such as C/C++. The main advantage of MATLAB lies in its easy programming,
visual concepts and user friendly layout. It is thus an essential tool for control engineering
and in many other fields. MATLAB short for “MATrix LABoratory was invented in the
late 1970s by Cleve Moler. The software was rewritten using the C language and The
Mathworks, Inc was founded in 1984 by Moler, Bangert and Little, to continue
MATLAB’s development.
The MATLAB language is commonly known as M-code or simply M. the main
feature of the MATLAB interface is the Command Window. M-code is usually ‘written’
using the MATLAB editor and executed through the command window.
Simulink is an accessory or toolbox integrated with MATLAB. It is a very useful
tool as it allows the modelling, simulation and analysis of systems graphically without the
need for simulation code. Simulink makes use of customizable ‘block’ libraries which
facilitates modelling. The toolbox also provides the ability to run model scripts via
MATLAB and also drive MATLAB within its own parameters.
Simulink has two main operation parameters: model definition and model analysis.
First a model is defined i.e. a control system. The model is then analysed. Once a model is
defined, we can analyze it by either choosing the options from the Simulink menus or by
entering commands into MATLAB’s command window. The progress of a simulation can
be viewed while the simulation is running, and the final results can be made available in
MATLAB workspace once the simulation is complete. The Graphical User Interface, block
diagrams, modelling, simulation and further capabilities make Simulink an essential
toolbox for the control engineer amongst others.

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.

1a) Transfer Function

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

1b) State Space


We create the State Space model for the given Van de Vusse reactor by replacing the
Transfer Function block with a State Space block.
This is shown in Figure 7.
The State Space parameters (matrices) can be entered in the MATLAB command
window and are given as follows:

A= B=

C = (0 1) D = (0 0)

These parameters can be inputted directly to the Simulink State-Space block. To


show the ability for MATLAB to interact with each other, we specify these parameters as
A, B, C and D as shown in Figure 8.

Figure 7
These parameters are entered in the MATLAB command window shown in Figure
9.

Here we have a problem with the simulation shown in Figure 10:


Figure 8

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

g=0:0.1:10; % Define Time


[A,B,C,D]=linmod('s');
% Linmod extracts linear
state-space model of a
system
[numc1,denc1]=ss2tf(A,B,C,D)
;
step(numc1,denc1,g);
% Plot Graph
The code did not work in this case although I think it is a simple name conflict
issue but it illustrates further capabilities of the toolbox.

2) Default PID vs. “Real PID”


First we consider the closed loop Simulink diagram for the Van de Vusse reactor
shown in Figure 10.

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

We define the Kc and tau parameters in the MATLAB command window as Kc =


1.89, taui = 1.23, taud = 0 and alpha = 0, we obtain the plot shown in Figure 12 which is
same as the default PID controller as shown in Figure 13:
Figure 13

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.

We can see that as taud increases the oscillation also increases.


Exercise 2: A Simulink model to solve an Equation

The aim of this exercise is


Conclusion
References

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.

You might also like