Communication test method and device based on vehicle-mounted controller
Through the communication testing method based on the on-board controller, the sender and receiver are automatically determined and the sending and processing strategies are set, which solves the problem of inefficiency of multi-device DDS communication function testing, and realizes efficient communication function and performance evaluation.
Patent Information
- Application Number
- CN202510555875.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-07-11
AI Technical Summary
The existing technology lacks efficient and convenient ways to automatically test the DDS communication function between multiple devices, which cannot meet the needs of communication reliability evaluation, performance indicator measurement and version iteration optimization in multi-device networking scenarios.
Based on the communication testing method of the on-board controller, by obtaining test tasks, determining the sender and receiver of the data packet, and setting the sending and processing strategies according to the communication function type, automatically completing the transmission, reception and result analysis of the data packet, supporting the testing of DDS communication functions and performance between multiple devices.
It realizes automated testing of DDS communication functions between multiple devices, quickly verify the correctness of communication functions, evaluate performance indicators, reduce labor costs, improve test efficiency and accuracy, and supports version optimization.
Smart Images

Figure CN120301795A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication testing, and particularly to a communication testing method and device based on a vehicle-mounted controller. Background Art
[0002] Data Distribution Service (DDS) is a technical specification for distributed real-time communication middleware. Adopting a publish-subscribe architecture and centered on data, it can configure various QoS (Quality of Service) policies to ensure the real-time, efficient, and flexible distribution of data.
[0003] In the field of DDS communication testing, it is usually divided into functional testing and performance testing. Existing solutions can only implement the DDS communication function testing of a single device. However, with the increasing complexity of distributed systems, the scenario of multi-device collaborative communication is increasing. The current technical problem is the lack of an efficient and convenient way to automatically test the DDS communication function between multiple devices, resulting in the inability to meet the requirements of communication reliability evaluation, performance index measurement, and version iteration optimization in the multi-device networking scenario. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a communication testing method and device based on a vehicle-mounted controller to solve the problem of the current lack of an efficient and convenient way to automatically test the DDS communication function between multiple devices.
[0005] In a first aspect, embodiments of the present invention provide a communication testing method based on a vehicle-mounted controller, the method including:
[0006] Obtain a test task of the vehicle-mounted data distribution service, where the test task includes the communication function to be tested in the data distribution service;
[0007] Based on the communication function, determine the sender and receiver of the data packet from the controller group, and determine the sending strategy and processing strategy corresponding to the data packet based on the task type of the test task, where the controller group includes at least two vehicle-mounted controllers;
[0008] Control the sender to send the data packet to the receiver according to the sending strategy;
[0009] Obtain the processing situation of the data packet by the receiver according to the processing strategy, and analyze the processing situation to obtain the test result corresponding to the communication function.
[0010] Further, the determining the sender and receiver of the data packet from the controller group based on the communication function includes:
[0011] If the communication function is the notification function, use the server in the controller group as the sender and the clients in the controller group as the receivers;
[0012] Or, if the communication function is the remote call function, use the clients in the controller group as the senders and the server in the controller group as the receivers;
[0013] Or, if the communication function is the throughput function, use the server in the controller group as the sender and the clients in the controller group as the receivers;
[0014] Or, if the communication function is the latency function, use the clients in the controller group as the senders and the server in the controller group as the receivers.
[0015] Further, controlling the sender to send data packets to the receiver according to the sending strategy includes:
[0016] If the communication function is the notification function, control the server to send N data packets to the client, where N is an integer greater than 1;
[0017] Or, if the communication function is the remote call function, control the client to send N data packets to the server, where N is an integer greater than 1;
[0018] Or, if the communication function is the throughput function, control the server to send data packets to the client according to the sending configuration parameters;
[0019] Or, if the communication function is the latency function, control the client to send the data packets and the corresponding sending timestamps of the data packets to the server.
[0020] Further, obtaining the processing situation of the data packets by the receiver according to the processing strategy and analyzing the processing situation to obtain the test result corresponding to the communication function includes:
[0021] If the communication function is the notification function, obtain whether the client receives the number of data packets within the preset time and the parsing situation of the data packets;
[0022] If the number of data packets received within the preset time reaches N and the parsing situation is that the data packets are successfully parsed, determine that the test is successful; or, if the number of data packets received within the preset time does not reach N, and / or the parsing situation is that the data packets are parsed failed, determine that the test fails.
[0023] Further, obtaining the processing situation of the data packet by the receiver according to the processing policy and analyzing the processing situation to obtain the test result corresponding to the communication function includes:
[0024] If the communication function is a remote call function, obtain the first feedback result of the server re-packaging and sending back N data packets.
[0025] Based on the first feedback result, analyze whether the number of data packets received by the client within a preset time and the parsing situation of the data packets.
[0026] If the number of data packets received within the preset time reaches N and the parsing situation is that the data packets are successfully parsed, determine that the test is successful; or, if the number of data packets received within the preset time does not reach N, and / or the parsing situation is that the data packets are parsed failed, determine that the test fails.
[0027] Further, obtaining the processing situation of the data packet by the receiver according to the processing policy and analyzing the processing situation to obtain the test result corresponding to the communication function includes:
[0028] If the communication function is a throughput function, count the number of data packets received by the client.
[0029] Obtain the sending quantity based on the sending configuration parameters, and calculate the packet loss rate based on the quantity and the sending quantity.
[0030] Take the packet loss rate as the test result.
[0031] Further, obtaining the processing situation of the data packet by the receiver according to the processing policy and analyzing the processing situation to obtain the test result corresponding to the communication function includes:
[0032] If the communication function is a latency function, obtain the second feedback result of the server re-packaging and sending back the data packet.
[0033] Based on the second feedback result, obtain the data packets received by the client and the corresponding receiving timestamps of the data packets.
[0034] Obtain the sending timestamp corresponding to the data packet.
[0035] Calculate the round-trip latency based on the sending timestamp and the receiving timestamp, and take the round-trip latency as the test result.
[0036] In a second aspect, an embodiment of the present invention provides a communication test device based on a vehicle-mounted controller, and the device includes:
[0037] An acquisition module, configured to acquire test tasks of an in-vehicle data distribution service, where the test tasks include communication functions;
[0038] A determination module, configured to determine a sender and a receiver of a data packet from a controller group based on the communication function, and determine a sending policy and a processing policy corresponding to the data packet based on the task type of the test task, where the controller group includes at least two in-vehicle controllers;
[0039] A control module, configured to control the sender to send the data packet to the receiver according to the sending policy;
[0040] An analysis module, configured to obtain the processing situation of the data packet by the receiver according to the processing policy, and analyze the processing situation to obtain a test result corresponding to the communication function.
[0041] In a third aspect, an embodiment of the present invention provides a computer device, including: a memory and a processor, which are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to execute the method according to the first aspect or any corresponding implementation manner thereof.
[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause a computer to execute the method according to the first aspect or any corresponding implementation manner thereof.
[0043] In the embodiment of the present application, by acquiring test tasks including communication functions, automatically determining the sender, receiver, sending policy, and processing policy in the controller group based on the functions, the automated testing of the DDS communication functions and performance between multiple devices is realized. Without manual intervention, data sending, receiving and processing, and result analysis can be completed, the correctness of communication functions such as announcements and remote calls in the multi-controller networking scenario can be quickly verified, performance indicators such as throughput and latency can be evaluated, the control variable method and vertical comparison of version results can be supported to optimize communication performance, the testing efficiency is significantly improved, the labor cost is reduced, and automated support is provided for the reliability evaluation and technology iteration of multi-device DDS communication in complex distributed systems.
[0044] In the embodiment of the present application for the announcement function, by setting a preset time and counting the number of data packets received by the client and the parsing situation, the integrity and accuracy of data transmission between multiple devices can be automatically verified. This method uses quantitative indicators (N data packets, parsing success rate) and time thresholds as the judgment basis, without manual checking of each packet one by one, quickly determines whether the function test passes, solves the problems of low efficiency and easy omission in traditional manual testing, and ensures the reliable distribution of data in the announcement scenario among multiple devices.
[0045] In the embodiments of the present application, for the remote call function, by obtaining the result returned by the server and analyzing the reception situation of the client, an automated test of the request - response mechanism among multiple devices is achieved. This process can accurately detect the correctness of data transmission back and forth between devices by verifying the number of returned data packets, parsing consistency, and timeliness, avoiding test delays caused by manual intervention, and efficiently verifying the reliability of the interaction logic of multiple devices in the remote call scenario.
[0046] In the embodiments of the present application, for the throughput function, by counting the number of received packets and calculating the packet loss rate in combination with the sending configuration parameters, the abstract communication performance is converted into quantifiable metrics. This method supports flexible adjustment of parameters such as the sending rate and packet size, automatically generates the packet loss rate results, and can quickly locate the performance bottleneck on the communication link of multiple devices without manual intervention, providing data support for evaluating the maximum throughput and optimizing the transmission strategy, and improving the efficiency and accuracy of the performance test of multiple devices.
[0047] In the embodiments of the present application, for the latency function, by recording the sending and receiving timestamps to calculate the round - trip latency, the test problem of clock asynchronization among multiple devices is solved. This method takes the automatic matching of timestamps and mathematical calculations as the core, and can accurately measure the communication latency without additional hardware synchronization devices. Combining average calculation further improves the effectiveness of the results, provides an automated test means for latency optimization in the real - time communication scenario of multiple devices, and significantly improves the efficiency and reliability of performance evaluation. Description of the Drawings
[0048] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0049] Figure 1 is a flowchart of a communication test method based on a vehicle - mounted controller according to some embodiments of the present invention;
[0050] Figure 2 is a schematic diagram of a test bench according to some embodiments of the present invention
[0051] Figure 3 is a flowchart of another communication test method based on a vehicle - mounted controller according to some embodiments of the present invention;
[0052] Figure 4 is a flowchart of another communication test method based on a vehicle - mounted controller according to some embodiments of the present invention;
[0053] Figure 5It is a flowchart of another communication test method based on an in-vehicle controller according to some embodiments of the present invention;
[0054] Figure 6 It is a schematic flowchart of another communication test method based on an in-vehicle controller according to some embodiments of the present invention;
[0055] Figure 7 It is a structural block diagram of a communication test device based on an in-vehicle controller according to an embodiment of the present invention;
[0056] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed implementation manners
[0057] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0058] According to an embodiment of the present invention, a communication test method and device based on an in-vehicle controller are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0059] In this embodiment, a communication test method based on an in-vehicle controller is provided. Figure 1 It is a flowchart of a communication test method based on an in-vehicle controller according to an embodiment of the present invention, as Figure 1 shown, and the process includes the following steps:
[0060] Step S101, obtain a test task of an in-vehicle data distribution service, where the test task includes a communication function to be tested in the data distribution service.
[0061] In an embodiment of the present application, as Figure 2As shown in the figure, the test bench is composed of a computer, an Ethernet converter, vehicle-mounted controller 1, and vehicle-mounted controller 2. There is an Ethernet converter between the computer (PC) and vehicle-mounted controller 1 (MPU1), and they are connected through a network cable and an Ethernet cable; the computer and vehicle-mounted controller 2 (MPU2) are connected through an Android Debug Bridge cable; vehicle-mounted controller 1 and vehicle-mounted controller 2 are connected through an Ethernet cable. Among them, the program on the computer side serves as the general console for test execution, responsible for operations such as uploading, starting, and checking results of the test program. The test program and the data distribution service library are also stored in the computer.
[0062] As the general console, the computer obtains test tasks (such as API interface calls, interface parameter configurations, etc.) through the test management system or manual input. The tasks include communication functions to be tested (such as DDS throughput, latency test, etc.). The computer analyzes the types of communication functions in the tasks (for example, the throughput test corresponds to the "send / receive as much as possible" scenario, and the latency test corresponds to the "reliable transmission" scenario), and extracts task parameters (such as packet size, transmission rate, number of tests, etc.).
[0063] Step S102: Determine the sender and receiver of the data packet from the controller group based on the communication function, and determine the corresponding sending strategy and processing strategy for the data packet based on the task type of the test task, where the controller group includes at least two vehicle-mounted controllers.
[0064] In the embodiment of the present application, determining the sender and receiver of the data packet from the controller group based on the communication function includes: if the communication function is an announcement function, then use the server in the controller group as the sender and the client in the controller group as the receiver; or, if the communication function is a remote call function, then use the client in the controller group as the sender and the server in the controller group as the receiver; or, if the communication function is a throughput function, then use the server in the controller group as the sender and the client in the controller group as the receiver; or, if the communication function is a latency function, then use the client in the controller group as the sender and the server in the controller group as the receiver.
[0065] Specifically, the sender and receiver in the controller group are determined according to different communication functions. For the announcement function or throughput function, the server is used as the sender and the client is used as the receiver. In the former case, the server sends N (N < 10 during functional testing) fixed data packets to the client, and the client records the test results after verifying the data correctness. In the latter case, QoS needs to be configured as "besteffort", and the server sends data at an adjustable rate, quantity, and data packet size. The client calculates the packet loss rate by counting the number of received packets. For the remote call function or latency function, the client is used as the sender and the server is used as the receiver. In the former case, the client sends N fixed data packets to the server, and the server repackages and sends them back for the client to verify data consistency. In the latter case, QoS needs to be configured as "reliable", the client sends data packets with timestamps, and after the server sends them back, the client calculates the round-trip latency and takes half of it as the one-way communication latency. The success or failure of the test cases for both functions is determined through the timeout mechanism and written into the result file.
[0066] It should be noted that the roles of the two vehicle-mounted controllers (MPUs) can be flexibly switched according to the test requirements. For example, in the announcement function or throughput function test, either MPU1 can be configured as the server to send data and MPU2 as the client to receive data, or vice versa with MPU2 as the server and MPU1 as the client. Similarly, in the remote call function or latency function test, MPU1 can be used as the client to send data, and MPU2 as the server to receive and send back, and vice versa. This role-switching mechanism enables the test to cover the performance of different controllers in different communication roles, ensuring the comprehensiveness and flexibility of the test and facilitating the verification of the reliability and functional correctness of two-way communication.
[0067] Step S103: Control the sender to send data packets to the receiver according to the sending strategy.
[0068] In the embodiment of the present application, controlling the sender to send data packets to the receiver according to the sending strategy includes: if the communication function is the announcement function, controlling the server to send N data packets to the client, where N is an integer greater than 1.
[0069] Specifically, when the communication function is the notification function, the control server sends N data packets (where N is an integer greater than 1) to the client. First, the server in the MPU establishes a communication connection with the client. Usually, the value of N is less than 10 during functional testing. After the client receives these data packets with fixed data, it will judge the correctness of the data. If the parsed data is the same as the data sent by the sending end, the data in this packet is considered correct. If the client fails to receive all the correct data within the timeout period, then this test case fails; on the contrary, if all the data is received correctly, the test case succeeds. Finally, the client will write the test result into a file. This method can quickly test the DDS notification function between MPUs, and the two MPUs can exchange the roles of the server and the client according to needs.
[0070] In the embodiment of the present application, controlling the sender to send data packets to the receiver according to the sending strategy includes: if the communication function is the remote call function, controlling the client to send N data packets to the server, where N is an integer greater than 1.
[0071] Specifically, if the communication function is the remote call function, the client will be controlled to send N (N is an integer greater than 1) data packets to the server. Similarly, first, the server in the MPU establishes a communication connection with the client. During functional testing, N is generally less than 10. After the client sends the data packets, the server receives these data and repackages them and sends them back to the client. After the client receives the returned data, it will judge whether the parsed data is the data it initially sent. If they are the same, the data in this packet is considered correct. If the client fails to receive all the correct data within the timeout period, the test case fails; if all the data is received correctly, the test case succeeds. The client will write the test result into a file. This method can quickly test the DDS request-response function between MPUs, and the two MPUs can also act as the server and the client for each other.
[0072] In the embodiment of the present application, controlling the sender to send data packets to the receiver according to the sending strategy includes: if the communication function is the throughput function, controlling the server to send data packets to the client according to the sending configuration parameters.
[0073] Specifically, if the communication function is the throughput function, the control server sends data packets to the client according to the sending configuration parameters. First, the test program needs to configure QoS as besteffort to ensure that the server sends as much as possible and the client receives as much as possible. After the server and the client in the MPU establish a communication connection, the server sends data packets according to the sending configuration parameters such as the rate, quantity, and data packet size that can be flexibly adjusted according to actual needs. The client receives the data packets and counts their number, calculates the packet loss rate through the formula "1 - (the number of received packets / the number of sent packets) * 100%", and writes the result into a file. This method can simply and quickly test the maximum throughput between different MPU controllers, that is, the maximum sending rate when no packets are lost, and can also obtain the DDS communication performance of multiple controllers through the control variable method. At the same time, it can record the results of different versions for vertical comparison to judge the optimization situation after DDS update and iteration.
[0074] In the embodiment of the present application, controlling the sender to send data packets to the receiver according to the sending strategy includes: if the communication function is the delay function, controlling the client to send data packets and the corresponding sending timestamps of the data packets to the server.
[0075] Specifically, when the communication function is the delay function, the client is controlled to send data packets and the corresponding sending timestamps of the data packets to the server. First, the test program needs to configure QoS as reliable to ensure that both ends can receive all data.
[0076] After the server and the client in the MPU establish a communication connection, the client sends data packets of a certain size, along with the timestamp of the sending moment of the data packets. After the server receives the data, it sends it back to the client. The client receives the data and records the timestamp of the receiving moment, subtracts the timestamp of the receiving moment from the timestamp of the sending moment to obtain the round-trip communication delay between the MPUs, and then divides the round-trip communication delay by 2 to obtain the communication delay between the controllers. Finally, the result is written into a file. This method solves the problem that the internal clocks of different controllers are different and cannot be directly calculated, and usually takes the average delay to make the result more effective.
[0077] Step S104, obtain the processing situation of the data packets by the receiver according to the processing strategy, and analyze the processing situation to obtain the test result corresponding to the communication function.
[0078] In the embodiment of the present application, the process of obtaining the processing situation of the data packets by the receiver according to the processing strategy and analyzing to obtain the test result is as follows: after the sender sends data packets according to the strategy corresponding to the communication function (such as the server sending fixed data in the notification function and the client sending timestamped data in the delay function), the receiver performs corresponding operations according to the processing strategy.
[0079] For example, in the notification function, the client needs to parse the data and verify whether it is consistent with the sender. In the remote call function, the client needs to compare the data returned by the server with the initially sent data for consistency. In the throughput function, the client needs to count the number of received packets to calculate the packet loss rate. In the latency function, the client needs to record timestamps and calculate the round-trip latency and one-way latency. After the receiver finishes processing, it writes the results (such as data correctness, packet loss rate value, latency value, etc.) to a file. The test system determines whether the test of the corresponding communication function is successful or generates performance metrics by reading the file content and combining with a timeout mechanism (such as whether all correct data is received within a specified time), thereby obtaining the test result.
[0080] In an embodiment of the present application, obtain the processing situation of the data packets by the receiver according to the processing strategy, and analyze the processing situation to obtain the test result corresponding to the communication function, such as Figure 3 shown, including the following steps:
[0081] Step S201, if the communication function is the notification function, obtain whether the client receives the number of data packets within a preset time, and the parsing situation of the data packets.
[0082] In an embodiment of the present application, when the communication function is the notification function, first ensure that a communication connection is established between the server and the client in the MPU. The server starts to send N data packets to the client according to the setting, where N is an integer greater than 1, and usually N < 10 in the functional test. On the client side, start a timing mechanism from the moment of receiving the data packets to record whether the time reaches the preset time.
[0083] For each data packet received by the client, parse the data packet, compare the parsed data with the data sent by the server. If the two are consistent, determine that the data packet is successfully parsed; otherwise, the parsing fails. At the same time, count the number of received data packets. After the preset time arrives, the client obtains the number of received data packets within this time period and the parsing situation of each data packet. The client will save this information, such as the received quantity, whether each data packet is successfully parsed, etc., to a file for subsequent viewing and analysis.
[0084] Step S202, if the number of received data packets reaches N within the preset time and the parsing situation is that the data packets are successfully parsed, determine that the test is successful; or, if the number of received data packets does not reach N within the preset time, and / or the parsing situation is that the data packets are parsed failed, determine that the test fails.
[0085] In the embodiment of the present application, check the number of received data packets counted within a preset time. If this number reaches N and the parsing of each data packet is successful, that is, the parsed data is consistent with the data sent by the server, then it can be determined that the test of this notification function is successful. On the contrary, if the number of data packets received by the client is less than N within the preset time, or there is at least one data packet whose parsing fails, that is, the parsed data is inconsistent with the data sent by the server, then it is determined that this test fails. Finally, the client will record the test result (success or failure) in a file for subsequent tracing and summarization of the test situation.
[0086] In the embodiment of the present application, for the notification function, by setting a preset time and counting the number of data packets received by the client and the parsing situation, the integrity and accuracy of data transmission between multiple devices can be automatically verified. This method uses quantitative indicators (N data packets, parsing success rate) and time thresholds as the judgment basis, without the need for manual verification of each packet one by one, quickly determines whether the function test passes, solves the problems of low efficiency and easy omission in traditional manual testing, and ensures the reliable distribution of data in the notification scenario among multiple devices.
[0087] In the embodiment of the present application, obtain the processing situation of the data packets by the receiving party according to the processing strategy, and analyze the processing situation to obtain the test result corresponding to the communication function, such as Figure 4 shown, including:
[0088] Step S301, if the communication function is a remote call function, obtain the first return result of the server re-packaging and returning N data packets.
[0089] In the embodiment of the present application, when the communication function is a remote call function, first, the client in the MPU establishes a communication connection with the server. The client sends N (N is an integer greater than 1, usually N < 10 during function testing) fixed data packets to the server according to the setting. After receiving these data packets, the server will perform a re-packaging operation on each data packet.
[0090] During this process, the server will process the received data and reorganize it into new data packets according to specific rules or formats. Then, the server returns the re-packaged N data packets to the client. During the process of the client receiving the data packets returned by the server, relevant return information is recorded, including whether the data packets are successfully received, the receiving time of each data packet, etc. The information recorded constitutes the first return result. At the same time, the client will save these first return results in a file for subsequent analysis and processing.
[0091] Step S302, based on the first return result, analyze whether the number of data packets received by the client within the preset time and the parsing situation of the data packets.
[0092] In an embodiment of the present application, after the client obtains the first feedback result, it starts to perform a detailed analysis. The client first checks the time information in the record to determine whether the time from the start of receiving the server feedback data packet to the current moment exceeds a preset time.
[0093] Next, the number of data packets actually received during this time period is counted. Then, for each received data packet, the client will perform a parsing operation. The client will compare the parsed data with the content of the data packet originally sent to the server by itself. If the two are consistent, it is determined that the data packet is successfully parsed; if not, it is determined that the data packet is failed to be parsed.
[0094] The client will record the number of received data packets within the preset time and the parsing situation of each data packet, and this information will be used to determine whether the test is successful subsequently.
[0095] Step S303, if the number of received data packets reaches N within the preset time and the parsing situation is that the data packet is successfully parsed, it is determined that the test is successful; or, if the number of received data packets does not reach N within the preset time, and / or the parsing situation is that the data packet is failed to be parsed, it is determined that the test is failed.
[0096] In an embodiment of the present application, the client determines the test result based on the number of received data packets within the preset time and the parsing situation of the data packets analyzed. If within the preset time, the number of data packets received by the client exactly reaches N, and the parsing results of all received data packets are successful, that is, the parsed data is consistent with the initially sent data, then it can be determined that the test of the remote call function this time is successful. On the contrary, if any of the following situations occurs, the test is failed: one is that within the preset time, the number of data packets received by the client does not reach N; the other is that there is at least one data packet with a parsing result of failure, that is, the parsed data is inconsistent with the initially sent data. The client will record the final test result (success or failure) in a file for subsequent viewing and further analysis and summary.
[0097] In an embodiment of the present application, for the remote call function, by obtaining the server feedback result and analyzing the client receiving situation, the automated test of the request - reply mechanism between multiple devices is realized. This process can accurately detect the correctness of data transmission back and forth between devices by verifying the quantity, parsing consistency and timeliness of the feedback data packets, avoid test delays caused by manual intervention, and efficiently verify the reliability of the interaction logic of multiple devices in the remote call scenario.
[0098] In an embodiment of the present application, obtain the processing situation of the data packet by the receiving party according to the processing strategy, and analyze the processing situation to obtain the test result corresponding to the communication function, such asFigure 5 As shown in, it includes:
[0099] Step S401: If the communication function is the throughput function, count the number of data packets received by the client.
[0100] In the embodiment of the present application, when the communication function is the throughput function, first, the QoS needs to be configured as "besteffort" in the test program to ensure that the server sends as much as possible and the client receives as much as possible.
[0101] After the server in the MPU establishes a communication connection with the client, the server sends a certain number of data packets to the client according to adjustable sending configuration parameters (such as rate, data packet size, etc.). The client starts a counter during the receiving process to count the successfully received data packets in real time. For each completely and correctly received data packet, the value of the counter is incremented by 1. The entire counting process continues until the server completes the sending of all data packets and actively ends the process. At this time, the client records the final value of the counter, which is used as the number of data packets received in this throughput function test.
[0102] Step S402: Obtain the sending quantity based on the sending configuration parameters, and calculate the packet loss rate based on the quantity and the sending quantity.
[0103] In the embodiment of the present application, the client obtains the sending configuration parameters of the server and extracts the preset number of data packets to be sent (that is, the total number planned to be sent by the server, denoted as S). Then, substitute the number of received data packets (denoted as R) counted in step S401 and the sending quantity S into the packet loss rate calculation formula: Packet loss rate = (1 - S / R) × 100%
[0104] During the calculation process, attention should be paid to the consistency of data types (such as all being integers) to avoid result deviation due to precision problems. If the server does not completely send all data packets (such as due to abnormal interruption), it is necessary to monitor the process status of the server through the PC-side program to confirm the actual sending quantity (if the process ends normally, the sending quantity is S, otherwise, the actual sending quantity needs to be obtained again) to ensure the accuracy of the calculation base.
[0105] Step S403: Take the packet loss rate as the test result.
[0106] In the embodiments of the present application, after the client completes the calculation of the packet loss rate, the result is written into the test result file in a specified format (such as a numerical percentage). This file usually contains information such as timestamps, test parameters (such as transmission rate, packet size), received quantity, sent quantity, and packet loss rate, which is convenient for subsequent analysis. After the PC-side program detects the end of the server process, it reads the file written by the client. If the packet loss rate is 0, it determines that the current transmission rate is the "maximum throughput without packet loss"; if the packet loss rate is greater than 0, it adjusts the transmission configuration parameters (such as reducing the rate) through the method of controlling variables and retests until the critical value is determined. In addition, the packet loss rate data can be used for horizontal and vertical comparisons of different MPU controllers or DDS versions to evaluate the communication performance and optimization effects.
[0107] In the embodiments of the present application, for the throughput function, the packet loss rate is calculated by counting the number of received packets and combining the transmission configuration parameters, converting the abstract communication performance into a quantifiable indicator. This method supports flexible adjustment of parameters such as transmission rate and packet size, automatically generates the packet loss rate result, and can quickly locate the performance bottleneck on the multi-device communication link without manual intervention, providing data support for evaluating the maximum throughput and optimizing the transmission strategy, and improving the efficiency and accuracy of multi-device performance testing.
[0108] In the embodiments of the present application, the processing situation of the data packets by the receiving party according to the processing strategy is obtained, and the test result corresponding to the communication function is obtained by analyzing the processing situation, such as Figure 6 shown, including:
[0109] Step S501, if the communication function is the delay function, obtain the second feedback result of the server re-packaging and sending back the data packet.
[0110] In the embodiments of the present application, when the communication function is the delay function, first, the test program needs to configure the QoS as reliable to ensure that both ends receive all data. After the client in the MPU establishes a communication connection with the server, the client sends data packets of a certain size and attaches the timestamp of the sending moment. After the server receives the data packet, it performs a re-packaging operation on it, which may involve adjusting the data format, header information, etc., but the sending timestamp in the data packet is retained. Then the server sends back the re-packaged data packet to the client. During the process of the client receiving the data packet sent back by the server, relevant feedback information will be recorded, including whether the data packet is successfully received, some characteristic information of each data packet, etc. These recorded information constitutes the second feedback result, and the client will save these results to a file for subsequent analysis.
[0111] Step S502, obtain the data packets received by the client and the corresponding receiving timestamps of the data packets based on the second feedback result.
[0112] In the embodiment of the present application, after the client obtains the second feedback result, it extracts relevant information from the saved result file. For each successfully received data packet, the client records the timestamp at the moment of its reception. During the extraction process, the client sorts and filters the data to ensure that only valid data packets and their corresponding reception timestamps are obtained. The client stores these data packets and the corresponding reception timestamps in a certain order, such as according to the packet number or the order of reception, for subsequent matching and calculation with the transmission timestamp.
[0113] Step S503: Obtain the transmission timestamp corresponding to the data packet.
[0114] In the embodiment of the present application, after the client sorts out the received data packets and reception timestamps, it finds the transmission timestamp corresponding to each received data packet from the information recorded when the client sent the data packet. Since the client has attached the timestamp of the sending moment to each data packet and recorded it when sending the data packet, the transmission timestamp corresponding to each received data packet can be accurately matched according to some identification information of the data packet, such as the packet number, the characteristics of the data content, etc. These transmission timestamps are associated with the corresponding reception timestamps to prepare for subsequent calculation of the round-trip delay.
[0115] Step S504: Calculate the round-trip delay based on the transmission timestamp and the reception timestamp, and use the round-trip delay as the test result.
[0116] In the embodiment of the present application, the client makes the obtained reception timestamps and the obtained transmission timestamps correspond one by one. For each pair of corresponding transmission timestamps and reception timestamps, subtracting the transmission timestamp from the reception timestamp gives the round-trip delay of the data packet.
[0117] The client will count and process the round-trip delays of all data packets, usually calculating the average round-trip delay to eliminate the influence of possible anomalies in the transmission process of individual data packets on the result. Finally, the calculated round-trip delay (which can be the average round-trip delay) is used as the result of this delay function test, and the result is written into a file for subsequent viewing and analysis.
[0118] In the embodiment of the present application, for the delay function, by recording the transmission and reception timestamps to calculate the round-trip delay, the test problem of clock asynchronization between multiple devices is solved. This method takes the automatic matching of timestamps and mathematical calculations as the core, and can accurately measure the communication delay without additional hardware synchronization devices. Combining the average calculation further improves the effectiveness of the result, provides an automated test method for delay optimization in the multi-device real-time communication scenario, and significantly improves the efficiency and reliability of performance evaluation.
[0119] In this embodiment, a communication test device based on a vehicle-mounted controller is further provided. This device is used to implement the above-mentioned embodiments and preferred implementation manners, and those that have been described will not be repeated. As used hereinafter, the term "module" can be a combination of software and / or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0120] This embodiment provides a communication test device based on a vehicle-mounted controller. As Figure 7 shown, it includes:
[0121] An acquisition module 701, configured to acquire a test task of a vehicle-mounted data distribution service, where the test task includes a communication function;
[0122] A determination module 702, configured to determine a sender and a receiver of a data packet from a controller group based on the communication function, and determine a sending policy and a processing policy corresponding to the data packet based on the task type of the test task, where the controller group includes at least two vehicle-mounted controllers;
[0123] A control module 703, configured to control the sender to send the data packet to the receiver according to the sending policy;
[0124] An analysis module 704, configured to acquire the processing condition of the data packet by the receiver according to the processing policy, and analyze the processing condition to obtain a test result corresponding to the communication function.
[0125] In the embodiment of the present application, the determination module 702 is configured to, if the communication function is a notification function, use the server in the controller group as the sender and the client in the controller group as the receiver; or, if the communication function is a remote call function, use the client in the controller group as the sender and the server in the controller group as the receiver; or, if the communication function is a throughput function, use the server in the controller group as the sender and the client in the controller group as the receiver; or, if the communication function is a latency function, use the client in the controller group as the sender and the server in the controller group as the receiver.
[0126] In the embodiment of the present application, the control module 703 is configured to, if the communication function is a notification function, control the server to send N data packets to the client, where N is an integer greater than 1; or, if the communication function is a remote call function, control the client to send N data packets to the server, where N is an integer greater than 1; or, if the communication function is a throughput function, control the server to send data packets to the client according to the sending configuration parameters; or, if the communication function is a latency function, control the client to send data packets and the corresponding sending timestamps of the data packets to the server.
[0127] In an embodiment of the present application, the analysis module 704, if the communication function is an announcement function, obtains whether the number of data packets received by the client within a preset time and the parsing situation of the data packets; if the number of data packets received within the preset time reaches N and the parsing situation is that the data packets are successfully parsed, it is determined that the test is successful; or, if the number of data packets received within the preset time does not reach N, and / or the parsing situation is that the data packets are parsed unsuccessfully, it is determined that the test is failed.
[0128] In an embodiment of the present application, the analysis module 704, if the communication function is a remote call function, obtains the first return result of the server re-packaging and returning N data packets; based on the first return result, analyzes whether the number of data packets received by the client within a preset time and the parsing situation of the data packets; if the number of data packets received within the preset time reaches N and the parsing situation is that the data packets are successfully parsed, it is determined that the test is successful; or, if the number of data packets received within the preset time does not reach N, and / or the parsing situation is that the data packets are parsed unsuccessfully, it is determined that the test is failed.
[0129] In an embodiment of the present application, the analysis module 704, if the communication function is a throughput function, counts the number of data packets received by the client; obtains the sending quantity based on the sending configuration parameters, and calculates the packet loss rate based on the quantity and the sending quantity; uses the packet loss rate as the test result.
[0130] In an embodiment of the present application, the analysis module 704, if the communication function is a delay function, obtains the second return result of the server re-packaging and returning the data packets; obtains the data packets received by the client and the corresponding receiving timestamps based on the second return result; obtains the sending timestamps corresponding to the data packets; calculates the round-trip delay based on the sending timestamps and the receiving timestamps, and uses the round-trip delay as the test result.
[0131] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of a computer device provided by an alternative embodiment of the present invention, as Figure 8As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting the components, including a high-speed interface and a low-speed interface. Each component communicates with each other using different buses and can be installed on a common motherboard or in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if needed, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a set of blade servers, or a multi-processor system).
[0132] The processor 10 can be a central processing unit, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above programmable logic device can be a complex programmable logic device, a field programmable gate array, a generic array logic, or any combination thereof.
[0133] Among them, the memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiments.
[0134] The memory 20 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the computer device presented by a kind of landing page of a small program, etc. In addition, the memory 20 can include a high-speed random access memory and can also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 can optionally include a memory remotely set relative to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0135] The memory 20 can include a volatile memory, such as a random access memory; the memory can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid-state drive; the memory 20 can also include a combination of the above types of memories.
[0136] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
[0137] Embodiments of the present invention also provide a computer-readable storage medium. The method according to the embodiments of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code that is originally stored in a remote storage medium or a non-transitory machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored as such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.
[0138] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A communication test method based on a vehicle-mounted controller, characterized in that, The method includes: Obtaining a test task for an in-vehicle data distribution service, where the test task includes a communication function to be tested in the data distribution service; Determining a sender and a receiver of a data packet from a controller group based on the communication function, and determining a sending policy and a processing policy corresponding to the data packet based on the task type of the test task, where the controller group includes at least two in-vehicle controllers; Controlling the sender to send the data packet to the receiver according to the sending policy; Obtaining the processing condition of the data packet by the receiver according to the processing policy, and analyzing the processing condition to obtain a test result corresponding to the communication function.
2. The method according to claim 1, wherein The determining the sender and the receiver of the data packet from the controller group based on the communication function includes: If the communication function is an announcement function, using the server in the controller group as the sender and the client in the controller group as the receiver; Or, if the communication function is a remote call function, using the client in the controller group as the sender and the server in the controller group as the receiver; Or, if the communication function is a throughput function, using the server in the controller group as the sender and the client in the controller group as the receiver; Or, if the communication function is a latency function, using the client in the controller group as the sender and the server in the controller group as the receiver.
3. The method according to claim 2, wherein The controlling the sender to send the data packet to the receiver according to the sending policy includes: If the communication function is an announcement function, controlling the server to send N data packets to the client, where N is an integer greater than 1; Or, if the communication function is a remote call function, controlling the client to send N data packets to the server, where N is an integer greater than 1; Or, if the communication function is a throughput function, controlling the server to send data packets to the client according to sending configuration parameters; Or, if the communication function is a latency function, controlling the client to send the data packet and the corresponding sending timestamp of the data packet to the server.
4. The method according to claim 2, characterized in that, The obtaining the processing condition of the data packet by the receiver according to the processing policy, and analyzing the processing condition to obtain a test result corresponding to the communication function includes: If the communication function is an announcement function, obtaining whether the client receives the number of data packets within a preset time and the parsing condition of the data packets; If the number of data packets received within the preset time reaches N and the parsing condition is that the data packets are successfully parsed, determining that the test is successful; or, if the number of data packets received within the preset time does not reach N, and / or the parsing condition is that the data packets are parsed failed, determining that the test fails.
5. The method according to claim 2, wherein The obtaining the processing condition of the data packet by the receiver according to the processing policy, and analyzing the processing condition to obtain a test result corresponding to the communication function includes: If the communication function is a remote call function, obtaining a first return result of the server re-packaging and returning N data packets; Analyze whether the client receives the number of data packets within a preset time based on the first feedback result, and the parsing situation of the data packets; If the number of received data packets reaches N within the preset time and the parsing situation is that the data packets are successfully parsed, determine that the test is successful; or, if the number of received data packets does not reach N within the preset time, and / or the parsing situation is that the data packets are parsed failed, determine that the test fails.
6. The method according to claim 2, wherein The obtaining the processing situation of the data packets by the receiving party according to the processing strategy and analyzing the processing situation to obtain the test result corresponding to the communication function includes: If the communication function is the throughput function, count the number of data packets received by the client; Obtain the sending quantity based on the sending configuration parameters, and calculate the packet loss rate based on the quantity and the sending quantity; Take the packet loss rate as the test result.
7. The method according to claim 2, characterized in that, The obtaining the processing situation of the data packets by the receiving party according to the processing strategy and analyzing the processing situation to obtain the test result corresponding to the communication function includes: If the communication function is the latency function, obtain the second feedback result of the server re-packaging and sending back the data packets; Obtain the data packets received by the client and the corresponding receiving timestamps based on the second feedback result; Obtain the sending timestamp corresponding to the data packets; Calculate the round-trip latency based on the sending timestamp and the receiving timestamp, and take the round-trip latency as the test result.
8. A communication test device based on a vehicle-mounted controller, characterized in that, The device includes: An obtaining module, configured to obtain a test task of an in-vehicle data distribution service, where the test task includes a communication function; A determining module, configured to determine a data packet sender and a receiver from a controller group based on the communication function, and determine a sending strategy and a processing strategy corresponding to the data packets based on the task type of the test task, where the controller group includes at least two in-vehicle controllers; A control module, configured to control the sender to send the data packets to the receiver according to the sending strategy; An analyzing module, configured to obtain the processing situation of the data packets by the receiving party according to the processing strategy and analyze the processing situation to obtain the test result corresponding to the communication function.
9. A computer device, characterized in that, Includes: A memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Computer instructions are stored on the computer-readable storage medium, and the computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 7.