TIDUF72 August   2024

 

  1.   1
  2.   Description
  3.   Resources
  4.   Features
  5.   Applications
  6.   6
  7. 1System Description
    1. 1.1 Key System Specifications
    2. 1.2 End Equipment
    3. 1.3 Electricity Meter
    4. 1.4 Power Quality Meter, Power Quality Analyzer
  8. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
      1. 2.2.1 Magnetic Tamper Detection With TMAG5273 Linear 3D Hall-Effect Sensor
      2. 2.2.2 Analog Inputs of Standalone ADCs
      3. 2.2.3 Voltage Measurement Analog Front End
      4. 2.2.4 Analog Front End for Current Measurement
    3. 2.3 Highlighted Products
      1. 2.3.1 AMC131M03
      2. 2.3.2 ADS131M02
      3. 2.3.3 MSPM0G1106
      4. 2.3.4 TMAG5273
      5. 2.3.5 ISO6731
      6. 2.3.6 TRS3232E
      7. 2.3.7 TPS709
  9. 3Hardware, Software, Testing Requirements, and Test Results
    1. 3.1 Hardware Requirements
      1. 3.1.1  Software Requirements
      2. 3.1.2  UART for PC GUI Communication
      3. 3.1.3  Direct Memory Access (DMA)
      4. 3.1.4  ADC Setup
      5. 3.1.5  Foreground Process
      6. 3.1.6  Formulas
        1. 3.1.6.1 Standard Metrology Parameters
        2. 3.1.6.2 Power Quality Formulas
      7. 3.1.7  Background Process
      8. 3.1.8  Software Function per_sample_dsp()
      9. 3.1.9  Voltage and Current Signals
      10. 3.1.10 Pure Waveform Samples
      11. 3.1.11 Frequency Measurement and Cycle Tracking
      12. 3.1.12 LED Pulse Generation
      13. 3.1.13 Phase Compensation
    2. 3.2 Test Setup
      1. 3.2.1 Power Supply Options and Jumper Setting
      2. 3.2.2 Electricity Meter Metrology Accuracy Testing
      3. 3.2.3 Viewing Metrology Readings and Calibration
        1. 3.2.3.1 Calibrating and Viewing Results From PC
      4. 3.2.4 Calibration and FLASH Settings for MSPM0+ MCU
      5. 3.2.5 Gain Calibration
      6. 3.2.6 Voltage and Current Gain Calibration
      7. 3.2.7 Active Power Gain Calibration
      8. 3.2.8 Offset Calibration
      9. 3.2.9 Phase Calibration
    3. 3.3 Test Results
      1. 3.3.1 Energy Metrology Accuracy Results
  10. 4Design and Documentation Support
    1. 4.1 Design Files
      1. 4.1.1 Schematics
      2. 4.1.2 BOM
      3. 4.1.3 PCB Layout Recommendations
      4. 4.1.4 Layout Prints
      5. 4.1.5 Altium Project
      6. 4.1.6 Gerber Files
      7. 4.1.7 Assembly Drawings
    2. 4.2 Tools and Software
    3. 4.3 Documentation Support
    4. 4.4 Support Resources
    5. 4.5 Trademarks
  11. 5About the Authors

Foreground Process

The foreground process includes the initial setup of the MSPM0+ MCU hardware and software and the ADS131M02 and AMC131M03 registers immediately after a device RESET. Figure 3-1 shows the flowchart for this process.

TIDA-010944 Foreground Process Figure 3-2 Foreground Process

The initialization routines involve the setup of the MSPM0G3507:

  • General purpose input/output (GPIO) port pins
  • Clock system (MCLK or CPU clock, RTC clock, SPI clock, I2C clock, CLK_OUT pin)
  • 1 UART port
  • 4 DMA channels, one each per SPI receive and transmit and one each per UART receive and transmit
  • ADS131M02 and AMC131M03 registers
  • Metrology variables

