Controller area network and time-sensitive network protocol conversion method, device and equipment

By monitoring the messages transmitted on the CAN bus, recording the sending time and content, determining the average response cycle, and converting CAN messages into TSN frames with a unified sampling cycle, the problem of high complexity in traffic scheduling planning in the integration of CAN networks and TSN networks is solved, and efficient protocol conversion and improved system real-time performance are achieved.

CN119697273BActive Publication Date: 2025-10-03PURPLE MOUNTAIN LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411518987.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-10-03
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

During the integration of CAN and TSN networks, random bursts of CAN data streams lead to high computational complexity in traffic scheduling and planning, which is difficult to be effectively handled by existing technologies.

Method used

By monitoring the messages transmitted on the CAN bus, recording the sending time and content, determining the average response cycle, and converting the CAN messages into TSN frames with a unified sampling period, the complexity of traffic scheduling planning is reduced.

Benefits of technology

It achieves seamless conversion from CAN messages to TSN frames, reduces the computational complexity of traffic scheduling and planning, and improves the real-time and deterministic performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697273B_ABST
    Figure CN119697273B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, and apparatus for converting a controller area network (Controller Area Network) protocol to a time-sensitive network (TSN) protocol, relating to the field of network communication technology. The method comprises: monitoring Controller Area Network (CAR) messages transmitted on a CAR bus and recording the sending time and message content of multiple CAR messages; determining an average response period based on the sending time of each CAR message; converting the message content of each CAR message into a TSN frame for each CAR message; using the average response period as a sampling period for each TSN frame, and transmitting each TSN frame on the TSN according to the sampling period. The present invention can convert randomly bursty CAR messages into TSN frames with a uniform sampling period, treating multiple CAR messages as a periodic data stream to participate in traffic scheduling planning for the TSN, and reducing the computational complexity of traffic scheduling planning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a method, device and equipment for converting a controller area network (Controller Area Network) to a time-sensitive network (Time Sensitive Network) protocol. Background Art

[0002] The Controller Area Network (CAN) bus is a widely used protocol in real-time communication systems, offering advantages such as strong real-time performance, long transmission distances, and robustness against electromagnetic interference. However, with increasing system complexity and increasing real-time requirements, the traditional CAN bus may not meet these requirements in some scenarios. Time-Sensitive Networking (TSN), an emerging network technology, offers enhanced real-time performance and determinism, making it suitable for time-sensitive applications. However, due to significant differences in protocol structure and communication mechanisms between CAN and TSN, achieving seamless transitions between the two presents a technical challenge.

[0003] Currently, the technology for converting CAN messages into TSN frames is very mature. However, since data streams need to be shaped and scheduled after entering the TSN network, the integration of CAN and TSN networks requires converting CAN network message data into TSN frames while also knowing the periodicity of the CAN data stream to match the periodic gating list scheduling of the TSN switch. When there are many CAN devices and CAN messages have random bursts, if the CAN data stream sent by each CAN node is processed separately, various CAN data streams with different periods will appear on the TSN side. If these data streams are mixed with the data streams in TSN, the overall flow data will increase significantly, which will bring serious high-complexity calculation problems to traffic scheduling. Summary of the Invention

[0004] The present invention provides a method, apparatus, and device for converting a controller area network (Controller Area Network) and a time-sensitive network (TSN) protocol, which are used to convert randomly bursty Controller Area Network (CARN) messages into TSN frames with a uniform sampling period, and to treat multiple CARN messages as a periodic data stream to participate in the traffic scheduling planning of the TSN, thereby reducing the computational complexity of the traffic scheduling planning.

[0005] The present invention provides a method for converting a controller area network (CARN) to a time-sensitive network (TSN) protocol, which is applied to a CARN-TSN gateway. The method comprises:

[0006] monitoring controller area network messages transmitted on a controller area network bus, and recording the sending time and message contents of a plurality of the controller area network messages;

[0007] Determining an average response period based on a sending time of each of the controller area network messages;

[0008] For each of the controller area network messages, converting the message content of the controller area network message into a time-sensitive network frame;

[0009] The average response period is used as a sampling period of each time-sensitive network frame, and each time-sensitive network frame is sent on the time-sensitive network according to the sampling period.

