org.lsst.ccs.subsystems.fcs
Class CarouselModule

java.lang.Object
  extended by java.util.Observable
      extended by org.lsst.ccs.framework.Module
          extended by org.lsst.ccs.subsystems.fcs.CarouselModule
All Implemented Interfaces:
java.io.Serializable, java.util.Observer, Carousel
Direct Known Subclasses:
SftCarouselModule

public class CarouselModule
extends org.lsst.ccs.framework.Module
implements Carousel

This is a representation of the hardware of the carousel. It receives commands from the FCSMAinModule and send back an anknowledge. It publishes data on the status bus. In engineering mode it can receive commands from the engineering console. It has a latch, an engine which are connected to real or simulated hardware.

Author:
virieux
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.lsst.ccs.framework.Module
org.lsst.ccs.framework.Module.ValueUpdate
 
Field Summary
protected  int nbSockets
           
static java.lang.String publishedByCarouselOutputName
           
 
Fields inherited from class org.lsst.ccs.framework.Module
log, name, nObserverThreads, registry, tickMillis
 
Constructor Summary
CarouselModule()
           
 
Method Summary
static double addAngle(double angle1, double angle2)
          Add 2 angles : an angle is a double which value is between -360 and +360
 Motor getCarouselMotor()
           
 Actuator getClampsActuator()
           
 Filter getFilterAtStandby()
           
 java.lang.String getFilterInStandbyName()
           
 double getFilterPosition(Filter filter)
           
 Latch getLatch()
           
 int getNbSockets()
           
 double getPosition()
           
 CarouselSocket getSocketAtStandby()
           
 int getSocketNumber(Filter filter)
           
 CarouselSocket[] getSockets()
           
 double getStandbyPositionForFilter(Filter filter)
           
 ModuleState getState()
           
 StatusDataPublishedByCarousel getStatusData()
           
 java.lang.String grabbeFilterAtStandby(Filter filter)
           
 java.lang.String grabbeFilterAtStandby(java.lang.Object filterName)
           
 void initModule()
           
 void initPublishedData()
           
 boolean isAbleToMove()
           
 boolean isLocked()
           
 boolean isOnStandby(Filter filter)
           
 boolean isReadyToGrabbeAFilterAtStandby()
          This method let us know if the carousel is ready to receive a filter at standby position : - the carousel must not rotate - an empty socket is at standby position.
 boolean isRotating()
           
 java.lang.String lock()
           
protected  java.lang.String moveFilterToStandby(Filter filter)
          This method rotates the carousel to put the given filter in front of the autochanger (standby position).
 void printSockets()
          Print for every socket on carousel, the name of the filter it contains.
 void processUpdate(java.util.Observable source, org.lsst.ccs.framework.Module.ValueUpdate v)
          What to do when the Modules we observe send there new values : we notify our own observers
 java.lang.String releaseClamps()
           
 void removeFilterFromCarousel(Filter filter)
           
 java.lang.String rotate(double angle)
          Rotates carousel for an angle given as a parameter.
 void setCarouselMotor(Motor engine)
           
 void setClampsActuator(Actuator clampsActuator)
           
 void setLatch(Latch latch)
           
 void setNbSockets(int nbSockets)
           
 void setSockets(CarouselSocket[] sockets)
           
 void setState(ModuleState state)
           
 java.lang.String stop()
           
 void tick()
          What has to be done for each tick of the timer.
 java.lang.String toString()
           
 void ungrabbeFilterAtStandby(Filter filter)
           
 java.lang.String unlock()
           
 java.lang.String unlockClamps()
           
 
Methods inherited from class org.lsst.ccs.framework.Module
getContext, getModule, getName, getNObserverThreads, getObservables, getSubsystem, getTickMillis, init, listens, publishData, publishData, publishData, publishData, sendToReply, sendToStatus, setBeanName, setContext, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, start, update
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nbSockets

protected int nbSockets

publishedByCarouselOutputName

public static java.lang.String publishedByCarouselOutputName
Constructor Detail

CarouselModule

public CarouselModule()
Method Detail

initModule

public void initModule()
Overrides:
initModule in class org.lsst.ccs.framework.Module

initPublishedData

public void initPublishedData()

getStatusData

public StatusDataPublishedByCarousel getStatusData()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

processUpdate

public void processUpdate(java.util.Observable source,
                          org.lsst.ccs.framework.Module.ValueUpdate v)
What to do when the Modules we observe send there new values : we notify our own observers

Overrides:
processUpdate in class org.lsst.ccs.framework.Module

getPosition

public double getPosition()
Specified by:
getPosition in interface Carousel

getSocketAtStandby

public CarouselSocket getSocketAtStandby()
Specified by:
getSocketAtStandby in interface Carousel

getFilterAtStandby

public Filter getFilterAtStandby()

getFilterInStandbyName

public java.lang.String getFilterInStandbyName()

isReadyToGrabbeAFilterAtStandby

public boolean isReadyToGrabbeAFilterAtStandby()
                                        throws HardwareErrorDetectedException
This method let us know if the carousel is ready to receive a filter at standby position : - the carousel must not rotate - an empty socket is at standby position.

Returns:
true if the position of the carousel matches the position when one of its sockets is at standby position and this socket is empty. false
Throws:
HardwareErrorDetectedException

