TIDUFB8 December   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
  8. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
      1. 2.2.1 Voltage Measurement – Analog Front End
      2. 2.2.2 Current Measurement Analog Front End
      3. 2.2.3 Input Voltage
      4. 2.2.4 Clock
    3. 2.3 Highlighted Products
      1. 2.3.1 AMC130M02
      2. 2.3.2 MSPM0G1106
      3. 2.3.3 LMK6C
      4. 2.3.4 TLV76133
  9. 3Hardware, Software, Testing Requirements, and Test Results
    1. 3.1 Hardware Requirements
    2. 3.2 Software Requirements
      1. 3.2.1 Formulas
      2. 3.2.2 Metrology Software Process
        1. 3.2.2.1 UART for PC GUI Communication
        2. 3.2.2.2 Direct Memory Access (DMA)
        3. 3.2.2.3 ADC Setup
        4. 3.2.2.4 Foreground Process
        5. 3.2.2.5 Background Process
        6. 3.2.2.6 Software Function per_sample_dsp ()
        7. 3.2.2.7 Frequency Measurement and Cycle Tracking
        8. 3.2.2.8 LED Pulse Generation
    3. 3.3 Test Setup
      1. 3.3.1 Power Supply and Jumper Settings
      2. 3.3.2 Viewing Metrology Readings and Calibration
      3. 3.3.3 Calibration
        1. 3.3.3.1 Voltage and Current Offset Calibration
        2. 3.3.3.2 Voltage and Current Gain Calibration
        3. 3.3.3.3 Active Power Gain Calibration
        4. 3.3.3.4 Offset Calibration
        5. 3.3.3.5 Phase Calibration
    4. 3.4 Test Results
      1. 3.4.1 Electricity Meter 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
        1. 4.1.3.1 Layout Prints
      4. 4.1.4 Altium Project
      5. 4.1.5 Gerber Files
      6. 4.1.6 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 Author

Formulas

This section briefly describes the formulas used for the voltage, current, power, and energy calculations. As previously described, voltage and current samples are obtained at a sampling rate of 4kHz. All of the samples that are taken in approximately one second frames are kept and used to obtain the RMS values for voltage and current. The RMS values are obtained with the following formulas.

Equation 3. V R M S , p h =   K v , p h ×   n = 1 S a m p l e   c o u n t V p h ( n ) × V p h ( n ) S a m p l e   C o u n t - V o f f s e t , p h
Equation 4. I R M S , p h =   K i , p h ×   n = 1 S a m p l e   c o u n t I p h ( n ) × I p h ( n ) S a m p l e   C o u n t - I o f f s e t , p h

where

  • Vph(n) = Voltage sample at a sample instant n
  • Voffset,ph = Offset used to subtract effects of the additive white Gaussian noise from the voltage converter
  • Iph(n) = Each current sample at a sample instant n
  • Ioffset,ph = Offset used to subtract effects of the additive white Gaussian noise from the current converter
  • Sample count = Number of samples within the present frame
  • Kv,ph = Scaling factor for voltage
  • Ki,ph = Scaling factor for current

Power and energy are calculated for active and reactive energy samples of one frame. These samples are phase-corrected and passed on to the foreground process, which uses the number of samples (sample count) to calculate phase active and reactive powers through the following formulas:

Equation 5. P A C T , p h =   K A C T , p h n = 1 S a m p l e   c o u n t V p h n × I p h ( n ) S a m p l e   C o u n t -   P A C T O f f s e t , p h
Equation 6. P R E A C T , p h =   K R E A C T , p h n = 1 S a m p l e   c o u n t V 90 , p h n × I p h ( n ) S a m p l e   C o u n t -   P R E A C T O f f s e t , p h
Equation 7. P A P P , p h   =   P A C T , p h 2 + P R E A C T , p h 2

where

  • V90(n) = Voltage sample at a sample instant n shifted by 90°
  • KACT,ph = Scaling factor for active power
  • KREACT,ph = Scaling factor for reactive power
  • PACT_offset,ph = Offset used to subtract effects of crosstalk on the active power measurements
  • PREACT_offset,ph = Offset used to subtract effects of crosstalk on the reactive power measurements
Note: For reactive energy, the 90° phase shift approach is used for two reasons:
  1. This approach allows accurate measurement of the reactive power for very small currents
  2. This approach conforms to the measurement method specified by IEC and ANSI standards

The calculated mains frequency is used to calculate the 90 degrees-shifted voltage sample. Because the frequency of the mains varies, the mains frequency is first measured accurately to phase shift the voltage samples accordingly.

To get an exact 90° phase shift, interpolation is used between two samples. For these two samples, a voltage sample slightly more than 90 degrees before the most recent voltage sample and a voltage sample slightly less than 90 degrees before the most recent voltage sample are used. The phase shift implementation of the application consists of an integer part and a fractional part. The integer part is realized by providing an N samples delay. The fractional part is realized by a one-tap FIR filter. In the test software, a lookup table provides the filter coefficients that are used to create the fractional delays.

Using the calculated powers, energies are calculated with the following formulas:

Equation 8. E A C T , p h =   P A C T , p h × S a m p l e   C o u n t
Equation 9. E R E A C T , p h =   P R E A C T , p h × S a m p l e   C o u n t
Equation 10. E A P P , p h =   P A P P , p h × S a m p l e   C o u n t

The calculated energies are then accumulated into buffers that store the total amount of energy consumed since system reset. These energies are different from the working variables used to accumulate energy for outputting energy pulses. There are three sets of buffers that are available: one for each V-I mapping. Within each set of buffers, the following energies are accumulated:

  1. Active import energy (active energy when active power ≥ 0)
  2. Active export energy (active energy when active power < 0)
  3. Fundamental active import energy (fundamental active energy when fundamental active power ≥ 0)
  4. Fundamental active export energy (fundamental active energy when fundamental active power < 0)
  5. React. Quad I energy (reactive energy when reactive power ≥ 0 and active power ≥ 0; inductive load)
  6. React. Quad II energy (reactive energy when reactive power ≥ 0 and active power < 0; capacitive generator)
  7. React. Quad III energy (reactive energy when reactive power < 0 and active power < 0; inductive generator)
  8. React. Quad IV energy (reactive energy when reactive power < 0 and active power ≥ 0; capacitive load)
  9. Apparent import energy (apparent energy when active power ≥ 0)
  10. Apparent export energy (apparent energy when active power < 0)

The background process also calculates the frequency in terms of samples-per-mains cycle. The foreground process then converts this samples-per-mains cycle to Hertz with Equation 11:

Equation 11. F r e q u e n c y   H z =   S a m p l e   R a t e   ( s a m p l e s / s e c o n d ) F r e q u e c y   ( s a m p l e / c y c l e )

After the active power and apparent power have been calculated, the absolute value of the power factor is calculated. In the internal representation of power factor of the system, a positive power factor corresponds to a capacitive load; a negative power factor corresponds to an inductive load. The sign of the internal representation of power factor is determined by whether the current leads or lags voltage, which is determined in the background process. Therefore, the internal representation of power factor is calculated with Equation 12:

Equation 12. I n t e r n a l   R e p r e s e n t a t i o n   o f   P o w e r   F a c t o r = P A C T P A p p   , i f   c a p a c i t i v e   l o a d     - P A C T P A P P ,   i f   i n d u c t i v e   l o a d