You are on page 1of 190

Piece-wise Linear Electrical Circuit Simulation

Circuit Simulation at System Level


Getting Started
Plexim GmbH
Technoparkstrasse 1
8005 Zrich

Piece-wiseiar Electrical Circuit Simulation

PLECS Getting Started


20022012 by Plexim GmbH
The software PLECS described in this manual is furnished under a license agreement. The
software may be used or copied only under the terms of the license agreement. No part of this
manual may be photocopied or reproduced in any form without prior written consent from
Plexim GmbH. PLECS has been developed under license of ETH Zurich. PLECS is a registered
trademark of Plexim GmbH. MATLAB and Simulink are registered trademarks of The MathWorks,
Inc. Other product or brand names are trademarks or registered trademarks of their respective
holders.

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS BlocksetVersion 3.3
PLECS Blockset
PLECSMATLABSimulink

PLECS BlocksetMATLAB

PleximWeb
plecs@kesco.co.jp

Windows 32-bit
Windows 64-bit
Mac Intel 32-bit
Mac Intel 64-bit
Linux 32-bit
Linux 64-bit

MATLAB

6.57.13
7.47.13
7.47.10
7.97.13
7.47.13
7.47.13

plecs-blockset-3-3-x_win32.exe
plecs-blockset-3-3-x_win64.exe
plecs-blockset-3-3-x_maci.tar.gz
plecs-blockset-3-3-x_maci64.tar.gz
plecs-blockset-3-3-x_linux32.tar.gz
plecs-blockset-3-3-x_linux64.tar.gz

M-
PLECS Blockset M-installplecs.m
M-installplecs.mMATLAB
PLECS BlocksetWeb
PLECS BlocksetMATLAB

** MATLAB

MALTAB 7.0.0

Simulation of Power Electronic Circuits at System Level

M-
OSMicrosoft Windows
1 installplecs_j.mM-MATLAB

M-MATLAB Editor
F5

PLECSMATLAB
MATLAB

Web

PLECS Blockset

PLECS

Simulation of Power Electronic Circuits at System Level

C:Program Files

Windows7
"C:\Users\\Documents\Plexim\PLECS Blockset 3.2 (64 bit)"

Install

MATLAB

Simulation of Power Electronic Circuits at System Level

PLECS Blockset
MATLAB

license.dat

MATLAB
PLECS Blockset
MATLAB

MATLAB

3 MATLAB

MATLAB

PLECS3.3.x
plecslibPLECS

Simulation of Power Electronic Circuits at System Level

M-
OSMicrosoft Windows
1 installplecs_j.m
M-MATLAB

M-MATLAB Editor
F5

PLECS Blockset
MATLABMATLAB

Web

2 PLECS Blockset

3
PLECS
MATLABPLECS Blockset

Simulation of Power Electronic Circuits at System Level

Microsoft Windows
1 plecs-blockset-3-3-x_win64.exe

PLECS Blockset

PLECS

C:Program Files

Windows7
"C:\Users\\Documents\Plexim\PLECS Blockset 3.2 (64 bit)"

Install

Simulation of Power Electronic Circuits at System Level

MATLAB

PLECS Blockset
MATLAB

license.dat

MATLAB
PLECS Blockset
MATLAB

MATLAB

Simulation of Power Electronic Circuits at System Level

2
license.dat 1
plecs.m
PLECS Viewer
PLECS Blocksetprivate
viewerlicense.datlicense.datplecs.m

** license.dat
3 1 MATLABMATLAB
1 PLECS Blockset
MATLAB
demos
MATLABMathworks
4 PLECS
MATLAB
plecsclear
rehash toolboxcache
MATLAB
binwin64win32plecs.exe

Simulation of Power Electronic Circuits at System Level

Mac OS X / Linux
1 tar.gzplecs-blockset-3-3-x_maci.tar.gz
tar
tar -xzf .tar.gz
tar -xvf plecs-blockset-3-3-x_maci.tar.gz
2
license.dat
1
** license.dat
3 MATLAB 1
MATLAB
demos
M-MATLAB
pathdef.mmatlabroot/toolbox/local/
startup.mADDPATH
startup.mmatlab

addpath(plecs_directory);
addpath(plecs_directory/demos);

addpath / home / user / plecs_33


addpath / home / user / plecs_33 / demos
4 PLECS
MATLAB
plecsclear
rehash toolboxcache

Simulation of Power Electronic Circuits at System Level

USBMicrosoft Windows
1 PLECSUSBFLEXIdUSB
FLEXId
plecs@kesco.co.jp FLEXId
FLEXId_Dongle_Driver_Installer.exePC

2 PLECSPCPLECSFLEXId
PLECSM-Microsoft
Windows
**
USBUSB1PLECS
PCPLECSPC
PLECS

FloatingMicrosoft Windows
1 PLECSFLEXnetFloating
FLEXnet
plecs@kesco.co.jp FLEXnet
flexnet_11_9_win64.zip
C:Program
Filesflexnet
2 lmtools.exe
3 LMTOOLSSystem Setting

Save HOSTID Info to a FileASCII


HOSTID.txt plecs@kesco.co.jp

** Host-IDLAN
IPMAC
Host-ID

4 plexim.lic
FLEXnetlmtools.exe

5 LMTOOLS
Servive/License File
Configuration using Services

10

Simulation of Power Electronic Circuits at System Level

6 Config Services
Service NamePlexim License
ManagerPath to the lmgrd.exe fileBrowse
lmgrd.exeC:Program Files flexnet lmgrd.exe
Path to the license fileC:Program Files flexnet plexim.lic

Save Service

7 Start/Stop/RereadStart Server

8 Server Status
Individual Daemon
pleximPerform Status EnquiryLMTOOLS
GUI

License server status: ***** @ *** . *** . *** . ***


License file(s) on *** . *** . *** . *** : C:Program Files flexnet plexim.lic:
*** . *** . *** . *** : license server UP v11.4
Vendor daemon status (on coulomb):
plexim: UP v11.4
Feature usage info:
Users of plecsedit: (Total of 1 license issued; Total of 0 licenses in use)

9 Config ServicesUse
ServicesStart Server at Power Up
10
PLECSlicense.dat

SERVER hostname ANY


USE_SERVER
plecs

SERVER plecs ANY


USE_SERVER
PLECS
**

11

Simulation of Power Electronic Circuits at System Level

1PLECSMATLAB
1

C:Program Files plecs_33


C:Program Files plecs_30
C:Program Files plecs_22
PLECS
MATLABplecsclear
MATLAB

PLECS Blockset
PLECS Blockset
1 MATLABPLECS

which plecsedit
2 MATLAB
pathdef.mstartup.m
PLECS
3 MATLAB
4 WindowsWindowsWindows7
PLECS BlocksetMacOSLinuxPLECS

12

Simulation of Power Electronic Circuits at System Level

PLECS StandaloneVersion 3.3


PLECS Standalone
PLECS StandaloneOS
PleximWeb plecs@kesco.co.jp

Windows 32-bit
Windows 64-bit
Mac Intel
Linux 32-bit
Linux 64-bit

plecs-standalone-3-3-x_w32.exe
plecs-standalone-3-3-x_w32.exe
plecs-standalone-3-3-x_maci64.dmg
plecs-standalone-3-3-x_linux32.tar.gz
plecs-standalone-3-3-x_linux64.tar.gz

Microsoft Windows
1 EXEplecs-standalone-3-3-x_w64.exe

PLECS Standalone

PLECS StandalonePC

Windows7
"C:\Users\\Documents\Plexim\PLECS Blockset 3.2 (64 bit)"

13

Simulation of Power Electronic Circuits at System Level

Install

PLECS Standalone

2
license.dat
1 plecs.exe

14

Simulation of Power Electronic Circuits at System Level

Mac OS X
1 dmgplecs-standalone-3-3-x_maci64.dmg

2 PLECS
3 PLECSlicense.dat

Linux
1 tar.gzplecs-standalone-3-3-x_maci.tar.gz
plecs

/ home / user / plecs_33


tar xzf .tar.gz
tar xf plecs-blockset-3-3-x_maci.tar
2
license.dat
1

PLECS

/
PLECS ViewerBlockset
PLECS BlocksetPLECS Viewer

15

Simulation of Power Electronic Circuits at System Level

Whats New in Version 3.3


PLECS3.3

PLECS Scope

PLECS

PLECS Scope

PLECS ScopePLECS Scope

PLECS Standalone

Mac OS XPLECS Standalone64


32DLL64

PLECS 3.3

16

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS

PLECS
2

PLECSC3

PLECS
(ODE)

u
y

17

Simulation of Power Electronic Circuits at System Level

(t)

(t)

(t)

y f output(t , u, xc , xd )

xdnext f update(t , u, xc , xd )
xc f derivative(t , u, xc , xd )
C

18

Simulation of Power Electronic Circuits at System Level

PLECS

PLECS 2

PLECSKirchhoffs current and voltage laws


/
piecewise linear
state-space equation

x A x B u
y C x D u

ODE

19

Simulation of Power Electronic Circuits at System Level

PLECS
Tustins Method

xn Ad xn1 Bd (u n u n1 )
1

t t
Ad 1
A 1
A
2
2

t t
Bd 1
A B
2
2

PLECS

PLECS

Direct feedthrough
ku

y k u

y xc

20

Simulation of Power Electronic Circuits at System Level

PLECS

2
1.

Scope

2.

21

Simulation of Power Electronic Circuits at System Level

fturn
on = vD fturn off = iD 2
/

PLECS

22

Simulation of Power Electronic Circuits at System Level

PLECS
Continuous

IntegratorTransfer Function

Semi-Continuous

Memory
-Discrete-Periodic

-Discrete-Variable

2
0

Continuous

Semi-Continuous
-
Discrete-Periodic
-
Discrete-Variable

[0, 0]
0
[0, -1]
[Tp, To]
Tp
[-2, 0]
-2

Tp: Tp > 0
To: 0 To < Tp

23

Simulation of Power Electronic Circuits at System Level

PLECS 1.1
PLECS BlocksetRLC
PLECS Blockset Version 3.3 OSWindows
RLCPLECS

RLC
[10mH][10]
DC[10V]
[100F]

PLECS
MATLABplecselibPLECS
MATLAB Simulink PLECS Block Library
PLECS

MATLAB

PLECS
GUI PLECS
MATLAB

PLECS Simulink
*.mdl
Simulink PLECS

PLECS Simulink

24

Simulation of Power Electronic Circuits at System Level

PLECSPLECS
SimulinkPLECS

PLECS Simulink
MATLAB/Simulink PLECS
PLECS PLECS

PLECS
PLECS
Library
Components

25

Simulation of Power Electronic Circuits at System Level

R1L1C1
DCV_dc
Vm1
PLECS
PLECS MATLAB/Simulink
Simulink

Ctrl

Ctrl
RCtrlF
/CtrlI/

26

Simulation of Power Electronic Circuits at System Level

Ctrl

PLECS

RLC
DC10 V10 10 mH
100 F

27

Simulation of Power Electronic Circuits at System Level

PLECS Simulink
SI

RLCSimulink
Simulink
Out1

Simulink

28

Simulation of Power Electronic Circuits at System Level

PLECSSimulinkPLECS
PLECS ScopeRLC
PLECSPLECS ScopeSimulink
PLECSPLECS Scope

PLECS Simulink

PLECSRLC

0.02

PLECS Scope

PLECS MATLAB Auto

RLC10V25Hz50%

SimulinkPulse Generator

29

Simulation of Power Electronic Circuits at System Level

RLC
In1
V

DCV_dcVIn1
SimulinkPLECS

PLECS Probe
PLECS
PLECS ProbeSimulink

30

Simulation of Power Electronic Circuits at System Level

SimulinkPLECS Probe

PLECS

PLECS Probe PLECS
Simulink

/VNm

PLECS
PLECS Probe
Simulink

31

Simulation of Power Electronic Circuits at System Level

PLECSSimulinkPulse Generator
Pulse Generator10
secs0.0425Hz50

SimulinkPulse GeneratorPLECSRLC
SimulinkMux

SimulinkMuxPLECS Probe
PLECS Scope

PLECS ScopePLECS
Scope 2
RLC
0.1
PLECS Scope

PLECS Scope

32

Simulation of Power Electronic Circuits at System Level

PLECS 1.2
PLECS BlocksetDC-DC
PLECS Blockset Version 3.3 OSWindows
DC-DC
PLECS

Simulink

DC/DC
DC/DC
25 mH220 F2

PLECS

PLECS

PLECS

33

Simulation of Power Electronic Circuits at System Level

R1L1C1
V
Vm1Am1
S1
D1
In1Out1
PLECS

DC/DC
0
/

di/dt

34

Simulation of Power Electronic Circuits at System Level

PLECS

2 25 mH
220 F

PLECSDC/DCSimulink
Simulink
PLECS
PLECS /

35

Simulation of Power Electronic Circuits at System Level

PLECSSimulink

DC/DC
6V0.2V
0.0512V8V
Simulink
Constant6
Sum| + -+-V
Relay 0.2
Simulink
Constant12
Sum+ | -+-
Step0.054
PLECSSimulink
MuxPLECS Scope

0.1
PLECS Scope

36

Simulation of Power Electronic Circuits at System Level

PLECS 2.1
PLECS StandaloneRLC
PLECS Standalone Version 3.2 OSWindows
RLCPLECS Standalone

RLC
[10mH][10]
DC[10V]
[100F]

PLECS Standaloneplecs.exe

PLECS

Ctrl+N
PLECS

dd
diodediode

37

Simulation of Power Electronic Circuits at System Level

PLECS

R1L1C1
DCV_dc
Vm1
PLECS Scope
PLECS

Ctrl

Ctrl
RCtrlF
/CtrlI/

38

Simulation of Power Electronic Circuits at System Level

Ctrl

PLECS

RLC
DC10 V10 10 mH
100 F

39

Simulation of Power Electronic Circuits at System Level

PLECS
SI
PLECSRLC
PLECS
Ctrl+E0.02

1e-4
PLECSCtrl+TPLECS
Scope

PLECSAuto

40

Simulation of Power Electronic Circuits at System Level

RLC10V25Hz50%

VRLCPulse Generator

Pulse Generator
V

DCV_dcVPulse Generator

PLECS Probe
PLECS ProbePLECS

41

Simulation of Power Electronic Circuits at System Level

PLECS PLECS Probe

PLECSL1

PLECS Probe PLECS

/VNm

PLECS
PLECS Probe

RLCPLECSRLC

Cntl+G
Cntl+G
RLC
PLECS/
RLC

42

Simulation of Power Electronic Circuits at System Level

Pulse Generator
Pulse Generator
High-state 10Hz25Hz50

Pulse Generator
RLC
Signal Multiplexer
PLECS Scope
PLECS Scope 2

/
RLC
0.1

PLECS Scope

PLECS Scope

43

Simulation of Power Electronic Circuits at System Level

PLECS 2.2
PLECS StandaloneDC-DC
PLECS Blockset Version 3.3 OSWindows
DC-DC
PLECS

PLECS

DC/DC
DC/DC
25 mH220 F2

Ctrl+N

PLECS

Circuit

44

Simulation of Power Electronic Circuits at System Level

R1L1C1
V
Vm1Am1
S1
D1
In1Out1

DC/DC
0
/

di/dt

45

Simulation of Power Electronic Circuits at System Level

2 25 mH
220 F

DC/DC
PLECS

46

Simulation of Power Electronic Circuits at System Level

ConstantStep
Sum
Relay
Signal MultiplexerPLECS Scope
PLECS

DC/DC
6V0.2V
0.0512V8V

47

Simulation of Power Electronic Circuits at System Level

Constant6
Sum| + -
+-V
Relay0.2-0.2

Constant12
Sum+ | -
+-
Step0.054

Single MultiplexerPLECS
Scope
PLECS
Ctrl+E
0.1

PLECSCtrl+TPLECS
Scope/

48

Simulation of Power Electronic Circuits at System Level

PLECS TIPS
PLECS
PLECS Version 3.3 OSWindows
PLECS

PLECSPLECS ScopeGUI
PLECS PLECS

PLECS
GUI
OS
EnglishGUI
JapaneseGUI
PLECS
ANSI American National Standards Institute
DIN Deutsche Industrie Normen