[0010] According to a method for converting a controller area network (CARN) to a time-sensitive network (TSN) protocol provided by the present invention, determining an average response period based on the sending time of each CARN message includes:

[0011] Counting the time interval between the sending times of two adjacent controller area network messages;

[0012] An average value of each of the sending time intervals is calculated as the average response period.

[0013] According to a method for converting a controller area network (CAN) protocol to a time-sensitive network (TSN) protocol, the method further includes: if the average response period is greater than the sending period of any of the CAN messages, adjusting the sampling period to the minimum sending period of the sending periods of the CAN messages.

[0014] According to a method for converting a controller area network (CAN) to a time-sensitive network (TSN) protocol, the method further includes: if the average response period is greater than the worst response time of the CAN message, adjusting the sampling period to any positive integer time that is half or less than half of the worst response time of the CAN message; the worst response time is the maximum response time specified by business requirements.

[0015] According to a method for converting a controller area network (CARN) protocol to a time-sensitive network (TSN) protocol, the method further includes: if the sending period of the CARN message is not an integer multiple of the average response period, adjusting the sampling period to the greatest common divisor of the sending periods of the CARN messages.

[0016] According to a method for converting a controller area network (CARN) to a time-sensitive network (TSN) protocol provided by the present invention, recording the sending time and message content of a plurality of CARN messages includes:

[0017] Recording the sending time and message content of multiple controller area network messages within a custom time period; or,

[0018] Record the sending time and message content of the controller local area network message with the customized message quantity.

[0019] The present invention also provides a device for converting a controller area network (CARN) to a time-sensitive network (TSN) protocol, which is applied to a CARN-TSN gateway. The device comprises:

[0020] A monitoring module, used for monitoring the CAN messages transmitted on the CAN bus;

[0021] A recording module, configured to record the sending time and message contents of a plurality of the controller local area network messages;

[0022] a determination module, configured to determine an average response period based on a sending time of each of the controller area network messages;

[0023] a conversion module, configured to convert the message content of each controller area network message into a time-sensitive network frame;

[0024] The sending module is configured to use the average response period as a sampling period of each of the time-sensitive network frames, and send each of the time-sensitive network frames on a time-sensitive network according to the sampling period.

[0025] The present invention further provides a controller area network-time-sensitive network gateway, comprising: a plurality of controller area network interfaces, a plurality of controller area network message receiving buffers corresponding one-to-one to the plurality of controller area network interfaces, a controller area network message period learner, a controller area network-time-sensitive network encapsulator, a scheduler, a plurality of Ethernet ports, and a plurality of time-sensitive network queue sending buffers corresponding one-to-one to the plurality of Ethernet ports; wherein:

[0026] The controller area network message receiving buffer is used to receive and cache the sending time and message content of the controller area network message entering from the corresponding controller area network interface;

[0027] The CAN message period learner is connected to each of the CAN message receiving buffers and is used to determine an average response period based on the sending time of multiple CAN messages;

[0028] The CAN-Time-Sensitive Network (TSN) encapsulator is connected to each CAN message receiving buffer and is configured to parse the message content of each CAN message, obtain the corresponding Ethernet port, and encapsulate the message content of the CAN message into a TSN frame.

[0029] The scheduler is respectively connected to the controller area network message period learner, the controller area network-time-sensitive network encapsulator and each time-sensitive network queue sending buffer, and is used to schedule each time-sensitive network frame to the corresponding time-sensitive network queue sending buffer, and use the average response period as the sampling period of the time-sensitive network frame, and send the time-sensitive network frame in the time-sensitive network queue sending buffer from the corresponding Ethernet port according to the sampling period.

[0030] The present invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the controller area network and time-sensitive network protocol conversion method as described above is implemented.

[0031] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for converting a controller area network protocol to a time-sensitive network protocol as described above is implemented.

[0032] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for converting a controller area network protocol to a time-sensitive network protocol.

