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

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.mbari.siam.core.DeviceService
                  extended by org.mbari.siam.core.BaseInstrumentService
                      extended by org.mbari.siam.core.PolledInstrumentService
                          extended by org.mbari.siam.foce.devices.controlLoop.ControlLoopService
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, ScheduleOwner, Device, ControlLoopConfigIF, ProcessConfigIF, ProcessParameterIF, ProcessStateIF, DeviceServiceIF, Instrument, InstrumentDataListener

public class ControlLoopService
extends PolledInstrumentService
implements Instrument, InstrumentDataListener, ProcessConfigIF, ControlLoopConfigIF, ProcessParameterIF

ControlLoop implements control system for the FOCE CO2 delivery subsystem. ControlLoop reads sensors (pH, current) and acutates motors and valves to maintain desired pH within the FOCE apparatus. Control inputs are received via DataTurbine (OSDT) or the instrument service registry. Control inputs include: - pH (4 internal, 2 external, 1 in the ESW subsystem) - ADV (internal chamber water velocity) - ADCP(ambient environmental water velocity) Control outputs include: - ESW pump - ESW valves - Thruster motors The ControlLoop service manages separate threads for two independent control loops. The pH loop servos around pH by actuating the ESW pump and valves. The velocity control loop maintains water velocity in one of several control modes. A third thread, the process monitor, monitors the state/status of control inputs and outputs. Each of these threads is independent, and may be run at different update periods. In addition to the control threads, a ControlProcessIF instance manages all of the data connections and filtering, providing access to all of the control system internal signals and state information. The control loop implements the ControlProcessIF interface as a thin wrapper, passing calls to the actual ControlProcessIF instance. The ControlLoopService produces a number of record types each readSample() is called. The primary record type is pH control loop data. Additional packets are published for the velocity control loop and status packets for each of the control inputs and outputs. Separate PacketParsers exist for each record type. These are encapsulated in a single ControlLoopParser class, which delegates to the appropriate parser for each record type received. A stand-alone Attributes class (subclasses InstrumentServiceAttributes) contains all of the configuration settings for the control loop. A single ControlLoopAttributes instance is shared by the ControlLoopService and the various control threads.

See Also:
Serialized Form

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
 ControlLoopAttributes _attributes
          Service attributes
protected static org.apache.log4j.Logger _log4j
          Log4j logger
static int _MAX_DATA_BYTES
          max raw data buffer size
static long RECORDTYPE_BASE
          Record type (use base class default record type).
static long RECORDTYPE_INPUT_STATE
          control input state/status data record type
static long RECORDTYPE_OUTPUT_STATE
          control output state/status data record type
static long RECORDTYPE_PH_PID
          pH control loop data record type
static long RECORDTYPE_VELOCITY_PID
          velocity control loop data record type
 
Fields inherited from class org.mbari.siam.core.BaseInstrumentService
_defaultSamplerTask, _defaultSampleScheduleName, _errorCache, _instrumentAttributes, _lastPacket, _lastSensorDataPacket, _maxSampleBytes, _messagePacket, _nPowerRequests, _nWakeRequests, _packetLog, _recordType, _running, _samplerWakeupTime, _scheduleKey, _schedules, _sensorDataPacket, _turbinator, MAX_BASE_RECORDTYPE, RECORDTYPE_DEFAULT, RECORDTYPE_METADATA, RECORDTYPE_UNDEFINED
 
Fields inherited from class org.mbari.siam.core.DeviceService
_fromDevice, _instrumentPort, _nodeProperties, _parentNode, _regEntry, _sandBox, _serviceCachePath, _serviceName, _servicePropertiesPath, _serviceXMLPath, _toDevice, CACHED_PROPERTIES_FILENAME, PROPERTIES_FILENAME, XML_FILENAME
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.mbari.siam.distributed.Device
ERROR, INITIAL, INSTRUMENT_STATE, MDATA_ALL, OK, SAFE, SAMPLING, SERVICE_ATTRIBUTES, SERVICE_CACHE, SERVICE_PROPERTIES, SERVICE_XML, SHUTDOWN, SLEEPING, SUSPEND, UNKNOWN
 
Fields inherited from interface org.mbari.siam.distributed.devices.ControlLoopConfigIF
FID_AFT_COMBINER, FID_EXT_COMBINER, FID_FWD_COMBINER, FID_INT_COMBINER, IID_PH_ACOM_L, IID_PH_ACOM_R, IID_PH_ECOM_L, IID_PH_ECOM_R, IID_PH_FCOM_L, IID_PH_FCOM_R, IID_PH_ICOM_AFT, IID_PH_ICOM_FWD, LID_ALL, LID_PH_LOOP, LID_VELOCITY_LOOP, MODE_CONSTANT, MODE_DEADBAND, MODE_EXP, MODE_LIN, MODE_MANUAL, MODE_OFFSET, MODE_PANIC, MODE_PID
 
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
ControlLoopService()
          Zero-arg constructor
 
Method Summary
 void closeESWValves()
          Close the ESW valves
 void configureFilter(int filterID, int[] inputIDs, double[] inputWeights, int divisor)
          Change filter configuration.
protected  ScheduleSpecifier createDefaultSampleSchedule()
          required by PolledInstrumentService
 void dataCallback(DevicePacket sensorData, PacketParser.Field[] fields)
          dataCallback from the sensors.
 java.lang.String filterInputName(int inputID)
          return a signal name for the given signal ID
 java.lang.Number getParameter(int paramID)
          get numeric value of specified parameter (attribute) by ID
 PacketParser getParser()
          Return a PacketParser.
protected  long getRecordType(java.util.Map map, java.lang.String key)
           
 SerialPortParameters getSerialPortParameters()
          required by DeviceService
 java.lang.Number getSignal(int signalID)
          get signal value by ID
protected  PowerPolicy initCommunicationPowerPolicy()
          required by BaseInstrumentService
protected  int initCurrentLimit()
          required by BaseInstrumentService
 void initializeControl(int id)
          Initialize one or more control loops
protected  void initializeInstrument()
          Register us for data callbacks from the temperature device
protected  PowerPolicy initInstrumentPowerPolicy()
          required by BaseInstrumentService
protected  int initInstrumentStartDelay()
          required by BaseInstrumentService
protected  int initMaxSampleBytes()
          required by BaseInstrumentService
protected  byte[] initPromptString()
          required by BaseInstrumentService
protected  byte[] initSampleTerminator()
          required by BaseInstrumentService
protected  void logSamples(java.lang.String[] samples)
          Log additional sample record types.
 void panicStop(int id)
          Fast shutdown of control loop, inputs and outputs.
 int parameterID(java.lang.String parameterName)
          get ID of specified parameter (attribute) by name
 java.lang.String parameterName(int parameterID)
          get name of specified parameter (attribute) by ID
 java.lang.String[] parameterNames()
          get list of parameter names
 java.lang.Object parseDataPacket(SensorDataPacket pkt)
          Parse a SensorDataPacket into a double[] array (used by infrastructure)
 void pauseControl(int id)
          pause one or more control loops
protected  int readSample(byte[] sample)
          The instrument service framework architecture allowss one sample per cycle.
protected  void requestSample()
          required by BaseInstrumentService
 void resetControl(int id)
          Reset control service (not implemented)
 void resumeControl(int id)
          resume one or more (paused) control loops
 void serviceRegisteredCallback(RegistryEntry entry)
          Callback for InstrumentDataListener interface, called when service is registered with the InstrumentRegistry Fulfills InstrumentDataListener interface
 void setFilterDivisor(int filterID, int divisor)
          Set the divisor for the specified (weighted average) filter.
 void setFilterInputWeight(int inputID, double weight)
          Set the input weighting for the specified (weighted average) filter input.
 void setParameter(int parameterName, java.lang.Number parameterValue)
          set a numeric control system parameter (attribute)
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          parse and set a control system parameter (attribute)
 void setPHControlMode(int modeID)
          Enter a pre-defined operation mode indicated by modeID
 void setPHResponseMode(int modeID)
          Enter a pre-defined operation mode indicated by modeID
 void setVelocityControlMode(int modeID)
          Enter a pre-defined operation mode indicated by modeID
 int signalID(java.lang.String signalName)
          get ID of specified signal by name
 java.lang.String signalName(int signalID)
          get signal name by ID
 java.lang.String[] signalNames()
          get list of signal names
 void startControl(int id)
          start one or more control loops
 void stopControl(int id)
          stop one or more control loops
 void stopESWPump()
          Stop the ESW pump
 void stopThrusters()
          Stop the thrusters
 int test()
          Self-test not implemented.
 
