Virtual can bus system, message transmission method, medium and electronic device

By using Ethernet to achieve cross-network communication through a virtual CAN bus system, the problems of high wiring costs and limited expansion of CAN bus systems are solved, enabling flexible expansion and improving the reliability and stability of the communication system.

CN122120060APending Publication Date: 2026-05-29BEIJING HUADIAN TIANREN ELECTRIC POWER CONTROL TECH +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HUADIAN TIANREN ELECTRIC POWER CONTROL TECH
Filing Date
2026-04-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing CAN bus systems are costly to wire and difficult to maintain in complex scenarios, and node expansion is limited.

Method used

The virtual CAN bus system utilizes Ethernet to achieve cross-network communication between the virtual CAN interface and the physical CAN interface. This includes a first subsystem configuring communication information, a second subsystem creating the virtual CAN interface and encapsulating Ethernet messages, and a third subsystem determining the target physical CAN interface for message transmission within the physical CAN interface.

Benefits of technology

It reduces physical cabling costs, supports flexible expansion, reduces signal interference and transmission loss, and improves the reliability and stability of communication systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122120060A_ABST
    Figure CN122120060A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a virtual CAN bus system, a message transmission method, a medium and an electronic device. The system comprises a first subsystem configured to configure communication information for communicating with a second device, a second subsystem configured to encapsulate the communication information into an Ethernet message and create a virtual CAN interface according to the communication information, and a third subsystem configured to determine a target physical CAN interface for communicating with the second device in a physical CAN interface according to the Ethernet message, and send a target message to the second device through the target physical CAN interface. Compared with the CAN bus system in the related art which realizes data transmission through physical wiring, the present scheme can realize cross-network communication between the virtual CAN bus and the physical CAN interface through Ethernet, thereby reducing the wiring cost and supporting flexible expansion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a virtual CAN bus system, a message transmission method, a medium, and an electronic device. Background Technology

[0002] CAN (Controller Area Network) bus system is a serial communication network widely used in industrial automation, automotive electronics, intelligent transportation, and other fields. It uses physical twisted-pair cables for connection and employs a bit-by-bit arbitration mechanism to achieve multi-master communication, effectively supporting the real-time data transmission needs of distributed control systems.

[0003] However, the CAN bus system in related technologies also has some limitations. For example, physical wiring is quite restrictive, and expanding nodes requires increasing cable length, which can lead to high wiring costs and difficult maintenance in complex scenarios. Summary of the Invention

[0004] The purpose of this disclosure is to provide a virtual CAN bus system, message transmission method, medium, and electronic device to solve the aforementioned technical problems.

[0005] To achieve the above objectives, a first aspect of this disclosure provides a virtual CAN bus system applied to a first device, comprising a first subsystem, a second subsystem, and a third subsystem, wherein: The first subsystem is used to configure communication information for communicating with the second device and to transmit the communication information to the second subsystem, wherein the second device is a device to interact with the first device; The second subsystem is configured to create a virtual CAN interface based on the communication information, obtain a target message to be sent to the second device through the virtual CAN interface, and transmit the target message to the third subsystem via Ethernet. It is also configured to encapsulate the communication information into an Ethernet message and transmit the Ethernet message to the third subsystem via Ethernet. The third subsystem includes a physical CAN interface, used to determine the target physical CAN interface for communication with the second device based on the Ethernet message, and to send the target message to the second device through the target physical CAN interface.

[0006] Optionally, the communication information includes multiple components, and each piece of communication information corresponds to one second device. The second subsystem is used for: Determine the quantity of the communication information, and create a corresponding number of virtual CAN interfaces based on the quantity of the communication information; For each virtual CAN interface, a target message to be sent to the corresponding second device is obtained, and the target message is transmitted to the third subsystem via Ethernet.

[0007] Optionally, the physical CAN interface is associated with first address information, the communication information including the communication baud rate and the address information of the physical CAN interface used for communicating with the second device, and the third subsystem is used for: The Ethernet message is parsed to obtain the second address information and communication baud rate used for communication with the second device; The physical CAN interface corresponding to the first address information that is the same as the second address information in the first address information is used as the target physical CAN interface for communicating with the second device; The target message is sent to the second device at the communication baud rate based on the target physical CAN interface.

[0008] Optionally, the first device includes a PLC system, the first subsystem and the second subsystem run on the PLC system in software form, the third subsystem is plugged into the PLC system through a physical interface, and the third subsystem includes multiple subsystems, each of which is associated with third address information. The communication information also includes fourth address information of the third subsystem for communicating with the second device. The second subsystem is further used for: The third address information associated with each of the third subsystems is obtained through the PLC backplane; The third subsystem corresponding to the third address information that is the same as the fourth address information among the plurality of third address information is used as the target third subsystem for communicating with the second device; The Ethernet message is transmitted to the target third subsystem via Ethernet.

[0009] Optionally, the third subsystem is further configured to acquire the communication status and / or error frame information between the first device and the second device, and send the communication status and / or error frame information to the second subsystem via Ethernet; The second subsystem is further configured to determine the CAN bus status based on the communication status and / or the error frame information, and transmit at least one of the communication status and the error frame information, as well as the CAN bus status, to the first subsystem; The first subsystem is further configured to adjust the communication parameters between the first device and the second device based on at least one of the communication status and the error frame information and the CAN bus status, and / or to troubleshoot the communication link between the first device and the second device based on the error frame information.

[0010] Optionally, the CAN bus status is used to indicate whether the CAN bus is busy or congested, and the communication parameters include at least one of communication mode, communication time, communication frequency, and communication baud rate. The first subsystem is further used for: When the CAN bus status indicates that the CAN bus is busy or congested, at least one of the communication method, communication time, and communication frequency between the first device and the second device is adjusted; and / or The error frame category is determined based on the error frame information, and the communication baud rate is adjusted and / or the communication link is investigated based on the error frame category.

[0011] Optionally, the first subsystem is further configured to: If the error frame category is a bit error category, at least one of the following in the communication link is checked: terminating resistance, line impedance, and electromagnetic interference. When the error frame category is a padding error category, the communication baud rate is adjusted; If the error frame category is a cyclic redundancy check error category, the electromagnetic interference in the communication link is investigated. In the case that the error frame category is a format error category, the communication baud rate is adjusted and / or the transceiver device in the communication link is troubleshooted; If the error frame category is a confirmed error category, check whether the first device and the second device are in a connected state.

[0012] A second aspect of this disclosure provides a message transmission method applied to a virtual CAN bus system according to any one of the first aspects, the message transmission method comprising: The first subsystem configures communication information for communication with the second device and transmits the communication information to the second subsystem. The second subsystem creates a virtual CAN interface based on the communication information, obtains the target message to be sent to the second device through the virtual CAN interface, and transmits the target message to the third subsystem via Ethernet. It is also used to encapsulate the communication information into an Ethernet message and transmit the Ethernet message to the third subsystem via Ethernet. The third subsystem determines the target physical CAN interface for communicating with the second device based on the Ethernet message in the physical CAN interface, and sends the target message to the second device through the target physical CAN interface.

[0013] A third aspect of this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in the second aspect.

[0014] A fourth aspect of this disclosure provides an electronic device, comprising: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method described in the second aspect.

[0015] The above technical solution allows for the configuration of communication information for communication with the device to be interacted with in the first subsystem. A virtual CAN interface can be created based on this communication information through the second subsystem. Furthermore, messages to be transmitted can be obtained through the virtual CAN interface and transmitted via Ethernet to the target physical CAN interface for communication with the device. This enables cross-network communication between the virtual CAN interface and the physical CAN interface via Ethernet. Compared to CAN bus systems in related technologies that use physical wiring for data transmission, this solution achieves cross-network communication between the virtual CAN bus and the physical CAN interface via Ethernet, thereby reducing physical wiring costs and supporting flexible expansion. Moreover, transmitting CAN data via Ethernet reduces signal interference and transmission loss caused by physical wiring, thus improving the reliability and stability of the entire communication system.

