SLAA494B May   2011  – September 2023 MSP430AFE221 , MSP430AFE222 , MSP430AFE223 , MSP430AFE231 , MSP430AFE232 , MSP430AFE233 , MSP430AFE251 , MSP430AFE252 , MSP430AFE253

 

  1.   1
  2.   Implementation of a Single-Phase Electronic Watt-Hour Meter Using the MSP430AFE2xx
  3. Trademarks
  4. Introduction
  5. Block Diagram
  6. Hardware Implementation
    1. 4.1 Power Supply
      1. 4.1.1 Resistor Capacitor (RC) Power Supply
      2. 4.1.2 Switching-Based Power Supply
    2. 4.2 Analog Inputs
      1. 4.2.1 Voltage Inputs
      2. 4.2.2 Current Inputs
  7. Software Implementation
    1. 5.1 Peripherals Setup
      1. 5.1.1 SD24 Setup
    2. 5.2 Foreground Process
      1. 5.2.1 Formulas
        1. 5.2.1.1 Voltage and Current
        2. 5.2.1.2 Power and Energy
    3. 5.3 The Background Process
      1. 5.3.1 Voltage and Current Signals
      2. 5.3.2 Phase Compensation
      3. 5.3.3 Frequency Measurement and Cycle Tracking
      4. 5.3.4 LED Pulse Generation
    4. 5.4 Energy Meter Configuration
  8. Energy Meter Demo
    1. 6.1 EVM Overview
      1. 6.1.1 Connections to the Test Setup or AC Voltages
      2. 6.1.2 Power Supply Options
    2. 6.2 Loading the Example Code
      1. 6.2.1 Opening the Project
  9. Results
    1. 7.1 Viewing Results on PC
    2. 7.2 Viewing Results During Debug
  10. Important Notes
  11. Schematics
  12. 10References
  13. 11Revision History

Energy Meter Configuration

Include files are used to initialize and configure the energy meter to perform several metrology functions. Some of the user configurable options that are available are listed in this section. The file that needs modification is emeter-1ph-bare-bones-afe.h in the emeter-ng directory. It includes macro definitions that are used during the normal operation of the meter.

  • MAINS_FREQUENCY_SUPPORT: The macro configures the meter to measure the frequency of the mains.
  • MAINS_NOMINAL_FREQUENCY: The macro defines the default mains frequency, which is a starting point for dynamic-phase correction for nonlinear CTs or other sensors for which the phase changes with the current.
  • TOTAL_ENERGY_PULSES_PER_KW_HOUR: This macro defines the total number of pulses per 1 kWh of energy. In this application, it is defined as 1600. Note that this value is not a standard, but it is widely used by many meter manufacturers. There could be a practical limit set on this number due to the reference meter's ability to accept fast pulses (due to large currents).
  • ENERGY_PULSE_DURATION: This macro defines the duration of the LED ON time for an energy pulse. This is measured in ADC samples (that is, increments every 1/3906 s). The maximum allowed is 255, giving a pulse of about 62.5 ms, while 163 gives a pulse of 40 m. This duration might be too large with adjacent pulses overlapping when very high currents are measured. It is recommended that this value be changed to a smaller number such as 80 if overlap is seen at the pulse outputs.
  • NEUTRAL_MONITOR_SUPPORT: This macro enables the support for neutral monitoring. The third SD24 is used for this purpose.
  • VRMS_SUPPORT: This macro configures the meter to calculate VRMS from the voltage samples.
  • IRMS_SUPPORT: This macro configures the meter to calculate IRMS from the current samples.
  • REACTIVE_POWER_SUPPORT: This macro configures the meter to calculate the reactive power from the voltage and current samples.
  • REACTIVE_POWER_BY_QUADRATURE_SUPPORT: This macro configures the meter to calculate the reactive power from the delayed voltage samples by 90° and current samples instead of using the power triangle method.
  • APPARENT_POWER_SUPPORT: This macro configures the meter to calculate the apparent power.
  • POWER_FACTOR_SUPPORT: This macro configures the meter to calculate the power factor for both lead and lag. A frequency-independent method, based on the ratio of scalar dot products, is used.
  • CURRENT_LIVE_GAIN: This macro defines the gain of the SD24's internal programmable gain amplifier (PGA) for the line current. In this application it is set to 1.
  • CURRENT_NEUTRAL_GAIN: This macro defines the gain of the SD24's internal PGA for neutral current monitoring. In this application it is set to 16.
  • VOLTAGE_GAIN: This macro defines the gain of the SD24's internal PGA for the voltage. In this application it is set to 1.
  • DEFAULT_V_RMS_SCALE_FACTOR_A: This macro holds the scaling factor for voltage at phase 1. It can be set to a value that is in an acceptable range and is fine tuned during calibration.
  • DEFAULT_I_RMS_SCALE_FACTOR_A: This macro holds the scaling factor for current at phase 1. It can be set to a value that is in an acceptable range and is fine tuned during calibration.
  • DEFAULT_P_SCALE_FACTOR_A_LOW: This macro holds the scaling factor for active power at phase 1. It can be set to a value that is in an acceptable range and is fine tuned during calibration.
  • DEFAULT_I_RMS_SCALE_FACTOR_NEUTRAL: This macro holds the scaling factor for current at neutral. It can be set to a value that is in an acceptable range and is fine tuned during calibration.