A2L file rapid analysis and generation device and method

CN116954710BActive Publication Date: 2026-10-16CHONGQING HONGJIANG MACHINERY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310941125.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-28
Publication Date
2026-10-16
Estimated Expiration
2043-07-28

AI Technical Summary

Technical Problem

[0004]本发明提供一种A2L文件快速解析与生成装置及方法,目的在于为A2L文件解析、使用与生成提供一种简单高效的方法,以解决A2L文件理解难、使用难的问题,为标定工具的开发乃至ASAP2标准的定制化使用提供解决方案

Benefits of technology

本发明提供了一种A2L文件快速解析与生成装置及方法,根据A2L文件遵循的ASAMMCD-2MC(ASAP2)标准特征,本发明采用逐词检查、动态生成、结构映射的方式快速、稳定地解析A2L文件,将A2L文件内容解析为节点块元素和属性项元素两类主要元素,其中节点块元素支持树形结构生长。A2L文件的内容结构被解析为节点块元素和属性项元素(作为叶子节点)的结构树,各元素的内容配置被解析为A2L元素参数表。同时,对解析的结构树和节点内容进行正向遍历并输出,快速实现A2L文件的生成。本发明可将A2L文件结构和内容完全参数化,将A2L文件解析为节点块元素、属性项元素以及特定的结构树和参数表,便于用户理解和应用,也便于标定工具调用。同时,由于A2L文件结构和内容的完全解析和参数化,本发明在保证兼容性和稳定性的前提下,支持自由定义元素的特定实现和接口以及其他一系列扩展,可以支持灵活访问和修改文件内容、扩展外部接口,支持标定工具定制更灵活的功能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116954710B_ABST
    Figure CN116954710B_ABST
Patent Text Reader

Abstract

The application relates to a kind of A2L file quick analysis and generation device and method, belong to file analysis field.According to the characteristic of A2L file compliance ASAM MCD-2MC (ASAP2) standard, the application adopts the way of word by word inspection, dynamic generation, structure mapping to quickly and stably analyze A2L file, and the content of A2L file is analyzed into two main elements of node block element and attribute item element, wherein the node block element supports tree structure growth.The content structure of A2L file is parsed into the structure tree of node block element and attribute item element (as leaf node), and the content configuration of each element is parsed into A2L element parameter table.At the same time, the parsed structure tree and node content are forward traversed and output, and the generation of A2L file can be quickly realized.Due to the complete analysis and parameterization of A2L file structure and content, the application can support flexible access and modification of file content, and extend external interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of file parsing technology, specifically involving A2L file fast parsing and generation technology. Background Technology

[0002] A2L is an abbreviation for ASAM MCD-2MC Language, used to describe information about communication between calibration tools and the ECU, as well as information about measured variables and calibration parameters in the ECU. This information is characterized by its diverse data types and difficulty in description. Therefore, ASAMMCD-2MC (ASAP2) not only defines a large number of standard data structures but also supports extended data structures based on the AML meta-language. The ASAP2 standard is therefore quite complex, and parsing, using, and generating A2L files also presents certain technical challenges.

[0003] Currently, the parsing and generation of A2L files mainly rely on commercial software such as Vector, which are expensive and lack customization. Therefore, there is a need to provide a simple and fast method for parsing and generating A2L files, making it easier for calibration tool developers or calibration engineers to understand and use A2L files, and providing a solution for the development of calibration tools and even the customized use of the ASAP2 standard. Summary of the Invention

[0004] This invention provides an apparatus and method for rapid parsing and generation of A2L files, aiming to provide a simple and efficient method for parsing, using and generating A2L files, so as to solve the problems of difficulty in understanding and using A2L files, and provide solutions for the development of calibration tools and even the customized use of the ASAP2 standard.

[0005] To achieve the above objectives, the present invention provides the following technical solution: In a first aspect, the present invention provides an A2L file fast parsing and generation apparatus, the apparatus comprising an A2L file reader, an A2L element parameter table, basic node block elements, basic attribute item elements, standard node block elements, standard attribute item elements, an A2L element building factory, and an ASAP2 standard definer.

[0006] The A2L file reader reads the content and type of the current, preceding, following, or specified position of the A2L file word by word based on the text stream, and provides an access interface.

[0007] The A2L element parameter table is used to store and retrieve A2L element parameters, and provides an A2L element parameter access interface.

