public class MultiToggleSensor extends WeatherSensor implements SensorDepending
humidity ∨ rain ∧ pressureThere is no priority rule, evaluation is done from left to right. In the example above, this would evaluate to
(humidity | rain) & pressure, meaning that the overall toggle
will be true if either rain or humidity is true (raining or high humidity)
and pressure is true (low pressure).
The toggle values could read as
togglehumidity=6.0,7.5;inverseAll toggles act on raw data. If there is a
togglerain=0.480,0.52;inverse
togglepressure=1.8,1.85;regular
KEY_SENSORREPORT stated,
then the values of this sensor are the values reported by this multi-toggle
snesor (plus possible conversion), otherwise we report 0 or 1 (good/bad).| Modifier and Type | Class and Description |
|---|---|
private static class |
MultiToggleSensor.Toggle |
TimerTaskSensor.SensorReadPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
static String |
AND
Identifies an AND token.
|
private List<Boolean> |
andtoogle
Combine individual votes, true for AND.
|
private static int |
DEFREPORTLOGMS |
static String |
INVERSE
Toggle is inverted.
|
private Map<String,Boolean> |
ison
The current toggle values for named sensors.
|
static String |
KEY_REPORTLOGMS
Re-report after this time-out.
|
static String |
KEY_SENSORLIST
The list of the sensor names that are used for multi toggling.
|
static String |
KEY_SENSORREPORT
The value of this sensor is our value..
|
private List<String> |
names
The list of names of the sensors that should be combined.
|
static String |
OR
Identifies an OR token.
|
static String |
PREFIX_TOGGLE
Toggle (raw) values are constructed from this key-header.
|
private Map<String,Double> |
reads
The readings of the registered sensors.
|
private List<Telemetering> |
sensors
All registered sensors.
|
private Map<String,MultiToggleSensor.Toggle> |
toggles
The toggle values for named sensors.
|
private Date |
wasreport
Reporting toggle.
|
KEY_DERIVATIVEINVALID, KEY_DERIVATIVEPARAMETER, KEY_INVERSE, KEY_INVERSEDERIVATIVE, KEY_JUDGEDERIVATIVE, KEY_JUDGEPREDICT, KEY_JUDGERAW, KEY_JUDGESMOOTH, KEY_PREDICTINVALID, KEY_PREDICTPARAMETER, KEY_RAWINVALID, KEY_RAWPARAMETER, KEY_RETARDBADDERIVATIVE, KEY_RETARDBADPREDICT, KEY_RETARDBADRAW, KEY_RETARDBADSMOOTH, KEY_RETARDGOODDERIVATIVE, KEY_RETARDGOODPREDICT, KEY_RETARDGOODRAW, KEY_RETARDGOODSMOOTH, KEY_SMOOTHINVALID, KEY_SMOOTHPARAMETERDEFRAWDERIVATIVE, derive, KEY_DERIVATIVEADVISE, KEY_DERIVE, KEY_PATH, KEY_RAWDERIVATIVE, zf, g, KEY_SMOOTH, KEY_SMOOTHADVISEKEY_CHI, KEY_EXTRAPOLATE, KEY_FUTURE, KEY_PREDICTADVISE, predictKEY_AVERAGE, KEY_MEMORY, KEY_PACKDEFRAWFORMAT, DEFREPORT, DEFSIGMAFORMAT, KEY_RAWFORMAT, KEY_REPORT, KEY_SIGMAFORMATKEY_LOGRAWABOVE, KEY_LOGRAWBELOW, KEY_LOGREADLAG, KEY_RESPAWNKEY_BIND, KEY_BINDNAME, KEY_CONVERT, KEY_DESCRIPTION, KEY_SENSORNAMEALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORTKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORNAMING_EXTENSIONCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
MultiToggleSensor(Map<String,String> prop)
Constructs a new multi-toogle sensor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getSensorInitInfo()
Returns the names of the sensors we use for averaging plus the super
information.
|
protected boolean |
goodFromRaw(double raw)
The actual reading is ignored, but we go through the list of actual
sensor readings to deduce a final vote.
|
void |
init()
We have a sensor list key, parse it plus the toggles.
|
protected double |
readSensor()
Reads the multi-toggling sensor.
|
void |
registerSensor(Telemetering add)
Adds sensor to this multi-toggle sensor.
|
boolean |
validReading()
Returns true if the reading of this averaging sensor is true.
|
addWeatherListener, conductOneMeasure, currentlyClear, currentlyRetarding, generateDataEvent, getMinClearUpTime, goodFromDerivative, goodFromPredict, goodFromSmooth, isDerivativeRetard, isPredictRetard, isRawRetard, isSmoothRetard, judgeWeather, notifyWeatherListener, removeWeatherListener, statusderiveAt, getDerivativeFormat, getDerivativeToggleInfo, getDerivator, getLastDerivative, isDerivativeAdvise, isDeriving, newData, regetDerive, registerDerivatorgetLastSmooth, getSmoother, getSmoothToggleInfo, isSmoothAdvise, isSmoothing, regetSmooth, registerSmoother, smoothOnegetExtrapolation, getLastPredict, getPredictToggleInfo, isPredictAdvise, isPredicting, isReliable, predictFrom, regetPredictcumulateOne, getLastRaw, getLastTime, getMaxSize, getMemory, getSizeaddDataListener, addRmiDataListener, exit, getRawFormat, getSigmaFormat, removeDataListener, removeRmiDataListener, reportcancel, equals, getRawToggleInfo, getReading, getRespawn, getTimeOfRead, hashCode, initSensorTimerTask, isReady, regetRaw, setTimeOfRead, validReadingaddRmiErrorListener, createSensor, getBindName, getConvert, getSensorDescription, getSensorName, notifyErrorListener, removeRmiErrorListener, setConvert, toStringbindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistrycontainsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemotePropertyclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringPropertiesfinalize, getClass, notify, notifyAll, wait, wait, waitcumulateOne, getLastRaw, getLastTime, getMaxSize, getSize, getTimeOfRead, regetRawbindToRegistry, isValid, unbindFromRegistrydefaultBoolean, 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, stringPropertiespublic static final String AND
public static final String OR
public static final String INVERSE
public static final String KEY_SENSORLIST
public static final String KEY_SENSORREPORT
public static final String PREFIX_TOGGLE
public static final String KEY_REPORTLOGMS
private static final int DEFREPORTLOGMS
private List<Telemetering> sensors
private Map<String,MultiToggleSensor.Toggle> toggles
private Date wasreport
public MultiToggleSensor(Map<String,String> prop) throws RemoteException
RemoteExceptionpublic void init()
throws InitException
init in interface Initializableinit in class PredictiveSensorInitExceptionpublic void registerSensor(Telemetering add)
Telemetering
instance's name is found in the KEY_SENSORLIST list, this sensor
is added to the sensors reads map.registerSensor in interface SensorDependingpublic boolean validReading()
validReading in interface Telemeteringpublic String getSensorInitInfo()
getSensorInitInfo in interface TelemeteringgetSensorInitInfo in class WeatherSensorprotected double readSensor()
reads, their readings are updated and used for final weather
judgment.readSensor in class TimerTaskSensorConvertToPhysicalprotected boolean goodFromRaw(double raw)
goodFromRaw in class WeatherSensor