0% found this document useful (0 votes)
21 views14 pages

Lab Report 08 - MEEN201101106

The document provides an introduction to Simulink, including how to start and use Simulink, the basic elements of block diagrams, and some common applications. It discusses modeling differential equations using Simulink and provides examples of basic block diagrams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views14 pages

Lab Report 08 - MEEN201101106

The document provides an introduction to Simulink, including how to start and use Simulink, the basic elements of block diagrams, and some common applications. It discusses modeling differential equations using Simulink and provides examples of basic block diagrams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

LAB SESSION 08

Control Engineering Lab

Amnah Kamran
Lab 08 Introduction to SIMULINK

Lab Session 08

Objective:
Introduction to SIMULINK, its interface and some of its basic applications

Section-I Theory

Theory:
SIMULINK
SIMULINK is a powerful simulation and modeling tool provided by MATLAB that allows
engineers and scientists to model, simulate, and analyze dynamic systems. It provides a graphical
user interface (GUI) for building block diagrams and simulating the behavior of systems
represented by mathematical equations.
Simulink and its Relation to MATLAB
Simulink is a MATLAB-based graphical programming environment for modeling, simulating
and analyzing multidomain dynamical systems. Its primary interface is a graphical block
diagramming tool and a customizable set of block libraries.
The MATLAB® and Simulink® environments are integrated into one entity, and thus we can
analyze, simulate, and revise our models in either environment at any point. We invoke Simulink
from within MATLAB.
1. Block Diagram Modeling:
 SIMULINK uses a block diagram approach to model systems. Each block
represents a specific component or mathematical operation, and the connections
between blocks represent the flow of signals.
 Blocks can represent continuous-time or discrete-time systems, linear or nonlinear
elements, mathematical operations, sensors, actuators, controllers, and more.
 By connecting blocks together, complex systems can be represented and
simulated in SIMULINK.

Page | 1
Lab 08 Introduction to SIMULINK

2. Simulating Dynamic Systems:


 SIMULINK allows you to simulate the behavior of dynamic systems by solving
the mathematical equations that represent the system's dynamics.
 The simulation can be performed in continuous time or discrete time, depending
on the nature of the system being modeled.
 SIMULINK uses numerical integration techniques to solve the differential
equations or iterative methods for discrete-time systems.
3. Interface and Block Libraries:
 The SIMULINK interface consists of a model window where the block diagram is
built and edited, and various toolbars and menus for model configuration,
simulation control, and data visualization.
 SIMULINK provides a wide range of block libraries that contain pre-built blocks
representing different system components and functions. These libraries include
sources, sinks, linear systems, logic and arithmetic operations, control systems,
and more.
4. Analysis and Visualization:
 SIMULINK provides tools for analyzing and visualizing simulation results. You
can plot signals, view time-domain and frequency-domain responses, and
compare different simulation runs.
 It supports data logging, allowing you to capture and save simulation data for
further analysis and post-processing.
 SIMULINK also integrates with MATLAB, enabling you to perform advanced
data analysis, optimization, and visualization using MATLAB's extensive
toolbox.

Page | 2
Lab 08 Introduction to SIMULINK

Starting Simulink
Simulink is started from the MATLAB command prompt by entering the following command:
simulink
Alternatively, you can hit the Simulink button at the top of the MATLAB window as shown
here:

Figure 1 MATLAB window


When it starts, Simulink brings up a single window, entitled Simulink Start Page which can be
seen here.

Figure 2 Simulink start page

Page | 3
Lab 08 Introduction to SIMULINK

Once you click on Blank Model, a new window will appear as shown below.

Figure 3 Untitled file


Model Files
In Simulink, a model is a collection of blocks which, in general, represents a system. In addition
to creating a model from scratch, previously saved model files can be loaded either from
the File menu or from the MATLAB command prompt. As an example, download the following
model file by right-clicking on the following link and saving the file in the directory you are
running MATLAB from.
simple.slx
Open this file in Simulink by entering the following command in the MATLAB command
window. (Alternatively, you can load this file using the Open option in the File menu in
Simulink, or by hitting Ctrl-O in Simulink).
simple
The following model window should appear.

Page | 4
Lab 08 Introduction to SIMULINK

Figure 4 Simple block diagram


A new model can be created by selecting New from the File menu in any Simulink window (or
by hitting Ctrl-N).
Basic Elements
There are two major classes of items in Simulink: blocks and lines. Blocks are used to generate,
modify, combine, output, and display signals. Lines are used to transfer signals from one block
to another.
Blocks
There are several general classes of blocks within the Simulink library:
 Sources: used to generate various signals
 Sinks: used to output or display signals
 Continuous: continuous-time system elements (transfer functions, state-space models,
PID controllers, etc.)
 Discrete: linear, discrete-time system elements (discrete transfer functions, discrete state-
space models, etc.)
 Math Operations: contains many common math operations (gain, sum, product, absolute
value, etc.)

Page | 5
Lab 08 Introduction to SIMULINK

 Ports & Subsystems: contains useful blocks to build a system


Blocks have zero to several input terminals and zero to several output terminals. Unused input
terminals are indicated by a small open triangle. Unused output terminals are indicated by a
small triangular point. The block shown below has an unused input terminal on the left and an
unused output terminal on the right.

Figure 5 Block
Lines
Lines transmit signals in the direction indicated by the arrow. Lines must always transmit signals
from the output terminal of one block to the input terminal of another block. On exception to this
is a line can tap off of another line, splitting the signal to each of two destination blocks, as
shown below

Figure 6 Split.xls

