public class WattsUp extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
WattsUp.Listener
Defines an event listener
|
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
WattsUp()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(WattsUp.Listener listener)
Adds an event listener
|
void |
close()
Closes the connection to the meter
|
int[] |
getCalibrationData()
Gets the calibration data
|
int |
getFullOption()
Gets the memory-full handling option
|
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
|
String[] |
getVersionData()
Gets the version information
|
void |
open(int index,
String serial)
Opens a connection to the meter
|
void |
open(String node,
int index,
String serial)
Opens a connection to the meter
|
void |
removeListener()
Removes the event listener
|
void |
resetMemory()
Resets (clears) data memory
|
void |
restart()
Restarts the meter
|
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
|
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
public void open(int index,
String serial)
throws WattsUpException
index - The zero-based index of the Modbus adapter within the
list of FTDI devices selected by the serial argumentserial - A string which, if non-null and non-empty, restricts
the list of available devices to those with a serial
number containing this stringWattsUpExceptionpublic void open(String node, int index, String serial) throws WattsUpException
node - The name of the node from which the Modbus is being
served, or null for the local nodeindex - The zero-based index of the Modbus adapter within the
list of FTDI devices selected by the serial argumentserial - A string which, if non-null and non-empty, restricts
the list of available devices to those with a serial
number containing this stringWattsUpExceptionpublic void close()
throws WattsUpException
WattsUpExceptionpublic void addListener(WattsUp.Listener listener)
listener - The event listener object, containing the
processData, setPowered and
setClosed methods.public void removeListener()
public int getLoggedFields()
throws WattsUpException
WattsUpExceptionpublic int setLoggedFields(int mask)
throws WattsUpException
mask - A bit mask where each set bit represents a field to be
logged.WattsUpExceptionpublic int[] getCalibrationData()
throws WattsUpException
WattsUpExceptionpublic String[] getHeaderRecord() throws WattsUpException
WattsUpExceptionpublic int getLoggedData()
throws WattsUpException
All the logged data currently stored in the meter is read out and
passed to the data listener's processData method, one record
at a time. This may take many seconds, depending on the amount of
logged data.
WattsUpExceptionpublic int setInternalLogging(int interval)
throws WattsUpException
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)
throws WattsUpException
Data logging is set to be external, wherein a data record is sent 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()
throws WattsUpException
WattsUpExceptionpublic int getFullOption()
throws WattsUpException
WattsUpExceptionpublic void setFullOption(int option)
throws WattsUpException
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()
throws WattsUpException
WattsUpExceptionpublic int getLoggingInterval()
throws WattsUpException
WattsUpExceptionpublic int getLoggingState()
throws WattsUpException
WattsUpExceptionpublic void setLoggingInterval(int interval)
throws WattsUpException
interval - The logging interval to set. This is ignored for
internal logging with the memory-full option set to
2 (sparsify).WattsUpExceptionpublic float getUserRate()
throws WattsUpException
WattsUpExceptionpublic int getUserThreshold()
throws WattsUpException
WattsUpExceptionpublic boolean getUserEuro()
throws WattsUpException
WattsUpExceptionpublic void setUserParameters(float rate,
int threshold,
boolean euro)
throws WattsUpException
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 String[] getVersionData() throws WattsUpException
WattsUpExceptionpublic void restart()
throws WattsUpException
This has the same effect as power cycling the meter.
WattsUpExceptionCopyright © 2014 LSST. All Rights Reserved.