[0008] The basic node block element, as the parent class of all node block elements, provides instantiation, parsing, output, parameter access, and structure tree access for node blocks.

[0009] The basic attribute element, as the parent class of all attribute elements, provides instantiation, parsing, output, and parameter access for attribute items.

[0010] The standard node block element, as a subclass of the basic node block element, provides specific implementations for instantiation, parsing, output, and parameter access.

[0011] The standard attribute item element, as a subclass of the basic attribute item element, provides specific implementations for instantiation, parsing, generation, and parameter access.

[0012] The A2L element building factory is used to dynamically generate instances of a given A2L element type during the A2L parsing process.

[0013] The ASAP2 standard definer is used to define the parameter structure and child node structure of standard node block elements and standard attribute item elements.

[0014] Preferably, the A2L file reader (A2LReader) is configured with an A2L file content input stream, holding a string content cache and a string type cache. It reads only one consecutive string at a time, caching the currently read string content and string type (A2LType), where A2LType is an enumeration, and possible string types include String, KeyWord, BlockBegin, BlockEnd, Type, FileEnd, LineEnd, Unknown, DataType, etc.

[0015] Preferably, the A2L Element Parameters table is configured with a parameter name linked list and a parameter value linked list, which supports access in the form of a Map and also supports index access.

[0016] Preferably, the basic node block element (A2LBlock) is configured with an A2L file reader pointer, holding a parent node (node ​​block element) pointer and an A2L element parameter table pointer, supporting the attachment of child node block elements and child attribute item elements in a tree structure, and supporting traversal of the parameter table and tree structure and output to a file.

[0017] Preferably, the basic attribute item element (A2LProp) is configured with a parent node (node ​​block element) pointer and an A2L element parameter table pointer, supporting traversal of the parameter table and output to a file.

[0018] Preferably, the standard node block elements are defined based on the ASAP2 standard and include A2LFILE, PROJECT, MODULE, A2ML, IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT, etc. A2ML also supports dynamically expanding non-standard A2L element types.

[0019] Preferably, the standard attribute items are defined based on the ASAP2 standard and include ECU, ECU_ADDRESS, ADDR_MAPPING, EXTENDED_LIMITS, DISPLAY, SYMBOL_LINK, etc.

[0020] Preferably, the ASAP2 standard definer (ASAP2Definer) uses a List <string>Linked list and a List <a2ltype>The linked lists define a series of parameter names and types for node block elements and attribute item elements, respectively. The two lists have the same length and correspond one-to-one. A2LType is an enumeration, and the possible parameter types include String, Integer, Float, Identifier, Hex, etc. For standard node block elements, a Map is used.<string, DefCount> Define the names and number of its optional child elements, where DefCount is an enumeration that can take the values ​​Multiple, Single, and None; use a Map.<string,A2LEleFactory> Define the structure and instantiation method of optional child nodes, where key defines the matching operator for the child element type and value defines the instantiation factory for the corresponding element type.

[0021] In a second aspect of the present invention, a method for fast parsing of A2L files is provided, the parsing process comprising the following steps: A1. Initialize the ASAP2 standard definer, initialize the A2L file reader, instantiate the A2LFILE class, and begin parsing the A2L file.

[0022] A2. Parsing A2LFILE: A2LFILE calls the A2L file reader to check word by word, examines the content to be read according to the definition of the current element by the standard definer, obtains the parameters ASAP2_VERSION and A2ML_VERSION and adds them to A2LParameters, examines the node block element PROJECT, and creates a PROJECT instance; A3. Parsing the PROJECT node block element: PROJECT calls the A2L file reader to check word by word, checks the content to be read according to the definition of the current element by the standard definer, obtains fixed parameters (Name, LongIdentifier) ​​and adds them to A2LParameters, checks optional node block elements (HEADER, MODULE), uses the A2L element construction factory to build the node block element instance, and then begins parsing, including parsing the HEADER node block element, parsing the attribute item elements PROJECT_NO, VERSION, the MODULE node block element, the A2ML node block element, and parsing IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT and other node block elements; A4. During recursive backtracking, optional elements are added as children level by level to build a tree structure, and finally the recursion ends and the file parsing process ends.

[0023] Preferably, the recursive parsing in step A3 specifically includes: A3-1. The node block element HEADER is parsed. The HEADER calls the A2L file reader to check word by word. According to the standard definer, the content of the current element is checked and read. The fixed parameter (Comment) is obtained and added to A2LParameters. The optional attribute item elements (PROJECT_NO, VERSION) are checked. The optional attribute item element instance is built using the A2L element construction factory, and the parsing continues.

