Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
ENERGY METER WITH POWER QUALITY MONITORING AND DIAGNOSTIC SYSTEMS
Document Type and Number:
WIPO Patent Application WO/1998/018013
Kind Code:
A2
Abstract:
An electronic meter (10) which automatically detects the service type and voltage to which the meter (10) is installed and which either automatically continues its own programming to the detected service is disclosed. An electronic energy meter (10) that permits the addition of new measurements or testing capabilities without requiring factory modifications to effect such functionality changes is also disclosed. The meter (10) includes firmware which measures the characteristics of electrical energy supplied to the meter and which generates characteristic signals reflective of the measured characteirstics of the electrical energy. A processor (16) is connected to receive and process the characteristic signals. The processing of the characteristic signals includes selecting and manipulating certain of the characteristic signals and generating characteristic information in response to the selection and generating additional characteristic information in response to the manipulation. It is preferred for the meter (10) to include a memory (35) having reference information stored therein. In such an embodiment, the manipulation of characteristic signals includes retrieving certain of the reference information and generating the characteristic information in response to the selected signals and the reference information.

Inventors:
HUBBARD VICK A (US)
MUNDAY MARK L (US)
HEMMINGER RODNEY C (US)
HOLDSCLAW SCOTT T (US)
Application Number:
PCT/US1997/018457
Publication Date:
April 30, 1998
Filing Date:
October 16, 1997
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
ABB POWER T & D CO (US)
HUBBARD VICK A (US)
MUNDAY MARK L (US)
HEMMINGER RODNEY C (US)
HOLDSCLAW SCOTT T (US)
International Classes:
G01R19/25; G01R21/133; G01R22/00; G06F19/00; (IPC1-7): G01R/
Foreign References:
US5315235A1994-05-24
US5469049A1995-11-21
US5555508A1996-09-10
Other References:
See also references of EP 1018022A2
Attorney, Agent or Firm:
Norris, Norman L. (46th floor One Liberty Plac, Philadelphia PA, US)
Download PDF:
Claims:
Claims What is claimed is:
1. A meter for metering electrical energy, said meter comprising: firmware, for measuring characteristics of said electrical energy and for generating characteristic signals reflective of the measured characteristics of said electrical energy; a processor connected to receive and process said characteristic signals, wherein the processing of said characteristic signals comprises selecting and manipulating certain of said characteristic signals and generating characteristic information in response to said selecting certain of the characteristic signals and generating additional characteristic information in response to said manipulation.
2. The meter of claim 1, further comprising a memory having reference information stored therein, wherein said reference information is reflective of various characteristics of said electrical energy and wherein said manipulation comprises retrieving certain of said reference information from said memory and wherein said characteristic information is generated in response to both certain of said selected signals and said certain of said reference information.
3. An electronic processorimplemented process for metering electrical energy, comprising the steps of: measuring characteristics of said electrical energy; generating characteristic signals reflective of the measured characteristics of said electrical energy; selecting certain of said characteristic signals; manipulating certain of said characteristic signals; generating characteristic information in response to said selecting certain of the characteristic signals; and generating additional characteristic information in response to said manipulation.
Description:
ENERGY METER WITH POWER QUALITY MONITORING AND DIAGNOSTIC SYSTEMS Related Application Data The present application claims priority from provisional application Serial No. 60/028,986, filed on October 22, 1996.

Field of the Invention The present invention relates generally to electronic energy meters, and more particularly to highly functional programmable electronic energy meters with systems for service identification and power quality analysis.

Background Programmable electronic energy meters are rapidly replacing electro-mechanical meters due to the enhanced functionality achieved using programmable logic integrated into solid-state electronic meters. Some of these meters can be used to meter various different electrical services without hardware modification. For example, meters having a voltage operating range between 98 Vrms to 526 Vrms are capable of operation with either 120 V or 480 V services.

U.S. Patent No. 5,457,621 dated October 10, 1995 entitled SWITCHING POWER SUPPLY HAVING VOLTAGE BLOCKING CLAMP, assigned to ABB T&D Company discloses examples of such meters. In addition some meters are constructed for use with any 3-wire or any 4-wire service, also disclosed in U.S. Patent No. 5,457,621. Unless meters having this versitility are used, utilities must be careful to install

the correct meter in relation to both configuration and electrical service supplied at the installation site.

Unfortunately, meter installers are not always trained to detect or note service particularities which might indicate that the meter to be installed is not configured properly for a particular installation.

For this reason, some utilities configure the meters themselves to ensure better control over which meters are installed at which installation sites. However, such configuration activity adds to the installation cost and does not always reduce the risk that a meter configured for one service might inadvertently be installed at a site supplied by a different service. Therefore, there remains a need for an electronic meter which automatically detects the service type and voltage to which the meter is installed and which either automatically configures its own programming to the detected service or provides a simple means for manual configuration at the installation site.

In addition, many new electronic energy meters have begun to take advantage of their programming capabilities by providing limited diagnostic and/or power quality testing. These capabilities are provided by programming stored in read only memory (ROM). Thus these meters are currently limited in operation to predefined programming, such as predefined sets of tests.

Significantly, such meters are also limited to the measurement of only a predetermined set of parameters that have been programmed into such meters, i.e., stored in ROM, during manufacture. Consequently, any change to the measurements or tests supported by the meter must be carried out by replacing the meter's ROM, i.e. by factory modification. Therefore, there also exists a need for a more flexible electronic energy meter that permits the addition of new measurements or testing capabilities without requiring factory modifications to effect such functionality changes.

Still further, the performance of power quality tests requires that the type of service and service voltage be known prior to installation so that the meter's

programming can be locked to the appropriate service- dependent thresholds utilized in connection with particularized power quality tests. Therefore, for this additional reason, there remains a need for an electronic meter to automatically detect the service type and voltage to which the meter is installed and which either automatically configures its programming to the detected service or provides a simple means for manual configuration at the installation.

Summary of the Invention The above problems are overcome and the advantages of the invention are achieved in methods and apparatus for metering electrical energy in an electronic meter which automatically detects the service type and voltage to which the meter is installed and which either automatically configures its own programming to the detected service. The electronic energy meter also permits the addition of new measurements or testing capabilities without requiring factory modifications to effect such functionality changes.

The meter includes firmware which measures the characteristics of electrical energy supplied to the meter and which generates characteristic signals reflective of the measured characteristics of the electrical energy. A processor is connected to receive and process the characteristic signals. The processing of the characteristic signals includes selecting and manipulating certain of the characteristic signals and generating characteristic information in response to the selection and generating additional characteristic information in response to the manipulation. It is preferred for the meter to include a memory having reference information stored therein. In such an embodiment, the manipulation of characteristic signals includes retrieving certain of the reference information and generating the characteristic information in response to the selected signals and the reference information.

Brief Description of the Drawings The present invention will be better understood, and its numerous objects and advantages will become apparent by reference to the following detailed description of the invention when taken in conjunction with the following drawings, in which: Figure 1 is a block diagram showing the functional components of the meter and their interfaces in accordance with the present invention; Figure 2 is a functional block diagram showing the logic that may be employed by the DSP to drive the potential indicators in accordance with the present invention; Figure 3 is a diagram showing the functional grouping of data into tables and the meter-relationship among the tables as implemented in a preferred embodiment of the invention; Figure 4 is a state diagram showing the measurement states within a preferred embodiment of the invention; Figure 5 is a functional diagram showing the system architecture for performing the instrumentation measurements and power quality monitoring as is implemented in accordance with a preferred embodiment of the invention; Figure 6 is a context diagram showing the measurement engine processing utilizing internal flags in accordance with the present invention; Figure 7 is an example of a state transition diagram for the measurement engine in accordance with the present invention; Figures 8A-8E are more detailed functional flow diagrams showing the steps carried out by the measurement engine in accordance with a preferred embodiment of the invention; Figure 9 is a context diagram showing the power quality test engine processing utilizing internal flags in accordance with the present invention

Figure 10 is a series of state diagrams showing power quality engine resource processing scenarios in accordance with present invention; Figures llA-llI are more detailed functional flow diagrams showing the steps carried out by the power quality test engine in accordance with a preferred embodiment of the invention; Figure 12 is a flow diagram showing the steps carried out by the microcontroller in accordance with the present invention to automatically and electronically identify the service definition; Figure 13 is a detailed flow diagram showing the service phase table search in accordance with the present invention; Figure 14 is a detailed flow diagram showing the service voltage table search in accordance with the present invention; Figure 15 is a state diagram showing the states for service lock processing according to the present invention; Figure 16 is a flow diagram of the service test and display features in accordance with the present invention; and Figure 17 is a flow diagram of the flicker determination and display feature in accordance with the present invention.

Detailed Description of the Invention A. Operational Overview The present invention provides comprehensive power quality monitoring and diagnostic features in connection with metering single and poly-phase electrical energy.

Figure 1 is a block diagram showing the functional components of the meter and their interfaces in accordance with the present invention. As shown in Figure 1, a meter for metering three-phase electrical energy preferably includes a digital LCD type display 30, a meter IC 14 which preferably comprises A/D converters and a programmable DSP, and a microcontroller 16.

Analog voltage and current signals propagating over power transmission lines between the power generator of the electrical service provider and the users of the electrical energy are sensed by voltage dividers 12A, 12B, 12C and current transformers or shunts 18A, 18B, 18C, respectively. The outputs of the resistive dividers and current transformers, or sensed voltage and current signals, are provided as inputs to meter IC 14. The A/D converters in the meter IC convert the sensed voltage and current signals into digital representations of the analog voltage and current signals. In a preferred embodiment, the A/D conversion is carried out as described in U.S. Patent No.

5,544,089 dated August 6, 1996 entitled PROGRAMMABLE ELECTRICAL METER USING MULTIPLEXED ANALOG-TO-DIGITAL CONVERTERS, assigned to ABB T& D Company. The digital voltage and current signals are then input to the programmable DSP in the meter IC for generating pulsed signals 42 ,44, 46, 48 representing various power measurements, i.e., each pulse represents the Ke value associated with watts, VA or VARs. These pulsed signals may be processed by the microcontroller 16 to perform revenue metering functions for billing purposes.

While the microcontroller, in accordance with the present invention, performs numerous revenue metering functions, it also performs instrumentation functions.

Instrumentation functions, in contrast to revenue functions, are intended to assist a technician in evaluating a service based on near-instantaneous conditions at the meter.

Instrumentation measurements may include system parameters such as frequency, Watts, VARs, and VAs, and per phase information such as voltage, current, phase angles, power factor, current to voltage angle, KWatts, KVARs, KVA, and harmonic distortion related parameters. The following is a more detailed listing describing some examples of instrumentation parameters that may be computed by the present invention.

TABLE 1 Parameter Description Frequency Measured on A Phase voltage, Rounded to two decimal places. System kWatts Signed sum ofthe kW measurement on each phase taken moments apart. System kVARs (Arithmetic) Root-magnitude square-difference of the System kVAs (Arithmetic) and System kWatts. System kVARs (Vectorial) Signed sum of the kVAR measurement on each phase taken moments apart. System kVAs (Arithmetic) Sum of the kVA measurements on each phase taken moments apart. System kVAs (Vectorial) Root-magnitude square-sum of the System kWatts and the System kVARs (Vectorial) System Power Factor (Arithmetic) System kWatts divided by the System kVAs Arithmetic System Power Factor (Vectorial) System KWatts divided by the System kVAs (Vectorial) Phase Voltages and Amperes Measurements are true RMS, Each phase voltage and current is measured simultaneously, Rounded to two decimal laces. Phase Voltage Angle related to Phase A Each phase angle is measured relative to Voltage Phase A zero crossings, Rounded to 30 degrees. Phase Power Factor Phase kWatts, Divided by; Phase kVAs (measured simultaneously), Rounded to two decimal places. Note: Phase Power Factor is set to 1.OOPF if Phase kVA is less than 5 VA. Phase Current to Phase Voltage Angle Inverse Cosine of Phase Power Factor (prior to rounding), Rounded to 0.1. degrees. Phase Current to Phase Voltage Angle Plus Phase Current to Phase Voltage Angle, Plus; Voltage Angle Relative to Phase A Voltage The nominal Phase Voltage Angle relative to Phase A voltage for the service. Phase k Watts, kVAs Each phase k Watts and k VAs is measured simultaneously, Rounded to two decimal places. Phase k VARs Root-magnitude square-difference of the Phase kVAs and Phase kWatts

