Jump to main content

# 1.2.2 Metrology Library - Core 1

## Overview

The Metrology Library runs on the metrology coprocessor (Core 1). This processor acquires Voltage and Current data samples at a 16 kHz rate from the EMAFE. Then, calculates the meter energy consumption, monitors related line voltage conditions and generates, as output, an entire suite of metrology measurements at a configurable rate (1 Hz being the default value for the integration period), and also every mains line cycle, if configured to do so.

Key features:

- 16 kHz ADC sample rate
- Dynamic range 1:3000
- 4-quadrant measurement
- Discrete Fourier Transform (DFT) Harmonic measurement options
- Active and reactive energy accuracy: up to class 0.2, compliant with ANSI C12.20-2002 and IEC 62053-22
- Line frequency monitor and measurement
- Current transformer, Rogowski coil or Shunt for current sensing circuit implementation

## Metrology Library and Core 1 Resources Usage

The application running on Core 0 must consider that the metrology library uses resources of the Core 1 (core and peripherals). These resources must not be used by the application running on Core 0. The main resources used by the metrology library are the following ones:

- Core 1
- SRAM1 and SRAM2
- PWM peripheral
- EMAFE (only in PIC32CXMTSH)
- Multi-Channel Core 1 SPI (MCSPI)
- GPIOs of the PORTD, such as the ones associated to the pulse outputs PD17, PD18, PD19

CAUTION: Depending on the metrology library version, the resource usage may change, due to the implementation of new functionalities. Refer to the “PIC32CXMTx Metrology Reference Guide” (DS50003461) for additional information.

## Samples Processing

The metrology firmware collects the raw data samples at 16 kHz (every 62.5 μs) from the Energy Metering AFE. Metrology filters and decimates the data to 4 kHz (0.25 ms) to integrate and calculate all the output data measurements. The integration period is 1 second by default, but it can be configured as it is explained in the “PIC32CXMTx Metrology Reference Guide” (DS50003461).

Key features:

- Voltages (A, B, C)
- Currents (A, B, C, N (N-measured, N-imputed, N-measured to imputed))
- Calibration compensation (V, I and Phase)
- Pulse output
- Zero crossing detection and counting
- Metrology DSP data capture for debugging and verifying algorithm

## Integration Period Processing

The Metrology firmware collects the acquired raw data and converts it into scaled and integrated measurements at each integration period (by default 1 second, so having 50 or 60 power line cycles). The Metrology firmware supports a wide range of measurement quantities (and accumulations) including active and reactive energy, supply voltage and frequency, apparent power. Some quantities are derived from the fundamental plus harmonics, while other quantities are derived from the fundamental only:

- Total Energy and individual phases with harmonics (Wh)
- Total Quadergy and individual phases with harmonics (VArh)
- Power factor
- Total Harmonic Distortion (Power, Current and Voltage)
- Line Voltage Monitoring (Frequency, Sag, Voltage line to Line phase)
- Metrology status (On/Off, OK/Error, Swell/Sag Alarm)

## Per-Cycle Processing

The Metrology can be configured to do the same acquisition and integration as explained above for the integration period, but for every mains line cycle. This enables measurements calculations by the Metrology Driver at a higher rate, which is useful for certain Metering applications.

## Constraints

All computed quantities available through the Metrology firmware are integrated over a time interval equivalent to an integral number of periods of the fundamental frequency. All integration periods are approximated by the final output sample rate of the DSP filters, 4000 Hz. So, the measurement accuracy will increase using longer integration periods. One second is the recommended minimum integration period (50 cycles at 50 Hz or 60 cycles at 60 Hz), but fewer numbers of samples may still yield acceptable results. DSP filters require a settling time before accurate measurements may be used for revenue-quality metering. It is recommended to wait at least 250 ms after start-up when testing to revenue-grade accuracy.

## Assumptions and Dependencies

The Smart Meter DSP Module is specifically designed to accept samples from an Energy Metering AFE - Δ/Σ ADC using an OSR = 64, at an input sample rate of 16.000 kHz. This input data stream is filtered to an internal sample rate of 4.000 kHz for generation of metrology measurements. All computed metrology measurements are available at a rate of approximately 1 Hz when using default settings.

Rev: E