View detail for AN-641: Single-Phase Energy Metering IC

Single-Phase Energy
Metering IC Application Note
90E21/22/23/24
AN-641
Table of Contents
1 Application Outline............................................................................................................................. 2
2 Hardware Reference Design ............................................................................................................. 3
2.1 Schematics .................................................................................................................................................................... 3
2.2 Component BOM ........................................................................................................................................................... 4
2.3 PCB................................................................................................................................................................................ 5
3 Interface............................................................................................................................................. 6
3.1 SPI Interface .................................................................................................................................................................. 6
3.1.1 SPI Outline .............................................................................................................................................................. 6
3.1.2 SPI Interface Code .................................................................................................................................................. 7
3.2 Application of WarnOut and IRQ.................................................................................................................................. 11
3.2.1 Metering Parameter Error Alarm ........................................................................................................................... 11
3.2.2 Voltage Sag........................................................................................................................................................... 11
3.2.3 Measurement Parameter Error Alarm ................................................................................................................... 11
3.2.4 Active/Reactive Energy Direction Change ............................................................................................................ 11
3.2.5 Toggle of L Line and N Line .................................................................................................................................. 11
4 Calibration........................................................................................................................................ 12
4.1 Calibration Method....................................................................................................................................................... 12
4.2 Calibration Example..................................................................................................................................................... 12
4.2.1 Configure Calibration Start Command Register and Checksum 1 Register.......................................................... 12
4.2.2 PL_Constant Calculation and Configuration ......................................................................................................... 12
4.2.3 MMode Register Configuration.............................................................................................................................. 12
4.2.4 L Line Calibration .................................................................................................................................................. 13
4.2.5 N Line Calibration.................................................................................................................................................. 14
5 Others .............................................................................................................................................. 15
5.1 Acceleration of Verification at Low Current State......................................................................................................... 15
5.2 Treatment When Current Exceeds 65.535A ................................................................................................................ 15
5.3 Application of LastSPIData .......................................................................................................................................... 15
5.3.1 SPI Read ............................................................................................................................................................... 15
5.3.2 SPI Write ............................................................................................................................................................... 15
1
March 27, 2013
DSC-7278/2
Single-Phase Energy Metering IC Application Note
1
AN-641
APPLICATION OUTLINE
The 90E21/22/23/24 has highly stable on-chip reference power
supply. Different from competitor’s products, the 90E21/22/23/24
requires only a 1μF SMT capacitor to connect to the Vref pin. Considering the characteristics under high frequency, it is suggested to also
add a 1nF capacitor to the Vref.
This document describes system application issues when using the
90E21/22/23/24, single-phase energy metering ICs to design singlephase energy meters. The 90E21/22/23/24 series includes 4 chips,
which share similar characteristics in application.
The 90E21/22/23/24 provides the active energy pulse output pin CF1
and the reactive energy pulse output pin CF2, which can be used for
energy calibration. The CF1/CF2 pin can also be connected to the MCU
for energy accumulation. The maximum source/sink current for the CF1/
CF2 pins is 10mA which can turn on the energy pulse light and drive the
optocoupler (even when the energy pulse light and the optocoupler are
in parallel with each other).
Generally, a single-phase smart meter consists of a single-phase
energy metering IC, an MCU processor and its peripheral equipments.
Section 2.1 Schematics provides the schematics of a energy meter
using the 90E21/22/23/24. MCU reads and writes data of the metering
IC through the SPI interface. Considering low-cost and anti-tampering
etc., ground of the single-phase energy metering IC is generally
connected to the phase line (L line) of the single phase power supply.
MCU can be isolated from the metering IC by optocoupler. While in
cases when the end user does not touch the internal components of the
energy meter, ground of the MCU can also be connected to the phase
line and MCU connects to the metering IC directly.
The 90E21/22/23/24 provides programmable voltage zero-crossing
pin ZX which can be used by MCU to complete operations such as
power line carrier sending and relay operation.
The 90E21/22/23/24 provides the independent metering parameter
error warning output pin WarnOut. When there is any metering parameter error, the WarnOut pin outputs high level to remind MCU to reset the
90E21/22/23/24 and reload the metering parameters. In addition, the
90E21/22/23/24 also has voltage sag warning function. The WarnOut
pin outputs high level when there is voltage sag provided the SagWo bit
(FuncEn, 02H) enables voltage sag warning output through the WarnOut
pin.
In a typical application, shunt resistor is generally used for phase line
(L line) current sampling. To ensure isolation between phase line (L line)
and neutral line (N line), Current Transformer (CT) is generally used for
N line current sampling. While resistor divider network can be used for
voltage sampling.
The 90E21/22/23/24 uses 3.3V single power supply. In the reference
design, the AC voltage output by the transformer is rectified by a diode
then passes through the regulator 78L33 and forms 3.3V linear power
supply. The 3.3V linear power supply is then directly connected to digital
power DVDD of the 90E21/22/23/24 after being decoupled by the
capacitors. The analog power AVDD is connected to DVDD via a 10Ω
resistor. The 90E21/22/23/24 has a power-on reset circuit and the Reset
pin can connect to DVDD directly.
Application Outline
The 90E21/22/23/24 provides a dedicated interrupt request output
pin IRQ. The IRQ pin outputs high level when there is any metering /
measurement parameter error, active/ reactive energy direction change,
voltage sag, metering line change in anti-tampering mode, etc.
The maximum source current for the above ZX, WarnOut and IRQ
pins is 5mA. In application when MCU is isolated from the 90E21/22/23/
24, these pins can directly drive the optocouplers.
2
March 27, 2013
Hardware Reference Design
1
L
Phase Line
3
3
Neutral Line
4
1
Shunt
N
N Current Sampling
5(100)A/5mA
Class 0.1
CT
L Current Sampling
L
100Ω
100Ω
R16
120kΩ
R17
120kΩ
C10
33nF
C9
33nF
C8
330nF
C6
330nF
2
Voltage Sampling
R14
R15
120kΩ 120kΩ
R10 1kΩ
R9
2.4Ω
R7
2.4Ω
R6 1kΩ
R4
R2
Power for RS485
6
TD35-18A-220V
8
7
R18
120kΩ
I2N
I2P
I1P
I1N
R19
120kΩ
220μF/35V
C1
D1 4007
120kΩ
R13
0.1μF
C7
R1
10Ω
DVDD
R20
1kΩ
C3
0.1μF
3
33nF
C14
C11
1μF
OUT
78L33
C12
1nF
Vref
I1N
14
13
12
11
10
9
7
8
6
5
4
3
2
1
I2N
I1P
C2
J4
J3
SDI
I1N
U1
CF1
VN
VP
WarnOut
90E24
AGND
Vref
NC
CF2
IRQ
NC
I1P
ZX
OSCI
OSCO
CS
SCLK
SDO
I2N
I2P
AGND
AVDD
RESET
DVDD
DGND
MMD1 MMD0
J2
DVDD
J1
DVDD
100μF/10V
1
I2P
AVDD
C5
0.1μF
IN
U2
3
IRQ
18
15
16
17
X1
8.192MHz
WarnOut
IRQ
ZX
CS
SCLK
SDI
SDO
R11
C13 1kΩ
33nF
VN
VP
WarnOut
CF1
CF2
20
19
ZX
OSCI
21
22
CS
OSCO
24
SCLK
SDI
SDO
23
25
26
27
28
C4
0.1μF
D3
D2
CF1
R8
510Ω
4
kWh-
kWh+
Pulse to MCU
kvarh-
kvarh+
Pulse to MCU
510Ω
PS2501L-1
510Ω
kWh
R3
CF2
PS2501L-1
R12 510Ω
U4
R5
U3
kvarh
D
C
B
A
SCHEMATICS
2
1
TC1
3
Power for MCU
4
2.1
D
L line
RV1
20K681
RT1 SPMZB-4(400Ω~700Ω)
5
9
GND
2
3
HARDWARE REFERENCE DESIGN
C
B
A
N
2
2
Pulses for Calibration
Pulses for Calibration
N Line
1
Single-Phase Energy Metering IC Application Note
AN-641
March 27, 2013
Single-Phase Energy Metering IC Application Note
2.2
AN-641
COMPONENT BOM
Table-1 Component BOM
Component Type
Designator
Quantity
Parameter
Tolerance
SMT Capacitor
C12
C9 C10 C13 C14
C3 C4 C5 C7
1
4
4
0603 1nF
0603 33nF
0603 0.1μF
±10% X7R
±10% X7R
±10% X7R
C6 C8
C11
C2
C1
R7 R9
R1
R2 R4
R3 R5 R8 R12
R6 R10 R11 R20
R13 R14 R15 R16 R17 R18
R19
D1
U3 U4
X1
2
1
1
1
2
1
2
4
4
7
0603 0.33μF
0603 1μF
100μF/10V
220μF/35V
0603 2.4Ω
0603 10Ω
0603 100Ω
0603 510Ω
0603 1kΩ
0805 120kΩ
±10% X7R
±10% X7R
±5% 1/8W 100ppm
±5% 1/8W 100ppm
±5% 1/8W 100ppm
±5% 1/8W 100ppm
±5% 1/8W 100ppm
±5% 1/8W 100ppm
1
2
1
1N4007
NEC2501
8.192MHz
100ppm
U1
U2
D2 D3
TC1
RV1
RT1
1
1
2
1
1
1
90E24
78L33 TO-92
Red Φ3
-
Electrolytic Capacitors
SMT Resistor
SMT Diode
Optocoupler
Crystal
IC
LED
Regulator
Varistor
Thermal Resistor
Hardware Reference Design
20K681
SPMZB-4
(400Ω ~ 700Ω)
4
March 27, 2013
Single-Phase Energy Metering IC Application Note
2.3
AN-641
PCB
Figure-2 Bottom View
Figure-1 Top View
Figure-3 Energy Meter
Hardware Reference Design
5
March 27, 2013
Single-Phase Energy Metering IC Application Note
3
INTERFACE
3.1
SPI INTERFACE
3.1.1
SPI OUTLINE
AN-641
Energy Pulses CFx: CFx does not need to connect to an MCU pin.
Instead, energy can be accumulated by reading values in the corresponding energy registers. CFx can also connect to the optocoupler and
the energy pulse light can be turned on by CFx. As the energy registers
are cleared after read and the SPI reading process could be disturbed, it
is suggested to read the LastSPIData register (06H) after reading the
energy registers for confirmation.
The interface to MCU is a standard 4-wire SPI or simplified 3-wire
SPI. The highest rate is 160kbps and the lowest rate is 200bps. MCU
can perform read and write operations through low speed optocoupler
when the 90E21/22/23/24 is isolated from the MCU.
Fatal Error WarnOut: Fatal error can be acquired by reading the CalErr[1:0] bits (SysStatus, 01H).
When the MCU resources are limited, especially when the metering
part is isolated from the MCU (e.g. IC card prepaid meter), 3-wire SPI
can reduce the cost of optocoupler, using SCLK, SDI and SDO of the
SPI interface. When the 90E21/22/23/24 is isolated from MCU, the realization of the related functions is as follows:
Interface
IRQ: IRQ interrupt can be acquired by reading the SysStatus register
(01H).
Reset: The 90E21/22/23/24 is reset when ‘789AH’ is written to the
software reset register (SoftReset, 00H).
6
March 27, 2013
Single-Phase Energy Metering IC Application Note
3.1.2
AN-641
SPI INTERFACE CODE
The reference code of the standard 4-wire SPI interface shown in this section is written using PIC 8-bit microcontroller from MicroChip. Taking into
account of the habits of most users, it adopts software to simulate the SPI interface.
The SDO pin of the 90E21/22/23/24 corresponds to the SDI pin of MCU, and the SDI pin of the 90E21/22/23/24 corresponds to the SDO pin of
MCU. In this section, the SDI/SDO pins are defined from the perspective of MCU, that is, BIO_CS, BIO_SCK, BIO_SDI, BIO_SDO in below SPI interface codes correspond to the CS, SCLK, SDO and SDI pins respectively.
;=====================================================================
;subroutine name: single_wr
;Function: Write a register via the SPI interface
;input parameters:
;
spiaddr: the address of the register to be written
;
data to be written: 2 bytes data of fsr pointed, higher byte data in lower address
;output parameters:
;
fsr=fsr+01h
;
;registers influenced: fsr, spiaddr, temp0, temp1
;stack: 1
;=====================================================================
single_wr:
;Enable SPI
bcf
BIO_CS
goto
$+1
;time delay=2 NOP
bcf
spiaddr,7
;write command is 0
;Send 8-bit Command/addr
movlw 08h
movwf temp0
SpiWriteOutputAddrLoop:
rlf
spiaddr,f
btfss
status,c
goto
SpiWriteOutputAddrLow
call
SpiDoutHi
goto
SpiWriteOutputAddrLoop_next
SpiWriteOutputAddrLow:
call
SpiDoutLow
SpiWriteOutputAddrLoop_next:
decfsz temp0,f
goto
SpiWriteOutputAddrLoop
;c=0, bit=0, Output low
;c=1, bit=1, Output high
;Begin Send 16-bit Data
movf
indf,w
movwf temp1
movlw
movwf
SpiWriteHighByteLoop:
rlf
btfss
goto
call
goto
SpiWriteHighByteLow:
call
SpiWriteHighByteLoop_next:
decfsz
goto
incf
movf
movwf
Interface
;move high byte data to temp1
08h
temp0
;high byte data write
temp1,f
status,c
SpiWriteHighByteLow
SpiDoutHi
SpiWriteHighByteLoop_next
;c=0, bit=0, Output low
;c=1, bit=1, Output high
SpiDoutLow
temp0,f
SpiWriteHighByteLoop
fsr,f
indf,w
temp1
;move low byte data to temp1
7
March 27, 2013
Single-Phase Energy Metering IC Application Note
movlw
movwf
SpiWriteLowByteLoop:
rlf
btfss
goto
call
goto
AN-641
08h
temp0
;low byte data write
temp1,f
status,c
SpiWriteLowByteLow
SpiDoutHi
SpiWriteLowByteLoop_next
;c=0, bit=0, Output low
;c=1, bit=1, Output high
SpiWriteLowByteLow:
call
SpiDoutLow
SpiWriteLowByteLoop_next:
decfsz temp0,f
goto
SpiWriteLowByteLoop
bsf
return
BIO_CS
;disable SPI, SPI single write end
;=====================================================================
; subroutine name: single_rd
;Function:read a register via the SPI interface
;input parameters:
;
spiaddr: the address of the register to be read
;
readout 2 bytes data to be stored at address fsr pointed, higher byte data in lower address
;output parameters
;
fsr=fsr+01h, readout 2 bytes data to be stored at address fsr pointed
;registers influenced:
;
fsr, temp0, spiaddr
;stack: 1
;=====================================================================
single_rd:
;Enable SPI
bcf
BIO_CS
goto
$+1
;time delay=2 NOP
bsf
spiaddr,7
;read command is 1
;Send 8 bits Command/addr
movlw 08h
movwf temp0
SpiReadOutputAddrLoop:
rlf
spiaddr,f
btfss
status,c
goto
SpiReadOutputAddrLow
call
SpiDoutHi
goto
SpiReadOutputAddrLoop_next
SpiReadOutputAddrLow:
call
SpiDoutLow
SpiReadOutputAddrLoop_next:
decfsz temp0,f
goto
SpiReadOutputAddrLoop
bcf
goto
bcf
;c=0, bit=0, Output low
;c=1, bit=1, Output high
BIO_SDO
$+1
BIO_SCK
;do not care SDO pin when reading
;time delay=2 NOP
;begin read 16bits data
movlw 08h
movwf temp0
SpiReadHighByteLoop:
bcf
bsf
Interface
;high byte data read
;assume SDI data is low(0)
;read data on the rising edge
status,c
BIO_SCK
8
March 27, 2013
Single-Phase Energy Metering IC Application Note
AN-641
goto
$+1
goto
$+1
btfsc BIO_SDI
bsf
status,c
;time delay=4 NOP
rlf
goto
bcf
indf,f
$+1
BIO_SCK
;shift data to the target register
decfsz
goto
temp0,f
SpiReadHighByteLoop
incf
fsr,f
movlw
movwf
SpiReadLowByteLoop:
bcf
bsf
goto
goto
btfsc
bsf
;read SDI pin state
;SDI pin is high(1)
07h
temp0
;low byte data read: high 7 bits of lower byte
;assume SDI data is low(0)
;read data on the rising edge
;time delay=4 NOP
status,c
BIO_SCK
$+1
$+1
BIO_SDI
status,c
rlf
goto
bcf
indf,f
$+1
BIO_SCK
decfsz
goto
temp0,f
SpiReadLowByteLoop
goto
goto
$+1
$+1
;read SDI pin state
;SDI pin is high(1)
;shift data to the target register
;begin read lowest bit of lower byte
bcf
status,c
bsf
BIO_SCK
goto
$+1
goto
$+1
btfsc
BIO_SDI
bsf
status,c
;assume SDI data is low(0)
;read data on the rising edge
;time delay=4 NOP
;read SDI pin state
;SDI pin is high(1)
rlf
indf,f
;shift data to the target register
goto
bsf
return
$+1
BIO_CS
;disable SPI, SCK keeps high when SPI read end
;=====================================================================
;subroutine name: SpiDoutHi
;Function: Output high level at SDO pin
;input parameters: N/A
;output parameters: N/A
;stack: 0
;=====================================================================
SpiDoutHi:
bcf
BIO_SCK
;pull down SCLK
goto
$+1
goto
$+1
Interface
bsf
goto
goto
BIO_SDO
$+1
$+1
;pull up SDO after 4 NOP delay
bsf
BIO_SCK
;pull up SCLK after 4 NOP delay
9
March 27, 2013
Single-Phase Energy Metering IC Application Note
AN-641
return
;=====================================================================
;subroutine name: SpiDoutLow
;Function: Output low level at SDO pin
;input parameters: N/A
;output parameters: N/A
;stack: 0
;=====================================================================
SpiDoutLow:
bcf
BIO_SCK
;pull down SCLK
goto
$+1
goto
$+1
Interface
bcf
goto
goto
BIO_SDO
$+1
$+1
;pull down SDO after 4 NOP delay
bsf
return
BIO_SCK
;pull up SCLK after 4 NOP delay
10
March 27, 2013
Single-Phase Energy Metering IC Application Note
3.2
AN-641
APPLICATION OF WARNOUT AND IRQ
3.2.3
The 90E21/22/23/24 only checks the correctness of the measurement parameters when the AdjStart register (30H) is 8765H. If the
measurement parameters are not correct, the measurement registers
(48H-4FH and 68H-6FH) do not update, the AdjErr[1:0] bits (SysStatus,
01H) are set and the IRQ pin reports interrupt. It is noted that the
measurement parameter error alarm can not be configured as disabled.
All functions of the WarnOut pin are covered by the IRQ pin.
However, the WarnOut pin can locate abnormal events more rapidly.
3.2.1
METERING PARAMETER ERROR ALARM
The 90E21/22/23/24 only checks the correctness of the metering
parameters when the CalStart register (20H) is 8765H. If the metering
parameters are not correct, the metering function of the 90E21/22/23/24
is disabled, the CalErr[1:0] bits (SysStatus, 01H) are set and the
WarnOut/IRQ pins report warning/interrupt at the same time. In this situation, the MCU should first reset the 90E21/22/23/24, then reload the
calibration parameters. It is noted that the metering parameter error
alarm can not be configured as disabled.
3.2.2
3.2.4
The 90E21/22/23/24 detects voltage sag based on instantaneous
value of the voltage. Comparing with the traditional means of evaluating
the DC voltage after rectification, the 90E21/22/23/24 can detect voltage
sag earlier as there is no lag effect by the Electrolytic Capacitor to maintain the voltage. Voltage sag is detected when there are no 3 sampling
points whose voltage is above the voltage sag threshold within one
cycle. Voltage sag is detected when voltage is continuously below the
voltage sag threshold for one cycle which starts from any zero-crossing
point.
In application it is suggested to read the RevP/RevQ bit (EnStatus,
46H) to acquire the current direction of the active/reactive energy as
there are cases when the SPI process is disturbed and the direction
change is missed. Detailed operation is as follows: MCU reads the
EnStatus register (46H) for a fixed interval such as 1s. If there is no
change with the RevP/RevQ bit, only read the value of the energy
register of the current direction. If there is any change with the RevP/
RevQ bit, read both the active and reactive energy registers.
Voltage sag detection is disabled by default after power-on reset.
Voltage sag detection can be enabled by configuring the FuncEn (02H)
and SagTh (03H) registers. When there is voltage sag, the SagWarn bit
(SysStatus, 01H) is set and the IRQ pin outputs high level. Voltage sag
can be reported by the WarnOut pin at the same time in order to locate
abnormal events more rapidly.
In addition, the 90E21/22/23/24 provides absolute active/reactive
energy registers to meet the needs of absolute value of active/reactive
energy in some cases. CFx can be configured correspondingly to realize
consistency between CFx output and the absolute active energy register
(ATenergy,42H)/ absolute reactive energy register (RTenergy, 45H).
Configuration of voltage sag:
The power-on value of SagTh is:
22000 * 2 * 0.78
4 * U gain /32768
3.2.5
it corresponds to 1D6AH.
TOGGLE OF L LINE AND N LINE
In anti-tampering mode, when the metering line changes from L line
to N line, or changes from N line to L line, MCU can acquire the change
in a timely manner by the following means:
1 When L line and N line toggles, the LNchange bit
(SysStatus,01H) is set and the IRQ pin outputs high level.
MCU can then read the SysStatus register (01H) after receipt
of the interrupt reported by the IRQ pin. As the SysStatus
register (01H) is cleared after read, it is suggested to read the
LastSPIData register (06H) for confirmation.
2 MCU can also read the LLine bit (EnStatus, 46H) to acquire
the current metering line.
Users can calculate voltage sag threshold based on the percentage
(x%) of the voltage sag threshold with regards to the reference voltage
Un in application. The equation is:
Interface
ACTIVE/REACTIVE ENERGY DIRECTION CHANGE
There is no dedicated pin to indicate the change of the direction of
active/reactive energy. However, MCU can acquire the change in a
timely manner by the following means:
1 MCU reads the SysStatus register (01H) to check if there is
any change of the direction when the IRQ pin reports high
level. As the SysStatus register (01H) is cleared after read, it
is suggested to read the LastSPIData register (06H) for confirmation. This active/reactive energy direction change interrupt
can be enabled/disabled by the RevQEn/RevPEn bit (FuncEn,
02H).
2 MCU reads the RevP/RevQ bit (EnStatus, 46H) to acquire the
current direction of the active/reactive energy. The RevP bit is
updated after each CF1 pulse outputs and the RevQ bit is
updated after each CF2 pulse outputs.
VOLTAGE SAG
SagTh =
MEASUREMENT PARAMETER ERROR ALARM
100 * U n * 2
× x%
4 * U gain /32768
11
March 27, 2013
Single-Phase Energy Metering IC Application Note
4
CALIBRATION
4.1
CALIBRATION METHOD
AN-641
CalStart register (20H). Note that the readout value of the CS1 register
(2CH) might not be the same as the one that is written.
Normally the CS1 register (2CH) should be written during calibration.
It is fine to read the CS1 register (2CH) first then write the readout value
to the CS1 register (2CH).
Metering Calibration
Only single-point calibration is needed over the entire dynamic range
4.2.2
Metering calibration is realized by first calibrating gain at unity power
factor and then calibrating phase angle compensation at 0.5 inductive
power factor.
PL_CONSTANT CALCULATION AND CONFIGURATION
PL_Constant is determined by L line hardware parameters.
PL_Constant is calculated as follows:
However, due to very small signal in L line current sampling circuits,
any external interference, e.g., a tens of nano volts influence voltage on
shunt resistor conducted by transformer in the energy meter’s power
supply may cause perceptible metering error, especially in low current
state. For this nearly constant external interference, the 90E21/22/23/24
also provides power offset compensation.
PL_Constant = int(838860800 *
GL * VL * VU
)
MC * Un * Ib
MC: pulse constant of the energy meter, unit is imp/kWh or imp/
kvarh;
Un: reference voltage, unit is V;
L line and N line need to be calibrated sequentially. Reactive does
not need to be calibrated.
Ib: basic current, unit is A;
Measurement Calibration
GL: L line current circuit gain;
Measurement calibration is realized by calibrating the gains for voltage rms and current rms. Considering the possible nonlinearity around
zero caused by external components, the chip also provides offset compensation for voltage rms, current rms, mean active power and mean
reactive power.
VL: sampling voltage of the L line circuit at Ib, unit is mV;
VU: sampling voltage of the voltage circuit at Un, unit is mV;
838860800: constant.
Before configuring PL_Constant, 5678H should be written to the
CalStart register (20H) to start up calibration. Registers 21H-2BH then
resume to their power-on values.
Frequency, phase angle and power factor do not need calibration.
4.2
CALIBRATION EXAMPLE
Example:
4.2.1 CONFIGURE CALIBRATION START COMMAND REGISTER
AND CHECKSUM 1 REGISTER
Assume MC=3200 imp/kWh
All metering registers are in 20H-2CH. Among them, the calibration
start command register (CalStart,20H) and the Checksum 1 Register
(CS1,2CH) are specially designed registers.
Un = 220V
Note that for the 90E21/22/23, all or part of the 25H/26H/29H/2AH
registers are not applicable and data written to these registers are
invalid.
GL=24
4.2.1.1
Ib = 5A
L line shunt resistor=200 μΩ, so VL=1mV
Voltage divider coefficient=880, so VU=250mV
Calibration Start Command Register (CalStart, 20H)
Unit of the sampling voltage of the voltage and current circuits is mV
The default value for the CalStart register (20H) is '6886H' after
power-on reset. It should be set to '5678H' when calibration is needed.
Then the 21H-2BH registers resume to their power-on values and the
90E21/22/23/24 starts to meter.
GL * VL * VU
MC * Un * Ib
= 1429876.36 = 15D174H
PL_Constant = 838860800 *
Generally after calibration, the CalStart register (20H) should be set
to '8765H'. The 90E21/22/23/24 checks the correctness of the 21H-2BH
registers. If correct, normal metering. If not correct, metering function is
disabled, the CalErr[1:0] bits (SysStatus, 01H) are set and the WarnOut/
IRQ pins report warning/interrupt.
4.2.1.2
'0015H' should be written to the PLconstH register (21H), and
'D174H' should be written to the PLconstL register.
Note that the PLconstH register (21H) takes effect after the PLconstL
register (22H) are configured.
Checksum 1 Register (CS1, 2CH)
4.2.3
The CS1 register (2CH) can be read through the SPI interface. The
readout value is the calculation by the 90E21/22/23/24 based on data in
the 21H-2BH registers. The calculation is independent of data in the
Calibration
MMODE REGISTER CONFIGURATION
The MMode register (2BH) should be configured according to hardware design.
L line gain Lgain[2:0]: bit 15-13
12
March 27, 2013
Single-Phase Energy Metering IC Application Note
AN-641
N line gain Ngain[1:0]: bit 12-11
4.2.4.2
metering line selection LNSel: bit 10
L line gain calibration is performed when power factor PF=1.0 and
the current is Ib.
HPF configuration DisHPF[1:0]: bit 9-8
L Line Gain Calibration
Assume the error output from the calibration bench is ε, then
CFx output for active/reactive power Amod/Rmod: bit 7-6
LRATIO = -ε/(1+ε)
zero-crossing mode Zxcon[1:0]: bit 5-4
L line gain calibration is
anti-tampering threshold Pthresh[3:0]: bit 3-0
LGain= Complementary (LRATIO* 2^15)
Example:
which is the complement of LRATIO* 2^15:
Hardware design configuration is:
Shunt resistor for sampling current in L line, gain is '24';
if LRATIO ≥ 0, LGain=int(LRATIO* 2^15)
CT for sampling current in N line, gain is '1';
if LRATIO < 0, LGain=int(2^16+ LRATIO* 2^15)
L line metering;
Example:
HPF is used;
Assume PF=1.0, current=Ib, ε=-13.78%, then
Forward (inductive) or reverse (capacitive) energy pulse output;
LRATIO= -ε/(1+ε)=0.159823707
All zero-crossing;
LGain= int(LRATIO* 2^15)=5237.10=1475H
Default threshold for anti-tampering mode.
That is, '1475H' should be written to the Lgain register (23H).
7C22H should be written to the MMode register (2BH).
4.2.4
4.2.4.1
4.2.4.3
L line angle calibration is performed when power factor PF=0.5L, the
current is Ib and the frequency is 50Hz.
L LINE CALIBRATION
Small-Power Mode and Power Offset Compensation
Assume the error output from the calibration bench is εL, then
Power offset compensation can be used to eliminate stationary noise
introduced by the external circuits in system design, such as coupling
noise on shunt resistor conducted by transformer in meter’s power
supply.
Angle = -εL*180/sqrt(3)/π
L line angle calibration is
LPhi= (εL*3763.74)
Power offset compensation is performed in small-power mode. The
register value of L line and N line active/reactive power in small-power
mode and normal mode are different. Their relationship is:
In this equation, 3763.74 is a constant, and LPhi is signed. LPhi is a
negative number when MSB is '1'.
Power in normal mode
Example:
= Power in small-power mode * 10 * Igain * Ugain / 2^42
L line gain is calibrated, PF=0.5L, current=Ib, frequency=50Hz, error
of the energy meter εL=0.95%
The following steps are recommended:
1 Disconnect the current circuit of the energy meter;
2 Write 'A987H' to the SmallPMod register (04H) to enter smallpower mode;
3 Read out L / N line active / reactive power in small-power mode
many times to get a mean value;
4 Write the complement of the above mean value to the corresponding L / N line active / reactive power offset registers;
5 Write any non-A987H value to the SmallPMod register (04H)
to exit small-power mode.
Angle= -εL*180/sqrt(3)/π
=-0.0095*180/ sqrt(3)/π=-0.31425747
LPhi=(εL*3763.74)
=0.0095*3763.74=35.75553=24H,
That is, '24H' should be written to the LPhi register (24H).
4.2.4.4 Startup Power/ Current Threshold and No-Load Power/
Current Threshold
Example:
Disconnect the current circuit of the energy meter, write 'A987H' to
the SmallPMod register (04H) to enter small-power mode. Readout L
line active power 5 times consecutively. The values are FFC4H, FFCAH,
FFCAH, FFDCH and FFC5H averaged as FFCBH. Then write the
complement 35H to the PoffsetL register (37H).
The definitions of the Active/Reactive Startup/No-load Power
Threshold registers (27H/28H/29H/2AH) are all the same. Below is an
example of the active power threshold.
Assume the active startup current is KS times of Ib (0.004 if 0.4%),
then
The same procedure goes for reactive power offset compensation. L
line reactive power offset register is QoffsetL (38H).
Calibration
L Line Angle Calibration
13
March 27, 2013
Single-Phase Energy Metering IC Application Note
AN-641
If the readout of L line current rms (Irms, 48H) is Cur_meaL, the
actual current rms is the basic current Ib, then the equation for Igain, the
current rms gain is:
PStartTh = int(93.2067556 * GL * VL * VU * K S )
Assume the active no-load current is KN times of Ib, then
Igain = int(31251*Ib Cur_mea L)
PNolTh = int(93.2067556 * GL * VL * VU * K N )
In the above equation, the unit for Ib is A, Cur_meaL is the readout
value of the Irms register (hex should be changed to decimal and
divided by 1000, unit is A), and 31251, or 7A13H, is the power-on value
of L line current rms gain register (IgainL, 32H).
In the above equations, the unit for VL and VU is mV, and 93.2067556
is a constant.
Example:
Assume startup current is 0.4% of Ib
Example:
The actual current rms Ib is 5.008A. Cur_meaL, the readout value of
the L line current rms is 1A58H, or 6.744A.
PNolTh = int(93.2067556 * GL * VL * VU * K S )
= 2236.962134 = 08BDH
Igain = int(31251*Ib Cur_mea L)
5.008
= int(31251 *
) = 23207 = 5AA7H
6.744
The configuration of the no-load power threshold is similar to that of
the startup power threshold.
4.2.4.5
Voltage rms Gain and L Line Current rms Gain
Note that it is not required to calibrate the current rms gain when
Igain is the power-on value. The equation is:
Calibration of voltage and current rms is performed at reference
voltage and basic current, and has no relationship with power factor PF.
So the calibration can be performed at PF=1.0, reference voltage Un
and basic current Ib. To simplify the process, the calibration of voltage
and current rms can be after 4.2.4.3 the calibration of angle.
Igain New = int(Igain Old *I b Cur_meaL )
The current offset calibration should be performed at reference
voltage and no current. Calibration is performed by reading the current,
multiplying it with the above Igain/2^16 and 2^8, calculating the complement and writing the result to the L line current offset register (IoffsetL,
35H).
Assume Vol_mea is the readout value of the Urms register (49H) and
reference voltage Un is the actual voltage, voltage rms gain Ugain is
calculated as:
Calibration of voltage offset is similar to that of current offset, but
voltage offset calibration is not applicable for self-powered meter.
Ugain = int(26400 * Un Vol_mea)
In the above equation, the unit of Un is V, Vol_mea is the readout
value of the Urms register (hex should be changed to decimal and
divided by 100, unit is V), and 26400 is the decimal of 6720H which is
the power-on value of the voltage rms gain register (Ugain, 31H).
4.2.5
4.2.5.1
Match of N Line and L Line Calibration
N line metering and L line metering share the same PL_Constant, the
same voltage and the same gain range (-50%~+50%) of registers
(Lgain, 23H) and (Ngain, 25H). Therefore, the L line and N line sampling
signals should be about the similar level after amplification of L line gain
Lgain [2:0] and N line gain Ngain [1:0]. If the N line current signal is too
small, N line gain can be adjusted, for example from '1' to '4'. If, however,
the N line current signal is too large even though the gain is only '1', the
load resistor of CT can be reduced.
Example:
The actual voltage Un is 220.024V. The readout value of the Urms
register Vol_mea is 6019H, or 246.01V.
Ugain = int(26400 * Un Vol_mea)
= int(26400* 220.024/246.01 = 23611 = 5C3BH
4.2.5.2
That is, 5C3BH should be written to the Ugain register (31H).
Calibration
Calibration of N line is similar to that of L line. Note that the power-on
value for the N Line Current rms Gain register (IgainN, 33H) is 7530H,
therefore the N line calibration equation is
Note that it is not required to calibrate the voltage rms gain when
Ugain is the power-on value. The equation is:
Ugain New = int(Ugain Old *U n Vol_mea )
Calibration
N LINE CALIBRATION
Igain = int(30000 * Ib Cur_mea N)
14
March 27, 2013
Single-Phase Energy Metering IC Application Note
5
AN-641
OTHERS
parameters such as active / reactive / apparent power have the same
multiple relationship with the corresponding actual power.
5.1 ACCELERATION OF VERIFICATION AT LOW
CURRENT STATE
5.3
The LastSPIData register (06H) stores the latest SPI read/write data.
The application of this register can improve the reliability of the SPI read/
write operation.
The acceleration of low current calibration can be achieved by MCU.
The 90E21/22/23/24 has good linearity at different PL_constant. It is
suggested to set PL_constant as a multiple of 4 because the acceleration is up to 4 times in low current calibration.
5.3.1
SPI READ
Generally, the SPI read reliability can be improved by reading the
target register first, then reading the LastSPIData register (06H), and
then comparing the two results. If the results are the same, the read
operation is considered to be correct. If the results are inconsistent, the
LastSPIData register (06H) should be read again to find out the correct
register value.
5.2 TREATMENT WHEN CURRENT EXCEEDS
65.535A
The current range of the current rms registers is 0 ~ 65.535A. When
the current exceeds 65.535A, it is suggested to be handled by MCU as
follows:
1 The register value of the Irms/Irms2 registers (48H/68H) can
be calibrated to be half of the actual current rms during calibration. For example, when Ib is 20A, the value of the Irms/Irms2
registers (48H/68H) can be calibrated to 10A for a 20(80)A
energy meter, that is, IgainL / IgainN is doubled. The multiple
relationships between the Irms/Irms2 registers (48H/68H) and
the actual value should be recorded in memory;
2 MCU automatically multiplies the Irms/Irms2 registers with 2
for applications such as display and communication.
The 90E21/22/23/24 has some read/clear registers, such as active /
reactive energy registers and system status register. When these registers are cleared after read, the LastSPIData register (06H) is updated.
This function is very useful in cases such as abnormal SCLK cycles.
5.3.2
SPI WRITE
SPI writes to registers only when the number of SCLK cycles is equal
to ‘24’. Generally, the SPI write reliability can be improved by writing to
the target register first, then reading the target register, and then
comparing the two results. If the results are the same, the write operation is considered to be correct. An alternative way is to write the target
register first, then read the LastSPIData register (06H), and then
compare the results.
As the current rms uses fiducial error in evaluation, 16-bit registers
are sufficient to guarantee measurement accuracy of 0.5%.
Note that if the Irms/Irms2 registers are calibrated to be half of the
actual current rms and doubled by MCU, the power measurement
Others
APPLICATION OF LASTSPIDATA
15
March 27, 2013