Method and device for testing automobile software unit through tree structure
Stateflow modeling of automotive software units through a logical tree structure solves the problems of time-consuming, error-prone, poor maintainability and difficult team collaboration in existing technologies, and achieves efficient and clear modeling and communication effects.
Patent Information
- Application Number
- CN202410394990.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-02
- Publication Date
- 2025-10-17
AI Technical Summary
Existing Stateflow modeling in vehicle dynamics is time-consuming, tedious, error-prone, poorly maintainable, not conducive to team collaboration, and relies on individual experience and skills.
A tree-structured inspection method for automotive software units is used. Stateflow modeling is performed through a logic tree, node positions are standardized, hierarchical parsing and calibration are performed, and inspection panels are used for node creation, screening, and position calibration. Logic and execution logic are separated, and an independent logic tree representation is provided.
It improves modeling efficiency, reduces errors, enhances model maintainability and team collaboration capabilities, simplifies the logic inspection and modification process, and improves communication efficiency.
Smart Images

Figure CN120803880A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automobile software unit inspection, and particularly relates to a tree structure-based inspection method and device for automobile software units. BACKGROUND
[0002] A logic tree is a tree structure used to represent logical relationships and decision-making processes. In vehicle dynamics, a logic tree can represent vehicle states, behaviors, and state transition rules. Designing a logic tree requires a deep understanding of the working principles and various behaviors of a vehicle dynamics system. Through a tree structure, the logical relationships and transition conditions between states can be clearly represented. Stateflow is a modeling tool in MATLAB / Simulink that is used to create state machines and state charts to describe various states and transitions of a system. In Stateflow, states represent different situations that a system can be in, while transitions represent the switching conditions between states. MBD (Model-Based Design) is a design method based on models. It is a system development methodology that involves modeling, analyzing, and verifying a system, and then automatically generating code, test cases, and documentation based on the model. The purpose of MBD is to enable software developers and system engineers to quickly create and verify a system in the early stages of the design process, so that problems can be caught and solved earlier. Using Stateflow, you can model combinatorial and sequential decision logic, making it available as a block in a Simulink model for simulation or as an object in MATLAB for execution. Graphical animations allow you to analyze and debug the logic while it is being executed, and editing-time and run-time checks ensure design consistency and completeness before implementation. Therefore, Stateflow is an important part of MBD development. The existing method of using Stateflow for vehicle dynamics modeling is to first define the input and output of the model based on its functionality, then define the transition conditions (such as the triggering of specific input signals, logical operations, and sensor signals reaching a certain value), events (signals, user inputs), and actions based on various states of the vehicle control system such as acceleration, braking, and steering. Finally, based on various requirements, the internal execution tasks of the module are written. The existing direct manual construction of Stateflow has some potential defects: 1. Time-consuming and tedious: creating a Stateflow requires a lot of time and effort, especially for complex systems or situations that require a large number of states and transitions. Direct manual construction can be very tedious.
[0003] 2. Prone to errors: Human errors are inevitable, especially when creating large and complex Stateflow diagrams, direct construction can easily introduce spelling errors, logical errors or state transition errors, leading to difficult debugging.
[0004] 3. Poor maintainability: Directly constructed Stateflow may become difficult to manage during subsequent modification and maintenance, when system requirements change, modification may cause chaos and instability of the entire Stateflow structure.
[0005] 4. Not conducive to team collaboration: Different team members may have different design styles and habits, and the constructed Stateflow diagram may lack unified specifications, increasing the difficulty of team collaboration.
[0006] 5. Dependence on individual experience and skills: Hand-crafted Stateflow diagrams usually require certain experience and skills, if a team member leaves or a new member joins, additional training and time may be required to adapt to the hand-crafted structure. SUMMARY
[0007] The present application provides a tree structure for verifying automotive software units and a device to solve the problems raised in the background art.
[0008] To solve the above technical problems, the technical solution adopted by the present application is: A tree structure for verifying automotive software units, the tree structure for verifying automotive software units comprises the following steps: Step 1: From the way of logical tree Stateflow modeling; Step 2: The overall logic flow of Stateflow modeling from the logical tree; Step 3: The logic flow of parsing the logical tree generated from the logical tree Stateflow; Step 4: The method of calibrating the position of each node generated from the logical tree Stateflow; In step 1, the position of each junction created by Stateflow is standardized by calculating the child nodes and characters, two value records of the position of the junction on the node are added to all nodes in the logical tree, junction is a basic element in Stateflow, transition is a basic element in Stateflow, two junctions are connected through transition, including the following.
[0009] Further improvement of the technical scheme of the present application is that: in the step two, first, the junction corresponding to the root node is created, then the smallest node not traversed is selected, it is judged whether the node is a newly created layer, if yes, the code tree node is parsed into Stateflow according to the newly created layer, if not, the transition structure of the original layer is deleted, the code tree node is parsed into Stateflow according to the newly created layer, finally, it is uniformly judged whether all nodes in the code tree are traversed, if yes, the operation is ended, if not, the smallest node not traversed is selected again to continue the operation repeatedly.
[0010] Further improvement of the technical scheme of the present application is that: in the step three, four nodes are divided, which are lf node, switch node, for node and while node, the lf node can create the junction and transition of the related elseif and else, the switch node can create the junction and transition of the related case and default, the for node and the while node can create the junction and transition, finally, the four nodes are positionally calibrated.
[0011] Further improvement of the technical scheme of the present application is that: in the step four, horizontal coordinate calibration and vertical coordinate calibration are included, in the horizontal coordinate calibration, the coordinate is a function of the number of child nodes and all characters of the child nodes, in the vertical coordinate calibration, the coordinate is a function of the number of child nodes and the number of rows of the child nodes, finally, the horizontal coordinate calibration and the vertical coordinate calibration are mixed into x, y for output.
[0012] A tree structure inspection device for a vehicle software unit, comprising an inspection panel, the inspection panel comprising a node creation module and a position calibration module, the node creation module and the position calibration module are both used by the inspection panel, the output end of the node creation module is electrically connected with a node screening module, the output end of the node screening module is electrically connected with an analysis module, the output end of the position calibration module is electrically connected with a horizontal calibration module and a vertical calibration module.
[0013] Due to the adoption of the above technical scheme, the present application has the following technical progress compared with the prior art: The present application provides a tree structure inspection method for a vehicle software unit, a method for realizing stateflow modeling through a logic tree, which can first comb the logic tree, and then generate a Stateflow model from the logic tree, so that logic errors can be avoided first, the time for logic checking is saved, the logic and the specific execution are distinguished, the maintainability of the model is ensured, and new members do not need very mature writing ability.
[0014] The application provides a tree structure test method for a vehicle software unit, a logic tree can more intuitively show the demand and logical relationship, helps to sort out and analyze the system logic in the demand stage, can be used as a supplement to the demand document, better expresses the demand, is convenient for subsequent accurate mapping of the demand to a Stateflow model, the logic tree can organize the logic according to different levels, so that the system logic structure is more clear and modular, through the logic tree, the complex system logic can be decomposed into more easily understood and managed modules, the logic tree as an independent representation form can be used to cross-verify the integrity and consistency of the demand, so as to ensure that all demands are correctly captured in the Stateflow model, can help to find potential logical errors or omissions in the demand stage, and avoid logical problems in the Stateflow model.
[0015] The application provides a tree structure test method for a vehicle software unit, the construction of the logic tree and Stateflow modeling are independent processes, which means that the logic can be analyzed and designed without being limited by the Stateflow tool, the logic tree as an intermediate representation form makes the modification or adjustment of the system logic more flexible, can be modified without affecting the Stateflow model, the logic tree can be used as a tool for documenting the demand, is convenient for communication and sharing among team members, reduces the understanding and communication cost, is more easily used to show and explain the system logic to non-technical personnel, and enhances the communication effect. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 It is a logic tree schematic diagram of the application; Figure 2 It is a Stateflow model schematic diagram of the application; Figure 3 It is a general logic block schematic diagram of the application; Figure 4 It is a logic block schematic diagram of the analysis process of the application; Figure 5 It is a logic block schematic diagram of the position calibration of the application; Figure 6 It is a Stateflow schematic diagram generated according to the content of the application; Figure 7 It is a test device module schematic diagram of the application.
[0017] In the figure: 1, test panel; 11, node creation module; 12, node screening module; 13, analysis module; 14, position calibration module; 15, horizontal calibration module; 16, vertical calibration module. DETAILED DESCRIPTION
[0018] The present invention is described in further detail below in conjunction with the embodiments: Example 1
[0019] like Figures 1-6 As shown, the present invention provides a tree structure for automobile software unit verification method, the tree structure for automobile software unit verification method comprises the following steps: Step 1: Modeling from the logic tree Stateflow; Step 2: Model the overall logic flow from the logic tree Stateflow; Step 3: Generate the logical flow of the Stateflow parsing logic tree from the logic tree; Step 4: Generate the method of calibrating the position of each node of Stateflow from the logic tree; In step 1, the position of each junction created in Stateflow is standardized by calculating the child nodes and characters. Two values are added to all nodes in the logic tree to record the position of the upper and lower junctions of the nodes. Junction is a basic element in Stateflow, and Transition is a basic element in Stateflow. Two junctions are connected by transition, including the following. Example 2
[0020] like Figures 1-6 As shown, based on Example 1, the present invention provides a technical solution: preferably, in step 2, a junction corresponding to the root node is first created, and then the smallest node that has not been traversed is selected, and it is determined whether the node is a newly created layer. If so, the code tree node is parsed into Stateflow according to the newly created layer. If not, the transition structure of the original layer is deleted, and the code tree node is parsed into Stateflow according to the newly created layer. Finally, it is uniformly determined whether all nodes in the code tree have been traversed. If so, the process ends. If not, the smallest node that has not been traversed is reselected and the operation is repeated. In step 3, there are four nodes, namely, lf node, switch node, for node, and while node. The lf node can create node-related elseif and else junctions and transitions. The switch node can create node-related case and default junctions and transitions. The for node and the while node can create junctions and transitions. Finally, the four nodes are positionally calibrated. Example 3
[0021] like Figures 1-6As shown, based on Example 1, the present invention provides a technical solution: preferably, step four includes horizontal coordinate calibration and vertical coordinate calibration, the coordinate in the horizontal coordinate calibration is a function of the number of child nodes and all characters of the child nodes, and the coordinate in the vertical coordinate calibration is a function of the number of child nodes and the number of child node rows, and the horizontal coordinate calibration and the vertical coordinate calibration are finally uniformly mixed into x and y for output. Example 4
[0022] like Figure 7 As shown, the present invention provides a tree-structured inspection device for automobile software units: it includes an inspection panel 1, the inspection panel 1 includes a node creation module 11 and a position calibration module 14, the node creation module 11 and the position calibration module 14 are both used using the inspection panel 1, the output end of the node creation module 11 is electrically connected to the node screening module 12, the output end of the node screening module 12 is electrically connected to the parsing module 13, and the output end of the position calibration module 14 is electrically connected to the horizontal calibration module 15 and the vertical calibration module 16.
[0023] In this embodiment, the detection is performed by operating the inspection panel 1, using the node creation module 11 to create the node, and using the node screening module 12 to screen the node to determine whether the node is a newly created layer and whether all nodes in the code tree have been traversed. If so, the code tree node is parsed into Stateflow according to the newly created layer using the parsing module 13, and at the same time, the horizontal calibration module 15 and the vertical calibration module 16 included in the position calibration module 14 can be used to calibrate the horizontal coordinates and the vertical coordinates.
[0024] The following describes in detail the working principle of the tree structure inspection device for automotive software units.
[0025] like Figure 7 As shown, the detection is performed through the operation inspection panel 1, the node creation module 11 is used to create the node, and the node screening module 12 is used to screen the node to determine whether the node is a newly created layer and whether all nodes in the code tree have been traversed. If so, the code tree node is parsed into Stateflow according to the newly created layer using the parsing module 13, and at the same time, the horizontal calibration module 15 and the vertical calibration module 16 included in the position calibration module 14 can be used to calibrate the horizontal coordinates and the vertical coordinates.
[0026] While the present invention has been generally described above, modifications and improvements are readily apparent to those skilled in the art. Therefore, modifications and improvements that do not depart from the spirit of the present invention are intended to be within the scope of the present invention.
Claims
1. A tree structure inspection method for automotive software units, characterized by: The tree structure inspection method for automobile software units includes the following steps: Step 1: Modeling from the logic tree Stateflow; Step 2: Model the overall logic flow from the logic tree Stateflow; Step 3: Generate the logical flow of the Stateflow parsing logic tree from the logic tree; Step 4: Generate the method of calibrating the position of each node of Stateflow from the logic tree; In step 1, the position of each junction created in Stateflow is standardized by calculating the child nodes and characters. Two values are added to all nodes in the logic tree to record the position of the upper and lower junctions of the nodes. Junction is a basic element in Stateflow, and Transition is a basic element in Stateflow. Two junctions are connected by transition, including the following.
2. The tree structure verification method for automotive software units according to claim 1, characterized in that: In the second step, a junction corresponding to the root node is first created, and then the smallest node that has not been traversed is selected. It is determined whether the node is a newly created layer. If so, the code tree node is parsed into Stateflow according to the newly created layer. If not, the transition structure of the original layer is deleted, and the code tree node is parsed into Stateflow according to the newly created layer. Finally, it is determined whether all nodes in the code tree have been traversed. If so, the process ends. If not, the smallest node that has not been traversed is reselected and the operation is repeated.
3. The tree structure verification method for automotive software units according to claim 1, characterized in that: The step three is divided into four nodes, namely, lf node, switch node, for node, and while node. The lf node can create the junction and transition of the node system related elseif and else. The switch node can create the junction and transition of the node system related case and default. The for node and while node can create junction and transition. The last four nodes are used for position calibration.
4. The tree structure verification method for automotive software units according to claim 1, characterized in that: Step four includes horizontal coordinate calibration and vertical coordinate calibration. The coordinates in the horizontal coordinate calibration are a function of the number of child nodes and all characters of the child nodes. The coordinates in the vertical coordinate calibration are a function of the number of child nodes and the number of child node rows. The horizontal coordinate calibration and the vertical coordinate calibration are finally unified and mixed into x and y for output.
5. A tree structure inspection device for automobile software units, comprising an inspection panel (1), characterized in that: The inspection panel (1) includes a node creation module (11) and a position calibration module (14). Both the node creation module (11) and the position calibration module (14) are used by the inspection panel (1). The output end of the node creation module (11) is electrically connected to the node screening module (12), the output end of the node screening module (12) is electrically connected to the analysis module (13), and the output end of the position calibration module (14) is electrically connected to the horizontal calibration module (15) and the vertical calibration module (16).