MF4 (MDF4) Explained: A Simple Guide to the ASAM File Format

Updated at 26 May, 2020

— Uncover the essentials of MF4 (MDF4) in our concise guide. Learn how this ASAM file format enhances automotive data management, aligning with ASAP2 standards.

MF4 (MDF4) Explained: A Simple Guide to the ASAM File Format
Welcome to our simplified MF4 guide. You're about to dive into the fascinating world of MF4, a standard that's making big waves in automotive data management.

Emerging from the foundations of the ASAM MCD-2 MC (ASAP2) standards, MF4 stands as an advanced iteration of the well-regarded MDF 3.x format. Designed to meet the dynamic demands of today's automotive industry, MF4 not only addresses current needs but also anticipates future challenges.

Let's embark on this journey together to demystify MF4 in an easy and engaging way!


What is a MF4 (MDF4) file?

In the world of automotive technology, the Measurement Data Format version 4, or short for MDF4, plays a crucial role. This Association for Standardization of Automation (ASAM) standard file format is specifically designed for the automobile industry to handle diverse range of data efficiency.

MDF4 is a binary file format, making it ideal for storing complex measurement data. It primarily captures information from vehicle communication systems like CAN, CAN FD, LIN bus, as well as sensor data from Engine Control Units (ECUs). These ECUs are vital in modern vehicles, overseeing various engine functions.

What sets MDF4 apart is its ability to store not just raw data but also the essential meta-data. This includes information necessary for interpreting the raw data, such as converting it into physical values and providing context with ASAM-compliant signal names.

Additionally, MDF4 allows for the inclusion of custom comments and extra binary data, enhancing its adaptability for various automotive applications. Essentially, MDF4 files serve as comprehensive repositories of vehicle data, crucial for analysis and system monitoring in the automotive field.

Benefits of Implementing MDF in Data Management

The Measurement Data Format, particularly its fourth iteration (MDF 4.x), brings a suite of advantages to data management in the automotive industry. Here are some of the key benefits:

  1. Speed and Efficiency in Data Handling

    • MDF is engineered for high performance in both writing and reading measurement data. Thanks to its index-based structure, operations on MDF files are exceptionally fast. This efficiency is crucial when dealing with the vast amounts of data generated in automotive systems.

  2. Accessibility of Tools and Libraries

    • There's a wealth of resources available for MDF, including many robust and free applications and APIs. A notable example is the MDF4-Lib, a free C++ library designed specifically for reading and writing ASAM-MDF4 files. This accessibility facilitates easier integration and manipulation of data.

  3. Interoperability Across Various Tools

    • MDF's widespread adoption means that a multitude of tools on the market utilize this format. This ubiquity allows for seamless data communication and exchange between different systems and tools within the automotive industry.

  4. Flexibility in File Size

    • MDF 4.x is capable of supporting the creation of files of virtually any size (up to 2^64 bytes). This flexibility ensures that data storage can scale with the needs of the project, without worrying about hitting size limits.

  5. Data Compression Capabilities

    • One of the more recent enhancements in MDF 4.1 is the option for payload data compression. This feature significantly reduces file sizes, leading to savings in storage space, server costs, and even expenses related to data transmission over networks like 3G or 4G.

  6. Compatibility with Previous Versions

    • MDF 4.x maintains compatibility with earlier versions, supporting the writing of pre-sorted measurement files. This backward compatibility saves time by eliminating the need for sorting large files at the end of a measurement or upon initial viewing.

  7. Enhanced CAN Bus Recording Functionality

    • MDF 4.1 has expanded its capabilities to store raw messages and classification results for established bus systems like CAN, LIN, Flexray, and Automotive Ethernet in a standardized manner. This functionality allows for both signal-based and message-oriented analysis from a single file, enhancing the depth and breadth of data analysis possible.

In summary, the implementation of MDF in data management within the automotive industry offers a combination of speed, flexibility, and compatibility. These features, coupled with robust compression and enhanced recording functionalities, make MDF a versatile and powerful tool for handling complex automotive data.

The AutoPi System
Take Control of Your Vehicle Data with AutoPi

Connect to the AutoPi Cloud and transform your vehicle data into actionable insights. Ready to elevate your telematics experience?

The File Structure of MDF4 Files: The Block Hierarchy

Understanding the structure of MDF4 files is crucial for anyone working with this data format.

The MDF4 file, with its *.mf4 extension, is meticulously organized into a hierarchy of binary blocks. Each block serves a unique function and contains a specific type of data or metadata.


Here's a breakdown of the key blocks in the MDF4 file format:

  1. (ID): The ID block is the file's identifier, confirming that it's an MDF file and specifying its version. In MDF4, this block is 64 bytes long, has a fixed location, and appears only once, setting the standard for the file.

  2. Header Block (HD): Serving as the root of the file, the header block provides a general overview of the MDF file. It links to all other data and is crucial as it appears once and occupies a fixed position within the file's structure.

  3. Channel Group Block (CG): This block specifies the record arrangement, which includes details about channels that are typically measured together. The Channel Group Block is essential for understanding the organization and grouping of data within the file.

  4. Data Group Block (DG): The DG block contains a description of the data block, which may be linked to one or more channel groups. It includes both the Data Blocks and Channel Groups, providing a comprehensive view of the measurement data.

  5. Data Block (DT): A DT block is a collection of data records that contain signal values, such as CAN frames. This block is essential for storing the actual measured values and is a key component in the data collection process.

Schematic of MDF file showing header, channel groups, and data blocks.

Diagram of MDF4 structure with CAN Data Frame and channel details.

