Chap#4 Simulink Part 1
Chap#4 Simulink Part 1
Dr. A. AMMAR
From the Simulink startup window, you can open existing models (recently worked
ones) from the right-side
01/20/2025 EE421 Dr. AMMAR 3
Or creating a new model by clicking on Blank Model or the other options there.
The Simulink main window, is shown below. Use the button to open the
Simulink library,
The Simulink library contains blocks for representing the mathematical models of
commonly occurring components in dynamic systems. The blocks are grouped in
sub-libraries according to function.
Inputs, when present, are implemented using blocks from the “Sources” sub-
library which can generate a host of input signals.
The blocks residing in the selected “Continuous” sub-library are shown in the right
pane. The “Integrator” block is selected and the transfer function, 1/s, is used to
designate the integrator.
Sources
01/20/2025 EE421 Dr. AMMAR 7
For arithmetic calculations we use the sub-library Math operations
It’s composed of Constant, Gain, Sum, and Display blocks. The scalars entered in
constant blocks are 13, 22, 3i/2, and 5. When this model is executed, it displays its
computed results in the Display block. Note that all of the blocks employed in this
model are available in the Simulink Library.
Example:
Use Simulink to solve the following problem for 0 ≤ t ≤ 13.
Variable-step solvers vary the step size during the simulation. They reduce the
step size to increase accuracy when the states of a model change rapidly. They
increase the step size to avoid taking unnecessary steps when the states of a model
change slowly.
The simplest way to view simulation output is to select one of the scopes,
double click it, and observe the time history of its input.
The simulation results can also be imported to the MATLAB Workspace several
different ways. Mainly, to workspace bloc or to file
Example
In order to simulate the step response of a
continuous time second order system
𝑑𝜔
𝑇 𝑒 − 𝑇 𝐿= 𝐽 + 𝑓 .𝜔
𝑑𝑡
Where the parametes values are given as:
La=0.006H ; Ra=0.6Ω ; KΦ=1; Ua=220V ;
J=0.1SI ; f=0.001SI, TL=5N.m
The Simulink model:
Using the previous developed model in the open loop, a closed-loop speed control using a
PID controller.
The Signal Routing library contains blocks that route signals from one point in a
block diagram to another.
• Demux
Separate a vector signal into output signals.
• Mux
Combine several input lines into a vector
line.
• Bus Selector
Output signals selected from an input bus.
• Goto
Pass block input to From blocks.
• From
Accept input from a Goto block.
Manual Switch
Switch between two inputs.
Multiport Switch
Pass through the input signals corresponding to the discreet value of the first input,
(this bloc work as the switch case command
Switch
Pass through input 1 when input 2 satisfies the selected criterion; otherwise, pass
through input 3
Multiport Switch
Must be a discrete natural number according to the number of the inputs.
The condition
second choice (else)
With a MATLAB Function block, you can write a MATLAB® function for use in a
Simulink® model
S-function
S-functions are SIMULINK blocks that can be programmed by the user (in
MATLAB language or in C language). They are used to simulate complex dynamic
systems (with time-varying parameters and/or with nonlinear components, different
sampling rates, etc.).