|
1-Wire Weather Service for Java -- Server API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwxservice.sensor.data.SensorData
wxservice.sensor.data.Precipitation
public class Precipitation
Processes data posted by the precipitation task. This data processor converts rain gauge events from bucket tip count or drip count to user-configurable standard units (e.g., inches or cm). The rate is the sum over the "averaging interval" (usually one hour). Also records total accumulation since the last time the reference count was saved to persistent storage. The reference can be configured to update automatically based on the day of the year, day of the month, day of the week, or daily. Stores the file in the current user's home directory, specified by user.home in the Java system.properties.
Service
. Default units 0.01 inch.
Nested Class Summary | |
---|---|
(package private) static class |
Precipitation.Interval
Enumeration of rainfall accumulation udpate intervals. |
Field Summary | |
---|---|
static java.lang.String |
CFG_FILE_LOCATION_KEY
Reference update schedule name.key suffix. |
static java.lang.String |
CFG_UPDATE_INTERVAL_DAY
Reference daily update interval configuration value. |
static java.lang.String |
CFG_UPDATE_INTERVAL_DOM
Reference day of month update interval configuration value. |
static java.lang.String |
CFG_UPDATE_INTERVAL_DOW
Reference day of week update interval configuration value. |
static java.lang.String |
CFG_UPDATE_INTERVAL_DOY
Reference day of year update interval configuration value. |
static java.lang.String |
CFG_UPDATE_INTERVAL_KEY
Reference update interval name.key suffix. |
static java.lang.String |
CFG_UPDATE_INTERVAL_MAN
Reference manual update interval configuration value. |
static java.lang.String |
CFG_UPDATE_TRIGGER_KEY
Reference update schedule name.key suffix. |
(package private) double |
m_accum
Current value (accumulation). |
(package private) int |
m_extrap
Extrapolates rainfall rate to a full hour. |
(package private) java.lang.String |
m_fileName
Name of the file. |
(package private) Precipitation.Interval |
m_interval
Sample interval enum has all of the update parameters. |
(package private) double |
m_reference
Rain gauge count. |
(package private) double |
m_scale
Multiplier for calibrating precipitation units. |
(package private) boolean |
m_update
Update requested. |
(package private) static long |
MILLIS_DAY
Number of milliseconds in 24 hours. |
Fields inherited from class wxservice.sensor.data.SensorData |
---|
CFG_AVERAGING_INTERVAL_KEY, CFG_OFFSET_KEY, CFG_SCALE_KEY, m_constant, m_dataAvailable, m_index, m_logger, m_maximumValue, m_minimumValue, m_name, m_reset, m_sensorName, m_values |
Constructor Summary | |
---|---|
Precipitation(java.lang.String name,
java.lang.String sensorName,
java.util.Properties config)
Creates a new instance of Precipitation. |
Method Summary | |
---|---|
java.lang.Number |
currentValue()
Modifies the standard way of calculating the current value. |
private boolean |
isFileValid(java.io.File file,
java.util.Calendar calendar)
Determines if the file exists, and is still valid. |
private boolean |
isFirstInterval(java.util.Calendar calendar)
Checks if the current time is within the first sample interval of the day. |
private boolean |
isTrigger(java.util.Calendar calendar)
Determines if the current time triggers a reference update. |
java.lang.Number |
maximumValue(boolean reset)
Modifies the standard way of calculating maximumValue. |
java.lang.Number |
minimumValue(boolean reset)
Modifies the standard way of calculating minimumValue. |
protected void |
processValue(double value)
Converts the number of bucket tips into a precipitation rate per hour, converted to units. |
private double |
readReference(double count,
java.util.Calendar calendar)
Deserializes the reference count from persistent storage. |
java.lang.Number |
sigmaValue()
Modifies the standard way of calculating the sigma value. |
private double |
updateReference(double value)
Calculates precipitation since the last reference update from the new value. |
private double |
writeReference(double count)
Serializes the count to persistent storage for reference. |
Methods inherited from class wxservice.sensor.data.SensorData |
---|
addValue, averageValue, dataAvailable, getConstant, getName, getSensorName, isReset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CFG_UPDATE_INTERVAL_KEY
public static final java.lang.String CFG_UPDATE_INTERVAL_DOY
public static final java.lang.String CFG_UPDATE_INTERVAL_DOM
public static final java.lang.String CFG_UPDATE_INTERVAL_DOW
public static final java.lang.String CFG_UPDATE_INTERVAL_DAY
public static final java.lang.String CFG_UPDATE_INTERVAL_MAN
public static final java.lang.String CFG_UPDATE_TRIGGER_KEY
public static final java.lang.String CFG_FILE_LOCATION_KEY
static final long MILLIS_DAY
double m_scale
int m_extrap
double m_reference
double m_accum
Precipitation.Interval m_interval
boolean m_update
java.lang.String m_fileName
Constructor Detail |
---|
public Precipitation(java.lang.String name, java.lang.String sensorName, java.util.Properties config)
name
- of this data processor.sensorName
- of the sensor associated with this data.config
- properties for configuring this data.Method Detail |
---|
public java.lang.Number sigmaValue()
sigmaValue
in interface ISensorData
sigmaValue
in class SensorData
public java.lang.Number currentValue()
currentValue
in interface ISensorData
currentValue
in class SensorData
public java.lang.Number maximumValue(boolean reset)
maximumValue
in interface ISensorData
maximumValue
in class SensorData
reset
- if true, resets to the next sigma value.
public java.lang.Number minimumValue(boolean reset)
minimumValue
in interface ISensorData
minimumValue
in class SensorData
reset
- if true, resets to the next sigma value.
protected void processValue(double value)
processValue
in class SensorData
value
- absolute number of bucket tips in the rain gauge.private double updateReference(double value)
value
- the new count from the rain gauge.
private boolean isTrigger(java.util.Calendar calendar)
calendar
- representing the current time.
private boolean isFirstInterval(java.util.Calendar calendar)
calendar
- representing the current time.
private double writeReference(double count)
count
- value to serialize.
private double readReference(double count, java.util.Calendar calendar)
count
- default value to use if the file does not exist.calendar
- representing the current time.
private boolean isFileValid(java.io.File file, java.util.Calendar calendar)
file
- to check for validity.calendar
- representing the current time.
|
Copyright © 2005-2007 Karl Uppiano | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |