19
Palestine Polytechnic University Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 18-21 May 2009 / 19 1 Workshop Matlab/Simulink in Drives and Power electronics Lecture 2 : Introduction to Simulink Ghislain REMY Jean DEPREZ

Lecture 2 Introduction to Simulink

Embed Size (px)

DESCRIPTION

intro for simlink in matlab

Citation preview

Page 1: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 191

WorkshopMatlab/Simulink in Drives

and Power electronics

Lecture 2 : Introduction to Simulink

Ghislain REMY Jean DEPREZ

Page 2: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 192

Workshop Program• 8 lectures will be presented based on Matlab/Simulink :

– 1 Introduction to Matlab

– 2 Introduction to Simulink

– 3 DC-Motor Control design

– 4 DC-Motor Chopper design SimPowerSystems

– 5 Introduction to Stateflow/Statechart

– 6 Induction Motor Inverter Control

– 7 Synchronous Motor Modeling

– 8 Synchronous Motor Control

• Two system applications (four quadrants electric drives of mechanical systems) will be used as "conducting lines" during the workshop.

Page 3: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 193

? SIMULINK ?

SIMULINK is a complement of the MATLAB kernel, which gives a graphic interface to model dynamical systems using a block schematic representation. Using the numerous basic blocks available, it is possible to create simulation models without writing any lines of programming code.

Specialized libraries – Blocksets – are available for specific purposes (Ex : SimPowerSystems, FuzzyLogic, DSP-Target …)

The open architecture allows to extend the simulation environment by:- Creating customized blocs and libraries from MATLAB, Fortran, C or graphic representation,- C codes generation from Simulink simulation models

Several tools are available for the signal analysis

Page 4: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Getting started with SIMULINK• Objective: Simulate a DC Permanent Magnet Motor

driving a mechanic load

4

La

Ra

E

ULoad inertia JLResistant Torque TL

Speed Ω

Electrical Torque TeFriction Torque TFMotor Inertia JMTorque Constant Ke

Ia

Page 5: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 195

Ke = 0.49 Nm/Atf = 0.18 N.mkf = 4.610-4N.m.sRa = 0.49 ΩLa = 4.3 mHJM = 0.0035 kg.m2

DC-SEVOMOTOR RX620J

Page 6: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Equations:

6

U = E + Ra.Ia + La.dIa/dtE = Ke. ΩTe = Ke.IaJ = JM + JLTF = sign(Ω).tf + kf.ΩTe = TF + TL + J.dΩ/dt

TeUΩ1

s

TL

+ --+

TF= Tf +kf*Ω

-1

Ra+La.sKe

Ke

Ia

E

J

x:

Simulation model:

Page 7: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Starting SIMULINK

7

1-Click "Simulink " to open the Simulink Library Browser

2- Click "Create a new model"

3- An empty new model pop-up (.mdl file)

Page 8: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Building the model

8

1- Select a Library

2- Select a component

3- Drag and Drop the icon into the model

4- Double Click on the icon to open the Function Block Parameters window and modify it

Page 9: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Add a value for each Parameters

9

Page 10: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Defining input signals values

10

The Most use Input Signal types are :

•Constant•Step

•From Workspace

•Signal Builder•Sin Wave

Page 11: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Displaying output signals

11

The Most use Output Signal types are :•Scope

•To Workspace

•Terminator

•XY Graph

Page 12: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Initializing the parameters of the motor

12

1- Create a M-filenamed DC_PM_motor_init.m

2- Run this M-file

The values of Ra, La, Ke, tf and kf are then stored in the workspace.

Page 13: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Setting the Simulation Parameters

13

1- Click “Simulation”, then “Configuration Parameters”

2- Modify the value of the Stop time

3- Use a Type of Solver :•Fixed-step•Variable-step

4- Select a Solver :The Most used are :- Ode1 (Euler)

for Real-Time in Fixed-step- Ode23s (stiff/Rosenbrock)

for stiff in Variable-step

5- Select a step size

Page 14: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Starting simulation

14

End of simulation

Page 15: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Displaying results of Simulation: Scope

15

Autoscale

Parameters

! By default, the number of points recorded is limited to the 5000 last points !!!

(see parameters)

Zoom

Page 16: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Saving data to workspace

16

The "To Wokspace" function blockallows the same saving of data, without screen displayUse Array Format for easier use

Solution 2:

Solution 1: The Scope Parameters

time

w

Page 17: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Creating a Subsystem (1/3)

17

1- Select the componentswhich will be inside the Subsystem.

2- Select "Create Subsystem"

Page 18: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Creating a Subsystem (2/3)

18

3- Model is modifyautomaticaly

4- Inside the SubsystemConnections are added:

- Input Port - Output Port

Subsytem Port names are the Port names

Page 19: Lecture 2 Introduction to Simulink

Palestine Polytechnic University

Workshop Matlab/Simulink in Drives and Power electronics – Lecture 218-21 May 2009 / 19

Creating a Subsystem (3/3)

19

5- Rearrange the iconsRename the subsystemRearrange and rename inputs and outputs

This subsystem canbe insert in a library(see practice 3)