Plexim PLECS RT Box User manual

Boost Converter
1 Overview
This RT Box demo model features a boost converter with a resistive load and closed-loop current con-
trol. The nominal operating condition is given at
• 52 kW power,
• 480 V input voltage and
• 108 A inductor current reference.
This document describes the implementation of the power stage and controls in PLECS and the real-
time deployment of the system on two RT Boxes. For such a “virtual prototyping” configuration the
two RT Boxes are connected front-to-front with two 37 pin Sub-D cables to exchange digital PWM sig-
nals and analog current measurements.
The chosen discretization step sizes and average execution times for each subsystem in the Boost con-
verter model are shown in Tab. 1. The discretization step size parameter specifies the base sample
time of the generated code and is used to discretize the state-space equations of the plant and control
model. The execution time represents the actual time it takes the processor on the RT Box to calculate
the plant or control model.
Table 1: Discretization step size and average execution time of real-time models with two RT Box 1
Subsystem Discretization Step Size Average Execution Time
Plant 2 µs 0.9µs
Controller 50 µs(fsw = 20 kHz)0.5µs
1.1 Requirements
To run this demo model, the following items are needed (available at www.plexim.com):
• Two PLECS RT Boxes and one PLECS and PLECS Coder license
• The RT Box Target Support Library
• Follow the step-by-step instructions on configuring PLECS and the RT Box in the Quick Start guide
of the RT Box User Manual.
• Two 37 pin Sub-D cables to connect the boxes front-to-front.
Note that this demo model is targeted at two RT Boxes application, with one running the Plant and
the other running the Controller. In this way, the execution time of each real-time target is minimized.
Besides, the setup can easily transition to a HIL or RCP test later on.
However if the user has only one RT Box available, please check the corresponding models targeted
for one RT Box application. In this case, two 37 pin Sub-D cables are still needed to connect in front
Analog Out interface with Analog In interface, and Digital Out interface with Digital In interface.
• For RT Box 2 and 3, by default the multi-tasking feature is enabled in this demo. “Controller” part
is circled with a Task frame block, and runs in one core. The rest of the circuit on the schematic be-
longs to the “Base task”, and runs in another core. In this way the computational effort is split onto
different cores. Please check the default setting under Scheduling tab of the Coder options... win-
dow.
• For RT Box 1, multi-tasking is disabled since there is only one CPU core available for calculating
the model, which includes both Plant and the Controller.
www.plexim.com 1

Boost Converter
Note This model contains model initialization commands that are accessible from:
PLECS Standalone: The menu Simulation + Simulation Parameters... + Initializations
PLECS Blockset: Right click in the Simulink model window + Model Properties + Callbacks +
InitFcn*
2 Model
The top level schematic contains two separate subsystems representing the controller and plant mod-
els, as shown in Fig. 1. Both subsystems are enabled for code generation from the Edit + Subsystem
+ Execution settings... menu. This step is necessary to generate the model code for the RT Box. Ad-
ditional delays in the feedback path are also modeled.
Plant
PWM
Vout
Vin
IL
Controller
IL
Vin
Vout
PWM
z-1
z-1
z-1
Figure 1: Top level schematic of the controller and boost converter model
2.1 Boost Converter
A boost converter is also known as a “step-up” converter since it converts an input DC voltage to a
higher DC voltage at its output. It requires at least two semiconductor switches; in this demo model
a diode and an IGBT are used. The inductor represents an energy storage element with a parasitic
series resistance RL. At the output a capacitor is used as a filtering component to stabilize the load
voltage. An overview of the boost converter is given in Fig. 2.
The plant model uses different blocks from the RT Box 1 Target Support Library to access the physical
input and output ports of the RT Box 1:
• The PWM Capture block samples incoming switching signals every 7.5 ns. The sampled switching
signals are time-averaged over each model step for high-fidelity resolution of the PWM inputs. To
utilize the time-averaged PWM input in the simulation a Low-Side Switch IGBT Chopper power
module is used with the “sub-cycle average” configuration selected [1].
• Analog Out blocks provide the analog signals required by the controller subsystem such as induc-
tor current, input voltage, and output voltage. The Analog Out component contains scale and off-
set parameters that can be set to avoid saturating the analog outputs of the RT Box and to match
IO requirements of the connected hardware or controller. Appropriate scaling factors can be deter-
mined with an offline simulation in PLECS. In the case of the inductor current, a closed-loop offline
simulation reveals a maximum current value of 110 A. Along with an analog output voltage range
configuration of ±5 V, as specified by the user in the Target tab of the Coder Options window, the
Analog Out scaling factor, IL,scale, has been set to:
IL,scale = 4 V/IL,max ≈0.0364
The scaling factors for the other analog in- and output channels are calculated accordingly.
www.plexim.com 2