Methods inherited from class org.mbari.siam.core.PolledInstrumentService
acquire, doScheduledTask, setAttributes
 
Methods inherited from class org.mbari.siam.core.BaseInstrumentService
acquireSample, addDefaultPacketFilters, addSchedule, addSchedule, annotate, assertSamplingState, cacheProperties, callDataListeners, canSummarize, checkInputProperties, cleanupServiceState, clearDefaultPacketFilters, clearPropertiesCache, createPacketLog, createTask, createTurbinators, disableSummary, enableSummary, endDeviceAccess, getAllSchedules, getChildren, getCommunicationPowerPolicy, getCurrentLimit, getDefaultPacketFilters, getDefaultSampleSchedule, getDefaultSampleScheduleName, getDevicePacketParser, getFileBytes, getInstrumentPowerPolicy, getInstrumentServiceBlock, getInstrumentStartDelay, getInstrumentStateMetadata, getLastSample, getMaxSampleBytes, getMaxSampleTries, getMetadata, getMetadata, getMetadataPayload, getPackets, getPackets, getParent, getPortDiagnostics, getPortDiagnosticsSummary, getPromptString, getProperties, getProperty, getSampleBuf, getSampleSchedule, getSampleTerminator, getSampleTimeout, getSchedule, getScheduleKey, getSchedules, getServicePropertiesBytes, initialize, initializeDriverDefaults, initializePooledResources, interruptDeviceAccess, logPacket, managePowerSleep, managePowerWake, nPowerRequests, postSample, powerOff, powerOffCallback, powerOn, powerOnCallback, prepareToRun, prepareToSample, printData, processSample, removeAllSchedules, removeSchedule, resetPortDiagnostics, resume, resumeSchedule, running, setClock, setClock, setCommunicationPowerPolicy, setCurrentLimit, setDefaultSampleScheduleName, setInstrumentPowerPolicy, setInstrumentServiceBlock, setInstrumentStartDelay, setMaxSampleBytes, setMaxSampleTries, setPromptString, setProperty, setRecordType, setSampleTerminator, setSampleTimeout, shutdown, shutdownInstrument, sleepingUntil, snooze, startDeviceAccess, summaryEnabled, suspend, suspendSchedule, sync, syncSchedule, validateSample
 
Methods inherited from class org.mbari.siam.core.DeviceService
addDataListener, advertiseService, createRegistryEntry, getAttributes, getCommPortName, getFrameworkVersion, getId, getInstrumentPort, getLocation, getName, getRemoteSerialPort, getRemoteSerialPort, getSamplingCount, getSamplingErrorCount, getSamplingRetryCount, getStatus, host, incRetryCount, initializePropertyDefaults, registryEntry, registryName, removeDataListener, setInstrumentPort, setNodeProperties, setParent, setSerialPort, setStatusError, setStatusInitial, setStatusOk, setStatusSafe, setStatusSampling, setStatusShutdown, setStatusSuspend
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mbari.siam.distributed.Instrument
acquireSample, addDefaultPacketFilters, annotate, cacheProperties, clearDefaultPacketFilters, clearPropertiesCache, disableSummary, enableSummary, getDefaultPacketFilters, getLastSample, getPackets, getPackets, getPortDiagnostics, getPortDiagnosticsSummary, getProperties, getProperty, getSampleSchedule, getSchedules, resetPortDiagnostics, setClock, setClock, setProperty, summaryEnabled
 
