11
FROM PSIM SIMULATION
TO HARDWARE IMPLEMENTATION
IN DSP
Hua Jin
11.1 INTRODUCTION
This chapter describes the basic functions and features of the simulation software
PSIM. Through a grid‐link inverter system example, it illustrates how to set up the
power and control circuits, and how to convert analog controllers to digital control-
lers. Furthermore, it shows how to prepare the system for automatic code generation
and processor‐in‐the‐loop (PIL) simulation with Texas Instruments F28335 DSP.
11.2 PSIM OVERVIEW
PSIM is a simulation software specifically designed for power electronics, motor
drives, and power conversion systems. It features a user‐friendly interface and a very
robust and fast simulation engine. In addition, its capability to generate code
automatically for TI DSP and perform PIL simulation with the DSP helps to speed
up the hardware implementation process significantly.
In PSIM, a circuit is represented in four parts: power circuit, control circuit,
sensors, and switch controllers, as illustrated in Figure 11.1.
A power circuit includes elements such as resistors, inductors, capacitors,
semiconductor switches, and some other elements that conduct electrical current.
A control circuit includes blocks that handle control signals, such as multipliers,
Modeling Power Electronics and Interfacing Energy Conversion Systems,
First Edition.
M. Godoy Simões and Felix A. Farret.
© 2017 John Wiley & Sons, Inc. Published 2017 by John Wiley & Sons, Inc.
256
FROM PSIM SIMULATION TO HARDWARE IMPLEMENTATION IN DSP
Power circuit
Switch controllers
Sensors
Control circuit
FIgURE 11.1
Circuit representation in PSIM.
dividers,
s‐domain,
and
z‐domain
transfer function blocks. Sensors include
voltage sensors, current sensors, and speed and torque sensors. Switch controllers
include blocks that control switches, such as ON–OFF controllers and PWM
controllers.
The structure of the PSIM element library and key elements are listed in the
following text.
Power:
• Resistors; inductors; capacitors; transformers; semiconductor switches
• Magnetic elements
• op. amp.; optocouplers; TL431
• Electric machines; encoders; speed/torque sensors; mechanical loads
• Inductors and semiconductor switches with power loss calculation capability
• Solar cells; wind turbines; batteries; ultracapacitors
• Link to finite element analysis software JMAG
Control:
• Computational function blocks
• Filters;
s‐domain
transfer function blocks
• Logic gates
•
z‐domain
transfer function blocks; zero‐order hold; unit delay; and other
function blocks for digital control
• Processor‐in‐the‐loop block
• Links to Matlab/Simulink and ModelSim
Other:
• Voltage/current sensors
• Switch controllers
• Probes and meters
FROM ANALOG CONTROL TO DIGITAL CONTROL
257
• Blocks that are common to power and control circuits, such as transformation
blocks, math function blocks, DLL blocks, and C blocks
• PWM ICs (e.g., UC3842, UC3854, UCC3895); driver ICs
• Sources
• Voltage/current sources
SimCoder:
• Event control
• Library for TI F2833x floating‐point DSP
• Library for TI F2803x fixed‐point DSP
• TI Digital Motor Control Library
To create a circuit in PSIM, access the PSIM element library either through the
Element menu or from the Library Browser. To launch the Library Browser, select
View
>>
Library Browser.
Note that in PSIM, one needs to define which voltages
and currents to display explicitly unless the option “Save all voltage and currents
during simulation” is checked. This option is under
Options
>>
general,
and by
default, it is unchecked. To display the voltage of a node or across two nodes, use a
voltage probe. To display the current of an element, either set the current flag of that
element to 1 or insert a current probe.
Once the circuit schematic is completed, select
Simulate
>>
Simulation Control,
and place it on the schematic. Define the simulation time step and total time. Then,
run the simulation by selecting
Simulate
>>
Run Simulation.
After the simulation is completed, the waveform display program Simview will be
launched, and waveforms can be selected for display. In Simview, one can also
perform mathematical calculations (i.e., multiplication of two waveforms, and calcu-
lation of average and RMS values) and FFT analysis.
For further details on how to use PSIM, refer to
PSIM User Manual
[1].
In the following sections, a grid‐link inverter example is used to illustrate how
such a system can be implemented in PSIM, and how the system can be modified to
generate code for TI F28335 DSP for hardware implementation.
11.3 FROM ANALOg CONTROL TO DIgITAL CONTROL
A power converter system may involve a complex control algorithm. In such a case,
a DSP will be well suited to implement the control algorithm. When designing a
digital controller, a common practice is to design the controller in analog domain and
then convert the analog controller to the digital controller. To illustrate this process,
we will use the grid‐link inverter system as an example.
Figure 11.2 shows a grid‐link inverter system. It consists of two stages: the DC–
DC boost converter and the grid‐link inverter. The boost converter provides the
voltage boost and the DC bus voltage control. The inverter is connected to a load and
a utility grid, and the active and reactive power flowing to the grid is regulated.
Figure 11.3 shows the boost controller and the inverter controller.
250u
Boost converter
vdc+
Inverter
ldc
A
Filter
La
la
1
Grid
V
control
208Y/120
3Phase
80
File
Vdc
V
4700u
vdc-
lb
lc
.1u
25
Qbst
Q1
Q4
Q6
Q5
Q3
Q2
1
vb
vc
va
Load
Boost controller
vdc+
Vm_bst
V
vdc+
vm
+
-
fs_bst
vdc–
Pref
V
Qbst
Va
Vb
Vc
la
lb
lc
Qref
V
Inverter controller
va
vb
vc
ia
ib
ic
Pref
Qref
ctrl
control
vma
vmb
vmc
Vma
V
+
–
+
–
+
–
Q1
Q4
Q3
Q6
Q5
Q2
vdc-
FIgURE 11.2
Grid‐link inverter system in analog control.
FROM ANALOG CONTROL TO DIGITAL CONTROL
259
(a)
C3
vdc+
1000
–
+
6.62
vdc–
R1 C1
R2
–
+
2.5
5
C2
0.95
vm
0.01
R11
(b)
Inverter controller
va
VgA
VgB
VgC
a
b
c
al
be
al
be
d
q
K
–1
K
theta
–1
Vgq
K
ctrl
Vgd
0
M
0
120pi
theta
V
V
VgA
vb
VgB
vc
VgC
ia
IgA
ib
IgB
ic
IgC
Iqref
ctrl
Pref
ctrl
Igq
Vgq
K
wL
K
÷
k
Iqref
V
+
–
–wL
+
MUX
+
IgA
IgB
IgC
a
b
c
al
be
al
be
+
Vgd
–
2.31
K
33
MUX
+
+
+
+
2pi
VgA
VgB
VgC
IgA
IgB
IgC
Q
P
d
q
theta
K
–1
K
–1
lgd
lgq
K
K
ctrl
+
+
+
mg
MUX
–1
K
–1
K
+
d
q
theta
al
be
al
be
a
b
c
K
K
MUX
K
vmb
vma
Igd
ldref
Qref
÷
K
ldref
V
–
MUX
MUX
+
K
K
ctrl
+
+
+
+
Vgd
md
vmc
ctrl
0
Vgd
K
+
–
K
MUX
K
+
+
–1
K
–1
K
d
q
al
be
al
be
a
b
c
ctrl
1
Vgq
K
ctrl
+
–
K
K
+
MUX
+
FIgURE 11.3
System controllers: (a) operational amplifier Type‐3 for the boost controller
and (b) analog‐based three‐phase inverter controller.
The boost controller uses an operational amplifier to implement a Type‐3 controller
to provide voltage control. The inverter controller, on the other hand, uses computa-
tional function blocks,
s‐domain
transfer function blocks, and transformation function
blocks from the PSIM’s control library to implement active/reactive power control
and voltage control. The inverter control algorithm is implemented in the
dq‐frame.
A C block is used to calculate the active/reactive power.
评论