CAN bus message signal simulation method and device, equipment and storage medium

By classifying CAN messages and constructing target simulation models, the problems of low efficiency and reliability in CAN bus simulation testing in existing technologies are solved, and efficient and reliable simulation testing is achieved.

CN121690899APending Publication Date: 2026-03-17SAIC GM WULING AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-26
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing CAN bus simulation tests, the calculation modules for the cyclic counting and checksum signals of a large number of CAN messages need to be built one by one. This results in redundant modeling work, low efficiency, and a cumbersome configuration process, which affects the efficiency and reliability of simulation tests.

Method used

Based on the cyclic counting signal characteristic parameters and checksum signal calculation algorithm of the messages to be simulated, multiple messages are classified, a target simulation model is constructed and compiled to generate an executable file, the simulation model is called upon receiving configuration parameters, the target signal value is generated and injected, and then sent through the bus interface.

Benefits of technology

It improves the efficiency and reliability of CAN bus simulation testing, simplifies the construction and maintenance of the simulation system, reduces manual configuration time and error probability, and realizes a seamless and automated closed loop between simulation calculation and real bus communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121690899A_ABST
    Figure CN121690899A_ABST
Patent Text Reader

Abstract

The invention discloses a CAN bus message signal simulation method, device and equipment and a storage medium, and the method comprises the steps: carrying out the classification of a plurality of to-be-simulated messages according to the feature parameters of cycle count signals in the to-be-simulated messages and / or the calculation algorithm of checksum signals, and obtaining a classification result; based on the classification result, constructing a target simulation model, and compiling the target simulation model to generate an executable file; receiving a configuration parameter of the to-be-simulated message, and calling and operating the executable file based on the configuration parameter to obtain a target signal value; and injecting the target signal value into the to-be-simulated message, and sending the to-be-simulated message through a bus interface. According to the CAN bus simulation test method and device, the multiple messages to be simulated are classified according to the characteristic parameters of the cycle counting signals in the messages to be simulated and / or the calculation algorithm of the checksum signals, the target simulation model is constructed and compiled based on the classification result, the executable file is called and operated based on the configuration parameters, and the efficiency and reliability of the CAN bus simulation test are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of CAN bus simulation technology, and in particular to a method, apparatus, device and storage medium for simulating CAN bus message signals. Background Technology

[0002] With the rapid development of automotive electronics and intelligent driving systems, the Controller Area Network (CAN) bus, as the core communication protocol of in-vehicle networks, is crucial for reliability and real-time performance. In CAN bus communication, to ensure the integrity and security of message transmission, signals such as a rolling counter and a checksum are typically defined within the message. The rolling counter is a counter that accumulates cyclically according to the message transmission cycle, used to identify lost or duplicate messages; the checksum is calculated using a specific algorithm on some or all of the data in the message, used to detect errors that may occur during data transmission. Therefore, in simulation testing of intelligent driving systems and vehicle electronic and electrical architectures, accurate and efficient simulation of the rolling counter and checksum signals in CAN bus messages is a key step in verifying system functionality and reliability.

[0003] Currently, in model-based simulation testing, tools such as Simulink are commonly used to simulate CAN bus messages. The conventional approach is to create a separate calculation module within the simulation model for each CAN message requiring simulation of cyclic counting and checksum signals. This calculation module is designed based on the specific position of the signal in the message data field (e.g., start byte, number of bits occupied, start bit, etc.) and the corresponding calculation rules (e.g., accumulation rules, checksum algorithms) to achieve real-time signal generation and embedding.

[0004] However, in practical engineering applications, the number of CAN messages involved in vehicle or system-level simulations is enormous, and the position, length, and calculation algorithms of the cycle count and checksum signals in their data fields often differ among different messages. This imposes significant limitations on existing simulation methods: First, for numerous messages using the same cycle count bit length or the same checksum algorithm, it is still necessary to establish redundant calculation modules for each one, resulting in redundant and inefficient modeling work, which in turn affects the efficiency of simulation testing; Second, each calculation module needs to be configured with signal position, length, and other parameters separately according to the corresponding message, a cumbersome and error-prone process that affects the reliability of simulation testing.

[0005] Therefore, there is an urgent need for a CAN bus message signal simulation method that can improve the efficiency and reliability of CAN bus simulation testing. Summary of the Invention

[0006] The main objective of this invention is to provide a CAN bus message signal simulation method, apparatus, device, and storage medium, aiming to solve the technical problems of low efficiency and reliability in existing CAN bus simulation testing.

