|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.mbari.siam.core.DeviceService
org.mbari.siam.core.BaseInstrumentService
org.mbari.siam.core.PolledInstrumentService
org.mbari.siam.foce.devices.controlLoop.ControlLoopService
public class ControlLoopService
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.
| 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 |
| 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 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 |
|---|
public static final long RECORDTYPE_BASE
public static final long RECORDTYPE_PH_PID
public static final long RECORDTYPE_VELOCITY_PID
public static final long RECORDTYPE_INPUT_STATE
public static final long RECORDTYPE_OUTPUT_STATE
public static final int _MAX_DATA_BYTES
protected static org.apache.log4j.Logger _log4j
public ControlLoopAttributes _attributes
| Constructor Detail |
|---|
public ControlLoopService()
throws java.rmi.RemoteException
java.rmi.RemoteException| Method Detail |
|---|
public int test()
test in interface Device
protected ScheduleSpecifier createDefaultSampleSchedule()
throws ScheduleParseException
createDefaultSampleSchedule in class PolledInstrumentServiceScheduleParseException
protected void requestSample()
throws java.lang.Exception
requestSample in class PolledInstrumentServicejava.lang.Exceptionprotected PowerPolicy initInstrumentPowerPolicy()
initInstrumentPowerPolicy in class BaseInstrumentServiceprotected PowerPolicy initCommunicationPowerPolicy()
initCommunicationPowerPolicy in class BaseInstrumentServiceprotected int initMaxSampleBytes()
initMaxSampleBytes in class BaseInstrumentServiceprotected byte[] initPromptString()
initPromptString in class BaseInstrumentServiceprotected byte[] initSampleTerminator()
initSampleTerminator in class BaseInstrumentServiceprotected int initCurrentLimit()
initCurrentLimit in class BaseInstrumentServiceprotected int initInstrumentStartDelay()
initInstrumentStartDelay in class BaseInstrumentService
public SerialPortParameters getSerialPortParameters()
throws gnu.io.UnsupportedCommOperationException
getSerialPortParameters in class DeviceServicegnu.io.UnsupportedCommOperationException
protected void initializeInstrument()
throws InitializeException,
java.lang.Exception
initializeInstrument in class BaseInstrumentServiceInitializeException
java.lang.Exception
protected int readSample(byte[] sample)
throws TimeoutException,
java.io.IOException,
java.lang.Exception
readSample in class BaseInstrumentServicesample - output buffer
TimeoutException
java.io.IOException
java.lang.Exception
public PacketParser getParser()
throws NotSupportedException
getParser in interface InstrumentgetParser in class BaseInstrumentServiceNotSupportedException
public java.lang.Object parseDataPacket(SensorDataPacket pkt)
throws InvalidDataException
InvalidDataException
protected long getRecordType(java.util.Map map,
java.lang.String key)
protected void logSamples(java.lang.String[] samples)
public void stopESWPump()
throws java.lang.Exception
java.lang.Exception
public void closeESWValves()
throws java.lang.Exception
java.lang.Exception
public void stopThrusters()
throws java.lang.Exception
java.lang.Exception
public void dataCallback(DevicePacket sensorData,
PacketParser.Field[] fields)
dataCallback in interface InstrumentDataListenersensorData - - SensorDataPacket that instrument loggedfields - - Result of passing sensorData to PacketParser.parseFields()
if registered DeviceService is an instanceof BaseInstrumentService. Else null.public void serviceRegisteredCallback(RegistryEntry entry)
serviceRegisteredCallback in interface InstrumentDataListener
public void initializeControl(int id)
throws java.lang.Exception
initializeControl in interface ControlLoopConfigIFjava.lang.Exception
public void resetControl(int id)
throws java.lang.Exception
resetControl in interface ControlLoopConfigIFjava.lang.Exception
public void startControl(int id)
throws java.lang.Exception
startControl in interface ControlLoopConfigIFjava.lang.Exception
public void stopControl(int id)
throws java.lang.Exception
stopControl in interface ControlLoopConfigIFjava.lang.Exceptionpublic void pauseControl(int id)
pauseControl in interface ControlLoopConfigIFpublic void resumeControl(int id)
resumeControl in interface ControlLoopConfigIF
public void setPHResponseMode(int modeID)
throws java.lang.Exception,
java.rmi.RemoteException
setPHResponseMode in interface ControlLoopConfigIFjava.lang.Exception
java.rmi.RemoteException
public void setPHControlMode(int modeID)
throws java.lang.Exception,
java.rmi.RemoteException
setPHControlMode in interface ControlLoopConfigIFjava.lang.Exception
java.rmi.RemoteException
public void setVelocityControlMode(int modeID)
throws java.lang.Exception,
java.rmi.RemoteException
setVelocityControlMode in interface ControlLoopConfigIFjava.lang.Exception
java.rmi.RemoteException
public void panicStop(int id)
throws java.lang.Exception,
java.rmi.RemoteException
panicStop in interface ControlLoopConfigIFjava.lang.Exception
java.rmi.RemoteException
public void setFilterInputWeight(int inputID,
double weight)
throws java.lang.Exception
setFilterInputWeight in interface ControlLoopConfigIFjava.lang.ExceptionsetFilterDivisor(int filterID, int divisor)
public void setFilterDivisor(int filterID,
int divisor)
throws java.lang.Exception
setFilterDivisor in interface ControlLoopConfigIFjava.lang.ExceptionsetFilterInputWeight(int inputID, double weight)
public void configureFilter(int filterID,
int[] inputIDs,
double[] inputWeights,
int divisor)
throws java.lang.Exception
configureFilter in interface ControlLoopConfigIFfilterID - A filter ID, as defined in the ControlLoopConfigIF interfaceinputIDs - 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 includeddivisor - Divides filter value
java.lang.ExceptionsetFilterDivisor(int filterID, int divisor)
public java.lang.Number getParameter(int paramID)
throws java.lang.Exception
getParameter in interface ProcessStateIFjava.lang.Exception
public java.lang.Number getSignal(int signalID)
throws java.lang.Exception,
java.rmi.RemoteException
getSignal in interface ProcessStateIFjava.lang.Exception
java.rmi.RemoteException
public int parameterID(java.lang.String parameterName)
throws java.lang.Exception
parameterID in interface ProcessStateIFjava.lang.Exception
public java.lang.String parameterName(int parameterID)
throws java.lang.Exception
parameterName in interface ProcessStateIFjava.lang.Exception
public int signalID(java.lang.String signalName)
throws java.lang.Exception
signalID in interface ProcessStateIFjava.lang.Exception
public java.lang.String[] parameterNames()
throws java.rmi.RemoteException
parameterNames in interface ProcessStateIFjava.rmi.RemoteException
public java.lang.String[] signalNames()
throws java.rmi.RemoteException
signalNames in interface ProcessStateIFjava.rmi.RemoteException
public java.lang.String signalName(int signalID)
throws java.rmi.RemoteException
signalName in interface ProcessStateIFjava.rmi.RemoteException
public java.lang.String filterInputName(int inputID)
throws java.rmi.RemoteException
filterInputName in interface ProcessStateIFjava.rmi.RemoteException
public void setParameter(int parameterName,
java.lang.Number parameterValue)
throws java.lang.Exception
setParameter in interface ProcessConfigIFjava.lang.Exception
public void setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
throws java.lang.Exception
setParameter in interface ProcessConfigIFjava.lang.Exception
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||