[0024] A3-2. Parse the attribute item elements PROJECT_NO and VERSION, call the A2L file reader to check word by word, check the content to be read according to the definition of the current element by the standard definer, obtain the fixed parameters and add them to A2LParameters, and complete the parsing.

[0025] A3-3. Parse the MODULE node block element. The MODULE calls the A2L file reader to check word by word. According to the definition of the current element by the standard definer, check the read content, obtain fixed parameters (Name, LongIdentifier) ​​and add them to A2LParameters. Check the optional node block elements (A2ML, IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT, etc.), use the A2L element construction factory to construct the node block element instance, and continue recursively parsing.

[0026] A3-4. Parse the node block element A2ML, call the A2L file reader to check word by word, identify strings (such as "CANAPE_EXT") as keywords to supplement the ASAP2 standard definer, identify the string after block as node block type, and identify the string before struct as attribute item.

[0027] A3-5. Parse other node block elements such as IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT, etc. Call the A2L file reader to check word by word, check the read content according to the standard definer of the current element, obtain fixed parameters and add them to A2LParameters, check optional block elements and optional attribute items, use the A2L element construction factory to build element instances, and continue recursively parsing until it is parsed into the fixed parameters of the node block or the fixed parameters of the attribute item.

[0028] In a third aspect, the present invention also provides a method for rapidly generating A2L files, comprising the following steps: B1. Call A2LFILE to start generating.

[0029] B2. Output ASAP2_VERSION and A2ML_VERSION.

[0030] B3. Output PROJECT: Begin forward traversal of the PROJECT structure tree, recursively calling the output function for each node's block element. Specifically, this includes: B3-1. Output node block elements. The node block elements begin with / begin BlockType and output the contents of the A2L parameter table A2LParameters in sequence, followed by the contents of child nodes (optional node block elements and attribute items). The child node block elements continue to be output recursively. B3-2. Output attribute item elements, outputting the attribute name and its parameter table A2LParameters in sequence.

[0031] B4. During recursive backtracking, each node block element ends with / end BlockType. After the recursion ends, the A2L elements are output.

[0032] B5. Format the file and check its content. Whenever a block beginning ( / begin) is detected, the next line is indented; when a block end ( / end) is detected, the indentation is immediately removed. After all content is formatted, save and close the file; the file generation process is complete.

[0033] The present invention has the following advantages over the prior art: This invention provides a device and method for rapid A2L file parsing and generation. Based on the ASAMMCD-2MC (ASAP2) standard features followed by A2L files, this invention employs word-by-word checking, dynamic generation, and structural mapping to rapidly and stably parse A2L files. The A2L file content is parsed into two main types of elements: node block elements and attribute item elements, where the node block elements support tree structure growth. The content structure of the A2L file is parsed into a structure tree of node block elements and attribute item elements (as leaf nodes), and the content configuration of each element is parsed into an A2L element parameter table. Simultaneously, the parsed structure tree and node content are traversed forward and output, quickly generating the A2L file. This invention can fully parameterize the A2L file structure and content, parsing the A2L file into node block elements, attribute item elements, and specific structure trees and parameter tables, facilitating user understanding and application, and also making it easy for calibration tools to call. Meanwhile, due to the complete parsing and parameterization of the A2L file structure and content, this invention, while ensuring compatibility and stability, supports the free definition of specific implementations and interfaces of elements, as well as a series of other extensions. It can support flexible access and modification of file content, extension of external interfaces, and support calibration tools to customize more flexible functions. Attached Figure Description

[0034] The accompanying drawings used in the following description of the embodiments or prior art will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 This is a flowchart of the A2L file fast parsing method described in Example 1.

[0036] Figure 2 This is a flowchart of the method for rapidly generating A2L files as described in Example 2.

[0037] Figure 3 This is a structural block diagram of the A2L file parsing and generation device described in Embodiment 3. Detailed Implementation

[0038] To more clearly illustrate the above-mentioned objectives, features, and advantages of the present invention, the implementation of the technical solution of the present invention will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention and not for limiting the scope of protection of the present invention.