[0016] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0017] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings: Figure 1 This is a system block diagram illustrating a virtual CAN bus system according to an exemplary embodiment of the present disclosure; Figure 2 This is a system block diagram of another virtual CAN bus system illustrated according to an exemplary embodiment of the present disclosure; Figure 3 This is a flowchart illustrating a message transmission method according to an exemplary embodiment of the present disclosure; Figure 4 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0018] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0019] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0020] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0021] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0022] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0023] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0024] As mentioned in the background section, the CAN bus system in related technologies has some limitations. For example, physical wiring is quite restrictive, and expanding nodes requires increasing cable length, which can lead to high wiring costs and difficult maintenance in complex scenarios.

[0025] In view of this, the present disclosure provides a virtual CAN bus system, a message transmission method, a medium, and an electronic device to solve the above-mentioned technical problems.

[0026] The embodiments of this disclosure will be further explained below with reference to the accompanying drawings.

[0027] Figure 1This is a system block diagram illustrating a virtual CAN bus system according to an exemplary embodiment of the present disclosure, with reference to... Figure 1 This virtual CAN bus system is applied to the first device and can be implemented through the first device's PLC (Programmable Logic Controller) system. Furthermore, this virtual CAN bus system can include a first subsystem, a second subsystem, and a third subsystem. Wherein: The first subsystem is used to configure communication information for communicating with the second device and to transmit the communication information to the second subsystem. The second device is the device that needs to interact with the first device.

[0028] It should be understood that communication information refers to the information required for the first device to communicate with the second device. For example, it may include the communication baud rate and the address information of the physical CAN interface used to communicate with the second device.

[0029] It should also be understood that the first device and the second device can be any electronic device with communication function, and the first device and the second device can be the same type of device or different type of device. This disclosure does not impose any restrictions on this.

