Git Product home page Git Product logo

a2l's Introduction

A2L file handling library

Dart codecov

Introduction

A library for Dart developers to handle ASAM MCD-2MC (ASAP2 or A2L) files. The file format is mostly used in the automotive industry for the development of electronic control units. It defines the memory layout of an embedded system, so that internal variables can be read and modified via a calibration and measurement system in-situ. For example, it can be used to change the engine response curve when the accelerator pedal is pressed. The calibration can be done via different bus systems, e.g. CAN, Ethernet, USB... because the calibration mechanism is agnostic of the actual transport protocol used.

A common transport layer used for the calibrations is the XCP protocol, which can be used with most bus system that are present on modern vehicles.

Usage

A simple usage example to parse a given A2L file to an AST tree:

import 'package:a2l/a2l.dart';

main() {
  var file = parseA2lFileSync('path/to/file.a2l');
}

File format

The ASAP2 or A2L files are similar to XML files, but the syntax is different. The file format was specified before XML was standardized and the standardization body never felt the need to update the ASAP2 specification. A very basic file looks like this:

/* 
This is a simple a2l file.
This is a multiline comment.                            
*/
// This is a single line comment

// required for every valid file - a named value with major and minor version.
ASAP2_VERSION 1 61

// a block element
/begin PROJECT DH.XCP.SIMPLE /* name of the project */
  "Simple Project" /* description of the project */

  /begin MODULE DH.XCP.SIM /* name of the module */
    "XCP Simulation module"  /* description of the module */
  /end MODULE
/end PROJECT

The file format uses different ways to define data:

  • named values followed by mandatory values (numbers, strings and identifiers)
  • named flags without arguments (e.g. READ_ONLY)
  • blocks started via "/begin XXX" followed by mandatory values, followed by optional values identified via names
  • a block must be closed with a matching "/end XXX" statement

Named values are usually optional, while the unamed values are required. A valid file must contain one of "ASAP2_VERSION", a "PROJECT" block with at least one "MODULE". The module contains the relevant data for an ECU. The most important blocks inside the module are "CHARACTERISTIC", which describes calibration values/parameters, "MEASUREMENT", "RECORD_LAYOUT" and "COMPU_METHOD" describgin how to convert the internal ECU data to phsyical values.

See the contents of the data directory in this repository for more examples.

Features and bugs

The library can read ASAP2 files conforming to the standards 1.5 and 1.6, and can write files for standard 1.6. However, currently there are some keywords that are only partially supported: A2ML, IF_DATA and FORMULA. The first two use the standardized ASAM MCD-2MC metalanguage which descirbes the interface specific data. During parsing, these block are simple passed through into the resulting data structure as strings. Formulas are currently also not parsed and instead stay as string. See also the supported keywords page.

Please file feature requests and bugs at the issue tracker.

a2l's People

Contributors

domohuhn avatar

Watchers

 avatar

a2l's Issues

Refactor into a more clear layout

The library should be split into distinct steps:

  • preprocessing: load all includes, but also keep the information about the origin
  • lexer: convert the input into tokens
  • parser: turn the tokens into the AST (try to keep references to the tokens)
  • validation: verify that all referenced objects exist.

Add support for FORMULA

Formulas and their inverse functions are currently not parsed to an actual executable function. This should be supported.

Add validation for the a2l file

We are currently only reading the file. There is no check if all referenced values are actually present. As a first step, the following validation steps should be added:

  • Verifiy that all referenced record layouts exist.
  • Verifiy that all referenced compute methods exist.
  • Verifiy that all measurements and characteristics exist.
  • Verifiy that the compute methods that use tables have defined tables.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.