Page | 6
Lab 08 Introduction to SIMULINK

Lines can never inject a signal into another line; lines must be combined through the use of a
block such as a summing junction.
A signal can be either a scalar signal or a vector signal. For Single-Input, Single-Output (SISO)
systems, scalar signals are generally used. For Multi-Input, Multi-Output (MIMO) systems,
vector signals are often used, consisting of two or more scalar signals. The lines used to transmit
scalar and vector signals are identical. The type of signal carried by a line is determined by the
blocks on either end of the line.
Basic Applications:
SIMULINK can be used for various applications, including system modeling and simulation,
control system design and analysis, signal processing, communication systems, image
processing, and more. It is commonly used in industries such as automotive, aerospace, robotics,
power systems, and process control for system-level design, testing, and verification.
SIMULINK allows for rapid prototyping, exploring different system configurations, evaluating
system performance under different conditions, and optimizing system designs.
Overall, SIMULINK is a versatile and powerful tool for system modeling, simulation, and
analysis. It provides a user-friendly interface, a wide range of block libraries, and extensive
analysis capabilities, making it a valuable tool for engineers and scientists working with dynamic
systems.
Modeling the Differential with Simulink:
To run Simulink we must first invoke MATLAB. Make sure that Simulink is installed in your
system. In the Command Window, we type: simulink alternately, we can click on the Simulink
icon shown. It appears on the top bar on MATLAB’s Command Window.

Figure 7 Simulink icon


Upon execution of the Simulink command, the Commonly Used Blocks are shown

Page | 7
Lab 08 Introduction to SIMULINK

Figure 8 Simulink Library browser


For Example:

Figure 9 Block diagram


To model the differential equation using Simulink, we perform the following steps:
1. On the Simulink Library Browser, we click on the leftmost icon shown as a blank page
on the top title bar. A new model window named untitled will appear.

Page | 8
Lab 08 Introduction to SIMULINK

Figure 10 Untitled
This is the model window where we enter our blocks to form a block diagram. We save this as
model file name Equation_1_26. This is done from the File drop menu where we choose Save as
and name the file as Equation_1_26. Simulink will add the extension .mdl. The new model
window will now be shown as Equation_1_26, and all saved files will have this appearance.

Figure 11 Model window


2. With the Equation_1_26 model window and the Simulink Library Browser both visible,
we click on the Sources appearing on the left side list, and on the right side we scroll
down until we see the unit step function. We select it, and we drag it into the
Equation_1_26 model window which now we save file Equation_1_26 using the File
drop menu on the Equation_1_26 model window
3. With reference to block diagram, we observe that we need to connect an amplifier with
Gain 3 to the unit step function block. The gain block in Simulink is under Commonly
Used Blocks (first item under Simulink on the Simulink Library Browser). If the
Equation_1_26 model window is no longer visible, it can be recalled by clicking on the
white page icon on the top bar of the Simulink Library Browser.
4. We choose the gain block and we drag it to the right of the unit step function. The
triangle on the right side of the unit step function block and the > symbols on the left and
right sides of the gain block are connection points. We point the mouse close to the
connection point of the unit step function until is a show as a cross hair, and draw a

Page | 9
Lab 08 Introduction to SIMULINK

straight line to connect the two blocks. We double−click on the gain block and on the
Function Block Parameters, we change the gain from 1 to 3.

Figure 12 Dragging the unit step function into File Equation_1_26

Figure 13 File Equation_1_26 with added Step and Gain blocks


5. Next, we need to add a three−input adder. The adder block appears on the right side of
the Simulink Library Browser under Math Operations. We select it, and we drag it into
the Equation_1_26 model window. We double click it, and on the Function Block
Parameters window which appears, we specify 3 inputs. We then connect the output of
the of the gain block to the first input of the adder block as shown

Figure 14 File Equation_1_26 with added gain block


Page | 10
Lab 08 Introduction to SIMULINK

6. From the Commonly Used Blocks of the Simulink Library Browser, we choose the
Integrator block, we drag it into the Equation_1_26 model window, and we connect it to
the output of the Add block. We repeat this step and to add a second Integrator block. We
click on the text “Integrator” under the first integrator block, and we change it to
Integrator 1. Then, we change the text “Integrator 1” under the second Integrator to
“Integrator 2” as shown.

Figure 15 File Equation_1_26 with the addition of two integrators


7. To complete the block diagram, we add the Scope block which is found in the Commonly
Used Blocks on the Simulink Library Browser, we click on the Gain block, and we copy
and paste it twice. We flip the pasted Gain blocks by using the Flip Block command from
the Format drop menu, and we label these as Gain 2 and Gain 3. Finally, we double-click
on these gain blocks and on the Function Block Parameters window, we change the gains
from to −4 and −3 as shown

Figure 16 File Equation_1_26 complete block diagram

8. The initial conditionsi L ¿ , and v c ¿ ¿ are entered by double clicking the Integrator blocks
and entering the values 0 for the first integrator, and 0.5 for the second integrator. We
also need to specify the simulation time. This is done by specifying the simulation time to
be seconds on the Configuration Parameters from the Simulation drop menu. We can start
the simulation on Start from the Simulation drop menu or by clicking on the icon.

Page | 11
Lab 08 Introduction to SIMULINK

9. To see the output waveform, we double click on the Scope block, and then clicking on
the Autoscale icon, we obtain the waveform shown

Figure 17 The waveform for the function

Page | 12
Lab 08 Introduction to SIMULINK

Section-II Tasks

SIMULINK:

Page | 13

You might also like