UPS & Inverters
UPS & Inverters
UPS & Inverters
UPS&Inverter
Aim of study
Contents Pages
1.1 Introduction 2
1.2 Freescale Semiconductor’s Solution 2
1.3 Advantages and Features of Freescale’s Controller 5
1.4 Online UPS Theory and Description 8
1.5 Control Loops In The Online UPS 36
1.6 Battery Temperature Reading 47
1.7 Program Loop Timing 48
1.8 Inverter Control Loop 49
1.9 PFC Control Loop 51
1.10 Battery Booster Control Loop 52
1.11 Battery Charger Control Loop 53
1.12 Rectifier Soft Start Routine 54
1
UPS&Inverter
UPS&Inverter
1.1 Introduction
• High input power factor with Direct PFC and lower power pollution to
the power grid.
• Extended battery life and lower maintenance costs.
• Power source and load conditioning can be monitored in real time.
• Network communication for remote control and monitoring.
• Expedites time-to-market using out-of-the-box software components.
The functional blocks of the on-line triple conversion UPS are shown in
Figure 1.
3
UPS&Inverter
a boost/buck DC/DC converter. When the system is charging the batteries, the
DC/DC converter works in buck mode, which steps the high DCBus voltage
down to the batteries’ acceptable voltage level and charges the batteries. When
the battery pack is fully charged, the converter switches to stand-by mode. If an
input power failure occurs, the DC/DC converter works in boost mode, which
supplies power to the DCBus from the batteries. The DC/AC inverter is used to
convert the DC voltage to approximated sinusoidal output voltage pulses. The
pulse string is input to an LC filter, which generates a true sinusoidal output
voltage that is supplied to the load. The user can select the frequency of the
sinusoidal output voltage and the frequency can either be synchronized to the
input voltage frequency or any other desired independent stable frequency.
When any failures or faults are generated or maintenance is needed in the UPS
system, the bypass switch will be engaged, which turns the UPS system off and
connects the load directly to the input power source. All necessary control
functions are implemented within the controller, such as:
• Power on/off control
• DCBus voltage regulation
• Input power factor correction
• Battery management
• AC output voltage regulation
• Frequency synchronization of input and output
• Power source monitoring
• System self diagnostics and self protection
• Emergency event processing
• Real-time multi-tasking system operation
• Communication protocols
4
UPS&Inverter
The Freescale 56F8300 (56800E core) family is well suited for UPS design,
combining the DSP’s calculation capability with an MCU’s controller features
on a single chip. These controllers offer many dedicated peripherals, including
Pulse Width Modulation (PWM) units, Analog-to-Digital Converters (ADC),
timers, communication peripherals (SCI, SPI, CAN), on-board Flash and
RAM. Generally, all the family members are appropriate for use in UPS
design.
The following section uses a specific device to describe the family’s features.
5
UPS&Inverter
PWM modules are the controller’s key features enabling UPS control. Each
PWM is double-buffered and includes interrupt controls. The PWM module
provides a reference output to synchronize the Analog-to-Digital Converters.
The PWM has the following features:
•Three complementary PWM signal pairs, or six independent PWM signals
• Features of complementary channel operation
• Dead time insertion
• Separate top and bottom pulse width correction via current status inputs
or software
• Separate top and bottom polarity control
• Edge-aligned or center-aligned PWM signals
• 15-bit resolution
• Half-cycle reload capability
• Integral reload rates from 1 to 16
• Individual software-controlled PWM outputs
• Mask and swap of PWM outputs
6
UPS&Inverter
7
UPS&Inverter
• Counts up/down
• Counters are cascadable
• Programmable count modulo
• Maximum count rate equals peripheral clock/2 when counting external
events
• Maximum count rate equals peripheral clock when using internal clocks
• Counts once or repeatedly
• Counters are preloadable
• Counters can share available input pins
• Each counter has a separate prescaler
• Each counter has capture and compare capability
1.4.1 Introduction
The minimum components needed to design an Online UPS are the rectifier,
the battery bank and the inverter. The rectifier converts the distribution line’s
AC (Alternating Current) power to DC (Direct Current) power, The Form of
current suitable to store energy in a battery bank. At all times, this DC is also
fed to an inverter, which reconverts the DC power to an AC waveform
connected to any equipment utilizing AC that a user considers as mission
8
UPS&Inverter
critical. If the AC supply fails for any reason, the inverter will continue to draw
power from the batteries.
9
UPS&Inverter
For an online UPS, two power DC/DC converters are required. One converter
operates as the battery charger, and the other boosts the battery voltage in the
absence of line input and generates the appropriate DC required by the inverter.
10
UPS&Inverter
11
UPS&Inverter
The input rectifier is implemented as a four-diode bridge (X1, X2, D24, and
D23). A soft start system implemented with SCRs can prevent a huge in-rush
current when the system starts, while the system’s internal capacitors get
charged to the line’s peak voltage.
If the trigger angle of X1 and X2 is gradually decreased from the zero crossing
towards the peak voltage, as demonstrated in Figure 8, the capacitor voltage
will then increase slowly. As the current on a capacitor equals the capacitance
value times the voltage derivative with respect to time, the input current will be
proportional to the slope of the voltage applied to the capacitor.
12
UPS&Inverter
Figure8 Relationship between Rectifier Soft Start Operation / Actuator Signals and the AC
Main Line Voltage
After the rectifier soft start finishes, X1 and X2 must act as diodes with
continuous triggers. When no PFC is implemented, the line current will be
similar to that shown in Figure 9, due to the diode–capacitor nature of a
13
UPS&Inverter
rectifier.
The objective of the PFC circuit is to simulate a resistive load to the power
line; in other words, to obtain a unity power factor and low harmonic content in
the current waveform. A fast control must be
14
UPS&Inverter
Once the voltage on capacitors C3, C7, and C8, shown in Figure 11, reach the
AC main supply peak after the rectifier soft start, the PFC is turned on,
correcting the power factor presented to the line and generating the rail DC
voltages VP and VN at a value higher than the line peak.
15
UPS&Inverter
For positive values of the line, when U1 is closed and U2 is open, the circuit
reduces as shown in Figure 13. C3 is now connected in parallel to C7, thus
reducing its ripple voltage. The line is applied directly to L1, increasing the
current across it with a constant slope, because line voltage could be
considered constant, and the inductor current, which corresponds to the current
in the line (ILINE), depends on the voltage across its terminals.
16
UPS&Inverter
Where:
VL1 is the voltage across the inductor terminals
The peak current across the inductor at time t2 depends, among other factors,
on the instant value of the line voltage and the time difference t2 – t1, which is
the time that U1 remains closed.
17
UPS&Inverter
Figure 16 has been extracted from the UPS schematic shown in Figure 5. Using
the high DC voltages VPrail positive and VN rail negative as its power sources,
this circuit provides the charge conditions for a battery bank formed by two
12V batteries connected in series, which must be charged with constant
current. When the float condition is reached, the charger must preserve a
constant voltage while providing the battery bank’s self-discharge current.
19
UPS&Inverter
over a single-transistor fly back converter is that the switches’ voltage rating is
VP - VN. Moreover, since a current path exists through the diodes D18 and
D19, which are connected to the primary winding, a dissipative snubber across
the primary winding is not needed to dissipate the energy associated with the
transformer primary-winding leakage inductance. The design, calculations and
construction of TX1 are critical in order to prevent the reflected voltage from
secondary to primary ising higher than VP - VN when D22 is on.
The battery booster is a DC/DC converter and transforms the battery voltage of
24VDC to the required differential 440VDC between rails. The rails are
symmetric, implying VP = 220VDC at the positive rail, and VN = -220VDC at
the negative rail, as shown in Figure 17.
Although the topology of Figure 17 is usually called “booster” because its
output voltage is higher than input voltage, it is actually a push-pull converter
with an arrangement of two forward converters working alternatively and a
transformer to increase the output voltage
20
UPS&Inverter
The switches U9 and U10 cannot be closed at the same time. Typical drive
signals are illustrated in Figure 18.
Using a control signal like the one shown in Figure 18, the waveforms at the
transformer secondary over L10 and L9 are illustrated with positive and
21
UPS&Inverter
C9 remains charged to VBAT and is added because the coupling factor is not
equal to one, implying that a leakage inductor must be considered. C9 acts as a
snubber, creating a current path to avoid an controlled voltage peak at the
primary windings of the transformer.
The four diodes D25, D26, D27 and D28 form a conventional full-wave
rectifier bridge and generate only positive values in the cathodes of D25 and
D27 and negative values at the anodes of D26 and D28, as shown in Figure 20.
22
UPS&Inverter
23
UPS&Inverter
Where:
tp/T is the duty cycle of the control signal
The expression simplifies to:
As 1/T = 20kHz is much higher than 50Hz or 60Hz, then the output voltage
will result proportional to TP, and the sinusoidal signal can be considered
constant during T seconds.
24
UPS&Inverter
25
UPS&Inverter
The output of the isolating transformer is half-wave rectified and applied to the
load. Positive and negative voltages are generated. The 39. Resistor limits the
current of the transformer’s secondary when M1 and M2 are on. Resistors RL1
and RL2 represent the load.
All isolated power supplies are connected in parallel to the rail voltage,
depicted as nodes A and B in Figure 23.
26
UPS&Inverter
While M1 and M2 are on, VCC is connected directly to the primary, increasing
the current linearly, as shown in Figure 25. Cn is simultaneously charging
across Dn.The 39. resistor acts as a current limiter. M1, M2, Dp, Cp, and the
transformer shape a traditional fly back power supply.
When M1 and M2 are off, an inverted voltage is induced in the primary and
27
UPS&Inverter
D1, D2 which limit that voltage to 15V plus 1.2 from two diode junctures,
turning Dp on and charging Cp.
There are several transformers connected to the rails A and B which generate
isolated power supplies to drive SCRs, IGBTs, and MOSFETs used in the
rectifier, inverter, battery charger, and battery booster.
Figure 26 shows the control power supply, which uses a LM2576 step-down
voltage regulator, to generate +VCC = 15V fed by the redundant DC voltage
coming from 18VAC or +VBAT or an additional power supply VDCR coming
from the battery charger. This circuit also generates the Control Board Power
Supply, which is isolated from +VCC.
All signals that require sensing as voltages, currents, and temperature at the
Analog-to-Digital Converters are converted to the appropriate input levels and
diode-limited to avoid damage to the ADCs; this process uses differential
28
UPS&Inverter
Figure 27 Partial View of the Auxiliary Power Supply and Optoisolation Network
29
UPS&Inverter
The value of the resistors required to sense every signal is calculated in order to
guarantee full swing, minimizing analog and quantization noise at the ADCs.
The reference level of the ADC is used to shift the AC input signal to swing
from 0 to VRH (i.e., 0 volts in the input signal are mapped to VRH/2). If the
output of the operational amplifier tends to go out of limits for any reason, the
diodes protect the ADC inputs.
The voltage reference, VRH, is generated by the circuit shown in Figure 29.
This circuit acts as a buffer to the reference voltage VREFH from the
controller. This circuit also generates two auxiliary voltage outputs:
• VA equal to one diode voltage Vã
• VB with value VRH-Vã
These voltages will be used to limit the values of voltage applied to A/D
modules.
30
UPS&Inverter
The circuit in Figure 30 shows the basic driver which handles the SCRs’ gates
using an 4N35 optocoupler to generate an isolated current supply to trigger the
rectifier’s SCRs.
31
UPS&Inverter
Figure 32 illustrates the basic isolated circuit implemented to drive the IGBT’s
and MOSFET’s gates. It is based in an HCPL 3101 gate drive optocoupler.
Under normal conditions, the UPS inverter feeds all power to the load.
However, in order to ensure that the load is supported in the event of a failure,
or during maintenance, the equipment must also allow for direct connection to
the AC main line. A switching relay is connected as shown in Figure 33.
32
UPS&Inverter
The relay’s transfer time must be shorter than a period of the AC line. A
transfer time of less than 20ms is fast enough to comply with this constraint.
The transfer is allowed if phase and voltage conditions are satisfied.
Figure 34 shows the circuit implemented to turn the bypass relay on and off
using the BP1 signal. Please note the three different grounds used in the
system.
33
UPS&Inverter
Figure 35 shows the rectifier and inverter current sensing circuit. Figure 36
shows the circuits implemented to sense the battery charger and battery booster
currents. These circuits generate overcurrent signals when the current value
reaches a defined level. These two signals are connected directly to the
controller’s FAULT 0 and FAULT 1 pins.
34
UPS&Inverter
The battery charger over current protection generates a fault signal, named
“SIC”, which turns off the charger PWM signal. Likewise, the battery booster’s
over current protection circuit generates the FPP signal, which turns off the
drive signal for the MOSFETs.
The battery temperature sensing circuit is shown in Figure 37; it uses an LM-
35-CZ, which is a precision centigrade temperature sensor.
35
UPS&Inverter
The UPS’ control algorithms are digitally implemented. The topology chosen
for the compensators is the PID (Proportional-Integral-Derivative) and the PI
(Proportional-Integral), with a 3-bit resolution. All gain constants are 16-bit
implemented. The accumulators are all 32-bit, unless otherwise specified.
36
UPS&Inverter
Where:
It is implemented as follows:
where:
37
UPS&Inverter
is the discrete time differential gain. The proportional gain constant, KP,
remains unmodified.
Figure 39 shows a simplified PFC control loop, valid only for positive AC line
voltages. The PFC is a current loop with a set point calculated as the product of
the rail voltage control output times the AC line voltage.
The voltage control must keep a constant DC rail. V. Positive Rail is sensed
and compared to Voltage Setpoint.
The error signal then passes through a PI control network, which outputs one of
the operands used to calculate the current set point. The other operand is the
AC Line Voltage, VLINE. This signal is then used as the set point of a second
PI control, which forms the current control loop.
38
UPS&Inverter
The goal of the rectifier stage is to maintain the rail DC voltage at ± 220V and
to control the input current to mimic the voltage waveform (and thus to make
the complete system appear as a resistive load to the AC main line). In order to
achieve these two goals, two control loops are required:
absolute value to control the signal, regardless of its sign. A suitable controller
for this pplication is a PI compensator with the following parameters:
Using the backward difference method yields the following discrete time
equivalent:
39
UPS&Inverter
with:
KP = 6.4 and KI = 1.6
The second controller keeps the rail voltage constant and uses a low pass filter
to reject the 60Hz and 120Hz ripple. The process is much slower than any of
these frequencies, and therefore should not attempt to correct higher harmonic
disturbances. The chosen controller is a PI. The output of this controller
modulates the AC main line voltage to obtain the reference for the current loop.
The low-pass filter is a first-order Infinite Impulse Response (IIR) filter with a
3dB cutoff frequency of 5Hz, implemented with the following transfer
function:
with:
b0 = 0.01
a1 = 0.9984
The following is the proper PI controller:
Using the backward difference method yields the following discrete time
equivalent:
with:
KP = 0.9 and KI = 0.0008
Given that the battery voltage is a slow signal, the sampling frequency for this
control is decimated by 16 relative to the 20kHz (20kHz/16 = 1250Hz)
sampling frequency used elsewhere in the system. The PWM switching
frequency is preserved at 20kHz.
41
UPS&Inverter
terminal voltage reaches 28V, the voltage is kept constant, decreasing the
charge current. The battery charger system is implemented by two nested
loops. The inner loop controls the charging current and uses a PI control.
The reference for this control is delivered by a voltage control loop, whose
output is limited from 0 to 1/3, where 1/3 (in Frac16 notation) represents 1A.
When the batteries are discharged, the voltage control
increases the current reference, looking for a 28V voltage. However, when the
voltage control loop reaches 1/3, the integral action is disconnected and the
output is limited, forcing the current loop to set a 1A charging current to the
battery. When floating voltage is reached, the voltage control loop reduces its
output, reducing the current applied to the batteries.
The controller chosen for the current control loop is a PI compensator with the
following parameters:
Using the backward difference method results in the following discrete time
equivalent system:
with:
KP = 0.7 and KI = 0.035
The controller chosen for the voltage control loop is a PI compensator with the
following parameters:
42
UPS&Inverter
Using the backward difference method results in the following discrete time
equivalent system:
with:
KP = 0.02 and KI = 0.0005
The objective of the inverter control loop is to supply the load with a voltage
defined by the reference signal.
This reference signal is generated by the PLL system, at a sampling frequency
of 20 kHz, high above the 50/60Hz nominal frequency. For this reason, it is
reasonable to consider the set point a constant.
43
UPS&Inverter
The inverter control is implemented with a nested topology. The outer loop
controls the output voltage and the inner loop controls the inductor current.
This configuration allows better stability of the feedback system and an
implicit limitation of the current delivered to the load. The inner control loop
stabilizes the system, acting as a damper for the LC output circuit.
The controller chosen for the current control loop is a PI compensator with the
following parameters:
Using the backward difference method results in the following discrete time
equivalent system:
44
UPS&Inverter
with:
KP = 0.84 and KI = 0.0024
The outer loop is the voltage control. The goal of this loop is to keep a
sinusoidal voltage waveform, regardless of the load characteristics. When
nonlinear loads (as a full wave rectifier) are connected, a high current is drawn
at the peaks of the signal. The action taken to
The controller chosen for the current control loop is a PI compensator with the
following parameters:
Using the backward difference method results in the following discrete time
equivalent system:
with:
KP = 3.42
KI = 0.475
and
KD = 11.75
45
UPS&Inverter
The function of this controller is to keep the rail DC voltage at ±220V while
the system is supported by the battery.
Given that the rail voltage is a slow signal, the sampling frequency for this
control is decimated by 16 relative to the 20kHz (20kHz/16 = 1250Hz)
sampling frequency used in other sections of the system. The PWM switching
frequency is preserved at 20 kHz.
The system is implemented with a PID compensator in order to regulate the rail
DC voltage. The control output modulates the duty cycle of a push-pull power
supply. The following are the parameters of such a controller:
Using the backward difference method yields the following discrete time
equivalent system:
46
UPS&Inverter
with:
KP = 16
KI = 0.2
and
KD = 0.1
The triangular signal used as a carrier wave for the PWM is created from a
counter that accumulates at the controller’s clock speed (60MHz). The pulse
width of the PWM is updated at a rate of 20 kHz. This implies that in order to
obtain both the 20kHz sampling frequency and a symmetric triangle wave, this
counter must count from zero to 1500, then count back from 1500 to zero:
Given that the PWM(s) update their value when the PWM load command is
given to the PWM peripheral, the delay from the time elapsed between the
sampling of the signal and the update of the PWM compare values should be
minimized, enhancing the system’s stability. The implementation of this delay
and the relationship between the PWM reference and the ADC conversion is
fully explained in Section 7..
47
UPS&Inverter
1.6.1 Delay_Timer_OnInterrupt
This routine merely counts 21 times 140ms (the time interval of the timer) in
order to generate a time delay of 3 seconds following the controller’s core
start-up. This is a wait time to allow the auxiliary power supplies to stabilize.
The timing of the program originates at the PWM, configured for one complete
cycle reload, and center-aligned. The modulo of the PWM is set to 1500,
generating a 20 kHz triangle wave from the 60MHz internal bus clock.
The SYNC signal of the PWM is passed to Timer C2 to provide the sync signal
to the ADCA peripheral. At Timer C2, the SYNC signal is delayed in order to
reduce the time between the sampling and the updating of the values at the
48
UPS&Inverter
After the configured delay, Timer C2 signals the ADCs to start conversion. At
the end of the conversion, the ADC module interrupts the core processor. All
control loops are executed in this interruption.
The control network for the inverter is constructed with an inner current PI
control loop and an outer PID control loop as shown in Figure 45
The outer control loop receives the sinusoidal wave synthesized by the PLL
module as a reference and compares it with the inverter output voltage. The
error signal passes through a PID compensator whose output constitutes the set
point for the inner PI control loop. This current set point is compared with the
load current.
49
UPS&Inverter
The transfer function of a discrete time PID control loop is calculated by this
equation:
The sine wave generated is used as the set point of the inverter control. The
inverter uses the output voltage and current as sensing inputs to the control,
which have a double control loop topology, inner PI current control and outer
PID voltage control. Figure 45 shows the details of the inverter loop as
implemented in the source code. Signal names are the actual variable names in
the C code.
50
UPS&Inverter
Figure 46 shows the actual function implementation of the PFC control loop. It
consists of two controls, one to control the rail-to-rail voltage and another to
control the current drawn to the AC main line. The current set point for the
inner loop is the AC line voltage times a factor linearly proportional to the
error signal at the rails (and finally dependent on the UPS load current). The
hardware implementation in this UPS (please refer to Figure 46) requires the
inner control to work with the absolute values of the signals in order to avoid
discontinuities at the current control output. Both control loops use
Proportional–Integral (PI) compensators, implemented with 32-bit integrators.
The Z domain transfer function of a PI compensator is:
Where:
KP is the proportional gain
KI is the integral gain A total gain, KT, is implemented in order to
allow flexibility when tuning the control; i.e., varying the total loop gain
without the necessity of modifying the individual gains.
51
UPS&Inverter
The battery booster control signals for the switches are not complementary but
180° phase shifted. This is implemented at PWMA channels 2 and 3, defining
the compare value of channel 3 as 1500 (the full scale of the PWM) minus the
compare value of channel 2, and inverting its output. A protection time of 4ms
is implemented between the active state of these signals at maximum duty
cycle.
Decimation by 16 is implemented for a routine sample frequency of 1250Hz.
Figure 47shows the battery booster system.
52
UPS&Inverter
The battery charger is a constant current power supply. The control loop uses
the measured battery current to calculate the appropriate voltage set point.
Decimation of the sampling rate by 16 allows for better precision for the
battery voltage variable. The variables are sensed at 20 kHz, but the battery
voltage routine is executed at 20 kHz/16 = 1250Hz. Moving averaging of the
samples is implemented for noise filtering.
Due to the slow speed of the system, the integrator input of the voltage control
is disabled when the output of the controls reaches a defined limit.
Please see Figure 48 for a detailed diagram of the battery charger system
53
UPS&Inverter
54
UPS&Inverter
Figure 49 SCR Control Signal Generation at the Beginning and End of the Rectifier Soft Start
55