DIN

ANSI

PLECS/

49

Simulation of Power Electronic Circuits at System Level

PLECS

PC1/3

1/332OS
500MB

PLECS
PLECS StandalonePLECS

XML-RPCPLECS Standalone
XML-RPC

1080XML-RPC
PLECSXML-RPC

50

Simulation of Power Electronic Circuits at System Level

PLECS PLECS Blockset


PLECS Extra Libray
Simulink*.mdlSimulink
MATLAB

ulib.mdl 1

PLECS PLECS Standalone


PLECS*.plecsSimulink
*.mdl

ulib.plecs ulib.mdl 1

51

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS*.xml

C: PLECS_Thermal_Library

PLECS
PLECS
PLECS

PLECS

52

Simulation of Power Electronic Circuits at System Level

53

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS

54

Simulation of Power Electronic Circuits at System Level

Sub

55

Simulation of Power Electronic Circuits at System Level

Shift

56

Simulation of Power Electronic Circuits at System Level

PLECS

57

Simulation of Power Electronic Circuits at System Level

text(x, y, text, fontsize)


text(0, 0, '', 14)

line(xvec, yvec)
line([0, 3, -18], [16, 16, 16])

patch(xvec, yvec)
patch([11, 14, 7.5, 11], [7.5, 12, 12, 7.5])

circle(x, y, r)
circle(11, -10, 3)

image(xvec, yvec, imread(filename) [, on])


image([-21 21], [-21 21], imread('C:plecsicon flyback.tif'))

color(r, g, b) RGB 0255


color(255, 0, 0)

* ???

58

Simulation of Power Electronic Circuits at System Level

Vf_d

EditCombo BoxCheck BoxThermal

MATLAB

** PLECS Blockset

59

Simulation of Power Electronic Circuits at System Level

&
PLECS 1.1PLECS Blockset
RLC PLECS 2.1PLECS Standalone RLC

60

Simulation of Power Electronic Circuits at System Level

PLECS

61

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS
PLECSGUI
PLECS
PLECS

62

Simulation of Power Electronic Circuits at System Level


OK

PLECS

63

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Blockset Version 3.3 OSWindows
PLECS BlocksetExtrasPLECS Library

GUI
PLECS Library
SimulinkGUIPLECS
ExtrasLibrary

PLECS Library

Extras

* Simulink

PLECS Standalone Standalone *.plecs Blockset *.mdl


PLECS PLECS

64

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECSPLECS


PLECSGUI

65

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS ViewerPLECS Blockset
PLECS BlocksetSimulinkPLECS
ViewerMATLAB/SimulinkPLECS
ViewerPLECS Viewer
PLECS PLECS Viewer
PLECS Viewer

PLECS BlocksetmdlPLECS Standalone


PLECS StandalonePLECS BlocksetPLECSmdl
PLECS
mdl

PLECSSVGPDF
PLECS

JPEGTIFFPNGGIF
PNG

dpi
PDF

66

Simulation of Power Electronic Circuits at System Level

PLECS Probe
PLECS Version 3.3 OSWindows
PLECSPLECS Probe
PLECS ProbeSimulink()

()PLECS Probe
Simulink
PLECS Scope

SimulinkPLECS ProbePLECSPLECS
ProbeSimulink

PLECS

67

Simulation of Power Electronic Circuits at System Level


PLECSL1R1
PLECSCircuitBuck_Conv

CtrlShift

PLECSPLECS ProbePLECS Probe


&

PLECSPLECS Probe
1. PLECS ProbePLECS
PLECS
2. PLECS ProbePLECS

3. PLECS ProbePLECSPLECS

PLECS BlocksetSimulinkPLECS ProbeSimulink


PLECS
PLECS

PLECS Probe

68

Simulation of Power Electronic Circuits at System Level

PLECS Scope
PLECS Version 3.3 OSWindows
PLECSPLECS ScopeSimulink Scope
Simulink

RMS

SimulinkPLECS Scope
PLECSPLECS
ScopeSimulink

PLECSPLECS Scope
PLECS ScopePLECS

69

Simulation of Power Electronic Circuits at System Level

PLECS ScopePLECS Scope

PLECS ScopePLECS Scope


70

Simulation of Power Electronic Circuits at System Level

Y
Y
YY
Y

71

Simulation of Power Electronic Circuits at System Level

PLECS Scope
PLECS Scope

RMS

12

RMS
THD

RMS

72

Simulation of Power Electronic Circuits at System Level

PLECS

PLECS Scope

PLECS Scope
PLECS Scope/

73

Simulation of Power Electronic Circuits at System Level

PLECS Scope
PLECS

74

Simulation of Power Electronic Circuits at System Level

PLECS Scope
/

XY
XY1

PLECS Scope
PLECS Scope

75

Simulation of Power Electronic Circuits at System Level

XY

XY

/
PLECS ScopePDF/

PDF

PDFPS

PDFPS
A5/A4/A3/A2/A1

//
///

PDF

PDF

76

Simulation of Power Electronic Circuits at System Level

mm/cm/inch/point/ pixel

dpi 72/150/300/600
1100

CSV CSV

PLECS
PLECS Version 3.3 OSWindows
PLECSPLECS Scope

77

Simulation of Power Electronic Circuits at System Level

PLECS

T PLECS Scope
T n T n/f0

PLECS Scope
2

1
PLECS Scope

PLECS Scope
PLECS Scope

N f0

78

Simulation of Power Electronic Circuits at System Level

PLECS Scope
X

1
dB



PLECS Scope

79

Simulation of Power Electronic Circuits at System Level

PLECSTm

F ( n)

j0 nt
j0 nt
2
2
f
(
t
)
e
dt

f
(
t
)
e
dt

m
T T
T m Tm

f m (t ) amt bm

f m (t ) bm

FFT

PLECS XY
PLECS Version 3.3 OSWindows
PLECS X Y XY
XY

XY
XY

80

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS Blockset
PLECS BlocksetMATLAB/SimulinkToolbox
SimulinkPLECS Blockset
SimulinkS-Function

PLECS BlocksetSimulink

PLECS Blockset
PLECS

81

Simulation of Power Electronic Circuits at System Level

GTO
Vf

1e-3
0

Stiff System

Vf Ron


PLECS

PLECS BlocksetSimulinkODE
PLECS
SimulinkODESimulink

SimulinkODESimulinkode45

Stiff
ode15sode23tbStiff

PLECS Blockset
Forward Euler
method

82

Simulation of Power Electronic Circuits at System Level

Simulink
auto-1Simulink
PLECS Blockset

t
1
1

PLECS Blockset

PLECS Blockset Simulink

1e-9

1e-3 1e-6

83

Simulation of Power Electronic Circuits at System Level

Simulink

Simulink
PLECS Blockset

PLECS BlocksetSimulink

PLECS Blockset

84

Simulation of Power Electronic Circuits at System Level

Real-Time Workshop rsim


SimulinkReal-Time Workshop
C
CReal-Time Workshop
PLECS Standalone
PLECS Standalone
PLECS Standalone

PLECS Standalone

Ctrl + E

85

Simulation of Power Electronic Circuits at System Level

PLECS Standalone /

DOPRInon-stiff
Dormand-Prince 5Runge-Kutta

non-stiff

stiff
non-stiff
PLECS Standalone
DOPRIstiff
stiff

RADAUstiff
Radaua 35Runge-Kutta

stiff
non-stiff
DOPRI

PLECS Standalone
PLECS
Forward Euler method

linear interpolation method

86

Simulation of Power Electronic Circuits at System Level

Scope
1e-3

auto

auto
/
1e-3auto
erri rtol|xi| + atoli

auto

r-1

87

Simulation of Power Electronic Circuits at System Level

PLECS Blockset

88

Simulation of Power Electronic Circuits at System Level

3


/

//


MATLAB

89

Simulation of Power Electronic Circuits at System Level

PLECS

PLECS

PLECS
PLECS Version 3.3
PLECS

RC

90

Simulation of Power Electronic Circuits at System Level

0J/K

PLECS
PLECS Version 3.3
2

PLECS 2 3

v Vf Ron i
VfRoni

PLECS v Von i,T


PLECS GUI
2

91

Simulation of Power Electronic Circuits at System Level

0V
GUI

* PLECS

92

Simulation of Power Electronic Circuits at System Level

IGBT

1 Vce
ic
E

PLECS /

E Eon vblock, ion, TE Eoff vblock, ion, T


PLECS GUI /3

0J

93

Simulation of Power Electronic Circuits at System Level

* PLECS

GTOGTO
IGBT

IGBT
IGCTIGCTMOSFET
MOSFET
TRIACSR
PLECS

i 2R v 2R

94

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3
PLECS

Ambient

95

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS
2

MATLAB

PLECS

MATLAB
MATLAB
MATLAB

96

Simulation of Power Electronic Circuits at System Level

thlosses = file:C:/Thermal/Vendor/mydiode.xml

*.xml
C:/Thermal/
thlosses = file: Vendor/mydiode
MATLAB
PLECS VonEonEoff CauerChain
MATLAB
Von 2 i

T
iT v

EonEoff 3
i
T
viTv
E
CauerChain RC R C

MATLAB

97

Simulation of Power Electronic Circuits at System Level

von.i = [0 5 15 35 50];
von.T = [25 125];
von.v = [[0.8 1.3 1.7 2.3 2.7]' [0.6 1.1 1.6 2.6 3.2]'];
eon.v = [0 200 300];
eon.i = [0 13 23 32 50];
eon.T = [25 125];
eon.E = 1e-3 * ...
[0.000 0.000 0.000 0.000 0.000
0.000 0.167 0.333 0.500 1.333
0.000 0.250 0.500 0.750 1.700];
eon.E(:,:,2) = 1e-3 * ...
[0.000 0.000 0.000 0.000 0.000
0.000 0.333 0.667 1.000 2.267
0.000 0.500 1.000 1.500 3.400];
cc.C = [0.95 2.4];
cc.R = [0.118 0.172];
thLosses = struct('Von', von, 'Eon', eon, 'Eoff', 0, ...
'CauerChain', cc);
PLECS Blockset MATLAB

98

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS
GUI
PLECS
PLECS

PLECS

PLECS GUI

LAN
PLECS

PLECS
*.xmlPLECS
PLECS GUI

*.xml

99

Simulation of Power Electronic Circuits at System Level

PLECS

PLECS
*.xmlSimulink/PLECS *.mdl
*.plecsSimulink
_plecs
Simulink plThermal.mdl
PLECS plThermal.plecs
plThermal_plecs

PLECS 1.x

100

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS

PLECS

RC

IGBT IGBT

101

Simulation of Power Electronic Circuits at System Level

/ 3

PLECS

GUI 3D

102

Simulation of Power Electronic Circuits at System Level

2
PLECS

GUI 2D

RC

RC Cauer Foster

103

Simulation of Power Electronic Circuits at System Level

RC Cauer
Cauer RC
nRiCi

RC Foster
Foster RC
nRii

Foster Cauer
Foster RC Cauer RC

PLECS Cauer RC
Foster RC Cauer
RC RC RC
Case
RC

104

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows

++

t2

t1

t
V

t = t1 t = t2
PLECS
-+
/
-+

105

Simulation of Power Electronic Circuits at System Level

t1 t t2
+
++

PLECS IGBT

++

+---


IGBT
Diode

3D SW/

106

Simulation of Power Electronic Circuits at System Level

SW

107

V
I
V
I

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Blockset 3.3 OSWindows

PLECSIGBT

IGBT
plThermal

IGBT DC-DC
10kHz


PLECS

PLECS

PLECS
(R)C RC

108

Simulation of Power Electronic Circuits at System Level

PLECS

K
J
W
J/K
K/W

V
C
A
F

PLECS
0

RC

PLECS
DC-DC R5
L1.2e-3C100e-6V500IGBT Simulink Pulse Generator
10kHz0.02

25
0.01J/K
0.29K/W

109

Simulation of Power Electronic Circuits at System Level

IGBT
PLECS Probe

IGBT
plThermal.mdlPLECS
demos plThermal_plecs

IGBT
76

110

Simulation of Power Electronic Circuits at System Level

-600V
-500V
0V

-600V
-500V
0V

25
120

0A
0
0

25mJ
0A
5A
8A
10A
15A
0
0.18
0.21
0.26
0.27
0
0.14
0.17
0.2
0.21
0
0
0
0
0
125mJ
0A
5A
8A
10A
15A
0
0.4
0.53
0.66
0.78
0
0.34
0.44
0.55
0.62
0
0
0
0
0

0.1A
0.6
0.36

V
0.8A
2.5A
4A
1.14
1.53
1.73
0.67
0.94
1.11

111

20A
2.75
2.11

Simulation of Power Electronic Circuits at System Level

RC

25
0J/K
RC [0.118 0.172] (K/W)[0.95 2.4] (J/K)
1 IGBT

97

112

Simulation of Power Electronic Circuits at System Level

PLECS
RC

R0.5 (K/W)C0.001 (J/K)

PLECS Probe
PLECS Scope
152

10

1 PC
PLECS

steady-state analysis

10kHz
5

113

Simulation of Power Electronic Circuits at System Level

System period length1/10e3Show steady-state cycles5

Start analysis

115
170

114

Simulation of Power Electronic Circuits at System Level

PLECS

RC

309W

115

Simulation of Power Electronic Circuits at System Level

PLECS WJ
Simulink

Simulink

PLECS Probe Simulink


Display
105W

PLECS Standalone
PLECS Demo Thermal

116

Simulation of Power Electronic Circuits at System Level

PLECS
,,

PLECS

(:2)

L1 L2 Lm Rfe
R1 R2

117

Simulation of Power Electronic Circuits at System Level

F(MMF) v i

F
v i

v N

dt
i

F
N

N ODE

1
N

vdt

PLECS

(DAE)
ODE
Stiff()

118

Simulation of Power Electronic Circuits at System Level

()()
F

dF

dt


0 r
l

-7

0 410 N/A2 r A l
()

P
F
loss

/
N

v N

F
N

i)(v F)
(

R N PLECS

119

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS
/

(t),

dt

dF

dt

dt
dF

F dt
d
(t) dt (t)
(t)
k
n

k 1

: tot(F) = /F
: diff (F) = d/dF


: tot(F)

dt

dF

tot F )

dt

tot

tot

tot

F
dt
d tot dF
tot

F
dt
dF
dt
dt
dF

dF

tot

dF

dF
dt

120

Simulation of Power Electronic Circuits at System Level

(t )

d
dt

(t )

tot

tot F

dF
0

dt

d dF

dF dt

diff

diff

(F)

dF

dt

d
dt

(t )

(t )

diff
0

()
coth

B B

coth 3H
sat
a


3H
a

H
sat
coth Bsata.satsat 3

H B
dB
dH

tanh2 H / a 1 a

sat
2 H / a
2
a
tanh
H

sat

= BA F = H :

diff

S. El-Hamamsy and E. Chang, Magnetics modeling for computer-aided design of power


electronics circuits, in Power Electronics Specialists Conference, vol. 2, pp. 635645, 1989.
R. W. Buntenbach, Improved circuit models for inductors wound on dissipative magnetic
cores, in Proc. 2nd Asilomar Conf. Circuits Syst., Pacific Grove, CA, Oct. 1968, pp. 229236
(IEEE Publ. No. 68C64-ASIL).
R. W. Buntenbach, Analogs between magnetic and electrical circuits, in Electron. Products,
vol. 12, pp. 108113, 1969.
D. Hamill, Lumped equivalent circuits of magnetic components: the gyratorcapacitor
approach, in IEEE Transactions on Power Electronics, vol. 8, pp. 97103, 1993.
D. Hamill, Gyrator-capacitor modeling: A better way of understanding magnetic
components, in APEC Conference Proceedings pp. 326332, 1994.

121

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS
PLECS 3.3 OSWindows

-
kHz0.001

PLECS Steady-State Analysis

PLECSBroyden

f ( x) x FT ( x)
x FT (x) T
f(x)FT (x) T

xk 1 xk J k1 f ( xk )

Jk

f ( x)
x

xk

rtol

X k ;1 X k
Xk

rtol

fi (X )
max xi ( )

122

rtol

i1n

Simulation of Power Electronic Circuits at System Level

PLECS
1

1 /

J0

/ 1