isRotating

public boolean isRotating()

isAbleToMove

public boolean isAbleToMove()
Specified by:
isAbleToMove in interface Carousel

isLocked

public boolean isLocked()

stop

public java.lang.String stop()
Specified by:
stop in interface Carousel

lock

public java.lang.String lock()
Specified by:
lock in interface Carousel

unlock

public java.lang.String unlock()
Specified by:
unlock in interface Carousel

rotate

public java.lang.String rotate(double angle)
                        throws java.lang.IllegalArgumentException,
                               org.lsst.ccs.bus.BadCommandException
Rotates carousel for an angle given as a parameter. This method can be launched by the user from the TestConsole. It checks the value of the rotation angle entered by the user, converts it in a double, and send the result of the method rotate(double angle).

Specified by:
rotate in interface Carousel
Parameters:
angleEntered - : rotation angle The rotation angle can be positive or negative. It must be a double and have a value between -360.0 and 360.0
Returns:
the result of the command rotate(double angle)
Throws:
IllegalArgumentException, - BadCommandException
java.lang.IllegalArgumentException
org.lsst.ccs.bus.BadCommandException

tick

public void tick()
What has to be done for each tick of the timer. We have to notify our observers we have changed and give them the new values of the update data.

Overrides:
tick in class org.lsst.ccs.framework.Module

removeFilterFromCarousel

public void removeFilterFromCarousel(Filter filter)
                              throws org.lsst.ccs.bus.BadCommandException,
                                     HardwareErrorDetectedException,
                                     org.lsst.ccs.bus.ErrorInCommandExecutionException
Throws:
org.lsst.ccs.bus.BadCommandException
HardwareErrorDetectedException
org.lsst.ccs.bus.ErrorInCommandExecutionException

getFilterPosition

public double getFilterPosition(Filter filter)

getStandbyPositionForFilter

public double getStandbyPositionForFilter(Filter filter)

getSocketNumber

public int getSocketNumber(Filter filter)
Parameters:
filter -
Returns:
the position of the filter in the sockets array I'm not sure this method is useful actually. Only used is FcsMainModule in method printFilters.

moveFilterToStandby

protected java.lang.String moveFilterToStandby(Filter filter)
                                        throws java.lang.InterruptedException,
                                               org.lsst.ccs.bus.BadCommandException
This method rotates the carousel to put the given filter in front of the autochanger (standby position). This method can't be launched by the user from the console. It computes the shortest way for the carousel. So the running way can be positive or negative. This could be more complicated if the carousel was not able to rotate more than TBD turns in one way.

Throws:
org.lsst.ccs.bus.BadCommandException
java.lang.InterruptedException

printSockets

public void printSockets()
Print for every socket on carousel, the name of the filter it contains.


grabbeFilterAtStandby

public java.lang.String grabbeFilterAtStandby(java.lang.Object filterName)
                                       throws org.lsst.ccs.bus.BadCommandException,
                                              org.lsst.ccs.bus.ErrorInCommandExecutionException,
                                              HardwareErrorDetectedException
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

grabbeFilterAtStandby

public java.lang.String grabbeFilterAtStandby(Filter filter)
                                       throws org.lsst.ccs.bus.BadCommandException,
                                              org.lsst.ccs.bus.ErrorInCommandExecutionException,
                                              HardwareErrorDetectedException
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

ungrabbeFilterAtStandby

public void ungrabbeFilterAtStandby(Filter filter)
                             throws org.lsst.ccs.bus.BadCommandException,
                                    org.lsst.ccs.bus.ErrorInCommandExecutionException,
                                    HardwareErrorDetectedException
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

releaseClamps

public java.lang.String releaseClamps()
                               throws org.lsst.ccs.bus.BadCommandException,
                                      org.lsst.ccs.bus.ErrorInCommandExecutionException
Specified by:
releaseClamps in interface Carousel
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException

unlockClamps

public java.lang.String unlockClamps()
                              throws org.lsst.ccs.bus.BadCommandException,
                                     org.lsst.ccs.bus.ErrorInCommandExecutionException
Specified by:
unlockClamps in interface Carousel
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException

isOnStandby

public boolean isOnStandby(Filter filter)

addAngle

public static double addAngle(double angle1,
                              double angle2)
Add 2 angles : an angle is a double which value is between -360 and +360

Parameters:
angle1 -
angle2 -
Returns:
result of the angles addition. Always > 0

getSockets

public CarouselSocket[] getSockets()

setSockets

public void setSockets(CarouselSocket[] sockets)

getCarouselMotor

public Motor getCarouselMotor()

setCarouselMotor

public void setCarouselMotor(Motor engine)

getLatch

public Latch getLatch()

setLatch

public void setLatch(Latch latch)

getState

public ModuleState getState()

setState

public void setState(ModuleState state)

getNbSockets

public int getNbSockets()
Returns:
the nbSockets

setNbSockets

public void setNbSockets(int nbSockets)
Parameters:
nbSockets - the nbSockets to set

getClampsActuator

public Actuator getClampsActuator()
Returns:
the clampsActuator

setClampsActuator

public void setClampsActuator(Actuator clampsActuator)
Parameters:
clampsActuator - the clampsActuator to set


Copyright © 2011 LSST. All Rights Reserved.