org.mbari.siam.devices.sbe37im
Class SeaBird37im

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.core.AggregateInstrumentService
                              extended by org.mbari.siam.devices.sbe37im.SeaBird37im
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, ScheduleOwner, Device, DeviceServiceIF, Instrument

public class SeaBird37im
extends AggregateInstrumentService
implements Instrument

The Sea-Bird Inductive Modem MicroCAT is an autonomous CT /CTD logger that communicates with a base station (normally at sea level), the SIM (surface inductive modem). The base station can supervise up to 100 inductively coupled MicroCAT's. In practice no more than 30 are used to monitor the physical characteristics of a water column. The SIM unit in turn communicates upon request with the Sidearm instrument controller through a low speed RS232 channel. Pre deployment setup Instrument setup Since a MicroCAT's Id cannot be set with multiple units on the IM loop, each module to be deployed at a single site must be preconfigured with it's own unique id. Ideally the module's id also represents its position in the water column w/ 0 being closest to the surface and the highest representing the deepest module. In any event the modules id's should be consecutively numbered. It is expect that other relevant properties such as the reference pressure for modules without pressure sensors would be setup at this time. The service driver would not initialize such properties. Note: When deploying a chain of modules one of them can fail to respond during the pre deployment test. For such an eventuality a spare is taken along. This spare is programmed with the next logical id leaving an id discontinuity. The new id configuration should be added to the puck property idMicroCATs and the service reinitialized.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mbari.siam.core.AggregateInstrumentService
_numSensors
 
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
 
Constructor Summary
SeaBird37im()
          Allocates a new SeaBird37im
 
Method Summary
protected  ScheduleSpecifier createDefaultSampleSchedule()
          Return specifier for default sampling schedule.
protected  byte[] getInstrumentMetadata()
          Not implemented
 SerialPortParameters getSerialPortParameters()
          Return parameters to use on serial port.
protected  PowerPolicy initCommunicationPowerPolicy()
          Return initial value of communication power policy.
protected  int initCurrentLimit()
          Specify current limit in increments of 120 mA upto 11880 mA.
protected  void initializeInstrument()
          Called by the framework to initialize the instrument prior to sampling.
protected  PowerPolicy initInstrumentPowerPolicy()
          Return initial value of instrument power policy.
protected  int initInstrumentStartDelay()
          Specify startup delay (millisec)
protected  int initMaxSampleBytes()
          Specify maximum bytes in raw sample.
protected  byte[] initPromptString()
          Specify prompt string.
protected  byte[] initSampleTerminator()
          Specify sample terminator.
protected  void postSample()
          Called by the framework after sampling.
protected  void prepareToSample()
          Called by the framework before sampling.
protected  void printData(byte[] buf)
          Print instrument data contained in input buffer.
protected  void requestSample(int moduleRef)
          Called repetitively (once per sensor) by the framework at the scheduled interval.
 void setClock(long t)
          Not implemented.
protected  void setNumSensors(int numSensors)
          Override of abstract method which sets the number of sensors this driver has determined it needs to support.
protected  void validateSample(byte[] buffer, int nBytes)
          Validates the following records from MicroCATs:-
 
Methods inherited from class org.mbari.siam.core.AggregateInstrumentService
acquire, incBadResponseCount, incInvalidDataCount, incRetryExceededCount, incSampleCount, incTimeoutCount, requestSample, resetCommStats, test
 
Methods inherited from class org.mbari.siam.core.PolledInstrumentService
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, getParser, getPortDiagnostics, getPortDiagnosticsSummary, getPromptString, getProperties, getProperty, getSampleBuf, getSampleSchedule, getSampleTerminator, getSampleTimeout, getSchedule, getScheduleKey, getSchedules, getServicePropertiesBytes, initialize, initializeDriverDefaults, initializePooledResources, interruptDeviceAccess, logPacket, managePowerSleep, managePowerWake, nPowerRequests, powerOff, powerOffCallback, powerOn, powerOnCallback, prepareToRun, processSample, readSample, removeAllSchedules, removeSchedule, resetPortDiagnostics, resume, resumeSchedule, running, setClock, setCommunicationPowerPolicy, setCurrentLimit, setDefaultSampleScheduleName, setInstrumentPowerPolicy, setInstrumentServiceBlock, setInstrumentStartDelay, setMaxSampleBytes, setMaxSampleTries, setPromptString, setProperty, setRecordType, setSampleTerminator, setSampleTimeout, shutdown, shutdownInstrument, sleepingUntil, snooze, startDeviceAccess, summaryEnabled, suspend, suspendSchedule, sync, syncSchedule
 
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, getParser, getPortDiagnostics, getPortDiagnosticsSummary, getProperties, getProperty, getSampleSchedule, getSchedules, resetPortDiagnostics, 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, test
 
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
 

Constructor Detail

SeaBird37im

public SeaBird37im()
            throws java.rmi.RemoteException
Allocates a new SeaBird37im

Throws:
java.rmi.RemoteException - .
Method Detail

setNumSensors

protected void setNumSensors(int numSensors)
Override of abstract method which sets the number of sensors this driver has determined it needs to support. The super class needs to know this in order to control acquireSample.

Specified by:
setNumSensors in class AggregateInstrumentService
Parameters:
numSensors - the number of slaved instruments supported by the driver.

initInstrumentStartDelay

protected int initInstrumentStartDelay()
Specify startup delay (millisec)

Specified by:
initInstrumentStartDelay in class BaseInstrumentService

initPromptString

protected byte[] initPromptString()
Specify prompt string.

Specified by:
initPromptString in class BaseInstrumentService

initSampleTerminator

protected byte[] initSampleTerminator()
Specify sample terminator.

Specified by:
initSampleTerminator in class BaseInstrumentService

initMaxSampleBytes

protected int initMaxSampleBytes()
Specify maximum bytes in raw sample.

Specified by:
initMaxSampleBytes in class BaseInstrumentService

initCurrentLimit

protected int initCurrentLimit()
Specify current limit in increments of 120 mA upto 11880 mA.

Specified by:
initCurrentLimit in class BaseInstrumentService

initInstrumentPowerPolicy

protected PowerPolicy initInstrumentPowerPolicy()
Return initial value of instrument power policy.

Specified by:
initInstrumentPowerPolicy in class BaseInstrumentService

initCommunicationPowerPolicy

protected PowerPolicy initCommunicationPowerPolicy()
Return initial value of communication power policy.

Specified by:
initCommunicationPowerPolicy in class BaseInstrumentService

createDefaultSampleSchedule

protected ScheduleSpecifier createDefaultSampleSchedule()
                                                 throws ScheduleParseException
Return specifier for default sampling schedule.

Specified by:
createDefaultSampleSchedule in class PolledInstrumentService
Throws:
ScheduleParseException

getSerialPortParameters

public SerialPortParameters getSerialPortParameters()
                                             throws gnu.io.UnsupportedCommOperationException
Return parameters to use on serial port.

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

initializeInstrument

protected void initializeInstrument()
                             throws InitializeException,
                                    java.lang.Exception
Called by the framework to initialize the instrument prior to sampling. Normally this method will use properties determined by the setProperties method.

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

prepareToSample

protected void prepareToSample()
                        throws java.lang.Exception
Called by the framework before sampling. Here we use it to power up the MicroCATs.

Overrides:
prepareToSample in class BaseInstrumentService
Throws:
java.lang.Exception

requestSample

protected void requestSample(int moduleRef)
                      throws TimeoutException,
                             java.lang.Exception
Called repetitively (once per sensor) by the framework at the scheduled interval. Note: The SIM could be in a state where it still waiting for a response from a silent MicroCAT. COMMAND_FORCE_PROMPT is sent to ensure we get the attention of the SIM from any state.

Specified by:
requestSample in class AggregateInstrumentService
Parameters:
moduleRef - Value between 0 and numSensors-1
Throws:
TimeoutException
java.lang.Exception - see setNumSensors(..)

validateSample

protected void validateSample(byte[] buffer,
                              int nBytes)
                       throws InvalidDataException
Validates the following records from MicroCATs:-

 
 TYPE1 = " 00820, 23.6730, 0.00010, 21 Jul 2003, 23:01:28" TYPE2 = "
 00470, 24.3894, 0.00001, 07 Jan 1980, 08:18:24, 25075" TYPE3 = " 01247,
 23.3810, 0.08525, -0.739, 21 Jul 2003, 23:02:50, 24941"
 

Validation is based on two parameters - sample length and number of fields

Overrides:
validateSample in class BaseInstrumentService
Parameters:
buffer - sample data
nBytes - Length of sample data
Throws:
InvalidDataException

postSample

protected void postSample()
Called by the framework after sampling. Here we use it instruct the MicroCATs to power down.

Overrides:
postSample in class BaseInstrumentService

printData

protected void printData(byte[] buf)
Description copied from class: BaseInstrumentService
Print instrument data contained in input buffer. By default does nothing, and may be overridden.

Overrides:
printData in class BaseInstrumentService

getInstrumentMetadata

protected byte[] getInstrumentMetadata()
Not implemented

Returns:
instrument metadata (byte array)

setClock

public void setClock(long t)
Not implemented. Samples are locally timestamped

Specified by:
setClock in interface Instrument
Overrides:
setClock in class BaseInstrumentService
Parameters:
t -


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.