|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lsst.ccs.drivers.wattsup.WattsUp
public class WattsUp
Controls a WattsUp? meter
| Nested Class Summary | |
|---|---|
static interface |
WattsUp.DataListener
Defines a data listener |
| Field Summary | |
|---|---|
static int |
FLD_AMPS
Data field - amps |
static int |
FLD_AMPS_MAX
Data field - maximum amps during interval |
static int |
FLD_AMPS_MIN
Data field - minimum amps during interval |
static int |
FLD_COST
Data field - cost over collection period |
static int |
FLD_COST_MONTH
Data field - cost per month |
static int |
FLD_DUTY_CYCLE
Data field - duty cycle (fraction of time over power threshold) |
static int |
FLD_FREQUENCY
Data field - line frequency |
static int |
FLD_POWER_CYCLE
Data field - power cycle (number of times power was cycled) |
static int |
FLD_POWER_FACTOR
Data field - power factor (watts / volt-amps) |
static int |
FLD_VOLT_AMPS
Data field - volt-amps (product of volts and amps) |
static int |
FLD_VOLTS
Data field - volts |
static int |
FLD_VOLTS_MAX
Data field - maximum volts during interval |
static int |
FLD_VOLTS_MIN
Data field - minimum volts during interval |
static int |
FLD_WATT_HOURS
Data field - watt-hours over collection period |
static int |
FLD_WATTS
Data field - watts |
static int |
FLD_WATTS_MAX
Data field - maximum watts during interval |
static int |
FLD_WATTS_MIN
Data field - minimum watts during interval |
static int |
FLD_WH_MONTH
Data field - watt-hours per month |
static int |
LOG_STA_EXTERNAL
Logging status - external |
static int |
LOG_STA_INTERNAL
Logging status - active internal |
static int |
LOG_STA_SUSPENDED
Logging status - suspended (memory full) |
static int |
MEM_OPT_CONDENSE
Memory-full option - condense (sparsify) the data |
static int |
MEM_OPT_OVERWRITE
Memory-full option - overwrite oldest data |
static int |
MEM_OPT_SUSPEND
Memory-full option - suspend logging |
static int |
N_CAL_FIELDS
Number of calibration fields |
static int |
N_FIELDS
Number of data fields |
static int |
N_VER_FIELDS
Number of version fields |
static int |
VER_FLD_CHECKSUM
Version field - checksum |
static int |
VER_FLD_FWMAJOR
Version field - major firmware version |
static int |
VER_FLD_FWMINOR
Version field - minor firmware version |
static int |
VER_FLD_FWTSTAMP
Version field - firmware time stamp (YYYYMMDDHHMM) |
static int |
VER_FLD_HW_MINOR
Version field - minor hardware version |
static int |
VER_FLD_HWMAJOR
Version field - major hardware version |
static int |
VER_FLD_MEMORY
Version field - memory size |
static int |
VER_FLD_MODEL
Version field - model |
| Constructor Summary | |
|---|---|
WattsUp()
Constructor |
|
| Method Summary | |
|---|---|
void |
addDataListener(WattsUp.DataListener listener)
Adds a data listener |
void |
close()
Closes the connection to the meter |
int[] |
getCalibrationData()
Gets the calibration data |
int |
getFullOption()
Gets the memory-full handling option |
java.lang.String[] |
getHeaderRecord()
Gets the header record |
int |
getLoggedData()
Gets all the logged data |
int |
getLoggedFields()
Gets the bit mask of fields being logged |
int |
getLoggingInterval()
Gets the logging interval |
int |
getLoggingState()
Gets the logging state |
int |
getRecordLimit()
Gets the record count limit |
boolean |
getUserEuro()
Gets the user-set euro flag |
float |
getUserRate()
Gets the user-set electricity rate |
int |
getUserThreshold()
Gets the user-set duty cycle threshold |
java.lang.String[] |
getVersionData()
Gets the version information |
void |
open()
Opens a connection to the meter |
void |
open(java.lang.String portName)
Opens a connection to the meter |
void |
removeDataListener()
Removes a data listener |
void |
resetMemory()
Resets (clears) data memory |
void |
restart()
Restarts the meter |
void |
serialEvent(gnu.io.SerialPortEvent event)
Receives serial port events |
void |
setExternalLogging(int interval)
Sets external logging |
void |
setFullOption(int option)
Sets the memory-full handling option |
int |
setInternalLogging(int interval)
Sets internal logging |
int |
setLoggedFields(int mask)
Sets the fields to be logged |
void |
setLoggingInterval(int interval)
Sets the logging interval |
void |
setUserParameters(float rate,
int threshold,
boolean euro)
Sets the user parameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FLD_WATTS
public static final int FLD_VOLTS
public static final int FLD_AMPS
public static final int FLD_WATT_HOURS
public static final int FLD_COST
public static final int FLD_WH_MONTH
public static final int FLD_COST_MONTH
public static final int FLD_WATTS_MAX
public static final int FLD_VOLTS_MAX
public static final int FLD_AMPS_MAX
public static final int FLD_WATTS_MIN
public static final int FLD_VOLTS_MIN
public static final int FLD_AMPS_MIN
public static final int FLD_POWER_FACTOR
public static final int FLD_DUTY_CYCLE
public static final int FLD_POWER_CYCLE
public static final int FLD_FREQUENCY
public static final int FLD_VOLT_AMPS
public static final int N_FIELDS
public static final int N_CAL_FIELDS
public static final int MEM_OPT_SUSPEND
public static final int MEM_OPT_OVERWRITE
public static final int MEM_OPT_CONDENSE
public static final int LOG_STA_SUSPENDED
public static final int LOG_STA_INTERNAL
public static final int LOG_STA_EXTERNAL
public static final int VER_FLD_MODEL
public static final int VER_FLD_MEMORY
public static final int VER_FLD_HWMAJOR
public static final int VER_FLD_HW_MINOR
public static final int VER_FLD_FWMAJOR
public static final int VER_FLD_FWMINOR
public static final int VER_FLD_FWTSTAMP
public static final int VER_FLD_CHECKSUM
public static final int N_VER_FIELDS
| Constructor Detail |
|---|
public WattsUp()
| Method Detail |
|---|
public void open()
Connects to the meter using the default serial port (/dev/ttyUSB0)
WattsUpExceptionpublic void open(java.lang.String portName)
portName - The name of the serial port to use.
WattsUpExceptionpublic void close()
WattsUpExceptionpublic void addDataListener(WattsUp.DataListener listener)
listener - The data listener object, containing the
process method.public void removeDataListener()
public int getLoggedFields()
WattsUpExceptionpublic int setLoggedFields(int mask)
mask - A bit mask where each set bit represents a field to be
logged.
WattsUpExceptionpublic int[] getCalibrationData()
WattsUpExceptionpublic java.lang.String[] getHeaderRecord()
WattsUpExceptionpublic int getLoggedData()
All the logged data currently stored in the meter is read out and
passed to the data listener's process method, one record at a
time. This may take many seconds, depending on the amount of logged
data.
WattsUpExceptionpublic int setInternalLogging(int interval)
Data logging is set to be internal, where each logged data record is
stored in the meter's internal memory, for subsequent retrieval via
getLoggedData.
interval - The logging interval to set. This is ignored if
the memory-full option is set to 2 (sparsify).
WattsUpExceptionpublic void setExternalLogging(int interval)
Data logging is set to be external, where a data record is sent to
the serial port at the end of each logging interval and then passed to
the process method of the data listener object.
interval - The logging interval to set.
WattsUpExceptionpublic int getRecordLimit()
WattsUpExceptionpublic int getFullOption()
WattsUpExceptionpublic void setFullOption(int option)
option - The memory-full option to set, encoded as follows:
0 = pause; 1 = wrap; 2 = sparsify by deleting every
other record and doubling the logging interval.
WattsUpExceptionpublic void resetMemory()
WattsUpExceptionpublic int getLoggingInterval()
WattsUpExceptionpublic int getLoggingState()
WattsUpExceptionpublic void setLoggingInterval(int interval)
interval - The logging interval to set. This is ignored for
internal logging with the memory-full option set to
2 (sparsify).
WattsUpExceptionpublic float getUserRate()
WattsUpExceptionpublic int getUserThreshold()
WattsUpExceptionpublic boolean getUserEuro()
WattsUpException
public void setUserParameters(float rate,
int threshold,
boolean euro)
rate - The electricity rate in currency units (dollars or
euros) per KWH.threshold - The power threshold (watts) used for calculating
the duty cycle.euro - The euro flag, true if the currency is euros and
false if dollars. This is used to display the
correct currency symbol on the meter.
WattsUpExceptionpublic java.lang.String[] getVersionData()
WattsUpExceptionpublic void restart()
This has the same effect as power cycling the meter.
WattsUpExceptionpublic void serialEvent(gnu.io.SerialPortEvent event)
This is an event listener method to receive notifications of changes in the serial port. It reacts only to DATA_AVAILABLE events and wakes the reading thread whenever one occurs.
serialEvent in interface gnu.io.SerialPortEventListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||