Using BBConv

BBConv is a BroadBand raw data to ASCII conversion program.  It uses a decoder file (.DEC) to determine how to convert the data.  A decoder file contains interpreted instructions for converting to ASCII.

To convert a file, do the following.

1.	Enter the name and path of the BroadBand ADCP raw data in the BB Input File Name box or use the browse button to locate the file.  BBConv "remembers" the input and output directory if the Browse button "..." is selected.

2.	Enter the name and path of the decoder file in the Decoder File Name box or use the browse button to locate the file.

3.	Enter the name and path of the ASCII file in the ASCII Output File Name box or use the browse button to locate the file.

4.	Enter the Start Ensemble Number.

5.	Enter the End Ensemble Number.

6.	Press the Convert button to begin.

7.	Press the Exit button to exit BBConv.

You can run BBConv in the batch mode by writing a simple DOS batch file (*.bat) that contains command lines with the files that you want to process.  For each file to be processed, add a line to the batch file specifying the name of the raw data file to be converted, the name of the decoder file, the name of the output file, and the starting and ending ensemble numbers.

	NOTE.  For unattended operation, make sure that output file does not exist; otherwise the batch file will pause to confirm overwriting the file.
Sample Batch file

start /w "C:\Program Files\RD Instruments\Utilities\BBConv.exe" -in:InputFile -dec:DecoderFile -out:OutputFile

A typical decoder file may contain the following:

; Temperature Data Decoder File

0080,3,2

0080,27,-2,0.01,2 ; Temperature (ET) in degrees

$L

•	Lines beginning with a semicolon (;) are ignored and are for user comments.

•	In addition, decoder lines may be followed by semi-colons for comments.

•	Blank lines are ignored.

•	"$L" signifies a CR/LF should be output before outputting more data

Lines containing decoding instructions are broken down as follows:

id,offset,size,multiplier,format

where:

id	Data Structure identifier in hex (e.g. 0080).  This information is presented MSB-LSB.  Be careful, since the data stream outputs LSB followed by MSB.
offset	The byte # from the first byte of the data structure (e.g. The first data byte in the structure following; the id is byte #3 . Byte #1 is the LSB of the ID Byte #2 is the MSB of the ID Byte #3 is the first data byte of the structure.
size	The number of bytes contiguous bytes contained in the data (LSB to MSB).  A negative number indicates signed data; a positive number indicates unsigned data.
multiplier	The conversion factor (optional)
format	The format specifies the number of decimal places to output (optional).
Additionally, if the line has a plus sign (+) at the end of the line, the addition is performed on the data in the line and the line following.

For example, to decode the range of beam 1 through 4 in the bottom track data the following lines should be included.

0600,17,2,0.01,0,+         ; Beam #1 Range (cm)

0600,78,1,655.36,2       ; Beam #1 Range MSB

0600,19,2,0.01,0,+         ; Beam #2 Range (cm)

0600,79,1,655.36,2       ; Beam #2 Range MSB

0600,21,2,0.01,0,+         ; Beam #3 Range (cm)

0600,80,1,655.36,2       ; Beam #3 Range MSB

0600,23,2,0.01,0,+         ; Beam #4 Range (cm)

0600,81,1,655.36,2       ; Beam #4 Range MSB

$L

In order to simply output of the profile data you can use a combination of two lines.  For example, to decode the velocity the following lines should be included.

$P idB, offsetB, typeB, offset, bins

idP, offsetP, typeP, multiplier, formatP

Where

idB, offsetB, typeB	points to the number that describes the number of bins (normally 000,10,1)
offset	is the number of bytes to advance to the next bins (velocity is 8 bytes, intensity is 4 bytes)
Bins	are the string that describes what bins to output.  For example, "1-10" would output bins one through 10, "1,5,7" would output bins one, five and seven, or "1-5,10-20" would output bins one through five and ten through twenty.
idP, offsetP, typeP	points to the data in the first bin for the profile (0100,3,-2 in the example shown below)

0080,3,2                        ; Ensemble Number

$P0000,10,1,8,"1-255"           ; Starting Profile

0100,3,-2                       ; Beam 1 Data

$L

$L

	NOTE.  See the included decoder files (.DEC) for examples.  To create your own decoder file, simply cut and paste the appropriate offset information into your own ASCII decoder file.  The figures in the Command and Output Data Format guide should aid in creating decoding files.