P. 1
01279A (AN1279) - Offline UPS Reference Design Using the dsPIC® DSC

01279A (AN1279) - Offline UPS Reference Design Using the dsPIC® DSC

|Views: 184|Likes:
Published by bubulescu

More info:

Published by: bubulescu on Aug 27, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/07/2014

pdf

text

original

© 2009 Microchip Technology Inc.

DS01279A-page 1
AN1279
UPS OVERVIEW
An Uninterruptible Power Supply, or UPS, is an
electronic device that provides an alternative electric
power supply to connected electronic equipment when
the primary power source is not available.
Unlike auxiliary power, a UPS can provide instant
power to connected equipment, which can protect
sensitive electronic devices by allowing them to shut
down properly and preventing extensive physical
damage. However, a UPS can only supply energy for a
limited amount of time, typically 15 to 20 minutes.
Although its use can extend to a virtually unlimited list
of applications, in past years the UPS has become
even more popular as a means of protecting computers
and telecommunication equipment, thus preventing
serious hardware damage and data loss.
Application Markets for UPS Systems
UPS systems provide for a large number of applica-
tions in a variety of industries. Their common applica-
tions range from small power rating for personal
computer systems to medium power rating for medical
facilities, life-support systems, data storage, and emer-
gency equipment, and high power rating for telecom-
munications, industrial processing, and online
management systems. Different considerations should
be taken into account for these applications. As an
example, a UPS for emergency systems and lighting
may support the system for 90-120 minutes. For other
applications like computer backup power, a UPS may
typically support the system for 15-20 minutes. If power
is not restored during that time, the system will be
gracefully shut down.
If a longer backup period is considered, a larger battery
is required. For process equipment and high power
applications, some UPS systems are designed to pro-
vide enough time for the secondary power sources,
such as diesel generators, to start up.
Types of UPS Systems
A typical UPS for computers has four basic protection
roles: being able to cope with power surges, voltage
shortage, complete power failure and wide variations in
the electric current frequency. There are three types of
UPS systems, depending on how the electric power is
being stored and relayed to the electronic device
connected to them:
• Offline UPS (also known as Standby UPS)
• Line-Interactive (or Continuous UPS)
• Online UPS (often called double conversion supply)
OFFLINE UPS
An Offline UPS system (see Figure 1), redirects the
electric energy received from the AC input to the load
and only switches to providing power from the battery
when a problem is detected in the utility power. Per-
forming this action usually takes a few milliseconds,
during which time the power inverter starts supplying
electric energy from the battery to the load.
FIGURE 1: OFFLINE UPS DIAGRAM
Authors: Sagar Khare
Mohammad Kamil
Microchip Technology Inc.
Load
Inverter
Battery
Charger
AC Input
Offline UPS Reference Design Using the dsPIC
®
DSC
AN1279
DS01279A-page 2 © 2009 Microchip Technology Inc.
LINE-INTERACTIVE UPS
A Line-Interactive UPS (see Figure 2), always relays
electric energy through the battery to the load. When
AC mains power is available, the battery is being
charged continuously. At the same time, the UPS reg-
ulates the AC output voltage and the lag related to cou-
pling the inverter is nearly zero. When a power outage
occurs, the transfer switch opens and the electric
energy flows from the battery to the load (Stored
Energy mode). Due to these characteristics, continu-
ous UPS systems tend to be somewhat more expen-
sive than an offline UPS.
FIGURE 2: LINE-INTERACTIVE UPS
DIAGRAM
ONLINE UPS
An Online UPS (see Figure 3), combines the two basic
technologies of the previously described UPS models,
with rectifiers and inverter systems working all of the
time. As is the case with a Line-Interactive UPS, the
power transfer is made instantly as an outage occurs,
with the rectifier simply being turned off while the
inverter draws power from the battery. As utility power
is again established, the inverter continues to supply
power to the connected devices, while the rectifier
resumes its activity, recharging the battery. This design
is sometimes fitted with an additional transfer switch for
bypass during a malfunction or overload.
FIGURE 3: ONLINE UPS DIAGRAM
SYSTEM SPECIFICATIONS
The reference design in this application note describes
the design of an Offline Uninterruptible Power Supply
(UPS) using a Switch Mode Power Supply (SMPS)
dsPIC
®
Digital Signal Controller (DSC).
The Offline UPS Reference Design consists of three
major UPS topology blocks:
• Push-Pull Converter (steps up the DC battery volt-
age to a constant high-voltage DC)
• Full-Bridge Inverter (converts DC voltage to a
sinusoidal AC output)
• Flyback Switch Mode Charger (current source
and charges battery with constant current)
The input and output specifications are shown in
Table 1.
TABLE 1: I/O SPECIFICATIONS
Load
Static Switch
AC Input
Inverter
Battery
Normal mode
Stored-energy mode
Legend:
220V UPS Version Specifications
AC Input 220 VAC ±10%, 50 Hz ±3 Hz
DC Input 3 x 12 VDC (lead acid battery)
UPS Output 220 VAC, 50 Hz ±1 Hz,
sinusoidal
Rating 1000 W/1000 VA,
(1300VA - 2 seconds)
Input Filtering EMI/RFI filtering
110V UPS Specifications
AC Input 110 VAC ±10%, 60 Hz ±3 Hz
DC Input 3 x 12 VDC (lead acid battery)
UPS Output 110 VAC, 60 Hz ±1 Hz,
sinusoidal
Rating 1000 W/1000 VA,
(1300VA - 2 seconds)
Input Filtering EMI/RFI filtering
Load
Static Switch
AC Input
Inverter
Battery
Rectifier/
(Static Bypass)
Charger
© 2009 Microchip Technology Inc. DS01279A-page 3
AN1279
1 kVA OFFLINE UPS REFERENCE
DESIGN
The Offline UPS system shown in Figure 4 operates in
Standby mode and in UPS mode. When AC line voltage
is present, the system is in Standby mode until a failure
occurs on the AC line. During Standby mode, the bat-
tery is charged and is maintained after becoming fully
charged. When the battery is charging, the inverter
works as a rectifier through the IGBT’s anti-parallel
diodes. The flyback switch mode charger acts as a cur-
rent generator and provides constant charging current
to the battery.
After a power failure, the system is switched to UPS
mode. In this situation, the DPDT relay is turned OFF
to prevent power from being delivered to the AC line.
The push-pull converter steps up the battery voltage to
380 VDC. The high DC voltage is then converted with
the full-bridge inverter and filtered with an LC filter to
create a pure sine wave 220/110 VAC output where
load is connected. This power switchover sequence is
made in less than 10 ms.
FIGURE 4: OFFLINE UPS REFERENCE DESIGN
EMI Filter
Battery
DPDT
Relay
LC Filter
Full-Bridge
Inverter/
Rectifier
Push-Pull
DC/DC
Converter
Flyback Switch
Mode Charger
Constant Current
220 VAC,
50 Hz
Load
220 VAC
380 VDC 3 X 12 VDC
AN1279
DS01279A-page 4 © 2009 Microchip Technology Inc.
Listing of I/O Signals for Each Block,
Type of Signal, and Expected Signal
Levels
PUSH-PULL CONVERTER
As specified in Figure 5, measurement of DC output
voltage (UDCM) is required to implement the control
algorithm. The EPP signal is for enabling the driver, the
temperature sensor measures heat sink temperature,
and the primary current measurement (IP) protects the
converter in case of transformer flux walking. The PWM
outputs from the dsPIC DSC are firing pulses to the
driver to control the output voltage.
FIGURE 5: PUSH-PULL CONVERTER RESOURCE DIAGRAM
Table 2 lists the resources used by the dsPIC DSC
device for a push-pull converter.
TABLE 2: RESOURCES REQUIRED FOR A DIGITAL PUSH-PULL CONVERTER
UDCM+
UDCM-
UBAT
PGND
DRIVER
dsPIC33FJ16GS504
P
W
M
P
W
M
Temperature
Sensor
A
D
C
A
D
C
A
D
C
IPM
EPP
I
/
O
T
A
D
C
UCDM
UB
IP
Signal Name Type of Signal
dsPIC
®
DSC
Resources Used
Expected Signal Level
UDCM Analog AN3 2.99V
IP Analog AN2 0V-1.65V
T (optional, not implemented
in software)
Analog AN8 0V-3.3V
UB Analog AN5 1.5V-1.98V
EPP Enable driver, Digital RB6 —
Push-Pull Gate Drive Digital PWM3H, PWM3L —
© 2009 Microchip Technology Inc. DS01279A-page 5
AN1279
FULL-BRIDGE INVERTER
The block diagram in Figure 6 illustrates that
measurement of the AC output voltage (ACO) is
required to implement the control algorithm. With
measurement of the output current (I), that current can
be limited to prevent overloading of the converter. The
presence of power grid voltage is detected with
measurement of (ACI) voltage. When power grid
voltage fails, signal A2 turns off the relay K2 and
prevents power flow to the line when the UPS is
operational. Signal A1 controls the K1 relay, which is off
when DC link voltage is low to prevent current inrush in
the DC link capacitors when power grid voltage is fed
to the rectifier. This happens when the UPS is
operational and the battery is depleted, the UPS goes
off or initial system connect to grid power. The
FLT_CLR signal is used to reset the driver when a fault
is detected. FAULT/SD and SYS_FLT are used to
enable or disable the driver or detect driver faults.
Detailed descriptions of these signals can be found in
the data sheet of the drivers (IR2214). Switching of the
inverter leg IGBTs is controlled by firing pulses S3, S4
and S5, S6, and is generated by the dsPIC DSC PWM
modules.
FIGURE 6: DIGITAL FULL-BRIDGE INVERTER RESOURCE DIAGRAM
Table 3 shows the resources used by a dsPIC DSC
device for a full-bridge inverter.
TABLE 3: RESOURCES REQUIRED FOR A DIGITAL FULL-BRIDGE INVERTER
R
L C
ACI2M
ACI1M
UDC+
PGND
F
L
T
_
C
L
R
F
A
U
L
T
/
S
D
S
Y
S
_
F
L
T
F
L
T
_
C
L
R
F
A
U
L
T
/
S
D
S
Y
S
_
F
L
T
dsPIC33FJ16GS504
P
W
M
P
W
M
A
D
C
I
/
O ADC I
/
O
I
/
O
I
/
O
P
W
M
P
W
M
ACO1M ACO2M
A1 (Inverter Series Relay)
A2 (Mains Relay)
I/O
ADC
DRIVER
DRIVER
S3
S4
S5
S6
I
Load
Power Grid
ACO
ACI
K
F
(1)
K
G
(1)
Note 1: KF and KG are feedback gain circuits. Refer to Appendix D: “Schematics and Board Layout” for details.
Signal Name Type of Signal
dsPIC
®
DSC
Resources Used
Expected Signal Level
ACO Analog AN1 0.27V-3.3V
ACI Analog AN11 0.15V-3.16V
I Analog AN0 2.5V (nominal)
A1 Digital output RC10 —
A2 Digital output RC0 —
FLT_CLR Digital output RB7 —
FAULT/SD Digital input (external interrupt) RC13 (INT1) —
SYS_FLT Digital input RC8 —
S3, S4 (gate drive) PWM output PWM1H, PWM1L —
S5, S6 (gate drive) PWM output PWM2H, PWM2L —
AN1279
DS01279A-page 6 © 2009 Microchip Technology Inc.
FLYBACK SWITCH MODE CHARGER
The block diagram in Figure 7 shows that an analog
current controller is used for battery charging. Four sig-
nals are needed: EFB signal for enabling topswitch, (IB)
for measuring battery charging current, (UB) for mea-
suring battery voltage and IREF for reference set with
PWM4L output.
FIGURE 7: DIGITAL FLYBACK SWITCH MODE CHARGER RESOURCE DIAGRAM
Table 4 shows the resources used by the dsPIC DSC
device for a flyback switch mode charger.
TABLE 4: RESOURCES REQUIRED FOR A DIGITAL FLYBACK SWITCH MODE CHARGER
UDC+
PGND
TOPSWITCH
PI
UBAT
PGND
ENABLE
+15V
IFEEDBACK
IERROR
-
IREF
Analog Controller
Shunt
dsPIC33FJ16GS504
PWM
ADC
I/O
IB
EFB
Flyback
transformer
ADC
PI
45V
UFEEDBACK
UB
K
3
(1)
K
4
(1)
Note 1: K1 and K2 are feedback gain circuits. Refer to Appendix D: “Schematics and Board Layout” for details.
Signal Name Type of Signal
dsPIC
®
DSC
Resources Used
Expected Signal Level
IBATM Analog AN4 0V-1.67V
UBAT Analog AN5 1.5V-2V
EFB Digital output RC7 —
IREF PWM output PWM4L —
© 2009 Microchip Technology Inc. DS01279A-page 7
AN1279
DC/DC CONVERTER
Most UPS designs contain a transformer-type DC/DC
converter. The transformer provides electrical isolation
between the input and output of the converter. The
transformer also provides the option to produce
multiple voltage levels by changing the turns ratio, or
provide multiple voltages by using multiple secondary
windings.
Transformer-type DC/DC converters are divided into
five basic topologies:
• Forward Converter
• Push-Pull Converter
• Half-Bridge Converter
• Full-Bridge Converter
• Flyback Converter
The Flyback topology operation differs slightly from
other topologies in that energy is stored in magnetic
material and then released. Other topologies always
transfer energy directly from input to output. Another
case in which topologies are distinguished from each
other is transformer core utilization:
• Unidirectional core excitation – where only the
positive part (quadrant 1) of the B-H loop is used
(flyback and forward converters)
• Bidirectional core excitation – where both the posi-
tive (quadrant 1) and the negative (quadrant 3) parts
of the B-H loop are utilized alternatively (push-pull,
half-bridge, and full-bridge converters)
Selection of a topology depends on careful analysis of
the design specifications, cost and size requirements of
the converter.
Operation of each of the above topologies is described
in the following sections of this application note. Details
of the topology selection and hardware design are
provided in subsequent sections.
Forward Converter
A forward converter, which can be a step-up or step-
down converter, is shown in Figure 8. When the
transistor Q is ON, VIN appears across the primary, and
then generates output voltage determined by
Equation 1.
The diode D1 on the secondary ensures that only
positive voltages are applied to the output circuit while
D2 provides a circulating path for inductor current if the
transformer voltage is zero or negative. A third winding
is added to the transformer of a forward converter, also
known as a “reset winding”. This winding ensures that
the magnetization of the transformer core is reset to
zero at the start of the switch conduction. This winding
prevents saturation of the transformer.
FIGURE 8: FORWARD CONVERTER
EQUATION 1:
VIN
D1
D2
+
-
+
-
D3
T
L
VOUT
Q
+ +
+
2
1
out in
N
V V d
N
= · ·
where d is the duty cycle of the transistor Q
AN1279
DS01279A-page 8 © 2009 Microchip Technology Inc.
Push-Pull Converter
A push-pull converter is shown in Figure 9. When Q1
switches ON, current flows through the upper half of
the T1 transformer primary and the magnetic field in T1
expands. The expanding magnetic field in T1 induces a
voltage across the T1 secondary; the polarity is such
that D2 is forward-biased and D1 is reverse-biased. D2
conducts and charges the output capacitor C2 via L1.
L1 and C2 form an LC filter network. When Q1 turns
OFF, the magnetic field in T1 collapses and after a
period of dead time (dependent on the duty cycle of the
PWM drive signal), Q2 conducts, current flows through
the lower half of T1's primary, and the magnetic field in
T1 expands. At this point, the direction of the magnetic
flux is opposite to that produced when Q1 conducted.
The expanding magnetic field induces a voltage across
the T1 secondary; the polarity is such that D1 is for-
ward-biased and D2 is reverse-biased. D1 conducts
and charges the output capacitor C2 via L1. After a
period of dead time, Q1 conducts and the cycle
repeats.
FIGURE 9: PUSH-PULL CONVERTER
There are two important considerations with the
push-pull converter:
• Both transistors must not conduct together, as this
would effectively short circuit the supply. This
means that the conduction time of each transistor
must not exceed half of the total period (d < 0.5)
for one complete cycle, otherwise conduction will
overlap.
• The magnetic behavior of the circuit must be
uniform; otherwise, the transformer may saturate,
and this would cause destruction of Q1 and Q2.
This behavior requires that the individual
conduction times of Q1 and Q2 must be exactly
equal and the two halves of the center-tapped
transformer primary must be magnetically
identical.
These criteria must be satisfied by the control and drive
circuit and the transformer. The output voltage equals
that of Equation 2.
EQUATION 2:
VIN
Q1
D1
+
D2
Q2
C2
VOUT
L1
+
0V
C1
+
0V
+ +
+ +
T1
+
2
1
2
out in
N
V V d
N
= · · ·
where:
0 < d < 0.5 d is the duty cycle of the transistors and
N2/N1 is the secondary-to-primary turns ratio of
the transformer
© 2009 Microchip Technology Inc. DS01279A-page 9
AN1279
Half-Bridge Converter
The half-bridge converter (see Figure 10) is similar to
the push-pull converter, but a center-tapped primary is
not required. The reversal of the magnetic field is
achieved by reversing the direction of the primary wind-
ing current flow. In this case, two capacitors. C1 and
C2, are required to form the DC input mid-point. Tran-
sistors Q1 and Q2 are turned ON alternately to avoid a
supply short circuit, in which case the duty cycle, d,
must be less than 0.5.
For the half-bridge converter, the output voltage VOUT
equals that of Equation 3.
FIGURE 10: HALF-BRIDGE CONVERTER
EQUATION 3:
D1
+
D2
Q1
Q2
L1
C1
C2
+VOUT
0V
+
+VIN
0V
T1
C3
+
+
+
+
2
1
out in
N
V V d
N
= · ·
where:
0 < d < 0.5 d is the duty cycle of the transistors and
N2/N1 is the secondary-to-primary turns ratio of
the transformer
AN1279
DS01279A-page 10 © 2009 Microchip Technology Inc.
Full-Bridge Converter
The full-bridge converter topology shown in Figure 11,
is basically the same as the half-bridge converter,
where four transistors are used.
Diagonal pairs of transistors (Q1-Q4 or Q2-Q3) con-
duct alternately, thus achieving current reversal in the
transformer primary. Output voltage equals that of
Equation 4.
FIGURE 11: FULL-BRIDGE CONVERTER
EQUATION 4: Flyback Converter
Figure 12 shows a flyback converter circuit. When tran-
sistor Q1 is ON, due to the winding polarities, the diode
D1 becomes reverse-biased. Therefore, transformer
core flux increases linearly. When transistor Q1 is
turned OFF, energy stored in the core causes the cur-
rent to flow in the secondary winding through the diode
D1 and flux decreases linearly. Output voltage is given
by Equation 5.
FIGURE 12: FLYBACK CONVERTER
EQUATION 5:
D1
D2
Q3
Q4
L1
C1
+VOUT
0V
+
+VIN
0V
T1
C2
+
+
+
+
Q1
Q2
2
1
2
out in
N
V V d
N
= · · ·
where:
0 < d < 0.5 d is the duty cycle of the transistors and
N2/N1 is the secondary-to-primary turns ratio of
the transformer
+VIN
Q1
D1
+
0V
+VOUT
C2
C1
+
0V
+
+
T1
2
1
1
out in
N d
V V
N d
= · ·
÷
© 2009 Microchip Technology Inc. DS01279A-page 11
AN1279
VOLTAGE SOURCE INVERTER (VSI)
A single-phase Voltage Source Inverter (VSI) can be
defined as a half-bridge and a full-bridge topology. Both
topologies are widely used in power supplies and
single-phase UPS systems.
Half-Bridge VSI
Figure 13 shows the topology of a Half-Bridge VSI,
where two large capacitors are required to provide a
neutral point N, such that each capacitor maintains a
constant voltage v
i
÷ 2. Because the current harmonics
injected by the operation of the inverter are low-order
harmonics, a set of large capacitors (C+ and C-) is
required. The duty cycle of the switches is used to
modulate the output voltage. The signals driving the
switches must ensure some dead time to prevent
shorting of the DC bus.
FIGURE 13: SINGLE-PHASE
HALF-BRIDGE VSI
Full-Bridge VSI
Figure 14 shows the topology of a Full-Bridge VSI. This
inverter is similar to the half-bridge inverter; however, a
second leg provides the neutral point to the load. Both
switches S1+ and S1- (or S2+ and S2-) cannot be on
simultaneously because a short circuit across the DC
link voltage source v
i
would be produced. To avoid the
short circuit across the DC bus and the undefined AC
output voltage condition, the modulating technique
should ensure that either the top or the bottom switch
of each leg is ON at any instant. The AC output voltage
can take values up to the DC link value v
i
, which is
twice the value obtained with half-bridge VSI topolo-
gies. Several modulating techniques have been devel-
oped that are applicable to full-bridge VSIs. Among
them, the best known are bipolar and unipolar PWM
techniques.
FIGURE 14: SINGLE-PHASE FULL-BRIDGE VSI
D+ S+
D- S-
VI
VI ÷ 2
VI ÷ 2
C+
C-
a
VO
+
-
i
o
+
-
+
-
i
i
N
+
-
D1+ S1+ D2+ S2+
D2- S2- D1- S1-
VI
VI C+
a
b
VO
+
-
i
o
+
-
i
i
+
-
AN1279
DS01279A-page 12 © 2009 Microchip Technology Inc.
BATTERY CHARGER
When the AC mains voltage is present, the Offline UPS
charges the batteries, and therefore, a battery charger
circuit is implemented.
Most battery chargers can be divided into four basic
design types, or topologies:
• Linear Chargers
• Switch Mode Chargers
• Ferroresonant Chargers
• SCR Chargers
Linear Chargers
Linear chargers consist of a power supply, which
converts AC power to lower voltage DC power, and a
linear regulating element, which limits the current that
flows into the battery. The power supply typically
consists of a transformer that steps down AC power
from 220/110 VAC to a lower AC voltage closer to that
of the battery, and a rectifier that smooths out the
existing sinusoidal AC signal into a constant-voltage
DC signal. The linear regulating element may be a
passive component such as a resistor or an active
component such as a transistor that is controlled by a
reference signal. Figure 15 shows a simplified
schematic of a linear charger with a linear power supply
with a resistor as the current regulating element.
Switch Mode Chargers
In a switch mode charger, AC voltage is rectified, and
then converted to a lower DC voltage through a DC/DC
converter. This type of charger contains additional
charge control circuitry to regulate current flow into the
battery. The charge control regulates the way in which
the power switch turns ON and OFF, and may be
accomplished through a circuit, a specialized inte-
grated chip, or some type of software control. A simpli-
fied schematic for a single piece switch mode charger
is shown in Figure 16.
FIGURE 15: LINEAR CHARGER
FIGURE 16: SWITCH MODE CHARGER
Power Supply
Charge
Control
DC Output
Battery
Current
Regulating
Element
R1
Rectifier Transformer
AC Input
DC Output
Battery
AC Input
Current Control
Logic
Power Supply
Output
Filter
Transformer
Power
Switch
Rectifier
© 2009 Microchip Technology Inc. DS01279A-page 13
AN1279
Ferroresonant Chargers
Ferroresonant chargers (sometimes called ferro char-
gers), operate by way of a special component called a
ferroresonant transformer. The ferroresonant trans-
former reduces the AC voltage to a lower regulated
voltage level while simultaneously controlling the
charge current. A rectifier then converts the AC power
to DC power suitable for the battery. Figure 17 shows a
block diagram of a ferroresonant charger.
SCR Chargers
SCR chargers use a special component known as a
Silicon-Controlled Rectifier (SCR) to control the current
to the battery. The SCR is a controllable switch that can
be turned ON and OFF multiple times per second. After
a transformer reduces utility voltage to a value near
that of the battery, the diodes rectify the current while
the SCR enables the flow of charge current according
to a control signal. A block diagram of an SCR charger
is shown in Figure 18.
FIGURE 17: FERRORESONANT CHARGER
FIGURE 18: SCR CHARGER
DC Output
Battery
AC Input
Ferroresonant
Transformer
Rectifier
Power Supply
Charge
Control
DC Output
Battery
AC Input
Current
Limiter
SCR
Diode
Rectifier
Transformer
Power Supply Charge Control
AN1279
DS01279A-page 14 © 2009 Microchip Technology Inc.
SOFTWARE DESIGN
The Offline UPS Reference Design is controlled by a
single dsPIC DSC device as shown in the system block
diagram in Figure 19.
FIGURE 19: OFFLINE UPS BLOCK DIAGRAM
The dsPIC DSC device is the heart of the Offline UPS.
It controls all critical operations of the system as well as
the housekeeping operations. The functions of the
dsPIC DSC can be broadly classified into the following
categories:
• All power conversion algorithms
• UPS state machine for the different modes of
operation
• Auxiliary tasks including true RMS calculations,
soft start routines and user interface routines.
The dsPIC DSC device offers “intelligent power periph-
erals” specifically designed for power conversion appli-
cations. These intelligent power Peripherals include
the High-Speed PWM, High-Speed 10-bit ADC, and
High-Speed Analog Comparator modules.
These peripheral modules include features that ease
the control of any switch-mode power supply with high
resolution PWM, flexible ADC triggering, and
comparator fault handling.
In addition to the intelligent power peripherals, the
dsPIC DSC also provides built-in peripherals for digital
communications including I
2
C™, SPI and UART that
can be used for power management and housekeeping
functions.
User Interface Block
Power Conversion Block
dsPIC
®
DSC
Push-Pull
Converter
Full Bridge
Voltage-Source
Inverter
3x12V Batteries
Flyback Battery
Charger
Relay Logic
Auxiliary
Power
Supply
LCD Controller
PIC18F2420
USB
Controller
PIC18F2450
LCD Module USB Port
Computer
UPS
Output
Load
AC Mains Input Rectified
by Inverter Body Diodes
Legend:
Signal Flow
Power Flow
Note: For device details, refer to the dsPIC33F
“GS” series device data sheets. For more
information on the peripherals, refer to the
corresponding SMPS sections in the
“dsPIC33F Family Reference Manual”.
© 2009 Microchip Technology Inc. DS01279A-page 15
AN1279
A high-level diagram of the Offline UPS software struc-
ture is shown in Figure 20. As shown in this figure, the
software is broadly partitioned into two parts:
• UPS State Machine (includes power conversion
routines)
• User Interface Software
These partitions are described in more detail in
subsequent sections of this document.
FIGURE 20: OFFLINE UPS SOFTWARE: HIGH-LEVEL PARTITIONS
UPS State Machine
The Offline UPS software implements a state machine
to determine the mode of operation for the system. The
state machine is executed once every 100 µs inside a
timer Interrupt Service Routine (ISR). The state
machine configures the on-chip peripherals to execute
the correct power conversion algorithms.
During normal operation of the offline UPS, the state
machine configures the system peripherals to execute
the correct power conversion algorithms as determined
by the system state.
When a power failure occurs, the UPS state machine
initiates a switchover sequence from Battery Charger
mode to Inverter mode. When the AC mains is detected
again, the state machine executes the switchover from
Inverter mode to Battery Charger mode. These swi-
tchover functions must be executed in as little time as
possible to ensure uninterrupted power to the load.
The Battery Charger mode and Inverter mode are the
two normal operating modes of the Offline UPS. There
are two other modes of operation, namely System
Startup and System Error. Each mode of operation for
the Offline UPS is described in the following sections.
Figure 21 shows the Offline UPS state diagram.
UPS State Machine
(Interrupt Based)
Priority: Medium
Execution Rate: Medium
User Interface Software
Priority: Low
Execution Rate: Low
Power Conversion Algorithms
(Interrupt Based)
Priority: High
Execution Rate: High
Offline UPS Software
AN1279
DS01279A-page 16 © 2009 Microchip Technology Inc.
FIGURE 21: OFFLINE UPS STATE DIAGRAM
System Startup
When the Offline UPS is turned ON, the state of the
system is unknown. Therefore, the state machine first
monitors all system variables and determines the
starting state of the UPS.
During this time, the state machine also monitors for
fault conditions and ensures that all system variables
are within specification so that the UPS can switch to
normal operation.
System
Startup
System Error
Inverter Mode
Battery
Charger
Mode
M
A
I
N
S
_
N
O
T
_
O
K


M
A
I
N
S
_
O
K

&

D
C
_
L
I
N
K
_
U
N
D
E
R
V
O
L
T
A
G
E
M
A
I
N
S
_
O
K

&

D
C
_
L
I
N
K
_
O
V
E
R
V
O
L
T
A
G
E
B
A
T
T
E
R
Y
_
O
V
E
R
V
O
L
T
A
G
E
M
A
IN
S
_
O
K
&

D
C
_
L
IN
K
_
O
K
&
B
A
T
T
E
R
Y
_
L
O
W
M
A
I
N
S
_
N
O
T
_
O
K

&

D
C
_
L
I
N
K
_
O
K

&
B
A
T
T
E
R
Y
_
O
K
M
A
I
N
S
_
O
K

&

D
C
_
L
I
N
K
_
O
K

&
(
B
A
T
T
E
R
Y
_
O
K

|
|

B
A
T
T
E
R
Y
_
L
O
W
)
M
A
IN
S
_
O
K
&

D
C
_
L
IN
K
_
O
K
&
B
A
T
T
E
R
Y
_
L
O
W
D
C
_
L
I
N
K
_
U
N
D
E
R
V
O
L
T
A
G
E
D
C
_
L
IN
K
_
O
V
E
R
V
O
L
T
A
G
E
M
A
IN
S
_
O
K
&

D
C
_
L
IN
K
_
O
K
&
B
A
T
T
E
R
Y
_
O
K
M
A
IN
S
_
O
K
&

D
C
_
L
IN
K
_
O
K
&
B
A
T
T
E
R
Y
_
O
K
M
A
I
N
S
_
N
O
T
_
O
K

