MOPS HDB File Format

MOPS *.hdb file is used by WinMOPS framework to store the timeseries historical data that is typically used in industrial automation.

Unlike traditional SQL data structures, It has the capabilities of storing and retrieving very big data reaching sizes of GBs or TBs.

This article will provide some preliminary information about high level view of this file type. It is hoped that it will be helpful in troubleshooting corrupted *.hdb data in terms of isolating the problem scope. It doesn’t mean to provide comprehensive one, but just some essential data items that can be used to perform high level navigation inside the structure.

The typical file name of *.hdb as follows:

MC1_000337_20121201T150000_20121215T150000.hdb

MC1 denotes the group name, 337 denotes FSN or file sequence number, 20121201T150000 and 20121215T150000 respectively denotes the date time range for the data inside this file.

Inside this file contains the header of 0x800 (2048) bytes. It just contains some information in plain text describing the categorization of data inside the file, such as file sequence number, interval etc.

The header is followed by the tag information in compressed format arranged in blocks of 0x200 (512) bytes. Starts of data blocks usually located at offset 0x800 but sometimes at 0xA00, for reasons still unknown 🙂

Below is the typical data block inside the file:

mops01

Two pieces of important information regarding this data block is denoted by word data at offset 0x1A (blue box) and at offset 0x38 (red box).

Word at offset 0x1A is the total number of blocks (e.g. 2 * 512 = 1024 bytes) for the tag information data for certain zero based interval index at offset 0x38.

In the above example, the interval is 0x15 (21). This interval is used to determine the date-time range for certain tag data. Implied date-time range for certain interval index can be calculated using INTERVAL command at the MOPS’ MHC console:

mops02

From the above example, interval 0x15 (21) contains data for the date-time range of:

mops03

Each data block for each date-time range (interval) is arranged contiguously depending on the number of blocks denoted by blue box above.

So, to locate the next interval block, just add the number of blocks times 512 bytes for it. For example, when the starting block is at 0x800, then the next block for next interval will be 0x800 + (0x2 * 0x200) = offset 0xC00.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: