|
||||||||||
| 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
stella.sensor.WeatherSensor
stella.sensor.BadSensor
public class BadSensor
A bad sensor does not generate data events based on reading a true sensor, but generates it from evaluating a probability description. Three parameter govern the sensor
KEY_GOODPERIOD: The average good-weather period in ms.KEY_BADPERIOD: The average bad-weather period in ms.KEY_BADFRACTION: The long-aim fraction of bad to good weather
periods.KEY_GAUSSSIGMA gauss sigma. After
the initial bad weather, we calculate the fraction of the accumulated bad
to good weather phases. This fraction is compared to the target bad fraction
and a normal random pick determines whether the weather changes or not.
Any weather change will produce only sensor readings
(KEY_GOODREADING or KEY_BADREADING) until the next change
commences. To allow this sensor to work seamless Default mappings are for a typical humidity sensor at a bad level of 0.2, and a good period of 4 days, a bad period of one day, if started with the default respawn rate of 1 second.
| Nested Class Summary | |
|---|---|
static class |
BadSensor.Randomize
Class for testing. |
| Nested classes/interfaces inherited from class stella.sensor.TimerTaskSensor |
|---|
TimerTaskSensor.SensorRead |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private long |
badcount
Cumulated bad period. |
private static double |
DEFBADFRACTION
The default bad weather period. |
private static long |
DEFBADPERIOD
The default bad weather period. |
private static double |
DEFBADREADING
The default good reading. |
private static double |
DEFGAUSSSIGMA
The default sigma. |
private static long |
DEFGOODPERIOD
The default good weather period. |
private static double |
DEFGOODREADING
The default good reading. |
private static long |
DEFMAXPERIOD
The default maximum period. |
private static long |
DEFMINPERIOD
The default minimum period. |
private static String |
DEFTIME
The default time parameter. |
private long |
goodcount
Cumulated good period. |
static String |
KEY_BADFRACTION
The key to standard bad weather fraction. |
static String |
KEY_BADPERIOD
The key to standard bad weather period. |
static String |
KEY_BADREADING
The key to standard bad reading. |
static String |
KEY_GAUSSSIGMA
The key to the standard deviation of the weather periods. |
static String |
KEY_GOODPERIOD
The key to standard good weather period. |
static String |
KEY_GOODREADING
The key to standard good reading. |
static String |
KEY_MAXPERIOD
The key to maximum weather period. |
static String |
KEY_MINPERIOD
The key to minimum weather period. |
static String |
KEY_TIME
The key giving the name of the time parameter. |
private long |
period
Current active period. |
private static Random |
random
My random number generator. |
private Time |
time
A special time grabbed from the parameter cluster. |
private long |
toggled
Last time of weather change. |
private boolean |
weather
Current active weather. |
| Fields inherited from class stella.sensor.DerivativeSensor |
|---|
DEFRAWDERIVATIVE, derive, KEY_DERIVATIVEADVISE, KEY_DERIVE, KEY_PATH, KEY_RAWDERIVATIVE, z |
| 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 | |
|---|---|
BadSensor(Map prop)
Constructs a new fake sensor. |
|
| Method Summary | |
|---|---|
private long |
getWeatherPeriod(long stdperiod,
double sigma)
Returns a new weather period. |
TimerTask |
initSensorTimerTask()
Starts the sensor. |
protected double |
readSensor()
Returns the current weather depending reading. |
void |
registerParameter(Parameter systime)
If we have a time, use it. |
boolean |
validReading()
A bad sensor is always valid. |
| Methods inherited from class stella.sensor.WeatherSensor |
|---|
addWeatherListener, conductOneMeasure, currentlyClear, currentlyRetarding, generateDataEvent, getMinClearUpTime, getSensorInitInfo, goodFromDerivative, goodFromPredict, goodFromRaw, goodFromSmooth, isDerivativeRetard, isPredictRetard, isRawRetard, isSmoothRetard, judgeWeather, notifyWeatherListener, removeWeatherListener, status |
| Methods inherited from class stella.sensor.DerivativeSensor |
|---|
deriveAt, getDerivativeFormat, getDerivativeToggleInfo, getDerivator, getLastDerivative, isDerivativeAdvise, isDeriving, newData, regetDerive, registerDerivator |
| 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, exit, getRawFormat, getSigmaFormat, removeDataListener, removeRmiDataListener, report |
| Methods inherited from class stella.sensor.TimerTaskSensor |
|---|
cancel, equals, getRawToggleInfo, getReading, getRespawn, getTimeOfRead, hashCode, isReady, regetRaw, setTimeOfRead, validReading |
| Methods inherited from class stella.sensor.AbstractSensor |
|---|
addRmiErrorListener, createSensor, getBindName, getConvert, getSensorDescription, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, 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 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_MINPERIOD
public static final String KEY_MAXPERIOD
public static final String KEY_GOODPERIOD
public static final String KEY_BADPERIOD
public static final String KEY_BADFRACTION
public static final String KEY_GAUSSSIGMA
public static final String KEY_GOODREADING
public static final String KEY_BADREADING
public static final String KEY_TIME
private static final long DEFMINPERIOD
private static final long DEFMAXPERIOD
private static final long DEFGOODPERIOD
private static final long DEFBADPERIOD
private static final double DEFBADFRACTION
private static final double DEFGAUSSSIGMA
private static final double DEFGOODREADING
private static final double DEFBADREADING
private static final String DEFTIME
private long goodcount
private long badcount
private long period
private boolean weather
private long toggled
private Time time
private static Random random
| Constructor Detail |
|---|
public BadSensor(Map prop)
throws RemoteException
RemoteException| Method Detail |
|---|
public TimerTask initSensorTimerTask()
initSensorTimerTask in interface TelemeteringinitSensorTimerTask in class TimerTaskSensorTelemetering.getRespawn()public void registerParameter(Parameter systime)
registerParameter in interface ParameterDependingpublic boolean validReading()
validReading in interface Telemeteringprotected double readSensor()
readSensor in class TimerTaskSensorConvertToPhysical
private long getWeatherPeriod(long stdperiod,
double sigma)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||