Method and system for constructing vehicle network simulation test environment based on protocol definition driven
By constructing an abstract syntactic dependency graph and performing semantic level difference calculation, the source nodes of protocol changes are identified, and a minimum perturbation regression test set is generated. This solves the problem of low efficiency in vehicle network simulation test environments and achieves accurate simulation model overloading and resource optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI WEILAN INTELLIGENT TECHNOLOGY CO LTD
- Filing Date
- 2026-04-17
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies in vehicle network simulation testing environments struggle to accurately perceive the scope of protocol version changes, resulting in low simulation testing efficiency, significant resource waste, and easily distorted simulation results.
By loading the old and new protocol definition files, the physical meaning of the signal and the physical semantic tuple of the data type conversion function are extracted, an abstract syntax dependency graph is constructed, semantic level difference calculation is performed, the change source node is identified, the influence radius is calculated, the minimum disturbance regression test set is generated, and the simulation environment incremental configuration description file is output.
This has improved the efficiency of iterative construction of vehicle network simulation test environments, increased resource utilization, enhanced the accuracy of simulation results, and made regression testing strategies more precise.
Smart Images

Figure CN122179326A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive electronics testing technology, specifically to a method and system for constructing a vehicle network simulation testing environment based on protocol definition. Background Technology
[0002] As automotive electronic and electrical architectures evolve towards domain-centralized and central computing platforms, the complexity of in-vehicle network communication protocols has increased dramatically. Throughout the vehicle development process, OEMs and suppliers rely on Controller Area Network (CAN) database files or Automotive Open Systems Architecture (OSA) Extensible Markup Language (ESL) files as the single source of fact for defining communication matrices. Due to feature iterations, hardware upgrades, or standards compliance revisions, these protocol definition files frequently undergo version evolution throughout the vehicle's lifecycle.
[0003] When protocol definition files evolve from old versions to new versions, vehicle network simulation testing environments face severe challenges: On the one hand, test engineers struggle to accurately perceive the scope of substantial technical changes between the two versions. Existing technologies often employ text difference tools based on file line content for comparison, which can only identify additions, deletions, and modifications at the string level. They cannot understand whether the physical meaning of signals has implicitly changed through modifications to the numerical correspondence table, nor can they trace the chain reaction of entire frame protocol data unit layout offsets caused by changes in the length of a single signal. On the other hand, due to the lack of quantitative analysis methods for the scope of changes, regression testing strategies tend to be conservative, typically performing full regression testing. This results in a large number of test cases unrelated to protocol evolution being executed ineffectively, leading to lengthy testing cycles and significant waste of computational resources. Simultaneously, virtual electronic control unit models in the simulation environment become invalid due to protocol changes and require reloading. Relying on manual experience for judgment makes it easy to overlook or misjudge, resulting in distorted simulation results.
[0004] Therefore, there is an urgent need for a method and system that can delve into the semantic level of protocols, automatically calculate the scope of changes, and accurately tailor the scale of regression tests accordingly, in order to solve the problems of low efficiency and insufficient accuracy in the construction of simulation environments driven by protocol evolution in existing technologies. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a method and system for constructing a vehicle network simulation test environment based on protocol definition. By loading new and old protocol definition files, physical semantic tuples containing the physical meaning of signals and data type conversion functions are extracted to generate a normalized intermediate representation layer. An abstract syntax dependency graph is constructed, containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes. Dependency edges, layout dependency edges, and function dependency edges are established. Semantic level difference calculation is performed, and semantic change source nodes and layout change source nodes are marked in the abstract syntax dependency graph. The influence radius is calculated using a graph traversal algorithm based on the out-degree and in-degree of the change source nodes, identifying the affected functional clusters. Based on the affected functional cluster identifiers, test cases covering the changed signals are extracted from the historical test sequence library to generate a minimum disturbance regression test set. An incremental configuration description file is output to indicate the list of virtual electronic control unit identifiers requiring local reloading in the simulation environment. This achieves intelligent pruning of regression test cases and accurate local reloading of the simulation model, improving the iterative construction efficiency and resource utilization of the vehicle network simulation test environment.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: On the one hand, a method for constructing a vehicle network simulation test environment based on protocol definition driving, the specific steps of which are as follows: S100: Load the first protocol version definition file and the second protocol version definition file, parse and extract the physical semantic tuples containing the physical meaning of the signal and the data type conversion function, and generate a normalized intermediate representation layer that eliminates file format differences; S200. Based on the normalized intermediate representation layer, an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes is constructed, and directed associations containing dependency edges, layout dependency edges, and function dependency edges are established between the nodes. S300. Perform semantic level difference calculation, compare the physical semantic tuples and protocol data unit layout offsets of the first protocol version and the second protocol version, and mark the semantic change source nodes and layout change source nodes that have undergone substantial changes in the abstract syntax dependency graph. S400. Based on the out-degree and in-degree of the semantic change source node and the layout change source node in the abstract syntax dependency graph, calculate the change impact radius using a graph traversal algorithm to identify the affected functional clusters affected by the change. S500. Based on the identification information of the affected functional cluster, retrieve and extract test cases that cover the change source node and whose tags belong to the affected functional cluster from the pre-built historical test sequence library, generate a minimum disturbance regression test set, and generate a simulation environment incremental configuration description file to indicate the list of virtual electronic control unit identifiers that need to be locally overloaded in the simulation environment.
[0007] Furthermore, in S100, the physical semantic tuple includes: signal name, physical minimum value, physical maximum value, physical unit, numerical correspondence table, and analytical expression of data type conversion function. The analytical expression of the data type conversion function is extracted by the normalized intermediate representation layer and transformed into a unified function abstract syntax tree structure to eliminate the differences in format description of the same physical conversion logic in different protocol definition files.
[0008] Furthermore, in S200, the steps for constructing the abstract syntax dependency graph include: For each electronic control unit obtained from the analysis, a corresponding electronic control unit node is established as the root node of the dependency graph; A protocol data unit node is established for each protocol data unit belonging to the electronic control unit, and a dependency edge is established from the electronic control unit node to the protocol data unit node. For each signal carried within the protocol data unit, a signal node is established, and a dependency edge is established from the protocol data unit node to the signal node; For each data type conversion function associated with the signal, a data type conversion function node is established, and a function dependency edge is established from the signal node to the data type conversion function node; Within the same protocol data unit, if a change in the bit length and bit position of the first signal will cause a change in the protocol data unit layout offset of the second signal, then a layout dependency edge is established from the first signal node to the second signal node.
[0009] Furthermore, in S300, the execution logic for semantic-level difference calculation is as follows: Traverse each signal in the normalized intermediate representation layer, compare the numerical correspondence table of the signal in the first protocol version and the second protocol version. If there is an addition or deletion of enumeration items or a change in the description of enumeration values in the numerical correspondence table, even if the starting position and bit length of the signal in the two versions have not changed, the node where the signal is located is still marked as the semantic change source node. Compare the bit layout parameters of all signals within each protocol data unit, and calculate the change in protocol data unit layout offset of each signal in the second protocol version relative to the first protocol version; when the change in the bit length of a signal causes the starting bit position of at least one subsequent signal to shift, mark the signal node with the changed bit length as the layout change source node. Compare the function abstract syntax tree structure of each data type conversion function node. If the operators, coefficients, or constants of the conversion formula for the same signal differ between the two versions, then mark the data type conversion function node with the difference as the semantic change source node.
[0010] Furthermore, in S400, the process of calculating the radius of influence of the change using a graph traversal algorithm includes: Starting from each of the semantic change source nodes and each of the layout change source nodes, a breadth-first traversal is performed along the directed edges of the abstract syntax dependency graph; For any node that is traversed and visited, calculate the quantized value of the degree of influence. ,in, Indicates the visited node The degree of impact is quantified. Represents a node In the abstract syntax dependency graph, the number of incoming edges directly derived from any of the semantic change source nodes or any of the layout change source nodes is... Represents a node The total number of incoming edges in the abstract syntax dependency graph. Indicates from node The number of outgoing edges that originate from and are ultimately connected to any of the semantic change source nodes or any of the layout change source nodes. Represents a node The total number of outgoing edges in the abstract syntax dependency graph. and The preset weighting coefficients satisfy... , , , It is a preset positive constant used to avoid the denominator being zero; The functional cluster to which the accessed node belongs is identified as the affected functional cluster if the quantified value of the degree of impact exceeds a preset impact threshold.
[0011] Furthermore, in S500, the step of generating the minimum perturbation regression test set includes: Obtain the pre-labeled attributes of each test case in the historical test sequence library. The pre-labeled attributes include a list of signal identifiers covered by the test case and a functional cluster label to which the test case belongs. Based on the identification information of the affected functional clusters, the historical test sequence library is subjected to a first-level pruning and filtering to retain candidate test cases whose functional cluster tags belong to the affected functional clusters; Based on the signal identifier lists corresponding to the semantic change source nodes and the layout change source nodes, the candidate test cases are subjected to a second-level pruning and screening process. Test cases in which the signal coverage identifier list and the signal identifier list have an intersection are retained, forming the minimum perturbation regression test set.
[0012] Furthermore, when the number of test cases in the minimum perturbation regression test set exceeds a preset execution resource limit, the test cases are sorted and pruned a second time based on their priority scores. ,in, Represents test cases Priority score, Represents test cases The set of signal identifiers covered This represents the set of signal identifiers corresponding to all semantic change source nodes. This represents the set of affected signal identifiers whose positions have been passively moved due to changes in layout offset. This indicates the number of elements in the set. and The preset weighting coefficients, and Test cases are selected from high to low according to the priority score until the execution resource limit is met.
[0013] Furthermore, in S500, the simulation environment incremental configuration description file is generated as follows: traverse all electronic control unit nodes corresponding to the functional clusters marked as affected by changes in the abstract syntax dependency graph, extract the unique identifiers of the electronic control unit nodes, generate a list of virtual electronic control unit identifiers that need to be partially reloaded, and when the simulation environment incremental configuration description file is parsed and executed, the simulation test engine only unloads the virtual electronic control unit simulation models specified in the list of virtual electronic control unit identifiers, and reloads the corresponding virtual electronic control unit simulation models according to the second protocol version definition file, while keeping other virtual electronic control unit simulation models not included in the list of virtual electronic control unit identifiers in a continuous running state.
[0014] Furthermore, the first protocol version definition file and the second protocol version definition file are controller local area network database files, and the normalized intermediate representation layer uses a unified data structure to describe the message identifier, data length, transmission type, signal name, start bit, bit length, byte order, physical value range, numerical correspondence, and mathematical expression of data type conversion function.
[0015] On the other hand, a vehicle network simulation and testing environment construction system based on protocol definition drive includes: The protocol parsing module is used to load the first protocol version definition file and the second protocol version definition file, and extract physical semantic tuples to generate a normalized intermediate representation layer; The dependency graph construction module is used to generate an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes; The semantic difference module is used to perform semantic-level difference calculations to identify semantic change source nodes and layout change source nodes. The impact analysis and calculation module is used to determine the impact radius of the change by calculating the out-degree and in-degree of the change source node and output the identifier of the affected functional cluster. The pruning and reloading module is used to retrieve and extract the minimum perturbation regression test set from the historical test sequence library and output the simulation environment incremental configuration description file to mark the virtual electronic control units that need to be locally reloaded.
[0016] Compared with existing technologies, this method for constructing a vehicle network simulation test environment based on protocol definition has the following advantages: I. By extracting physical semantic tuples containing the physical meaning of signals and data type conversion functions and performing semantic level difference calculation, this invention can identify deep changes that do not change the bit layout but affect the functional logic, such as modifications to the numerical correspondence table. This avoids the missed and false alarms of text comparison technology and significantly improves the accuracy and completeness of change detection.
[0017] Second, this invention establishes an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes, and constructs dependency edges, layout dependency edges, and function dependency edges between nodes, transforming discrete protocol descriptions into computable directed dependency networks, so that the chain effect of protocol data unit layout offsets has a traceable and quantifiable graph traversal basis.
[0018] Third, this invention, based on changing the out-degree and in-degree of the source node, uses a preset quantitative value of the degree of impact to perform graph traversal analysis, which can automatically calculate the precise radius of impact and map it to the affected functional clusters. This compresses the granularity of impact analysis from the entire bus system to a specific functional domain, providing a quantitative decision basis for subsequent precise pruning.
[0019] Fourth, this invention performs two-level pruning and filtering on the historical test sequence library based on the affected functional clusters and change signal identifiers to generate a minimum perturbation regression test set. After the protocol version evolves, only a small number of core test cases that are strongly related to the evolution logic need to be executed, which greatly reduces the regression test execution time and effectively releases simulation computing resources.
[0020] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0022] Figure 1 A flowchart illustrating the steps involved in constructing a protocol-defined-driven vehicle network simulation test environment. Figure 2 This is a flowchart illustrating the construction process of the abstract syntax dependency graph in an embodiment of the present invention. Figure 3 This is a block diagram of the module composition of the vehicle network simulation test environment construction system based on protocol definition driving in this embodiment of the invention. Detailed Implementation
[0023] To better understand the above technical solutions, a detailed description of the solutions will be provided below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0024] To address the technical bottlenecks in protocol evolution-driven test environment construction for existing vehicle network simulation testing, traditional differential tools based on text line comparison cannot understand the physical semantics of signals and the chain reactions of protocol data unit layout offsets, leading to inaccurate perception of the impact range of changes. Simultaneously, regression testing strategies, lacking quantitative analysis methods, result in lengthy testing cycles and significant waste of computational resources due to the use of full regression. Furthermore, the overloading of virtual electronic control unit models in the simulation environment relies heavily on human experience and judgment, making them prone to omissions or misjudgments, leading to distorted simulation results. Figure 1 As shown, the specific steps of this method are as follows: S100: Load the first protocol version definition file and the second protocol version definition file, parse and extract the physical semantic tuples containing the physical meaning of the signal and the data type conversion function, and generate a normalized intermediate representation layer that eliminates file format differences; S200. Based on the normalized intermediate representation layer, an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes is constructed, and directed associations containing dependency edges, layout dependency edges, and function dependency edges are established between the nodes. S300. Perform semantic level difference calculation, compare the physical semantic tuples and protocol data unit layout offsets of the first protocol version and the second protocol version, and mark the semantic change source nodes and layout change source nodes that have undergone substantial changes in the abstract syntax dependency graph. S400. Based on the out-degree and in-degree of the semantic change source node and the layout change source node in the abstract syntax dependency graph, calculate the change impact radius using a graph traversal algorithm to identify the affected functional clusters affected by the change. S500. Based on the identification information of the affected functional cluster, retrieve and extract test cases that cover the change source node and whose tags belong to the affected functional cluster from the pre-built historical test sequence library, generate a minimum disturbance regression test set, and generate a simulation environment incremental configuration description file to indicate the list of virtual electronic control unit identifiers that need to be locally overloaded in the simulation environment.
[0025] This invention provides a method for constructing a vehicle network simulation test environment based on protocol definition. This invention aims to extract deep physical semantic tuples, including the physical meaning of signals and data type conversion functions, by loading both old and new protocol definition files, and construct a normalized intermediate representation layer that eliminates format differences. Based on this, an abstract syntax dependency graph containing ECU nodes, PDU nodes, signal nodes, and data type conversion function nodes is constructed, transforming the discrete protocol description into a directed dependency network capable of graph traversal calculations. Semantic level difference calculations are then performed to accurately mark the semantic change source nodes and layout change source nodes that have undergone substantial changes in the graph. Furthermore, a unique graph traversal algorithm and impact quantification formula are used to calculate the change impact radius and identify the affected functional clusters. Finally, based on the identification of the affected functional clusters, multi-level intelligent pruning is performed from the historical test sequence library to generate a minimum disturbance regression test set, and simultaneously outputs an incremental configuration description file for the simulation environment indicating the need for partial reloading of the virtual ECU. This method provides an efficient and automated solution for iterative testing of vehicle network communication protocols, characterized by accurate change perception, quantified impact analysis, minimized regression range, and accurate simulation environment reloading, significantly improving the iterative construction efficiency and resource utilization of vehicle network simulation test environments.
[0026] The present invention will be further described in detail below with reference to specific embodiments. The protocol format, parameters, thresholds, etc. described in this embodiment are only examples, and those skilled in the art can make adjustments according to the specific protocol and test resources in the actual project.
[0027] In this embodiment, the protocol definition file to be processed is the CAN database file of the Controller Area Network (CAN) communication matrix. The first protocol version definition file represents the baseline version, and the second protocol version definition file represents the evolved target version. The execution logic of S100 aims to eliminate the differences in format, encoding, or annotation style between different version files and extract the core information directly related to the physical meaning of vehicle network communication. Specifically, firstly, two versions of the DBC file are loaded. The parser performs lexical and syntactic analysis on the file content, traversing each message and signal definition in the file. For each signal, the parser not only extracts its basic layout information, such as identifier, start bit, bit length, and byte order, but also deeply parses and extracts multiple key fields that constitute the physical semantic tuple, which includes: Signal name: Serves as a unique or quasi-unique identifier for the signal throughout the entire system.
[0028] Physical minimum and physical maximum values: the effective range of the physical values of a signal.
[0029] Physical unit: A unit of measurement for the physical value of a signal.
[0030] Numerical correspondence table: For enumeration or state-type signals, the parser will extract all its discrete values and their corresponding text descriptions.
[0031] The parsed expression of data type conversion functions: The DBC file defines linear conversion formulas for converting raw binary values to physical values, and further transforms them into a unified function abstract syntax tree structure. This unified structured representation eliminates the differences in format descriptions caused by writing habits or equivalent formula forms in different protocol versions, laying the foundation for in-depth function logic comparison in the subsequent step S300.
[0032] Ultimately, all the information extracted from the first and second protocol versions is integrated into a normalized intermediate representation layer described by a unified data structure. This intermediate representation layer is independent of the original DBC file format and describes the entire vehicular network's communication matrix in a standardized manner, including message identifiers, data lengths, transmission types, and the name, bit layout, physical semantics, and conversion function of each signal.
[0033] Based on the normalized intermediate representation layer, an abstract syntax dependency graph is constructed. In this embodiment, the goal of this step is to transform the relatively discrete normalized intermediate representation layer generated in S100 into a directed graph structure that can clearly express the complex dependencies between network communication entities, namely, an abstract syntax dependency graph. This graph consists of four types of nodes and three types of directed edges, providing a computable data structure for subsequent change impact propagation analysis, such as... Figure 2 As shown, the specific construction process of the abstract syntax dependency graph is as follows: Establish ECU nodes: Traverse all senders of messages in the normalized intermediate presentation layer and establish a corresponding ECU node for each unique ECU identifier; Establish PDU nodes and include dependency edges: For each message belonging to a specific ECU, establish a PDU node and establish a directed edge from the ECU node to the PDU node. This edge is marked as an include dependency edge, indicating that the PDU was sent or received by the ECU. Establish signal nodes and dependent edges: Traverse all signals carried within each PDU, establish a signal node for each signal, and establish a directed edge from the PDU node to the signal node. This edge is marked as a dependent edge, indicating that the signal is encapsulated within the PDU. Establish data type conversion function nodes and function dependency edges: For each signal associated with a data type conversion function, establish a data type conversion function node for its conversion function, and establish a directed edge from the signal node to the data type conversion function node. This edge is marked as a function dependency edge, indicating that the calculation of the physical value of the signal depends on the conversion function. Establish layout dependency edges between signals: Within the same PDU, traverse all signals. When there is a first signal whose bit length or start bit position has changed during protocol version evolution, this change will cause the start bit position of the second signal located after it in the same PDU to be passively offset. Establish a directed edge from the first signal node to the second signal node. This edge is marked as a layout dependency edge.
[0034] S300 performs semantic-level differential calculation, marking semantic change source nodes and layout change source nodes. In this embodiment, this step is used to identify substantial, propagating change sources between the first and second protocol versions. The execution logic of this step is divided into three parallel and complementary comparison processes: Semantic comparison of numerical correspondence tables: The system traverses every signal in the normalized intermediate representation layer that exists in both the first and second versions. For signal i, the focus is on comparing its numerical correspondence tables. Even if the layout parameters of signal i, such as the start bit and bit length, are exactly the same in both versions, as long as any of the following substantial changes occur in its numerical correspondence table—addition or deletion of enumeration items, or change in the description of enumeration values—the system will mark the signal node containing signal i as a semantic change source node in the abstract syntax dependency graph. This change does not alter the binary layout of the message, but it will profoundly affect the receiver ECU's interpretation of the physical meaning of the signal and its behavioral logic.
[0035] PDU layout offset comparison: The system uses the first version as a benchmark, traverses and compares the bit layout parameters of all signals inside each PDU in the second version. For each signal in the PDU, it calculates the change value of its PDU layout offset in the second version relative to the first version. In this embodiment, the change value is defined as the starting bit position of the second version minus the starting bit position of the first version. When the traversal finds that the bit length of a signal has changed, and this change causes the starting bit position of at least one subsequent signal to be passively offset, the system marks the signal node whose bit length has changed as the layout change source node.
[0036] Abstract syntax tree comparison of data type conversion functions: For each data type conversion function node, the system compares its abstract syntax tree structure in the two versions. The system performs a structured hash comparison of the two abstract syntax trees. When any difference is detected between the two abstract syntax trees in the operators, coefficients or constants, the system marks the data type conversion function node associated with the difference as the semantic change source node.
[0037] Through the above semantic level difference calculation, this invention can accurately identify the nodes that truly trigger functional and layout chain reactions in the protocol evolution, providing a precise source for the accurate impact analysis of S400.
[0038] S400 calculates the impact radius of the change using a graph traversal algorithm and identifies the affected functional clusters. In this embodiment, based on the semantic change source nodes and layout change source nodes marked in step S300, this step utilizes the abstract syntax dependency graph constructed in step S200 and employs a weighted breadth-first search (BFS) graph algorithm to quantify the scope of the change's impact and aggregate the impact from the node level to the higher-level functional cluster level. The specific process of this step is as follows: Initialize the traversal queue: Create a first-in-first-out traversal queue and add all nodes marked as semantic change source nodes and layout change source nodes to the queue as the starting point for graph traversal.
[0039] Breadth-first traversal and impact quantification: Take a node u from the queue and perform a breadth-first traversal along all directed edges (including dependency edges, layout dependency edges, and function dependency edges) in the abstract syntax dependency graph. For any node v visited during the traversal, calculate the impact quantification value. ,in, Indicates the visited node The degree of impact is quantified. Represents a node In the abstract syntax dependency graph, the number of incoming edges directly derived from any of the semantic change source nodes or any of the layout change source nodes is... Represents a node The total number of incoming edges in the abstract syntax dependency graph. Indicates from node The number of outgoing edges that originate from and are ultimately connected to any of the semantic change source nodes or any of the layout change source nodes. Represents a node The total number of outgoing edges in the abstract syntax dependency graph. and The preset weighting coefficients satisfy... , , , The value is a preset positive constant to avoid zero denominators. The system maintains a preset functional cluster mapping table, which defines the affiliation relationship between lower-level signal nodes and upper-level functional clusters. During breadth-first traversal, for each visited node v, the affected degree quantization value I(v) is calculated, and the system compares this value with a preset impact threshold. In this embodiment, the threshold is set to 0.4. When I(v) > 0.4, the system determines that node v has been substantially affected, and then adds the functional cluster identifier to which the node belongs to a deduplicated set of affected functional cluster identifiers by querying the functional cluster mapping table.
[0040] When the graph traversal is complete, the quantified impact values of all affected nodes are obtained. The results of the impact analysis are compressed and refined from the bottom-level signal nodes into high-level functional cluster identifiers, providing a screening basis with appropriate granularity and clear meaning for regression test pruning.
[0041] S500 generates a minimum perturbation regression test set and an incremental configuration description file for the simulation environment. In this embodiment, using the set of affected functional cluster identifiers calculated in step S400, necessary and sufficient test cases are intelligently selected from historical test assets, and a configuration file guiding the precise updating of the simulation environment is generated. When generating the minimum perturbation regression test set: Obtain pre-annotated attributes: Access a pre-built historical test sequence library. Each test case in this library contains test scripts and execution logic, as well as detailed pre-annotated attributes, including: a list of signal identifiers covered by the test case and the functional cluster label to which the test case belongs.
[0042] First-level pruning and filtering (functional cluster level): Based on the identification information of the affected functional clusters identified in step S400, first-level pruning and filtering is performed on all test cases in the historical test sequence library. Only test cases whose functional cluster labels belong to the affected functional cluster identification set are retained to form a candidate test case set, and all functional domain test cases that are completely unrelated to this protocol change are excluded.
[0043] Second-level pruning and filtering (signal level): For the candidate test case set obtained from the first-level filtering, the system performs a second-level, more refined pruning and filtering, extracting the signal identifiers corresponding to all semantic change source nodes and layout change source nodes marked in step S300, forming a source change signal identifier list. Iterate through each test case in the candidate test case set and check the signal coverage identifier list in its pre-labeled attributes. Whether or not There is an intersection. Only if ∩ ≠ Only when the time is right will the test case be retained, and the retained test cases will form the minimum perturbation regression test set.
[0044] Secondary pruning based on priority scores: When the number of test cases in the minimum perturbation regression test set exceeds the preset execution resource limit, secondary pruning is performed based on the priority scores of the test cases. ,in, Represents test cases Priority score, Represents test cases The set of signal identifiers covered This represents the set of signal identifiers corresponding to all semantic change source nodes. This represents the set of affected signal identifiers whose positions have been passively moved due to changes in layout offset. This indicates the number of elements in the set. and The preset weighting coefficients, and Based on the calculated The test cases in the minimum perturbation regression test set are sorted in descending order, and test cases are selected sequentially from high to low until the total number of selected test cases reaches the execution resource limit.
[0045] Traversing the abstract syntax dependency graph constructed in step S200, all nodes marked as belonging to the affected functional cluster in step S400 are identified. Following the dependency edges in the graph, the process traces backward to the ECU nodes to which these nodes belong, extracting their unique identifiers to form a deduplicated list—the list of virtual ECU identifiers requiring local reloading. This generated list of virtual ECU identifiers is then written into a simulation environment incremental configuration description file according to a predefined format. When this simulation environment incremental configuration description file is parsed and executed by the vehicle network simulation test engine, the engine, according to the file instructions, only performs unloading and reloading operations on the virtual ECU simulation models specified in the list. The engine re-instantiates the simulation models based on the second protocol version definition file (new version), ensuring their internal communication behavior matches the new protocol. Simulation models of all other virtual ECUs not listed in the system remain continuously running and unaffected. This incremental, localized reloading mechanism shortens the preparation time for simulation environment reconstruction due to protocol changes and improves test iteration efficiency.
[0046] In practical implementation, this invention also provides a system for constructing a vehicle network simulation test environment based on protocol definition, such as... Figure 3 As shown, the system includes: The protocol parsing module is used to load the first protocol version definition file and the second protocol version definition file, and extract physical semantic tuples to generate a normalized intermediate representation layer; The dependency graph construction module is used to generate an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes; The semantic difference module is used to perform semantic-level difference calculations to identify semantic change source nodes and layout change source nodes. The impact analysis and calculation module is used to determine the impact radius of the change by calculating the out-degree and in-degree of the change source node and output the identifier of the affected functional cluster. The pruning and reloading module is used to retrieve and extract the minimum perturbation regression test set from the historical test sequence library and output the simulation environment incremental configuration description file to mark the virtual electronic control units that need to be locally reloaded.
[0047] In summary, the method proposed in this invention lays the data foundation for analyzing the physical meaning of protocols by extracting protocol semantic tuples and constructing a normalized intermediate representation layer; it transforms discrete protocol descriptions into computable directed networks by constructing abstract syntactic dependency graphs; it achieves accurate identification of deep and substantial changes through semantic differential computation; it precisely aggregates the scope of influence to the functional cluster level through impact analysis based on graph traversal algorithms and quantification formulas; and it finally achieves minimization of the regression test set and accurate local reloading of the simulation environment through multi-level intelligent pruning and incremental configuration generation based on the impact analysis results. The entire process forms a fully automated system from protocol change perception and impact quantification analysis to precise adaptation of the test and simulation environments, significantly improving the efficiency, accuracy, and resource utilization of vehicle network simulation testing in dealing with frequent protocol evolution.
[0048] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for constructing a vehicle network simulation test environment based on protocol definition-driven architecture, characterized in that: The specific steps of this method are as follows: S100: Load the first protocol version definition file and the second protocol version definition file, parse and extract the physical semantic tuples containing the physical meaning of the signal and the data type conversion function, and generate a normalized intermediate representation layer that eliminates file format differences; S200. Based on the normalized intermediate representation layer, an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes is constructed, and directed associations containing dependency edges, layout dependency edges, and function dependency edges are established between the nodes. S300. Perform semantic level difference calculation, compare the physical semantic tuples and protocol data unit layout offsets of the first protocol version and the second protocol version, and mark the semantic change source nodes and layout change source nodes that have undergone substantial changes in the abstract syntax dependency graph. S400. Based on the out-degree and in-degree of the semantic change source node and the layout change source node in the abstract syntax dependency graph, calculate the change impact radius using a graph traversal algorithm to identify the affected functional clusters affected by the change. S500. Based on the identification information of the affected functional cluster, retrieve and extract test cases that cover the change source node and whose tags belong to the affected functional cluster from the pre-built historical test sequence library, generate a minimum disturbance regression test set, and generate a simulation environment incremental configuration description file to indicate the list of virtual electronic control unit identifiers that need to be locally overloaded in the simulation environment.
2. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, In S100, the physical semantic tuple includes: signal name, physical minimum value, physical maximum value, physical unit, numerical correspondence table, and analytical expression of data type conversion function. The analytical expression of the data type conversion function is extracted by the normalized intermediate representation layer and transformed into a unified function abstract syntax tree structure to eliminate the differences in format description of the same physical conversion logic in different protocol definition files.
3. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, In step S200, the steps for constructing the abstract syntax dependency graph include: For each electronic control unit obtained from the analysis, a corresponding electronic control unit node is established as the root node of the dependency graph; A protocol data unit node is established for each protocol data unit belonging to the electronic control unit, and a dependency edge is established from the electronic control unit node to the protocol data unit node. For each signal carried within the protocol data unit, a signal node is established, and a dependency edge is established from the protocol data unit node to the signal node; For each data type conversion function associated with the signal, a data type conversion function node is established, and a function dependency edge is established from the signal node to the data type conversion function node; Within the same protocol data unit, if a change in the bit length and bit position of the first signal will cause a change in the protocol data unit layout offset of the second signal, then a layout dependency edge is established from the first signal node to the second signal node.
4. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, In S300, the execution logic for semantic level difference calculation is as follows: Traverse each signal in the normalized intermediate representation layer, compare the numerical correspondence table of the signal in the first protocol version and the second protocol version. If there is an addition or deletion of enumeration items or a change in the description of enumeration values in the numerical correspondence table, even if the starting position and bit length of the signal in the two versions have not changed, the node where the signal is located is still marked as the semantic change source node. Compare the bit layout parameters of all signals within each protocol data unit, and calculate the change in protocol data unit layout offset of each signal in the second protocol version relative to the first protocol version; when the change in the bit length of a signal causes the starting bit position of at least one subsequent signal to shift, mark the signal node with the changed bit length as the layout change source node. Compare the function abstract syntax tree structure of each data type conversion function node. If the operators, coefficients, or constants of the conversion formula for the same signal differ between the two versions, then mark the data type conversion function node with the difference as the semantic change source node.
5. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, In S400, the process of calculating the radius of influence of the change using a graph traversal algorithm includes: Starting from each of the semantic change source nodes and each of the layout change source nodes, a breadth-first traversal is performed along the directed edges of the abstract syntax dependency graph; For any node that is traversed and visited, calculate the quantized value of the degree of influence. ,in, Indicates the visited node The degree of impact is quantified. Represents a node In the abstract syntax dependency graph, the number of incoming edges directly derived from any of the semantic change source nodes or any of the layout change source nodes is... Represents a node The total number of incoming edges in the abstract syntax dependency graph. Indicates from node The number of outgoing edges that originate from and are ultimately connected to any of the semantic change source nodes or any of the layout change source nodes. Represents a node The total number of outgoing edges in the abstract syntax dependency graph. and The preset weighting coefficients satisfy... , , , It is a preset positive constant used to avoid the denominator being zero; The functional cluster to which the accessed node belongs is identified as the affected functional cluster if the quantified value of the degree of impact exceeds a preset impact threshold.
6. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, In S500, the steps for generating the minimum perturbation regression test set include: Obtain the pre-labeled attributes of each test case in the historical test sequence library. The pre-labeled attributes include a list of signal identifiers covered by the test case and a functional cluster label to which the test case belongs. Based on the identification information of the affected functional clusters, the historical test sequence library is subjected to a first-level pruning and filtering to retain candidate test cases whose functional cluster tags belong to the affected functional clusters; Based on the signal identifier lists corresponding to the semantic change source nodes and the layout change source nodes, the candidate test cases are subjected to a second-level pruning and screening process. Test cases in which the signal coverage identifier list and the signal identifier list have an intersection are retained, forming the minimum perturbation regression test set.
7. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 6, characterized in that, When the number of test cases in the minimum perturbation regression test set exceeds the preset execution resource limit, the test cases are sorted and pruned a second time based on their priority scores. ,in, Represents test cases Priority score, Represents test cases The set of signal identifiers covered This represents the set of signal identifiers corresponding to all semantic change source nodes. This represents the set of affected signal identifiers whose positions have been passively moved due to changes in layout offset. Indicates the number of elements in the set. and The preset weighting coefficients, and Test cases are selected from high to low according to the priority score until the execution resource limit is met.
8. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, In S500, the simulation environment incremental configuration description file is generated as follows: traverse all electronic control unit nodes corresponding to the functional clusters marked as affected by changes in the abstract syntax dependency graph, extract the unique identifiers of the electronic control unit nodes, and generate a list of virtual electronic control unit identifiers that need to be partially reloaded. When the simulation environment incremental configuration description file is parsed and executed, the simulation test engine only unloads the virtual electronic control unit simulation models specified in the list of virtual electronic control unit identifiers, and reloads the corresponding virtual electronic control unit simulation models according to the second protocol version definition file, while keeping other virtual electronic control unit simulation models not included in the list of virtual electronic control unit identifiers in a continuous running state.
9. The method for constructing a vehicle network simulation test environment based on protocol definition driving according to claim 1, characterized in that, The first protocol version definition file and the second protocol version definition file are controller local area network database files. The normalized intermediate representation layer uses a unified data structure to describe the message identifier, data length, transmission type, signal name, start bit, bit length, byte order, physical value range, numerical correspondence, and mathematical expression of data type conversion function.
10. A system for constructing a vehicle network simulation test environment based on protocol definition-driven architecture, applicable to the method for constructing a vehicle network simulation test environment based on protocol definition-driven architecture as described in any one of claims 1-9, characterized in that, The system includes: The protocol parsing module is used to load the first protocol version definition file and the second protocol version definition file, and extract physical semantic tuples to generate a normalized intermediate representation layer; The dependency graph construction module is used to generate an abstract syntax dependency graph containing electronic control unit nodes, protocol data unit nodes, signal nodes, and data type conversion function nodes; The semantic difference module is used to perform semantic-level difference calculations to identify semantic change source nodes and layout change source nodes. The impact analysis calculation module is used to determine the impact radius of the change by calculating the out-degree and in-degree of the change source node and output the identifier of the affected functional cluster. The pruning and reloading module is used to retrieve and extract the minimum perturbation regression test set from the historical test sequence library and output the simulation environment incremental configuration description file to mark the virtual electronic control units that need to be locally reloaded.