&
B
A
T
T
E
R
Y
_
U
N
D
E
R
V
O
L
T
A
G
E
B
A
T
T
E
R
Y
_
O
V
E
R
V
O
L
T
A
G
E
D
C
_
L
IN
K
_
U
N
D
E
R
V
O
L
T
A
G
E
D
C
_
L
IN
K
_
O
V
E
R
V
O
L
T
A
G
E
B
A
T
T
E
R
Y
_
O
V
E
R
V
O
L
T
A
G
E
M
A
IN
S
_
N
O
T
_
O
K
&
B
A
T
T
E
R
Y
_
U
N
D
E
R
V
O
L
T
A
G
E
B
A
T
T
E
R
Y
_
U
N
D
E
R
V
O
L
T
A
G
E
D
C
_
L
I
N
K
_
U
N
D
E
R
V
O
L
T
A
G
E
D
C
_
L
I
N
K
_
O
V
E
R
V
O
L
T
A
G
E
B
A
T
T
E
R
Y
_
O
V
E
R
V
O
L
T
A
G
E
M
A
IN
S
_
N
O
T
_
O
K
&
D
C
_
L
IN
K
_
O
K
&
B
A
T
T
E
R
Y
_
O
K
© 2009 Microchip Technology Inc. DS01279A-page 17
AN1279
BATTERY CHARGER MODE
If the AC mains voltage is detected, the Inverter mode
is disabled (if running) and the Offline UPS switches to
the Battery Charger mode. The dsPIC DSC device pro-
vides the reference current level with a variable duty
cycle PWM signal.
The battery voltage is measured to ascertain the state
of the battery. Depending on the battery state, the value
of the charging current is modified so as to achieve the
fastest charging time and also to prolong the life of the
batteries.
The battery charging profile has been configured for
sealed lead-acid (SLA) batteries, and is summarized in
Figure 22.
The battery charger control is implemented partly in
hardware and partly in software. A flyback converter IC
is used to produce a constant current source from the
rectified AC mains voltage. The dsPIC DSC device pro-
vides the reference signal for the output current of the
flyback converter.
This current reference signal is generated by filtering
the PWM output from the dsPIC DSC. The charging
current is controlled by modifying the duty cycle of the
current reference PWM signal.
When the Battery Charger mode is started, the dsPIC
DSC device sets up the minimum charging current.
Then, the battery voltage and battery current are mea-
sured using the high-speed 10-bit ADC module. The
measured battery voltage determines the charging
state, and the code specifies the correct charging cur-
rent from the battery charging profile shown in
Figure 22.
All system variables are monitored by the state
machine to initiate a switchover sequence if required.
When an AC mains power failure is detected, the state
machine switches the UPS operation to the Inverter
mode. If a fault is detected, the system state is changed
to System Error.
FIGURE 22: OFFLINE UPS BATTERY CHARGING PROFILE
Charging
Current
Battery Voltage
35.7V 40.5V 43.2V 45V
2.25A
0.1A
Trickle
Charging
State
Bulk
Charging
State
Over
Charging
State
Float
Charging
State
Charging
Off
30V
Note: Not drawn to scale
Charging
Off
AN1279
DS01279A-page 18 © 2009 Microchip Technology Inc.
BATTERY CHARGER INITIALIZATION
ROUTINE
When the offline UPS switches to the Battery Charger
mode, the code must ensure that the previous mode is
turned OFF. To reduce stress on the hardware
components, the full-bridge inverter is turned OFF
when the output reaches 0V. The flowchart for the
Battery Charger mode is shown in Figure 23.
After the inverter is turned OFF, the output relay is
released so that the AC mains is connected to the UPS
output. The output relay must be released in the short-
est possible duration so that there is no interruption of
power at the UPS output. Typically, relay switching
times are the limiting factor for the switchover duration.
FIGURE 23: BATTERY CHARGER INITIALIZATION FLOWCHART
UPS State Machine
Battery Charger Initialization
Priority: Medium
Battery
Charger
Mode
Inverter
Mode
System
Startup
Set Relay flag =
NOT_READY_TO_SWITCH
Is relay ready to switch?
(Relay flag cleared in ADC ISR)
Initiate relay release
Call 4 ms delay to allow inverter
output to become 0V
Turn OFF inverter PWM signals
Bypass DC link charging resistor
Call 12 ms delay to allow
complete release of relay
Reset charging state to UNKNOWN
and set minimum charging
Enable charging current
reference signal (PWM4L)
Enable Battery Charger
Flyback Converter
Push-Pull Control Loop
(ADC Interrupt)
Priority: High
Inverter Control Loop
(ADC Interrupt)
Priority: High
Battery Voltage and Current
Measurement
(ADC Interrupt)
Priority: Medium
AC Mains Detection
(ADC Interrupt)
Priority: Medium
Yes
No
current reference
© 2009 Microchip Technology Inc. DS01279A-page 19
AN1279
The dsPIC DSC device implements a predictive tech-
nique to achieve the fastest switchover time possible.
This is done by predicting the relay switching time and
initiating the relay release even before the inverter out-
put has turned OFF. The switchover operation from the
inverter to the AC mains is described in subsequent
sections of this application note.
BATTERY CHARGER CONTROL SCHEME
The battery charger control loop is implemented in the
state machine.
If the measured charging current is less than the refer-
ence, the duty cycle is incremented by a fixed step.
Conversely, if the charging current exceeds the refer-
ence, the duty cycle is reduced by the same fixed step.
This process continues until the current error reduces
to a negligible value.
The battery charging current control scheme is illus-
trated in Figure 24. The battery charger control routine
is called inside the state machine under the Battery
Charger mode. The battery charging control loop is
therefore executed at the same rate (once every
100 µs) and also at the same priority level as the state
machine. The battery current and voltage measure-
ment is triggered using the PWM trigger feature on the
dsPIC DSC device.
The measured data is scaled and stored as a variable
in data memory asynchronous to the control loop exe-
cution. When the control loop is called, the data is sim-
ply read from the data memory and used for control
loop calculations. The flowchart for the battery charger
control loop is shown in Figure 25.
FIGURE 24: BATTERY CHARGER CONTROL SCHEME
Quantizer
z
-1
Measured Charging Current
Charging Current
Reference
Duty Cycle
+K
-K
0
AN1279
DS01279A-page 20 © 2009 Microchip Technology Inc.
FIGURE 25: BATTERY CHARGER MODE FLOWCHART
UPS State Machine
Battery Charger Control Loop
Priority: Medium
Battery
Charger
Mode
Battery
Charger
Mode
Push-pull control loop
(ADC Interrupt)
Priority: High
Inverter control loop
(ADC Interrupt)
Priority: High
Battery Voltage and Current
Measurement
(ADC Interrupt)
Priority: Medium
AC Mains Detection
(ADC Interrupt)
Priority: Medium
Is battery voltage <
BATTERY_TRICKLE_VOLTAGE?
Is battery voltage <
BATTERY_BULK_VOLTAGE?
Is battery voltage <
BATTERY_FLOAT_VOLTAGE?
Is battery voltage <
BATTERY_VOLTAGE_MAX?
Set Minimum
Charging Current
Set Maximum
Charging Current
Yes
No
No
No
No
Yes
Yes
Yes
Calculate and set
Charging Current
Turn Charger
OFF
© 2009 Microchip Technology Inc. DS01279A-page 21
AN1279
BATTERY CHARGER RESOURCE ALLOCATION
FIGURE 26: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR BATTERY CHARGER
The dsPIC DSC device resources used for the battery
charger are summarized in Table 5.
TABLE 5: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR BATTERY CHARGER
Inverter Mode
If the AC mains voltage is not detected, the battery
charger is disabled and the Offline UPS switches to the
Inverter mode. During Inverter mode, the system is
running on battery power and produces a clean
sinusoidal voltage at the UPS output so that critical
electronics can continue operation without interruption.
The sinusoidal output waveform is generated using a
sine lookup table in the data memory. This lookup table
serves as the sinusoidal reference voltage for the
inverter control loop.
When starting Inverter mode, the push-pull converter is
ramped up to the rated DC Link voltage using a soft-
start routine. The soft-start routine reduces stress on
system components and also prevents voltage and
current surges from the AC mains or the battery.
During normal operation of Inverter mode, the push-
pull converter and the full-bridge inverter are controlled
by interrupt-based power conversion algorithms, or
control loops. The control loops are executed at a fast
rate to achieve the best performance. The Inverter
mode power conversion algorithms are the most critical
routines for the dsPIC DSC device; therefore, these
routines are assigned the highest user-priority level.
ADC ADC PWM
dsPIC33FJ16GS504
+
k
B
(2)
k
A
(2)
VBAT
GND
AC Input
Note 1
Note 1: The AC mains input is rectified by the body diodes of the IGBTs to provide a DC voltage to the battery charger.
2: KA and KB are feedback gain circuits. Refer to Appendix D: “Schematics and Board Layout” for details.
Signal
Name
Description Type of Signal
dsPIC
®
DSC
Resource Used
Execution Rate/Frequency
IREF Charging current reference PWM output PWM4L
(remapped to pin 35)
25 kHz
IB Charging current feedback Analog Input AN4 6.25 kHz
UB Battery voltage feedback Analog Input AN5 6.25 kHz
EFB Flyback converter enable Digital Output RC7 Activated only when the UPS
switches to Battery Charger mode
AN1279
DS01279A-page 22 © 2009 Microchip Technology Inc.
The state machine, which is also interrupt-based, has a
lower priority than the control loops. As a result, the
execution of the state machine and user interface code
may be interrupted numerous times by the high-priority
control loops.
This operation is possible because the dsPIC DSC
device allows for nesting of interrupts. The interrupt
nesting feature enables the control loops to interrupt
the execution of the state machine. The state machine
execution is relatively slower than the control loops.
The dsPIC DSC device allows for seamless transition
between the power conversion routines and the UPS
state machine, with the use of multiple interrupts of
differing priorities and execution rates.
When operating in the Inverter mode, all system vari-
ables are monitored by the state machine. As soon as
the AC mains voltage is detected, the switchover
sequence is engaged and the system state is changed
to Battery Charger mode. If any system variable is in
error, the system state is changed to System Error.
PUSH-PULL CONVERTER INITIALIZATION
When the system switches to Inverter mode, any previ-
ous modes of operation must first be disabled. There-
fore, the battery charger is first disabled by turning OFF
the flyback converter and also by disabling the PWM
output for battery current reference. The output relay is
engaged to disconnect the AC mains input from the
UPS output, while the inverter series resistor is
bypassed by switching ON the bypass relay. Then, the
push-pull converter control loop is reinitialized and all
control history is purged.
The AC mains input has a wide operating voltage
range; therefore, the value of the DC link voltage is
unpredictable when a mains failure occurs. As a result,
before turning ON the push-pull converter, the most
recently measured DC Link voltage is used as the initial
reference voltage for the push-pull converter. The soft-
start routine enables the DC Link voltage to be ramped
up at a controlled rate and thus prevents unnecessary
stress on the circuit components due to current spikes.
FIGURE 27: PUSH-PULL CONVERTER INITIALIZATION FLOWCHART
UPS State Machine
Push-pull Converter Initialization
Priority: Medium
Inverter
Mode
Battery
Charger
Mode
System
Startup
Disable Battery Charger
Flyback Converter
Switch output relay to disconnect
Mains from UPS output
Bypass DC link charging resistor
Push-pull control loop
(ADC Interrupt)
Priority: High
Inverter control loop
(ADC Interrupt)
Priority: High
Battery Voltage and Current
Measurement
(ADC Interrupt)
Priority: Medium
AC Mains Detection
(ADC Interrupt)
Priority: Medium
Turn OFF PWM signal for
battery current reference
Re-initialize push-pull control
loop to purge history
Set minimum duty cycle before
turning ON PWM outputs
Enable PWM outputs for push-pull
converter (PWM3H and PWM3L)
© 2009 Microchip Technology Inc. DS01279A-page 23
AN1279
SOFT-START ROUTINE
The soft-start routine is called right after enabling the
push-pull converter. The soft-start routine increments
the reference voltage for the push-pull converter in soft-
ware in fixed steps until the reference reaches the rated
DC Link voltage. At this point, the inverter is enabled by
calling the inverter re-initialization routine to produce a
sinusoidal voltage at the UPS output.
The ramp rate for the DC Link voltage is fixed and the
starting voltage for the soft-start routine is variable,
making the soft-start duration also variable.
The variable duration of the soft-start routine may
cause uncertainty in the mains-to-inverter switchover
time. The ramp rate for the soft-start routine is
configured to be completed in the time required for the
output relay to turn ON. This ensures that the
switchover time is within the design specification of
10 ms.
However, the other situation must also be considered
where the soft-start is completed in less time. In this
case, the inverter output will turn ON before the relay is
given enough time to switch, thereby causing the
inverter output to be turned ON at the UPS output
midway through the sine wave cycle. If the relay is
turned ON after the completion of the soft-start, the
switchover timing would be too slow.
The dsPIC DSC avoids both of these problems by ini-
tializing a delay counter at the beginning of the soft-
start routine. As the soft-start routine is ramping up the
DC Link voltage, the counter is incremented to reflect
the soft-start duration in milliseconds. If the soft-start is
completed before the minimum required time for the
relay turn-on, the code continues to wait until the mini-
mum required switching time has elapsed. Once the
required relay switching time elapses, the full-bridge
inverter is enabled. This technique ensures that unin-
terrupted power is available at the UPS output at all
times.
AN1279
DS01279A-page 24 © 2009 Microchip Technology Inc.
FIGURE 28: SOFT-START ROUTINE FLOWCHART
UPS State Machine
Push-pull Converter Initialization
Priority: Medium
Inverter
Mode
Start
Initialize delay counter
Push-pull control loop
(ADC Interrupt)
Priority: High
Inverter control loop
(ADC Interrupt)
Priority: High
Battery Voltage and Current
Measurement
(ADC Interrupt)
Priority: Medium
AC Mains Detection
(ADC Interrupt)
Priority: Medium
Set soft-start flag to allow higher
peak currents during startup
Clear soft-start flag
Is Push-pull converter
reference = final setpoint?
Yes
No
Increment push-pull
reference
Increment delay
counter
Does delay count represent
duration greater than relay
switching time?
Increment delay
counter
Yes
No
Push-Pull
Soft-Start
© 2009 Microchip Technology Inc. DS01279A-page 25
AN1279
FULL BRIDGE INVERTER INITIALIZATION
The push-pull soft-start routine ensures that the DC link
voltage is at the rated value and the output relay has
completed the switching event. After the soft-start
routine concludes, the full-bridge inverter must be
enabled to produce a sinusoidal voltage at the UPS
output.
The inverter control loop is reinitialized to purge all con-
trol history. The duty cycle is then configured to pro-
duce 0V output and the sine wave lookup table pointer
is also reset to the start. At this point, the PWM outputs
are enabled to produce the sinusoidal output voltage.
FIGURE 29: INVERTER INITIALIZATION FLOWCHART
UPS State Machine
Inverter Initialization
Priority: Medium
Inverter
Mode
Inverter
Mode
Re-initialize inverter control loop to
purge all control history
Set duty cycle to produce 0V output
Reset sine wave lookup table
to the start
Enable PWM outputs to turn ON
inverter (PWM1H, PWM1L,
PWM2H and PWM2L)
Push-pull control loop
(ADC Interrupt)
Priority: High
Inverter control loop
(ADC Interrupt)
Priority: High
Battery Voltage and Current
Measurement
(ADC Interrupt)
Priority: Medium
AC Mains Detection
(ADC Interrupt)
Priority: Medium
AN1279
DS01279A-page 26 © 2009 Microchip Technology Inc.
PUSH-PULL CONTROL LOOP
The push-pull converter is controlled with a voltage
mode control scheme. The PWM module in the dsPIC
DSC device is configured for Push-Pull mode with an
independent time-base. The DC Link voltage is
measured by the ADC and converted to a digital value.
This value is subtracted from the voltage reference in
software to obtain the voltage error.
The voltage error is then fed into a control algorithm
that produces a duty cycle value based on the voltage
error, previous error, and control history. The output of
the control algorithm is also clamped to minimum and
maximum duty cycle values for hardware protection.
The voltage mode control algorithm must be executed
at a fast rate in order to achieve the best transient
response. Therefore, the control algorithm is executed
in the ADC interrupt service routine, which is also
assigned the highest priority in the UPS code.
A block diagram of the push-pull converter control
scheme is shown in Figure 30.
FIGURE 30: PUSH-PULL CONVERTER CONTROL SCHEME
X PID
VREF
+-
PWM
S&H
1001010111
ADC
Voltage Feedback
VOUT
1:16
+
+
Vin
Voltage
Error
Control
Output
Duty
Cycle
© 2009 Microchip Technology Inc. DS01279A-page 27
AN1279
INVERTER CONTROL LOOP
The inverter output is generated by varying the voltage
reference using a sinusoidal lookup table. The mea-
sured output voltage is subtracted from the present ref-
erence value and the voltage error is obtained. The
voltage error is fed into the voltage error compensation
algorithm within the ADC interrupt service routine. The
output of the voltage error compensator produces the
current reference value. The measured output current
is subtracted from the current reference to obtain the
current error. The current error is used as the input to
the current error compensation algorithm to produce
the command signal for the PWM module.
In the Offline UPS, a 3-level control is implemented for
the full-bridge inverter. So the PWM module in the
dsPIC DSC device is set up with a fixed duty cycle for
zero output voltage. Each leg of the full-bridge inverter
is operated in complementary Center-Aligned mode
with dead time. The result of the control loop is added
to the nominal duty cycle for one leg of the full-bridge
inverter and subtracted from the nominal duty cycle for
the second leg.
A block diagram of the full-bridge inverter control
system is shown in Figure 31.
FIGURE 31: FULL-BRIDGE INVERTER CONTROL SCHEME
X PI X P
PWM
Sinusoidal Reference
Current
Reference
S&H
S&H
1001010111
ADC
1011010011
Output Filter
AC Out
Voltage Feedback
+ -
+ -
Voltage
Error
Current
Error
Control
Output
Duty
Cycle
Current
Feedback
AN1279
DS01279A-page 28 © 2009 Microchip Technology Inc.
PUSH-PULL CONVERTER HARDWARE AND
SOFTWARE RESOURCE ALLOCATION
FIGURE 32: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR PUSH-PULL CONVERTER
The dsPIC DSC resources used for the push-pull
converter are summarized in Table 6.
TABLE 6: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR PUSH-PULL CONVERTER
ADC
ADC
ADC PWM
dsPIC33FJ16GS504
PWM
FET
Driver
FET
Driver
k
D
k
C
VBAT
GND
+
Push-Pull Converter
VDC
GND
k
E
or
Analog Comparator
Signal
Name
Description Type of Signal
dsPIC
®
DSC
Resource Used
Sample Rate/
Frequency
S1 Push-Pull Drive Signal PWM Output PWM3L 100 kHz
S2 Push-Pull Drive Signal PWM Output PWM3H 100 kHz
IP Push-Pull Primary
Current Feedback
Analog Input AN2 25 kHz
UDCM DC Link Voltage
Feedback
Analog Input AN3 25 kHz
© 2009 Microchip Technology Inc. DS01279A-page 29
AN1279
FIGURE 33: dsPIC DSC
®
RESOURCE ALLOCATION FOR FULL-BRIDGE INVERTER
The dsPIC DSC device resources used for the full-
bridge converter are summarized in Table 7.
TABLE 7: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR FULL-BRIDGE CONVERTER
ADC
ADC
PWM PWM
dsPIC33FJ16GS504
PWM PWM
IGBT
Driver
IGBT
Driver
IGBT
Driver
IGBT
Driver
k
F
k
G
VOUT+
VOUT-
Full-Bridge Inverter VDC
GND
Signal
Name
Description Type of Signal
dsPIC
®
DSC
Resource Used
Sample Rate/
Frequency
S3 Inverter Drive Signal PWM Output PWM1L 50 kHz
S4 Inverter Drive Signal PWM Output PWM1H 50 kHz
S5 Inverter Drive Signal PWM Output PWM2L 50 kHz
S6 Inverter Drive Signal PWM Output PWM2H 50 kHz
I Inverter Output Current
Feedback
Analog Input AN0 25 kHz
ACO Inverter Output Voltage
Feedback
Analog Input AN1 25 kHz
ACI AC Mains Voltage
Feedback
Analog Input AN11 25 kHz
A1 Resistor Bypass Relay
Drive Signal
Digital Output RC10 Activated only at startup
to charge the DC Link
voltage above the
minimum value.
A2 Output Relay Drive
Signal
Digital Output RC0 Activated only when the
UPS switches to
Inverter mode.
AN1279
DS01279A-page 30 © 2009 Microchip Technology Inc.
Inverter-to-Mains Switchover Routine
When a power failure occurs, the Offline UPS switches
to the Inverter mode and operates in this mode until the
mains is detected again. The system should switch
from one mode to the other in the shortest possible
duration in order to provide uninterrupted power to the
load.
Before switching to the Battery Charger mode, the soft-
ware must reliably ensure that the mains voltage
detected is within the specified levels. The software
must also ensure that the mains waveform is clean and
has little or no distortion.
The mains detection routine is divided into the following
steps:
1. Mains High Voltage Detection: In the Inverter
mode, the UPS software first checks for the
presence of high voltage on the mains. If a high
voltage is detected consecutively for 5 ms, the
mains detection routine proceeds to the next
step.
2. Zero-Crossing Detection: After a high voltage
has been detected, the software keeps polling
the mains voltage for a zero-crossing detection.
A valid zero-crossing is only detected if the pre-
vious voltage is negative and the present volt-
age is positive, and the difference between the
previous and present measurement is above a
minimum value. This ensures that spurious
zero-crossings are not detected due to noise.
3. Mains Data Collection: Once the zero-crossing
has been detected, the UPS software enters the
mains data collection step. In this step, every
sample of the measured mains voltage is stored
in an array. Each sample of the collected data is
averaged over four sine wave cycles to ensure
an accurate reference. This array is later used
as the mains reference to detect a mains failure.
4. Mains Synchronization: After collecting the
mains voltage data, the mains detection routine
now compares the measured voltage with the
mains reference data. If the error is within ±20V
consecutively for 8 ms, the software concludes
that the mains is present and indicates the new
state of the AC mains to the state machine.
The state machine then begins the process of
switching from Inverter mode to Battery Charger mode.
The switchover is engaged at the zero-crossing of both
the inverter and mains. This provides the smoothest
transition from one mode to the other and occurs
instantaneously.
It is possible that the inverter and mains are out of
phase when AC mains is available again. As the fre-
quencies of the AC mains and the inverter are nearly
equal, the zero crossings of the two waveforms may
never align. Therefore, the UPS software first checks
whether the frequencies are very close. If there is a sig-
nificant difference in frequencies, the two waveforms
will eventually align at the zero crossings, which is
when the UPS will engage the switchover.
If the two signals are operating at nearly the same fre-
quency, the inverter frequency is modified slightly by
discarding some of the samples from the lookup table.
As a result, the zero crossings of the two signals are
forced to align after a few sine wave cycles. This allows
the UPS state machine to switch from the Inverter
mode to the Battery Charger mode with almost zero
latency. The inverter-to-mains switchover sequence is
described graphically in Figure 34.
It is also important to note that the alignment of the zero
crossings must be predicted using information for the
relay switching time. The relay is switched a few milli-
seconds before the actual zero-crossing so that the
relay switching delay is accounted for.
© 2009 Microchip Technology Inc. DS01279A-page 31
AN1279
FIGURE 34: INVERTER-TO-MAINS SWITCHOVER SEQUENCE
High Voltage Detected Zero-crossing Detected Mains Data Collection
Complete
AC
Mains
Inverter
Inverter
Frequency
Modified
Zero-crossing Aligned
Inverter turned
OFF
Start Mains Data
Collection
AN1279
DS01279A-page 32 © 2009 Microchip Technology Inc.
Mains-to-Inverter Switchover Routine
When mains is present, the UPS software keeps com-
paring the measured mains voltage with the corre-
sponding data in the mains reference array. The
quadrant information is also saved in a variable. On
every sample, the error between the expected voltage
and the actual voltage is calculated.
If the error is detected to be larger than ±20V, a count
is incremented. If the error is detected to be outside the
limit consecutively for about 1 ms, then the Offline UPS
detects that a mains failure has occurred. The system
state is changed to Inverter mode and the relay is
switched immediately to disconnect the mains from the
UPS output. The push-pull converter is then enabled
and the soft-start routine is executed. After the soft-
start routine is complete, the mains voltage is
measured again.
Using a binary search algorithm, the appropriate sam-
ple number from the sine lookup table is selected,
which is in the appropriate quadrant and has a value
closest to the mains voltage. The inverter is then
enabled starting at this sample number so that there is
no sudden change in voltage on the UPS output. The
mains-to-inverter switchover sequence is described in
Figure 35.
FIGURE 35: MAINS-TO-INVERTER SWITCHOVER SEQUENCE
Mains Failure
Occurred
Mains Failure
detected
Battery
Charger
Mode (AC
Mains
Present)
UPS
Output
DC
Link
Voltage
Push-pull Soft-start
Routine Completed
Inverter Mode
Inverter turned ON
at the last measured
mains voltage
© 2009 Microchip Technology Inc. DS01279A-page 33
AN1279
System Error
The UPS goes into the System Error state if a combi-
nation of the system variables is detected to be in a
fault state. The state diagram in Figure 21 illustrates all
conditions under which a system error is detected.
The dsPIC DSC device has built-in fault and current
limit features that enable automatic shutdown of power
converters with no software overhead. This feature is
critical in power conversion applications and is useful in
protecting the user, system hardware, and downstream
electronics.
The System Error mode is designed to handle any
faults after the respective power stage has been dis-
abled. When the system enters this mode, the type of
fault is displayed on the LCD module. When the UPS
enters the System Error mode, the system needs to be
restarted again before it can function normally.
Auxiliary Tasks
All non-critical functions of the Offline UPS are catego-
rized as auxiliary tasks. These tasks have a relatively
slow execution rate and therefore are assigned the low-
est execution priority in the Offline UPS software.
The auxiliary tasks are executed in the main loop of the
code. These tasks are performed only when other high-
priority tasks like power conversion control loops and
the UPS state machine are not active. In other words,
the auxiliary tasks are performed during the “idle” time
for the power conversion routines and state machine.
As a result, the main loop is also referred to as the “idle
loop”. The auxiliary tasks are numerously interrupted
by high-priority tasks like the control loops and the state
machine. Each of the auxiliary tasks is described briefly
in the following sections.
OUTPUT VOLTAGE/CURRENT RMS
CALCULATION
The RMS Calculation routine provides the output
voltage and current information for the LCD display
as well as for output overcurrent and output
overvoltage/undervoltage protection.
The measured current and voltage are stored in data
memory in an array of 256 points each. When the RMS
calculation routine is called, the respective array is
passed to the function, while the output of the function
is the true RMS value of the parameter.
The DSP instructions of the dsPIC DSC device are uti-
lized to efficiently execute the RMS calculation rou-
tines. The Q15 library includes functions for calculating
sum-of-squares and square-root. Both of these opera-
tions are available in the Q15 library, and are used for
implementing the RMS calculation in the offline UPS
reference design.
The RMS calculation is called in the idle loop since it is
executed over the AC mains cycle, and therefore,
requires a relatively slow execution rate. The results
are then scaled appropriately to produce a number in
volts or amperes.
In order to display the result on the LCD display, each
decimal digit of the RMS calculation result is stored as
a character variable. The character variables are then
concatenated into a string in order to display the data
on the LCD module.
LCD DISPLAY
The LCD control code for the dsPIC DSC device is
implemented as independent functions for writing pix-
els, bytes, words, or strings to the LCD module. The
LCD display routines are called in the main loop.
The Offline UPS Reference Design uses a 4x20 char-
acter LCD display module controlled by a dedicated
MCU (PIC18F2420). The dsPIC DSC device communi-
cates with the LCD controller via a Serial Peripheral
Interface (SPI).
The dsPIC DSC device is configured as the SPI master
device and transmits all LCD commands to the LCD
controller. The LCD controller converts the serial
commands from the dsPIC DSC device into parallel
data and also manages the timing controls for the LCD
module.
The LCD controller operates with a 5V supply and the
dsPIC DSC operates on a 3.3V supply. However direct
connections between the dsPIC DSC and LCD control-
ler can be made because the digital-only pins of the
dsPIC DSC are 5V tolerant. Also the digital outputs of
the dsPIC DSC can be operated in open-drain configu-
ration and produce logic high for the 5V LCD controller
using just a pull-up resistor.
The resource allocation for LCD control is summarized
in Table 8.
TABLE 8: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR LCD DISPLAY
Note: Operation of the LCD controller is beyond
the scope of this reference design. Visit
www.microchip.com/lcd for LCD design
solutions.
Signal
Name
Description Type of Signal
dsPIC
®
DSC
Resource Used
Sample Rate/Frequency
SDO SPI Data Output Digital Output RP22 156.25 kHz when active
SDI SPI Data Input Digital Input RP19 156.25 kHz when active
SCK SPI Clock Output Digital Output RP21 156.25 kHz when active
AN1279
DS01279A-page 34 © 2009 Microchip Technology Inc.
USB COMMUNICATION
The Offline UPS also includes a USB communication
interface to enable power management for a computer
or server connected to the UPS. The USB communica-
tion is performed by a separate USB controller MCU
(PIC18F2450). The USB controller communicates with
the dsPIC DSC device via an opto-isolated UART
interface.
The resource allocation for the USB communication
interface is summarized in Table 9.
TABLE 9: dsPIC
®
DSC DEVICE RESOURCE ALLOCATION FOR USB INTERFACE
SS SPI Slave Select
Output
Digital Output RP20 Asserted only when data is
transmitted to LCD controller
Signal
Name
Description Type of Signal
dsPIC
®
DSC
Resource Used
Sample Rate/Frequency
Signal
Name
Description Type of Signal
dsPIC
®
DSC
Resource Used
Sample Rate/Frequency
Tx UART Transmit Digital Output RP27 9600 bps
RX UART Receive Digital Input RP28 9600 bps
© 2009 Microchip Technology Inc. DS01279A-page 35
AN1279
Fault States and Protection Schemes
There are a number of fault sources that can cause the
system to turn off all outputs and enter the System
Error mode. Any system fault can trigger the Offline
UPS to enter the System Error mode. These include
the following:
• Push-pull primary overcurrent
• DC Link undervoltage
• DC Link overvoltage
• Battery undervoltage
• Battery overvoltage
• Output overcurrent
• Overtemperature
The system will enter the System Error mode due to
either a single fault or a combination of faults,
depending on the operating modes. For example, a DC
Link undervoltage condition will not cause the system
to enter the System Error mode if the soft-start routine
is active. Similarly, transient loads may cause the push-
pull primary current to exceed the limit for a short
duration. Therefore, a push-pull overcurrent fault will
only be generated if the overcurrent condition persists
for an extended duration.
All faults that are fast-acting and destructive to the sys-
tem and user's load are handled in the high-priority
control loops. The push-pull overcurrent fault is an
example of a very high-speed signal that must be
detected as quickly as possible. As a result, this fault is
detected at the same time as the push-pull control loop.
Other signals like the battery voltage are not very high-
speed signals and therefore the faults are handled in
the UPS state machine.
When a fault condition happens, the system enters the
System Error mode and the type of fault is displayed on
the LCD module.
Operation with Rectifier Loads
One of the most important applications of the Offline
UPS is to provide uninterrupted power to computers
and servers. Most computers and servers implement a
switch-mode AC-DC power supply that implements
Power Factor Correction (PFC). Such a load usually
contains a front-end bridge rectifier and is therefore
classified as a rectifier load.
If PFC is not implemented, the load appears as a highly
capacitive load, resulting in high peak currents and a
low power factor. A block diagram of the connections
for such a configuration is shown in Figure 36.
The typical configuration of such a power supply con-
tains a PFC boost converter as shown in Figure 37.
The boost converter usually contains a large output
capacitor. As seen from the circuit diagram, a low
impedance path exists from the AC input to the output
capacitor. As a result, the output capacitor draws a
large inrush current when the load is first connected to
the UPS output.
FIGURE 36: TYPICAL RECTIFIER LOAD FOR THE OFFLINE UPS
Computer/Server Power Supply
EMI Filter
PFC Boost
Converter
DC-DC
Converter
AC UPS
Output Input
AC Offline UPS
AN1279
DS01279A-page 36 © 2009 Microchip Technology Inc.
FIGURE 37: PFC BOOST CONVERTER
If PFC is not implemented, the current is drawn by the
load in a very discontinuous nature with high peaks,
causing the load to appear highly capacitive, as shown
in Figure 38.
FIGURE 38: RECTIFIER LOAD INPUT CURRENT WAVEFORMS (NO PFC)
Load
AC