Methods inherited from interface org.mbari.siam.distributed.Device
getChildren, getCommPortName, getFrameworkVersion, getId, getLocation, getMetadata, getName, getParent, getSamplingCount, getSamplingErrorCount, getSamplingRetryCount, getStatus, host, powerOff, powerOn, prepareToRun, resume, shutdown, suspend
 
Methods inherited from interface org.mbari.siam.distributed.DeviceServiceIF
getName
 
Methods inherited from interface org.mbari.siam.core.ScheduleOwner
addSchedule, getAllSchedules, getScheduleKey, removeAllSchedules, removeSchedule, resumeSchedule, sleepingUntil, suspendSchedule, syncSchedule
 

Field Detail

RECORDTYPE_BASE

public static final long RECORDTYPE_BASE
Record type (use base class default record type). Other record types are indexed from this value.

See Also:
Constant Field Values

RECORDTYPE_PH_PID

public static final long RECORDTYPE_PH_PID
pH control loop data record type

See Also:
Constant Field Values

RECORDTYPE_VELOCITY_PID

public static final long RECORDTYPE_VELOCITY_PID
velocity control loop data record type

See Also:
Constant Field Values

RECORDTYPE_INPUT_STATE

public static final long RECORDTYPE_INPUT_STATE
control input state/status data record type

See Also:
Constant Field Values

RECORDTYPE_OUTPUT_STATE

public static final long RECORDTYPE_OUTPUT_STATE
control output state/status data record type

See Also:
Constant Field Values

_MAX_DATA_BYTES

public static final int _MAX_DATA_BYTES
max raw data buffer size

See Also:
Constant Field Values

_log4j

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


_attributes

public ControlLoopAttributes _attributes
Service attributes

Constructor Detail

ControlLoopService

public ControlLoopService()
                   throws java.rmi.RemoteException
Zero-arg constructor

Throws:
java.rmi.RemoteException
Method Detail

test

public int test()
Self-test not implemented.

Specified by:
test in interface Device

createDefaultSampleSchedule

protected ScheduleSpecifier createDefaultSampleSchedule()
                                                 throws ScheduleParseException
required by PolledInstrumentService

Specified by:
createDefaultSampleSchedule in class PolledInstrumentService
Throws:
ScheduleParseException

requestSample

protected void requestSample()
                      throws java.lang.Exception
required by BaseInstrumentService

Specified by:
requestSample in class PolledInstrumentService
Throws:
java.lang.Exception

initInstrumentPowerPolicy

protected PowerPolicy initInstrumentPowerPolicy()
required by BaseInstrumentService

Specified by:
initInstrumentPowerPolicy in class BaseInstrumentService

initCommunicationPowerPolicy

protected PowerPolicy initCommunicationPowerPolicy()
required by BaseInstrumentService

Specified by:
initCommunicationPowerPolicy in class BaseInstrumentService

initMaxSampleBytes

protected int initMaxSampleBytes()
required by BaseInstrumentService

Specified by:
initMaxSampleBytes in class BaseInstrumentService

initPromptString

protected byte[] initPromptString()
required by BaseInstrumentService

Specified by:
initPromptString in class BaseInstrumentService

initSampleTerminator

protected byte[] initSampleTerminator()
required by BaseInstrumentService

Specified by:
initSampleTerminator in class BaseInstrumentService

initCurrentLimit

protected int initCurrentLimit()
required by BaseInstrumentService

Specified by:
initCurrentLimit in class BaseInstrumentService

initInstrumentStartDelay

protected int initInstrumentStartDelay()
required by BaseInstrumentService

Specified by:
initInstrumentStartDelay in class BaseInstrumentService

getSerialPortParameters

public SerialPortParameters getSerialPortParameters()
                                             throws gnu.io.UnsupportedCommOperationException
required by DeviceService

Overrides:
getSerialPortParameters in class DeviceService
Throws:
gnu.io.UnsupportedCommOperationException

initializeInstrument

protected void initializeInstrument()
                             throws InitializeException,
                                    java.lang.Exception
Register us for data callbacks from the temperature device

