regensburg, 24. – 28.7. 2006 introduction to simulink pavel karban university of west bohemia,...
TRANSCRIPT
Regensburg, 24. – 28.7. 2006
Introduction to Simulink
Pavel Karban
University of West Bohemia,Faculty of Electrical Engineering,
Department of Theory of Electrical Engineering
Part One
Regensburg, 24. – 28.7. 2006
Contents:
1. What is Simulink?2. Getting Started3. Dynamic System Definition4. Preparing Problem for Simulation5. Creation of Simuling Model – Standard Block Descripton6. Analyzing Results
Regensburg, 24. – 28.7. 2006
-intended to modeling, simulating, and analyzing of dynamical systems under GUI-linear and nonlinear analyses-hierarchical model
1. What is Simulink?1. What is Simulink?
Simulink (SIMUlation and LINK) is an extension of MATLAB by Mathworks Inc
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
Simple model – Sine wave and its integral
1.Start Simulinka)From Command Window: type simulinkb)From Main toolbar
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
2. Simulink Library Browser
3. Create new model (by new file icon)
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
4. Workspace for your model
5. Explore Library browser for become familiarized
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
6. Drag from Sources group block with name Sine Wave to workspace
7. Save your work to harddisk
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
8. Continue to build model by adding blocks to your model window.
From Sinks library: ScopeFrom Continuous library: IntegratorFrom Signal Routing library: Mux
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
8. Continue to build model by adding blocks to your model window.
From Sinks library: ScopeFrom Continuous library: IntegratorFrom Signal Routing library: Mux
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
9. Establish connection between the blocks
To make a connection: left-click while holding down the control key (on your keyboard) and drag from source port to a destination port.
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
10. Run the simulation
Double click on the Scope block to display of the scope.
Regensburg, 24. – 28.7. 2006
2. Getting Started2. Getting Started
NOTE:
From math: Primitive function to sine function is –cosine function
Real integrator:Definite integral of input variable (area under sine wave function between 0 and t)
0
( ) ( )dt
y t u t t
Regensburg, 24. – 28.7. 2006
33. . Dynamic System DefinitionDynamic System Definition
A dynamic system is in fact a way how to describe real objects and phenomena. It is possible to say, that the dynamic system is a set of variables and relations. Dynamic system can describe relations between variables and causality between variables as well. Variables describing an object or a phenomenon can be divided into to sets – parameters and state of system. State of system is such a set of variables the knowledge of which and the input function, with the equation describing the dynamics, will provide the future state and output of the system.
Regensburg, 24. – 28.7. 2006
33. . Dynamic System DefinitionDynamic System Definition
The state of a system is described by a set of first-order differential equations in terms of the state variables. This set of differential equations can be written in matrix form as follows:
In general the output of dynamic system can be related to the state variables and the input signal by the output equation
x Ax Bu
y Cx Du
Regensburg, 24. – 28.7. 2006
33. . Dynamic System DefinitionDynamic System Definition
The state of a system is described by a set of first-order differential equations in terms of the state variables. This set of differential equations can be written in matrix form as follows:
In general the output of dynamic system can be related to the state variables and the input signal by the output equation
x Ax Bu
y Cx Du
Regensburg, 24. – 28.7. 2006
3. Dynamic System Definition3. Dynamic System Definition
D
A
B CintegratorS Su yxx
.
x inner state vectoru input vectorx output vector
A matrix of dynamics of the systemB input matrixC output matrixD matrix of direct acting of input to output
x Ax Buy Cx Du
Regensburg, 24. – 28.7. 2006
44. . Preparing Problem for Simulation
Given circuit can be described by this equation:
Simulate electrical circuit
2 0LL
diR i L
dt
With initial condition:
0
1 2
(0)L
Ui
R R
TASK: Find time evolution of current iL
Regensburg, 24. – 28.7. 2006
44. . Preparing Problem for Simulation
After some rearrangement we will get:
2LL
di Ri
dt L
It is possible to rewrite previous equation in the "matrix" form
1 1x Ax
1y Cx
30
1 2
(0) 5 10U
xR R
1 Lx i 52 10R
AL
1C where
Initial condition (integrator):
Regensburg, 24. – 28.7. 2006
55. . Creation of Simuling Model
Block diagram of simple dynamic system
Simulink model of simple dynamic system
Scope
1s
Integrator
-1e3/10e-3
Gain
Regensburg, 24. – 28.7. 2006
55. . Creation of Simuling Model
Setting up Initial condition (double click on Integrator block)
Regensburg, 24. – 28.7. 2006
55. . Creation of Simuling Model
Setting up simulation preferences (menu item Simulation > Configuration Parameters …)
Regensburg, 24. – 28.7. 2006
66. . Analyzing Results
Time evolution of current iL (double click on Scope block)
Regensburg, 24. – 28.7. 2006
Thank you for your kind attention