Diode
ON
Diode
ON
Diode
ON
Diode
ON
Diode
OFF
Diode
OFF
Diode
OFF
Input Voltage
Output Voltage
Input Current
© 2009 Microchip Technology Inc. DS01279A-page 37
AN1279
Due to the presence of a large capacitor on the output
of the PFC boost converter, the Offline UPS needs to
implement a special algorithm to handle load steps and
startup conditions for rectifier loads.
The current draw during a rectifier load startup can be
up to 20 times the maximum rated current. One option
to support these high current surges is to design the
hardware with sufficient design margin. However, this
approach is usually not cost effective and may also
cause a drop in performance or efficiency. The dsPIC
DSC provides a number of flexible features to over-
come this problem. The PWM Current-Limit feature can
be used to limit the current on a cycle-by-cycle basis.
This feature, along with software can help charge the
output capacitor in a controlled manner so that the
inrush current is limited.
In the Offline UPS Reference Design, an external inter-
rupt is generated when an overcurrent condition
occurs. This causes the PWM module to automatically
shut down. Inside the Interrupt Service Routine, the
PWM is configured for a very small duty cycle and then
re-enabled. As the duty cycle is small, the current
drawn during one PWM switching cycle is automatically
limited. The duty cycle is incremented in small steps to
charge the output capacitor in a controlled manner.
While the current-limit fault handling routine is being
executed, the inverter control loop is overridden. The
inverter control loop resumes operation when the sine
voltage reference of the inverter becomes equal to the
actual voltage on the inverter output.
If the first current limit fault is caused by a short circuit
condition on the inverter output, the current limit fault
will be triggered immediately for a second time. This
will cause the system to shut down with an overcurrent
error. The error state is displayed on the LCD display
module and is reset only when the system is turned
OFF and back ON.
Peak Current Limiting Function
If the power factor of the rectifier load is too low, it will
result in a high crest factor for the inverter current. The
Offline UPS Reference Design is rated for a maximum
crest factor of 3:1. If the crest factor of the load exceeds
this value, no action is taken by the UPS if the current
is within the maximum peak current rating. However, a
high crest factor warning is displayed on the LCD
display module.
If the peak current required by the load exceeds 15A, a
current limiting function overrides the inverter control
loop. This function limits the maximum current on the
output by clamping the duty cycle to a maximum value.
DC Offset Elimination
A side-effect of operating with a high crest factor is that
the current drawn may become asymmetric. This is
caused by the presence of a small DC offset on the
inverter output voltage. The DC offset occurs due to the
tolerance limits of the feedback components.
A typical analog implementation requires the use of
trimming resistors to eliminate the DC offset. This
solution requires trimming of each UPS system during
manufacturing, and therefore becomes expensive and
time consuming. It may also need periodic adjustment
via a servicing schedule to account for effects of long
term degradation of components. The dsPIC DSC
helps overcome this problem with an active algorithm
to eliminate the DC offset.
The Offline UPS Reference Design implements an off-
set elimination routine by comparing the positive and
negative peak of the measured output voltage. If an
imbalance is detected, a correction factor is applied to
the output voltage to cancel the DC offset. The peaks
are determined by averaging the maximum and mini-
mum recorded voltages over a number of sine wave
cycles. Doing so helps to ignore the effects of load
steps on the output.
AN1279
DS01279A-page 38 © 2009 Microchip Technology Inc.
HARDWARE DESIGN
Push-Pull Boost Converter
DESIGN SPECIFICATIONS
A push-pull boost converter needs to convert the wide
range battery link input voltage to a stabilized high-volt-
age DC-Link. The design specifications used in the
Offline UPS Reference Design are:
• Input voltage range: 30-45 VDC
• Output voltage: 380 VDC
• Continuous power: 1 kVA
• Peak power for two seconds: 1.3 kVA
• Switching frequency: 100 kHz
TOPOLOGIES CONSIDERED AND REASONS
FOR CURRENT CHOICES
In Figure 39 and Figure 40 all possible push-pull boost
circuits are shown. The combination of a push-pull
inverter (Figure 39(C)) and a full-bridge rectifier
(Figure 40(B)) was chosen, which provides the best
price performance ratio. For the inverter only the low-
side drive circuitry is required and simple PWM signals
(see Figure 41) can drive the inverter.
FIGURE 39: PRIMARY DRIVE CIRCUITS
(A) Full-Bridge Inverter
(B) Half-Bridge Inverter
(C) Push-Pull Inverter
Q1
Q3 Q4
Q2
Q1
Q3
Q Q
T1
T1
C1
UB
UB
UB
T1
+
+
+
C2
C1
© 2009 Microchip Technology Inc. DS01279A-page 39
AN1279
FIGURE 40: RECTIFIER CIRCUITS
FIGURE 41: CONTROL SIGNALS FOR
PUSH-PULL INVERTER
For the secondary, a full-bridge rectifier was chosen for
the following reasons:
• Reducing the leakage inductance by using only
one secondary winding on the transformer
• Reducing cost of transformer
• Rectifier diodes can be rated lower in reverse
breakdown voltage, such diodes have better
forward and switching characteristics.
• Synchronous rectification is not required due to
high-voltage and low current operation.
The output voltage is calculated by Equation 6, where
N2 ÷ N1 is the transformer windings ratio, and d is the
duty cycle of the PWM signal. The duty cycle must be
limited to the given boundary. In a real application, the
duty cycle must be limited to 0.1 < d < 0.42. This is
done due to the switching behavior of the MOSFETs
and transformer. Due to allowed oscillation and losses
in the system, the calculation using Equation 6 is not
exact. When no load is applied to the push-pull boost
stage, the controller has to switch into Burst mode, and
when heavy load is applied, the duty cycle must be
increased to compensate for various losses.
EQUATION 6:
(A) Half-Bridge Rectifier
(B) Full-Bridge Rectifier
T1
L1
R1
C1
D2
D1
T1
D3
D1 D2
D4
L1
C1
R1
U
DC
U
BAT
N
2
N
1
------ 2d · · =
where:
0 < d < 0.5 d is the duty cycle of the transistors and
N2/N1 is the secondary-to-primary turns ratio of
the transformer
AN1279
DS01279A-page 40 © 2009 Microchip Technology Inc.
DESIGN OF POWER-TRAIN COMPONENTS
The push-pull transformer has been designed using a
ferrite magnetic core. The transformer design is based
using the area product (W
a
A
c
) approach and is
designed to meet the following conditions:
• Minimum input voltage: V
imin
= 30V
• Maximum DC link voltage: V
o
= 380V
• Maximum output power: P
omax
= 2000W
• Primary RMS current: IP
rms
= 30.5A
• Maximum duty cycle: D
max
= 0.42
• Switching frequency: f = 100 kHz
The manufacturer’s data sheet is used to help select
the appropriate material for the desired application. For
the given range of materials, frequency, core loss, and
maximum flux density of the material should be
considered. From the research data, 3C90 material
from FERROXCUBE was selected. From core loss,
maximum flux density can be calculated, as shown in
Equation 7. The factors used in this equation are
provided in Table 10.
EQUATION 7:
Core loss density is normally selected around 150 mW/
cm
3
. The calculated maximum flux density must be lim-
ited to less than half of B at saturation. This B level is
chosen because the transformer core will develop
excessive temperature rise at this frequency when the
flux density is close to saturation. Maximum flux density
can now be calculated, as shown in Equation 8.
TABLE 10: FACTORS APPLIED TO EQUATION 7 (CORE LOSS EQUATION)
EQUATION 8:
P
l
a f
c
B
max
d
· · =
Material Frequency a c d
R, 35G, N87, 3C90 f < 100 kHz 0.074 1.43 2.85
100 kHz ≤ f < 500 kHz 0.036 1.64 2.68
f ≥ 500 kHz 0.014 1.84 2.28
P, 45G, N72, 3C85 f < 100 kHz 0.158 1.36 2.86
100 kHz ≤ f < 500 kHz 0.0434 1.63 2.62
f ≥ 500 kHz 7.36e-7 3.47 2.54
F, 25G, N41, 3C81 f < 10 kHz 0.790 1.06 2.85
10 kHz ≤ f < 100 kHz 0.0717 1.72 2.66
100 kHz ≤ f < 500 kHz 0.0573 1.66 2.68
f ≥ 500 kHz 0.0126 1.88 2.29
B
max
P
l
a
f
1000
------------
\ .
| |
c
·
---------------------------
\ .
|
|
|
| |
1000
d
------------
150
0.036
100000
1000
----------------- -
\ .
| |
1.64
·
-------------------------------------------------
\ .
|
|
|
| |
1000
2.68
------------
1339G = = =
© 2009 Microchip Technology Inc. DS01279A-page 41
AN1279
For selecting the right size core, the area product of the
core must be calculated by Equation 9. This equation is
derived from the flux linkage equation (v = N * u) and
represents the power handling ability of the core.
Therefore, each core has a number that is a product of
its window area, W
a
, and the core cross-sectional area,
A
c
.
EQUATION 9:
ΔB in Equation 9 is equal to 2B
max
due to bidirectional
core excitation as seen in Figure 42. Current density of
a winding is estimated to be 500A/cm
2
, and maximum
output power P
omax
is 2000W. Therefore, the calculated
area product is shown in Equation 10.
EQUATION 10:
FIGURE 42: HYSTERESIS LOOP OF
MAGNETIC CORE
The selected core must have an area product larger
than calculated. ETD54 shape and size of a core was
selected with W
a
A
c
= 12.6 cm
2
. A larger size was
selected due to the primary and secondary windings,
which fit to the winding area of that core.
The primary turns are calculated by Equation 11. Given
result is then rounded up or down to the integer value.
In this case it is rounded to 4 turns for one-half of the
primary.
EQUATION 11:
W
a
A
c
10
8
P
omax
·
K
t
AB f J · · ·
------------------------------- =
W
a
A
c
10
8
2000 ·
0.254 2678 100000 500 · · ·
------------------------------------------------------------------ 5.9cm
4
= =
AB
B
H
B
B
BSAT
BSAT
BMAX
BMAX
N
P
10
8
V
i min
2
f
---
\ .
| |
D
max
· · ·
AB A
C
·
---------------------------------------------------------
10
8
30
2
100000
------------------
\ .
| |
0.42 · · ·
2678 2.8 ·
-------------------------------------------------------------- 3.4 = = =
AN1279
DS01279A-page 42 © 2009 Microchip Technology Inc.
The secondary turns are calculated by Equation 12.
The result is rounded to the value 60 of secondary
turns.
EQUATION 12:
The cross section of the primary and secondary wind-
ings is calculated by Equation 13. Different current den-
sities are used (J
P
= 8A/mm
2
and J
S
= 5A/mm
2
) to fit the
windings into the transformer bobbin and because the
length of one-half of the primary is very short compared
to the secondary. In that case, it is allowed to use higher
current density for primary as temperature of winding will
not be much higher due to the short winding. Primary
RMS current is I
Prms
= 30.5A. Secondary current can be
calculated by I
srms
= I
Prms
* N
p
÷ N
s
= 2.03A.
EQUATION 13:
Because of the high switching frequency, f = 100 kHz,
litz wire must be selected to reduce winding losses
(losses by skin and proximity effect). Litz wire must also
be designed for that frequency.
Figure 43 shows the transformer winding diagram and
construction diagram.
FIGURE 43: TRANSFORMER ELECTRICAL AND MECHANICAL CONSTRUCTION
N
s
V
o
2D
max
----------------
V
i mi n
---------------- N
p
380
2 0.42 ·
------------------
30
------------------ 4 60.3 = · = · =
A
cuP
I
Prms
J
P
------------- 3.81mm
2
= =
A
cuS
I
Srms
J
S
------------ 0.41mm
2
= =
NS
NP NP
NP
NP
NS
CORE Bobbin Insulation and Shield
NP
NP
NS
© 2009 Microchip Technology Inc. DS01279A-page 43
AN1279
PUSH-PULL MOSFETS
When choosing the right MOSFETs the following must
be considered:
• Maximum Breakdown Voltage
• Continuous Current
• Peak Current
• Package Thermal Performance
Maximum Breakdown Voltage
In the chosen configuration, a MOSFET must be able
to hold more than twice the battery voltage, as
expressed in Equation 14. In this calculation, a safety
factor of 30% overrating was chosen. Therefore, the
selected devices need to have a drain-to-source
breakdown voltage higher than 117V.
EQUATION 14:
Continuous Current
To calculate the current rating of the devices, peak and
average currents have to be estimated. The peak and
average currents can be estimated from the power rat-
ings and input voltage. The average current is calcu-
lated using Equation 15, where PC is the continuous
power and UBAT is the battery voltage.
EQUATION 15:
The highest current will flow at the lowest battery
voltage so the continuous current is:
I = 1000W ÷ 30V = 33.34A. And per leg, the continuous
drain current is half of this: ID = 16.67A.
Peak Current
The peak current must be calculated at maximum
power and the form of the current waveform must also
be taken into account. When we assume that the cur-
rent waveform will have a sawtooth waveform with the
given duty cycle (d), we can calculate the resulting
peak current using Equation 16. The duty cycle (d) is
calculated using Equation 17.
EQUATION 16:
EQUATION 17:
When we use a transformer with windings ratio of 16
the peak current is that of Equation 18:
EQUATION 18:
Therefore, we have to design the MOSFETs for contin-
uous drain current of 16.67A and peak drain current of
160.3A. Because the waveform shape will not be an
exact sawtooth, these calculations are only an esti-
mate. To be on the safe side, these numbers are
increased by 30%.
Package Thermal Performance
To design the thermal performance, the rms current
value must be calculated. If the waveform shape and
peak current are known, the rms can be calculated
using Equation 19.
EQUATION 19:
The rms current can now be calculated and is shown in
Equation 20:
EQUATION 20:
2
2 45 1.3 117
BRDSS BAT
V V
V V
>
· · =
/
a c bat
I P U =
max
pm
bat
P
I
U d
=
·
2
1
2
DC
bat
U N
d
U N
·
=
· ·
2000
160.3
30 0.416
pm
W
I A
V
= =
·
3
rms pc
d
I I =
2
80.15 .416 42.13
3
rms
I A = · · =
AN1279
DS01279A-page 44 © 2009 Microchip Technology Inc.
Per leg, the current is half of this: IDRMS = 21.07A . This
is the most critical design consideration; therefore, an
overrating of 50% should be done IDRMS = 21.07A * 1.5
= 31.5A, and all current leading traces and the
transformer should also be rated for this current.
The conductive losses on the MOSFETS are
calculated using Equation 21.
EQUATION 21:
For a switching frequency of 100 kHz and with the
push-pull configuration also switching, losses have to
be taken into account. If the current waveform is near
sawtooth, turn-on losses can be neglected. Turn-off
losses depend on the peak current and leakage induc-
tance. To limit the voltage spikes at turn-off a voltage
clamp circuit is used. This circuit enables the MOS-
FETs to operate without RC snubbers. Snubbers are
only used to suppress high frequency oscillation, and
not to dissipate the energy stored in the leakage induc-
tance of the transformer. Therefore, all of the energy is
dissipated on the MOSFETs. Equation 22 can be used
to estimate the power dissipation at turn-off.
EQUATION 22:
In Equation 22, WL is the energy stored in the leakage
inductance at turn-off and is calculated using
Equation 23.
EQUATION 23:
A typical transformer in this range should have not
more than L = 0.5 μH of leakage inductance.
Therefore, the turn off power would be that of
Equation 24:
EQUATION 24:
Total dissipation on the MOSFETS is then Ptot = Poff +
PC, and it is estimated to be 55W per leg.
Now the MOSFETs can be selected. In the reference
design, a TO-220 package is used for the MOSFETs.
Typical junction-to-heat sink thermal resistance of
these devices is ROt = 2.5°C/W when using silicone
pad insulation.
We will allow a continuous junction temperature of
110°C and a heat sink temperature of 60°C. From this
and the power dissipation, we can calculate the needed
thermal resistance, which provides the number of
parallel MOSFETs to use.
The number of necessary devices is calculated as
n = ROt ÷ ROJH = 2.7. According to the calculation
shown in Equation 25, three parallel FDP2532 devices
from Fairchild Semiconductor were selected.
EQUATION 25:
2
Drms
c DSon
P I R = ·
4
L
off SW
W
P f =
2
2
L
i L
W =
3
3
1.6
100 40
4
off
e
P e W
÷
= =
50
0.91 /
55
JH
tot
R C W
P
O
AO
= = = °
© 2009 Microchip Technology Inc. DS01279A-page 45
AN1279
FULL-WAVE RECTIFIER
FIGURE 44: RECTIFIERS WITH CURRENT FLOW
When selecting diodes, the following must be
considered:
• Diode Breakdown Voltage
• Average Forward Current
• Peak Forward Current
• Switching Characteristics
• Package Thermal Performance
Diode Breakdown Voltage
The transformer secondary voltage is calculated as
VS = VBAT * N2 ÷ N1. The maximum secondary voltage
at the highest battery voltage is VS = 45 * 16 = 720V .
Because of transformer leakage inductance, diode
internal inductance, and DC link inductor inductance,
voltage spikes appear on diodes when switching. Due
to this, the calculated breakdown voltage is increased
by 30% and should be more than 936V.
Average Forward Current
Average forward current per leg is easily calculated
using Equation 26 from the desired DC link voltage and
continuous output power.
EQUATION 26:
Peak Forward Current
Peak current is calculated using the transformer
current ratio and peak MOSFET current previously
calculated in Equation 9.
EQUATION 27:
(A) D3 and D2 Conduct
(B) D1 and D4 Conduct
T1
D3
D1 D2
D4
L1
C1
R1
T1
D3
D1 D2
D4
L1
C1
R1
1000
2.6
380
c
avg
DC
P
I A
V
= = =
1
2
160.3 0.625 10
pD P
N
I I A
N
= · = · =
AN1279
DS01279A-page 46 © 2009 Microchip Technology Inc.
Switching Characteristics
Diode switching characteristics are determined by
forward recovery time and reverse recovery time.
FIGURE 45: DIODE SWITCHING CHARACTERISTICS
Diode switching loss can be estimated using
Equation 28.
EQUATION 28:
Package Thermal Performance
For diodes, an isolated TO-220-2 package is used.
Continuous working junction temperature should not
exceed 130°C at a heat sink temperature of 60°C. Typ-
ical thermal junction-to-heat sink resistance of the junc-
tion-isolated TO-220-2 package is ROt = 3.5°C/W.
Therefore, the maximum allowed power dissipation per
part is PMAX = 70 ÷ 3.5 = 20W.
The STTH1210DI from STMicroelectronics meets the
voltage and current requirements. Power loss calcula-
tion can now be done looking at the diode data sheet.
Total power loss is estimated by adding conduction
losses and switching losses, as shown in Equation 29.
EQUATION 29:
The estimation shows that the power losses are within
the set criteria.
Output Inductor
This inductor is optional and is not required. Its use
depends on the transformer construction and control of
DC-link voltage, and the inductor value that must be
used. This section describes the design of a 50 µH
output inductor.
The design of the output inductor uses the area product
approach with the following conditions:
• Inductance: L = 50 μH
• Peak DC current: I
p
= 13A
• Operating flux density: B
m
= 300 mT
• Current density: J = 500A/cm
2
• Window utilization: K
u
= 0.4
First, the energy handling capability must be calculated
by Equation 30.
t[s]
t
3
t
2
t
1
t
i
P
Doff P
Don
i[A]
u[V]
t
fr
u
t
swD c DC SW
P Q V f = · · 10
tot swD fD
P P P W = + =
© 2009 Microchip Technology Inc. DS01279A-page 47
AN1279
EQUATION 30:
Then, to select the appropriate size of ferrite core, the
area product calculation must be done, as shown in
Equation 31.
EQUATION 31:
The selected core was the P36/22 pot core from FER-
ROXCUBE due to its small size and shape, which pro-
duces less interference into surrounding components.
The area product of this core is 1.46 cm
4
and can be
calculated from the data in the manufacturer’s data
sheet.
The number of turns required to get the desired
inductance of the coil is calculated by Equation 32. The
Core cross section A
c
= 172 mm
2
is obtained from the
manufacturer’s data sheet.
EQUATION 32:
The calculated number of turns is then rounded to the
nearest integer value, which is 13.
To get the desired inductance, 3C81 material with an
air gap was selected to control the flux density. If an air
gap is distributed into the magnetic path of the core, the
effective permeability of material changes and induc-
tance factor A
L
. From the A
L
value and number of turns,
the inductance is calculated by Equation 33. The A
L
value is obtained from the material data sheet and is
315 nH at 0.97 mm air gap.
EQUATION 33:
The new operating flux density is verified by
Equation 34 and must be lower than the saturation
point of the selected material.
EQUATION 34:
The 3C81 material has a saturation point at 320 mT
(100
o
C).
If the criteria are not fulfilled, different material, air gap,
number of turns, or even a bigger core must be
selected.
The cross-section of a wire is calculated by
Equation 35, where RMS current through the inductor
is calculated from primary RMS current of push-pull
transformer and turns ratio. This current is twice as
large as primary because for half of a switching period,
the first primary winding is conducting and in the other
half, the second primary winding.
EQUATION 35:
The calculated value is the minimum cross-section of a
wire (100 kHz litz wire must be used).
Next, the fill factor must be calculated by Equation 36.
This provides an estimation of whether the winding fits
into the bobbin. The fill factor must be 0.4 or less.
W
b
is the bobbin winding area and is 72.4 mm
2
, and
can be found in the core data sheet.
EQUATION 36:
Output Capacitors
When choosing DC-link capacitors, the following must
be considered:
• Voltage Rating
• Ripple Current
Voltage Rating
The voltage rating is defined by the DC Link voltage:
VDC = 380V. Therefore, the capacitors must be above
this rating.
2
6 2
50 10 13
0.0043
2 2
p
L I
E Ws
÷
·
· ·
= = =
4
4
2 10
1.43
a c
m u
E
W A cm
B J K
· ·
= =
· ·
12.6
p
c m
L I
N
A B
·
= =
·
2
53
L
L N A H u = · =
308
p
new
c
L I
B mT
N A
·
= =
·
2
2
0.82
P
Prms
rms S
cu
N
I
I N
A mm
J J
· ·
= = =
0.15
cu
u
b
N A
K
W
·
= =
AN1279
DS01279A-page 48 © 2009 Microchip Technology Inc.
Ripple Current
When the DC link voltage controller is working as
expected, the low frequency ripple current caused by
the inverter is negligible. Therefore, the capacitors
need only compensate for the reactive load current,
which depends on the device specifications:
S = 1300VA and P = 1000W.
EQUATION 37:
EQUATION 38:
SNUBBERS
Snubbers are used to dampen high frequency oscilla-
tion and reduce ringing losses on diodes. Snubbers on
the primary side are placed across the primary wind-
ings and are not used to handle voltage spikes at turn-
off of the MOSFETs. They only reduce ringing and
transformer in-rush current.
To design the snubber for the primary side, the
capacitance of the MOSFETs and leakage inductance
of the transformer must be known. Both parameters
can be measured; however, MOSFET capacitance is
voltage dependent so only an estimate can be used. In
our case, the capacitance of three parallel MOSFETs is
approximately CDS = 7 nF, and leakage inductance of
the transformer is estimated at LS = 500 nH. A
simplified high frequency circuit is shown in Figure 46.
FIGURE 46: HIGH-FREQUENCY CIRCUIT
The resonant frequency is calculated using
Equation 39.
EQUATION 39:
Damping of the system is very low because of the low
primary winding resistance (RS) and the series
resistance of the battery link capacitors (RC), which are
both in the range of milliohms. To reduce this high
frequency ringing, a series RC snubbers were added
across the primary winding. The capacitance should be
one to three times the capacitance of the MOSFETs,
and the series resistor value should be chosen so that
it grants damping and the power dissipation is within
the resistor rating. To maintain high efficiency of the
system we allow less than 1% of the rated power to be
dissipated on the primary snubbers. The final values of
the RC snubber are evaluated by experimenting and
are C = 10 nF and R = 12Ω. The power rating of the
resistors is 4W.
To design the snubbers for the rectifier diodes, the
capacitance of the rectifier diode must be known. The
simplified high frequency circuit is shown in Figure 47.
FIGURE 47: HIGH-FREQUENCY CIRCUIT
Here, the capacitor should be in the range from two to
five times the capacitance of the diode. The diode
capacitance can be found in the diode data sheet. For
the selected diodes it is approximately CD = 70 pF.
Therefore, a good starting capacitance value for the
snubber is C = 150 pF. Here we will also limit the max-
imum waste power to 1% of the rated converter power
to keep the efficiency of the converter as high as possi-
ble. Thus, the resistor ratings will also be 4W. The
resistor value should be selected so that the main
switching voltage signal will produce as low as possible
dissipation on the resistor. The dissipation is depen-
dent on the RC frequency characteristics, and selecting
lower resistance or lower capacitance will shift the
characteristic frequency of the RC circuit higher, which
result in the 100 kHz switching voltage producing less
dissipation on the snubbers. However, damping of the
snubbers will also decrease. A good starting value for
the resistor is R = 1 kO.
2 2
830.7 Q S P Var = ÷ =
830.7
3.6
230
r
AC
Q
I A
V
= = =
RS
RC
LS
.5 µH
CDS
6.6 nF
1
2.7
2
DS S
f MHz
C L t
= =
· · ·
CD1
CD3
L1 LSS
© 2009 Microchip Technology Inc. DS01279A-page 49
AN1279
Calculating the required snubber circuit is very complex
and does not give the expected results. Therefore, the
parameters have to be evaluated by experimenting.
When designing the snubbers the following must be
considered:
• Overall system efficiency
• Signal quality
• Device power ratings
• Device voltage ratings
Design of Drive Circuitry
To drive the MOSFETs, a driver must be used that
amplifies the signal from the dsPIC DSC device and
drives the gates of MOSFETs. The gate of a MOSFET
behaves like a capacitor. The MOSFET drain-to-source
RDS depends on the gate to source voltage, VGS. The
higher the gate-to-source voltage, the lower the drain-
to-source resistance of the MOSFET. For the selected
MOSFETs:
• VGS = ±20V
• VGS(TH) = 2-4V
• CG(TOT) = 10.7 nF
To ensure low resistance in the ON state the gates are
driven with 12V signals. The drive circuit is shown in
Figure 48, which consists of the driver shown as S1,
slope control elements, equalization resistors R1, R2,
R3, R4, R5, and C1 turn-off voltage clamp circuit D1,
D2, Q4, R6.
The elements R5 and C1 are optional. R5 is used to
ensure the MOSFETs do not turn on by themselves. C1
is used to compensate for Miller capacitance and EMI
control. Resistors R1, R2, and R3 are used to equalize
the gate threshold voltage of the MOSFETs to ensure
parallel turn-on. In combination with R4, the turn-on
slope is also controlled. In addition, the turn-off slope is
controlled until the drain-to-source voltage (VDS)
reaches the voltage clamp circuit threshold. When the
voltage clamp circuit becomes active, VDS stays con-
stant and the turn-off slope is reduced. This enables
part of the energy stored in the leakage inductance to
be transferred to the secondary side and the other part
to be dissipated in a controlled fashion by the MOS-
FETs. Also, overall system oscillation is reduced due to
lower current slopes. However, it must be considered
that the turn on time of the MOSFETs will increase and
that the maximum duty cycle must be reduced.
Driver continuous supply current is calculated using
Equation 40. Where n is the number of parallel
MOSFETs.
FIGURE 48: MOSFET DRIVE CIRCUIT
EQUATION 40:
Q1 Q2 Q3
R3
R2
R1
D2
R5
C1
D1 Zener
T
R6
R4
S1
V1
12V
Q4
+
9 3
( )
2 2 3 10.7 10 15 100 10 96.3
Gc G tot DRV SW
I n C V f mA
÷
= · · · · = · · · · · · =
AN1279
DS01279A-page 50 © 2009 Microchip Technology Inc.
Peak current estimate is calculated using Equation 41.
EQUATION 41:
Driver power dissipation calculation is shown in the
“MCP14E3/MCP14E4/MCPE5 4.0A Dual High-Speed
Power MOSFET Drivers With Enable” (DS22062) data
sheet. The total power dissipation is calculated to
approximately Ptot = 1W.
Design of Voltage and Current Feedback
Circuitry
For the push-pull stage, battery link, and DC link volt-
age, measurements are needed. Both measurements
are done differential with the MCP6022 rail-to-rail oper-
ational amplifiers. When taking high voltage differential
measurements, the input resistance must be high and
voltage and power rating of the resistors must not be
exceeded. Because of this, 1206 resistors are used on
the input dividers in the reference design. The output
signal for the differential amplifiers is 5V to increase
SNR. Then, a resistor divider is used near the dsPIC
DSC to interface to the 3.3V, 10-bit A/D converter. In
addition, a capacitor is placed near the dsPIC DSC to
enable fast charge of the S&H capacitor. For measure-
ment, 1% tolerance resistors are used. This is espe-
cially important for the differential amplifiers to
guarantee the same resistance in both arms to reduce
common mode noise rejection.
The MOSFET drain current and heat sink temperature
are also measured. The current measurement is based
on the voltage drop measurement on the drain-to-
source resistance, RDSON. This type of measurement
is temperature dependent so a semiconductor
temperature sensor is placed which has nearly the
same temperature dependency as the MOSFET,
RDSON. The current feedback signal is used to prevent
the transformer from saturating.
PCB Layout Considerations
For the push-pull stage, special care should be taken
with traces leading the primary current. High frequency
currents and high current peak values can produce a
lot of noise and even losses on the PCB. Therefore, the
traces should be as short as possible and they should
contain no sharp edges. It is a good idea to connect the
primary windings with the transformer litz wire that is
used for winding the transformer (fly leads).
Care should be taken to not couple the power and
signal parts with the ground planes.
Thermal Design
The heat produced by the MOSFETs and diodes must
be transferred to ambient air using heat sinks. Total
power loss estimation which were performed earlier
are:
• For MOSFETs, PMOS = 110W
• For diodes, PDIODE = 40W. Forced air cooling is
used to dissipate the heat
Full-Bridge Inverter
INVERTER DESIGN SPECIFICATIONS
The inverter is used to generate the UPS output volt-
age. The specifications are:
• Input voltage : 380 VDC
• Output voltage: 230 VACrms
• Continuous power: 1 kW
• Continuous output current: 5.6 Arms
• Peak power for 2 seconds: 1300 VA
• Maximum output current: 10 Arms
• Switching frequency: 50 kHz
• Short circuit-proof
INVERTER POWER-TRAIN DESIGN
IGBT Selection
Due to the high switching frequency, IGBTs with low
switching losses must be selected. Their voltage rating
should be 600V with a current rating of 14A or more
continuous. The STGP14NC60KD from STMicroelec-
tronics was chosen and fulfils all of the selected criteria.
Loss estimation can be done using information in the
data sheet and is estimated at P = 17W. The estimated
junction-to-heat sink resistance using SilPad is:
ROt = 3°C/W. According to these estimates, the junc-
tion temperature will raise 50°C above the heat sink
temperature.
The IGBT inverter also acts as a full-wave rectifier
when charging the battery from the power grid.
Output Common-mode Choke
The common mode inductor has two windings on the
same core. It is called common mode because it blocks
common mode interference and switching noise
produced by the inverter to the output. A schematic of
the inductor is shown in Figure 49. The dot on the
windings indicates the start of a winding. When load is
connected to the output, the flux in the core must be
summed; otherwise, the inductor is connected
incorrectly.
( )
1 1 1 1
4 ( 1 2 3 )
DRV GS TH
Gp
V V
I
R R R R
÷ ÷ ÷ ÷
÷
=
+ + +
© 2009 Microchip Technology Inc. DS01279A-page 51
AN1279
FIGURE 49: COMMON MODE INDUCTOR
SCHEMATIC
Design of the output common-mode choke is the same
design of that of a DC inductor, with the following
conditions:
• Inductance: L = 250 μH
• Peak AC current: I
p
= 17A
• Operating flux density: B
m
= 380 mT
• Current density: J = 500A/cm
2
• Window utilization: K
u
= 0.4
• Output power: P
o
= 1000W
First, the energy handling capability must be
calculated, as shown in Equation 42.
EQUATION 42:
After that, to select the appropriate size of the core, the
area product calculation must be done, as shown in
Equation 43.
EQUATION 43:
The selected core is an Epcos ETD54 ferrite core. The
area product of that core is 11.5 cm
4
, and can be calcu-
lated from the dimension data in the manufacturer’s
data sheet.
The number of turns required to get the desired induc-
tance of the coil is calculated by Equation 44. The core
cross-section, A
c
= 172 mm
2
, is obtained from the
manufacturer’s data sheet.
EQUATION 44:
The calculated number of turns is the number for both
windings. The number is rounded to the value of 40, so
that both winding have an equal number of turns, which
is 20.
To get the desired inductance, the A
L
value is
calculated by Equation 45.
EQUATION 45:
Now, from the core manufacturer’s data sheet the
correct air gap can be selected. For the Epcos N87
material, the air gap length is calculated with
Equation 46.
EQUATION 46:
The gap is chosen from the data sheet to be 3.5 mm.
The new A
L
value must be calculated for the new air
gap by Equation 47.
EQUATION 47:
The new inductance value is shown in Equation 48.
EQUATION 48:
The new operating flux density is verified by
Equation 49 and must be lower than the saturation
point of the selected material.
I1 O1
Input Output
I2 O2
2
6 2
250 10 17
0.036
2 2
p
L I
E Ws
÷
·
· ·
= = =
4
4
2 10
10.3
a c
m u
E
W A cm
B J K
· ·
= =
· ·
39.9
p
c m
L I
N
A B
·
= =
·
2
156
L
L
A nH
N
= =
2
1
1
3.3
k
L
A
s mm
k
| |
= =
|
\ .
2
1
148
K
L
A K s nH = · =
2
237
L
L N A H u = · =
AN1279
DS01279A-page 52 © 2009 Microchip Technology Inc.
EQUATION 49:
N27 material has a saturation point of 410 mT (100
o
C).
The cross section of the wire is calculated by
Equation 50, where RMS current through the inductor
is calculated from the output power and the RMS value
of the output voltage.
EQUATION 50:
The calculated value is the minimum cross-section of a
wire (100 kHz litz wire must be used).
Next, the fill factor has to be calculated by Equation 51.
This will give an estimate if the windings will fit into the
bobbin. The fill factor must be 0.4 or less. W
b
is the bob-
bin winding area and is 315.6 mm
2
. This information
can be found in the core data sheet.
EQUATION 51:
Output Capacitor Selection
The Inverter switching transistors produce the
sinusoidal pulse width modulated voltage waveform
that has a fundamental frequency of 50 Hz or 60 Hz.
The low-pass filter comprises an output inductor and an
output capacitor to pass only the low-frequency
component (50 Hz or 60 Hz) of the sinusoidal pulse
width modulated voltage waveform, in order to produce
a low-frequency sinusoidal output voltage.
The value of the output capacitor must be large enough
to pass the fundamental frequency and low enough so
that it should need high reactive current. To get a cut-
off frequency of ~100 Hz, the value of the output capac-
itor selected is 4.7 µF. The output capacitor should be
able to take the high inductor ripple current as well as
suppress the switching noise. The B32924C3475M
MKP series film capacitor from Epcos fulfils all of the
selected criteria.
Output Relays
Two relays are used in the system. Relay K1 is used to
control charging of the DC link capacitors from the
power grid. During operation this relay is always on.
Relay K2 is used for switchover when the power grid
fails. This relay must have a fast switchover time so
additional components are used to reduce the
switchover time. The R||C combination of R68 and C43
is used to allow high current at turn-on, and then
reduce current during the ON state to allow for faster
turn-off. Resistor R72 is used to deplete the energy
stored in the relay coil for faster turn-off. Transistor
Q11’s switching speed is increased using R-C||R
combination, which allows for a higher base current at
turn-on and negative voltage on the base current at
turn-off.
DESIGN OF GATE DRIVE CIRCUITRY
A half-bridge driver with fault- and short-circuit protec-
tion must be used to fulfill the design specification. The
selected IGBT can withstand a short circuit of 10 µs. If
the driver detects a short-circuit, it will perform a soft
turn-off for the IGBTs. In addition, a bootstrap with a
600V floating channel is needed to drive the high-side
IGBTs. To be able to meet the EMI requirements, the
turn-on and turn-off slopes should be tunable with gate
resistors. The IR2214 from International Rectifier
meets all of these requirements. Looking at the data
sheet of the IGBTs the allowed gate voltage is VGMAX
= ±20V and the gate threshold voltage is VG(TH) = 4.5-
6.5V. The driver is supplied by VCC = 12V to ensure
IGBT turn-on. To ensure that the IGBT does not turn on
due to internal IGBT Miller capacitance when VCE
rises with high slope, gate to collector capacitors are
used.
DESIGN OF VOLTAGE AND CURRENT
FEEDBACK CIRCUITRY
For voltage feedback, differential amplifiers are used,
which are built with the MCP6022 operational amplifier.
To measure power grid and output voltage, bipolar
measurements are needed. To enable the differential
amplifiers to measure a bipolar signal voltage, an offset
of Voff = 2.5V is used as the positive reference point.
Therefore, the operational amplifier gives 2.5V to its
output when the differential measured voltage is zero.
When the differential measured voltage is negative, the
output goes to 0V and conversely, the output voltage
goes to 5V when the measured differential voltage is
positive.
360
p
new
c
L I
B mT
N A
·
= =
·
2 230
0.88
o
rms
cu
P
I
V
A mm
J J
= = =
0.11
cu
u
b
N A
K
W
·
= =
© 2009 Microchip Technology Inc. DS01279A-page 53
AN1279
Because of the high differential input voltage, a series
of 1206 resistors were used to stay within the voltage
and power rating of the devices. All of the resistors
used were 1% tolerance to guarantee the exact mea-
surement and reduce common mode noise rejection.
For current measurement, a Hall effect-based sensor
from LEM is used. The sensor is bipolar and signal
output is 0.5V. At zero current, the output is 2.5V.
For all of the 5V signals, a resistor divider was
added near the dsPIC DSC to interface with the 3.3V
10-bit A/D converter. In addition, a capacitor was
added near the dsPIC DSC to fast-charge the SH
capacitor.
PCB LAYOUT CONSIDERATIONS
Traces leading the output current should be held as
short as possible. Special care should be taken
because of high voltage. Around the IGBT driver the
logical level and gate drive components should be sep-
arated, and care should be taken to not couple the
parts with ground planes.
THERMAL DESIGN
IGBTs must be placed on a heat sink to dissipate the
produced heat. Total power dissipation is estimated as
P
IGBT
= 68W. The devices must be mounted on the heat
sink using thermal conductive and electric insulating
material.
Battery Charger Design
DESIGN SPECIFICATIONS FOR BATTERY
CHARGER SPECIFICATIONS
A battery charger is used to charge the batteries from
the power grid. Three series lead acid batteries were
used in the system. The charger design specifications
are:
• Input voltage: 95-260 VAC
• Output voltage: 30-45V
• Output current: 0-2.5A
• Current control
• Voltage limit
DESIGN OF POWER-TRAIN COMPONENTS
To realize the flyback converter primary drive stage, an
integrated solution TOP250Y from Power Integrations
was selected. Maximum output power is calculated as
PCH = UBmax * IBmax - 112.5W . The flyback works
with a switching frequency of f = 132 kHz. Therefore, a
fast rectifier and primary clamp diode must be used.
The transformer ratio is N2 ÷ N1 = 28 ÷ 52. Based on
this ratio and the maximum input voltage, the rectifier
reverse voltage rating should be higher than the result
of Equation 66, where VF(IGBTD) is the voltage drop
across the IGBT anti-parallel diode, which are used for
power grid voltage rectification.
The clamping elements are designed using design
tools from the manufacturer of the TOP250Y.
Flyback Transformer
The flyback transformer is designed to the desired out-
put power and output current ripple, to enable current
source operation. For the flyback converter, a trans-
former with air gap is needed. The transformer is
designed for the following conditions:
• Minimum DC link voltage: V
imin
= 130.6 V
• Maximum DC link voltage: V
imax
= 364 V
• Nominal DC link voltage: V
inom
= 247.4 V
• Nominal duty cycle: d
n
= 0.24
• Output current: I
o1max
= 2.5A
• Nominal output voltage: V
o
= 40V
• Secondary current ripple: ∆I
s
[%] < 25 %
• Switching frequency: f = 132 kHz
The primary to secondary turns ratio is calculated with
Equation 52.
EQUATION 52:
To limit the current ripple, the inductance of primary and
secondary windings must be calculated with
Equation 53.
EQUATION 53:
Now, the primary current can be calculated with
Equation 54, where transformer efficiency is estimated
at 90%, and for secondary current with Equation 55.
( ) 1.9
1
inom DSon n
PS
O Df n
V V d
N
V V d
÷
= · =
+ ÷
max
2
( ) ( )
196
684
o Df ON
S
P S PS
V V T T
L H
Is
L L N H
u
u
+ · ÷
= =
A
= · =
AN1279
DS01279A-page 54 © 2009 Microchip Technology Inc.
EQUATION 54:
EQUATION 55:
Now, the required wires for primary and secondary can
be selected. We will design the flyback transformer to
run a current density of J = 4 A/mm
2
. Therefore, the
required copper area for the primary and secondary
can be calculated with Equation 56 (litz wire for
132 kHz must be used).
EQUATION 56:
A winding factor of K = 0.2 is selected for the trans-
former and N87 material for the core. The maximum
core flux density is set to B = 130 mT. To select the
core, the area product has to be calculated with
Equation 55.
EQUATION 57:
The selected core needs to have a higher area product
than what has been calculated. From the magnetics
side, ETD34 and above will be sufficient; however,
there needs to be enough space to fit the windings. For
this in iterations for different cores, the number of turns
and from this the window utilization and fill factor has to
be calculated. If the window utilization is higher than
90% or a fill factor higher than 0.4, the windings will not
fit. The transformer construction winding diagram and
mechanical diagram are shown in Figure 50.
| |
max
max
2
max
( ) ( )
% 1
4
(1 )
4.5
2
1
(1 )( ( ) ( ( )) 3.2
2 3 2
O on
S O S
S
O
Sc
S
Speek Sc
S S
S rms Speek Sc Speek Sc
V T T
I I I A
L
I
I A
d
I
I I A
I I
I d I I I I A
· ÷
A = = · A =
= =
÷
A
= + =
A A
= ÷ ÷ + ÷ ÷ =
min max
min max
2
max
( )
0.55
2.4
( ) 0.9
2.7
2
1
( ( ) ( ( )) 1.5
2 3 2
i on
P
P
O O
Pc
i
P
Ppeek Pc
P P
Prms Ppeek Pc Ppeek Pc
V T
I A
L
V I
I A
V d
I
I I A
I I
I d I I I I A
·
A = =
·
= =
· ·
A
= + =
A A
= ÷ + ÷ ÷ =
2
2
0.375
0.8
Prms
CuP
Srms
CuS
I
A mm
J
I
A mm
J
= =
= =
4 max
100
0.65
2
O
a c
t
P
W A cm
K B f J
·
= =
· · ·
© 2009 Microchip Technology Inc. DS01279A-page 55
AN1279
FIGURE 50: TRANSFORMER ELECTRICAL AND MECHANICAL CONSTRUCTION
For the windings, litz wire is used to grant low copper
losses at high frequency. For switching frequency f =
132 kHz, a litz wire made of AWG38 wires is used to
eliminate skin and proximity effect. The required num-
ber of parallel wires is calculated with Equation 58.
EQUATION 58:
For both, we have to select standard litz wires. So, for
the primary, 45xAWG38 is selected and for the second-
ary, 105xAWG38 is selected. The diameter of selected
wires with silk isolation is D
P
= 1 mm and D
S
= 1.5 mm.
For the used ETD39 core with an air gap, the required
number of turns can now be calculated from the
required primary inductance, turns ratio, and core data.
Primary turns are calculated with Equation 59.
EQUATION 59:
Now, the window utilization and fill factor can be calcu-
lated for the selected core and wires. The bobbin win-
dow is 25x7 mm. From this we can calculated how
many turns for the primary and secondary
(Equation 60) and the number of required layers
(Equation 61).
EQUATION 60:
EQUATION 61:
The window utilization is shown in Equation 62 and fill
factor in Equation 63.
EQUATION 62:
EQUATION 63:
According to this the windings fit to the selected core.
The required air gap can be calculated from the core
data sheet. To calculate the required air gap the A
L
value of the core has to be calculated. The A
L
value is
air gap dependent. From knowing the primary induc-
tance and number of winding turns, the required A
L
value can be calculated with Equation 64.
CORE
Bobbin Insulation and Shield
NP
NP
NS
Primary
Secondary
Primary
Primary
Secondary
Primary
47.7
101.8
CuP
wP
Cuw
CuP
wS
Cuw
A
n
A
A
n
A
= =
= =
4
10
58.1 58
2
30.5 30
P Ppeek
P
e
P
S
PS
L I
N
B A
N
N
N
· ·
= = ÷
·
= = ÷
25
25 25
25
16.7 16
tP
P
tS
S
N
D
N
D
= = ÷
= = ÷
2.32 3
1.875 2
P
lP
tP
S
lS
tS
N
N
N
N
N
N
= = ÷
= =÷ ÷
( ) / 86%
u P lP S lS a
W D N D N W = + =
( ) / 0.25
u CuP P CuS S a
K A N A N W = · + · =
AN1279
DS01279A-page 56 © 2009 Microchip Technology Inc.
EQUATION 64:
Now, from the core manufacturer data sheet, the cor-
rect air gap can be selected. For the used EPCOS
ETD39 N87 core, the correct air gap is calculated with
Equation 65.
EQUATION 65:
The nearest standard air gap values are 0.7 mm and
1 mm. Our calculated value is close to 1 mm so we
select an air gap of 1 mm and do not need to change
the windings. If an air gap of 0.7 mm is selected, the
number of winding turns must be corrected.
Battery Selection
The battery selection will depend on the DC voltage
and the required backup time of the Offline UPS
system. The Offline UPS Reference Design has been
designed for 36V input DC voltage, being able to
produce one hour of backup time with a 35 AH battery.
VOLTAGE, CURRENT AND TEMPERATURE
SENSE CIRCUITRY
The battery charger works as a current source deliver-
ing the requested charge current to the battery, inde-
pendent of battery voltage. For current measurement
and control, a resistor and a high-side current shunt
monitor (INA168 from Texas Instruments) were used.
For current control, a discrete analog PI controller was
built that controls the duty cycle of the TOP250Y. In
addition, the measured current is fed through a differ-
ential amplifier stage to the dsPIC DSC device. Parallel
to the current feedback loop, a voltage feedback loop is
used to limit the output voltage in case the battery is not
connected. In addition, a header is placed on the PCB
to interface with a temperature sensor to monitor the
battery temperature and allow battery management
software to know the state of the batteries.
PCB LAYOUT CONSIDERATIONS
Precaution must be taken due to high voltage signals.
Also the primary clamp components should be placed
as near as possible to the transformer and the
TOP250Y to reduce stress of the switching compo-
nents. Care should also be taken to not couple the
power, control, and measurement parts with ground
planes.
THERMAL DESIGN
The top switch and rectifier diode must be mounted on
a heat sink. Assuming efficiency of the battery charger
to be 70%, nearly 50W of loss will be dissipated. Those
losses consist of clamp losses, transformer losses,
primary switch (TOP250Y), and rectifier losses.
Therefore, we can estimate that near 30W of losses
need to be dissipated on the heat sink. Both elements
TOP250Y and the rectifier diode must be mounted on
the heat sink using thermal conductive electrical
insulating material.
EQUATION 66:
2
203.3
L
L
A nH
N
= =
2
1
1
0.95
k
L
A
s mm
k
| |
= =
|
\ .
2
( ) ( )
1
28
2 2 260 2 45 2 1.3 240.4
52
BR rect in bat F IGBTD
N
V V V V V
N
= · · + ÷ · = · · + ÷ · =
© 2009 Microchip Technology Inc. DS01279A-page 57
AN1279
Design of Auxiliary Power Supply
DESIGN SPECIFICATIONS
The auxiliary power supply provides power, which is
taken from the battery link, to all of the on-board
electronics. The design specifications are:
• Input voltage: 30V-45V
• Output: 150 mA @ 3.3V, 300 mA @ 5V, 500 mA
@ 12V
CHOICE OF COMPONENTS
Because of a wide range of input voltage and power
losses, a buck converter was used to generate 12V
from the battery voltage. For 3.3V and 5V, linear
regulators are used because of simplicity and price. All
the voltage regulators are connected in series so the
12V buck converter needs to deliver 1A of current. For
the buck converter, an LM5575 from National
Semiconductor was used with the switching frequency
set at f = 500 kHz. Components were selected
according to the LM5575 data sheet. For the linear
voltage regulators, power dissipation must be
calculated to select the right package in the PCB
layout. For the 5V regulator, maximum power
dissipation is calculated to P5V = (VIN - VOUT) * IOUT =
3.15 mW and for 3.3V to P5V = (VIN - VOUT) * IOUT = 255
mW. For the 5V regulator, a (KE7805ER) TO-263
package with a PCB mount heat sink was selected, and
for the 3.3V regulator, a (TC1262) SOT223 package
was selected. For the analog circuits, additional chip
inductors and capacitors were added to separate digital
and analog supply voltages.
The auxiliary power supply will start when DC link
voltage is present or when the button is pressed.
PCB LAYOUT CONSIDERATIONS
For the buck converter, due to very high frequency cur-
rent, care should be taken when designing the output
traces. The inductor, Schottky diode, and low-ESR out-
put capacitors should be as close as possible to the IC.
Also input capacitors should be placed close to the IC
to block the noise produced by the buck converter.
For linear regulators, adequate PCB and copper area
must be provided to keep the devices cool.
CONCLUSION
The Microchip dsPIC DSC device provides all of the
necessary power peripherals used for power conver-
sion applications. It’s highly flexible Intelligent Power
Peripheral (IPP), ADC, Comparator, and PWM mod-
ules simplify the hardware schematic and reduces the
number of components in the design of a high-perfor-
mance UPS system. The built-in DSP engine and IPP
help in optimizing control loop design, being able to
produce a clean sine wave output (THD less than 3%)
even with a rectifier load and a crest factor of 3:1.
With the help of optimized instruction sets, like MAC,
there is enough time left to perform all of the auxiliary
tasks, fault protection, housekeeping, and communica-
tion with the external world. The dsPIC33F enables
power conversion design with all advance features
within the target price.
REFERENCES
• “MCP14E3/MCP14E4/MCPE5 4.0A Dual High-
Speed Power MOSFET Drivers With Enable”
(DS22062), Microchip Technology Inc.
• “TC1262 500mA Fixed Output CMOS LDO”
(DS21372), Microchip Technology Inc.
• “Power Electronics Converter, Applications and
Design” by N.Mohan, T.M. Undeland, and W.P.
Robbins
• “Control Topology Options for Single-Phase UPS
Inverter” by M.J Ryan, W.E. Brumsickle, and R.D.
Lorenz, IEEE transaction on industry application,
Vol. 33, No. 2, March/April 1997.
• “A Current Mode Control Technique with Instanta-
neous Inductor Current Feedback for UPS
Inverter” by H.Wu, D.Lin, D. Zhang, K. Yao,
J.Zhang, IEEE transaction, 1999.
• “A High Performance Sine Wave Inverter Control-
ler with Capacitor Current Feedback and Back-
EMF coupling” by M.J Ryan and R.D. Lorenz,
IEEE transaction, 1995.
AN1279
DS01279A-page 58 © 2009 Microchip Technology Inc.
NOTES:
© 2009 Microchip Technology Inc. DS01279A-page 59
AN1279
APPENDIX A: SOURCE CODE
All of the software covered in this application note is
available as a single WinZip archive file. This archive
can be downloaded from the Microchip corporate Web
site at:
www.microchip.com
Software License Agreement
The software supplied herewith by Microchip Technology Incorporated (the “Company”) is intended and supplied to you, the
Company’s customer, for use solely and exclusively with products manufactured by the Company.
The software is owned by the Company and/or its supplier, and is protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil
liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR
STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE
FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
AN1279
DS01279A-page 60 © 2009 Microchip Technology Inc.
APPENDIX B: CONTROL SYSTEM
DESIGN
The Offline UPS Reference Design implements full dig-
ital control of the push-pull converter and full-bridge
inverter. MATLAB
®
was used to design the compensa-
tors based on the hardware and to generate optimal
coefficients to be used in the software.
MATLAB SIMULINK
The simulation files contain the models for various sub-
systems. Some subsystems are presented as nested
blocks to simplify the main diagram. Simulink
®
pro-
vides mathematical blocks for the time domain simula-
tions.
There are typically two models in each file.
• Analog implementation
• Digital implementation
Each SIM file analog implementation typically consists
of the following sections:
• Reference Block
• Feedback System Block
• Power System Block
• Control System Block
• Modulation Inverse Block
• Modulation Block
• Load System Block
• Special Blocks
The Simulink blocks will vary based on the converter
topology and control scheme implemented (i.e., current
mode, voltage mode). The following sections describe
each block used within the models.
REFERENCE BLOCK
This system provides the input for the control system.
Typically, it is only a DC constant for DC-DC converters
or a sine wave generator for UPS-type models. The
control system is required to track the reference wave-
form. This block may or may not be labeled as such in
the actual models.
FEEDBACK SYSTEM BLOCK
Various signals are typically measured in a system.
These include the voltages and currents for performing
the control operations.
In digital implementation, additional blocks may be
needed to account for quantization due to the presence
of an ADC and zero order holds for sampling the signal
at a constant frequency.
POWER SYSTEM BLOCK
This is the actual physical system. This system
represents energy states and is what actually gives the
output to be controlled. Typically, it will consist of an L-
C circuit. The system implementation of L and C is
based on integrators and saturations. The input is
typically voltage given by the modulation block
(conversion of duty ratio to actual excitation voltage).
Depending on the topology, the power system block will
change. Parasitic components such as capacitor ESR
and inductor DCR are included in the system here. In
addition, loading of the system will be accounted here.
CONTROL SYSTEM BLOCK
This block generates the duty ratio that drives the
power section block. The feedback signals from the
feedback block is the input and the output as a number
between 0 and 1, which represents the duty cycle ratio.
This block may consist of various cascaded PID loops
based on the control scheme (voltage mode or current
mode control). In digital implementation integrators and
differentiators are replaced by their digital equivalents.
MODULATION INVERSE BLOCK
This block may be part of the control system block as it
converts the output of the PID loops from voltage and
current quantities to duty ratio quantities between 0 and
1. Different topologies have different implementations.
Typically, it involves division with a voltage quantity
(e.g., input voltage for buck converter and output
voltage for boost converter). It is just the inverse
operation of modulation performed by the physical
system in converting duty ratio into voltage.
These models typically have a division with a voltage
quantity (divisor) with little variation. Sometimes in soft-
ware these routines are not implemented, but in an
actual system, the quantity is assumed to be constant
and gains are prescaled appropriately.
MODULATION BLOCK
This block represents the average model of the switch-
ing system. This block converts the duty applied to
physical system to voltage quantity. Its input is the duty
cycle ratio /parameter (0 to 1) that gets converted to
voltage quantity. It usually takes the system input volt-
age and duty cycle as input and generates an output
voltage.
LOAD SYSTEM BLOCK
This block is used to generate different types of load
current. For example, a step load with DC offset can be
created, which is useful for step loading. Sinusoidal
loads for UPS-type systems with variable phase (induc-
tive, resistive, etc.), amplitude, and frequency can also
be used depending on the choice of test conditions.
SPECIAL BLOCKS
Second order effects like saturation of inductor and
dead-time are modeled for systems where these
become important like UPS. These are indicated by
saturation and dead-time blocks.
© 2009 Microchip Technology Inc. DS01279A-page 61
AN1279
MATLAB .m File
The .m file is used to generate the coefficients that are
used in the MATLAB model (.mdl). It also generates
the scaled values to be used in the software. The gen-
erated values are in fractional format. In software they
must be represented as Q15(x), where x is a fractional
value.
The following parameters are typically used:
• The input voltage
• L (equivalent inductor value)
• C (equivalent capacitor value)
• ESR (capacitor ESR)
• LSR (lumped series resistance includes tracks +
switch + cable resistance, etc.)
Based on the topology used, these parameters can
vary from the actual values. For example, if three con-
verters are in parallel, then simulation is performed for
a single converter (instead of (3x) the capacitor value,
only a single capacitor is modeled and the inductor
value will remain the same).
The input voltage may vary especially when
transformers are involved. Typically, all quantities are
then referenced to primary or secondary based on
convenience. In either case, the input voltage will vary.
Depending on implementation, input voltage may be
assumed constant and lumped together with some of
the gains.
Bode plots are generated by the .m file for a graphical
representation. The following are typical plots:
• Loop gain plot (A x |) – this is used to determine
phase and gain margin
• Closed loop plot (A x |) / (1 + A x |) or Vo / Vo* –
used to determine the closed loop response and
bandwidth of the system
• Disturbance rejection plot Io(s) / Vo(s) – used to
determine the stiffness of the system and
expected amount of voltage ripple when a load is
applied as a function of frequency
Push-Pull Compensator
For the push-pull converter, a PID control algorithm
has been implemented using voltage mode control.
This means that the output voltage is measured and
compared to a reference set point. The difference is
then passed through the PID compensator. The PID
control algorithm will look at the error, the previous
error, and the control history to determine the output
value. The output of the PID will determine the ON
time for the PWM duty cycle. Figure B-1 provides a
push-pull converter control scheme.
FIGURE B-1: PUSH-PULL CONTROL SCHEME
X PID
VREF
+
PWM
S&H
1001010111
ADC
Voltage Feedback
VOUT
1:16
+
+
VIN

Voltage
Error
Control
Output
Duty
Cycle
AN1279
DS01279A-page 62 © 2009 Microchip Technology Inc.
Figure B-2 shows the MATLAB Simulink block
diagram. For further details of each block refer to the
MATLAB (.mdl) file.
FIGURE B-2: MATLAB DIGITAL IMPLEMENTATION (PUSH-PULL)
The following bode plots are generated from the
MATLAB (.m) file. Each plot is used to describe the
behavior of the system. The disturbance rejection plot
is defined as: I(s) / VO(s).
Figure B-3 describes the amount of load current ampli-
tude needed to be applied to generate one unit voltage
sag as a function of frequency. The higher this absolute
figure of merit, the stiffer (better) the power supply will
be. The minimum is -4 db, which will correlate to a 1A
load producing 1.5V dip on the output.
FIGURE B-3: DISTURBANCE REJECTION PLOT (PUSH-PULL)
390
VO*1
VIN1
Digital
Control System
Inverter Load Generator1
ADC
L_C Circuit1
Buck Modulation1
Scope1
Expected Input
Current1
Product3
VO
VIN
D
D
VIN1
VIN.D
VO*
Out1 In1
VO ILOAD
540
L_C
Voltage
VO1
IL iLoad
x
© 2009 Microchip Technology Inc. DS01279A-page 63
AN1279
The loop gain voltage plot shown in Figure B-4 is used
to find phase and gain margin. From the plot it can be
seen that the phase margin (difference between 180
degrees and the phase angle where the gain curve
crosses 0 db) is 90 degrees.
To prevent the system from being conditionally unsta-
ble, it is imperative that the gain plot drops below 0 db
when the phase hits 180 degrees.
The blue curve is for the analog implementation and
the green curve is for the digital implementation. It is
generally recommended to have a phase margin of at
least 40 degrees to allow for parameter variations.
The gain margin is the difference between gain curve
at 0 db and where the phase curve hits 180 degrees.
The gain margin (where the green line on the phase
plot hits 180 degrees) is -20 db.
FIGURE B-4: LOOP GAIN VOLTAGE PLOT (PUSH-PULL)
AN1279
DS01279A-page 64 © 2009 Microchip Technology Inc.
Figure B-5 shows the closed loop bode plot. The point
where the gain crosses -3 db or -45 degrees in phase
is usually denoted as the bandwidth. In this system, the
bandwidth of the voltage loop is approximately 1250 Hz
(8000 rad/s), which is closely matched by the bode plot.

FIGURE B-5: CLOSED LOOP (PUSH-PULL)
Full-Bridge Inverter Compensator
Current mode control has been implemented for the
Inverter using two control algorithms: PI and P.
In current mode control, the current as well as the volt-
age is measured. The inverter output is generated by
varying the input voltage reference using a sinusoidal
lookup table. The difference is passed through the volt-
age error compensator (PI) and the output is the cur-
rent reference value. The measured current value is
subtracted from the reference and the difference is
passed to the current error compensator (P). The out-
put of the compensator is used to control the PWM out-
puts. Current mode control is the preferred method as
it has better transient response and stability of the out-
put. However, current mode control is usually harder to
implement as there are two control algorithms instead
of just one as in voltage mode control.
FIGURE B-6: FULL-BRIDGE INVERTER CONTROL SCHEME
X PI X P
PWM
Sinusoidal Reference
Current
Reference
S&H
S&H
1001010111
ADC
1011010011
Output Filter
AC Out
Voltage Feedback
+ -
+ -
Voltage
Error
Current
Error
Control
Output
Duty
Cycle
Current
Feedback
© 2009 Microchip Technology Inc. DS01279A-page 65
AN1279
Figure B-7 shows the MATLAB Simulink block diagram
for the inverter. For further details of each block, refer
to the MATLAB (.mdl) file.
FIGURE B-7: MATLAB DIGITAL IMPLEMENTATION (INVERTER)
The disturbance rejection plot as previously described
in the Push-Pull section is defined as: I(s) / VO(s).
For the inverter, the minimum is -30 db, which implies
that for 1A load amplitude @ 1000 Hz (6280 rad/s), the
output voltage will exhibit a sinusoidal variation of 31V.
FIGURE B-8: DISTURBANCE REJECTION PLOT (INVERTER)
Out1
Sine Wave
VO*1
Zero-order
Hold2
Sine Wave
(input variation)
+
+
390
+
+
+
+
Full-Bridge
Modulation Model1
L_C Circuit1
D.VIN
iLoad
VO
IL
Dtop
VIN
ILZX
VIN
(2.D-1)
In1
In2 Out2
Out1
Digital
Control System1
Dtop
VO
VIN
IL
VO*
ILoad
Scope2
AN1279
DS01279A-page 66 © 2009 Microchip Technology Inc.
Figure B-9 shows the loop gain bode plot for the
inverter. From the plot, it can be seen that the phase
margin (difference between 180 degrees and the
phase angle where the gain curve crosses 0 db) is 47
degrees.
The gain margin is the difference between the gain
curve at 0 db, and where the phase curve hits 180
degrees. In the plots below, the gain margin (where the
green line on the phase plot hits 180 degrees) is -10 db.
Figure B-10 shows the closed loop bode plot for the
inverter. The point where the gain crosses -3 db or -45
degrees in phase is usually denoted as the bandwidth.
In this system, the bandwidth of voltage loop is 1250 Hz
(8000 rad/s), which is closely matched by the bode
plots.
FIGURE B-9: FIGURE: LOOP GAIN VOLTAGE PLOT (INVERTER)
FIGURE B-10: FIGURE: CLOSED LOOP (INVERTER)
© 2009 Microchip Technology Inc. DS01279A-page 67
AN1279
Scaling
The gains calculated from MATLAB are based on real
units (volts, amps, etc.). The dsPIC DSC has a fixed
point processor and the values in the processor have a
linear relationship with the actual physical quantities
they represent.
The gains generated by MATLAB being in real units,
cannot be directly applied to these scaled values (rep-
resentation of physical quantities). Therefore, for con-
sistency, these gains themselves need to be scaled.
The following sections present general concepts
behind proper scaling.
The basic idea behind scaling is quantities that need to
be added or subtracted should be of the same scale.
Scaling does not affect the structure of the control sys-
tem block diagram in any way. Scaling only effects the
software representation of various quantities.
SCALING FEEDBACK
To properly scale the PID gains, it is imperative to
understand the feedback gain calculation. The feed-
back can be represented in various formats. Fractional
format (Q15) is a very convenient representation.
Fractional format allows easy migration of code from
one design to another with completely different ratings
with most changes only in the coefficients defined in the
header file.
To completely use the 16 bits available in the
processor, the Q15 format is most convenient as it
allows signed operations and full utilization of the
available bits (maximum resolution). Other formats are
also possible, but resolution is lost in the process. Q15
allows us to use the fractional multiply MAC operation
of the dsPIC DSC effectively.
The feedback signal (typically voltage or current) is
usually from a 10-bit ADC. Based on the potential
divider/amplifier in the feedback circuitry, actual voltage
and currents are scaled.
Typically, the feedback 10-bit value (0 -1023) is brought
to +/- 32767 range by multiplying by 32. This format is
also known as Q15 format: Q15(m) where -1 < m < 1
and is defined as (int) (m * 32767).
These formulas will have some error as we need 2^15
= 32768, but due to finite resolution of 15 bits we use
only +/- 32767. From a control perspective, for most
systems these hardly introduce any significant error.
In this format, +32767 corresponds to +3.3V and 0
corresponds to 0V.
The feedback circuitry and the left shift by 5 (x32) is
effectively taking the physical quantity and dividing it by
a larger base quantity. The fractional value is then rep-
resented as Q15 in software. Our goal is to find that
larger base quantity.
As an example, we are trying to measure 100V. We
have a potential divider such that 100V would give
1.65V on the analog pin. Then, the value read in Q15
format is 16383 or Q15(0.5), which is equivalent to
Q15(100 / 200). Therefore, 200 becomes the base
voltage.
The base (or normalizer) is denoted as VN. In other
words, VN is the voltage that will produce 3.3V or full-
range voltage on the analog ADC pin.
At this point, voltage has been scaled as a fraction
(V / VN) in software.
Similarly, other physical quantities that are read via
ADC feedback are also represented in Q15 format.
GAIN SCALING
In simulation the control gains are calculated in real
units. For example, in current mode control, the output
of voltage loop is the current reference (in amps).
Therefore, the gain is Amps/Volts or in units of 1/ohms:
V  Gain  IREF
The goal is to obtain IREF in an appropriate format like
Q15(I/IN) to enable implementation of the current loop
in software.
In theory, the Q15 voltage V/VN is first multiplied by
VN, and then gain (G), and then the IREF that is
obtained is divided by IN to get current in the cor-
rect format. Since VN and IN are constants, the gain
G is scaled as: G * VN / IN. This value can be used
in software to act on voltage quantity and give out a
current quantity.
The input quantity should be in fractional format (this
has to be ensured in code). Then, the output current
quantity will automatically be in the correct fractional
quantity. This essentially solves the objective of
scaling. The same logic applies to any control block.
By considering the input and output units and scale of
each block to be implemented in software, the proper
scaled values can be arrived at.
SAMPLING TIME
In calculation of the derivative and integral term in the
discrete time domain, TS (sampling time) factors show
up. Since sampling time is usually constant, it can also
be lumped together with the gains. For example, if GS
is the integral gain in real units, GS * TS * VN / IN is the
scaled value.
AN1279
DS01279A-page 68 © 2009 Microchip Technology Inc.
PRESCALER
As most physical quantities are represented as Q15
format for easy multiplication with gains, the gains also
need to be in fractional format. If the value of gain
(G * VN / IN) is between -1 and +1, it can be easily
represented as fractional format.
Multiplications can then be performed using
fractional multiply functions like MAC or using
builtin_mul functions and shifting appropriately.
For example, z = (__builtin_mulss(x,y) >> 15)
results in z = Q15(fx,fy), where all x, y, and z are in
Q15 format (fx and fy are the fractions that are
represented by x and y).
In many instances, the gain terms are greater than
unity. Since 16-bit fixed point is a limitation, a prescaler
may be used to bring the gain term within the +/- range.
For example, if the value that needs to be used is 2.5,
it is predivided by 4 to bring it within ±1 range.
If a prescaler is used for P term in a control block, it also
must be used for the I and D term in the control block
as all of the terms get added together.
To prevent number overflows, PID output and I output
individually have to be properly saturated to ±32767.
The saturation limits for the PID output must be set at
one-fourth of the original ±32767 to account for the
prescaler. Therefore, they are set at ±8192.
Finally after saturation, the output has to be postscaled
by 4 to bring it to proper scale again.
Modulation and Duty Generation
The output of a control system after saturation is
brought to 0-32767. Based on the topology, this can be
interpreted as a duty ratio/modulation index
representing 0-1. This can then be used to convert to a
duty cycle value by multiplying it with the PWM period.
This varies with topology, but the idea behind scaling is
the same.
Again, the following equation can be used where
PERIOD corresponds to 100% duty :
Duty = ( __builtin_mulss(m, PERIOD) >> 15)
Division By VIN
The output of the controller in the MATLAB model is
usually a voltage quantity. This needs to be converted
to a duty/modulation quantity. To do this, the control
output needs to be divided by the input voltage VIN. To
avoid division, VIN can be assumed to be constant and
1/VIN can be used as a constant multiplier and bundled
along with the gains in the previous blocks.
© 2009 Microchip Technology Inc. DS01279A-page 69
AN1279
APPENDIX C: ELECTRICAL
SPECIFICATIONS
This Appendix provides an overview of the UPS electri-
cal specifications as well as scope plots from initial test
results.
TABLE C-1: OFFLINE UPS REFERENCE DESIGN ELECTRICAL SPECIFICATIONS
Parameter Description Min Typ Max Units Comments
V
IN
Input Voltage 210 220 242 V
f
IN
Input Frequency 47 50 53 Hz
V
OUT
Output Voltage 220 V
f
OUT
Output Frequency 49 50 51 Hz
V
BATTERY
Battery Input Voltage 34 36 45 V
P
OUT
Continuous Output Power — — 1000 VA
OLP Over Load Protection >100 — 135 % 1350 VA for 2 seconds
THD Output Voltage THD — — 3 % Full load (resistive)
η Battery Charger Mode
System Efficiency
— 84 — %
Inverter Mode System Efficiency — — 84 % >50% load
t
TRANSFER
Mains to Inverter Transfer Time — — 10 ms
Inverter to Mains Transfer Time — 0 — ms
I
CHARGE
Battery Charge Current — 2 2.5 A
I
_BATTERY
Battery Input Current (note 1) — — 40 A @ 100% load
T Operating Temperature — 25 — °C
CF Crest Factor — — 3:1 —
PF Power Factor (Inductive Load) .65 — — — Only tested at .8 PF
Power Factor (Rectifier Load) .65 — — —
Note 1: UPS run time will vary with output load current and the batteries discharge rate. Refer to the battery data
sheet for specific discharge times.
AN1279
DS01279A-page 70 © 2009 Microchip Technology Inc.
FIGURE C-1: EFFICIENCY CHART ACROSS LOAD SPECTRUM
FIGURE C-2: OUTPUT VOLTAGE WAVEFORM – NO LOAD
220V UPS Efficiency Chart
60
65
70
75
80
85
90
10 25 50 60 70 80 90 100
% Load
P
e
r
c
e
n
t
a
g
e

(
%
)
© 2009 Microchip Technology Inc. DS01279A-page 71
AN1279
FIGURE C-3: OUTPUT VOLTAGE AND OUTPUT CURRENT – FULL LOAD
FIGURE C-4: OUTPUT VOLTAGE AND OUTPUT CURRENT – 500 VA REACTIVE LOAD
AN1279
DS01279A-page 72 © 2009 Microchip Technology Inc.
FIGURE C-5: MAINS TO INVERTER SWITCH OVER – 400W LOAD
FIGURE C-6: INVERTER TO MAINS SWITCH OVER – 400W LOAD
© 2009 Microchip Technology Inc. DS01279A-page 73
AN1279
FIGURE C-7: DYNAMIC LOAD RESPONSE – 400W UNLOAD
FIGURE C-8: DYNAMIC LOAD RESPONSE – 400W LOAD STEP
AN1279
DS01279A-page 74 © 2009 Microchip Technology Inc.
APPENDIX D: SCHEMATICS AND BOARD LAYOUT
FIGURE D-1: OFFLINE UPS REFERENCE DESIGN BOARD LAYOUT (TOP)
© 2009 Microchip Technology Inc. DS01279A-page 75
AN1279
FIGURE D-2: OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 1 OF 8)
B
Y
V
2
6
E
D
2
6
D
2
5
S
T
T
H
8
R
0
6
D
6
k
8

4
W
R
9
7
0
.
2
2
u
F

6
3
0
V
C
8
2
4
.
7
n
F

1
0
0
0
V
C
8
3
C
8
4
R
9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
R
1
1
3
G
N
D
P
4
C
h
a
r
g
e
r
+
P
2
C
h
a
r
g
e
r
-
I
m
a
x
=
2
.
5
A
V
m
a
x
=
4
8
V
D
N
P
D
N
P
D
N
P
1
S
M
B
5
9
4
1
B
T
3
G
AN1279
DS01279A-page 76 © 2009 Microchip Technology Inc.
FIGURE D-3: OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 2 OF 8)
P
W
M
2
L
1
1
P
W
M
2
H
1
0
P
W
M
3
L
9
P
W
M
3
H
8
V
D
D
C
O
R
E
7
V
s
s
6
R
P
1
9
5
R
P
2
2
4
R
P
2
1
3
R
P
2
0
2
P
G
C
1
1
R P 6
4 4
R P 5
4 3
R P 1 5
4 2
R P 8
4 1
V D D
4 0
V s s
3 9
R P 2 4
3 8
R P 2 3
3 7
A N 9
3 6
P W M 4 L
3 5
P W M 4 H
3 4
O
S
C
O
3
3
O
S
C
I
3
2
A
N
8
3
1
V
s
s
3
0
V
D
D
2
9
A
N
1
0
2
8
A
N
1
1
2
7
A
N
5
2
6
A
N
4
2
5
A
N
3
2
4
A
N
2
2
3
A N 1
2 2
A N 0
2 1
R P 2 8
2 0
R P 2 7
1 9
M C L R
1 8
A V D D
1 7
A V S S
1 6
R P 2 9
1 5
R P 1 6
1 4
P W M 1 L
1 3
P W M 1 H
1 2
U
1
5
d
s
P
I
C
3
3
F
J
1
6
G
S
5
0
4
S 4
S 3
S
6
S
5
I
A C o
F
L
T
_
C
L
R
/ S Y S _ F L T
F A U L T / S D
S
2
S
1
I
P
U
d
c
m
T
P S
E P P
T X
R X
S
C
L
K
S
D
O
S
D
I
S
S
1
2
3
4
5
6
P
3
I
C
S
P
d
s
V
p
p
d
s
I
C
S
P
C
d
s
I
C
S
P
D
3
V
3
G
N
D
D
o

