Application Pack 2:: PWM Based H-Bridge Power Control

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

VisSim 5

Application Pack 2:
PWM
based
H-Bridge
power
control

®
❝Discovering VisSim has been a major turning point in
my career as a control engineer. VisSim allows me to
solve problems ten times faster than with tools
conventionally adopted by industry❞

Mike Borrello,
the technical computing people Senior Controls Engineer, Mallinckrodt, Inc.

VISSIM 5 APPLICATION PACK FROM ADEPT SCIENTIFIC


PWM based H-Bridge
power control
APPLICATION PACK 2
Contents

VisSim/Embedded Controls Developer Data Sheet ................................1

“H-Bridge Power Control with VisSim Embedded


Controls Developer for TI-C2000” ..........................................................2

isSim/Embedded Controls Developer is a

V package for the rapid prototyping and


creation of embedded controllers for the
Texas Instruments C2000 DSPs. A technical
overview of the software is given as well an
example in which H-Bridge control is
implemented through a TI-C2000 board.

VISSIM 5 APPLICATION PACK FROM ADEPT SCIENTIFIC


APPLICATION PACK 2
VisSim
PWM based H-Bridge power control

H-Bridge Power Implementing H-Bridge outputs on the C24x


with VisSim/ Embedded Controls Developer
Control with VisSim/ To obtain C24x PWM outputs to control an H-Bridge, you
will need a TI-C2407 (or C243) Full Compare block. This
Embedded Controls block will control either PWM1-6 or PWM7-12 (C2407
only). Note that the full compare output PWM’s all share
Developer for TI-C2000 the same base timer and so are synchronised to the same
base frequency. Also, the outputs are grouped in pairs, so
only the duty cycle of PWM1&2, PWM3&4, PWM5&6, etc.
H-Bridge control requires two PWM outputs, both of the can be controlled independently. You can also control
same duty cycle but 180 degrees out of phase. For power whether the output of a given PWM pair member is
conversion applications, the volt seconds integral across active high or active low in the Full Compare PWM dialog.
the transformer must be balanced. Thus if PWM1 is high To obtain the properly phased outputs we setup the base
for 30% of the period, then the other must also be high timer to be in up/down count mode and use PWM1 active
for exactly 30%. Under no circumstances should any pulse high, and PWM3 active low. PWM1 is driven with duty
be wider than 50%. Below is a detailed explanation. cycle command that varies between 0 and 50%, PWM3
(active low) is driven with duty cycle command that varies
Consider firing 4 IGBTs (Q1,Q2,Q3,Q4) in full H-bridge between 50% and 100%. Since the PWM3 duty cycle must
configuration to drive a transformer. You need 2 gate be the same as PWM1, we calculate it as (1 - PWM1).
drive signals, identical except for a 180 degree phase shift.

+Bus

Q1 Q2

transformer

Q3 Q4

-Bus
Fig. 1 Full H-Bridge

In Fig. 1 above, PWM1 drives gates of Q1 and Q4, PWM2


drives gates of Q2 and Q3. This yields an alternating
polarity voltage applied across the transformer, which
allows DC bus power to energise a transformer for
conversion to a different AC voltage.

Desired PWM action over 50 microsecond cycle:


Fig. 2 - Full Compare Properties Dialog
Time PWM1 PWM2 Action
The dialog from Fig. 2 above shows the configuration for
0us L->H L start positive half cycle
PWM1. This is setup for 40MHz/2000 for a 20KHz base
10us H->L L remove power frequency, Up/Down counter mode, Active High for
25us L L->H start negative half cycle PWM1, and has 2 microseconds of hardware provided
35us L H->L remove power
dead band. PWM3 is setup similarly in the same dialog,
except that it is Active low.
50us L->H L Repeat at time 0

• Tel: 01462 480055 • Fax: 01462 480213 • Email: vissim@adeptscience.co.uk • WWW: www.adeptscience.co.uk • WebStore: www.adeptstore.co.uk
VisSim
Fig. 3 - VisSim/Embedded Controls Developer diagram for H-Bridge Control

