Buffered operation
This application note describes the operation of the data buffers as implemented in the MLM-1000 in systems with version 1.3 firmware
This application note assumes reader familiarity with the MLM -1000 Mooring Line Modem system.
Overview
The MLM-1000 offers the user a range of features and capabilities related to the buffering and transmission of data. These choices provide the flexibility to optimize performance over a range of system applications.
It is important to note that the data that the MLM-1000 transmits between nodes (i.e. between an HEM and SSM) is assembled into packets. These packets contain the data that has been transmitted by the serially attached data source (e.g. host computer or oceanographic instrument) as well as an embedded protocol that implements transmission error detection and correction mechanisms.
A high-level description of the transmission of data from data source “A” (e.g. a computer) to data receptor “B” is as follows (assuming a transparent channel has been established):
“A” transmits its information via a serial data connection to the MLM node (HEM or SSM).
The MLM node stockpiles the incoming serial data stream in a buffer until a packet transmission trigger criteria has been met.
At this stage, the transmitting MLM node assembles data payload into the packet structure and transmits it over the mooring line channel
o Concurrently, the transmitting MLM may (in some application configurations) continue to receive incoming serial data
- Once the packet is transmitted over the mooring line channel, the transmitting node may optionally request a handshaking sequence with the receiving node in order to confirm successful transmission.
o If the handshaking sequence fails, the system may optionally be configured to retransmit the packet. This provides an efficient overall error detection and system data recovery mechanism.
- Once a packet is successfully received at the data receptor node via the mooring line channel, that node will transmit the data on its associated serial port.
The user may configure:
the baud rate of the serial connection to the HEM
the baud rate of the serial connection to the SSM
any combination (enabled or disabled) of three possible packet transmission trigger criteria. These are:
o Trigger a packet transmission after a special “trigger” character is detected in the data. e.g. a <LF>. There is a further option to transmit the trigger character as part of the data payload, or not.
o Trigger a packet transmission after a timeout of the incoming serial data; e.g. if this timeout is set for 1 second and a stream of characters is received over the serial line, the packet transmission will be triggered if no characters are received over the serial line for 1 second.
o Trigger a packet transmission when a threshold number of bytes (to a maximum of 512) is received serially into the transmit buffer of the node .
- whether or not the transmitting modem will request the receiving modem to confirm successful packet transmission over the mooring line.
o a further option allows the user to configure the number of retry attempts in the event of unsuccessful transmission
- whether or not an ACK or NAK is transmitted by an HEM or SSM back to the source of the serial data upon successful transmission of a packet over the mooring line link
Data buffering in the transmitting node
When an instrument or computer is sending data to an HEM or SSM node for transmission over the mooring line channel, the node receives the data via its serial data interface and then buffers the information until the packet payload is transmitted over the channel.
There are two distinct buffers in the transmitting node. The first is the transmit buffer. The maximum size of this buffer is 512 bytes and is configured by the parameter TPMXC. When data is received on the serial port of the node, it is routed to the transmit buffer. When the amount of data reaches the configured buffer size, the modem node will begin transmission of the data that is in the transmit buffer over the mooring line channel.
If data continues to be sent to the node over the serial data link at this time, this data will begin to fill up the queuing buffer. The maximum number of bytes the queuing buffer can store is 1280. Once that number is exceeded, data will no longer be buffered and will be lost.
Once the contents of the transmit buffer (e.g. 512 bytes) have been successfully transmitted over the mooring line channel, the next block of data (equal to the configured size of the transmit buffer) will be automatically transferred from the queuing buffer to the transmit buffer (Thus freeing up that much space in the queuing buffer).
The maximum amount of transmit data that can be buffered without data loss is 512 (maximum size of transmit buffer) bytes plus 1280 bytes (size of queuing buffer), totaling 1792 bytes. However, if the transmit buffer is not set to its maximum size, the total available buffer size decreases commensurately. (e.g. if the transmit buffer size is set to 256 bytes, then the total amount of transmit data that can be buffered will be 1536 bytes).
Application examples
Example 1 – Fetching a sample from an RBR instrument
Objective: On demand, obtain a reading from an RBRconcerto logger that is connected to an SSM.
Relevant Modem Parameter Configuration:TPMXC=512
this sets transmit buffer size to 512 bytesTPCTOEN=0
this disables the transmit trigger condition on timeout of incoming serial data
TPSNDC=x0D
Set the transmission trigger character to hex 0D (carriage return) for the HEM
TPSNDC=x0A
Set the transmission trigger character to hex 0A (line feed) for the SSM
TPSNDEN=1
this enables the trigger mechanism that uses a specific character to trigger a transmission
TPSNDC2=1
this enables the feature that transmits the trigger character along with the data payload
TPACK=1
this enables the intermodem handshaking to confirm that a packet was successfully transmitted.
MDRTRY=3
this enables and sets to 3 the number of times a packet will be retransmitted in the event that a data transmission error was detected. Requires TPACK=1
MDOCDUR=700
this would set the modem open channel timeout to 7 seconds. That is, the HEM would close down the channel if no data traffic was transmitted over the mooring line channel for a period of 7 seconds. For the purpose of this example, the value of open channel timeout must be greater than the time it take the RBR logger and associated sensor to produce a sample.
The baud rate of the HEM is 115200 and the SSM is 19200.
An aspect of this example that is worth noting is why the HEM and SSM have different transmission trigger characters.
The trigger character for the HEM is a “carriage return” because the Concerto logger expects to see command strings terminated by a “carriage return”. Furthermore, enabling the feature to pass the trigger character through to the channel ensures that the Concerto sees the “carriage return”.
The trigger character for the SSM is a line feed because the data output string from the Concerto is terminated by a <CR><LF>. Therefore, triggering the transmission on the “line feed” ensures that the whole data output string and the <CR><LF> is transmitted through to the computer connected to the HEM.
In this example a computer that is connected to the HEM would initiate a channel seizure and establish a transparent link with the RBR logger that is attached to the SSM.
Once a transparent channel has been established, data transmission would function as follows:
The computer connected to the HEM would transmit an “A” <CR>.
The <CR> would trigger a transmission of the “A<CR>” through to the RBR logger. This would cause the logger to wake up.
Subsequently, the computer connected to the HEM would transmit “FETCH<CR>”
The logger would receive this command and subsequently enable all sensors and take a measurement reading on all channels.
Once ready, the logger would transmit the sample information on its serial port to the SSM. The sample information data stream is terminated by a <LF> as described above and thus will trigger a transmission to the HEM
The HEM will transmit the data to the computer connected to it.
Once the transaction is completed, the computer can send the commands necessary to close the channel.
Example 2 – Transferring large files utilizing buffer management
Objective: For a computer or otherwise “smart” node to (e.g. instrument implementing the functionality described below) transfer a file of 6250 bytes over either type of node (HEM or SSM).
Relevant Modem Parameter Configuration:TPMXC=512
this sets transmit buffer size to 512 bytes.TPCTOEN=1
this enables the transmit trigger condition on timeout of incoming serial data
TPCTO=150
this sets the transmit trigger timeout to 1.5 seconds; i.e. if no data is received on the serial data line for a period of 1.5 seconds, the modem will transmit the contents of the transmit buffer over the mooring line channel
TPSNDEN=0
this disables the trigger mechanism that uses a specific character to trigger a transmission
TPACK=1
this enables the intermodem handshaking to confirm that a packet was successfully transmitted.
MDRTRY=3
this enables and sets to 3 the number of times a packet will be retransmitted in the event that a data transmission error was detected. Requires TPACK=1
TPACKDSP=1
This enables the transmission of an ACK by the node back to the data source after each successful packet transmission.
The baud rate of the HEM is 115200 and the SSM is 19200.
In this example the computer that is the source of data is connected to the HEM and one could imagine another computer connected to the SSM.
Once a transparent channel has been established, data transmission would function as follows:
- The computer connected to the HEM would transmit 1536 bytes to the HEMo The computer now “expects” this to generate 3 ACKs back from the HEM.
The computer now waits or performs other tasks
As the transmit buffer is full (has reached the trigger level), the HEM transmits 512 bytes and confirms the successful transmission via the handshaking protocol with the SSM.
Once the confirmation of a successful transmission over the mooring channel has been received, the HEM transmits and ACK over the serial link back to the computer.
Once the confirmation process is complete at the SSM, it will begin to transmit the data it received out it’s serial port.
Once the confirmation is received by the HEM, the transmit buffer is flushed and the next 512 bytes are transferred from the queuing buffer to the transmit buffer and the next transmission of a packet over the mooring line is initiated.
The ACK not only signifies that successful transmission of a packet took place, but also that there is now 512 bytes of space available in the queuing buffer. Therefore, the computer will now transmit another 512 bytes into the queuing buffer.
As each block of 512 bytes is transmitted over the mooring line channel, the computer receives an ACK and then transmits another 512 bytes. This ensures that the queuing buffer is full and the modem will be transferring 512 byte blocks as rapidly as it can.
In this example, the size of the payload is 6250 bytes. This means that there will be 12 full blocks of 512 bytes transmitted. Once the 12th block has been transmitted, there will be 106 bytes remaining in the queuing buffer.
The transmit trigger for these last 106 bytes is the transmit timeout. Once the serial line has been inactive for 1.5 seconds (TPCTO), whatever is in the queuing buffer will be transmitted, thus completing the transmission of the 6250 byte payload.
The HEM may now clear down the link.
This arrangement of keeping the queuing buffer full ensures that data is transferred across the mooring line channel at the fastest possible speed.
Example 3 – Connecting to an ADCP with a data payload ofless than 1792 bytes
Objective: Provide connectivity to an ADCP that is configured to transmit an output data ensemble of 1500 bytes, once every 10 minutes.
Relevant Modem Parameter Configuration:TPMXC=512
this sets transmit buffer size to 512 bytesTPCTOEN=1
this enables the transmit trigger condition on timeout of incoming serial data
TPCTO=150
this sets the transmit trigger timeout to 1.5 seconds; i.e. if no data is received on the serial data line for a period of 1.5 seconds, the modem will transmit the contents of the transmit buffer over the mooring line channel
TPSNDEN=0
This disables the trigger mechanism that uses a specific character to trigger a transmission
TPACK=1
This enables the intermodem handshaking to confirm that a packet was successfully transmitted.
MDRTRY=5
This enables and sets to 5 the number of times a packet will be retransmitted in the event that a data transmission error was detected. Requires TPACK=1
MDOCDUR=65534
This set the open channel timeout of the link to be approximately 10.9 minutes.
The baud rate of the HEM is 115200 and the SSM is 19200.
In this example the ADCP is the source of data is connected to the SSM. The SSM is an OEM SSM and is either powered from the ADCP or from its own internal battery pack. Note that in this example, the data ensemble from the ADCP is lessthan the maximum buffer size in the modem. Therefore the ADCP can fully load up the buffer at any available baud rate and the modem system will regulate the transmission of the data.
Of particular note in this example is the mode of channel operation in the system. The HEM establishes the channel and the channel is configured with a very long open channel timeout. For all intents and purposes, the link is permanently established. The transmission of data every 10 minutes (ie at an interval less than the open channel timeout) will reset the open channel timeout counter. Therefore, the timeout will not be exceeded and the the system will not autonomously close the channel due to the timeout being exceeded.
If the interval of data ensemble transmissions from the ADCP is longer than the maximum value of MDOCDUR (10.9 minutes), then the parameter MDOCPERM must be set to 1. This enables an infinite open channel timeout.
Once a transparent channel has been established, data transmission would function as follows:
The channel is now essentially permanently open.
Whenever the ADCP spits out a data ensemble, it will be transmitted through to the HEM and out the serial port, in 512 byte chunks.
The modem system will transparently handle all the intermodem ACKs and retries (if necessary).
- A 1500 byte data ensemble would mean that 2 full 512 byte blocks would be transmitted. The remaining bytes would be transmitted after the transmission timeout trigger criteria has been met.
- Under normal operating conditions, the channel would stay open until the HEM would be used to close the channel.
Example 4 – Connecting to an ADCP with a data payload of more Than 1792 bytes
Objective: Provide connectivity to an ADCP that is configured to transmit an output data ensemble of 2028 bytes, once every 10 minutes.
Relevant Modem Parameter Configuration:TPMXC=512
this sets transmit buffer size to 512 bytesTPCTOEN=1
this enables the transmit trigger condition on timeout of incoming serial data
TPCTO=150
this sets the transmit trigger timeout to 1.5 seconds; i.e. if no data is received on the serial data line for a period of 1.5 seconds, the modem will transmit the contents of the transmit buffer over the mooring line channel
TPSNDEN=0
This disables the trigger mechanism that uses a specific character to trigger a transmission
TPACK=1
This enables the intermodem handshaking to confirm that a packet was successfully transmitted.
MDRTRY=2
This enables and sets to 2 the number of times a packet will be retransmitted in the event that a data transmission error was detected. Requires TPACK=1
MDOCDUR=65534
This set the open channel timeout of the link to be approximately 10.9 minutes.
The baud rate of the HEM is 115200 and the SSM is 2400.
In this example the ADCP is the source of data is connected to the SSM. The SSM is an OEM SSM and is either powered from the ADCP or from it’s own internal battery pack. Note that in this example, the data ensemble from the ADCP is greaterthan the maximum buffer size in the modem. Therefore, the system must be configured so that the queuing buffer does not overflow with associated loss of data. Therefore, the baud rate of the serial link between the ADCP and the SSM is 2400. At this baud rate and given the size of the transmit and queuing buffers as well as the baud rate over the mooring line channel, no data will be lost.
Of particular note in this example is the mode of channel operation in the system. The HEM establishes the channel and the channel is configured with a very long open channel timeout. For all intents and purposes, the link is permanently established. The transmission of data every 10 minutes (ie at an interval less than the open channel timeout) will reset the open channel timeout counter. Therefore, the timeout will not be exceeded and the the system will not autonomously close the channel due to the timeout being exceeded.
If the interval of data ensemble transmissions from the ADCP is longer than the maximum value of MDOCDUR (10.9 minutes), then the parameter MDOCPERM must be set to 1. This enables an infinite open channel timeout.
Once a transparent channel has been established, data transmission would function as follows:
The channel is now essentially permanently open.
Whenever the ADCP spits out a data ensemble to the SSM at 2400 baud, it will fill the transmit buffer. Once the transmit buffer is filled, the SSM will transmit the contents to the HEM
As this transmission is taking place, more data bytes are filling the queuing buffer at 2400 baud.
o Since the transmission over the mooring channel is at 4800 baud, the queuing buffer only takes in approximately half as many bytes as are transmitted over the mooring line
o As long as the serial data stream from the ADCP to the SSM is at a lower baud rate than the mooring channel, the queuing buffer will not overflow.
o The size of the queuing buffer and the serial baud rate determines how many retries can be supported. This is because incoming ADCP data is accumulating in the queuing buffer as retries would be taking place
- The complete payload of 2028 bytes is 3 whole 512 byte blocks. The transmission of the remaining bytes is triggered via the transmit timeout.
Related documents
Mooring Line Modem System OEM Command Reference V2
MLM-1000 Development System Reference Manual V1