A time-triggered dds communication method and system based on message preemption mechanism

CN122933548APending Publication Date: 2026-10-16TONGJI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611225022.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-13
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

如果数据样本的字节数很大,其拷贝操作将消耗大量的存储资源,这对于资源受限的车载设备而言是无法容忍的;另一方面,针对大量数据的拷贝操作会引入不可控的处理延迟,这TSN的确定性通信要求相悖

Benefits of technology

(1)本发明在DDS流控制器中设计了DDS消息抢占机制,要求流控制器维护两个队列:时间敏感队列和可抢占队列,对于时间敏感应用程序产生的DDS消息,数据写入者将其相关信息插入时间敏感队列;相反地,尽力而为应用程序产生的DDS消息将被插入可抢占队列;两个队列的开启和关闭分别由两个独立的队列门控制;在对DDS消息进行传输过程中,只有在时间敏感队列为空时,才打开可抢占队列进行DDS消息的传输,且每次成功地发布可抢占队列中的DDS消息后都需要重新检查时间敏感队列的状态,若有新的DDS消息插入时间敏感队列队列,则立即关闭可抢占队列的队列门,进而处理时间敏感队列中新加入的DDS消息;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933548A_ABST
    Figure CN122933548A_ABST
Patent Text Reader

Abstract

The application relates to a time-triggered DDS communication method and system based on a message preemption mechanism, and the method comprises the following steps: inputting data samples to be published into a DDS middleware for serialization processing, and encapsulating the data samples into DDS messages, the structure of the DDS messages is simplified into a fixed format; transmitting the encapsulated DDS messages to a DDS flow controller, the DDS flow controller is provided with a time-sensitive queue and a preemptible queue, the DDS flow controller inserts DDS messages generated by a time-sensitive application program into the time-sensitive queue, inserts DDS messages generated by a best-effort application program into the preemptible queue, and sends the corresponding DDS messages to a transmission layer by controlling the opening and closing of a queue gate of the time-sensitive queue and the preemptible queue. Compared with the prior art, the application realizes preemptive publishing of time-sensitive DDS messages, and eliminates the publishing jitter of time-sensitive messages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of DDS communication technology, and in particular to a time-triggered DDS communication method and system based on a message preemption mechanism. Background Technology

[0002] In next-generation regionally centralized automotive electronic and electrical architectures, on the one hand, the in-vehicle network needs to rely on Data Distribution Service (DDS) middleware to achieve service-oriented communication; on the other hand, the in-vehicle network needs to rely on Time-Sensitive Networking (TSN) technology to ensure the real-time performance and reliability of communication. Therefore, the integrated application of DDS and TSN is currently a key research focus in the field of in-vehicle networks.

[0003] The DDS (Data Distribution Service) standard provides a data-centric publish / subscribe model. The core of DDS communication is publish / subscribe: data writers publish data to specific topics, and data readers subscribe to topics of interest to obtain the corresponding data. Standard DDS middleware is divided into a DCPS (Data-CentricPublish-Subscribe) layer and an RTPS (Real-Time Publish-Subscribe) layer. The former primarily provides standard protocol APIs for the application layer, while the latter provides functions such as DDS entity discovery, message encapsulation, and parsing. To manage the publication sequence of DDS messages (since DDS message encapsulation mainly resides in the RTPS layer, it will also be referred to as RTPS messages), some DDS software (such as Fast DDS) introduces a flow controller entity. This entity is responsible for scheduling the publication of DDS messages, ensuring that DDS messages are published at the correct time. Current flow controller scheduling strategies include four types: first-in-first-out, round-robin, strict priority, and strict priority with reserved bandwidth. First-in-first-out (FIFO) and round-robin strategies do not consider the priority of DDS messages and cannot guarantee the real-time performance of high-priority DDS messages. Although strict priority and strict priority strategies with reserved bandwidth introduce the concept of priority, the problem of high-priority DDS messages being blocked still exists in the special cases described in section 1.

[0004] Time-Sensitive Networking (TSN) is a set of standards developed by the IEEE 802.1 working group. It aims to provide network assurance for applications requiring high precision, low latency, and high reliability, particularly suitable for industrial automation, intelligent transportation, and vehicular networks. The TSN standard consists of a suite of protocols that provide quality of service guarantees at the data link layer. Its main components include: the IEEE 802.1AS protocol for time synchronization; the IEEE 802.1Qbv protocol for guaranteed bounded low latency through the TAS mechanism; the IEEE 802.1Qcr protocol for integer asynchronous traffic to reduce end-to-end latency; and the IEEE 802.1CB protocol for ensuring communication reliability through frame duplication and cancellation mechanisms.

[0005] In vehicular networks, DDS middleware provides a service-oriented communication method, while TSN provides deterministic, low-latency, and reliable Quality of Service (QoS) guarantees for DDS communication at the data link layer. In scenarios where DDS and TSN are integrated, the frame duplication and cancellation mechanisms in TSN can replace the acknowledgment and retransmission mechanisms in DDS, ensuring communication reliability; the TAS mechanism in TSN can replace DDS's Deadline, Latency_Budget, and other QoS policies, providing deterministic, low-latency communication services. However, the normal operation of the TAS mechanism requires DDS messages to be published at specified times. Current DDS middleware lacks a corresponding mechanism to precisely control the publication time of DDS messages. This is a key challenge facing the integrated application of DDS and TSN. To achieve the integrated application of DDS and TSN, the following key issues urgently need to be addressed: 1. High resource consumption and uncontrollable processing delays caused by data copying like Figure 1 As shown, in the standard DDS protocol framework, serialized data samples are first stored in a history cache. Then, the serialized data samples need to be copied to the memory segment storing DDS messages, encapsulated into complete DDS messages, and finally sent by the transport layer interface. If the number of bytes in the data sample is large, the copy operation will consume a significant amount of storage resources, which is unacceptable for resource-constrained in-vehicle devices. On the other hand, copying large amounts of data introduces uncontrollable processing delays, which contradicts the deterministic communication requirements of TSN.

[0006] 2. The problem of low-priority DDS messages blocking high-priority DDS messages. While some open-source DDS software (such as Fast DDS) provides strict priority flow controller policies to ensure that high-priority DDS messages are sent first, the problem of high-priority DDS messages being blocked still exists in the following scenarios: A low-priority DDS message is first inserted into the queue, and the high-priority queue is empty at this time. In this case, the flow controller chooses to process the low-priority DDS message. Subsequently, a high-priority DDS message is inserted into the queue. Because the flow controller is processing the aforementioned low-priority DDS message, it must complete the processing of that message before it can process the subsequent high-priority DDS messages. If the low-priority DDS message has a large data volume and needs to be transmitted through multiple fragments, then subsequent high-priority DDS messages will be blocked for a long time, and their real-time transmission cannot be guaranteed.

[0007] 3. DDS message transmission jitter issue Neither the DDS standard nor current open-source DDS software provides a specific method for precisely controlling the timing of DDS message transmission. Therefore, when interfered with by other threads or other DDS messages, jitter inevitably occurs in the transmission timing of DDS messages. If a Time Aware Shaper (TAS) mechanism is used at the TSN layer, a dedicated time transmission window is allocated to DDS messages at the switch port. If jitter causes a DDS message to miss its transmission window, the message must wait until the next cycle's transmission time window before it can be transmitted, and the deterministic transmission of subsequent DDS messages will be affected. Therefore, resolving the DDS message transmission jitter problem is crucial for realizing the convergence of DDS and TSN applications. Summary of the Invention

[0008] The purpose of this invention is to overcome the shortcomings of the prior art, where high-priority DDS messages are blocked by low-priority DDS messages for a long time, and to provide a time-triggered DDS communication method and system based on a message preemption mechanism.

[0009] The objective of this invention can be achieved through the following technical solutions: A time-triggered DDS communication method based on message preemption mechanism includes the following steps: The data sample to be published is input into the DDS middleware for serialization and encapsulated into a DDS message. The structure of the DDS message is simplified to a fixed format. The encapsulated DDS message is transmitted to the DDS flow controller, which has a time-sensitive queue and a preemptible queue. The DDS flow controller inserts DDS messages generated by time-sensitive applications into the time-sensitive queue and DDS messages generated by best-effort applications into the preemptible queue. By controlling the opening and closing of the queue doors of the time-sensitive queue and the preemptible queue, the corresponding DDS message is sent to the transport layer. The opening and closing control process for the queue gates of the time-sensitive queue and the preemptible queue includes: During the initialization phase, the queue gate of the time-sensitive queue is opened, while the queue gate of the preemptible queue is closed. DDS messages in the time-sensitive queue are sent to the transport layer in sequence and then deleted from the time-sensitive queue. When the time-sensitive queue is empty, open the queue gate of the preemptible queue, send the DDS messages in the preemptible queue to the transport layer in sequence, and delete them from the preemptible queue. After each successful transmission of a DDS message in the preemptible queue, recheck the status of the time-sensitive queue. If there is a new DDS message in the time-sensitive queue, close the queue gate of the preemptible queue and open the queue gate of the time-sensitive queue for processing.

[0010] Furthermore, the opening and closing control process for the queue gates of the time-sensitive queue and the preemptible queue also includes: If both the time-sensitive queue and the preemptible queue are empty, the DDS flow controller enters a blocking wait state and synchronously starts the corresponding timeout timer. After the timeout, the DDS flow controller is woken up. If a new DDS message is received while the DDS flow controller is in the blocking wait state, the DDS flow controller is woken up and re-enters the initialization phase.

[0011] Furthermore, the simplified DDS message structure, which is in a fixed format, includes an RTPS header, an InfoDestination sub-message, an InfoTimeStemp sub-message, and a Data / DataFrag sub-message. The RTPS header is used to maintain the format specified by the protocol, the InfoDestination sub-message is used to declare the destination node information of the DDS message, the InfoTimeStemp sub-message is used to record the timestamp of data publication, and the Data / DataFrag sub-message is used to store serialized data.

[0012] Furthermore, the encapsulation into a DDS message includes: The serialized data is written to the specified position of the Data / DataFrag sub-message, and then the information in the InfoDestination sub-message and InfoTimeStemp sub-message is updated according to the data sample to complete the encapsulation of the DDS message.

[0013] Furthermore, if the size of the serialized data exceeds the preset byte threshold, it will be fragmented according to the maximum fragment length pre-configured in the DDS middleware, and each fragment will be stored in the specified position of the Data / DataFrag sub-message in the form of a linked list. The preemptible queue is sent in units of fragments. After each successful transmission of a fragment in the preemptible queue, the status of the time-sensitive queue is rechecked.

[0014] Furthermore, the DDS flow controller also includes a timed event table for controlling the DDS message publication timing of the time-sensitive queue.

[0015] Furthermore, the timed event table registers multiple timed events during the initialization phase. Each timed event has a corresponding trigger time, event period, historical cache pointer, and data sample sequence number to be published. The timed events in the timed event table are arranged in ascending order of their trigger times. Before the trigger time of a certain timed event is reached, the DDS flow controller closes the queue gate of the preemptible queue, opens the queue gate of the time-sensitive queue, and sends the DDS message corresponding to the current timed event. After sending, the queue gate of the preemptible queue is opened and the queue gate of the time-sensitive queue is closed.

[0016] Furthermore, the method also includes: When sending the DDS message corresponding to the current timed event, the trigger time of the next timed event is looked up from the timed event table. and in The queue gates for preemptible queues should be kept closed at all times. , The time taken for the DDS flow controller to process a maximum DDS message fragment; If the current time has not yet arrived If successful, open the preemptible queue gate, close the time-sensitive queue gate, and send DDS messages from the preemptible queue. After each successful transmission of a DDS message from the preemptible queue, recheck whether the current time has elapsed. If the message does not arrive, continue sending DDS messages from the preemptible queue; otherwise, close the queue gate of the preemptible queue, open the queue gate of the time-sensitive queue, and send DDS messages from the time-sensitive queue.

[0017] Furthermore, the method also includes: If the current time has not yet arrived If the preemptible queue is empty, the system enters a blocking waiting phase, inserting a new DDS message into the preemptible queue, or waking up the DDS flow controller when the waiting timeout occurs.

[0018] The present invention also provides a time-triggered DDS communication system based on a message preemption mechanism, including a memory and a processor. The memory stores a computer program, and the processor calls the computer program to execute the steps of the method described above.

[0019] Compared with the prior art, the present invention has the following advantages: (1) The present invention designs a DDS message preemption mechanism in the DDS flow controller, requiring the flow controller to maintain two queues: a time-sensitive queue and a preemptible queue. For DDS messages generated by time-sensitive applications, the data writer inserts its relevant information into the time-sensitive queue; conversely, DDS messages generated by best-effort applications will be inserted into the preemptible queue. The opening and closing of the two queues are controlled by two independent queue gates. During the transmission of DDS messages, the preemptible queue is only opened for DDS message transmission when the time-sensitive queue is empty. After each successful publication of a DDS message in the preemptible queue, the status of the time-sensitive queue needs to be checked again. If a new DDS message is inserted into the time-sensitive queue, the queue gate of the preemptible queue is immediately closed, and the newly added DDS message in the time-sensitive queue is then processed. This solution enables preemptive publishing of time-sensitive DDS messages at the middleware level, ensuring that the time during which time-sensitive DDS messages are blocked by best-effort DDS messages has a deterministic upper limit, namely the time taken by the flow controller thread to process a maximum DDS message fragment.

[0020] (2) In the scenario of DDS and TSN integration, this invention optimizes the encapsulation process of DDS messages. First, the DDS message is simplified to a fixed format, merging the memory segment storing serialized data and the memory segment storing the DDS message, and directly storing the complete DDS message in the historical cache, avoiding unnecessary data copying operations. This optimized design not only reduces the storage resource overhead caused by data copying operations, but also avoids uncontrollable processing delays caused by copying large amounts of data.

[0021] (3) The present invention takes into account that the flow controller using the DDS message preemption mechanism can guarantee that the time when the time-sensitive DDS message is blocked has a deterministic upper bound, but the blocking still exists and the time when the time-sensitive DDS message is published still has jitter.

[0022] To address this, a guard band mechanism is introduced on top of the DDS message preemption mechanism. A timed event table is added to the message preemption model to control the publication time of time-sensitive DDS messages. When a certain event trigger time is reached, the flow controller thread closes the queue gate of the preemptible queue and then publishes the corresponding time-sensitive queue DDS message; during other time periods, the queue gate of the preemptible queue is opened to publish best-effort data samples. It achieves precise control over the timing of time-sensitive DDS message publication, eliminates publication jitter of time-sensitive messages, and ensures that the publication timing of time-sensitive DDS messages is aligned with the transmission time window allocated by the TAS mechanism in TSN. Attached Figure Description

