Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Simulink: A Graphical Tool for Modeling and Simulating Dynamic Systems, Lecture notes of Construction

Simulink is an interactive, graphical environment for modeling, simulating, and analyzing dynamic systems using MATLAB. It provides a user-friendly interface for building models as block diagrams, supports linear and nonlinear systems, and is integrated with MATLAB for easy data sharing. In this document, we explore the basics of Simulink, its components, and the process of creating a simple model.

Typology: Lecture notes

2021/2022

Uploaded on 09/27/2022

linden
linden 🇬🇧

4.4

(8)

217 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
What is Simulink?
Simulink, an add-on product to MATLAB, provides an interactive, graphical
environment for modeling, simulating, and analyzing of dynamic systems. It enables
rapid construction of virtual prototypes to explore design concepts at any level of detail
with minimal effort. For modeling, Simulink provides a graphical user interface (GUI)
for building models as block diagrams. It includes a comprehensive library of pre-
defined blocks to be used to construct graphical models of systems using drag-and-drop
mouse operations. The user is able to produce an “up-and-running” model that would
otherwise require hours to build in the laboratory environment. It supports linear and
nonlinear systems, modeled in continuous-time, sampled time, or hybrid of the two.
Since students learn efficiently with frequent feedback, the interactive nature of Simulink
encourages you to try things out, you can change parameters “on the fly” and
immediately see what happens, for “what if” exploration. Lastly, and not the least,
Simulink is integrated with MATLAB and data can be easily shared between the
programs.
In order to use Simulink, you must first start MATLAB. With MATLAB running, there
are two ways to start Simulink:
Click the Simulink icon on the MATLAB toolbar
Type ‘simulink’ at the MATLAB prompt followed by a carriage return (press the
Enter key)
313
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Understanding Simulink: A Graphical Tool for Modeling and Simulating Dynamic Systems and more Lecture notes Construction in PDF only on Docsity!

What is Simulink?

Simulink, an add-on product to MATLAB, provides an interactive, graphical environment for modeling, simulating, and analyzing of dynamic systems. It enables rapid construction of virtual prototypes to explore design concepts at any level of detail with minimal effort. For modeling, Simulink provides a graphical user interface (GUI) for building models as block diagrams. It includes a comprehensive library of pre- defined blocks to be used to construct graphical models of systems using drag-and-drop mouse operations. The user is able to produce an “up-and-running” model that would otherwise require hours to build in the laboratory environment. It supports linear and nonlinear systems, modeled in continuous-time, sampled time, or hybrid of the two. Since students learn efficiently with frequent feedback, the interactive nature of Simulink encourages you to try things out, you can change parameters “on the fly” and immediately see what happens, for “what if” exploration. Lastly, and not the least, Simulink is integrated with MATLAB and data can be easily shared between the programs.

In order to use Simulink, you must first start MATLAB. With MATLAB running, there are two ways to start Simulink:

  • Click the Simulink icon on the MATLAB toolbar
  • Type ‘simulink’ at the MATLAB prompt followed by a carriage return (press the Enter key)

In response, MATLAB displays the Simulink Library Browser.

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. One exception to this is that a line can tap off of another line. This sends the original signal to two (or more) destination blocks.

Lines can never inject a signal into another line; lines must be combined through the use of block such as a summing junction. A signal can be either a scalar signal or a vector signal.

- Building a Simulink model

Building a Simulink model of a system consists of selecting the appropriate blocks and connecting them in a way that represents the mathematical models. Since the best way to learn a simulation tool is to work with it, this first tutorial will guide you through a simple example. We will build the block diagram for a simple model consisting of a sinusoidal input multiplied by a constant gain, which is depicted below.

Six Distinct Blocks

The Simulink model will consist of 6 distinct blocks, namely, Sine Wave , Scope , Mux , Clock , and To Workspace. The Sine Wave is a source block from which a sinusoidal input signal originates. The signal is transferred through a line in the direction indicated by the arrow to the Gain block. The Gain block modifies its input (scales it by 5) and outputs a new signal through a line. The output of the Gain block and the output of the Sine Wave are combined in the multiplexer (Mux) to form a signal vector. The signal vector is transferred through a line to the Scope block used to display a signal much like an oscilloscope.

Specifications of Model

Block Name Specifications Location

Sine Wave

Amplitude=1v Frequency=1 rad/s Sources

Scope Time range=10s Sinks

