|
||||||||||
| 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.AbstractRmiListener
stella.rmi.AbstractRmiCasterAndListener
stella.rmi.ReceiverTorso
stella.rmi.GenericSimulator
stella.environment.DomeSimulator
public class DomeSimulator
A class to simulate the environment. It extends a generic simulator and has the following properties:
NoRoof error that may occur any time. The weather errors are
cast by the weather station which also serves the weather trigger.
The weather station should use pre-recorded 'real' weather data,
see FakeSensor.OpenRoof, CloseRoof,
and StatusEnvironment. All commands have a single acknowledge
event. The time sent back in the acknowledge is handled in the super class.
OpenRoof and CloseRoof may fail with a
CannotOpenRoof or a CannotCloseRoof error, respectively.
The probabilities for failures are KEY_OPENFAIL and
KEY_CLOSEFAIL. If successfully conducted the roof-open trigger is
toggled.StatusEnvironment produces a random status event which
carries the correct weather condition, but has random numbers in the
sensor readings. It is always sent prior to method return.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class stella.rmi.ReceiverTorso |
|---|
ReceiverTorso.CommandHandler |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static String[] |
ACKTIMES
The acknowledge times for the known commands. |
private static String[] |
COMMANDS
The known command types, used for acknowledges. |
private static double |
DEFCLOSEFAIL
The default closinging failure probability . |
private static String |
DEFERRORCLASSES
The default error list. |
private static String |
DEFERRORPROBABILITIES
The default error probabilities. |
private static String |
DEFFAKE
The default properties of the fake weather station. |
private static double |
DEFFOLLOWFAIL
The default positioning failure probability . |
private static String |
DEFISOPEN
The default name of the roof-is-open trigger. |
private static double |
DEFOPENFAIL
The default opening failure probability . |
private static double |
DEFPOSITIONFAIL
The default positioning failure probability . |
private static double |
DEFPOWERFAIL
The default power-switching failure probability . |
private static String |
DEFSET
The default properties of the parameter set of the simulator. |
private static String[] |
DIVERT
The actual divert factors for the commands. |
private static String[] |
DONETIMES
The 'true' command execution times. |
private WeatherSurveying |
fake
The weather station. |
static String |
KEY_CLOSEFAIL
The key to the sleep-time for an open-roof command. |
static String |
KEY_FAKE
The key to the properties of the fake weather station. |
static String |
KEY_FOLLOWFAIL
The key to the sleep-time for an open-roof command. |
static String |
KEY_ISOPEN
The key to the name of the is-open trigger. |
static String |
KEY_OPENFAIL
The key to the sleep-time for an open-roof command. |
static String |
KEY_POSITIONFAIL
The key to the sleep-time for an open-roof command. |
static String |
KEY_POWERFAIL
The key to the probability of power-switch failure. |
private ErrorEvent |
lasterror
The error event if command execution fails. |
| Fields inherited from class stella.rmi.GenericSimulator |
|---|
ACKNOWLEDGEPREFIX, DEFUNIQUE, DEVIATEPREFIX, DONEPREFIX, KEY_ACCELERATE, KEY_ERRORCLASSES, KEY_ERRORINTERVAL, KEY_ERRORPROBABILITIES, KEY_GENERICACKNOWLEDGE, KEY_GENERICDEVIATE, KEY_GENERICDONE, KEY_SET, KEY_UNIQUE, random |
| Fields inherited from class stella.rmi.ReceiverTorso |
|---|
KEY_BIND, KEY_BINDNAME, KEY_COMMANDCASTER, KEY_ERRORCOOL |
| Fields inherited from class util.rmi.AbstractRmiListener |
|---|
KEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP, KEY_SHUTDOWNDELAY |
| 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.RmiAcknowledgeCaster |
|---|
NAMING_EXTENSION |
| Fields inherited from interface stella.rmi.RmiDoneCaster |
|---|
NAMING_EXTENSION |
| Fields inherited from interface util.StepInitializable |
|---|
KEY_INITDEPTH |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
DomeSimulator(Map prop)
Constructs a new environment simulator. |
|
| Method Summary | |
|---|---|
boolean |
accepts(CommandEvent ce)
Returns true if this receiver accepts commands of the type handed over as an argument. |
protected ErrorEvent |
getLastError()
Returns the last error that occured during command processing. |
void |
init2()
Initializes the weather station. |
void |
initStep(int curstep)
Initializes the weather station. |
protected boolean |
isAllowed(ErrorEvent ee)
Checks if the error handed over is currently allowed to be thrown. |
static void |
main(String[] arg)
Constructs a new environment simulator. |
private static Map |
myAugment(Map def)
Augments the properties three times, for acknowledge and done times and for divert factors. |
protected boolean |
processCommand(CommandEvent ce,
int acknr)
Simulated command processing. |
void |
weatherChanged(WeatherEvent we)
The weather event receiving edge of the environment master. |
| Methods inherited from class stella.rmi.AbstractRmiCasterAndListener |
|---|
addErrorListener, addRmiErrorListener, bindToRegistry, getBindName, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus, unbindFromRegistry |
| Methods inherited from class util.rmi.AbstractRmiListener |
|---|
allBound, blockBinding, blockBinding, disconnect, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, startBinding, startBinding |
| 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, init, 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, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface stella.ErrorCaster |
|---|
addErrorListener, removeErrorListener |
| Methods inherited from interface util.rmi.RmiEventListener |
|---|
getListenerName |
| Methods inherited from interface util.rmi.RmiListener |
|---|
disconnect, isConnected |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| 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.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String KEY_OPENFAIL
public static final String KEY_CLOSEFAIL
public static final String KEY_POWERFAIL
public static final String KEY_POSITIONFAIL
public static final String KEY_FOLLOWFAIL
public static final String KEY_FAKE
public static final String KEY_ISOPEN
private static final double DEFOPENFAIL
private static final double DEFCLOSEFAIL
private static final double DEFPOWERFAIL
private static final double DEFPOSITIONFAIL
private static final double DEFFOLLOWFAIL
private static final String DEFFAKE
private static final String DEFSET
private static final String DEFISOPEN
private static final String DEFERRORCLASSES
private static final String DEFERRORPROBABILITIES
private static final String[] COMMANDS
private static final String[] ACKTIMES
private static final String[] DONETIMES
private static final String[] DIVERT
private WeatherSurveying fake
private ErrorEvent lasterror
| Constructor Detail |
|---|
public DomeSimulator(Map prop)
throws RemoteException
RemoteException| Method Detail |
|---|
private static Map myAugment(Map def)
public void initStep(int curstep)
FakeSensor
sensors only.
initStep in interface StepInitializableinitStep in class GenericSimulatorcurstep - The current initialization depth.public void init2()
FakeSensor
sensors only.
public boolean accepts(CommandEvent ce)
throws RemoteException
EnvironmentCommands.
accepts in interface RmiCommandListenerRemoteExceptionprotected boolean isAllowed(ErrorEvent ee)
NoRoof error is always allowed.
isAllowed in class GenericSimulatorprotected ErrorEvent getLastError()
getLastError in class ReceiverTorsopublic void weatherChanged(WeatherEvent we)
#direct method. Here, the weather event is checked for bad
weather. If so, the roof operator gets directly a signal to close the
roof without waiting for a close-roof from the default command caster.
Note that closing of the roof is only allowed in robotic mode.
weatherChanged in interface WeatherListener
protected boolean processCommand(CommandEvent ce,
int acknr)
StatusEnvironment, go to sleep, then
generate a status command from the weather station and the current
roof-open trigger, send it back and return true.GenericSimulator.getSimulationTime(stella.CommandEvent, int). Now, generate a random number
and match it to the failure probabilities of these commands,
KEY_OPENFAIL and KEY_CLOSEFAIL, respectively.
If a failure is indicated, return false and update the last-error
which will be fetched by the ReceiverTorso.
If everything is correct, update the roof-trigger and return true.
processCommand in class GenericSimulator
public static void main(String[] arg)
throws RemoteException
RemoteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||