[0023] Figure 1 This is a schematic diagram of the processing flow of a standard DDS protocol framework provided in the background art of this invention; Figure 2 This is a schematic diagram of an optimized DDS message encapsulation process provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a basic model of a DDS message preemption mechanism provided in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the operational logic of a DDS message preemption mechanism provided in an embodiment of the present invention. Figure 5 This is a schematic diagram of a message preemption model with an added timed event table provided in an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the specific implementation logic of time-triggered DDS communication provided in an embodiment of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0025] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0026] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0027] Example 1 This embodiment provides a time-triggered DDS communication method based on a message preemption mechanism, including the following steps: S1: Input the data sample to be published into the DDS middleware for serialization and encapsulate it into a DDS message. The structure of the DDS message is simplified to a fixed format. Specifically, in scenarios where DDS and TSN are integrated, the encapsulation process for DDS messages is optimized. In such scenarios, reliable message transmission is achieved through the frame duplication and elimination mechanism of the TSN layer, eliminating the need for the acknowledgment and retransmission mechanism of the DDS middleware. Therefore, this invention first simplifies DDS messages to a fixed format, and then merges the memory segment storing serialized data with the memory segment storing DDS messages, avoiding data copying operations during the DDS message encapsulation process. Figure 2 The optimized DDS message encapsulation process is described, and the specific design and implementation process is as follows: S11: Simplify the structure of DDS messages. Considering that in scenarios where DDS and TSN are integrated, the DDS middleware does not need to implement an acknowledgment and retransmission mechanism, the structure of DDS messages is simplified to a fixed format. The simplified DDS message consists of an RTPS header, an InfoDestination sub-message, an InfoTimeStemp sub-message, and a Data / DataFrag sub-message. The RTPS header maintains the format specified by the protocol; the InfoDestination sub-message declares the destination node information of the DDS message; the InfoTimeStemp sub-message records the timestamp of data publication; and the serialized data is stored in the Data / DataFrag sub-message.

[0028] S12: Merging of memory segments. The simplified DDS message has a fixed format and can be directly stored in the publisher's history cache, avoiding the copying operation of serialized data from the history cache to the DDS message storage area.

[0029] S13: Encapsulation of DDS messages. The application encapsulates the data sample to be published via... writeThe interface () is passed to the DDS middleware. The DDS middleware first serializes the data sample. The serialized data can be directly written to the specified position in the Data / DataFrag sub-message. Then, it updates the information in the InfoDestination and InfoTimeStemp sub-messages to complete the encapsulation of the DDS message.

[0030] S14: Fragmentation of DDS messages. For data with a large number of bytes, fragmentation is performed according to the maximum fragmentation length pre-configured in the DDS middleware, and the fragments of the serialized data are then stored in the form of a linked list.

[0031] S2: Transmit the encapsulated DDS message to the DDS flow controller. The DDS flow controller has a time-sensitive queue and a preemptible queue. The DDS flow controller inserts DDS messages generated by time-sensitive applications into the time-sensitive queue and DDS messages generated by best-effort applications into the preemptible queue. By controlling the opening and closing of the queue doors of the time-sensitive queue and the preemptible queue, the corresponding DDS message is sent to the transport layer.

[0032] The opening and closing control process for queue gates in time-sensitive queues and preemptible queues includes: During the initialization phase, the queue gate of the time-sensitive queue is opened, while the queue gate of the preemptible queue is closed. DDS messages in the time-sensitive queue are sent to the transport layer in sequence and then deleted from the time-sensitive queue. When the time-sensitive queue is empty, open the queue gate of the preemptible queue, send the DDS messages in the preemptible queue to the transport layer in sequence, and delete them from the preemptible queue. After each successful transmission of a DDS message in the preemptible queue, recheck the status of the time-sensitive queue. If there is a new DDS message in the time-sensitive queue, close the queue gate of the preemptible queue and open the queue gate of the time-sensitive queue for processing.

[0033] Preferably, the opening and closing control process for queue gates of time-sensitive queues and preemptible queues further includes: If both the time-sensitive queue and the preemptible queue are empty, the DDS flow controller enters a blocking wait state and starts the corresponding timeout timer simultaneously. After the timeout expires, the DDS flow controller is woken up. If a new DDS message is received while the DDS flow controller is in a blocking wait state, the DDS flow controller is woken up and re-enters the initialization phase.

