2 command line interpreter (cli), 3 auto-calibration, Command line interpreter (cli) – Maxim Integrated 71M6534 Energy Meter IC Family Software User Manual

Page 58: Auto-calibration

Advertising
background image

71M653X Software User’s Guide

ComputeRMS()

derives the voltages and current numbers used for creep detection.

ComputeSmallRMS()

divides the Wh or VAh by the voltage to derive more accurate current values at small currents.

This works because the Wh and VARh have better filtering and a lower noise floor than the basic current calculation.
This calculation is especially useful to prevent creep using shunts.

ApplyCreepThreshold() (meter\meter.c)

clears the Wh to zero if either the volts or current are below the

minimum thresholds VThrshld and IThreshld.

The calculation is designed for use in an AMR system. Basically, as long as XFER_UPDATE is true, the meter
calculation is in progress. TSC has code for a FLAG interface in the all options code set.

Wh_Accumulate()

(meter\Wh.c) adds up the watt-hours. Since the CE’s output is signed, true four-quadrant

metering is possible. The demo code separates code into imports and exports. Antitamper “absolute value” versions
are available as well. The phase shift behavior, DC response, and other signal-processing traits depend on the CE’s
code. For special signal processing needs, contact the factory.

VARh_Accumulate()

(meter\VARh.c) adds up the volt-amp-reactive-hours. Since the CE’s output is signed, true four-

quadrant metering is possible. The demo code separates VARh into imports and exports. Antitamper “absolute value”
versions are available as well. The 6530 does IEEE “pure” signed VARh measurements. They have the same
accuracy as the Wh measurements. The phase shift behavior and other signal-processing traits depend on the CE’s
code. For special signal processing needs, contact the factory.

SelectPulses()

(meter\pulse_src.c) selects the pulse sources to emit to the pulse outputs. Every element’s Wh,

VARh and VAh are available, as well as totals, A2h, and V2h.

DetermineFrequency()

(meter\freq.c) handles the creep associated with frequency and the mains edge count. The

mains edge count is important when the real-time-clock is slaved to the line frequency.

DeterminePeaks()

(meter\Peak.c) detects peaks and sags, over-current, and also temperature excursions, which

can be a sign of over-current.

ComputePowerFactor()

performs the power factor calculation once and caches it. TSC also has sample code to

calculate phase angles and phase-to-phase voltages. Contact the factory or see the code set with all options.

GainCompensation()

adjusts the meter’s rate for the current temperature, using a quadratic adjustment. This is the

logic that uses PPMC1 and PPMC2 to adjust for the ADC’s voltage reference, and temperature-based changes in the
current and voltage sensors.

RTCCompensation()

adjusts the rate of the meter’s real-time-clock for temperature, using a quadratic adjustment.

This is the logic that uses Y_CAL0, Y_CAL1 and Y_CAL2.

5.4.3.2

Command Line Interpreter (CLI)

The command line interpreter is cli(), (in cli\cli.c) called from main_run() (in main\main.c).

In main_run(), cmd_pending() (in CLI\io.c) gets a line of text from the user. Then, it returns a nonzero to indicate
that the line buffer has data. cmd_pending() is complicated because it echos the characters, and edits the line
using backspace.

main_run()

then calls cli() to interpret the characters in the line buffer. cli() calls routines like get_upper()

(CLI\io.c) to get characters from the line buffer.

While the idea is simple, the code is surprisingly large, and resists simplification.

5.4.3.3

Auto-Calibration

The auto-calibration is an automated version of the “fast” calibration discussed in the DBUM. This section describes
the code, then derives the mathematics.

Before the calibration starts, the applied (ideal) voltage and current have to be entered by the user in the MPU memory
locations VCAL and ICAL. TSC’s experience is that optimal results are obtained with the default two second
calibration, but this time can be extended by writing the number of accumulation intervals to SCAL.

The procedure of this calibration method is the same as for the fast calibration procedure, as described in the DBUM:
The tangent of the ratio of VARh and Wh determines the phase angle. The ratio between applied (ideal) and measured
voltage determines the voltage gain. However, whereas the calibration spreadsheet uses extensive trigonometric

v1.1v1.1

TERIDIAN Proprietary

58 of 116

© Copyright 2005-2008 TERIDIAN Semiconductor Corporation

Advertising
This manual is related to the following products: