electrical engineering software
Plexim GmbH [email protected] www.plexim.comp
lecs U
ser Manual Version 3.4
THE SIMULATION PLATFORM FOR
POWER ELECTRONIC SYSTEMS
User Manual Version 3.5
How to Contact Plexim:
+41 44 533 51 00 Phone%+41 44 533 51 01 Fax
Plexim GmbH Mail)Technoparkstrasse 18005 ZurichSwitzerland
[email protected] Email@http://www.plexim.com Web
PLECS User Manual
20022014 by Plexim GmbH
The software PLECS described in this manual is furnished under a licenseagreement. The software may be used or copied only under the terms of thelicense agreement. No part of this manual may be photocopied or reproducedin any form without prior written consent from Plexim GmbH.
PLECS is a registered trademark of Plexim GmbH. MATLAB, Simulink andSimulink Coder are registered trademarks of The MathWorks, Inc. Otherproduct or brand names are trademarks or registered trademarks of their re-spective holders.
Contents
Contents iii
Before You Begin 1
Installing the PLECS Blockset . . . . . . . . . . . . . . . . . . . . . . . . 1
Automatic Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Manual Installation on Microsoft Windows . . . . . . . . . . . . . . 1
Manual Installation on Mac OS X / Linux . . . . . . . . . . . . . . . 2
Configuring PLECS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installing Different Versions of the PLECS Blockset in Parallel . . 3
Uninstalling the PLECS Blockset . . . . . . . . . . . . . . . . . . . 3
Installing PLECS Standalone . . . . . . . . . . . . . . . . . . . . . . . . . 5
Installation on Microsoft Windows . . . . . . . . . . . . . . . . . . . 5
Installation on Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . 5
Installation on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Whats New in Version 3.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Major New Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Further Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Network Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Contents
1 Getting Started 9Getting Started with the PLECS Blockset . . . . . . . . . . . . . . . . . 9
A Simple Passive Network . . . . . . . . . . . . . . . . . . . . . . . . 9
Buck Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Getting Started with PLECS Standalone . . . . . . . . . . . . . . . . . . 18
A Simple Passive Network . . . . . . . . . . . . . . . . . . . . . . . . 18
Buck Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2 How PLECS Works 25Modeling Dynamic Systems . . . . . . . . . . . . . . . . . . . . . . . . . . 25
System Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Physical Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Simulating Dynamic Systems . . . . . . . . . . . . . . . . . . . . . . . . . 27
Model Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Model Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Fixed-Step Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Sampled Data Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Sample Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Sample Time Inheritance . . . . . . . . . . . . . . . . . . . . . . . . 35
Multirate Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3 Using PLECS 39Configuring PLECS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Thermal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Scope Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Creating a New Circuit with the PLECS Blockset . . . . . . . . . . . . . 42
iv
Contents
Customizing the Circuit Block . . . . . . . . . . . . . . . . . . . . . 42
Using the Library Browser . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Specifying Component Parameters . . . . . . . . . . . . . . . . . . . 45
Displaying Parameters in the Schematic . . . . . . . . . . . . . . . 46
Changing Parameters of Multiple Components . . . . . . . . . . . . 46
Changing Parameters During a Simulation . . . . . . . . . . . . . . 46
Changing Component Names . . . . . . . . . . . . . . . . . . . . . . 47
Changing the Orientation of Components . . . . . . . . . . . . . . . 47
Getting Component Help . . . . . . . . . . . . . . . . . . . . . . . . . 47
Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Creating a New Library in PLECS Blockset . . . . . . . . . . . . . 48
Creating a New Library in PLECS Standalone . . . . . . . . . . . . 48
Creating a Library Reference . . . . . . . . . . . . . . . . . . . . . . 48
Updating a Library Reference . . . . . . . . . . . . . . . . . . . . . . 49
Breaking a Library Reference . . . . . . . . . . . . . . . . . . . . . . 49
Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Wires . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Creating Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Creating a Subsystem by Adding the Subsystem Block . . . . . . . 51
Creating a Subsystem by Grouping Existing Blocks . . . . . . . . . 51
Arranging Subsystem Terminals . . . . . . . . . . . . . . . . . . . . 52
Resizing a Subsystem Block . . . . . . . . . . . . . . . . . . . . . . . 52
Placing the Subsystem Label . . . . . . . . . . . . . . . . . . . . . . 53
Masking Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Mask Icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Mask Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Mask Probe Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
v
Contents
Mask Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Unprotecting Masked Subsystems . . . . . . . . . . . . . . . . . . . 60
Circuit Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Viewing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
PLECS Probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Copying a Probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Controlling Access to Circuits and Subsystems . . . . . . . . . . . . . . . 66
Encrypting Circuits and Subsystems . . . . . . . . . . . . . . . . . . 66
Exporting Circuits for the PLECS Viewer . . . . . . . . . . . . . . . . . . 67
Exporting Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using the PLECS Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Zoom Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Changing Curve Properties . . . . . . . . . . . . . . . . . . . . . . . 71
Spreading Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Fourier Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Saving a View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Adding Traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Saving and Loading Trace Data . . . . . . . . . . . . . . . . . . . . 74
Scope Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Printing and Exporting . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Using the Fourier Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Calculation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 75
Display Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Zoom, Export and Print . . . . . . . . . . . . . . . . . . . . . . . . . 77
Calculation of the Fourier coefficients . . . . . . . . . . . . . . . . . 77
Using the XY Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Time Range Window . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Zoom, Save View, Export and Print . . . . . . . . . . . . . . . . . . 79
Simulation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
vi
Contents
PLECS Blockset Parameters . . . . . . . . . . . . . . . . . . . . . . 80
PLECS Standalone Parameters . . . . . . . . . . . . . . . . . . . . . 83
4 Thermal Modeling 87
Heat Sink Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Thermal Loss Dissipation . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Semiconductor Losses . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Ohmic Losses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Heat Sinks and Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Thermal Description Parameter . . . . . . . . . . . . . . . . . . . . . . . 93
Assigning Thermal Data Sheets . . . . . . . . . . . . . . . . . . . . 94
Using Reference Variables . . . . . . . . . . . . . . . . . . . . . . . . 94
Thermal Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Library Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Global and Local Data Sheets . . . . . . . . . . . . . . . . . . . . . . 97
Creating New Data Sheets . . . . . . . . . . . . . . . . . . . . . . . 98
Browsing the Thermal Library . . . . . . . . . . . . . . . . . . . . . 98
Thermal Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Editing Switching Losses . . . . . . . . . . . . . . . . . . . . . . . . 100
Editing Conduction Losses . . . . . . . . . . . . . . . . . . . . . . . . 100
Editing the Thermal Equivalent Circuit . . . . . . . . . . . . . . . . 100
Copy, Paste and Scaling . . . . . . . . . . . . . . . . . . . . . . . . . 101
Semiconductor Loss Specification . . . . . . . . . . . . . . . . . . . . . . . 103
Single Semiconductor Switch Losses . . . . . . . . . . . . . . . . . . 103
Diode Losses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Losses of Semiconductor Switch with Diode . . . . . . . . . . . . . 104
vii
Contents
5 Magnetic Modeling 107Equivalent circuits for magnetic components . . . . . . . . . . . . . . . . 107
Coupled inductors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Reluctance-resistance analogy . . . . . . . . . . . . . . . . . . . . . . 108
Permeance-capacitance analogy . . . . . . . . . . . . . . . . . . . . . 110
Magnetic Circuit Domain in PLECS . . . . . . . . . . . . . . . . . . . . . 111
Modeling Non-Linear Magnetic Material . . . . . . . . . . . . . . . 112
Saturation Curves for Soft-Magnetic Material . . . . . . . . . . . . 113
6 Mechanical Modeling 115Flanges and Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Force/Torque Flows and Sign Conventions . . . . . . . . . . . . . . . . . 116
Positions and Angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Initial Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Angle Wrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Ideal Clutches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Inelastic Collisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7 Analysis Tools 123Steady-State Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Fast Jacobian Calculation for Thermal States . . . . . . . . . . . . 124
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
AC Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Impulse Response Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Compensation for Discrete Pulse . . . . . . . . . . . . . . . . . . . . 126
Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Usage in PLECS Standalone . . . . . . . . . . . . . . . . . . . . . . . . . 128
Steady-State Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 128
viii
Contents
AC Sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Impulse Response Analysis . . . . . . . . . . . . . . . . . . . . . . . 131
Extraction of State-Space Matrices . . . . . . . . . . . . . . . . . . . 131
Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Usage in the PLECS Blockset . . . . . . . . . . . . . . . . . . . . . . . . . 134
Steady-State Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 134
AC Sweep / Loop Gain Analysis . . . . . . . . . . . . . . . . . . . . . 136
Impulse Response Analysis . . . . . . . . . . . . . . . . . . . . . . . 139
Extraction of State-Space Matrices . . . . . . . . . . . . . . . . . . . 141
Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
8 C-Scripts 151
How C-Scripts Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
C-Script Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Modeling Discontinuities . . . . . . . . . . . . . . . . . . . . . . . . . 154
Sample Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
User Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Runtime Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
C-Script Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
A Simple Function Times Two . . . . . . . . . . . . . . . . . . . . 159
Discrete States Sampled Delay . . . . . . . . . . . . . . . . . . . . 160
Continuous States Integrator . . . . . . . . . . . . . . . . . . . . . 160
Event Handling Wrapping Integrator . . . . . . . . . . . . . . . . 161
Piecewise Smooth Functions Saturation . . . . . . . . . . . . . . . 162
Multiple Sample Times Turn-on Delay . . . . . . . . . . . . . . . 164
C-Script Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
ix
Contents
9 Simulation Scripts 169
Command Line Interface in PLECS Blockset . . . . . . . . . . . . . . . . 169
Simulation Scripts in PLECS Standalone . . . . . . . . . . . . . . . . . . 173
Overview of PLECS Scripting Extensions . . . . . . . . . . . . . . . 174
Example Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
XML-RPC Interface in PLECS Standalone . . . . . . . . . . . . . . . . . 178
Establishing an XML-RPC Connection to PLECS . . . . . . . . . . 178
Overview of XML-RPC Commands . . . . . . . . . . . . . . . . . . . 178
Example Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Scripted Simulation and Analysis Options . . . . . . . . . . . . . . . . . 182
10 Code Generation 187
Code Generation for Physical Systems . . . . . . . . . . . . . . . . . . . . 187
Limiting the Code Size . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Maximum Number of Switches . . . . . . . . . . . . . . . . . . . . . 188
Naturally Commutated Devices . . . . . . . . . . . . . . . . . . . . . 188
Unsupported Components . . . . . . . . . . . . . . . . . . . . . . . . 189
Code Generation with PLECS Standalone . . . . . . . . . . . . . . . . . 190
Generating Code for a Model . . . . . . . . . . . . . . . . . . . . . . 190
Generating Code for a Subsystem . . . . . . . . . . . . . . . . . . . 191
Code Generation Options . . . . . . . . . . . . . . . . . . . . . . . . 192
Code Generation with the PLECS Blockset . . . . . . . . . . . . . . . . . 194
Code Generation Targets . . . . . . . . . . . . . . . . . . . . . . . . . 194
Real-Time Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Rapid Simulation Target . . . . . . . . . . . . . . . . . . . . . . . . . 195
Code Generation Options . . . . . . . . . . . . . . . . . . . . . . . . 197
x
Contents
11 Components by Category 199System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Continuous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Delays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Discontinuous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Discrete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Functions & Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Logical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Modulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Small Signal Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Electrical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Meters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Passive Components . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Power Semiconductors . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Thermal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Magnetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Mechanical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Translational . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Rotational . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Additional Simulink Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . 214
xi
Contents
12 Component Reference 2151D Look-Up Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
2D Look-Up Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
2-Pulse Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
3D Look-Up Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
3-Phase Overmodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
6-Pulse Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Abs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Ambient Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Air Gap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Ammeter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Angle Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Blanking Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Blanking Time (3-Level) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Breaker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Brushless DC Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Brushless DC Machine (Simple) . . . . . . . . . . . . . . . . . . . . . . . 233
C-Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Combinatorial Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Configurable Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Constant Heat Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Constant Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Controlled Heat Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Controlled Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Current Source (Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Current Source AC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Current Source DC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
xii
Contents
D Flip-flop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
DC Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Dead Zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Diode with Reverse Recovery . . . . . . . . . . . . . . . . . . . . . . . . . 261
Diode Rectifier (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Discrete Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Discrete Mean Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Discrete RMS Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Discrete State Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Discrete Total Harmonic Distortion . . . . . . . . . . . . . . . . . . . . . 269
Discrete Transfer Function . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
DLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Double Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Edge Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Electrical Ground . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Electrical Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Electrical Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Flux Rate Meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Force (Constant) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Force (Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Force Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Fourier Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Gear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
GTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
GTO (Reverse Conducting) . . . . . . . . . . . . . . . . . . . . . . . . . . 293
xiii
Contents
Heat Flow Meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Heat Sink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Hit Crossing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Hysteretic Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Ideal 3-Level Converter (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . 300
Ideal Converter (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Ideal Transformer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
IGBT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
IGBT 3-Level Converter (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . 305
IGBT Converter (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
IGBT with Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
IGBT with Limited di/dt . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
IGCT (Reverse Blocking) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
IGCT (Reverse Conducting) . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Induction Machine (Slip Ring) . . . . . . . . . . . . . . . . . . . . . . . . 319
Induction Machine (Open Stator Windings) . . . . . . . . . . . . . . . . . 323
Induction Machine (Squirrel Cage) . . . . . . . . . . . . . . . . . . . . . . 326
Induction Machine with Saturation . . . . . . . . . . . . . . . . . . . . . 329
Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Inertia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
JK Flip-flop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Leakage Flux Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Linear Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Linear Transformer (2 Windings) . . . . . . . . . . . . . . . . . . . . . . . 344
Linear Transformer (3 Windings) . . . . . . . . . . . . . . . . . . . . . . . 346
Logical Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Magnetic Permeance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Magnetic Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Magnetic Resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Mass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
xiv
Contents
Math Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Meter (3-Phase) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Minimum / Maximum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
MMF Meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
MMF Source (Constant) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
MMF Source (Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Monoflop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
MOSFET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
MOSFET Converter (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
MOSFET with Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
MOSFET with Limited di/dt . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Moving Average . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Mutual Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Mutual Inductance (2 Windings) . . . . . . . . . . . . . . . . . . . . . . . 371
Mutual Inductance (3 Windings) . . . . . . . . . . . . . . . . . . . . . . . 373
Op-Amp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Op-Amp with Limited Output . . . . . . . . . . . . . . . . . . . . . . . . . 376
Peak Current Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Periodic Average . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Periodic Impulse Average . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Permanent Magnet Synchronous Machine . . . . . . . . . . . . . . . . . 380
Pi-Section Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Piece-wise Linear Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Polar to Rectangular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Position Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Pulse Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Pulse Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Quantizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Rack and Pinion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
xv
Contents
Ramp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Rate Limiter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Rectangular to Polar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Relational Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Rotational Backlash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Rotational Clutch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Rotational Damper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Rotational Friction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Rotational Hard Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Rotational Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Rotational Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Rotational Speed (Constant) . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Rotational Speed (Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . 412
Rotational Speed Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Rounding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Saturable Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Saturable Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Saturable Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Saturable Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Saturation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Sawtooth PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Sawtooth PWM (3-Level) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Set/Reset Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Signal Demultiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Signal From . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Signal Goto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Signal Inport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
xvi
Contents
Signal Multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Signal Outport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Signal Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Signal Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Signum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Sine Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Small Signal Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Small Signal Perturbation . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Small Signal Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Space Vector PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Space Vector PWM (3-Level) . . . . . . . . . . . . . . . . . . . . . . . . . 450
SR Flip-flop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
State Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Switched Reluctance Machine . . . . . . . . . . . . . . . . . . . . . . . . . 461
Symmetrical PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Symmetrical PWM (3-Level) . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Synchronous Machine (Round Rotor) . . . . . . . . . . . . . . . . . . . . . 469
Synchronous Machine (Salient Pole) . . . . . . . . . . . . . . . . . . . . . 474
Thermal Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Thermal Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Thermal Ground . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Thermal Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Thermal Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Thermometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Thyristor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Thyristor Rectifier/Inverter . . . . . . . . . . . . . . . . . . . . . . . . . . 488
Thyristor with Reverse Recovery . . . . . . . . . . . . . . . . . . . . . . . 489
xvii
Contents
To File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Torque (Constant) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
Torque (Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Torque Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Torsion Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Transfer Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Transformation 3ph->RRF . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Transformation 3ph->SRF . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Transformation RRF->3ph . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
Transformation RRF->SRF . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Transformation SRF->3ph . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
Transformation SRF->RRF . . . . . . . . . . . . . . . . . . . . . . . . . . 503
Transformers (3ph, 2 Windings) . . . . . . . . . . . . . . . . . . . . . . . 504
Transformers (3ph, 3 Windings) . . . . . . . . . . . . . . . . . . . . . . . 507
Translational Backlash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
Translational Clutch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Translational Damper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Translational Friction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
Translational Hard Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Translational Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
Translational Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Translational Speed (Constant) . . . . . . . . . . . . . . . . . . . . . . . . 519
Translational Speed (Controlled) . . . . . . . . . . . . . . . . . . . . . . . 520
Translational Speed Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Translational Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
Transmission Line (3ph) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Transport Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
TRIAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Triangular Wave Generator . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Trigonometric Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
Triple Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
xviii
Contents
Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Turn-on Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Variable Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Variable Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Variable Magnetic Permeance . . . . . . . . . . . . . . . . . . . . . . . . . 546
Variable Resistor with Constant Capacitor . . . . . . . . . . . . . . . . . 548
Variable Resistor with Constant Inductor . . . . . . . . . . . . . . . . . . 549
Variable Resistor with Variable Capacitor . . . . . . . . . . . . . . . . . . 550
Variable Resistor with Variable Inductor . . . . . . . . . . . . . . . . . . 552
Voltage Source (Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . 554
Voltage Source AC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
Voltage Source AC (3-Phase) . . . . . . . . . . . . . . . . . . . . . . . . . 556
Voltage Source DC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Voltmeter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
White Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Winding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Wire Multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Wire Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
XY Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Zener Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
Zero Order Hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
13 Additional Simulink Blocks 569AC Sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
Discrete Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Impulse Response Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Loop Gain Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Modulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Steady-State Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
xix
Contents
xx
Before You Begin
Installing the PLECS Blockset
Installing the PLECS Blockset on your system is easy. You do not need tohave system administrator permissions. Since the PLECS Blockset requiresMATLAB and Simulink make sure these programs are installed on your sys-tem.
Automatic Installation
The Blockset directory of the PLECS CD-ROM contains an M-fileinstallplecs.m. When you execute this file from MATLAB it will automati-cally detect your platform, optionally search online for newer PLECS versions,install PLECS to a folder of your choice and set up your MATLAB path. Youcan use the installer both for a fresh installation and to update an existinginstallation.
Manual Installation on Microsoft Windows
1 Run the installer executable by double-clicking it. PLECS can be installedfor the current user or all users of a machine. To install PLECS for allusers the installer must be executed with administrator privileges.
2 If you have purchased a license for the full version you will have received alicense file license.dat. Copy this file to your harddisk. During the instal-lation the installer allows you to browse to the license file. As an alterna-tive you can choose to install the license for the PLECS Viewer.
Before You Begin
The file can also be copied into the installation directory after the installa-tion has completed. PLECS searches the license file in the same directorywhere plecs.m is located.
3 The PLECS installer will add PLECS to the MATLAB search path. If anerror is encountered (e.g. because of insufficient access priviledges) thechanges to the MATLAB path can also be done manually. In this case addthe installation directory and the subdirectory demos to your search pathusing the Path Browser in MATLAB. The Path Browser is found under themenu item File Set Path Add Folder.
4 If you previously had installed an older version of PLECS execute
plecsclearrehash toolboxcache
in the MATLAB command line.
You can always re-run the installation assistant to the change the licensefile or the MATLAB path. To do this, start plecs.exe in the subdirectorybin\win32.
Manual Installation on Mac OS X / Linux
1 Untar with
tar -xzf filename.tar.gz
in a directory of your choice. This will create a new sub-directory namedplecs containing the required files.
2 If you have purchased a license for the full version you will have received alicense file license.dat. Copy this file into the just created directory namedplecs.
If you would like to install the PLECS Viewer, copy the fileviewerlicense.dat from plecs/private into the parent directory plecsand rename it to license.dat.
3 In MATLAB, add the new directory plecs and the subdirectory demos toyour search path. Use the Path Browser under the menu item File SetPath Add Folder. Alternatively, edit directly the file pathdef.m in thedirectory matlabroot/toolbox/local/. If you do not have file system per-mission to modify the file pathdef.m add the commands
2
Installing the PLECS Blockset
addpath('plecs_directory');addpath('plecs_directory/demos');
to the file ~/matlab/startup.m. (In case the file does not exist create anempty file startup.m in the subdirectory matlab of your home directory.)
4 If you previously had installed an older version of PLECS execute
plecsclearrehash toolboxcache
in the MATLAB command line.
Configuring PLECS
For information about setting global configuration options for PLECS seeConfiguring PLECS (on page 39).
Installing Different Versions of the PLECS Blockset inParallel
If you want to keep different versions of PLECS installed in parallel on onecomputer, you must ensure that only one version is on your MATLAB path atany time during a MATLAB session. Otherwise, loss of data may occur. Be-fore changing the MATLAB path, be sure to clear the currently loaded PLECSmodule by entering plecsclear at the MATLAB command prompt. As an ad-ditional precaution you should restart MATLAB after the change.
Uninstalling the PLECS Blockset
Uninstalling the PLECS Blockset is as easy as installing it.
1 Locate the directory where PLECS is installed by entering
which plecs
in the MATLAB command line.
2 Remove the PLECS directory and its subdirectory demos from the searchpath. Depending on how the directories were added to the path duringinstallation, this is done using the Path Browser or by editing the file
3
Before You Begin
pathdef.m in the directory matlabroot/toolbox/local/ or the file ~/mat-lab/startup.m.
3 Quit MATLAB.
4 On Windows, deinstall PLECS Blockset by choosing the appropriate en-try in the Windows control panel. On Mac OS X and Linux just delete thePLECS directory.
4
Installing PLECS Standalone
Installing PLECS Standalone
Installing PLECS on your system is easy. You do not need to have system ad-ministrator permissions.
Installation on Microsoft Windows
1 Run the installer executable by double-clicking it. PLECS can be installedfor the current user or all users of a machine. To install PLECS for allusers the installer must be executed with administrator privileges.
2 If you have purchased a license for the full version you will have receiveda license file license.dat. During the installation the installer asks youto copy the file into the installation directory. The file can also be copiedinto the installation directory after the installation has completed. PLECSsearches the license file in the same directory where plecs.exe is located.
Installation on Mac OS X
1 Open the downloaded disk image by double-clicking it.
2 Copy PLECS to the Application folder.
3 If you have purchased a license for the full version you will have receiveda license file license.dat. Copy this file to your harddisk. When PLECS isstarted for the first time it will offer to install the license file.
Installation on Linux
1 Untar with
tar -xzf filename.tar.gz
in a directory of your choice. This will create a new sub-directory namedplecs containing the required files.
2 If you have purchased a license for the full version you will have received alicense file license.dat. Copy this file into the plecs directory.
5
Before You Begin
Whats New in Version 3.5
Major New Features
Certain parameters can be changed while a simulation is running (see sec-tion Changing Parameters during a Simulation on page 46). This includesmost control block parameters, such as gains or saturation limits, and pa-rameters of physical sources and passive physical components.
Code generation now supports naturally commutated devices, such asdiodes and thyristors, and control blocks with a discrete sample time.
The Enable block permits the conditional execution of subsystems contain-ing control blocks.
New blocks have been added to the PLECS Library: Display (see page 272),Discrete State Space (see page 268), White Noise Generator (see page 559),Random Number Generator (see page 396) and 3-Level Space Vector PWM(see page 450).
Further Enhancements
The circuit browser can display all components of a model in a hierarchicalor flat view (see section Circuit Browser on page 61).
If multiple components of the same type are selected, their parameters canbe changed simultaneously (see section Changing Parameters of MultipleComponents on page 46).
The Constant, Transfer Function and Discrete Transfer Function blocks areresizable to display their parameters in the block icon.
PLECS can be enabled to automatically check for updates. The XY Plot can be set to a fixed aspect ratio. In the thermal editor the user can exchange data with other applications,
such as Microsoft Excel, using copy and paste. All thermal data can bescaled conveniently (see section Copy, Paste and Scaling on page 101).
The C-Script editor now supports Find and Replace.
6
Licensing
Licensing
To use all features of PLECS you must have a valid license file license.dat.This file will be sent to you by email when you purchase a license for PLECS.Copy the file license.dat into the directory where you have installed PLECS.
If the license file for PLECS Blockset is not present or contains invalid datayou will still be able to open or save Simulink models containing PLECS cir-cuits. However, you cannot modify a circuit or run a simulation.
PLECS Standalone can be started in demo mode if no valid license file isfound. In this mode certain models can be opened and simulated. Its not pos-sible to save models or export data from PLECS.
Note The PLECS Blockset for Simulink scans the license file only once whenthe module is loaded by MATLAB. Therefore, if you reinstall the license file youneed to clear the PLECS module before the changes can become effective. Youcan do this by entering plecsclear at the MATLAB command prompt.
Network Licensing
If you purchase one or more concurrent licenses for PLECS, the license serverprogram FlexNet is employed to control access to PLECS. FlexNet is a productof Flexera Software. The license sent to you must be installed on the licenseserver. This file contains information that identifies the computer running thelicense manager and specifies the number of concurrent licenses you have pur-chased.
On the client computer(s), you need to use a text editor to create the licensefile license.dat in the PLECS directory with the following content:
SERVER hostname ANYUSE_SERVER
where hostname is the name of the computer running the license manager.
PLECS tries to obtain a license from the server the first time you load amodel or library containing a PLECS circuit. If the license is not granted
7
Before You Begin
either because the server is down or unreachable or because the licensed num-ber of concurrent users is already reached PLECS will fall back to an un-licensed mode. In this mode you cannot modify a circuit or run a simulation;saving a model is still possible. In order to retry to obtain a license you firstneed to close all models (including the PLECS library). Once granted, a li-cense is returned to the server when you close the last model containing aPLECS circuit.
If the connection to the license server is lost after you have obtained a license,PLECS will temporarily switch to the unlicensed mode. Upon successful recon-nection to the server, PLECS will switch back to normal operation.
8
1Getting Started
Let us have a quick tour and see how PLECS is used. Our aim is to show theessential elements of PLECS in real applications without regarding all the de-tails, rules, and exceptions. At this stage, we are not trying to be complete. Wewant to get you as soon as possible to the point where you can set up usefulapplications. Many of the details are not necessary at the beginning and canbe studied later.
The following section addresses users of the PLECS Blockset for Simulink. Ifyou are using the stand-alone version of PLECS please continue with sectionGetting Started with PLECS Standalone (on page 18).
Getting Started with the PLECS Blockset
To access PLECS you simply need to enter plecslib in the MATLAB com-mand line. This will bring up a Simulink model that contains a genericPLECS block named Circuit and various component libraries. In the li-braries you find electrical components, from which you can create your cir-cuits. Alternatively, you may access the PLECS toolbox by opening it in theSimulink library browser.
A Simple Passive Network
The only way to become familiar with a new program is by using it. For thisreason we are presenting here two example circuits that you can reconstructon your computer. The examples are based on each other, since the features ofPLECS will be explained step by step.
1 Getting Started
The first electrical system we are going to model is a simple RLC network asshown in Fig. 1.1. A capacitor is charged by a DC voltage source via an RL-branch and its voltage is monitored with a voltmeter.
10mH
10V vC100 F
10
Figure 1.1: Simple RLC network
In order to enter the circuit in PLECS we have to open a new Simulink model.Into the model window we copy the block Circuit from the PLECS library bydragging it with the mouse. Our Simulink model should now look like Fig. 1.2.
Figure 1.2: Simulink model
Components
A double-click on the PLECS block will open an empty schematic window witha menu bar quite similar to the one of a Simulink window. The componentsrequired for our circuit must be copied into this window from the componentslibraries. Like in Simulink, this is done by dragging them with the mouse.If you want to copy components already placed in the window hold down theCtrl control key or use the right mouse button. The components that you needfor the RLC network can be found in in the library Electrical in the sub-libraries Sources, Meters and Passive Components.
10
Getting Started with the PLECS Blockset
After you have copied all components the schematic window should look likeFig. 1.3. If not, move the components with the left mouse button. To rotateselected components press Ctrl-R, to flip them horizontally press Ctrl-F. Allthese functions can also be accessed via the menu bar.
Figure 1.3: PLECS schematic
Note You cannot place Simulink objects in a PLECS schematic and vice versasince both programs do not share the same Graphical User Interface.
Connections
The unconnected electrical terminals of a component are marked with lit-tle hollow circles. If we bring the mouse pointer close to such a terminal thepointer shape changes from an arrow to a cross. We now can drag a connec-tion to another component by holding the left mouse button down. Whenwe approach another terminal or an existing connection the pointer shapechanges into a double cross. As soon as we release the mouse button an elec-trical connection will be created.
For drawing a branch connection place the mouse pointer on an existing con-nection where you want the branch to start. With the right mouse button orwith the left mouse button while holding down the Ctrl key you can create aconnection from there to the desired destination.
11
1 Getting Started
Component Properties
Each component is identified by a unique name, which is chosen automati-cally. You may change it as you wish by double-clicking on it in the schematic.The name is intended only for documentation purposes and does not affect thesimulation. Of greater importance are the parameters that determine, for ex-ample, the inductance of an inductor, the capacity of an capacitor, or the volt-age of a DC voltage source. A double-click on the component icon opens a di-alog box in which you can set these parameters. Fig. 1.4 shows the dialog boxfor an inductor.
Figure 1.4: Inductor dialog box
If you want selected parameters to be displayed in the schematic, you mustcheck the check box on the right side of the edit field. For reasons of claritywe prefer to display only the most important parameters of a component.
Units
Like Simulink PLECS does not know anything about units. It is your respon-sibility that variables are scaled correctly. For power electronics we recom-mend the use of SI quantities. However, if you want to employ PLECS for thesimulation of power systems it may be more appropriate to work with perunit quantities.
For every component enter the values according to the schematic in Fig. 1.1.In the dialog boxes of the inductor and the capacitor you can additionally setthe initial current resp. the initial voltage. Please leave both values at zero.
12
Getting Started with the PLECS Blockset
Signals
Up to now our electrical circuit lacks a connection with the Simulink envi-ronment. You will notice this from the fact that the PLECS block in Simulinkdoes not have inputs or outputs. In order to add inputs and outputs we mustcopy the respective port blocks from the library System into the schematic.In our case we want to access in Simulink the voltage measured by the volt-meter. Therefore, we need the Signal Outport block that exports a signalinto the parent system.
Signals in PLECS correspond to the connections between Simulink blocks.They provide unidirectional information interchange between components andwith Simulink.
Connect the output of the voltmeter with the input of the port block. InSimulink, connect a Scope to the output of the PLECS block and start thesimulation. In order to see something of the more interesting part of the sim-ulation you probably need to set the stop time to 0.1. By this time you shouldhave something like Fig. 1.5 and Fig. 1.6 on your screen.
Figure 1.5: Complete model
Adding More Measurements
If you want to measure other quantities in the circuit, simply add the requiredvoltmeters and ammeters. The measured signals can be exported to Simulinkwith additional port blocks. Alternatively you can bundle the measured sig-nals into a vector by using the multiplexer for signals Signal Multiplexerfrom the library System.
13
1 Getting Started
Figure 1.6: Simulation result
You can also add scopes in the PLECS schematic directly. The Scope" blockcan be found in the library System".
Importing Signals
You have already learned how to export signals from the electrical circuit toSimulink via the output block. In the same manner you can also import sig-nals from Simulink into your circuit, usually to control sources.
Let us see how the capacitor in our example charges and discharges if we ap-ply a pulsed voltage. In the schematic we replace the DC voltage source by acontrolled one. Copy the input block Signal Inport into the schematic andconnect it to the voltage source. The PLECS block in Simulink now also hasan input terminal. Any Simulink signal that you connect to this terminalwill be translated into a voltage in the electrical circuit. In Fig. 1.7 we useda pulse generator with a period of 0.04 sec and an amplitude of 10.
The signal generated by the pulse generator is discrete, i.e. its value changesabruptly. Normally, the PLECS Scope would determine the signal type auto-matically and display vertical slopes. In this case, however, the discrete signalcoming from the pulse generator is multiplexed with a continuous signal be-fore reaching the Scope. In order to avoid trapezoidal curves, the signal typemust be set manually to discrete in the Data window of the Scope (see Fig.1.8).
14
Getting Started with the PLECS Blockset
Figure 1.7: RLC network with a pulsed voltage source
Figure 1.8: Data window of the PLECS Scope
Buck Converter
In the next example we will introduce the concept of ideal switches, whichdistinguishes PLECS from other simulation programs. It will be shown howswitches are controlled, i.e. either by voltages and currents in the system orby external signals.
25mH
vsrc 2220F vC
isrc
Figure 1.9: Schematic of buck converter
15
1 Getting Started
Switches
In the buck converter outlined in Fig. 1.9 we will model the transistor as anentirely controllable switch and bear in mind that it may conduct current onlyin one direction. We also need a free-wheeling diode. The diode is a switchthat closes as the voltage across it becomes positive, and opens as the currentthrough it becomes negative.
The diode can be found in the library Electrical / Power Semiconductors andthe switch in the library Electrical / Switches. All components in these li-braries are based on ideal switches that have zero on-resistance and infiniteoff-resistance. They open and close instantaneously. In some components likethe diode you may add a forward voltage or a non-zero on-resistance. If youare unsure about these values leave them at zero.
In order to control the switch in our buck converter we import another signalfrom Simulink and connect it to the switch. The switch will close upon a non-zero signal and open when the signal goes back to zero.
Figure 1.10: Electrical part of buck converter
By now you should be able to model the electrical part of the buck converteras shown in Fig. 1.10. For the buck converter we will implement a hysteresistype control that keeps the capacitor voltage roughly in a 0.2 V band around6 V. To make things a bit more interesting we apply a step change from 12 Vdown to 8 V to the input voltage during the simulation.
16
Getting Started with the PLECS Blockset
Figure 1.11: Simulation of buck converter with hysteresis control
17
1 Getting Started
Getting Started with PLECS Standalone
The only way to become familiar with a new program is by using it. For thisreason we are presenting here two example circuits that you can reconstructon your computer. The examples are based on each other, since the features ofPLECS will be explained step by step.
After starting PLECS the PLECS Library browser is displayed. In the li-braries you find various components from which you can create your circuits.You can browse through the available libraries and see which components areavailable.
A Simple Passive Network
The first electrical system we are going to model is a simple RLC network asshown in Fig. 1.12. A capacitor is charged by a DC voltage source via an RL-branch and its voltage is monitored with a voltmeter.
10mH
10V vC100 F
10
Figure 1.12: Simple RLC network
In order to enter the circuit in PLECS we have to open a new PLECS model.This is done by selecting New Model from the File Menu in the LibraryBrowser.
Components
The components required for our circuit must be copied into this window fromthe Library Browser. This is done by dragging them with the mouse. If youwant to copy components already placed in the window hold down the Ctrlcontrol key or use the right mouse button.
The electrical components that you need for the RLC network can be found inin the library Electrical in the sub-libraries Sources, Meters and Pas-sive Components. The scope is located in the library System. Instead of
18
Getting Started with PLECS Standalone
browsing for the components you can also search for them by entering the firstletters of the component you need in the search bar. For example, typing scshows you the scope, res all available resistors etc.
After you have copied all components the schematic window should look likeFig. 1.13. If not, move the components with the left mouse button. To rotateselected components press Ctrl-R, to flip them horizontally press Ctrl-F. Allthese functions can also be accessed via the menu bar.
Figure 1.13: PLECS schematic
Connections
The unconnected electrical terminals of a component are marked with lit-tle hollow circles. If we bring the mouse pointer close to such a terminal thepointer shape changes from an arrow to a cross. We now can drag a connec-tion to another component by holding the left mouse button down. Whenwe approach another terminal or an existing connection the pointer shapechanges into a double cross. As soon as we release the mouse button an elec-trical connection will be created.
For drawing a branch connection place the mouse pointer on an existing con-nection where you want the branch to start. With the right mouse button orwith the left mouse button while holding down the Ctrl key you can create aconnection from there to the desired destination.
Component Properties
Each component is identified by a unique name, which is chosen automati-cally. You may change it as you wish by double-clicking on it in the schematic.The name is intended only for documentation purposes and does not affect the
19
1 Getting Started
simulation. Of greater importance are the parameters that determine, for ex-ample, the inductance of an inductor, the capacity of an capacitor, or the volt-age of a DC voltage source. A double-click on the component icon opens a dia-log box in which you can set these parameters. Fig. 1.14 shows the dialog boxfor an inductor.
Figure 1.14: Inductor dialog box
If you want selected parameters to be displayed in the schematic, you mustcheck the check box on the right side of the edit field. For reasons of claritywe prefer to display only the most important parameters of a component.
Units
PLECS does not know anything about units. It is your responsibility thatvariables are scaled correctly. For power electronics we recommend the useof SI quantities. However, if you want to employ PLECS for the simulation ofpower systems it may be more appropriate to work with per unit quantities.
For every component enter the values according to the schematic in Fig. 1.12.In the dialog boxes of the inductor and the capacitor you can additionally setthe initial current resp. the initial voltage. Please leave both values at zero.
Signals
In addition to the electrical connections (wires) that are used to connect elec-trical components PLECS also makes use of unidirectional signals. The sig-nals are painted in green and have an arrowhead to indicate their direction.In the RLC example a signal connects the output terminal of the voltmeter tothe input terminal of the scope.
20
Getting Started with PLECS Standalone
PLECS uses signals to carry non-electrical information like measurement val-ues or triggering pulses for switches. Signals can be used in calculations anddisplayed in a scope. Electrical connections cannot be fed into a scope directly,you always have to use a volt- or ammeter to convert the electrical quantitiesinto a signal first.
By this time your model should look similar to Fig. 1.15. To start the simu-lation, press Ctrl-T or select Start from the Simulation menu. In orderto see something of the more interesting part of the simulation you need toset the stop time to 0.1. To do this, open the Simulation Parameters dialogby clicking the corresponding menu entry in the Simulation menu or pressCtrl-E.
You should now get the simulation results shown in below.
Figure 1.15: Complete model and simulation result
Adding Control Blocks
To enhance our model we would like to add some dynamic behavior into ourstatic electrical model. Let us see how the capacitor in our example chargesand discharges if we apply a pulsed voltage. In the schematic we replace theDC voltage source by a controlled one. The input of the voltage source can beany signal generated from one of the control blocks in PLECS. In Fig. 1.16 weused a pulse generator with a period of 0.04 sec and an amplitude of 10 to con-trol the voltage source.
21
1 Getting Started
Figure 1.16: RLC network with a pulsed voltage source
Buck Converter
In the next example we will introduce the concept of ideal switches, whichdistinguishes PLECS from other simulation programs. It will be shown howswitches are controlled, i.e. either by voltages and currents in the system orby external signals.
25mH
vsrc 2220F vC
isrc
Figure 1.17: Schematic of buck converter
Switches
In the buck converter outlined in Fig. 1.17 we will model the transistor as anentirely controllable switch and bear in mind that it may conduct current onlyin one direction. We also need a free-wheeling diode. The diode is a switchthat closes as the voltage across it becomes positive, and opens as the currentthrough it becomes negative.
The diode can be found in the library Electrical / Power Semiconductors andthe switch in the library Electrical / Switches. All components in these li-
22
Getting Started with PLECS Standalone
braries are based on ideal switches that have zero on-resistance and infiniteoff-resistance. They open and close instantaneously. In some components likethe diode you may add a forward voltage or a non-zero on-resistance. If youare unsure about these values leave them at zero.
The switch is controlled by an external signal. It will close upon a non-zeroinput and open when the signal goes back to zero.
We start with the electrical part of the buck converter first. By now youshould be able to model it as shown in Fig. 1.18.
Figure 1.18: Electrical part of buck converter
Subsystems
Wed also like to separate the electrical part from the control part. This has noeffect on the simulation result but makes the whole system more structured.Once you have completed the circuit from Fig. 1.18, select all components (ei-ther by clicking on an empty space in the upper left corner of the schematicand dragging a frame to the lower right corner, or by pressing Ctrl-A). Nowcreate a new subsystem by selecting Create Subsystem from the Edit menuor by pressing Ctrl-G. The electrical components are now in a new subsys-tem Sub. You can rename it to something more meaningful, e.g. Circuitand change the icon size by dragging one of the selected corners. You can alsomove the name label to another position by clicking and dragging it to the bor-ders or the corners of the icon. Now your system should look similar to Fig.1.19.
To connect the subsystem to the outer schematic we need to place ports intoit. Drag two Signal Inports and two Signal Outports into the subsystemschematic and connect them to the voltage source, the switch, the volt- and
23
1 Getting Started
Figure 1.19: Electrical Subsystem
the ammeter respectively. Note that a new terminal appears in the subsystemicon for each port that you drag into the subsystem schematic.
For the buck converter we will implement a hysteresis type control that keepsthe capacitor voltage roughly in a 0.2 V band around 6 V. To make things abit more interesting we apply a step change from 12 V down to 8 V to the in-put voltage during the simulation.
Figure 1.20: Simulation of buck converter with hysteresis control
Demo Models
Now that youve built your first own models in PLECS it may be worthwile totake a look at the demo models that come with PLECS. Open the demo modelbrowser by selecting Demo Models from the View Menu.
24
2How PLECS Works
PLECS is a software package for modeling and simulating dynamic systems.As with any other software package, in order to make the best use of it youshould have a basic understanding of its working principles. Before delvinginto the question how PLECS works, however, it is worthwhile to distinguishbetween the terms modeling and simulation.
The term modeling refers to the process of extracting knowledge from the sys-tem to be simulated and representing this knowledge in some formal way.The second part i.e. the representation of knowledge can be more or lessstraightforward depending on the formalism used. PLECS offers three dif-ferent formalisms equations (implemented as C-code), block diagrams andphysical models that can be used in the same modeling environment. Theyare described in the following section.
The term simulation refers to the process of performing experiments on amodel in order to predict how the real system would behave under the sameconditions. More specifically, in the context of PLECS, it refers to the compu-tation of the trajectories of the models states and outputs over time by meansof an ordinary differential equation (ODE) solver. This is described in the sec-ond section.
Modeling Dynamic Systems
A system can be thought of as a black box as depicted below. The system doesnot exchange energy with its environment but only information: It accepts in-put signals u, and its reactions can be observed by the output signals y.
A system can have internal state variables that store information about thesystems past and influence its current behavior. Such state variables can becontinuous, i.e. they are governed by differential equations, or discrete, i.e.
2 How PLECS Works
xc, xdSystem states
uInput signals
yOutput signals
they change only at certain instants. An example of a continuous state vari-able is the flux or current of an inductor; an example of a discrete state vari-able is the state of a flip flop.
System Equations
One way to describe a system is by mathematical equations. Typical systemequations are listed below:
An output function describes the systems outputs in terms of the currenttime, the systems inputs and its internal states.
If the system has discrete states, an update function determines if and howthey change at a given time for the current inputs and
If the system has continuous states, a derivative function describes theirderivatives with respect to time. internal states.
Symbolically, these functions can be expressed as follows:
y = foutput(t, u, xc, xd)
xnextd = fupdate(t, u, xc, xd)
xc = fderivative(t, u, xc, xd)
Such a description is most convenient for implementation in a procedural pro-gramming language like C.
Block Diagrams
A more graphic modeling method that is commonly used in control engineer-ing is a block diagram such as the one below which shows a low pass filter.
Each of the three blocks is again a dynamic system in itself, that can be de-scribed with its own set of system equations. The blocks are interconnected
26
Simulating Dynamic Systems
1/s+ 10
with directed lines to form a larger system. The direction of the connectionsdetermines the order in which the equations of the individual blocks must beevaluated.
Physical Models
Block diagrams are very convenient to model control structures where it isclear what the input and output of a block should be. This distinction is lessclear or impossible for physical systems.
For instance, an electrical resistor relates the quantities voltage and currentaccording to Ohms law. But does it conduct a current because a voltage is ap-plied to it, or does it produce a voltage because a current is flowing through it?Whether the first or the second formulation is more appropriate depends onthe context, e.g. whether the resistor is connected in series with an inductoror in parallel with a capacitor. This means that it is not possible to create asingle block that represents an electrical resistor.
Therefore, block diagrams with their directed connections are usually not veryuseful for modeling physical systems. Physical systems are more convenientlymodeled using schematics in which the connections between individual compo-nents do not imply a computational order.
PLECS currently supports physical models in the electrical, magnetic, me-chanical and thermal domains (in the form of lumped parameter models).
Simulating Dynamic Systems
A simulation is performed in two phases initialization and execution thatare described in this section.
27
2 How PLECS Works
Model Initialization
Physical Model Equations
PLECS first sets up the system equations for the physical model according toe.g. Kirchhoff s current and voltage laws. If the physical model contains onlyideal linear and/or switching elements it can be described by a set of piece-wise linear state-space equations:
x = Ax + Bu
y = Cx + Du
The subscript is due to the fact that each state-change of a switching ele-ment leads to a new set of state-space matrices.The complete physical model is thus represented by a single, atomic subsys-tem. The following figure shows the interaction between the physical subsys-tem, the surrounding block diagram and the ODE solver.
s1 Event
detectionSolver
B + A C +
D
Switc
h m
anag
erPhysical model
continuousinputs
gateinputs
measure-ments
The physical subsystem accepts external input signals for controllable sourcesand for switching elements and it provides an output signal containing thevalues of physical measurements. During the simulation, the derivativesof the physical state variables are calculated and handed over to the solverwhich in turn calculates the momentary values of these state variables.The Switch Manager monitors the gate signals and the internal measure-ments and decides whether a switching action is necessary. If so, it initiatesthe calculation of a new set of equations. The Switch Manager also providesauxiliary signals so-called zero-crossing signals to the solver for proper lo-cation of the exact instants when a switching should occur.
28
Simulating Dynamic Systems
Block Sorting
After the setup of the physical model, PLECS determines the execution orderof the block diagram. As noted above, the physical model is treated as a singleatomic subsystem of the block diagram. The execution order is governed bythe following computational causality:
If the output function of a block depends on the current value of one ormore input signals,the output functions of the blocks that provide theseinput signals must be evaluated first.
Direct feedthrough The property of an input port whether or not its cur-rent signal values are required to compute the output function is called directfeedthrough. For example, the output function of a linear gain is
y = k uand so the input signal of the gain has direct feedthrough. In contrast, theoutput function of an integrator is
y = xc
i.e. the integrator just outputs its current state regardless of the current in-put. The integrator input therefore does not have direct feedthrough.
Algebraic loops An algebraic loop is a group of one or more blocks that areconnected in a circular manner, so that the output of one block is connected toa direct feedthrough input of the next one.
For such a group it is impossible to find a sequence in which to compute theiroutput functions because each computation involves an unknown variable (theoutput of the previous block). Instead, the output functions of these blocksmust be solved simultaneously. PLECS currently cannot simulate block dia-grams that contain algebraic loops.
29
2 How PLECS Works
Model Execution
The figure below illustrates the workflow of the actual simulation.
Calculateoutputs
Calculateupdates
Calculateoutputs
Calculateoutputs
Startsimulation
Terminatesimulation
Mainloop
Eventdetection
loop
Integrationloop
Calculatederivatives
Calculatezero-crossings
Main Loop
The main simulation loop also called a major time step consists of two ac-tions:
1 The output functions of all blocks are evaluated in the execution order thatwas determined during block sorting. If a model contains scopes, they willbe updated at this point.
2 The update functions of blocks with discrete state variables are executed tocompute the discrete state values for the next simulation step.
Depending on the model and the solver settings, the solver may enter one orboth of the following minor loops.
30
Simulating Dynamic Systems
Integration Loop
If a model has continuous state variables, it is the task of the solver to nu-merically integrate the time derivatives of the state variables (provided by themodel) in order to calculate the momentary values of the states variables.
Depending on the solver algorithm, an integration step is performed in multi-ple stages also called minor time steps in order to increase the accuracy ofthe numerical integration. In each stage the solver calculates the derivativesat a different intermediate time. Since the derivative function of a block candepend on the blocks inputs i.e. on other blocks outputs the solver mustfirst execute all output functions for that particular time.
Having completed an integration step for the current step size, a variable-stepsolver checks whether the local integration error remains within the specifiedtolerance. If not, the current integration step is discarded and a new integra-tion is initiated with a reduced step size.
Event Detection Loop
If a model contains discontinuities, i.e. instants at which the model behaviorchanges abruptly, it may register auxiliary event functions to aid a variable-step solver in locating these instants. Event functions are block functions andare specified implicitly as zero-crossing functions depending on the currenttime and the blocks inputs and internal states.
For instance, if a physical model contains a diode, it will register two eventfunctions, fturn on = vD and fturn off = iD, depending on the diode voltage andcurrent, so that the solver can locate the exact instants at which the diodeshould turn on and off.
If one or more event functions change sign during the current simulationstep, the solver performs a bisection search to locate the time of the first zero-crossing. This search involves the evaluation of the event functions at differ-ent intermediate times. Since the event function of a block like the deriva-tive function can depend on the blocks inputs, the solver must first executeall output functions for a particular time. Also these intermediate time stepsare called minor time steps.
Having located the first event, the solver will reduce the current step size sothat the next major time step is taken just after the event.
31
2 How PLECS Works
Fixed-Step Simulation
As indicated in the previous paragraphs, certain important aspects of the mi-nor simulation loops require a variable-step solver that can change its stepsize during a simulation. Using a solver with a fixed step size has two seriousimplications.
Integration Error A fixed-step solver does not have any control over theintegration error. The integration error is a function of the model time con-stants, the step size and the integration method. The first parameter is ob-viously given by the model, but the second and possibly the third parametermust be provided by the user. One strategy for determining an appropriatestep size is to iteratively run simulations and reduce the step size until thesimulation results stabilize.
Event Handling Discontinuities in a physical model such as the turn-on orturn-off of a diode or the transition from static to dynamic friction typicallydo not coincide with a fixed simulation step. Postponing such non-sampledevents until the following fixed simulation step will produce jitter and maylead to subsequent runtime errors, e.g. because a physical state variable be-comes discontinuous.
For these reasons it is generally recommended to use a variable-step solver.However, if you plan to generate code from a model to run it on a real-timesystem you will need to use a fixed-step solver.
Physical Model Discretization
In order to mitigate the problems due to non-sampled events, PLECS trans-forms the physical model into a discrete state-space model when it is sim-ulated with a fixed-step solver. The continuous state-space equations of theelectrical and magnetic domains are discretized using the bilinear transforma-tion (also known as Tustins method). The integration of the state variables isthus replaced with a simple update rule:
xn = Adxn1 + Bd (un + un1)
Ad =
(1 t
2A
)1(
1 +t
2A
)
Bd =
(1 t
2A
)1 t
2B
where t is the discretization time step.
32
Simulating Dynamic Systems
The above equations show that the current input values un must be knownin order to calculate the current state values xn. As a consequence, all inputsof the electro-magnetic model now have direct feedthrough because they mustbe known before the model outputs can be calculated. In order to reduce theoccurrence of algebraic loops caused by this, all other state variable both fromother physical domains and from the block diagram are integrated with Eu-lers method.
Interpolation of Non-Sampled Switching Events
With the physical model discretized like this, non-sampled switching eventscan be handled efficiently using the following algorithm:
1 Check whether the solver has stepped over a non-sampled switching eventin the last simulation step.
2 If so, determine the time of the event and calculate the model state just af-ter the event using linear interpolation and handle the event, i.e. toggle oneor more switches.
3 Perform one full forward step.
4 Linearly interpolate the model states back to the actual simulation time.
This algorithm is illustrated using the example of a half-wave rectifier shownbelow. The two graphs show the commutation of the dc current from diode D3(shown in gray) to diode D1 (shown in black). The solid lines show the resultsfrom a simulation with a variable-step solver, large dots mark the steps of thefixed-step simulation, and small dots mark the internal interpolation steps.
Commutation starts when the voltage across D1 becomes positive. The fixed-step solver first steps well beyond the zero-crossing of the voltage (1). PLECSthen internally steps back to the zero-crossing (2) and turns on D1. With thenew set of state-space equations, it performs an internal full step forward (
Top Related