[0033] The controller area network and time-sensitive network protocol conversion method, device and equipment provided by the present invention first monitor the controller area network messages transmitted on the controller area network bus and record the sending time and message content of multiple controller area network messages; then, determine the average response period based on the sending time of each controller area network message; then, for each controller area network message, convert the message content of the controller area network message into a time-sensitive network frame; finally, use the average response period as the sampling period of each time-sensitive network frame, and send each time-sensitive network frame on the time-sensitive network according to the sampling period. Random burst controller area network messages can be converted into time-sensitive network frames with a uniform sampling period, and multiple controller area network messages are regarded as a periodic data stream to participate in the traffic scheduling planning of the time-sensitive network, which can reduce the computational complexity of the traffic scheduling planning. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0035] Figure 1 It is a flowchart of a method for converting a controller area network (CARN) to a time-sensitive network (TSN) protocol provided by an embodiment of the present invention.

[0036] Figure 2 This is a schematic diagram of a CAN network communicating through a CAN-TSN gateway provided by an embodiment of the present invention.

[0037] Figure 3 It is a structural diagram of a controller area network and time-sensitive network protocol conversion device provided by an embodiment of the present invention.

[0038] Figure 4 The figure is a schematic diagram of converting CAN messages into TSN frames in a CAN-TSN gateway provided by an embodiment of the present invention.

[0039] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0040] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0041] The following combination Figure 1-Figure 2 The present invention describes a method for converting a controller area network (CARN) protocol to a time-sensitive network (TSN) protocol.

[0042] Please refer to Figure 1 , Figure 1 Schematic diagram of the process of converting the controller area network and time-sensitive network protocol provided by the embodiment of the present invention. The method is applied to the CAN-TSN gateway, such as Figure 1 As shown, the method includes steps 101 to 104.

[0043] Step 101: monitor CAN messages transmitted on a CAN bus, and record the sending time and message contents of multiple CAN messages.

[0044] Specifically, if Figure 2 As shown in the figure, in an industrial automation system, multiple CAN nodes (such as various sensors and actuators) communicate via the CAN bus. The CAN-TSN gateway monitors CAN messages transmitted on the CAN bus and records the sending time and message content of each CAN message.

[0045] Optionally, recording the sending time and message content of multiple CAN messages includes: recording the sending time and message content of multiple CAN messages within a custom duration; or recording the sending time and message content of a custom number of CAN messages.

[0046] For example, assuming the custom duration is 1 second, the sending time and message content of multiple CAN messages within 1 second are recorded. Alternatively, assuming the number of custom messages is 10,000, the sending time and message content of 10,000 CAN messages are recorded.

[0047] Step 102: Determine an average response period based on the sending time of each controller LAN message.

[0048] Specifically, the CAN-TSN gateway calculates the average response period based on the recorded sending time of each CAN message.

[0049] Optionally, step 102 includes: counting the time intervals between the sending times of two adjacent controller area network messages; and calculating the average value of the time intervals as the average response period.

[0050] Step 103: For each CAN message, convert the message content of the CAN message into a time-sensitive network frame.

[0051] Specifically, to improve the real-time and deterministic performance of the system, the CAN-TSN gateway maps the data fields of the message content of each recorded CAN message to the corresponding fields of the TSN frame and maintains the timing relationship of the messages, thereby converting the message content of each CAN message into a TSN frame.

[0052] Step 104: Use the average response period as a sampling period for each time-sensitive network frame, and send each time-sensitive network frame on the time-sensitive network according to the sampling period.

[0053] Specifically, if Figure 2 As shown in the figure, the CAN-TSN gateway uses the average response period as the sampling period for each TSN frame. The sampling period determines the frequency or time interval for sending TSN messages. Each TSN frame is sent on the TSN network according to a unified sampling period. In this way, all CAN messages connected to the CAN-TSN gateway are transmitted with the same sampling period, thus achieving seamless conversion between CAN and TSN protocols.

[0054] The embodiment of the present invention provides a method for converting a controller area network (CAN) to a time-sensitive network (TSN) protocol. First, the method monitors CAN messages transmitted on a CAN bus and records the sending time and message content of multiple CAN messages. Then, the method determines an average response period based on the sending time of each CAN message. Then, for each CAN message, the method converts the message content of the CAN message into a TSN frame. Finally, the method uses the average response period as a sampling period for each TSN frame, and sends each TSN frame on the TSN according to the sampling period. This method converts randomly bursty CAN messages into TSN frames with a uniform sampling period, and treats multiple CAN messages as a periodic data stream to participate in the traffic scheduling planning of the TSN, thereby reducing the computational complexity of the traffic scheduling planning.

[0055] In one embodiment, the method further includes: if the average response period is greater than the sending period of any CAN message, adjusting the sampling period to the minimum sending period of the CAN messages.

[0056] Specifically, if the calculated average response period is greater than the sending period of any CAN message, it means that the calculated average response period cannot carry the sending period of the CAN message. The sampling period can be adjusted to the minimum sending period among the sending periods of each CAN message, and the CAN message can be saturated sampled.

[0057] In one embodiment, the method further includes: if the average response period is greater than the worst response time of the CAN message, adjusting the sampling period to any positive integer less than or equal to half of the worst response time of the CAN message, where the worst response time is the maximum response time specified by the service requirements.

[0058] For example, the worst-case response time is the maximum response time specified by the business requirements. If the calculated average response period is 16ms and the worst-case response time of a CAN message is 10ms, then the calculated average response period is greater than the worst-case response time of the CAN message, meaning that the calculated average response period cannot support the CAN message transmission period. The sampling period can be adjusted to 5ms or any positive integer less than 5ms to perform saturation sampling on the CAN message.

[0059] In one embodiment, the method further includes: if the sending period of the CAN messages is not an integer multiple of the average response period, adjusting the sampling period to the greatest common divisor of the sending periods of the CAN messages.

[0060] For example, if the calculated average response period is 13ms, and the sending period of CAN messages is 5ms, 20ms, and 8ms, the sending period of CAN messages is not an integer multiple of the average response period. Then adjusting the sampling period to the greatest common divisor of the sending periods of each CAN message, 1ms, can meet the requirements of scenarios that strictly require that the sending period of CAN messages is an integer multiple of the sampling period.

[0061] The following describes a device for converting a CAN protocol to a time-sensitive network (TSN) provided by the present invention. The device for converting a CAN protocol to a time-sensitive network (TSN) described below and the method for converting a CAN protocol to a time-sensitive network (TSN) described above may refer to each other.

[0062] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of the controller area network and time sensitive network protocol conversion device provided by an embodiment of the present invention. The device is applied to the CAN-TSN gateway, such as Figure 3 As shown, the device may include:

[0063] A monitoring module 10 is used to monitor CAN messages transmitted on the CAN bus;

[0064] Recording module 20, used to record the sending time and message content of multiple controller local area network messages;

[0065] A determination module 30, configured to determine an average response period based on a sending time of each controller area network message;

[0066] The conversion module 40 is configured to convert the message content of each controller area network message into a time-sensitive network frame;

[0067] The sending module 50 is configured to use the average response period as a sampling period of each time-sensitive network frame, and send each time-sensitive network frame on the time-sensitive network according to the sampling period.

[0068] In one embodiment, the determination module 30 is specifically configured to:

[0069] Count the time interval between the sending times of the LAN messages of two adjacent controllers;

[0070] Calculate the average of the sending time intervals as the average response period.

[0071] In one embodiment, the apparatus further comprises:

[0072] The first adjustment module is configured to adjust the sampling period to a minimum sending period among the sending periods of the LAN messages if the average response period is greater than the sending period of any LAN message.

[0073] In one embodiment, the apparatus further comprises:

[0074] The second adjustment module is used to adjust the sampling period to any positive integer time that is half or less than half of the worst response time of the controller area network message if the average response period is greater than the worst response time of the controller area network message; the worst response time is the maximum response time specified by the business requirements.

[0075] In one embodiment, the apparatus further comprises:

[0076] The third adjustment module is configured to adjust the sampling period to the greatest common divisor of the sending periods of the LAN messages if the sending period of the LAN messages is not an integer multiple of the average response period.

[0077] In one embodiment, the recording module 20 is specifically configured to:

[0078] Record the sending time and content of multiple Controller Area Network (LAN) messages within a custom duration; or

[0079] Records the sending time and message content of the LAN messages of the controller with a custom number of messages.

[0080] Please refer to Figure 4 , Figure 4 FIG1 is a schematic diagram of converting CAN messages into TSN frames in a CAN-TSN gateway provided by an embodiment of the present invention. Figure 4 As shown, the CAN-TSN gateway includes: multiple CAN interfaces, multiple CAN message receiving buffers corresponding to the multiple CAN interfaces, a CAN message cycle learner, a CAN-TSN encapsulator, a scheduler, multiple Ethernet (ETH) ports, and multiple TSN queue sending buffers corresponding to the multiple ETH ports; wherein:

