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
 FcsEnumerations.FilterClampState getClampsState()
           
 FilterClampModule getClampXminus()
           
 FilterClampModule getClampXplus()
           
 Filter getFilter()
           
 double getPosition()
           
 double getStandbyPosition()
           
 boolean isClampedOnFilter()
           
 boolean isEmpty()
           
 boolean isReadyToClamp()
           
 boolean isUnclampedEmpty()
           
 boolean isUnclampedOnFilter()
           
 void putFilterOnSocket(Filter filter)
           
 String 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()
           
 String unlockClamps()
          Unlock the 2 clamps
 void updateClampsStateWithSensors()
          This method updates the state of the 2 clamps in reading the values sent by the sensors.
 void updateClampsStateWithSensors(CanOpenProxy.PDOStorage pdoStorage)
           
 
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)

getClampsState

public FcsEnumerations.FilterClampState getClampsState()

updateClampsStateWithSensors

public void updateClampsStateWithSensors()
                                  throws HardwareError
This method updates the state of the 2 clamps in reading the values sent by the sensors. The values of the sensors are read clamp by clamp with read SDO commands.

Throws:
HardwareError

updateClampsStateWithSensors

public void updateClampsStateWithSensors(CanOpenProxy.PDOStorage pdoStorage)
                                  throws HardwareError
Throws:
HardwareError

isEmpty

public boolean isEmpty()
                throws HardwareError
Throws:
HardwareError

isClampedOnFilter

public boolean isClampedOnFilter()

isUnclampedOnFilter

public boolean isUnclampedOnFilter()

isUnclampedEmpty

public boolean isUnclampedEmpty()

isReadyToClamp

public boolean isReadyToClamp()

releaseClamps

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

Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareError

unlockClamps

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

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

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 © 2013 LSST. All Rights Reserved.