n
o
t

c
o
n
n
e
c
t

w
h
e
n

U
P
S

i
s

c
o
n
n
e
c
t
e
d

t
o

A
C

L
i
n
e
!
N
o

g
a
l
v
a
n
i
c

i
s
o
l
a
t
i
o
n
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
C
1
/
C
L
K
I
9
O
S
C
2
/
C
L
K
O
/
R
A
6
1
0
R
C
0
/
T
1
O
S
O
/
T
1
C
K
I
1
1
R
C
1
/
T
1
O
S
I
/
U
O
E
1
2
R
C
2
/
C
C
P
1
1
3
V
U
S
B
1
4
R
C
4
/
D
-
/
V
M
1
5
R
C
5
/
D
+
/
V
P
1
6
R
C
6
/
T
X
/
C
K
1
7
R
C
7
/
R
X
/
C
K
1
8
V
S
S
1
9
V
D
D
2
0
R
B
0
/
A
N
1
2
/
I
N
T
0
2
1
R
B
1
/
A
N
1
0
/
I
N
T
1
2
2
R
B
2
/
A
N
8
/
I
N
T
2
/
V
M
O
2
3
R
B
3
/
A
N
9
/
V
P
O
2
4
R
B
4
/
A
N
1
1
/
K
B
I
0
2
5
R
B
5
/
K
B
I
1
/
P
G
M
2
6
R
B
6
/
K
B
I
2
/
P
G
C
2
7
R
B
7
/
K
B
I
3
/
P
G
D
2
8
U
1
4
P
I
C
1
8
F
2
4
5
0
© 2009 Microchip Technology Inc. DS01279A-page 83
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART,
rfPIC and UNI/O are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB
Certified logo, MPLIB, MPLINK, mTouch, nanoWatt XLP,
Omniscient Code Generation, PICC, PICC-18, PICkit,
PICDEM, PICDEM.net, PICtail, PIC
32
logo, REAL ICE, rfLAB,
Select Mode, Total Endurance, TSHARC, WiperLock and
ZENA are trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2009, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Note the following details of the code protection feature on Microchip devices:
• Microchip products meet the specification contained in their particular Microchip Data Sheet.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
®
MCUs and dsPIC
®
DSCs, KEELOQ
®
code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS01279A-page 84 © 2009 Microchip Technology Inc.
AMERICAS
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
ASIA/PACIFIC
Asia Pacific Office
Suites 3707-14, 37th Floor
Tower 6, The Gateway
Harbour City, Kowloon
Hong Kong
Tel: 852-2401-1200
Fax: 852-2401-3431
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
ASIA/PACIFIC
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4080
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Hsin Chu
Tel: 886-3-6578-300
Fax: 886-3-6578-370
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
EUROPE
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Worldwide Sales and Service
03/26/09

AN1279
LINE-INTERACTIVE UPS
A Line-Interactive UPS (see Figure 2), always relays electric energy through the battery to the load. When AC mains power is available, the battery is being charged continuously. At the same time, the UPS regulates the AC output voltage and the lag related to coupling the inverter is nearly zero. When a power outage occurs, the transfer switch opens and the electric energy flows from the battery to the load (Stored Energy mode). Due to these characteristics, continuous UPS systems tend to be somewhat more expensive than an offline UPS.

FIGURE 3:

ONLINE UPS DIAGRAM
Static Switch (Static Bypass)

AC Input Rectifier/ Charger Battery Inverter

Load

FIGURE 2:

LINE-INTERACTIVE UPS DIAGRAM
Static Switch

AC Input

Load

SYSTEM SPECIFICATIONS
The reference design in this application note describes the design of an Offline Uninterruptible Power Supply (UPS) using a Switch Mode Power Supply (SMPS) dsPIC® Digital Signal Controller (DSC). The Offline UPS Reference Design consists of three major UPS topology blocks: • Push-Pull Converter (steps up the DC battery voltage to a constant high-voltage DC) • Full-Bridge Inverter (converts DC voltage to a sinusoidal AC output) • Flyback Switch Mode Charger (current source and charges battery with constant current) The input and output specifications are shown in Table 1.

Inverter

Legend:

Battery Normal mode Stored-energy mode

