org.mbari.siam.foce.devices.controlLoop
Class FOCEProcess

java.lang.Object
  extended by org.mbari.siam.foce.devices.controlLoop.FOCEProcess
All Implemented Interfaces:
java.rmi.Remote, ControlProcessIF, ProcessConfigIF, ProcessParameterIF, ProcessStateIF

public class FOCEProcess
extends java.lang.Object
implements ControlProcessIF, ProcessParameterIF

FOCEProcess encapsulates the FOCE control process (or "plant", in the control systems domain). It is responsible for managing connections to inputs (pH and velocity sensors) and outputs (motors and valves). It is one of the major components of the FOCE control system software; A ControlWorkerThread periodically causes a ControlResponseIF (e.g. PHPIDResponse, PHEXPResponse) to update using a FOCEPRocess instance to provide current values for system signals and parameters. The ControlResponseIF then updates system outputs via the FOCEProcess. FOCEProcess is configured via ControlLoopAttributes.

See Also:
ProcessParameterIF

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mbari.siam.distributed.devices.ProcessParameterIF
ProcessParameterIF.DummyConstValues, ProcessParameterIF.DummyFIDMap, ProcessParameterIF.DummyIDMap, ProcessParameterIF.DummyIIDMap, ProcessParameterIF.DummyModeNames, ProcessParameterIF.DummyOIDMap, ProcessParameterIF.DummyParamNames, ProcessParameterIF.DummyRIDMap, ProcessParameterIF.DummySIDMap
 
Field Summary
protected static org.apache.log4j.Logger _log4j
          Log4j logger
 
Fields inherited from interface org.mbari.siam.distributed.devices.ControlProcessIF
CPIF_STATE_INSTANTIATED, CPIF_STATE_RUNNING, CPIF_STATE_STOPPED, CPIF_STATE_UNKNOWN
 
