EM datagrams on *.kmall format  Reg. nr. 410224 rev I
Multibeam data logging

Note: This page is meant for developers who shall create their own standalone KMall logger. Logging is usually carried out in SIS 5 or K-Controller.

Introduction

When a multibeam datagram (EMdgmMRZ_def and EMdgmMWC_def) is sent from the multibeam echosounder system, the datagram will be split into several partitions if the multibeam datagram size exceeds the maximum datagram size (MAX_DGM_SIZE, corresponding to maximum size of a UDP package). The multibeam data logger has to process the raw multibeam datagram and combine the partitions into one clean multibeam datagram (EMdgmMRZ_def or EMdgmMWC_def). This process is described below.

Major change from Revision I:
Every partition contains the datafield EMdgmMbody_def. Before Revision I, EMdgmMbody_def was only in the first partition. See the "Before Rev I." column in the table below. This header has to be deleted for all the partitions, except for the first partition.

Partitioning of multibeam datagrams, an example

Below we have an example where a raw EMdgmMRZ_def datagram has been recorded. The size of the raw logged EMdgmMRZ_def datagram is in our example 130 000 bytes. EMdgmHeader_def.numBytesDgm equals the max datagram size (MAX_DGM_SIZE) for all the partitions, except for the last partition. We know how many partitions we shall expect (EMdgmMpartition_def.numOfDgms) and which partition we currently are processing (EMdgmMpartition_def.dgmNum). Since the raw EMdgmMRZ_def size is 130 000 bytes, EMdgmMpartition_def.numOfDgms will be 3 (see the code example further down). The very last partition contains the remainder of the raw EMdgmMRZ_def datagram. EMdgmHeader_def.numBytesDgm of the last partition will be 130 000 - 2 x MAX_DGM_SIZE = 2000 bytes. Again, see the code example. Every partition ends with the size of the partition, named EMdgmMpartitionNumBytes_def in this example. EMdgmMpartitionNumBytes_def and EMdgm_payload_def are dummy datafields and do not exist in the datagram format.

A logged raw EMdgmMRZ_def datagram. The size is 130 000 bytes.

Partition From Rev. I Before Rev. I Description
1 EMdgmHeader_def EMdgmHeader_def Definition of general header. EMdgmHeader_def.numBytesDgm = MAX_DGM_SIZE
EMdgmMpartition_def EMdgmMpartition_def Partition information. EMdgmMpartition_def.numOfDgms = 3, EMdgmMpartition_def.dgmNum = 1
EMdgmMbody_def EMdgmMbody_def Start of body of all M datagrams
EMdgm_payload_def EMdgm_payload_def Common dummy struct for multibeam payload. See definition in table below.
EMdgmMpartitionNumBytes_def EMdgmMpartitionNumBytes_def Equal to EMdgmHeader_def.numBytesDgm
2 EMdgmHeader_def EMdgmHeader_def Definition of general header. EMdgmHeader_def.numBytesDgm = MAX_DGM_SIZE
EMdgmMpartition_def EMdgmMpartition_def Partition information. EMdgmMpartition_def.numOfDgms = 3, EMdgmMpartition_def.dgmNum = 2
EMdgmMbody_def Start of body of all M datagrams
EMdgm_payload_def EMdgm_payload_def Common dummy struct for multibeam payload. See definition in table below.
EMdgmMpartitionNumBytes_def EMdgmMpartitionNumBytes_def Equal to EMdgmHeader_def.numBytesDgm
3 EMdgmHeader_def EMdgmHeader_def Definition of general header. EMdgmHeader_def.numBytesDgm = 2000. (130 000 - 2 x MAX_DGM_SIZE )
EMdgmMpartition_def EMdgmMpartition_def Partition information. EMdgmMpartition_def.numOfDgms = 3, EMdgmMpartition_def.dgmNum = 3
EMdgmMbody_def Start of body of all M datagrams.
EMdgm_payload_def EMdgm_payload_def Common dummy struct for multibeam payload. See definition in table below.
EMdgmMpartitionNumBytes_def EMdgmMpartitionNumBytes_def Dummy datafield, equal to EMdgmHeader_def.numBytesDgm, 4 bytes.