ONLINE UPS
An Online UPS (see Figure 3), combines the two basic technologies of the previously described UPS models, with rectifiers and inverter systems working all of the time. As is the case with a Line-Interactive UPS, the power transfer is made instantly as an outage occurs, with the rectifier simply being turned off while the inverter draws power from the battery. As utility power is again established, the inverter continues to supply power to the connected devices, while the rectifier resumes its activity, recharging the battery. This design is sometimes fitted with an additional transfer switch for bypass during a malfunction or overload.

TABLE 1:
AC Input DC Input UPS Output Rating Input Filtering AC Input DC Input UPS Output Rating Input Filtering

I/O SPECIFICATIONS
220 VAC ±10%, 50 Hz ±3 Hz 3 x 12 VDC (lead acid battery) 220 VAC, 50 Hz ±1 Hz, sinusoidal 1000 W/1000 VA, (1300VA - 2 seconds) EMI/RFI filtering 110 VAC ±10%, 60 Hz ±3 Hz 3 x 12 VDC (lead acid battery) 110 VAC, 60 Hz ±1 Hz, sinusoidal 1000 W/1000 VA, (1300VA - 2 seconds) EMI/RFI filtering 110V UPS Specifications

220V UPS Version Specifications

DS01279A-page 2

 2009 Microchip Technology Inc.

AN1279
1 kVA OFFLINE UPS REFERENCE DESIGN
The Offline UPS system shown in Figure 4 operates in Standby mode and in UPS mode. When AC line voltage is present, the system is in Standby mode until a failure occurs on the AC line. During Standby mode, the battery is charged and is maintained after becoming fully charged. When the battery is charging, the inverter works as a rectifier through the IGBT’s anti-parallel diodes. The flyback switch mode charger acts as a current generator and provides constant charging current to the battery. After a power failure, the system is switched to UPS mode. In this situation, the DPDT relay is turned OFF to prevent power from being delivered to the AC line. The push-pull converter steps up the battery voltage to 380 VDC. The high DC voltage is then converted with the full-bridge inverter and filtered with an LC filter to create a pure sine wave 220/110 VAC output where load is connected. This power switchover sequence is made in less than 10 ms.

FIGURE 4:

OFFLINE UPS REFERENCE DESIGN

220 VAC, 50 Hz

EMI Filter

DPDT Relay

Load

220 VAC Constant Current

Flyback Switch Mode Charger

LC Filter

Battery

3 X 12 VDC

Push-Pull DC/DC Converter

380 VDC

Full-Bridge Inverter/ Rectifier

 2009 Microchip Technology Inc.

DS01279A-page 3

AN1279
Listing of I/O Signals for Each Block, Type of Signal, and Expected Signal Levels
PUSH-PULL CONVERTER
As specified in Figure 5, measurement of DC output voltage (UDCM) is required to implement the control algorithm. The EPP signal is for enabling the driver, the temperature sensor measures heat sink temperature, and the primary current measurement (IP) protects the converter in case of transformer flux walking. The PWM outputs from the dsPIC DSC are firing pulses to the driver to control the output voltage.

FIGURE 5:

PUSH-PULL CONVERTER RESOURCE DIAGRAM
UDCM+

UBAT

IPM

PGND

UDCM-

UCDM

IP EPP T Temperature Sensor

DRIVER

UB

PWM

PWM

ADC

ADC

ADC

dsPIC33FJ16GS504

Table 2 lists the resources used by the dsPIC DSC device for a push-pull converter.

TABLE 2:

RESOURCES REQUIRED FOR A DIGITAL PUSH-PULL CONVERTER
Type of Signal Analog Analog Analog Analog Enable driver, Digital Digital dsPIC® DSC Resources Used AN3 AN2 AN8 AN5 RB6 PWM3H, PWM3L Expected Signal Level 2.99V 0V-1.65V 0V-3.3V 1.5V-1.98V — —

Signal Name UDCM IP T (optional, not implemented in software) UB EPP Push-Pull Gate Drive

ADC

I/O

DS01279A-page 4

 2009 Microchip Technology Inc.

that current can be limited to prevent overloading of the converter. Detailed descriptions of these signals can be found in the data sheet of the drivers (IR2214). The FLT_CLR signal is used to reset the driver when a fault is detected. Refer to Appendix D: “Schematics and Board Layout” for details. The presence of power grid voltage is detected with measurement of (ACI) voltage.AN1279 FULL-BRIDGE INVERTER The block diagram in Figure 6 illustrates that measurement of the AC output voltage (ACO) is required to implement the control algorithm. TABLE 3: RESOURCES REQUIRED FOR A DIGITAL FULL-BRIDGE INVERTER Type of Signal Analog Analog Analog Digital output Digital output Digital output Digital input (external interrupt) Digital input PWM output PWM output dsPIC® DSC Resources Used AN1 AN11 AN0 RC10 RC0 RB7 RC13 (INT1) RC8 PWM1H. PWM1L PWM2H. This happens when the UPS is operational and the battery is depleted. signal A2 turns off the relay K2 and prevents power flow to the line when the UPS is operational. With measurement of the output current (I). which is off when DC link voltage is low to prevent current inrush in the DC link capacitors when power grid voltage is fed to the rectifier. S4 and S5. S6 (gate drive)  2009 Microchip Technology Inc. S6. Switching of the inverter leg IGBTs is controlled by firing pulses S3.3V 0. DS01279A-page 5 .27V-3. Signal A1 controls the K1 relay. When power grid voltage fails. FIGURE 6: UDC+ DIGITAL FULL-BRIDGE INVERTER RESOURCE DIAGRAM A1 (Inverter Series Relay) DRIVER S3 S4 FLT_CLR FAULT/SD SYS_FLT A2 (Mains Relay) R ACI1M Power Grid ACI2M PGND L C FLT_CLR FAULT/SD SYS_FLT S5 S6 I ACO1M Load ACO2M DRIVER PWM PWM I/O I/O I/O PWM PWM ADC I/O ADC I/O ACO KF(1) dsPIC33FJ16GS504 ADC ACI KG(1) Note 1: KF and KG are feedback gain circuits.16V 2.15V-3. S4 (gate drive) S5. the UPS goes off or initial system connect to grid power. and is generated by the dsPIC DSC PWM modules. Table 3 shows the resources used by a dsPIC DSC device for a full-bridge inverter.5V (nominal) — — — — — — — Signal Name ACO ACI I A1 A2 FLT_CLR FAULT/SD SYS_FLT S3. PWM2L Expected Signal Level 0. FAULT/SD and SYS_FLT are used to enable or disable the driver or detect driver faults.

Four signals are needed: EFB signal for enabling topswitch.5V-2V — — Signal Name IBATM UBAT EFB IREF DS01279A-page 6  2009 Microchip Technology Inc. TABLE 4: RESOURCES REQUIRED FOR A DIGITAL FLYBACK SWITCH MODE CHARGER Type of Signal Analog Analog Digital output PWM output dsPIC® DSC Resources Used AN4 AN5 RC7 PWM4L Expected Signal Level 0V-1.AN1279 FLYBACK SWITCH MODE CHARGER The block diagram in Figure 7 shows that an analog current controller is used for battery charging. (IB) for measuring battery charging current. (UB) for measuring battery voltage and IREF for reference set with PWM4L output.67V 1. . Refer to Appendix D: “Schematics and Board Layout” for details. FIGURE 7: UDC+ DIGITAL FLYBACK SWITCH MODE CHARGER RESOURCE DIAGRAM Shunt UBAT K3(1) PGND Flyback transformer UFEEDBACK K4(1) PI TOPSWITCH ENABLE 45V PGND +15V EFB UB IB ADC ADC PWM I/O PI IERROR IFEEDBACK IREF dsPIC33FJ16GS504 Analog Controller Note 1: K1 and K2 are feedback gain circuits. Table 4 shows the resources used by the dsPIC DSC device for a flyback switch mode charger.