Fields inherited from interface org.mbari.siam.distributed.devices.ProcessParameterIF
AC_PH_INT_AFT, ACTUATION_DISABLED, ACTUATION_ENABLED, ACTUATION_MAX, ACTUATION_MIN, BX_PH_ESW, BX_PH_EXT_MID_L, BX_PH_EXT_MID_R, BX_PH_INT_AFT_L, BX_PH_INT_AFT_R, BX_PH_INT_FWD_L, BX_PH_INT_FWD_R, BX_VESWP, BX_VH2O_EXT_X, BX_VH2O_EXT_Y, BX_VH2O_INT_X, BX_VH2O_INT_Y, BX_VTHR_AFT, BX_VTHR_FWD, CONNECTOR_TYPE_EXT_OSDT, CONNECTOR_TYPE_RAW, CONNECTOR_TYPE_SIAM_OSDT, CONNECTOR_TYPE_SIAM_REG, const_mnem2value, CONTROL_MODE_CONSTANT, CONTROL_MODE_DEADBAND, CONTROL_MODE_MANUAL, CONTROL_MODE_MAX, CONTROL_MODE_MIN, CONTROL_MODE_OFFSET, CONTROL_MODE_PANIC, DIR_X, DIR_Y, DIR_Z, EC_PH_EXT, FC_PH_INT_FWD, filter_id2fname, HD_HDG_EXT, HD_HDG_INT, IAC_PH_INT_AFT_L, IAC_PH_INT_AFT_R, IBX_PH_ESW, IBX_PH_EXT_MID_L, IBX_PH_EXT_MID_R, IBX_PH_INT_AFT_L, IBX_PH_INT_AFT_R, IBX_PH_INT_FWD_L, IBX_PH_INT_FWD_R, IBX_VESWP, IBX_VH2O_EXT_X, IBX_VH2O_EXT_Y, IBX_VH2O_INT_X, IBX_VH2O_INT_Y, IBX_VTHR_AFT, IBX_VTHR_FWD, IC_PH_INT, IEC_PH_EXT_MID_L, IEC_PH_EXT_MID_R, IFC_PH_INT_FWD_L, IFC_PH_INT_FWD_R, IHD_HDG_EXT_X, IHD_HDG_EXT_Y, IHD_HDG_INT_X, IHD_HDG_INT_Y, IIC_PH_INT_AFT, IIC_PH_INT_FWD, IMA_MAG_EXT_X, IMA_MAG_EXT_Y, IMA_MAG_INT_X, IMA_MAG_INT_Y, input_id2iname, IVC_VH2O_EXT_X, IVC_VH2O_EXT_Y, IVC_VH2O_INT_X, IVC_VH2O_INT_Y, IVS_ESWV_AFT, IVS_ESWV_FWD, LOC_ESW, LOC_EXT, LOC_INT, MA_MAG_EXT, MA_MAG_INT, mode_id2pname, OUTPUT_AFT_ESW_VALVE, OUTPUT_AFT_THRUSTER_VELOCITY, OUTPUT_ESW_PUMP_VELOCITY, OUTPUT_FWD_ESW_VALVE, OUTPUT_FWD_THRUSTER_VELOCITY, output_id2name, OUTPUT_TYPE_EXT, OUTPUT_TYPE_SIAM, PARAM_CO2_CONCENTRATION, PARAM_DENSITY_SW, PARAM_ESW_PUMP_AMODE, PARAM_ESW_VALVE_AMODE, PARAM_EXP_A, PARAM_EXP_B, PARAM_EXP_H, PARAM_EXP_K, PARAM_FLUME_AREA, param_id2pname, PARAM_MAX_FLOW_CHANGE_PERCENT, PARAM_PH_ABS_MAX, PARAM_PH_ABS_MIN, PARAM_PH_CMODE, PARAM_PH_DEADBAND_HI, PARAM_PH_DEADBAND_LO, PARAM_PH_LIN_FILTER_DEPTH, PARAM_PH_LIN_OFFSET, PARAM_PH_LIN_SLOPE, PARAM_PH_MAX_CORRECTION, PARAM_PH_OFFSET, PARAM_PH_PID_KD, PARAM_PH_PID_KI, PARAM_PH_PID_KP, PARAM_PH_PID_MAX_KI, PARAM_PH_PID_SCALE_FACTOR, PARAM_PH_RMODE, PARAM_PH_SETPOINT, param_pname2aname, PARAM_THRUSTER_AMODE, PARAM_VELOCITY_CAL_A, PARAM_VELOCITY_CAL_B, PARAM_VELOCITY_CAL_C, PARAM_VELOCITY_CMODE, PARAM_VELOCITY_DEADBAND_HI, PARAM_VELOCITY_DEADBAND_LO, PARAM_VELOCITY_MAX_CORRECTION, PARAM_VELOCITY_MAX_RPM, PARAM_VELOCITY_MIN_RPM, PARAM_VELOCITY_OFFSET, PARAM_VELOCITY_PID_KD, PARAM_VELOCITY_PID_KI, PARAM_VELOCITY_PID_KP, PARAM_VELOCITY_PID_MAX_KI, PARAM_VELOCITY_PID_SCALE_FACTOR, PARAM_VELOCITY_RMODE, PARAM_VELOCITY_SETPOINT, POS_AFT, POS_FWD, POS_L, POS_MID, POS_R, PROC_EXCL, PROC_INCL, RESPONSE_MODE_EXP, RESPONSE_MODE_LIN, RESPONSE_MODE_MAX, RESPONSE_MODE_MIN, RESPONSE_MODE_PID, ROLE_AFT_ESW_VALVE, ROLE_AFT_THRUSTER, ROLE_ESW_PH, ROLE_ESW_PUMP, ROLE_EXT_MID_L_PH, ROLE_EXT_MID_R_PH, ROLE_EXT_X_VELOCITY, ROLE_EXT_Y_VELOCITY, ROLE_FWD_ESW_VALVE, ROLE_FWD_THRUSTER, role_id2name, ROLE_INT_AFT_L_PH, ROLE_INT_AFT_R_PH, ROLE_INT_FWD_L_PH, ROLE_INT_FWD_R_PH, ROLE_INT_X_VELOCITY, ROLE_INT_Y_VELOCITY, ROLE_MASK, SIG_AFT_THRUSTER_VEL, SIG_AFT_THRUSTER_VEL_CMD_CHK, SIG_AFT_THRUSTER_VEL_CMD_RAW, SIG_ESW_AFT_VALVE_CMD, SIG_ESW_AFT_VALVE_STATE, SIG_ESW_FWD_VALVE_CMD, SIG_ESW_FWD_VALVE_STATE, SIG_ESW_INJ_VOL, SIG_ESW_PUMP_CMD_CHK, SIG_ESW_PUMP_CMD_RAW, SIG_ESW_PUMP_VEL, SIG_FWD_THRUSTER_VEL, SIG_FWD_THRUSTER_VEL_CMD_CHK, SIG_FWD_THRUSTER_VEL_CMD_RAW, SIG_PH_ERR, SIG_PH_ESW, SIG_PH_ESW_FILT, SIG_PH_EXT_FILT, SIG_PH_EXT_MID_L, SIG_PH_EXT_MID_R, SIG_PH_GRAD, SIG_PH_INT_AFT_FILT, SIG_PH_INT_AFT_L, SIG_PH_INT_AFT_R, SIG_PH_INT_FILT, SIG_PH_INT_FWD_FILT, SIG_PH_INT_FWD_L, SIG_PH_INT_FWD_R, SIG_VH2O_EXT_DIR_FILT, SIG_VH2O_EXT_MAG_FILT, SIG_VH2O_EXT_X_FILT, SIG_VH2O_EXT_X_RAW, SIG_VH2O_EXT_Y_FILT, SIG_VH2O_EXT_Y_RAW, SIG_VH2O_INT_DIR_FILT, SIG_VH2O_INT_ERR, SIG_VH2O_INT_MAG_FILT, SIG_VH2O_INT_X_FILT, SIG_VH2O_INT_X_RAW, SIG_VH2O_INT_Y_FILT, SIG_VH2O_INT_Y_RAW, signal_id2sname, TYPE_ALL, TYPE_ESW, TYPE_MASK, TYPE_MOTOR, TYPE_PH, TYPE_VALVE, TYPE_VELOCITY, VC_VH2O_EXT_X, VC_VH2O_EXT_Y, VC_VH2O_INT_X, VC_VH2O_INT_Y, VS_ESWV_AFT, VS_ESWV_FWD
 