Boost Converter
Note that in this virtual prototyping setup it does not matter which IO channels are configured, but
the channel IDs must match between the “Controller” and “Plant” subsystems.
L
RL
A
V
Vin
PWM
PWM
Capture
V
Vout
Analog
Out
IL
Analog
Out
Vin
Analog
Out
Cout
Rload
Figure 2: Boost converter plant model
Design
For a boost converter in CCM and with given input and output voltages Vin and Vout, the required
duty-cycle Dcan be calculated as follows:
D= 1 −Vin
Vout
(1)
The sizing of the input inductor Land output capacitor Care determined using the specifications of
current and voltage ripple (∆Iin,pp and ∆Vout,pp) in Tab. 2.
Table 2: Parameters set and design requirements
Vin Vout,nom ∆Vout,pp ∆Iin,pp Pnom RLfsw
480 −800 V 950 V 10 V 5 A 52 kW 15 mΩ 20 kHz
The current increases during the first part of the switching period t0≤t≤t0+DT , when Vin is applied
over the inductance L. Using the state equation of the inductor and neglecting the inductor series re-
sistance, one finds that:
dIL
dt =∆Iin,pp
DTsw
=Vin
L⇒L=Vin ·D
∆Iin,pp ·fsw
The required inductance Lis then found at the nominal output voltage and minimum input voltage:
L=
Vin ·1−Vin
Vout
∆Iin,pp ·fsw
= 2.375 mH
At nominal power, the load current and resistance values are:
Iload =Pnom
Vout
= 54.7 A
Rload =Vout
Iload
= 17.4 Ω
The value of the output capacitor Cis calculated in a similar fashion to the inductor L:
C=Iload ·D
∆Vout,pp ·fsw
= 135.4µF
www.plexim.com 3

Boost Converter
2.2 Current Controller
The inductor current of the boost converter is regulated by a PI controller implemented in the “Con-
troller” subsystem, as shown in Fig 3. The current reference set point will toggle between the mini-
mum and maximum reference values at 50 Hz. The parameters of the PI controller are calculated us-
ing the plant transfer function P(s)and the Magnitude Optimum Criterion, as described in more de-
tail below.
The “Controller” subsystem contains the following components from the RT Box 1 Target Support Li-
brary:
• Analog In blocks provide the analog signals from the “Plant” subsystem. The input signals can be
scaled and offset, similar to the Analog Out block. In this model, the Analog In scaling factors are
set to the inverse of the Analog Out scaling factors. The current and voltage values in the “Control”
subsystem will then correspond to unscaled voltage and current measurements in the power stage.
• The PWM Out block is configured to generate a PWM signal with a symmetrical carrier on digital
output channel 0. To sample the average inductor current, the sample point of the ADC needs to be
in the middle of the switching period for a symmetrical PWM scheme. To ensure consistent point-
on-wave sampling, the ADC and the PWM execution need to be synchronized. With the RT Box this
is achieved by synchronizing both ADC sampling and PWM update with the model step. This behav-
ior is configured by the Synchronization with model step parameter of the PWM Out block. The
controller runs in a single update mode with the compare value (CMP) updating always on the min-
imum of the triangular carrier (see Update setting of the PWM Out block). The PWM Out carrier
waveform is updated every 7.5 ns which limits the time resolution of the PWM period. This effect is
modeled in the offline simulation. In the initialization commands the closest achievable PWM car-
rier frequency to 20 kHz is calculated and used for the PWM Out switching frequency. The resulting
PWM frequency error is less than 0.005%.
IL
Analog
In
Vin
Analog
In
Vout
Analog
In
PIController
Iref*
IL
Vsw*
Vin
rst
D
Vsw*
Vout
D
0
ResetController
0.5
DefaultD
PWM
PWM
Out
Scope
IL
IL
Iref
Figure 3: Schematic of the current controller
Plant transfer function
To set the PI controller gain parameters the plant transfer function P(s)is needed. P(s)relates the
change of the voltage across the RL elements VRL (the input variable) to the response of the inductor
currents IL(the output variable):
P(s) = IL
VRL
=1/RL
1 + s L/RL
=K1
1 + s T1
where K1:= 1/RLand T1:= L/RL
Time delays
Several types of time delays are present in the virtual prototyping setup of this boost converter real-
time model.
www.plexim.com 4

