stella.telescope
Class TelescopeSimulator

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiListener
                      extended by stella.rmi.AbstractRmiCasterAndListener
                          extended by stella.rmi.ReceiverTorso
                              extended by stella.rmi.GenericSimulator
                                  extended by stella.telescope.TelescopeSimulator
All Implemented Interfaces:
Cloneable, Remote, EventListener, Caster, ErrorSending, ErrorCaster, RmiAcknowledgeCaster, RmiCommandListener, RmiDoneCaster, RmiErrorCaster, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiEventListener, RmiListener, RmiPropertyBearing, StepInitializable

public class TelescopeSimulator
extends GenericSimulator

A telescope simulator. This simulator is based on rmi, not on socket communication which is used for STELLA. It is intended for testing scheduling, sequencing and error handling. It does the following:


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 and true dones.
private  String curerror
          The currently active error symbols.
private static String DEFALTVALUE
          The default name of the telescope altitude value.
private static String DEFAZVALUE
          The default name of the telescope azimuth value.
private static String DEFDECVALUE
          The default name of the telescope dec value.
private static String DEFERRORCLASSES
          The default error list.
private static String DEFERRORPROBABILITIES
          The default error probabilities.
private static String DEFERRORSYMBOLS
          The default error symbols to set in the status message.
private static double DEFFAILDEROT
          The default of the failure probability of the focus telescope command.
private static double DEFFAILFOCUS
          The default of the failure probability of the focus telescope command.
private static double DEFFAILINIT
          The default of the failure probability of the init telescope command.
private static double DEFFAILMIRROR
          The default of the failure probability of the focus telescope command.
private static double DEFFAILMOVE
          The default of the failure probability of the move telescope command.
private static double DEFFAILOFFSET
          The default of the failure probability of the focus telescope command.
private static double DEFFAILPARK
          The default to the failure probability of the park telescope command.
private static String DEFFOCUSVALUE
          The default name of the focus position value.
private static String DEFGUIDETRIGGER
          The default name of the guiding-telescope trigger.
private static String DEFINITTRIGGER
          The default name of the init-telescope trigger..
private static String DEFRAVALUE
          The default name of the telescope ra value.
private static String DEFSET
          The default properties of the hidden parameter set of the simulator.
private static double DEFSTARTUPALT
          The startup-value of the telescope zenith distance.
private static double DEFSTARTUPAZ
          The startup-value of the telescope azimuth.
private static long DEFTRACKTIMEBASE
          The default to the base-time of the track-time remaining status event.
private static double DEFTRACKTIMEDIVERT
          The default to the divergence of the track-time remaining status.
private static String[] DIVERT
          The actual divert factors for the commands.
private static String[] DONETIMES
          The actual execution times for the commands.
static String KEY_ALTVALUE
          The key to the value naming altitude of the telescope.
static String KEY_AZVALUE
          The key to the value naming azimuth of the telescope.
static String KEY_DECVALUE
          The key to the value naming the dec of the telescope.
static String KEY_ERRORSYMBOLS
          The key to the error sysmbols to set in the status message.
static String KEY_FAILDEROT
          The key to the failure probability of the focus telescope command.
static String KEY_FAILFOCUS
          The key to the failure probability of the focus telescope command.
static String KEY_FAILINIT
          The key to the failure probability of the init telescope command.
static String KEY_FAILMIRROR
          The key to the failure probability of the focus telescope command.
static String KEY_FAILMOVE
          The key to the failure probability of the move telescope command.
static String KEY_FAILOFFSET
          The key to the failure probability of the focus telescope command.
static String KEY_FAILPARK
          The key to the failure probability of the park telescope command.
static String KEY_FOCUSVALUE
          The key to the value naming the focus position of the telescope.
static String KEY_GUIDETRIGGER
          The key to the trigger naming the is-guiding state of the telescope.
static String KEY_INITTRIGGER
          The key to the trigger naming the is-init state of the telescope.
static String KEY_RAVALUE
          The key to the value naming the ra of the telescope.
static String KEY_SET
          The key to the properties of the parameter set.
static String KEY_STARTUPALT
          The key to the default telescope zenith distance if val is undefined.
static String KEY_STARTUPAZ
          The key to the default telescope azimuth if value is undefined.
static String KEY_TRACKTIMEBASE
          The key to the base-time of the track-time remaining status event.
static String KEY_TRACKTIMEDIVERT
          The key to the divergence of the track-time remaining status event.
private  ErrorEvent lasterror
          The error occured at the last command processing simulation.
 
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_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
TelescopeSimulator(Map prop)
          Constructs a new telescope 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.
protected  boolean isAllowed(ErrorEvent ee)
          Returns true if the error handed over is either a NoTelescope instance or, if guiding is on, a RepositionTelescope.
