org.mbari.siam.foce.devices.co2subsys
Class CO2SubsystemMonitor

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.co2subsys.CO2SubsystemMonitor
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, ScheduleOwner, Device, CO2SubsystemMonitorIF, DeviceServiceIF, Instrument, InstrumentDataListener

public class CO2SubsystemMonitor
extends PolledInstrumentService
implements Instrument, InstrumentDataListener, CO2SubsystemMonitorIF

reads and writes the B&B 232SPDA module used to interface various analog and digital signals from within the CO2 electronics housing. It has seven 12-bit A/D inputs, four 8-bit D/A outputs, two digital inputs and one digital output. It is powered by +12Vdc and is communicated to via an RS-232 connection. It is serial port #yy and it's serial parameters are xxxx,x,x,x with xx hardware control. See appendicies for specific command structures. Analog In #0: Volt_24V This is a scaled version of the main +24Vdc bus. The input range is a DC voltage from 0 volts to 5 volts, which maps to an input voltage range of 0 to +30V. The defining equation is y (Bus volts) = 6.0x (ADC volts). Analog In #1: Curr_24V This is a representative voltage of the current used by the +24Vdc bus. The input range is a DC voltage from 0 volts to 5 volts, which maps to an input current range of 0 to 10A. The defining equation is y (Bus amps) = 2.0x (ADC volts). Analog In #2: HTM2530 Humidity This is the ambient humidity inside of the FOCE electronics can. It outputs a 1-4V signal which corresponds to 0-100% Relative Humidity (RH). The defining equation is y (%RH) = 37.5 x (ADC volts) - 37.5. Analog In #3: HTM2530 Temperature This is the ambient temperature inside of the FOCE electronics can. It outputs a 0 to 5V signal which corresponds to a -40 C to +125 C temperature range. There are two possible defining equations, a more precise third order polynomial and a simpler linear equation. The linear equation works sufficiently around our expected operating range but generates considerable errors at either extreme. Third Order: y = 7.689x^3-48.935x^2+137.49x-132.34 Linear: y = 40.944x - 73.787 where y is the measured temperature in degress Celsius x is the ADC volts Analog In #4: Fan State This signal is actually a digital input signal used to indicate the stae of the cooling fan. High = Fan OFF, Low = Fan ON. Analog In #5: Reserved for future use Analog In #6: Reserved for future use Digital In #0: Water Sensor #1 This is a digital input signal tied to water detector #1. A digital high indicates no water present, while a digital low indicates water in the housing. Digital In #1: Water Sensor #2 This is a digital input signal tied to water detector #2. A digital high indicates no water present, while a digital low indicates water in the housing. Digital Out #0: Fan Control This is a digital output signal used to control the state of the cooling fan. Setting this bit high activates the fan, while a low de-activates the fan. Analog Out #0-#3: Not Used These signals are not brought out to the Power Monitor Board.

See Also:
Serialized Form

Field Summary
 CO2SubsystemMonitorAttributes _attributes
          Service attributes
protected static org.apache.log4j.Logger _log4j
          Log4j logger
static int AD_BITS
           
static double AD_COUNTS
           
static short AD_MASK
           
static int ANALOG_IN_5
           
static int ANALOG_IN_6
           
static int CURRENT_24V
           
static int FAN_CONTROL
           
static int FAN_STATE
           
static int HUMIDITY
           
static int TEMPERATURE
           
static int VOLTAGE_24V
           
static double VREF
           
static int WATER_SENSOR_1
           
static int WATER_SENSOR_2
           
 
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.CO2SubsystemMonitorIF
FAN_CONTROL_OFF, FAN_CONTROL_ON
 
Constructor Summary
CO2SubsystemMonitor()
          Zero-arg constructor
 
Method Summary
protected  double[] convertData(short[] rawData)
           
protected  double counts2volts(short counts)
           
protected  ScheduleSpecifier createDefaultSampleSchedule()
          required by PolledInstrumentService
 void dataCallback(DevicePacket sensorData, PacketParser.Field[] fields)
          dataCallback from the sensors.
 PacketParser.Field[] getMonitorState()
          Read the monitor state, but do not log the sample
 PacketParser getParser()
          Return a PacketParser (create one if an instance doesn't exist).
 SerialPortParameters getSerialPortParameters()
          required by DeviceService
protected  PowerPolicy initCommunicationPowerPolicy()
          required by BaseInstrumentService
protected  int initCurrentLimit()
          required by BaseInstrumentService
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
 java.lang.Object parseDataPacket(SensorDataPacket pkt)
          Parse a SensorDataPacket into a double[] array (used by infrastructure)
protected  int readSample(byte[] sample)
          Read raw sample bytes from serial port into buffer, return number of bytes read.
protected  void requestSample()
          required by BaseInstrumentService
 void serviceRegisteredCallback(RegistryEntry entry)
          Callback for InstrumentDataListener interface, called when service is registered with the InstrumentRegistry Fulfills InstrumentDataListener interface
 void setFanControl(int state)
          Set the CO2 cooling fan control bit.
 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

_log4j

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


VOLTAGE_24V

public static final int VOLTAGE_24V
See Also:
Constant Field Values

CURRENT_24V

public static final int CURRENT_24V
See Also:
Constant Field Values

HUMIDITY

public static final int HUMIDITY
See Also:
Constant Field Values

TEMPERATURE

public static final int TEMPERATURE
See Also:
Constant Field Values

FAN_STATE

public static final int FAN_STATE
See Also:
Constant Field Values

ANALOG_IN_5

public static final int ANALOG_IN_5
See Also:
Constant Field Values

ANALOG_IN_6

public static final int ANALOG_IN_6
See Also:
Constant Field Values

WATER_SENSOR_1

public static final int WATER_SENSOR_1
See Also:
Constant Field Values

WATER_SENSOR_2

public static final int WATER_SENSOR_2
See Also:
Constant Field Values

FAN_CONTROL

public static final int FAN_CONTROL
See Also:
Constant Field Values

AD_BITS

public static final int AD_BITS
See Also:
Constant Field Values

AD_COUNTS

public static final double AD_COUNTS

AD_MASK

public static final short AD_MASK
See Also:
Constant Field Values

VREF

public static final double VREF
See Also:
Constant Field Values

_attributes

public CO2SubsystemMonitorAttributes _attributes
Service attributes

Constructor Detail

CO2SubsystemMonitor

public CO2SubsystemMonitor()
                    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()
required by PolledInstrumentService

Specified by:
createDefaultSampleSchedule in class PolledInstrumentService

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

counts2volts

protected double counts2volts(short counts)

convertData

protected double[] convertData(short[] rawData)

readSample

protected int readSample(byte[] sample)
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.Exception
Description copied from class: BaseInstrumentService
Read raw sample bytes from serial port into buffer, return number of bytes read. Reads characters from serial port until sample terminator string is encountered.

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 (create one if an instance doesn't exist).

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

setFanControl

public void setFanControl(int state)
                   throws java.lang.Exception
Set the CO2 cooling fan control bit. valid state values are FAN_CONTROL_ON, FAN_CONTROL_OFF

Specified by:
setFanControl in interface CO2SubsystemMonitorIF
Throws:
java.lang.Exception

getMonitorState

public PacketParser.Field[] getMonitorState()
                                     throws java.lang.Exception
Read the monitor state, but do not log the sample

Specified by:
getMonitorState in interface CO2SubsystemMonitorIF
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


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.