Cangw-based intra-cluster CAN communication method and device

By demarcating the cluster in the container cluster and using virtual network connection pairs, the communication stability problem caused by the excessive number of CAN nodes is solved, and more stable CAN communication is achieved.

CN120200872APending Publication Date: 2025-06-24709TH RESEARCH INSTITUTE CHINA STATE SHIPBUILDING CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510529394.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

In the CAN communication system of container clusters, excessive number of CAN nodes leads to poor communication stability, complex CAN bus topology, and weak anti-interference with high baud rate.

Method used

Through a cangw-based method, the cluster is divided into multiple subclusters, each subcluster grouping a CAN bus separately, and communication within and between multiple subclusters is realized through virtual network connection pairs.

Benefits of technology

It reduces the complexity of the CAN network topology, reduces the number of nodes per CAN network, realizes long-distance cross-CAN bus communication, and improves the stability of cluster CAN communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120200872A_ABST
    Figure CN120200872A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of communication, and particularly discloses an intra-cluster CAN communication method and device based on cangw, and the method comprises the steps: dividing a target cluster into a plurality of sub-clusters based on the physical space distribution condition of the target cluster; setting controller area network (CAN) buses in one-to-one correspondence to the plurality of sub-clusters respectively, and setting a plurality of virtual network connection pairs in the plurality of sub-clusters respectively; and based on the CAN bus and the virtual network connection pair, realizing internal communication of the sub-clusters and communication among the plurality of sub-clusters. According to the method, the complexity of a CAN network topology structure can be reduced, long-distance cross-CAN bus communication is realized, and the cluster CAN communication stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of communication technologies, and more specifically, relates to a Controller Area Network (CAN) communication method and apparatus within a cluster based on a Controller Area Network Gateway (cangw). Background Art

[0002] For a CAN communication system in a container cluster, when the number of CAN nodes within the cluster is excessive, it will lead to a complex CAN bus topology and unstable communication. When the CAN bus is too long, the anti-interference ability at high baud rates is weak, resulting in poor communication stability. Summary of the Invention

[0003] Aiming at the deficiencies of the prior art, the purpose of this application is to provide a CAN communication method and apparatus within a cluster based on cangw, aiming to solve the problem of poor communication stability within the cluster caused by an excessive number of CAN nodes within the cluster.

[0004] To achieve the above objective, in a first aspect, this application provides a CAN communication method within a cluster based on cangw, including: Dividing the target cluster into multiple sub-clusters based on the physical space distribution of the target cluster; Setting a corresponding Controller Area Network (CAN) bus for each of the multiple sub-clusters respectively, and setting multiple virtual network connection pairs within each of the multiple sub-clusters; Based on the CAN bus and the virtual network connection pairs, realizing communication within the sub-clusters and communication between multiple sub-clusters.

[0005] This application divides the cluster into multiple sub-clusters according to the physical space distribution. Each sub-cluster forms a separate CAN bus, and forwards the CAN bus data of each sub-cluster through the network. While realizing CAN data sharing, the number of nodes in each CAN network is reduced. Combined with the virtual network connection pairs, the complexity of the CAN network topology is reduced, long-distance cross-CAN bus communication is realized, and the CAN communication stability within the cluster is improved.

[0006] According to the CAN communication method within a cluster based on cangw provided by this application, the setting of multiple virtual network connection pairs within each of the multiple sub-clusters includes: When creating containers in the multiple sub-clusters, creating a pair of virtual network connection pairs on the physical machine node, with one end set in the network command space of the container and the other end bound to the physical machine node.

[0007] This application creates virtual network connection pairs when creating containers, enabling the containers to transmit data to the CAN bus through the virtual network connection pairs, realizing internal communication within sub-clusters and communication between multiple sub-clusters, and improving the stability of cluster CAN communication.

[0008] According to a method for CAN communication within a cluster based on cangw provided by this application, based on the CAN bus and virtual network connection pairs, realizing internal communication within sub-clusters and communication between multiple sub-clusters, includes: Containers in the first sub-cluster transmit data to the first physical machine node through virtual network connection pairs; The first physical machine node equally forwards the data to the first CAN bus corresponding to the first sub-cluster through the controller area network gateway cangw, and sends the data to other containers in the first sub-cluster through the first CAN bus.

[0009] This application transmits container data to the CAN bus through virtual network connection pairs and cangw, and sends the data to other containers in the first sub-cluster through the first CAN bus, realizing internal communication within the sub-cluster.

[0010] According to a method for CAN communication within a cluster based on cangw provided by this application, based on the CAN bus and virtual network connection pairs, realizing internal communication within sub-clusters and communication between multiple sub-clusters, includes: Containers in the second sub-cluster transmit data to the second physical machine node through virtual network connection pairs; The second physical machine node equally forwards the data to the second CAN bus corresponding to the second sub-cluster through cangw, and communicates with the first bus repeater in the second sub-cluster through the second CAN bus; The first bus repeater forwards the data to the second bus repeater in the third sub-cluster through the network, and sends the data to the containers in the third sub-cluster through the third CAN bus corresponding to the third sub-cluster.

[0011] This application transmits container data to the CAN bus through virtual network connection pairs and cangw, and sends the data to the bus repeater in the first sub-cluster through the CAN bus, and then transmits the data to the bus repeaters of other sub-clusters through the network, realizing communication between multiple sub-clusters.

[0012] In a second aspect, this application provides a CAN communication device within a cluster based on cangw, including: A division module, used to divide the target cluster into multiple sub-clusters based on the physical space distribution of the target cluster; A setting module, used to respectively set a controller area network CAN bus and virtual network connection pairs for the multiple sub-clusters; A communication module, configured to implement intra-sub-cluster communication and communication between multiple sub-clusters based on the CAN bus and virtual network connection pairs.

[0013] In a third aspect, the present application provides an electronic device, including: at least one memory for storing programs; at least one processor for executing the programs stored in the memory, and when the programs stored in the memory are executed, the processor is configured to execute the CAN communication method within a cluster based on cangw described in the first aspect or any possible implementation manner of the first aspect.

[0014] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, and when the computer program runs on a processor, it causes the processor to execute the CAN communication method within a cluster based on cangw described in the first aspect or any possible implementation manner of the first aspect.

[0015] In a fifth aspect, the present application provides a computer program product, and when the computer program product runs on a processor, it causes the processor to execute the CAN communication method within a cluster based on cangw described in the first aspect or any possible implementation manner of the first aspect.

[0016] It can be understood that the beneficial effects of the above second to fifth aspects can refer to the relevant descriptions in the first aspect above, and will not be elaborated here.

[0017] Generally speaking, compared with the prior art by the above technical solutions conceived in the present application, the following beneficial effects are achieved: The present application divides a cluster into multiple sub-clusters according to the physical space distribution. Each sub-cluster forms a separate CAN bus, and forwards the CAN bus data of each sub-cluster through a network. While realizing CAN data sharing, the number of nodes in each CAN network is reduced. Combined with virtual network connection pairs, the complexity of the CAN network topology is reduced, long-distance cross-CAN bus communication is realized, and the stability of cluster CAN communication is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0019] Figure 1 is a schematic flowchart of the CAN communication method within a cluster based on cangw provided by an embodiment of the present application; Figure 2It is a schematic diagram of internal communication within a sub - cluster provided by an embodiment of the present application; Figure 3 It is a schematic diagram of communication between sub - clusters provided by an embodiment of the present application; Figure 4 It is a schematic structural diagram of a CAN communication device within a cluster based on Cangw provided by an embodiment of the present application; Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0020] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0021] The term "and / or" in this article is an association relationship describing associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The symbol " / " in this article represents an "or" relationship between associated objects. For example, A / B represents A or B.

[0022] In the embodiments of the present application, words such as "exemplary" or "for example" are used to give examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, using words such as "exemplary" or "for example" is intended to present related concepts in a specific manner.

[0023] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality of" refers to two or more. For example, a plurality of processing units refers to two or more processing units, and a plurality of elements refers to two or more elements, etc.

[0024] Next, in combination with Figures 1 - 3 The CAN communication method within a cluster based on Cangw provided in the embodiments of the present application will be introduced.

[0025] Figure 1 It is a schematic flowchart of the CAN communication method within a cluster based on Cangw provided by an embodiment of the present application. As Figure 1 shown, the method includes the following steps: Step 100, divide the target cluster into a plurality of sub - clusters based on the physical space distribution of the target cluster; First, obtain the CAN resources applied by the user. Specifically, before starting the Pod container, the container cloud platform reads the container tags and the applied CAN peripheral resources set in the configuration file.

[0026] Optionally, containers that are close to each other in distance can be grouped into the same sub-cluster.

[0027] Step 110: Set a one-to-one corresponding Controller Area Network (CAN) bus for each of the multiple sub-clusters, and set multiple virtual network connection pairs within each of the multiple sub-clusters. After dividing the cluster into multiple sub-clusters, each sub-cluster forms a separate CAN bus, enabling each sub-cluster to achieve data sharing within the sub-cluster through its corresponding CAN bus.

[0028] The virtual network connection pair is used to achieve data intercommunication between the container and the CAN physical machine node.

[0029] Step 120: Based on the CAN bus and the virtual network connection pair, implement internal communication within the sub-cluster and communication between multiple sub-clusters.

[0030] Optionally, node heterogeneity is supported within the cluster, and containers with CAN communication requirements are only scheduled to nodes with CAN interfaces.

[0031] A method for CAN communication within a cluster based on cangw provided by this application divides the cluster into multiple sub-clusters according to the physical space distribution. Each sub-cluster forms a separate CAN bus, forwards the CAN bus data of each sub-cluster through the network, realizes CAN data sharing, reduces the number of nodes in each CAN network at the same time, combines the virtual network connection pair, reduces the complexity of the CAN network topology, realizes long-distance cross-CAN bus communication, and improves the stability of CAN communication in the cluster.

[0032] In some embodiments, step 110 specifically includes: When creating containers in multiple sub-clusters, create a pair of virtual network connection pairs on the physical machine node, with one end set in the network command space of the container and the other end bound to the physical machine node.

[0033] The CAN device plugin selects eligible nodes to create virtual network connection pairs according to the number of CAN peripheral requirements applied by the user, connects one end to the network namespace of the newly created container for use by the application in the container, and binds the other end to the physical machine CAN device for equal-flow forwarding.

[0034] Optionally, the virtual connection pairs can be created and the equal-data forwarding can be set through the CAN device plugin of the container cloud platform to meet the requirement of multiple containers using a single CAN device simultaneously.

[0035] In some embodiments, step 120 specifically includes: Step 1201, the containers in the first sub-cluster perform data transmission with the first physical machine node through a virtual network connection pair. Step 1202, the first physical machine node equally forwards the data to the first CAN bus corresponding to the first sub-cluster through the controller area network gateway cangw, and sends the data to other containers in the first sub-cluster through the first CAN bus.

[0036] Cangw can connect the real CAN device with the virtual vxcan0 - vxcanN, and cooperate with the network connection pair (such as vxcan0 - can0_0) to realize the mapping from one physical interface to the virtual CAN devices in multiple pod containers.

[0037] Figure 2 It is a schematic diagram of the internal communication of the sub-cluster provided by the embodiments of the present application. As Figure 2 shown, Pod1 on node 1 exchanges data with its virtual network connection pair vxcan0 through can0_0, and then cangw equally forwards the data to the physical interface can0 to realize the communication between Pod1 and the devices on CAN bus 1; Pod3 on node 2 exchanges data with its virtual network connection pair vxcan2 through can1_0, and then cangw equally forwards the data to the physical interface can1 to realize the communication between Pod3 and the devices on CAN bus 2.

[0038] In some embodiments, step 120 specifically includes: The containers in the second sub-cluster perform data transmission with the second physical machine node through a virtual network connection pair. The second physical machine node equally forwards the data to the second CAN bus corresponding to the second sub-cluster through cangw, and communicates with the first bus repeater in the second sub-cluster through the second CAN bus. The first bus repeater forwards the data to the second bus repeater in the third sub-cluster through the network, and sends the data to the containers in the third sub-cluster through the third CAN bus corresponding to the third sub-cluster.

[0039] Figure 3 It is a schematic diagram of the communication between sub-clusters provided by the embodiments of the present application. As Figure 3As shown in the figure, Pod1 above Node 1 exchanges data with vxcan0 through its virtual network connection can0_0, and then cangw forwards the data equally to the physical interface can0, enabling Pod1 to communicate with devices on CAN bus 0. The CAN0 bus repeater 0 of Sub-cluster 1 acts as a software relay, running on the nodes of Sub-cluster 1 side. It forwards all the data received from the CAN0 bus to the repeater 1 of the CAN1 bus through the network, and at the same time sends the CAN1 bus data received from the repeater 1 to other devices on the CAN0 bus, realizing the data intercommunication between the two CAN buses of Sub-cluster 1 and Sub-cluster 2. Pod2 of Sub-cluster 2 exchanges data with vxcan1 through its virtual network connection can1_0, and then cangw forwards the data equally to the physical interface can1, enabling Pod2 to communicate with devices on CAN bus 1. The CAN1 bus repeater 1 of Sub-cluster 2 acts as a software relay, running on the nodes of Sub-cluster 2 side. It forwards all the data received from the CAN1 bus to the repeater 0 of the CAN0 bus through the network, and at the same time sends the CAN0 bus data received from the repeater 0 to other devices on the CAN1 bus, realizing the data intercommunication between the two CAN buses of Sub-cluster 1 and Sub-cluster 2.

[0040] Figure 4 is a schematic structural diagram of a CAN communication device within a cluster based on cangw provided by an embodiment of the present application. As Figure 4 shown, the system includes a partitioning module 410, a setting module 420, and a communication module 430, where: The partitioning module 410 is used to partition the target cluster into multiple sub-clusters based on the physical space distribution of the target cluster; The setting module 420 is used to respectively set a controller area network CAN bus and a virtual network connection pair for multiple sub-clusters; The communication module 430 is used to realize intra-sub-cluster communication and communication between multiple sub-clusters based on the CAN bus and the virtual network connection pair.

[0041] Based on the method in the above embodiment, Figure 5 illustrates a schematic structural diagram of an electronic device. As Figure 5 shown, an embodiment of the present application provides an electronic device, which may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communication interface 520, and the memory 530 complete mutual communication through the communication bus 540. The processor 510 can call the logical instructions in the memory 530 to execute the CAN communication method within the cluster based on cangw in the above embodiment.

[0042] In addition, when the logical instructions in the above-mentioned memory 530 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this 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, a server, or a network device, etc.) to execute all or part of the steps of the CAN communication method within the cluster based on cangw described in various embodiments of this application.

[0043] Based on the method in the above embodiments, an embodiment of this application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program runs on a processor, it causes the processor to execute the CAN communication method within the cluster based on cangw in the above embodiments.

[0044] Based on the method in the above embodiments, an embodiment of this application provides a computer program product. When the computer program product runs on a processor, it causes the processor to execute the CAN communication method within the cluster based on cangw in the above embodiments.

[0045] It can be understood that the processor in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor.

[0046] The method steps in the embodiments of the present application can be implemented in a hardware manner or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), flash memory, read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), register, hard disk, removable hard disk, CD-ROM, or any other form of storage medium well-known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0047] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server, data center, etc. that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0048] It can be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application.

[0049] Those skilled in the art can easily understand that the above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A CAN communication method within a cluster based on cangw, characterized in that: include: Based on the physical space distribution of the target cluster, the target cluster is divided into multiple subclusters; One-to-one corresponding controller area network (CAN) buses are respectively set for the plurality of sub-clusters, and a plurality of virtual network connection pairs are respectively set in the plurality of sub-clusters; Based on the CAN bus and the virtual network connection pair, internal communication within a sub-cluster and communication between multiple sub-clusters are achieved.

2. The intra-cluster CAN communication method based on cangw according to claim 1, characterized in that: The step of respectively setting a plurality of virtual network connection pairs in the plurality of sub-clusters includes: When creating containers in the multiple sub-clusters, a pair of virtual network connections is created on the physical machine node, one end of which is set in the network command space of the container and the other end is bound to the physical machine node.

3. The intra-cluster CAN communication method based on cangw according to claim 1 or 2, characterized in that: The method of realizing internal communication of a sub-cluster and mutual communication of multiple sub-clusters based on the CAN bus and the virtual network connection pair includes: The container in the first sub-cluster performs data transmission with the first physical machine node through a virtual network connection; The first physical machine node forwards the data in equal amounts to the first CAN bus corresponding to the first sub-cluster through the controller area network gateway cangw, and sends the data to other containers in the first sub-cluster through the first CAN bus.

4. The intra-cluster CAN communication method based on cangw according to claim 1 or 2, characterized in that: The method of realizing internal communication of a sub-cluster and mutual communication of multiple sub-clusters based on the CAN bus and the virtual network connection pair includes: The container in the second sub-cluster transmits data to the second physical machine node through a virtual network connection; The second physical machine node forwards the data in equal amounts to the second CAN bus corresponding to the second sub-cluster through cangw, and communicates with the first bus repeater in the second sub-cluster through the second CAN bus; The first bus repeater forwards the data to the second bus repeater in the third sub-cluster through the network, and sends the data to the container in the third sub-cluster through the third CAN bus corresponding to the third sub-cluster.

5. A CAN communication device within a cluster based on cangw, characterized in that: include: A partitioning module, used for partitioning the target cluster into a plurality of sub-clusters based on the physical space distribution of the target cluster; A setting module, used for respectively setting a controller area network CAN bus and a virtual network connection pair for the multiple sub-clusters; The communication module is used to realize internal communication of a sub-cluster and communication between multiple sub-clusters based on the CAN bus and the virtual network connection pair.

6. An electronic device, characterized in that: include: at least one memory for storing a computer program; At least one processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the intra-cluster CAN communication method based on cangw as described in any one of claims 1-4.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program runs on a processor, the processor executes the intra-cluster CAN communication method based on cangw as described in any one of claims 1 to 4.

8. A computer program product, characterized in that When the computer program product runs on a processor, the processor is enabled to execute the intra-cluster CAN communication method based on cangw as described in any one of claims 1 to 4.