When the transistor Q is ON. also known as a “reset winding”. This winding ensures that the magnetization of the transformer core is reset to zero at the start of the switch conduction. Transformer-type DC/DC converters are divided into five basic topologies: • • • • • Forward Converter Push-Pull Converter Half-Bridge Converter Full-Bridge Converter Flyback Converter Selection of a topology depends on careful analysis of the design specifications. A third winding is added to the transformer of a forward converter. cost and size requirements of the converter. and full-bridge converters) FIGURE 8: FORWARD CONVERTER T + + D2 VIN + D3 Q + D1 L + VOUT - EQUATION 1: Vout  Vin  N2 d N1 where d is the duty cycle of the transistor Q  2009 Microchip Technology Inc. or provide multiple voltages by using multiple secondary windings. This winding prevents saturation of the transformer. is shown in Figure 8. Operation of each of the above topologies is described in the following sections of this application note. half-bridge. VIN appears across the primary. The Flyback topology operation differs slightly from other topologies in that energy is stored in magnetic material and then released. The transformer also provides the option to produce multiple voltage levels by changing the turns ratio. Other topologies always transfer energy directly from input to output. which can be a step-up or stepdown converter. The transformer provides electrical isolation between the input and output of the converter. The diode D1 on the secondary ensures that only positive voltages are applied to the output circuit while D2 provides a circulating path for inductor current if the transformer voltage is zero or negative. DS01279A-page 7 . Another case in which topologies are distinguished from each other is transformer core utilization: • Unidirectional core excitation – where only the positive part (quadrant 1) of the B-H loop is used (flyback and forward converters) • Bidirectional core excitation – where both the positive (quadrant 1) and the negative (quadrant 3) parts of the B-H loop are utilized alternatively (push-pull. and then generates output voltage determined by Equation 1. Forward Converter A forward converter. Details of the topology selection and hardware design are provided in subsequent sections.AN1279 DC/DC CONVERTER Most UPS designs contain a transformer-type DC/DC converter.

the polarity is such that D1 is forward-biased and D2 is reverse-biased. the magnetic field in T1 collapses and after a period of dead time (dependent on the duty cycle of the PWM drive signal). EQUATION 2: Vout  2  Vin  N2 d N1 where: d is the duty cycle of the transistors and 0 < d < 0. The expanding magnetic field in T1 induces a voltage across the T1 secondary. Q1 conducts and the cycle repeats. and the magnetic field in T1 expands. These criteria must be satisfied by the control and drive circuit and the transformer. This means that the conduction time of each transistor must not exceed half of the total period (d < 0. current flows through the upper half of the T1 transformer primary and the magnetic field in T1 expands. the transformer may saturate. otherwise. the direction of the magnetic flux is opposite to that produced when Q1 conducted. After a period of dead time. FIGURE 9: PUSH-PULL CONVERTER T1 + + VIN + D1 L1 + + VOUT C2 0V + + + D2 C1 Q1 Q2 0V There are two important considerations with the push-pull converter: • Both transistors must not conduct together. At this point. D2 conducts and charges the output capacitor C2 via L1. as this would effectively short circuit the supply. This behavior requires that the individual conduction times of Q1 and Q2 must be exactly equal and the two halves of the center-tapped transformer primary must be magnetically identical. current flows through the lower half of T1's primary. When Q1 switches ON.5) for one complete cycle. The expanding magnetic field induces a voltage across the T1 secondary. Q2 conducts. • The magnetic behavior of the circuit must be uniform.AN1279 Push-Pull Converter A push-pull converter is shown in Figure 9. otherwise conduction will overlap. . When Q1 turns OFF. The output voltage equals that of Equation 2. and this would cause destruction of Q1 and Q2. L1 and C2 form an LC filter network. the polarity is such that D2 is forward-biased and D1 is reverse-biased.5 N2/N1 is the secondary-to-primary turns ratio of the transformer DS01279A-page 8  2009 Microchip Technology Inc. D1 conducts and charges the output capacitor C2 via L1.

FIGURE 10: HALF-BRIDGE CONVERTER +VIN C1 + Q1 + + + Q2 D2 T1 + C3 D1 L1 +VOUT + 0V C2 0V EQUATION 3: Vout  Vin  N2 d N1 where: d is the duty cycle of the transistors and 0 < d < 0. are required to form the DC input mid-point. must be less than 0. in which case the duty cycle. DS01279A-page 9 . C1 and C2.5.AN1279 Half-Bridge Converter The half-bridge converter (see Figure 10) is similar to the push-pull converter. d. but a center-tapped primary is not required.5 N2/N1 is the secondary-to-primary turns ratio of the transformer  2009 Microchip Technology Inc. In this case. The reversal of the magnetic field is achieved by reversing the direction of the primary winding current flow. the output voltage VOUT equals that of Equation 3. For the half-bridge converter. two capacitors. Transistors Q1 and Q2 are turned ON alternately to avoid a supply short circuit.

where four transistors are used. energy stored in the core causes the current to flow in the secondary winding through the diode D1 and flux decreases linearly. When transistor Q1 is turned OFF. FIGURE 12: +VIN FLYBACK CONVERTER T1 + D1 +VOUT + C2 + Q1 0V C1 + 0V EQUATION 5: Vout  Vin  N2 d  N1 1  d DS01279A-page 10  2009 Microchip Technology Inc. FIGURE 11: FULL-BRIDGE CONVERTER +VIN Q1 Q3 + C1 + + T1 + C2 D1 L1 +VOUT + 0V Q2 0V Q4 D2 EQUATION 4: Flyback Converter Vout  2  Vin  N2 d N1 where: d is the duty cycle of the transistors and 0 < d < 0. Output voltage is given by Equation 5. Output voltage equals that of Equation 4. Diagonal pairs of transistors (Q1-Q4 or Q2-Q3) conduct alternately. is basically the same as the half-bridge converter. .5 N2/N1 is the secondary-to-primary turns ratio of the transformer Figure 12 shows a flyback converter circuit. the diode D1 becomes reverse-biased.AN1279 Full-Bridge Converter The full-bridge converter topology shown in Figure 11. due to the winding polarities. When transistor Q1 is ON. thus achieving current reversal in the transformer primary. transformer core flux increases linearly. Therefore.

The duty cycle of the switches is used to modulate the output voltage. FIGURE 13: SINGLE-PHASE HALF-BRIDGE VSI ii VI 2 + C+ - S+ a D+ io + VO - VI + VI 2 N + CSD- FIGURE 14: SINGLE-PHASE FULL-BRIDGE VSI ii S1+ a C+ S1D1S2b D1+ S2+ D2+ io + VO - VI + - VI + D2-  2009 Microchip Technology Inc. a set of large capacitors (C+ and C-) is required. such that each capacitor maintains a constant voltage vi  2. Both switches S1+ and S1. Half-Bridge VSI Figure 13 shows the topology of a Half-Bridge VSI. This inverter is similar to the half-bridge inverter. DS01279A-page 11 . where two large capacitors are required to provide a neutral point N. Full-Bridge VSI Figure 14 shows the topology of a Full-Bridge VSI. The signals driving the switches must ensure some dead time to prevent shorting of the DC bus. Because the current harmonics injected by the operation of the inverter are low-order harmonics. the best known are bipolar and unipolar PWM techniques. however. Both topologies are widely used in power supplies and single-phase UPS systems. Several modulating techniques have been developed that are applicable to full-bridge VSIs. a second leg provides the neutral point to the load. which is twice the value obtained with half-bridge VSI topologies. Among them. The AC output voltage can take values up to the DC link value vi.AN1279 VOLTAGE SOURCE INVERTER (VSI) A single-phase Voltage Source Inverter (VSI) can be defined as a half-bridge and a full-bridge topology.(or S2+ and S2-) cannot be on simultaneously because a short circuit across the DC link voltage source vi would be produced. the modulating technique should ensure that either the top or the bottom switch of each leg is ON at any instant. To avoid the short circuit across the DC bus and the undefined AC output voltage condition.

which converts AC power to lower voltage DC power. which limits the current that flows into the battery. a specialized integrated chip. Most battery chargers can be divided into four basic design types. The charge control regulates the way in which the power switch turns ON and OFF. Figure 15 shows a simplified schematic of a linear charger with a linear power supply with a resistor as the current regulating element. and therefore. . a battery charger circuit is implemented. or topologies: • • • • Linear Chargers Switch Mode Chargers Ferroresonant Chargers SCR Chargers of the battery. AC voltage is rectified. and a linear regulating element.AN1279 BATTERY CHARGER When the AC mains voltage is present. and a rectifier that smooths out the existing sinusoidal AC signal into a constant-voltage DC signal. Linear Chargers Linear chargers consist of a power supply. The linear regulating element may be a passive component such as a resistor or an active component such as a transistor that is controlled by a reference signal. This type of charger contains additional charge control circuitry to regulate current flow into the battery. Switch Mode Chargers In a switch mode charger. and may be accomplished through a circuit. The power supply typically consists of a transformer that steps down AC power from 220/110 VAC to a lower AC voltage closer to that FIGURE 15: LINEAR CHARGER Transformer Rectifier Current Regulating Element Battery AC Input R1 DC Output Power Supply Charge Control FIGURE 16: SWITCH MODE CHARGER Rectifier Power Switch Transformer Output Filter Battery AC Input DC Output Power Supply Current Control Logic DS01279A-page 12  2009 Microchip Technology Inc. and then converted to a lower DC voltage through a DC/DC converter. or some type of software control. the Offline UPS charges the batteries. A simplified schematic for a single piece switch mode charger is shown in Figure 16.

SCR Chargers SCR chargers use a special component known as a Silicon-Controlled Rectifier (SCR) to control the current to the battery. operate by way of a special component called a ferroresonant transformer. FIGURE 17: FERRORESONANT CHARGER Ferroresonant Transformer Rectifier Battery Charge Control AC Input DC Output Power Supply FIGURE 18: SCR CHARGER Diode Rectifier Current Limiter Transformer SCR Battery AC Input DC Output Power Supply Charge Control  2009 Microchip Technology Inc. A block diagram of an SCR charger is shown in Figure 18. DS01279A-page 13 . The ferroresonant transformer reduces the AC voltage to a lower regulated voltage level while simultaneously controlling the charge current.AN1279 Ferroresonant Chargers Ferroresonant chargers (sometimes called ferro chargers). The SCR is a controllable switch that can be turned ON and OFF multiple times per second. After a transformer reduces utility voltage to a value near that of the battery. A rectifier then converts the AC power to DC power suitable for the battery. the diodes rectify the current while the SCR enables the flow of charge current according to a control signal. Figure 17 shows a block diagram of a ferroresonant charger.

The dsPIC DSC device offers “intelligent power peripherals” specifically designed for power conversion applications. refer to the dsPIC33F “GS” series device data sheets. soft start routines and user interface routines. DS01279A-page 14  2009 Microchip Technology Inc. and comparator fault handling. For more information on the peripherals. SPI and UART that can be used for power management and housekeeping functions. Note: For device details. . refer to the corresponding SMPS sections in the “dsPIC33F Family Reference Manual”. The functions of the dsPIC DSC can be broadly classified into the following categories: • All power conversion algorithms • UPS state machine for the different modes of operation • Auxiliary tasks including true RMS calculations. These intelligent power Peripherals include the High-Speed PWM. It controls all critical operations of the system as well as the housekeeping operations. High-Speed 10-bit ADC. FIGURE 19: OFFLINE UPS BLOCK DIAGRAM Power Conversion Block Push-Pull Converter Full Bridge Voltage-Source Inverter UPS Output Load 3x12V Batteries Relay Logic Auxiliary Power Supply Flyback Battery Charger AC Mains Input Rectified by Inverter Body Diodes dsPIC® DSC LCD Controller PIC18F2420 USB Controller PIC18F2450 LCD Module USB Port Legend: Signal Flow Power Flow User Interface Block Computer The dsPIC DSC device is the heart of the Offline UPS. flexible ADC triggering. the dsPIC DSC also provides built-in peripherals for digital communications including I2C™. and High-Speed Analog Comparator modules. These peripheral modules include features that ease the control of any switch-mode power supply with high resolution PWM.AN1279 SOFTWARE DESIGN The Offline UPS Reference Design is controlled by a single dsPIC DSC device as shown in the system block diagram in Figure 19. In addition to the intelligent power peripherals.

 2009 Microchip Technology Inc. As shown in this figure. When a power failure occurs. the software is broadly partitioned into two parts: • UPS State Machine (includes power conversion routines) • User Interface Software These partitions are described in more detail in subsequent sections of this document. DS01279A-page 15 . the state machine executes the switchover from Inverter mode to Battery Charger mode. the state machine configures the system peripherals to execute the correct power conversion algorithms as determined by the system state. When the AC mains is detected again. There are two other modes of operation. These switchover functions must be executed in as little time as possible to ensure uninterrupted power to the load. FIGURE 20: OFFLINE UPS SOFTWARE: HIGH-LEVEL PARTITIONS Offline UPS Software UPS State Machine (Interrupt Based) Priority: Medium Execution Rate: Medium Power Conversion Algorithms (Interrupt Based) Priority: Low Execution Rate: Low User Interface Software Priority: High Execution Rate: High UPS State Machine The Offline UPS software implements a state machine to determine the mode of operation for the system. During normal operation of the offline UPS.AN1279 A high-level diagram of the Offline UPS software structure is shown in Figure 20. The Battery Charger mode and Inverter mode are the two normal operating modes of the Offline UPS. the UPS state machine initiates a switchover sequence from Battery Charger mode to Inverter mode. Each mode of operation for the Offline UPS is described in the following sections. Figure 21 shows the Offline UPS state diagram. The state machine configures the on-chip peripherals to execute the correct power conversion algorithms. namely System Startup and System Error. The state machine is executed once every 100 µs inside a timer Interrupt Service Routine (ISR).

During this time. Therefore.AN1279 FIGURE 21: OFFLINE UPS STATE DIAGRAM System Startup M D AIN BA C_LI S_O TT N K K ER _ O & Y_ K & M LO DC AIN W _L S_O BA I N TT K _ K & ER OK Y_ & OK MAINS_OK & DC_LINK_OK & (BATTERY_OK || BATTERY_LOW) MAINS_NOT_OK & DC_LINK_OK & BATTERY_OK MAINS_OK & DC_LINK_UNDERVOLTAGE BATTERY_OVERVOLTAGE MAINS_OK & DC_LINK_OVERVOLTAGE MAINS_NOT_OK M D AIN BA C_LI S_O T T NK K ER _O & Y_ K & LO W MA DC IN BA _LINS_O TT K _ K & ER O K Y_ & OK Battery Charger Mode Inverter Mode MA IN DC_ S_NOT BAT LINK_ _OK & TER OK & Y_ OK M TT AIN ER S_ Y_ N O BA UN T _ TT DE OK ER RV & Y_ OL DC OV TA _L ER INK GE VO _U DC LT ND _L AG INK ER E VO _O VE LT AG RV OL E TA GE BA System Error GE & K LTA _O V O T GE NO ER TA S_ ND I N _U OL GE MAERY RV TA VE T OL _O AT V E Y B ER AG ER LT ND TT _U VO BA K ER IN OV _L K_ DC IN _L DC D C BA T T ER Y UN _ D E RVO LT A GE _L IN _U LINK DC_ BATTERY_OVERVOLTAGE O K_ R VE VO AG LT E E TAG L RVO NDE System Startup When the Offline UPS is turned ON. the state machine first monitors all system variables and determines the starting state of the UPS. the state of the system is unknown. the state machine also monitors for fault conditions and ensures that all system variables are within specification so that the UPS can switch to normal operation. . DS01279A-page 16  2009 Microchip Technology Inc.

5V 43. the battery voltage and battery current are measured using the high-speed 10-bit ADC module. The charging current is controlled by modifying the duty cycle of the current reference PWM signal. and is summarized in Figure 22.25A Charging Off Trickle Charging State Bulk Charging State Over Charging State Float Charging State Charging Off 0. The measured battery voltage determines the charging state. DS01279A-page 17 . the Inverter mode is disabled (if running) and the Offline UPS switches to the Battery Charger mode. The battery charger control is implemented partly in hardware and partly in software. the dsPIC DSC device sets up the minimum charging current. Depending on the battery state. The battery voltage is measured to ascertain the state of the battery. The dsPIC DSC device provides the reference signal for the output current of the flyback converter.AN1279 BATTERY CHARGER MODE If the AC mains voltage is detected. Then. the system state is changed to System Error. and the code specifies the correct charging current from the battery charging profile shown in Figure 22. The dsPIC DSC device provides the reference current level with a variable duty cycle PWM signal.7V 40. If a fault is detected. The battery charging profile has been configured for sealed lead-acid (SLA) batteries. the value of the charging current is modified so as to achieve the fastest charging time and also to prolong the life of the batteries. A flyback converter IC is used to produce a constant current source from the rectified AC mains voltage. FIGURE 22: OFFLINE UPS BATTERY CHARGING PROFILE Charging Current 2. When the Battery Charger mode is started. This current reference signal is generated by filtering the PWM output from the dsPIC DSC. All system variables are monitored by the state machine to initiate a switchover sequence if required.1A 30V 35.2V 45V Battery Voltage Note: Not drawn to scale  2009 Microchip Technology Inc. the state machine switches the UPS operation to the Inverter mode. When an AC mains power failure is detected.

To reduce stress on the hardware components. relay switching times are the limiting factor for the switchover duration. The output relay must be released in the shortest possible duration so that there is no interruption of power at the UPS output. the code must ensure that the previous mode is turned OFF. . After the inverter is turned OFF. the full-bridge inverter is turned OFF when the output reaches 0V. Typically.AN1279 BATTERY CHARGER INITIALIZATION ROUTINE When the offline UPS switches to the Battery Charger mode. FIGURE 23: BATTERY CHARGER INITIALIZATION FLOWCHART UPS State Machine Push-Pull Control Loop (ADC Interrupt) Battery Charger Initialization Priority: Medium System Startup Inverter Mode Priority: High Set Relay flag = NOT_READY_TO_SWITCH Inverter Control Loop (ADC Interrupt) No Is relay ready to switch? (Relay flag cleared in ADC ISR) Priority: High Yes Initiate relay release Call 4 ms delay to allow inverter output to become 0V Turn OFF inverter PWM signals Battery Voltage and Current Measurement (ADC Interrupt) Bypass DC link charging resistor Priority: Medium Call 12 ms delay to allow complete release of relay Reset charging state to UNKNOWN and set minimum charging current reference Enable charging current reference signal (PWM4L) Enable Battery Charger Flyback Converter AC Mains Detection (ADC Interrupt) Priority: Medium Battery Charger Mode DS01279A-page 18  2009 Microchip Technology Inc. The flowchart for the Battery Charger mode is shown in Figure 23. the output relay is released so that the AC mains is connected to the UPS output.

If the measured charging current is less than the reference. DS01279A-page 19 . the data is simply read from the data memory and used for control loop calculations. Conversely. The battery charger control routine is called inside the state machine under the Battery Charger mode. When the control loop is called. BATTERY CHARGER CONTROL SCHEME The battery charger control loop is implemented in the state machine. if the charging current exceeds the reference. The measured data is scaled and stored as a variable in data memory asynchronous to the control loop execution.AN1279 The dsPIC DSC device implements a predictive technique to achieve the fastest switchover time possible. The battery charging control loop is therefore executed at the same rate (once every 100 µs) and also at the same priority level as the state machine. The flowchart for the battery charger control loop is shown in Figure 25. The battery current and voltage measurement is triggered using the PWM trigger feature on the dsPIC DSC device. The switchover operation from the inverter to the AC mains is described in subsequent sections of this application note. FIGURE 24: BATTERY CHARGER CONTROL SCHEME Quantizer +K Duty Cycle Charging Current Reference -K Measured Charging Current 0 z -1  2009 Microchip Technology Inc. the duty cycle is reduced by the same fixed step. This is done by predicting the relay switching time and initiating the relay release even before the inverter output has turned OFF. The battery charging current control scheme is illustrated in Figure 24. the duty cycle is incremented by a fixed step. This process continues until the current error reduces to a negligible value.

AN1279 FIGURE 25: BATTERY CHARGER MODE FLOWCHART UPS State Machine Push-pull control loop (ADC Interrupt) Battery Charger Control Loop Priority: Medium Battery Charger Mode Priority: High Yes Is battery voltage < BATTERY_TRICKLE_VOLTAGE? Inverter control loop (ADC Interrupt) No Yes Is battery voltage < BATTERY_BULK_VOLTAGE? Priority: High No Set Maximum Charging Current Battery Voltage and Current Measurement (ADC Interrupt) Yes Is battery voltage < BATTERY_FLOAT_VOLTAGE? No Calculate and set Charging Current Priority: Medium Yes Is battery voltage < BATTERY_VOLTAGE_MAX? AC Mains Detection (ADC Interrupt) Set Minimum Charging Current No Turn Charger OFF Priority: Medium Battery Charger Mode DS01279A-page 20  2009 Microchip Technology Inc. .

Refer to Appendix D: “Schematics and Board Layout” for details. the push-pull converter is ramped up to the rated DC Link voltage using a softstart routine. the pushpull converter and the full-bridge inverter are controlled by interrupt-based power conversion algorithms.  2009 Microchip Technology Inc. The dsPIC DSC device resources used for the battery charger are summarized in Table 5. During normal operation of Inverter mode.AN1279 BATTERY CHARGER RESOURCE ALLOCATION FIGURE 26: dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR BATTERY CHARGER VBAT + Note 1 AC Input GND kA(2) kB(2) ADC ADC PWM dsPIC33FJ16GS504 Note 1: 2: The AC mains input is rectified by the body diodes of the IGBTs to provide a DC voltage to the battery charger. these routines are assigned the highest user-priority level. The sinusoidal output waveform is generated using a sine lookup table in the data memory. The soft-start routine reduces stress on system components and also prevents voltage and current surges from the AC mains or the battery. DS01279A-page 21 . The control loops are executed at a fast rate to achieve the best performance. The Inverter mode power conversion algorithms are the most critical routines for the dsPIC DSC device. or control loops. TABLE 5: Signal Name IREF IB UB EFB dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR BATTERY CHARGER Description Charging current reference Charging current feedback Battery voltage feedback Flyback converter enable Type of Signal PWM output Analog Input Analog Input Digital Output dsPIC® DSC Resource Used PWM4L (remapped to pin 35) AN4 AN5 RC7 Execution Rate/Frequency 25 kHz 6. When starting Inverter mode. During Inverter mode. the battery charger is disabled and the Offline UPS switches to the Inverter mode. the system is running on battery power and produces a clean sinusoidal voltage at the UPS output so that critical electronics can continue operation without interruption. therefore.25 kHz 6.25 kHz Activated only when the UPS switches to Battery Charger mode Inverter Mode If the AC mains voltage is not detected. KA and KB are feedback gain circuits. This lookup table serves as the sinusoidal reference voltage for the inverter control loop.

the value of the DC link voltage is unpredictable when a mains failure occurs. before turning ON the push-pull converter. while the inverter series resistor is bypassed by switching ON the bypass relay. PUSH-PULL CONVERTER INITIALIZATION When the system switches to Inverter mode. The interrupt nesting feature enables the control loops to interrupt the execution of the state machine. the push-pull converter control loop is reinitialized and all control history is purged. the system state is changed to System Error. has a lower priority than the control loops. which is also interrupt-based. The output relay is engaged to disconnect the AC mains input from the UPS output. therefore. The dsPIC DSC device allows for seamless transition between the power conversion routines and the UPS state machine. any previous modes of operation must first be disabled. with the use of multiple interrupts of differing priorities and execution rates. As a result. all system variables are monitored by the state machine. When operating in the Inverter mode. As soon as the AC mains voltage is detected. If any system variable is in error. the execution of the state machine and user interface code may be interrupted numerous times by the high-priority control loops.AN1279 The state machine. The softstart routine enables the DC Link voltage to be ramped up at a controlled rate and thus prevents unnecessary stress on the circuit components due to current spikes. the switchover sequence is engaged and the system state is changed to Battery Charger mode. the battery charger is first disabled by turning OFF the flyback converter and also by disabling the PWM output for battery current reference. FIGURE 27: PUSH-PULL CONVERTER INITIALIZATION FLOWCHART UPS State Machine Push-pull control loop (ADC Interrupt) Push-pull Converter Initialization Priority: Medium System Startup Priority: High Battery Charger Mode Disable Battery Charger Flyback Converter Inverter control loop (ADC Interrupt) Turn OFF PWM signal for battery current reference Switch output relay to disconnect Mains from UPS output Priority: High Bypass DC link charging resistor Battery Voltage and Current Measurement (ADC Interrupt) Re-initialize push-pull control loop to purge history Priority: Medium Set minimum duty cycle before turning ON PWM outputs AC Mains Detection (ADC Interrupt) Enable PWM outputs for push-pull converter (PWM3H and PWM3L) Priority: Medium Inverter Mode DS01279A-page 22  2009 Microchip Technology Inc. Then. The state machine execution is relatively slower than the control loops. The AC mains input has a wide operating voltage range. As a result. . Therefore. This operation is possible because the dsPIC DSC device allows for nesting of interrupts. the most recently measured DC Link voltage is used as the initial reference voltage for the push-pull converter.

the full-bridge inverter is enabled. However. DS01279A-page 23 . the counter is incremented to reflect the soft-start duration in milliseconds. the inverter is enabled by calling the inverter re-initialization routine to produce a sinusoidal voltage at the UPS output. If the relay is turned ON after the completion of the soft-start. the other situation must also be considered where the soft-start is completed in less time. In this case.  2009 Microchip Technology Inc. Once the required relay switching time elapses. The ramp rate for the DC Link voltage is fixed and the starting voltage for the soft-start routine is variable. The ramp rate for the soft-start routine is configured to be completed in the time required for the output relay to turn ON. The dsPIC DSC avoids both of these problems by initializing a delay counter at the beginning of the softstart routine. The soft-start routine increments the reference voltage for the push-pull converter in software in fixed steps until the reference reaches the rated DC Link voltage. As the soft-start routine is ramping up the DC Link voltage. making the soft-start duration also variable. If the soft-start is completed before the minimum required time for the relay turn-on. the code continues to wait until the minimum required switching time has elapsed. This ensures that the switchover time is within the design specification of 10 ms. At this point. the inverter output will turn ON before the relay is given enough time to switch. the switchover timing would be too slow. This technique ensures that uninterrupted power is available at the UPS output at all times. thereby causing the inverter output to be turned ON at the UPS output midway through the sine wave cycle. The variable duration of the soft-start routine may cause uncertainty in the mains-to-inverter switchover time.AN1279 SOFT-START ROUTINE The soft-start routine is called right after enabling the push-pull converter.

.AN1279 FIGURE 28: SOFT-START ROUTINE FLOWCHART UPS State Machine Push-pull control loop (ADC Interrupt) Push-pull Converter Initialization Priority: Medium Start Push-Pull Soft-Start Priority: High Initialize delay counter Inverter control loop (ADC Interrupt) Set soft-start flag to allow higher peak currents during startup Priority: High Increment delay counter Increment push-pull reference No Is Push-pull converter reference = final setpoint? Battery Voltage and Current Measurement (ADC Interrupt) Priority: Medium Increment delay counter AC Mains Detection (ADC Interrupt) No Yes Does delay count represent duration greater than relay switching time? Yes Clear soft-start flag Priority: Medium Inverter Mode DS01279A-page 24  2009 Microchip Technology Inc.

PWM2H and PWM2L) AC Mains Detection (ADC Interrupt) Inverter Mode Priority: Medium  2009 Microchip Technology Inc. The duty cycle is then configured to produce 0V output and the sine wave lookup table pointer is also reset to the start. the PWM outputs are enabled to produce the sinusoidal output voltage. DS01279A-page 25 . PWM1L. At this point.AN1279 FULL BRIDGE INVERTER INITIALIZATION The push-pull soft-start routine ensures that the DC link voltage is at the rated value and the output relay has completed the switching event. FIGURE 29: INVERTER INITIALIZATION FLOWCHART UPS State Machine Push-pull control loop (ADC Interrupt) Inverter Initialization Priority: Medium Priority: High Inverter Mode Inverter control loop (ADC Interrupt) Re-initialize inverter control loop to purge all control history Priority: High Set duty cycle to produce 0V output Battery Voltage and Current Measurement (ADC Interrupt) Reset sine wave lookup table to the start Priority: Medium Enable PWM outputs to turn ON inverter (PWM1H. The inverter control loop is reinitialized to purge all control history. After the soft-start routine concludes. the full-bridge inverter must be enabled to produce a sinusoidal voltage at the UPS output.

The PWM module in the dsPIC DSC device is configured for Push-Pull mode with an independent time-base. previous error. The voltage error is then fed into a control algorithm that produces a duty cycle value based on the voltage error. A block diagram of the push-pull converter control scheme is shown in Figure 30. Therefore. FIGURE 30: PUSH-PULL CONVERTER CONTROL SCHEME 1:16 VREF +- X Voltage Error PID Control Output PWM Duty Cycle Vin + + VOUT 1001010111 Voltage Feedback S&H ADC DS01279A-page 26  2009 Microchip Technology Inc. The DC Link voltage is measured by the ADC and converted to a digital value. the control algorithm is executed in the ADC interrupt service routine. which is also assigned the highest priority in the UPS code. .AN1279 PUSH-PULL CONTROL LOOP The push-pull converter is controlled with a voltage mode control scheme. The voltage mode control algorithm must be executed at a fast rate in order to achieve the best transient response. The output of the control algorithm is also clamped to minimum and maximum duty cycle values for hardware protection. and control history. This value is subtracted from the voltage reference in software to obtain the voltage error.

In the Offline UPS. The result of the control loop is added to the nominal duty cycle for one leg of the full-bridge inverter and subtracted from the nominal duty cycle for the second leg. So the PWM module in the dsPIC DSC device is set up with a fixed duty cycle for zero output voltage. DS01279A-page 27 . The current error is used as the input to the current error compensation algorithm to produce the command signal for the PWM module. A block diagram of the full-bridge inverter control system is shown in Figure 31. The output of the voltage error compensator produces the current reference value. The measured output voltage is subtracted from the present reference value and the voltage error is obtained. FIGURE 31: Sinusoidal Reference FULL-BRIDGE INVERTER CONTROL SCHEME Current Reference Current Error X + Current Feedback 1011010011 1001010111 Voltage Feedback ADC S&H S&H Duty Cycle PWM Output Filter X + Voltage Error - PI P Control Output AC Out  2009 Microchip Technology Inc.AN1279 INVERTER CONTROL LOOP The inverter output is generated by varying the voltage reference using a sinusoidal lookup table. a 3-level control is implemented for the full-bridge inverter. The measured output current is subtracted from the current reference to obtain the current error. Each leg of the full-bridge inverter is operated in complementary Center-Aligned mode with dead time. The voltage error is fed into the voltage error compensation algorithm within the ADC interrupt service routine.

TABLE 6: Signal Name S1 S2 IP UDCM dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR PUSH-PULL CONVERTER Description Push-Pull Drive Signal Push-Pull Drive Signal Push-Pull Primary Current Feedback DC Link Voltage Feedback Type of Signal PWM Output PWM Output Analog Input Analog Input dsPIC® DSC Resource Used PWM3L PWM3H AN2 AN3 Sample Rate/ Frequency 100 kHz 100 kHz 25 kHz 25 kHz DS01279A-page 28  2009 Microchip Technology Inc.AN1279 PUSH-PULL CONVERTER HARDWARE AND SOFTWARE RESOURCE ALLOCATION FIGURE 32: dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR PUSH-PULL CONVERTER Push-Pull Converter VDC VBAT + GND GND FET Driver FET Driver kD kC PWM kE ADC PWM ADC ADC or Analog Comparator dsPIC33FJ16GS504 The dsPIC DSC resources used for the push-pull converter are summarized in Table 6. .

DS01279A-page 29 . TABLE 7: Signal Name S3 S4 S5 S6 I ACO ACI A1 dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR FULL-BRIDGE CONVERTER Description Inverter Drive Signal Inverter Drive Signal Inverter Drive Signal Inverter Drive Signal Inverter Output Current Feedback Inverter Output Voltage Feedback AC Mains Voltage Feedback Resistor Bypass Relay Drive Signal Type of Signal PWM Output PWM Output PWM Output PWM Output Analog Input Analog Input Analog Input Digital Output dsPIC® DSC Resource Used PWM1L PWM1H PWM2L PWM2H AN0 AN1 AN11 RC10 Sample Rate/ Frequency 50 kHz 50 kHz 50 kHz 50 kHz 25 kHz 25 kHz 25 kHz Activated only at startup to charge the DC Link voltage above the minimum value. Activated only when the UPS switches to Inverter mode. A2 Output Relay Drive Signal Digital Output RC0  2009 Microchip Technology Inc.AN1279 FIGURE 33: dsPIC DSC® RESOURCE ALLOCATION FOR FULL-BRIDGE INVERTER VDC Full-Bridge Inverter VOUT+ VOUT- GND IGBT Driver IGBT Driver IGBT Driver IGBT Driver kF kG PWM PWM PWM PWM ADC ADC dsPIC33FJ16GS504 The dsPIC DSC device resources used for the fullbridge converter are summarized in Table 7.

3. the Offline UPS switches to the Inverter mode and operates in this mode until the mains is detected again. the software keeps polling the mains voltage for a zero-crossing detection. This ensures that spurious zero-crossings are not detected due to noise. . As the frequencies of the AC mains and the inverter are nearly equal. the two waveforms will eventually align at the zero crossings. The system should switch from one mode to the other in the shortest possible duration in order to provide uninterrupted power to the load. the UPS software enters the mains data collection step. the mains detection routine now compares the measured voltage with the mains reference data. 2. the inverter frequency is modified slightly by discarding some of the samples from the lookup table.AN1279 Inverter-to-Mains Switchover Routine When a power failure occurs. It is possible that the inverter and mains are out of phase when AC mains is available again. Mains High Voltage Detection: In the Inverter mode. Mains Synchronization: After collecting the mains voltage data. every sample of the measured mains voltage is stored in an array. the mains detection routine proceeds to the next step. the zero crossings of the two signals are forced to align after a few sine wave cycles. the software concludes that the mains is present and indicates the new state of the AC mains to the state machine. This array is later used as the mains reference to detect a mains failure. and the difference between the previous and present measurement is above a minimum value. which is when the UPS will engage the switchover. 4. Each sample of the collected data is averaged over four sine wave cycles to ensure an accurate reference. As a result. If there is a significant difference in frequencies. The switchover is engaged at the zero-crossing of both the inverter and mains. DS01279A-page 30  2009 Microchip Technology Inc. the software must reliably ensure that the mains voltage detected is within the specified levels. A valid zero-crossing is only detected if the previous voltage is negative and the present voltage is positive. Therefore. If the two signals are operating at nearly the same frequency. The mains detection routine is divided into the following steps: 1. If a high voltage is detected consecutively for 5 ms. It is also important to note that the alignment of the zero crossings must be predicted using information for the relay switching time. The software must also ensure that the mains waveform is clean and has little or no distortion. The state machine then begins the process of switching from Inverter mode to Battery Charger mode. the zero crossings of the two waveforms may never align. The inverter-to-mains switchover sequence is described graphically in Figure 34. Before switching to the Battery Charger mode. This provides the smoothest transition from one mode to the other and occurs instantaneously. Mains Data Collection: Once the zero-crossing has been detected. In this step. The relay is switched a few milliseconds before the actual zero-crossing so that the relay switching delay is accounted for. Zero-Crossing Detection: After a high voltage has been detected. If the error is within ±20V consecutively for 8 ms. the UPS software first checks whether the frequencies are very close. This allows the UPS state machine to switch from the Inverter mode to the Battery Charger mode with almost zero latency. the UPS software first checks for the presence of high voltage on the mains.

AN1279 FIGURE 34: INVERTER-TO-MAINS SWITCHOVER SEQUENCE Zero-crossing Detected Start Mains Data Collection Mains Data Collection Complete Zero-crossing Aligned High Voltage Detected AC Mains Inverter Inverter turned OFF Inverter Frequency Modified  2009 Microchip Technology Inc. DS01279A-page 31 .

which is in the appropriate quadrant and has a value closest to the mains voltage. If the error is detected to be larger than ±20V. Using a binary search algorithm. The mains-to-inverter switchover sequence is described in Figure 35. the error between the expected voltage and the actual voltage is calculated.AN1279 Mains-to-Inverter Switchover Routine When mains is present. If the error is detected to be outside the limit consecutively for about 1 ms. The push-pull converter is then enabled and the soft-start routine is executed. then the Offline UPS detects that a mains failure has occurred. the appropriate sample number from the sine lookup table is selected. the UPS software keeps comparing the measured mains voltage with the corresponding data in the mains reference array. a count is incremented. After the softstart routine is complete. The inverter is then enabled starting at this sample number so that there is no sudden change in voltage on the UPS output. . On every sample. The system state is changed to Inverter mode and the relay is switched immediately to disconnect the mains from the UPS output. the mains voltage is measured again. FIGURE 35: MAINS-TO-INVERTER SWITCHOVER SEQUENCE Mains Failure detected Mains Failure Occurred Push-pull Soft-start Routine Completed Inverter turned ON at the last measured mains voltage UPS Output Battery Charger Mode (AC Mains Present) Inverter Mode DC Link Voltage DS01279A-page 32  2009 Microchip Technology Inc. The quadrant information is also saved in a variable.

Note: Operation of the LCD controller is beyond the scope of this reference design. In order to display the result on the LCD display. and downstream electronics.25 kHz when active 156. However direct connections between the dsPIC DSC and LCD controller can be made because the digital-only pins of the dsPIC DSC are 5V tolerant. The LCD display routines are called in the main loop. and are used for implementing the RMS calculation in the offline UPS reference design. and therefore. the main loop is also referred to as the “idle loop”. The LCD controller operates with a 5V supply and the dsPIC DSC operates on a 3. The auxiliary tasks are numerously interrupted by high-priority tasks like the control loops and the state machine. the type of fault is displayed on the LCD module. These tasks have a relatively slow execution rate and therefore are assigned the lowest execution priority in the Offline UPS software. These tasks are performed only when other highpriority tasks like power conversion control loops and the UPS state machine are not active. The results are then scaled appropriately to produce a number in volts or amperes. bytes. LCD DISPLAY The LCD control code for the dsPIC DSC device is implemented as independent functions for writing pixels. TABLE 8: Signal Name SDO SDI SCK dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR LCD DISPLAY Description SPI Data Output SPI Data Input SPI Clock Output Type of Signal Digital Output Digital Input Digital Output dsPIC® DSC Resource Used RP22 RP19 RP21 Sample Rate/Frequency 156. Each of the auxiliary tasks is described briefly in the following sections. When the RMS calculation routine is called. When the UPS enters the System Error mode.25 kHz when active 156. words. Also the digital outputs of the dsPIC DSC can be operated in open-drain configuration and produce logic high for the 5V LCD controller using just a pull-up resistor. The measured current and voltage are stored in data memory in an array of 256 points each. Both of these operations are available in the Q15 library. DS01279A-page 33 .com/lcd for LCD design solutions. each decimal digit of the RMS calculation result is stored as a character variable. the auxiliary tasks are performed during the “idle” time for the power conversion routines and state machine. The Offline UPS Reference Design uses a 4x20 character LCD display module controlled by a dedicated MCU (PIC18F2420). The dsPIC DSC device has built-in fault and current limit features that enable automatic shutdown of power converters with no software overhead.3V supply. As a result. The Q15 library includes functions for calculating sum-of-squares and square-root. The dsPIC DSC device communicates with the LCD controller via a Serial Peripheral Interface (SPI). Visit www. This feature is critical in power conversion applications and is useful in protecting the user. Auxiliary Tasks All non-critical functions of the Offline UPS are categorized as auxiliary tasks. OUTPUT VOLTAGE/CURRENT RMS CALCULATION The RMS Calculation routine provides the output voltage and current information for the LCD display as well as for output overcurrent and output overvoltage/undervoltage protection. the system needs to be restarted again before it can function normally. In other words. The auxiliary tasks are executed in the main loop of the code. the respective array is passed to the function. The RMS calculation is called in the idle loop since it is executed over the AC mains cycle. The DSP instructions of the dsPIC DSC device are utilized to efficiently execute the RMS calculation routines. The System Error mode is designed to handle any faults after the respective power stage has been disabled.AN1279 System Error The UPS goes into the System Error state if a combination of the system variables is detected to be in a fault state. The resource allocation for LCD control is summarized in Table 8.microchip.25 kHz when active  2009 Microchip Technology Inc. The dsPIC DSC device is configured as the SPI master device and transmits all LCD commands to the LCD controller. The LCD controller converts the serial commands from the dsPIC DSC device into parallel data and also manages the timing controls for the LCD module. The state diagram in Figure 21 illustrates all conditions under which a system error is detected. When the system enters this mode. requires a relatively slow execution rate. or strings to the LCD module. The character variables are then concatenated into a string in order to display the data on the LCD module. system hardware. while the output of the function is the true RMS value of the parameter.

The USB communication is performed by a separate USB controller MCU (PIC18F2450). The resource allocation for the USB communication interface is summarized in Table 9. TABLE 9: Signal Name Tx RX dsPIC® DSC DEVICE RESOURCE ALLOCATION FOR USB INTERFACE Description UART Transmit UART Receive Type of Signal Digital Output Digital Input dsPIC® DSC Resource Used RP27 RP28 Sample Rate/Frequency 9600 bps 9600 bps DS01279A-page 34  2009 Microchip Technology Inc. The USB controller communicates with the dsPIC DSC device via an opto-isolated UART interface.AN1279 Signal Name SS Description SPI Slave Select Output Type of Signal Digital Output dsPIC® DSC Resource Used RP20 Sample Rate/Frequency Asserted only when data is transmitted to LCD controller USB COMMUNICATION The Offline UPS also includes a USB communication interface to enable power management for a computer or server connected to the UPS. .

this fault is detected at the same time as the push-pull control loop. a low impedance path exists from the AC input to the output capacitor. the load appears as a highly capacitive load. For example. depending on the operating modes. resulting in high peak currents and a low power factor. The system will enter the System Error mode due to either a single fault or a combination of faults. The boost converter usually contains a large output capacitor. Similarly. a push-pull overcurrent fault will only be generated if the overcurrent condition persists for an extended duration. Therefore. When a fault condition happens. As seen from the circuit diagram. If PFC is not implemented. the output capacitor draws a large inrush current when the load is first connected to the UPS output. Such a load usually contains a front-end bridge rectifier and is therefore classified as a rectifier load. All faults that are fast-acting and destructive to the system and user's load are handled in the high-priority control loops. Any system fault can trigger the Offline UPS to enter the System Error mode.AN1279 Fault States and Protection Schemes There are a number of fault sources that can cause the system to turn off all outputs and enter the System Error mode. FIGURE 36: TYPICAL RECTIFIER LOAD FOR THE OFFLINE UPS Computer/Server Power Supply AC Offline UPS UPS Output AC Input EMI Filter PFC Boost Converter DC-DC Converter  2009 Microchip Technology Inc. As a result. Other signals like the battery voltage are not very highspeed signals and therefore the faults are handled in the UPS state machine. a DC Link undervoltage condition will not cause the system to enter the System Error mode if the soft-start routine is active. As a result. DS01279A-page 35 . The typical configuration of such a power supply contains a PFC boost converter as shown in Figure 37. A block diagram of the connections for such a configuration is shown in Figure 36. These include the following: • • • • • • • Push-pull primary overcurrent DC Link undervoltage DC Link overvoltage Battery undervoltage Battery overvoltage Output overcurrent Overtemperature Operation with Rectifier Loads One of the most important applications of the Offline UPS is to provide uninterrupted power to computers and servers. the system enters the System Error mode and the type of fault is displayed on the LCD module. transient loads may cause the pushpull primary current to exceed the limit for a short duration. The push-pull overcurrent fault is an example of a very high-speed signal that must be detected as quickly as possible. Most computers and servers implement a switch-mode AC-DC power supply that implements Power Factor Correction (PFC).

as shown in Figure 38. causing the load to appear highly capacitive. . the current is drawn by the load in a very discontinuous nature with high peaks.AN1279 FIGURE 37: PFC BOOST CONVERTER AC Load If PFC is not implemented. FIGURE 38: RECTIFIER LOAD INPUT CURRENT WAVEFORMS (NO PFC) Diode ON Diode OFF Diode ON Diode OFF Diode ON Diode OFF Diode ON Input Voltage Output Voltage Input Current DS01279A-page 36  2009 Microchip Technology Inc.

The duty cycle is incremented in small steps to charge the output capacitor in a controlled manner. DC Offset Elimination A side-effect of operating with a high crest factor is that the current drawn may become asymmetric. In the Offline UPS Reference Design. the current limit fault will be triggered immediately for a second time. This is caused by the presence of a small DC offset on the inverter output voltage. a current limiting function overrides the inverter control loop. The peaks are determined by averaging the maximum and minimum recorded voltages over a number of sine wave cycles. This solution requires trimming of each UPS system during manufacturing. a high crest factor warning is displayed on the LCD display module. The inverter control loop resumes operation when the sine voltage reference of the inverter becomes equal to the actual voltage on the inverter output. the PWM is configured for a very small duty cycle and then re-enabled. Inside the Interrupt Service Routine. Doing so helps to ignore the effects of load steps on the output. no action is taken by the UPS if the current is within the maximum peak current rating. One option to support these high current surges is to design the hardware with sufficient design margin. If an imbalance is detected. Peak Current Limiting Function If the power factor of the rectifier load is too low. However. and therefore becomes expensive and time consuming. This feature. The Offline UPS Reference Design implements an offset elimination routine by comparing the positive and negative peak of the measured output voltage. The dsPIC DSC provides a number of flexible features to overcome this problem. However. If the first current limit fault is caused by a short circuit condition on the inverter output.  2009 Microchip Technology Inc. along with software can help charge the output capacitor in a controlled manner so that the inrush current is limited. the inverter control loop is overridden. The DC offset occurs due to the tolerance limits of the feedback components. this approach is usually not cost effective and may also cause a drop in performance or efficiency. If the peak current required by the load exceeds 15A. This causes the PWM module to automatically shut down. This function limits the maximum current on the output by clamping the duty cycle to a maximum value. it will result in a high crest factor for the inverter current.AN1279 Due to the presence of a large capacitor on the output of the PFC boost converter. If the crest factor of the load exceeds this value. DS01279A-page 37 . This will cause the system to shut down with an overcurrent error. While the current-limit fault handling routine is being executed. The current draw during a rectifier load startup can be up to 20 times the maximum rated current. As the duty cycle is small. the Offline UPS needs to implement a special algorithm to handle load steps and startup conditions for rectifier loads. It may also need periodic adjustment via a servicing schedule to account for effects of long term degradation of components. The Offline UPS Reference Design is rated for a maximum crest factor of 3:1. the current drawn during one PWM switching cycle is automatically limited. A typical analog implementation requires the use of trimming resistors to eliminate the DC offset. a correction factor is applied to the output voltage to cancel the DC offset. The dsPIC DSC helps overcome this problem with an active algorithm to eliminate the DC offset. an external interrupt is generated when an overcurrent condition occurs. The error state is displayed on the LCD display module and is reset only when the system is turned OFF and back ON. The PWM Current-Limit feature can be used to limit the current on a cycle-by-cycle basis.

The combination of a push-pull inverter (Figure 39(C)) and a full-bridge rectifier (Figure 40(B)) was chosen.3 kVA Switching frequency: 100 kHz TOPOLOGIES CONSIDERED AND REASONS FOR CURRENT CHOICES In Figure 39 and Figure 40 all possible push-pull boost circuits are shown. FIGURE 39: PRIMARY DRIVE CIRCUITS Q1 UB + Q2 C1 T1 (A) Full-Bridge Inverter Q3 Q4 Q1 C1 T1 (B) Half-Bridge Inverter UB + C2 Q3 T1 UB + (C) Push-Pull Inverter Q Q DS01279A-page 38  2009 Microchip Technology Inc. . For the inverter only the lowside drive circuitry is required and simple PWM signals (see Figure 41) can drive the inverter. The design specifications used in the Offline UPS Reference Design are: • • • • • Input voltage range: 30-45 VDC Output voltage: 380 VDC Continuous power: 1 kVA Peak power for two seconds: 1.AN1279 HARDWARE DESIGN Push-Pull Boost Converter DESIGN SPECIFICATIONS A push-pull boost converter needs to convert the wide range battery link input voltage to a stabilized high-voltage DC-Link. which provides the best price performance ratio.

where N2  N1 is the transformer windings ratio.1 < d < 0. In a real application. • Synchronous rectification is not required due to high-voltage and low current operation. and when heavy load is applied.AN1279 FIGURE 40: RECTIFIER CIRCUITS T1 L1 (A) Half-Bridge Rectifier C1 D1 D2 R1 L1 (B) Full-Bridge Rectifier T1 D3 D4 C1 R1 D1 D2 FIGURE 41: CONTROL SIGNALS FOR PUSH-PULL INVERTER The output voltage is calculated by Equation 6. 2d N1 where: d is the duty cycle of the transistors and 0 < d < 0.42. a full-bridge rectifier was chosen for the following reasons: • Reducing the leakage inductance by using only one secondary winding on the transformer • Reducing cost of transformer • Rectifier diodes can be rated lower in reverse breakdown voltage. The duty cycle must be limited to the given boundary. the duty cycle must be increased to compensate for various losses. DS01279A-page 39 . the duty cycle must be limited to 0. the calculation using Equation 6 is not exact.5 N2/N1 is the secondary-to-primary turns ratio of the transformer  2009 Microchip Technology Inc. EQUATION 6: For the secondary. such diodes have better forward and switching characteristics. and d is the duty cycle of the PWM signal. When no load is applied to the push-pull boost stage. the controller has to switch into Burst mode. This is done due to the switching behavior of the MOSFETs and transformer. N2 U DC = U BAT  ----. Due to allowed oscillation and losses in the system.

 =  ------------------------------------------------- = 1339G c 1. From the research data. 35G.158 0. .06 1. 3C90 material TABLE 10: Material FACTORS APPLIED TO EQUATION 7 (CORE LOSS EQUATION) Frequency f < 100 kHz 100 kHz ≤ f < 500 kHz f ≥ 500 kHz a 0. 45G. 25G.66 1. The transformer design is based using the area product (WaAc) approach and is designed to meet the following conditions: • • • • • • Minimum input voltage: Vimin = 30V Maximum DC link voltage: Vo = 380V Maximum output power: Pomax = 2000W Primary RMS current: IPrms = 30.86 2. The factors used in this equation are provided in Table 10. c d The manufacturer’s data sheet is used to help select the appropriate material for the desired application.63 3.0434 7. EQUATION 7: P l = a  f  B max Core loss density is normally selected around 150 mW/ cm3.66 2. 3C85 f < 100 kHz 100 kHz ≤ f < 500 kHz f ≥ 500 kHz F. frequency.0126 c 1. core loss.28 2.64 1.036   100000    1000    -----------------  1000 1000 1000 B max DS01279A-page 40  2009 Microchip Technology Inc.68 Pl     150 =  -------------------------.AN1279 DESIGN OF POWER-TRAIN COMPONENTS The push-pull transformer has been designed using a ferrite magnetic core.036 0.014 0. maximum flux density can be calculated. From core loss.790 0.36 1. N41.68 2. Maximum flux density can now be calculated.0573 0.68 2.29 R.88 d 2. and maximum flux density of the material should be considered.64 f  a   -----------   0. 3C81 f < 10 kHz 10 kHz ≤ f < 100 kHz 100 kHz ≤ f < 500 kHz f ≥ 500 kHz EQUATION 8:   ----------  ----------d 2. as shown in Equation 7.47 1. as shown in Equation 8. N87.84 1. The calculated maximum flux density must be limited to less than half of B at saturation.85 2.54 2.074 0. For the given range of materials. This B level is chosen because the transformer core will develop excessive temperature rise at this frequency when the flux density is close to saturation. N72.72 1.0717 0.43 1.36e-7 0.85 2. 3C90 P.62 2.5A Maximum duty cycle: Dmax = 0.42 Switching frequency: f = 100 kHz from FERROXCUBE was selected.

= 5.42  f  100000 = -------------------------------------------------------. DS01279A-page 41 . ETD54 shape and size of a core was selected with WaAc = 12. and the core cross-sectional area. Therefore.= 3.254  2678  100000  500 8 BSAT The selected core must have an area product larger than calculated. the area product of the core must be calculated by Equation 9. which fit to the winding area of that core. Ac. The primary turns are calculated by Equation 11. each core has a number that is a product of its window area. FIGURE 42: HYSTERESIS LOOP OF MAGNETIC CORE B BSAT EQUATION 9: 10  P omax W a A c = -----------------------------K t  B  f  J B ΔB in Equation 9 is equal to 2Bmax due to bidirectional core excitation as seen in Figure 42.8 NP  2009 Microchip Technology Inc.4 B  AC 2678  2. This equation is derived from the flux linkage equation ( = N * ) and represents the power handling ability of the core. Current density of a winding is estimated to be 500A/cm2. Given result is then rounded up or down to the integer value.= ------------------------------------------------------------. In this case it is rounded to 4 turns for one-half of the primary. and maximum output power Pomax is 2000W.AN1279 For selecting the right size core.9cm 0. A larger size was selected due to the primary and secondary windings. EQUATION 11: 8 2 8 2 10  V imin   --  Dmax 10  30   -----------------  0. Therefore.6 cm2. Wa. 8 BMAX B H B BMAX EQUATION 10: 10  2000 4 W a A c = ----------------------------------------------------------------. the calculated area product is shown in Equation 10.

not be much higher due to the short winding. Figure 43 shows the transformer winding diagram and construction diagram.3 V imin 30 The cross section of the primary and secondary windings is calculated by Equation 13. The result is rounded to the value 60 of secondary turns. it is allowed to use higher current density for primary as temperature of winding will EQUATION 13: I Prms 2 A cuP = -----------.81mm JP I Srms 2 AcuS = ----------.41mm JS Because of the high switching frequency. Litz wire must also be designed for that frequency. Secondary current can be calculated by Isrms = IPrms * Np  Ns = 2.= 3.5A. . In that case. 4 = 60. Primary RMS current is IPrms = 30. N p = ----------------. litz wire must be selected to reduce winding losses (losses by skin and proximity effect).AN1279 The secondary turns are calculated by Equation 12.03A. EQUATION 12: Vo 380 ------------------------------2D max 2  0.= 0. f = 100 kHz.42 N s = --------------. Different current densities are used (JP = 8A/mm2 and JS = 5A/mm2) to fit the windings into the transformer bobbin and because the length of one-half of the primary is very short compared to the secondary. FIGURE 43: TRANSFORMER ELECTRICAL AND MECHANICAL CONSTRUCTION NS NP NS Bobbin NP NP NS NP CORE Insulation and Shield NP NP DS01279A-page 42  2009 Microchip Technology Inc.

DS01279A-page 43 .3A. In this calculation. If the waveform shape and peak current are known. the rms current value must be calculated. the selected devices need to have a drain-to-source breakdown voltage higher than 117V.13 A 3  2009 Microchip Technology Inc. The peak and average currents can be estimated from the power ratings and input voltage. Package Thermal Performance To design the thermal performance. When we assume that the current waveform will have a sawtooth waveform with the given duty cycle (d). as expressed in Equation 14.416 EQUATION 15: I a  Pc / U bat The highest current will flow at the lowest battery voltage so the continuous current is: I = 1000W  30V = 33.416  42. Maximum Breakdown Voltage In the chosen configuration. the continuous drain current is half of this: ID = 16.67A and peak drain current of 160. EQUATION 16: I pm  Pmax U bat  d EQUATION 17: EQUATION 14: VBRDSS  2VBAT 2  45V 1. Therefore.15  2  . To be on the safe side. peak and average currents have to be estimated. these numbers are increased by 30%. The average current is calculated using Equation 15. Therefore. a MOSFET must be able to hold more than twice the battery voltage. The duty cycle (d) is calculated using Equation 17.67A.AN1279 PUSH-PULL MOSFETS When choosing the right MOSFETs the following must be considered: • • • • Maximum Breakdown Voltage Continuous Current Peak Current Package Thermal Performance Peak Current The peak current must be calculated at maximum power and the form of the current waveform must also be taken into account. d U DC  N 2 2 U bat  N1 When we use a transformer with windings ratio of 16 the peak current is that of Equation 18: EQUATION 18: I pm  2000W  160. a safety factor of 30% overrating was chosen. where PC is the continuous power and UBAT is the battery voltage.3  117V Continuous Current To calculate the current rating of the devices. Because the waveform shape will not be an exact sawtooth. the rms can be calculated using Equation 19. EQUATION 19: I rms  I pc d 3 The rms current can now be calculated and is shown in Equation 20: EQUATION 20: I rms  80. we have to design the MOSFETs for continuous drain current of 16.3 A 30V  0.34A. And per leg. we can calculate the resulting peak current using Equation 16. these calculations are only an estimate.

EQUATION 21: 2 Pc  I Drms  RDSon For a switching frequency of 100 kHz and with the push-pull configuration also switching.91C / W Ptot 55 EQUATION 22: Poff  f SW WL 4 In Equation 22. therefore. To limit the voltage spikes at turn-off a voltage clamp circuit is used. According to the calculation shown in Equation 25.07A . three parallel FDP2532 devices from Fairchild Semiconductor were selected. losses have to be taken into account. From this and the power dissipation.AN1279 Per leg.5A. the current is half of this: IDRMS = 21. we can calculate the needed thermal resistance. This circuit enables the MOSFETs to operate without RC snubbers. DS01279A-page 44  2009 Microchip Technology Inc. The number of necessary devices is calculated as n = Rt  RJH = 2. The conductive losses on the MOSFETS are calculated using Equation 21. Therefore. the turn off power would be that of Equation 24: EQUATION 24: Poff  100e3 1. Snubbers are only used to suppress high frequency oscillation.5 = 31. Therefore. EQUATION 25: RJH   50   0. all of the energy is dissipated on the MOSFETs. We will allow a continuous junction temperature of 110°C and a heat sink temperature of 60°C. EQUATION 23: WL  i2 L 2 A typical transformer in this range should have not more than L = 0. Typical junction-to-heat sink thermal resistance of these devices is Rt = 2. If the current waveform is near sawtooth. a TO-220 package is used for the MOSFETs. turn-on losses can be neglected. In the reference design. Equation 22 can be used to estimate the power dissipation at turn-off. This is the most critical design consideration.7.6e3  40W 4 Total dissipation on the MOSFETS is then Ptot = Poff + PC. and it is estimated to be 55W per leg. and all current leading traces and the transformer should also be rated for this current. which provides the number of parallel MOSFETs to use.5 μH of leakage inductance. an overrating of 50% should be done IDRMS = 21. Turn-off losses depend on the peak current and leakage inductance.07A * 1.5°C/W when using silicone pad insulation. . WL is the energy stored in the leakage inductance at turn-off and is calculated using Equation 23. Now the MOSFETs can be selected. and not to dissipate the energy stored in the leakage inductance of the transformer.

DS01279A-page 45 . The maximum secondary voltage at the highest battery voltage is VS = 45 * 16 = 720V . Because of transformer leakage inductance.AN1279 FULL-WAVE RECTIFIER FIGURE 44: RECTIFIERS WITH CURRENT FLOW L1 T1 D3 D4 C1 R1 (A) D3 and D2 Conduct D1 D2 L1 T1 D3 D4 C1 R1 (B) D1 and D4 Conduct D1 D2 When selecting diodes. voltage spikes appear on diodes when switching. diode internal inductance. Due to this. EQUATION 27: I pD  I P  N1  160. the calculated breakdown voltage is increased by 30% and should be more than 936V. EQUATION 26: Diode Breakdown Voltage The transformer secondary voltage is calculated as VS = VBAT * N2  N1.625  10 A N2  2009 Microchip Technology Inc.6 A VDC 380 Peak Forward Current Peak current is calculated using the transformer current ratio and peak MOSFET current previously calculated in Equation 9. and DC link inductor inductance. I avg  Pc 1000   2.3  0. the following must be considered: • • • • • Diode Breakdown Voltage Average Forward Current Peak Forward Current Switching Characteristics Package Thermal Performance Average Forward Current Average forward current per leg is easily calculated using Equation 26 from the desired DC link voltage and continuous output power.

DS01279A-page 46  2009 Microchip Technology Inc. Ptot  PswD  PfD  10W The estimation shows that the power losses are within the set criteria. and the inductor value that must be used. as shown in Equation 29. .5°C/W. Therefore. The STTH1210DI from STMicroelectronics meets the voltage and current requirements. Its use depends on the transformer construction and control of DC-link voltage. FIGURE 45: DIODE SWITCHING CHARACTERISTICS i[A] u[V] tfr i t PDon t1 t2 PDoff t3 u t[s] Diode switching Equation 28. Output Inductor This inductor is optional and is not required.5 = 20W. This section describes the design of a 50 µH output inductor. Typical thermal junction-to-heat sink resistance of the junction-isolated TO-220-2 package is Rt = 3. loss can be estimated using Total power loss is estimated by adding conduction losses and switching losses. Continuous working junction temperature should not exceed 130°C at a heat sink temperature of 60°C. Power loss calculation can now be done looking at the diode data sheet. The design of the output inductor uses the area product approach with the following conditions: • • • • • Inductance: L = 50 μH Peak DC current: Ip = 13A Operating flux density: Bm = 300 mT Current density: J = 500A/cm2 Window utilization: Ku = 0. an isolated TO-220-2 package is used.4 First.AN1279 Switching Characteristics Diode switching characteristics are determined by forward recovery time and reverse recovery time. EQUATION 28: EQUATION 29: PswD  Qc VDC  f SW Package Thermal Performance For diodes. the energy handling capability must be calculated by Equation 30. the maximum allowed power dissipation per part is PMAX = 70  3.

AN1279
EQUATION 30: EQUATION 34:
2 LIp

E

2

50 106 132  0.0043Ws 2

Bnew 

LIp N  Ac

 308mT

Then, to select the appropriate size of ferrite core, the area product calculation must be done, as shown in Equation 31.

The 3C81 material has a saturation point at 320 mT (100oC). If the criteria are not fulfilled, different material, air gap, number of turns, or even a bigger core must be selected. The cross-section of a wire is calculated by Equation 35, where RMS current through the inductor is calculated from primary RMS current of push-pull transformer and turns ratio. This current is twice as large as primary because for half of a switching period, the first primary winding is conducting and in the other half, the second primary winding.

EQUATION 31:

2  E 104 Wa Ac   1.43cm 4 Bm  J  K u
The selected core was the P36/22 pot core from FERROXCUBE due to its small size and shape, which produces less interference into surrounding components. The area product of this core is 1.46 cm4 and can be calculated from the data in the manufacturer’s data sheet. The number of turns required to get the desired inductance of the coil is calculated by Equation 32. The Core cross section Ac = 172 mm2 is obtained from the manufacturer’s data sheet.

EQUATION 35:

Acu 

I rms  J

2  I Prms 

NP NS

J

 0.82mm2

EQUATION 32:

The calculated value is the minimum cross-section of a wire (100 kHz litz wire must be used). Next, the fill factor must be calculated by Equation 36. This provides an estimation of whether the winding fits into the bobbin. The fill factor must be 0.4 or less. Wb is the bobbin winding area and is 72.4 mm2, and can be found in the core data sheet.

N

LIp Ac  Bm

 12.6

The calculated number of turns is then rounded to the nearest integer value, which is 13. To get the desired inductance, 3C81 material with an air gap was selected to control the flux density. If an air gap is distributed into the magnetic path of the core, the effective permeability of material changes and inductance factor AL. From the AL value and number of turns, the inductance is calculated by Equation 33. The AL value is obtained from the material data sheet and is 315 nH at 0.97 mm air gap.

EQUATION 36:

Ku 

N  Acu  0.15 Wb

Output Capacitors
When choosing DC-link capacitors, the following must be considered: • Voltage Rating • Ripple Current

EQUATION 33:

L  N 2  AL  53 H
The new operating flux density is verified by Equation 34 and must be lower than the saturation point of the selected material.

Voltage Rating
The voltage rating is defined by the DC Link voltage: VDC = 380V. Therefore, the capacitors must be above this rating.

 2009 Microchip Technology Inc.

DS01279A-page 47

AN1279
Ripple Current
When the DC link voltage controller is working as expected, the low frequency ripple current caused by the inverter is negligible. Therefore, the capacitors need only compensate for the reactive load current, which depends on the device specifications: S = 1300VA and P = 1000W.

EQUATION 39:

f 

1  2.7 MHz 2    CDS  LS

EQUATION 37:

Q  S 2  P 2  830.7Var
EQUATION 38:

Ir 
SNUBBERS

Q 830.7   3.6 A 230 VAC

Damping of the system is very low because of the low primary winding resistance (RS) and the series resistance of the battery link capacitors (RC), which are both in the range of milliohms. To reduce this high frequency ringing, a series RC snubbers were added across the primary winding. The capacitance should be one to three times the capacitance of the MOSFETs, and the series resistor value should be chosen so that it grants damping and the power dissipation is within the resistor rating. To maintain high efficiency of the system we allow less than 1% of the rated power to be dissipated on the primary snubbers. The final values of the RC snubber are evaluated by experimenting and are C = 10 nF and R = 12Ω. The power rating of the resistors is 4W. To design the snubbers for the rectifier diodes, the capacitance of the rectifier diode must be known. The simplified high frequency circuit is shown in Figure 47.

Snubbers are used to dampen high frequency oscillation and reduce ringing losses on diodes. Snubbers on the primary side are placed across the primary windings and are not used to handle voltage spikes at turnoff of the MOSFETs. They only reduce ringing and transformer in-rush current. To design the snubber for the primary side, the capacitance of the MOSFETs and leakage inductance of the transformer must be known. Both parameters can be measured; however, MOSFET capacitance is voltage dependent so only an estimate can be used. In our case, the capacitance of three parallel MOSFETs is approximately CDS = 7 nF, and leakage inductance of the transformer is estimated at LS = 500 nH. A simplified high frequency circuit is shown in Figure 46.

FIGURE 47:

HIGH-FREQUENCY CIRCUIT
LSS CD1 L1

CD3

FIGURE 46:

HIGH-FREQUENCY CIRCUIT

RS

RC

LS .5 µH

CDS 6.6 nF

Here, the capacitor should be in the range from two to five times the capacitance of the diode. The diode capacitance can be found in the diode data sheet. For the selected diodes it is approximately CD = 70 pF. Therefore, a good starting capacitance value for the snubber is C = 150 pF. Here we will also limit the maximum waste power to 1% of the rated converter power to keep the efficiency of the converter as high as possible. Thus, the resistor ratings will also be 4W. The resistor value should be selected so that the main switching voltage signal will produce as low as possible dissipation on the resistor. The dissipation is dependent on the RC frequency characteristics, and selecting lower resistance or lower capacitance will shift the characteristic frequency of the RC circuit higher, which result in the 100 kHz switching voltage producing less dissipation on the snubbers. However, damping of the snubbers will also decrease. A good starting value for the resistor is R = 1 k.

The resonant Equation 39.

frequency

is

calculated

using

DS01279A-page 48

 2009 Microchip Technology Inc.

AN1279
Calculating the required snubber circuit is very complex and does not give the expected results. Therefore, the parameters have to be evaluated by experimenting. When designing the snubbers the following must be considered: • • • • Overall system efficiency Signal quality Device power ratings Device voltage ratings To ensure low resistance in the ON state the gates are driven with 12V signals. The drive circuit is shown in Figure 48, which consists of the driver shown as S1, slope control elements, equalization resistors R1, R2, R3, R4, R5, and C1 turn-off voltage clamp circuit D1, D2, Q4, R6. The elements R5 and C1 are optional. R5 is used to ensure the MOSFETs do not turn on by themselves. C1 is used to compensate for Miller capacitance and EMI control. Resistors R1, R2, and R3 are used to equalize the gate threshold voltage of the MOSFETs to ensure parallel turn-on. In combination with R4, the turn-on slope is also controlled. In addition, the turn-off slope is controlled until the drain-to-source voltage (VDS) reaches the voltage clamp circuit threshold. When the voltage clamp circuit becomes active, VDS stays constant and the turn-off slope is reduced. This enables part of the energy stored in the leakage inductance to be transferred to the secondary side and the other part to be dissipated in a controlled fashion by the MOSFETs. Also, overall system oscillation is reduced due to lower current slopes. However, it must be considered that the turn on time of the MOSFETs will increase and that the maximum duty cycle must be reduced. Driver continuous supply current is calculated using Equation 40. Where n is the number of parallel MOSFETs.

Design of Drive Circuitry
To drive the MOSFETs, a driver must be used that amplifies the signal from the dsPIC DSC device and drives the gates of MOSFETs. The gate of a MOSFET behaves like a capacitor. The MOSFET drain-to-source RDS depends on the gate to source voltage, VGS. The higher the gate-to-source voltage, the lower the drainto-source resistance of the MOSFET. For the selected MOSFETs: • VGS = ±20V • VGS(TH) = 2-4V • CG(TOT) = 10.7 nF

FIGURE 48:

MOSFET DRIVE CIRCUIT
T D1 Zener

Q4 R6 D2 S1 + V1 12V R4 R5 R1 Q1 R2 Q2 R3 Q3

C1

EQUATION 40:

I Gc  2  n  CG (tot ) VDRV  f SW  2  3 10.7 109 15 100 103  96.3mA

 2009 Microchip Technology Inc.

DS01279A-page 49

AN1279
Peak current estimate is calculated using Equation 41.

Thermal Design
The heat produced by the MOSFETs and diodes must be transferred to ambient air using heat sinks. Total power loss estimation which were performed earlier are: • For MOSFETs, PMOS = 110W • For diodes, PDIODE = 40W. Forced air cooling is used to dissipate the heat

EQUATION 41:

I Gp 

VDRV  VGS (TH ) R 4  ( R11  R 21  R31 ) 1

Driver power dissipation calculation is shown in the “MCP14E3/MCP14E4/MCPE5 4.0A Dual High-Speed Power MOSFET Drivers With Enable” (DS22062) data sheet. The total power dissipation is calculated to approximately Ptot = 1W.

Full-Bridge Inverter
INVERTER DESIGN SPECIFICATIONS
The inverter is used to generate the UPS output voltage. The specifications are: • • • • • • • • Input voltage : 380 VDC Output voltage: 230 VACrms Continuous power: 1 kW Continuous output current: 5.6 Arms Peak power for 2 seconds: 1300 VA Maximum output current: 10 Arms Switching frequency: 50 kHz Short circuit-proof

Design of Voltage and Current Feedback Circuitry
For the push-pull stage, battery link, and DC link voltage, measurements are needed. Both measurements are done differential with the MCP6022 rail-to-rail operational amplifiers. When taking high voltage differential measurements, the input resistance must be high and voltage and power rating of the resistors must not be exceeded. Because of this, 1206 resistors are used on the input dividers in the reference design. The output signal for the differential amplifiers is 5V to increase SNR. Then, a resistor divider is used near the dsPIC DSC to interface to the 3.3V, 10-bit A/D converter. In addition, a capacitor is placed near the dsPIC DSC to enable fast charge of the S&H capacitor. For measurement, 1% tolerance resistors are used. This is especially important for the differential amplifiers to guarantee the same resistance in both arms to reduce common mode noise rejection. The MOSFET drain current and heat sink temperature are also measured. The current measurement is based on the voltage drop measurement on the drain-tosource resistance, RDSON. This type of measurement is temperature dependent so a semiconductor temperature sensor is placed which has nearly the same temperature dependency as the MOSFET, RDSON. The current feedback signal is used to prevent the transformer from saturating.

INVERTER POWER-TRAIN DESIGN IGBT Selection
Due to the high switching frequency, IGBTs with low switching losses must be selected. Their voltage rating should be 600V with a current rating of 14A or more continuous. The STGP14NC60KD from STMicroelectronics was chosen and fulfils all of the selected criteria. Loss estimation can be done using information in the data sheet and is estimated at P = 17W. The estimated junction-to-heat sink resistance using SilPad is: Rt = 3°C/W. According to these estimates, the junction temperature will raise 50°C above the heat sink temperature. The IGBT inverter also acts as a full-wave rectifier when charging the battery from the power grid.

PCB Layout Considerations
For the push-pull stage, special care should be taken with traces leading the primary current. High frequency currents and high current peak values can produce a lot of noise and even losses on the PCB. Therefore, the traces should be as short as possible and they should contain no sharp edges. It is a good idea to connect the primary windings with the transformer litz wire that is used for winding the transformer (fly leads). Care should be taken to not couple the power and signal parts with the ground planes.

Output Common-mode Choke
The common mode inductor has two windings on the same core. It is called common mode because it blocks common mode interference and switching noise produced by the inverter to the output. A schematic of the inductor is shown in Figure 49. The dot on the windings indicates the start of a winding. When load is connected to the output, the flux in the core must be summed; otherwise, the inductor is connected incorrectly.

DS01279A-page 50

 2009 Microchip Technology Inc.

4 Output power: Po = 1000W must be AL  L  156nH N2 Now. The number is rounded to the value of 40. The area product of that core is 11. as shown in Equation 43. Ac = 172 mm2. EQUATION 43: 2  E 104 Wa Ac   10. the energy handling capability calculated.AN1279 FIGURE 49: COMMON MODE INDUCTOR SCHEMATIC EQUATION 44: N I1 O1 LIp Ac  Bm  39. For the Epcos N87 material. 1 E 2 LIp 2 250 106 17 2   0.3mm  k1  The gap is chosen from the data sheet to be 3. To get the desired inductance. so that both winding have an equal number of turns. The core cross-section. I2 O2 EQUATION 45: Design of the output common-mode choke is the same design of that of a DC inductor.9 Input Output The calculated number of turns is the number for both windings.5 mm. to select the appropriate size of the core. as shown in Equation 42. the AL value is calculated by Equation 45. The number of turns required to get the desired inductance of the coil is calculated by Equation 44. is obtained from the manufacturer’s data sheet.  2009 Microchip Technology Inc. EQUATION 46: First. the air gap length is calculated with Equation 46. EQUATION 42:  A  k2 s   L   3.3cm 4 Bm  J  K u The selected core is an Epcos ETD54 ferrite core. The new AL value must be calculated for the new air gap by Equation 47. EQUATION 47: AL  K1  s K 2  148nH The new inductance value is shown in Equation 48.5 cm4. the area product calculation must be done.036Ws 2 After that. DS01279A-page 51 . from the core manufacturer’s data sheet the correct air gap can be selected. with the following conditions: • • • • • • Inductance: L = 250 μH Peak AC current: Ip = 17A Operating flux density: Bm = 380 mT Current density: J = 500A/cm2 Window utilization: Ku = 0. which is 20. EQUATION 48: L  N 2  AL  237  H The new operating flux density is verified by Equation 49 and must be lower than the saturation point of the selected material. and can be calculated from the dimension data in the manufacturer’s data sheet.

EQUATION 51: Ku  N  Acu  0. DESIGN OF GATE DRIVE CIRCUITRY A half-bridge driver with fault. DESIGN OF VOLTAGE AND CURRENT FEEDBACK CIRCUITRY For voltage feedback.and short-circuit protection must be used to fulfill the design specification. The output capacitor should be able to take the high inductor ripple current as well as suppress the switching noise.AN1279 EQUATION 49: Output Relays Bnew  LIp N  Ac  360mT N27 material has a saturation point of 410 mT (100oC).6 mm2. Therefore. the output goes to 0V and conversely. When the differential measured voltage is negative. This relay must have a fast switchover time so additional components are used to reduce the switchover time.56. The driver is supplied by VCC = 12V to ensure IGBT turn-on. Next. To get a cutoff frequency of ~100 Hz. Wb is the bobbin winding area and is 315. Two relays are used in the system. The low-pass filter comprises an output inductor and an output capacitor to pass only the low-frequency component (50 Hz or 60 Hz) of the sinusoidal pulse width modulated voltage waveform. This information can be found in the core data sheet. The R||C combination of R68 and C43 is used to allow high current at turn-on. To be able to meet the EMI requirements. in order to produce a low-frequency sinusoidal output voltage. If the driver detects a short-circuit. Looking at the data sheet of the IGBTs the allowed gate voltage is VGMAX = ±20V and the gate threshold voltage is VG(TH) = 4. Relay K2 is used for switchover when the power grid fails. This will give an estimate if the windings will fit into the bobbin.4 or less. The value of the output capacitor must be large enough to pass the fundamental frequency and low enough so that it should need high reactive current.5V is used as the positive reference point.5V to its output when the differential measured voltage is zero. During operation this relay is always on. In addition. To measure power grid and output voltage. which allows for a higher base current at turn-on and negative voltage on the base current at turn-off. the output voltage goes to 5V when the measured differential voltage is positive.5V. The fill factor must be 0. EQUATION 50: Po I rms 230V Acu    0. DS01279A-page 52  2009 Microchip Technology Inc. bipolar measurements are needed. To enable the differential amplifiers to measure a bipolar signal voltage. gate to collector capacitors are used. The selected IGBT can withstand a short circuit of 10 µs. it will perform a soft turn-off for the IGBTs. which are built with the MCP6022 operational amplifier. the turn-on and turn-off slopes should be tunable with gate resistors. differential amplifiers are used. Resistor R72 is used to deplete the energy stored in the relay coil for faster turn-off. The cross section of the wire is calculated by Equation 50. a bootstrap with a 600V floating channel is needed to drive the high-side IGBTs. where RMS current through the inductor is calculated from the output power and the RMS value of the output voltage. To ensure that the IGBT does not turn on due to internal IGBT Miller capacitance when VCE rises with high slope. the fill factor has to be calculated by Equation 51. and then reduce current during the ON state to allow for faster turn-off.7 µF.88mm 2 J J The calculated value is the minimum cross-section of a wire (100 kHz litz wire must be used).11 Wb Output Capacitor Selection The Inverter switching transistors produce the sinusoidal pulse width modulated voltage waveform that has a fundamental frequency of 50 Hz or 60 Hz. The IR2214 from International Rectifier meets all of these requirements. Transistor Q11’s switching speed is increased using R-C||R combination. the value of the output capacitor selected is 4. the operational amplifier gives 2. The B32924C3475M MKP series film capacitor from Epcos fulfils all of the selected criteria. . an offset of Voff = 2. Relay K1 is used to control charging of the DC link capacitors from the power grid.

the output is 2. Flyback Transformer The flyback transformer is designed to the desired output power and output current ripple.4 V Nominal duty cycle: dn = 0. the inductance of primary and secondary windings must be calculated with Equation 53. Maximum output power is calculated as PCH = UBmax * IBmax .5A Current control Voltage limit To limit the current ripple.5V. The devices must be mounted on the heat sink using thermal conductive and electric insulating material. The transformer is designed for the following conditions: • • • • • • • • Minimum DC link voltage: Vimin = 130. All of the resistors used were 1% tolerance to guarantee the exact measurement and reduce common mode noise rejection. a fast rectifier and primary clamp diode must be used. DS01279A-page 53 . the primary current can be calculated with Equation 54. DESIGN OF POWER-TRAIN COMPONENTS To realize the flyback converter primary drive stage. a resistor divider was added near the dsPIC DSC to interface with the 3. and for secondary current with Equation 55. a series of 1206 resistors were used to stay within the voltage and power rating of the devices.5W . The transformer ratio is N2  N1 = 28  52. and care should be taken to not couple the parts with ground planes. Special care should be taken because of high voltage. Around the IGBT driver the logical level and gate drive components should be separated. At zero current. a Hall effect-based sensor from LEM is used. to enable current source operation. Total power dissipation is estimated as PIGBT = 68W. The clamping elements are designed using design tools from the manufacturer of the TOP250Y.5V.112. where transformer efficiency is estimated at 90%. The flyback works with a switching frequency of f = 132 kHz. For current measurement. For the flyback converter. Therefore. The charger design specifications are: • • • • • Input voltage: 95-260 VAC Output voltage: 30-45V Output current: 0-2. The primary to secondary turns ratio is calculated with Equation 52. an integrated solution TOP250Y from Power Integrations was selected. a transformer with air gap is needed.  2009 Microchip Technology Inc. which are used for power grid voltage rectification. a capacitor was added near the dsPIC DSC to fast-charge the SH capacitor.9 VO  VDf 1  dn Battery Charger Design DESIGN SPECIFICATIONS FOR BATTERY CHARGER SPECIFICATIONS A battery charger is used to charge the batteries from the power grid.6 V Maximum DC link voltage: Vimax = 364 V Nominal DC link voltage: Vinom = 247.24 Output current: Io1max = 2. EQUATION 53: LS  (Vo  VDf )  (T  TON max ) Is  684  H  196  H LP  LS  N PS 2 Now.5A Nominal output voltage: Vo = 40V Secondary current ripple: ∆Is[%] < 25 % Switching frequency: f = 132 kHz PCB LAYOUT CONSIDERATIONS Traces leading the output current should be held as short as possible. For all of the 5V signals. THERMAL DESIGN IGBTs must be placed on a heat sink to dissipate the produced heat. The sensor is bipolar and signal output is 0. the rectifier reverse voltage rating should be higher than the result of Equation 66.3V 10-bit A/D converter. Based on this ratio and the maximum input voltage.AN1279 Because of the high differential input voltage. EQUATION 52: N PS  ( Vinom  VDSon d )  n  1. Three series lead acid batteries were used in the system. In addition. where VF(IGBTD) is the voltage drop across the IGBT anti-parallel diode.

the required wires for primary and secondary can be selected. EQUATION 57: Wa Ac  100  PO max  0. there needs to be enough space to fit the windings. The transformer construction winding diagram and mechanical diagram are shown in Figure 50. Therefore.2 A 2 3 2 I Speek  I Sc  I S rms  (1  d max )( I Speek ( I Sc  EQUATION 55: I P  I Pc  (Vi min )  Ton max  0. EQUATION 56: ACuP  ACuS I Prms  0.375mm 2 J I  Srms  0. however. . the number of turns and from this the window utilization and fill factor has to be calculated. I Ppeek  I Pc  I Prms  d max ( I Ppeek ( I Pc  Now.7 A 2 I P 1 I )  ( I Ppeek  ( I Pc  P )) 2  1. We will design the flyback transformer to run a current density of J = 4 A/mm2.8mm 2 J A winding factor of K = 0.5 A 2 3 2 The selected core needs to have a higher area product than what has been calculated.55 A LP VO  I O  2.9  d max I P  2.4. the required copper area for the primary and secondary can be calculated with Equation 56 (litz wire for 132 kHz must be used). The maximum core flux density is set to B = 130 mT.2 is selected for the transformer and N87 material for the core. If the window utilization is higher than 90% or a fill factor higher than 0. To select the core. From the magnetics side.AN1279 EQUATION 54: I S  I Sc  (VO )  (T  Ton max )  I O  I S  %   1A LS IO  4A (1  d max ) I S  4. For this in iterations for different cores.5 A 2 I S I 1 )  ( I Speek  ( I Sc  S ))2  3.4 A (Vi min )  0. the windings will not fit.65cm 4 Kt  2 B  f  J DS01279A-page 54  2009 Microchip Technology Inc. the area product has to be calculated with Equation 55. ETD34 and above will be sufficient.

EQUATION 62: EQUATION 59: Wu  ( DP N lP  DS N lS ) / Wa  86% 2 B  Ae  58. Now. To calculate the required air gap the AL value of the core has to be calculated. EQUATION 60: N tP  N tS  25  25  25 DP 25  16.5 mm. the required AL value can be calculated with Equation 64.5  30 N PS K u   ACuP  N P  ACuS  N S  / Wa  0.7 ACuw ACuP  101.25 According to this the windings fit to the selected core.8 ACuw EQUATION 61: N lP  N lS  NP  2. From this we can calculated how many turns for the primary and secondary (Equation 60) and the number of required layers (Equation 61). The AL value is air gap dependent. The required air gap can be calculated from the core data sheet. The diameter of selected wires with silk isolation is DP = 1 mm and DS = 1. DS01279A-page 55 .7  16 DS EQUATION 58: nwP  nwS  ACuP  47. we have to select standard litz wires.1  58 EQUATION 63: NP  NS  104  LP  I Ppeek NP  30. a litz wire made of AWG38 wires is used to eliminate skin and proximity effect.AN1279 FIGURE 50: TRANSFORMER ELECTRICAL AND MECHANICAL CONSTRUCTION Primary NP NS Bobbin NP Primary Secondary Primary CORE Insulation and Shield Secondary Primary For the windings. and core data. turns ratio. From knowing the primary inductance and number of winding turns. For the used ETD39 core with an air gap. So.32  3 N tP NS  1. the window utilization and fill factor can be calculated for the selected core and wires. the required number of turns can now be calculated from the required primary inductance. 105xAWG38 is selected. For switching frequency f = 132 kHz. 45xAWG38 is selected and for the secondary. litz wire is used to grant low copper losses at high frequency. The required number of parallel wires is calculated with Equation 58. The bobbin window is 25x7 mm. Primary turns are calculated with Equation 59. The window utilization is shown in Equation 62 and fill factor in Equation 63.875  2 N tS For both. for the primary.  2009 Microchip Technology Inc.

Battery Selection The battery selection will depend on the DC voltage and the required backup time of the Offline UPS system. Assuming efficiency of the battery charger to be 70%. CURRENT AND TEMPERATURE SENSE CIRCUITRY The battery charger works as a current source delivering the requested charge current to the battery. If an air gap of 0.3nH N2 VOLTAGE.AN1279 EQUATION 64: AL  L  203. the correct air gap can be selected. primary switch (TOP250Y). 1 k2 PCB LAYOUT CONSIDERATIONS Precaution must be taken due to high voltage signals. THERMAL DESIGN The top switch and rectifier diode must be mounted on a heat sink. In addition. independent of battery voltage. EQUATION 65: A  s   L   0. EQUATION 66: VBR ( rect )  Vin  2  N2 28  Vbat  2  VF ( IGBTD )  260  2   45  2 1. In addition. For current control. Care should also be taken to not couple the power. The Offline UPS Reference Design has been designed for 36V input DC voltage. the correct air gap is calculated with Equation 65.7 mm is selected. a header is placed on the PCB to interface with a temperature sensor to monitor the battery temperature and allow battery management software to know the state of the batteries. Our calculated value is close to 1 mm so we select an air gap of 1 mm and do not need to change the windings.4V N1 52 DS01279A-page 56  2009 Microchip Technology Inc. For the used EPCOS ETD39 N87 core. being able to produce one hour of backup time with a 35 AH battery. a discrete analog PI controller was built that controls the duty cycle of the TOP250Y. and measurement parts with ground planes. a resistor and a high-side current shunt monitor (INA168 from Texas Instruments) were used. transformer losses.95mm  k1  The nearest standard air gap values are 0.3  240. and rectifier losses. Therefore. For current measurement and control. we can estimate that near 30W of losses need to be dissipated on the heat sink. the measured current is fed through a differential amplifier stage to the dsPIC DSC device. Also the primary clamp components should be placed as near as possible to the transformer and the TOP250Y to reduce stress of the switching components. Parallel to the current feedback loop. control. Those losses consist of clamp losses. Both elements TOP250Y and the rectifier diode must be mounted on the heat sink using thermal conductive electrical insulating material. nearly 50W of loss will be dissipated. the number of winding turns must be corrected. a voltage feedback loop is used to limit the output voltage in case the battery is not connected. from the core manufacturer data sheet. Now.7 mm and 1 mm. .

For 3. an LM5575 from National Semiconductor was used with the switching frequency set at f = 500 kHz. like MAC. 2. W.E. fault protection. and R. D. a (KE7805ER) TO-263 package with a PCB mount heat sink was selected. The built-in DSP engine and IPP help in optimizing control loop design. IEEE transaction.3V to P5V = (VIN .VOUT) * IOUT = 3. For the 5V regulator. care should be taken when designing the output traces.3V and 5V. • “TC1262 500mA Fixed Output CMOS LDO” (DS21372). DS01279A-page 57 . • “A Current Mode Control Technique with Instantaneous Inductor Current Feedback for UPS Inverter” by H. The inductor. 33. ADC. The dsPIC33F enables power conversion design with all advance features within the target price.3V regulator. adequate PCB and copper area must be provided to keep the devices cool. Brumsickle. • “A High Performance Sine Wave Inverter Controller with Capacitor Current Feedback and BackEMF coupling” by M.AN1279 Design of Auxiliary Power Supply DESIGN SPECIFICATIONS The auxiliary power supply provides power. power dissipation must be calculated to select the right package in the PCB layout. Yao. Vol. Schottky diode. K. REFERENCES • “MCP14E3/MCP14E4/MCPE5 4. The auxiliary power supply will start when DC link voltage is present or when the button is pressed. to all of the on-board electronics. Lorenz.15 mW and for 3. Also input capacitors should be placed close to the IC to block the noise produced by the buck converter.Mohan. It’s highly flexible Intelligent Power Peripheral (IPP). Undeland. PCB LAYOUT CONSIDERATIONS For the buck converter. maximum power dissipation is calculated to P5V = (VIN .P. Comparator. All the voltage regulators are connected in series so the 12V buck converter needs to deliver 1A of current. and for the 3. IEEE transaction on industry application.Zhang. which is taken from the battery link. Microchip Technology Inc. CHOICE OF COMPONENTS Because of a wide range of input voltage and power losses. For the analog circuits.D.  2009 Microchip Technology Inc. and PWM modules simplify the hardware schematic and reduces the number of components in the design of a high-performance UPS system. a buck converter was used to generate 12V from the battery voltage. No. housekeeping. For the linear voltage regulators.J Ryan. Lorenz. linear regulators are used because of simplicity and price. • “Power Electronics Converter.J Ryan and R. there is enough time left to perform all of the auxiliary tasks.Lin. Components were selected according to the LM5575 data sheet. and low-ESR output capacitors should be as close as possible to the IC. For the 5V regulator. For linear regulators. due to very high frequency current. Zhang. 500 mA @ 12V CONCLUSION The Microchip dsPIC DSC device provides all of the necessary power peripherals used for power conversion applications. March/April 1997.Wu. IEEE transaction. Applications and Design” by N.D. and W. additional chip inductors and capacitors were added to separate digital and analog supply voltages. being able to produce a clean sine wave output (THD less than 3%) even with a rectifier load and a crest factor of 3:1. 1995. 300 mA @ 5V.3V. With the help of optimized instruction sets.0A Dual HighSpeed Power MOSFET Drivers With Enable” (DS22062). D. Robbins • “Control Topology Options for Single-Phase UPS Inverter” by M. Microchip Technology Inc. 1999. J.M. T. and communication with the external world. a (TC1262) SOT223 package was selected. For the buck converter.VOUT) * IOUT = 255 mW. The design specifications are: • Input voltage: 30V-45V • Output: 150 mA @ 3.

.AN1279 NOTES: DS01279A-page 58  2009 Microchip Technology Inc.

The software is owned by the Company and/or its supplier. and is protected under applicable copyright laws. THE COMPANY SHALL NOT.com  2009 Microchip Technology Inc. This archive can be downloaded from the Microchip corporate Web site at: www. IN ANY CIRCUMSTANCES. the Company’s customer. All rights are reserved.microchip. WHETHER EXPRESS. INCIDENTAL OR CONSEQUENTIAL DAMAGES. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws. THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. BE LIABLE FOR SPECIAL. as well as to civil liability for the breach of the terms and conditions of this license. DS01279A-page 59 . NO WARRANTIES. for use solely and exclusively with products manufactured by the Company.AN1279 APPENDIX A: SOURCE CODE Software License Agreement The software supplied herewith by Microchip Technology Incorporated (the “Company”) is intended and supplied to you. All of the software covered in this application note is available as a single WinZip archive file. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. INCLUDING. BUT NOT LIMITED TO. FOR ANY REASON WHATSOEVER. IMPLIED OR STATUTORY.

• Analog implementation • Digital implementation Each SIM file analog implementation typically consists of the following sections: • • • • • • • • Reference Block Feedback System Block Power System Block Control System Block Modulation Inverse Block Modulation Block Load System Block Special Blocks CONTROL SYSTEM BLOCK This block generates the duty ratio that drives the power section block. which represents the duty cycle ratio. The following sections describe each block used within the models. FEEDBACK SYSTEM BLOCK Various signals are typically measured in a system. POWER SYSTEM BLOCK This is the actual physical system. and frequency can also be used depending on the choice of test conditions. amplitude. In digital implementation. The input is typically voltage given by the modulation block (conversion of duty ratio to actual excitation voltage). additional blocks may be needed to account for quantization due to the presence of an ADC and zero order holds for sampling the signal at a constant frequency. the power system block will change.AN1279 APPENDIX B: CONTROL SYSTEM DESIGN C circuit. but in an actual system. Depending on the topology. Some subsystems are presented as nested blocks to simplify the main diagram. In digital implementation integrators and differentiators are replaced by their digital equivalents. Typically.). Typically. In addition. The system implementation of L and C is based on integrators and saturations. input voltage for buck converter and output voltage for boost converter). Typically.g. Sinusoidal loads for UPS-type systems with variable phase (inductive. MATLAB® was used to design the compensators based on the hardware and to generate optimal coefficients to be used in the software. These include the voltages and currents for performing the control operations. Its input is the duty cycle ratio /parameter (0 to 1) that gets converted to voltage quantity. This block converts the duty applied to physical system to voltage quantity. voltage mode). The Offline UPS Reference Design implements full digital control of the push-pull converter and full-bridge inverter.. Simulink® provides mathematical blocks for the time domain simulations. The Simulink blocks will vary based on the converter topology and control scheme implemented (i. It usually takes the system input voltage and duty cycle as input and generates an output voltage. SPECIAL BLOCKS Second order effects like saturation of inductor and dead-time are modeled for systems where these become important like UPS. etc.e. These are indicated by saturation and dead-time blocks. MATLAB SIMULINK The simulation files contain the models for various subsystems. It is just the inverse operation of modulation performed by the physical system in converting duty ratio into voltage. MODULATION BLOCK This block represents the average model of the switching system. This system represents energy states and is what actually gives the output to be controlled. REFERENCE BLOCK This system provides the input for the control system. current mode. resistive. it will consist of an L- DS01279A-page 60  2009 Microchip Technology Inc. This block may or may not be labeled as such in the actual models. Parasitic components such as capacitor ESR and inductor DCR are included in the system here. The control system is required to track the reference waveform.. it involves division with a voltage quantity (e. . the quantity is assumed to be constant and gains are prescaled appropriately. For example. Sometimes in software these routines are not implemented. The feedback signals from the feedback block is the input and the output as a number between 0 and 1. which is useful for step loading. a step load with DC offset can be created. LOAD SYSTEM BLOCK This block is used to generate different types of load current. There are typically two models in each file. This block may consist of various cascaded PID loops based on the control scheme (voltage mode or current mode control). Different topologies have different implementations. it is only a DC constant for DC-DC converters or a sine wave generator for UPS-type models. loading of the system will be accounted here. MODULATION INVERSE BLOCK This block may be part of the control system block as it converts the output of the PID loops from voltage and current quantities to duty ratio quantities between 0 and 1. These models typically have a division with a voltage quantity (divisor) with little variation.

mdl). Push-Pull Compensator For the push-pull converter.m File The . if three converters are in parallel. the previous error. It also generates the scaled values to be used in the software. The difference is then passed through the PID compensator. input voltage may be assumed constant and lumped together with some of the gains. The input voltage may vary especially when transformers are involved. In either case. Bode plots are generated by the . a PID control algorithm has been implemented using voltage mode control. Figure B-1 provides a push-pull converter control scheme. FIGURE B-1: PUSH-PULL CONTROL SCHEME 1:16 VREF + X – Voltage Error PID Control Output PWM Duty Cycle VIN + + VOUT 1001010111 Voltage Feedback S&H ADC  2009 Microchip Technology Inc. then simulation is performed for a single converter (instead of (3x) the capacitor value. For example. The output of the PID will determine the ON time for the PWM duty cycle.AN1279 MATLAB . all quantities are then referenced to primary or secondary based on convenience. Typically.) Depending on implementation. where x is a fractional value.m file is used to generate the coefficients that are used in the MATLAB model (. DS01279A-page 61 . these parameters can vary from the actual values. etc. only a single capacitor is modeled and the inductor value will remain the same).m file for a graphical representation. The generated values are in fractional format. In software they must be represented as Q15(x). The following are typical plots: • Loop gain plot (A x ) – this is used to determine phase and gain margin • Closed loop plot (A x ) / (1 + A x ) or Vo / Vo* – used to determine the closed loop response and bandwidth of the system • Disturbance rejection plot Io(s) / Vo(s) – used to determine the stiffness of the system and expected amount of voltage ripple when a load is applied as a function of frequency Based on the topology used. the input voltage will vary. and the control history to determine the output value. The PID control algorithm will look at the error. This means that the output voltage is measured and compared to a reference set point. The following parameters are typically used: • • • • • The input voltage L (equivalent inductor value) C (equivalent capacitor value) ESR (capacitor ESR) LSR (lumped series resistance includes tracks + switch + cable resistance.

The disturbance rejection plot is defined as: I(s) / VO(s). the stiffer (better) the power supply will be. Each plot is used to describe the behavior of the system. The minimum is -4 db. .5V dip on the output.AN1279 Figure B-2 shows the MATLAB Simulink block diagram. The higher this absolute figure of merit. FIGURE B-2: MATLAB DIGITAL IMPLEMENTATION (PUSH-PULL) VO 390 VO*1 540 VIN1 Out1 In1 ADC VO ILOAD x Product3 Expected Input Current1 VIN D VO* Digital Control System D VIN. which will correlate to a 1A load producing 1. Figure B-3 describes the amount of load current amplitude needed to be applied to generate one unit voltage sag as a function of frequency.D VIN1 Buck Modulation1 L_C Voltage iLoad VO1 IL Scope1 L_C Circuit1 Inverter Load Generator1 The following bode plots are generated from the MATLAB (.m) file. For further details of each block refer to the MATLAB (. FIGURE B-3: DISTURBANCE REJECTION PLOT (PUSH-PULL) DS01279A-page 62  2009 Microchip Technology Inc.mdl) file.

FIGURE B-4: LOOP GAIN VOLTAGE PLOT (PUSH-PULL)  2009 Microchip Technology Inc. To prevent the system from being conditionally unstable. The gain margin is the difference between gain curve at 0 db and where the phase curve hits 180 degrees. It is generally recommended to have a phase margin of at least 40 degrees to allow for parameter variations. it is imperative that the gain plot drops below 0 db when the phase hits 180 degrees. DS01279A-page 63 . The blue curve is for the analog implementation and the green curve is for the digital implementation. The gain margin (where the green line on the phase plot hits 180 degrees) is -20 db. From the plot it can be seen that the phase margin (difference between 180 degrees and the phase angle where the gain curve crosses 0 db) is 90 degrees.AN1279 The loop gain voltage plot shown in Figure B-4 is used to find phase and gain margin.

. which is closely matched by the bode plot. The output of the compensator is used to control the PWM outputs. The point where the gain crosses -3 db or -45 degrees in phase is usually denoted as the bandwidth. The inverter output is generated by varying the input voltage reference using a sinusoidal lookup table. current mode control is usually harder to implement as there are two control algorithms instead of just one as in voltage mode control.AN1279 Figure B-5 shows the closed loop bode plot. The measured current value is subtracted from the reference and the difference is passed to the current error compensator (P). In current mode control. FIGURE B-6: FULL-BRIDGE INVERTER CONTROL SCHEME Voltage Error Current Reference Current Error X + Current Feedback 1011010011 1001010111 Voltage Feedback ADC S&H S&H Control Output PWM Output Filter Duty Cycle AC Out Sinusoidal Reference X + PI P DS01279A-page 64  2009 Microchip Technology Inc. In this system. The difference is passed through the voltage error compensator (PI) and the output is the cur- rent reference value. FIGURE B-5: CLOSED LOOP (PUSH-PULL) Full-Bridge Inverter Compensator Current mode control has been implemented for the Inverter using two control algorithms: PI and P. the bandwidth of the voltage loop is approximately 1250 Hz (8000 rad/s). the current as well as the voltage is measured. However. Current mode control is the preferred method as it has better transient response and stability of the output.

the output voltage will exhibit a sinusoidal variation of 31V. For the inverter. FIGURE B-7: Sine Wave (input variation) MATLAB DIGITAL IMPLEMENTATION (INVERTER) VO VIN + + 390 IL VO* Dtop Dtop VIN ILZX VIN (2. which implies that for 1A load amplitude @ 1000 Hz (6280 rad/s). refer to the MATLAB (. FIGURE B-8: DISTURBANCE REJECTION PLOT (INVERTER)  2009 Microchip Technology Inc. For further details of each block.mdl) file. the minimum is -30 db.VIN VO iLoad IL L_C Circuit1 Scope2 Sine Wave VO*1 Zero-order Hold2 ILoad Digital Control System1 Out1 In1 Out2 In2 Full-Bridge Modulation Model1 + + + + Out1 The disturbance rejection plot as previously described in the Push-Pull section is defined as: I(s) / VO(s). DS01279A-page 65 .AN1279 Figure B-7 shows the MATLAB Simulink block diagram for the inverter.D-1) D.

which is closely matched by the bode plots. the bandwidth of voltage loop is 1250 Hz (8000 rad/s).AN1279 Figure B-9 shows the loop gain bode plot for the inverter. it can be seen that the phase margin (difference between 180 degrees and the phase angle where the gain curve crosses 0 db) is 47 degrees. the gain margin (where the green line on the phase plot hits 180 degrees) is -10 db. In this system. The gain margin is the difference between the gain curve at 0 db. . FIGURE B-9: FIGURE: LOOP GAIN VOLTAGE PLOT (INVERTER) FIGURE B-10: FIGURE: CLOSED LOOP (INVERTER) DS01279A-page 66  2009 Microchip Technology Inc. In the plots below. Figure B-10 shows the closed loop bode plot for the inverter. From the plot. The point where the gain crosses -3 db or -45 degrees in phase is usually denoted as the bandwidth. and where the phase curve hits 180 degrees.

the Q15 voltage V/VN is first multiplied by VN. We have a potential divider such that 100V would give 1. This format is also known as Q15 format: Q15(m) where -1 < m < 1 and is defined as (int) (m * 32767). The input quantity should be in fractional format (this has to be ensured in code). For example. Q15 allows us to use the fractional multiply MAC operation of the dsPIC DSC effectively. Therefore. other physical quantities that are read via ADC feedback are also represented in Q15 format.).5). in current mode control. Therefore. voltage has been scaled as a fraction (V / VN) in software.65V on the analog pin. The fractional value is then represented as Q15 in software. the Q15 format is most convenient as it allows signed operations and full utilization of the available bits (maximum resolution). The same logic applies to any control block. the gain is Amps/Volts or in units of 1/ohms: V  Gain  IREF The goal is to obtain IREF in an appropriate format like Q15(I/IN) to enable implementation of the current loop in software. In theory. The feedback circuitry and the left shift by 5 (x32) is effectively taking the physical quantity and dividing it by a larger base quantity. SCALING FEEDBACK To properly scale the PID gains.AN1279 Scaling The gains calculated from MATLAB are based on real units (volts. Fractional format allows easy migration of code from one design to another with completely different ratings with most changes only in the coefficients defined in the header file.  2009 Microchip Technology Inc. etc. The dsPIC DSC has a fixed point processor and the values in the processor have a linear relationship with the actual physical quantities they represent. for most systems these hardly introduce any significant error.3V or fullrange voltage on the analog ADC pin. Similarly. and then the IREF that is obtained is divided by IN to get current in the correct format. For example. we are trying to measure 100V. The gains generated by MATLAB being in real units. actual voltage and currents are scaled. Based on the potential divider/amplifier in the feedback circuitry. the gain G is scaled as: G * VN / IN. GAIN SCALING In simulation the control gains are calculated in real units. By considering the input and output units and scale of each block to be implemented in software. the output current quantity will automatically be in the correct fractional quantity. The following sections present general concepts behind proper scaling. Therefore. In other words. Then. for consistency. To completely use the 16 bits available in the processor. which is equivalent to Q15(100 / 200).3V and 0 corresponds to 0V. it can also be lumped together with the gains. the proper scaled values can be arrived at. it is imperative to understand the feedback gain calculation. This value can be used in software to act on voltage quantity and give out a current quantity. Typically. but due to finite resolution of 15 bits we use only +/. if GS is the integral gain in real units. VN is the voltage that will produce 3. In this format. From a control perspective. Then. These formulas will have some error as we need 2^15 = 32768. The basic idea behind scaling is quantities that need to be added or subtracted should be of the same scale. the value read in Q15 format is 16383 or Q15(0. This essentially solves the objective of scaling. and then gain (G). cannot be directly applied to these scaled values (representation of physical quantities). The feedback can be represented in various formats. these gains themselves need to be scaled. Our goal is to find that larger base quantity. The feedback signal (typically voltage or current) is usually from a 10-bit ADC. Scaling only effects the software representation of various quantities. Since VN and IN are constants. At this point. GS * TS * VN / IN is the scaled value.32767. amps. Scaling does not affect the structure of the control system block diagram in any way. the feedback 10-bit value (0 -1023) is brought to +/. Fractional format (Q15) is a very convenient representation. Since sampling time is usually constant. the output of voltage loop is the current reference (in amps). TS (sampling time) factors show up. SAMPLING TIME In calculation of the derivative and integral term in the discrete time domain. Other formats are also possible. DS01279A-page 67 . As an example.32767 range by multiplying by 32. but resolution is lost in the process. +32767 corresponds to +3. The base (or normalizer) is denoted as VN. 200 becomes the base voltage.

the output has to be postscaled by 4 to bring it to proper scale again. VIN can be assumed to be constant and 1/VIN can be used as a constant multiplier and bundled along with the gains in the previous blocks.5. Again. where all x. z = (__builtin_mulss(x. if the value that needs to be used is 2.y) >> 15) results in z = Q15(fx. it can be easily represented as fractional format. the control output needs to be divided by the input voltage VIN. If the value of gain (G * VN / IN) is between -1 and +1. y. To do this. but the idea behind scaling is the same. For example. they are set at ±8192. a prescaler may be used to bring the gain term within the +/. DS01279A-page 68  2009 Microchip Technology Inc. Since 16-bit fixed point is a limitation.AN1279 PRESCALER As most physical quantities are represented as Q15 format for easy multiplication with gains. and z are in Q15 format (fx and fy are the fractions that are represented by x and y). PERIOD) >> 15) Division By VIN The output of the controller in the MATLAB model is usually a voltage quantity. For example. The saturation limits for the PID output must be set at one-fourth of the original ±32767 to account for the prescaler. To avoid division.fy). this can be interpreted as a duty ratio/modulation index representing 0-1. PID output and I output individually have to be properly saturated to ±32767. the following equation can be used where PERIOD corresponds to 100% duty : Duty = ( __builtin_mulss(m. Therefore. the gain terms are greater than unity. This needs to be converted to a duty/modulation quantity. Finally after saturation. the gains also need to be in fractional format. If a prescaler is used for P term in a control block. Modulation and Duty Generation The output of a control system after saturation is brought to 0-32767. This varies with topology. This can then be used to convert to a duty cycle value by multiplying it with the PWM period.range. it also must be used for the I and D term in the control block as all of the terms get added together. it is predivided by 4 to bring it within ±1 range. To prevent number overflows. . Based on the topology. Multiplications can then be performed using fractional multiply functions like MAC or using builtin_mul functions and shifting appropriately. In many instances.

5 40 — 3:1 — — Max 242 53 Units V Hz V Hz V VA % % % % ms ms A A °C — — — Only tested at .65 Min 210 47 Typ 220 50 220 50 36 — — — 84 — — 0 2 — 25 — — — 51 45 1000 135 3 — 84 10 — 2. Refer to the battery data sheet for specific discharge times.8 PF @ 100% load >50% load 1350 VA for 2 seconds Full load (resistive) Comments tTRANSFER ICHARGE I_BATTERY T CF PF Note 1: UPS run time will vary with output load current and the batteries discharge rate. DS01279A-page 69 . TABLE C-1: Parameter VIN fIN VOUT fOUT VBATTERY POUT OLP THD η OFFLINE UPS REFERENCE DESIGN ELECTRICAL SPECIFICATIONS Description Input Voltage Input Frequency Output Voltage Output Frequency Battery Input Voltage Continuous Output Power Over Load Protection Output Voltage THD Battery Charger Mode System Efficiency Inverter Mode System Efficiency Mains to Inverter Transfer Time Inverter to Mains Transfer Time Battery Charge Current Battery Input Current (note 1) Operating Temperature Crest Factor Power Factor (Inductive Load) Power Factor (Rectifier Load) 49 34 — >100 — — — — — — — — — .  2009 Microchip Technology Inc.65 .AN1279 APPENDIX C: ELECTRICAL SPECIFICATIONS This Appendix provides an overview of the UPS electrical specifications as well as scope plots from initial test results.

AN1279 FIGURE C-1: EFFICIENCY CHART ACROSS LOAD SPECTRUM 220V UPS Efficiency Chart 90 85 80 Percentage (%) 75 70 65 60 10 25 50 60 % Load 70 80 90 100 FIGURE C-2: OUTPUT VOLTAGE WAVEFORM – NO LOAD DS01279A-page 70  2009 Microchip Technology Inc. .

AN1279 FIGURE C-3: OUTPUT VOLTAGE AND OUTPUT CURRENT – FULL LOAD FIGURE C-4: OUTPUT VOLTAGE AND OUTPUT CURRENT – 500 VA REACTIVE LOAD  2009 Microchip Technology Inc. DS01279A-page 71 .

.AN1279 FIGURE C-5: MAINS TO INVERTER SWITCH OVER – 400W LOAD FIGURE C-6: INVERTER TO MAINS SWITCH OVER – 400W LOAD DS01279A-page 72  2009 Microchip Technology Inc.

DS01279A-page 73 .AN1279 FIGURE C-7: DYNAMIC LOAD RESPONSE – 400W UNLOAD FIGURE C-8: DYNAMIC LOAD RESPONSE – 400W LOAD STEP  2009 Microchip Technology Inc.

AN1279 APPENDIX D: FIGURE D-1: SCHEMATICS AND BOARD LAYOUT OFFLINE UPS REFERENCE DESIGN BOARD LAYOUT (TOP) DS01279A-page 74  2009 Microchip Technology Inc. .

68uF 100V C85 100uF 100V 100V 1206 390k L 2 IC4 D 7 Ibatm+ 4 3 Q14 BC817 R114 4k7 EFB 5 Ibatm- OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 1 OF 8) TOP250YN (TO220-7) S  2009 Microchip Technology Inc. ETD39 Flyback transformer N1:N2 = 52:28 Lp=700uH 12V Q12 BC817 TP14 D49 Zener 47V 1SMB5941BT3G GND GND P4 C82 0.8e 180e D27 BAR43C PGND C89 47uF 25V C91 12V 100nF 25V 8 U7A LM358 GND PGND 1 A 2 3 4 R111 24k R113 10k C93 R115 1k5 47nF GND PGND R202 2k2 C92 1uF GND GND R112 2k2 Iref C147 1uF C88 DNP 100nF 100V R110 12k C143 100nF 1 R105 B R106 5 4 GND 2 U7B LM358 U6 INA168 5 + 3 4 D26 DNP C84 R98 C86 0.22uF 630V 6k8 4W PGND Charger+ R99 1206 390k P2 R100 1206 390k BYV26E Charger- PGND R102 1206 390k R108 1206 390k R109 AN1279 DS01279A-page 75 .FIGURE D-2: Imax=2.8k 1% 6 7 1k5 1% R104 3k3 C X F R107 6.33e 5W Ubat Udc T2 W2 R97 C83 4.7nF 1000V DNP PGND TP13 C144 12V 100nF 25V GND R101 3k3 8 1 R103 6.5A Vmax=48V D25 STTH8R06D Uch R96 0.

5A C94 L10 P_FAN 1 2 FAN 1uF 100nF C59 C22 10uF 25V 1uF 25V e10 R116 Q15 IRLL2705 U15 dsPIC33FJ16GS504 AN1279 P3 3V3 dsVpp dsICSPD GND dsICSPC 1 3 5 2 4 6 ICSP No galvanic isolation! Do not connect when UPS is connected to AC Line! 3V3  2009 Microchip Technology Inc.FIGURE D-3: EPP PS ds CSPC I ds CSPD I /SYS_FLT EFB Tb 3V3 100  10k GND C95 GND OSCO 2 OS CI 32 20MHz 31 T 3V3 29 28 A1 ACi Ub Ib Udcm 23 AN2 IP 27 26 25 24 C97 30 Y1 33 1 R11712pF 1M DNP C96 GND 12pF AR1 34 Iref 44 43 42 41 40 39 38 37 36 35 RP6 RP5 RP15 RP24 PWM4L SS R207 3 RP21 AN8 RP22 Vss RP19 VDD Vss AN10 VDDCORE AN11 PWM3H AN5 PWM3L AN4 PWM2H AN3 RP16 RP29 AVSS AVDD MCLR RP2 7 RP2 8 AN0 AN1 PWM 1H PWM 1L PWM2L 100nF C98 1uF GND 4 5 6 10uF 6V Tant C139 7 8 9 10 11 S2 D33 DNP GND DNP S6 S5 S1 D34 R201 DNPC140 100nF 10e 2 RP20 SCLK SDO SDI R15 DNP R26 DNP R127 DNP D30 DNP S2 DNP GND 12 13 14 15 16 17 18 19 20 21 I S4 S3 A2 TX FAULT/SD BR4 0e AGND GND 1uF C99 100nFAGND C141 3V3A R118 10k 3V3 OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 2 OF 8) dsVpp C142 100pF GND RX ACo 22 PWM4H FLT_CLR PGC1 1 RP23 AN9 R206 DNP RP8 VDD Vss DS01279A-page 76 12V C25 GND 1B ES D29 4. .7uH 1.

3728MHz 2 1 5V R131 1M R130 10k VPP OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 3 OF 8) C102 33pF C103 33pF GND GND AN1279 GND DS01279A-page 77 .FIGURE D-4: 5V R120 10k R119 220e C100 100nF P5 GND  2009 Microchip Technology Inc.2nF GND 5V R136 10k DB6 DB7 A0 E1 E2 Y2 7. A0 E2 DB1 DB3 DB5 DB7 R121 4k7 R123 4k7 LED1 LED2 P6 Vpp GND ICSP C 1 3 5 2 4 6 5V ICSP D ICSP No galvanic isolation! Do not connect when UP S is connected to AC L 1 3 5 7 9 11 13 15 17 19 LCD 2 4 6 8 10 12 14 16 18 20 ine! U8 5V 5V R124 DNP R125 DNP R204 DNP R126 DNP 2 3 4 5 6 7 10 9 RA0/AN0 RA1/AN1 RA2/AN2/VREFRA3/AN3/VREF+ RA4/T0CKI RA5/AN4/SS/LVDIN OSC2/CLKO/RA6 OSC1/CLKI RB0/INT0 RB1/INT1 RB2/INT2 RB3/CCP2 RB4 RB5/PGM RB6/PGC RB7/PGD P_BZ 1 2 DB0 DB1 DB2 DB3 DB4 DB5 ICSP C ICSP D 21 22 23 24 25 26 27 28 R128 0R R129 0R R132 0R R133 R134 4k7 C104 100nF GND GND D31 R203 DNP R135 DNP 0R SDI SS SCLK SDO 1 MCLR/VPP 8 19 VSS VSS VDD PIC18F2420-E/SO RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RC2/CCP1 RC3/SCK/SCL RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT 11 LED1 12 LED2 13 14 15 16 17 BTN 18 5V 20 5V R122 10k E1 DB0 DB2 DB4 DB6 BTN C101 2.

N.C.C.C.C.3nF 25V R40 SDDH1 C33 DSH Vb N.3nF 25V R56 10k R53 47e R54 12e R57 1k EGP10J DSH1 HOP1 HON1 R51 1k Q7 Q8 1N4148 R48 12e D13 D14 Q6 BC817 R50 3k3 R49 4k7 R45 47e 12V D15 UDC K1 Phoenix Contact DP DT MR.S6 R42 4k7 S3 FIGURE D-5: S5 R41 4k7 S4 GND SDDL2 EGP10J STGP14NC60KD R61 47e R62 12e 1kR65 C37 3. N.. N. N. N. HOP HON Vs SSDH N.C.21 A1 GND L2 250uH ETD54 100e 4W C36 U4 HXS 20-NP/SP2 4.21. HOP HON Vs SSDH N. N. N.C.. 2 4 6 8 2 4 6 8 out gnd EGP10J ref 11 12V DSH1 C41 HOP1 HON1 1uF 25V L1 A Ci1 m SDDH1 S1 N SW-DPST L F2 Not on P CB J5 ACInN C42 470pF A2 R69 100e GND K2 GND Phoenix Contact DP DT MR.21. No t on PCB D19 1N4148 A Co2m DS01279A-page 78 GND 3V3 3V3 DSH2 R47 4k7 HOP2 HON2 SDDH2 EGP10J STGP14NC60KD STGP14NC60KD R52 10k R55 10k C34 3.C..C.C. L J6 ACInL PE Not on PCB GND R68 33e 12V 1206 R43 4k7 R44 4k7 AN1279 GND GND GND FLT_CLR R46 4k7 /SYS_FLT GND FAULT/SD 12V U3 S6 S5 FLT_CLR /SYS_FLT FAULT/SD SDDL2 C145 1uF 25V IR2214 PGND R66 1e 1206 S4 S3 FLT_CLR /SYS_FLT FAULT/SD SDDL1 GND PGND LON1 LOP1 C146 1uF 25V DSL1 HIN LIN FLT_CLR /SYS_FLT /FAULT/SD Vss SSDL COM LON LOP Vcc DSL IR2214 PGND R67 1e 1206 ..7uF 305V 5VA DSH Vb N.C.3nF 25V 10k 3.21 R70 3k3 R71 10k Q11 BC817 Filter N U5 PGND C39 100nF Im A Ci2 m C132 4n7 AGND AGND AGND C40 100nF 12 10 9 Vc A Co1m OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 4 OF 8) EGP10J Not on P CB PACin 2 3 1 Plug AC Male C43 10uF 25V R72 12e D20 J3 ACOutN J4 ACOutL  2009 Microchip Technology Inc. N.C.3nF 25V 10k R63 C38 R64 EGP10J DSL1 LOP1 LON1 D18 SDDL1 R60 1k Q9 Q10 STGP14NC60KD L2 1 3 5 7 PGND LON2 LOP2 1 3 5 7 DSL2 HIN LIN FLT_CLR /SYS_FLT /FAULT/SD Vss SSDL COM LON LOP Vcc DSL DSH2 C35 HOP2 HON2 1uF 25V LOP2 SDDH2 LON2 R59 12e R58 47e L1 D16 L2 D17 DSL2 3.C.