[0007] To achieve the above objectives, the present invention provides a CAN bus message signal simulation method, the method comprising the following steps: Based on the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the simulated message, the multiple simulated messages are classified to obtain the classification results; Based on the classification results, a target simulation model is constructed, and the target simulation model is compiled to generate an executable file; The configuration parameters of the message to be simulated are received, and the executable file is called and run based on the configuration parameters to obtain the target signal value; The target signal value is injected into the message to be simulated and sent through the bus interface.

[0008] Optionally, the step of classifying multiple simulated messages based on the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the simulated message to obtain the classification result includes: Identify the message containing the loop count signal and the message containing the checksum signal from among multiple messages to be simulated; The simulated message containing the loop counting signal is classified into the first category based on the number of bits occupied by the loop counting signal, and the first classification result is obtained. The simulated message containing the checksum signal is classified into a second category according to the calculation algorithm of the checksum signal, and the second classification result is obtained. The first classification result and the second classification result are used as the classification result.

[0009] Optionally, the step of constructing a target simulation model based on the classification results and compiling the target simulation model to generate an executable file includes: For each category in the first classification result, a corresponding cyclic counting signal simulation model is constructed; For each category in the second classification result, a corresponding checksum signal simulation model is constructed; The cyclic counting signal simulation model and the checksum signal simulation model are used as target simulation models, and the target simulation models are compiled to generate an executable file.

[0010] Optionally, the step of constructing a corresponding cyclic counting signal simulation model for each category in the first classification result includes: For each category in the first classification result, a corresponding cyclic counting signal simulation model is constructed according to a preset cyclic counting rule; Accordingly, the step of constructing a corresponding checksum signal simulation model for each category in the second classification result includes: For each category in the second classification result, a corresponding checksum signal simulation model is constructed based on a preset checksum calculation algorithm.

[0011] Optionally, the step of receiving the configuration parameters of the message to be simulated, and calling and running the executable file based on the configuration parameters to obtain the target signal value includes: The simulation platform receives configuration parameters of the message to be simulated from user input via its front-end graphical user interface. These configuration parameters include at least the byte position of the loop counter signal in the message, the start bit of the bit, and the bit length, and / or the byte position of the checksum signal in the message and the range of signals involved in the checksum calculation. The configuration parameters are transmitted to the corresponding target simulation model via a signal transmission module. The target simulation model in the executable file is invoked and run to obtain the target signal value, which is the cycle count signal value and / or checksum signal value.

[0012] Optionally, the target simulation model is a checksum signal simulation model, and the step of calling and running the target simulation model in the executable file to obtain the target signal value includes: Based on the range of signals involved in the verification and calculation in the configuration parameters, obtain the corresponding signal value to be calculated; According to the preset checksum calculation algorithm corresponding to the checksum signal simulation model, the signal value to be calculated is accumulated to obtain the accumulation result; The accumulated result is moduloed by a preset value to obtain a checksum signal value.

[0013] Optionally, the step of injecting the target signal value into the message to be simulated and sending it through the bus interface includes: The target signal value is transmitted back to the signal channel corresponding to the message to be simulated in the simulation platform through the signal transmission module, so as to update the data of the corresponding signal in the message to be simulated; The updated message to be simulated is encapsulated into CAN bus frame data through the bus interface driver. The CAN bus frame data is sent to the CAN bus through the bus interface.

[0014] Furthermore, to achieve the above objectives, the present invention also proposes a CAN bus message signal simulation device, the device comprising: The message classification module is used to classify multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the message to be simulated, and to obtain the classification result; The model building module is used to build a target simulation model based on the classification results, and to compile the target simulation model to generate an executable file; The simulation calculation module is used to receive the configuration parameters of the message to be simulated, call and run the executable file based on the configuration parameters, and obtain the target signal value. The message sending module is used to inject the target signal value into the message to be simulated and send it through the bus interface.

[0015] Furthermore, to achieve the above objectives, the present invention also proposes a CAN bus message signal simulation device, the device comprising: a memory, a processor, and a CAN bus message signal simulation program stored in the memory and executable on the processor, the CAN bus message signal simulation program being configured to implement the steps of the CAN bus message signal simulation method described above.

[0016] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a CAN bus message signal simulation program, wherein when the CAN bus message signal simulation program is executed by a processor, the steps of the CAN bus message signal simulation method described above are implemented.

[0017] This invention discloses a method for classifying multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the checksum signal in the messages to be simulated, obtaining classification results; constructing a target simulation model based on the classification results, compiling the target simulation model to generate an executable file; receiving configuration parameters of the messages to be simulated, calling and running the executable file based on the configuration parameters to obtain target signal values; injecting the target signal values ​​into the messages to be simulated, and sending them through the bus interface. Because this invention classifies multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the checksum signal in the messages to be simulated, constructs a target simulation model based on the classification results, compiles the target simulation model to generate an executable file, and finally calls and runs the executable file based on the configuration parameters, compared with existing technologies, this invention improves the efficiency and reliability of CAN bus simulation testing. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating the first embodiment of the CAN bus message signal simulation method of the present invention. Figure 2This is a flowchart illustrating the second embodiment of the CAN bus message signal simulation method of the present invention; Figure 3 This is a flowchart illustrating the third embodiment of the CAN bus message signal simulation method of the present invention; Figure 4 This is a structural block diagram of the first embodiment of the CAN bus message signal simulation device of the present invention; Figure 5 This is a schematic diagram of the structure of a CAN bus message signal simulation device for the hardware operating environment involved in the embodiments of the present invention.

