Professional Documents
Culture Documents
emeter-ng
Most meters which are required to measure reactive and apparent power or energy are only
required to give a general indication of load quality. For some applications, such as tri-vector
meters in India, the required accuracy for active, reactive and apparent power is similar. This
software can be built to offer good accuracy with lower complexity. It can also be built to
give accuracy suitable for tri-vector meters, and supports the data gathering and storage
features typical of these meters.
It supports a wide range of anti-tamper features;
- Reverse current detection
- Current imbalance (earthing) detection
- Limp mode operation
- Neutral current monitoring for 3-phase meters
Most of the limits in the following description are set be definitions in the source code. If
there is sufficient EEPROM space, changing these definitions will change the limits. This has
little effect on code size or RAM usage. It does, of course, affect the size of EEPROM
required.
- The software provides for up to 8 tariffs. Usage information is gathered separately for
each of these tariffs, between specified cutoff dates.
- Up to 8 daily schedules may be configured. Each schedule may specify up to 8 time slots.
Each time slot may be assigned to any of the tariffs. Typically only 3 schedules would be
required V weekdays, Saturdays and Sundays/public holidays.
- Each weekday may be assigned to one of the tariff schedules.
- A list of up to 32 public holidays may be configured. These override the normal weekday
tariff patterns. Holidays may be assigned to any of the tariff schedules.
- Up to 12 billing cut-off dates may be configured. Between these dates, the meter accumulates
the total energy used for each of the tariffs. The meter stores the last 12 sets of these
values, to allow the meter to be read infrequently. Note the actual cutoff point is midnight
on the day preceding the specified day.
- The meter measures the consumed energy in five minute steps. It accumulates six consecutive
five minute steps, to find the total energy consumed in the last 30 minutes. For each day,
the meter determines the time and size of the peak 30 minute consumption value. This allows
the time of peak demand to be found with reasonable accuracy. The last 31 daily peak times
and amounts are stored.
Preactive=
Whilst simple, the accuracy of this method, at small currents, is limited, especially when a
shunt resistor sensor is used to measure the current. To see why, we must look at the
implications of the preceeding formulae.
In an e-emeter, the voltage signal is always large. In many places it is specified as always
being within a few percent of the nominal level. In some rural areas it may vary more, but the
voltage will never drop to a very low level, unless the power actually fails. The current, on the
other hand, varies between a cutoff point close to zero and full load. We need to achieve
sufficient accuracy over a current range that may be up to 1000:1. When the current is very
small, the percentage of each digitised sample which is noise from the electronics can be
significant. If a shunt sensor and a high gain front end is used, that noise will typically be
much larger than if a sensor with a large output, such as a CT, is used.
If the reactive power can be calculated from a (VI) type of calculation, the substantial noise
content of a small RMS current value could be avoided. One way to achieve this is to use an
accurate 90 degree phase shift to rotate the voltage samples. Then, the reactive energy during
a period, T, can be expressed as Ereactive=
A Hilbert transform could produce such a phase shift over a sufficiently wide frequency range,
but would be computationally expensive. However, we can measure the mains frequency
accurately, and obtain an accurate estimate for the number of samples of delay required to
produce a precise 90 degree phase shift at the current mains frequency. We can implement
this phase shift easily, by delaying for required whole number of samples and using a single
pole FIR filter to shift by the fractional amount. This will only shift the fundamental
frequency by 90 degrees, but this may not be a problem. the voltage waveform never contains
significant harmonic energy. It is only the current waveform which is often rich in harmonics,
due to the nature of the load.
Once precise values for the active and reactive energy are known, the apparent (VA) energy
consumed in a period T is
Another method which achieves similar results may be derived as follows:
Q=V.Isin()
= V.I.cos( + )
= V.I.cos( - )
- =V.I.(cos( + ) - cos( - ))
A little trignometry can reduce this to
- =2.V.I.sin ( )sin( ))
The value Q, which we are trying to find, is buried in this equation as V.I.sin ( ) so
Q=
Q=
This requires more computation, but avoids the need to buffer many samples of the voltage
signal. If RAM is very limited, this may be a solution.
Fully electronic electricity meters generally use one of two strategies for energy accumulation.
Both start out by calculating the dot product of the voltage and current waveforms. One
method uses a continuous integration technique, integrating every product of a V and I
sample. This technique is used in many metering ASICs, as it suits their architectures well.
The other method processes the accumulated data in timed blocks, typically around one
second long. This fits the architectures of MCUs and programmable DSPs much better. This
is the method used in the current software. Both methods are capable of similar accuracy, and
response times. However, the character of their outputs is a little different. The output of the
continuous method smoothly adjusts to step changes in the load. The output of the block
method jumps in response to step changes in the load. However, the total energy accumulated
through such as a step change is the same for both methods (assuming they are correctly
implemented).
For a device using the ADC12, the meter samples each of the waveforms 3276.8 times per
second. For a device using the SD16, the meter samples each of the waveforms 4096 times
per second.
A flag is also set to tell the back end processing that new data is available. The counts are
cleared, and the accumulation process begins again.
To evaluate the mains frequency, the number of sample between positive zero crossings of
the waveform is counted, and filtered using a single pole IIR filter. By using a 32 bit result
register in the filter, and filtering the cycles lengths into the top 16 bits, the mains frequency
is estimated to about 0.01Hz accuracy over many cycles of the mains waveform. To minimise
the effects of noise spikes, and the mains power switching on and off, excessively long or
short mains cycles are not counted.
We calculate the power factor from the power, voltage and current measurements. This
technique does not indicate whether the power factor is leading or lagging. To determine this,
the software monitors the current waveform at each positive going zero crossing of the
voltage waveform. If the current is above the voltage, the current must be leading the voltage.
If the current is below the voltage waveform, the current must be lagging the voltage. To
ensure stable assessment of lead vs lag, the software lightly integrates the decisions.
Energy pulses
To satisfy customer requirements it is usually necessary for an e-meter to have an LED or
LCD segment which flashes once for each small increment in consumed energy. An
increment might typically be 1/1000kWh or 1/1600kWh. This has nothing to do with the
actual measurement process of modern fully electronic meters. It is provided mostly for
historic reasons. However, it must always give stable and accurate pulses - it is this pulse rate
which will generally be used to evaluate the meter's performance. To provide sufficient
timing accuracy in the pulses to avoid significant jitter, these pulses are generated within the
ADC interrupt routine. The LED can, therefore, flash within 244us or 305us (depending on
the ADC type) of the exact time that it should.
During each ADC interrupt, the power measured during the previous sampling block is
accumulated pulse by pulse. The LED is flashed when the accumulated value reached the
value of one pulse. The duration of the LED pulse is also controlled within the ADC interrupt
routine to be a fixed number of ADC interrupts.