Total Harmonic Distortion (THD) Indication Square root of the sum of the squares of the second through fifteenth fundamental values of the Phase Voltage or Phase Current; Divided by the phase quantity's fundamental magnitude. 2nd Harmonic Voltage Distortion Indication The phase quantity's 2nd Harmonic Voltage Magnitude, Divided by; The phase quantity's fundamental magnitude. General Nth Voltage Harmonic Magnitude Measurements are true RMS, Rounded to two decimal places. General Nth Harmonic Magnitude Measurements are true RMS, Rounded to two decimal places.

The meter IC 14 and microcontroller 16 each preferably interface with one or more memory devices through the IIC bus 36. An EEPROM 35 is provided to store revenue data as well as programs and program data. Upon power up after installation, a power failure or a data altering communication, for example, selected programs and program data stored in the EEPROM may be downloaded to the Program RAM and Data RAM associated with the meter IC 14 as shown in Figure 1. The DSP under the control of the microcontroller processes the digital voltage and current signals in accordance with the downloaded programs and data stored in the respective program and data RAM.

To perform instrumentation functions microcontroller 16 may require both voltage and current measurement information from DSP 14. According to a preferred embodiment of the present invention the meter IC 14 monitors the digital phase voltage signals and phase current signals over two line cycles (at about 50 or 60 Hz, two line cycle measurements are defined herein as RMS measurements even though they are "near-instantaneous") and then computes the RMS values for instrumentation purposes.

It should be understood that the number of line cycles is preferably programmable and a different number of line- cycles may be used for designated measurements. The RMS parameters computed for each phase, A, B, and/or C, are then stored in register in data RAM. The microcontroller 16 polls for data in these registers via IIC bus 36 for

instrumentation processing. Because the instrumentation measurements are nearly instantaneous in the preferred embodiment, no memory storage is needed for instrumentation data including phase angle data.

The DSP in the meter IC 14 also drives potential indicators 27, 29 and 31 which are preferably designated sections on the LCD 30. Phase potential for each phase is present so long as the corresponding potential indicator remains lit. Figure 2 shows a functional block diagram for the logic that may be employed by the DSP in IC 14 to drive potential indicators 27, 29 and 31 in accordance with the present invention. While the logic for only one phase is shown it should be understood that the logic is preferably replicated for each phase. As shown in Figure 2, the digital samples for each phase voltage are provided to the RMS measurement generator 51. In a preferred embodiment the RMS measurement generator computes the RMS measurements in accordance with the following formula: where N equals the number of samples per a selected number of line cycle intervals.

A programmable potential indicator threshold 53 is preferably downloaded from the EEPROM to the data RAM in IC 14. While initial programmable thresholds are downloaded following power-up, it is also preferable that the potential indicator thresholds be updated following certain system tests described in detail below. Comparator 55 compares the RMS measurement with the potential indicator threshold and generates an output that is high whenever the RMS measurement exceeds the programmable potential indicator threshold. The output of the Comparator is output to microcontroller 16. Referring back to Figure 1 phase A, B, and C potential signals are output from the meter IC to microcontroller 16 which in turn drives the potential

indicator so that the potential indicator remains lit when the potential signals are high.

The present invention preferably utilizes three display modes for LCD 30, namely, normal, alternate, and test modes.

On power-up following installation, at a preset time, or following a data altering communication, programmably designated tests are preferably executed. Following those tests, in a preferred embodiment, the meter sequentially and continuously scrolls through display items selected for the normal display mode. The display items may include both revenue data and instrumentation parameters. The alternate mode and test mode are manually initiated in a preferred embodiment. Different and/or additional display items may also preferably be selected for display in the alternate and test modes. The alternate mode preferably either scrolls through the selected parameters once or can be made to manually step through the displayed items. Items or parameters selected for display during test mode are continuously scrolled until the test mode is manually terminated.

The tests that are performed by the present invention may be categorized as operating error tests, system tests, power quality tests and flicker tests. The operating error tests are used to identify those conditions that may affect revenue data, such as power outage carryover errors, configuration errors, EEPROM errors and the like. These errors when detected are displayed and are preferably locked on the display. The system tests include a system service voltage test (hereinafter "service test") and a system current test. Generally, the service test is used to verify that the voltage phase angles are within a predefined range for the particular service and that the phase voltages are within a predefined voltage range of the valid service nominal voltages. The system current tests may check for low current conditions, over current conditions, under current conditions, reverse power, and/or improper power factor conditions. The power quality tests permit testing and evaluation for the following conditions: abnormal service voltage, abnormally high or low voltage, abnormally

low or high current, abnormal leading or lagging power factor, and various harmonic distortions, as well as other abnormal conditions..Flicker tests monitor the phase potentials signals for frequent temporary losses of phase potential.

Following power-up at installation, the service test is preferably performed to identify and/or check the electrical service. The present invention may be preprogrammed for use with a designated service or it may determine the service using the service test. When the service test is used to identify the electrical service, an initial determination is made of the number of active elements. To this end, each element (i.e. 1, 2 or 3 elements) is checked for voltage, for example, by monitoring the outputs of comparator 53 in Figure 2 for each phase. Once the number of elements is identified, many of the service types can be eliminated from the list of possible service types. The voltage phase angle relative to phase A may then be calculated and compared to each phase angle for abc or cba rotations with respect to the remaining possible services, e.g., within +15". If a valid service is found from the phase angle comparisons, the service voltage is preferably determined by comparing the RMS voltage measurements for each phase with nominal phase voltages for the identified service. If the nominal service voltages for the identified service matches measured values within an acceptable tolerance range, a valid service is identified and the phase rotation, service voltage, and service type are preferably displayed. The service may be locked, i.e, the service information is stored in the EEPROM, manually or automatically.

When the service type is known in advance and locked, the service test preferably checks to ensure that each element is receiving phase potential; that the phase angles are within a predetermined percentage of the nominal phase angles for the known service; and the per-phase voltages are also measured and compared to the nominal service voltages to determine whether they are within a predefined tolerance range of the nominal phase voltages. If the voltages and phase angles are within the specified ranges, the phase

rotation, the service voltage and service type are displayed on the meter display. If either a valid service is not found or the service test for a designated service fails, a system error code indicating an invalid service is displayed and locked on the display to ensure that the failure is noted and evaluated to correct the error.

The present invention may also be programmed so that immediately following the service test after installation, power-up, etc., the alternate mode is initiated. In order to avoid crowding the normal display, it is preferred that the instrumentation parameters and the system tests be included in the alternate display mode and not the normal display mode. It is also preferred, that the service test and the system current test be specified as the first and second parameters of the alternate display, respectively. If the service test or system current test fail while in the alternate mode, a system error code indicating the error is displayed in the alternate scroll sequence. Examples of possible system error codes designated by an "SERXXXXXX" error message are as follows

TABLE 2 VVVI II ABCABC Unknown Service Angles SEr 5 5 5 0 0 0 Misusing A Phase Current SEr 0 0 0 1 0 0 Misusing B Phase Current SEr 0 0 0 0 1 0 Missing C Phase Current SEr 0 0 0 0 0 1 Low A Phase Current SEr 0 0 0 2 0 0 Low B Phase Current SEr 0 0 0 0 2 0 Low C Phase Current SEr 0 0 0 0 0 2 Inappropriate PF on A Phase SEr 0 0 0 4 0 0 Inappropriate PF on B Phase SEr 0 0 0 0 4 0 Inappropriate PF on C Phase SEr 0 0 0 0 0 4 Reverse Power on A Phase SEr 0 0 0 5 0 0 Reverse Power on B Phase SEr 0 0 0 0 5 0 Reverse Power on C Phase SEr 0 0 0 0 0 5 Excess Current on A Phase SEr 0 0 0 8 0 0 Current Excess Current on B Phase SEr 0 0 0 0 8 0 Current Excess Current on C Phase SEr 0 0 0 0 0 8 Current If multiple tested conditions fail, the associated system error codes may be added together so that a single error code is displayed in the appropriate sequence. In a preferred embodiment, the error codes are hexadecimal values so that an excess current condition "8" and an inappropriate power factor "4 would be reported as "C." Any system test selected for the alternate mode display is preferably not carried out until the results are to be displayed. Therefore, the measurements made in connection with the system tests do not require storage in memory.

Similarly, no instrumentation parameters selected for the alternate mode display are preferably calculated until they are to be displayed.

Referring back to Figure 1, the meter according to the present invention also provides for remote meter reading, remote power quality monitoring and reprogramming through optical port 40 and/or option connector 38. While optical communications may be used in connection with the optical port, option connector 38 may be adapted for RF

communications or electronic communications via modem for example Revenue functions, communications, system tests, flicker testing, and instrumentation features preferably have priority in terms of processing over power quality tests. Therefore, the power quality tests are processed in background. Although the designated power quality tests are run one-at-a-time in a fixed selected sequence, they are only run when processing time is available, and accordingly, not at fixed intervals. However, it should be understood that certain power quality tests could be given higher priority such that those higher priority tests could be carried out at fixed intervals.

When an abnormal condition is detected by any of the designated power quality tests (which may include the service tests and/or system current tests) a predefined code indicative of an abnormal condition is preferably optionally injected as the first item in the normal scroll sequence.

However, since the condition is not necessarily related to one specific error it is considered a warning or a flag condition and display of the predefined code preferably does not affect the operation of the meter. Whether or not particular abnormal conditions drive a warning on the display may be selected through programmable options.

The warnings may be time and date stamped and logged in an event log and the number of events and cumulative time of the conditions may be separately logged in an occurrence log. The logs are preferably stored in the EEPROM 35 shown in Figure 1. The information stored in these logs may be accessed through software for further diagnostic processing and evaluation external to the meter itself.

The systems for performing system, power quality and flicker tests according to the present invention are preferably implemented in firmware, wherein such operations are enabled by the correct programming of several data tables. The functional inter-relationships of these tables is shown in Figure 3. System current tests are performed utilizing data stored in records in the system current test table 114 which generally includes system current thresholds

for each service supported by the meter. Service tests are performed utilizing the data records stored in the service angle table 116 and the service voltage table 118. The records in the service angle table may preferably include the nominal phase angle information for each service supported by the meter whereas the records in the service voltage table may preferably include the nominal voltage and tolerances for each service and a corresponding potential indicator threshold. A separate table, the phase tolerance table 115, is preferably used in connection with the service voltage test stored in EEPROM 35. Once the service is locked, the data corresponding to the service is transferred from tables 114, 116, and 118 to the thresholds table 122.

The power quality tests preferably form a predefined set of comparison tests. A record is stored in the power quality test table 108 for each comparison test to be carried out by the meter. The comparison tests and associated records are stored in the comparison test table 110. The power quality test table also may include information referencing a measurement record for the measurement to be tested by the referenced comparison test.

The power quality test table additionally references threshold information for test comparisons from the thresholds table.

The measurement records are stored in a measurement table 100 which preferably includes information referencing a record in the measurement function table 102. The records in the measurement function table identify a DSP function to be performed and may additionally reference a record in the constant table 104 which may include initialization and calibration constants used to carry out the functions. The records in the measurement table may also reference a record in the conversion table 106 which specifies particular computations to be performed in connection with the specified DSP function to complete the measurement required for comparison by the power quality test.

The DSP program in conjunction with the DSP hardware implements the fundamental measurement capabilities of the meter. The preferred embodiment has made provisions for

different versions of DSP programs to provide the capability to perform additional fundamental measurements. In the preferred embodiment, the DSP address and internal RAM page selector 121 are provided to the power quality measurement engine to allow the engine to communicate with versions of DSP programs that may have different IIC addresses and/or internal RAM addresses.

Programming for the data tables shown in Fig. 3 can preferably be divided into four levels of activities: (1) Display and Test Selection; (2) Display and Test Parameter Adjustment; (3) Test Definition; and (4) Measurement Definition.

Display selection involves the insertion of predefined byte sequences into a display table to enable the meter to display predefined measurement quantities. Test Selection involves the insertion of predefined byte sequences into the power quality test table 108 to enable the meter to perform predefined power quality tests.

Display Parameter Adjustment involves changing the number of line cycle pairs over which a given electrical measurement is performed as indicated by the selected function. Test Parameter Adjustment involves the modification of voltage, current, power factor and time thresholds in the system current test table 114, the service phase table 116, the service voltage table 118 and the power quality test table 108 to effect the sensitivity of the various tests that can be performed.

Test Definition involves the creation of new power quality tests by new combinations of test parameter threshold in tables 114, 116, and 108 with defined electrical measurements.