[0019] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0021] This invention provides a method for simulating CAN bus message signals, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the CAN bus message signal simulation method of the present invention.

[0022] In this embodiment, the CAN bus message signal simulation method includes steps S10~S40: Step S10: Based on the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the message to be simulated, classify the multiple messages to be simulated to obtain the classification results.

[0023] It should be noted that the execution subject of this embodiment can be a computer server device with data processing, network communication, and program execution functions applied in a CAN bus simulation scenario, such as a server, tablet computer, or personal computer, or an electronic device capable of performing the above functions (such as a CAN bus message signal simulation device). The following uses a simulation system (hereinafter referred to as the system) containing a CAN bus message signal simulation device as an example to illustrate this embodiment and the following embodiments.

[0024] It should be understood that the message to be simulated can refer to a CAN bus message that needs to be generated or processed in a simulated manner and contains specific signals (such as a cycle count signal and / or a checksum signal).

[0025] In a practical implementation, the IDs of all CAN bus messages containing a loop counter signal and / or a checksum signal can be counted to determine the message to be simulated.

[0026] Understandably, the cyclic counter signal is a signal embedded in the CAN message data field. Its value increases cyclically with each successful transmission of the message (e.g., from 0 to a maximum value and then back to zero). Its main function is to allow the receiver to determine whether the message is continuous and whether any data has been lost. The checksum signal is also a signal embedded in the CAN message data field. Its value is calculated based on data from other specific parts of the message (i.e., the data involved in the calculation) using a predefined mathematical algorithm (such as accumulation and modulo). Its main function is to allow the receiver to verify whether the message data has been corrupted or tampered with during transmission.

[0027] It should be noted that the number of bits occupied by the ring count signal (e.g., 4 bits, 8 bits, etc.) may differ in different messages to be simulated, and the calculation algorithm used for the checksum signal may also differ. By classification, messages with the same number of ring count bits can be grouped into one category, and a general ring count signal simulation model can be designed for this category. Similarly, messages using the same checksum algorithm can be grouped into another category, and a general checksum signal simulation model can be designed. In this way, messages of the same category can share the same simulation model, and only the specific position of their respective signals in the message needs to be distinguished by configuration parameters. This greatly simplifies the construction and maintenance of the simulation system, thereby improving the efficiency and reliability of CAN bus simulation testing.

[0028] In a specific implementation, a message containing a cyclic count signal and a message containing a checksum signal can be identified from multiple messages to be simulated. The message containing the cyclic count signal is classified into two categories based on the number of bits occupied by the cyclic count signal to obtain a first classification result. The message containing the checksum signal is classified into two categories based on the calculation algorithm of the checksum signal to obtain a second classification result. The first classification result and the second classification result are used as the classification result.

[0029] It should be understood that the number of bits occupied by the cyclic counting signal can refer to the number of binary bits (bits) that the signal occupies in the CAN message data field, which determines the maximum numerical range that the cyclic counting signal can represent.

[0030] It should be noted that the first classification result can refer to the result obtained by grouping all simulated messages containing a cyclic counting signal according to the specific characteristic of the number of bits occupied by the cyclic counting signal. For example, all messages with a 4-bit cyclic counting signal are classified into the first category, and messages with an 8-bit cyclic counting signal are classified into the second category, and so on.

[0031] It should be understood that the algorithm for calculating the checksum signal can refer to the specific mathematical rules used to calculate the checksum signal value from other data portions specified in the message.

[0032] It should be noted that the second classification result can refer to the result obtained by grouping all simulated messages containing checksum signals according to the calculation algorithm used for the checksum signal. For example, all messages using the "byte accumulation and take the lower 8 bits" algorithm are grouped into one category, and messages using the "byte-by-byte XOR" algorithm are grouped into another category.

[0033] Step S20: Based on the classification results, construct the target simulation model and compile the target simulation model to generate an executable file.

[0034] It should be noted that the target simulation model may include a cyclic counting signal simulation model and a checksum signal simulation model.

