Filter

Smoothly filter an A2L file to produce an A2L with exactly the right information

To protect intellectual property or prevent accidental calibration changes it is often a good idea to remove some measurements, characteristics, groups and functions before sending the software and A2L to customers or partners. Filter accomplishes this task by filtering the A2L file. It offers a rich set of expressions to select which items shall be kept or removed.

A typical flowchart for Filter is shown below.

Highlights of Filter

Filter definition grammar

  • A filter can be a keep or delete filter, i.e. items selected are either kept or removed.
  • Measurements, characteristics, groups and functions can be filtered by name. Wildcards is supported.
  • Measurements and characteristics can be filtered by group and function membership. Wildcards in group names are supported.
  • Filter by labfile contents. Very useful when the measurements and calibrations to keep or delete are kept in ETAS INCA. Enables reuse of filter definition across several projects improving consistency and maintainability.
  • Groups can be filtered by name. Wildcards in group names are supported. Choose whether the group members shall be deleted or kept.
  • Functions can be filtered exactly as groups, i.e. choose whether members shall be deleted with function or opt to delete function but keep members.

The filter definition is a text file with one rule per line. It starts with filter type, followed by one rule per line. These rules are processed one by one from top to bottom.

Groups and functions which become empty after processing of all rules are deleted. Unused compu methods, record layouts etc are also removed.

An example of the filter definition is show below.

// A single line comment

/* A comment spanning 
   multiple lines */
   
/* The rules are processed one by one. The first rule applied has precedence, i.e. if the 2nd
   rule says that measurement x shall be kept and the 3rd says it shall be deleted then it will
   be kept.
*/

FILTER_TYPE DELETE

// Delete measurements and characteristics in the lab file foo.lab.
SELECT ITEMS IN LABFILE "src\com\udokaelectronics\a2l\test\foo.lab"

// Delete measurement named exactly abc
SELECT MEASUREMENT WHICH NAME MATCHES abc

// * is a wildcard which matches any string including an empty one.
SELECT MEASUREMENT WHICH NAME MATCHES Hello*

// ? is a wildcard which matched any single character
SELECT MEASUREMENT WHICH NAME MATCHES xyz?.dev

// Delete all measurements in group Group1. 
// Do not delete measurements in subgroups.
SELECT MEASUREMENT IN GROUP NAME MATCHES Group1 EXCLUDE SUBGROUPS

// Delete all measurements in group Group2. 
// Do delete measurements in subgroups.
SELECT MEASUREMENT IN GROUP NAME MATCHES Group2 INCLUDE SUBGROUPS

// Wildcards can be used in groups too.
SELECT MEASUREMENT IN GROUP NAME MATCHES Def*ection INCLUDE SUBGROUPS

// Handling of characteristics is identical to measurements 
// except for CHARACTERISTIC in the rule.
SELECT CHARACTERISTIC WHICH NAME MATCHES x.Increment
SELECT CHARACTERISTIC IN GROUP NAME MATCHES foo*ection INCLUDE SUBGROUPS

// Delete group Motor_Limit_Check and its subgroups but doesn't delete measurements 
// and characteristics in group.
SELECT GROUP WHICH NAME MATCHES Motor_Limit_Check EXCLUDE MEASUREMENTS EXCLUDE CHARACTERISTICS

// Delete groups which name starts with Generated but keep measurements and 
// characteristics in groups. 
DELETE GROUP WHICH NAME MATCHES Generated* KEEP MEASUREMENTS KEEP CHARACTERISTICS