+ All Categories
Home > Documents > 1 Application Software Course Simulink By: Mahdi Akbari 2010.

1 Application Software Course Simulink By: Mahdi Akbari 2010.

Date post: 26-Mar-2015
Category:
Upload: hayden-pope
View: 218 times
Download: 1 times
Share this document with a friend
Popular Tags:
32
1 Application Software Course Simulink By: Mahdi Akbari 2010
Transcript
Page 1: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

1

Application Software Course

Simulink

By: Mahdi Akbari2010

Page 2: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

2

What Is Simulink?

•Simulink is a software package for modeling, simulating, and analyzing dynamical systems.

• It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two.

Page 3: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

3

How to open simulink

• Click on this item

Page 4: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

4

create a model

• To create the model, first type simulink in the MATLAB command window. On Microsoft Windows, the Simulink Library Browser appears.

Page 5: 1 Application Software Course Simulink By: Mahdi Akbari 2010.
Page 6: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

6

Open new window

•Simulink opens a new model window.

• Click on New Model button

Page 7: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

7

Model Editor

Page 8: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

8

View Command History

• Back =(Displays the previous view in the view history.Forward )

•forward=( Displays the next view in the view history.Go To Parent )

•Go To Parent=Opens, if necessary, the parent of the current subsystem and brings its window to the top of the desktop.

Page 9: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

9

Building a Simple Model

• This example shows you how to build a model using many of the model building

• commands and actions you will use to build your own models

• The model integrates a sine wave and displays the result, along with the sine wave. The block diagram of the model looks like this

Page 10: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

10

Create example model

• To create this model, you will need to copy blocks into the model from the following Simulink block libraries:

1. Sources library (the Sine Wave block)

2. Sinks library (the Scope block)

3. Continuous library (the Integrator block)

4. Signals & Systems library (the Mux block)

Page 11: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

11

• first expand the Library Browser tree to display the blocks in the Sources library. Do this by

• clicking first on the Simulink node to display the Sources node

• Sources node to display the Sources library blocks.

• Finally right click on the Sine Wave node to select the Sine Wave

Page 12: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

12

• Copy the rest of the blocks in a similar manner from their respective libraries into the model window

Page 13: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

13

• With all the blocks copied into the model window, the model should looksomething like this.

• Now it’s time to connect the blocks.• Hold down the mouse button and move the cursor to the top input

port of the Mux block. Notice that the line is dashed while the mouse button is down and that the cursor shape changes to double-lined cross hairs as it approaches the Mux block.

Page 14: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

14

• Now release the mouse button. The blocks are connected

• Press and hold down the Ctrl key. Press the mouse button, then drag the pointer to the Integrator block’s input port or over the Integrator block itself.

Page 15: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

15

• Finish making block connections. When you’re done, your model should look something like this.

Page 16: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

16

Page 17: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

17

• Now, open the Scope block to view the simulation output. Keeping the Scope

• window open, set up Simulink to run the simulation for 10 seconds. • the simulation parameters by choosing Parameters from the

Simulation menu. On the dialog box that appears notice that the Stop time is set to 10.0(its default value)

Page 18: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

Simulation > Configuration Parameters

Page 19: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

Sine Wave block Double click

Page 20: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

20

• Choose Start from the Simulation menu and watch the traces of the Scope block’s input.

Page 21: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

21

Model Viewing Shortcuts

Page 22: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

22

Zooming Block Diagrams

• Select Zoom In from the View menu (or type r) to enlarge the view.Select Zoom Out from the View menu (or type v) to shrink

the view.• Select Fit System To View from the View menu (or press the space

bar) to fit the diagram to the view.• Select Normal from the View menu

(or type 1) to view the diagram at

actual size.

Page 23: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

23

colors

• Simulink allows you to specify the foreground and background colors of any block

• select Screen color from the Simulink Format menu

Page 24: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

24

Connecting Blocks

• Connecting Two Blocks To auto connect two blocks: Select the source block.

• Hold down Ctrl and left-click the destination block.Simulink connects the source block to the destination block

Page 25: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

25

Connecting Groups of Source Blocks

• Simulink can connect a group of source blocks to a destination block or a source block to a group of destination blocks.To connect a group of source blocks to a destination block:

• Select the source blocks.• Hold down Ctrl and left-click the destination block.

Page 26: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

26

connect a source block to a group of destination blocks• Select the destination blocks.

• Hold down Ctrl and left-click the source block.

Page 27: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

27

Moving a Line Segment To move a line segment:• Position the pointer on the segment you want to move.

• Press and hold down the left mouse button.

• Drag the pointer to the desired location.

Page 28: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

28

Inserting Blocks in a Line

To insert a block in a line:• Position the pointer over the block and press the left mouse button.

• Drag the block over the line in which you want to insert the block.

• Release the mouse button to drop the block on the line.• Simulink inserts the block where you dropped it.

Page 29: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

29

Disconnecting Blocks

• To disconnect a block from its connecting lines, hold down the Shift key, then drag the block to a new location.

Page 30: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

30

Creating Subsystems

• As your model increases in size and complexity, you can simplify it by grouping blocks into subsystems. Using subsystems has these advantages:

• It helps reduce the number of blocks displayed in your model window.

• It allows you to keep functionally related blocks together

Page 31: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

31

Creating a Subsystem by Adding the Subsystem Block• To create a subsystem before adding the blocks• Copy the Subsystem block from the Ports & Subsystems

library into your model.• Open the Subsystem block by double-clicking it.• In the empty Subsystem window, create the subsystem.• For example, the subsystem shown includes a Sum block

and inport and Outport blocks to represent input to and output from the subsystem.

Page 32: 1 Application Software Course Simulink By: Mahdi Akbari 2010.

32

Creating a Subsystem by Grouping Existing Blocks• If your model already contains the blocks you want to convert to a

subsystem, you can create the subsystem by grouping those blocks:

• Enclose the blocks and connecting lines that you want to include in the subsystem within a bounding box. You cannot specify the blocks to be grouped by selecting them individually or by using the Select All command.

• Choose Create Subsystem from the Edit menu.

• If you open the Subsystem block, Simulink displays the underlying system, as shown below.


Recommended