[0039] It should be noted that the illustrations provided in the following embodiments are merely schematic representations of the basic concept of the present invention. The various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0040] Example 1 This embodiment provides a fast method for parsing A2L files, such as... Figure 1 As shown, the method includes the following steps: A1. Initialize the ASAP2 standard definer, initialize the A2L file reader, instantiate the A2LFILE class, and begin parsing the A2L file.

[0041] A2. Parse the A2L file A2LFILE. A2LFILE calls the A2L file reader to check word by word. According to the standard definer, it checks the content to be read, obtains the parameters ASAP2_VERSION and A2ML_VERSION and adds them to A2LParameters. It checks the node block element PROJECT and creates a PROJECT instance.

[0042] A3. Parse the node block element PROJECT. PROJECT calls the A2L file reader to check word by word. It checks the content read according to the definition of the current element by the standard definer, obtains fixed parameters (Name, LongIdentifier) ​​and adds them to A2LParameters, checks optional node block elements (HEADER, MODULE), and uses the A2L element construction factory to build the node block element instance. After that, recursive parsing begins, as follows: A3-1. The node block element HEADER is parsed. The HEADER calls the A2L file reader to check word by word. According to the standard definer, the content of the current element is checked and read. The fixed parameter (Comment) is obtained and added to A2LParameters. The optional attribute item elements (PROJECT_NO, VERSION) are checked. The optional attribute item element instance is built using the A2L element construction factory, and the parsing continues.

[0043] A3-2. Parse the attribute item elements PROJECT_NO and VERSION, call the A2L file reader to check word by word, check the content to be read according to the definition of the current element by the standard definer, obtain the fixed parameters and add them to A2LParameters, and complete the parsing.

[0044] A3-3. Parse the MODULE node block element. The MODULE calls the A2L file reader to check word by word. According to the definition of the current element by the standard definer, check the read content, obtain fixed parameters (Name, LongIdentifier) ​​and add them to A2LParameters. Check the optional node block elements (A2ML, IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT, etc.), use the A2L element construction factory to construct the node block element instance, and continue recursively parsing.

[0045] A3-4. Parse the node block element A2ML, call the A2L file reader to check word by word, identify strings (such as "CANAPE_EXT") as keywords to supplement the ASAP2 standard definer, identify the string after block as node block type, and identify the string before struct as attribute item.

[0046] A3-5. Parse other node block elements such as IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT, etc. Call the A2L file reader to check word by word, check the read content according to the standard definer of the current element, obtain fixed parameters and add them to A2LParameters, check optional block elements and optional attribute items, use the A2L element construction factory to build element instances, and continue recursively parsing until it is parsed into the fixed parameters of the node block or the fixed parameters of the attribute item.

[0047] A4. During recursive backtracking, optional elements are added as children level by level to build a tree structure, and finally the recursion ends and the file parsing process ends.

[0048] In practical applications, the ASAP2 standard definer should define the parameters and optional sub-elements of standard node block elements and standard attribute item elements based on the ASAP2 standard. It can also be customized according to business needs, such as adding a fixed parameter `Version` of type `String` to the standard node block element `MODULE`. Correspondingly, the default implementation of the standard node block element `MODULE` type can be customized (but is not mandatory). Obviously, users can also extend standard element types, extend element access interfaces, and adjust A2L structure tree growth behavior according to business needs.

[0049] Example 2 Based on Example 1, this example provides a method for rapid generation of A2L files, such as... Figure 2 As shown, it includes the following steps: B1. Import and parse the A2L file to obtain the parameterized A2LFILE structure tree.

[0050] B2. Call A2LFILE to start generating.

[0051] B3. Output ASAP2_VERSION, A2ML_VERSION.

[0052] B4. Output PROJECT. Begin forward traversal of the PROJECT structure tree, recursively calling the output function for each node's block element. Specifically, this includes: B4-1. Output node block elements. The node block elements begin with / begin BlockType and output the contents of the A2L parameter table A2LParameters in sequence, followed by the contents of child nodes (optional node block elements and attribute items). The child node block elements continue to be output recursively. B4-2. Output attribute item elements, outputting the attribute name and its parameter table A2LParameters in sequence.

[0053] B5. During recursive backtracking, each node block element ends with / end BlockType. After the recursion ends, the A2L elements are output.

[0054] B6. Format the file and check its content. Whenever a block beginning ( / begin) is detected, the next line is indented; when a block end ( / end) is detected, the indentation is immediately removed. After all content is formatted, save and close the file. The file generation process is now complete.