Gain Gain=5 Math Operations

A. Step one: Select desired blocks – Getting the blocks into the model window:

Follow the steps below to collect the necessary blocks:

  • Create a new model (New from the File menu). You will get a blank model window
  • Click on the Sources icon in the Library Browser. This opens the Sources window which contains the Sources block library. Sources are used to generate signals.
  • Drag the Sine Wave and Clock blocks from the Sources window into the left side of your model window.
  • Click on the Sinks icon in the Library Browser to open the Sinks window.
  • Drag the Scope and To Workspace blocks into the right side of your model window.
  • Click on the Signal Routing icon in the Library Browser to open the Signal Routing window.
  • Drag the Mux block into the your model window
  • Click on the Math Operations icon in the Library Browser to open Math Operations window.
  • Drag the Gain block into your model window.

B. Step 2: Configure block parameters - Resizing and moving blocks:

  • First select the block by clicking with your left mouse button while the pointer is on the block. In each corner of the block a little filled square appears. Put the pointer on one of the corner, press the left mouse button and keep it pressed down. Move the mouse and release the mouse button when the block has the desired size.
  • To move a block you first have to select it. Then put the pointer inside the block, press the left mouse button down and keep it pressed down. Drag the block to its new position and release the mouse button.

C. Step 3: Connecting block inputs and outputs- Adding a branch line:

To connect the output of the Sine Wave to the input of the Mux block, you will use a branch line. Drawing a branch line is slightly different in that to start, the branch line must be welded to an existing line. Position the pointer on the line that connects the Sine Wave block to the Gain block. Without moving the mouse, press and hold down the CTRL key and then press and hold the left mouse button. Drag the pointer to the input port of the Mux block and release the mouse button.

E. More Modifications

Modify blocks

Follow these steps to properly modify the blocks in your model

  • Double-click your Sine Wave. Change the frequency to 1 rad/s and the amplitude to 1v. Close the dialog box.
  • Double-click the Gain block. Change the gain to 5 and close the dialog box.

Copying blocks:

  • Position the pointer on the block to be copied, press the right mouse button down and keep it pressed down to copy the block. Drag the copy of the desired position and release the mouse button.
  • Alternatively, you can use Copy and Paste topics of the Edit menu to copy the block

Removing blocks:

  • Select the block to be removed
  • Press the Delete key on your keyboard, or select the Cut topic in the Edit menu

Connecting blocks with lines:

Now that the blocks are properly laid out, you will now connect them together. Follow these steps:

  • Drag the mouse from the output terminal of the Sine Wave block to the upper input of the Sum block.
  • Let go of the mouse button only when the mouse is right on the input terminal. Do not worry about the path you follow while dragging, the line will route itself.
  • The resulting line should have a filled arrowhead. If the arrowhead is pen, it means it is not connected to anything. You can continue the partial line you just drew by treating the open arrowhead as an output terminal and drawing just as before.

Run Simulation

Double-click the Scope block, Scope window will pop-up. Then click SimulationÆStart, you will see the simulation result is plotted in the Scope. Click Autoscale (an icon of Telescope), the Scope will rescale the plot and make it fit the window. You can also Zoom in/out the plot. You can also rescale the axes; by right click on the axes.

Simulation Parameters

In the model window, select Configuration Parameters from the Simulation menu, as depicted below.

You will see the following dialog box.

There are many simulation parameter options, we will be concerned with the Start time and Stop time , which tell SIMULINK over what time span to perform the simulation. Keep the Start time at 0.0, and change the Stop time from 10.0 to 1000.00. Next, we will alter the Max step size. Change Max step size from auto to 0.001. Close the dialog box by clicking OK and run the simulation.

After hitting the Autoscale button , the Scope window should provide a much better display of the output.

Scope

The scope block displays its input with respect to simulation time. The Scope block can have multiple axis; all axes have a common time range. You can move and resize the Scope window and you can modify the Scope’s parameter values during the simulation. When you start a simulation, Simulink does not open Scope windows.

Y-axis Limits

You set Y-limits by right-clicking an axis and choosing Axes Properties. The following dialog box appears:

Change the x-axis limits by entering a number or auto in the Time range field. Entering a number of seconds causes each screen to display the amount of data that corresponds to that number of seconds. Enter auto to set the x-axis to the duration of the simulation.

Tick labels:

You can choose to have tick labels on all axes, or one axis, or on the bottom axis only, using the Tick labels list