Data transmission method, system and device and computer readable storage medium
By using preset sending windows and loopback result update mechanisms in industrial networks, the problems of low data transmission efficiency and sequential disorder are solved, efficient and reliable data transmission is achieved, and efficient data transmission needs are met.
Patent Information
- Application Number
- CN202411372245.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2024-12-06
AI Technical Summary
Data transmission methods in existing industrial networks, such as protocols such as repeated data transmission without responses and shutdowns, have problems such as low efficiency, unreliability and confusing data sequence, and cannot meet the needs of efficient and reliable data transmission.
Through the preset sending window, multiple sets of communication data frames arranged in frame sequence number order are specified from the communication data sequence as the data sequence to be sent, and the sending window is updated using the loopback result within the waiting time of the target node to ensure the data transmission Order and reliability, dynamically adjust the data transmission process.
It significantly improves the data transmission efficiency in industrial network scenarios, realizes efficient bandwidth utilization and orderly interaction between data transmission, and meets the industrial network's needs for efficient and reliable data transmission.
Smart Images

Figure CN119094093A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of industrial communication networks, and in particular to a data transmission method, system, device, and computer-readable storage medium. Background Art
[0002] With the continuous development of industrial communication network technology, users have put forward higher requirements for data transmission efficiency in industrial network scenarios.
[0003] The existing data transmission methods in industrial networks, such as repeated data transmission without response, stop-and-wait protocol (timeout retransmission) and ARQ (Automatic Repeat reQuest), all have certain limitations. Among them, the repeated data transmission method without response ensures reception by copying and sending data multiple times. Although this method is simple and easy to implement, it will greatly reduce bandwidth resources. The stop-and-wait protocol requires the sender not to send new data segments before receiving the ACK (Acknowledgment) from the receiver. Although this method can ensure the reliability of data transmission, the overall communication efficiency is low and cannot meet the needs of efficient transmission. The ARQ method requests the sender to resend data after the receiver detects an error or timeout, but this method cannot guarantee the order of data transmission. Especially when there are multiple paths or blockages in the network, the order of data interaction may become chaotic, thus affecting the accuracy and reliability of data transmission.
[0004] Therefore, while ensuring the reliability of data transmission, how to improve the data transmission efficiency in industrial network scenarios is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The main purpose of this application is to provide a data transmission method, system, device and computer-readable storage medium, aiming to ensure data transmission reliability while improving data transmission efficiency in industrial network scenarios.
[0006] To achieve the above object, the present application provides a data transmission method, which is applied to a controller and includes:
[0007] Specifying multiple groups of communication data frames arranged in frame sequence order from the communication data sequence as a data sequence to be sent through a preset sending window, and sending each of the communication data frames in the data sequence to be sent to a target node according to the frame sequence order;
[0008] In response to the data loopback result sent by the target node within a preset timeout waiting time, an updated data sequence of the sending window is determined according to the data loopback result and the to-be-sent data sequence, and data transmission is performed according to the updated data sequence.
[0009] In one embodiment, the data loopback result is a loopback data frame in the to-be-sent data sequence that is identical to the current data frame; and the step of determining an updated data sequence based on the data loopback result and the to-be-sent data sequence includes:
[0010] In response to the data loopback result, taking the next communication data frame of the final data frame in the to-be-sent data sequence as the target data frame;
[0011] The next communication data frame of the current data frame is used as the next current data frame, and the data sequence from the next current data frame to the target data frame is sorted in the order of frame sequence numbers as the update data sequence of the sending window.
[0012] In one embodiment, the step of performing data transmission according to the update data sequence includes:
[0013] After sending the communication data frame with the largest frame number in the update data sequence to the target node, taking the update data sequence as the next data sequence to be sent, returning to execute the step of responding to the data loopback result of the data sequence to be sent sent by the target node within a preset timeout waiting time;
[0014] When the updated data sequence of the sending window is an empty set, it is determined that the data transmission of the to-be-sent data sequence is completed based on the sending window.
[0015] In one embodiment, after the step of sending each of the communication data frames in the to-be-sent data sequence to the target node in the order of the frame sequence numbers, the data transmission method further comprises:
[0016] When the data loopback result sent by the target node is not received within the timeout waiting time, the current data frame is resent to the target node, and the number of repeated transmissions of the current data frame is accumulated;
[0017] Detecting whether the data loopback result sent by the target node within the timeout waiting time is received when the number of repeated transmissions does not exceed a preset retransmission number threshold;
[0018] If yes, return to the step of determining the updated data sequence of the sending window according to the data loopback result and the to-be-sent data sequence;
[0019] If not, the step of resending the current data frame to the target node is stopped, and data transmission is performed according to other data frames in the to-be-sent data sequence except the current data frame.
[0020] In one embodiment, the step of transmitting data according to other data frames in the to-be-sent data sequence except the current data frame includes:
[0021] Determine other data frames except the current data frame in the to-be-sent data sequence, and after receiving data loopback frames corresponding to the other data frames within the timeout waiting time, send the current data frame to the target node for data transmission.
[0022] In one implementation, the step of sending the current data frame to the target node for data transmission includes:
[0023] When the target node returns a loopback data frame identical to the current data frame, maintaining the sequence of data to be sent in the sending window unchanged;
[0024] Until the target node pops the other data frames cached in the preset receiving buffer area in sequence according to the frame sequence number, the next communication data frame of the final data frame in the to-be-sent data sequence is used as the next current data frame;
[0025] Arrange the data sequence from the next current data frame to the destination data frame in the order of frame numbers as the next data sequence to be sent, and return to execute the step of sending each communication data frame in the data sequence to be sent to the target node in the order of frame numbers, wherein the destination data frame is a communication data frame whose frame number is the data capacity of the sending window.
[0026] In one implementation, the data loopback result is a loopback data frame in the to-be-sent data sequence that is identical to the current data frame, and the data transmission method further includes:
[0027] Sending a data query request to the target node, and sending a data read request corresponding to each communication data frame in the to-be-sent data sequence to the target node in frame sequence order according to a response made by the target node to the data query request;
[0028] If the data loopback result sent by the target node is received within the timeout waiting time, the step of determining the updated data sequence of the sending window based on the data loopback result and the data sequence to be sent is executed, and the updated data sequence is used as the next data frame to be sent, and the step of returning to execute the step of sending the data read request corresponding to each communication data frame in the data sequence to be sent to the target node in the order of frame sequence numbers.
[0029] In one embodiment, after the step of sending the data read request corresponding to each of the communication data frames in the to-be-sent data sequence to the target node in the order of frame sequence numbers, the data transmission method further includes:
[0030] If no response from the target node to the target read request in the to-be-sent data sequence is received within the timeout waiting time, resending the target read request to the target node, the target read request being any one of the multiple data read requests;
[0031] In response to the target loopback result of the target read request returned by the target node, a data read request corresponding to the communication data frame with a frame sequence number being the target sequence is sent to the target node; wherein,
[0032] The target loopback result is set to determine that the communication data frame specified by the target read request has been received, and the target sequence is obtained by superimposing the frame sequence number sequence pointed to by the target read request based on the data capacity of the sending window.
[0033] In addition, to achieve the above purpose, the present application also provides a data transmission method, which is applied to a target node and includes:
[0034] The receiving controller receives each communication data frame in the to-be-sent data sequence sent in the order of the frame sequence number, and sends the data loopback result to the controller within a preset timeout waiting time.
[0035] In one embodiment, the data transmission method further includes:
[0036] In response to a data query request of the controller, receiving a data read request corresponding to each communication data frame in the to-be-sent data sequence sent by the controller in frame sequence order;
[0037] Until the data read request of the next communication data frame of the final data frame in the data sequence to be sent is read, it is determined that the loopback data frame identical to the current data frame has been uploaded to the controller as a data loopback result within the timeout waiting time, and the data loopback result is set to determine that the current data frame has been received.
[0038] In one embodiment, after the step of receiving a data read request corresponding to each of the communication data frames in the to-be-sent data sequence sent by the controller in the order of frame sequence numbers, the data transmission method includes:
[0039] If the controller does not receive a response from the target node to the target read request in the to-be-sent data sequence, the controller receives the target read request resent by the controller, where the target read request is any one of the multiple data read requests;
[0040] In response to the target read request, a loopback data frame identical to the communication data frame specified by the target read request is sent to the controller as a target loopback result, the target loopback result being set to determine that the communication data frame specified by the target read request has been received.
[0041] In addition, to achieve the above-mentioned purpose, the present application also provides a data transmission system, the data transmission system at least comprising a controller and a target node in communication connection;
[0042] The controller is used to specify multiple groups of communication data frames arranged in frame sequence order as the data sequence to be sent from the communication data sequence through a preset sending window, and send each of the communication data frames in the data sequence to be sent to the target node according to the frame sequence order; in response to the data loopback result sent by the target node within a preset timeout waiting time, determine the updated data sequence of the sending window according to the data loopback result and the data sequence to be sent, and perform data transmission according to the updated data sequence;
[0043] The target node is used to receive each communication data frame in the to-be-sent data sequence sent by the controller in the order of frame sequence numbers, and send the data loopback result to the controller within a preset timeout waiting time.
[0044] Each functional device of the data transmission system of the present application implements the steps of the data transmission method of the present application as described above during operation.
[0045] In addition, to achieve the above-mentioned purpose, the present application also provides a device, which includes a memory, a processor, and a data transmission program stored on the memory and executable on the processor, and the data transmission program implements the steps of the above-mentioned data transmission method when executed by the processor.
[0046] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, which is a computer-readable storage medium, and a data transmission program is stored on the computer-readable storage medium. When the data transmission program is executed by the processor, the steps of the above-mentioned data transmission method are implemented.
[0047] The present application provides a data transmission method that optimizes the data transmission method in the existing industrial network. Specifically, the preset sending window set in the present application can specify multiple groups of communication data frames arranged in frame sequence order from the communication data sequence as the data sequence to be sent according to the network status and data transmission requirements of the industrial network scenario, and send each communication data frame in the data sequence to be sent to the target node in the order of frame sequence number to ensure the orderliness and continuity of data transmission; next, the target node will feed back the same loopback data frame as the current data frame (that is, the communication data frame with the smallest frame number in the multiple groups of communication data frames) as the data loopback result to the controller for confirmation within the preset timeout waiting time, so that the controller can quickly verify the integrity of the data transmission; next, the controller can be based on The data loopback result quickly adjusts the updated data sequence of the occurrence window, excludes the communication data frames in the to-be-sent data sequence that have been confirmed to be correct based on the data loopback result, and only retains the new data frame sequence to be sent (i.e., the updated data sequence) in the sending window. Data is transmitted based on the updated data sequence, thereby realizing dynamic adjustment and optimization of the data transmission process, overcoming the inherent defects of existing data transmission methods (such as repeated data transmission without response, stop-and-wait protocol, and ARQ), significantly improving the data transmission efficiency in industrial network scenarios, realizing efficient bandwidth utilization, and ensuring orderly interaction and reliable transmission of data transmission, meeting the urgent needs of industrial network scenarios for efficient and reliable data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flowchart of the first embodiment of the data transmission method of the present application;
[0049] Figure 2 It is a schematic diagram of the communication data frame structure involved in the embodiment of the present application;
[0050] Figure 3 It is a schematic diagram of a data frame transmission process based on automatic loopback involved in an embodiment of the present application;
[0051] Figure 4 It is a schematic diagram of a communication data frame delivered from a device to a controller according to an embodiment of the present application;
[0052] Figure 5 This is a schematic diagram of normal output transmission involved in the embodiment of the present application;
[0053] Figure 6 It is a schematic diagram of a data frame transmission timeout detection process involved in an embodiment of the present application;
[0054] Figure 7 It is a schematic diagram of retransmission of output data transmission involved in the embodiment of the present application;
[0055] Figure 8 It is a schematic diagram of retransmission occurring during input data transmission involved in the embodiment of the present application;
[0056] Fig. 9 It is a structural diagram of the data transmission device involved in the embodiment of the present application.
[0057] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] The present application provides a data transmission method, referring to Figure 1 As shown, Figure 1 It is a flowchart of the first embodiment of the data transmission method of the present application.
[0059] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.
[0060] It is important to ensure efficient, orderly and non-lost data transmission in industrial communication network scenarios. Most of the data retransmission methods (i.e., data transmission methods) in existing industrial networks adopt the methods of repeated data transmission without response, stop-and-wait protocol (timeout retransmission) and ARQ. Among them, the method of repeated data transmission without response is adopted, that is, the data to be interacted is copied and sent to the receiver repeatedly, and the receiver removes the duplicate data according to the frame identifier. This method is simple and easy to implement, but it will reduce more than 50% of the bandwidth; in the stop-and-wait protocol (timeout retransmission), the sender will not send the next data segment before receiving the receiver's confirmation (ACK). If the receiver does not receive the data or confirmation within the predetermined time, it will resend the same data segment, resulting in low overall communication efficiency; the ARQ method is adopted, that is, the receiver will request the sender to resend the data when an error is detected (usually using an error detection code) or a reception timeout. This ARQ method does not guarantee the order of data transmission interaction, that is, when there are multiple paths or congestion in the network, the order of data interaction will be chaotic.
[0061] Therefore, the above data retransmission method cannot meet the urgent needs of industrial network scenarios for efficient and reliable data transmission when applied in industrial communication network scenarios. For example, the visual measurement scenario requires not only fast data transmission interaction efficiency and reduced data reception response waiting time, but also requires data to be interacted in sequence to ensure that the data delivered to the application layer is not out of order. At the same time, it requires that data is not lost, and when a transmission error occurs, data can be resent to ensure data integrity.
[0062] To meet the urgent need for efficient and reliable data transmission in industrial network scenarios, the present application provides a data transmission method, system, device, and computer-readable storage medium.
[0063] The data transmission method of the present application is applied to a controller, and the data transmission method includes:
[0064] Step S10: designating a plurality of groups of communication data frames arranged in frame sequence order from the communication data sequence as a data sequence to be sent through a preset sending window, and sending each of the communication data frames in the data sequence to be sent to a target node according to the frame sequence order.
[0065] In the present embodiment, the controller provided by the present application responds to the window size definition instruction sent by the human-computer exchange interface, and can flexibly configure the capacity of the sending window (i.e., the preset sending window), that is, the capacity of the sending window corresponds to the number of frames of the communication data frame to be sent. Exemplarily, the present application specifies multiple groups of communication data frames arranged in the order of frame sequence numbers in a huge communication data sequence as a data sequence to be sent by adopting a preset sending window, and sends each communication data frame in the data sequence to be sent to the target node in the order of frame sequence numbers, which not only ensures that the process of each communication data frame being transmitted from the controller to the target node is more efficient and orderly, but also enables the target node to receive and process the communication data frames uploaded by the controller in the order of frame sequence numbers, avoiding errors and confusion that may be caused by data disorder.
[0066] It should be noted that the data frame to be sent can be understood as a collection of multiple groups of communication data frames included in the preset sending window at the current moment and ready to be sent to the target node.
[0067] In addition, it should be noted that, referring to Figure 2 As shown, Figure 2 Schematic diagram of the communication data frame structure involved in the embodiment of the present application. The communication data frame structure set in the present application at least includes communication data frame one and communication data frame two.
[0068] Taking the communication data frame 1 as an example, the structure shown in the communication data frame 1 indicates that each receiving device has its own corresponding serial number, and the communication data frame 1 at least includes a telegram header, a data segment, and a check segment. Exemplarily, the telegram header is set before the header of the data segment, and the check segment is set after the tail of the data segment to form a complete frame structure of the communication data frame; wherein, Figure 2 The telegram header shown includes address information and a frame sequence number, that is, the frame sequence number is bound to the address information.
[0069] The controller provided in the present application is connected to each receiving device in communication, and each receiving device has an address information. In other words, the target node provided in the present application can be understood as a receiving device with the same address information as the current data frame among multiple receiving devices. Exemplarily, referring to Table 1, Table 1 is a frame sequence number table involved in an embodiment of the present application. Address 1 provided in the present application corresponds to device 1, and address 2 corresponds to device 2. If the frame sequence number carried by the current data frame is Data 6 and the address information is Address 1, it can be determined that the target node provided in the present application is device 1, that is, the controller sends a communication data frame with a frame sequence number of Data 6 to device 1. In addition, each time the controller provided in the present application sends a communication data frame, the frame sequence number is incremented by 1.
[0070]
[0071]
[0072] Table 1
[0073] Taking the communication data frame 2 as an example, the communication data frame 2 at least includes a telegram header, a data segment of each receiving device, and a check segment. That is, the structure of the communication data frame 2 set in the present application is that all receiving devices share the same sequence number.
[0074] Step S20: In response to the data loopback result sent by the target node within a preset timeout waiting time, determine an updated data sequence of the sending window according to the data loopback result and the to-be-sent data sequence, and perform data transmission according to the updated data sequence.
[0075] In the present embodiment, the controller sends the current data frame (i.e., the communication data frame with the smallest frame number in multiple groups of communication data frames) carrying address information and frame sequence number to the target node, and automatically sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). After the target node receives the current data frame sent by the controller, it reads and writes the current data frame, and automatically loops back the current data frame to the controller, and feeds back the loopback data frame identical to the current data frame as the data loopback result to the controller. At this time, the controller responds to the data loopback result sent by the target node within the preset timeout waiting time, so that the controller can quickly verify the integrity of the data transmission; next, the controller can quickly adjust the update data sequence of the occurrence window based on the data loopback result, exclude the communication data frame confirmed to be correct according to the data loopback result in the data sequence to be sent, and only retain the new data frame sequence to be sent in the sending window (i.e., the update data sequence), and perform data transmission according to the update data sequence, realizing the dynamic adjustment and optimization of the data transmission process, thereby effectively ensuring the reliability of efficient data transmission.
[0076] It should be noted that the loopback data frame can be understood as the current data frame sent by the controller and returned via the target node, and the loopback data frame is used to confirm whether the current data frame has been sent to the target node.
[0077] In a specific embodiment, refer to Figure 3 , Figure 3 is a schematic diagram of a data frame transmission process based on automatic loopback involved in an embodiment of the present application, Figure 3 The "A-Controller" in the figure represents the controller, and the controller can be understood as a network controller; Figure 3 In the figure, "Device 1" represents the first receiving device (i.e., device 1), "Device 2" represents the second receiving device (i.e., device 2), "Device 3" represents the third receiving device (i.e., device 3), and "Device 4" represents the fourth receiving device (i.e., device 4), and the address information of the first receiving device is address 1, the address information of the second receiving device is address 2, the address information of the third receiving device is address 3, and the address information of the fourth receiving device is address 4. For example, Figure 3 It is the transmission process of data sent from the network controller to the receiving device (output data). Specifically, the current data frame (i.e., data 6) carrying the address information of address 3 and the frame sequence number of Data6 is sent from the network controller, flows through the first receiving device and the second receiving device to reach the target node, which is the third receiving device. That is to say, when the network controller delivers data 6 to the third receiving device, the third receiving device automatically loops back the data 6 sent by the network controller (i.e., the loopback data frame of data 6). After receiving the loopback data frame of data 6, the network controller confirms that the output data 6 has been delivered.
[0078] Exemplarily, the data transmission method provided in the present application may also include the following implementation steps:
[0079] Step 1: The network controller sends a communication data frame carrying address information and a frame sequence number, and sets a loopback data timeout waiting time (i.e., a preset timeout waiting time);
[0080] Step 2: The communication data frame arrives at the target node, the device receives the communication data frame and completes the communication data frame reading and writing processing, and automatically loops back the communication data frame to the controller, that is, returns the loopback data frame of the current data frame to the controller. In addition, the target node can also check the frame sequence number of the communication data frame, and deliver the communication data frame to the application layer by popping the stack in the order of the frame sequence number.
[0081] Step 3: The network controller detects whether the loopback data is received within the set time.
[0082] Step 4: If the detection result in step 3 is correct, move the sending window down.
[0083] Step 5: If the detection result of step 3 is wrong, data retransmission is started. The retransmission steps are the same as steps 1, 2, and 3. The number of retransmissions does not exceed the set value. Specifically, in order to avoid network congestion caused by unlimited data retransmission, it is necessary to set the maximum number of retransmissions (i.e., the set value). When the number of data errors / retransmissions of a certain sequence number exceeds the limit, the retransmission of this sequence number will no longer be performed.
[0084] Further, in another embodiment, referring to Figure 4 , Figure 4 It is a schematic diagram of the communication data frame delivered from the device to the controller involved in the embodiment of the present application. In other words, the transmission process of data from the receiving device to the network controller (input data) has two more steps than the above process. In one specific step, the network controller uses a polling method to query whether the device node (i.e., each receiving device) has input data to upload. If so, the frame sequence number and address information of the input data to be uploaded are returned to the network controller. The network controller sends a loopback data frame with the frame sequence number and address information to be uploaded in the order of the frame sequence number from small to large. After arriving at the target node, the target node updates the input data to the loopback data frame and returns it to the network controller. After receiving the loopback data frame, the network controller confirms that the input data has been received. In another specific step, in order to ensure that the cache space of the device is released, the controller needs to ensure that an empty response is obtained (the number of empty responses obtained is consistent with the window size, which is 2 times in this example) before stopping sending the request.
[0085] In summary, the present application provides a data transmission method that optimizes the data transmission method in the existing industrial network. Specifically, the preset sending window set in the present application can specify multiple groups of communication data frames arranged in frame sequence order from the communication data sequence as the data sequence to be sent according to the network status and data transmission requirements of the industrial network scenario, and send each communication data frame in the data sequence to be sent to the target node in the order of frame sequence number to ensure the orderliness and continuity of data transmission; next, at the target node, the same loopback data frame as the current data frame (that is, the communication data frame with the smallest frame number in the multiple groups of communication data frames) is fed back to the controller as the data loopback result within the preset timeout waiting time for confirmation, so that the controller can quickly verify the integrity of the data transmission; next, the controller can be based on The data loopback result quickly adjusts the updated data sequence of the occurrence window, excludes the communication data frames in the to-be-sent data sequence that have been confirmed to be correct based on the data loopback result, and only retains the new data frame sequence to be sent (i.e., the updated data sequence) in the sending window. Data is transmitted based on the updated data sequence, thereby realizing dynamic adjustment and optimization of the data transmission process, overcoming the inherent defects of existing data transmission methods (such as repeated data transmission without response, stop-and-wait protocol, and ARQ), significantly improving the data transmission efficiency in industrial network scenarios, realizing efficient bandwidth utilization, and ensuring orderly interaction and reliable transmission of data transmission, meeting the urgent needs of industrial network scenarios for efficient and reliable data transmission.
[0086] Furthermore, based on the first embodiment of the data transmission method of the present application, a second embodiment of the data transmission method of the present application is proposed.
[0087] Further, in some feasible embodiments, the data loopback result is a loopback data frame in the to-be-sent data sequence that is identical to the current data frame; the above step S20: determining the updated data sequence of the sending window according to the data loopback result and the to-be-sent data sequence, may also include the following implementation steps:
[0088] Step S201: In response to the data loopback result, a communication data frame next to the final data frame in the to-be-sent data sequence is used as a target data frame.
[0089] In this embodiment, after receiving the data loopback result returned by the target node, the present application further optimizes the data transmission process. Specifically, the controller responds according to the data loopback result, first identifying the final data frame from the data sequence to be sent; then, the next communication data frame of the final data frame is used as the target data frame, thereby ensuring the continuity and orderliness of data transmission, avoiding repeated transmission and confusion of data, and significantly improving the efficiency and accuracy of data transmission.
[0090] It should be noted that the frame sequence number sequence set in this application can be a positive sequence or a reverse sequence. Among them, the positive sequence can be understood as the frame sequence numbers are arranged in order from small to large, and the reverse sequence can be understood as the frame sequence numbers are arranged in order from large to small.
[0091] Exemplarily, when the frame sequence number order is in positive order, the current data frame is the communication data frame with the smallest sequence number among multiple communication data frames in the data sequence to be sent, and the final data frame is the communication data frame with the largest sequence number among multiple communication data frames in the data sequence to be sent; when the frame sequence number order is in reverse order, the current data frame is the communication data frame with the largest sequence number among multiple communication data frames in the data sequence to be sent, and the final data frame is the communication data frame with the smallest sequence number among multiple communication data frames in the data sequence to be sent.
[0092] Step S202: taking the next communication data frame of the current data frame as the next current data frame, and sorting the data sequence from the next current data frame to the target data frame in the order of frame sequence numbers as the update data sequence of the sending window.
[0093] In this embodiment, the controller moves the current data pointer set in the sending window to the next communication data frame of the currently confirmed communication data frame (i.e., the communication data frame corresponding to the data loopback result) as the next current data frame to be processed (i.e., the new current data frame); next, the controller reconstructs the updated data sequence of the sending window based on the new current data frame and the target data frame. Specifically, the updated data sequence is sorted in order of frame sequence numbers starting from the new current data frame to the end of the target data frame, thereby realizing dynamic adjustment of the updated data sequence in the sending window, which not only ensures the continuity of data transmission, but also improves the efficiency of data transmission, because the controller can quickly exclude the communication data frames that have been confirmed to be correct based on the data loopback result in the data sequence to be sent, and only retains the new data frame sequence to be sent (i.e., the updated data sequence) in the sending window, thereby effectively utilizing the network resources of the industrial network scenario and significantly improving the efficiency of data transmission.
[0094] Furthermore, in some feasible embodiments, the above step S20: performing data transmission according to the update data sequence may further include the following implementation steps:
[0095] Step A10: After sending the communication data frame with the largest frame number in the updated data sequence to the target node, use the updated data sequence as the next data sequence to be sent, and return to execute the step of responding to the data loopback result of the data sequence to be sent by the target node within a preset timeout waiting time.
[0096] In this embodiment, after the controller sends the communication data frame with the largest frame number in the updated data sequence (i.e., the target data frame) to the target node, it immediately uses the updated data sequence as the next data sequence to be sent, and returns to execute the step of responding to the data loopback result of the data sequence to be sent sent by the target node within the preset timeout waiting time, that is, restarting the data sending and loopback confirmation process to the target node, which not only reduces the waiting time during data transmission, but also makes full use of the preset timeout waiting time, significantly improving the overall efficiency of data transmission.
[0097] Step A20: until the updated data sequence of the sending window is an empty set, it is determined that the data transmission of the to-be-sent data sequence is completed based on the sending window.
[0098] In this embodiment, through continuous data loopback confirmation and dynamic update of the sending window, until the updated data sequence is an empty set, it is confirmed that accurate control and efficient completion of data transmission are achieved based on the preset sending window, which not only ensures the orderly and error-free transmission of all data frames to be sent, but also significantly improves the overall efficiency of data transmission by reducing unnecessary retransmission and waiting time, providing a stable and reliable data communication solution for application scenarios such as industrial networks.
[0099] In a specific embodiment, refer to Figure 5 , Figure 5 This is a schematic diagram of normal data transmission involved in the embodiment of the present application. Step 100: At time T1, the network controller sends data with the current data frame as frame sequence number 20 (i.e., 20 data) to device 3, and sets the loopback data timeout waiting time to the time interval from time T1 to time T5; wherein the loopback data timeout waiting time is the preset timeout waiting time.
[0100] Step 200: At time T2, the network controller sends data with a frame sequence number of 21 (ie, 21 data) after 20 data to device 3, and sets the loopback data timeout waiting time to the time interval from time T2 to time T6.
[0101] Step 300: At time T3, after receiving data 20, device 3 pops data 20 from the receiving buffer of device 3 and delivers it to the application layer, and feeds back the loopback data frame identical to data 20 as the data loopback result to the network controller;
[0102] Step 400: At time T4, after receiving data 21, device 3 pops data 21 from the receiving buffer of device 3 and delivers it to the application layer, and feeds back the loopback data frame identical to data 21 as the data loopback result to the network controller;
[0103] Step 500: At time T5, if the controller receives the data loopback result of data 20 and verifies that it is correct, it confirms that data 20 has been delivered to device 3, and sends data with a frame sequence number of 22 (i.e., data 22) after data 21 to device 3, and sets the loopback data timeout waiting time to the time interval from time T5 to time T9;
[0104] Step 600: At time T6, if the controller receives the data loopback result of data 21 and verifies that it is correct, it confirms that data 21 has been delivered to device 3, and sends data with a frame sequence number of 23 (i.e., data 23) after data 22 to device 3, and sets the loopback data timeout waiting time to the time interval from time T6 to time T10. The subsequent steps are similar to the above steps, and this application will not be repeated here.
[0105] In another embodiment, step 10: at time T1, the network controller sends data whose current data frame is frame sequence number 21 (i.e., 21 data) to device 3, and sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). After device 3 receives 21 data, it pops 21 data from the receiving buffer of device 3 and delivers it to the application layer.
[0106] Step 20: At time T2, the network controller sends data with a frame sequence number of 22 (ie, data 22) after data 210 to device 3, and sets the loopback data timeout waiting time (ie, the preset timeout waiting time). After receiving data 22, device 3 completes the stacking.
[0107] Step 30: At time T3, the network controller sends a frame of data with a sequence number of 23 (i.e., data 23) after data 22 to device 3, and sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). Device 3 receives data 23 and completes the stack. At this time, if the controller receives the loopback frame of data 21 and verifies that it is correct, it confirms that data 21 has been delivered to device 3, and moves the preset sending window down by one unit grid.
[0108] Step 40: At time T4, the network controller sends a frame of data with a sequence number of 24 (i.e., 24 data) after 23 data to device 3, and sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). Device 3 receives 24 data and completes the stacking. The controller receives the 22 data loopback frame and verifies that it is correct, then confirms that 22 data has been delivered to device 3, and moves the moved sending window down one cell again. The subsequent steps are similar to the above steps, and this application will not be repeated here.
[0109] Further, in some other feasible embodiments, referring to Figure 6 to Figure 7 , Figure 6 is a schematic diagram of a data frame transmission timeout detection process involved in an embodiment of the present application, Figure 7 This is a schematic diagram of retransmission occurring in output data transmission involved in the embodiment of the present application. After the above step S10: each communication data frame in the to-be-sent data sequence is sent to the target node in the order of the frame sequence number, the data transmission method may further include the following implementation steps:
[0110] Step B10: When the data loopback result sent by the target node is not received within the timeout waiting time, the current data frame is resent to the target node, and the number of repeated transmissions of the current data frame is accumulated.
[0111] In this embodiment, if the data loopback result sent by the target node is not received within the preset timeout waiting time, that is, the loopback data frame of the current data frame sent by the target node is not received within the preset timeout waiting time, the controller confirms that the current data frame is lost or damaged during the data transmission process; next, the controller automatically resends the current data frame to the target node to ensure accurate data transmission. At the same time, the controller will also automatically accumulate the number of repeated transmissions of the current data frame, thereby providing reliable data support for subsequent data transmission.
[0112] In a specific embodiment, Figure 6 The Timeout shown indicates the maximum time limit allowed before the target node (i.e., device 3) returns the loopback data frame, i.e., the preset timeout waiting time; if the controller (network controller) does not receive the loopback data frame returned by device 3 within the preset timeout waiting time, it is considered that the current data frame is lost or damaged, and the current data frame is automatically resent to the target node to increase the chance of successful transmission of the current data frame; next, by accumulating the number of repeated transmissions of the current data frame and continuously retransmitting when the number of repeated transmissions does not exceed the preset retransmission threshold, temporary interference or delays in the network can be coped with to ensure that important data is not easily lost.
[0113] Step B20: Detect whether the data loopback result sent by the target node within the timeout waiting time is received when the number of repeated transmissions does not exceed a preset retransmission number threshold.
[0114] In this embodiment, if the number of repeated transmissions of the current data frame does not exceed the preset retransmission threshold, the controller will continue to detect whether there is a data loopback result from the target node, that is, respond based on the data loopback result fed back by the target node, indicating that the current data frame has been successfully received by the target node, thereby ensuring the reliability of data transmission, and using the preset timeout waiting time to cope with network delays, while using the preset retransmission threshold to balance the reliability and efficiency of data transmission.
[0115] Step B30: If yes, return to the step of determining the updated data sequence of the sending window according to the data loopback result and the to-be-sent data sequence.
[0116] In this embodiment, when the number of repeated transmissions does not exceed the preset retransmission threshold, the controller receives the data loopback result sent by the target node within the preset timeout waiting time, which can verify that the current data frame has been transmitted successfully, and immediately returns to execute the step of determining the updated data sequence of the sending window based on the data loopback result and the data sequence to be sent based on the data loopback result feedback from the target node, thereby making the data transmission process more efficient and reducing unnecessary waiting time.
[0117] Step B40: If not, stop executing the step of resending the current data frame to the target node, and perform data transmission according to other data frames in the to-be-sent data sequence except the current data frame.
[0118] In this embodiment, when the number of repeated transmissions exceeds the preset retransmission limit, and the controller does not receive the data loopback result sent by the target node within the preset timeout waiting time, the controller will stop the retransmission operation of the current data frame, that is, stop executing the step of resending the current data frame to the target node, effectively avoiding infinite loop transmission attempts. Next, after stopping the retransmission of the current data frame, data transmission is performed based on other data frames in the data sequence to be sent except the current data frame, so that while ensuring a certain transmission success rate, unnecessary network congestion and bandwidth occupation can be reduced, ensuring the efficiency and stability of the data transmission process.
[0119] Further, in some feasible embodiments, the above step B40: performing data transmission according to other data frames in the to-be-sent data sequence except the current data frame, includes the following implementation steps:
[0120] Step C10: determining other data frames in the to-be-sent data sequence except the current data frame, and after receiving data loopback frames corresponding to the other data frames within the timeout waiting time, sending the current data frame to the target node for data transmission.
[0121] In this embodiment, refer to Figure 7The controller will first intelligently detect the status of the sending window, especially check whether there are other data frames in the data sequence to be sent in the sending window except the current data frame, and detect the data loopback frames corresponding to other data frames that have been successfully received from the target node within the preset timeout waiting time, that is, after confirming that other data frames except the current data frame have been successfully cached by the target node to the preset receiving cache area (that is, the receiving buffer area), further data transmission processing will be performed on the current data frame, which further enhances the reliability and orderliness of data transmission.
[0122] It should be noted that other data frames refer to all communication data frames in the data sequence to be sent except the current data frame. Exemplarily, before detecting that the data loopback frames corresponding to other data frames fed back by the target node have been successfully received within the preset timeout waiting time, the target node will cache the other data frames sent by the controller in the order of the frame sequence number to the receiving buffer, thereby reducing the overall delay caused by the failure of the transmission of a single data frame (current data frame), that is, effectively reducing the overall transmission congestion caused by the loss or delay of individual data frames, and significantly improving the reliability and efficiency of data transmission.
[0123] In another embodiment, if there are no other data frames to be sent in the data sequence to be sent in the preset sending window except the current data frame, the step of resending the current data frame to the target node and accumulating the number of repeated transmissions of the current data frame is returned to execute, thereby ensuring the continuity and integrity of data transmission and avoiding communication interruption caused by data frame loss. At the same time, the success rate of data transmission is also improved through the repeated transmission mechanism.
[0124] Further, in some other feasible embodiments, referring to Figure 7 The above step C10: sending the current data frame to the target node for data transmission may also include the following implementation steps:
[0125] Step C101: When the target node returns a loopback data frame identical to the current data frame, the sequence of data to be sent in the sending window is maintained unchanged.
[0126] In this embodiment, the current data frame is sent to the target node again, and its successful reception is confirmed by verifying that the returned loopback data frame is completely consistent with the sent current data frame. This not only ensures the integrity and accuracy of the data transmission, but also maintains the continuity and efficiency of the data transmission process by maintaining the sequence of data to be sent in the preset sending window unchanged.
[0127] Step C102: until the target node pops the other data frames cached in the preset receiving buffer area in sequence according to the frame sequence number, the next communication data frame of the final data frame in the to-be-sent data sequence is used as the next current data frame.
[0128] In this embodiment, when the target node successfully processes and pops a series of data frames (i.e., other data frames) previously cached in its preset receiving buffer area one by one according to the order of the frame sequence numbers, it can seamlessly set the next communication data frame immediately following the final processed data frame in the data sequence to be sent as the next current data frame to be sent to the target node, thereby ensuring the continuity and orderliness of data transmission, avoiding the risk of data confusion or loss, and improving the efficiency and reliability of data transmission, providing strong support for real-time or high-demand data communication scenarios.
[0129] Step C103: Sort the data sequence from the next current data frame to the destination data frame in order of frame numbers as the next data sequence to be sent, and return to execute the step of sending each communication data frame in the data sequence to be sent to the target node in order of frame numbers, wherein the destination data frame is a communication data frame whose frame number is the data capacity of the sending window.
[0130] In this embodiment, the controller determines that the next data sequence to be sent to the target node is a data sequence from the next current data frame to the destination data frame, which reduces the blindness of data transmission. That is, the controller can send the next data sequence to be sent in a targeted manner, avoid unnecessary data transmission attempts, and improve the utilization rate of network bandwidth and the efficiency of data transmission. In addition, by setting the destination data frame to a communication data frame with a frame sequence number as the data capacity of the sending window, the amount of data sent to the target node can be effectively controlled to avoid the situation where too much data is sent to cause network congestion or the receiving end cannot handle it. At the same time, the data capacity of the sending window can also be dynamically adjusted according to the network status and the processing power of the receiving end, and the data transmission efficiency is further optimized. Next, according to the next data sequence to be sent, the step of sending each of the communication data frames in the data sequence to be sent to the target node in the order of the frame sequence number is returned, thereby effectively maintaining the efficient data flow in the data transmission process, reducing the waiting time and processing delay of data transmission, and significantly improving the overall efficiency and performance of data transmission.
[0131] Furthermore, when an error occurs in data transmission, starting retransmission also includes the following implementation steps:
[0132] Step 1: At time T1, the network controller sends data with the current data frame as frame sequence number 21 (i.e., data 21) to device 3, and sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). If data 21 has an error during the transmission process, device 3 does not receive data 21;
[0133] Step 2: At time T2, the network controller sends a frame of data with a sequence number of 22 (i.e., data 22) after data 21 to device 3, and sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). Device 3 receives data 22 and temporarily stores it in its own receiving buffer. Since data 21 was not received in the previous step 1, data 22 is not popped out of the stack;
[0134] Step 3: At time T3, the network controller sends a frame sequence number of data 23 (i.e., data 23) after data 22 to device 3, and sets the loopback data timeout waiting time (i.e., the preset timeout waiting time). Device 3 receives data 23, which is consistent with the situation in step 2, and data 23 is not popped out of the stack;
[0135] Step 4: At time T4, the network controller detects that the loopback timeout of data 21 has expired and starts retransmission. Data 21 is resent to device 3 and the loopback data timeout waiting time is reset. The network controller receives the loopback frame of data 22 and verifies that it is correct, confirming that data 22 has been delivered to the device. Since data 21 was not confirmed in the previous step, the sending window remains unchanged;
[0136] Step 5: At time T5, since all the data in the sending window have been sent, the network controller does not send new data. The controller receives the 23 data loopback frame and verifies that it is correct, confirming that the 23 data has been delivered to the device. Since the previous step did not confirm the 21 data, the sending window remains unchanged;
[0137] Step 6: At time T6, the network controller receives the loopback frame of data 21 and verifies that it is correct, confirming that data 21 has been delivered to the device. Since data 21, 22, and 23 have all been delivered to the device, the sending window moves down by 3 grids. The controller sends data with frame sequence number 24 to device 3. The subsequent steps are similar to the above and will not be repeated.
[0138] In summary, the data transmission method provided by the present application adopts a sending window mechanism to improve the data interaction rate. A receiving buffer is provided in each receiving device, and data frames are popped out of the stack based on the frame sequence number in ascending order, thereby ensuring the interactive data sequence. In addition, an error detection mechanism based on loopback transmission is also adopted. Once an error is detected, the corresponding data is resent to ensure the reliability of data interaction.
[0139] Further, in some feasible embodiments, the data loopback result is a loopback data frame in the to-be-sent data sequence that is identical to the current data frame, and the data transmission method may further include the following implementation steps:
[0140] Step Y10: Send a data query request to the target node, and according to the response of the target node to the data query request, send a data read request corresponding to each communication data frame in the to-be-sent data sequence to the target node in the order of frame sequence numbers.
[0141] In this embodiment, the controller first sends a data query request to the target node. Next, based on the target node's response to the data query request, the controller sends a data read request corresponding to each communication data frame in the data sequence to be sent to the target node in frame sequence order, thereby ensuring the orderliness and accuracy of data transmission.
[0142] Step Y20: If the data loopback result sent by the target node is received within the timeout waiting time, execute the step of determining the updated data sequence of the sending window based on the data loopback result and the data sequence to be sent, and use the updated data sequence as the next data frame to be sent, and return to execute the step of sending the data read request corresponding to each communication data frame in the data sequence to be sent to the target node in the order of frame sequence numbers.
[0143] In this embodiment, the controller receives the data loopback result sent by the target node within the timeout waiting time, which not only verifies the integrity of the data transmission, but also allows the controller to dynamically adjust the update data sequence of the sending window according to the data loopback result, that is, to perform the step of determining the update data sequence of the sending window according to the data loopback result and the data sequence to be sent, which effectively reduces the redundancy and errors in data transmission and improves the efficiency and reliability of data transmission. Next, the updated data sequence is used as the next data frame to be sent, and the step of executing the data read request corresponding to each communication data frame in the data sequence to be sent according to the frame sequence number order to the target node is returned, so as to achieve the continuity and smoothness of data transmission.
[0144] Further, in some feasible embodiments, in the above step Y10: sending a data read request corresponding to each of the communication data frames in the to-be-sent data sequence to the target node in the order of frame sequence numbers, the data transmission method may further include the following implementation steps:
[0145] Step X10: If no response from the target node to the target read request in the to-be-sent data sequence is received within the timeout waiting time, resend the target read request to the target node, where the target read request is any one of the multiple data read requests.
[0146] In this embodiment, when the controller does not receive a response from the target node to the target read request in the data sequence to be sent within a preset timeout waiting period due to network delays, target node processing delays or other factors during the data transmission process, the present application configures the controller to resend the target read request to the target node, thereby ensuring the reliable delivery of the target read request data request, thereby avoiding data loss due to a single transmission failure.
[0147] Step X20: In response to the target loopback result of the target read request returned by the target node, send a data read request corresponding to a communication data frame with a frame sequence number being a target sequence to the target node; wherein the target loopback result is set to determine that the communication data frame specified by the target read request has been received, and the target sequence is obtained by superimposing the frame sequence number sequence pointed to by the target read request based on the data capacity of the sending window.
[0148] In this embodiment, in response to the target loopback result of the target read request returned by the target node, the target loopback result is used to characterize that the data frame specified by the target read request has been successfully received; next, the controller intelligently calculates the frame sequence number (i.e., the target sequence) of the next data read request to be sent, and the target sequence is obtained by superimposing the data capacity of the sending window and the frame sequence number sequence pointed to by the target read request, thereby ensuring the orderly sending of the data read request, thereby significantly improving the efficiency and accuracy of data transmission.
[0149] Furthermore, based on the first embodiment and / or the second embodiment of the data transmission method of the present application, a third embodiment of the data transmission method of the present application is proposed.
[0150] The data transmission method of the present application is applied to the target node, and the data transmission method includes the following implementation steps:
[0151] Step D10: receiving each communication data frame in the to-be-sent data sequence sent by the controller in the order of the frame sequence number, and sending the data loopback result to the controller within a preset timeout waiting time.
[0152] In this embodiment, the target node receives the communication data frame in the data sequence to be sent by the controller in the order of the frame sequence number, which ensures the orderliness of data reception. The loopback data frame identical to the current data frame (i.e., the communication data frame with the smallest frame sequence number in the multiple groups of the communication data frames) is fed back to the controller as the data loopback result within the preset timeout waiting time, so that the controller can timely understand the data transmission status. For the controller, multiple groups of communication data frames arranged in the order of frame sequence numbers are specified from the communication data sequence by the preset sending window as the data sequence to be sent, and are sent in order, which ensures the consistency and stability of data transmission. In response to the data loopback result fed back by the target node, the controller determines the updated data sequence of the sending window based on it and the data sequence to be sent, and then performs data transmission, thereby improving the reliability and efficiency of data transmission. And through orderly data transmission, reception and feedback, it can better adapt to different network environments, reduce the occurrence of data loss and disorder, and also facilitate rapid retransmission and error correction when problems occur, enhancing the stability and robustness of data transmission.
[0153] In a specific embodiment, in order to ensure that the data receiver (i.e., the target node) is delivered to the application layer in order, the present application is provided with a receiving buffer in each receiving device. Specifically, the target node checks the frame sequence number of the received communication data frame, and delivers the communication data frame to the application layer in order. If there is a communication data frame with the previous frame sequence number that has not been received, it is necessary to wait for the communication data frame with the previous frame sequence number to be received and then delivered to the application layer.
[0154] Further, in some feasible embodiments, referring to Figure 4 , the data transmission method applied to the target node also includes the following implementation steps:
[0155] Step D10: In response to the data query request of the controller, receiving a data read request corresponding to each communication data frame in the to-be-sent data sequence sent by the controller in frame sequence order.
[0156] In this embodiment, when the target node receives a data query request from the controller, that is, after receiving the query instruction of the controller for a series of communication data frames (data sequence to be sent) to be sent, the transmission process of the target node delivering data to the controller is started. Specifically, the target node responds to the data query request of the controller and is ready to receive the data read request of each communication data frame in the data sequence to be sent one by one according to the predefined frame sequence order, thereby ensuring the orderliness and accuracy of data transmission.
[0157] Step D20: until the data read request of the next communication data frame of the final data frame in the data sequence to be sent is read, it is determined that the loopback data frame identical to the current data frame has been uploaded to the controller as the data loopback result within the timeout waiting time, and the data loopback result is set to determine that the current data frame has been received.
[0158] In this embodiment, the target node continuously receives the data read request of each communication data frame in the to-be-sent data sequence sent by the controller one by one in the order of the frame sequence number until the data read request of the next communication data frame of the final data frame in the to-be-sent data sequence is read, that is, the data read request of the next communication data frame of the final data frame in the to-be-sent data sequence is read. Figure 4 When a read request is received in 22, it is determined that a loopback data frame identical to the current data frame has been uploaded to the controller as a data loopback result within the preset timeout waiting time. At this time, the controller confirms that the current data frame has been successfully delivered to the target node device based on the received data loopback result; next, the controller uses the data sequence of the next data frame of the current data frame to the next communication data frame of the final data frame as the next data frame to be sent, so that the target node can execute the step of receiving the data read request corresponding to each communication data frame in the data sequence to be sent sent by the controller in the order of frame sequence numbers according to the next data frame to be sent, thereby ensuring the efficiency and reliability of data transmission.
[0159] In a specific embodiment, refer to Figure 4 , Figure 4 The query request >> shown is a data query request, the #20 read request and the #21 read request are data read requests corresponding to each communication data frame in the data sequence to be sent, and the device 3 is the target node. Exemplarily, the device 3 responds to the query request >> of the controller, receives the #20 read request and the #21 read request sent by the controller one by one in the order of the frame sequence number, until the #21 read request is read, and determines that the loopback data frame identical to the data 20 (i.e., #20) has been uploaded to the controller as the data loopback result within the preset timeout waiting time. At this time, when the controller confirms that #20 has been successfully delivered to the device 3, the data sequence containing #21 and #22 is synchronously used as a new data sequence to be sent, so that the device 3 can execute the step of receiving the data read request corresponding to each communication data frame in the data sequence to be sent by the controller according to the frame sequence number order based on the data sequence to be sent constructed by #21 and #22, thereby ensuring the efficiency and reliability of data transmission.
[0160] Further, in some other feasible embodiments, referring to Figure 8 , Figure 8The embodiment of the present application is a schematic diagram of input data transmission retransmission. In the above step D10: receiving a data read request corresponding to each communication data frame in the to-be-sent data sequence sent by the controller in the order of frame sequence numbers, the subsequent data transmission method further includes the following implementation steps:
[0161] Step E10: receiving the target read request resent by the controller, where the target read request is any one of the multiple data read requests.
[0162] In this embodiment, when the controller does not receive a response from the target node to the target read request in the pending data sequence, the target read request is resent to the target node. At this time, the target node receives the target read request resent by the controller, which not only improves the success rate of data transmission, but also reduces the risk of interruption of the overall data transmission process due to a single communication failure.
[0163] It should be noted that the target read request is any one of the multiple data read requests. Figure 8 , Figure 8 The query request shown >> is a data query request, the #20 read request and the #21 read request are data read requests corresponding to each communication data frame in the data sequence to be sent, and the device 3 is the target node. The target read request set in this application is the #20 read request, because the controller did not receive the #20 loopback data frame returned by the device 3 based on the #20 read request, that is, the controller did not receive the response made by the device 3 to the #20 read request within the preset timeout waiting time.
[0164] Step E20: In response to the target read request, sending a loopback data frame identical to the communication data frame specified by the target read request as a target loopback result to the controller, wherein the target loopback result is set to determine that the communication data frame specified by the target read request has been received.
[0165] In this embodiment, the target node responds to the target read request resent by the controller, and sends the loopback data frame that is identical to the communication data frame specified by the target read request as the target loopback result to the controller. At this time, the controller determines the data capacity of the sending window, superimposes the data capacity on the frame sequence number sequence pointed to by the target read request, obtains the target sequence, and when sending the data read request corresponding to the communication data frame with the frame number of the target sequence to the target node, reads the target loopback result uploaded by the target node, then determines that the communication data frame specified by the target read request has been received.
[0166] In a specific embodiment, Figure 8The data capacity of the sending window shown is 2, and device 3 responds to the resent #20 read request and feeds back the response to the #20 read request (i.e., #20 response, also known as the loopback data frame of #20) to the controller. At this time, the controller adds the value of 2 of the data capacity to the value of 20 of the frame sequence number executed by the #20 read request, and obtains a target sequence of 22. When sending a #22 read request of data #22 with a target sequence of 22 to device 3, the #20 response fed back by device 3 is synchronously read, and thus it can be accurately confirmed that data #20 has been successfully received by the target node.
[0167] In summary, the present application sets up an efficient and orderly data transmission method, which integrates multiple advanced features such as automatic loopback transmission, loopback data frame timeout detection, intelligent retransmission mechanism and dynamic sending window management. Through automatic loopback transmission, the network controller can obtain loopback data frames in real time to verify the correctness of data transmission, effectively improving the reliability of data transmission. At the same time, combined with loopback data timeout detection, once a transmission error (i.e., data loss) is detected, the retransmission mechanism is immediately triggered to ensure the accuracy of the data. The introduction of the sending window mechanism realizes the ability to continue to send subsequent data frames without receiving the previous data loopback frame, significantly improving the efficiency and throughput of data interaction. In addition, the device strictly checks the sequence number of the received data frame, and delivers it to the application layer in order, ensuring the orderliness and integrity of the data, and completely solving the problem of frame loss that may occur during data transmission. In other words, the data transmission method of the present application not only realizes the efficient and orderly interaction of data, but also comprehensively improves the reliability, real-time and overall performance of data transmission through a series of optimization measures.
[0168] In addition, the present application also provides a data transmission system, and the data transmission system provided in the present application at least includes a controller and a target node in communication connection;
[0169] The controller is used to specify multiple groups of communication data frames arranged in frame sequence order as the data sequence to be sent from the communication data sequence through a preset sending window, and send each of the communication data frames in the data sequence to be sent to the target node according to the frame sequence order; in response to the data loopback result sent by the target node within a preset timeout waiting time, determine the updated data sequence of the sending window according to the data loopback result and the data sequence to be sent, and perform data transmission according to the updated data sequence;
[0170] The target node is used to receive each communication data frame in the to-be-sent data sequence sent by the controller in the order of frame sequence numbers, and send the data loopback result to the controller within a preset timeout waiting time.
[0171] Each functional device of the data transmission system of the present application implements the steps of the data transmission method of the present application as described above during operation.
[0172] In addition, the present application also provides a data transmission device. Figure 8 , Figure 8 The structure diagram of the data transmission device involved in the embodiment of the present application is shown in FIG. The device in the embodiment of the present application may be a device for locally running the data transmission method.
[0173] like Figure 8 As shown, the data transmission device of the embodiment of the present application may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface).
[0174] The memory 1005 is arranged on the main body of the data transmission device. The memory 1005 stores a program, and the program implements the corresponding operation when it is executed by the processor 1001. The memory 1005 is also used to store parameters used by the data transmission device. The memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 can also be a storage device independent of the aforementioned processor 1001.
[0175] Those skilled in the art will understand that Figure 8 The data transmission device structure shown in the figure does not constitute a limitation on the data transmission device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0176] like Figure 8 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a data transmission program of the device.
[0177] exist Figure 8 In the data transmission device shown, the processor 1001 can be used to call the data transmission program of the device stored in the memory 1005 and execute the steps of any of the above-mentioned data transmission methods.
[0178] In addition, the present application provides a computer-readable storage medium on which a data transmission program is stored, and when the data transmission program is executed by a processor, the steps of the above-mentioned data transmission method are implemented.
[0179] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0180] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0181] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0182] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data transmission method, characterized in that: The data transmission method is applied to a controller, and the data transmission method includes: Specifying multiple groups of communication data frames arranged in frame sequence order from the communication data sequence as a data sequence to be sent through a preset sending window, and sending each of the communication data frames in the data sequence to be sent to a target node according to the frame sequence order; In response to the data loopback result sent by the target node within a preset timeout waiting time, an updated data sequence of the sending window is determined according to the data loopback result and the to-be-sent data sequence, and data transmission is performed according to the updated data sequence.
2. The data transmission method according to claim 1, characterized in that: The data loopback result is a loopback data frame in the to-be-sent data sequence that is identical to the current data frame; The step of determining an updated data sequence according to the data loopback result and the to-be-sent data sequence comprises: In response to the data loopback result, taking the next communication data frame of the final data frame in the to-be-sent data sequence as the target data frame; The next communication data frame of the current data frame is used as the next current data frame, and the data sequence from the next current data frame to the target data frame is sorted in the order of frame sequence numbers as the update data sequence of the sending window.
3. The data transmission method according to claim 1, characterized in that: The step of performing data transmission according to the update data sequence comprises: After sending the communication data frame with the largest frame number in the update data sequence to the target node, taking the update data sequence as the next data sequence to be sent, returning to execute the step of responding to the data loopback result of the data sequence to be sent sent by the target node within a preset timeout waiting time; When the updated data sequence of the sending window is an empty set, it is determined that the data transmission of the to-be-sent data sequence is completed based on the sending window.
4. The data transmission method according to claim 1, characterized in that: After the step of sending each of the communication data frames in the to-be-sent data sequence to the target node in the order of the frame sequence numbers, the data transmission method further comprises: When the data loopback result sent by the target node is not received within the timeout waiting time, the current data frame is resent to the target node, and the number of repeated transmissions of the current data frame is accumulated; Detecting whether the data loopback result sent by the target node within the timeout waiting time is received when the number of repeated transmissions does not exceed a preset retransmission number threshold; If yes, return to the step of determining the updated data sequence of the sending window according to the data loopback result and the to-be-sent data sequence; If not, the step of resending the current data frame to the target node is stopped, and data transmission is performed according to other data frames in the to-be-sent data sequence except the current data frame.
5. The data transmission method according to claim 4, characterized in that: The step of transmitting data according to other data frames in the to-be-sent data sequence except the current data frame comprises: Determine other data frames except the current data frame in the to-be-sent data sequence, and after receiving data loopback frames corresponding to the other data frames within the timeout waiting time, send the current data frame to the target node for data transmission.
6. The data transmission method according to claim 5, characterized in that: The step of sending the current data frame to the target node for data transmission comprises: When the target node returns a loopback data frame identical to the current data frame, maintaining the sequence of data to be sent in the sending window unchanged; Until the target node pops the other data frames cached in the preset receiving buffer area in sequence according to the frame sequence number, the next communication data frame of the final data frame in the to-be-sent data sequence is used as the next current data frame; Arrange the data sequence from the next current data frame to the destination data frame in the order of frame numbers as the next data sequence to be sent, and return to execute the step of sending each communication data frame in the data sequence to be sent to the target node in the order of frame numbers, wherein the destination data frame is a communication data frame whose frame number is the data capacity of the sending window.
7. The data transmission method according to claim 1, characterized in that: The data loopback result is a loopback data frame in the to-be-sent data sequence that is identical to the current data frame, and the data transmission method further includes: Sending a data query request to the target node, and sending a data read request corresponding to each communication data frame in the to-be-sent data sequence to the target node in frame sequence order according to a response made by the target node to the data query request; If the data loopback result sent by the target node is received within the timeout waiting time, the step of determining the updated data sequence of the sending window based on the data loopback result and the data sequence to be sent is executed, and the updated data sequence is used as the next data frame to be sent, and the step of returning to execute the step of sending the data read request corresponding to each communication data frame in the data sequence to be sent to the target node in the order of frame sequence numbers.
8. The data transmission method according to claim 7, characterized in that: After the step of sending the data read request corresponding to each of the communication data frames in the to-be-sent data sequence to the target node in the order of frame sequence numbers, the data transmission method further includes: If no response from the target node to the target read request in the to-be-sent data sequence is received within the timeout waiting time, resending the target read request to the target node, the target read request being any one of the multiple data read requests; In response to the target loopback result of the target read request returned by the target node, a data read request corresponding to the communication data frame with a frame sequence number being the target sequence is sent to the target node; wherein, The target loopback result is set to determine that the communication data frame specified by the target read request has been received, and the target sequence is obtained by superimposing the frame sequence number sequence pointed to by the target read request based on the data capacity of the sending window.
9. A data transmission method, characterized in that: The data transmission method is applied to a target node, and the data transmission method includes: The receiving controller receives each communication data frame in the to-be-sent data sequence sent in the order of the frame sequence number, and sends the data loopback result to the controller within a preset timeout waiting time.
10. The data transmission method according to claim 9, characterized in that: The data transmission method further comprises: In response to a data query request of the controller, receiving a data read request corresponding to each communication data frame in the to-be-sent data sequence sent by the controller in frame sequence order; Until the data read request of the next communication data frame of the final data frame in the data sequence to be sent is read, it is determined that the loopback data frame identical to the current data frame has been uploaded to the controller as a data loopback result within the timeout waiting time, and the data loopback result is set to determine that the current data frame has been received.
11. The data transmission method according to claim 10, characterized in that: After the step of receiving a data read request corresponding to each of the communication data frames in the to-be-sent data sequence sent by the controller in the order of frame sequence numbers, the data transmission method comprises: receiving the target read request resent by the controller, where the target read request is any one of the multiple data read requests; In response to the target read request, a loopback data frame identical to the communication data frame specified by the target read request is sent to the controller as a target loopback result, the target loopback result being set to determine that the communication data frame specified by the target read request has been received.
12. A data transmission system, characterized in that: The data transmission system comprises at least a controller and a target node in communication connection; The controller is used to specify multiple groups of communication data frames arranged in frame sequence order from the communication data sequence as the data sequence to be sent through a preset sending window, and send each of the communication data frames in the data sequence to be sent to the target node according to the frame sequence order; In response to a data loopback result sent by the target node within a preset timeout waiting time, determining an updated data sequence of the sending window according to the data loopback result and the to-be-sent data sequence, and performing data transmission according to the updated data sequence; The target node is used to receive each communication data frame in the to-be-sent data sequence sent by the controller in the order of frame sequence numbers, and send the data loopback result to the controller within a preset timeout waiting time.
13. A data transmission device, characterized in that: The data transmission device includes a memory, a processor, and a data transmission program stored in the memory and executable on the processor. When the processor executes the data transmission program, the steps of the data transmission method according to any one of claims 1 to 10 are implemented.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data transmission program, and when the data transmission program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 10 are implemented.