[0081] CAN message receiving buffer, used to receive and cache the sending time and message content of CAN messages entering from the corresponding CAN interface;

[0082] A CAN message period learner connected to each CAN message receiving buffer for determining an average response period based on the sending time of multiple CAN messages;

[0083] The CAN-TSN encapsulator is connected to each CAN message receiving buffer and is used to parse the message content of each CAN message, obtain the corresponding ETH port, and encapsulate the message content of the CAN message into a TSN frame;

[0084] The scheduler is connected to the CAN message cycle learner, the CAN-TSN encapsulator and each TSN queue sending buffer respectively. It is used to schedule the TSN frame to the corresponding TSN queue sending buffer for each TSN frame, and use the average response cycle as the sampling period of the TSN frame. According to the sampling period, the TSN frames in the TSN queue sending buffer are sent from the corresponding ETH port.

[0085] Optionally, the port exchange table is used to store a mapping relationship between the CAN interface and the ETH port.

[0086] In one embodiment, the CAN message cycle learner is specifically used to:

[0087] Count the time interval between the sending times of the LAN messages of two adjacent controllers;

[0088] Calculate the average of the sending time intervals as the average response period.

[0089] In one embodiment, the CAN message period learner is further configured to:

[0090] If the average response period is greater than the sending period of any CAN message, the sampling period is adjusted to the minimum sending period of the sending periods of the CAN messages.

[0091] In one embodiment, the CAN message period learner is further configured to:

[0092] If the average response period is greater than the worst response time of the CAN message, the sampling period is adjusted to any positive integer less than or equal to half of the worst response time of the CAN message; the worst response time is the maximum response time specified by the business requirements.

[0093] In one embodiment, the CAN message period learner is further configured to:

[0094] If the sending period of the CAN message and the average response period are not integer multiples, the sampling period is adjusted to the least common multiple of the sending periods of the CAN messages.

[0095] In one embodiment, the CAN message receiving buffer is specifically used to:

[0096] Record the sending time and content of multiple Controller Area Network (LAN) messages within a custom duration; or

[0097] Records the sending time and message content of the LAN messages of the controller with a custom number of messages.

[0098] Figure 5 An example of a physical structure diagram of an electronic device is shown below. Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communications bus 540. The processor 510, the communications interface 520, and the memory 530 communicate with each other via the communications bus 540. The processor 510 may invoke logic instructions in the memory 530 to execute a method for converting a CAN protocol to a TSN protocol. The method includes: monitoring CAN messages transmitted on the CAN bus and recording the sending time and message content of multiple CAN messages; determining an average response period based on the sending time of each CAN message; converting the message content of each CAN message into a TSN frame; using the average response period as a sampling period for each TSN frame, and sending each TSN frame on the TSN according to the sampling period.

[0099] Furthermore, the logic instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0100] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the controller local area network and time-sensitive network protocol conversion method provided by the above-mentioned method embodiments. The method includes: monitoring the controller local area network messages transmitted on the controller local area network bus, and recording the sending time and message content of multiple controller local area network messages; determining the average response period based on the sending time of each controller local area network message; for each controller local area network message, converting the message content of the controller local area network message into a time-sensitive network frame; using the average response period as the sampling period of each time-sensitive network frame, and sending each time-sensitive network frame on the time-sensitive network according to the sampling period.

[0101] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the controller local area network and time-sensitive network protocol conversion method provided by the above-mentioned method embodiments. The method includes: monitoring the controller local area network messages transmitted on the controller local area network bus, and recording the sending time and message content of multiple controller local area network messages; determining the average response period based on the sending time of each controller local area network message; for each controller local area network message, converting the message content of the controller local area network message into a time-sensitive network frame; using the average response period as the sampling period of each time-sensitive network frame, and sending each time-sensitive network frame on the time-sensitive network according to the sampling period.

[0102] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0103] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for converting a controller area network (CARN) to a time-sensitive network (TSN) protocol, characterized in that: Applied to a controller area network-time sensitive network gateway, the method includes: monitoring controller area network messages transmitted on a controller area network bus, and recording the sending time and message contents of a plurality of the controller area network messages; Determining an average response period based on a sending time of each of the controller area network messages; For each of the controller area network messages, converting the message content of the controller area network message into a time-sensitive network frame; The average response period is used as a sampling period of each time-sensitive network frame, and each time-sensitive network frame is sent on the time-sensitive network according to the sampling period.

2. The method for converting between a controller area network and a time-sensitive network protocol according to claim 1, wherein: The determining the average response period based on the sending time of each of the controller area network messages includes: Counting the time interval between the sending times of two adjacent controller area network messages; An average value of each of the sending time intervals is calculated as the average response period.

3. The method for converting a controller area network to a time-sensitive network protocol according to claim 1 or 2, wherein: Also includes: If the average response period is greater than the sending period of any of the CAN messages, the sampling period is adjusted to a minimum sending period among the sending periods of the CAN messages.

4. The method for converting a controller area network to a time-sensitive network protocol according to claim 1 or 2, wherein: Also includes: If the average response period is greater than the worst response time of the CAN message, the sampling period is adjusted to any positive integer time that is half or less than half of the worst response time of the CAN message; the worst response time is the maximum response time specified by the business requirements.

5. The method for converting a Controller Area Network (CARN) to a Time Sensitive Network (TSN) protocol according to claim 1 or 2, wherein: Also includes: If the sending period of the CAN message is not an integer multiple of the average response period, the sampling period is adjusted to the greatest common divisor of the sending periods of the CAN messages.

6. The method for converting between a controller area network and a time-sensitive network protocol according to claim 1, wherein: The recording of the sending time and message content of the plurality of controller area network messages includes: Recording the sending time and message content of multiple controller area network messages within a custom time period; or, Record the sending time and message content of the controller local area network message with the customized message quantity.

7. A controller area network and time-sensitive network protocol conversion device, characterized in that: Applied to a controller area network-time sensitive network gateway, the device includes: A monitoring module, used for monitoring the CAN messages transmitted on the CAN bus; A recording module, configured to record the sending time and message contents of a plurality of the controller local area network messages; a determination module, configured to determine an average response period based on a sending time of each of the controller area network messages; a conversion module, configured to convert the message content of each controller area network message into a time-sensitive network frame; The sending module is configured to use the average response period as a sampling period of each of the time-sensitive network frames, and send each of the time-sensitive network frames on a time-sensitive network according to the sampling period.

8. A controller area network-time sensitive network gateway, characterized in that: include: A plurality of controller area network interfaces, a plurality of controller area network message receiving buffers corresponding one-to-one to the plurality of controller area network interfaces, a controller area network message period learner, a controller area network-time-sensitive network encapsulator, a scheduler, a plurality of Ethernet ports, and a plurality of time-sensitive network queue sending buffers corresponding one-to-one to the plurality of Ethernet ports; wherein: The controller area network message receiving buffer is used to receive and cache the sending time and message content of the controller area network message entering from the corresponding controller area network interface; The CAN message period learner is connected to each of the CAN message receiving buffers and is used to determine an average response period based on the sending time of multiple CAN messages; The CAN-Time-Sensitive Network (TSN) encapsulator is connected to each CAN message receiving buffer and is configured to parse the message content of each CAN message, obtain the corresponding Ethernet port, and encapsulate the message content of the CAN message into a TSN frame. The scheduler is respectively connected to the controller area network message period learner, the controller area network-time-sensitive network encapsulator and each time-sensitive network queue sending buffer, and is used to schedule each time-sensitive network frame to the corresponding time-sensitive network queue sending buffer, and use the average response period as the sampling period of the time-sensitive network frame, and send the time-sensitive network frame in the time-sensitive network queue sending buffer from the corresponding Ethernet port according to the sampling period.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for converting a controller area network to a time-sensitive network protocol according to any one of claims 1 to 6 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for converting a controller area network to a time-sensitive network protocol according to any one of claims 1 to 6 is implemented.

11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for converting a controller area network to a time-sensitive network protocol according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data exchange device for merging CAN bus into time sensitive network and network

    CN111464409A

  • Methods and apparatus for adjusting wireless communication structure

    IN202047027547A