Measurement Definition involves the creation of new electrical measurements by new combinations of DSP functions and computations.

New hardware capabilities are added via measurement function table 102 and the constants table 104. Moreover new computations can be added or defined via the conversion table 106 or by specifying a sequence of computations from the conversion table 106. New measurements can be added by either combining new DSP functions with computations, DSP functions with new computations, or new DSP functions with new computations into new measurement records.

B. INSTRUMENTATION MEASUREMENT AND MONITOR INTERACTION Figure 4 shows a state diagram of the measurement states within a preferred embodiment of the invention. The measurement routines are executed by a measurement engine which is described in detail below. The measurement engine remains in the idle state at 140 until a request for measurement is received. Measurement requests may be initiated for the purpose of displaying an instrumentation parameter, performing a power quality test or for transmitting a measured parameter via external communications.

A display measurement request 136 may be received when a quantity is required for display in one of the display modes supported by the meter. Upon receipt of a display measurement request the measurement engine transitions to the display request processing state 144 and remains in that state until the measurement is computed, stored in a register and retrieved for display. In a preferred embodiment, the measurement engine remains in the display measurement processing state until (1) the measurement is computed, stored in a register and retrieved for display; (2) until a higher priority measurement request is received; or (3) an error occurs as a result of processing the display request. Once the measurement is done, the display measurement processing state transitions at 138 back to the idle state 140.

As shown in Figure 4, so long as background testing is enabled, a power quality measurement request may be received

at 130. The power quality measurement request designates which measured quantity is to be used in a current power quality test, e.g., phase B RMS voltage for comparison to a maximum acceptable voltage level for phase B, given the locked service. When received, the measurement engine transitions from the idle state 140 to the power quality measurement processing state 146 where the measurement designated by the power quality measurement request is processed. The measurement is stored in a register which is accessed by a power quality test engine (also described below in detail) so that the power quality test can be carried out utilizing the measured quantity. In a preferred embodiment, the power quality test engine acknowledges receipt of the measured quantity. The measurement engine remains in state 146 until the measurement is done. When the power quality measurement processing is complete, the measurement engine transitions at 132 to the idle state 140.

An external communication request 154 may be received via optical communications or electronically from an external source in which a particular measurement is requested for transmission to the external source. When request 154 is received, the measurement engine transitions from the idle state 154 to the communication measurement processing state 142. The designated measurement is processed and stored in a register accessible by the meters communications routines. When the measurement is done, the measurement engine transitions at 152 back to the idle state 140.

In a preferred embodiment, meter communications has priority over both measurement display functions and power quality testing. Similarly, display measurement functions have priority over power quality testing. Thus if the measurement engine is in the power quality measurement processing state 146 and a display measurement request is received, the measurement engine transitions at 151 to the display measurement processing state 144. Any computations or measurement data generated before transitioning to the display measurement processing state is preferably not saved

and therefore the power quality measurement must be reinitiated once the measurement engine returns to the idle state after display measurement processing is complete.

In a similar manner, if a communication measurement request is received while the measurement engine is in either the power quality measurement processing state 146 or the display measurement processing state 144, the measurement engine transitions at 150 and 158, respectively, to the communication measurement processing state 142. In a preferred embodiment, no data generated in either state 146 or state 144 is stored after transitioning to state 142.

Consequently, a new power quality measurement request or display measurement request is initiated to invoke the interrupted measurement processing after the communication measurement processing is complete and the measurement engine returns to the idle state 140.

The system architecture for performing instrumentation measurement and power quality monitoring is implemented in accordance with a preferred embodiment of the invention as shown in Figure 5. The system archetecture is functionally divided into two engines, the measurement engine 50 and the power quality engine 52. In a preferred embodiment, a third engine shown as the service lock engine 54 is also provided.

Instrumentation measurements may be selected for display by programming a measurement record number, formatting information, and phase to measure in a display table which defines the display sequence. An example of the information that might be included in a display table is set forth in Table 3 below.:

MR Name MR# Name 1 Frequency 13 Percent 2nd Harmonic Voltage 2 Current * 10, 14 Total Power KVARs, KWatts Voltage * 10 (Vectorial) 3 Total power factor 15 Total Power KWatts angle (arithmetic) (Vectorial and Arithmetic) 4 KVA, KW 16 Total VA (Vectorial) 5 Current 17 Total PF 6 Voltage 18 Total PF Angle 7 KVAR 19 V THD 8 PF Angle 20 I THD 9 KW 21 Total Power KVA, KWatts (Arithmetic) 10 2nd Harmonic Current 22 Total VAR (Arithmetic) Magnitude 11 V Angle 23 Total PF (Arithmetic) 12 I Angle 24 single phase Power Factor 25 Electrical System Service Determination 26 System Current Tests Table 3: Electrical Measurements and Measurement Record (MR) Numbers The display table is preferably generated and written to the meter EEPROM so that the information can be accessed by both the microcontroller and DSP during meter operation.

As discussed above instrumentation measurements may also be required for power quality tests. The power quality engine 52 allows the meter to monitor and log various conditions of the power line. A power quality test may be constructed by combining any instrumentation measurement, for example, in Table 3, with a comparison test which may utilize test parameters configured by the service test, i.e., threshold values based on the locked service. Records of this nature are stored in the power quality test table shown generally in Figure 3 and described in detail below.

Therefore, the display configuration table preferably includes two entry definitions, one for normal display quantities and one for power quality measurements. The definitions can be mixed within the table to obtain the desired display sequence. Power quality measurements are considered instrumentation quantities as opposed to billing

quantities. If a power quality measurement is selected which is unavailable in a given meter or installed service, the meter preferably skips the display with no warning or error. This is considered desirable so that a single pre- defined display table will work in multiple applications regardless of the rate for which the program was generated.

Referring again to Figure 5, the power quality engine 52 retrieves the measurement record number 74 from the next power quality test record and generates a power quality measurement request 66. Request 66 references one of the measurement records from the measurement table. A measurement record generally comprises a function/constant index, a conversion routine index, and a pointer to the next measurement record. The function index references one of a predefined set of measurement functions that the DSP may perform. The constant index references initialization constants and service-dependent constants based on the locked service. The conversion routine index references one of a set of predefined conversion routines that operate on the data manipulated and returned by the DSP. Examples of conversion routines include computational routines such as scaling, square root or trigonometric functions, system test routines, iteration routines, expansion routines, and power measurement computation routines, to name a few.

To better understand the measurement process, consider the situation were the phase angle for the current IB is required for display. The microprocessor references a measurement record and invokes the DSP function designated in that record via bus 36 to the DSP. In this example, the DSP function is return Watts and VA on phase B over a designated number of line cycles. When the DSP completes these measurements, the measurements are stored in the return registers in data RAM. The microcontroller polls for these measurements and retrieves them over the bus 36 when they are available. Then the microcontroller performs the conversion routine referenced by the measurement. In the present example, the conversion routine would call for dividing the watts measurement by the VA measurement to compute the power factor for phase B. The next record field

would then reference the next measurement record to be processed. That record would include a reference to the conversion routine for determining the arccosine of the power factor to arrive at the phase angle associated with phase B current.

In Figure 5, the measurement engine is shown processing a measurement record for power quality monitoring purposes although the measurement record processing is preferably the same for display processing. In either case, the measurement record number is shown at 67, the conversion index is shown at 58, and the function index is shown at 56. The measurement engine thus performs the designated DSP function and computational routines specified by respective function and conversion indices of the measurement record identified by the power quality measurement request 66. The measurement engine then processes the next measurement record designated in the next measurement record field of the current measurement record.

Figure 6 is a context diagram showing the measurement engine processing utilizing internal flags in accordance with the present invention. In a preferred embodiment the DSP is capable of being programmed to perform several different types of measurement functions such as voltage, current, power, apparent power, frequency, harmonic content, etc. on the meter inputs. Of course the DSP could be replaced by any type of device, or system that is capable of producing a fundamental measurement. For this discussion the production of any fundamental measurement by such a system is referred to as a DSP conversion. The Measurement Engine provides the capability to combine sequences of fundamental measurements and mathematical computations (referred to as conversion routines) to produce an instrumentation measurement.

The context diagram in Figure 6 shows that a measurement requester 110 such as the Power Quality Monitor Engine starts the Measurement Engine 120 by providing a measurement record number, a description of the meter phase or phases that are to be measured, a flag indicating whether or not intermediate working register RO should be saved

before beginning, and a flag indicating whether or not DSP conversion should be performed before the conversion routine is executed. The Measurement Engine responds by clearing the measurement finished flag 130 and returning a flag indicating that the measurement has been started. The Measurement Engine will then operate independently from the requester to interpret a linked list of measurement records in the measurement table to produce a measurement result for the requester.

In a preferred embodiment if the Measurement Engine is started before a previous measurement request has been completed the first measurement request will be aborted and the second request will be performed. Contention for the Measurement Engine has been avoided by a priority scheme.

Three levels of priority have been selected and are called background priority, foreground priority, and communication priority. The Power Quality Monitor Engine operates at the background priority, the meter display operates at the foreground priority, devices communicating via a communications protocol operate at the communications priority. Other embodiments might provide other means for handling multiple measurement requests such as but not limited to: requiring a measurement request to be finished before another can be started, or allowing additional measurement requests to be queued and processed one at a time, or interrupting the measurement request in process until the new request is processed, or even processing the measurement requests in parallel.

Figure 7 is an example of a state transition diagram for the measurement engine in accordance with the present invention.

Figures 8A-8E are more detailed functional flow diagrams showing the steps carried out by the measurement engine in accordance with a preferred embodiment of the invention. Referring to figure 8A, it can be seen that the Measurement Engine has two entry points Start Background Test 210 and Start Test 220. Start Background Test is used by the Power Quality Monitor Engine to send a measurement request to the Measurement Engine. The flags background

test in process (140) provides feedback to the Power Quality Monitor Engine to indicate that the test is still process.

Start Test is used by the meter display and communications functions to send foreground and communications priority measurement requests to the Measurement Engine. Should the Measurement Engine receive a measurement request via the Start Test entry point then the background test in process flag will be cleared and the measurement engine running at higher priority flag will be set. When a measurement request has been completed and the requester has read the instrumentation measurement the measurement engine running at higher priority flag will always be cleared. The Power Quality Monitor Engine will not issue a measurement request while the measurement engine running at higher priority flag is set. If the flag is not set the Power Quality Monitor Engine will restart its power Quality monitor test if the background test in process flag is cleared.

In a preferred embodiment the Measurement Engine will perform all actions specified up to the conversion routine specified by the last measurement record in the linked list.

The Measurement Engine will then set the measurement finished flag. When the measurement requester observes that measurement finished is set, then the Measurement Engine will be commanded to perform the last conversion routine and return the final measurement to the measurement requester.

Other embodiments could complete all actions specified by the linked list before setting the measurement finished flag provided that the final measurement result is left undisturbed until it has been read by the measurement requester.

A measurement record will preferably specify zero or one DSP conversion to be performed, one conversion routine to perform, and either the next record to be interpreted or an indicator that the end of the linked list has been reached. The engine will continue operation at the next measurement record and so on until the "next measurement record" field contains a code indicating the end of the linked list.

The measurement records define what the Measurement Engine must do to produce a requested measurement. Each measurement record is comprised of 24 bits. Bits 8 through 13 represent the pointer to the conversion function associated with a measurement record. Depending on the purpose of the conversion function the measurement record fields may be interpreted in different ways by the Measurement Engine. In the preferred embodiment the conversion functions cause the fields to be interpreted in four different ways designated as types 1, 2, 3, and 4 as shown in the following Table 4 below: TABLE 4 Measurement record bit field definitions Record type Bit # 23-22 21-20 19-16 15-14 type 1 chg ph pre conv func index pre xfer type 2 chg ph iteration steps-l pre xfer type 3 phase const index pre xfer dependent type 4 xx expanded function pre xfer Measurement record bit field definitions-continued Record Bit # 13- 7 6 5-0 type 18 type 1 conv rO->dsp conv next measurement function sav only record index type 2 iterate rO->dsp conv iterated function sav only measurement record index type 3 conv rO->dsp conv next measurement function sav only record index with index type 4 expand rO->dsp conv next measurement sav only record index

