Seabird 25 Software Reference Documentation
-------------------------------------------

Introduction
============

This document has been composed after a significant restructuring of a previous Seabird 25 driver, needed for intergration of the new model, the 25p. This model has some expanded features and difference data structures that required a new driver be branched from the original. This was done to preserve backward compatibility for dorado systems still using the 25 system.The expanded features of the 25p system brought in a simpler communication standard as well as expanded capabilities for sampling more voltage channels (8) and logging input serial data. Also all channels have increased ADC resolution from previous models

Features
========

To Summarize, the driver software for the Seabird 25plus system encompasses the following features:

  - Standard serial or tcp interaction with the instrument (assuming raw data transmit protocols).
  - Binary log file generation compliant with previous versions, addition of new fields should not interfere with processing scripts.
  - Integration of newest Seabird reccomendations value calculation to comply with newer style calibration constants. Older style calculations are still available. Assignment of which calibration set to use is set in the configuration file (`A` for A-E constants, and `G` for G-J constants.
  - New calculations to resolve depth from standard onboard pressure sensor. These depth values are also latitude corrected, using the same calculations employed in the Paroscientific drivers. Both refer to values set in the `worksite.cfg` file.


Interface
=========

This software meets standard Dorado class specifications built on the server/driver concepts, incorporating taskIF based inter-process interactions. As a device driver, exterior interactions defined in the Seabird25plus.idl which extends the CTDIF.idl. Only two functions have been overloaded in order to meet new demands, both associated with enabling access to two new voltage channels. Most applications will access the IF for acquisition of sensor values. No configuration functions have been implemented.

Remaining Issues
================

  - Seabird does not support the external instrument serial data to be output in real-time.
  - The diagnostic data mentioned in the manual is also not available in real-time output.
  - You cannot disable internal logging of the data. There is a constant



Main Class Modifications and Reference
======================================

### Seabird25p.cc


**General:**

  - We're going to refactor this class as Seabird25p...

### Seabird()

**Description:** Constructor Function

**Notes**:

 - Validate that newlines are still the terminator once plugged in.
 - Otherwise no direct communications to the device or configuration takes place within this function.  

### ~Seabird()

**Description:** Destructor Function

**Notes:**

 - No changes.

### createCTDAttributes()

**Description:** Create server attributes, mostly calibration constants that get populated by the loadCTDConfigFile(char*) function.

**Notes:**

 - Validate all attributes are valid in the 25plus system.

### halt()

**Description:** Sends and 0x1A (SUB/CTRL-Z) command to the device.

**Notes:**

 - This is no longer correct, must send a different break to halt the device.

### initialize()

**Description:** Main device setup function.

**Notes:**

 - Many changes are going to happen here, from how we wake up the device to a
   difference in how the software marches through sequential menus.

### loadCTDConfigFile(char*)
N
**Description:** Loads standard cfg file and parses config information.

**Notes:**

 - Few changes here, please check number of supported voltages in the 25plus system
   see if they match with the 25's number, 6.

### processRecord(unsigned cahr*, int)

**Description:** Reads in a line from the stream and uses calculate function to
get temperature and conductivity values.

**Notes:**

 - Temperature and conductivity are now a 32-bit vs a 28-bit value, also now using the IEEE 754 floating
   point format. The manual describes said format.
 - Also there is a new diagnostic set of fields we can interact with, right now they just output error
   messages and updates to the syslog. May have to turn it down to just the error messages. Working on
   getting a usable current measurement out of Seabird.
 - Added the read in of the integrated pressure sensor.

### readRecord(unsigned char *, int, const char* unsign, int*)

**Description:** Reads in data on socket prior to processRecord().

**Notes:**

 - Just need to check again here what the terminator is for a data record, but its passed in.

### reportCTDAttributes()

**Description:** Simple syslog output for calibration constants.

**Notes:**

 - check all of the constants are correct and sufficient number.

### standby()

**Description:** Assumably gets the unit to standby for commands.

**Notes:**

  - Marked for removal, the 25P has no standby mode.
  
### sw_c3515()

**Description:** Returns a constant used in processRecord()

**Notes:**

 - No changes.

### sw_salrp(double,double,double)

**Description:** Calculates salinity based on cond, temp, and press

**Notes:**

 - No changes.

### sw_salrt(double)

**Description:** Calculates conductivity ratio used in salinity calc

**Notes:**

 - No changes.

### sw_sals(double,double)

**Description:** Calculates salinity based on cond ratio and temp

**Notes:**

 - No changes.

### sw_salt(double,double,double)

**Description:** Wrapper function that calculates salinity based on other functions.

**Notes:**

 - No changes.


ctdDriver.cfg
=============

**Changes:**

  - Must include two more channgels for voltage inputs. Total in 25p system is 8.

CtdIF.idl
=========

**Changes:**

  - perhaps recast as well? 
  - Must include two more channgels for voltage inputs. Total in 25p system is 8.
  - ideally we update the entire CtdIF so that both drivers implement the same methods,
    meaning changes in the original seabird 25 driver. I'll start by overloading the get_CTD_data() function.
  
  


CHANGELOG
=========

|DATE        | FILE                    |                                                            |
|------------|-------------------------|------------------------------------------------------------|
| 2014-09-08 | ALL                     | Refactored "25p" into fnames and aux tasks.                |
|            | `Seabird25p.h`          | Added more voltages.                                       |
|            | `Seabird25pOutput.cc/.h`| Added more voltages.                                       |
|            | `Seabird25pServer.cc/.h`| Added more voltages to `get_CTD_data()` and `voltages()`using overloaded methods. These methods were added to the taskIF idl file as well. Implementation will require modification to original seabird driver.  |
|            | `Seabird25pLog.cc/.h`   | Added more voltages to log items.                          |
|            | `Seabird25p.cc`         | Added more voltages to attributes.  |
|            | `seabird25pTest.cc`     | Added more voltages and modified calls. |
| 2014-09-20 | `Seabird25p.cc/.h`      | Incorporate the entire new real-time data string, but there are some hanging issues.
|            |                         | There is now pressure in the record and we're calculating that, which creates new cal constants needed in the file. |
|            |                         | One issue is that the new conductivity sensor requires a different calculation than in the past. Is it time to adopt new cal constants? How will that impace users of the raw data. (McCann). |
| 2014-10-10 |                         | Final set of changes, verified serial port and tcp operations, binary file content, and tested against actual auxillary sensors.  |
| 2014-10-13 |                         | Modified upgrade notes to summarize state of work prior to pre-deployment final installation and testing. |

