public class Anemometer extends SensorData
Refer to
this internal default resource file
for property keys and default values used to configure this data processor.
To receive data, the variable sensor-name must map to the name of
a sensor task running on
Service
. Default units are miles per hour.
Modifier and Type | Class and Description |
---|---|
private static interface |
Anemometer.IPeakProcessor
Interface for peak processors.
|
private class |
Anemometer.nullProcessor
Installs the peak processor after the first two data points.
|
private class |
Anemometer.peakProcessor
Peak processor handles everything past the first two data points.
|
Modifier and Type | Field and Description |
---|---|
private static double |
C1
Beaufort scale: v = C1*B^C2.
|
private Anemometer.IPeakProcessor |
peak
Processes gusts as peak values.
|
private int |
peakIndex
Index into most recent data in the peak values.
|
private double[] |
peakValues
Data buffer for peak values.
|
private double |
scale
Multiplier for converting meters/sec to another unit of velocity.
|
CFG_AVERAGING_INTERVAL_KEY, CFG_OFFSET_KEY, CFG_SCALE_KEY, constant, dataReceived, dataTime, index, maximumValue, minimumValue, name, reset, resetTime, sensorName, values
Constructor and Description |
---|
Anemometer(java.lang.String name,
java.lang.String sensorName,
java.util.Properties config)
Creates a new instance of Anemometer.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Number |
maximumValue(boolean reset)
Calculates the highest value since the last reset.
|
java.lang.Number |
peakValue()
Calculates the peak of all values in the history buffer.
|
protected void |
processValue(double value)
Calls the base class multiplying the value by the scaling constant.
|
averageValue, currentValue, dataAvailable, dataAvailable, getConstant, getName, getResetTime, getSensorName, isReset, minimumValue, putData, reset, sigmaValue
private static final double C1
private double scale
private double[] peakValues
private int peakIndex
private Anemometer.IPeakProcessor peak
public Anemometer(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.public java.lang.Number peakValue()
ISensorData
peakValue
in interface ISensorData
peakValue
in class SensorData
public java.lang.Number maximumValue(boolean reset)
ISensorData
maximumValue
in interface ISensorData
maximumValue
in class SensorData
reset
- if true, to implementation-specific value.protected void processValue(double value)
processValue
in class SensorData
value
- new value from sensor.