71M6513 Harmonic Analysis


This application note discusses the ce13b13f, a custom compute engine (CE) firmware from Teridian. The ce13b13f supports the Teridian 71M6513, a 3-phase energy-metering system-on-chip (SoC), for harmonic analysis. The article describes the firmware’s many capabilities.


The compute engine firmware was developed to provide the following capabilities:

  1. Measurement of Wh, ISQh and VSQh information with harmonics and a separate Wh measurement register for the harmonic component. Two sets of registers are available simultaneously for meter harmonic analysis for Wh, current and voltage components.

    • The existing CE outputs, WSUM_X (0x42), W0SUM_X (0x43), WSUM1_X (0x44), and WSUM2_X (0x45) will be broadband Wh measurement registers
    • Four new output registers, WSUM_H_X (0x58), W0SUM_H_X (0x59), W1SUM_H_X (0x5A) and W2SUM_H_X (0x5B), will contain Wh information for the selected harmonic component.
    • Three new output registers, I0SQSUM_H_X (0x5C), I1SQSUM_H_X (0x5D) and I2SQSUM_H_X (0x5E), will contain ISQh information for the selected harmonic component.
    • Three new output registers, V0SQSUM_H_X (0x5f), V1SQSUM_H_X (0x60) and V2SQSUM_H_X (0x61), will contain VSQh information for the selected harmonic component.
  2. A new register to select the desired harmonic component for measurement NFREQ (0x63) was added.
  3. Only 3-phase 4-wire WYE (VA* IA + VB * IB + VC * IC) or 3-phase 3-wire (VA* IA + VB * IB) configurations are supported.
  4. Only one pulse output, the WPULSE output, is supported.

    1. This pulse output can be configured for various pulse outputs through the EXT_PULSE register. Please refer to the 71M6513 data sheet or the 71M6513 Demo Board User Manual (DBUM) for further details.
    2. The Wh pulse generator, when in internal mode, will output broadband Wh.
    3. The maximum pulse rate is 1260Hz.
  5. The neutral current measurement function is supported.
  6. The voltage-to-voltage phase angle measurement is supported.
  7. The line zero-crossing detection for RTC adjustment using the MainEdgeCount register is supported.
  8. The SAG detection for early power-fail warning for each phase voltage is supported.
  9. VARh information registers support broadband measurements only.

A block diagram of the CE firmware is shown on the following page.

The upgrade procedure and results of performance tests will be demonstrated on the pages that follow

Upgrading Meter Firmware

The following files are used to achieve the CE specifications listed above.

  1. CE13B13b.ce
  2. CE13B13b.dat
  3. CE13B13b_ce.c
  4. CE13B13b_dat.c

How to use these files:

One can easily upgrade the existing CE code to the new version by applying either of the following techniques:

  1. Using the CE_MERGE utility to upgrade the current hexadecimal file. That is, the existing CE files (*.ce and *.dat) files will be updated to the new hex file without modifying the existing hex file as documented in the Demo Board Users Manual (DBUM).
  2. Users of development systems (compiler, emulator) can include the files (*ce.c and *dat.c) and then rebuild the project in the compiler environment.

Caution: When upgrading to the new firmware, one should be cautious about the following:

  1. This CE firmware does not support VAR pulse output.
  2. The pulse rate is limited to a maximum of 1260Hz.
  3. The metering connections are limited to 3-phase 3-wire and 3-phase 4-wire WYE.

CE Code Details

In this section, the CE input and output registers used to control harmonics measurements are described

Input Register NFREQ (0x63)

The Compute Engine measures harmonic contents on voltage and current signals using a tracking band-pass filter whose center frequency is programmable via the NFREQ (0x63) register. When NFREQ = -1, the CE tunes the band-pass filter to the fundamental frequency of measurement and provides the data for the fundamental component only. The CE provides Wh, ISQSUM and VSQSUM data utilizing the band-pass filters.

Following is the formula for computing NFREQ register values for harmonic components:

where χ = 2-7
fs = 32768/13 (sampling frequency)
fpk = Center frequency

Overall, the CE code implements two meters:

  • One meter is our standard 3-phase meter with VAR measurement.
  • The other meter is a frequency-selectable meter that measures RMS values and Wh.

The second meter can either be a tracking meter centered at the fundamental frequency or a fixed-frequency meter centered at a frequency programmed by NFREQ. When NFREQ < 0, the meter is a tracking meter. When NFREQ > 0, the meter is centered on Fpk (Hz) according to the formula stated above.

NFREQ Values for 60Hz (left) and for 50Hz (right)

Note that even though the NFREQ register data can be determined by the formula for harmonic analysis stated above, the MPU firmware should use a look-up table for feeding the desired harmonic component to the compute engine.

Compute Engine Output Registers