Measurement Record Field Descriptions In a preferred embodiment the measurement record fields have the following meaning. Other embodiments may choose different field definitions, field sizes and record sizes. next measurement record index Pointer to the next measurement record in measurement table. iterated measurement record index Pointer to the first measurement record for an iterated measurement record sequence. This measurement record sequence will be executed for the number of specified iteration steps. After the last iteration then execution will continue at iterated measurement record index +1. chg-ph Indicates that the phase to be measurement recorded should be modified before the DSP conversion is started. chggh=00 for no change 01 for select phase A 10 for select phase B 11 for select phase C function~index The index to the function record in the function table. pre~conv Indicates actions to be take after DSP conversion values have been scaled but before the conversion routines run. pre~conv= 00 for none 01 ClampO Low VA 10 Clampl Low VA 11 for none (spare) Const~index

Used as an index to the constant table and service thresholds table.

Phase dependent The constant index is phase dependent if the bit is set. In the preferred embodiment the phase dependent bit indicates to certain conversion functions that alternative actions may be taken depending on which service phase the DSP conversion was performed.

PreConversions 0 0 no transfers 0 1 dsp~sav->rl 1 0 rl ->dsp~sav 1 1 dsp sav ->rO, 0->dsp~sav Conversion Routines The conversion routines are defined to operate on the data produced by DSP measurements. Thirty-one routines were required to meet the basic requirements for a preferred embodiment of the meter. These routines are specified by the appropriate value in the func~index field. The actual purpose of each conversion routine is not important to the understanding of the Measurement Engine except for the iterate routine. Table 5 below lists some exemplary routines executable the present invention.

TABLE 5 func~index Name 0 read dummy 1 Scale DataO 2 DataO by Datal 3 Do RMS 4 Do RDS 5 Sum Square data0 datal 6 Expanded Function

7 Iservice Test 8 ArcCos 9 ArcTan A Pack B pfService Test C LLArcCos D LLArcTan E Find Service F Finish Service 10 Add Freq Const 11 Add Normal 12 Iterate 13 Mult Factor 14 Finish THD 15 Div Factor 16 Total Power 17 Scale rl 18 Pack Power 19 Clr rO if rl 0 1A Set rO if rl It Nominal 1B Scale Up 1C Mod 360 1D ClampO Low VA 1E Clampl Low vAa 1F Total VAW Expanded function index Forty-nine additional routines perform basic operations on the power tool working registers. They are provided to support new functions.

TABLE 6 expanded function code Name E HiLoRatio

F Set LL Do RmS 10 XOR Signs LL 11 xor Signs 12 DataO by Datal Set Signs LL 13 DataO by Datal Set LL 14 Set LL 15 Read Data 16 Add Factor 17 Get Freq Const 18 Smult 19 sqrt rO 1A Square data0 datal 1B mag rO 1C mag rl 1D Adjust Index 1E divide 1F Scaled Div 20 sqrt 21 Negate 22 SwaprOrl 23 rO to dsp sav 24 dsp sav to rO 25 dsp sav to rl 26 dsp sav to templ 27 fl to rO 28 rO to rl 29 rO to templ 2A rl to rO 2B rl to r3 2C rl to f2 2D rl to templ 2E rl to dsp sav

2F r3 to rl 30 r3 to rO 31 r3 to templ 32 r3s to rO 33 r3s to rl 34 templ to rO 35 templ to rl 36 f2 to rl 37 sub rl rO 38 sub rl r3 39 sub r3s rO 3A add r3 to rO 3B add sav a rO 3C add sav b rl 3D add r3s to rO 3E add dsp sav to rO 3F Add r3 5 dsp sav Definitions DataO The DSP is capable of producing two conversion results in parallel. DataO represents the primary raw value read from the DSP. DataO is always multiplied by a conversion/calibration factor specific to the type of DSP measurement performed to obtain a calibrated value.

Datal Represents the secondary raw value read from the DSP. Datal is always multiplied by a conversion/calibration factor specific to the type of DSP measurement performed to obtain a calibrate value.

RO, R1 General working registers. The register contents will both be preserved across DSP measurements or while waiting for the display or communications routines to read a Measurement Engine result.

DSP~SAVE Working register defined specifically for use by Measurement Engine functions. The contents is preserved until cleared or overwritten by a Power Quality Measurement Engine function.

Iterate routine The effect of this routine is to provide power tools with a REPEAT...UNTIL capability. The iteration step, and any steps that it may chain to, will be performed and then the iterator will be decremented. This sequence will continue until the iterator decrements from 0 to $FF. Operation will then continue at the next step following the iteration step.

Phase~Pointer,Phase~to~measure The phase~to~measure and phase~pointer contents encode a phase designator; phase a, phase b, phase~c, end/begin and a multiphase test flag.

In general if the multiphase test flag is set then at the Measurement Engine will automatically advance the phase designator in the phase~pointer to the next phase (in end/begin,A,B,C, end/begin order) supported by the service the meter is connected to before interpreting the measurement record indicated by measurement index. After the conversion routine has been executed the Measurement Engine will again automatically advance the phase designator and interpret the measurement record. This advance and repeat sequence continues until the last service phase has been converted and the Measurement Engine advances the phase designator to the end/begin designator. If the measurements will be made according to the phase designator. If the phase designator specified a phase that is not defined for the present service that the meter is connected to then the Measurement Engine will not start and will return measurement started=false to the measurement requestor.

In the preferred embodiment measurement records are interpreted as shown in Figs. 8A-8E. Either entry point Start Background Test (210) or Start Test (220) are suitable for starting the Measurement Engine. The difference between the entry points is simply the implementation of the

preferred embodiments's priority method at 230. The ability to abort measurement requests in process is accomplished by insuring that the iteration capability is reset (240) and the parameters measurement record number, convert~only and phase to measurement overwrite the respective internal data storage areas measurement~index, do~convert~only (250) and phase~pointer (260). The entry point Queue Test (270) used by the Measurement Engine to process special instrumentation measurements such as the service~voltage and service~current. Just after 240 and before the Queue ~Test entry point the Measurement Engine tests the measurement record number for reserved code indicating the service~voltage check or the service current check. These checks require additional processing to set up or check necessary preconditions before the normal functions of the Measurement Engine can be performed. If either type of check is found then the required processing is performed which includes changing the measurement record number to specify a measurement sequence the Measurement Engine is capable of performing. Then control is returned to the Measurement Engine at Queue~Test. The measure the Measurement Engine will be the requester and call itself using entry point Queue Test (270).

Once the parameters passed the Measurement Engine have been saved processing continues as shown in figure 8C. If the Save to flag (310) was received set then the contents of working register RO is transferred to the save register (320). The measurement record fields to be interpreted is denoted MR in 330. MR is the measurement record in the measurement table indexed by the measurement~index. If the do~convert~only flag is set (340) then the convert~can~run flag (370) is set and the Measurement Engine clears the measurement finished flag and returns measurement~started TRUE (3120). If do~convert~only was not set then the change overriding the phase~pointer's phase designation. The phasegointer will then be validated at step 360 to insure that the phase designated is supported by the service and phase. Note that in cases where the service has not been determined the phases supported are determined to be those

phases that the meter has been configured to be capable of measuring. If the phase designated was not supported by the service or auto advancing the phase designator resulted in the end/begin designation (380) then the Measurement Engine returns measurement started FALSE (90) to the measurement requester. If the phasegointer is designating a valid phase then the conversion function index of the MR is tested to see if the MR is a type 2 (iterate) record (3110). If the MR is a type 2 then convert~2can~run is set at ie370 and the Measurement Engine returns measurement~started TRUE to the measurement requester.

All other types of measurement records require a DSP conversion to be started prior to returning (3100). Note that while it is possible for a type 3 or type 4 measurement record to erroneously be processed at step 3100 (erroneous because type 3 and type 4 do not specify a DSP conversion) in practice this will not occur provided the requester has set the convert~only flag. If the preferred embodiment the DSP conversion is started as shown in Figure 4. FR denotes the function record, indexed by the func~index field in the MR, of the function table (410). The FR in conjunction with the phase designator is the phase~pointer represents a complete specification of which DSP conversion to start, what phase to perform the conversion on, how many line cycle pairs to perform the conversion for, what initialization data should be provided to the DSP and what scale factors should be used to scale or calibrate the DSP conversion results to known units of measure. This information is used at 420 to start the DSP conversion. Once the conversion is started the measurement~finished flag (130) is cleared (430) and the Measurement Engine returns measurement~started TRUE (440).

It can be seen from the above discussion that when the Measurement Engine returns to the measurement requester either no measurement was started, or the measurement was started and the measurement finished flag is cleared and either the convert~can~run flag is set and the DSP was not started, or the measurement was started and convert~can~run is not set and DSP conversion was started.

The Measurement Engine responds to the measurement requester as discussed above to begin the instrumentation measurement. Once begun, the Measurement Engine executes independently from the measurement requester as shown in Figure 5. Decision block 510 shows that the Do~Measurement process is in an idle loop while measurement finished is true or while the DSP is converting. If neither case is true then the phase~pointer is tested (560) to see if this was the last measurement to be performed to produce the instrumentation measurement. If the end~of~chain designator is found then the iteration~step is tested to see if an iterate instruction is in process (5130). If not then the measurement finished flag is set to notify the measurement requester that the instrumentation measurement is ready to be read. The measurement requester can be read the instrumentation measurement by calling the read conversion function shown on Figure 6. After the measurement requester has obtained the result the requester clears the measurement engine running at higher priority flag.

If it is determined that an iteration instruction is in process at 130 after finding the end~of ~chain at 560 the conversion function pointed to by the MR will be executed by the Run~Conversion process on Figure 6. After the conversion function has completed the iterator value will be decremented. If that was the last iteration then the measurement~index will be changed to the contents of iteration~step to phase pointer indicates that this is a multiphase measurement then the phase~pointer will be reset to the end/begin designator so that after the auto advance occurs at 360 the next phase measurement will be phase A.

Processing continues at 530 to begin the next iteration. Continue Test is called to start the first measurement of the iterated sequence. After Continue Test returns either the measurement was not started or it was started either converted~can~run is true or false. If the measurement was not started then the conversion routine for the MR corresponding to the measurement~index will not be executed. Instead processing will continue at 51340. If the measurement was started and convert~can~run is false

then a DSP conversion was started and the Measurement Engine must wait for the conversion to complete (5100). If convert can run is true then a DSP conversion was not started. The conversion routine of the MR is executed by Run~Conversion~Function (5110). After the conversion function has completed the next~measurement~index of the MR is checked for the end~of~chain code. If the end~of ~chain code is discovered then processing begins again at 5130 as described above. Otherwise processing will continue at 51340.

At 5140 the next~convert~only flag of the MR is transferred to the convert only flag and the next measurement index field of the MR is transferred to the measurement~index to select the next MR. Processing continues as 5170 as described above. At 560 if the next measurement index was not the end of chain code then the conversion routine specified by the MR will be executed by calling the Run~Conversion process (590). After the conversion routine has been has been completed then processing will continue at 5140 as described above.

At 520 if the phasegointer can be auto advanced to another phase supported by the service then the conversion routine specified by the MR will be executed by a call to Run~Conversion (540). After the conversion routine has been completed the processing will continue at 550 as described above.

The Run~Conversion routine flowchart is shown if figure 6. The Preconversions field of the MR processed in 610 provide general purpose register operations to all conversion functions. If the MR caused a DSP conversion to be performed (620) the DSP conversion results are read and the scaled by the scale factors pointed to be the function record selected from the function table according to the func~index field of the MR (530). The pre~conv function specified in the MR is then performed on the scaled data (640). Lastly, the conversion routine specified by MR is called (650) and then Run~Conversion returns to its caller.

If at 620 it was determined that no DSP conversion had been

performed the processing will continue at 650 as described above.

In a preferred embodiment at least fourteen different power quality tests are programmed for concurrent operation.

Referring back to Figure 5, power quality tests also referred to as background tests can make use of the following resources: Occurrence logs 86, event logs 78, active warnings 76, load control relays 84 and display warnings 88. There are preferably the same number of occurrence logs as power quality tests. An occurrence log consists of a logging flag, a binary occurrence counter, and an occurrence timer. Background warning start and stop times can be recorded in the event log if the background test has an occurrence log specified. The event codes are based on the occurrence log number associated with the background test. Each background warning condition can be programmed to assert the load control relay. The relay will only deassert if no function within the meter has requested an assertion.

The use of these power quality resources is explained in detail below.

Figure 9 is a context diagram showing the power quality test engine processing utilizing internal flags in accordance with the present invention. Power Quality tests are checks of instrumentation values to determine unusual conditions on the electrical service which might indicate power quality, equipment failure, or tampering issues.