Constructor Summary
FOCEProcess(ControlLoopAttributes attributes)
          Constructor for FOCEProcess (ControlProcessIF)
 
Method Summary
 void configureAllFilters()
          Perform per-filter configuration for all filters.
 void configureFilter(Filter filter)
          Perform per-filter configuration for specified Filter.
 void configureInputConnector(ControlLoopAttributes.ConnectorSpec connectorSpec)
           
 void configureOutputConnector(ControlLoopAttributes.ConnectorSpec connectorSpec)
           
 void connectFilter(Filter filter)
          make connections to the filtering network for the specified filter
 void connectFilterNetwork()
          Make connections between all the filters in the filtering network.
 ControlInputIF createConnector(ControlLoopAttributes.ConnectorSpec connectorSpec, FilterInput input)
           
 void createFilterInputs()
           
 void createFilters()
          Create signal processing filters for the control inputs and intermediate processing (like pH averaging).
 ControlOutputIF createOutput(ControlLoopAttributes.ConnectorSpec connectorSpec)
           
 double dph2rate(double deltaPH)
          return required pumped fluid volume rate (liters/min), given a desired change in pH.
 java.lang.String filterInputName(int inputID)
          return a filter input name for the given signal ID
 java.lang.String filterName(int filterID)
          return a filter name for the given filter ID
 double flowCO2(double massCO2, double massH2O)
          return CO2 flow mmol/min
