M300 Data Format

The basic structure in the M300 data is composed of two sections. The first part of the M300 data is called the Directory area. It contains information about the data recorded. The second part of the M300 data is called the Data area. It contains the actual data values. Any number of these structures (M300 Data Buffers) can be linked together to compose an entire data file.

The directory area is composed of one or more directory structures. Each directory structure represents a data type. The number of directory entries can change and therefore so can the size of the directory area.

The data area size is not static. The data area size changes depending on the number of different data types that compose it, the number of data samples and the number of bytes per sample.

M300 Directory Structure

The M300 directory entry is composed of several elements that identify the data. The directory is 16 bytes (16 * 8 bits) long. Each directory contains a Tag Number, Data Offset, Number of Bytes, Number of Samples, Bytes per Sample, Data Type, Parameter One, Parameter Two, Parameter Three and Interface Address.

In C the data structure for a data directory entry is as follows.

struct datadir{

unsigned int tagNumber;
unsigned int dataOffset;
unsigned int numberBytes;
unsigned int samples;
unsigned int bytesPerSample;
unsigned char type;
unsigned char parameter1;
unsigned char parameter2;
unsigned char parameter3;
unsigned int address;

} typedef DataDir;

NOTE: 'unsigned int' is a sixteen bit unsigned number and 'unsigned char' is an eight bit unsigned number.

Reserved Tag Numbers

Description
Tag Number
Time
0
Next
999
Reserved
65000-65529
FileName
65530
FileData
65531
Command
65533
Error
65534
Last
65535

The following is a description of all the fields in the directory entry.

Tag Number

Each directory entry and its associated data is given a unique tag number. This tag number is specified by the user and may be a value in the range of 0 to 65535 (0, 999, 65534 and 65535 are reserved by the system and must not be used as general purpose tag numbers). The tag number must be used when searching for a particular data item. Other data fields may be used to double check directory and data integrity.

Data Offset

The data offset field is used to get a pointer to the data. This value specifies the number of bytes from the beginning of the buffer where the data is located. To get a pointer to a particular data item, first find its directory entry and then add the corresponding offset to the beginning of the buffer. The data offset of the next directory points to the first directory of the next data buffer.

Number of Bytes

The number of bytes field contains the actual number of data bytes acquired. This field will be zero if there is no data. The number of bytes will always be less than or equal to the number of samples times the bytes per sample.

Number of Samples

The samples field specifies the number of desired samples. The actual number of samples may be less than this field. To get the actual number of samples, divide the total number of bytes by the bytes per sample.

Bytes per Sample

The bytes per sample field is indicative of the data size. This field is used to jump from one data sample to the next. By adding to the data pointer the number of bytes per sample, one can obtain a pointer to the next sample of the same data type. The number of samples should be checked before incrementing the data pointer in order to avoid getting a pointer to the wrong type of data or just the wrong data.

Data Type

The data type can be used to identify the data and double check it against the known type for the tag number. Different data types have different data formats and therefore it is important to check the data type as well as the number of bytes before using the data. This is particularly important when checking data integrity.

Parameter One, Two and Three

Any data types may use these parameters to store encoded information regarding the data at any particular moment in time. When called for these fields must be checked to get a complete set of information regarding the data. Different data types make different uses of these parameters.

Advantages of the Data Directories

The data directory structure is a fundamental part of the M300 Data Acquisition System. The data directory entries control the acquisition process and document how the data was acquired. By reviewing the information in these directories when processing the acquired data, important facts are available.

Data Acquisition Self Documentation

Data Processing, During and Post Acquisition

Just in case of Power/Data Loss

The original reason for developing the data directory structure was the desire and necessity of facilitating generalized access to the recorded data. In the past data acquisition systems generally used a fixed data format where each recorded value had a fixed place in the buffer. One problem, that frequently occurred, was that someone would change a parameter or add additional information to the buffer. This meant that project data was recorded in more than one format. The problem this causes with post processing software is obvious.