The VisSim diagram from Fig. 3 shows the scaled fixed-point blocks required to implement a
simple H-Bridge control. Note that because the fixed point PI control output is scaled at 1.16 (1
binary digit to the left of the decimal place in a 16 bit word) and is followed by a gain of .5, the
largest value that can appear after the gain is .5, thus avoiding activation of both legs of the H-
Bridge simultaneously.
The Full Compare PWM block has 3 inputs that control the 3 PWM pairs PWM1-2, PWM3-4, For further
PWM5-6. Since we are only using PWM1 and PWM3, we have left the remaining PWM pins
configured as “Force Low”. We assume that the analog in has been scaled to produce the value 1 information on
at 10 Volts, thus the setpoint of .5 will result in an actual voltage setpoint of 5 volts. VisSim 5 please
contact your
nearest Adept
Scientific Office

UK
Adept Scientific plc
Amor Way, Letchworth,
Herts, SG6 1ZA, UK
Tel: 01462 480055
Fax: 01462 480213
Email: info@adeptscience.co.uk
WWW: www.adeptscience.co.uk
WebStore: www.adeptstore.co.uk

Denmark
Adept Scientific Aps
Nordre Jernbanevej 13C,
DK-3400 Hillerød, Denmark
Tel: +45 48 25 17 77
Fax: +45 48 24 08 47
Email: infodk@adeptscientific.dk
WWW: www.adeptscientific.dk
WebStore: www.adeptstore.dk

USA
Adept Scientific plc
7909 Charleston Court,
Bethesda, MD 20817, USA
Tel: +1 (301) 365-0720
Fax: +1 (301) 767-1675
Email: info@adeptscience.com
WWW: www.adeptscience.com
WebStore: www.adeptstore.com
®

Copyright © 2002
Adept Scientific plc.
All rights reserved.
All trademarks
recognised.

E&OE
APPLICATION PACK 2
VisSim Embebbed Controls Developer

A Smarter, Faster Way for Highlights


Embedded Control Design • Performs rapid • Performs automatic
prototyping and programming of
VisSim/Embedded Controls Developer is software generates code for on-chip peripherals for
for the rapid prototyping and creation of embedded embedded system TI F243 and F2407 EVMs,
controllers for the Texas Instruments C2000 DSPs. development on the and LF2407 eZdsp
VisSim/Embedded Controls Developer simulates and C2000 • Validates algorithm
generates scaled, fixed-point ANSI C code, as well as on- • Generates production using off-line simulation
chip peripherals specific to the TI C2000 DSPs. It supports C code with automatic • Uses JTAG hotlink for
the TI F243 EVM, LF2407 EVM, and the LF2407 eZdsp scaling of fixed-point downloading and
evaluation boards. operations real-time
• Simulates the effects communication for
of scaled, fixedpoint plotting responses and
The Rapid Prototyping Process truncation and interactively changing
precision loss parameters during DSP
Using VisSim/Embedded Controls Developer, you can build a • Logs minimum and execution
model of your entire system, including the control algorithm maximum values • Retains the VisSim GUI
and the plant, generate production code, and then observed during while the algorithm
download the code to the target DSP. simulation executes on the DSP
VisSim/Embedded Controls Developer lets you develop the
• Compiles, links, and • Supports serial port
controller subsystem in scaled, fixed point and model the
plant in full-precision floating point. Once the model is downloads the based LCD display
complete, you can simulate it in VisSim to verify the algorithm to the
behaviour of the algorithm. Results are easily viewed in target DSP
graphical plots.

Serial LCD
Serial LCD blocks support up to 4-line-by-20-column
serial interfaced LCDs. You can compose text prompts,
numeric formatting, field placement, and page address for
each block. Additionally, runtime paging commands are
supported. Serial baud rate, serial protocol, and LCD vendor
format are user-configurable.

Scaled, Fixed-Point Algorithms


The VisSim/Fixed-Point block set performs simulation and
efficient code generation of scaled, fixed point operations.
Overflow and precision loss effects are easily seen and
corrected at simulation time. Auto-scaling speeds fixed-point
development, while in-line code generation creates fast
Target-Specific Blocks target code.
VisSim/Embedded Controls Developer provides target
specific blocks that generate production code for on-chip
devices. These blocks include analog inputs, simple PWMs,
event captures, SPIs, I/O port reads and writes, digital