[0055] In practical applications, the exported A2L file is usually modified. For example, if the CCP communication baud rate needs to be modified, the process involves first retrieving the PROJECT sub-node from the A2LFILE according to the A2L structure tree, then retrieving the MODULE (named CCP) sub-node from the PROJECT node, then the IF_DATA sub-node (named ASAP1B_CCP) from the MODULE node, then finding the TP_BLOB sub-node from the IF_DATA node, then finding the BAUDRATE attribute item from the TP_BLOB node, accessing its parameter table A2LParameters (which contains one parameter, the baud rate), and modifying the baud rate parameter value. Clearly, users of this invention can encapsulate this structure tree indexing process and parameter table operations into a convenient access interface, thereby improving the development efficiency of calibration tools.

[0056] Example 3 Based on Embodiments 1 and 2, this embodiment provides a device for fast parsing and generating A2L files, such as... Figure 3 As shown, the device includes: The A2L file reader (A2LReader) reads the content and type of an A2L file word by word from a text stream, including the current, preceding, following, or specified positions, and provides an access interface. A2LReader holds an input stream of A2L file content, a string content buffer, and a string type buffer. It reads only one consecutive string at a time, buffering the currently read string content and string type (A2LType). A2LType is an enumeration, and possible string types include String, KeyWord, BlockBegin, BlockEnd, Type, FileEnd, LineEnd, and Unknown.

[0057] The A2L Element Parameters table (A2LParameters) is used to store and retrieve A2L element parameters, providing an interface for accessing A2L element parameters. A2LParameters holds a linked list of parameter names and a linked list of parameter values, supporting access in Map format as well as indexed access.

[0058] The basic node block element (A2LBlock) is the parent class of all node block elements, providing basic implementations for node block instantiation, parsing, output, parameter access, and structure tree access. A2LBlock holds a pointer to the A2L file reader, a pointer to the parent node (node ​​block element), and a pointer to the A2L element parameter list. It supports attaching child node block elements and child attribute item elements in a tree structure, and supports traversing the tree structure and outputting to a file.

[0059] The basic attribute element (A2LProp) is the parent class of all attribute elements, providing basic implementations for attribute instantiation, parsing, output, and parameter access. A2LProp holds a pointer to the parent node (node ​​block element) and a pointer to the A2L element parameter list, supporting traversal of the parameter list and output to a file.

[0060] Standard node block elements are subclasses of the basic node block element (A2LBlock), providing specific implementations for instantiation, parsing, output, and parameter access. Standard node block elements are defined based on the ASAP2 standard and include A2LFILE, PROJECT, MODULE, A2ML, IF_DATA, MEASRUEMENT, CHARACTERISTIC, and RECORD_LAYOUT. A2ML also supports dynamically expanding non-standard A2L element types.

[0061] Standard attribute elements are subclasses of basic attribute elements (A2LProp), providing specific implementations for instantiation, parsing, generation, and parameter access. Standard attribute elements are defined based on the ASAP2 standard and include ECU, ECU_ADDRESS, ADDR_MAPPING, EXTENDED_LIMITS, DISPLAY, and SYMBOL_LINK.

[0062] The A2L element building factory (A2LEleFactory) is used to dynamically generate instances of a given A2L element type during the A2L parsing process.

[0063] The ASAP2 Standard Definer (ASAP2Definer) is used to define the parameter structure and child node structure of standard node block elements and standard attribute item elements. ASAP2Definer uses a List... <string>Linked list and a List <a2ltype>The linked lists define a series of parameter names and types for node block elements and attribute item elements, respectively. The two lists have the same length and correspond one-to-one. A2LType is an enumeration, and the possible parameter types include String, Integer, Float, Identifier, Hex, etc. For standard node block elements, a Map is used.<string, DefCount> Define the names and number of its optional child elements, where DefCount is an enumeration that can take the values ​​Multiple, Single, and None; use a Map.<string,A2LEleFactory> Define the structure and instantiation method of optional child nodes, where key defines the matching operator for the child element type and value defines the instantiation factory for the corresponding element type.

[0064] In addition, this device also includes a measurement / calibration device interface (IMCDevice), used for centralized operation of all CHARACTERISTIC, MEASUREMENT, COMPUTE_METHOD, AXIS_PTS, and GROUP sub-elements of the device (MODULE). IMCDevice provides block element query interfaces getASAP1B, getCharacteristic(const char* name), getMeasurement(const char* name), getCompMethod(const char* name), getAxisPts(const char* name), and getGroup(const char* name), and block element list interfaces etCharList, getMeasList, getCompMethodList, getAxisPtsList, and getGroupList, supporting fast access and modification of MODULE sub-elements and their parameter tables.