n+
n
PLECS

Simulink
PLECS Blockset

Integrator
PLECS Blockset
PLECS Blockset InitialStateplsteadystate

Simulink

Simulink
MemoryRelayTransport DelayVariable Transport Delay

123

Simulation of Power Electronic Circuits at System Level

PLECS Standalone
PLECS Standalone

...

124

Simulation of Power Electronic Circuits at System Level

PLECS Standalone

tstart
tstartT + tstart0

1e-4

20

1e-4

125

Simulation of Power Electronic Circuits at System Level

PLECS Blockset
Steady-State AnalysisPLECS Extars

plsteadystate
GUI

TimeSpan

TStart

Tolerance

MaxIter

Display

HideScopes
HiddenStates

FinalStateName

NCycles

JPert
JacobianCalculation

System period length / Max simulation time span

Simulation start time

Termination tolerance

Max number of iterations


MALTLAB
iterationfinaloff

Display level
GUI

error warningnone

Hidden model states


MATLAB

Steady-state variable

Show steady-state cycles

fullfastfast

126

Simulation of Power Electronic Circuits at System Level

Start analysis

PLECS Blockset GUI


MATLAB
mymodelPLECS Steady state
plsteadystate(mymodel/Steady State);
01MATLABx0x1

plsteadystate(mymodel/Steady State, TStart, 0, FinalStateName, x0);


plsteadystate(mymodel/Steady State, TStart, 1, FinalStateName, x1);

D. Maksimovic, "Automated steady-state analysis of switching power converters using a


general-purpose simulation tool", Proc. IEEE Power Electronics, Specialists Conference,
June 1997, pp. 1352-1358.

127

Simulation of Power Electronic Circuits at System Level

PLECS AC
PLECS Version 3.3 OSWindows
PLECS
PLECS Blockset AC
2 AC SweepAC
-
Loop-Gain Analysis

PLECSAC

PLECS
1

PLECS Standalone AC
PLECS Standalone AC

128

Simulation of Power Electronic Circuits at System Level

PLECS Standalone AC

tstart
tstartT + tstart0

21

[100 50e3]
100Hz 50kHz

[800:50:1100 1200:100:1400]
800Hz 1100Hz 50Hz 1200Hz 1400Hz 100Hz

PLECS Standalone

129

Simulation of Power Electronic Circuits at System Level

PLECS BlocksetAC
AC placsweep
GUI
GUI
MATLAB set_param

TimeSpan

TStart

FreqRange

FreqScale

NPoints

InitialAmplitude

Method

System period length

Simulation start time

Frequency sweep range


linearlogarithmic

Frequency sweep scale

Number of points

Amplitude at first freq

Brute force simulation start from model initial state


Brute force simulation start from unperturbed steady state
Steadystate analysis start from model initial state
Steadystate analysis start from unperturbed steady state

Tolerance

MaxIter

Display

HideScopes
HiddenStates

Method drop-down

Termination tolerance

Max number of iterations


MALTLAB
iterationfinaloff

Display level
GUI

error warningnone

130

Simulation of Power Electronic Circuits at System Level

Hidden model states

OutputName

BodePlot

JPert

MATLAB

Output variable
onoff

Plot Bode diagram

Start analysis

PLECS Blockset AC GUI


MATLAB
mymodelPLECS AC Sweep
placsweep(mymodel/AC Sweep);
01MATLABT0T1

placsweep(mymodel/AC Sweep, TStart, 0, OutputName, T0);


placsweep(mymodel/AC Sweep, TStart, 1, utputName, T1);

131

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS
Impulse Response Analysis
AC

PLECS
1

PLECS Standalone
PLECS Standalone

PLECS Standalone
PLECS Standalone AC

132

Simulation of Power Electronic Circuits at System Level

PLECS Blockset :

Compensation GUI
Compensation for discrete pulse
discrete pulsePWM

external reference
Impulse Response Analysis 2

none
PLECS Blockset
plimpulseresponse
GUI
GUI
MATLAB set_param

TimeSpan

TStart

FreqRange

FreqScale

NPoints

System period length

Simulation start time

Frequency sweep range


linearlogarithmic

Frequency sweep scale

Number of points

133

Simulation of Power Electronic Circuits at System Level

Perturbation

Compensation

Tolerance

MaxIter

Display

HideScopes
HiddenStates

OutputName

BodePlot

JPert

Amplitude at first freq

nonediscrete pulseexternal reference

Compensation for discrete pulse

Termination tolerance

Max number of iterations


MALTLAB
iterationfinaloff

Display level
GUI

error warningnone

Hidden model states


MATLAB

Output variable
onoff

Plot Bode diagram

134

Simulation of Power Electronic Circuits at System Level

Start analysis

PLECS Blockset GUI


MATLAB
mymodelPLECS Impulse Resp
plimpulseresponse(mymodel/Impulse Resp);
01MATLABT0T1

plimpulseresponse(mymodel/Impulse Resp, TStart, 0, OutputName, T0);


plimpulseresponse(mymodel/Impulse Resp, TStart, 1, utputName, T1);

135

Simulation of Power Electronic Circuits at System Level

PLECS
PLECS Version 3.3 OSWindows
PLECS

PLECS

names MATLAB/Octave
PLECS PLECS
PLECS
names = plecs(get, PLECS , StateSpaceOrder);
MATLAB/Octave PLECS

PLECS /

plecs(set, PLECS , SwitchVector, );

[1 0][0 1]
PLECS
t = plecs(get, PLECS , Topology);
t
ABCDI
I

PLECS Standalone XML-RPC

136

Simulation of Power Electronic Circuits at System Level

PLECS Blockset

MATLAB

Simulink test.mdlPLECS Circuit


>> load_system test %
>> open_system test %openopen test
>> name = plecs('get', 'test/Circuit', 'StateSpaceOrder');
>> plecs('set', 'test/Circuit', 'SwitchVector', [1 0] );
>> t =

plecs('get', 'test/Circuit', 'Topology');

PLECS Standalone

test.plecs
circuit = plecs('get', '', 'CurrentCircuit'); %
names = plecs('get',circuit, 'StateSpaceOrder');
plecs('set', circuit, 'SwitchVector', [1 0]);
t = plecs('get', circuit, 'Topology');

137

Simulation of Power Electronic Circuits at System Level

PLECS Standalone
PLECS Standalone Version 3.3 OSWindows
PLECS StandaloneDemo Analysis ToolsBuckOpenLoop.plecs
DC-DC

DC-DC15/28100kHz

T1/100kHz10-5s

DC-DC
Steady State Analysis
PLECS Scope

-
-
m
DC-DC
vo
AC Control to Output TF (AC Sweep)
AC 100Hz
50kHz 21
800Hz1400Hz

138

Simulation of Power Electronic Circuits at System Level

Control to Output TF (Impulse)

DC-DC
i
DC-DC
vo-
AC

PLECS StandaloneDemo Loop Gain Analysis Tools


BuckClosedLoop.plecsDC-DC

DC-DC 15V
PIDPWM

139

Simulation of Power Electronic Circuits at System Level

Loop Gain Mter


Loop Gain Mter

Closed Loop Gain AC


100Hz 500kHz
21

140

Simulation of Power Electronic Circuits at System Level

PLECS Blocset
PLECS Blockset Version 3.3 OSWindows
100kHzDC-DCPLECS

5A15V

R.F.Erickson
Fundamentals of Power Electronics, 2nd Edition9Controller Design
PLECS

plBuckSweepplBuckLoopplBuckImpulseResponse

Vout / Vsrc = 15V / 28V


PLECS
Steady-State-Analysis

PLECS Extras Analysis Tools


Steady-State-AnalysisSimulink

141

Simulation of Power Electronic Circuits at System Level

System period length1e-5Show steady-state cycles10

Start analysis

Start analysis Scope


10

AC
-

AC-SweepAC Simulink
Simulink

AC v_load
m_ac

142

Simulation of Power Electronic Circuits at System Level

Amplitude at first freq2/1000


1e-3 AC 100Hz 50kHz
800Hz 1200Hz 50Hz
Frequency sweep range:[100 800:50:1200 50000]

Start analysis

