
2
2
± ,
RMS
RMS fund
THD
RMS fund
I
I
I
2
2
active fund
reactive fund
RMS fund
RMS fund
P
P
I
V
2
2
±
RMS
RMS fund
THD
RMS fund
V
V
V
V
pure( / 2)
1
1
( ) V
(i)
N
reactive fund
samp
P
PGAIN
I
i
N
S
u
u
¦
pure
1
1
( ) V
(i)
N
active fund
samp
P
PGAIN
I
i
N
u
u
¦
pure
1
( ) V
(i)
N
RMS fund
samp
i
V
VGAIN
V
i
N
u
u
¦
cos
active
apparent
P
PF
P
M
apparent
RMS
RMS
P
V
I
u
,90
1
1
N
reactive
samp
samp
i
P
PGAIN
V
(i) I
(i)
N
u
u
¦
1
1
N
active
samp
samp
i
P
PGAIN
V
(i) I
(i)
N
u
u
¦
1
1
( )
( )
N
RMS
samp
samp
i
I
IGAIN
I
i
I
i
N
u
u
¦
1
1
N
RMS
samp
samp
i
V
VGAIN
V
(i) V
(i)
N
u
u
¦
Metrology Computation Engine
•
Q1.15 fixed-point number multiply
•
16-bit square-and-accumulate into 48-bit accumulator
•
24-bit square-and-accumulate into 64-bit accumulator
5.4
Metrology Computation Engine
The metrology computation engine performs the actual sampling and computation based on the
information collected from the voltage and current ADC channels. The computation engine performs its
actions in a time critical background processing and a less time critical foreground processing.
The background processing is triggered by the ADC at the sample rate. It is running in the interrupt
services routine of the ADC and is processed automatically.
The foreground processing is triggered by the completion of background processing at the
reporting/update rate. Background process sets a flag PHASE_STATUS_NEW_LOG in variable
phase_state to indicate there is data ready to be processed by the foreground process. The application
then needs to monitor this flag to trigger the foreground process by calling to calculate_phase_readings().
In the actual computation, the following formulas are used in the metrology computation:
(11)
(12)
(13)
(14)
(15)
(16)
(17)
(18)
(19)
(20)
(21)
(22)
34
Firmware and Embedded Metering Library API
SLAU587 – August 2014
Copyright © 2014, Texas Instruments Incorporated