[0030] For example, such as Figure 2 As shown, the first subsystem (i.e. Figure 2 The application configuration IDE in the system may include a configuration module for configuring communication information, and a second subsystem (i.e. Figure 2 The virtual CAN bus in the PLC can include a bus management module. When the user triggers this configuration module, a configuration interface for configuring communication information is displayed. After the user configures the communication information in the configuration interface, the communication information is obtained. Then, through IO (Input / Output) mapping, the communication information can be transmitted to the bus management module in the second subsystem. The bidirectional IO mapping between the first and second subsystems is implemented through the PLC system's runtime, which is scheduled by the PLC's real-time operating system.

[0031] It is understandable that there can be one or more second devices. Accordingly, in order to quickly configure the communication information of multiple second devices, the configuration interface can display multiple configuration items, and each configuration item is used to configure the communication information of one second device.

[0032] The second subsystem is used to create a virtual CAN interface based on communication information, obtain the target message to be sent to the second device through the virtual CAN interface, and transmit the target message to the third subsystem via Ethernet. It is also used to encapsulate communication information into Ethernet packets and transmit the Ethernet packets to the third subsystem via Ethernet.

[0033] For example, such as Figure 2 As shown, the first subsystem may also include a CAN application layer protocol module (the CAN application layer protocol module is a key component of the CAN communication system, mainly responsible for implementing the application layer protocol, converting user application data into message frames on the CAN bus, and parsing message frames on the CAN bus into data that the application can understand), the second subsystem may also include a virtual CAN driver module and an Ethernet driver, and the third subsystem (i.e. Figure 2 The physical CAN system in the second subsystem can include a physical CAN management module and a physical CAN driver. Therefore, when the bus management module in the second subsystem receives communication information, it can encapsulate the communication information into Ethernet messages and transmit the Ethernet messages to the physical CAN management module via the Ethernet driver. Alternatively, it can create a virtual CAN interface based on the communication information. After the virtual CAN interface is created, it calls the virtual CAN driver module to drive the virtual CAN interface to obtain the target message (e.g., the address information of the second device, message length, and / or message type) from the CAN application layer protocol module. Then, the target message can be transmitted to the physical CAN driver via the Ethernet driver.

[0034] As mentioned earlier, there can be multiple second devices. Therefore, to enable simultaneous message transmission to multiple second devices, one possible approach is for the bus management module in the second subsystem to create a preset number of virtual CAN interfaces upon receiving communication information. This allows each second device to be assigned an independent virtual interface, thus enabling simultaneous message transmission to multiple second devices. This method not only improves communication efficiency but also enhances the system's flexibility and scalability, enabling the system to easily handle the access requirements of different numbers and types of second devices.

[0035] Since there can be only one second device, creating a preset number of virtual CAN interfaces each time could lead to resource waste. Therefore, to improve resource utilization and optimize system performance, the bus management module can dynamically create virtual CAN interfaces based on the number of second devices. In this way, whether there is one or multiple second devices, the system can reduce unnecessary resource waste while providing the corresponding number of CAN channels for data transmission and reception, thereby reducing latency and increasing throughput.

[0036] In other words, in possible modes, the communication information includes multiple components, and each piece of communication information corresponds to a second device. Accordingly, the second subsystem can be used for: Determine the number of communication messages and create a corresponding number of virtual CAN interfaces based on the number of communication messages; for each virtual CAN interface, obtain the target message to be sent to the corresponding second device and transmit the target message to the third subsystem via Ethernet.

[0037] For example, after receiving communication information, the bus management module can first detect the number of communication messages, and then dynamically create a corresponding number of virtual CAN interfaces using a "multi-threaded + asynchronous + data buffering" mode. It can then assign one virtual CAN interface to a second device. Thus, for each virtual CAN interface, it can retrieve the target message from the CAN application layer protocol module in the first subsystem and transmit the target message to the third subsystem via Ethernet. The third subsystem can then transmit the target message to the corresponding second device.

[0038] The third subsystem includes a physical CAN interface, which is used to determine the target physical CAN interface for communication with the second device based on the Ethernet message, and to send the target message to the second device through the target physical CAN interface.

[0039] The third subsystem may include one or more physical CAN interfaces. When the third subsystem includes multiple physical CAN interfaces, each physical CAN interface may be associated with address information to facilitate differentiation, and different physical CAN interfaces may be associated with different physical address information. Accordingly, to enable interaction with the second device, the communication information may at least include the address information of the physical CAN interface used for communication with the second device. The target physical CAN interface can then be determined based on the address information in the communication information, and the target message can be sent to the second device through the target physical CAN interface.

[0040] Furthermore, in order to enable the first and second devices to operate at the same speed and rhythm and avoid data errors caused by speed mismatch, the communication information may also include the communication baud rate. This allows the first and second devices to communicate at the agreed-upon communication baud rate, thereby ensuring reliable data transmission.

[0041] In other words, in possible configurations, the physical CAN interface is associated with first address information, and the communication information may include the communication baud rate and the address information of the physical CAN interface used for communication with the second device. Correspondingly, the third subsystem can be used for: The Ethernet message is parsed to obtain the second address information and communication baud rate for communicating with the second device; the physical CAN interface corresponding to the first address information that is the same as the second address information is used as the target physical CAN interface for communicating with the second device; the target message is sent to the second device according to the communication baud rate based on the target physical CAN interface.

[0042] For example, such as Figure 2 As shown, when the physical CAN management module receives an Ethernet message and parses it to obtain the second address information and communication baud rate, it can automatically obtain the first address information associated with each physical CAN interface in the third subsystem. It then compares the second address information with each first address information, obtaining the first address information that matches the second address information, and designates the physical CAN interface corresponding to this first address information as the target physical CAN interface. Next, it transmits the interface identifier and communication baud rate of the target physical CAN interface to the physical CAN driver. The physical CAN driver then transmits the received target message to the second device via the target physical CAN interface according to the communication baud rate.

[0043] Accordingly, when the second device transmits a message to the first device, the second device can first transmit the message to the physical CAN driver through the target physical CAN interface, and then the physical CAN driver transmits the message to the virtual CAN driver module through Ethernet. The virtual CAN driver module then transmits the message to the CAN application layer protocol module through IO mapping.

[0044] In one possible configuration, the first device includes a PLC system, a first subsystem and a second subsystem running on the PLC system in software form, and a third subsystem plugged into the PLC system via a physical interface. Multiple third subsystems are included, each associated with third address information. The communication information also includes fourth address information of the third subsystem used for communication with the second device. The second subsystem is further used for: The third address information associated with each third subsystem is obtained through the PLC backplane; the third subsystem corresponding to the third address information that is the same as the fourth address information among multiple third address information is used as the target third subsystem for communication with the second device; Ethernet packets are transmitted to the target third subsystem via Ethernet.

[0045] For example, such as Figure 2As shown, when the first device needs to communicate with the second device, it can first configure the communication baud rate, the fourth address information of the third subsystem used for communication with the second device, and the second address information of the physical CAN interface in the third subsystem used for communication with the second device through the configuration module. Then, the configured communication information is transmitted to the physical CAN management module of the second subsystem. After receiving the communication information, the physical CAN management module at least encapsulates the communication information into an Ethernet message and transmits the Ethernet message to the Ethernet driver. After receiving the Ethernet message, the Ethernet driver automatically obtains the third address information associated with each third subsystem through the PLC backplane, compares the fourth address information with each third address information, obtains the third address information that matches the fourth address information, and uses the third subsystem corresponding to this third address information as the target third subsystem for communication with the second device. The Ethernet message is then transmitted to the physical CAN management module of the target third subsystem via Ethernet. After receiving the Ethernet message, the physical CAN management module parses the Ethernet message to obtain the second address information and the communication baud rate. Then, the system can automatically obtain the first address information associated with each physical CAN interface in the target third subsystem, compare the second address information with each first address information, obtain the first address information that is the same as the second address information, and use the physical CAN interface corresponding to the first address information as the target physical CAN interface. Then, the interface identifier and communication baud rate of the target physical CAN interface are transmitted to the physical CAN driver, and the physical CAN driver transmits the received target message to the second device via the target physical CAN interface according to the communication baud rate.

[0046] In this way, the second subsystem can automatically obtain the address information of each third subsystem plugged into the PLC through the PLC backplane and compare it with the address information issued by the first subsystem, thereby achieving automatic address information matching. Compared with related technologies that achieve address information identification and matching through heartbeat packet interaction or group ID allocation, the method provided in this application embodiment requires no additional communication overhead and has higher identification efficiency.

[0047] In summary, the virtual CAN bus system described above allows for the configuration of communication information for communication with the device to be interacted with in the first subsystem. A virtual CAN interface can be created based on this communication information through the second subsystem. Furthermore, messages to be transmitted can be obtained through the virtual CAN interface and transmitted via Ethernet to the target physical CAN interface for communication with the device. This enables cross-network communication between the virtual CAN interface and the physical CAN interface via Ethernet. Compared to CAN bus systems in related technologies that rely on physical wiring for data transmission, this solution achieves cross-network communication between the virtual CAN bus and the physical CAN interface via Ethernet, thereby reducing wiring costs and supporting flexible expansion. Moreover, transmitting CAN data via Ethernet reduces signal interference and transmission loss caused by physical wiring, thus improving the reliability and stability of the entire communication system.

[0048] In a possible implementation, the third subsystem is further configured to acquire the communication status and / or error frame information between the first device and the second device, and send the communication status and / or error frame information to the second subsystem via Ethernet; the second subsystem is further configured to determine the CAN bus status based on the communication status and / or error frame information, and transmit at least one of the communication status and error frame information and the CAN bus status to the first subsystem; the first subsystem is further configured to adjust the communication parameters between the first device and the second device based on at least one of the communication status and error frame information and the CAN bus status, and / or to troubleshoot the communication link between the first device and the second device based on the error frame information.

[0049] For example, such as Figure 2As shown, the third subsystem may further include a status detection module, the second subsystem may further include a bus diagnostic module, and the first subsystem may further include a status output module. Therefore, during communication between the first and second devices, the status detection module can collect and record information such as communication status and / or error frames. Simultaneously, the status detection module can package the communication status and / or error frame information into Ethernet messages and transmit them to the bus diagnostic module via an Ethernet driver. Upon receiving the Ethernet message, the bus diagnostic module can parse it to obtain the communication status and / or error frame information, determine the CAN bus status (e.g., CAN bus busy or CAN bus congestion) based on the communication status and / or error frame information, and transmit at least one of the communication status and error frame information, along with the CAN bus status, to the status output module via I / O mapping. The status output module feeds back at least one of the communication status and error frame information, along with the CAN bus status, to the CAN application layer protocol module. The CAN application layer protocol module integrates the communication status and error frame information, along with the CAN bus status, to adjust the application layer communication strategy and / or troubleshoot the communication link.

[0050] In a possible implementation, the CAN bus status is used to indicate whether the CAN bus is busy or congested, and the communication parameters include at least one of communication mode, communication time, communication frequency, and communication baud rate. Accordingly, the first subsystem is also used for: When the CAN bus status indicates that the CAN bus is busy or congested, at least one of the communication method, communication time, and communication frequency between the first device and the second device is adjusted; and / or, the error frame category is determined based on the error frame information, and the communication baud rate is adjusted and / or the communication link is investigated based on the error frame category.

[0051] For example, when the CAN bus is busy or congested, the timed communication method between the first and second devices can be changed to an on-demand communication method. This ensures that communication only occurs when new data needs to be transmitted between the first and second devices, rather than sending data at fixed time intervals. This avoids sending unnecessary data when the bus is busy, improving bus utilization.

[0052] For example, when the CAN bus is busy or congested, the communication frequency between the first and second devices can be appropriately reduced. For instance, if the communication frequency is originally 10 times per second, it can be adjusted to 5 times per second or less, thereby reducing the occupation of bus resources and also reducing the probability of data conflicts.

[0053] For example, upon receiving an error frame, you can first determine whether it's a single-node (device connected to the CAN backplane) error or a multi-node error. If it's a single-node error, you can check the communication baud rate and / or whether the transceiver is faulty. If it's a multi-node error, you can check whether the terminating resistors of the entire communication link are matched, whether the CAN bus is open-circuited, and / or whether electromagnetic interference is severe. Simultaneously, error monitoring can also monitor the TEC (Transmit Error Counter) and REC (Receive Error Counter) values. If the TEC gradually increases, it indicates a data transmission failure, such as a link connection failure at a node or a baud rate mismatch. If the REC gradually increases, it may indicate a fault in the node's receiving circuitry.

[0054] In a possible implementation, the first subsystem is also used for: If the error frame type is a bit error, check at least one of the following in the communication link: terminating resistance, line impedance, and electromagnetic interference; if the error frame type is a padding error, adjust the communication baud rate; if the error frame type is a cyclic redundancy check error, check the electromagnetic interference in the communication link; if the error frame type is a format error, adjust the communication baud rate and / or troubleshoot the transceiver equipment in the communication link; if the error frame type is a confirmation error, check whether the first device and the second device are connected.

[0055] It should be understood that a node (either the first or second device) is simultaneously transmitting bits and listening to the CAN bus. A bit error occurs if the bit level transmitted by the node does not match the level actually observed on the CAN bus. The main causes of bit errors are related to mismatched terminating resistors (resistors connected to the end of the CAN bus), abnormal line impedance, and severe electromagnetic interference. Therefore, when the error frame type is bit error, at least one of the terminating resistor, line impedance, or electromagnetic interference in the communication link can be checked to overcome the problem.

[0056] It should also be understood that the CAN protocol uses bit stuffing technology. After every five consecutive bits of the same polarity, the transmitter must insert a reversed bit (stuff bit). If a node does not see a reversed bit where it expects to see a stuff bit, a stuff error occurs. The main cause of stuff errors is the inconsistency in the communication baud rate between nodes. Therefore, when the error frame category is stuff error, the communication baud rate can be adjusted to overcome this problem.

[0057] It should also be understood that a Cyclic Redundancy Check (CRC) error occurs when the CRC checksum calculated by the receiving node does not match the CRC sequence inherent in the message frame. This type of error is generally caused by severe electromagnetic interference. Therefore, when the error frame category is a CRC error, electromagnetic interference in the communication link can be investigated, and the problem can be overcome by reducing electromagnetic interference.

[0058] It should also be understood that a form error will occur when an illegal bit level appears in a fixed-format field (such as the CRC separator, ACK separator, EOF, etc.). Form errors are usually caused by hardware failure and / or baud rate mismatch. Therefore, when the error frame category is a form error, the problem can be overcome by adjusting the communication baud rate and / or troubleshooting the transceiver equipment in the communication link.

[0059] It should also be understood that if the sending node does not detect the dominant bit during the ACK period, it will trigger an ACK Error, indicating that no node has received this message. In this case, it usually means that the node has been disconnected from other nodes. Therefore, when the error frame type is an ACK Error, the connection status between the first and second devices can be checked to overcome this problem.

[0060] In this way, the status monitoring module can collect communication status and / or error frame information in real time and feed it back to the bus diagnostic module to obtain the CAN bus status. Then, it feeds back at least one of the communication status and error frame information, along with the CAN bus status, to the CAN application layer protocol. The CAN application layer protocol is then used to adjust the application layer communication strategy and / or troubleshoot the communication link. This forms a closed-loop feedback mechanism and optimizes the application layer communication strategy and / or communication link, solving the problem of the lack of adaptive capability in traditional CAN systems and improving the reliability of data transmission.

[0061] In one possible approach, when transmitting data between the second and third subsystems via Ethernet, data key verification can be introduced to reduce the frequency of data tampering and man-in-the-middle attacks, thereby improving data security and accuracy.

[0062] Based on the same concept, this disclosure also provides a message transmission method, applied to the virtual CAN bus system in any of the above embodiments, such as... Figure 3 As shown, the message transmission method may include: S301: Configure communication information for communication with the second device through the first subsystem, and transmit the communication information to the second subsystem; S302: The second subsystem creates a virtual CAN interface based on communication information, obtains the target message to be sent to the second device through the virtual CAN interface, and transmits the target message to the third subsystem via Ethernet. It is also used to encapsulate communication information into Ethernet packets and transmit the Ethernet packets to the third subsystem via Ethernet. S303: The third subsystem determines the target physical CAN interface for communication with the second device in the physical CAN interface based on the Ethernet message, and sends the target message to the second device through the target physical CAN interface.

[0063] The above technical solution allows for the configuration of communication information for communication with the device to be interacted with via the first subsystem, and the creation of a virtual CAN interface based on this communication information via the second subsystem. Furthermore, the virtual CAN interface can acquire messages to be transmitted and transmit them via Ethernet to the target physical CAN interface for communication with the device. This enables cross-network communication between the virtual CAN interface and the physical CAN interface via Ethernet. Compared to CAN bus systems in related technologies that use physical wiring for data transmission, this solution achieves cross-network communication between the virtual CAN bus and the physical CAN interface via Ethernet, thereby reducing physical wiring costs and supporting flexible expansion. Moreover, transmitting CAN data via Ethernet reduces signal interference and transmission loss caused by physical wiring, thus improving the reliability and stability of the entire communication system.

[0064] Based on the same concept, embodiments of this disclosure also provide a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the above-described message transmission method.

[0065] Based on the same concept, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described message transmission method.

[0066] Based on the same concept, embodiments of this disclosure also provide an electronic device, including: A memory on which computer programs are stored; A processor is configured to execute the computer program in the memory to implement the steps of the message transmission method described above.

[0067] Figure 4 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Figure 4 As shown, the electronic device 400 may include a processor 401 and a memory 402. The electronic device 400 may also include one or more of a multimedia component 403, an input / output (I / O) interface 404, and a communication component 405.

[0068] The processor 401 controls the overall operation of the electronic device 400 to complete all or part of the steps in the aforementioned message transmission method. The memory 402 stores various types of data to support the operation of the electronic device 400. This data may include, for example, instructions for any application or method operating on the electronic device 400, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 402 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The multimedia component 403 may include a screen and audio components. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 402 or transmitted via communication component 405. The audio component also includes at least one speaker for outputting audio signals. I / O interface 404 provides an interface between processor 401 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 405 is used for wired or wireless communication between the electronic device 400 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 405 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.

[0069] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the message transmission method described above.

[0070] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the message transmission method described above. For example, the computer-readable storage medium may be the memory 402 including program instructions, which may be executed by the processor 401 of the electronic device 400 to complete the message transmission method described above.

[0071] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0072] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0073] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A virtual CAN bus system, characterized in that, Applied to a first device, comprising a first subsystem, a second subsystem, and a third subsystem, wherein: The first subsystem is used to configure communication information for communicating with the second device and to transmit the communication information to the second subsystem, wherein the second device is a device to interact with the first device; The second subsystem is configured to create a virtual CAN interface based on the communication information, obtain a target message to be sent to the second device through the virtual CAN interface, and transmit the target message to the third subsystem via Ethernet. It is also configured to encapsulate the communication information into an Ethernet message and transmit the Ethernet message to the third subsystem via Ethernet. The third subsystem includes a physical CAN interface, used to determine a target physical CAN interface for communicating with the second device based on the Ethernet message, and to send the target message to the second device through the target physical CAN interface.

2. The virtual CAN bus system according to claim 1, characterized in that, The communication information includes multiple components, and each piece of communication information corresponds to one second device. The second subsystem is used for: Determine the quantity of the communication information, and create a corresponding number of virtual CAN interfaces based on the quantity of the communication information; For each virtual CAN interface, a target message to be sent to the corresponding second device is obtained, and the target message is transmitted to the third subsystem via Ethernet.

3. The virtual CAN bus system according to claim 1, characterized in that, The physical CAN interface is associated with first address information, and the communication information includes the communication baud rate and the address information of the physical CAN interface used for communication with the second device. The third subsystem is used for: The Ethernet message is parsed to obtain the second address information and communication baud rate used for communication with the second device; The physical CAN interface corresponding to the first address information that is the same as the second address information in the first address information is used as the target physical CAN interface for communicating with the second device; The target message is sent to the second device at the communication baud rate based on the target physical CAN interface.

4. The virtual CAN bus system according to claim 3, characterized in that, The first device includes a PLC system. The first subsystem and the second subsystem run on the PLC system in software form. The third subsystem is plugged into the PLC system via a physical interface, and there are multiple third subsystems. Each third subsystem is associated with third address information. The communication information also includes fourth address information of the third subsystem for communicating with the second device. The second subsystem is further used for: The third address information associated with each of the third subsystems is obtained through the PLC backplane; The third subsystem corresponding to the third address information that is the same as the fourth address information among the plurality of third address information is used as the target third subsystem for communicating with the second device; The Ethernet message is transmitted to the target third subsystem via Ethernet.

5. The virtual CAN bus system according to any one of claims 1-4, characterized in that, The third subsystem is also used to acquire the communication status and / or error frame information between the first device and the second device, and send the communication status and / or error frame information to the second subsystem via Ethernet; The second subsystem is further configured to determine the CAN bus status based on the communication status and / or the error frame information, and transmit at least one of the communication status and the error frame information, as well as the CAN bus status, to the first subsystem; The first subsystem is also configured to adjust the communication parameters between the first device and the second device according to at least one of the communication status and the error frame information and the CAN bus status, and / or to troubleshoot the communication link between the first device and the second device according to the error frame information.

6. The virtual CAN bus system according to claim 5, characterized in that, The CAN bus status is used to indicate whether the CAN bus is busy or congested. The communication parameters include at least one of communication mode, communication time, communication frequency, and communication baud rate. The first subsystem is also used for: When the CAN bus status indicates that the CAN bus is busy or congested, at least one of the communication method, the communication time, and the communication frequency between the first device and the second device is adjusted. and / or The error frame category is determined based on the error frame information, and the communication baud rate is adjusted and / or the communication link is investigated based on the error frame category.

7. The virtual CAN bus system according to claim 6, characterized in that, The first subsystem is also used for: If the error frame category is a bit error category, at least one of the following in the communication link is checked: terminating resistance, line impedance, and electromagnetic interference. When the error frame category is a padding error category, the communication baud rate is adjusted; If the error frame category is a cyclic redundancy check error category, the electromagnetic interference in the communication link is investigated. In the case that the error frame category is a format error category, the communication baud rate is adjusted and / or the transceiver device in the communication link is troubleshooted; If the error frame category is a confirmed error category, check whether the first device and the second device are in a connected state.

8. A message transmission method, characterized in that, Applied to the virtual CAN bus system as described in any one of claims 1-7, the message transmission method includes: The first subsystem configures communication information for communication with the second device and transmits the communication information to the second subsystem. The second subsystem creates a virtual CAN interface based on the communication information, obtains the target message to be sent to the second device through the virtual CAN interface, and transmits the target message to the third subsystem via Ethernet. It is also used to encapsulate the communication information into an Ethernet message and transmit the Ethernet message to the third subsystem via Ethernet. The third subsystem determines the target physical CAN interface for communicating with the second device based on the Ethernet message in the physical CAN interface, and sends the target message to the second device through the target physical CAN interface.

9. 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, it implements the steps of the method of claim 8.

10. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method of claim 8.