public class AdapterSimulator extends GenericSimulator
DropTarget, LostGuiding
, LostTarget, NoCalibrationUnit, NoFlatFieldSwitch,
NoGuiding, and RegainedGuiding. LostGuiding may only
be issued if adapter is in guiding mode, after a StartGuidingAdapter
and guiding is not already lost. LostTarget may be issued if adapter
is in guiding mode, regardless if it lost guiding, but only if target was not
already lost. DropTarget is issued in a lost-guiding or lost-target
situation. RegainedGuiding is only issued after guiding or target has
been lost. The other three errors may be issued at any time. To allow testing
of the call-back query (if the adapter needs the telescope azimuth), a
special error is introduced RequestTelescopePosition. This error is
scheduled out of the command cycle and captured in the isAllowed(stella.ErrorEvent)
method in a way that during guiding the remote paramters are queried and the
values retrieved are stored locally (for status commands). For this error,
isAllowed(stella.ErrorEvent) always returns false, because it is not a regular
error that should be thrown at any time.AcquireAdapter, CalibrationOnAdapter,
CalibrationOffAdapter, ExposeAdapter, FindAdapter,
FlatFieldOnAdapter, FlatFieldOffAdapter, InitAdapter,
ParkAdapter, SelectFilterAdapter, StartGuidingAdapter
, StopGuidingAdapter, and StatusAdapter commands. See
processCommand(stella.CommandEvent, int) for details.CommandEvent.getExpectedAcknowledgeNumber().ReceiverTorso.CommandHandlerPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
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 |
DEFFAILEXPOSE
The default error list.
|
private static double |
DEFFAILFOCUS
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_FAILEXPOSE
The key to the failure probability of the guider.
|
static String |
KEY_FAILFOCUS
The key to the failure probability of the guider.
|
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.
|
ACKNOWLEDGEPREFIX, DEFUNIQUE, DEVIATEPREFIX, DONEPREFIX, KEY_ACCELERATE, KEY_ERRORCLASSES, KEY_ERRORINTERVAL, KEY_ERRORPROBABILITIES, KEY_GENERICACKNOWLEDGE, KEY_GENERICDEVIATE, KEY_GENERICDONE, KEY_SET, KEY_UNIQUE, randomKEY_BIND, KEY_BINDNAME, KEY_COMMANDCASTER, KEY_ERRORCOOLKEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP, KEY_SHUTDOWNDELAYKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORNAMING_EXTENSIONNAMING_EXTENSIONKEY_INITDEPTHKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
AdapterSimulator(Map<String,String> prop)
Constructs a new adapter simulator.
|
| Modifier and Type | Method and Description |
|---|---|
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(CommandEvent ce)
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<String,String> |
myAugment(Map<String,String> def)
Augmentes the properties for the acknowledge, done, and divert times.
|
protected boolean |
processCommand(CommandEvent ce,
int acknr)
Simulates execution of the adapter commands.
|
augmentProperties, exit, formatWithGlobals, getAcknowledgeNumber, getNoisyTime, getParameter, getParameterByKey, getParameterByName, getParameterCluster, getParameterValueByKey, getParameterValueByName, getTrigger, getUnique, getValue, setParameter, setParameterValueByKey, setParameterValueByName, setTrigger, setValue, shutdown, sleepFor, statusSimulatoraddRmiAcknowledgeListener, addRmiDoneListener, bindDefault, containsRemoteProperty, deregisterAtCaster, equals, getRemoteProperties, getRemoteProperty, hashCode, notifyAcknowledgeListener, notifyDoneListener, registerAtCaster, removeRmiAcknowledgeListener, removeRmiDoneListener, rescanned, rmiCommand, sendAllPrematureDone, sendPrematureDone, setLastError, setRemoteProperty, toString, unbindDefaultaddErrorListener, addRmiErrorListener, bindToRegistry, getBindName, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus, unbindFromRegistryallBound, blockBinding, blockBinding, disconnect, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, startBinding, startBindingclone, 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, setObject, setProperties, setProperty, stringPropertiesfinalize, getClass, notify, notifyAll, wait, wait, waitbindToRegistry, isValid, unbindFromRegistryaddErrorListener, removeErrorListenergetListenerNamedisconnect, isConnecteddefaultBoolean, 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 KEY_AZVALUE
public static final String KEY_ALTVALUE
public static final String KEY_FOCUSVALUE
public static final String KEY_FAILAMBIGUOUS
public static final String KEY_FAILGUIDE
public static final String KEY_FAILINIT
public static final String KEY_FAILSTAR
public static final String KEY_FAILEXPOSE
public static final String KEY_FAILFOCUS
public static final String KEY_FOCUSDIVERT
public static final String KEY_FOCUSFWHM
public static final String KEY_FOCUSMINIMUM
public static final String KEY_FOCUSOPTIMUM
public static final String KEY_MAGNITUDE
public static final String KEY_READOUTTIME
private static final String DEFAZVALUE
private static final String DEFALTVALUE
private static final String DEFFOCUSVALUE
private static final String DEFTHARSWITCH
private static final String DEFQUARTZSWITCH
private static final double DEFFAILAMBIGUOUS
private static final double DEFFAILGUIDE
private static final double DEFFAILINIT
private static final double DEFFAILSTAR
private static final double DEFFAILEXPOSE
private static final double DEFFAILFOCUS
private static final double DEFFOCUSDIVERT
private static final double DEFFOCUSFWHM
private static final double DEFFOCUSMINIMUM
private static final double DEFFOCUSOPTIMUM
private static final double DEFMAGNITUDE
private static final long DEFREADOUTTIME
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 Trigger guide
private Trigger lostguide
private Trigger losttarget
private ErrorEvent lasterror
private boolean guidingdead
public AdapterSimulator(Map<String,String> prop) throws RemoteException
processCommand(stella.CommandEvent, int).RemoteExceptionpublic void initStep(int curstep)
throws InitException
initStep in interface StepInitializableinitStep in class GenericSimulatorInitExceptionprivate void init5()
throws InitException
InitExceptionprivate static Map<String,String> myAugment(Map<String,String> def)
public boolean accepts(CommandEvent ce) throws RemoteException
AdapterCommands.RemoteExceptionprotected boolean isAllowed(ErrorEvent ee)
NoCalibrationUnit, NoFlatFieldSwitch, and
NoGuiding errors are always allowed.LostGuiding error is allowed, if the adapter is guiding (
guide, and if guiding or the target have not already been lost (
lostguide, losttarget ).LostTarget error is allowed, if the adapter is guiding (
guide, and if the target has not been lost. Different to
LostGuiding it is also allowed if the guiding
has been lost.DropTarget is allowed only if at least the guiding or, this
reflects the more realistic case, the the target was lost. In the
simulator, no distinction is made between allowence after lost guiding or
lost target.RegainedGuiding is allowed only if the target or the guiding
has been lost.RequestTelescopePosition, which is a error
only used during simulation, will always return false (so that it is not
transported to an error handler, but will spark a remote-retrieval of the
telescope position.isAllowed in class GenericSimulatorprotected ErrorEvent getLastError(CommandEvent ce)
getLastError in class ReceiverTorsoprotected long getCompletionTime(CommandEvent ce, int acknr)
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.getCompletionTime in class GenericSimulatorce - The command to process.acknr - The number of the acknowledge that will be sent back.protected long getSimulationTime(CommandEvent ce, int acknr)
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.getSimulationTime in class GenericSimulatorprotected boolean processCommand(CommandEvent ce, int acknr)
AcquireAdapter: This command is issued when the adapter
should acquire a target star. It therefore compares a list of
field-of-view stars provided with the FindAdapter command with
the current field-of-view obtained by the guiding ccd. Failure is
possible in quite a bunch of ways: A NoGuiding error might be
thrown, KEY_FAILGUIDE. This error is also command-cycle
independent. Additionally, a NoStarOnAcquire error might be
thrown KEY_FAILSTAR. This error might occur rather frequently,
it is an indication of cloud coverage. Then, an
AmbiguousStarPattern might occur if the star constellation found
does not coincide with the field-of-view stars transfered in the
FindAdapter command, probability KEY_FAILAMBIGUOUS. Last
but not least, a TargetStarMagnitude status event might be issued
(KEY_MAGNITUDE), if the target star was found, but its
brightness is well of the expected value. This status event is intended
for identifying acquiring difficulties and will not block target
acquisition.CalibrationOnAdapter: Fails with #KEY_FAILCALIBRATION
to a NoCalibrationUnit. This error may also occur
out-of-cycle.CalibrationOffAdapter: Never fails.ExposeAdapter: Sends back a AdapterFwhm status
message. To allow focus groups to be tested, the current focus position
is queried via RMI in the #focus value. Depending on
KEY_FOCUSOPTIMUM and KEY_FOCUSFWHM together with
KEY_FOCUSDIVERT an artificial FWHM of the star image is
calculated and sent back to the SCS.FindAdapter Never fails.FlatFieldOnAdapter Fails with #KEY_FAILFLATFIELD to a
NoFlatFieldSwitch. This error may also occur out-of-cycle.FlatFieldOffAdapter never fails.InitAdapter Fails with a KEY_FAILINIT probability to
a CannotInitAdapter.ParkAdapter never fails.SelectFilterAdapter Fails with a
#KEY_FAILFILTERPRESENT to a NoSuchFilter. Additionally
can throw a NoFilterWheel (#KEY_FAILFILTERSTUCK).StartGuidingAdapter Fails with KEY_FAILGUIDE to a
NoStarOnAcquire.StopGuidingAdapter never fails.StatusAdapter sends back an artificial status command, as
right now no parameter is coupled to this status event.processCommand in class GenericSimulatorpublic static void main(String[] arg) throws RemoteException
RemoteException