simulink presentation

Post on 22-Feb-2015

246 Views

Category:

Documents

10 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

SIMULINK INTRODUCTION

Sadaf Anjum

2

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

3

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

4

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.

5

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

6

Start a Simulink Session

7

Start a Simulink Session

8

Simulink Library Browser

9

Create a New Model

10

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

11

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)

12

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

13

Continue…

Step 1: Creating Blocks

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

This is the Sine Wave block is

from the Sources library

Sources library

Save this model

14

Continue…

Step 1: Creating Blocks

These arefrom the Sinks

library

The Gain block isfrom the

Math library

The Mux block is from the Signals &Systems library

15

Continue…

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

A connected Model

16

Continue…

Gain value = 5

Name the output parameter as “out1”

Double click the Gain block to set the parameter for the Gain block

Step 3: Set Parameters

17

Continue…

18

Continue…

View output via Scope block

Double click on Scope block to display output of the scopeNote: Scope block is similar to oscilloscope!

Output of the scope

Yellow: Input sine wavePurple: Output (sine wave with gain of 5

To fit graph to frame

19

Continue…

Three outputs show here

View output (workspace)

You can plot the output using the plot function

20

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

21

Example 1:Differential Equations Example of a dynamic system:

1x Bx Kx f t

M

The Mathematical model of the system is describe by:

12 2

2x x x f t

Lets M=2kg; B = 2 Ns/m; K=2 N/m

22

Unit Step Input

Continue…

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

STEP 1: Creating Blocks

12 2

2x x x f t

f(t), N

1

0 Time, s

Select BLOCK set Location in Simulink Library

Step Sources

Sum Math Operation

Gain Math Operation

Integrator Continuous

Scope & To Workspace Sinks

23

Continue…

24

Continue…

25

Continue…

26

Continue…

12 2

2x x x f t

12 2

2x x x f t

STEP 2: Making connections

27

Continue…Step 4 Run SimulationStep Response for system example

Output from Scope block Plot system response

28

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

29

Example 2: Transfer Function Use the system example and simulate the

response using transfer function approach

12 2

2x x x f t

2

( ) 1

( ) 2 2 2

X s

F s s s

The transfer function of the equation (assume all initial conditions =0)

30

Continue…

STEP 1: Creating Blocks

Select BLOCK set Location in Simulink Library

Step Sources

Transfer Function Continuous

Scope & To Workspace Sinks

31

Continue…

32

Continue… STEP 2: Making

connections

2

( ) 1

( ) 2 2 2

X s

F s s s

33

Continue…

Step 3 set parameters

34

Continue…

Step 4 Run Simulation

Output from Scope blockPlot system response

35

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

36

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

37

Continue…

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

38

Continue…

39

Continue…

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

40

Continue…

STEP 3: Making connections (Main window)

41

Continue…

STEP 4: Set Parameter (Main window)STEP 5: Running SimulationThen view output response

Output from Scope block

42

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

43

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.75E-6 H Input (V): Source Voltage

Output (theta): position of shaft

44

Continue…

45

Continue…

46

Continue…

47

Continue…

48

Continue…

49

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

50

System Identification

51

Continue…

52

Coninue…

53

Continue…

54

Continue…

55

Continue…

56

Continue…

57

Continue…

This is the identified model of the unknown system.

58

THANK YOU…

top related