A bus protocol data transmission control method, device, equipment and storage medium
By receiving and parsing Ethernet data packets on the bus module, dynamically adjusting the discard probability and segmentation encapsulation, and using buffer design, the problem of data delay in a multi-network environment is solved, real-time data transmission and multi-protocol integration are realized, and delay and Spill risk.
Patent Information
- Application Number
- CN202410970983.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-07-19
AI Technical Summary
In a multi-network environment, the data delays of different network protocols vary greatly, which affects the real-time performance of the system. Especially in application scenarios such as robot control and high-speed motion control, data transmission delays or interruptions may lead to system performance degradation or failure.
Receive Ethernet data packets through the control bus module, analyze and determine whether to send to the wireless network or CAN bus, dynamically adjust the discard probability, segment and re-encapsulate the data packets, and use the primary and secondary buffers for data forwarding to ensure the integrity of the data packets. The target IP address is forwarded accurately to reduce communication delays.
It realizes multi-protocol integration and conversion control of the bus module, reduces communication delays, ensures real-time data transmission in a multi-network integration environment, avoids CAN sending buffer overflow, and improves network throughput and data integrity.
Smart Images

Figure CN118524076B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of bus technology, and in particular to a bus protocol data transmission control method, device, equipment and storage medium. Background Art
[0002] The bus module, also known as the bus device, can control the bus and is the bottom-level data communication network in the field of automation. The bus module is used in the production site to connect the intelligent field equipment and the automatic control system with a two-way transmission and branch structure communication network, and can exchange data with other communicative devices.
[0003] The bus module is provided with at least one communication network port, which is connected to the host control system for data transmission. In the prior art, a variety of protocols are usually configured on the bus module, such as Modbus, CAN, Profinet, EtherCAT, etc., to meet different communication needs. This coexistence of multiple protocols leads to the formation of a multi-network environment. The delay difference of data of different network protocols is large, and the data delay difference between different protocols may have a significant impact on the real-time performance of the system. In many application scenarios, such as robot control, high-speed motion control, etc., real-time data transmission is crucial. Delays or interruptions in data transmission may cause system performance to decline or even malfunction. Therefore, how to achieve real-time data transmission in a multi-network integrated environment is an urgent problem to be solved by technicians in this field. Summary of the invention
[0004] In view of the above defects, the embodiments of the present invention provide a bus protocol data transmission control method, device, equipment and storage medium to solve the problems existing in the prior art.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a bus protocol data transmission control method, the method comprising:
[0006] The control bus module receives the Ethernet data packet and parses the Ethernet data packet;
[0007] Determining whether the Ethernet data packet is sent to a wireless network;
[0008] If the Ethernet data packet is sent to a wireless network, transmitting the Ethernet data packet to a primary buffer of the bus module;
[0009] Control the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding;
[0010] If the Ethernet data packet is sent to the CAN bus, the Ethernet data packet is transmitted to the secondary buffer of the bus module;
[0011] Obtaining the queue length of the CAN data frame, and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame;
[0012] The remaining Ethernet data packets after being discarded are divided and re-encapsulated into a plurality of CAN data packets;
[0013] forwarding the CAN data packet from the secondary buffer of the bus module according to the target IP address in the CAN data packet;
[0014] The CAN bus device is controlled to receive the CAN data packet and perform splicing processing on the CAN data packet.
[0015] Preferably, the obtaining of the queue length of the CAN data frame and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame comprises:
[0016] Obtaining a queue length of the CAN data frame according to the Ethernet data;
[0017] Dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame;
[0018] The Ethernet data packet is randomly discarded according to the discard probability of the Ethernet data packet.
[0019] Preferably, randomly discarding the Ethernet data packet according to the discard probability of the Ethernet data packet comprises:
[0020] If the queue length of the CAN data frame is less than the minimum threshold, receiving the arriving Ethernet data packet;
[0021] If the queue length of the CAN data frame is between the minimum threshold value and the maximum threshold value, the arriving Ethernet data packet is discarded according to a preset probability.
[0022] Preferably, the randomly discarding the Ethernet data packet according to the discarding probability of the Ethernet data packet further comprises:
[0023] If the queue length of the CAN data frame is greater than the maximum threshold value, the arriving Ethernet data packet is directly discarded.
[0024] Preferably, in the case where the queue length of the CAN data frame is between the minimum threshold value and the maximum threshold value, the arriving Ethernet data packet is discarded according to a preset probability, the linear relationship of the preset probability is: ; Wherein, P is the preset probability; It is the queue length of the current CAN data frame; is the minimum threshold value; is the maximum threshold value; is the maximum drop probability.
[0025] Preferably, the bus protocol data transmission control method further includes:
[0026] Control the bus module to receive CAN bus data and parse the CAN bus data;
[0027] Determine whether the CAN bus data is sent to Ethernet;
[0028] If the CAN bus data is sent to Ethernet, the CAN bus data is sent to the primary buffer;
[0029] Convert the CAN bus data into Ethernet data, and encapsulate the Ethernet data into Ethernet data packets;
[0030] forwarding the Ethernet data packet from the primary buffer of the bus module according to the target IP address of the Ethernet data packet;
[0031] If the CAN bus data is sent to a wireless network, the CAN bus data is sent to a secondary buffer of a bus module;
[0032] Converting the CAN bus data into wireless transmission data, and encapsulating the wireless transmission data into a wireless network data packet;
[0033] According to the target IP address of the wireless network data packet, the wireless network data packet is forwarded from the secondary buffer of the bus module.
[0034] Preferably, the primary buffer is implemented by a Vector with a continuous buffer area, and the secondary buffer is implemented by a List with a dispersed buffer area.
[0035] In order to solve the above technical problems, an embodiment of the present invention provides a bus protocol data transmission control device, the device comprising:
[0036] A parsing module, used for controlling the bus module to receive Ethernet data packets and parse the Ethernet data packets;
[0037] A determination module, used for determining whether the Ethernet data packet is sent to the wireless network;
[0038] A primary buffer module, used for transmitting the Ethernet data packet to the primary buffer of the bus module if the Ethernet data packet is sent to the wireless network;
[0039] A first data forwarding module, used for controlling the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding;
[0040] A secondary buffer module, used for transmitting the Ethernet data packet to the secondary buffer of the bus module if the Ethernet data packet is sent to the CAN bus;
[0041] A discard control module, used for obtaining the queue length of the CAN data frame, and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame;
[0042] A segmentation conversion module, used for segmenting the remaining Ethernet data packets after being discarded, and re-encapsulating them into a plurality of CAN data packets;
[0043] A second data forwarding module, configured to forward the CAN data packet from the secondary buffer of the bus module according to the target IP address in the CAN data packet;
[0044] The splicing module is used to control the CAN bus device to receive the CAN data packet and perform splicing processing on the CAN data packet.
[0045] To solve the above technical problems, an embodiment of the present invention provides a bus protocol data transmission control device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the method of the first aspect in the above embodiment is implemented.
[0046] To solve the above technical problem, an embodiment of the present invention provides a storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method of the first aspect in the above embodiment is implemented.
[0047] In summary, the embodiments of the present invention provide a bus protocol data transmission control method, device, equipment and storage medium. The present invention receives an Ethernet data packet by controlling the bus module, parses the Ethernet data packet; determines whether the Ethernet data packet is sent to a wireless network; if the Ethernet data packet is sent to a wireless network, transmits the Ethernet data packet to the primary buffer of the bus module; controls the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding; if the Ethernet data packet is sent to a CAN bus, transmits the Ethernet data to the secondary buffer of the bus module; converts the Ethernet data packet into a CAN data frame, and divides and converts the CAN data frame; re-encapsulates the divided and converted CAN data frame into several CAN data packets; forwards the CAN data packet from the secondary buffer of the bus module according to the target IP address in the CAN data packet; controls the CAN bus device to receive the CAN data packet, and splices the CAN data packet.
[0048] In the present application, high-speed networks and low-speed networks adopt a hierarchical buffer design, and different data structures are used to manage buffers at different levels, which can effectively improve transmission efficiency. When the Ethernet data packet is too long, the present application can segment the Ethernet data packet, encapsulate it into a CAN data packet, and send it to the corresponding CAN bus according to the target IP address of the CAN data packet; in addition, the present application can dynamically adjust the discard probability of the Ethernet data packet according to the queue length of the CAN data frame, avoid overflow due to exhaustion of the CAN send buffer space, and reduce queue delay. Therefore, the present invention can realize multi-protocol integration and conversion control of the bus module, reduce communication delay, and ensure real-time data transmission in a multi-network integration environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the following briefly introduces the drawings required for use in the embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 The present invention is a flowchart of a bus protocol data transmission control method according to an embodiment of the present invention.
[0051] Figure 2 The present invention is a flowchart of an embodiment of obtaining a queue length of a CAN data frame and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame.
[0052] Figure 3The present invention is a flowchart of randomly discarding Ethernet data packets according to the discard probability of the Ethernet data packets.
[0053] Figure 4 It is a schematic diagram of the relationship between a discard probability P and a queue length of CAN data frames according to an embodiment of the present invention.
[0054] Figure 5 It is a structural schematic diagram of a bus protocol data transmission control device according to an embodiment of the present invention.
[0055] Figure 6 It is a structural schematic diagram of a bus protocol data transmission control device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The features and exemplary embodiments of various aspects of the present invention will be described in detail below. In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only configured to explain the present invention and are not configured to limit the present invention. For those skilled in the art, the present invention can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by illustrating examples of the present invention.
[0057] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device 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 device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0058] See also Figure 1 , Figure 1 A bus protocol data transmission control method provided in this application comprises the following steps:
[0059] S1, control the bus module to receive Ethernet data packets and parse the Ethernet data packets;
[0060] Specifically, the bus module of the present application is integrated with a wireless network interface, an Ethernet network interface, and a CAN network interface. In this embodiment, data is transmitted between the bus module and a host control system such as a PLC via an Ethernet network, the bus module is connected to an external industrial device via a wireless network or a CAN bus cable, and data is transmitted between the bus module and the external industrial device via a wireless network or a CAN bus network.
[0061] Specifically, in this embodiment, firstly, an Ethernet data packet is received from the host control system through the Ethernet network, and the bus module receives the Ethernet data packet and parses the Ethernet data packet. It can be understood that after parsing, key information of the Ethernet data packet can be extracted, such as the source IP address, the target IP address and the data content.
[0062] S2, determining whether the Ethernet data packet is sent to the wireless network;
[0063] Specifically, in this embodiment, after the parsing is completed, the bus module will determine whether the Ethernet data packet needs to be sent to the wireless network or the CAN bus according to the target IP address of the Ethernet data packet.
[0064] S3, if the Ethernet data packet is sent to the wireless network, the Ethernet data packet is transmitted to the primary buffer of the bus module;
[0065] Specifically, in this embodiment, if the target IP address of the Ethernet data packet is a wireless network, the bus module will transmit the Ethernet data packet to the primary buffer.
[0066] It is worth noting that in a multi-network environment, the delay of network data varies greatly, and therefore the requirements for buffering also vary greatly. For networks with high transmission rates, the buffering requirement is fast speed, and the requirement for buffer capacity is not high; for networks with low transmission rates, the buffering requirement is large capacity, and the requirement for speed is not very high. Therefore, this application will design the buffer in layers, and use different data structures to manage buffers at different levels, which can effectively improve transmission efficiency.
[0067] Specifically, in this embodiment, compared with the CAN network, the wireless network is a high-speed network, and a first-level buffer is used to serve it. The buffer area of the first-level buffer is continuous, the operation speed is fast, but the capacity is limited.
[0068] Specifically, in this embodiment, compared with the wireless network, the CAN network is a low-speed network, and a secondary buffer is used to serve it. The buffer area of the secondary buffer is dispersed, the operation speed is slightly slower, but the capacity is larger.
[0069] Therefore, in the present application, different network data services are provided by buffering layers, which can alleviate the memory shortage on the one hand, and ensure the real-time nature of network data forwarding on the other hand.
[0070] S4, controlling the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding;
[0071] Specifically, in this embodiment, after the Ethernet data packet is transmitted to the primary buffer of the bus module, the wireless network obtains the data packet from the primary buffer and forwards it.
[0072] S5, if the Ethernet data packet is sent to the CAN bus, the Ethernet data is transferred to the secondary buffer of the bus module;
[0073] Specifically, if the destination IP address of the Ethernet data packet is the CAN bus network, the bus module will transmit the Ethernet data packet to the secondary buffer.
[0074] S6. Obtain the queue length of the CAN data frames, and dynamically adjust the discard probability of the Ethernet data packets according to the queue length of the CAN data frames.
[0075] Specifically, in this embodiment, Ethernet data packets and CAN data frames are data transmission formats under two different network protocols. Ethernet data packets have a larger data capacity and a higher transmission speed, while CAN data frames have a smaller data capacity and a slower transmission speed.
[0076] Specifically, in this embodiment, since Ethernet transmits data faster and the CAN bus transmits data slower, when there are too many Ethernet data packets, the CAN sending buffer will overflow and reduce the data conversion performance.
[0077] Therefore, the present application obtains the discard probability of Ethernet data packets by confirming the queue length of CAN data frames, and randomly discards Ethernet data packets based on this probability, thereby avoiding CAN send buffer space exhaustion and overflow, improving network throughput and reducing queue delay.
[0078] It is understandable that the packet loss mechanism of the present application will discard some data packets when implementing the conversion between Ethernet and CAN networks, so the integrity of the data can be ensured by setting a redundancy mechanism. For example, a data retransmission mechanism is implemented at a higher layer to ensure that important data can eventually be correctly transmitted, which is not specifically limited here.
[0079] Therefore, the present application can minimize the loss of data packets while ensuring the overall performance of the network, and can strike a balance between data transmission efficiency and data integrity.
[0080] S7, dividing the remaining Ethernet data packets after being discarded, and re-encapsulating them into a plurality of CAN data packets.
[0081] Specifically, in this embodiment, since the data capacity of the Ethernet data packet is relatively large and the data capacity of the CAN data frame is limited, the Ethernet data packet needs to be segmented and then reassembled into a number of CAN data packets.
[0082] Specifically, in this embodiment, in the process of segmentation and conversion, in order to ensure the integrity and correctness of the data and avoid data loss or error, the CAN data frame needs to be segmented, numbered, checked, etc.
[0083] S8. According to the target IP address in the CAN data packet, the CAN data packet is forwarded from the secondary buffer of the bus module.
[0084] S9, controlling the CAN bus device to receive the CAN data packets, and performing splicing processing on the CAN data packets.
[0085] Specifically, in this embodiment, the bus module forwards the CAN data packet from the secondary buffer according to the target IP address in the CAN data packet.
[0086] Specifically, the external industrial device receives these data packets through the CAN bus interface and performs splicing processing to restore the original CAN data packet content.
[0087] In summary, the present application provides a bus protocol data transmission control method. In this scheme, the bus module is controlled to receive Ethernet data packets and parse the Ethernet data packets; it is determined whether the Ethernet data packets are sent to the wireless network; if the Ethernet data packets are sent to the wireless network, the Ethernet data packets are transmitted to the primary buffer of the bus module; the wireless network is controlled to obtain the Ethernet data packets from the primary buffer of the bus module for forwarding; if the Ethernet data packets are sent to the CAN bus, the Ethernet data is transmitted to the secondary buffer of the bus module; the Ethernet data packets are converted into CAN data frames, and the CAN data frames are segmented and converted; the segmented and converted CAN data frames are repackaged into several CAN data packets; according to the target IP address in the CAN data packets, the CAN data packets are forwarded from the secondary buffer of the bus module; the CAN bus device is controlled to receive the CAN data packets, and the CAN data packets are spliced. Therefore, the present invention can realize the multi-protocol integration and conversion control of the bus module, reduce communication delays, and ensure real-time data transmission in a multi-network integration environment.
[0088] Based on the above embodiments:
[0089] See also Figure 2 , Figure 2A schematic diagram of the principle architecture of a code read protection module provided in this application.
[0090] As a preferred embodiment, obtaining the queue length of the CAN data frame, and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame includes:
[0091] S61. Obtain the queue length of the CAN data frame according to the Ethernet data.
[0092] Specifically, in this embodiment, since the data format of Ethernet data and the data format of CAN data frames are known, the system confirms the queue length of CAN data frames by monitoring the size of Ethernet data packets in real time.
[0093] S62, dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame;
[0094] Specifically, in this embodiment, the discard probability P is usually determined dynamically according to the relationship between the queue length of the CAN data frame, the minimum threshold value and the maximum threshold value.
[0095] S63: Randomly discard the Ethernet data packet according to the discard probability of the Ethernet data packet.
[0096] Specifically, in this embodiment, some data packets are randomly discarded with a discard probability P, so that the length of the CAN sending queue is controlled, and the processing delay caused by the CAN sending queue can be avoided, thereby improving the overall throughput of the network.
[0097] See also Figure 3 , Figure 3 The present application provides a flowchart for randomly discarding Ethernet data packets according to the discard probability of the Ethernet data packets.
[0098] As a preferred embodiment, randomly discarding Ethernet data packets according to the discard probability of the Ethernet data packets includes:
[0099] S631, if the queue length of the CAN data frame is less than the minimum threshold, receiving the arriving Ethernet data packet;
[0100] S632: If the queue length of the CAN data frame is between the minimum threshold and the maximum threshold, the arriving Ethernet data packet is discarded according to a preset probability.
[0101] As a preferred embodiment, randomly discarding the Ethernet data packet according to the discard probability of the Ethernet data packet further comprises:
[0102] S633: If the queue length of the CAN data frame is greater than the maximum threshold, the arriving Ethernet data packet is directly discarded.
[0103] Specifically, in this embodiment, the queue length of the current CAN data frame is calculated for each arriving Ethernet data packet. If the queue length of the current CAN data frame is less than the minimum threshold value, the Ethernet data packet is received. If the queue length of the current CAN data frame is between the minimum threshold and the maximum threshold, the arriving Ethernet data packet is discarded according to a preset probability. If the queue length of the current CAN data frame is greater than the maximum threshold value, the arriving Ethernet data packet is discarded.
[0104] See also Figure 4 , Figure 4 A schematic diagram of the relationship between a discard probability P and a queue length of CAN data frames provided in the present application.
[0105] Specifically, the discard probability P is usually determined dynamically based on the relationship between the queue length of the CAN data frame, the minimum threshold value and the maximum threshold value. When the discard probability P is low, the queue length of CAN data frames is close to The probability of discarding is high, even reaching the maximum probability Pmax .
[0106] As a preferred embodiment, if the queue length of the CAN data frame is between the minimum threshold value and the maximum threshold value, the arriving Ethernet data packet is discarded according to a preset probability, and the linear relationship of the preset probability is: ; Wherein, P is the preset probability; It is the queue length of the current CAN data frame; is the minimum threshold value; is the maximum threshold value; is the maximum drop probability.
[0107] Specifically, in this embodiment, different applications have different requirements for delay and packet loss rate. For example, real-time applications may require lower delay and packet loss rate, so and It may need to be set lower to reduce the queue length, but no specific limitation is given here.
[0108] Specifically, in the above linear relationship, when Less than When P is 0, the data packet is not discarded; when exist and When Greater than When P is fixed at , discard all packets.
[0109] As a preferred embodiment, a bus protocol data transmission control method further includes:
[0110] The control bus module receives the CAN bus data and parses the CAN bus data;
[0111] Determine whether CAN bus data is sent to Ethernet;
[0112] If CAN bus data is sent to Ethernet, the CAN bus data is sent to the primary buffer;
[0113] Convert CAN bus data into Ethernet data, and encapsulate the Ethernet data into Ethernet data packets;
[0114] According to the target IP address of the Ethernet data packet, the Ethernet data packet is forwarded from the primary buffer of the bus module;
[0115] If the CAN bus data is sent to the wireless network, the CAN bus data is sent to the secondary buffer of the bus module;
[0116] Convert CAN bus data into wireless transmission data, and encapsulate the wireless transmission data into wireless network data packets;
[0117] According to the target IP address of the wireless network data packet, the wireless network data packet is forwarded from the secondary buffer of the bus module.
[0118] Specifically, in this embodiment, the CAN bus network data packet is first received from the host control system through the CAN bus network, and the bus module receives the CAN bus network data packet and parses the CAN bus network data packet. It can be understood that after parsing, key information of the CAN bus network data packet can be extracted, such as the source IP address, the target IP address and the data content.
[0119] Specifically, in this embodiment, after the parsing is completed, the bus module will determine whether the CAN bus network data packet needs to be sent to the wireless network or the Ethernet network according to the target IP address of the CAN bus network data packet. The bus module is then connected to the external industrial device through the wireless network or the Ethernet network, and the bus module and the external industrial device perform data transmission through the wireless network or the Ethernet network.
[0120] Alternatively, the present application can also first receive data packets through a wireless network, and then the bus module is connected to the external industrial equipment through a CAN bus network or an Ethernet network, and data is transmitted between the bus module and the external industrial equipment through the CAN bus network or the Ethernet network, which is not specifically limited here.
[0121] As a preferred embodiment, the primary buffer is implemented by a continuous Vector in the buffer area, and the secondary buffer is implemented by a dispersed List in the buffer area.
[0122] Specifically, in this embodiment, Vector generally guarantees continuous memory allocation of internal elements, which makes data access more efficient, especially when a large number of sequential access operations are performed.
[0123] Specifically, in this embodiment, similar to vector, List is also a dynamic data structure that can automatically adjust its size as data is added and deleted. List allows internal elements to be stored non-contiguously in memory and linked through a linked list. The operation speed is slightly slower, but the capacity is large, so it can better meet the data management requirements of this application.
[0124] See also Figure 5 The embodiment of the present invention provides a bus protocol data transmission control device, the device comprising:
[0125] Parsing module 1, used for controlling the bus module to receive Ethernet data packets and parse the Ethernet data packets;
[0126] A determination module 2, used to determine whether the Ethernet data packet is sent to the wireless network;
[0127] A primary buffer module 3, used for transmitting the Ethernet data packet to the primary buffer of the bus module if the Ethernet data packet is sent to the wireless network;
[0128] A first data forwarding module 4, used for controlling the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding;
[0129] A secondary buffer module 5, for transmitting the Ethernet data to the secondary buffer of the bus module if the Ethernet data packet is sent to the CAN bus;
[0130] A discard control module 6, used for obtaining the queue length of the CAN data frame, and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame;
[0131] The segmentation and conversion module 7 is used to segment the remaining Ethernet data packets after being discarded, and re-encapsulate them into a plurality of CAN data packets;
[0132] A second data forwarding module 8, configured to forward the CAN data packet from the secondary buffer of the bus module according to the target IP address in the CAN data packet;
[0133] The splicing module 9 is used to control the CAN bus device to receive the CAN data packet and perform splicing processing on the CAN data packet.
[0134] In addition, combined Figure 1 The bus protocol data transmission control method described in the embodiment of the present invention can be implemented by a network bus protocol data transmission control device. Figure 6 A schematic diagram of the hardware structure of a bus protocol data transmission control device provided by an embodiment of the present invention is shown.
[0135] The bus protocol data transmission control device may include a processor 401 and a memory 402 storing computer program instructions.
[0136] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0137] The memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 402 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 402 may be inside or outside the data processing device. In a specific embodiment, the memory 402 is a non-volatile solid-state memory. In a specific embodiment, the memory 402 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0138] The processor 401 implements any one of the bus protocol data transmission control methods in the above embodiments by reading and executing computer program instructions stored in the memory 402 .
[0139] In one example, the bus protocol data transmission control device may further include a communication interface 403 and a bus 410. Figure 6 As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.
[0140] The communication interface 403 is mainly used to implement the communication between the modules, devices, units and / or equipment in the embodiment of the present invention.
[0141] Bus 410 includes hardware, software or both, and couples the components of bus protocol data transmission control device to each other. For example, but not limitation, the bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnect (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. Where appropriate, bus 410 may include one or more buses. Although the embodiments of the present invention describe and illustrate specific buses, the present invention contemplates any suitable bus or interconnection.
[0142] In addition, in combination with a bus protocol data transmission control method in the above embodiment, an embodiment of the present invention can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any bus protocol data transmission control method in the above embodiment is implemented.
[0143] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.
[0144] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.
Claims
1. A bus protocol data transmission control method, characterized in that: The bus protocol data transmission control method comprises: The control bus module receives the Ethernet data packet and parses the Ethernet data packet; Determining whether the Ethernet data packet is sent to a wireless network; If the Ethernet data packet is sent to a wireless network, transmitting the Ethernet data packet to a primary buffer of the bus module; Control the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding; If the Ethernet data packet is sent to the CAN bus, the Ethernet data packet is transmitted to the secondary buffer of the bus module; Obtaining the queue length of the CAN data frame, and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame; The remaining Ethernet data packets after being discarded are divided and re-encapsulated into a plurality of CAN data packets; forwarding the CAN data packet from the secondary buffer of the bus module according to the target IP address in the CAN data packet; The CAN bus device is controlled to receive the CAN data packet and perform splicing processing on the CAN data packet.
2. A bus protocol data transmission control method according to claim 1, characterized in that: In acquiring the queue length of the CAN data frame, dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame includes: Obtaining the queue length of the CAN data frame according to the Ethernet data packet; Dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame; The Ethernet data packet is randomly discarded according to the discard probability of the Ethernet data packet.
3. A bus protocol data transmission control method according to claim 2, characterized in that: The randomly discarding the Ethernet data packet according to the discarding probability of the Ethernet data packet comprises: If the queue length of the CAN data frame is less than the minimum threshold, receiving the arriving Ethernet data packet; If the queue length of the CAN data frame is between the minimum threshold value and the maximum threshold value, the arriving Ethernet data packet is discarded according to a preset probability.
4. A bus protocol data transmission control method according to claim 3, characterized in that: The randomly discarding the Ethernet data packet according to the discarding probability of the Ethernet data packet further comprises: If the queue length of the CAN data frame is greater than the maximum threshold value, the arriving Ethernet data packet is directly discarded.
5. A bus protocol data transmission control method according to claim 3, characterized in that: In the case where the queue length of the CAN data frame is between the minimum threshold value and the maximum threshold value, the arriving Ethernet data packet is discarded according to a preset probability, the linear relationship of the preset probability is: ; Wherein, P is the preset probability; It is the queue length of the current CAN data frame; is the minimum threshold value; is the maximum threshold value; is the maximum drop probability.
6. A bus protocol data transmission control method according to claim 1, characterized in that: The bus protocol data transmission control method further comprises: Control the bus module to receive CAN bus data and parse the CAN bus data; Determine whether the CAN bus data is sent to Ethernet; If the CAN bus data is sent to Ethernet, the CAN bus data is sent to the primary buffer; Convert the CAN bus data into Ethernet data, and encapsulate the Ethernet data into Ethernet data packets; forwarding the Ethernet data packet from the primary buffer of the bus module according to the target IP address of the Ethernet data packet; If the CAN bus data is sent to a wireless network, the CAN bus data is sent to a secondary buffer of a bus module; Converting the CAN bus data into wireless transmission data, and encapsulating the wireless transmission data into a wireless network data packet; According to the target IP address of the wireless network data packet, the wireless network data packet is forwarded from the secondary buffer of the bus module.
7. A bus protocol data transmission control method according to claim 1, characterized in that: The primary buffer is implemented by a continuous Vector in the buffer area, and the secondary buffer is implemented by a dispersed List in the buffer area.
8. A bus protocol data transmission control device, characterized in that: The device comprises: A parsing module, used for controlling the bus module to receive Ethernet data packets and parse the Ethernet data packets; A determination module, used for determining whether the Ethernet data packet is sent to the wireless network; A primary buffer module, used for transmitting the Ethernet data packet to the primary buffer of the bus module if the Ethernet data packet is sent to the wireless network; A first data forwarding module, used for controlling the wireless network to obtain the Ethernet data packet from the primary buffer of the bus module for forwarding; A secondary buffer module, used for transmitting the Ethernet data packet to the secondary buffer of the bus module if the Ethernet data packet is sent to the CAN bus; A discard control module, used for obtaining the queue length of the CAN data frame, and dynamically adjusting the discard probability of the Ethernet data packet according to the queue length of the CAN data frame; A segmentation conversion module, used for segmenting the remaining Ethernet data packets after being discarded, and re-encapsulating them into a plurality of CAN data packets; A second data forwarding module, configured to forward the CAN data packet from the secondary buffer of the bus module according to the target IP address in the CAN data packet; The splicing module is used to control the CAN bus device to receive the CAN data packet and perform splicing processing on the CAN data packet.
9. A bus protocol data transmission control device, characterized in that: include: At least one processor, at least one memory and computer program instructions stored in the memory, when the computer program instructions are executed by the processor, implement the method according to any one of claims 1 to 7.
10. A storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
