public class WindVane 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
.
Modifier and Type | Field and Description |
---|---|
private static double[] |
COS
Array of cos values for the 16 cardinal compass points.
|
private static double |
CPA
Cardinal compass point angle in radians.
|
private int[] |
data
Data buffer for rolling average.
|
private int |
deviceOffset
Device offset for true north.
|
private static double[] |
SIN
Array of sin values for the 16 cardinal compass points.
|
private static double |
TAU
Tau equals 2π.
|
CFG_AVERAGING_INTERVAL_KEY, CFG_OFFSET_KEY, CFG_SCALE_KEY, constant, dataReceived, dataTime, index, maximumValue, minimumValue, name, reset, resetTime, sensorName, values
Constructor and Description |
---|
WindVane(java.lang.String name,
java.lang.String sensorName,
java.util.Properties config)
Creates a new instance of WindVane.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Number |
averageValue()
Calculates the average value by converting the angles to vectors on the
unit circle and averaging the Cartesian coordinates.
|
java.lang.Number |
currentValue()
Obtains the most recent new value.
|
java.lang.Number |
maximumValue(boolean reset)
Calculates the highest value since the last reset.
|
java.lang.Number |
minimumValue(boolean reset)
Calculates the lowest value since the last reset.
|
void |
putData(java.lang.Number value)
Adds a new data value to the processor.
|
dataAvailable, dataAvailable, getConstant, getName, getResetTime, getSensorName, isReset, peakValue, processValue, reset, sigmaValue
private static final double TAU
private static final double CPA
private static final double[] SIN
private static final double[] COS
private int[] data
private int deviceOffset
public WindVane(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 void putData(java.lang.Number value)
putData
in interface ISensorData
putData
in class SensorData
value
- new data to add to the processor.public java.lang.Number averageValue()
averageValue
in interface ISensorData
averageValue
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 new value.public java.lang.Number minimumValue(boolean reset)
minimumValue
in interface ISensorData
minimumValue
in class SensorData
reset
- if true, resets to the next new value.