MATLAB Motor Power Control Whitepaper
MATLAB Motor Power Control Whitepaper
MATLAB Motor Power Control Whitepaper
Summary of 10 Ways
1. Simulate analog and digital components at the same time................................................................................3
2. Automate controller analysis and tuning in the frequency domain....................................................................6
3. Simulate control algorithms to improve power quality........................................................................................7
4. Verify fault-detection, mode logic, and supervisory control across operating conditions...............................8
5. Verify operation of the power converter within a larger electrical system......................................................10
6. Validate control code on the processor without damaging electrical system hardware................................12
7. Generate control code for real-time testing........................................................................................................12
8. Develop real-time simulations of your electrical system.....................................................................................13
9. Generate code for microcontrollers, FPGAs, or ASICs from your model.........................................................14
10. Reuse handwritten code from existing projects................................................................................................15
W H I T E PA P E R | 2
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
Introduction
When you’re designing digital control for power converters, there are many good reasons to model and simulate the
varying power supply and converter loads, the balance of passive components (like resistors and capacitors) and
active components (like power transistors), and the feedback and supervisory control algorithms needed to regulate
voltage and meet stringent design requirements.
Simulation with Simulink® accomplishes what hand coding cannot, by automating tasks and eliminating hardware
integration errors. With system-level modelling and simulation you can:
• Make tradeoff studies and conduct optimization analyses to balance cost and performance
• Generate C/C++ and HDL code from your model
• Validate your design with real-time simulations and hand off production-ready algorithmic code to your
software engineers
These are among the 10 proven ways to use system-level simulation with Simulink to improve your design process
for digital control for power converters.
W H I T E PA P E R | 3
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
L
VOut
v
+ - +
-
Current N-Channel Voltage
sensor MOSFET/1 sensor
+
Cyclic R
DC Source load Load
C
30V
I-
-
N-Channel 200Hz
MOSFET/2
f(x) = 0
phase
PWML duty cycle PID(z)
PWMH
Driver Digital PID Controller 15
VRef
Buck converter model of a switching power supply that converts a 30V DC supply into a regulated 15V DC supply.
With Simulink you can model your digital control algorithms and analog circuit together, before beginning detailed
circuit design with a SPICE circuit simulator. Depending on the complexity of the control scheme needed, the
requirements for the fidelity of the plant model change. In some cases, the model can be made up of averaged value
components. In other cases, such as when the controller depends on transient behavior, you may need to model more
complex behavior.
W H I T E PA P E R | 4
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
+ i -
irradiance
d d
G G
PS S
s s
E E
+ -
MOS1 MOS3
+ C
- +
+
v - CL v Grid
-
- i +
d d
Ir
Ir
+
Solar G G
Panel2 s s
E E
-
MOS2 MOS4
f(x) = 0
Model for determining the efficiency of a single-stage solar converter. The model simulates one complete AC cycle for
a specified level of solar irradiance and corresponding optimal DC voltage and AC RMS current. Converter efficiency
is determined in two independent ways. The first compares the ratio of AC power out to DC power in over one AC cycle.
The second calculates losses by component by making use of Simscape logging.
Using Simulink and Simscape components, you can model “A single unit costs thousands of dollars
and simulate passive and active components using pre- and is capable of delivering 250 kilo-
built or custom blocks. With the ability to simulate analog watts—more than enough power to
and digital components at the same time, you can apply cause serious damage if not managed
optimization methods or Monte Carlo analyses to auto-
safely. We mitigate the risk by verifying
matically calculate component parameter values and con-
troller gains to meet timing and frequency constraints.
our control algorithms via simulation in
You can vary the fidelity of your model by modeling com- Simulink before testing them on the
ponents as average value components, ideal switching hardware.”
devices, or nonlinear transistors, and you can also include — Dr. Robert Turner, senior R&D engineer
thermal characteristics to help you understand the effect at ABB in New Zealand
of switching and conduction losses.
Learn More
»» Developing Buck-Boost Converter Control with Simulink Video Series - Video Series
»» Lockheed Martin Simulates Orion Spacecraft Missions Using a Multidomain Power System Model - User Story
»» Solar Power Converter - Example
»» ABB Accelerates the Delivery of Large-Scale, Grid-Connected Inverter Products with Model-Based Design -
User Story
W H I T E PA P E R | 5
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
R6 L1
1.8mOhm 20uH
R2
Vin 5V-10V 8mOhm
Rload
S PS 3Ohm-6Ohm
C1
Vin Value 1480uF
f(x) = 0
S PS
Sampling
Boost converter configured with a reference voltage that switches from 15 to 25 volts.
You can use control design tools in Simulink to tune controller gains, implement gain scheduling controllers, and
develop layered feedback and feedforward control loops to ensure that your controller will maintain stable power
output.
Simulink lets you compute the frequency response of a nonlinear simulation model that includes switching effects.
You can compute frequency responses using AC sweep analysis or by identifying a linear model from measured
input-output data.
Once a frequency response is available, you can tune controller gains using interactive loop shaping on a Bode plot
or root locus plot. Alternatively, you can specify design requirements such as bandwidth and stability margins and
then use automated tuning to compute the required gains. You can use automated tuning capabilities in Simulink to
tune multiple loops at the same time, such as when tuning the cascaded structure of a current-mode boost converter.
Further, you can automate the tuning process to compute a frequency response and tune controller gains at different
operating conditions, for implementation of a gain-scheduled controller.
Learn More
»» See example of boost converter design using frequency response data (and try it in Simulink)
W H I T E PA P E R | 6
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
High Side
+
Bus
d
Voltage v
gH g
-
+
s D1 R
2+ Cout
Load
Control + - + - 1+
-
-
2-
d Lr
gL g Cr 3+
s 1- f(x) = 0
3-
Low Side
Behavioral Tr D2
Gate Driver
Meas
f-control signal
f control
Ref
DC-DC LLC power converter with frequency control. A simple integral control is implemented in Simulink in the Controller block,
and is designed to achieve a nominal output voltage defined by the variable Vout_nominal.
W H I T E PA P E R | 7
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
The model above contains two variants for the power electronic switches. The detailed version includes a MOSFET
with nonlinear characteristics. The abstract version uses a piecewise linear model with an ideal switch, body diode,
and output capacitance. The abstract version provides very similar behavior and quicker simulation.
By modeling your control algorithms, electronic components, power supplies, and loads in Simulink, you can com-
bine digital control tasks with analog device simulations to explore different control strategies and circuit topologies
while analyzing power quality across the entire operating space of the power converter. Simulating and tuning the
controller over a range of varying input and output conditions enables you to increase the probability that your
design will behave as intended when hardware testing begins, thereby minimizing hardware iterations.
Learn More
»» ABB Accelerates Application Control Software Development for a Power Electronic Controller - User Story
W H I T E PA P E R | 8
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
A behavioral model in Stateflow implements the electronic circuit generating the PWM
waveforms and regulating the solenoid current.
W H I T E PA P E R | 9
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
1 D
d
Short-Circuit
- +
X F
2 + -
Fault
G s
Resistor
5Ohm MOSFET
+
Package
Parasitic
-
10nH
3 S
Fault applied to a MOSFET in a power converter in order to explore the operation of protection circuitry.
After the MOSFET becomes faulted, the crowbar circuitry is activated in order to clamp the output voltage across
the load and eventually to cause the fuse to blow.
Learn More
»» Alstom Generates Production Code for Safety-Critical Power Converter Control Systems - User Story
»» Modeling a PWM-Driven Hydraulic Servomechanism - Example
»» Buck Converter with Faults - Example
»» Danfoss Adopts Model-Based Design to Speed Development of Power Electronics Control Systems - User Story
»» MOFSET Fault in Buck Converter - Example
W H I T E PA P E R | 10
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
First, Simulink and Simscape include modifiable libraries of prebuilt electrical components and systems such as elec-
tric machines, motor drives, grid equipment, and power sources and loads. The combination of basic electrical com-
ponents with a range of fidelity from ideal to nonlinear operation and the Simscape language for modeling physical
components lets you build models that meet your project’s specific requirements for simulation fidelity and speed.
VSC Control
Vdc_mes Vdc
V_PV V_PV
Pulses 5 kHz - 500V
I_PV I_PV Boost Converter
Irradiance
(W/m^2) m_PV
+ 33*60 Hz - 500V
L1 3-level VSC +
Diode1 v Vab_VSC Utility Grid
Ramp-up/down Irradiance
+
-
m
Ir Ir +
g
g
C
+
+ IGBT1 +
A A a a A A a
Vdc v N
-
B B b b B B b
E
Temp T -
+
-
C C c cD1 Yg C C c
A
B
C
10 kvar
Temperature
(deg. C)
Detailed model of a 100-KW array connected to a 25-kV grid via a DC-DC boost converter and a three-phase three-level VSC.
Second, Simulink supports cosimulation with other soft- “Our customers asked us to use the
ware, including SPICE circuit simulators. You can devel- PSCAD/EMTDC environment for
op the digital aspects of your controller in Simulink and dynamic performance and transient
the analog circuit components in SPICE. Via cosimula-
analysis studies, which previously
tion, you can verify the controller in the context of non-
linear circuit behavior, such as parasitic capacitance or
required rewriting our models in PSCAD
inductance in circuit elements. and months of integration time. Our
experts worked with MathWorks consul-
Third, Simulink enables you to generate code from
models that can be integrated into other simulation soft-
tants to reuse our existing MATLAB and
ware. After you have designed and tested your power Simulink models with Embedded Coder,
converter controller in Simulink, you can code and inte- enabling us to implement a change in
grate it to any other software package capable of running functionality in about five minutes.”
C/C++ code, including PSCAD, RSCAD, or certain —Anthony Totterdell, Alstom Grid
SPICE circuit simulators.
Fourth, Simulink supports custom block libraries, enabling third-party hardware and software companies to develop
libraries of their components that you can incorporate directly into your power converter design models.
Learn More
»» OMRON Develops Solar Inverter Control Algorithm for Anti-Islanding Control - User Story
»» Detailed Model of a 100-kW Grid-Connected PV Array - Example
»» Alstom Grid Develops High-Voltage Direct Current Transmission Control System Using Model-Based Design -
User Story
»» Microcontroller and FPGA Hardware Support in Simulink - Hardware Support
W H I T E PA P E R | 11
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
PIL simulation tests numerical equivalence between model components and the compiled object code
by running it on real target hardware or an instruction set simulator.
Learn More
»» Custom Target Development for ARM Cortex A: Processor-in-the-Loop (4:39) - Video
W H I T E PA P E R | 12
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
As an alternative, you can use Simulink to generate controller code for rapid control prototyping on a dedicated com-
puter that executes in real-time and uses high-speed I/O to communicate with test hardware. One advantage of this
approach is that you can validate changes to the controller by running the simulation model first and verifying that
no other problems were introduced. A second advantage is that you generate code directly from the model and run it
on the target computer, eliminating manual coding and any associated delays.
Typical real-time simulation and testing environment using Simulink Real-Time. Photo courtesy Speedgoat.
Learn More
»» SuperGrid Institute: An efficient and compact power converter to enable the supergrids of the future - User Story
W H I T E PA P E R | 13
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
Simulink can generate C/C++ and HDL code from the simulation model of the hardware in your power converter
and the system of which it is part, including the supply and the load. This capability lets you run a real-time simula-
tion of the hardware, often called hardware-in-the-loop (HiL) simulation, to test the real-time execution of your con-
troller code before verifying it in a hardware prototype. As a result, you can find and correct errors before they
potentially damage expensive and difficult-to-replace prototype hardware. Further, you can test the control code via
real-time simulation in the electrical system that contains the power converter.
Learn More
»» Developing a Real-Time Motor Model for HIL Testing (22:26) - Video
»» Real-Time Simulation and Testing of Power Electronics on a More Electric Aircraft - Article
W H I T E PA P E R | 14
10 Ways to Speed Design for Digitally Controlled Power Converters with Simulink
indicate that algorithm changes are needed, you can simply modify the algorithms in your simulation model, rerun
simulation test cases to verify the correctness of the algorithm changes, and generate the new, updated code. All gen-
erated C/C++ and HDL code is fully portable, optimizable with a range of options, and bidirectionally traceable to
the Simulink model.
Learn More
»» Implementing a Buck Converter Controller Using Embedded Coder (34:01) - Video
»» ABB Accelerates the Delivery of Large-Scale, Grid-Connected Inverter Products with Model-Based Design -
User Story
»» Philips Healthcare Develops Smart Digital RF Power Subsystem for MRI Systems - User Story
Learn More
»» Integrate C Functions Using the Legacy Code Tool - Documentation
»» Lotus Engineering Develops Control Systems Software to Reduce Diesel Emissions - User Story
Next Steps
Take the next step to speed your power converter control project.
Explore: Power Electronics Control Design with Simulink
Download: Trial Software for Power Electronics Control
Get Started: Consulting Services
© 2018 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of additional trademarks.
Other product or brand names may be trademarks or registered trademarks of their respective holders.
W H I T E PA P E R | 15