Vehicle bus mirror image data test method and system, tool, equipment and vehicle
Automatically obtain and parse the mapping relationship between the original data of the vehicle bus and the mirror data through automatic testing software tools, solving the problems of low efficiency and difficulty in ensuring the accuracy of manual testing in the existing technology, and achieving efficient and accurate vehicle bus mirror data testing.
Patent Information
- Application Number
- CN202411262672.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-01-14
AI Technical Summary
The existing vehicle bus mirror data testing methods rely on manual operation, resulting in low testing efficiency, difficult to guarantee accuracy, and difficult to quickly adapt to complex and changeable vehicle bus data, increasing operational difficulty and error risk.
The automatic testing software tool is used to obtain the original bus data and mirror data, judge the mapping relationship between the two, realize automatic analysis and output of test results, reduce human interference and reduce error rate.
It improves testing efficiency and accuracy, reduces operational complexity and error rate, and achieves fast and accurate verification of vehicle bus mirror data.
Smart Images

Figure CN119310959A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicles, and in particular to a vehicle bus mirror data testing method and system, an automatic testing software tool, an electronic device and a vehicle. Background Art
[0002] In the field of automotive electronics, with the increasing complexity of vehicle network systems, especially the widespread application of Ethernet technology in vehicle bus systems, it is particularly important to ensure the accuracy and consistency of vehicle bus mirror data. At present, the test method of vehicle bus mirror data mainly relies on manual operation, that is, manually calculating the mapping relationship between the data domain message of the vehicle bus mirror data and the original data. This manual test method is not only cumbersome and time-consuming, but also greatly reduces the test efficiency. Moreover, due to the inevitable subjective factors in the manual operation process, the accuracy and consistency of the test results are difficult to be fully guaranteed. In addition, in the face of complex and changeable vehicle bus data, the existing manual test method is difficult to quickly adapt to changes, which further increases the difficulty of operation and the risk of errors. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, one object of the present invention is to provide a vehicle bus mirror data testing method, which realizes the automation of the entire test process, reduces the interference of human factors, reduces the complexity of the operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0004] The second objective of the present invention is to provide an automatic testing software tool.
[0005] The third objective of the present invention is to provide an electronic device.
[0006] A fourth objective of the present invention is to provide a vehicle bus mirror data testing system.
[0007] A fifth object of the present invention is to provide a vehicle.
[0008] In order to achieve the above-mentioned purpose, a vehicle bus mirror data testing method according to a first aspect of an embodiment of the present invention is used for automatically testing a software tool, and the testing method comprises: obtaining bus original data and obtaining bus mirror data; determining a mapping relationship between the bus original data and the bus mirror data; and obtaining a test result of the bus mirror data according to the mapping relationship.
[0009] According to the vehicle bus mirror data testing method of the embodiment of the present invention, by adopting an automatic testing software tool, the bus original data and the bus mirror data can be automatically obtained, and the mapping relationship between the bus original data and the bus mirror data can be judged, so that the system can quickly identify and automatically analyze whether the bus mirror data correctly reflects the bus original data. This automated analysis process can verify whether the mirroring and transmission of the bus original data in the network communication are accurate. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data, and the test results can help engineers find and correct problems that may exist in the data transmission or mirroring process. Therefore, the method of the present invention can realize the automated operation of the entire test process through the automatic testing software tool, reduce the interference of human factors, reduce the complexity of the operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0010] In some embodiments, the bus raw data includes CAN bus raw data; the CAN bus raw data is collected by calling the CAN bus data collection interface; the bus raw data also includes Ethernet bus raw data; the Ethernet bus raw data is collected by calling the Ethernet bus raw data interface of the switch.
[0011] In some embodiments, the CAN bus data acquisition interface includes a PCAN interface, and the PCAN interface is called by loading PCANBasic.dll and PCANBasic.c to control the opening or closing of the PCAN interface.
[0012] In some embodiments, the bus mirror data is collected by calling a bus mirror data interface of a switch.
[0013] In some embodiments, determining the mapping relationship between the bus original data and the bus mirror data includes: calling network packet analysis software to parse the payload data of the bus mirror data according to mirroring rules; comparing the payload data of the bus mirror data with the corresponding data of the bus original data to obtain the mapping relationship.
[0014] In some embodiments, obtaining the test result of the bus mirror data according to the mapping relationship includes: determining whether all the original bus data are successfully converted into the bus mirror data and whether the mirror format is correct according to the mapping relationship.
[0015] In order to achieve the above-mentioned purpose, the automatic testing software tool of the second aspect of the embodiment of the present invention includes: a switch calling module, a CAN bus data acquisition interface calling module and a network packet analysis software calling module; a diagnostic module, which is used to send a mirror function start instruction, and establish an Ethernet bus connection and a CAN bus connection through the switch calling module and the CAN bus data acquisition interface calling module to obtain bus original data and bus mirror data; a data processing module, which is respectively connected to the diagnostic module, the switch calling module, the CAN bus data acquisition interface calling module and the network packet analysis software calling module, and is used to determine the mapping relationship between the bus original data and the bus mirror data, and obtain the test result of the bus mirror data according to the mapping relationship.
[0016] According to the automatic test software tool of the embodiment of the present invention, by integrating multiple functional modules, the tool can efficiently complete the automatic test of the vehicle bus mirror data. Specifically, the diagnostic module is responsible for sending the mirror function start instruction, and establishing the Ethernet bus connection and the CAN bus connection through the switch calling module and the CAN bus data acquisition interface calling module, so as to automatically obtain the bus original data and the bus mirror data. The data processing module is connected to each calling module respectively, and is responsible for judging the mapping relationship between the bus original data and the bus mirror data, so that the system can quickly identify and automatically analyze whether the bus mirror data accurately reflects the bus original data. This automated analysis process can verify whether the mirroring and transmission of the bus original data in the network communication are accurate. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data. Therefore, the automatic test software tool of the present invention realizes the automated data collection, analysis and test result output process by effectively integrating multiple functional modules, avoiding the cumbersomeness and potential errors in manual testing, thereby improving the test efficiency and the accuracy of the test results.
[0017] In order to achieve the above-mentioned purpose, the electronic device of the third aspect embodiment of the present invention includes: at least one processor; the at least one processor is configured with network packet analysis software, PCAN software and automatic testing software; a memory communicatively connected to the at least one processor; the memory stores a computer program executable by the at least one processor, and when the at least one processor executes the computer program, the automatic testing software is used to implement the vehicle bus mirror data testing method described in the above embodiment.
[0018] The electronic device according to the embodiment of the present invention realizes the automation operation of the entire test process by adopting the vehicle bus mirror data testing method described in the above embodiment, reduces the interference of human factors, reduces the complexity of operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0019] In order to achieve the above-mentioned purpose, a vehicle bus mirror data testing system of an embodiment of the fourth aspect of the present invention includes: a switch, the switch includes an Ethernet bus original data interface and a bus mirror data interface, the Ethernet bus original data interface is suitable for connecting to a vehicle gateway and a vehicle controller to collect Ethernet bus original data, and the bus mirror data interface is suitable for connecting to the vehicle gateway to collect bus mirror data; a CAN bus data acquisition interface, the CAN bus data acquisition interface is connected to the vehicle gateway through a vehicle CAN bus, and is used to collect CAN bus original data; an electronic device as described in the above embodiment, the electronic device is connected to the switch and the CAN bus data acquisition interface.
[0020] According to the vehicle bus mirror data test system of the embodiment of the present invention, the electronic device is connected with the switch and the CAN bus data acquisition interface, and the comprehensive acquisition of the CAN bus original data, the Ethernet bus original data and the bus mirror data can be realized. By adopting the vehicle bus mirror data test method described in the above embodiment, by judging the mapping relationship between the bus original data and the bus mirror data, the system can quickly identify and automatically analyze whether the bus mirror data accurately reflects the bus original data. This automated analysis process can verify whether the mirroring and transmission of the bus original data in the network communication are accurate. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data. Therefore, the vehicle bus mirror data test system of the present invention can realize the automated operation of the entire test process, reduce the interference of human factors, reduce the complexity of the operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0021] In order to achieve the above-mentioned purpose, the vehicle of the fifth aspect embodiment of the present invention includes an on-board gateway, an on-board controller and the vehicle bus mirror data test system described in the above embodiments, and the on-board gateway and the on-board controller are respectively connected to the test system.
[0022] According to the vehicle of the embodiment of the present invention, by adopting the vehicle bus mirror data testing system described in the above embodiment, the automation operation of the entire testing process is realized, the interference of human factors is reduced, the complexity of operation and the error rate in the testing process are reduced, thereby improving the testing efficiency and the accuracy of the test results.
[0023] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0025] Figure 1 is a flow chart of a method for testing vehicle bus mirror data according to an embodiment of the present invention;
[0026] Figure 2 is a flow chart of an automated test of vehicle bus mirror data according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of an automatic testing software tool according to an embodiment of the present invention;
[0028] Figure 4 is a block diagram of an electronic device according to an embodiment of the present invention;
[0029] Figure 5 is a schematic diagram of a vehicle bus mirror data testing system according to an embodiment of the present invention;
[0030] Figure 6 is a block diagram of a vehicle according to one embodiment of the present invention.
[0031] Reference numerals:
[0032] Vehicle 100;
[0033] Vehicle bus mirror data test system 1; vehicle gateway 2; vehicle controller 3;
[0034] Electronic device 10; switch 20; CAN bus data acquisition interface 30;
[0035] Processor 11; Memory 12;
[0036] Automated testing software tools 110;
[0037] Switch calling module 111; CAN bus data acquisition interface calling module 112; network packet analysis software calling module 113; diagnosis module 114; data processing module 115. DETAILED DESCRIPTION
[0038] Embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. Embodiments of the present invention are described in detail below.
[0039] In the related art, the test method of vehicle bus mirror data mainly relies on manual operation, that is, manually calculating the mapping relationship between the data domain message of the vehicle bus mirror data and the original data. This manual test method is not only cumbersome and time-consuming, but also greatly reduces the test efficiency. Moreover, due to the inevitable subjective factors in the manual operation process, the accuracy and consistency of the test results are difficult to be fully guaranteed.
[0040] In view of the above problems, an embodiment of the present invention proposes a vehicle bus mirror data testing method, which is used for automatic testing software tools, realizes the automation of the entire testing process, reduces the interference of human factors, reduces the complexity of operation and the error rate in the testing process, thereby improving the testing efficiency and the accuracy of the test results.
[0041] In some embodiments, the automatic test software tool can be a software tool specially designed to automate the test process, i.e., a host computer test software developed using Python scripts. Among them, Python is a high-level programming language that is widely used in developing test tools due to its ease of use and powerful library support. Python scripts can be used to write various test functions, including data collection, data parsing, and test result generation. This software tool avoids the tediousness and errors in manual operation and improves the efficiency and accuracy of the test.
[0042] Reference below Figure 1 A method for testing vehicle bus mirror data according to an embodiment of the present invention is described.
[0043] Figure 1 FIG. 1 is a flow chart of a method for testing vehicle bus mirror data according to an embodiment of the present invention. Figure 1 As shown, the vehicle bus mirror data testing method at least includes steps S1-S3.
[0044] S1, obtain bus original data and bus mirror data.
[0045] In some embodiments, the bus raw data may be raw data streams acquired in real time from various bus interfaces in the vehicle network system. Such data may include real-time information exchanged between various control units and sensors inside the vehicle, reflecting the actual operating status of the vehicle.
[0046] In some embodiments, the bus raw data can be collected through hardware interfaces connected to the vehicle network system. These interfaces are directly connected to the vehicle's bus system and capture the raw data stream through appropriate software drivers and data collection tools.
[0047] In some embodiments, bus mirror data may be data generated using a mirroring function in a vehicle network system. In other words, bus mirror data is a data copy of the original bus data, which is used to monitor and analyze the accuracy and consistency of data flows. Specifically, the main function of bus mirror data is to verify whether the original bus data is correctly copied and transmitted to the target device during the transmission process. By comparing the original bus data and the bus mirror data, the integrity and accuracy of the data during the transmission process can be detected. Engineers can use bus mirror data to analyze potential problems in network communications, such as packet loss, delays, or erroneous transmissions.
[0048] In some embodiments, bus mirror data can be configured by enabling the mirroring function, and the network device and switch can mirror the original bus data and send it to a designated receiving device. The receiving device captures and saves the bus mirror data for subsequent analysis and testing.
[0049] S2, determining the mapping relationship between the bus original data and the bus mirror data.
[0050] In some embodiments, the mapping relationship may refer to the corresponding relationship between the bus original data and the bus mirror data, which is used to ensure that the key features of the bus original data, such as the content, format, and identifier, remain consistent after being mirrored. The mapping relationship can be determined by comparing the data name, identifier (ID), data frame, timestamp, protocol format, data field, or checksum of the bus original data and the bus mirror data. This judgment process can effectively verify the consistency between the bus mirror data and the bus original data, and ensure the accuracy and reliability of the mirroring operation.
[0051] In some embodiments, accurate data transmission in the vehicle network system is critical. By determining the mapping relationship, it can be ensured that the bus mirror data can truly reflect the original bus data, thereby verifying whether the original bus data is correctly mirrored and transmitted in the network communication. Determining the mapping relationship helps to discover potential communication problems, such as packet loss, retransmission errors, or packet forgery. If the mapping relationship is found to be incorrect during the judgment process, it can help engineers quickly locate the cause of the problem and take corresponding corrective measures. This is especially important for system debugging, troubleshooting, performance optimization and other processes.
[0052] S3, obtaining a test result of the bus mirror data according to the mapping relationship.
[0053] In some embodiments, the test result is an evaluation result of whether the bus mirror data correctly reflects the bus original data. Specifically, based on the results of the mapping relationship analysis, a test report can be automatically generated, including information such as data matching, error records, and performance evaluation. The test results are statistically analyzed, such as data consistency rate, error rate, etc., and a detailed result summary is output. Then, the accuracy of the test results is verified to ensure that the test report accurately reflects the mapping relationship between the bus original data and the bus mirror data.
[0054] According to the vehicle bus mirror data testing method of the embodiment of the present invention, by adopting an automatic testing software tool, the bus original data and the bus mirror data can be automatically obtained, and the mapping relationship between the bus original data and the bus mirror data can be judged, so that the system can quickly identify and automatically analyze whether the bus mirror data correctly reflects the bus original data. This automated analysis process can verify whether the mirroring and transmission of the bus original data in the network communication are accurate. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data, and the test results can help engineers find and correct problems that may exist in the data transmission or mirroring process. Therefore, the method of the present invention can realize the automated operation of the entire test process through the automatic testing software tool, reduce the interference of human factors, reduce the complexity of the operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0055] In some embodiments, the bus raw data includes CAN (Controller Area Network) bus raw data, wherein the CAN bus raw data may be unprocessed data transmitted via the CAN bus protocol, and such data may include a CAN bus name, an identifier (CAN ID), a data field, a timestamp, and the like.
[0056] In some embodiments, the CAN bus raw data may include data transmitted by multiple different CAN channels (or CAN networks), such as BCAN, CCAN, ICAN, etc. Each CAN bus is responsible for different types of data transmission. Specifically, BCAN can be used to transmit data related to body control, such as doors, windows, lights, air conditioning control, etc. CCAN can be used to transmit data related to the vehicle chassis, such as braking system, steering system, suspension system data. ICAN can be used to transmit data of infotainment systems, such as audio, navigation, etc. Through multiple CAN buses, the data transmission of each system can be effectively managed and isolated to ensure the safety and reliability of the vehicle.
[0057] In some embodiments, the CAN bus raw data is collected by calling a CAN bus data collection interface, wherein the CAN bus data collection interface may be a hardware device for data interaction with multiple CAN buses, and may include a physical interface and a corresponding driver for extracting CAN bus raw data from different CAN networks (such as CCAN, BCAN, etc.) of the vehicle.
[0058] In some embodiments, the physical part of the CAN bus data acquisition interface can be a standard CAN transceiver chip, which can be directly electrically connected to the vehicle's CAN bus. These interfaces can support the input of multiple CAN signals and can process data from different CAN networks at the same time. In order to enable the hardware interface to communicate effectively with the automatic test software tool, the CAN bus data acquisition interface can be equipped with a dedicated driver and CAN protocol stack. The driver is responsible for managing the data transmission process of the hardware interface, while the protocol stack is used to parse the information in the CAN frame and convert it into a data format that can be processed by the software.
[0059] Furthermore, the automatic test software tool (such as the test software developed by Python script) obtains the CAN bus raw data by calling the API (application programming interface) of the CAN bus data acquisition interface. Then, the software tool can store, analyze and test the data as needed to verify the performance and reliability of various vehicle systems.
[0060] In some embodiments, the CAN bus data acquisition interface includes a PCAN interface, which supports multiple forms, including PCI card, USB adapter, PC card, etc., and is suitable for different types of computer devices. The PCAN interface can be used in application scenarios such as data acquisition and analysis, real-time monitoring, system debugging and diagnosis in vehicle network systems.
[0061] In some embodiments, the PCAN interface is called by loading PCANBasic.dll and PCANBasic.c to control the opening or closing of the PCAN interface. Among them, PCANBasic.dll is the dynamic link library file of the PCAN interface, which contains a series of functions for initialization, configuration, reading and writing CAN data, error handling, etc. Through these functions, users can easily control various operations of the PCAN interface. PCANBasic.c is a C language source file corresponding to PCANBasic.dll, which contains the specific implementation of these basic functions and sample codes. Developers can understand how to call the functions in PCANBasic.dll through the code in PCANBasic.c to implement specific operations on the PCAN interface, such as opening or closing the PCAN interface, sending or receiving CAN data frames, etc.
[0062] Specifically, the automatic test software tool can load PCANBasic.dll to obtain control over the PCAN interface. By loading this dynamic link library, the software can call the API functions provided therein. For example, the PCAN interface can be initialized by calling the CAN_Initialize function, or data can be read from a specified CAN channel by the CAN_Read function. PCANBasic.c provides examples and operation details for calling these APIs, and developers can refer to or directly use these codes to implement interface control. In some cases, PCANBasic.dll can be loaded by writing a script or program to dynamically control the opening or closing of the PCAN interface during the test. This process can involve operations such as initialization of the interface, management of data transmission, and resource release at the end of the test.
[0063] In some embodiments, it is important to control the opening and closing of the PCAN interface in the test process. The opening of the PCAN interface may include initializing the interface, setting the CAN baud rate, configuring filters, etc. to ensure that data can be accurately transmitted and received. Closing the interface may include stopping data transmission, releasing hardware resources, etc. to ensure the integrity and stability of the test process.
[0064] In some embodiments, the bus raw data also includes Ethernet bus raw data. Among them, the Ethernet bus raw data can be raw data that is not filtered or processed and transmitted through the vehicle Ethernet network. These data can include various data packets transmitted when the various systems of the vehicle communicate, such as control signals, diagnostic information, sensor data, etc. Ethernet has a wide range of application scenarios in vehicles, especially for systems that require high-speed and large data volume transmission, such as ADAS (Advanced Driver Assistance System) and IVI (In-Vehicle Infotainment System).
[0065] In some embodiments, the Ethernet bus raw data is collected by calling the Ethernet bus raw data interface (origin) of the switch. Among them, the switch is a network device used to forward data packets in the Ethernet network, which can process and manage data flows between different subsystems of the vehicle. The Ethernet bus raw data interface can be a dedicated interface on the switch for data interaction with the test system. This interface can capture and forward data packets from the in-vehicle Ethernet, so that the test system can obtain the original Ethernet data packets that have not been filtered or processed. By analyzing this data, engineers can evaluate the working status of the Ethernet bus, judge the network performance, and detect potential problems in the data transmission process.
[0066] In some embodiments, bus mirror data is collected by calling the bus mirror data interface of the switch. The bus mirror data is a network data packet copied and captured by the port mirroring function of the switch. The mirroring function can be used to monitor or debug the network, and the data stream received or sent by the specified port can be copied to another port, so that the test system can obtain these data in real time for analysis. The bus mirror data may include CAN bus mirror data and Ethernet bus mirror data. The CAN bus mirror data is a copy of the original data transmitted through the CAN network inside the vehicle, while the Ethernet bus mirror data is a copy of the original data transmitted through the Ethernet network inside the vehicle.
[0067] In some embodiments, the bus mirror data interface of the switch is an interface on the switch for managing and configuring the mirror function. Through this interface, the test system can instruct the switch to mirror the network traffic of a specified port to another monitoring port, thereby collecting this data for analysis. This interface supports controlling the mirror settings through API or configuration commands to ensure the accuracy and real-time nature of data collection.
[0068] In some embodiments, the bus mirror data interface of the switch is actually an Ethernet bus mirror data interface. This is because in modern vehicle networks, CAN bus mirror data can be encapsulated as the payload of an Ethernet frame and transmitted through an Ethernet network. One of the main reasons for encapsulating CAN bus mirror data into Ethernet frames is to expand its application range and transmission distance. Through this encapsulation method, CAN bus data can be transmitted in an Ethernet network and then collected through the Ethernet bus mirror data interface. This encapsulation technology enables CAN bus mirror data to be transmitted over longer distances or used in more complex networks, such as vehicle network architectures that span multiple network subsystems, increasing the flexibility of data transmission and the scalability of the network.
[0069] In some embodiments, determining the mapping relationship between the bus original data and the bus mirror data includes: calling network packet analysis software, parsing the payload data of the bus mirror data according to the mirroring rules, and comparing the payload data of the bus mirror data with the corresponding data of the bus original data to obtain the mapping relationship.
[0070] The network packet analysis software may be a tool software capable of capturing and analyzing network data packets, such as Wireshark or other customized software. In an embodiment, through the pyshark library, Wireshark can capture data packets transmitted through the bus mirror data interface, and perform preliminary decoding and analysis on these Ethernet mirror data, and convert the captured network traffic into an operable data format for subsequent processing. Therefore, the main task of the network packet analysis software is to capture and preliminarily parse network data, and its role is equivalent to a "captor" and "preliminary parser" of network data.
[0071] In some embodiments, the mirroring rules may be pre-set rules for judging and parsing bus mirroring data during the test process. These rules may include data format, frame structure, protocol requirements, etc., to ensure that the bus mirroring data can be correctly mapped back to the original bus data.
[0072] In some embodiments, the payload data is the core data portion contained in the bus mirror data, such as the frame data of the CAN bus or the application layer data of the Ethernet frame. By comparing the payload data extracted from the mirror data with the original bus data, it can be determined whether the data has maintained consistency during the mirroring process. This comparison can reveal whether the bus mirror data accurately reflects the original bus data, whether there is data loss, format error or other transmission problems.
[0073] Specifically, the mirror bus data captured from the Wireshark module is loaded into the data processing module, and the data processing module extracts the payload data part from the bus mirror data according to the mirroring rules. For the Ethernet-encapsulated CAN bus mirror data, the data processing module can extract key data from the payload, such as CAN ID and CAN bus name, and automatically determine the mapping relationship between the CAN ID and CAN bus name in the CAN bus mirror data and the CANID and CAN bus name in the CAN bus original data to determine whether they match correctly. For the Ethernet bus mirror data, the data processing module can extract the SOME / IP type message from the payload, and directly compare the Service ID in the SOME / IP message of the Ethernet bus mirror data and the Ethernet bus original data to determine whether the SOME / IP message of the Ethernet bus original data is correctly converted.
[0074] In some embodiments, the test result of the bus mirror data is obtained according to the mapping relationship, including: determining whether all the original bus data are successfully converted into bus mirror data and whether the mirror format is correct according to the mapping relationship. Among them, for the test result of the CAN bus mirror data, if the CAN ID and the CAN bus name in the CAN bus original data and the CAN bus mirror data are consistent, and the CAN frame format in the CAN bus mirror data complies with the CAN protocol specification, it can be indicated that all the original CAN bus data are successfully converted into CAN bus mirror data and the mirror format is correct. For the test result of the Ethernet bus mirror data, if the Service ID in the SOME / IP message of the Ethernet bus mirror data and the Ethernet bus original data matches each other, it can be indicated that all the original Ethernet bus data are successfully converted into Ethernet bus mirror data and the mirror format is correct.
[0075] Figure 2 FIG. 1 is a flow chart of an automatic test of vehicle bus mirror data according to an embodiment of the present invention. Figure 2 As shown, the vehicle bus mirror data automatic test process includes at least steps S10-S17.
[0076] S10, start.
[0077] S11, open the automatic test software tool, start the network packet analysis software, and open the Ethernet bus raw data interface to collect the Ethernet bus raw data and save it in the ".pcapng" format.
[0078] S12, sending a mirror function start instruction to start the mirror function.
[0079] S13, close the Ethernet bus raw data interface, and open the bus mirror data interface to collect Ethernet bus mirror data and save it in ".pcapng" format.
[0080] S14, collecting CAN bus raw data by calling the CAN bus data collection interface.
[0081] S15, parsing the effective load data of the bus mirror data according to the mirroring rule, and comparing the effective load data of the bus mirror data with the corresponding data of the CAN bus original data and the Ethernet bus original data to obtain a mapping relationship.
[0082] S16, determining whether all the original bus data are successfully converted into bus mirror data and whether the mirror format is correct according to the mapping relationship.
[0083] S17, end.
[0084] In general, the above processes or functions can be automatically executed with one click. That is, by using the automatic test software tool, the bus original data and bus mirror data can be automatically obtained, and the mapping relationship between the bus original data and the bus mirror data can be determined, so that the system can quickly identify and automatically analyze whether the bus mirror data correctly reflects the bus original data. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data, thereby realizing the automation of the entire test process, reducing the interference of human factors, reducing the complexity of the operation and the error rate in the test process, and improving the test efficiency and the accuracy of the test results.
[0085] Reference below Figure 3 An automated testing software tool according to an embodiment of the present invention is described.
[0086] Figure 3 is a schematic diagram of an automatic testing software tool according to an embodiment of the present invention, such as Figure 3 As shown, the automatic testing software tool 110 includes: a switch calling module 111 , a CAN bus data acquisition interface calling module 112 , a network packet analysis software calling module 113 , a diagnosis module 114 and a data processing module 115 .
[0087] In some embodiments, the main function of the switch calling module 111 is to control the opening and closing of the Ethernet bus original data interface and the bus mirror data interface respectively. Specifically, through the Python script, the user can enter the IP address and port number of the switch to realize remote calling and control of the switch interface.
[0088] In some embodiments, the CAN bus data acquisition interface calling module 112 is a software module for interacting with a CAN bus data acquisition interface (such as a PCAN interface). Specifically, the PCAN interface is called by loading PCANBasic.dll and PCANBasic.c to control the opening or closing of the PCAN interface.
[0089] In some embodiments, the network packet analysis software calling module 113 can capture and preliminarily parse Ethernet data packets by using the "pyshark" library or the command line tool of Wireshark (such as tshark).
[0090] In some embodiments, the diagnostic module 114 is used to send a mirror function start instruction, and establish an Ethernet bus connection and a CAN bus connection through the switch calling module 111 and the CAN bus data acquisition interface calling module 112 to obtain bus original data and bus mirror data.
[0091] In some embodiments, the diagnostic module 114 can implement vehicle Ethernet DoIP diagnosis and CAN message diagnosis. Among them, DoIP (Diagnostic over Internet Protocol) is a protocol for diagnosis via Ethernet, which is widely used in modern vehicle diagnostic systems. This function allows remote diagnosis and maintenance of the vehicle. CAN message diagnosis involves testing and analyzing data transmitted through the CAN bus. CAN is a standard protocol for internal communication in the vehicle, mainly used for data transmission between controllers and sensors.
[0092] Among them, in order to realize the DoIP diagnostic function of the vehicle Ethernet, the diagnostic module 114 can cooperate with the switch calling module 111 to send Ethernet messages through the switch calling module 111. The diagnostic interface includes inputting the destination IP, source IP, destination port, source port, destination logical address, source logical address interface, etc. In order to perform diagnosis, the computer diagnostic software must establish a TCP (Transmission Control Protocol) connection with the controller under test. Entering the correct network parameters (IP address, port number, etc.) is a prerequisite for establishing a connection. The diagnostic interface provides commonly used diagnostic functions, such as reading software and hardware version numbers, reading and writing vehicle identification numbers (VIN), etc. These functions are used to obtain basic information about the vehicle and perform routine inspections.
[0093] In some embodiments, in order to implement CAN message diagnosis, the diagnosis module 114 may cooperate with the CAN bus data acquisition interface calling module 112 to send CAN UDS messages through the CAN bus data acquisition interface calling module 112 to implement diagnosis of the CAN bus.
[0094] In some embodiments, the data processing module 115 is respectively connected to the diagnosis module 114, the switch calling module 111, the CAN bus data acquisition interface calling module 112 and the network packet analysis software calling module 113, and is used to determine the mapping relationship between the bus original data and the bus mirror data, and obtain the test results of the bus mirror data according to the mapping relationship.
[0095] Specifically, the data processing module 115 can load the CAN bus original data, CAN bus mirror data, Ethernet bus original data and Ethernet bus mirror data transmitted from each module. The data processing module 115 extracts the payload data part from the bus mirror data according to the mirroring rule. For the CAN bus mirror data, the data processing module 115 can extract key data such as CAN ID and CAN bus name from the payload, and automatically judge the mapping relationship between the CAN ID and CAN bus name in the CAN bus mirror data and the CAN ID and CAN bus name in the CAN bus original data, and judge whether they match correctly, so as to determine whether all the CAN bus original data are successfully converted into CAN bus mirror data and whether the mirroring format is correct. For the Ethernet bus mirror data, the data processing module 115 can extract the SOME / IP type message from the payload, and directly compare whether the Service ID in the SOME / IP message of the Ethernet bus mirror data and the Ethernet bus original data matches, so as to determine whether all the SOME / IP messages of the Ethernet bus original data are successfully converted into Ethernet bus mirror data and whether the mirroring format is correct.
[0096] According to the automatic test software tool 110 of the embodiment of the present invention, by integrating multiple functional modules, the tool can efficiently complete the automatic test of the vehicle bus mirror data. Specifically, the diagnostic module 114 is responsible for sending the mirror function start instruction, and establishing the Ethernet bus connection and the CAN bus connection through the switch calling module 111 and the CAN bus data acquisition interface calling module 112, so as to automatically obtain the bus original data and the bus mirror data. The data processing module 115 is connected to each calling module respectively, and is responsible for judging the mapping relationship between the bus original data and the bus mirror data, so that the system can quickly identify and automatically analyze whether the bus mirror data accurately reflects the bus original data. This automated analysis process can verify whether the mirroring and transmission of the bus original data in the network communication are accurate. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data. Therefore, the automatic test software tool 110 of the present invention realizes the automated data collection, analysis and test result output process by effectively integrating multiple functional modules, avoiding the cumbersomeness and potential errors in manual testing, thereby improving the test efficiency and the accuracy of the test results.
[0097] Reference below Figure 4 An electronic device according to an embodiment of the present invention is described.
[0098] Figure 4 is a block diagram of an electronic device according to an embodiment of the present invention, such as Figure 4 As shown, the electronic device 10 includes: a memory 12 and at least one processor 11.
[0099] In some embodiments, at least one processor 11 is configured with network packet analysis software, PCAN software and automatic test software. Among them, the network packet analysis software is used to capture and analyze data packets in network traffic. The PCAN software includes APIs (such as PCANBasic.dll and PCANBasic.c) for communicating with the CAN bus and performing the collection of CAN bus raw data. The automatic test software can be developed based on Python or other programming languages. By executing the test method of the vehicle bus mirror data described in the above embodiment, the automation of the entire test process is realized. It can perform all operations from data collection, analysis, judgment to result output, and can generate a test report according to the set test rules, thereby improving the test efficiency and the accuracy of the test results.
[0100] In some embodiments, the at least one processor 11 may be one processor 11, or may be two processors 11, three processors 11, five processors 11, eight processors 11, ten processors 11, or a plurality of processors 11. These processors 11 may be various types of general or special processors, such as a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), etc. It depends on the design and purpose of the electronic device 10.
[0101] In some embodiments, the memory 12 may be a random access memory (RAM), a read-only memory (ROM), a flash memory (Flash Memory), a solid state drive (SSD), etc. The selection of the memory 12 depends on the requirements and performance of the processor 11 to ensure that it can support real-time requirements and large-scale data processing. These memories 12 play an important role in storing and managing data, programs, and configuration information in the electronic device 10 to ensure normal operation of the system and data security.
[0102] In some embodiments, the memory 12 is communicatively connected to at least one processor 11, and the memory 12 stores a computer program that can be executed by at least one processor 11. When the at least one processor 11 executes the computer program, the vehicle bus mirror data testing method described in the above embodiment is implemented through automatic testing software.
[0103] In some embodiments, the electronic device 10 may be a computing device in various forms, such as a desktop computer, a laptop computer, an embedded system, a server, or a dedicated test device.
[0104] The electronic device 10 according to the embodiment of the present invention realizes the automation operation of the entire test process by adopting the vehicle bus mirror data testing method described in the above embodiment, reduces the interference of human factors, reduces the complexity of operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0105] Reference below Figure 5 A vehicle bus mirror data testing system according to an embodiment of the present invention is described.
[0106] Figure 5 FIG. 1 is a schematic diagram of a vehicle bus mirror data testing system according to an embodiment of the present invention. Figure 5 As shown, the vehicle bus mirror data testing system 1 includes: a switch 20, a CAN bus data acquisition interface 30 and the electronic device 10 described in the above embodiment.
[0107] In some embodiments, the switch 20 can use an existing industrial-grade Ethernet switch, supporting multi-port configuration and high-bandwidth data transmission. The switch 20 plays a core "data distribution and collection" role in the entire system. The switch 20 includes an Ethernet bus raw data interface and a bus mirror data interface. Among them, the Ethernet bus raw data interface is suitable for connecting to the vehicle gateway and the vehicle controller to collect the Ethernet bus raw data, and the bus mirror data interface is suitable for connecting to the vehicle gateway to collect the bus mirror data.
[0108] In some embodiments, the CAN bus data acquisition interface 30 is connected to the vehicle gateway via the vehicle CAN bus to collect the original data of the CAN bus. The CAN bus data acquisition interface 30 can be designed as a multi-channel system to simultaneously collect data from multiple CAN buses, such as BCAN, CCAN, ICAN, etc.
[0109] In some embodiments, the electronic device 10 is the data processing center of the entire vehicle bus mirror data test system 1. The electronic device 10 is connected to the switch 20 and the CAN bus data acquisition interface 30, and is responsible for receiving the CAN bus original data, Ethernet bus original data and bus mirror data from the switch 20 and the CAN bus data acquisition interface 30, and executes the vehicle bus mirror data test method described in the above embodiment through the internal automatic test software, and determines the mapping relationship between the bus original data and the bus mirror data, thereby obtaining the test result of the bus mirror data.
[0110] According to the vehicle bus mirror data test system 1 of the embodiment of the present invention, the electronic device 10 is connected with the switch 20 and the CAN bus data acquisition interface 30, and the comprehensive acquisition of the CAN bus original data, the Ethernet bus original data and the bus mirror data can be realized. By adopting the vehicle bus mirror data test method described in the above embodiment, by judging the mapping relationship between the bus original data and the bus mirror data, the system can quickly identify and automatically analyze whether the bus mirror data accurately reflects the bus original data. This automated analysis process can verify whether the mirroring and transmission of the bus original data in the network communication are accurate. By analyzing the mapping relationship, the system can automatically output the test results of the bus mirror data. Therefore, the vehicle bus mirror data test system 1 of the present invention can realize the automated operation of the entire test process, reduce the interference of human factors, reduce the complexity of the operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0111] Reference below Figure 6 A vehicle according to an embodiment of the present invention is described.
[0112] Figure 6 is a block diagram of a vehicle according to an embodiment of the present invention, Figure 6 As shown, the vehicle 100 includes an onboard gateway 2 , an onboard controller 3 , and the vehicle bus mirror data testing system 1 described in the above embodiments.
[0113] In some embodiments, the vehicle gateway 2 is the core hub of the vehicle's internal network, responsible for managing and forwarding data between different communication buses (such as CAN, Ethernet, etc.). It can not only connect various controllers inside the vehicle 100, but also connect external devices for data exchange and transmission of control instructions. The vehicle gateway 2 is connected to the vehicle bus mirror data test system 1 through a specific interface, and provides the bus original data and bus mirror data to the test system.
[0114] In some embodiments, the vehicle controller 3 may be an electronic control unit (ECU) inside the vehicle 100, responsible for executing specific control tasks, such as engine control, transmission control, body electronic control, etc. These controllers communicate with other system components through the vehicle network to exchange necessary sensor data and control instructions. The vehicle controller 3 is connected to the test system 1 for vehicle bus mirror data via Ethernet, and provides the bus raw data to the test system.
[0115] In some embodiments, the vehicle 100 may be various types of vehicles, including but not limited to fuel vehicles, hybrid vehicles, electric vehicles, etc.
[0116] The vehicle 100 according to the embodiment of the present invention realizes the automation operation of the entire test process by adopting the vehicle bus mirror data test system 1 described in the above embodiment, reduces the interference of human factors, reduces the complexity of operation and the error rate in the test process, thereby improving the test efficiency and the accuracy of the test results.
[0117] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.
[0118] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for testing vehicle bus mirror data, characterized in that: For automatic testing of software tools, the testing method includes: Obtain bus original data and bus mirror data; Determine the mapping relationship between the bus original data and the bus mirror data; A test result of the bus mirror data is obtained according to the mapping relationship.
2. The testing method according to claim 1, characterized in that: The bus original data includes CAN bus original data; The CAN bus raw data is collected by calling the CAN bus data collection interface; The bus original data also includes Ethernet bus original data; The Ethernet bus original data is collected by calling the Ethernet bus original data interface of the switch.
3. The testing method according to claim 2, characterized in that: The CAN bus data acquisition interface includes a PCAN interface, and the PCAN interface is called by loading PCANBasic.dll and PCANBasic.c to control the opening or closing of the PCAN interface.
4. The testing method according to claim 1, characterized in that: The bus mirror data is collected by calling the bus mirror data interface of the switch.
5. The testing method according to claim 1, characterized in that: The determining of the mapping relationship between the bus original data and the bus mirror data includes: Calling network packet analysis software to parse out the payload data of the bus mirror data according to the mirroring rules; The payload data of the bus mirror data is compared with the corresponding data of the bus original data to obtain the mapping relationship.
6. The testing method according to claim 5, characterized in that: The step of obtaining the test result of the bus mirror data according to the mapping relationship includes: It is determined according to the mapping relationship whether all the original bus data are successfully converted into the bus mirror data and whether the mirror format is correct.
7. An automatic testing software tool, characterized in that: include: Switch calling module, CAN bus data acquisition interface calling module and network packet analysis software calling module; The diagnostic module is used to send a mirror function start instruction, and establish an Ethernet bus connection and a CAN bus connection through the switch calling module and the CAN bus data acquisition interface calling module to obtain bus original data and bus mirror data; The data processing module is respectively connected to the diagnosis module, the switch calling module, the CAN bus data acquisition interface calling module and the network packet analysis software calling module, and is used to determine the mapping relationship between the bus original data and the bus mirror data, and obtain the test result of the bus mirror data according to the mapping relationship.
8. An electronic device, characterized in that: include: At least one processor, the at least one processor being configured with network packet analysis software, PCAN software and automatic testing software; a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and when the at least one processor executes the computer program, the vehicle bus mirror data testing method according to any one of claims 1 to 6 is implemented through the automatic testing software.
9. A vehicle bus mirror data testing system, characterized in that: include: A switch, the switch comprising an Ethernet bus original data interface and a bus mirror data interface, the Ethernet bus original data interface is suitable for connecting to a vehicle gateway and a vehicle controller to collect Ethernet bus original data, and the bus mirror data interface is suitable for connecting to the vehicle gateway to collect bus mirror data; A CAN bus data acquisition interface, which is connected to the vehicle gateway via the vehicle CAN bus and is used to collect CAN bus raw data; The electronic device as claimed in claim 8, wherein the electronic device is connected to the switch and the CAN bus data acquisition interface.
10. A vehicle, characterized in that: A test system comprising an on-board gateway, an on-board controller and the vehicle bus mirror data according to claim 10, wherein the on-board gateway and the on-board controller are respectively connected to the test system.