stella.adapter
Class AdapterSimulator

java.lang.Object
  extended by util.PropertyContainer
      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.adapter.AdapterSimulator
All Implemented Interfaces:
Cloneable, Remote, EventListener, Caster, ErrorSending, ErrorCaster, RmiAcknowledgeCaster, RmiCommandListener, RmiDoneCaster, RmiErrorCaster, ExitCleaning, Initializable, PropertyBearing, RmiCaster, RmiEventListener, RmiListener, RmiPropertyBearing, StepInitializable

public class AdapterSimulator
extends GenericSimulator

Simulates the action of the adapter.


Nested Class Summary
 
Nested classes/interfaces inherited from class stella.rmi.ReceiverTorso
ReceiverTorso.CommandHandler
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
private static String[] ACKTIMES
          The acknowledge times, same order as commands.
private static String[] COMMANDS
          The known command types, used for acknowledges and true dones.
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 DEFERRORCLASSES
          The default error list.
private static String DEFERRORPROBABILITIES
          The default error probabilities.
private static double DEFFAILAMBIGUOUS
          The default error list.
private static double DEFFAILGUIDE
          The default error list.
private static double DEFFAILINIT
          The default error list.
private static double DEFFAILSTAR
          The default error list.
private static double DEFFOCUSDIVERT
          The default error list.
private static double DEFFOCUSFWHM
          The default error list.
private static double DEFFOCUSMINIMUM
          The default error list.
private static double DEFFOCUSOPTIMUM
          The default error list.
private static String DEFFOCUSVALUE
          The default name of the telescope focus value.
private static double DEFMAGNITUDE
          The default error list.
private static String DEFQUARTZSWITCH
          The default name of the simulated quartz switch .
private static long DEFREADOUTTIME
          The default error list.
private static String DEFTHARSWITCH
          The default name of the simulated thar switch .
private static String[] DIVERT
          The divergence factors for the simulation times of the commands.
private static String[] DONETIMES
          The actual simulation times for the commands.
private  Trigger guide
          The is-guiding trigger.
private  boolean guidingdead
          True, if a no-guiding error was thrown.
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_FAILAMBIGUOUS
          The probability of seeing an ambiguous star pattern on acquire.
static String KEY_FAILGUIDE
          The key to the failure probability of the guider.
static String KEY_FAILINIT
          The key to the failure probability of the initialization process.
static String KEY_FAILSTAR
          The probability of not seeing a star on acquire.
static String KEY_FOCUSDIVERT
          The deviation of the fitting parabel during focusing.
static String KEY_FOCUSFWHM
          The full-width-half-maximum of the PSF of the focus star.
static String KEY_FOCUSMINIMUM
          The minimum fwhm of the focus star.
static String KEY_FOCUSOPTIMUM
          The optimum focus position to recover.
static String KEY_FOCUSVALUE
          The key to the value naming focus of the telescope.
static String KEY_MAGNITUDE
          The probability of a star-too-faint on the guider.
static String KEY_READOUTTIME
          The key to the readout time of the ST-7.
private  ErrorEvent lasterror
          The last error occured.
private  Trigger lostguide
          The guiding-lost trigger.
private  Trigger losttarget
          The target-lost trigger.
 
Fields inherited from class stella.rmi.GenericSimulator
ACKNOWLEDGEPREFIX, DEVIATEPREFIX, DONEPREFIX, KEY_ACCELERATE, KEY_ERRORCLASSES, KEY_ERRORINTERVAL, KEY_ERRORPROBABILITIES, KEY_GENERICACKNOWLEDGE, KEY_GENERICDEVIATE, KEY_GENERICDONE, KEY_SET, 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.PropertyContainer
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES
 
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.PropertyBearing
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
AdapterSimulator(Map prop)
          Constructs a new adapter simulator.
 
Method Summary
 boolean accepts(CommandEvent ce)
          Returns true if this receiver accepts commands of the type handed over as an argument.
protected  long getCompletionTime(CommandEvent ce, int acknr)
          Returns the completion time.
protected  ErrorEvent getLastError()
          Returns the last error that occured during command processing.
protected  long getSimulationTime(CommandEvent ce, int acknr)
          Returns the simulation time.
private  void init5()
          We delay the initialization of the remote values to the last stages of the intialization to avoid blocking.
 void initStep(int curstep)
          We delay the initialization of the remote values to the last stages of the intialization to avoid blocking.
protected  boolean isAllowed(ErrorEvent ee)
          Returns true if the error handed over is allowed.
static void main(String[] arg)
          Constructs a new adapter simulator.
private static Map myAugment(Map def)
          Augmentes the properties for the acknowledge, done, and divert times.
protected  boolean processCommand(CommandEvent ce, int acknr)
          Simulates execution of the adapter commands.
 
Methods inherited from class stella.rmi.GenericSimulator
augmentProperties, exit, getAcknowledgeNumber, getNoisyTime, getParameter, getParameterCluster, getTrigger, getValue, setParameter, 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.PropertyContainer
augment, augment, augment, clone, createFrom, createFrom, createFrom, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getLocalClassLoader, getLocalized, getLocalized, getLocalizedString, getLocalizedString, getProperties, getPropertiesToKey, getPropertiesToKey, getProperty, getResource, getResourceAsStream, getResourceFromKey, getResources, has, init, isNew, keyCreate, keyCreate, parseObject, reload, 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
 

Field Detail

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_FOCUSVALUE

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

See Also:
Constant Field Values

KEY_FAILAMBIGUOUS

