Data transmission method, electronic device and storage medium
By flexibly handling the transmission of low-priority messages in time-sensitive networks, the problems of latency and low bandwidth utilization of high-priority messages are solved, achieving efficient data transmission.
Patent Information
- Application Number
- CN202210208969.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-04
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-03-04
AI Technical Summary
In time-sensitive networks, high-priority packets suffer from transmission delay jitter and low bandwidth utilization, especially when low-priority packets fail to be sent in time, leading to increased delays or wasted bandwidth for high-priority packets.
Within the first time window, a decision is made based on the remaining time and message length to send a portion of a low-priority message or a slice, ensuring that high-priority messages are sent in a timely manner within the next time window and maximizing bandwidth utilization within the remaining time.
It reduces transmission latency jitter of high-priority messages, improving bandwidth utilization and data transmission performance.
Smart Images

Figure CN116743674B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a data transmission method, electronic device, and storage medium. Background Technology
[0002] With the rapid popularization of smart terminals and the rapid development of mobile internet, mobile services are growing exponentially, and the time requirements for transmission speed are becoming increasingly stringent. Time-Sensitive Networking (TSN) has emerged to meet this need. TSN can be used to transmit audio or video information and has wide applications in industries such as vehicle networking, industrial automation, etc. TSN is a new generation network protocol standard based on Ethernet. This standard defines a time-sensitive mechanism for Ethernet data transmission, providing functions such as time synchronization and delay guarantees to ensure real-time performance, thus increasing the stability and reliability of Ethernet data transmission.
[0003] The 802.1QBV (enhancements for scheduled traffic) mechanism in the TSN protocol employs a time-window-based scheduling mechanism, distributing different service packets across different time windows to avoid packet conflicts. Typically, if the first packet to be sent in a previous time window is long and not completed by the end of that window, the second packet to be sent in the adjacent subsequent time window cannot be sent immediately at the start of that window; it must wait for the first packet to be sent before being sent. Alternatively, if the first packet to be sent in a previous time window is long, it can be chosen not to send the first packet before the end of the previous time window, and instead send the second packet in the adjacent subsequent time window.
[0004] Service messages transmitted in the network can include high-priority messages corresponding to high-priority services and low-priority messages corresponding to low-priority services. Assuming the second message is a high-priority message, since high-priority messages have high real-time requirements, if the second message is sent only after the first message has finished being sent within the second time window, there will be unacceptable transmission delays, affecting data transmission performance. Conversely, if the first message is not sent if there is insufficient remaining time in the previous time window to ensure its real-time performance, it will result in a waste of message transmission bandwidth. Summary of the Invention
[0005] This application provides a data transmission method, electronic device, and storage medium that can reduce transmission delay jitter of high-priority messages, while improving bandwidth utilization and data transmission performance.
[0006] Firstly, embodiments of this application provide a data transmission method applied in a TSN-supported network, which can be executed by any electronic device capable of sending messages within the network. The data transmission method may include: within a first time window for sending a message of first priority, if a first message to be sent exists, determining a first remaining duration from the time the first message is to be sent to the end time of the first time window, wherein the first message is a message of first priority. The transmission duration required to send the first message is determined based on the message length and message transmission rate of the first message, where the message length of the first message is the number of bytes contained in the first message; the transmission duration required to send the shortest message slice is determined based on the length of the shortest message slice supported by the network and the message transmission rate. The transmission duration required to send the first message is used as a maximum duration threshold, and the transmission duration required to send the shortest message slice is used as a minimum duration threshold. If the first remaining duration is greater than or equal to the maximum duration threshold, the complete first message is sent. If the first remaining duration is less than the minimum duration threshold, the first message is not sent, and the system enters an idle state, waiting for the first time window to end. If the first remaining duration is greater than or equal to the minimum duration threshold and less than the maximum duration threshold, and the number of bytes contained in the first message is greater than or equal to the first set number of bytes, the first part of the first message's bytes are sent within the first time window. The first set number of bytes is determined based on the number of bytes contained in the shortest message slice supported by the network. The number of bytes in the first part and the number of bytes in the second part of the first message not sent within the first time window are both greater than or equal to the number of bytes contained in the shortest message slice. At the beginning of the second time window used to send messages with second priority, if a second message to be sent exists, it is sent. The second time window is the next time window adjacent to the first time window, and the second message is a message with second priority, which is higher than the first priority.
[0007] Optionally, the first set number of bytes can be twice the number of bytes contained in the shortest message slice; or, the first set number of bytes can be the sum of the number of bytes contained in the shortest message slice and the minimum number of bytes set by the network protocol.
[0008] The data transmission method provided in this application embodiment allows for the transmission of a portion of the low-priority message within the remaining time window if the remaining time is insufficient to send a low-priority message but sufficient to send a shortest message slice. If the length of the low-priority message satisfies the condition for segmentation, a portion of the low-priority message can be sent within the remaining time window to ensure timely transmission of the high-priority message at the start of the second time window. This reduces transmission delay jitter in the high-priority message and improves its transmission timeliness. Furthermore, compared to not sending low-priority messages when there is insufficient remaining time, sending a portion of the low-priority message within the remaining time window maximizes the utilization of the remaining time, improves bandwidth utilization, and enhances data transmission performance.
[0009] In one possible implementation, within the first remaining duration of the first time window, the first portion of bytes of the first message can be sent as follows: Each byte in the first message is sent in the order of its byte counterpart. For each byte sent, the remaining unsent bytes and the second remaining duration are determined. The second remaining duration is the duration from the current time to the end of the first time window. If the remaining bytes are greater than a second set number of bytes, and the second remaining duration is greater than a preset duration, the next byte is sent. The second set number of bytes can be the number of bytes contained in the shortest message slice. Setting the second set number of bytes ensures that the second portion of bytes can be sent as a message slice, i.e., the number of bytes in the second portion of bytes is greater than or equal to the number of bytes contained in the shortest message slice. If the remaining bytes are equal to the set number of bytes, the next byte is stopped, the message enters an idle state, waits for the first time window to end, and the first portion of bytes is used as the first message slice. If the remaining bytes are greater than the set number of bytes and the second remaining duration is less than or equal to the preset duration, the next byte is stopped, the message enters an idle state, waits for the first time window to end, and the first portion of bytes is used as the first message slice. When using the first portion of bytes as the first packet slice, a 4-byte cyclic redundancy check (CRC) field needs to be added. The preset duration is a pre-defined value. In some embodiments, the preset duration is set based on the number of bytes of the CRC field to be added; the preset duration is greater than the transmission time required to send the 4-byte CRC field. In other embodiments, when setting the preset duration, the inter-packet gap (IPG) between packet slices can also be considered. That is, the preset duration is set based on the number of bytes of the CRC field to be added and the IPG; the CRC field is 4 bytes, the IPG can be 12 bytes, and the preset duration is greater than or equal to the transmission time required to send 16 bytes.
[0010] In the above embodiments, each byte of the first message is sent one by one. After each byte is sent, it is determined whether the remaining bytes and remaining time meet the conditions for sending the next byte. If both the remaining bytes and remaining time meet the conditions for sending the next byte, then the next byte is sent to minimize the remaining time. The first message is sent as much as possible based on the remaining time, and the optimal segmentation position is automatically selected through iterative looping to make full use of the remaining time of the first time window and improve bandwidth utilization. At the same time, if the remaining bytes are equal to the set number of bytes, the sending of the next byte is stopped to ensure that the remaining bytes can be sent as a message slice in other time windows in the following time windows. This avoids the problem of information loss in the first message caused by discovering that the remaining bytes are too short to be segmented at the end of the first time window and therefore cannot be sent in other time windows.
[0011] In another possible implementation, within the first remaining duration of the first time window, the first portion of bytes of the first message can be sent as follows: N bytes of the first message are sent in the order of the bytes in the first message; where the value of N is determined based on the first remaining duration, and the transmission time required to send N bytes is less than the first remaining duration. Bytes after the N bytes of the first message are sent in the order of the bytes in the first message. For each byte sent, the remaining unsent bytes and the second remaining duration are determined; where the second remaining duration is the duration from the current time to the end of the first time window. If the remaining bytes are greater than a second set number of bytes, and the second remaining duration is greater than a preset duration, the next byte is sent; if the remaining bytes are equal to the set number of bytes, the next byte is stopped, and the system enters an idle state, waiting for the first time window to end; if the remaining bytes are greater than the set number of bytes, and the second remaining duration is less than or equal to the preset duration, the next byte is stopped, and the system enters an idle state, waiting for the first time window to end.
[0012] In the above embodiment, the number of bytes that can be sent within the first remaining time is first determined. Then, N bytes from the first message are sent, where N is less than the number of bytes that can be sent within the first remaining time. After sending N bytes, each byte in the first message is sent one by one. A judgment is performed after each byte is sent to ensure that the remaining bytes can be sent as a message slice in other time windows. This avoids the problem of information loss in the first message caused by discovering that the remaining bytes are too short to be sliced at the end of the first time window and therefore cannot be sent in other time windows. It also reduces the number of judgments, reduces the consumption of computing resources, and saves equipment energy.
[0013] In one possible implementation, after sending the second message, if there is a third remaining time within the second time window, the second part of bytes that were not sent in the first message are sent within the third remaining time. This allows for the timely transmission of low-priority messages while ensuring the timeliness of high-priority message transmission, and makes full use of transmission bandwidth resources.
[0014] Optionally, when sending the second part of the first message within the third remaining time, the above method can still be used. First, determine whether the third remaining time is sufficient to send the second part of the bytes. If the third remaining time is not sufficient to send the second part of the bytes, but sufficient to send a shortest message slice, the above method can be used to send a portion of the second part of the bytes first, further improving bandwidth utilization.
[0015] Secondly, embodiments of this application provide an electronic device, including a processor and a communication unit; the communication unit is used for the electronic device to send and receive messages with other devices; the processor is used for:
[0016] If it is determined that a first message to be sent exists within the first time window, then a first remaining duration is determined; the first time window is used to send messages of the first priority; the first message is a message of the first priority; the first remaining duration is the duration from the time the first message is to be sent to the end time of the first time window; if the first remaining duration is greater than or equal to the minimum duration threshold and less than the maximum duration threshold, and the number of bytes contained in the first message is greater than or equal to the first set number of bytes, then within the first remaining duration, the control communication unit sends the first part of the bytes of the first message; the maximum duration threshold is the transmission duration required to send the first message; the minimum duration threshold is the transmission duration required to send the shortest message slice supported by the network; the number of bytes in the first part and the unsent second part of the bytes in the first message are both greater than or equal to the number of bytes contained in the shortest message slice;
[0017] If it is determined that there is a second message to be sent at the beginning of the second time window, the control communication unit sends the second message; the second time window is used to send messages with the second priority; the second message is a message with the second priority; the second priority is higher than the first priority.
[0018] In one possible implementation, when the processor controls the communication unit to send the first portion of the first message bytes within the first remaining time period, it specifically performs the following:
[0019] The control communication unit sends each byte in the first message in the order of the bytes in the first message. After sending each byte, it determines the remaining bytes that have not been sent in the first message and the second remaining time. The second remaining time is the time between the time when the byte is sent and the end time of the first time window. If the remaining bytes are greater than the second set number of bytes and the second remaining time is greater than the preset time, the control communication unit continues to send the next byte. If the remaining bytes are equal to the second set number of bytes, or if there is no second remaining time between the current time and the end time of the first time window, the control communication unit stops sending the next byte and waits for the first time window to end.
[0020] In another possible implementation, when the processor controls the communication unit to send the first portion of the first message bytes within the first remaining time period, it is specifically used for:
[0021] The control communication unit sends N bytes of the first message in the order of each byte in the first message; the value of N is determined based on the first remaining time, and the transmission time required to send N bytes is less than the first remaining time; the control communication unit sends each byte after the N bytes of the first message in the order of each byte in the first message, and after sending each byte, determines the remaining bytes that have not been sent in the first message and the second remaining time; the second remaining time is the time between the time when the byte is sent and the end time of the first time window; if the remaining bytes are greater than the second set number of bytes and the second remaining time is greater than the preset time, the control communication unit continues to send the next byte; if the remaining bytes are equal to the second set number of bytes, or if there is no second remaining time between the current time and the end time of the first time window, the control communication unit stops sending the next byte and waits for the first time window to end.
[0022] In one possible implementation, after the processor controls the communication unit to send the second message, if it is determined that there is still a third remaining time within the second time window, the processor can then control the communication unit to send the second part of the bytes that were not sent in the first message within the third remaining time.
[0023] Thirdly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method proposed in any of the possible designs of the first aspect above.
[0024] Fourthly, embodiments of this application provide a computer program product comprising computer-executable instructions for causing a computer to perform the method proposed in any of the possible designs of the first aspect.
[0025] The technical effects that can be achieved by any of the second to fourth aspects mentioned above can be referred to the description of the beneficial effects in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0026] Figure 1 This is a schematic diagram illustrating one application scenario of an embodiment of this application;
[0027] Figure 2 A timing comparison diagram of two scheduling modes for transmitting messages in a communication system;
[0028] Figure 3 This is a timing diagram of the message transmission process in a related technology;
[0029] Figure 4 A flowchart illustrating a data transmission method provided in an embodiment of this application;
[0030] Figure 5 A flowchart illustrating another data transmission method provided in this application embodiment;
[0031] Figure 6 A timing diagram for message transmission provided in an embodiment of this application;
[0032] Figure 7 A timing diagram for another message transmission provided in an embodiment of this application;
[0033] Figure 8 A schematic diagram illustrating message segmentation as provided in an embodiment of this application;
[0034] Figure 9 A timing diagram for another message transmission provided in an embodiment of this application;
[0035] Figure 10 A timing diagram for another message transmission provided in an embodiment of this application;
[0036] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the embodiments of this application will be described in detail below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application.
[0038] Before introducing the specific solutions provided in the embodiments of this application, some terms used in this application will be explained to facilitate understanding by those skilled in the art, but the terms used in this application are not limited.
[0039] (1) TSN: TSN originated from the application needs in the video field. Because general Ethernet typically operates asynchronously, the timing of data transmission is neither precise nor certain. Therefore, general Ethernet technology only solves the problem of devices sharing network infrastructure and data connections, but it cannot effectively achieve real-time, deterministic, and reliable data transmission between devices. Networks transmitting audio or video data need to adhere to strict timing rules. If audio or video data fails to arrive at the receiving device according to the specified timing rules, the receiving device (e.g., a video screen or speaker) may experience dropped video frames and audio artifacts. Furthermore, networks transmitting audio or video data require predictable latency. To ensure synchronization between video streams and related audio streams, TSN was developed.
[0040] Time-Sensitive Networking (TSN) refers to a set of sub-standards developed within the IEEE 802.1 standard framework, based on specific application requirements. Its aim is to establish a universal time-sensitive mechanism for the Ethernet protocol to ensure the deterministic timing of network data transmission. TSN is a set of protocol standards, not a single protocol. It comprises numerous protocols, a standardized collection of approaches proposed from multiple perspectives to address various scenarios. Essentially, it focuses on how to manage and schedule messages at the granular level of time management and how to ensure the real-time transmission of high-priority messages, achieving optimal scheduling efficiency and user experience in different application scenarios. In other words, TSN will provide a universal time-sensitive mechanism for the Ethernet protocol's MAC layer, ensuring the deterministic timing of Ethernet data communication while enabling interoperability between networks using different protocols.
[0041] Time-Sensitive Networking (TSN) can be considered a concept, a set of approaches for network deployment. Simply put, it means that time factors must be considered in network planning and deployment, as well as hardware priority traffic planning. In traditional network deployments, whether it's a network interface card (NIC), router, or switch, time-insensitive scheduling is used. In network data scheduling methods, TSN is generally referred to as synchronous scheduling; in contrast, ordinary scheduling is called asynchronous scheduling.
[0042] (2) Synchronous scheduling: This is the concept opposite to asynchronous scheduling. Asynchronous scheduling means that the scheduling or sending of service messages is independent of time, and traditional shaping or scheduling methods can be used to manage the priority of service messages. Synchronous scheduling, on the other hand, means that the scheduling or sending of service messages is related to time. For example, message A is sent at time T1, and message B is sent at time T2. If the messages are periodic, then the messages may be sent once every set time interval (the time difference between T2 and T1). Synchronous scheduling can distribute the messages across different time periods according to the time pattern of the messages, thereby ensuring that different service traffic will not conflict, making full use of time, improving efficiency, and achieving better service performance and user experience.
[0043] In this application embodiment, "multiple" refers to two or more. Therefore, in this application embodiment, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, such as one, two, or more. For example, "including at least one" means including one, two, or more, and it does not limit which ones are included. For example, including at least one of A, B, and C, then it could include A, B, C, A and B, A and C, B and C, or A and B and C. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / ", unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.
[0044] Unless otherwise stated, the ordinal numbers such as "first" and "second" mentioned in the embodiments of this application are used to distinguish multiple objects, and are not used to limit the order, sequence, priority or importance of multiple objects.
[0045] The data transmission method provided in this application embodiment can be applied to communication systems that support TSN. These communication systems can be various types of communication systems, such as Long Term Evolution (LTE), 5G, Universal Terrestrial Radio Access (UTRA), Evolved UTRA (E-UTRAN), New Radio (NR), GSM / EDGE Radio Access Network-Circuit Switched (GERAN-CS), GSM / EDGE Radio Access Network-Packetswitched (GERAN-PS), Code Division Multiple Access (CDMA) 2000-1XRTT, and Multi-RAT Dual-Connectivity (MR-DC). It can also be a hybrid architecture of multiple communication systems, such as a hybrid architecture of LTE and 5G.
[0046] Figure 1 A schematic diagram of a communication system is shown. This system may include at least one first device 100, at least one second device 300, and at least one network device 200, all of which together form a communication network. The network device 200 can be understood as a relay node in the communication network, used to transmit data or information between the devices. Exemplarily, the network device 200 may be a regular base station (such as a Node B or eNB), a new radio controller (NR controller), a gNode B (gNB) or en-gNB in a 5G system, a centralized unit, a new radio base station, a remote radio module, a micro base station, a relay, a distributed unit, a transmission reception point (TRP) or transmission point (TP), or any other wireless access device such as a switch, router, or bridge. This application does not limit the specific implementation of this embodiment.
[0047] In some embodiments, both the first device 100 and the second device 300 can be terminal devices. For example, a terminal device can be a programmable logic controller (PLC) or a data acquisition device capable of accessing an Ethernet network; alternatively, a terminal device can be referred to as user equipment (UE), a device that provides voice and / or data connectivity to a user, such as a handheld device or in-vehicle device with wireless connectivity. Common terminal devices may include: mobile phones, tablets, laptops, PDAs, mobile internet devices (MIDs), and wearable devices such as smartwatches, smart bracelets, and pedometers.
[0048] In other embodiments, the first device 100 and the second device 300 may be a terminal device and a core network device or server, respectively. The core network device may be a mobility management entity (MME), a serving gateway (SGW), or an access and management function (AMF), user plane function (UPF), etc., in a 5G system. The core network device can provide further network connectivity, such as telephone networks and / or data communication networks (e.g., the internet). Base stations can be connected to the core network device via communication links.
[0049] The aforementioned communication system supports TSN, and the clocks and times of each device in the system are synchronized. The 802.1QBV protocol in TSN employs a time-window-based scheduling mechanism, distributing different service packets across different time windows to avoid packet conflicts. 802.1QBV will be referred to as QBV scheduling mode below.
[0050] For example, such as Figure 2 As shown, assume there exists a message queue consisting of 0 / 1 / 2 / 3, meaning this message queue includes service message 0, service message 1, service message 2, and service message 3. In the previous non-QBV scheduling mode, the scheduling and sending might have been first-in, first-out (FIFO). Therefore, according to the time order in which the service messages in the message queue were received, the output order would be service message 1 → service message 0 → service message 2 → service message 3, i.e., FIFO.
[0051] According to actual business requirements, it is desired to output business messages in the order of 0 → 1 → 2 → 3, with message 0 expected to be output at 2:00, message 1 at 2:10, message 2 at 2:20, and message 3 at 2:30. While non-QBV scheduling mode might achieve the order of 0-3, it cannot output at precise times. QBV scheduling mode can be used to divide the time into several time windows according to a set pattern, for example, each time window being 10 minutes. Figure 2 As shown:
[0052] 1000: This indicates that from 2:00 to 2:10, only service message 0 is allowed to be sent during this time window;
[0053] 0100: This indicates that from 2:10 to 2:20, only service message 1 is allowed to be sent within this time window;
[0054] 0010: This indicates that from 2:20 to 2:30, only service message 2 is allowed to be sent within this time window;
[0055] 0001: This indicates that from 2:30 to 2:40, only service message 3 is allowed to be sent within this time window.
[0056] During the aforementioned time window segmentation process, it is necessary to set the start time, window interval, and on / off status within the window. The start time can be set to 2:00 AM, indicating that time window segmentation begins at 2:00 AM. The window interval can be understood as the duration of each time window, set to 10 minutes. The on / off status within the window refers to which service packets are allowed to be output within the corresponding time window; for example, in chronological order, each time window allows service packets 0 through 3 to be output respectively.
[0057] The above process enables time-window-based scheduling, allowing each message queue to output precisely at the boundary time of its time window (the start time of the time window). However, simply dividing the time window does not guarantee that message transmission between time windows will be completely unaffected. For example, if the first message to be sent in the previous time window is long and has not been completed by the end of the previous time window, the second message to be sent in the adjacent subsequent time window cannot be sent immediately at the beginning of the subsequent time window, but must wait for the first message to be sent before being sent.
[0058] Service messages transmitted in a network can include high-priority messages corresponding to high-priority services and low-priority messages corresponding to low-priority services. For example, service messages with a transmission priority higher than a set priority can be called high-priority messages (express traffic). High-priority messages have higher real-time requirements and are referred to as E messages below. Service messages with a transmission priority no higher than a set priority can be called low-priority messages (preemptable traffic), referred to as P messages below. For instance, the message priority of high-definition video is often higher than that of web news messages; therefore, high-definition video messages can be E messages and can be sent first, while web news messages can be P messages, with a relatively lower sending priority than E messages.
[0059] like Figure 3 As shown, if two adjacent time windows are used to transmit P-messages (the first window is called the P-message time window), and the second window is used to transmit E-messages (the second window is called the E-message time window), and a long P-message is transmitted shortly before the start of the E-message time window, then the E-messages in the second time window must wait for the P-message to finish before they can be transmitted. Therefore, the transmission time of the E-messages will deviate significantly from the expected start time (the start of the E-message time window), potentially reaching tens of microseconds. This delay is unacceptable for E-messages. If, to ensure the real-time transmission of E-messages, P-messages are not transmitted when there is insufficient remaining time in the first time window, this also wastes packet transmission bandwidth.
[0060] Based on this, embodiments of this application provide a data transmission method, which includes: within a first time window for sending P messages, if a first message to be sent exists, determining a first remaining duration from the time the first message is to be sent to the end time of the first time window, wherein the first message is a P message. If the remaining duration of the first time window is insufficient to send a low-priority message to be sent, but sufficient to send a shortest message slice, and the message length of the first message satisfies the condition of being divisible, i.e., the first message can be divided into at least two shortest message slices, then a portion of the bytes of the low-priority message can be sent within the remaining duration of the first time window. At the beginning of a second time window for sending E messages, if a second message to be sent exists, then the second message is sent; wherein the second time window is the next time window adjacent to the first time window, the second message is an E message, and the priority of the E message is higher than that of the P message. Through the above process, it can be ensured that the E message is sent on time at the beginning of the second time window, thereby reducing the transmission delay of the E message and improving the transmission timeliness of the E message. Meanwhile, compared to not sending P packets when there is not enough remaining time, sending a portion of the P packets within the remaining time of the first time window can maximize the use of the remaining time of the first time window, improve bandwidth utilization, and enhance data transmission performance.
[0061] Figure 4 The flowchart illustrates a data transmission method according to an embodiment of this application. This data transmission method can be executed by any device or any node in a communication system that supports TSN. For example, it can be executed by... Figure 1 Execute on any of the devices in the list. For example... Figure 4 As shown, the method may include the following steps:
[0062] S401, when there is a first message to be sent within the first time window, determine the first remaining time.
[0063] As mentioned above, TSN employs a time-window-based scheduling mechanism, dividing time into multiple time windows and distributing different service packets within these windows for transmission. The first time window is used to send P packets, where the first packet is a P packet, and the first remaining duration refers to the time elapsed from the time the first packet is scheduled to be sent to the end of the first time window.
[0064] S402, determine whether the first remaining time is less than the maximum time threshold; if yes, proceed to step S404; if no, proceed to step S403.
[0065] The maximum duration threshold is the transmission time required to send the first message. For example, the transmission time required to send the first message can be determined based on the message length and transmission rate of the first message, where the message length refers to the number of bytes contained in the first message.
[0066] S403, directly send the first message.
[0067] If the first remaining time is greater than or equal to the maximum time threshold, it means that the first remaining time is sufficient to send the first message. In this case, the complete first message is sent directly, and the system enters an idle state after the first message is sent.
[0068] S404, determine whether the first remaining time is greater than or equal to the minimum time threshold; if yes, proceed to step S406; if no, proceed to step S405.
[0069] The minimum duration threshold is the transmission time required for the shortest message slice supported by the sending network. If the first remaining duration is less than the maximum duration threshold and insufficient to send the first message, the first message can be divided into at least two message slices for transmission. At least one of these message slices can be sent within the first remaining duration. In this case, it is necessary to determine whether the first remaining duration is sufficient to send a minimum message slice. The length of the minimum message slice can be set according to the characteristics of different networks or the requirements of network protocols; different networks may have different minimum message slice lengths. For example, the transmission time required to send the minimum message slice can be determined based on the length of the minimum message slice and the message transmission rate.
[0070] S405: Do not send the first message, enter the idle state.
[0071] If the first remaining time is less than the minimum time threshold, it means that the first remaining time is not enough to send a shortest message slice. Therefore, the first message is not sent, and the device enters an idle state, waiting for the start of the second time window.
[0072] S406, determine whether the number of bytes contained in the first message is greater than or equal to the first set number of bytes; if yes, proceed to step S407; if no, proceed to step S405.
[0073] The first set number of bytes is determined based on the number of bytes contained in the shortest packet slice supported by the network. Optionally, the first set number of bytes can be twice the number of bytes contained in the shortest packet slice, or the first set number of bytes can be the sum of the number of bytes contained in the shortest packet slice and the minimum number of bytes set by the network protocol.
[0074] If the remaining time is insufficient to send the first message, and the length of the first message is too short (less than the first set number of bytes), thus failing to meet the conditions for segmentation, then the first message will not be sent, and the system will enter an idle state, waiting for the start of the second time window.
[0075] The execution order of the above steps S402, S404, and S406 can be interchanged. For example, in some other embodiments, steps S402, S406, and S404 can be executed in that order: first, it is determined whether the first remaining time is sufficient to send the first message; then, it is determined whether the first message meets the segmentable condition; and finally, it is determined whether the first remaining time is sufficient to send a shortest message slice.
[0076] S407, send the first part of the first message bytes.
[0077] If the remaining time is insufficient to send the first message, but sufficient to send a minimum message slice, and the first message meets the segmentability condition, then the first portion of the first message can be sent within the first time window. The number of bytes in the first portion and the number of bytes in the second portion of the first message not sent within the first time window are both greater than or equal to the number of bytes contained in the minimum message slice.
[0078] S408: At the beginning of the second time window, if there is a second message to be sent, then send the second message.
[0079] The second time window and the first time window are two adjacent time windows, with the second time window following the first time window. The second time window is used to send E-messages, and the second message is an E-message. After the second message is sent, if there is a third remaining time within the second time window, the second part of the bytes that were not sent in the first message can be sent within the third remaining time.
[0080] Optionally, when sending the second part of the first message within the third remaining time, the above method can still be used. First, determine whether the third remaining time is sufficient to send the second part of the bytes. If the third remaining time is not sufficient to send the second part of the bytes, but sufficient to send a shortest message slice, the above method can be used to send a portion of the second part of the bytes first, further improving bandwidth utilization.
[0081] The data transmission method provided in this application embodiment allows for the transmission of a portion of the low-priority message within the remaining time window if the remaining time window is insufficient to send a low-priority message but sufficient to send a shortest message slice. If the length of the low-priority message satisfies the condition for segmentation, a portion of the low-priority message can be sent within the remaining time window to ensure timely transmission of the high-priority message at the start of the second time window. This reduces the transmission delay of the high-priority message and improves its transmission timeliness. Furthermore, compared to not sending low-priority messages when the remaining time is insufficient, sending a portion of the low-priority message within the remaining time window fully utilizes the remaining time, improving bandwidth utilization and data transmission performance.
[0082] In some embodiments, in step S407 above, sending the first portion of bytes of the first message can be implemented as follows: Each byte in the first message is sent sequentially. For each byte sent, the remaining unsent bytes and the second remaining duration in the first message are determined. The second remaining duration is the duration from the completion of sending the first byte to the end of the first time window. If the remaining bytes are greater than a second set number of bytes and the second remaining duration is greater than a preset duration, the next byte is sent. The second set number of bytes can be the number of bytes contained in the shortest message slice. Setting the second set number of bytes ensures that the second portion of bytes can be sent as a message slice, i.e., the number of bytes in the second portion of bytes is greater than or equal to the number of bytes contained in the shortest message slice. If the remaining bytes are equal to the set number of bytes, sending the next byte stops, the system enters an idle state, waits for the first time window to end, and uses the first portion of bytes as the first message slice. If the remaining bytes are greater than the set number of bytes and the second remaining duration is less than or equal to the preset duration, sending the next byte stops, the system enters an idle state, waits for the first time window to end, and uses the first portion of bytes as the first message slice. The preset duration is a pre-set value. When using the first portion of bytes as the first message slice, a 4-byte CRC field needs to be added. In some embodiments, the preset duration is greater than the transmission time required to send the 4-byte CRC field. In other embodiments, when setting the preset duration, an IPG can also be considered. The IPG can be 12 bytes, meaning the preset duration is greater than or equal to the transmission time required to send 16 bytes.
[0083] In the above embodiments, each byte in the first message is sent one by one. After each byte is sent, it is determined whether the remaining bytes and remaining time meet the conditions for sending the next byte. If both the remaining bytes and remaining time meet the conditions for sending the next byte, the next byte is sent to minimize the remaining time. The first message is sent as much as possible according to the remaining time. The optimal segmentation position is automatically selected through iterative looping to make full use of the remaining time of the first time window and improve bandwidth utilization. At the same time, if the remaining bytes are equal to the set number of bytes, the sending of the next byte is stopped to ensure that the second part of the bytes can be sent as a shortest message slice. This avoids the problem that the remaining second part of the bytes is too short to be segmented or sent at the end of the first time window, which would lead to information loss when transmitting the first message.
[0084] In some other embodiments, in step S407 above, sending the first portion of bytes of the first message can be achieved as follows: sending N bytes of the first message; wherein the value of N is determined based on the first remaining duration, and the transmission time required to send N bytes is less than the first remaining duration. Each byte after the N bytes in the first message is sent sequentially. After each byte is sent, the remaining unsent bytes and the second remaining duration in the first message are determined; wherein the second remaining duration is the duration from the time a byte is sent to the end of the first time window. If the remaining bytes are greater than a second set number of bytes, and the second remaining duration is greater than a preset duration, then the next byte is sent; if the remaining bytes are equal to the set number of bytes, then the next byte is stopped, and the system enters an idle state, waiting for the first time window to end; if the remaining bytes are greater than the set number of bytes, and the second remaining duration is less than or equal to the preset duration, then the next byte is stopped, and the system enters an idle state, waiting for the first time window to end.
[0085] In the above embodiment, the number of bytes that can be sent within the first remaining time is first determined, and N bytes of the first message are sent, where N is less than the number of bytes that can be sent within the first remaining time. After sending N bytes, each byte in the first message is sent one by one, and a judgment is made after each byte is sent. This can avoid the problem that the remaining second part of the bytes is too short to be segmented or sent, while also reducing the number of judgments, reducing the consumption of computing resources, and saving equipment energy.
[0086] Furthermore, at the end of step 408 above, after the second message is sent, if there is a third remaining time within the second time window, the second portion of bytes that were not sent in the first message can be sent within the third remaining time. This ensures the timely transmission of high-priority messages while allowing the remaining bytes in the first message to be sent as promptly as possible, thus improving the performance of low-priority services.
[0087] To better understand the technical solutions provided in the embodiments of this application, the data transmission method provided in the embodiments of this application is illustrated below with a detailed specific example, such as... Figure 5 As shown, the method may include the following steps:
[0088] S501, enter the idle state of the P-message time window used for transmitting P-messages.
[0089] If the current time is within the P-message time window for sending P-messages, the next adjacent time window is the E-message time window, and there are no P-messages to be sent at present, then the P-message time window enters the idle state.
[0090] S502, if a P message to be transmitted is detected, determine whether the remaining time is sufficient to send the P message to be transmitted; if yes, proceed to step S503; if no, proceed to step S504.
[0091] The remaining duration refers to the length of time from the current moment to the end of the P message time window or the start of the adjacent E message time window.
[0092] In one embodiment, the transmission time required to send the P message can be determined based on the message length and message transmission rate of the P message to be transmitted, wherein the message length refers to the number of bytes contained in the message.
[0093] If the remaining time is greater than or equal to the transmission time required to send the P message to be transmitted, then the remaining time is determined to be sufficient to send the P message to be transmitted; if the remaining time is less than the transmission time required to send the P message to be transmitted, then the remaining time is determined to be insufficient to send the P message to be transmitted.
[0094] In another embodiment, the maximum number of bytes that can be sent within the remaining time can be determined based on the remaining time and the message transmission rate. If the maximum number of bytes is greater than or equal to the message length of the P message to be transmitted, then the remaining time is sufficient to send the P message; if the maximum number of bytes is less than the message length of the P message to be transmitted, then the remaining time is insufficient to send the P message. For example, assuming the maximum number of bytes that can be sent within the remaining time is 110 bytes, if the message length of the P message to be transmitted is 70 bytes, then the remaining time is sufficient to send the P message; if the message length of the P message to be transmitted is 130 bytes, then the remaining time is insufficient to send the P message.
[0095] S503 directly sends the P message to be transmitted.
[0096] like Figure 6 As shown, if the remaining time is sufficient to send the P message to be transmitted, then the P message to be transmitted is sent, and after the transmission is completed, return to S501 and re-enter the idle state.
[0097] S504, determine whether the P message to be transmitted meets the segmentation conditions; if yes, proceed to step S505; if no, return to step S501.
[0098] The segmentation condition includes the message length reaching a set length. If the P message to be transmitted does not meet the segmentation condition, it will not be sent temporarily, and the system will re-enter the idle state of the P message time window to ensure that the E message can be sent immediately at the beginning of the adjacent E message time window. Figure 7As shown, the idle time period from the current moment to the end of the P-message time window can be called a dynamic isolation band. Alternatively, the idle time period from the current moment to the start of the next adjacent E-message time window can be called a dynamic isolation band. The isolation band refers to the time interval between sending P-messages and sending E-messages. In this embodiment, the length of the isolation band varies within different P-message time windows. This length is determined based on the number of P-messages to be sent within the corresponding P-message time window and is dynamically changing; hence, it is called a dynamic isolation band.
[0099] If the P-message to be transmitted meets the segmentation conditions, it can be segmented into at least two segmented segments. At least one segment is sent within the P-message time window to ensure that the E-message can be sent immediately at the beginning of the adjacent E-message time window. Other unsent P-message segments can be sent after the E-messages have finished sending. This message transmission mode can be called frame preemption mode. In frame preemption mode, the transmission of P-messages can be interrupted by E-messages, prioritizing the timely transmission of E-messages. P-messages can also be understood as preemptible segments; E-messages can be understood as segments that can preempt other segments for priority transmission.
[0100] In one embodiment, the set length can be 120 bytes. Due to the characteristics of Ethernet, a packet slice cannot be less than 64 bytes, and a packet must be at least 120 bytes long to guarantee that it can be sliced into two packet slices greater than 64 bytes each. For example, as... Figure 8 As shown, a 120-byte P message can be segmented into two 60-byte segments. Each segment has a 4-byte CRC field added at the physical layer, resulting in a total of 64 bytes. A 119-byte message can also be segmented into a 60-byte segment and a 59-byte segment. The 60-byte segment, after adding a 4-byte CRC field, reaches 64 bytes, making it a valid segment. However, the 59-byte segment, even with a 4-byte CRC field, only reaches 63 bytes, not 64 bytes. Segments shorter than 64 bytes are invalid. Therefore, a 119-byte message is too short to be segmented into at least two 64-byte segments, failing to meet the segmentation condition. In other words, the remaining bytes after segmentation cannot be less than 60 bytes. This means the length must be twice the minimum 60-byte segment size.
[0101] In another embodiment, the set length can be 140 bytes, that is, the set length is the sum of the number of bytes contained in the shortest message slice and the minimum number of bytes set by the network protocol, wherein the number of bytes contained in the shortest message slice can be 60 bytes and the minimum number of bytes set by the network protocol can be 80 bytes.
[0102] S505, determine whether the remaining time is sufficient to send a shortest message slice; if yes, proceed to step S506; if no, return to step S501.
[0103] The process involves determining whether the remaining duration is greater than or equal to the minimum duration threshold. This minimum duration threshold is determined based on the transmission time required to send a single shortest segment. As mentioned above, the length of the shortest segment can be 64 bytes. Based on the 64-byte length of the shortest segment and the message transmission rate, the transmission time required to send a single shortest segment can be determined. The minimum duration threshold can be either the transmission time required to send a single shortest segment, or it can be a value close to 0 added to the transmission time required to send a single shortest segment, making the minimum duration threshold slightly greater than the transmission time required to send a single shortest segment. Alternatively, when setting the minimum duration threshold, the IPG (Intended Percentage Group) can be considered. The IPG can be 12 bytes, meaning the minimum duration threshold can be the transmission time required to send a single shortest segment plus the transmission time required to send 12 bytes.
[0104] If the remaining time is less than the minimum time threshold, it means that the remaining time is not enough to send a message slice. Therefore, the P message to be transmitted will not be sent for the time being, and the P message will re-enter the idle state of the P message time window.
[0105] If the remaining duration is greater than or equal to the minimum duration threshold, the P-message to be transmitted can be sent according to the following steps.
[0106] In some embodiments, the execution order of steps S504 and S505 can be interchanged. That is, it can be determined first whether the remaining time is sufficient to send a minimum message slice. If the remaining time is sufficient to send a minimum message slice, then it can be determined whether the P message to be transmitted meets the segmentation conditions.
[0107] S506, send one byte of the P message to be transmitted in sequence.
[0108] If the P-message to be transmitted meets the segmentation condition and the remaining duration is greater than or equal to the minimum duration threshold, then each byte in the P-message to be transmitted is sent one by one. For each byte sent, the following judgment operation is performed once.
[0109] S507, determine whether the remaining bytes are greater than the set byte count threshold; if yes, proceed to step S508; if no, proceed to step S509.
[0110] The remaining bytes refer to the bytes in the P-message that have not yet been sent. For example, the byte count threshold can be set to 60 bytes.
[0111] S508, determine whether the remaining time is greater than the preset time; if yes, return to step S506; if no, proceed to step S509.
[0112] In some embodiments, considering that each segment of the P-message to be transmitted needs to have a 4-byte CRC field added, the preset duration needs to be at least sufficient to send the added 4 bytes. In other embodiments, when setting the preset duration, an IPG can also be considered, which can be 12 bytes, meaning the preset duration is greater than or equal to the transmission duration required to send 16 bytes.
[0113] If the remaining bytes are greater than 60 bytes and the remaining duration is greater than the preset duration, it means that at least one more byte can be sent. Then return to step S506 and continue sending the next byte in the P message to be transmitted.
[0114] In some embodiments, the execution order of steps S507 and S508 can be interchanged. That is, it can be determined first whether the remaining time is greater than the preset time; if the remaining time is greater than the preset time, then it can be determined whether the remaining bytes are greater than the set number of bytes.
[0115] A judgment is made after each byte is sent, so that as many bytes as possible can be sent within the P-message time window to maximize the use of current bandwidth efficiency.
[0116] S509 performs segmentation processing on the P-message to be transmitted.
[0117] The bytes already sent in the P-message to be transmitted are taken as the first message slice, i.e., P-message 1. The remaining bytes are taken as the second message slice. The second message slice is the message slice to be sent, i.e., the second message slice is not sent for the time being. The system enters an idle state and waits for the P-message time window to end and the E-message time window to begin. The E-message is sent at the beginning of the E-message time window. The second message slice, i.e., P-message 2, can be sent after the E-message has finished being sent.
[0118] If the remaining bytes are no more than 60 bytes (i.e., the remaining bytes equal to 60 bytes), it means that although there is still some remaining time, for example, enough time to send 40 bytes, the remaining bytes cannot be reduced further. If reduced further, the remaining bytes would only be 59 bytes, which does not meet the requirement that the remaining bytes after message segmentation cannot be less than 60 bytes. Therefore, when the remaining bytes equal to 60 bytes, even if there is still a considerable amount of remaining time, the next byte is not sent; instead, transmission ends, and the P-message to be transmitted is segmented, using the bytes already sent in the P-message to be transmitted as the first segment. Figure 9 As shown, after the transmission ends, it re-enters the idle state. At this time, there is still a dynamic isolation band between the start time of the next adjacent E message time window and the start time of the next E message.
[0119] If the remaining time is less than or equal to the preset time, since the preset time is close to 0, it means that the remaining time is already close to 0 and not enough to send the next byte. At this time, the transmission ends, and the P-message to be transmitted is segmented, with the bytes already sent in the P-message to be transmitted being used as the first segment. Figure 10 As shown, after the transmission ends, it re-enters the idle state. At this time, the isolation band between the start time of the adjacent E message time window and the start time of the next E message is very small and can be ignored. It can be assumed that the P message of the previous time window and the E message of the next time window are sent closely together.
[0120] Figure 5 The steps described above are those performed by the application layer of the electronic device. When the application layer divides the P-message to be transmitted into a first segment and a second segment, it can set a fragmentation flag before the first byte of the second segment; alternatively, the application layer can send a fragmentation message to the physical layer, causing the physical layer to add a fragmentation end flag after the last byte of the first segment. The physical layer can also add a 4-byte CRC field to the first segment and send the added 4-byte CRC field.
[0121] Through the above process, the P-message to be transmitted can be divided into at least two message slices for transmission. After receiving at least two message slices of the P-message to be transmitted, the receiving device can perform a slice reassembly operation based on information such as the fragmentation flag to obtain the complete P-message to be transmitted.
[0122] In the above embodiments, the set length, set number of bytes, minimum duration threshold, and preset duration are all set according to the communication protocol requirements for data transmission in Ethernet. In other communication networks, they can also be set according to the requirements of other communication protocols.
[0123] The technical solutions described above can achieve optimal bandwidth utilization while ensuring accurate E-message transmission delay, thus achieving the best performance and bandwidth benefits.
[0124] Based on the same inventive concept as the above method embodiments, this application also provides an electronic device, which can be... Figure 1 Any of the devices shown. This electronic device can be used to implement Figure 4 or Figure 5 The method embodiments shown can achieve the beneficial effects of the above-described method embodiments by providing the functionality of the methods described above.
[0125] In some embodiments, the structure of the electronic device 1100 can be as follows: Figure 11 As shown, the system includes a processor 1101 and one or more communication units 1102 connected to the processor 1101. The processor 1101 and the communication units 1102 can be interconnected via a bus. The processor 1101 can be a general-purpose processor, such as a microprocessor, or other conventional processor. The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc.
[0126] The communication unit 1102 is used to send or receive messages under the control of the processor 1101. The communication unit 1102 can be understood as a transceiver or data transceiver interface. The communication unit 1102 of the electronic device 1100 may include multiple transceivers, and different transceivers can be connected to different sending or receiving devices. For example, the electronic device 1100 can receive data messages sent by a sending device through one transceiver, and send the same data messages to the corresponding receiving device through another transceiver.
[0127] In one embodiment, the processor 1101 in the electronic device 1100 is used to run computer instructions or programs and execute... Figure 4 The function shown in the method embodiment. When the electronic device 1100 is used to implement Figure 4In the method shown, the processor 1101 is configured to: determine a first remaining duration if a first message to be sent exists within a first time window; the first time window is used to send a message of first priority; the first message is a message of first priority; the first remaining duration is the duration from the time the first message is to be sent to the end time of the first time window; if the first remaining duration is greater than or equal to a minimum duration threshold and less than a maximum duration threshold, and the number of bytes contained in the first message is greater than or equal to a first set number of bytes, then within the first remaining duration, control the communication unit 1102 to send a first portion of bytes of the first message; the maximum duration threshold is the transmission duration required to send the first message; the minimum duration threshold is the transmission duration required to send the shortest message slice supported by the network; the number of bytes of the second portion of bytes not sent in the first message is greater than or equal to the number of bytes contained in the shortest message slice; determine that a second message to be sent exists at the beginning time of the second time window, then control the communication unit 1102 to send the second message; the second time window is used to send a message of second priority; the second message is a message of second priority; the second priority is higher than the first priority.
[0128] In one embodiment, the electronic device 1100 may further include a memory for storing instructions or programs executed by the processor 1101, or storing input data required by the processor 1101 to run instructions or programs, or storing data generated by the processor 1101 after running instructions or programs. The processor 1101 may include one or more processing units, which may be independent devices or integrated into one or more processors. The processor 1101 may also include a controller, which can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0129] In another embodiment, the electronic device 1100 may not include a memory. When memory is needed, computer programs or instructions in the memory can be read and executed by coupling.
[0130] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the switch. In other embodiments of this application, the switch may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0131] The method steps in the embodiments of this application can be implemented in hardware or by a processor executing a computer program or instructions. The computer program or instructions can constitute a computer program product. Embodiments of this application also provide a computer program product comprising computer-executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to perform… Figure 4 or Figure 5 The functionality of the method embodiments shown.
[0132] Computer-executable instructions can be stored in a computer-readable storage medium. This application also provides a computer-readable storage medium storing executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to perform... Figure 4 or Figure 5 The functionality of the method embodiments shown.
[0133] The computer-readable storage medium provided in the embodiments of this application may be random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), register, hard disk, portable hard disk, CD-ROM, or any other form of computer-readable storage medium known in the art.
[0134] Computer-executable instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive.
[0135] In the various embodiments of this application, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments are consistent and can be referenced mutually. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, such as including a series of steps or units. A method, system, product, or device is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0136] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made therein without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely illustrative examples of the solutions defined by the appended claims and are to be considered as covering any and all modifications, variations, combinations, or equivalents within the scope of this application.
[0137] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope of this application. Therefore, if these modifications and variations of the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.
Claims
1. A data transmission method, characterized in that, include: If there is a first message to be sent within the first time window, then the first remaining time is determined; the first time window is used to send messages of the first priority. The first message is a message with the first priority; the first remaining time is the duration from the time the first message is to be sent to the end time of the first time window; If the first remaining duration is greater than or equal to the minimum duration threshold and less than the maximum duration threshold, and the number of bytes contained in the first message is greater than or equal to the first set number of bytes, then within the first remaining duration, the first part of the bytes of the first message is sent; the maximum duration threshold is the transmission duration required to send the first message; the minimum duration threshold is the transmission duration required for the shortest message slice supported by the network; the number of bytes in the second part of the bytes not sent in the first message is greater than or equal to the number of bytes in the message slice contained in the shortest message slice; At the beginning of the second time window, if there is a second message to be sent, the second message is sent; the second time window is used to send messages with a second priority; the second message is a message with a second priority; the second priority is higher than the first priority, and the second time window is the next time window adjacent to the first time window.
2. The method according to claim 1, characterized in that, During the first remaining time period, the first portion of bytes of the first message is sent, including: Each byte in the first message is sent in the order of the bytes in the first message. After each byte is sent, the remaining bytes that have not been sent in the first message and the second remaining duration are determined. The second remaining duration is the duration between the current time and the end time of the first time window. If the remaining bytes are greater than the second set number of bytes, and the second remaining duration is greater than the preset duration, then continue sending the next byte; the second set number of bytes is the number of bytes contained in the shortest message slice; If the remaining bytes are equal to the second set number of bytes, or the second remaining duration is less than or equal to the preset duration, then stop sending the next byte and wait for the first time window to end.
3. The method according to claim 1, characterized in that, During the first remaining time period, the first portion of bytes of the first message is sent, including: The first message is sent in the order of its bytes; the value of N is determined based on the first remaining time, and the transmission time required to send the N bytes is less than the first remaining time. Each byte after the N bytes in the first message is sent in the order of the bytes in the first message. After each byte is sent, the remaining bytes that have not been sent in the first message and the second remaining duration are determined. The second remaining duration is the duration between the current time and the end time of the first time window. If the remaining bytes are greater than the second set number of bytes, and the second remaining duration is greater than the preset duration, then continue sending the next byte; the second set number of bytes is the number of bytes contained in the shortest message slice; If the remaining bytes are equal to the second set number of bytes, or the second remaining duration is less than or equal to the preset duration, then stop sending the next byte and wait for the first time window to end.
4. The method according to any one of claims 1 to 3, characterized in that, After determining the first remaining time, the method further includes: If the first remaining duration is greater than or equal to the maximum duration threshold, then the first message is sent within the first remaining duration; If the first remaining duration is less than the minimum duration threshold, then wait for the first time window to end.
5. The method according to any one of claims 1 to 4, characterized in that, After sending the second message, the method further includes: If it is determined that there is still a third remaining duration within the second time window, then the second part of bytes that were not sent in the first message are sent within the third remaining duration.
6. An electronic device, characterized in that, Includes a processor and a communication unit; The communication unit is used for the electronic device to send and receive messages with other devices; The processor is used for: If it is determined that a first message to be sent exists within a first time window, then a first remaining duration is determined; the first time window is used to send messages of a first priority; the first message is a message of a first priority; the first remaining duration is the duration from the time the first message is to be sent to the end time of the first time window; if the first remaining duration is greater than or equal to the minimum duration threshold and less than the maximum duration threshold, and the number of bytes contained in the first message is greater than or equal to a first set number of bytes, then within the first remaining duration, the communication unit is controlled to send the first part of the bytes of the first message; the maximum duration threshold is the transmission duration required to send the first message; the minimum duration threshold is the transmission duration required to send the shortest message slice supported by the network; the number of bytes of the second part of the unsent bytes in the first message is greater than or equal to the number of message bytes contained in the shortest message slice; If it is determined that there is a second message to be sent at the beginning of the second time window, the communication unit is controlled to send the second message; the second time window is used to send a message with a second priority; the second message is a message with a second priority; the second priority is higher than the first priority, and the second time window is the next time window adjacent to the first time window.
7. The electronic device according to claim 6, characterized in that, When the processor controls the communication unit to send the first portion of the first message within the first remaining time period, it is specifically used for: The communication unit is controlled to send each byte of the first message in the order of the bytes in the first message; For each byte sent, determine the remaining unsent bytes and the second remaining duration in the first message; the second remaining duration is the duration between the current time and the end time of the first time window. If the remaining bytes are greater than the second set number of bytes, and the second remaining duration is greater than the preset duration, then the communication unit is controlled to continue sending the next byte; the second set number of bytes is the number of bytes contained in the shortest message slice; If the remaining bytes are equal to the second set number of bytes, or the second remaining duration is less than or equal to the preset duration, then the communication unit is controlled to stop sending the next byte and wait for the first time window to end.
8. The electronic device according to claim 6, characterized in that, When the processor controls the communication unit to send the first portion of the first message within the first remaining time period, it is specifically used for: The communication unit is controlled to send N bytes in the first message in the order of each byte in the first message; the value of N is determined based on the first remaining time, and the transmission time required to send the N bytes is less than the first remaining time; The control unit sends each byte after the N bytes in the first message in the order of each byte in the first message. After sending each byte, it determines the remaining bytes that have not been sent in the first message and the second remaining duration. The second remaining duration is the duration between the current time and the end time of the first time window. If the remaining bytes are greater than the second set number of bytes, and the second remaining duration is greater than the preset duration, then the communication unit is controlled to continue sending the next byte; the second set number of bytes is the number of bytes contained in the shortest message slice; If the remaining bytes are equal to the second set number of bytes, or the second remaining duration is less than or equal to the preset duration, then the communication unit is controlled to stop sending the next byte and wait for the first time window to end.
9. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions for causing a computer to perform the method as described in any one of claims 1 to 5.
10. A computer program product, characterized in that, It includes computer-executable instructions for causing a computer to perform the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Message scheduling method, scheduler, network device and network system
CN113366805A
Data forwarding method and device, readable storage medium and control terminal
CN113746815A