MDF4 CAN Data Frame: MDF4 also has a specific structure for CAN Data Frames, which is divided into seven sections or subchannels. This structure is tailored to efficiently handle the complexities of CAN data within the automotive context.


Name
Description
BusChannel Data buses are the conduits through which outputs are sent or inputs are received by a digital system or subsystem in order to perform its functions.
A message or Frame consists primarily of the ID (Identifier), which represents the priority of the message, and up to eight data bytes...
E type (regular, extended).
DLC CAN frame Data Length code.
DataLength Actual data length (may differ from the DLC for CAN FD).
DataBytes Data bytes of the CAN frame.
DIR Direction (received, transmitted).

The meticulous organization of these blocks in MDF4 files makes the format highly suitable for cloud analytics and telematics applications. It's designed to work seamlessly with various protocols such as CAN, CAN FD, LIN, J1939, OBD2, CANopen, and others, making it a versatile and indispensable tool in automotive data management.

In-Depth Look at the Technical Composition of MDF Blocks

Delve into the technical intricacies of MDF blocks, each a critical piece in the puzzle of automotive data analysis and management.


Abbreviation
Name
Description
ID Identification block Identification of the file as mdf file
HD Header block General description of the measurement file
MD Metadata block Container for an XML string of variable length
TX Text block Container for a plain string of variable length
FH File history block Change history of the MDF file
CH Channel hierarchy block Definition of a logical structure/hierarchy for channels
AT Attachment block Container for binary data or a reference to an external file
EV Event block Description of an event (trigger, maker, ...)
DG Data group block Description of data block that may refer to one or more channels groups
CG Channel group block Description of a channel group, i.e. channels which are always measure jointly
SI Source information block Specifies source information for a channel or for the acquisition of a channel group
CN Channel block Description of a channel, i.e. information about the measured signal and how the signal values are stored
CC Channel conversion block Description of a conversion formula for a channel
CA Channel array block Description of an array dependency
DT Data block Container for data records with signal values
SR Sample reduction block Description of reduced/condensed signal values which can be used for preview
RD Reduction data block Container for data record triples with result of a sample reduction
SD Signal data block Container for signal values of variable length
DL Data list block Ordered list of links to data blocks if the data is spread over multiple blocks
DZ Data zipped block Container for zipped data section of a DT/SD/RD block as replacement of such a block
HL Header of list block Header information for linked list of data blocks

Data Block Architecture: How Record Channels Shape Structure

In MDF files, the configuration of a data block is fundamentally influenced by the channels within its associated channel group. Essentially, each record within the block is composed of signal values that are synchronously captured or "sampled."

This simultaneous sampling ensures that the data is cohesive and chronologically aligned. Notably, a Data Block is designed without a link section, a structural choice that mandates the storage of records in a continuous, gap-free sequence. This approach ensures data integrity and simplifies the process of data analysis.

Diagram showing a CAN data record structure with identification numbers, timestamps, and multiple value fields.

Sorted vs. Unsorted MDF Files

The structure of data blocks within an MDF file can vary significantly before and after the sorting process. In cases where a data group is connected to only a single child channel group, the data block is constrained to include records that adhere to a uniform layout.

For sorted data groups, there's an option to omit the record ID, facilitating faster, index-based access to the data. This streamlined approach is often preferred for efficient data retrieval.

Conversely, when dealing with unsorted MDF files, many applications tend to sort them prior to reading. This sorting process in MDF is a meticulous, lossless operation that distinctly organizes records from unsorted data groups, thereby negating the need for buffering during the recording process.

This method not only enhances data access speed but also maintains the integrity and completeness of the data.

Diagram showing the structure of sorted and unsorted MDF files with 'Logger' and 'Reader' labels.

The Evolution of MDF

The journey of Measurement Data Format (MDF) is a testament to the automotive industry's relentless pursuit of technological advancement. Conceived to meet the intricate demands of ECU development, calibration, and testing, MDF has become synonymous with data reliability and efficiency in vehicle systems.

Here's an overview of MDF's historical evolution

  • MDF, born in the 90s, has become a staple for vehicle system data handling.

  • It's designed for complex tasks in ECU development, calibration, and testing.

  • MDF 4.0, released by ASAM, eliminated the file size limit and added new features.

  • Enhanced data compression and varied data length storage arrived with MDF 4.1.

  • MDF 4.2.0, the latest iteration, introduced advanced layout and signal reading options.

  • The evolution of MDF mirrors the automotive industry's push for innovation.

  • A narrative of collaboration, MDF's history is marked by OEM and developer efforts.

The AutoPi System

Harness the Power of Telematics with AutoPi Cloud

Step into the future of vehicle management. Advanced telematics at your fingertips.

Other posts you will like

How Long May I Drive? Rules Regarding Driver Hours
Fleet Management

How Long May I Drive? Rules Regarding Driver Hours

Explore the regulations on driver hours to ensure safety and compliance. Learn about legal driving limits and rest requirements for drivers.

ELM327 apps - Supported Protocols by AutoPi
Guides AutoPi Topics

ELM327 apps - Supported Protocols by AutoPi

Discover more about the ELM327 apps, CAN-analyser and many other practical benefits that comes with the AutoPi Telematics Unit.

How To Build a Tesla Overheating Protection
DIY

How To Build a Tesla Overheating Protection

Learn how to build a car overheating protection easily in your own vehicle and prevent unpleasant high interior temperatures in summer or interior dam ...

STILL HAVE QUESTIONS?

Get in touch with us – We're ready to answer any and all questions.

* Mandatory fields

Email our engineers

We are here to help!