org.lsst.ccs.subsystems.fcs
Class CarouselSocket

java.lang.Object
  extended by org.lsst.ccs.subsystems.fcs.CarouselSocket

public class CarouselSocket
extends Object

This is a socket on the carousel : there is 5 sockets on a carousel. When a filter is on the carousel, it is attached at a socket. A socket has a clamp on each side : - clampX- (clampXminus) - clampX+ (clampXplus) clampX+ and clampX- are the same except for the method isLocked() See FilterClampXminusModule and FilterClampXplusModule The main job of this class CarouselSocket is to synchronize the actions on the 2 clamps. The state of the CarouselSocket is the state of the clamps when both clamps state are identical. To synchonize an action (updateSateWithSensor, unlock or release) on both clamps, we use a CyclicBarrier : we start 2 threads and they wait for each other action completion with a CyclicBarrier. During an action on both clamps, we want to lock the CarouselSocket so no other thread can try to access this object before the completion of action. We do that with a Lock and Condition. (see java.util.concurrent)

Author:
virieux

Constructor Summary
CarouselSocket()
           
CarouselSocket(double position)
          This constructor is for tests.
 
Method Summary
 FilterClampModule getClampXminus()
           
 FilterClampModule getClampXplus()
           
 Filter getFilter()
           
 double getPosition()
           
 double getStandbyPosition()
           
 FcsEnumerations.FilterClampState getState()
           
 boolean isClampedOnFilter()
           
 boolean isEmpty()
           
 boolean isReadyToClamp()
           
 boolean isUnclampedEmpty()
           
 boolean isUnclampedOnFilter()
           
 void putFilterOnSocket(Filter filter)
           
 void releaseClamps()
          Releases the 2 clamps of the socket.
 void removeFilter()
           
 void setClampXminus(FilterClampModule clampXminus)
           
 void setClampXplus(FilterClampModule clampXplus)
           
protected  void setFilter(Filter filter)
           
 void setPosition(double position)
           
 void setStandbyPosition(double standbyPosition)
           
 String toString()
           
 void unlockClamps()
          Unlock the 2 clamps
 void updateClampsStateWithSensors()
          This method updates the state of the 2 clamps in reading the values sent by the sensors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CarouselSocket

public CarouselSocket()

CarouselSocket

public CarouselSocket(double position)
This constructor is for tests.

Parameters:
position -
Method Detail

getClampXminus

public FilterClampModule getClampXminus()

setClampXminus

public void setClampXminus(FilterClampModule clampXminus)

getClampXplus

public FilterClampModule getClampXplus()

setClampXplus

public void setClampXplus(FilterClampModule clampXplus)

getPosition

public double getPosition()

setPosition

public void setPosition(double position)

getFilter

public Filter getFilter()

setFilter

protected void setFilter(Filter filter)

getStandbyPosition

public double getStandbyPosition()

setStandbyPosition

public void setStandbyPosition(double standbyPosition)

getState

public FcsEnumerations.FilterClampState getState()

updateClampsStateWithSensors

public void updateClampsStateWithSensors()
                                  throws HardwareErrorDetectedException
This method updates the state of the 2 clamps in reading the values sent by the sensors. The 2 threads wait for each other until the 2 updates are completed. When the 2 updates are completed, the method clampsUpdateCompleted() is executed.

Throws:
HardwareErrorDetectedException

isEmpty

public boolean isEmpty()
                throws HardwareErrorDetectedException
Throws:
HardwareErrorDetectedException

isClampedOnFilter

public boolean isClampedOnFilter()

isUnclampedOnFilter

public boolean isUnclampedOnFilter()

isUnclampedEmpty

public boolean isUnclampedEmpty()

isReadyToClamp

public boolean isReadyToClamp()

releaseClamps

public void releaseClamps()
                   throws org.lsst.ccs.bus.BadCommandException,
                          org.lsst.ccs.bus.ErrorInCommandExecutionException,
                          HardwareErrorDetectedException
Releases the 2 clamps of the socket.

Parameters:
actuatorXminus -
actuatorXplus -
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

unlockClamps

public void unlockClamps()
                  throws org.lsst.ccs.bus.BadCommandException,
                         org.lsst.ccs.bus.ErrorInCommandExecutionException,
                         HardwareErrorDetectedException
Unlock the 2 clamps

Parameters:
actuatorXminus -
actuatorXplus -
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

removeFilter

public void removeFilter()
                  throws org.lsst.ccs.bus.BadCommandException
Throws:
org.lsst.ccs.bus.BadCommandException

putFilterOnSocket

public void putFilterOnSocket(Filter filter)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 LSST. All Rights Reserved.