7nF 56k 1% 1206 56k 1% 1206 R149 R150 U9A 100nF AGND MCP6022 1 56k 1% 1206 56k 1% 1206 Udcm2k2 1% 3V3 R139 R140 R141 C105 4.7nF 100k 1% AGND U12A 100nF AGND MCP6022 1 R183 1k69 1% R185 3k3 1% C125 4.7nF D12 BAR43S Udcm 4 8 2k2 1% Ibatm+ 3 D39 BAR43S Ib 6 5 R191 2k2 1% AGND D41 BAR43S Tb 8 4 AGND Tr R193 3k3 1% AGND 4 8 C130 100nF AN1279 DS01279A-page 79 5 1k69 1% 4 B 7 R196  2009 Microchip Technology Inc.7nF R186 2k2 1% AGND R192 OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 5 OF 8) AGND 2k2 1% Tm+ R197 3k3 1% AGND .7nF R175 3k3 1% C117 4.FIGURE D-6: C106 4.7nF R137 5VA C107 8 2k 1% R138 5VA C108 8 56k 1% 1206 2 3 4 R157 2k 1% AGND AGND R159 1k69 1% R161 3k3 1% UbmAGND AGND AGND 8 6 5 1k69 1% R176 3k3 1% AGND AGND AGND C120 4.7nF C111 4.7nF 4 R178 2k2 1% 2V5A B 7 Ubm+ R169 33k 1% 1206 R170 R177 2k2 1% AGND U10B MCP6022 D38 BAR43S ACo 33k 1% 1206 R163 8 U9B MCP6022 6 5 B 7 C115 4.7nF R160 2k2 1% AGND AGND A R148 56k 1% 1206 C109 4.7nF AGND AGND AGND D40 BAR43S IP 6 U11B MCP6022 1 2 3 C128 R195 100nF 100k AGND AGND AGND ACi2m R151 R152 R153 R154 82k 1% 1206 82k 1% 1206 82k 1% 1206 82k 1% 1206 ACo1m R164 R165 R166 R167 82k 1% 1206 82k 1% 1206 82k 1% 1206 82k 1% 1206 ACo2m R171 R172 R173 R174 82k 1% 1206 82k 1% 1206 82k 1% 1206 82k 1% 1206 5VA 5VA C121 R182 2 A U11A 100nF AGND MCP6022 1 C123 4.7nF AGND AGND AGND IPm R190 C127 220pF 3V3 DNP P7 3V3 5VA R194 1k D42 Bat Temp AGND BAR43S T R198 3k3 1% C129 100nF AGND AGND AGND 10k R181 C122 5VA 3V3 R180 2k2 1% C119 4.7nF R179 100k 1% Ibatm8 33k 1% 1206 2 3 4 R188 A R184 33k 1% 1206 C124 4.7nF AGND AGND AGND AGND C113 4.7nF 4 R158 2k2 1% 2V5A A R147 Udcm+ U10A 100nF AGND MCP6022 1 D35 BAR43S ACi R142 R143 R144 R145 82k 1% 1206 82k 1% 1206 82k 1% 1206 82k 1% 1206 R146 1k69 1% R155 3k3 1% C110 4.7nF AGND AGND AGND D37 BAR43S Ub C118 4.7nF 3V3 ACi1m 2 3 1k69 1% R156 3k3 1% 3V3 C112 4.7nF AGND 2V5A 3V3 U12B MCP6022 B 7 R187 1k69 1% R189 3k3 1% C126 4. AGND C114 4.7nF Im R162 2k2 1% 3V3 D36 BAR43S I 3V3 R168 1k69 1% C116 4.

0 GND GND VOUT C73 C75 2.2uF 10V 68uF 25V LowESR AGND D46 GND VR2 VIN VOUT GND UBAT UDC TC1262-3.Udc P1 C44 0.2uF 10V 68uF 25V LowESR R220 2k2 5V L8 0805 BLM21PG221 5VA C68 C72 2.6A D22 ES3B C50 68uF 25V LowESR C53 1uF 25V R82 10k GND GND PAGND1 LM5575 GND R86 3k3 R83 1k2 C49 330pF C51 68uF 25V LowESR C52 68uF 25V LowESR D44 L3 IC1 12V C47 GND power C45 C46 470nF 25V 12V 5V 3V3 GND 1 3 5 7 2 4 6 8 12V 5VA 3V3A AGND FIGURE D-7: Ubat DS01279A-page 80 C48 1uF 25V GND VCC BST SW PRE IS OUT PGND 12 11 R81 10e 1206 1 16 14 15 13 BZX85C16 GND 3 2 4 8 10 7 5 6 9 VIN /SD SYNC RAMP SS RT COMP FB AGND C54 C55 680pF 25V 1uF 25V R85 12K PAGND1 PAGND1 C56 1nF 25V C57 2.33uF 100V 0.2uF 10V GND 100pF 2kV C81 D47 GND R221 1k 3V3 L5 0805 BLM21PG221 AN1279 W1 R73 2-position header 1206 external ON/OFF switch F1 SMD075F/60 150k (on enclosure) R76 1206 150k R79 1206 150k R80 1206 150k BC856 Q13 R74 10k R84 1206 150k R78 R75 47k 68k P10 R87 4k7 1206 2 1 S3 SW-PB GND TEST GND BR2 GND 0e PAGND1 OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 6 OF 8) 3V3A C62 C61 2.2nF 25V R18 4k7 C66 1uF 25V C64 68uF 25V LowESR D45 GND L6 0805 BLM21PG221 R88 24k Needs heatsink on P CB VR1 VIN GND LM2904S-5.33uF 100V D21 BAV99 GND R77 100k 220nF 25V 47uH 2.2uF 10V 68uF 25V LowESR AGND 100pF 2kV C80 GND EGND EGND EGND PGND EGND  2009 Microchip Technology Inc.3 GND C78 100pF 2kV C79 100pF 2kV C60 2. .

4k 3W C2D05120 C1 150pF 1kV C4 ETD54 C2D05120 T1 R16 10R 3W 0.S2 S1 EPP D1 P9A L1 DC+ 200H C2 e15 .4k 3W 2.4k 3W R12 DNP GND R13 DNP PGND 2.4k 3W C24 R7 R9 ref1 C11 1200uF 100V C12 1200uF 100V PGND 1000uF 100V HT 105×C T3 DNP CT 1:1000 (optional) C13 C14 e5 e5 1uF 100V BAT12V PGND R10 1k current sense BAS21 D4 D8 Q18 BC817 DNP C17 DNP D23 BAR43S100V D24 100V BAR43S C26 DNP PGND R24 10k C20 10k D11 12e 1206 C21 3.01uF 100V C2D05120 C2D05120 150pF 1kV 150pF 1kV 12V Tr R11 Q1A FDP2532 1k current sense BAS21 D5 D9 Q2A FDP2532 Q2B FDP2532 Q3C FDP2532 R29 DNP GND 12V R30 DNP ref2 Q19 BC817 DNP Q1B FDP2532 Q1C FDP2532 R25 10k DNP C6 C8 D3 D28 2.7e R22A 4.7e R22B 4.01uF 100V Fext 150pF 1kV C23 R1 D2 R4 TP2 Udc Udcm+ FIGURE D-8: R2 DNP Ubat Ubm+ DNP R5 R3 4k7 R6 J1 4k7 C3 e15 . 2x20A BAT+ Slow Blow (on enclosure) J2 Ubm1uF 100V R17 10R 3W 0.7e R19C 4.7e R19A 4.3nF 25V .1uF 630V Udcm470uF 400V HT 105×C DCPGND P9B Tr R8 10k DNP I N_B GND I N_A ENB_A OUT_ B VDD OUT_ A ENB_ B 5 6 7 8 4.7e R22C TP6 C28 Vvercurrent shutdown to driver 100pF DNP LM393 3V3 Current sense to dsPIC GND U1B 5 6 C30 68pF DNP GND ref2 GND R39 10k DNP 7 GND IPm C29 DNP TP7 OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 7 OF 8) R37 2k2 R38 R38a DNP 1206 33e(CT) DNP 10k GND t× D32 BAV99 D48 BAV99 GND PS AN1279 DS01279A-page 81 Cycle-by-cycle Current-Limit to dsPIC 1k / 33e(CT) 1206 DNP  2009 Microchip Technology Inc.1uF 630V C5 C7 2.3nF 25V P_CT U1A 3 GND 1 2 ref1 R36 1k 1 2 PGND BZX84C3V6 R21 10k Tm+ R28 RT1 DNP KTY81/122 DNP TmQ5 BC807 PGND TP5 100nF C27 5V DNP BAS21 BAS21 D43 R22 R20 PGND D6 3k3 D10 BAS21 R14 BR1 0e 4 3 2 1 GND PGND U2 MCP14E4 12V C15 1uF 25V C16 68uF 25V LowESR D7 BAS21 R23 10k R19 12e 1206 3.7e R19B 4.

FIGURE D-9: 2 1 DS01279A-page 82 P8 5VUSB 2 4 6 3V3 C131 100nF U13 1 RX TX 3 4 GND 2 Vcc1 Out A In B GND 1 ISO7221 Vcc2 In A Out B GND2 8 7 6 5 GNDUSB GND 5VUSB C136 100nF GNDUSB UICSP D UVpp 3 UICSP C 5 ICSP 1 U14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 VUSB RC4/D-/VM C138 1nF PIC18F2450 GNDUSB EGND GNDUSB GNDUSB RC2/CCP1 RC5/D+/VP 15 RC1/T1OSI/UOE RC6/TX/CK 16 C137 1uF 25V RC0/T1OSO/T1CKI RC7/RX/CK 17 OSC2/CLKO/RA6 VSS 18 OSC1/CLKI VDD 19 Vss RB0/AN12/INT0 20 RA5/AN4/HLVDIN RB1/AN10/INT1 21 C134 100nF 5VUSB 0805 BLM21PG221 L9 1 2 3 4 J7 VBUS DD+ GND USB B 1-14701561 RA4/T0CKI/RCV RB2/AN8/INT2/VMO 22 RA3/AN3/VREF+ RB3/AN9/VPO 23 5VUSB RA2/AN2/VREFRB4/AN11/KBI0 24 RA1/AN1 RB5/KBI1/PGM 25 RA0/AN0 RB6/KBI2/PGC 26 UICSP C MCLR/VPP/RE3 RB7/KBI3/PGD 27 28 UICSP D AN1279 GNDUSB 5VUSB R199 10k UVpp C133 GNDUSB 12pF R200 Y3 C135 1M GNDUSB 20MHz 12pF OFFLINE UPS REFERENCE DESIGN SCHEMATIC (SHEET 8 OF 8)  2009 Microchip Technology Inc. GNDUSB .

and other countries.S. MERCHANTABILITY OR FITNESS FOR PURPOSE.A. Mindi. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. the person doing so is engaged in theft of intellectual property. ICSP. If such acts allow unauthorized access to your software or other copyrighted work.S. ICEPIC. CodeGuard. Most likely. Code protection does not mean that we are guaranteeing the product as “unbreakable.net. under any Microchip intellectual property rights.net. KEELOQ. mTouch. WRITTEN OR ORAL. MPLINK.Note the following details of the code protection feature on Microchip devices: • • • Microchip products meet the specification contained in their particular Microchip Data Sheet. MiWi. suits. PICtail. microperipherals. Linear Active Thermistor. MPLAB. We at Microchip are committed to continuously improving the code protection features of our products. Microchip is willing to work with the customer who is concerned about the integrity of their code. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. HI-TIDE. Oregon and design centers in California and India. Select Mode. All Rights Reserved.A. rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U. Gresham. In-Circuit Serial Programming. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk.  2009 Microchip Technology Inc. MXDEV. Serial EEPROMs. FanSense. Total Endurance.A. WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U. Trademarks The Microchip name and logo. require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. dsPICDEM. MPASM. There are dishonest and possibly illegal methods used to breach the code protection feature. Microchip believes that its family of products is one of the most secure families of its kind on the market today. PICDEM. No licenses are conveyed. Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters. FilterLab.. you may have a right to sue for relief under that Act. PICkit. indemnify and hold harmless Microchip from any and all damages. claims. Printed in the U. REAL ICE. Microchip disclaims all liability arising from this information and its use. Omniscient Code Generation. QUALITY. PIC32 logo. to our knowledge. ECAN. Hampshire.A. rfLAB. SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.” • • Code protection is constantly evolving. Arizona. STATUTORY OR OTHERWISE. dsPICDEM. the Microchip logo. nonvolatile memory and analog products. PICC. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED. dsSPEAK. All other trademarks mentioned herein are property of their respective companies. dsPIC. DS01279A-page 83 . when used in the intended manner and under normal conditions. Analog-for-the-Digital Age. Printed on recycled paper. implicitly or otherwise. Application Maestro. dsPICworks. SQTP is a service mark of Microchip Technology Incorporated in the U. KEELOQ logo. PICmicro.S. or expenses resulting from such use. PERFORMANCE. MPLIB.A. RELATED TO THE INFORMATION. ECONOMONITOR. nanoWatt XLP. design and wafer fabrication facilities in Chandler and Tempe. INCLUDING BUT NOT LIMITED TO ITS CONDITION. It is your responsibility to ensure that your application meets with your specifications. HI-TECH C. Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. PICSTART.S. PIC. and the buyer agrees to defend. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs.S. MXLAB. PICDEM. Microchip Technology Incorporated. © 2009. and other countries. All of these methods. MPLAB Certified logo. In addition. PICC-18. TSHARC. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. KEELOQ® code hopping devices.

IL Tel: 630-285-0071 Fax: 630-285-0075 Cleveland Independence.com Atlanta Duluth.Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 China . CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara.Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan .Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 03/26/09 DS01279A-page 84  2009 Microchip Technology Inc.New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 India .Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China .Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 China . OH Tel: 216-447-0464 Fax: 216-447-0643 Dallas Addison.Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain .Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands .microchip. CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga.Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany . Canada Tel: 905-673-0699 Fax: 905-673-6509 ASIA/PACIFIC Asia Pacific Office Suites 3707-14. MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo.Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 France .Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 China . Ontario. 37th Floor Tower 6.Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China .Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 China .6166 Fax: 81-45-471-6122 Korea .Yokohama Tel: 81-45-471. Chandler.Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 China . MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca.Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Italy . .Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK .microchip.Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China .Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark . TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills.Worldwide Sales and Service AMERICAS Corporate Office 2355 West Chandler Blvd.Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 Philippines .Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 China .Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 Korea . AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 EUROPE Austria .Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 Japan .com Web Address: www.Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China .Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 Malaysia . The Gateway Harbour City.Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 China .Hsin Chu Tel: 886-3-6578-300 Fax: 886-3-6578-370 Taiwan .Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Thailand . GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough.Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 Malaysia .Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan .Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China . Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 Australia .Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 ASIA/PACIFIC India .Bangalore Tel: 91-80-3090-4444 Fax: 91-80-3090-4080 India . IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->