stella.ccd
Class WifsipSimulator

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.ccd.WifsipSimulator
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 WifsipSimulator
extends GenericSimulator

A class to simulate the scientific ccd in STELLA. 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  boolean aborting
          A boolean set to true if an exposure abort is handled.
private static String[] ACKTIMES
          The acknowledge times.
private  Map addfits
          The fits header data added during operation, see FitsCcd.
private static String[] COMMANDS
          The known command types, used for acknowledges and true dones.
private static String DEFDATAPATH
          The default data path.
private static String DEFERRORCLASSES
          The default error list.
private static String DEFERRORPROBABILITIES
          The default error probabilities.
private static String DEFEXPOSING
          The default exposing trigger name.
private static double DEFFAILFILTER
          The default of the failure probability of a filter selection .
private static double DEFFAILFOCUS
          The default of the failure probability of a filter selection .
private static double DEFFAILHARDDISK
          The default of the failure probability of a write-to-disk.
private static double DEFFAILINIT
          The default of the failure probability of a init ccd.
private static String DEFTRANSFERING
          The default exposing trigger name.
private static String[] DIVERT
          The actual divert factors for the commands.
private static String[] DONETIMES
          The actual execution times for the commands.
private  CommandEvent exposecommand
          The last exposure command.
private  File fitsfile
          The fits file to create.
static String KEY_DATAPATH
          The path to the data directory.
static String KEY_EXPOSING
          The key matching to the name of the exposing trigger.
static String KEY_FAILFILTER
          The key to the failure probability of filter selection.
static String KEY_FAILFOCUS
          The key to the failure probability of the guider.
static String KEY_FAILHARDDISK
          The key to the failure probability of a init ccd.
static String KEY_FAILINIT
          The key to the failure probability of a write-to-disk.
static String KEY_TRANSFERING
          The key matching to the name of the exposing trigger.
private  ErrorEvent lasterror
          The error occured at the last command processing simulation.
private  boolean noccd
          A boolean indicating that the ccd has failed.
private  boolean nowheel
          A boolean indicating that the filter wheel has failed.
 
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
WifsipSimulator(Map<String,String> prop)
          Constructs a new ccd simulator.
 
Method Summary
 boolean accepts(CommandEvent ce)
          Returns true if this receiver accepts commands of the type handed over as an argument.
private  boolean fitsKey(String key, String parameter, String comment)
          Adds/removes a fits header key from the customizable table.
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.
protected  boolean isAllowed(ErrorEvent ee)
          Returns true if the error handed over is a NoCcd instance or a {@link
static void main(String[] arg)
          Constructs a new ccd 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 particular ccd-command.
private  boolean writeFits(File fits)
          Writes the data allocated in the MainCamera object to a fits file provided as an argument.
 
Methods inherited from class stella.rmi.GenericSimulator
augmentProperties, exit, formatWithGlobals, getAcknowledgeNumber, getNoisyTime, getParameter, getParameterByKey, getParameterByName, getParameterCluster, getParameterValueByKey, getParameterValueByName, 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_EXPOSING

public static final String KEY_EXPOSING
The key matching to the name of the exposing trigger.

See Also:
Constant Field Values

KEY_TRANSFERING

public static final String KEY_TRANSFERING
The key matching to the name of the exposing trigger.

See Also:
Constant Field Values

KEY_DATAPATH

public static final String KEY_DATAPATH
The path to the data directory.

See Also:
Constant Field Values

KEY_FAILINIT

public static final String KEY_FAILINIT
The key to the failure probability of a write-to-disk.

See Also:
Constant Field Values

KEY_FAILHARDDISK

public static final String KEY_FAILHARDDISK
The key to the failure probability of a init ccd.

See Also:
Constant Field Values

KEY_FAILFILTER

public static final String KEY_FAILFILTER
The key to the failure probability of filter selection.

See Also:
Constant Field Values

KEY_FAILFOCUS

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

See Also:
Constant Field Values

DEFEXPOSING

private static final String DEFEXPOSING
The default exposing trigger name.

See Also:
Constant Field Values

DEFTRANSFERING

private static final String DEFTRANSFERING
The default exposing trigger name.

See Also:
Constant Field Values

DEFDATAPATH

private static final String DEFDATAPATH
The default data path.

See Also:
Constant Field Values

DEFFAILINIT

private static final double DEFFAILINIT
The default of the failure probability of a init ccd.

See Also:
Constant Field Values

DEFFAILHARDDISK

private static final double DEFFAILHARDDISK
The default of the failure probability of a write-to-disk.

See Also:
Constant Field Values

DEFFAILFILTER

private static final double DEFFAILFILTER
The default of the failure probability of a filter selection .

See Also:
Constant Field Values

DEFFAILFOCUS

private static final double DEFFAILFOCUS
The default of the failure probability of a filter selection .

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. Override the first dark and scientific expose.


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.


fitsfile

private File fitsfile
The fits file to create.


addfits

private Map addfits
The fits header data added during operation, see FitsCcd.


lasterror

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


aborting

private boolean aborting
A boolean set to true if an exposure abort is handled.


exposecommand

private CommandEvent exposecommand
The last exposure command.


noccd

private boolean noccd
A boolean indicating that the ccd has failed.


nowheel

private boolean nowheel
A boolean indicating that the filter wheel has failed.

Constructor Detail

WifsipSimulator

public WifsipSimulator(Map<String,String> prop)
                throws RemoteException
Constructs a new ccd simulator. Serves a remote trigger #expose used for signaling ongoing exposures to the sequencer.

Throws:
RemoteException
Method Detail

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. The wifsip simulator accepts all sort of CcdCommands plus the select filter command.

Throws:
RemoteException

isAllowed

protected boolean isAllowed(ErrorEvent ee)
Returns true if the error handed over is a NoCcd instance or a {@link

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 DarkCcd or a ScientificCcd and the acknowledge number is zero, add the distorted exposure time carried by these commands 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 DarkCcd or a ScientificCcd and the acknowledge number is zero, add the distorted exposure time carried by these commands 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 particular ccd-command. The following commands are allowed and produce the indicated outcome:

Overrides:
processCommand in class GenericSimulator

writeFits

private boolean writeFits(File fits)
Writes the data allocated in the MainCamera object to a fits file provided as an argument. If the argument is null this method returns immediately without writing the file.
Implementation note: It is not clear weather readout of the data is necessary to clear the CCD. Time could be saved on unwanted data if the readout procedure could be skipped.


fitsKey

private boolean fitsKey(String key,
                        String parameter,
                        String comment)
Adds/removes a fits header key from the customizable table. If the first argument is null, all mappings are ereased, i.e. all except the default header settings are deleted. If the second argument is null, only the mapping with the key given in the first argument is ereased. If the first to arguments are valid, a new mapping is added.


main

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

Throws:
RemoteException