[0035] In a specific implementation, a corresponding cyclic counting signal simulation model can be constructed for each category in the first classification result; a corresponding checksum signal simulation model can be constructed for each category in the second classification result; the cyclic counting signal simulation model and the checksum signal simulation model can be used as target simulation models, and the target simulation models can be compiled to generate an executable file.

[0036] It should be understood that an executable file can refer to a file in a specific format (e.g., an .enb file) generated after the target simulation model has been compiled and processed, which can be recognized, loaded and called by the simulation platform (e.g., NI Veristand).

[0037] Understandably, compilation is a crucial technical step connecting the model design phase and the simulation execution phase. The target simulation model built in a model design environment (such as Simulink) is in its raw, development-oriented form and cannot be directly called by the core engine of real-time simulation platforms like NI Veristand. The compilation process converts the model code into a binary or specific intermediate code format that the platform's underlying drivers (such as the XNET AFP interface) can directly and efficiently manipulate, thus achieving language unification and seamless integration between the model and the simulation platform. Furthermore, the compilation process typically includes code optimization; the generated executable file, when run on the simulation platform, has faster computation speed and lower resource consumption, further improving the efficiency of CAN bus simulation testing.

[0038] It should be noted that, for each category in the first classification result, a corresponding cyclic counting signal simulation model can be constructed according to a preset cyclic counting rule; correspondingly, for each category in the second classification result, a corresponding checksum signal simulation model can be constructed according to a preset checksum calculation algorithm.

[0039] It should be explained that all simulated messages with the same number of bits occupied by the cyclic counting signal use the same cyclic counting signal simulation model. The cyclic counting signal simulation model is designed according to a preset cyclic counting rule. For example, the cyclic counting adopts a cyclic accumulation rule, that is, the cyclic counting signal accumulates according to the message sending cycle. After reaching the maximum value, it starts accumulating again from 0. The maximum value of the cyclic count is determined by the number of bits occupied. The cyclic counting signal simulation model is designed according to the cyclic counting rule. A counter variable is set in the model. The model uses the message sending cycle as the running step size and performs a cyclic increment operation on the counter variable. When the counter variable reaches the maximum value of the cyclic count, the counter variable is cleared and the cyclic increment operation is repeated. The counter variable is output through the model and mapped to the cyclic counting signal of the simulated message to complete the real-time calculation of the cyclic counting signal.

[0040] Accordingly, messages to be simulated using the same checksum calculation algorithm are uniformly modeled using the same checksum simulation model. The checksum simulation model is designed according to a preset checksum calculation algorithm. For example, the checksum uses a message signal non-carry accumulation algorithm, that is, all message signals involved in the checksum calculation are accumulated, with a maximum of 8 bits of data retained. The checksum simulation model is designed according to the checksum calculation algorithm. The model input is the value of all message signals involved in the checksum calculation. The simulation platform transmits the message signal values ​​involved in the calculation to the checksum simulation model using the signal transmission module according to the parameters configured in the front-end GUI interface. The checksum simulation model performs an addition operation on the input signal values, and finally retains 8 bits of valid data as output variables through a modulo operation of 255. The output variables are mapped to the checksum signal of the message to be simulated to complete the real-time calculation of the checksum signal.

[0041] Step S30: Receive the configuration parameters of the message to be simulated, call and run the executable file based on the configuration parameters, and obtain the target signal value.

[0042] It should be noted that the configuration parameters include at least the byte position of the cyclic counter signal in the message, the start bit of the bit, and the bit length, and / or the byte position of the checksum signal in the message and the range of signals involved in the checksum calculation.

[0043] It should be understood that the range of signals involved in the checksum calculation can refer to which part of the message data the checksum calculation needs to cover, usually the start and end byte positions involved in the calculation, thereby determining the range of data input to the checksum signal simulation model.

[0044] It should be noted that the target signal value is the output of the simulation process and will ultimately be injected or mapped to a specified location in the message to be simulated, forming a complete and sendable simulation message. The target signal value is the cycle count signal value and / or checksum signal value.

[0045] Understandably, the cycle count signal value can be a number that increments cyclically according to the transmission cycle (e.g., 0, 1, 2, ..., 15, 0, 1...). The checksum signal value can be a checksum calculated based on a specific data segment of the message (e.g., a value between 0 and 255).

[0046] Step S40: Inject the target signal value into the message to be simulated and send it through the bus interface.

[0047] It should be noted that the bus interface can refer to the hardware and driver layer interface used to connect the simulation system to the real physical CAN bus, such as a CAN simulation board. Its core function is to complete the conversion and transmission of signals from the simulation software environment to the physical signal.

[0048] In a specific implementation, the target signal value can be injected into the message to be simulated to obtain complete CAN bus message data, and then the complete CAN bus message data can be sent to the CAN bus through the bus interface.

