Message sending method and device, storage medium and product
By setting the delayed transmission time for each message, the problem of inaccurate transmission cycle in CAN bus message transmission is solved, the load rate of the CAN bus is reduced, and the accuracy of message transmission is improved.
Patent Information
- Application Number
- CN202411786932.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the transmission of messages based on the CAN bus has the problem of accuracy, especially when multiple messages are sent simultaneously, it is easy to cause inaccurate transmission cycles, increase the load rate of the CAN bus, and reduce communication efficiency.
By determining the period and delay transmission time of each message, setting the delay transmission time according to the period of the message, distinguishing the transmission time of messages of different periods, thereby reducing the load rate of the CAN bus and improving the accuracy of message transmission.
It effectively reduces the load rate of the CAN bus, improves the accuracy of message transmission, and ensures the controllability and accuracy of communication.
Smart Images

Figure CN119603248A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a message sending method, device, storage medium and product. Background Art
[0002] Communication based on the Controller Area Network (CAN) bus is a widely used communication protocol. Multiple nodes communicate with each other by sending messages to the CAN bus. Summary of the invention
[0003] A technical problem to be solved by the present disclosure is: how to improve the accuracy of message sending.
[0004] According to a first aspect of some embodiments of the present disclosure, a message sending method is provided, comprising: determining a period of multiple messages to be sent on a communication node, wherein the communication node communicates based on a controller area network (CAN) bus; based on the period of the multiple messages, determining a delayed sending duration of each message in the multiple messages, wherein, for each message, the delayed sending duration of the message is positively correlated with the duration of the period of the message; and sending multiple messages on the communication node according to the period and delayed sending duration of each message.
[0005] In some embodiments, multiple messages are stored in multiple buffers based on the period and priority of each message, wherein for each buffer, messages with the same period are stored in the buffer, and are stored in the buffer in descending order of the priority of the messages; for each buffer in the multiple buffers, the messages in the buffer are sent on the communication node based on the period and delayed sending duration of the messages in the buffer.
[0006] In some embodiments, based on the period and delayed sending duration of the messages in the buffer, sending the messages in the buffer on the communication node includes: determining the actual sending time sequence of the messages in the buffer based on the period and delayed sending duration of the messages in the buffer, wherein the actual sending time sequence includes multiple actual sending time points; and sending the messages in the buffer at each actual sending time point in order of priority of the messages in the buffer from high to low.
[0007] In some embodiments, sending the messages in the buffer at each actual sending time point in order of the priorities of the messages in the buffer from high to low includes: starting timing from a starting time point, and when the time reaches an actual sending time point in an actual sending time sequence, sending the messages in order of the priorities of the messages in the buffer from high to low, wherein the starting time points of multiple messages to be sent on the communication node are the same.
[0008] In some embodiments, determining the actual sending time sequence of the message based on the period and delayed sending duration of the message in the buffer includes: determining the initial sending time sequence of the message based on the period and starting time point of the message, wherein the initial sending time sequence includes multiple initial sending time points; determining the actual sending time sequence of the message based on the initial sending time sequence and the delayed sending duration of the message.
[0009] In some embodiments, determining the actual sending time sequence of the message based on the initial sending time sequence and delayed sending duration of the message includes: taking the time sequence obtained by adding the delayed sending duration to each initial sending time point in the initial sending time sequence as the actual sending time sequence.
[0010] In some embodiments, the message sending method further includes: determining the priority of each message in the multiple messages according to the identifiers of the multiple messages.
[0011] In some embodiments, the delayed sending duration of the message corresponding to the minimum period among the multiple messages is zero.
[0012] In some embodiments, the difference between the delayed sending durations of messages of different periods among the multiple messages is greater than a preset threshold.
[0013] According to a second aspect of some embodiments of the present disclosure, a message sending device is provided, comprising: a first determination module, configured to determine a period of multiple messages to be sent on a communication node, wherein the communication node communicates based on a controller area network (CAN) bus; a second determination module, configured to determine a delayed sending duration of each message in the multiple messages based on the periods of the multiple messages, wherein, for each message, the delayed sending duration of the message is positively correlated with the duration of the period of the message; and a sending module, configured to send multiple messages on the communication node according to the period and delayed sending duration of each message.
[0014] According to a third aspect of some embodiments of the present disclosure, a message sending device is provided, comprising: a processor; and a memory coupled to the processor, for storing instructions, which, when executed by the processor, causes the processor to execute the message sending method as described above.
[0015] According to a fourth aspect of some embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the program is executed by a processor, the message sending method as described above is implemented.
[0016] According to a fifth aspect of some embodiments of the present disclosure, a computer program product is provided, comprising instructions, which, when executed by a processor, cause the processor to execute the message sending method as described above.
[0017] The present disclosure sets the delayed sending duration of the message according to the period of the message, so as to distinguish the sending time of the messages with different periods, thereby reducing the load rate of the CAN bus and improving the accuracy of the message sending.
[0018] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 A schematic flow chart of a message sending method according to some embodiments of the present disclosure is shown.
[0021] Figure 2 A schematic flow chart of a message sending method according to other embodiments of the present disclosure is shown.
[0022] Figure 3 A schematic diagram of a message sending method according to some further embodiments of the present disclosure is shown.
[0023] Figure 4 A schematic structural diagram of a message sending device according to some embodiments of the present disclosure is shown.
[0024] Figure 5 A schematic structural diagram of a message sending device according to some other embodiments of the present disclosure is shown.
[0025] Figure 6 A schematic structural diagram of a message sending device according to some further embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present disclosure and its application or use. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0027] First Input First Output (FIFO) is a data transmission method in CAN bus communication. Under high CPU load conditions, it may be difficult to process a series of CAN frames in a short period of time. Using a FIFO buffer structure can reduce the loss of incoming messages, reduce the setup time of outgoing messages, and generate a single message interrupt when the entire CAN frame series is completed.
[0028] However, when multiple messages are sent simultaneously within a certain time window, the sending cycle of some messages will be inaccurate. For example, when the 100ms time point arrives, there is a message sending task with a cycle of 10ms ahead, which may cause the sending of the message with a cycle of 100ms to be delayed and fail to meet the requirement of sending according to a certain cycle. In addition, sending multiple messages at the same time will cause the CAN bus load rate to be too large, reducing the efficiency of program operation.
[0029] Based on this, the present disclosure provides a message sending method.
[0030] Figure 1 FIG. 1 is a flow chart showing a method for sending a message according to some embodiments of the present disclosure. Figure 1 As shown, the method of this embodiment includes steps S102 to S106. The message sending method disclosed in the present invention can be executed on any communication node based on CAN bus communication.
[0031] In step S102, the period of a plurality of messages to be sent on a communication node is determined, wherein the communication node communicates based on a CAN bus.
[0032] Determine the period of each message among the multiple messages to be sent on the communication node, the period is, for example, 20ms, 50ms, 100ms, etc.
[0033] In step S104, based on the cycles of the multiple messages, the delayed sending duration of each message in the multiple messages is determined, wherein for each message, the delayed sending duration of the message is positively correlated with the duration of the cycle of the message.
[0034] Based on the period of each message, the delay time of each message is determined. For each message, the longer the period of the message, the longer the delay time of the message. For example, there are A, B, and C messages to be sent on the communication node, and the periods of A, B, and C are 20ms, 50ms, and 100ms respectively. Then the delay time of A, B, and C messages can be set to 5ms, 10ms, and 15ms.
[0035] In some embodiments, the delay time length of the message corresponding to the minimum period among the multiple messages is 0. For example, the delay time length of the messages A, B, and C can be set to 0ms, 5ms, and 10ms.
[0036] Setting different delayed sending durations for messages of different cycles is to distinguish the sending time of these messages. For example, when the delayed sending duration is not set, when the 100ms time point arrives, messages A, B, and C need to be sent, which will put a large load on the bus and cause inaccurate message sending cycles. After setting the delayed sending duration, for example, setting the delayed sending durations of messages A, B, and C to 0ms, 5ms, and 10ms respectively, then message A is sent when the 100ms time point arrives, message B is sent when the 105ms time point arrives, and message C is sent when the 110ms time point arrives. This reduces the number of messages sent at the same time point and can reduce the load on the CAN bus. In addition, it can also reduce the phenomenon of inaccurate message sending cycles caused by the coincidence of multiple message sending times.
[0037] In some embodiments, the difference between the delayed transmission durations of messages of different periods in the multiple messages is greater than a preset threshold. The preset threshold is, for example, 5ms. For example, for the above-mentioned A and B messages, the delayed transmission durations are 0ms and 5ms respectively. Since there is a 5ms transmission time difference, the transmission time difference is sufficient to complete the transmission of the A message, so the transmission of the B message will not be affected by the A message.
[0038] Alternatively, the delay sending duration may be set according to the size of the message. For example, the messages to be sent on the communication node are sorted in ascending order according to the duration of the cycle. Then, the delay sending duration is set in combination with the size of the message. On the basis that the delay sending duration of the message is positively correlated with the cycle, for each message, the larger the previous message, the longer the delay sending duration of the current message.
[0039] In step S106, multiple messages are sent on the communication node according to the cycle and delayed sending duration of each message.
[0040] Based on the cycle and delayed sending duration of each message, as well as the starting time point, the actual sending time point of each message can be determined, and the message is sent after the time reaches the actual sending time point.
[0041] In some embodiments, sending multiple messages on a communication node according to the period and delayed sending duration of each message includes: storing the multiple messages in multiple buffers according to the period and priority of each message, wherein, for each buffer, messages with the same period are stored in the buffer, and are stored in the buffer in descending order of the priority of the message; for each buffer in the multiple buffers, sending the messages in the buffer on the communication node according to the period and delayed sending duration of the messages in the buffer.
[0042] That is, multiple FIFO buffers are established, each FIFO buffer stores a message of a cycle, and the number of FIFO buffers is the same as the type of message cycle. In this way, the messages in each FIFO buffer correspond to the same actual sending time point. Then, the timing starts from the starting time point, and when the time reaches the actual sending time point corresponding to the FIFO buffer, the message in the FIFO buffer is sent.
[0043] In some embodiments, based on the period and delayed sending duration of the messages in the buffer, sending the messages in the buffer on the communication node includes: determining the actual sending time sequence of the messages in the buffer based on the period and delayed sending duration of the messages in the buffer, wherein the actual sending time sequence includes multiple actual sending time points; and sending the messages in the buffer at each actual sending time point in order of priority of the messages in the buffer from high to low.
[0044] In some embodiments, determining the actual sending time sequence of the message based on the period and delayed sending duration of the message in the buffer includes: determining the initial sending time sequence of the message based on the period and starting time point of the message, wherein the initial sending time sequence includes multiple initial sending time points; determining the actual sending time sequence of the message based on the initial sending time sequence and the delayed sending duration of the message.
[0045] In some embodiments, determining the actual sending time sequence of the message based on the initial sending time sequence and delayed sending duration of the message includes: taking the time sequence obtained by adding the delayed sending duration to each initial sending time point in the initial sending time sequence as the actual sending time sequence.
[0046] Since the FIFO buffer may include multiple messages, that is, multiple messages need to be sent at an actual sending time point, the multiple messages are sent in order of priority. That is, the message sending method disclosed in the present invention can not only improve the accuracy of the message sending cycle, but also comply with the priority order of the messages under the FIFO structure, thereby improving the accuracy of communication.
[0047] In some embodiments, sending the messages in the buffer at each actual sending time point in order of the priorities of the messages in the buffer from high to low includes: starting timing from a starting time point, and when the time reaches an actual sending time point in an actual sending time sequence, sending the messages in order of the priorities of the messages in the buffer from high to low, wherein the starting time points of multiple messages to be sent on the communication node are the same.
[0048] For example, before sending a message, the system clock corresponding to the communication node is initialized, and the system timer module (System Timer Module, STM) is initialized. Then, the STM is used to establish a timing reference unit (for example, the unit is 1ms), that is, the timing starts at the starting time point, and the message is sent when the time reaches the actual sending time point in the actual sending time sequence.
[0049] In some embodiments, the message sending method further includes: determining the priority of each message in the multiple messages according to the identifiers of the multiple messages. That is, setting the priority of the message by configuring the identifier of each message. For example, the ID of the message can be configured, and the smaller the ID of the message, the higher the priority.
[0050] The messages in the buffer are stored in order of priority from high to low, that is, the high-priority messages are stored in the buffer first. In this way, the timing starts from the starting time point, and after the time reaches the actual sending time point corresponding to the buffer, the messages in the buffer can be sent in the order of first-in-first-out, that is, in the order of message priority, thereby solving the problem that high-priority messages cannot be sent in time.
[0051] The present disclosure can improve the accuracy of the message sending cycle by setting a delayed sending duration for the message and storing the message in a buffer according to the message cycle and priority order, and can improve the accuracy of communication by sending the message according to the message priority order. In addition, the message sending method of the present disclosure does not increase the complexity of the system and is easy to implement.
[0052] Figure 2 FIG. 2 is a flow chart showing a method for sending a message according to other embodiments of the present disclosure. Figure 2 As shown, the method of this embodiment includes steps S201 to S222.
[0053] In step S201, the system is initialized, including: initializing the system clock and initializing the STM.
[0054] In step S202, taking the case where the communication node will send messages with three periods of 20ms, 50ms, and 100ms as an example, three FIFO buffers are established: FIFO1, FIFO2, and FIFO3, and the CAN bus is initialized, and the baud rate of the CAN bus is set (for example, it can be 500kbit). It can be understood that the message sending method disclosed in the present invention can be applied to the communication node that will send messages with N periods, where N is not less than 1.
[0055] In step S203, the priority monitoring unit is used to pre-sort the messages of the three cycles. For example, the bubble sorting method can be used to traverse the IDs of the messages (or CAN frames) of the three cycles and sort them according to the rule that the IDs of the messages with high priority are small and the IDs of the messages with low priority are large.
[0056] In step S204, according to the pre-sorting result of the priority monitoring unit, the three periodic messages are stored in three buffers respectively, that is, different buffers store messages of different periods, and the messages of the same period are stored in the same buffer in descending order of priority.
[0057] The present invention takes the sending of 30 frames of messages on the communication node as an example, and sets the messages with sending periods of 20ms, 50ms, and 100ms to 15 frames, 10 frames, and 5 frames respectively, so that the structures CANfifobuf1
[15] [4], CANfifobuf2
[10] [4], and CANfifobuf3[5][4] can be defined to pre-store the messages, wherein
[15] in CANfifobuf1
[15] [4] represents 15 frames of messages with a period of 20ms, [4] represents ID, message data H, message data L, and sending period, and the other two structures are similar in meaning to CANfifobuf1
[15] [4].
[0058] That is, CAN messages with a transmission period of 20ms, 50ms, and 100ms are stored in the structures CANfifobuf1
[15] [4], CANfifobuf2
[10] [4], and CANfifobuf3[5][4], respectively, and the messages in each structure are stored in descending order of priority. That is, by pre-sorting the messages according to priority, priority inversion in the FIFO structure is avoided, ensuring that high-priority CAN frames are sent first.
[0059] In step S205, a 1 ms timing reference unit is established using the STM, and then 20 ms, 50 ms, and 100 ms time windows are established according to the message sending cycle.
[0060] In step S206, the timing unit is turned on to wait for the arrival of the time window.
[0061] In step S207, it is determined whether the 20 ms time window has arrived. If so, step S208 is executed, otherwise, the process returns to step S206.
[0062] In step S208, the messages in CANfifobuf1
[15] [4] are loaded into FIFO1 in sequence.
[0063] In step S209, the message in FIFO1 is sent to the CAN bus.
[0064] In step S210, it is determined whether the 50 ms time window has arrived. If so, step S211 is executed, otherwise, the process returns to step S206.
[0065] In step S211, the waiting time is delayed for 5 ms.
[0066] In step S212, the messages in CANfifobuf1
[10] [4] are loaded into FIFO2 in sequence.
[0067] In step S213, the message in FIFO2 is sent to the CAN bus.
[0068] In step S214, it is determined whether the 100 ms time window has arrived. If so, step S215 is executed, otherwise, the process returns to step S206.
[0069] In step S215, the messages in CANfifobuf1
[15] [4] are loaded into FIFO1 in sequence.
[0070] In step S216, the message in FIFO1 is sent to the CAN bus.
[0071] In step S217, the waiting time is delayed for 5 ms.
[0072] In step S218, the messages in CANfifobuf1
[10] [4] are loaded into FIFO2 in sequence.
[0073] In step S219, the message in FIFO2 is sent to the CAN bus.
[0074] In step S220, the waiting time is further delayed by 5 ms, that is, the waiting time is delayed by 10 ms from the time point of 100 ms.
[0075] In step S221, the messages in CANfifobuf1[5][4] are loaded into FIFO3 in sequence.
[0076] In step S222, the message in FIFO3 is sent to the CAN bus.
[0077] like Figure 2 As shown, when the first 100ms time window arrives, if the message sending method disclosed in the present invention is not adopted, messages with periods of 20ms, 50ms, and 100ms will be sent sequentially. However, if the message sending method disclosed in the present invention is adopted, a message with a period of 20ms will be sent first, and then a message with a period of 50ms will be sent after a delay of 5ms, and then a message with a period of 100ms will be sent after a delay of 10ms.
[0078] Figure 3 FIG. 1 is a schematic diagram showing a method for sending a message according to some other embodiments of the present disclosure. Figure 3 As shown, Figure 3 It includes two scenarios, 3A and 3B, wherein scenario 3A describes a message sending scenario when the message sending method of the present disclosure is not used, and scenario 3B describes a message sending scenario when the message sending method of the present disclosure is used.
[0079] As shown in scenario 3A, in the scenario where the message sending method disclosed in the present invention is not adopted, the example of sending messages with periods of 20ms, 50ms, and 100ms on the above communication node is used. When the time window of the least common multiple of these three sending periods arrives, that is, at the 100ms timing node, the messages of the three task periods will be sent to the CAN bus, which will cause a sharp increase in bus tasks and increase the bus load rate. In addition, at the 100ms timing node, if the content of FIFO1 is sent to the bus first, then when the content of FIFO3 is sent to the CAN bus, the sending period exceeds 100ms, resulting in inaccurate sending period.
[0080] As shown in Scenario 3B, in the scenario where the message sending method of the present invention is adopted, the example of sending messages with periods of 20ms, 50ms, and 100ms respectively on the above-mentioned communication node is used. When the time window of the least common multiple of these three sending periods arrives, that is, on the 100ms timing node, the message with a period of 20ms is first sent to the CAN bus, and then delayed by 5ms, and the message with a period of 50ms is sent to the CAN bus, and then delayed by another 5ms, and the message with a period of 100ms is sent to the CAN bus.
[0081] Depend on Figure 3 It can be seen that by adopting the message sending method disclosed in the present invention, messages of different periods are not sent simultaneously on the 100ms time window node, thereby effectively reducing the load rate on the CAN bus and ensuring the accuracy of the CAN sending cycle. That is, by delaying the sending of messages of different sending cycles, the problem of excessively high load rate and inaccurate sending cycle caused by message concurrency in the least common multiple time window of different sending cycles is optimized.
[0082] In addition, the message sending method disclosed in the present invention can ensure the priority order of messages when sending messages, while avoiding sending messages of different periods at the same time, thereby improving the controllability and accuracy of communication.
[0083] Figure 4 FIG. 2 shows a schematic diagram of the structure of a message sending device according to some embodiments of the present disclosure. Figure 4 As shown, the device 40 of this embodiment includes modules 410-430.
[0084] The first determination module 410 is configured to determine the period of multiple messages to be sent on the communication node, wherein the communication node communicates based on the controller area network (CAN) bus; the second determination module 420 is configured to determine the delayed sending duration of each message in the multiple messages based on the period of the multiple messages, wherein, for each message, the delayed sending duration of the message is positively correlated with the duration of the period of the message; the sending module 430 is configured to send the multiple messages on the communication node according to the period and delayed sending duration of each message.
[0085] In some embodiments, the sending module 430 is configured to store the multiple messages in multiple buffers according to the period and priority of each message, wherein, for each buffer, the messages with the same period are stored in the buffer, and are stored in the buffer in order from high to low according to the priority of the messages; for each buffer in the multiple buffers, the messages in the buffer are sent on the communication node according to the period and delayed sending duration of the messages in the buffer.
[0086] In some embodiments, the sending module 430 is configured to determine the actual sending time sequence of the messages in the buffer according to the period and delayed sending duration of the messages in the buffer, wherein the actual sending time sequence includes multiple actual sending time points; and send the messages in the buffer at each actual sending time point in order of priority of the messages in the buffer from high to low.
[0087] In some embodiments, the sending module 430 is configured to start timing from a starting time point, and when the time reaches the actual sending time point in the actual sending time sequence, the messages in the buffer are sent in order from high to low priority, wherein the starting time points of multiple messages to be sent on the communication node are the same.
[0088] In some embodiments, the sending module 430 is configured to determine an initial sending time sequence of the message based on a period and a starting time point of the message, wherein the initial sending time sequence includes multiple initial sending time points; and determine an actual sending time sequence of the message based on the initial sending time sequence and the delayed sending duration of the message.
[0089] In some embodiments, the sending module 430 is configured to take a time sequence obtained by increasing each initial sending time point in the initial sending time sequence by the delayed sending time length as the actual sending time sequence.
[0090] In some embodiments, the message sending device 40 is further configured to determine the priority of each message in the multiple messages according to the identifiers of the multiple messages.
[0091] In some embodiments, the delayed sending duration of the message corresponding to the minimum period among the multiple messages is zero.
[0092] In some embodiments, the difference between the delayed sending durations of messages of different periods among the multiple messages is greater than a preset threshold.
[0093] The message sending device disclosed in the present invention can distinguish the sending times of messages with different periods by setting the delayed sending duration of the message according to the period of the message, thereby reducing the load rate of the CAN bus and improving the accuracy of message sending.
[0094] The message sending device in the embodiment of the present disclosure can be implemented by various computing devices or computer systems. Figure 5 as well as Figure 6 Give a description.
[0095] Figure 5 FIG. 2 shows a schematic diagram of a structure of a message sending device according to other embodiments of the present disclosure. Figure 5 As shown, the device 50 of this embodiment includes: a memory 510 and a processor 520 coupled to the memory 510, and the processor 520 is configured to execute the message sending method in any of some embodiments of the present disclosure based on instructions stored in the memory 410.
[0096] The memory 510 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, a database, and other programs.
[0097] Figure 6 FIG. 2 shows a schematic diagram of a structure of a message sending device according to some other embodiments of the present disclosure. Figure 6As shown, the device 60 of this embodiment includes: a memory 610 and a processor 620, which are similar to the memory 510 and the processor 520 respectively. It can also include an input and output interface 630, a network interface 640, a storage interface 650, etc. These interfaces 630, 640, 650 and the memory 610 and the processor 620 can be connected, for example, through a bus 660. Among them, the input and output interface 630 provides a connection interface for input and output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 640 provides a connection interface for various networked devices, for example, it can be connected to a database server or a cloud storage server. The storage interface 650 provides a connection interface for external storage devices such as SD cards and USB flash drives.
[0098] An embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements any of the aforementioned message sending methods when executed by a processor.
[0099] The embodiment of the present disclosure further provides a computer program product, including instructions, which, when executed by a processor, enable the processor to execute any of the above-mentioned message sending methods.
[0100] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable non-transient storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0101] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0102] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0104] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A message sending method, comprising: Determining a period of a plurality of messages to be sent on a communication node, wherein the communication node communicates based on a controller area network (CAN) bus; Based on the cycles of the multiple messages, determine the delayed sending duration of each message in the multiple messages, wherein, for each message, the delayed sending duration of the message is positively correlated with the duration of the cycle of the message; The multiple messages are sent on the communication node according to the period and delayed sending duration of each message.
2. The message sending method according to claim 1, wherein: The sending of the multiple messages on the communication node according to the period and delayed sending duration of each message includes: According to the period and priority of each message, the multiple messages are stored in multiple buffers, wherein for each buffer, the messages of the same period are stored in the buffer, and are stored in the buffer in descending order of priority of the messages; For each buffer in the plurality of buffers, the message in the buffer is sent on the communication node according to the period and delayed sending duration of the message in the buffer.
3. The message sending method according to claim 2, wherein: The sending of the message in the buffer on the communication node according to the cycle and the delayed sending duration of the message in the buffer includes: Determine an actual sending time sequence of the messages in the buffer according to the period and the delayed sending duration of the messages in the buffer, wherein the actual sending time sequence includes a plurality of actual sending time points; The messages in the buffer are sent at each actual sending time point in descending order of priority of the messages in the buffer.
4. The message sending method according to claim 3, wherein: The sending of the messages in the buffer at each actual sending time point according to the order of priorities of the messages in the buffer from high to low includes: The timing is started from a starting time point, and when the time reaches an actual sending time point in the actual sending time sequence, the messages in the buffer are sent in descending order according to their priorities, wherein the starting time points of the multiple messages to be sent on the communication node are the same.
5. The message sending method according to claim 3, wherein: Determining the actual sending time sequence of the message according to the period and the delayed sending duration of the message in the buffer includes: Determine an initial sending time sequence of the message according to the period and the starting time point of the message, wherein the initial sending time sequence includes a plurality of initial sending time points; The actual sending time sequence of the message is determined according to the initial sending time sequence and the delayed sending duration of the message.
6. The message sending method according to claim 5, wherein: Determining the actual sending time sequence of the message according to the initial sending time sequence and the delayed sending duration of the message includes: A time sequence obtained by adding the delayed sending time length to each initial sending time point in the initial sending time sequence is used as the actual sending time sequence.
7. The message sending method according to claim 2, further comprising: The priority of each message in the multiple messages is determined according to the identifiers of the multiple messages.
8. The message sending method according to claim 1, wherein: The delayed sending duration of the message corresponding to the minimum period among the multiple messages is zero.
9. The message sending method according to claim 1, wherein: The difference between the delayed sending durations of messages of different periods among the multiple messages is greater than a preset threshold.
10. A message sending device, comprising: A first determination module is configured to determine a period of a plurality of messages to be sent on a communication node, wherein the communication node communicates based on a controller area network (CAN) bus; A second determination module is configured to determine a delayed sending duration of each of the multiple messages based on the cycles of the multiple messages, wherein, for each of the messages, the delayed sending duration of the message is positively correlated with the duration of the cycle of the message; The sending module is configured to send the multiple messages on the communication node according to the period and delayed sending duration of each message.
11. A message sending device, comprising: processor; as well as A memory coupled to the processor, used to store instructions, wherein when the instructions are executed by the processor, the processor executes the message sending method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the message sending method according to any one of claims 1 to 9 is implemented.
13. A computer program product, comprising instructions, which, when executed by a processor, enable the processor to execute the message sending method according to any one of claims 1 to 9.