Smoothly filter an A2L file to produce an A2L with exactly the right information
A typical flowchart for UeA2lFilter is shown below.
To protect intellectual property or preventing accidental calibration changes its often a good idea to remove some measurements, characteristics, groups and functions before sending the software and A2L to customers or partners. UeA2lFilter accomplishes this task by filtering the A2L file. It offers a rich set of expressions for selecting which items shall be kept or removed.
- Filter rules are defined in a text file for easy reuse. This text file also support comments to document the rules.
- Very versatile yet easy to understand filter definition makes it possible to express a very wide range of filtering rules.
- Two mechanisms for external filter definition suitable for automation: Filter by labfile content or generate filter definition.
Filter definition grammar
- A filter can be a keep or delete filter, i.e. items selected by filter definition is 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 name is supported.
- Filter by labfile contents. Very useful when the measurements and calibrations to keep or delete a kept in ETAS INCA. Enables reuse of filter definition across several projects which improves consistency and maintainability.
- Groups can be filtered by name. Wildcards in group name is 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. Then follows the rules with one rule per line. These rules are processed one by one from top to bottom.
Groups and functions which becomes 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 applying have 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