protected  ControlLoopAttributes getAttributes()
          get ControlLoopAttributes instance
 Filter getFilter(int filterID)
           
 FilterInput getFilterInput(int inputID)
           
 ControlInputIF getInput(int inputID)
           
 ControlInputIF[] getInputs()
           
 Node getNodeReference(java.lang.String siamHost)
           
 ControlOutputIF getOutput(int outputID)
           
 ControlOutputIF[] getOutputs()
           
 java.lang.Number getParameter(int paramID)
          get current value of a control system parameter by ID
 RangeValidator getPHRangeValidatorInstance()
          initialize an input validator that will be used by shared // by all of the pH input connectors.
 java.lang.Number getSignal(int signalID)
          Get signal value by ID.
 int getState()
           
 void initializeInputConnectors()
          Create and configure the input connectors for the data stream inputs.
 void initializeOutputConnectors()
           
 void initPHRangeValidatorInstance()
          Cause a new pH Range Validator instance to be created (with latest configuration from ControlLoopAttributes)
 Instrument lookupSIAMService(java.lang.String siamHost, java.lang.String registryName)
           
 double massflowH2O(double densityCO2, double volumeH2O)
          return water mass flow kg/min
 java.lang.String modeName(int mode)
          get mnemonic associated with specified mode ID
 java.lang.String outputName(int outputID)
          return an output name for the given output ID
 int parameterID(java.lang.String parameterName)
          get the parameter ID by name
 java.lang.String parameterName(int parameterID)
          get the parameter name by ID
 java.lang.String[] parameterNames()
          return set of parameter names that may be used to get parameter values KeySet/Iterator are not exportable, so we deal in String arrays
 java.lang.String registry2osdt(java.lang.String siamHost, java.lang.String registryName)
           
 void setAttributes(ControlLoopAttributes attributes)
          set ControlLoopAttributes instance
 void setFilterInputInhibit(int filterID, java.lang.String inputName, boolean inhibitValue)
           
 void setOutput(int roleID, ControlOutputIF output)
           
 void setParameter(int paramID, java.lang.Number paramValue)
          set a control system parameter
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Set parameter using the underlying ControlLoopAttributes class.
 void setState(int state)
          set ControlProcessIF state (but not part of the ControlProcessIF interface)
 int signalID(java.lang.String signalName)
          get the signal ID by name
 java.lang.String signalName(int signalID)
          return a signal name for the given signal ID
 java.lang.String[] signalNames()
          return set of signal names that may be used to get signal values KeySet/Iterator are not exportable, so we deal in String arrays
 void simpleStart()
           
 void startProcess()
          initialize process
 void stopProcess()
          shutdown process
 java.lang.String toString()
           
 double vel2rpm(double velocity)
          computer thruster speed (rpm) from water velocity (cm/sec) MotorRPM= aV^2+bV+c where V is water velocity (cm/sec)
 double volume2rpm(double volRate)
          compute pump speed (rpm) from CO2 flow rate (l/min)
 double volumeCO2(double flowCO2, double concentrationCO2)
          return CO2 volume flow liters/min
 double volumeH2O(double area, double velocity)
          return water volume flow m^3/min
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log4j

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

Constructor Detail

FOCEProcess

public FOCEProcess(ControlLoopAttributes attributes)
Constructor for FOCEProcess (ControlProcessIF)

Parameters:
attributes - ControlLoopAttributes shared by ControlLoopService, PID loops etc.
Method Detail

createOutput

public ControlOutputIF createOutput(ControlLoopAttributes.ConnectorSpec connectorSpec)
                             throws java.lang.Exception,
                                    java.rmi.RemoteException
Throws:
java.lang.Exception
java.rmi.RemoteException

createConnector

public ControlInputIF createConnector(ControlLoopAttributes.ConnectorSpec connectorSpec,
                                      FilterInput input)
                               throws InvalidPropertyException
Throws:
InvalidPropertyException

createFilters

public void createFilters()
                   throws java.lang.Exception
Create signal processing filters for the control inputs and intermediate processing (like pH averaging).

Throws:
java.lang.Exception

configureAllFilters

public void configureAllFilters()
Perform per-filter configuration for all filters.

See Also:
configureFilter(Filter filter)

configureFilter

public void configureFilter(Filter filter)
                     throws java.lang.Exception
Perform per-filter configuration for specified Filter.

Throws:
java.lang.Exception
See Also:
configureAllFilters()

createFilterInputs

public void createFilterInputs()
                        throws java.lang.Exception
Throws:
java.lang.Exception

connectFilterNetwork

public void connectFilterNetwork()
Make connections between all the filters in the filtering network.