[0034] Specifically, this solution introduces a DDS message preemption mechanism into the DDS flow controller. Figure 3This paper describes the basic model of the DDS message preemption mechanism. The DDS message preemption mechanism requires the flow controller to maintain two queues: a Time-Sensitive Queue (TSQ) and a Preemptable Queue (PQ). For DDS messages generated by time-sensitive applications, the data writer inserts its relevant information into the time-sensitive queue; conversely, DDS messages generated by best-effort applications are inserted into the preemptable queue. To avoid data copying, the data writer only needs to insert a pointer to the history cache into the designated queue. The opening and closing of the two queues are controlled by two independent queue gates. Only when a queue gate is open can DDS messages in the queue be published sequentially in FIFO order. The flow controller... sendto The () interface publishes DDS messages stored in the historical cache to the physical links in the network. The operating logic of the DDS message preemption mechanism is as follows: Figure 4 As shown, the specific process is as follows: S21: Initialization Phase. During the initialization phase, the flow controller thread opens the queue gate for TSQ and closes the queue gate for PQ to ensure that TSQ is processed first. The status of TSQ and PQ is then checked.

[0035] S22: Process DDS messages in the TSQ. If the TSQ is not empty, publish and delete all DDS messages in the TSQ in FIFO order. When the TSQ is empty, open the queue gate of the PQ, and then begin processing DDS messages in the PQ.

[0036] S23: Process DDS messages in PQ. If PQ is not empty, DDS messages in PQ are processed sequentially in FIFO order. If the number of bytes in a DDS message in PQ is large, it is published in units of fragments. The state of the TSQ queue needs to be checked again after each successful publication of a DDS message (fragment) in PQ; this is crucial for preemption. If a data writer inserts a new DDS message into the TSQ while processing the PQ queue, the PQ queue gate must be closed immediately before processing the newly added DDS message in the TSQ. Although DDS messages in the TSQ can still be blocked by DDS messages in PQ, the DDS message preemption mechanism ensures that blocking is caused by at most the largest fragment of a DDS message, giving the blocking time a deterministic upper bound.

[0037] S24: Blocking Waiting Phase. If both TSQ and PQ are empty, the flow controller thread enters a blocking waiting state. To avoid permanent blocking, a timeout timer is preset, and the flow controller thread will be woken up after the timeout. During the waiting period, if a data writer inserts a new DDS message, the flow controller is immediately woken up. If a new DDS message is inserted into TSQ, the PQ queue gate needs to be closed immediately. After being woken up, the flow controller thread re-enters and exits the initialization phase and continues processing DDS messages in TSQ and PQ.

[0038] In a preferred embodiment, the DDS flow controller further includes a timed event table for controlling the DDS message publication time of the time-sensitive queue. During the initialization phase, the timed event table registers multiple timed events. Each timed event has a corresponding trigger time, event period, historical cache pointer, and data sample sequence number to be published. The timed events in the timed event table are arranged in ascending order of trigger time. The method also includes: S3: Before the trigger time of a certain timed event is reached, the DDS flow controller closes the queue gate of the preemptible queue, opens the queue gate of the time-sensitive queue, sends the DDS message corresponding to the current timed event, and after sending, opens the queue gate of the preemptible queue and closes the queue gate of the time-sensitive queue.

[0039] Specifically, this solution considers that while the flow controller employing the DDS message preemption mechanism can guarantee a deterministic upper bound on the blocking time of time-sensitive DDS messages, blocking still exists, thus causing jitter in the publication timing of time-sensitive DDS messages. The TAS mechanism in TSN requires DDS messages to be published at a specified time; therefore, to achieve the integrated application of DDS and TSN, the jitter caused by blocking must be eliminated. This solution introduces a guard band mechanism based on the DDS message preemption mechanism and proposes a time-triggered DDS communication method, achieving precise control over the publication timing of DDS messages.