[0049] This embodiment discloses a method for classifying multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the checksum signal in the messages to be simulated, obtaining classification results; constructing a target simulation model based on the classification results, compiling the target simulation model to generate an executable file; receiving configuration parameters of the messages to be simulated, calling and running the executable file based on the configuration parameters to obtain target signal values; injecting the target signal values ​​into the messages to be simulated, and sending them through the bus interface. Because this embodiment classifies multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the checksum signal in the messages to be simulated, constructs a target simulation model based on the classification results, compiles the target simulation model to generate an executable file, and finally calls and runs the executable file based on the configuration parameters, compared with the prior art, this embodiment improves the efficiency and reliability of CAN bus simulation testing.

[0050] refer to Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the CAN bus message signal simulation method of the present invention.

[0051] Based on the first embodiment described above, in this embodiment, step S30 includes steps S301 to S303: Step S301: Receive configuration parameters of the message to be simulated from the user input through the front-end graphical user interface of the simulation platform. The configuration parameters include at least the byte position of the cyclic counter signal in the message, the start bit of the bit, and the bit length, and / or the byte position of the checksum signal in the message and the range of signals involved in the checksum calculation.

[0052] Step S302: Transmit the configuration parameters to the corresponding target simulation model through the signal transmission module.

[0053] Step S303: Call and run the target simulation model in the executable file to obtain the target signal value, wherein the target signal value is the loop count signal value and / or checksum signal value.

[0054] It should be understood that a simulation platform can refer to a specific software environment with complete real-time simulation management capabilities. The simulation platform in this embodiment and the following embodiments is NI VeriStand as an example.

[0055] Understandably, the signal transmission module can be a functional component or data path mechanism within the simulation platform. It can reliably transfer data and parameters between different parts of the simulation platform.

[0056] It should be noted that the front-end graphical user interface of the simulation platform (i.e., the NI_Veristand front-end GUI interface) can be used to directly set the parameters related to the cyclic counting signal and checksum signal of different messages without changing the simulation model, which greatly simplifies the operation process. Especially when dealing with hundreds or thousands of CAN messages with different signal positions and algorithms, it can not only reduce manual configuration time and error probability, but also improve the flexibility and maintainability of CAN bus simulation testing.

[0057] In practical implementation, an NI_Veristand project can be created, and the configuration parameters of the message to be simulated can be configured using the NI_Veristand front-end GUI interface. Then, the configuration parameters input by the user in the NI_Veristand front-end GUI interface are transmitted to the target simulation model through the signal transmission module. Next, the target simulation model in the executable file is called and run by the NI_Veristand underlying driver to complete the calculation of the target signal value. Finally, the target signal value is transmitted to the corresponding signal channel of NI_Veristand XNET through the signal transmission module, and the data is sent to the bus through the CAN simulation board.

[0058] It should be noted that after creating the NI_Veristand project and configuring the parameters of the message to be simulated using the NI_Veristand front-end GUI interface, the NI_Veristand project can be downloaded to the lower-level machine for execution to complete the simulation of the CAN bus message cyclic counting signal and checksum signal.

[0059] It should be noted that when the target simulation model is a checksum signal simulation model, the step of calling and running the target simulation model in the executable file to obtain the target signal value includes: obtaining the corresponding signal value to be calculated according to the signal range participating in the checksum calculation in the configuration parameters; accumulating the signal value to be calculated according to the preset checksum calculation algorithm corresponding to the checksum signal simulation model to obtain the accumulation result; and performing a modulo operation on the accumulation result with a preset value (e.g., 255) to obtain the checksum signal value.

[0060] Accordingly, when the target simulation model is a cyclic counting signal simulation model, the step of calling and running the target simulation model in the executable file to obtain the target signal value includes: determining the current stored value of the cyclic counting signal according to the byte position, bit start bit, and bit length of the cyclic counting signal in the message in the configuration parameters; updating the current stored value according to the preset cyclic counting rule corresponding to the cyclic counting signal simulation model to obtain the cyclic counting signal value.

[0061] It should be understood that the current stored value can refer to the value of the cyclic counting signal at the current calculation moment during the simulation process, which was previously generated and stored or mapped to the corresponding message. This value is the reference value for the cyclic counting signal simulation model to perform the next accumulation or update operation.

[0062] It should be noted that the step of updating the current stored value to obtain the cyclic counting signal value according to the preset cyclic counting rule corresponding to the cyclic counting signal simulation model includes: incrementing the current stored value by one with the transmission period of the message to be simulated as the running step size; determining whether the updated value has reached the maximum count value determined by the bit length; if so, resetting the updated value to the initial value; otherwise, keeping the updated value; and using the reset or kept value as the cyclic counting signal value.

