org.mbari.siam.devices.valve
Class ValveControl

java.lang.Object
  extended by org.mbari.siam.devices.valve.ValveControl
All Implemented Interfaces:
java.rmi.Remote, Valve2WayIF, ValveIF

public class ValveControl
extends java.lang.Object
implements Valve2WayIF, java.rmi.Remote

Implementation of ValveIF for one Hanbay MDx-xxxDT valve connected to a B&B Electronics 232SDD16 Digital I/O controller


Field Summary
protected  org.mbari.siam.devices.valve.ValveAttributes _attributes
           
protected  int _cmd1Bit
           
protected  int _cmd2Bit
           
protected  BB232SDD16 _digitalIO
           
protected  int _feedback1Vector
           
protected  int _feedback2Vector
           
protected  int[] _funcMap
           
protected static org.apache.log4j.Logger _log4j
          Log4j logger
protected  int _valveNum
           
protected static int[] positionMap
           
 
Fields inherited from interface org.mbari.siam.distributed.devices.Valve2WayIF
CLOSE_FUNC, OPEN_FUNC, POSITION_MOVING
 
Fields inherited from interface org.mbari.siam.distributed.devices.ValveIF
POSITION_BACK, POSITION_CENTER, POSITION_LEFT, POSITION_RIGHT
 
Constructor Summary
ValveControl(BB232SDD16 digIO, org.mbari.siam.devices.valve.ValveAttributes attributes, int valveNum)
           
 
Method Summary
 void close()
          Close the valve.
 int getFunctionMap(int function)
          Get the meaning of a function (open() or close(), in terms of valve position
 int getPosition()
          Get current position of valve.
 java.lang.String getPositionName(int position)
          Get the String name for the given valve position
 boolean isClosed()
          Determine whether valve is in a closed position.
 boolean isOpen()
          Determine whether valve is in an open position.
 void open()
          Open the valve.
 int parsePositionName(java.lang.String name)
          Parse the given String name into a valve position
 void setFunctionMap(int function, int position)
          Set the meaning of a function (open() or close(), in terms of valve position
 void setPosition(int position)
          Explicitly set valve position
protected  boolean waitForPosition(int position, long timeout)
          Internal routine to wait for valve to reach position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j
Log4j logger


positionMap

protected static int[] positionMap

_digitalIO

protected BB232SDD16 _digitalIO

_attributes

protected org.mbari.siam.devices.valve.ValveAttributes _attributes

_valveNum

protected int _valveNum

_cmd1Bit

protected int _cmd1Bit

_cmd2Bit

protected int _cmd2Bit

_feedback1Vector

protected int _feedback1Vector

_feedback2Vector

protected int _feedback2Vector

_funcMap

protected int[] _funcMap
Constructor Detail

ValveControl

public ValveControl(BB232SDD16 digIO,
                    org.mbari.siam.devices.valve.ValveAttributes attributes,
                    int valveNum)
Method Detail

open

public void open()
          throws java.io.IOException
Open the valve. This sets the valve to the position indicated by getFunctionMap(OPEN_FUNC)

Specified by:
open in interface Valve2WayIF
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Close the valve. This sets the valve to the position indicated by getFunctionMap(CLOSE_FUNC)

Specified by:
close in interface Valve2WayIF
Throws:
java.io.IOException

getPosition

public int getPosition()
                throws java.io.IOException
Get current position of valve. This MAY perform I/O to the valve to query the position

Specified by:
getPosition in interface ValveIF
Throws:
java.io.IOException

isOpen

public boolean isOpen()
               throws java.io.IOException
Determine whether valve is in an open position. Both POSITION_LEFT and POSITION_RIGHT are considered open.

Specified by:
isOpen in interface Valve2WayIF
Throws:
java.io.IOException

isClosed

public boolean isClosed()
                 throws java.io.IOException
Determine whether valve is in a closed position. Both POSITION_CENTER and POSITION_BACK are considered closed.

Specified by:
isClosed in interface Valve2WayIF
Throws:
java.io.IOException

waitForPosition

protected boolean waitForPosition(int position,
                                  long timeout)
Internal routine to wait for valve to reach position


setPosition

public void setPosition(int position)
                 throws RangeException,
                        java.io.IOException
Explicitly set valve position

Specified by:
setPosition in interface ValveIF
Throws:
RangeException
java.io.IOException

setFunctionMap

public void setFunctionMap(int function,
                           int position)
                    throws RangeException,
                           java.io.IOException
Set the meaning of a function (open() or close(), in terms of valve position

Specified by:
setFunctionMap in interface ValveIF
Parameters:
function - OPEN_FUNC or CLOSE_FUNC, function to map
position - Position this function maps to Note that isOpen() and isClosed() are hard wired, and ignore the positions mapped by this function.
Throws:
RangeException
java.io.IOException

getFunctionMap

public int getFunctionMap(int function)
                   throws RangeException,
                          java.io.IOException
Get the meaning of a function (open() or close(), in terms of valve position

Specified by:
getFunctionMap in interface ValveIF
Throws:
RangeException
java.io.IOException

getPositionName

public java.lang.String getPositionName(int position)
                                 throws java.rmi.RemoteException
Get the String name for the given valve position

Specified by:
getPositionName in interface ValveIF
Throws:
java.rmi.RemoteException

parsePositionName

public int parsePositionName(java.lang.String name)
                      throws java.lang.IllegalArgumentException,
                             java.rmi.RemoteException
Parse the given String name into a valve position

Specified by:
parsePositionName in interface ValveIF
Throws:
java.lang.IllegalArgumentException
java.rmi.RemoteException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.