LC ) 1kHz
f0 = 1 / (2

143

G0 = 28V 29dB

Simulation of Power Electronic Circuits at System Level

AC

AC

AC
i_acAC

AC v_load
i_ac
5 Amplitude at first freq:
1e-2

Start analysis

144

Simulation of Power Electronic Circuits at System Level

PLECS
Impulse Response Analysis

10Hz-50kHz
300
external reference
discrete pulse

Compensation for discrete pulse external reference

145

Simulation of Power Electronic Circuits at System Level

Compensation for discrete pulse discrete pulse

AC

146

Simulation of Power Electronic Circuits at System Level

PID fc=5kHz
-180
1652

PD
fz
/
fp /G0 0.3
fz = 1.7kHzfp = 14.5kHzDC k = (fc / f0)
PI
-fZ = 500kHz
Saturation 0.10.9
windup PI

PID

PD

PI

147

Simulation of Power Electronic Circuits at System Level

Loop Gain Analysis

15V Amplitude at first freq:


1e-2

Start analysis

148

Simulation of Power Electronic Circuits at System Level

PID

PLECS
plSSADemo.m PLECS
Demos
CCM AC DC

d ~
~ (t )
x (t ) A ~
x (t ) B u~(t ) ( A1 A2) x ( B1 B 2)u m
dt
~
~(t )
y (t ) C ~
x (t ) D u~(t ) (C1 C 2) x ( D1 D2)u m
~ (t ) x u y m AC
x (t ) u~(t ) ~
y (t ) m
~

149

Simulation of Power Electronic Circuits at System Level

A B C D

A mA1 (1 m)A2
B mB1 (1 m)B2
C mC1 (1 m)C2
D mD1 (1 m)D2
1
2
PLECS MATLAB A1A2

AC MATLAB

load system('plBuckSweep');
names = plecs('get', 'plBuckSweep/Circuit', 'StateSpaceOrder');
names.Switches
MATLAB
ans =
'Circuit/FET'
'Circuit/D'
2

plecs('set', 'plBuckSweep/Circuit', 'SwitchVector', [1 0]);


t1 = plecs('get', 'plBuckSweep/Circuit', 'Topology');
plecs('set', 'plBuckSweep/Circuit', 'SwitchVector', [0 1]);
t2 = plecs('get', 'plBuckSweep/Circuit', 'Topology');
MATLAB
m = 15/28;
A = t1.A*m + t2.A*(1-m);
B = t1.B*m + t2.B*(1-m);
C = t1.C*m + t2.C*(1-m);
D = t1.D*m + t2.D*(1-m);

I_acVm

~
Y(s)
1
~ C (sI A) B D
U(s)

150

Simulation of Power Electronic Circuits at System Level

MIMO(multi-input multi-output)

namesInputsOutputs

MATLAB
names.Inputs
MATLAB
ans =
'Circuit/V_dc'
'Circuit/I_ac'
MATLAB

names.Outputs
MATLAB
ans =
'Circuit/Vm'
'Circuit/Am'
'Circuit/FET'
'Circuit/FET'
'Circuit/D'
'Circuit/D'

2Circuit/I_ac
1Circuit/Vm

MATLAB Control System Toolbox

bode(ss(A,B(:,2),C(1,:),D(1,2)), {2*pi*100, 2*pi*50000})


Control System Toolbox MATLAB
M-plSSADemo.m

151

Simulation of Power Electronic Circuits at System Level

~
- AC m
AC

~
Y(s)
C (sI A ) 1 B D
~
M(s)

A A
B {(A1 A 2 )A 1 B (B1 B2 )}u
C C
D {(C1 C2 )A 1 B (D1 D2 )}u
~ 1 B D u
m

DC AC

u = [28 ; 0];
B_co = ( - (t1.A-t2.A)*(A/B)+(t1.B-t2.B))*u;
D_co = ( - (t1.C-t2.C)*(A/B)+(t1.D-t2.D))*u;
bode(ss(A,B_co,C(1,:),D_co(1)), {2*pi*100, 2*pi*50000})

MATLAB bode Control System Toolbox


-

R.W. Erickson, D. Maksimovic, "Fundamentals of Power Electronics, 2ndEd.", Kluwer


Academic Publishers, 2003.

152

Simulation of Power Electronic Circuits at System Level

PLECS C
C
PLECS Version 3.3 OSWindows
PLECSCC-ScriptC
C
C-Script

CC-Script

C
DSP

PLECSCC-ScriptC
PLECS

C
C C-Script
PLECS
C
C C-Script C
uyxc,xd

y f output(t , u, xc , xd )

xdnext f update(t , u, xc , xd )
xc f derivative(t , u, xc , xd )
C C-Script
/
1 C

153

Simulation of Power Electronic Circuits at System Level

Start Function
C /
ContState(i)DiscState(i)

Output Function
/

Input(i)Output(i)CurrentTime
C
C-ScriptC

PLECS
/

IsMajorStep

Update Function
Update Function
CC-Script

DiscState
Derivative Function
CC-Script
ContDeriv

Terminate Function

Memory

154

Simulation of Power Electronic Circuits at System Level

Code Declarations
/CC-Script
Cmath.hstdio.h

C
C

#include <C>C

CC-Script

/
-

-
-C
-
Output Function-ZCSignal(i)
/
-
-1

ZCSignal(0) = Input(0) - 1.;


-0.91.23

-
C
C-Script

NextSampleHit

155

Simulation of Power Electronic Circuits at System Level

Dormand-Prince6
5
1

piecswise smooth function1

CC-Script

piecswise smooth function


Output
Function
if (IsMajorStep)
{
if (Input(0) >= 1.)
Output(0) = 1.;
else
Output(0) = 0.;
}
ZCSignal(0) = Input(0) - 1.;
if (IsMajorStep)

CC-Script/

0[0,0]
/

156

Simulation of Power Electronic Circuits at System Level

[0,-1]

-
-Tp
[Tp,To]
Tp
To0ToTpTo0
/nTp+Ton
-
--2[-2,0]

NextSampleHit
/
NextSampleHit

-Start
Functionfirst sample hit
CurrentTime

PLECS Blockset-Simulink
--

PLECS Standalone

n2

0.50.1[0, 0; 0.5,0.1]

IsSampleHit(i)/

IsSampleHit(i)i

157

Simulation of Power Electronic Circuits at System Level

if (IsSampleHit(1))
{
// this code is only executed at t == n*0.5 + 0.1
}

C-

C
MATLAB
3

NumParameters
ParamNumDims(i)ParamDim(I,j)

ParamRealValue(I,j)
j 3

int rowIdx = 2;
int colIdx = 0;
int pageIdx = 1;
int numRows = ParamDim(0, 0);
int numCols = ParamDim(0, 1);
int elIdx = rowIdx + numRows*(colIdx + numCols*pageIdx);
double value = ParamRealData(0, elIdx);

DMA

158

Simulation of Power Electronic Circuits at System Level

C
C C-Script


C C-Script2

y f output(t , u, xc , xd ) 2 u
CC-Script
/1

0
[0, 0]

Output(0) = 2.*Input(0);
/2


1 1

y f output(t , u, xc , xd ) xd

xdnext f update(t , u, xc , xd ) u

159

Simulation of Power Electronic Circuits at System Level

CC-Script
/11

1[1, 0]

Output(0) = DiscState(0);

DiscState(0) = Input(0);

y f output(t , u, xc , xd ) xc
xc f derivative(t , u, xc , xd ) u

160

Simulation of Power Electronic Circuits at System Level

CC-Script
/11

0[0, 0]

Output(0) = ContState(0);

ContDeriv(0) = Input(0);

20PLL

C C-Script

161

Simulation of Power Electronic Circuits at System Level

CC-Script
/
2-

#define PI 3.141592653589793
if (IsMajorStep)
{
while (ContState(0) >= 2*PI)
ContState(0) -= 2*PI;
while (ContState(0) < 0)
ContState(0) += 2*PI;
}
ZCSignal(0) = ContState(0);
ZCSignal(1) = ContState(0) - 2*PI;
Output(0) = ContState(0);
/2
/
/-
020

-0

ContDeriv(0) = Input(0);

162

Simulation of Power Electronic Circuits at System Level

u 1
1, for

y f output(t , u, xc , xd ) u, for 1 u 1
1, for
1 u

CC-Script
/1
2-

163

Simulation of Power Electronic Circuits at System Level

static enum { NO_LIMIT, LOWER_LIMIT, UPPER_LIMIT } mode;


if (IsMajorStep)
{
if (Input(0) > 1.)
mode = UPPER_LIMIT;
else if (Input(0) < -1.)
mode = LOWER_LIMIT;
else
mode = NO_LIMIT;
}
switch (mode)
{
case NO_LIMIT:
Output(0) = Input(0);
break;
case UPPER_LIMIT:
Output(0) = 1.;
break;
case LOWER_LIMIT:
Output(0) = -1.;
break;
}
ZCSignal(0) = Input(0) + 1.;
ZCSignal(1) = Input(0) - 1.;
1NO_LIMIT
LOWER_LIMITUPPER_LIMIT

011
00

164

Simulation of Power Electronic Circuits at System Level

CC-Script
/1
1
2

[0, 1;-2, 0]

#include <float.h>
#define PREV_INPUT DiscState(0)
#define DELAY ParamRealData(0, 0)
float.hDBL_MAXDBL_EPSILON2
2DiscStateParamRealData

if (NumParameters != 1)
{
SetErrorMessage("delay time");
return;
}
if (ParamNumDims(0) != 2
|| ParamDim(0, 0) != 1 || ParamDim(0, 1) != 1
|| DELAY <= 0.)
{
SetErrorMessage("");
return;
}

165

Simulation of Power Electronic Circuits at System Level

if (Input(0) == 0)
{
Output(0) = 0;
NextSampleHit = DBL_MAX;
}
else if (PREV_INPUT == 0)
{
NextSampleHit = CurrentTime + DELAY;
if (NextSampleHit == CurrentTime)
NextSampleHit = CurrentTime * (1.+DBL_EPSILON);
}
else if (IsSampleHit(1))
{
Output(0) = 1;
NextSampleHit = DBL_MAX;
}
00

001

0
01

if (NextSampleHit == CurrentTime)

15

PREV_INPUT = Input(0);

166

Simulation of Power Electronic Circuits at System Level

C
CC-Script

NumInputs
NumOutputs
NumContStates
NumDiscStates
NumZCSignals
NumParameters

int
int
int
int
int
int

R
R
R
R
R
R

CurrentTime

double

IsMajarStep

int

IsSampleHit (int i)

int

NextSampleHit

double

R/W

Input (int i)

double

Output (int i)

double

R/W

ContState(int i)

double

R/W

ContDeriv(int i)

double

R/W

DiscState(int i)

double

R/W

ZCSignal(int i)

double

R/W

ParamNumDims(int i)

int

ParamDims(int i, j)

int

double

void

ParamRealData(int i, j)

SetErrorMessage(char *msg)

1
0
i1
0

i-
i

ij

ij
j

ParamNumDimsParamDims

return
msg

/
2

double *output = &Output(0); // not recommended


output[1] = 1; // fails
*(output + 1) = 1; // fails
Output(1) = 1; // ok

167

Simulation of Power Electronic Circuits at System Level

PLECS Version 3.3 OSWindows

PLECS BlocksetMATLABSimulink

M-SimulinkMathwaorks
PLECS BlocksetPLECS
PLECS Standalone2

PLECS StandaloneMATLAB

PLECS StandaloneXML-RPCPLECS
XML-RPCPythonRuby
XML-RPC

PLECS StandalonePLECS Standalone

PLECS Blockset
PLECSMATLABPLECS
CLI
CLI
plecs('cmd', ' 1', ' 2', ... )
cmd
get set thermalexport versionhostid

get

plecs( 'get' , '' , '')


PLECS

plecs('get', '')

168

Simulation of Power Electronic Circuits at System Level

MATLAB

Simulink test.mdl
PLECS Circuit
D1
>>

load_system test %

>>

open_system test %openopen test

>>

plecs( 'get' , 'test/Circuit/D1' , 'Vf')

>>

plecs( 'get' , 'test/Circuit/D1')

PLECS CurrentCircuit

>>

plecs( 'get' , ' ' , ' CurrentCircuit')

set

plecs('set', '', '', )

Simulink test.mdl
PLECS Circuit
D1 Vf0.70.5
>>
>>

load_system test
plecs('set', 'test/Circuit/D1', 'Vf', '0.5')

Scope/
Scope
scope
HoldTrace
ScopeScope

plecs( 'scope' , 'Scope ' , 'HoldTrace')


plecs( 'scope' , 'Scope ' , 'HoldTrace' , '')

169

Simulation of Power Electronic Circuits at System Level

ClearTracesScope
Scope
plecs( 'scope' , 'Scope ' , 'ClearTraces')

Simulink test.mdl
PLECS Circuit
PLECS Scope ScopeI_ac_01
>>
>>

load_system test
plecs('scope', 'test/Scope', 'HoldTrace', 'I_ac_01')

thermal,import

plecs('thermal', 'import', valVon, valEon, valEoff)


plecs('thermal', 'import', valVon, val Eon, valEoff, ...
valCauer )
/iT
vEvalEon
valEoff
iT
vvalVon
RCRCvalCauer
SW
PLECS 1.x
PLECS 2.x

MATLAB
MATLAB thermal,export

plecs('thermal', 'export', '')


*.xml
Simulink

*.xml
plecs('thermal', 'export', '', '')

170

Simulation of Power Electronic Circuits at System Level

[]
>> valEon = struct(...
'v', [500 600], ...
'i', [0 5 8 10 15], ...
'T', [25 125], ...
'E', cat(3, [0 .28 .45 .56 .96; 0 .36 .55 .71 1.08], ...
[0 .73 .94 1.17 1.77; 0 .83 1.03 1.34 1.78]) .* 1e-3);
[]
>> valEoff = struct(...
'v', [500 600], ...
'i', [0 5 8 10 15], ...
'T', [25 125], ...
'E', cat(3, [0 .60 .93 1.08 1.36; 0 .79 1.09 1.27 1.63], ...
[0 .62 1.00 1.15 1.43; 0 .8 1.25 1.37 1.82]) .* 1e-3);
[]
>> valVon = struct(...
'i', [0 1.2 4.8 14 18], ...
'T', [82 100 150], ...
'v', [0 0.9 1.39 1.95 2.28; ...
0 0.9 1.34 1.89 2.4; ...
0 0.9 1.54 2.26 2.75]');
[RCCauer]
>> valCauer = struct(...
'C', [0.5243 1.076 44 20.25].*1e-3, ...
'R', [1.756 1.717 0.545 0.094]);
MATLAB
RCCauer

>>

plecs('thermal', 'import', valVon, valEon, valEoff)

>>

plecs('thermal', 'import', valVon, valEon, valEoff, valCauer)

171

Simulation of Power Electronic Circuits at System Level

MATLAB

SimulinkplSMPS_CCM.mdl Demos
SPP20N60C3.xml

>>

plecs('thermal', 'export', 'C:/PLECS/Thermal_Library/Infineon/SPP20N60C3.xml')

>>
>>

load_system plSMPS_CCM
plecs('thermal', 'export', 'Infineon/SPP20N60C3', 'plSMPS_CCM')

PLECS Viewer
PLECS Viewerexport

plecs( 'export' , '')


PLECS Viewer

PLECS
true / false

plecs( 'export' , '' , true / false


PLECS Viewer

plecs( 'export' , '' , true / false , ''

*.mdl

Simulink test.mdl
PLECS Circuit
>>
>>
>>
>>

load_system test
plecs('export', 'test')
plecs('export', 'test', true)
plecs('export', 'test', false, 'C:/test_exported.mdl')

172

Simulation of Power Electronic Circuits at System Level

PLECS version

plecs( 'version' )
MATLAB Host-ID hostid

plecs( 'hostid' )

PLECS 3.3.x
>>

plecs( 'version' )

ans =
3.3.x
>>

plecs( 'hostid' )

ans =
User:
HostID: ID
MATLAB: MATLAB
floating: /1/0

PLECS Standalone
PLECS Standalone

...

173

Simulation of Power Electronic Circuits at System Level

/
/

PLECS Standalone GNU Octave


Octave MATLAB Octave
Octave
http://www.gnu.org/software/octave/doc/interpreter/

PLECS
Octave PLECS

get

plecs( 'get' , '' , '')


PLECS

plecs('get', '')

Octave
PLECS test.plecs
PLECS Circuit
D1
>>

plecs( 'get' , 'test/Circuit/D1' , 'Vf')

>>

plecs( 'get' , 'test/Circuit/D1')

PLECS CurrentCircuit

>>

plecs( 'get' , ' ' , ' CurrentCircuit')

174

Simulation of Power Electronic Circuits at System Level

set

plecs( 'set', '', '', )

PLECS test.plecs
PLECS Circuit
D1 Vf0.70.5
>>

plecs( 'set', 'test/Circuit/D1', 'Vf', '0.5')

Scope/
Scope
scope
HoldTrace
ScopeScope

plecs( 'scope' , 'Scope ' , 'HoldTrace')


plecs( 'scope' , 'Scope ' , 'HoldTrace' , '')
ClearTracesScope
Scope
plecs( 'scope' , 'Scope ' , 'ClearTraces')

simulate
optStruct

plecs( 'simulate')
plecs( 'simulate', optStruct )

analyze

optStruct

175

Simulation of Power Electronic Circuits at System Level

ACFGrGi
FGrGi

plecs( 'analyze', '' )


plecs( 'analyze', '', optStruct )

varLinductorValues
PLECS
BuckParam-Sweep

mdl = plecs('get', '', 'CurrentCircuit');


scope = [mdl '/Scope'];
mdlVars = struct('varL', 50e6);
opts = struct('ModelVars', mdlVars);
plecs('scope',scope, 'ClearTraces');
inductorValues = [50, 100, 200];
for ix = 1:length(inductorValues)
opts.ModelVars.varL=inductorValues(ix) * 1e6;
out = plecs('simulate', opts);
plecs('scope', scope, 'HoldTrace', ...
['L=' mat2str(inductorValues(ix)) 'uH']);
[maxv, maxidx] = max(out.Values(1,:));
printf('Max current for L=%duH: %f at %fsn', ...
inductorValues(ix), maxv, out.Time(maxidx));
end
2 CurrentCircuit

2 varLModelVars
opts

For inductorValuesvarL
out

Octave

176

Simulation of Power Electronic Circuits at System Level

PLECSXML-RPC
XML-RPC XML-RPC
PLECS XML-RPC
PLECS TCP
Python PLECS XML-RPC
import xmlrpclib
server = xmlrpclib.Server("http://localhost:1080/RPC2")
XML-RPC 1080 TCP

XML-RPC PLECS
URL localhost

XML-RPC
XML-RPCplecs.
PythonserverPLECS

server.plecs.load( ".plecs" )
/
XML-RPC

plecs.load( "" )

plecs.close( "" )

get

plecs.get( '' , '')


plecs.get( '')
PLECS

177

Simulation of Power Electronic Circuits at System Level

Python

PLECS test.plecs
PLECS Circuit
D1
plecs.get ( 'test/Circuit/D1' , 'Vf')
plecs.get ( 'test/Circuit/D1')

set

plecs.set( '', '', )

PLECS test.plecs
PLECS Circuit
D1 Vf0.70.5
plecs.set( 'test/Circuit/D1', 'Vf', '0.5')
Scope/
Scope
scope
HoldTrace
ScopeScope

plecs.scope( 'Scope ' , 'HoldTrace')


plecs.scope( 'Scope ' , 'HoldTrace' , '')
ClearTracesScope
Scope
plecs.scope( 'Scope ' , 'ClearTraces')

simulate
optStruct

178

Simulation of Power Electronic Circuits at System Level

plecs.simulate( '')
plecs.simulate( '', optStruct )

simulate

optStruct

ACFGrGi
FGrGi

plecs.simulate( '', '' )


plecs.simulate( '', '', optStruct )

varL
XML-RPC
import xmlrpclib
server = xmlrpclib.Server("http://localhost:1080/RPC2")
server.plecs.load("C:/Models/BuckParamSweep.plecs")
server.plecs.scope('BuckParamSweep/Scope', 'ClearTraces')
opts = {'ModelVars' : { 'varL' : 50e6} }
result = server.plecs.simulate("BuckParamSweep", opts)
server.plecs.scope('BuckParamSweep/Scope',
'HoldTrace', 'L=50uH')
opts['ModelVars']['varL'] = 100e6;
result = server.plecs.simulate("BuckParamSweep", opts)
server.plecs.scope('BuckParamSweep/Scope',
'HoldTrace', 'L=100uH')

179

Simulation of Power Electronic Circuits at System Level

XML-RPC
/optStruct
GUI

optStructModelVars
SolverOpts

AnalysisOpts

ModelVars
ModelVars

plecs.simulate( )
plecs.analyze( )

plecs('simulate')
plecs('analyze')
ModelVars
/

XML-RPC

ModelVars
/

180

Simulation of Power Electronic Circuits at System Level

SolverOpts
SolverOpts

Solver

StartTime
StopTime
MaxStep

InitStep

FixedStep

AbsTol
RelTol
Refine

non-stiff dopri
stiff radau
descrete

181

Simulation of Power Electronic Circuits at System Level

AnalysisOpts
AnalysisOpts

TimeSpan
StartTime
Tolerance
MaxIter
JacobianPerturbation
JacobianCalculation
InitCycles
FrequencyRange
FrequencyScale
AdditionalFreqs
NumPoints
Perturbation
Response
AmplitudeRange
Amplitude

fullfast
fast

AC
AC

182

Simulation of Power Electronic Circuits at System Level

PLECS C PLECS Blockset


PLECS Blockset Version 3.2
PLECS BlocksetSimulinkReal-Time WorkshopC
CPLECSC
PLECS Blockset
C
PLECSRapid SimlationRSimReal-Time
22

RSim

C
PLECS Rsim
PLECS

Real-Time

CANSI

C
C
PLECS

PLECSReal-Time Workshop
RTWTarget
Rapid SimulationRSim
SimulinkRapid AcceleratorReal-Time WorkshopS-Function
RSim
RSimCPLECSRSim

Rapid SimulationRSim

OS
plecs
OS
Windows 32-bit
Windows 64-bit
Mac PPC
Mac Intel
Linux 32-bit
Linux 64-bit

Plecs\bin\win32\plecsrsim.dll
plecs\bin\win64\plecsrsim.dll
plecs/bin/mac/libplecsrsim.dylib
plecs/bin/maci/libplecsrsim.dylib
plecs/bin/glnx86/libplecsrsim.so
plecs/bin/glnxa64/libplecsrsim.so

183

Simulation of Power Electronic Circuits at System Level

Rapid SimulationRSim PLECS


RSimPLECSPC

PLEXIM_LICENSE_FILE

RSimPLECS

PLECSRSimMATLABHost-ID
MATLAB
Rapid SimulationRSim PLECS
PLECS

S-

SimulinkPLECS

PLECSReal-Time Workshop
rsim

PLECS
Real-Time WorkshopUsers Guide

Rapid SimulationRSim PLECS


PLECSRSim

MATLAB
Real-Time Workshop

184

Simulation of Power Electronic Circuits at System Level

Real-Time
Real-Time WorkshopReal-TimeReal-Time
C
PLECS Real-Time CoderReal-Time
C
Real-Time PLECS

DCBLDC
SR

Real-Time
1PLECS32
/

Real-Time
PLECS2nnPLECS

222323PLECS

PLECSRTWTopologies

PLECS10
2101024

//
PLECSC
PLECS

RTWAllowNaturalCommutation

185

Simulation of Power Electronic Circuits at System Level

+-/
-

RTWSuppressStateInconsistencies

RTWTarget

RSimRealTimeAuto
Auto
AutoReal-Time Workshop

RTWTopologies
Real-Time

nn
[ ] PLECS

RTWAllowNaturalCommutation
Real-Time(
)

RTWSuppressStateInconsistencies
Real-Time

RSimInlineCircuitParams
RSim

RSimInlineCircuitParams

Plecsedit (set, PLECS, RTWAllowNaturalCommutation, );


PLECSPLECS Scope
ScopeSimulink

186

Piece-wise Linear Electrical Circuit Simulation

Piece-wise Linear Electrical Circuit Simulation

Electrical systems and power electronics in Simulink

You might also like