|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.sensor.AbstractSensor
stella.sensor.TimerTaskSensor
stella.sensor.DataSensor
stella.sensor.CumulativeSensor
stella.sensor.PredictiveSensor
stella.sensor.SmoothingSensor
stella.sensor.DerivativeSensor
public abstract class DerivativeSensor
A derivating sensor adds the capability of calculating the first derivative of the sensor readings. Because it is generally not advisable to allow the calculation of a numerical derivative from noisy data, this class extends a smoothing sensor. Additionally, calcing derivatives is only provided for Savitzky-Golay smoothing. Note that the smoothing coefficients may (and should!) differ from the smoothing used for the plain readings. In particular, consider using higher polynomial degrees in the Savitzky-Golay algorithm for derivatives!
The properties are scanned for the file name to derive a Savitzky-Golay smoothing filter with the KEY_DERIVE. If the property is not set no derivator is registered. This is one exception to the general rule that the use of default constructors guarantees the proper key to be present in the properties after the construction phase. This is necessary because Map do not allow null keys or values.
Implementation note: This routine relies on heavy conversion from Double objects to double primitive types. If this turns out to be unacceptable slow, replace the Shelf with a double array.
This sensor adds the following properties if they are not set already:
Shelf| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class stella.sensor.TimerTaskSensor |
|---|
TimerTaskSensor.SensorRead |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static boolean |
DEFDERIVATIVEADVISE
The default advisory behaviour. |
private static String |
DEFDERIVE
The default smoother. |
(package private) static DecimalFormat |
DEFRAWDERIVATIVE
The default format string for the values. |
private SavitzkyGolaySmoothing |
derivator
The smoothing algorithm to use. |
protected Shelf<Double> |
derive
Stores the first derivatives. |
static String |
KEY_DERIVATIVEADVISE
The key defining only advisory functionality if set to true. |
static String |
KEY_DERIVE
The key mapping to the derivative filter file. |
static String |
KEY_PATH
The key pointing to the derivative filter dir. |
static String |
KEY_RAWDERIVATIVE
The key to the raw derivative-data format string. |
(package private) double[] |
z
A double arrays. |
| Fields inherited from class stella.sensor.SmoothingSensor |
|---|
f, g, KEY_SMOOTH, KEY_SMOOTHADVISE |
| Fields inherited from class stella.sensor.PredictiveSensor |
|---|
KEY_BASE, KEY_CHI, KEY_EXTRAPOLATE, KEY_FUTURE, KEY_PREDICTADVISE, predict |
| Fields inherited from class stella.sensor.CumulativeSensor |
|---|
KEY_AVERAGE, KEY_MEMORY, KEY_PACK |
| Fields inherited from class stella.sensor.DataSensor |
|---|
DEFRAWFORMAT, DEFREPORT, DEFSIGMAFORMAT, KEY_RAWFORMAT, KEY_REPORT, KEY_SIGMAFORMAT |
| Fields inherited from class stella.sensor.TimerTaskSensor |
|---|
KEY_RESPAWN |
| Fields inherited from class stella.sensor.AbstractSensor |
|---|
KEY_BIND, KEY_BINDNAME, KEY_CONVERT, KEY_DESCRIPTION, KEY_SENSORNAME |
| Fields inherited from class util.rmi.AbstractRmiCaster |
|---|
ALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface stella.rmi.RmiDataCaster |
|---|
NAMING_EXTENSION |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
protected |
DerivativeSensor(Map<String,String> qualify)
Constructs a fully-qualified derivative sensor, with a given size of measurements to keep. Use of this constructor guarantees that the Map keys name and respawn are always set. |
| Method Summary | |
|---|---|
void |
deriveAt(double raw)
The implementation of the deriving interface. |
protected DataEvent |
generateDataEvent()
Takes the last sensor derivative data and adds it to the SmoothDataEvent produced by the parental method. |
NumberFormat |
getDerivativeFormat()
Returns the decimal format of the raw derivative value. |
String |
getDerivativeToggleInfo()
Returns extra info on a derivative toggle event. |
SavitzkyGolaySmoothing |
getDerivator()
Returns the derivator used. |
List<Double> |
getLastDerivative(int nr)
The interface method for retrieving the last nr derivatives. |
boolean |
isDerivativeAdvise()
Returns true if the derivative functionality of this sensor is only meant for advisory behaviour. |
boolean |
isDeriving()
Return true if the derivator object is non-null. |
protected void |
newData(double raw,
Date time)
Conducts a single measure by calling this class's super method. |
double |
regetDerive()
Returns the most-recently added first derivative as a primitive double. |
void |
registerDerivator(SavitzkyGolaySmoothing deriver)
This method registers a linear smoothing algorithm for use with this sensor. |
| Methods inherited from class stella.sensor.SmoothingSensor |
|---|
getLastSmooth, getSmoother, getSmoothToggleInfo, isSmoothAdvise, isSmoothing, regetSmooth, registerSmoother, smoothOne |
| Methods inherited from class stella.sensor.PredictiveSensor |
|---|
getExtrapolation, getLastPredict, getPredictToggleInfo, isPredictAdvise, isPredicting, isReliable, predictFrom, regetPredict |
| Methods inherited from class stella.sensor.CumulativeSensor |
|---|
cumulateOne, getLastRaw, getLastTime, getMaxSize, getMemory, getSize |
| Methods inherited from class stella.sensor.DataSensor |
|---|
addDataListener, addRmiDataListener, conductOneMeasure, exit, getRawFormat, getSigmaFormat, removeDataListener, removeRmiDataListener, report |
| Methods inherited from class stella.sensor.TimerTaskSensor |
|---|
cancel, equals, getRawToggleInfo, getReading, getRespawn, getTimeOfRead, hashCode, initSensorTimerTask, isReady, readSensor, regetRaw, setTimeOfRead, validReading |
| Methods inherited from class stella.sensor.AbstractSensor |
|---|
addRmiErrorListener, createSensor, getBindName, getConvert, getSensorDescription, getSensorInitInfo, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, status, toString |
| Methods inherited from class util.rmi.AbstractRmiCaster |
|---|
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.rmi.RmiPropertyContainer |
|---|
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface stella.sensor.Cumulating |
|---|
cumulateOne, getLastRaw, getLastTime, getMaxSize, getSize, getTimeOfRead, regetRaw |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface stella.sensor.Telemetering |
|---|
validReading |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Field Detail |
|---|
public static final String KEY_PATH
public static final String KEY_DERIVE
public static final String KEY_RAWDERIVATIVE
public static final String KEY_DERIVATIVEADVISE
private static final String DEFDERIVE
private static final boolean DEFDERIVATIVEADVISE
static final DecimalFormat DEFRAWDERIVATIVE
protected Shelf<Double> derive
private SavitzkyGolaySmoothing derivator
double[] z
| Constructor Detail |
|---|
protected DerivativeSensor(Map<String,String> qualify)
size - The maximum number of measurements to keep.group - The ThreadGroup this thread belongs to.name - The name of this thread (sensor).qualify - The Map object describing this sensor.| Method Detail |
|---|
protected void newData(double raw,
Date time)
newData in class SmoothingSensorpublic void deriveAt(double raw)
registerDerivator(vec_math.SavitzkyGolaySmoothing) method.
deriveAt in interface Derivingraw - The actual raw reading of the sensor.public double regetDerive()
regetDerive in interface Derivingpublic List<Double> getLastDerivative(int nr)
getLastDerivative in interface DerivingDerivingpublic void registerDerivator(SavitzkyGolaySmoothing deriver)
smoother - The linear smoothing algorithm to use.public SavitzkyGolaySmoothing getDerivator()
public boolean isDeriving()
derivator object is non-null.
isDeriving in interface Derivingpublic boolean isDerivativeAdvise()
public NumberFormat getDerivativeFormat()
Deriving.
getDerivativeFormat in interface Derivingpublic String getDerivativeToggleInfo()
protected DataEvent generateDataEvent()
SmoothDataEvent produced by the parental method. If no
derivator is specified, the undisturbed data event is returned.
If the CumulativeSensor.KEY_PACK property
points to a value greater than one, the data event produced carries the
average of the last derivative data.
generateDataEvent in class SmoothingSensorDerivativeDataEvent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||