The integration time is 1 second. Additionally, the hardware will not permit output values to ‘fold back’ upon overflow.

CE Address Name Description
0x42 WSUM_X The signed sum: W0SUM_X+W1SUM_X+W2SUM_X
0x43 W0SUM_X The sum of Watt samples from each wattmeter element.
LSB = 9.4045*10-13 VMAX IMAX / In_8 Wh.
0x44 W1SUM_X
0x45 W2SUM_X
0x46 VARSUM_X The signed sum: VAR0SUM_X+VAR1SUM_X+VAR2SUM_X
0x47 VAR0SUM_X The sum of VAR samples from each wattmeter element.
LSB = 9.4045*10-13 VMAX IMAX / In_8 VARh.
D15 D14
D15 D14
CE Address Name Description
0x33 FREQSEL Selected phase for the frequency monitor
Phase A: 0 (default)
Phase B: 1
Phase C: 2
0x41 FREQ_X Fundamental frequency.
0x4A I0SQSUM_X The sum of squared current samples from each element.
LSB = 9.4045*10-13 IMAX2 / In_82 A2 h
0x4D INSQSUM_X The sum of squared current samples from the calculated neutral:

LSB=7.5236*10-12 IMAX2 / In_82 A2 h
0x4E V0SQSUM_X The sum of VAR samples from each wattmeter element.
LSB = 9.4045*10-13 VMAX IMAX / In_8 VARh.
0x50 V2SQSUM_X

The RMS values can be computed by the MPU from the squared current and voltage samples as per the formulae:

Other Measurement Parameters

PH_AtoB_X is the phase angle between phase A and phase B. PH_AtoC_X is the phase angle between phase A and phase C. These measurements can be used for phase sequencing and error detection. If the voltage at phase A is missing, the phase angle accuracy will be reduced.

MAINEDGE_X is useful for implementing a real-time clock based on the input AC signal. MAINEDGE_X is the number of half-cycles accounted for in the last accumulated interval for the AC signal of the phase specified in the FREQSEL register.

CE Address Name Description
0x52 PH_AtoB_X Phase lag from VA to VB.
Angle in degrees is (0 to 360): PH_AtoB_X * 360/NACC + 2.4
0x53 PH_AtoC_X Phase lag from VA to VC.
Angle in degrees is (0 to 360): PH_AtoB_X * 360/NACC + 4.8
0x55 MAINEDGE_X The number of edge crossings of the selected voltage in the previous accumulation interval.
Edge crossings are either direction and are debounced.
CE Address Name Description
0x58 WSUM_H_X The signed sum: W0SUM_X+W1SUM_X+W2SUM_X
0x59 W0SUM_H_X The sum of Watt samples from each wattmeter element.
LSB = 9.4045*10-13 VMAX IMAX / In_8 Wh.
CE Address Name Description
0x5c I0SQSUM_H_X The sum of squared current samples from each element
LSB = 9.4045*10-13 IMAX2 / In_82 A2 h
0x5d I1SQSUM_H_X
0x5e I2SQSUM_H_X
0x5f V0SQSUM_H_X The sum of squared voltage samples from each element.
LSB= 9.4045*10-13 VMAX2 V2h

Performance of the New CE Firmware

Various signals were supplied to a meter that had been upgraded with the new CE firmware supporting harmonic measurements. In compliance with IEC 62052/ IEC 62053 and ANSI C12.20 metering standards, the voltage applied to the meter contained 20% of the fundamental harmonic components, and the current contained 40% of the fundamental harmonic components. The following tools were used to verify the performance:

  1. Fluke 6100A for phantom load with harmonic generation capability.
  2. Fluke pulse input for capturing the pulse output from the meter under test.

The following pages show measurement results obtained with the new CE code.

Harmonic Energy Measurement

240V, 50Hz, 40% of Fundamental on Current, 20% of Fundamental on Voltage

240V, 50Hz, 40% Fundamental on Current, 20% on Fundamental Voltage

240V, 50Hz, 40% fundamental on Current, 20% on Fundamental Voltage

240V, 60Hz, 40% fundamental on Current, 20% on Fundamental Voltage

Applied 240V, 60Hz, 40% Fundamental on Current, 20% on Fundamental Voltage

From the above table it can be seen that the W0SUM_H_X at harmonic #2 is about 8% of the fundamental energy (439171/5474411, or 8.02%). Also, one can see that the sum of the harmonic current and the fundamental current is equivalent to the broadband current (I0SQSUM_H_X + I0SQSUM_F = I0SQSUM_X). Similar considerations apply for the voltage measurements.


The capability of the 71M6513 with the new CE code for broadband and fundamental watt-hour measurement and individual harmonic component measurement capability for operation at 50Hz and 60Hz and their harmonics has been demonstrated.