static void main(String[] arg)
          Constructs a new telescope simulator.
private static Map myAugment(Map def)
          Augments the properties three times, for acknowledge and done times and for d factors.
protected  boolean processCommand(CommandEvent ce, int acknr)
          Simulated command execution.
 
Methods inherited from class stella.rmi.GenericSimulator
augmentProperties, exit, formatWithGlobals, getAcknowledgeNumber, getCompletionTime, getNoisyTime, getParameter, getParameterByKey, getParameterByName, getParameterCluster, getParameterValueByKey, getParameterValueByName, getSimulationTime, getTrigger, getUnique, getValue, initStep, setParameter, setParameterValueByKey, setParameterValueByName, setTrigger, setValue, shutdown, sleepFor, statusSimulator
 
Methods inherited from class stella.rmi.ReceiverTorso
addRmiAcknowledgeListener, addRmiDoneListener, bindDefault, containsRemoteProperty, deregisterAtCaster, equals, getRemoteProperties, getRemoteProperty, hashCode, notifyAcknowledgeListener, notifyDoneListener, registerAtCaster, removeRmiAcknowledgeListener, removeRmiDoneListener, rescanned, rmiCommand, sendAllPrematureDone, sendPrematureDone, setRemoteProperty, toString, unbindDefault
 
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

KEY_FAILOFFSET

public static final String KEY_FAILOFFSET
The key to the failure probability of the focus telescope command.

See Also:
Constant Field Values

KEY_FAILDEROT

public static final String KEY_FAILDEROT
The key to the failure probability of the focus telescope command.

See Also:
Constant Field Values

KEY_FAILMIRROR

public static final String KEY_FAILMIRROR
The key to the failure probability of the focus telescope command.

See Also:
Constant Field Values

KEY_FAILFOCUS

public static final String KEY_FAILFOCUS
The key to the failure probability of the focus telescope command.

See Also:
Constant Field Values

KEY_FAILINIT

public static final String KEY_FAILINIT
The key to the failure probability of the init telescope command.

See Also:
Constant Field Values

KEY_FAILMOVE

public static final String KEY_FAILMOVE
The key to the failure probability of the move telescope command.

See Also:
Constant Field Values

KEY_FAILPARK

public static final String KEY_FAILPARK
The key to the failure probability of the park telescope command.

See Also:
Constant Field Values

KEY_TRACKTIMEBASE

public static final String KEY_TRACKTIMEBASE
The key to the base-time of the track-time remaining status event.

See Also:
Constant Field Values

KEY_TRACKTIMEDIVERT

public static final String KEY_TRACKTIMEDIVERT
The key to the divergence of the track-time remaining status event.

See Also:
Constant Field Values

KEY_ERRORSYMBOLS

public static final String KEY_ERRORSYMBOLS
The key to the error sysmbols to set in the status message.

See Also:
Constant Field Values

KEY_SET

public static final String KEY_SET
The key to the properties of the parameter set.

See Also:
Constant Field Values

KEY_INITTRIGGER

public static final String KEY_INITTRIGGER
The key to the trigger naming the is-init state of the telescope.

See Also:
Constant Field Values

KEY_GUIDETRIGGER

public static final String KEY_GUIDETRIGGER
The key to the trigger naming the is-guiding state of the telescope.

See Also:
Constant Field Values

KEY_FOCUSVALUE

public static final String KEY_FOCUSVALUE
The key to the value naming the focus position of the telescope.

See Also:
Constant Field Values

KEY_RAVALUE

public static final String KEY_RAVALUE
The key to the value naming the ra of the telescope.

See Also:
Constant Field Values

KEY_DECVALUE

public static final String KEY_DECVALUE
The key to the value naming the dec of the telescope.

See Also:
Constant Field Values

KEY_AZVALUE

public static final String KEY_AZVALUE
The key to the value naming azimuth of the telescope.

See Also:
Constant Field Values

KEY_ALTVALUE

public static final String KEY_ALTVALUE
The key to the value naming altitude of the telescope.

See Also:
Constant Field Values

KEY_STARTUPAZ

public static final String KEY_STARTUPAZ
The key to the default telescope azimuth if value is undefined.

See Also:
Constant Field Values

KEY_STARTUPALT

public static final String KEY_STARTUPALT
The key to the default telescope zenith distance if val is undefined.

See Also:
Constant Field Values

DEFFAILOFFSET

private static final double DEFFAILOFFSET
The default of the failure probability of the focus telescope command.

See Also:
Constant Field Values

DEFFAILDEROT

private static final double DEFFAILDEROT
The default of the failure probability of the focus telescope command.

See Also:
Constant Field Values