[0040] The time-triggered DDS communication model adds a timed event table to the message preemption model to control the timing of the publication of time-sensitive DDS messages. Figure 5The specific structure of the model is described. During the application initialization phase, the data writer needs to register timed events with the timed event table. The registration information includes the trigger time, event period, historical cache pointer, and the sequence number of the data sample to be published. During registration, the data writer sets an initial value for the trigger time, which is determined according to the transmission time window allocated by the TAS mechanism. All events in the timed event table are arranged in ascending order of trigger time. The queue gates of TSQ and PQ are controlled by the timed event table. When the trigger time of a certain event is reached, the flow controller thread closes the PQ queue gate and publishes the corresponding time-sensitive DDS message; during other time periods, the PQ queue gate is opened, and best-effort data samples are published. It is important to note that the TSQ in this model is actually a pseudo-queue; it does not store any information, and the flow controller thread can directly access the DDS messages in the historical cache through the registration information in the timed event table.

[0041] Figure 6 The specific implementation logic of time-triggered DDS communication is described, and the specific process is as follows: S31: Initialization Phase. The flow controller thread opens the queue gates for TSQ and PQ, then looks up the trigger time of the next timer event from the timer event table, denoted as... To completely eliminate blocking caused by best-effort DDS messages, the flow controller thread needs to... (Right now Close the queue gate of PQ at all times. The size is equal to the upper bound of the blocking, which is the time it takes for the flow controller thread to process a maximum DDS message fragment. (Introduction) This can protect time-sensitive DDS messages from being blocked, therefore Also known as the protection belt time.

[0042] S32: Process the DDS message in PQ. If the current time has not yet arrived. The flow controller thread begins processing DDS messages in PQ, following the same preemptive mechanism as DDS messages. If the number of bytes is large, processing is done in fragments. After each successful publication of a DDS message (fragment) in PQ, a check for arrival is required. If the time has not arrived, continue processing the PQ queue; otherwise, close the PQ queue gate and begin processing DDS messages in the TSQ.

[0043] S33: Process the DDS message in the TSQ. Block the thread until the next timer triggers. .exist At this point, the flow controller thread publishes the corresponding DDS message based on the registration information in the timing schedule, then updates the trigger time and sequence number of the timed event, and opens the PQ queue gate. Next, the thread switches to the initialization phase and repeats the operations in S31-S33.

[0044] S34: Blocking wait phase. If not reached... When the PQ queue is empty, the flow controller thread enters a blocked waiting phase. Once a data writer inserts a new DDS message into the PQ, or the wait times out, the thread is immediately awakened. After being awakened, the flow controller thread returns to the initialization phase and continues processing the PQ and timed events.

[0045] Example 2 This embodiment provides a time-triggered DDS communication system based on a message preemption mechanism, including a memory and a processor. The memory stores a computer program, and the processor calls the computer program to execute the steps of a time-triggered DDS communication method based on a message preemption mechanism as described in Embodiment 1.

[0046] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.

Claims

1. A time-triggered DDS communication method based on message preemption mechanism, characterized in that, Includes the following steps: The data sample to be published is input into the DDS middleware for serialization and encapsulated into a DDS message. The structure of the DDS message is simplified to a fixed format. The encapsulated DDS message is transmitted to the DDS flow controller, which has a time-sensitive queue and a preemptible queue. The DDS flow controller inserts DDS messages generated by time-sensitive applications into the time-sensitive queue and DDS messages generated by best-effort applications into the preemptible queue. By controlling the opening and closing of the queue doors of the time-sensitive queue and the preemptible queue, the corresponding DDS message is sent to the transport layer. The opening and closing control process for the queue gates of the time-sensitive queue and the preemptible queue includes: During the initialization phase, the queue gate of the time-sensitive queue is opened, while the queue gate of the preemptible queue is closed. DDS messages in the time-sensitive queue are sent to the transport layer in sequence and then deleted from the time-sensitive queue. When the time-sensitive queue is empty, open the queue gate of the preemptible queue, send the DDS messages in the preemptible queue to the transport layer in sequence, and delete them from the preemptible queue. After each successful transmission of a DDS message in the preemptible queue, recheck the status of the time-sensitive queue. If there is a new DDS message in the time-sensitive queue, close the queue gate of the preemptible queue and open the queue gate of the time-sensitive queue for processing.

2. The time-triggered DDS communication method based on message preemption mechanism according to claim 1, characterized in that, The opening and closing control process for the queue gates of the time-sensitive queue and the preemptible queue also includes: If both the time-sensitive queue and the preemptible queue are empty, the DDS flow controller enters a blocking wait state and synchronously starts the corresponding timeout timer. After the timeout, the DDS flow controller is woken up. If a new DDS message is received while the DDS flow controller is in the blocking wait state, the DDS flow controller is woken up and re-enters the initialization phase.

3. The time-triggered DDS communication method based on message preemption mechanism according to claim 1, characterized in that, The simplified DDS message structure, which is in a fixed format, includes an RTPS header, an InfoDestination sub-message, an InfoTimeStemp sub-message, and a Data / DataFrag sub-message. The RTPS header is used to maintain the format specified by the protocol. The InfoDestination sub-message is used to declare the destination node information of the DDS message. The InfoTimeStemp sub-message is used to record the timestamp of data publication. The Data / DataFrag sub-message is used to store serialized data.

4. The time-triggered DDS communication method based on message preemption mechanism according to claim 3, characterized in that, The encapsulation into a DDS message includes: The serialized data is written to the specified position of the Data / DataFrag sub-message, and then the information in the InfoDestination sub-message and InfoTimeStemp sub-message is updated according to the data sample to complete the encapsulation of the DDS message.

5. A time-triggered DDS communication method based on a message preemption mechanism according to claim 4, characterized in that, If the size of the serialized data exceeds the preset byte threshold, it will be fragmented according to the maximum fragment length pre-configured in the DDS middleware, and each fragment will be stored in the specified position of the Data / DataFrag sub-message in the form of a linked list. The preemptible queue is sent in units of fragments. After each successful transmission of a fragment in the preemptible queue, the status of the time-sensitive queue is rechecked.

6. The time-triggered DDS communication method based on message preemption mechanism according to claim 1, characterized in that, The DDS flow controller also includes a timed event table for controlling the DDS message publication timing of the time-sensitive queue.

7. A time-triggered DDS communication method based on a message preemption mechanism according to claim 6, characterized in that, The timed event table registers multiple timed events during the initialization phase. Each timed event has a corresponding trigger time, event period, historical cache pointer, and data sample sequence number to be published. The timed events in the timed event table are arranged in ascending order of their trigger times. Before the trigger time of a certain timed event is reached, the DDS flow controller closes the queue gate of the preemptible queue, opens the queue gate of the time-sensitive queue, and sends the DDS message corresponding to the current timed event. After sending, the queue gate of the preemptible queue is opened and the queue gate of the time-sensitive queue is closed.

8. A time-triggered DDS communication method based on a message preemption mechanism according to claim 7, characterized in that, The method further includes: When sending the DDS message corresponding to the current timed event, the trigger time of the next timed event is looked up from the timed event table. and in The queue gates for preemptible queues should be kept closed at all times. , The time taken for the DDS flow controller to process a maximum DDS message fragment; If the current time has not yet arrived If successful, open the preemptible queue gate, close the time-sensitive queue gate, and send DDS messages from the preemptible queue. After each successful transmission of a DDS message from the preemptible queue, recheck whether the current time has elapsed. If the message does not arrive, continue sending DDS messages from the preemptible queue; otherwise, close the queue gate of the preemptible queue, open the queue gate of the time-sensitive queue, and send DDS messages from the time-sensitive queue.

9. A time-triggered DDS communication method based on a message preemption mechanism according to claim 8, characterized in that, The method further includes: If the current time has not yet arrived If the preemptible queue is empty, the system enters a blocking waiting phase, inserting a new DDS message into the preemptible queue, or waking up the DDS flow controller when the waiting timeout occurs.

10. A time-triggered DDS communication system based on a message preemption mechanism, characterized in that, It includes a memory and a processor, the memory storing a computer program, the processor invoking the computer program to perform the steps of the method as described in any one of claims 1 to 9.