public static final String KEY_FAILAMBIGUOUS
The probability of seeing an ambiguous star pattern on acquire.

See Also:
Constant Field Values

KEY_FAILGUIDE

public static final String KEY_FAILGUIDE
The key to the failure probability of the guider.

See Also:
Constant Field Values

KEY_FAILINIT

public static final String KEY_FAILINIT
The key to the failure probability of the initialization process.

See Also:
Constant Field Values

KEY_FAILSTAR

public static final String KEY_FAILSTAR
The probability of not seeing a star on acquire.

See Also:
Constant Field Values

KEY_FOCUSDIVERT

public static final String KEY_FOCUSDIVERT
The deviation of the fitting parabel during focusing.

See Also:
Constant Field Values

KEY_FOCUSFWHM

public static final String KEY_FOCUSFWHM
The full-width-half-maximum of the PSF of the focus star.

See Also:
Constant Field Values

KEY_FOCUSMINIMUM

public static final String KEY_FOCUSMINIMUM
The minimum fwhm of the focus star.

See Also:
Constant Field Values

KEY_FOCUSOPTIMUM

public static final String KEY_FOCUSOPTIMUM
The optimum focus position to recover.

See Also:
Constant Field Values

KEY_MAGNITUDE

public static final String KEY_MAGNITUDE
The probability of a star-too-faint on the guider.

See Also:
Constant Field Values

KEY_READOUTTIME

public static final String KEY_READOUTTIME
The key to the readout time of the ST-7.

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

DEFFOCUSVALUE

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

See Also:
Constant Field Values

DEFTHARSWITCH

private static final String DEFTHARSWITCH
The default name of the simulated thar switch .

See Also:
Constant Field Values

DEFQUARTZSWITCH

private static final String DEFQUARTZSWITCH
The default name of the simulated quartz switch .

See Also:
Constant Field Values

DEFFAILAMBIGUOUS

private static final double DEFFAILAMBIGUOUS
The default error list.

See Also:
Constant Field Values

DEFFAILGUIDE

private static final double DEFFAILGUIDE
The default error list.

See Also:
Constant Field Values

DEFFAILINIT

private static final double DEFFAILINIT
The default error list.

See Also:
Constant Field Values

DEFFAILSTAR

private static final double DEFFAILSTAR
The default error list.

See Also:
Constant Field Values

DEFFOCUSDIVERT

private static final double DEFFOCUSDIVERT
The default error list.

See Also:
Constant Field Values

DEFFOCUSFWHM

private static final double DEFFOCUSFWHM
The default error list.

See Also:
Constant Field Values

DEFFOCUSMINIMUM

private static final double DEFFOCUSMINIMUM
The default error list.

See Also:
Constant Field Values

DEFFOCUSOPTIMUM

private static final double DEFFOCUSOPTIMUM
The default error list.

See Also:
Constant Field Values

DEFMAGNITUDE

private static final double DEFMAGNITUDE
The default error list.

See Also:
Constant Field Values

DEFREADOUTTIME

private static final long DEFREADOUTTIME
The default error list.

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, same order as commands. Add exposure time on 4.


DONETIMES

private static final String[] DONETIMES
The actual simulation times for the commands. Add exposure time on 4.


DIVERT

private static final String[] DIVERT
The divergence factors for the simulation times of the commands.


guide

private Trigger guide
The is-guiding trigger.


lostguide

private Trigger lostguide
The guiding-lost trigger.


losttarget

private Trigger losttarget
The target-lost trigger.


lasterror

private ErrorEvent lasterror
The last error occured.


guidingdead

private boolean guidingdead
True, if a no-guiding error was thrown.

Constructor Detail

AdapterSimulator

public AdapterSimulator(Map prop)
                 throws RemoteException
Constructs a new adapter simulator. Does not serve any remote triggers. For details of command processing, see processCommand(stella.CommandEvent, int).

Throws:
RemoteException
Method Detail

initStep

public void initStep(int curstep)
We delay the initialization of the remote values to the last stages of the intialization to avoid blocking.

Specified by:
initStep in interface StepInitializable
Overrides:
initStep in class GenericSimulator
Parameters:
curstep - The current initialization depth.

init5

private void init5()
We delay the initialization of the remote values to the last stages of the intialization to avoid blocking.


myAugment

private static Map myAugment(Map def)
Augmentes the properties for the acknowledge, done, and divert times.


accepts

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

Throws:
RemoteException

isAllowed

protected boolean isAllowed(ErrorEvent ee)
Returns true if the error handed over is allowed. The following things are checked:

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

getCompletionTime

protected long getCompletionTime(CommandEvent ce,
                                 int acknr)
Returns the completion time. If the command is a ExposeAdapter command and the acknowledge number is zero, add the distorted exposure time carried by the command to the value returned by the parental method.

Overrides:
getCompletionTime in class GenericSimulator
Parameters:
ce - The command to process.
acknr - The number of the acknowledge that will be sent back.

getSimulationTime

protected long getSimulationTime(CommandEvent ce,
                                 int acknr)
Returns the simulation time. If the command is a ExposeAdapter command and the acknowledge number is zero, add the distorted exposure time carried by the command to the value returned by the parental method.

Overrides:
getSimulationTime in class GenericSimulator

processCommand

protected boolean processCommand(CommandEvent ce,
                                 int acknr)
Simulates execution of the adapter commands. The following commands are served and their possible consequences indicated:

Overrides:
processCommand in class GenericSimulator

main

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

Throws:
RemoteException