DEFFAILMIRROR

private static final double DEFFAILMIRROR
The default of the failure probability of the focus telescope command.

See Also:
Constant Field Values

DEFFAILFOCUS

private static final double DEFFAILFOCUS
The default of the failure probability of the focus telescope command.

See Also:
Constant Field Values

DEFFAILINIT

private static final double DEFFAILINIT
The default of the failure probability of the init telescope command.

See Also:
Constant Field Values

DEFFAILMOVE

private static final double DEFFAILMOVE
The default of the failure probability of the move telescope command.

See Also:
Constant Field Values

DEFFAILPARK

private static final double DEFFAILPARK
The default to the failure probability of the park telescope command.

See Also:
Constant Field Values

DEFTRACKTIMEBASE

private static final long DEFTRACKTIMEBASE
The default to the base-time of the track-time remaining status event.

See Also:
Constant Field Values

DEFTRACKTIMEDIVERT

private static final double DEFTRACKTIMEDIVERT
The default to the divergence of the track-time remaining status.

See Also:
Constant Field Values

DEFERRORSYMBOLS

private static final String DEFERRORSYMBOLS
The default error symbols to set in the status message.

See Also:
Constant Field Values

DEFSET

private static final String DEFSET
The default properties of the hidden parameter set of the simulator.

See Also:
Constant Field Values

DEFINITTRIGGER

private static final String DEFINITTRIGGER
The default name of the init-telescope trigger..

See Also:
Constant Field Values

DEFGUIDETRIGGER

private static final String DEFGUIDETRIGGER
The default name of the guiding-telescope trigger.

See Also:
Constant Field Values

DEFFOCUSVALUE

private static final String DEFFOCUSVALUE
The default name of the focus position value.

See Also:
Constant Field Values

DEFRAVALUE

private static final String DEFRAVALUE
The default name of the telescope ra value.

See Also:
Constant Field Values

DEFDECVALUE

private static final String DEFDECVALUE
The default name of the telescope dec value.

See Also:
Constant Field Values

DEFAZVALUE

private static final String DEFAZVALUE
The default name of the telescope azimuth value.

See Also:
Constant Field Values

DEFALTVALUE

private static final String DEFALTVALUE
The default name of the telescope altitude value.

See Also:
Constant Field Values

DEFSTARTUPAZ

private static final double DEFSTARTUPAZ
The startup-value of the telescope azimuth.

See Also:
Constant Field Values

DEFSTARTUPALT

private static final double DEFSTARTUPALT
The startup-value of the telescope zenith distance.

See Also:
Constant Field Values

DEFERRORCLASSES

private static final String DEFERRORCLASSES
The default error list.

See Also:
Constant Field Values

DEFERRORPROBABILITIES

private static final String DEFERRORPROBABILITIES
The default error probabilities.

See Also:
Constant Field Values

COMMANDS

private static final String[] COMMANDS
The known command types, used for acknowledges and true dones.


ACKTIMES

private static final String[] ACKTIMES
The acknowledge times for the known commands.


DONETIMES

private static final String[] DONETIMES
The actual execution times for the commands.


DIVERT

private static final String[] DIVERT
The actual divert factors for the commands.


lasterror

private ErrorEvent lasterror
The error occured at the last command processing simulation.


curerror

private String curerror
The currently active error symbols.

Constructor Detail

TelescopeSimulator

public TelescopeSimulator(Map prop)
                   throws RemoteException
Constructs a new telescope simulator. Different to the true telescope server, this implementation is based on RMI and therefore not inetended to test basic communication properties.

Throws:
RemoteException
Method Detail

myAugment

private static Map myAugment(Map def)
Augments the properties three times, for acknowledge and done times and for d factors. Uses an own method to increase readability.


accepts

public boolean accepts(CommandEvent ce)
                throws RemoteException
Returns true if this receiver accepts commands of the type handed over as an argument. An telescope simulator accepts all sort of TelescopeCommands.

Throws:
RemoteException

isAllowed

protected boolean isAllowed(ErrorEvent ee)
Returns true if the error handed over is either a NoTelescope instance or, if guiding is on, a RepositionTelescope.

Specified by:
isAllowed in class GenericSimulator

getLastError

protected ErrorEvent getLastError()
Returns the last error that occured during command processing.

Specified by:
getLastError in class ReceiverTorso

processCommand

protected boolean processCommand(CommandEvent ce,
                                 int acknr)
Simulated command execution. The following commands are allowed (plus special actions taken)

Overrides:
processCommand in class GenericSimulator

main

public static void main(String[] arg)
                 throws RemoteException
Constructs a new telescope simulator. The single argument supplied are the simulator properties.

Throws:
RemoteException