0% found this document useful (0 votes)
81 views25 pages

Modelling and Simulation of Dynamic Systems

Uploaded by

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

Modelling and Simulation of Dynamic Systems

Uploaded by

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

MODELLING AND SIMULATION OF DYNAMIC SYSTEMS

SIMULATION USING SIMULINK

PUSHPARAJ MANI PATHAK


MECHANICAL & INDUSTRIAL ENGINEERING

1
Introduction

• SIMULINK is a toolbox to model a system in block


diagram form.
• After opening the MATLAB window, type Simulink, a
new pops up with the name of the Simulink module
and elementary blocks appears.
• One can select a new model from the drop down
file menu, another window appears where we can
draw the block diagrams.

2
Simulink

• Graphical block diagram capability


– Can drag and drop components (called blocks)

• Extensive library of blocks available


– DSP Blockset is one

• Real-time Workshop
• An environment for building and simulating models.
– Continuous, discrete or hybrid systems
– Linear and nonlinear components

• Closely integrated with MATLAB and toolboxes


Simulink Model
• A typical Simulink model includes Sources, Systems and
Sinks.

Sources Systems Sinks

• Interconnection
• Sinewaves of Linear and • Displays
• Function Nonlinear blocks scopes
Generators • FFT scopes
• From MATLAB • To MATLAB
workspace workspace
• From Disk Files • To disk files
Simple Simulink Model

Scope
2

Sine Wave Gain


Sum Scope1

Gain1 1
0.9 Unit Delay
z
Simulink Block Libraries
• Simulink contains block libraries, which contain
components that can be used to build models.
• A block library can itself have other libraries as
blocks. Example: When you first start Simulink:
In1 Out1
Scope XY Graph

Sources Sinks Discrete Linear Nonlinear Connections 0

Blocksets & Simulink Block Library 2.2 Display


Toolboxes Demos
Copyright (c) 1990-1998 by The MathWorks, Inc.

untitled.mat simout

To File To Workspace
Sinks is itself a
block library of STOP

components Stop Simulation


Building a Simulink Model 1

Gain Sum

1 1
Sine Wave Sum s s+1
Integrator Transfer Fcn
Model Window
x' = Ax+Bu (s-1)
y = Cx+Du s(s+1)
State-Space Zero-Pole
1
Constant du/dt
Signal Step
Generator
Derivative Dot Product

Use left Ramp Sine Wave Repeating


Sequence
K 1

mouse Discrete Pulse Pulse Chirp Signal


Matrix
Gain
Slider
Gain

button to Generator Generator

12:34

drag blocks Clock Digital Clock Linear Blocks


Library
to the
untitled.mat [T,U]

From File From


Workspace

model
window Random
Number
Uniform Random
Number
Band-Limited
White Noise
Sources Library
Connecting Blocks 1
1
Sine Wave Gain Sum
Sine Wave Gain 1
Sum

Sine Wave Gain Sum

Use the left mouse


button to click on a port
and drag a connection

1
1
Sine Wave Gain Sum Scope
Sine Wave Gain Sum Scope

Use the right mouse


button to click on a line
to drag a branch line
More Simulink Basics

• Double-click on a block to open its Dialog Box.


Parameters for the block can be set in this box.
– Example: setting the amplitude, frequency,
phase and sampling frequency of the sinewave
source.
• After selecting a block, you can rotate, flip or resize
it. These operations are useful in creating a more
“readable” block diagram.
Setting Simulation Parameters
• The Simulation menu item on the model’s window can
be used to set simulation parameters.
• You can specify the appropriate solver that is to be
used. For discrete-time systems use
– the Fixed-step Discrete solver if there is only a single
sample time.
– The Variable-step Discrete solver for multirate systems.
• You can also specify variables that are to be obtained
from or returned to the MATLAB workspace.
Subsystem
• One can select portions of model using
the mouse and make them into a
subsystem.

• One can created a masked subsystem,


that hides the complexity of the
subsystem from the user.
Example

This model consists of three blocks:


1.step-source block,
2.scope-sink block and
3.transfer function-Linear block
13
• A block can be modified
by double-clicking on it,
here by right click on
transfer function block
yields
• This dialog box contains
fields for the numerator and
the denominator of the
block's transfer function.

14
• To change the denominator to s2+2s+4,
• Enter the [1 2 4] into the denominator field:

15
• The "step" block can also be
double-clicked, bringing up
the following dialog box.
• The default parameters in
this dialog box generate a
step function occurring at
time =1 s, from an initial level
of zero to a level of 1.

16
• Double clicking on
scope block brings up a
blank oscilloscope
screen.
• When a simulation is
performed, the signal
which feeds into the
scope will be displayed
in this window.

17
• Take the following model to run a simulation

• Before running a simulation of this system, first open the


scope window by double-clicking on the scope block.
• Then, to start the simulation, select Start from the
Simulation menu

18
• The simulation should run very quickly and
the scope window will appear.

19
• The simulation
output (shown in
yellow) is at a very
low level relative to
the axes of the
scope.
• To fix this, hit the
auto scale button
(binoculars).
20
21
• We can change the
parameters of the
simulation also.
• In the model window,
select Parameters
from the Simulation
menu.
• You will see the
following dialog box.

22
• By just changing
the stop time 10s
to 2 s we get.

23
Reference

• Simulink-Dynamic System Simulation (The


Math Works)

24
Thank you
25

You might also like