Está en la página 1de 58

SIMULINK INTRODUCTION

Sadaf Anjum

Lecture Overview

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
2

Topics

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems Useful Information System Identification
3

Simulink

Is a software package for modeling, simulating, and analyzing dynamic systems. Supports linear and nonlinear systems, modeled in continuous time, sample time, or a hybrid of the two. For modeling, it provides a graphical user interface (GUI) for building models as block diagrams (using click-and-drag mouse operations) You can simulate, analyze the output results, explore, revise your models.
4

Topics

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
5

Start a Simulink Session

Start a Simulink Session

Simulink Library Browser

Create a New Model

Topics

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
10

Building a Model

Simulink Block Diagram clear model of a dynamic system Each block represents an elementary dynamic system that produces an output (either continuous or discrete output) Lines represent connections of block inputs to block outputs

u (Input)

x (states)

y (Output)

11

Continue
The following steps will guide you to construct a system/model: STEP 1: Creating Blocks STEP 2: Making connections STEP 3: Set Parameters STEP 4: Running Simulation

12

Continue

Step 1: Creating Blocks

Save this model

This is the Sine Wave block is from the Sources library

Sources library

Click-Drag-Drop the Sine Wave block to Workspace Window


13

Continue

Step 1: Creating Blocks

The Gain block is from the Math library

The Mux block is from the Signals &Systems library

These are from the Sinks library


14

Continue

Step 2: Making connections


To make connection: left-click while holding down control key (on keyboard) and drag from source port to a destination port

A connected Model

15

Continue

Step 3: Set Parameters


Double click the Gain block to set the parameter for the Gain block Name the output parameter as out1

Gain value = 5

16

Continue

17

Continue

View output via Scope block


Output of the scope To fit graph to frame

Yellow: Input sine wave Purple: Output (sine wave with gain of 5 Double click on Scope block to display output of the scope Note: Scope block is similar to oscilloscope!
18

Continue

View output (workspace)

You can plot the output using the plot function Three outputs show here
19

Topics

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
20

Example 1:Differential Equations

Example of a dynamic system:


The Mathematical model of the system is describe by:

1 x Bx Kx f t M
Lets M=2kg; B = 2 Ns/m; K=2 N/m

1 x 2 x 2 x f t 2
21

Continue

Use Simulink to simulate the step response of the system, i.e. Unit Step Input

1 x 2 x 2 x f t 2
STEP 1: Creating Blocks
Select BLOCK set Step

f(t), N 1

Time, s

Location in Simulink Library Sources

Sum
Gain Integrator Scope & To Workspace

Math Operation
Math Operation Continuous Sinks
22

Continue

23

Continue

24

Continue

25

Continue
STEP 2: Making connections

1 x 2 x 2 x f t 2

1 2 x 2 x f t 2

26

Continue
Step 4 Run Simulation Step Response for system example

Output from Scope block

Plot system response


27

Topics

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
28

Example 2: Transfer Function

Use the system example and simulate the response using transfer function approach

1 x 2 x 2 x f t 2
The transfer function of the equation (assume all initial conditions =0)

X (s) 1 2 F ( s) 2s 2s 2
29

Continue
STEP 1: Creating Blocks
Select BLOCK set Location in Simulink Library

Step
Transfer Function Scope & To Workspace

Sources
Continuous Sinks

30

Continue

31

Continue

STEP 2: Making connections

X (s) 1 2 F ( s) 2s 2s 2

32

Continue

Step 3 set parameters

33

Continue
Step 4 Run Simulation

Output from Scope block

Plot system response


34

Topics

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
35

Creating Subsystems

Subsystem similar to Subroutine Advantage of Subsystems:

Reduce the number of blocks display on the main window (i.e. simplify the model) Group related blocks together (i.e. More organized) Can create a hierarchical block diagram (i.e. you can create subsystems within a subsystem ) Easy to check for mistakes and to explore different parameters
36

Continue
Create Subsystem using model in Example 1 STEP 1: Creating Blocks (Main window)

37

Continue

38

Continue
STEP 2: Double click Subsystem block and create a model in the Subsystem block

39

Continue
STEP 3: Making connections (Main window)

40

Continue
STEP 4: Set Parameter (Main window) STEP 5: Running Simulation Then view output response

Output from Scope block

41

TOPICS

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System Modeling example System Identification
42

System modeling Example.

Moment of inertia of the rotor (J) = 3.2284E-6 kg.m^2/s^2 Damping ratio of the mechanical system (b) = 3.5077E-6 Nms Electromotive force constant (K=Ke=Kt) = 0.0274 Nm/Amp Electric resistance (R) = 4 ohm Electric inductance (L) = 2.75E6H Input (V): Source Voltage Output (theta): position of shaft

43

Continue

44

Continue

45

Continue

46

Continue

47

Continue

48

What is Simulink? How to use Simulink


Getting Start with Simulink Building a model

Example 1 (Differential Equations ) Example 2 (Transfer Function) Creating Subsystems System modeling example System Identification
49

System Identification

50

Continue

51

Coninue

52

Continue

53

Continue

54

Continue

55

Continue

56

Continue

This is the identified model of the unknown system.


57

THANK YOU

58

También podría gustarte