SBOA444 November   2020 TMCS1100

 

  1.   Trademarks
  2. 1Introduction
  3. 2Implementation Block Diagram
  4. 3Hardware Implemenation
    1. 3.1 Analog Inputs
      1. 3.1.1 Voltage Measurement Analog Front End
      2. 3.1.2 Current Measurement Analog Front End
    2. 3.2 MSP432 LaunchPad Connections
    3. 3.3 PCB Layout Recommendations
  5. 4How to Implement Software for Metrology Testing
    1. 4.1 Setup
      1. 4.1.1 Clock
      2. 4.1.2 UART Setup for GUI Communication
      3. 4.1.3 Real-Time Clock (RTC)
      4. 4.1.4 Direct Memory Access (DMA)
      5. 4.1.5 ADC Setup
    2. 4.2 Foreground Process
      1. 4.2.1 Formulas
        1. 4.2.1.1 Standard Metrology Parameters
        2. 4.2.1.2 Power Quality Formulas
    3. 4.3 Background Process
      1. 4.3.1 per_sample_dsp( )
        1. 4.3.1.1 Voltage and Current ADC Samples
        2. 4.3.1.2 Pure Waveform Samples
        3. 4.3.1.3 Frequency Measurement and Cycle Tracking
      2. 4.3.2 LED Pulse Generation
      3. 4.3.3 Phase Compensation
  6. 5Metrology Accuracy Testing
    1. 5.1 Test Setup
    2. 5.2 Results
  7. 6Schematics
  8. 7References

Foreground Process

The foreground process includes the initial setup of the MSP432 hardware and software and the ADS131M08 registers immediately after a device RESET. The Foreground Process figure shows the flowchart for this process. In the diagram, V-I mappings are referring to the combinations of the common voltage and the individual current channels. There are a total of three V-I mappings: the mapping between the voltage and current channel A, the mapping between the voltage and current channel B, and the mapping between the voltage and current channel C.

GUID-20201005-CA0I-XRXX-H7ZV-DLWSNBHNR2CL-low.gifFigure 4-2 Foreground Process.
The initialization routines involve the setup of the MSP432 clock system; general purpose input/output (GPIO) port pins and associated port map controller; MSP432 USCI_A0 for UART functionality; MSP432 RTC module for clock functionality; MSP432 DMA; ADS131M08 registers; and MSP432 metrology variables.

After the hardware is setup, 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 50 Hz and 12 cycles when the nominal frequency setting in the software is set to 60 Hz. 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 Formulas section.

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. Note that 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.