These usual conditions are qualified against a magnitude threshold for a minimum duration. For example, voltage above 120% of the nominal voltage might damage electrical equipment, but short term transitions to this level have little effect and are relatively common. Thus, a magnitude and a minimum duration is typically required to qualify a condition as an abnormal condition. These qualified tests are referred to as Power Quality Events. The magnitude thresholds can be minimum thresholds as well as maximum thresholds. Thresholds can also define acceptable or abnormal bands of operation. Because the meter can operate in a number of services and over a number of voltages, the thresholds for many of the monitors are best defined in terms of the service locked into the meter. Other tests

need thresholds which are absolute numbers. Both methods are supported in the present invention. The duration can be defined in terms of seconds or minutes. In accordance with the present invention any number of quantities can be monitored for abnormal conditions within practical constraints imposed on the background processing and the desired time frame for repeating the tests. These quantities can be defined to a particular phase or can be treated generically for all meter phases.

The Power Quality test are performed preferably, one- at-a-time in sequence. Quantities are requested of and obtained from the Meter IC 14 over the IIC serial bus 36 using the Instrumentation (Power Quality Measurement) feature of the Meter IC when other higher priority operations are not using this feature of the Meter IC. This display and communications routines have priority over the Power Quality Monitors. Because the Power Quality Measurements vary in length and the other routines have a higher priority than the Power Quality tests, time between monitor samples is not consistent or predictable as is described in more detail below.

When a Power Quality event is identified a number of actions can be taken by the meter. The meter can count the event and accumulate the duration of the event. The meter can also set a warning which can appear on the meter's display. The meter can also set a warning which is definable by the utility, but only available through optical or remote communications. The meter can also operate a relay. The meter can also record the start and end time and date of the event in an event log. The exact action of the meter is defined by the meter configuration.

The operation and interactions of the Power Quality Monitor can be better understood by looking at the POWER QUALITY MONITOR CONTEXT DIAGRAM in Figure 9, the state diagram in Figure 10 and the associated flow charts in Figures llA-llI. Before the Power Quality tests are operational several conditions are preferably satisfied. If these are not met, the meter continues to poll these conditions to see when they have been met. The BACKGROUND

ENABLE FLAG turns on or off the Power Quality test feature within the meter, and thus, this flag must be set before the tests may be carried out by the meter. As previously stated, the thresholds for many of the Power Quality tests are defined in terms of the service locked into the meter, thus, the SERVICE LOCKED FLAG is also preferably set. Also, if Power Quality tests are enabled to run, the service is not locked, and service checks are not permitted to run (disabled), the meter has not been configured correctly because the service can never be locked-in. In this condition a warning should be set. In this invention this is the same warning as is displayed for Active Power Quality Monitor Events (POWER QUALITY MONITOR WARNING FLAG) Other warnings are also within the scope of the invention.

Because Test Mode is used when the meter is being verified, service conditions may be abnormal while the various tests are being run. Thus, in accordance with a preferred embodiment of the invention, the Power Quality tests are disabled while in the Test Mode (the METER IN TEST MODE FLAG is set). It should be understood however, that the power quality tests may be enabled during test mode operation.

Thus in a preferred embodiment, if any of these flags are set, the Power Quality tests do not run.

In addition, certain conditions can suspend Power Quality tests while higher priority routines are serviced.

Because the Power Quality tests preferably use the same resources within Meter IC 14 as the Display or Communications Routines, the Power Quality Monitor is suspended while measurements for these higher priority routines are performed (MEASUREMENT ENGINE RUNNING AT HIGHER PRIORITY FLAG) and while previous measurements are in- progress (BACKGROUND TEST IN PROCESS FLAG). If the measurement does not successfully complete, an error flag is set (MEASUREMENT ERROR FLAG), and in the present invention we advance to the next test. This is done so that a measurement error caused by improper configuration or equipment failure does not prevent other Power Quality Monitors from running. When any pending measurements have successfully completed (MEASUREMENT FINISHED FLAG) and the

conditions previously described in this paragraph have been met, the Power Quality Monitors are free to start a measurement sample.

Because the time between Power Quality Measurements will vary, an ELAPSED SECONDS count and FREE RUNNING MINUTES TIMER is used to provide the time base. The Power Quality test engine needs to know which test is the next to execute.

This is controlled by a pointer to the next record BKGND~REC known as BKGND~INDEX. The monitor defines the measurement to make (MEASUREMENT RECORD NUMBER) and the phase or phases to measure (PHASE TO MEASURE). Thus the POWER QUALITY MONITOR ENGINE knows the next measurement to perform. (The BKGND~INDEX is normally not 0.) The monitor engine starts the test by setting (TRUE) the BACKGROUND TEST IN PROCESS FLAG and clearing other flags that will be used in the engine. The monitor can be run on a single phase specified in the monitor record, on all valid phases performing the test on each phase, or on all valid phases performing the test once on the combination of the phases. The PHASE~CODE in the record is examined and based on its value is assigned to the variable PHASE~TO~MEASURE and for a monitor which tests all valid phases individually, the MULTIPHASE TEST variable is set (TRUE). This information and the MEASUREMENT RECORD NUMBER are provided to the POWER QUALITY MEASUREMENT ENGINE to start the measurement. The POWER QUALITY MEASUREMENT ENGINE provides information on the status of the measurement by setting the MEASUREMENT ERROR FLAG. If the measurement did not start, the Power Quality Monitor Engine clears the BACKGROUND TEST IN PROCESS FLAG and the MEASUREMENT ERROR FLAG, and advances to the next Power Quality Monitor.

Because the display warning code can be driven by multiple monitors, a state is needed to check if no events are active. In this invention the test index equal to 0 allows for this state. This state could have occurred at other (or multiple) test index numbers. When the test index equals 0, the Power Quality Monitor Engine assumes an event is active (BACKGROUND WARNED FLAG set). The assigned background warning flags are examined and if all of those

which are intended to drive a display warning (POWER QUALITY MONITOR WARNING FLAG) are clear, the BACKGROUND WARNED FLAG is cleared. And if the SERVICE CHECK ERROR FLAG is not set, the POWER QUALITY MONITOR WARNINGS FLAG is cleared.

Otherwise, the POWER QUALITY MONITOR FLAG is set. The BKGND~INDEX is now set to 1 and the background warning flags are cleared-waiting to be set at the detection of an event.

When the measurement is complete, the high and low thresholds may need to be computed from the nominal identified in the monitor record. The quantity is compared using the test defined within that Power Quality Monitor record against the raw or computed threshold by the POWER QUALITY MONITOR ENGINE. If the threshold test indicates a possible event (fails the test criteria), the event may need to be qualified against a minimum duration and warnings and other event logging may need to occur. The routine in this invention which determines when and what actions to take is the LOG-FAULT routine. The LOG~FAULT routine is passed the OWNER~CODE which defines if the high or low threshold was exceeded, the LOG~NUMBER which is the log number in the monitor record corresponding to threshold exceeded, and the WARNING~NUMBER which is the warning code in the monitor record corresponding to the threshold exceeded.

In the LOG~FAULT routine, if the minimum duration (ALARM TIME) in the monitor record is 0, the event does not need to be qualified against a minimum duration and can be immediately logged. This is done by checking the monitor record to see if the POWER QUALITY MONITOR WARNING FLAG should be set (this causes a warning to be displayed on the meter LCD), and the BACKGROUND WARNING BIT assigned in the monitor record is set. Based on the OWNER~CODE either the USING~HIGH or USING~LOW variable is set (TRUE). These variables are used to identify the owner of the log. If the LOG~NUMBER does not point to a real occupance log, the LOG~FAULT routine can do no more, and thus, returns. If the LOG~NUMBER points to an occurrence log presently in use (LOGGING FLAG set), the routine need not do anything else, and thus returns. If the LOG~NUMBER points to an occurrence log not presently in use, the routine increments the number

of event (OCCURRENCE LOG), and sets the LOGGING FLAG. If the RELAY REQUEST FLAG is set in the monitor record, then set the BKGND RELAY FLAG and note that this log has set the relay flag (BK RELAY). This is necessary to assure that this log has set the relay flag (BK RELAY). This is necessary to assure that the BKGND~RELAY only gets cleared if all the logs which can set the BKGND~RELAY have ceased to have active events. If event logging (time and date of occurrence in the event log) is enabled in the monitor record, the start condition for this event is generated by adding hex'80' to the log number and sending this event code to the event log routine.

If the minimum duration (ALARM TIME) in the monitor record is not 0, the event needs to be qualified against a minimum duration. The units of the minimum duration (TIMEBASE), minimum duration value (ALARM TIME VALUE), and timer to use to time the minimum duration (ALARM TIMER ) are also defined in the Power Quality Monitor record. Sixteen ALARM TIMERS are available from which to choose. Multiple monitors can use the same timer. However, if the monitor record does not reference a real alarm timer, this qualification can not occur, and thus, the warnings for the event are set as described above, and the routine returns.

If a real alarm timer is referenced, that timer is checked to see if it is 0 (not running). If it is 0, the alarm timer is assigned to the OWNER~CODE. The monitor activating the ALARM TIMER is maintained OWNER CODE) so that the POWER QUALITY MONITOR ENGINE knows which minimum duration time to compare the alarm timer's ELAPSED TIME against and which monitor can terminate the timing of a condition. The timer is started using the timebase defined in the monitor record.

When a timer is started an ALARM TIMER STATUS is set indicating that the timer is in use. The routine can then return. If the alarm timer is running (timer not equal to zero) an event is presently being timed. If this event (OWNER~CODE) is not the same event as presently timed, the routine returns. Otherwise, based on the OWNER~CODE either the USING~HIGH or USING~LOW variable is set (TRUE). The alarm timer is tested. If the timer is still timing

