You are on page 1of 19

Palestine Polytechnic University

Workshop
Matlab/Simulink in Drives
and Power electronics
Lecture 2 : Introduction to Simulink

Ghislain REMY Jean DEPREZ


18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 1 / 19
Palestine Polytechnic University

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.

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 2 / 19
Palestine Polytechnic University

? 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

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 3 / 19
Palestine Polytechnic University

Getting started with SIMULINK


• Objective: Simulate a DC Permanent Magnet Motor
driving a mechanic load
Ia

La
Speed Ω Load inertia JL
U Ra Resistant Torque TL

Electrical Torque Te
Friction Torque TF
Motor Inertia JM
Torque Constant Ke

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 4 / 19
Palestine Polytechnic University

DC-SEVOMOTOR RX620J

Ke = 0.49 Nm/A
tf = 0.18 N.m
kf = 4.610-4N.m.s
Ra = 0.49 Ω
La = 4.3 mH
JM = 0.0035 kg.m2

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 5 / 19
Palestine Polytechnic University

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

Simulation model: TL J

U Ia Te - :
1 Ke + x 1 Ω
+ -
- Ra+La.s s
E

TF= Tf +kf*Ω
Ke

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 6 / 19
Palestine Polytechnic University

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

2- Click "Create a new model"

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

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 7 / 19
Palestine Polytechnic University

Building the model


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

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 8 / 19
Palestine Polytechnic University

Add a value for each Parameters

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 9 / 19
Palestine Polytechnic University

Defining input signals values

The Most use Input Signal types are :


•Constant •From Workspace
•Step
•Signal Builder
•Sin Wave

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 10 / 19
Palestine Polytechnic University

Displaying output signals

The Most use Output Signal types are :


•Scope •Terminator

•To Workspace •XY Graph

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 11 / 19
Palestine Polytechnic University

Initializing the parameters of the motor

1- Create a M-file
named 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.

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 12 / 19
Palestine Polytechnic University

Setting the Simulation Parameters

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

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 13 / 19
Palestine Polytechnic University
Starting simulation

End of simulation

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 14 / 19
Palestine Polytechnic University

Displaying results of Simulation: Scope


Autoscale Zoom

Parameters

By default, the number of points recorded

! is limited to the 5000 last points !!!


(see parameters)

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 15 / 19
Palestine Polytechnic University

Saving data to workspace


Solution 1: The Scope Parameters

time

Solution 2: w
The "To Wokspace" function block
allows the same saving of data,
without screen display
Use Array Format for easier use
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 16 / 19
Palestine Polytechnic University

Creating a Subsystem (1/3)

1- Select the components


which will be inside the
Subsystem.

2- Select
"Create Subsystem"

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 17 / 19
Palestine Polytechnic University

Creating a Subsystem (2/3)

3- Model is modify
automaticaly

Subsytem Port names


are the Port names

4- Inside the Subsystem


Connections are added:

- Input Port
- Output Port

18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 2 18 / 19
Palestine Polytechnic University

Creating a Subsystem (3/3)

5- Rearrange the icons


Rename the subsystem
Rearrange and rename
inputs and outputs

This subsystem can


be insert in a library
(see practice 3)

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

You might also like