[0063] This embodiment discloses receiving configuration parameters of the message to be simulated from user input via a front-end graphical user interface of a simulation platform. These configuration parameters include at least the byte position, start bit, and bit length of the loop counter signal in the message, and / or the byte position and range of the checksum signal involved in the checksum calculation. The configuration parameters are then transmitted to the corresponding target simulation model via a signal transmission module. The target simulation model in the executable file is then called and run to obtain the target signal value, which is the loop counter signal value and / or the checksum signal value. Because this embodiment receives the configuration parameters of the message to be simulated from user input via the front-end graphical user interface of the simulation platform, then transmits the configuration parameters to the corresponding target simulation model via a signal transmission module, and finally calls and runs the target simulation model in the executable file to obtain the target signal value, compared to existing technologies, this embodiment improves the flexibility and maintainability of CAN bus simulation testing.

[0064] refer to Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the CAN bus message signal simulation method of the present invention.

[0065] Based on the above embodiments, in this embodiment, step S40 includes steps S401 to S403: Step S401: The target signal value is transmitted back to the signal channel corresponding to the message to be simulated in the simulation platform through the signal transmission module, so as to update the data of the corresponding signal in the message to be simulated.

[0066] Step S402: Encapsulate the updated message to be simulated into CAN bus frame data through the bus interface driver.

[0067] Step S403: Send the CAN bus frame data to the CAN bus through the bus interface.

[0068] It should be noted that in the software architecture of simulation platforms (such as NI Veristand), a signal channel is a pre-defined memory location or data path used to store and transmit a specific signal value. Each cyclic count signal or checksum signal of the message to be simulated has a unique signal channel corresponding to it within the platform.

[0069] It should be understood that the bus interface driver can refer to the low-level software program (driver) that controls the physical or virtual CAN bus hardware interface. Its main function is to follow the CAN protocol standard and convert the message data prepared by the upper-layer software (i.e., the updated message to be simulated) into electrical signal commands (i.e., CAN bus frame data) that the hardware can recognize and send.

[0070] It should be explained that CAN bus frame data can refer to a complete data sequence that conforms to the CAN bus protocol standard format.

[0071] This embodiment discloses a method for transmitting the target signal value back to the signal channel corresponding to the message to be simulated in the simulation platform via the signal transmission module to update the data of the corresponding signal in the message to be simulated; encapsulating the updated message to be simulated into CAN bus frame data through the bus interface driver; and sending the CAN bus frame data to the CAN bus through the bus interface. Because this embodiment transmits the target signal value back to the signal channel corresponding to the message to be simulated in the simulation platform via the signal transmission module, then encapsulates the updated message to be simulated into CAN bus frame data, and finally sends the CAN bus frame data to the CAN bus through the bus interface, compared to existing technologies, this embodiment achieves a seamless and automated closed loop between simulation calculation and real bus communication, ensuring the realism and efficiency of the simulation test.

[0072] Furthermore, this embodiment of the invention also proposes a storage medium storing a CAN bus message signal simulation program, which, when executed by a processor, implements the steps of the CAN bus message signal simulation method described above.

[0073] Reference Figure 4 , Figure 4 This is a structural block diagram of the first embodiment of the CAN bus message signal simulation device of the present invention.

[0074] like Figure 4 As shown, the CAN bus message signal simulation device proposed in this embodiment of the invention includes: a message classification module 501, a model construction module 502, a simulation calculation module 503, and a message sending module 504.

[0075] The message classification module 501 is used to classify multiple messages to be simulated according to the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the message to be simulated, and obtain the classification result.

[0076] The model building module 502 is used to build a target simulation model based on the classification results, and to compile the target simulation model to generate an executable file.

[0077] The simulation calculation module 503 is used to receive the configuration parameters of the message to be simulated, call and run the executable file based on the configuration parameters, and obtain the target signal value.

[0078] The message sending module 504 is used to inject the target signal value into the message to be simulated and send it through the bus interface.

[0079] The message classification module 501 is further configured to: identify, among multiple messages to be simulated, a message containing a cyclic count signal and a message containing a checksum signal; classify the message containing the cyclic count signal into a first category based on the number of bits occupied by the cyclic count signal, and obtain a first classification result; classify the message containing the checksum signal into a second category based on the checksum signal calculation algorithm, and obtain a second classification result; and use the first classification result and the second classification result as the classification result.

[0080] The model building module 502 is further configured to build a corresponding cyclic counting signal simulation model for each category in the first classification result; build a corresponding checksum signal simulation model for each category in the second classification result; use the cyclic counting signal simulation model and the checksum signal simulation model as target simulation models, and compile the target simulation models to generate an executable file.

[0081] The model building module 502 is also used to build a corresponding cyclic counting signal simulation model for each category in the first classification result according to a preset cyclic counting rule.