(LOGGING FLAG True), then the routine returns. If the timer is suspended indicating that the timer was used to qualify an event but no occurrence log is being used then the warnings for the event are set as described above and routine returns. If the timer has met the minimum duration requirement (Timed Out), the warnings for the event are set as described above and the LOG~NUMBER is checked. If the LOG~NUMBER points to an occurrence log presently in use (LOGGING FLAG set) then the alarm timer must have timed out at least once before and was reloaded to measure its largest possible time interval. In that case the routine adds the largest interval to the timer to record the elapsed interval and then again restarts the alarm timer to measure its largest interval and select the minute timer as the time base, and returns. If the LOG~NUMBER points to an occurrence log not presently in use, the routine increments the number of events (OCCURRENCE LOG), and sets the LOGGING FLAG. If the RELAY REQUEST FLAG is set in the monitor record, then set the BKGND RELAY FLAG and note that this log has set the relay flag (BK~RELAY only gets cleared if all the logs which can set the BKGND~RELAY have be ceased to have active events. If event logging (time and date of occurrence in the event log) is enabled in the monitor record, the start condition for this event is generated by adding hex'80' to the log number and sending this event code to the event log routine. The routine then increments the occurrence timer by the alarm time value specified in the monitor record minus the elapsed time in the minute timer, restart the alarm timer to measure its largest interval and select the minute timer as the time base, and returns.

Thus, the timers are appropriately started and any warnings have been flagged.

Once any faults are logged the MULTIPHASE TEST flag is checked. If this is a mutiphase test, the PHASE~TO~MEASURE is advanced to the next phase supported by the locked service. If this is not the last phase, the above measurement is repeated on the new phase and the above operation is repeated back to this point. If this was not a multiphase tests or it was the last phase of the multiphase

test, the status of the event is checked by the Check Test Status routine.

Since a single power quality monitor test definition can cause multiple phases to be tested and possibly logged the Power Quality Monitor Engine does not attempt to change an occurrence log from logging to not logging or clear an alarm timer until all phases specified by the power quality monitor test have been tested. Check Test Status is responsible for inspecting the test conditions and make the decision to transition from logging and or timing an event into waiting for the next event. This transitioning operation is referred to as closing the log. If the power quality monitor test specifies the same occurrence logs for both high and low events then if either USING~HIGH or USING~LOW is set the occurrence log and alarm timer should be left in its present state and Check Test Status returns.

If both USING~HIGH and USING~LOW are clear then Clear Log is called with parameters warning~stop~code set the occurrence log number. Clear log will perform the transition steps required to close the log specified in log~to~close. If an alarm timer was used by the test is cleared in preparation for timing the next occurrence of an event. Check Test Status will then return. If Check Test Status determines that different occurrence logs are specified for high and low events then conditions will be checked to see if each log can be closed. If USING~LOW is not set then the low log can be closed. The warning~stop~code will be set to low~warning~code and Clear Log will be called to insure the low log is closed. After Clear Log returns or if USING LOW was true then USING~High is tested. If USING~HIGH is set then no further action is required and Check Test Status returns. Otherwise the warning~stop~code will be set to the high warning code and Clear~Log will be called to insure the high log is closed. At this point if USING~LOW is clear then neither high nor high nor low type events are being logged. If an alarm timer was used by the test it is cleared in preparation for timing the next occurrence of an event. Check Test Status will then return.

If USING~LOW is set then the alarm timer must be left as is and Check Test Status will return.

As previously stated Clear log will perform the transition steps required to close the log specified in log to close. The background warning bit indexed by the passed warning code is always cleared. If the log~to~close does not point to a real occurrence log then no further action is required and Clear~Log returns. Otherwise the occurrence log referenced by log to close is closed by insuring that the logging flag is cleared. If an alarm timer was in use by the power quality monitor test then the elapsed time since the alarm timer was last restarted and the elapsed seconds since the minute timer last rolled over are added to the occurrence timer. If the relay request flag is set for the power quality monitor test then the relay request flag corresponding to the log~to~close will be cleared. If the relay request flags are determined to be cleared then the bkgnd relay flag will also be cleared to indicate that no power quality monitor test requires the relay associated with background test to be cleared. If event logging is enabled for the power quality monitor test then an event code of hex$C0 +log to close is sent to the event log to record the transition from log open to log closed. Finally, Clear~log returns.

So in summary: If the condition does not persist for the minimum duration, the ALARM TIMER STATUS is cleared, and the event is not qualified and is treated as if the condition never existed. If the condition persists for the minimum duration, a new ALARM TIMER STATUS is set and a number meter operations can occur depending on the configuration of the Power Quality Monitor. If the monitor is configured to have an event drive one of the 14 OCCURRENCE LOG's the OCCURRENCE COUNT is incremented in the appropriate OCCURRENCE LOG and the LOGGING STATUS is set for that LOG. When the event terminates, the ALARM TIMER elapsed time is added to the OCCURRENCE TIME and the logging status is cleared (NOT LOGGING STATUS). If the monitor is configured to drive the EVENT LOG, the start time and date of the event is recorded with the start EVENT CODE in the

EVENT LOG. When the vent terminates, the end time and date of the event is recorded with the end EVENT CODE in the EVENT LOG. (The EVENT CODE is defined by the Power Monitor number so that the actual monitor causing the event is known., but other methods of assigning the EVENT CODE's could be. employed.) If the monitored is configured to drive a specific warning (ASSIGNED BACKGROUND WARNING FLAGS) that defined warning is set in the POWER QUALITY MONITOR WARNING FLAG for the duration of the event. This warning is cleared when the event ends. If the monitored is configured to drive the display warning for Power Quality Monitor Events (BACKGROUND WARNING FLAG) this flag is set for the duration of the event. This warning is cleared when all events end which are driving this warning. If the monitor is configured to drive the load control relay, the BKGND RELAY FLAG is set for the duration of the event. This flag is cleared when the event terminates. The relay drive routine monitors this flag and handles the actual driving of the relay. The Power Quality Monitors can configure any combination of these operations.

The meter may be programmed to increment event counters, totalize event times, set warning indicators, latch relays, and log event start and stop times when a measurement fails a test. The tests may be further qualified by timers such that a measurement fails a test for a programmable amount of time (e.g., 1 second to 60 minutes) before the programmed action occurs. Such parameters are stored in the EEPROM in the power quality test table shown in Figure 3. The power quality test table comprises a preselected set of records. Each power quality test definition specifies the electrical measurement to perform, the phase or phases to test, the type of comparison to perform after the measurement, the value to compare the measurement against, the amount of time that the test must fail before an action is taken, and the action to take in the event that a measurement exceeds a threshold. In a preferred embodiment the records comprise the following field descriptions:

Field 1: Comparison test number - This field is a single index that specifies which of several possible types of comparison tests to perform on the value measured during a given background test and the threshold values specified by the background record.

Field2 Specifies actions to take if a test against a low threshold fails.

Field 3: Specifies actions to take if a test against a high threshold fails.

Field 4: Initial alarm time value - Specifies the time that a warning condition preferably should exist before a failure is declared.

If the value is zero then no time delay will be in effect and warning conditions are consequently logged immediately upon detection.

Field 5: Timer number - Specifies the alarm timer to be used if the initial alarm time value is non-zero.

Field 6: Low log number - Specifies which occurrence log to use to log low warnings, Field 7: High log number - Specifies which occurrence log to use to log high warnings.

Field 8: This field provides the raw data used to compute a high threshold value to test against a background measurement. The field is interpreted as either an Embedded Normal value, an Embedded Percent value or a Percent Above Nominal value depending on the value of the Nominal~Code in field 10.

Field 9: This field provides the raw data used to compute a low threshold value to test against a background measurement. The field is interpreted as either an Embedded Normal value, an Embedded Percent value or a Percent below Nominal value depending on the value of the Nominal~Code in field 10.

Field 10: Specifies the Nominal Code and the Phase~Code designating either phase A, B or C which are described in more detail below.

Field 11: DSP measurement record index - Specifies the measurement record number needed for the background test to be performed. An index of 0 indicates the end of the background test list if fewer than maximum background tests are defined. Setting any background test

index will cause that background test and all following tests not be performed. The background test sequence will start again at test 1. Note that setting DSP~Test~Index = 0 is one way to disable background tests.

Referring back to Figure 5, the power quality engine performs the designated comparison test after receiving the measurement 60 from measurement engine. The returned measurement is then tested in accordance with the comparison tests specified by the power quality test record utilizing service specific thresholds 70 which are referenced by the power quality test records. The following lists a few exemplary power quality tests and describes how these tests utilize service threshold information.

PQ Test 1: Abnormal service voltage: - Defined by the Service Test (repeated below) Measured voltage phase angles outside a degree nominal voltage angle band; and Measured voltages outside a +/-10% nominal phase voltage band.

Duration: Either condition or combination of conditions for greater than 60 seconds.

PQ Test 2: Abnormally low voltage Measured voltage less than 6% of nominal service voltage (ANSI B limit) on any phase.

Duration: Condition on any phase or combination of phases for greater than 60 seconds.

PQ Test 3: Abnormally high voltage Measured voltage greater than 6% of nominal service voltage (ANSI B limit) on any phase.

Duration: Condition on any phase or combination of phases for greater than 60 seconds.

PQ Test 4: Abnormal service current (power factor and reverse power) - Defined by the Service Current Test (repeated below) Leading or lagging measured power factor less than 0.25 on single phase and wye services, and 0.00 on delta services, Negative measured power (current) on any phase.

Duration: Either condition or combination of conditions for greater than 5 minutes.

PQ Test 5: Abnormally low service current - Defined by the Service Current Test

Measured current less than 0.1% of class current on any phase, but not ALL phases.

Duration: Condition on any phase or combination of phases for greater than 5 minutes.

PQ Test 6: Abnormal power factor Measured Power factor less than 0.45 leading or lagging on any phase on single phase and wye services, and 0.2 on delta services.

Duration: Condition on any phase or combination of phases for greater than 5 minutes.

PQ Test 7: Excess 2nd harmonic current - Measured 2nd harmonic current greater than 0.5 amperes on any phase.

Duration: Condition on any phase or combination of phases for greater than 15 minutes.

PQ Test 8: Excess total harmonic current distortion Measured total harmonic distortion greater than 30% of fundamental on any phase.

Duration: Condition on any phase or combination of phases for greater than 60 seconds.

PQ Test 9: Excess total harmonic voltage distortion Measured total harmonic distortion greater than 30% of fundamental on any phase.

Duration: Condition on any phase or combination of phases for greater than 60 seconds.

Based on the outcome of the specified power quality test, one or more power quality resource 76, 78, 80, 82, 84, 86, 88 in Figure 5 are acted on by the power quality engine as is described in detail below. The individual power quality monitor comparison tests specify exactly how fields 6, 7, 8 and 9 are used. In general, low log numbers indicate the log to use if a test against a low threshold fails.

Likewise the high log numbers are used when testing measurements against high thresholds. This implementation allows a single measurement to be tested against one or more thresholds but defining a single test. With a single log the statistics about the times the test failed are known.

However, for multiple threshold tests information about which threshold was crossed more often or for longer periods of time is preferably not delineated. The use of two logs supports band type tests where a measurement may be required to be either between two thresholds or outside two

thresholds. This allows outcome statistics to be collected for each threshold.

Each power quality test is capable of selecting one value from the service thresholds table shown in Figure 3.

The value selected is considered to be a nominal value to be used to create test thresholds. High and low thresholds are computed by scaling the nominal value up and down by the high and low threshold percent values which are preferably labeled Raw High Threshold and Raw~Low Threshold in the power quality test table. The service thresholds table has been implemented as packed array of words or records. The array is indexed by the Nominal~Table~Index. The Nominal~Table~Index is stored in the Nominal~Code~sub-field of field 10.

As an example consider a nominal code represented by a five-bit value. If the five bits are considered to represent values from $00 to S1F then: values in the range of $00 to S1C are considered to be word boundary indices into the service thresholds table; the value S1D is used to specify that the special six byte value bk~factor should be used as the nominal value; the value S1E is used to specify that the high and low thresholds should be generated by treating the high and low threshold percent values as packed word values for the high and low thresholds that each represent the range of 0 to 100 percent; the value S1F is used to specify that the high and low thresholds should be generated by treating the high and low threshold percent values as packed word values for the high and low thresholds that each represent the range of 0 to 1. In a preferred, embodiment computes and stores the thresholds using forty- eight bit arithmetic with sixteen bits of resolution to the right of the binary point.

Field 10 also contains a three bit sub-field called Phase~Code to indicate the phases the power quality test shall test. The values of the Phase~Code field are defined as follows: Phase~Code = 0..7 0 = Test Phase a measurement

2 = Test Phase B measurement 4 = Test Phase C measurement 1 = Measure all service phases and perform one test on the result 7 = Test all service phases one at a time.

The power quality monitor engine is responsible for interpreting the Phase~Code field and constructing correct measurement requests to the power quality measurement engine.

Referring back to Figure 10, each power quality test will be in a state that depends on whether or not an alarm timer is allocated to the test, whether or not an occurrence log is allocated to the test, and on the condition being monitored relative to programmable test limits.

If no alarm timer or occurrence log is assigned to a power quality test then the power quality test will either be in state sl or s2. The power quality test will be state sl as long as the measurement defined for the test passes the test. If a measurement defined for the test fails then the test the warning bit assigned to the power quality test will be set, the power quality monitor warning flag will be set if programmably enabled for the power quality test and the power quality test will be in stated s2. The power quality test will remain in state s2 until the measurement defined for the test passes and the power quality test returns to state sl. During the transition to state sl the warning bit assigned to the power quality test will be cleared.

If no alarm timer is assigned to a given power quality test but an occurrence log is assigned then the power quality test will either be in state s3 or s4. The power quality test will be in state s3 as long as the measurement defined for the test passes the test. While in state s3 if a measurement defined for the test fails the test then the warning bit assigned to the power quality test will be set, the power quality monitor warning flag will be set if programmably enabled for the power quality test, the

occurrence log logging flag will be set, the binary occurrence log will be incremented, a relay request flag corresponding to the occurrence log number will be set, if programmably enabled, to request the load control relay be actuated, a power quality monitor start event code corresponding to the occurrence log number will be sent to the event log if programmably enabled, and the power quality test will be state s4. The power quality test will remain in state s4 until the measurement defined for the test passes and the power quality test returns to state s3.

During the transition from state s4 to s3 the warning bit assigned to the power quality test will be cleared, the relay request flag corresponding to the occurrence log number will be cleared, if programmably enabled, to indicate that this power quality test does not require actuation of the load control relay and the occurrence log logging flag will be cleared.

If an alarm timer is assigned to a given power quality test but an occurrence log is not assigned then the power quality test will either be in state s5, s6 or s7. The power quality test will be in state s5 as long as the measurement defined for the test passes the test. If a measurement defined for the test fails the test then the alarm timer assigned to the power quality test will be programmed with the alarm time value defined for the power quality test. The power quality test will transition to state s6 and shall remain in this state until either the measurement defined for the test passes or until the alarm timer times out. If the measurement for the test passes then the alarm timer will be disabled and the power quality test will return to state s5. If the alarm timer times out while in state s6 then the warning bit assigned to the power quality test will be set, the power quality monitor warning flag will be set if programmably enabled for the power quality test, the alarm timer will be disabled, and the power quality test will transition to state s7. The power quality test will remain in state s7 until the measurement defined for the test passes and the power quality test transitions to state s5. During the transition from states

s7 to s5 the warning bit assigned to the power quality test will be cleared and the power quality monitor warning flag will be cleared if programmably enabled for the power quality test.

If an alarm timer and an occurrence log is assigned to a given power quality test then the power quality test will either be in state s8, s9 or slO. The power quality test will be in state s8 as long as the measurement defined for the test passes the test. If a measurement defined for the test fails the test then the alarm timer assigned to the power quality test will be programmed with the alarm time value defined for the power quality test. The power quality test will transition to state s9 and shall remain in this state until either the measurement defined for the test passes or until the alarm timer times out. If the measurement for the test passes then the alarm timer will be disabled and the power quality test will return to state s8.

If the alarm timer times out while in state s8 then the warning bit assigned to the power quality test will be set, the power quality monitor warning flag will be set if programmably enabled for the power quality test, the occurrence log logging flag will be set, the binary occurrence log will be incremented, the relay request flag corresponding to the occurrence log number will be set, if programmably enabled, to request the load control relay be actuated, a power quality monitor start event code corresponding to the occurrence log number will be sent to the event log if programmably enabled, the alarm time value will be added to the occurrence timer, the elapsed seconds of the free running minute timer will be subtracted from the occurrence timer, the alarm timer will be restarted to measure its maximum elapsed time (sixty minutes in the preferred embodiment using the free running minute timer as the alarm timer's time base), and the power quality test will transition to state s10. The power quality test will remain in state s10 until the measurement defined for the test passes or until the alarm timer times out. If the alarm timer times out while the power quality test is in state sl0 then the maximum elapsed time that the alarm timer

has measured will be added to the occurrence timer and the alarm timer will be reloaded to measure its maximum elapsed time. If the measurement passes the test while the power quality test is in stated slO then and the power quality test transitions to state s8. During the transition from state s10 to s8 the warning bit assigned to the power quality test will be cleared, the relay request flag corresponding to the occurrence log number will be cleared, if programmably enabled, to indicate that this power quality test does not require actuation of the load control relay, the power quality monitor warning flag will be cleared if programmably enabled for the power quality test, the elapsed time since the alarm timer was reprogrammed will be added to the occurrence timer.

The purpose of subtracting the elapsed seconds of the free running minute timer from the occurrence timer during the transition to state slO and later adding the elapsed seconds of the free running minute timer to the occurrence timer during the transition to state s8 is to enable the use of a single free running minute timer as a time base to multiple alarm timers running asynchronously with respect to each other while maintaining the time measurement accuracy and resolution of the free running minute timer's timebase.

C. SERVICE IDENTIFICATION Figure 12 is a flow diagram showing the steps carried out by microcontroller 16 in accordance with the present invention to automatically and electronically identify the service At 1000 the DSP outputs which drive the phase potential indicators (Figure 2) are checked. In a preferred embodiment, phases having an associated output with a high signal level are determined to be powered.

Information representing the meter element configuration is preferably stored in a predefined memory location in the EEPROM. In a preferred embodiment, information indicating whether the meter must utilize all of the elements is also stored in a memory location in the EEPROM. The meter element configuration refers to how many and which phase voltages and currents the meter is capable

of measuring. At step 1002 the microcontroller checks the meter element configuration data stored in the EEPROM to determine whether the maximum meter elements must be used or whether a lesser number of elements can be used. If the maximum meter elements must be used, then at 1006 the microcontroller determines whether the correct phases are available, i.e., the phases present match the phases identified by the meter element configuration data. If the correct phases are not available, no service is determinable.

If the maximum number of elements is not required as determined at 1002, then the microcontroller checks for valid configurations such as single phase on phase A, 2- phase (present on phases A and C), and three-phase services at 1004. Other configurations are preferably deemed invalid.

If no service is determinable or if the configuration is invalid, then at 1008 the unknown service code, e.g., "NONE", is stored in RAM in connection with the service type status information which is referred to herein as the service byte..

At step 1010, the microcontroller determines whether the service is a single phase, two-phase or three-phase service. When the service is two-phase service, the angle for Vca (the phase angle between phase C and phase A) is measured. When the service is a three-phase service, phase angles Vba (the phase angle between phase B voltage and phase A voltage) and Vca are measured. In a preferred embodiment, the voltage phase angles are measured using an FFT technique referenced to zero-crossing of Va.

As discussed above in connection with Figure 3, a service angle table is stored in the EEPROM. The service angle table which will be described in detail below, generally includes records with a service byte and nominal phase angles for phase C and B. The service byte is the first byte in the service record and defines the services to which the entry applies. For example, the service byte format may be represented as follows:

Bit 7: spare - not used.

Bit 6: cba - defines that cba rotation is a valid rotation.

Bit 5: abc - defines that abc rotation is a valid rotation.

Bit 4:4wd - 4wd service; 1 = 4WD, 0 = not 4WD.

Bit 3:4wy - 4wy service; 1 = 4WY, 0 = not 4WY.

Bit 2:3wy - 3wy service; 1 = 3WY, 0 = not 3WY.

Bit 1:3wd - 3wd service; 1 = 3WD, 0 = not 3WD.

Bit O: ip - single phase service; 1 = 1P, 0 = not 1P.

The nominal phase angles are preferably in 2-byte format represented in binary in 0.01 deg. increments. The microcontroller at step 1016 searches the service phase table record-by-record for the first service that includes the measured voltage angles. This process will be described in detail below. If a service phase angle record is found for the measured phase angles at step 1020, the service byte is defined to identify the phase rotation and service type corresponding to that record. Otherwise no known service is found, e.g. Service byte = "NONE" as shown at step 1008.

When the service byte has been defined, either because the service was determined to be a single phase service at step 1010 or through the table search technique described in connection with steps 1016 and 1020, the service test continues at step 1018. At step 1018, each phase voltage that is present is measured. Then using these measurements, the microcontroller searches the service voltage table (described in connection with Figure 3) at step 1022 for a record that includes the service type identified by the service byte and each measured phase voltage. In a preferred embodiment the records in the service voltage table may include a service definition byte identifying possible services and scaling information, information identifying the nominal service voltage, information identifying the programmable potential indicator threshold to be used with the service, and information identifying each of the maximum and minimum tolerances with respect to the nominal service voltage.

Once the phase voltages are measured the records are searched to determine whether the measured voltages are within the defined tolerance range for the phase and service type. If the voltages are valid as determined at step 1024 then the nominal voltage will be returned. The service voltage record search must repetitively find a service voltage record that matches the service designated by the service byte. The high and low tolerances corresponding to the nominal voltage in the service voltage record are preferably based on a minimum and maximum percent of the service voltage. All voltages for the service preferably fall within the thresholds. Note that some service types may require that phase A, B and C limits be scaled. The voltage test procedure as well as the fields of the service voltage table records will be described in more detail below.

If a voltage test record is not identified at step 124 as a matching record, than the service byte is defined as "NONE" and the service nominal voltage is set to zero at step 108. If a voltage test record is identified at step 124 then the service byte and service voltage identified by the matching record is returned and stored in RAM.

Figure 13 is a detailed flow diagram showing the service phase table search procedure in accordance with the present invention. This procedure is best illustrated by reference to the Service Phase Table definition set forth below: ;*********************************************************** *********** ;00 00 00 00 00 00 ;header spares <BR> <BR> ;09 C4 ; eephase~tolerence 25 degrees * 100 = 2500 = $09C4<BR> ;05 dc ; eephase~tolerence 15 degrees * 100 = 1500 = $05dc<BR> ;37 ; Not Used ; service test; record definition service service information byte na,cba,abc,s4wd, s4wy,s3wy,s3wd,slp ; c nom phase c nominal angle * 100: high,low b nom phase b nominal angle * 100: high,low service information byte column: 4 3 2 1 0 ; index na, cba,abc, s4wd, s4wy, s3wy, s3wd, s1p 2100 00 00 00 ; 1 1ph 0 0 1 0 0 0 0 1 62 75 30 17 70 ; 23WD ABC, CBA: C 1 1 0 0 0 1 0 ; phC: ; 300*100 = $7530 ; phB:

60*100 = $1770 70 69 78 46 50, 3 4WD ABC, CBA: 0 1 1 1 0 0 0 0 ; phC: 270*100 = $6978 <BR> <BR> ; phB:<BR> <BR> 180*100 = $4650 ; 6C 5D C0 2E E0; 4 3WY,4WY ABC,CBA: 0 1 1 0 1 1 0 0 ; phC: 240*100 = $5DC0 <BR> <BR> ; phB:<BR> <BR> <BR> 120*100 = $2EE0 ; 21 46 50 46 50 ; 51 ph 180 degree 0 0 1 0 0 0 0 1 ; 00 00 00 00 00 ; 6 spare 0 0 0 0 0 0 0 0 The phase angle tolerances are preferably stored in EEPROM in advance as indicated. The record definition includes a "service information byte" which in the preferred embodiment includes the bit definition as indicated above.

Specifically, bit 7 is empty, bit 6 defines a cba phase rotation, bit 5 defines a abc phase rotation, and bits 4-0 define different service types. Each record in the service phase table includes a different service information byte.

Referring back to figure 13, the first record in the service angle table is checked at 1032 to determine whether the service information byte includes an abc rotation bit.

If so, the nominal phase angle range is then computed at 1034 for phase C and phase B if those phase are present.

The phase angle computations are preferably carried out by adding the tolerance specified for the appropriate phase to the phase angle specified in the record to obtain the upper angle limit for the phase and subtracting the tolerance from the phase angle specified to obtain the lower limit for the phase. For example, referring to the Service Angle Table above, assume the tolerance to be 25 deg. Considering the first listed record, to determine the phase angle range to compare the measure phase angle for phase C, the following computations are carried in hex: upper limit = 7530 +05dc or in decimal 300 deg. + 25 deg. lower limit = 7530 +05dc or in decimal 300 deg. - 25 deg.

If the measured phase angles are within the ranges computed as determined at 1036, the first service bit = 1 going from left to right in the service information byte is identified as the service at 1038. For example, considering the first record in the Service Angle Table above, the first service bit in the service information byte corresponds to a 3-wire delta type service. the service byte is then updated to define the 3-wire delta service at step 1040. A pointer is then preferably stored to identify the service angle record at step 1042.

If the measured phase angles were not determined to be within the computed ranges at 1036, then the next record with an ABC rotation bit in the service information bit is located by carrying out steps 1044, 1046, and 1032.

Therefore, each record with an abc rotation bit is checked for matching phase angle measurements until either a match is found and the service defined, or until no more records are available to check as determined at step 1046. When no more records are available, the cba rotation bit of the service information byte of each record is similarly checked via steps 1044, 1046, 1048. If a record with a cba rotation bit includes angle ranges that matches the measured ranges as determined at steps 1036, then the service bit is located at step 1038, the service defined at step 1040, and a pointer set to the record at 1042. If no record with a cba rotation bit matches the measured phase angles as determined at 1036, then the service in the service byte is defined as "NONE" at 1052.

Figure 14 is a detailed flow diagram showing the service voltage table search procedure in accordance with the present invention. This procedure is best illustrated by reference to the Service Voltage Table definition set forth below: <BR> <BR> ;*********************************************************** ***********<BR> ; voltage~test; vservice vservice ab.5,c.5,c.86,s4wd,s4wy,s3wy,s3wd,s Ip vnominal ; P1 (7 bit dsp format: low byte, high byte) ; vmax~percent ; ~vmin~percent

ab.5,c.5,c.86,s4wd,s4wy,s3wy,s3wd,s1p 0D 02 B5 3D 0A 19 9A E6 66 ; 0 0 0 0 1 1 0 1 ;1 1P,4WY,3WY ; 69.3V, P1 = 55V = 0A3D in dsp format.

; -10%, + 10% OF 04 B0 25 12 19 9A E6 66 ; 0 0 0 0 1 1 1 1 ;2 1P,4WY,3WY,3WD ; 120V, P1 = 96V = 1225 in dsp format.

; -10%, + 10% B0 09 60 4B 24 19 9A E6 66 ; 1 0 1 1 0 0 0 0 ;3 4WD ; 240V, P1 = 192V = 244B in dsp format.

; -10%, + 10% 03 09 60 4B 24 19 9A E6 66 ; ; 0 0 0 0 0 0 1 1 ;4 1P,3WD ; 240V, P1 = 192V = 244B in dsp format ; -10%, + 10% B0 12 C0 4B 24 19 9AE666;1 0 1 1 0 0 0 0 ;5 4WD ; 480V, P1 = 192V = 244B in dsp format.

; -10%, + 10% OD OA D2CE 2A 19 9A E6 66 ;0 0 0 0 1 1 0 1 ;6 1P,4WY,3WY ; 277V, P1 = 221 = 2A0E in dsp format.

; -10%, + 10% 03 12 CO 16 49 19 9AE666 ; 0 0 0 0 0 0 1 1 ;7 1P,3WD ; 480V, P1 = 384V = 4916 in dsp format.

; -10%, + 10% C1 09 60 25 12 19 9A E6 66 ;1 1 0 0 0 0 0 1 ;8 1P ; 240V, P1 = 96V = 1225 in dsp format.

; -10%, + 10% 00 01 0101 0119 9A E6 66 ;0 0 0 0 0 0 0 0 ; 00 01 01 01 01 19 9A E6 66 ; 0 0 0 0 0 0 0 0 <BR> <BR> 60 ; checksum<BR> ;*********************************************************** **********

As indicated above, each record of the Service Voltage Table preferably includes a l-byte field referred to as the voltage service byte, a 2-byte field representing the nominal voltage for the service, a 2-byte field representing the programmable potential indicator threshold to be used in connection with the service, at 2-byte field representing a factor (>1) to multiply the nominal voltage to arrive at the maximum threshold on the nominal voltage range for the service, and a 2-byte field representing a factor (<1) to multiply the nominal voltage to arrive at the minimum threshold of the nominal voltage range for the service. The voltage service byte preferably includes the following bit definition: bit 7: ab.5- scale phase A and B voltages by 0.5 bit 6: c.5 - scale phase C voltage by 0.5 bit 5: c.86 - scale phase C voltage by 0.86 bits 4-0: Each bit represents a different electrical service.

Referring to Figure 14, the search procedure begins after a service is identified by the service angle search procedure. Each record of the service voltage table is checked at 1060 to determine whether the voltage service byte field includes a bit matching the same service identified in the service byte, e.g., bit 1 in the voltage service byte and the service byte =1 defining the 3-wire delta service. If a match is found at step 1060, the nominal voltage ranges designated by that record are computed at 1062. For example, the nominal voltage field data is multiplied by the vmax percent field data (1 +vmax percent) and then scaled according to bits 7, 6, and 5 of the voltage service byte to arrive at the upper threshold for the nominal voltage range. Similarly, the nominal voltage field data is multiplied by the vmin percent field data (1 vmin percent) and then scaled according to the scaling information contained in the voltage service byte to arrive at the lower threshold for the nominal voltage range.

As a specific example, consider, the third listed record in the Service Voltage Table set forth above. The nominal

phase voltage is designated in hex as ""0960," the vmax percent is designated in hex as "199A," and the voltage service byte service bits indicate that phases A and B should be scaled by 0.5 and phase C should be scaled by 0.86. Thus to arrive at the upper threshold, the following computation is carried out: 0960 multiplied by (1+ 199A/FFFF) Then each measured phase voltage is then compared to the computed nominal voltage range associated with the same phase at step 1064 to determine whether or not the measured phase voltages "match," i.e., fall within the nominal range.

If the measured voltages match the nominal ranges, then the service byte is defined as the current service definition at 1066 and a pointer is set to the current service voltage record at step 1068. If the measured voltages do not match the nominal voltage ranges then, the procedure continues by checking whether or not more records are available in the service voltage table at 1070. The same steps are carried out for each record until either a valid service is found or until no more records exist to check in the service voltage table. If no valid service is identified and all of the records have been checked the service byte returns "NONE" to indicate that no valid service was identified by the service test at 1072.

As discussed above, the power quality tests require service-dependent thresholds and other data. For this reason, it is important that the correct service definition be locked into the meter. It should be understood that power quality testing and flicker processing cannot be enabled until a valid service is identified and locked.

Figure 15 is a state diagram showing the states of the service locking procedure according to the present invention. As shown in Figure 15, there are basically two states, locked and unlocked, each with a number of conditional state definitions These conditional definitions may include whether or not the service test is enabled or disabled, whether or not power quality testing is enabled or disabled, whether or not flicker processing is enabled or disabled, whether or not a valid service has been defined,

and whether or not manual or autolock is defined. When any of these conditional state definitions change a transition to a different state is triggered. The receipt of a lock or unlock command may also result in a transition from one state to another.

At state 1100 shown in Figure 15, the meter is in an unlocked state with service check enabled, manual lock specified, both power quality testing and flicker processing are disable, and no valid service has yet to be identified.

Upon detection of a valid service, the state 1100 transitions to state 1104. As is described below, the valid service is preferably displayed on the meter display. If the displayed service is the anticipated or an acceptable service, the meter installer or technician may depress the demand reset key to manual lock the service. If the demand reset key is depressed, the state transitions from state 1104 to state 1102. If, however, the meter installer or technician does not manually lock the meter when in state 1102, a transition back to state 1100 takes place.

Therefore, the meter continues to look for a valid service until one is locked.

A command to unlock the service is generated. If an unlock command is received while in state 1102, the meter then transitions back to state 1100. The meter may also be reconfigured through programming changes to provide the aforementioned autolock feature. If the meter is in state 1102 and is reconfigured to autolock the service, then the service is unlocked and the meter transitions to state 1112.

In this state, if a valid service is defined by the service test, that service is automatically locked and the meter transitions to state 1110. If no valid service is identified or if an unlock command is received while in state 1110, then the meter returns to state 1112.

The service test may be disabled through programming changes. If the service test is disabled while the meter is in state 1102 or state 1110, the meter transitions to state 1108. While in state 1108, the service is locked and only the receipt of an unlock command will trigger a transition to a different state. When an unlock command is received,

the meter transitions from state 1108 to state 1106. If the service is then locked via reprogramming, the meter returns to state 1108.

Figure 16 is a state diagram for the service test procedure and display processing in accordance with the present invention. As discussed above, various parameters and/or tests may be selected for display in the normal ore alternate display modes. Each selected item is measured, tested, etc. and displayed for a predefined period of time.

In a preferred embodiment. the items are displayed one at a time in a fixed sequential sequence. Therefore each item selected for display in the normal mode is sequentially processed and displayed while in the normal display processing state 1200.

If a service test is specified as one of the selected items, a transition to the service test processing state 1202 is made when the service test becomes the current item in the display sequence. In a preferred embodiment, the meter displays the message "SYS " on the LCD while in the service test processing state. If a valid service is found and autolocked, the service test procedure transitions to the locked display state 1204 and a display timer is started. In a preferred embodiment, the phase rotation, service voltage, locked status, and service type are displayed for the predefined period of time. As shown in Figure 12, the phase rotation was "ABC," the service voltage was "120", the status "1" indicates that the service was locked, and the service "lP" refers to single phase.

When the display timer indicates that the predefined display period has elapsed, i.e., the display timer "times out." the display procedure returns to normal display processing state 1200.

If a valid service is found but manual lock is required, the service test procedure transitions to the display state 1210 and a display timer is started. During the display state 1210, the service may is displayed and may be manually locked by depressing the demand reset button. In a preferred embodiment, the phase rotation, the service voltage , and the service type are displayed on the meter

display. If the demand reset button is depressed, the service is locked, and the service test procedure transitions to the locked display state 1204 with an "L" preferably displayed in connection with the service definition. If the displayed service is not locked while in display state 1210 before the display timer times out, the service test procedure transitions to the service test processing state 1214 until a valid service is identified and locked Once the valid service is locked, i.e., autolock is enabled, the service test procedure transitions from the service test processing state 1214 to the locked display state 1204 and restarts the display timer. If a valid service is identified during the service test processing state 1214, but requires manual locking, then the service test procedure transitions back to the display state 1210.

If no valid service is found while in either service test processing state 1202, 1214, the display timer is started and the service test procedure transitions to the error display state 1206. In a preferred embodiment, the service error code "ser 555000" is displayed and locked on the meter.

If the alternate mode is invoked during the normal display sequence, for example, by depressing the ALT button, the items designated for the alternate display mode are processed and are displayed during the alternate scroll processing states 1208, 1212. If the alternate scroll is invoked after an invalid service determination is made or when the ALT button is depressed before transitioning to the service test processing state 1202, then the service test procedure reinvokes the service test when the last alternate scroll item has been cleared from the display in the alternate scroll processing state 1208. Similarly, if the alternate mode is invoked during the display state 1210 or the service test processing state 1214, the alternate scroll processing state 1212 is entered and completed. At the end of the alternate scroll sequence, the service test may be reinvoked if no prior valid service was identified.

However, if a valid service was identified prior to the

alternate scroll processing, then service may be locked and the display timer reset.

Another feature of the present invention is the provision of flicker detection and indication capabilities.

To this end, it will be recalled that processor 14, provides phase A, phase B, and phase C outputs. These outputs are indicative of the presence of voltage on each of the respecitve phases. Since meter 10 is intended for a wide range of uses, i.e., capable of use over a wide range of voltages, the voltage levels on phases A, B and C will vary from use to use. Accordingly, one aspect of the present invention is the provision of programmable threshold comparators in processor 14. Such comparators can be programmed with the threshold appropriate for a given nominal service voltage. So long as the voltage remains above the programmable threshold voltage, the signals output from DSP 14 will have a logic level indicating acceptable voltage. Should voltage fall below the threshold level the output from DSP 14 changes, thereby providing an indication to processor 16.

As shown in Fig. 17, processor 16 determines at every executive clock pulse the status of the phase A, B and C outputs to determine the presence of a "glitch." A glitch will be "announced" by the presence of a PI Warning at 1220.

For every executive clock pulse, a determination is made if a glitch is present. If a glitch indication is present, a further determination is made to determine if the glitch indication is indeed a glitch and not an actual power outage. To this end a glitch counter is provided which is incremented at 1224 for each consecutive executive clock pulse during which a warning was also present. If the glitch counter is above a glitch start value (a minimum number of counts necessary for a legitimate glitch, stored at 1226 and determined at 1222) and less then a glitch end value (a number of counts above which a gitch is in fact a power outage, stored at 1228 and determined at 1222), the glitch counter is increased by one , a log warning is generated and a log duration generated. This operation can be duplicated for each phase.

Once a glitch has been determined, a warning and a warning flag are produced at 1230 and 1232. These warnings are used to flash indicators 27, 29 and 31 on LCD 30 (Fig.

1), depending on whether a glitch is present on phase A. B or C. Such warnings are also used to cause the voltages being displayed on display 30 to flash ON and OFF.

TABLE 1 Meter Formulae Watt formulae -3:Watts=KG(KAVA0IA0+KBVB1IB1+KCVC2IC2) -2:Watts=KG((KAVA0-KBVB0)IA0+(KCVC2-KDVB2)IC2) 8:Watts=KG(KAVA0IA0-(KBVA1IB1+KBVC1IB1)+KCVC2IC2) -7:Watts=KG(KAVA0IA0-KBVA0IB0+KCVC2IC2) NOTE: Subscripts refer to the phase of the inputs.

Sub-subscripts refer to the A/D cycle in which the 6 ample 16 taken Va for 7 applications is actually line to neutral VA Formulae @3:VA=KG[(KAVA0)rmsIA0rms+(KBVB1)rmsIB1rms+(KCVC2)rmsIC2rms] -2:VA=KG((KAVA0-KBVB0)rmsIA0rms+(KCVC2-KDVB2)rmsIC2rms) -8:VA=KG[KAVA0rmsIA0rms-KB(VA1+VC1)rmsIB1rms+KCVC2rmsIC2rms]

-7:VA=KG(KAVA0rmsIA0rms+KBVA0rmsIB0rms+KCVC2rmsIC2rms) RMS measurements are made over one line cycle and preferably begin at the zero crossing of each voltage.

VAR Formula where the subscripts are associated with the I terms of Watts and VAs and the calculation is performed every cycle ('.? as shown below

For purposes of the above formulae, the following definitions apply: -2 means a 2 element in 3 wire delta application; -3 means a 3 element in 4 wire wye application; -8 means a 2 ½ element in 4 wire wye application; -5 means a 2 element in 3 wire delta application; -7 is a 2 4 element in 4 wire delta application While the invention has heen described and illustrated with reference to specific embodiments, those skilled in the art will recognize that modification and variations may be made without departing from the principles of the invention as described hereinabove