IEEE Power Electronics Magazine - June 2016 - 23
MCU at the correct positions to facilitate the synchronized simulation. Dedicated pipes are used for communication between the SE and the CS. PIL is compatible
with TI's 32-bit fixed-point number format and the IEEE
single-precision floating-point format. Explicit conversion from double precision to single precision is done to
avoid any errors arising out of automatic typecasting.
Additionally, the PIL has built-in compatibility for 16-bit
and 8-bit fixed-point values. This provides flexibility to
the user to utilize any data size and format of choice. It
can also handle data in both big-endian and small-endian
formats and for multiple word sizes of eight-, 16-, and
32-bit words.
The PIL system is present as a PIL block in the SE (PSIM).
The various parameters or configurations required by PIL
can be provided through the PIL block's attributes. The configuration data is passed onto the CS by the SE in the initial
data exchange before the actual simulation begins. This
information consists of the interrupt subroutine names and
the names of the subroutines that process the control algorithm. Based on this data, the MCU is configured to halt at
appropriate locations to read and write data to and from the
MCU, respectively. It also allows the user to launch CCS in
the debug perspective to interact with the code during the
PIL simulation.
At the beginning of the simulation, the CS configures the
MCU by setting the breakpoints and identifying the read
and write variables. The CS then starts code execution and
the MCU runs until the breakpoint is encountered, which
halts the MCU. The CS then waits for the data to arrive from
the SE and sends it to the MCU after receiving it. The MCU
execution is resumed. At the end of the cycle, the controller output (Vm) is read from the MCU, which is a result of
the computation of the control algorithm with the data provided from the SE. The data are sent to the SE, updated in
the SE simulation, and then converted to PWM waveform,
which in turn is fed into the power stage.
PIL Implementation
The PIL system can be divided into four blocks: the
SE-PSIM software module, the CS, the MCU running the
control algorithm, and the controller output to PWM conversion module. These blocks are described in the
upcoming sections.
sE-PsIM
The PSIM software developed by Powersim Inc. is used for
the software simulation part of the PIL system. PSIM provides building blocks for creating and simulating the power
circuits or the motor drives (typically called the plant). The
plant is designed using the library provided by PSIM, and
the control algorithm is defined as an MIL system. The simulation step size is specified using the simulation control
module in PSIM. For the MIL/SIL simulation, the sampling
of the data fed to the control system is done through a zeroorder hold (ZOH) block. The ZOH block has the same fre-
SE
p1
PSIM
Sends
V, I
t0 t1 t2
td
PSIM
Reads
Controller
Output
t3
p2
PSIM and
MCU Run
Asynchronously
MCU
t4
ISR
ISR
Begin End
td
MCU
MCU Running
Halted
PWM
Counter
FIG 5 The synchronization scheme between SE and MCU for PIL.
quency as the sampling frequency for the control algorithm.
The PWM is generated by using a comparator with the controller output fed to the positive terminal and a triangular
voltage source fed to the negative terminal. A similar subcircuit is used for the PWM generation in the PIL system.
For code generation by the SimCoder PIL module, the ZOH
block is replaced by a hardware specific ADC block (F28335
ADC block), and the PWM generation circuit is replaced by
a hardware specific PWM block (F28335 PWM block). The
hardware specific blocks are provided by the SimCoder
module. All the information required to program the MCU is
contained in the code files generated by SimCoder. The SimCoder PIL module generates the files required for creating a
CCS project and the source file for the code, which is used
to program the microcontroller. The project file is imported
into the CCS and the project is built with all the source and
header dependencies to generate the .out file. This .out file is
placed in the MCU memory and contains the byte code for
running on the MCU.
After the code is generated, the plant is configured to
work with the PIL system. The PIL library provides for the
PIL block to be placed in the simulation environment. This
PIL block samples the data with appropriate delay, applies
the gain (if any), and communicates with the CS for data
exchange between the PSIM environment and the MCU. It
is configured with the requisite number of inputs and outputs. The inputs to the digital controller are the inputs of
the PIL block. The PIL block's output is the controller output voltage, which is fed to the PWM generation subcircuit
to generate the PWM pulses. The PWM block's output is
connected to the feedback path to the plant. The PIL block
is configured with all the parameters required by the CS.
These parameters can be configured by modifying the PIL
block's attributes through a dialog box in PSIM.
simulation cs
The CS is a custom script written in JavaScript using the TI
DSS API. Many actions essential to the working of the PIL
system are controlled by the CS. The MCU used for the PIL
is configured and programmed with the .out file by the CS.
June 2016
z IEEE PowEr ElEctronIcs MagazInE
23
Table of Contents for the Digital Edition of IEEE Power Electronics Magazine - June 2016
IEEE Power Electronics Magazine - June 2016 - Cover1
IEEE Power Electronics Magazine - June 2016 - Cover2
IEEE Power Electronics Magazine - June 2016 - 1
IEEE Power Electronics Magazine - June 2016 - 2
IEEE Power Electronics Magazine - June 2016 - 3
IEEE Power Electronics Magazine - June 2016 - 4
IEEE Power Electronics Magazine - June 2016 - 5
IEEE Power Electronics Magazine - June 2016 - 6
IEEE Power Electronics Magazine - June 2016 - 7
IEEE Power Electronics Magazine - June 2016 - 8
IEEE Power Electronics Magazine - June 2016 - 9
IEEE Power Electronics Magazine - June 2016 - 10
IEEE Power Electronics Magazine - June 2016 - 11
IEEE Power Electronics Magazine - June 2016 - 12
IEEE Power Electronics Magazine - June 2016 - 13
IEEE Power Electronics Magazine - June 2016 - 14
IEEE Power Electronics Magazine - June 2016 - 15
IEEE Power Electronics Magazine - June 2016 - 16
IEEE Power Electronics Magazine - June 2016 - 17
IEEE Power Electronics Magazine - June 2016 - 18
IEEE Power Electronics Magazine - June 2016 - 19
IEEE Power Electronics Magazine - June 2016 - 20
IEEE Power Electronics Magazine - June 2016 - 21
IEEE Power Electronics Magazine - June 2016 - 22
IEEE Power Electronics Magazine - June 2016 - 23
IEEE Power Electronics Magazine - June 2016 - 24
IEEE Power Electronics Magazine - June 2016 - 25
IEEE Power Electronics Magazine - June 2016 - 26
IEEE Power Electronics Magazine - June 2016 - 27
IEEE Power Electronics Magazine - June 2016 - 28
IEEE Power Electronics Magazine - June 2016 - 29
IEEE Power Electronics Magazine - June 2016 - 30
IEEE Power Electronics Magazine - June 2016 - 31
IEEE Power Electronics Magazine - June 2016 - 32
IEEE Power Electronics Magazine - June 2016 - 33
IEEE Power Electronics Magazine - June 2016 - 34
IEEE Power Electronics Magazine - June 2016 - 35
IEEE Power Electronics Magazine - June 2016 - 36
IEEE Power Electronics Magazine - June 2016 - 37
IEEE Power Electronics Magazine - June 2016 - 38
IEEE Power Electronics Magazine - June 2016 - 39
IEEE Power Electronics Magazine - June 2016 - 40
IEEE Power Electronics Magazine - June 2016 - 41
IEEE Power Electronics Magazine - June 2016 - 42
IEEE Power Electronics Magazine - June 2016 - 43
IEEE Power Electronics Magazine - June 2016 - 44
IEEE Power Electronics Magazine - June 2016 - 45
IEEE Power Electronics Magazine - June 2016 - 46
IEEE Power Electronics Magazine - June 2016 - 47
IEEE Power Electronics Magazine - June 2016 - 48
IEEE Power Electronics Magazine - June 2016 - 49
IEEE Power Electronics Magazine - June 2016 - 50
IEEE Power Electronics Magazine - June 2016 - Cover3
IEEE Power Electronics Magazine - June 2016 - Cover4
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2023
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2023
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2023
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2022
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2022
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2022
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2022
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2021
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2021
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2021
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2021
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2020
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2020
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2020
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2020
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2019
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2019
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2019
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2019
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2018
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2018
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2018
https://www.nxtbook.com/nxtbooks/ieee/pelcompendium_march2018
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2018
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2017
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2017
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2017
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2016
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2016
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2016
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2016
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2015
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2015
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2015
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2015
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_december2014
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_september2014
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_june2014
https://www.nxtbook.com/nxtbooks/ieee/powerelectronics_march2014
https://www.nxtbookmedia.com