I/Os, quadrature encoders, six-channel space vector


PWMs, CAN 2.0, and serial ports. Dialog box for
the Fixed-Point
PI Regulator
Can Bus Support block. Parameter
CAN bus supports all six CAN mailboxes on the TI C2000 values will be
automatically
series. Baud rates to 2 megabits are supported. Mailboxes scaled for the
are configurable from 0- to 8-byte data packet size. User- simulation and
configurable addressing can be 11 bits or 23 bit extended. code generation.
Remote frame requests an auto answer are also supported.

• Tel: 01462 480055 • Fax: 01462 480213 • Email: vissim@adeptscience.co.uk • WWW: www.adeptscience.co.uk • WebStore: www.adeptstore.co.uk
TI C2000 Digital Motor Control
Block Set
VisSim
The TI C2000 Digital Motor Control block set is
used for simulation and production code
generation of efficient, hand-coded assembler
for motion control systems based on AC Automatic comments and full


induction, brushless DC, permanent magnet variable names consistent with
those used in block diagram


synchronous and stepper motors. It includes PID
make code very readable and
Regulators, PWM Drivers, “3rd Harmonic” Space portable.
Vector Waveform Generators, Park and Clarke
Transforms, and Volts-to-Hertz Profiles. Fixed-point operations
implemented as in-line macros
and shift operations resulting in
fast execution speed and small
DSP-in-the-Loop Simulation footprint.

After simulation, the controller can be run on


the target DSP, and take inputs from VisSim and
write outputs to VisSim. VisSim/Embedded
Controls Developer generates production quality
fixed-point code, compiles, and links it. You can
then replace the simulated controller with a DSP For further
interface block, which automatically configures
with the controller .OUT file and performs a
information on
JTAG download to the target DSP. In DSP-in-the- VisSim 5 please
loop simulation, the plant model runs on the contact your
host computer in VisSim while the control
algorithm runs in real time on the target DSP. nearest Adept
Real-time communication between the target Scientific Office
DSP and VisSim is performed via the JTAG
hotlink. The VisSim GUI is retained while you

change controller gains and plot controller UK
Automatically generated project from VisSim/Code Composer
Adept Scientific plc
responses from the DSP. Studio plug-in.
Amor Way, Letchworth,
Herts, SG6 1ZA, UK
Tel: 01462 480055
What Comes with VisSim/Embedded
Automatic Algorithm FLASH Burn Fax: 01462 480213
Controls Developer Email: info@adeptscience.co.uk
Once the algorithm has been validated on the WWW: www.adeptscience.co.uk
target DSP, ANSI C code is generated for the • Professional VisSim WebStore: www.adeptstore.co.uk
controller in standalone mode suitable for FLASH • VisSim/Fixed-Point blocks and design tools
burn. At the push of a button, VisSim/Embedded Denmark
• TI C2000 Digital Motor Control block set Adept Scientific Aps
Controls Developer automatically burns the
algorithm into the FLASH memory on the DSP. • Peripheral blocks that generate code for on- Nordre Jernbanevej 13C,
chip devices DK-3400 Hillerød, Denmark
It also automatically takes into account CPU
• VisSim/Code Composer Studio plug-in for Tel: +45 48 25 17 77
speed and PLL rates. Example of automatic fixed- Fax: +45 48 24 08 47
point code generation. automatic project creation Email: infodk@adeptscientific.dk
WWW: www.adeptscientific.dk
WebStore: www.adeptstore.dk
VisSim/Code Composer Studio
USA
Plug-In Adept Scientific plc
The VisSim/Code Composer Studio plug-in creates 7909 Charleston Court,
a CCS project that includes the generated code Bethesda, MD 20817, USA
Tel: +1 (301) 365-0720
targeted for the TI C2000 DSP, allowing the code Fax: +1 (301) 767-1675
to be integrated with other user-developed Email: info@adeptscience.com
code. The project includes the generated .C file, WWW: www.adeptscience.com
as well as the necessary VisSim support libraries. WebStore: www.adeptstore.com
®

Copyright © 2002
Adept Scientific plc.
All rights reserved.
All trademarks
recognised.

E&OE

You might also like