Boost Converter
• Analog input sampling
• Control calculation time step
• PWM output generation
• PWM capture interface
• Plant calculation time step
• Analog output
Since the plant calculation time step is much smaller than the controller step (factor of 50), only the
time delays of the controller are considered in the offline model. These are the control calculation time
step itself (1/Tsw) and the average PWM output delay of 1/(2Tsw)giving a total delay of 3/(2Tsw). For
the calculation of the control parameters the delay is approximated with a first-order low pass filter of
the form:
DΣ(s) = 1
1 + sTΣ
where TΣ= 3/2·Tdisc,control = 3/2·Tsw.
Calculation of control parameters
The control parameters of the PI controller (Kiand Kp) are calculated using the Magnitude Optimum
Criterion. The system’s open-loop transfer function HOL(s)is given by the product of transfer functions
from the controller, plant and time delays:
HOL(s) = 1 + sTn
sTi
·K1
1 + s T1
·1
1 + sTΣ
where Kp=Tn
Tiand Ki=1
Ti. The controller parameter Tnis chosen, such that the pole of the plant
transfer function is canceled, i.e. Tn=T1. The remaining parameter Tiis calculated from the closed-
loop transfer function and with the condition HCL(jω)≈1at low frequencies Ti= 2K1TΣ
Anti-windup and controller reset
The controller is equipped with an anti-windup mechanism. The anti-windup feedback uses a correc-
tive gain of:
Kbc =Ki
Kp
.
The lower saturation level is 0V(for a duty cycle of 1) and the upper saturation level is set to Vout (for
a duty cycle of 0). Note that this assumes that the output capacitor is pre-charged to at least Vin. In
startup situations where the output capacitor is not pre-charged the saturation level of the controller
would need to be variable and adapted to the actual output voltage.
A reset option is added to the controller. Setting the value of the “Reset Controller” Constant block to
1 resets the integral part of the PI controller to its initial condition and a default duty cycle of 0.5 is
applied to the PWM module.
The overall structure of the PI controller including anti-windup and reset features is given in Fig. 4.
www.plexim.com 5

