2.2.2 Multichannel Metrology Library - Core 1

Overview

The multichannel metrology library systematically acquires data from the signals connected to the MCP391x devices, designating each signal as a channel for the purpose of measuring electrical currents or voltages.

A power is defined as a pair of one voltage and one current channel.

The library's control registers offer users the capability to tailor the configuration of both channels and powers, ensuring an outstanding degree of adaptability. Standard configuration procedures include:
  • Selection of the MCP391x devices connected to the PIC32CXMTC MCU.
  • Configuring each channel to function as either a voltage or current measurement channel.
  • Determining the specific voltage and current channels that constitute each power measurement.

The library calculates various metrological parameters for both individual channels, such as root mean square and peak values, and powers, such as active and reactive power measurements.

The present version of the metrology library allows to manage up to 2 MCP3913 or 2 MCP3914 devices. In the future, more MCP391x models will be supported, and the number of managed devices will increase up to 4 units.

Analysis of the configuration alternatives available when utilizing 2 MCP3914 units:

  • The system features a total of 16 channels, with 8 channels allocated to each MCP3914.
  • Channel indexes 0 through 7 correspond to the MCP3914 linked to the CS0 signal.
  • Channel indexes 8 through 15 correspond to the MCP3914 linked to the CS1 signal.
  • Each channel can be configured as voltage or current channel.
  • The configuration of channels and powers is highly adaptable, supporting all the possible combinations.

Multichannel Metrology Library and Core 1 Resources Usage

The application running on Core 0 must consider that the multichannel 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 mutichannel metrology library are the following ones:
  • Core 1
  • SRAM1 and SRAM2
  • PWM peripheral
  • Multi-Channel Core 1 SPI (MCSPI)
  • GPIOs of the PORTD, such as the ones associated to the pulse outputs PD17, PD18, PD19
    Important: The use of PORTD on Core 0 applications is highly NOT recommended to avoid configuration conflicts between Core 0 application and the metrology library.
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 multichannel metrology firmware collects the raw data samples at 16 kHz (every 62.5 μs) from the Energy Metering AFE (MCP391x). The metrology library 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 and Currents
  • Pulse Output
  • Zero crossing detection and counting
  • Metrology DSP data capture for debugging and verifying algorithm

Integration Period Processing

The multichannel 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 multichannel metrology firmware supports a wide range of measurement quantities (and accumulations) including active and reactive energy, supply voltage and frequency. 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)

Constraints

All computed quantities available through the multichannel 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=128, 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.