public class TelescopeSimulator extends GenericSimulator
NoTelescope and
RepositionTelescope. The second one is only allowed if the telescope
is guiding.AbortTelescope, FocusTelescope,
InitTelescope, MoveTelescope, ParkTelescope,
StartGuideTelescope, StopGuideTelescope, and
StatusTelescope. Error as result to these commands are found in the
processCommand(stella.CommandEvent, int) section. MoveTelescope and
StatusTelescope spawn a TracktimeRemaining and a
TelescopeStatus status-event, respectively.CommandEvent.getExpectedAcknowledgeNumber().KEY_INITTRIGGER,
KEY_GUIDETRIGGER, KEY_FOCUSVALUE, KEY_RAVALUE,
KEY_DECVALUE, KEY_AZVALUE, and KEY_ALTVALUE. Note
that additional parameters needed especially for the target-depending
parameters must also be present in the set.ReceiverTorso.CommandHandlerPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
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.
|
ACKNOWLEDGEPREFIX, DEFUNIQUE, DEVIATEPREFIX, DONEPREFIX, KEY_ACCELERATE, KEY_ERRORCLASSES, KEY_ERRORINTERVAL, KEY_ERRORPROBABILITIES, KEY_GENERICACKNOWLEDGE, KEY_GENERICDEVIATE, KEY_GENERICDONE, 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 |
|---|
TelescopeSimulator(Map<String,String> prop)
Constructs a new telescope 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 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<String,String> |
myAugment(Map<String,String> 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.
|
augmentProperties, exit, formatWithGlobals, getAcknowledgeNumber, getCompletionTime, getNoisyTime, getParameter, getParameterByKey, getParameterByName, getParameterCluster, getParameterValueByKey, getParameterValueByName, getSimulationTime, getTrigger, getUnique, getValue, initStep, setParameter, setParameterValueByKey, setParameterValueByName, setTrigger, setValue, shutdown, sleepFor, statusSimulatoraddRmiAcknowledgeListener, addRmiDoneListener, bindDefault, containsRemoteProperty, deregisterAtCaster, equals, getLastError, 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_FAILOFFSET
public static final String KEY_FAILDEROT
public static final String KEY_FAILMIRROR
public static final String KEY_FAILFOCUS
public static final String KEY_FAILINIT
public static final String KEY_FAILMOVE
public static final String KEY_FAILPARK
public static final String KEY_TRACKTIMEBASE
public static final String KEY_TRACKTIMEDIVERT
public static final String KEY_ERRORSYMBOLS
public static final String KEY_SET
public static final String KEY_INITTRIGGER
public static final String KEY_GUIDETRIGGER
public static final String KEY_FOCUSVALUE
public static final String KEY_RAVALUE
public static final String KEY_DECVALUE
public static final String KEY_AZVALUE
public static final String KEY_ALTVALUE
public static final String KEY_STARTUPAZ
public static final String KEY_STARTUPALT
private static final double DEFFAILOFFSET
private static final double DEFFAILDEROT
private static final double DEFFAILMIRROR
private static final double DEFFAILFOCUS
private static final double DEFFAILINIT
private static final double DEFFAILMOVE
private static final double DEFFAILPARK
private static final long DEFTRACKTIMEBASE
private static final double DEFTRACKTIMEDIVERT
private static final String DEFERRORSYMBOLS
private static final String DEFSET
private static final String DEFINITTRIGGER
private static final String DEFGUIDETRIGGER
private static final String DEFFOCUSVALUE
private static final String DEFRAVALUE
private static final String DEFDECVALUE
private static final String DEFAZVALUE
private static final String DEFALTVALUE
private static final double DEFSTARTUPAZ
private static final double DEFSTARTUPALT
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 ErrorEvent lasterror
private String curerror
public TelescopeSimulator(Map<String,String> prop) throws RemoteException
RemoteExceptionprivate static Map<String,String> myAugment(Map<String,String> def)
public boolean accepts(CommandEvent ce) throws RemoteException
TelescopeCommands.RemoteExceptionprotected boolean isAllowed(ErrorEvent ee)
NoTelescope
instance or, if guiding is on, a RepositionTelescope.isAllowed in class GenericSimulatorprotected ErrorEvent getLastError()
protected boolean processCommand(CommandEvent ce, int acknr)
AbortTelescope: Does not throw any special errors. Aborts all
commands currently processed with a premature done event.FocusTelescope: Fails for a CannotFocusMirror error
with a probaility of KEY_FAILFOCUS. Sets the internal variable
focus position to the required value.InitTelescope: Fails with a CannotInitTelescope or a
CannotOpenMirrorCover, both with a probability of
KEY_FAILINIT.MoveTelescope: Fails with a CannotMoveTelescope error
with a KEY_FAILMOVE probability. Sends back a
TracktimeRemaining status event with a random tracking time.ParkTelescope: Fails with a CannotMoveTelescope error
with a KEY_FAILMOVE probability or a
CannotCloseMirrorCover with a KEY_FAILPARKStartGuideTelescope: Toggles the guiding trigger, does not
fail.StopGuideTelescope: Toggles the guiding trigger, does not
fail.StatusTelescope: Does not fail, produces a
TelescopeStatus event prior to sending the final done. Uses the
correct settings of guiding, power, init, and focus position. The azimuth
and the zenith distance are calculated from the last telescope position.
Note that the parameter set houses only an altitude parameter. Derotator
position is always zero.processCommand in class GenericSimulatorpublic static void main(String[] arg) throws RemoteException
RemoteException