[0065] In practical applications, IMCDevice can hold a MODULE pointer or extend the MODULE by inheriting from IMCDevice. Based on IMCDevice, the A2L element to be operated on can be quickly located. For example, if a calibration tool needs to provide the actual value of the measurement variable "EngineSpeed", it can directly access IMCDevice's getMeasurement("EngineSpeed") to quickly obtain the target MEASUREMENT element. By accessing its parameter table A2LParameters, the address information ECU_ADDRESS can be obtained, and the required actual value can be obtained from the ECU based on the address information. Obviously, IMCDevice can also be further extended to become a program instance of the ECU, autonomously maintaining communication with the ECU and updating ECU information in real time.

[0066] It should be understood that those skilled in the art can use the various forms of processes shown above to rearrange, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this invention does not impose any limitations on them.

[0067] The above-described embodiments are merely preferred embodiments of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the scope of the technology disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims. < / string> < / string>

Claims

1. A device for fast parsing and generating A2L files, characterized in that, include: A2L file reader, A2L element parameter table, basic node block element, basic attribute item element, standard node block element, standard attribute item element, A2L element building factory and ASAP2 standard definer; The A2L file reader reads the content and type of the current, preceding, following, or specified position of the A2L file word by word based on the text stream, and provides an access interface; The A2L element parameter table is used to store and retrieve A2L element parameters and provides an A2L element parameter access interface. The basic node block element, as the parent class of all node block elements, provides instantiation, parsing, output, parameter access, and structure tree access for node blocks; The basic attribute item element, as the parent class of all attribute item elements, provides instantiation, parsing, output, and parameter access for attribute items; The standard node block element, as a subclass of the basic node block element, provides implementations for instantiation, parsing, output, and parameter access; The standard attribute item element, as a subclass of the basic attribute item element, provides implementation for instantiation, parsing, generation, and parameter access; The A2L element building factory is used to dynamically generate instances of a given A2L element type during the A2L parsing process. The ASAP2 standard definer is used to define the parameter structure and child node structure of standard node block elements and standard attribute item elements.

2. The A2L file fast parsing and generation device according to claim 1, characterized in that, The A2L file reader is configured with an A2L file content input stream, sets up a string content cache and a string type cache, reads only one continuous string at a time, and caches the currently read string content and string type A2LType.

3. The A2L file fast parsing and generation device according to claim 1, characterized in that, The A2L element parameter table is configured with a parameter name linked list and a parameter value linked list, which supports access in the form of a Map and also supports index access.

4. The A2L file fast parsing and generation device according to claim 1, characterized in that, The basic node block element is configured with an A2L file reader pointer, including a parent node pointer and an A2L element parameter table pointer. It supports attaching child node block elements and child attribute item elements in a tree structure, and supports traversing the parameter table and tree structure and outputting to a file.

5. The A2L file fast parsing and generation device according to claim 1, characterized in that, The basic attribute item element is configured with a parent node pointer and an A2L element parameter table pointer, which supports traversing the parameter table and outputting it to a file.

6. The A2L file fast parsing and generation device according to claim 1, characterized in that, The standard node block elements, based on the ASAP2 standard definition, include A2LFILE, PROJECT, MODULE, A2ML, IF_DATA, MEASRUEMENT, CHARACTERISTIC, and RECORD_LAYOUT, among which A2ML supports dynamic expansion of non-standard A2L element types.

7. The A2L file fast parsing and generation device according to claim 1, characterized in that, The standard attribute items, defined based on the ASAP2 standard, include ECU, ECU_ADDRESS, ADDR_MAPPING, EXTENDED_LIMITS, DISPLAY, and SYMBOL_LINK.

8. The A2L file fast parsing and generation device according to claim 1, characterized in that, The ASAP2 standard definer uses a List <string>Linked list and a List <a2ltype>The linked lists define a series of parameter names and types for node block elements and attribute item elements, respectively. The two lists have the same length and correspond one-to-one. For standard node block elements, a Map<string, DefCount> is used to define the name and number of its optional child elements, where DefCount is an enumeration that can take the values ​​Multiple, Single, and None. A Map<string, A2LEleFactory> is used to define the structure and instantiation method of optional child nodes, where the key defines the matching specifier of the child element type and the value defines the instantiation factory of the corresponding element type. < / string> 9. The A2L file rapid parsing and generation device according to claim 2 or 8, characterized in that, A2LType is an enumeration that can take the values ​​String, Integer, Float, Identifier, Hex, Type, DataType, KeyWord, BlockBegin, BlockEnd, FileEnd, LineEnd, Unknown, etc.