[0082] The model building module 502 is also used to build a corresponding checksum signal simulation model for each category in the second classification result according to a preset checksum calculation algorithm.

[0083] This device embodiment discloses a method for classifying multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the messages to be simulated, obtaining classification results; constructing a target simulation model based on the classification results, compiling the target simulation model to generate an executable file; receiving configuration parameters of the messages to be simulated, calling and running the executable file based on the configuration parameters to obtain target signal values; injecting the target signal values ​​into the messages to be simulated, and sending them through the bus interface. Because this device embodiment classifies multiple messages to be simulated based on the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the messages to be simulated, constructs a target simulation model based on the classification results, compiles the target simulation model to generate an executable file, and finally calls and runs the executable file based on the configuration parameters, compared with the prior art, this device embodiment improves the efficiency and reliability of CAN bus simulation testing.

[0084] Based on the first embodiment of the CAN bus message signal simulation device of the present invention, a second embodiment of the CAN bus message signal simulation device of the present invention is proposed.

[0085] In this embodiment, the simulation calculation module 503 is further configured to receive configuration parameters of the message to be simulated input by the user through the front-end graphical user interface of the simulation platform. The configuration parameters include at least the byte position, bit start bit, and bit length of the loop counter signal in the message and / or the byte position and range of the checksum signal in the message. The configuration parameters are then transmitted to the corresponding target simulation model through the signal transmission module. The target simulation model in the executable file is called and run to obtain the target signal value, which is the loop counter signal value and / or the checksum signal value.

[0086] The simulation calculation module 503 is further configured to obtain the corresponding signal value to be calculated according to the range of signals participating in the checksum calculation in the configuration parameters; accumulate the signal value to be calculated according to the preset checksum calculation algorithm corresponding to the checksum signal simulation model to obtain the accumulation result; and perform a modulo operation on the accumulation result with a preset value to obtain the checksum signal value.

[0087] This device embodiment receives configuration parameters of the message to be simulated input by the user through the front-end graphical user interface of the simulation platform, then transmits the configuration parameters to the corresponding target simulation model through the signal transmission module, and finally calls and runs the target simulation model in the executable file to obtain the target signal value. Compared with the prior art, this device embodiment improves the flexibility and maintainability of CAN bus simulation testing.

[0088] Based on the above embodiments of the CAN bus message signal simulation device of the present invention, a third embodiment of the CAN bus message signal simulation device of the present invention is proposed.

[0089] In this embodiment, the message sending module 504 is further configured to transmit the target signal value back to the signal channel corresponding to the message to be simulated in the simulation platform through the signal transmission module, so as to update the data of the corresponding signal in the message to be simulated; encapsulate the updated message to be simulated into CAN bus frame data through the bus interface driver; and send the CAN bus frame data to the CAN bus through the bus interface.

[0090] This embodiment of the device transmits the target signal value back to the signal channel corresponding to the message to be simulated in the simulation platform through the signal transmission module. Then, the updated message to be simulated is encapsulated into CAN bus frame data, and finally the CAN bus frame data is sent to the CAN bus through the bus interface. Compared with the prior art, this embodiment of the device realizes a seamless and automated closed loop between simulation calculation and real bus communication, ensuring the authenticity and efficiency of simulation testing.

[0091] Other embodiments or specific implementations of the CAN bus message signal simulation device of the present invention can be referred to the above-described method embodiments, and will not be repeated here.

[0092] This application provides a CAN bus message signal simulation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the CAN bus message signal simulation method in the above embodiment 1.

[0093] The following is for reference. Figure 5 This document illustrates a structural schematic diagram of a CAN bus message signal emulation device suitable for implementing embodiments of this application. The CAN bus message signal emulation device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 5 The CAN bus message signal simulation device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0094] like Figure 5As shown, the CAN bus message signal emulation device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the CAN bus message signal emulation device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the CAN bus message signal emulation device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows CAN bus message signal emulation devices with various systems, it should be understood that implementation or having all of the systems shown is not required. More or fewer systems may be implemented alternatively.

[0095] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0096] The CAN bus message signal simulation device provided in this application, employing the CAN bus message signal simulation method described in the above embodiments, can solve the technical problem of low efficiency and reliability in existing CAN bus simulation testing. Compared with the prior art, the beneficial effects of the CAN bus message signal simulation device provided in this application are the same as those of the CAN bus message signal simulation method provided in the above embodiments, and other technical features of this CAN bus message signal simulation device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0097] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0098] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0099] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0100] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0101] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0102] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the protection scope of the present invention.

Claims

1. A method for simulating CAN bus message signals, characterized in that The method comprises: According to the characteristic parameters of the loop count signal and / or the calculation algorithm of the checksum signal in the to-be-simulated message, a plurality of to-be-simulated messages are classified to obtain a classification result; Based on the classification result, a target simulation model is constructed, and the target simulation model is compiled to generate an executable file; Receiving the configuration parameters of the to-be-simulated message, calling and running the executable file based on the configuration parameters to obtain a target signal value; The target signal value is injected into the to-be-simulated message, and is sent through a bus interface.

2. The CAN bus message signal emulation method of claim 1, wherein, The step of classifying a plurality of to-be-simulated messages according to the characteristic parameters of the loop count signal and / or the calculation algorithm of the checksum signal in the to-be-simulated message to obtain a classification result comprises: Determine the to-be-simulated message containing the loop count signal and the to-be-simulated message containing the checksum signal in a plurality of to-be-simulated messages; According to the number of bits occupied by the loop count signal, the to-be-simulated message containing the loop count signal is first classified to obtain a first classification result; According to the calculation algorithm of the checksum signal, the to-be-simulated message containing the checksum signal is second classified to obtain a second classification result; The first classification result and the second classification result are taken as the classification result.

3. The CAN bus message signal emulation method of claim 2, wherein, The step of constructing a target simulation model based on the classification result and compiling the target simulation model to generate an executable file comprises: For each category in the first classification result, a corresponding loop count signal simulation model is constructed; For each category in the second classification result, a corresponding checksum signal simulation model is constructed; The loop count signal simulation model and the checksum signal simulation model are taken as the target simulation model, and the target simulation model is compiled to generate an executable file.

4. The CAN bus message signal emulation method of claim 3, wherein, The step of constructing a corresponding loop count signal simulation model for each category in the first classification result comprises: For each category in the first classification result, a corresponding loop count signal simulation model is constructed according to a preset loop count rule; Correspondingly, the step of constructing a corresponding checksum signal simulation model for each category in the second classification result comprises: For each category in the second classification result, a corresponding checksum signal simulation model is constructed according to a preset checksum calculation algorithm.

5. The CAN bus message signal emulation method of claim 1, wherein, The step of receiving the configuration parameters of the to-be-simulated message, calling and running the executable file based on the configuration parameters to obtain a target signal value comprises: The configuration parameters of the to-be-simulated message input by the user are received through the front-end image user interface of the simulation platform, and the configuration parameters at least include the byte position, the bit start bit and the bit length of the loop count signal in the message and / or the byte position of the checksum signal in the message and the signal range participating in the checksum calculation; The configuration parameters are transmitted to the corresponding target simulation model through the signal transmission module; The target simulation model in the executable file is called and run to obtain a target signal value, and the target signal value is a loop count signal value and / or a checksum signal value.

6. The CAN bus message signal emulation method of claim 5, wherein, The target simulation model is a checksum signal simulation model, and the step of calling and running the target simulation model in the executable file to obtain a target signal value comprises: According to the signal range participating in checksum calculation in the configuration parameter, the corresponding to-be-calculated signal value is obtained; According to the preset checksum calculation algorithm corresponding to the checksum signal simulation model, the to-be-calculated signal value is accumulated to obtain an accumulation result; The accumulation result is subjected to a remainder operation with a preset numerical value to obtain a checksum signal value.

7. The CAN bus message signal emulation method of claim 5, wherein, The step of injecting the target signal value into the to-be-simulated message and sending the same through a bus interface comprises: The target signal value is fed back to a signal channel corresponding to the to-be-simulated message in the simulation platform through the signal transmission module to update the data of the corresponding signal in the to-be-simulated message; The updated to-be-simulated message is encapsulated into CAN bus frame data through the driving of the bus interface; The CAN bus frame data is sent to the CAN bus through the bus interface.

8. A CAN bus message signal simulation device, characterized by The device comprises: A message classification module configured to classify a plurality of to-be-simulated messages according to the characteristic parameters of the cyclic count signal and / or the calculation algorithm of the checksum signal in the to-be-simulated messages to obtain a classification result; A model construction module configured to construct a target simulation model based on the classification result and compile the target simulation model to generate an executable file; A simulation calculation module configured to receive configuration parameters of the to-be-simulated message, call and run the executable file based on the configuration parameters, and obtain a target signal value; A message sending module configured to inject the target signal value into the to-be-simulated message and send the same through a bus interface.

9. A CAN bus message signal simulation device, characterized by The device comprises a memory, a processor, and a CAN bus message signal simulation program stored on the memory and executable on the processor, and the CAN bus message signal simulation program is configured to implement the steps of the CAN bus message signal simulation method according to any one of claims 1 to 7.

10. A storage medium, characterized by The storage medium stores a CAN bus message signal simulation program, and the CAN bus message signal simulation program implements the steps of the CAN bus message signal simulation method according to any one of claims 1 to 7 when executed by the processor.