See Also:
connectFilter(Filter filter)

connectFilter

public void connectFilter(Filter filter)
                   throws java.lang.Exception
make connections to the filtering network for the specified filter

Throws:
java.lang.Exception

initPHRangeValidatorInstance

public void initPHRangeValidatorInstance()
Cause a new pH Range Validator instance to be created (with latest configuration from ControlLoopAttributes)


getPHRangeValidatorInstance

public RangeValidator getPHRangeValidatorInstance()
initialize an input validator that will be used by shared // by all of the pH input connectors. // Uses simple range (including endpoints), and inserts the last // valid value if an input is invalid. // May need one per channel, for example if the validator should // return an average of previous values when an invalid input is encountered. // Could also implement as a filter, but for now a single validator may be used, // reducing the object count.


initializeInputConnectors

public void initializeInputConnectors()
                               throws InvalidPropertyException,
                                      java.lang.Exception
Create and configure the input connectors for the data stream inputs. The configuration information is specified in ControlLoopAttributes in an array of ControlLoopAttributes.ConnectorSpec objects

Throws:
InvalidPropertyException
java.lang.Exception
See Also:
ControlLoopAttributes, ControlLoopAttributes.ConnectorSpec

configureInputConnector

public void configureInputConnector(ControlLoopAttributes.ConnectorSpec connectorSpec)
                             throws InvalidPropertyException,
                                    java.lang.Exception
Throws:
InvalidPropertyException
java.lang.Exception

initializeOutputConnectors

public void initializeOutputConnectors()
                                throws InvalidPropertyException,
                                       java.lang.Exception
Throws:
InvalidPropertyException
java.lang.Exception

configureOutputConnector

public void configureOutputConnector(ControlLoopAttributes.ConnectorSpec connectorSpec)
                              throws InvalidPropertyException,
                                     java.lang.Exception
Throws:
InvalidPropertyException
java.lang.Exception

setAttributes

public void setAttributes(ControlLoopAttributes attributes)
set ControlLoopAttributes instance


getAttributes

protected ControlLoopAttributes getAttributes()
get ControlLoopAttributes instance


modeName

public java.lang.String modeName(int mode)
get mnemonic associated with specified mode ID


getSignal

public java.lang.Number getSignal(int signalID)
                           throws java.lang.Exception
Get signal value by ID. Signals represent intermediate calculated values in the control loop processing chain, i.e., the "lines" in control loop block diagram that connect functional blocks.

Specified by:
getSignal in interface ProcessStateIF
Throws:
java.lang.Exception

getParameter

public java.lang.Number getParameter(int paramID)
                              throws java.lang.Exception
get current value of a control system parameter by ID

Specified by:
getParameter in interface ProcessStateIF
Throws:
java.lang.Exception

parameterID

public int parameterID(java.lang.String parameterName)
                throws java.lang.Exception
get the parameter ID by name

Specified by:
parameterID in interface ProcessStateIF
Throws:
java.lang.Exception

parameterName

public java.lang.String parameterName(int parameterID)
                               throws java.lang.Exception
get the parameter name by ID

Specified by:
parameterName in interface ProcessStateIF
Throws:
java.lang.Exception

signalID

public int signalID(java.lang.String signalName)
             throws java.lang.Exception
get the signal ID by name

Specified by:
signalID in interface ProcessStateIF
Throws:
java.lang.Exception

parameterNames

public java.lang.String[] parameterNames()
return set of parameter names that may be used to get parameter values KeySet/Iterator are not exportable, so we deal in String arrays

Specified by:
parameterNames in interface ProcessStateIF

signalNames

public java.lang.String[] signalNames()
return set of signal names that may be used to get signal values KeySet/Iterator are not exportable, so we deal in String arrays

Specified by:
signalNames in interface ProcessStateIF

signalName

public java.lang.String signalName(int signalID)
return a signal name for the given signal ID

Specified by:
signalName in interface ProcessStateIF

filterName

public java.lang.String filterName(int filterID)
return a filter name for the given filter ID


filterInputName

public java.lang.String filterInputName(int inputID)
return a filter input name for the given signal ID