After the hardware is set up, any received frames from the GUI are processed. Next, the foreground process checks whether the background process has notified the foreground process to calculate new metrology parameters for any voltage-current mappings. This notification is accomplished through the assertion of the PHASE_STATUS_NEW_LOG status flag whenever a frame of data is available for processing. The data frame consists of the processed dot products that were accumulated for CYCLES_PER_COMPUTATION number of cycles of data. The value for CYCLES_PER_COMPUTATION is 10 cycles when the nominal frequency setting in the software is 50Hz and 12 cycles when the nominal frequency setting in the software is set to 60Hz. When the measured line frequency is equal to the nominal frequency of the design, this is equivalent to 200 milliseconds of accumulated data.

The processed dot products include the VRMS, IRMS, active power, reactive power, fundamental voltage, fundamental active power, and fundamental reactive power. These dot products are used by the foreground process to calculate the corresponding metrology readings in real-world units. All the processed dot products are accumulated in separate 64-bit registers to further process and obtain the RMS and mean values. Using the calculated values of active and reactive power of the foreground process, the apparent power is calculated.

Similarly, using the calculated values of the foreground for the fundamental voltage, fundamental reactive power, and fundamental active power, the fundamental current, fundamental apparent power, voltage THD, and current THD are calculated. Additionally, voltage underdeviation and voltage overdeviation are calculated using the value of the calculated RMS voltage and the defined nominal voltage of the design. The frequency (in Hz) and power factor are also calculated using parameters calculated by the background process using the formulas in the Section 3.1.6.

The foreground process is also responsible for calculating the 1-cycle VRMS readings that are used to update the sag, swell, and interruption state logging variables. The 1-cycle VRMS readings are triggered by the background process after every negative-to-positive zero crossing. After the new VRMS reading, the following state variables are updated accordingly:

  • Swell variables
    • Swell_events: This variable logs the total number of swell events that have occurred since the design was first reset. The start of a swell event occurs whenever the 1-cycle RMS is above a user-defined sag. The end of a swell threshold event occurs when the 1-cycle RMS is below the user-defined swell threshold minus a user-defined hysteresis value.
    • Max_swell_value: This variable is the maximum 1-cycle RMS reading that was observed during the current ongoing swell event. If a swell event is not currently occurring, this variable represents the maximum 1-cycle RMS reading during the previously completed swell event.
    • Swell_duration: This variable logs the number of cycles during the current ongoing swell event. If a swell event is not currently occurring, this variable represents the duration of the previously completed swell event.
  • Sag Variables
    • Sag_events: This variable logs the total number of sag events that have occurred since the design was first reset. The start of a sag event occurs whenever the 1-cycle RMS is below a user-defined sag threshold but is still greater than the user-defined interruption threshold. The end of a sag event occurs when the 1-cycle RMS is above the user-defined sag threshold plus a user-defined hysteresis value.
    • Min_sag_value: This variable is the minimum 1-cycle RMS reading that was observed during the current ongoing sag event. If a sag event is not currently occurring, this variable represents the minimum 1-cycle RMS reading during the previously completed sag event.
    • Sag_duration: This variable logs the number of cycles during the current ongoing sag event. If a sag event is not currently occurring, this variable represents the duration of the previously completed sag event.
  • Interruption Variables
    • Interruption_events: This variable logs the total number of interruption events that have occurred since the design was first reset. The start of an interruption event occurs whenever the 1-cycle RMS is below a user-defined interruption threshold, which is lower than the sag voltage threshold.
    • Interruption_duration: This variable logs the number of cycles during the current ongoing sag event. If a sag event is not currently occurring, this variable represents the duration of the previously completed interruption event. This variable does not increment when there is no voltage applied to the design since there are no cycles to count; however, the absence of voltage is still able to be counted as an interruption event.

For the one-phase configuration, there are two voltage-current mappings, where each voltage-to-current mapping has a different voltage and current channel. Specifically, the line-to-neutral voltage measurement for line A and the line A current measurement are associated with each other for one mapping and the line B current measurement is used for neutral current monitoring (no voltage associated).

For the two-phase configuration, there are two voltage-current mappings, where Phase A and Phase B both share the voltage measured with ADS131M02. Specifically, the same line-to-line voltage measurement (180 degrees shift between the voltages on Phase A and Phase B) is associated with the line A and line B current measurements, on ADS131M02 and AMC131M03, respectively.

For simplicity, each voltage-to-current mapping is referred to as a phase in this document as well as in the PC GUI.