Definition of the dummy datafields used in the table above. These do not exist in the EMdgmFormat.h header.

Name Data struct
EMdgm_payload_def EMdgmMRZ_pingInfo_def
EMdgmMRZ_txSectorInfo_def
EMdgmMRZ_rxInfo_def
EMdgmMRZ_extraDetClassInfo_def
EMdgmMRZ_sounding_def
EMdgmMRZ_txSectorInfo_def
EMdgmMpartitionNumBytes_def uint32_t

Reassemble and combine multibeam datagrams, example continued

You may notice there is redundant information in the raw EMdgmMRZ_def datagram shown in the table in the previous section. In the final EMdgmMRZ_def, we do not care about partitions. The next task will be to reassemble the raw datagram and create a complete EMdgmMRZ_def datagram according to the datagram specification. We only want EMdgmHeader_def, EMdgmMpartition_def and EMdgmMbody_def once in our datagram. In the example above, the three data fields are represented three times, thus we have to remove two of the groups.

When we have reassembled the raw EMdgmMRZ_def datagram to a complete EMdgmMRZ_def datagram, we remove the redundant fields. See the table below for the final complete EMdgmMRZ_def datagram.

Reassembled EMdgmMRZ_def Description
EMdgmHeader_def Definition of general header. See code example below for computation of EMdgmHeader_def.numBytesDgm.
EMdgmMpartition_def Partition information. Always EMdgmMpartition_def.numOfDgms = 1, EMdgmMpartition_def.dgmNum = 1 in the final EMdgmMRZ_def.
EMdgmMbody_def Start of body of all M datagrams
EMdgm_payload_def Dummy struct for payload. See table above.
EMdgmMpartitionNumBytes_def Equal to EMdgmHeader_def.numBytesDgm. Dummy data field.

Since the redundant data fields have been removed, EMdgmHeader_def.numBytesDgm needs be recomputed. See the code example below.

Example of how to compute the final EMdgmHeader_def.numBytesDgm based on the example.

typedef uint32_t EMdgmMpartitionNumBytes_def;
unsigned int numBytesLoggedMrz = 130000;
unsigned int numPartitions = ceil((double) numBytesLoggedMrz / MAX_DGM_SIZE); // 3 partitions
unsigned int numBytesLastPartition = numBytesLoggedMrz % MAX_DGM_SIZE; // 2000 bytes
unsigned int numRedundantBytes = (numPartitions - 1) * // 80 bytes
( sizeof(EMdgmHeader_def)
+ sizeof(EMdgmMbody_def)
+ sizeof(EMdgmMpartitionNumBytes_def));
EMdgmMRZ_def mrzDgm;
mrzDgm.header.numBytesDgm = numBytesLoggedMrz - numRedundantBytes; // 129 920 bytes

An example of how to combine the logged multibeam datagram #MRZ in C++ can be found here. Note that this example will only work with localhost. Use replay of *.kmall file in SIS 5 for input to the logger.

EMdgmHeader_def::numBytesDgm
uint32_t numBytesDgm
Definition: EMdgmFormat.h:117
EMdgmMRZ_def
#MRZ - Multibeam Raw Range and Depth datagram. The datagram also contains seabed image data.
Definition: EMdgmFormat.h:1096
EMdgmHeader_def
Definition of general datagram header.
Definition: EMdgmFormat.h:111
EMdgmMbody_def
Multibeam (M) datagrams - body part. Start of body of all M datagrams.
Definition: EMdgmFormat.h:719
EMdgmMpartition_def
Multibeam (M) datagrams - data partition information. General for all M datagrams.
Definition: EMdgmFormat.h:674
MAX_DGM_SIZE
#define MAX_DGM_SIZE
Definition: EMdgmFormat.h:48