Overrides:
initializeInstrument in class BaseInstrumentService
Throws:
InitializeException
java.lang.Exception

readSample

protected int readSample(byte[] sample)
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.Exception
The instrument service framework architecture allowss one sample per cycle. We'll treat the pH PID data as the one sample, and log additional records using logSamples() (defined in this class).

Overrides:
readSample in class BaseInstrumentService
Parameters:
sample - output buffer
Throws:
TimeoutException
java.io.IOException
java.lang.Exception

getParser

public PacketParser getParser()
                       throws NotSupportedException
Return a PacketParser.

Specified by:
getParser in interface Instrument
Overrides:
getParser in class BaseInstrumentService
Throws:
NotSupportedException

parseDataPacket

public java.lang.Object parseDataPacket(SensorDataPacket pkt)
                                 throws InvalidDataException
Parse a SensorDataPacket into a double[] array (used by infrastructure)

Throws:
InvalidDataException

getRecordType

protected long getRecordType(java.util.Map map,
                             java.lang.String key)

logSamples

protected void logSamples(java.lang.String[] samples)
Log additional sample record types.


stopESWPump

public void stopESWPump()
                 throws java.lang.Exception
Stop the ESW pump

Throws:
java.lang.Exception

closeESWValves

public void closeESWValves()
                    throws java.lang.Exception
Close the ESW valves

Throws:
java.lang.Exception

stopThrusters

public void stopThrusters()
                   throws java.lang.Exception
Stop the thrusters

Throws:
java.lang.Exception

dataCallback

public void dataCallback(DevicePacket sensorData,
                         PacketParser.Field[] fields)
dataCallback from the sensors. Fulfills InstrumentDataListener interface

Specified by:
dataCallback in interface InstrumentDataListener
Parameters:
sensorData - - SensorDataPacket that instrument logged
fields - - Result of passing sensorData to PacketParser.parseFields() if registered DeviceService is an instanceof BaseInstrumentService. Else null.

serviceRegisteredCallback

public void serviceRegisteredCallback(RegistryEntry entry)
Callback for InstrumentDataListener interface, called when service is registered with the InstrumentRegistry Fulfills InstrumentDataListener interface

Specified by:
serviceRegisteredCallback in interface InstrumentDataListener

initializeControl

public void initializeControl(int id)
                       throws java.lang.Exception
Initialize one or more control loops

Specified by:
initializeControl in interface ControlLoopConfigIF
Throws:
java.lang.Exception

resetControl

public void resetControl(int id)
                  throws java.lang.Exception
Reset control service (not implemented)

Specified by:
resetControl in interface ControlLoopConfigIF
Throws:
java.lang.Exception

startControl

public void startControl(int id)
                  throws java.lang.Exception
start one or more control loops

Specified by:
startControl in interface ControlLoopConfigIF
Throws:
java.lang.Exception

stopControl

public void stopControl(int id)
                 throws java.lang.Exception
stop one or more control loops

Specified by:
stopControl in interface ControlLoopConfigIF
Throws:
java.lang.Exception

pauseControl

public void pauseControl(int id)
pause one or more control loops

Specified by:
pauseControl in interface ControlLoopConfigIF

resumeControl

public void resumeControl(int id)
resume one or more (paused) control loops

Specified by:
resumeControl in interface ControlLoopConfigIF

setPHResponseMode

public void setPHResponseMode(int modeID)
                       throws java.lang.Exception,
                              java.rmi.RemoteException
Enter a pre-defined operation mode indicated by modeID

Specified by:
setPHResponseMode in interface ControlLoopConfigIF
Throws:
java.lang.Exception
java.rmi.RemoteException

setPHControlMode

public void setPHControlMode(int modeID)
                      throws java.lang.Exception,
                             java.rmi.RemoteException
Enter a pre-defined operation mode indicated by modeID

Specified by:
setPHControlMode in interface ControlLoopConfigIF
Throws:
java.lang.Exception
java.rmi.RemoteException

setVelocityControlMode

public void setVelocityControlMode(int modeID)
                            throws java.lang.Exception,
                                   java.rmi.RemoteException