Boost Converter
1/s
Kp
Ki
+
−
Iref*
IL
Vsw*
+
+
+
−
Vin
rst
−
+
K
+
−
Figure 4: Schematic of the PI controller
Analog In
Analog Out
Digital In
Digital Out
Analog In
Analog Out
Digital In
Digital Out
Controller Plant
Analog Signals
PWM Signals
Figure 5: Interconnection of two RT Boxes running the plant and controller models
3 Simulation
This demo model runs both in offline mode on a PC or in real-time on the PLECS RT Box. For the
real-time operation, two RT Boxes are needed that exchange digital PWM and analog sensor signals
using two 37 pin Sub-D cables. The connection of the two boxes in depicted in Fig. 5.
Please follow the instructions below to run a real-time model on two RT Boxes:
• Connect the Analog Out interface of the “Plant” RT Box to the Analog In interface of the “Con-
troller” RT Box, and the Digital In interface of the “Plant” RT Box to the Digital Out interface of
the “Controller” RT Box (e.g. using two DB37 cables shown in Fig. 5).
• From the System tab of the Coder options... window, select the “Plant” and Build it onto the
“Plant” RT Box. Then, select “Controller" and Build it onto the “Controller” RT Box.
3.1 External Mode
Open the External Mode tab of the “Controller” subsystem and click Connect and then Activate
autotriggering. The PLECS Scopes in that subsystem will now update with real-time data from the
RT Box. The controller subsystem has different tunable parameters:
• “Reset Controller” Constant block
• “Kp” Gain block inside the “PI Controller” subsystem
• “Ki” Gain block inside the “PI Controller” subsystem
• “Iref” Pulse Generator block
To start the system, double-click on the “Reset Controller” Constant block and change the value to 1
and then back to 0.
www.plexim.com 6

Boost Converter
Notice the inductor current reference is toggling between a maximum (108 A) and minimum (65 A)
value in the “Controller” subsystem. The step response of the current control-loop is shown in Fig. 6.
The maximum and minium values for the reference current can be tuned online as well as the control
parameters Ki and Kp.
InductorCurrent
ModulationIndex
OutputVoltage
A
60
80
100
120
0.0
0.5
1.0
×1e-3
Time(s)
4.5 5.0 5.5 6.0 6.5 7.0 7.5
V
700
800
900
Kp*2:IL
Kp*2:Iref
Kpcalculated:IL
Kpcalculated:Iref
Kp*2:m
Kpcalculated:m
Kp*2:Vout
Kpcalculated:Vout
Figure 6: Current control step response from 64 A to 108 A
4 Conclusion
This RT Box demo model demonstrates a boost converter under closed-loop control with a continu-
ous PI current controller and resistive load. The demo model can run in both offline simulation and
in real-time on two RT Boxes. The controller subsystem runs on one RT Box with a discretization step
size of 50 µs, which is the size of the switching period, and the plant subsystem runs with a discretiza-
tion step size of 1 µson a second RT Box.
References
[1] J. Allmeling, and N. Felderer, “Sub-cycle average models with integrated diodes for real-time simu-
lation of power converters,” IEEE Southern Power Electronics Conference (SPEC), 2017.
www.plexim.com 7

Revision History:
RT Box Target Support Package 1.8.3 First release
How to Contact Plexim:
+41 44 533 51 00 Phone%
+41 44 533 51 01 Fax
Plexim GmbH Mail)
Technoparkstrasse 1
8005 Zurich
Switzerland
http://www.plexim.com Web
RT Box Demo Model
© 2002–2021 by Plexim GmbH
The software PLECS described in this document is furnished under a license agreement. The software
may be used or copied only under the terms of the license agreement. No part of this manual may be
photocopied or reproduced in any form without prior written consent from Plexim GmbH.
PLECS is a registered trademark of Plexim GmbH. MATLAB, Simulink and Simulink Coder are regis-
tered trademarks of The MathWorks, Inc. Other product or brand names are trademarks or registered
trademarks of their respective holders.
Other manuals for PLECS RT Box
7
This manual suits for next models
3
Table of contents
Other Plexim Media Converter manuals

Plexim
Plexim PLECS RT Box User manual

Plexim
Plexim RT Box TSP 2.0.5 User manual

Plexim
Plexim PLECS RT Box User manual

Plexim
Plexim PLECS RT Box User manual

Plexim
Plexim PLECS RT Box User manual

Plexim
Plexim PLECS RT Box User manual

Plexim
Plexim PLECS RT Box User manual

Plexim
Plexim PLECS RT Box User manual