10. A fast parsing method for A2L files, characterized in that, Includes the following steps: A1. Initialization: Initialize the ASAP2 standard definer, initialize the A2L file reader, instantiate the A2LFILE class, and begin parsing the A2L file; A2. Parsing the A2L file: A2LFILE calls the A2L file reader to check word by word, examines the content to be read according to the definition of the current element by the standard definer, obtains the parameters ASAP2_VERSION and A2ML_VERSION and adds them to A2LParameters, examines the node block element PROJECT, and creates a PROJECT instance; A3. Parsing the PROJECT node block element: PROJECT calls the A2L file reader to check word by word, checks the content to be read according to the definition of the current element by the standard definer, obtains fixed parameters and adds them to A2LParameters, checks optional node block elements, uses the A2L element construction factory to build node block element instances, and then begins recursive parsing, including parsing the HEADER node block element, parsing the PROJECT_NO and VERSION attribute items, parsing the MODULE node block element, parsing the A2ML node block element, and parsing IF_DATA, MEASRUEMENT, CHARACTERISTIC, RECORD_LAYOUT and other node block elements; A4. During recursive backtracking, optional elements are added as children level by level to build a structure tree, and finally the recursion ends, ending the file parsing process.

11. The method for fast parsing of A2L files according to claim 10, characterized in that, The recursive parsing of A3 includes: A3-1. Parsing the node block element HEADER: HEADER calls the A2L file reader to check word by word, checks the content to be read according to the definition of the current element by the standard definer, obtains fixed parameters and adds them to A2LParameters, checks optional attribute item elements, uses the A2L element building factory to build instances of optional attribute item elements, and continues parsing; A3-2. Parsing attribute item elements PROJECT_NO and VERSION: Calling the A2L file reader to check word by word, checking the content read according to the definition of the current element by the standard definer, obtaining fixed parameters and adding them to A2LParameters to complete the parsing; A3-3. Parsing the MODULE node block element: MODULE calls the A2L file reader to check word by word, checks the content to be read according to the definition of the current element by the standard definer, obtains fixed parameters and adds them to A2LParameters, checks optional node block elements, uses the A2L element building factory to build node block element instances, and continues to recursively parse; A3-4. Parse node block elements A2ML: Call the A2L file reader to check word by word, identify the string as keywords to be added to the ASAP2 standard definer, identify the string after block as node block type, and identify the string before struct as attribute item; A3-5. Parsing IF_DATA, MEASRUEMENT, CHARACTERISTIC, and RECORD_LAYOUT node block elements: The A2L file reader is called to check word by word. The content is checked according to the definition of the current element by the standard definer. Fixed parameters are obtained and added to A2LParameters. Optional block elements and optional attribute items are checked. The A2L element construction factory is used to build element instances. The recursive parsing continues until the fixed parameters of the node block or the fixed parameters of the attribute item are parsed.

12. A method for rapidly generating A2L files, characterized in that, Includes the following steps: B1. Import and parse the A2L file to obtain the parameterized A2LFILE structure tree; B1. Call the A2LFILE generation method to begin generation; B2. Output ASAP2_VERSION and A2ML_VERSION; B3. Output PROJECT: Traverse the PROJECT structure tree in a forward direction and recursively call the output function of each node block element. B3-1. Output node block elements. The node block elements begin with / begin BlockType and output the contents of the A2L parameter table A2LParameters and the contents of child nodes in sequence. The child node block elements continue to be output recursively. B3-2. Output attribute item elements, and output the attribute name and its parameter table A2LParameters in sequence; B4. During recursive backtracking, each node block element ends with / end BlockType. After the recursion ends, the A2L elements are output. B5. Format the file and check its content. When a node block is detected, the next line is indented; when a node block is detected, the indentation is decremented. Continue this process until all content is formatted, then save the file and end the file generation process.

Citation Information

Patent Citations

  • General calibration system of automobile electronic control unit and realizing method thereof

    CN101751028A

  • A2L file generation method and system

    CN104636351A