Specified by:
filterInputName in interface ProcessStateIF

outputName

public java.lang.String outputName(int outputID)
return an output name for the given output ID


setParameter

public void setParameter(int paramID,
                         java.lang.Number paramValue)
                  throws java.lang.Exception
set a control system parameter

Specified by:
setParameter in interface ProcessConfigIF
Throws:
java.lang.Exception

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
                  throws java.lang.Exception
Set parameter using the underlying ControlLoopAttributes class. This ensures that proper validation is done when assigning the new value.

Specified by:
setParameter in interface ControlProcessIF
Specified by:
setParameter in interface ProcessConfigIF
Throws:
java.lang.Exception

stopProcess

public void stopProcess()
                 throws java.lang.Exception
shutdown process

Specified by:
stopProcess in interface ControlProcessIF
Throws:
java.lang.Exception

simpleStart

public void simpleStart()
                 throws java.lang.Exception
Throws:
java.lang.Exception

startProcess

public void startProcess()
                  throws java.lang.Exception
initialize process

Specified by:
startProcess in interface ControlProcessIF
Throws:
java.lang.Exception

setOutput

public void setOutput(int roleID,
                      ControlOutputIF output)
               throws java.lang.Exception
Specified by:
setOutput in interface ControlProcessIF
Throws:
java.lang.Exception

getOutput

public ControlOutputIF getOutput(int outputID)
                          throws java.rmi.RemoteException
Specified by:
getOutput in interface ControlProcessIF
Throws:
java.rmi.RemoteException

getOutputs

public ControlOutputIF[] getOutputs()
                             throws java.rmi.RemoteException
Specified by:
getOutputs in interface ControlProcessIF
Throws:
java.rmi.RemoteException

getInput

public ControlInputIF getInput(int inputID)
                        throws java.rmi.RemoteException
Specified by:
getInput in interface ControlProcessIF
Throws:
java.rmi.RemoteException

getInputs

public ControlInputIF[] getInputs()
                           throws java.rmi.RemoteException
Specified by:
getInputs in interface ControlProcessIF
Throws:
java.rmi.RemoteException

getState

public int getState()
             throws java.rmi.RemoteException
Specified by:
getState in interface ControlProcessIF
Throws:
java.rmi.RemoteException

setState

public void setState(int state)
              throws java.lang.Exception
set ControlProcessIF state (but not part of the ControlProcessIF interface)

Throws:
java.lang.Exception

volumeH2O

public double volumeH2O(double area,
                        double velocity)
return water volume flow m^3/min


massflowH2O

public double massflowH2O(double densityCO2,
                          double volumeH2O)
return water mass flow kg/min


flowCO2

public double flowCO2(double massCO2,
                      double massH2O)
return CO2 flow mmol/min


volumeCO2

public double volumeCO2(double flowCO2,
                        double concentrationCO2)
return CO2 volume flow liters/min


dph2rate

public double dph2rate(double deltaPH)
return required pumped fluid volume rate (liters/min), given a desired change in pH.


volume2rpm

public double volume2rpm(double volRate)
compute pump speed (rpm) from CO2 flow rate (l/min)


vel2rpm

public double vel2rpm(double velocity)
computer thruster speed (rpm) from water velocity (cm/sec) MotorRPM= aV^2+bV+c where V is water velocity (cm/sec)


getFilter

public Filter getFilter(int filterID)

getFilterInput

public FilterInput getFilterInput(int inputID)

setFilterInputInhibit

public void setFilterInputInhibit(int filterID,
                                  java.lang.String inputName,
                                  boolean inhibitValue)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getNodeReference

public Node getNodeReference(java.lang.String siamHost)
                      throws java.lang.Exception
Throws:
java.lang.Exception

lookupSIAMService

public Instrument lookupSIAMService(java.lang.String siamHost,
                                    java.lang.String registryName)
                             throws java.lang.Exception
Throws:
java.lang.Exception

registry2osdt

public java.lang.String registry2osdt(java.lang.String siamHost,
                                      java.lang.String registryName)
                               throws java.lang.Exception
Throws:
java.lang.Exception

toString

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


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.