Enter a pre-defined operation mode indicated by modeID

Specified by:
setVelocityControlMode in interface ControlLoopConfigIF
Throws:
java.lang.Exception
java.rmi.RemoteException

panicStop

public void panicStop(int id)
               throws java.lang.Exception,
                      java.rmi.RemoteException
Fast shutdown of control loop, inputs and outputs.

Specified by:
panicStop in interface ControlLoopConfigIF
Throws:
java.lang.Exception
java.rmi.RemoteException

setFilterInputWeight

public void setFilterInputWeight(int inputID,
                                 double weight)
                          throws java.lang.Exception
Set the input weighting for the specified (weighted average) filter input. In this context, the weight value is generally >= 0, though it could be set negative to create linear combinations of inputs. The input weights may be used in conjuction with divisor to dynamically configure signal filtering.

Specified by:
setFilterInputWeight in interface ControlLoopConfigIF
Throws:
java.lang.Exception
See Also:
setFilterDivisor(int filterID, int divisor)

setFilterDivisor

public void setFilterDivisor(int filterID,
                             int divisor)
                      throws java.lang.Exception
Set the divisor for the specified (weighted average) filter. The divisor behavior is defined as follows: If divisor == 0, the average is computed using the sum of the uninhibited inputs divided by the total number of uninhibited inputs. If divisor != 0, the average is computed using the sum of the uninhibited inputs divided by the divisor. In this context, the divisor must be >=0; The divisor may be used in conjuction with input weights to dynamically configure signal filtering.

Specified by:
setFilterDivisor in interface ControlLoopConfigIF
Throws:
java.lang.Exception
See Also:
setFilterInputWeight(int inputID, double weight)

configureFilter

public void configureFilter(int filterID,
                            int[] inputIDs,
                            double[] inputWeights,
                            int divisor)
                     throws java.lang.Exception
Change filter configuration. This method is used by clients to change which inputs are used to produce filtered signals used for control, e.g. Internal pH. This enables some flexibility combining and including/excluding sensors to produce filtered control signals.

Specified by:
configureFilter in interface ControlLoopConfigIF
Parameters:
filterID - A filter ID, as defined in the ControlLoopConfigIF interface
inputIDs - An array of signal IDs that should be used as inputs to the filter indicated by filterID. The valid signal IDs are defined in the ControlLoopConfigIF interface.
inputWeights - The respective weight of each of the specified input signals. If a signal weight is set to zero, the signal input is disabled and not included
divisor - Divides filter value
Throws:
java.lang.Exception
See Also:
setFilterDivisor(int filterID, int divisor)

getParameter

public java.lang.Number getParameter(int paramID)
                              throws java.lang.Exception
get numeric value of specified parameter (attribute) by ID

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

getSignal

public java.lang.Number getSignal(int signalID)
                           throws java.lang.Exception,
                                  java.rmi.RemoteException
get signal value by ID

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

parameterID

public int parameterID(java.lang.String parameterName)
                throws java.lang.Exception
get ID of specified parameter (attribute) 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 name of specified parameter (attribute) 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 ID of specified signal by name

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

parameterNames

public java.lang.String[] parameterNames()
                                  throws java.rmi.RemoteException
get list of parameter names

Specified by:
parameterNames in interface ProcessStateIF
Throws:
java.rmi.RemoteException

signalNames

public java.lang.String[] signalNames()
                               throws java.rmi.RemoteException
get list of signal names

Specified by:
signalNames in interface ProcessStateIF
Throws:
java.rmi.RemoteException

signalName

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

Specified by:
signalName in interface ProcessStateIF
Throws:
java.rmi.RemoteException

filterInputName

public java.lang.String filterInputName(int inputID)
                                 throws java.rmi.RemoteException
return a signal name for the given signal ID

Specified by:
filterInputName in interface ProcessStateIF
Throws:
java.rmi.RemoteException

setParameter

public void setParameter(int parameterName,
                         java.lang.Number parameterValue)
                  throws java.lang.Exception
set a numeric control system parameter (attribute)

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
parse and set a control system parameter (attribute)

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


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.