Method for real-time communication of industrial system, computing device and storage medium
By using CAN transceivers and UART hardware resources in industrial control systems, real-time communication with one master and multiple slaves is achieved, which solves the problems of high cost and insufficient real-time performance of traditional protocols, and improves data transmission speed and system real-time performance.
Patent Information
- Application Number
- CN202510006768.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-04-15
AI Technical Summary
Traditional real-time communication protocols for industrial control rely on Ethernet, resulting in high cost and complex systems and difficult to meet high real-time requirements.
The CAN transceiver is used to combine UART hardware resources to realize single-cycle real-time communication with one master and multiple slaves. The control packets are generated and broadcasted through the master device to ensure that the slave device responds to data in sequence and ensure the real-time nature of data interaction.
It reduces hardware costs, increases the data transmission speed between various devices in the industrial system network, supports CAN-FD communication rates up to 5Mbps, and meets the high real-time requirements of industrial control systems.
Smart Images

Figure CN119835101A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention generally relate to the field of industrial communication, and more particularly to a method, a computing device, and a storage medium for real-time communication of an industrial system. Background Art
[0002] Traditional real-time communication protocols for industrial control include EtherCAT (Ethernet for Control Automation Technology), RTEX (Real Time Express) and PowerLink. Most of these protocols are implemented through Ethernet interfaces and can provide higher communication rates and lower latency, making them very suitable for real-time control applications in the field of industrial automation.
[0003] However, in some specific applications, especially in resource-constrained embedded systems, the use of Ethernet interfaces may bring additional costs and system complexity. In some application scenarios, cost and system complexity become important factors in choosing communication technology. Therefore, communication through UART (Universal Asynchronous Receiver / Transmitter) or CAN (Controller Area Network) has also been used. Despite this, the above protocols are usually difficult to meet the real-time communication requirements of industrial control systems, and they cannot be used in applications that require fast response and high bandwidth.
[0004] In summary, the traditional real-time communication methods for industrial control have the following shortcomings: they rely on Ethernet, which is costly and complex, and cannot meet the needs of applications with high real-time requirements. Summary of the invention
[0005] In view of the above problems, the present invention provides a method, a computing device and a storage medium for real-time communication in an industrial system, which can effectively reduce the cost and system complexity while supporting high-performance real-time communication requirements.
[0006] According to a first aspect of the present invention, a method for real-time communication of an industrial system is provided, wherein the industrial system comprises a master device and a plurality of slave devices, each device being configured to access an industrial system network via a CAN transceiver, and a control unit of each device being configured to communicate with the CAN transceiver based on a universal asynchronous receiver-transmitter. The method comprises: at the master device, via the control unit of the master device, based on a device control requirement of the industrial system and a predetermined message format, generating a control message, wherein the control message comprises data about at least one of the plurality of slave devices arranged in a predetermined message receiving and transmitting sequence of the plurality of slave devices; sending the generated control message to the CAN transceiver of the master device via the universal asynchronous receiver-transmitter of the master device; and broadcasting the generated control message to the industrial system network via the CAN transceiver of the master device.
[0007] According to a second aspect of the present invention, a computing device is provided, comprising: at least one processing unit; at least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the device to perform the steps of the method according to the first aspect.
[0008] According to a third aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a machine, the method according to the first aspect is implemented.
[0009] According to a fourth aspect of the present invention, there is further provided a computer program product, comprising a computer program, wherein when the computer program is executed by a machine, the method of the first aspect of the present invention is performed.
[0010] In some embodiments, the method for real-time communication of an industrial system also includes: in a current communication cycle, after broadcasting a control message, receiving a response message from a slave device from the industrial system network; and determining whether there is a faulty slave device among the multiple slave devices based on the number and time of the received response messages and a predetermined message sending and receiving order.
[0011] In some embodiments, determining whether there is a faulty slave device among multiple slave devices includes: in response to determining that the number of times a response message from a target slave device is not correctly received reaches a first threshold, determining that a communication fault exists in the target slave device; determining whether other types of faults exist in the slave device based on the content of the received response message; and in response to determining that a communication fault and / or other faults exist in the slave device, determining whether it is necessary to send a control message for indicating suspension of operation and / or restriction of operation to other non-faulty slave devices among the multiple slave devices based on the device control requirements of the industrial system and / or the type of device controlled by the slave device.
[0012] In some embodiments, the predetermined message format of the master device includes: a frame header, data length, a master station code, the number of slave devices, multiple slave device data bits, and a data check bit; wherein the multiple slave device data bits include each slave device data bit arranged in a predetermined message sending and receiving order of multiple slave devices.
[0013] In some embodiments, before the master device communicates with the slave device, it also includes: determining a predetermined message format based at least on the control requirements from the host computer and the device information of each slave device; and determining the communication data protocol used when communicating with each of the multiple slave devices, so that multiple slave device data bits can carry slave device data generated based on different communication data protocols.
[0014] In some embodiments, a method for real-time communication of an industrial system includes: at a slave device, receiving a control message from a master device via a CAN transceiver of the slave device, the control message including data about at least one of a plurality of slave devices arranged in a predetermined message transmission and reception order of the plurality of slave devices; determining, via a control unit of the current slave device, based on the received control message, data about the current slave device in the control message so as to generate a response message and determine a message sending time of the current slave device; and in response to determining the message sending time arriving at the current slave device, broadcasting the generated response message to the industrial system network via the CAN transceiver of the current slave device.
[0015] In some embodiments, determining the message sending time of the current slave device includes: parsing the number of slave devices and the message sending and receiving order in the industrial system based on the received control message via the control unit of the current slave device; and determining, based on the parsing result of the control message, the time required for a slave device whose message sending and receiving order is before the current slave device to send a response message and the time required for the current slave device to send a response message.
[0016] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above and other features, advantages and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.
[0018] Figure 1 A schematic diagram of a system for implementing a method for real-time communication in an industrial system according to an embodiment of the present invention is shown.
[0019] Figure 2 A flow chart of a method for real-time communication in an industrial system according to an embodiment of the present invention is shown.
[0020] Figure 3 A flow chart of a method for determining whether a failed slave device exists according to an embodiment of the present invention is shown.
[0021] Figure 4 A flow chart of a method for real-time communication of an industrial system of slave devices according to an embodiment of the present invention is shown.
[0022] Figure 5 A schematic time slot diagram showing the sequence of sending response messages from a device according to an embodiment of the present invention is shown.
[0023] Figure 6 A block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0025] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0026] As described above, the traditional real-time communication method for industrial control has the following shortcomings: it relies on Ethernet, is costly and complex, and is difficult to meet the needs of applications with high real-time requirements.
[0027] In order to at least partially solve one or more of the above problems and other potential problems, an example embodiment of the present invention proposes a solution for real-time communication of industrial systems. In the solution of the present invention, the industrial system includes a master device and multiple slave devices, each device is configured to access the industrial system network through a CAN transceiver, and the control unit of each device is configured to communicate with the CAN transceiver based on a universal asynchronous receiver-transmitter transmission; the present invention uses the UART hardware resources of the master and slave devices in combination with the CAN transceiver to achieve low-cost, high-efficiency one-master-multiple-slave single-cycle real-time communication for industrial control systems.
[0028] In addition, the present invention also generates a control message at the master device via the control unit of the master device based on the device control requirements of the industrial system and the predetermined message format, wherein the control message includes data about at least one of the multiple slave devices arranged in the predetermined message receiving and sending order of the multiple slave devices; the generated control message is sent to the CAN transceiver of the master device via the universal asynchronous receiver-transmitter of the master device; and the generated control message is broadcast to the industrial system network via the CAN transceiver of the master device; thereby enabling the master device to send data to any slave device, and based on the predetermined receiving and sending order, each slave device can reply to the data requested by the master station in sequence, thereby ensuring the real-time nature of data interaction. In addition, the communication method also supports a CAN-FD (CAN with Flexible Data rate, i.e., a controller area network with flexible data rate, which is an upgraded version of the CAN bus) communication rate of up to 5Mbps, which significantly improves the data transmission speed between devices in the industrial system network.
[0029] Therefore, the present invention can effectively improve the data transmission speed between devices in the industrial system network on the basis of reducing hardware costs; and can realize real-time communication between devices in the industrial control system in a one-master-multiple-slave communication mode, which is particularly suitable for application scenarios that require real-time data exchange, such as automotive electronics and control systems, autonomous driving, CNC machine tools, robots, servo motors, robotic arms, energy management, etc.
[0030] Figure 1 FIG. 1 is a schematic diagram of an industrial system 100 for implementing a method for real-time communication of an industrial system according to an embodiment of the present invention. Figure 1 As shown in , the industrial system 100 includes a host computer 130, a master device 110, multiple slave devices (1501, ..., 150n) and an industrial system network 150. The master device 110 and the multiple slave devices (1501, ..., 150n) can send and receive data through the industrial system network 150, and the host computer 130 and the master device 110 can exchange information through a network (e.g., Ethernet, Internet, local area network, etc.).
[0031] Regarding the master device 110, it includes, for example, a control unit 1101 and a CAN transceiver 1102, and the control unit 1101 and the CAN transceiver 1102 are connected based on a universal asynchronous receiver-transmitter (UART) communication; the master device 110 is configured to broadcast data messages to other devices in the industrial system network 150 or receive data messages from slave devices through the CAN transceiver 1102; the master device 110 is also configured to receive device control requirements from the host computer 130; based on the device control requirements of the industrial system 100 and a predetermined message format, a control message is generated; the control message includes data about at least one slave device among the multiple slave devices (1501, ..., 150n) arranged in a predetermined message receiving and sending order of the multiple slave devices (1501, ..., 150n); the generated control message is broadcast to the industrial system network 150 via the CAN transceiver 1102 of the master device 110.
[0032] About UART (Universal Asynchronous Receiver / Transmitter), it is a protocol and hardware interface for asynchronous serial communication. UART is commonly used for data communication between microcontrollers, computers and other digital devices. UART controller does not require a clock signal to synchronize data transmission, but relies on signals such as start bit, data bit, check bit and stop bit to mark the beginning and end of data and perform error checking. UART communication uses two wires: one for sending data (usually marked as TX or TXD), and the other for receiving data (usually marked as RX or RXD), for example Figure 1 UART-Tx in the figure indicates the transmit data line, and UART-Rx indicates the receive data line.
[0033] Regarding multiple slave devices (1501, ..., 150n), each slave device includes, for example, a control unit and a CAN transceiver, and the control unit and the transceiver of the slave device are also connected based on a universal asynchronous receiver-transmitter (UART) communication connection; and each slave device is connected to at least one device to be controlled (not shown in the figure); each slave device is configured to receive a control message from the master device 110, and generate a response message based on the received control message and determine the message sending time of the current slave device; in response to determining the message sending time arriving at the current slave device, broadcast the generated response message to the industrial system network 150 via the CAN transceiver of the current slave device; parse the received control message so as to control the device to be controlled to which the current slave device is connected.
[0034] Regarding the devices to be controlled, they are, for example, engine control units (ECUs), sensors, actuators, CNC machine tools, robotic arms, motors, robots, switches, temperature control equipment, rotating equipment, lifting equipment, etc., controllable devices in industrial systems. The devices to be controlled can be used for data collection, data transmission, action execution and other operations.
[0035] Regarding the control unit in the master device and the slave device, for example, it may have one or more processing units, including special processing units such as MCU (Microcontroller Unit), GPU (Graphics Processing Unit), FPGA (Field Programmable Gate Array) and ASIC (Application-Specific Integrated Circuit) and general processing units such as CPU. In addition, one or more virtual machines may also be running on the master device 110 and each slave device.
[0036] Regarding the universal asynchronous receiver-transmitter UART, for example, when the master device and the slave device are single-chip microcomputers, microcontrollers or other similar devices, the UART integrated inside the master device and the slave device forms internal communication with the CAN transceiver. Regarding the CAN transceiver, for example, it can support CAN and CAN FD (CAN with Flexible Data rate, i.e., controller area network with flexible data rate, which is an upgraded version of the CAN bus). As a result, it is possible to build a communication link inside the device and between the master and slave devices in a low hardware cost manner to support high-speed real-time communication.
[0037] Regarding the number of slave devices, based on the length of the communication cycle and the control requirements of the industrial system, the above solution can support the access of a maximum of 32 to 256 slave devices, that is, it can support real-time communication between a maximum of 256 slave devices and the master device. Regarding the length of the communication cycle, the industrial system can adjust the length of the communication cycle (for example, 5 to 50 ms) based on the number of slave devices and the control requirements (the control requirements can determine the length range of the data requested by the master device to each slave device, and thus determine the time required for the slave device to reply to the response message).
[0038] Figure 2 2 is a flowchart of a method 200 for use according to an embodiment of the present invention. The method 200 may be performed as follows: Figure 1 The main device 110 shown in FIG. Figure 6The method 200 is executed at the electronic device 600. It should be understood that the method 200 may further include additional steps not shown and / or may omit the steps shown, and the scope of the present invention is not limited in this respect.
[0039] In step 210, a control message is generated via the control unit of the master device 110 based on the device control requirements of the industrial system and a predetermined message format, wherein the control message includes data about at least one of the multiple slave devices arranged in a predetermined message receiving and sending order of the multiple slave devices.
[0040] In some embodiments, the predetermined message format of the master device includes: a frame header, data length, a master station code, the number of slave devices, multiple slave device data bits, and a data check bit; wherein the multiple slave device data bits include each slave device data bit arranged in a predetermined message sending and receiving order of multiple slave devices.
[0041] For example, Table 1 shows a schematic diagram of a predetermined message format of a master device in an embodiment of the present invention:
[0042] Table 1
[0043] Frame Header Data length Master Device ID Number of slave devices Data from device 1 Data from device 2 … Data from device N CRC 55AA55AA XXXXXXXX 0 N Data1…… Data2…… …… DataN…… XXXX
[0044] As shown in Table 1, when the message receiving and sending order of multiple slave devices is received sequentially from slave device 1 to slave device N, the multiple slave device data bits shown in Table 1 include slave device 1 data, slave device 2 data, ..., slave device N data arranged in sequence, so that each slave device data bit arranged according to the predetermined message receiving and sending order of multiple slave devices can be sufficient.
[0045] It should be understood that when a slave device receives a control message generated in a message format such as that shown in Table 1, the order of message reception and transmission by multiple slave devices is also "data from device 1, data from device 2, ..., data from device N". For example, the order in which slave device 1 sends a response message is before that of slave device 2, and the order in which slave device N-1 sends a response message is before that of slave device N.
[0046] In some embodiments, before the master device communicates with the slave device, it also includes: determining a predetermined message format based at least on the control requirements from the host computer and the device information of each slave device; and determining the communication data protocol used when communicating with each of the multiple slave devices, so that multiple slave device data bits can carry slave device data generated based on different communication data protocols.
[0047] For example, slave device 1 uses A communication data protocol to communicate with the master device, and slave device 2 uses B communication data protocol to communicate with the device. Please continue to refer to Table 1. The slave device 1 data "Data1..." in the control message is generated based on the A communication data protocol, and the slave device 2 data "Data2..." in the control message is generated based on the B communication data protocol. Therefore, the above scheme enables the control message sent by the master device to carry data generated based on different communication data protocols, so as to more flexibly communicate with each slave device in real time based on the communication needs of each slave device and the entire industrial system.
[0048] For example, in an industrial robot control system, the main controller (master device) links each motor controller (slave device) through a CAN bus, and the main controller (master device) and the motor controllers (slave devices) use a universal serial port interface (UART) for data protocol communication; wherein, the main controller (master device) sends a control command message to each motor controller (slave device), and after each motor controller (slave device) receives its own control command, it replies data to the main controller (master device) in sequence according to the control command sequence in the control command message data, thereby meeting the industrial robot's requirements for real-time data communication.
[0049] In step 220 , the generated control message is sent to the CAN transceiver of the master device via the universal asynchronous receiver-transmitter of the master device 110 .
[0050] In step 230 , the generated control message is broadcast to the industrial system network via the CAN transceiver of the master device 110 .
[0051] In some embodiments, in the current communication cycle, the master device 110 receives a response message from a slave device in the industrial system network after broadcasting a control message.
[0052] In some embodiments, the master device 110 determines whether there is a failed slave device among the multiple slave devices based on the number and time of the received response messages and the predetermined message sending and receiving sequence.
[0053] The following will combine Figure 3 The method for determining whether there is a failed slave device is described in detail and will not be repeated here.
[0054] In the above scheme, the UART hardware resources of the master device can be combined with the CAN transceiver to achieve low-cost, high-efficiency, single-cycle real-time communication of one master and multiple slaves for industrial control systems; and the master device can generate control messages based on the control requirements from the host computer and the actual situation of the industrial system, based on the predetermined data format and the predetermined message receiving and sending sequence, and broadcast them to the industrial system network, so that the master device can send data to any slave device, and based on the predetermined receiving and sending sequence, each slave device can reply to the data requested by the master station in sequence, thereby ensuring the real-time nature of data interaction. In addition, relying on the hardware design of the above scheme, the above scheme supports a CAN-FD communication rate of 5Mbps, which significantly improves the data transmission speed between devices in the industrial system network.
[0055] Figure 3 FIG. 3 is a flow chart of a method 300 for determining whether there is a failed slave device according to an embodiment of the present invention. The method 300 may be performed as follows: Figure 1 The main device 110 shown in FIG. Figure 6 The method 300 is executed at the electronic device 600. It should be understood that the method 300 may further include additional steps not shown and / or may omit the steps shown, and the scope of the present invention is not limited in this respect.
[0056] In step 302, if the master device 110 determines that the number of times the response message of the target slave device is not correctly received reaches a first threshold, it is determined that a communication failure exists in the target slave device.
[0057] Regarding incorrect reception, for example, the response message from the slave device should be received but is not received; for example, the receiving sequence is wrong, such as the response message from slave device 1 should be received before the response message from slave device 2, but the actual situation is different; for example, the received response message data is wrong, such as failing to pass the verification, incomplete content, etc.
[0058] Regarding the first threshold, for example, a response message from the same slave device is not correctly received for n consecutive times, where n is greater than or equal to 1 and is a positive integer.
[0059] In step 304, the master device 110 determines whether the slave device has other fault types based on the content of the received response message.
[0060] Regarding other fault types, for example, the response message of the slave device contains active error reporting data, such as reflecting that a fault occurs in the device to be controlled controlled by the slave device; for example, the device to be controlled is out of control, damaged, malfunctions, and other faults that make it unable to work normally.
[0061] In step 306, if the master device 110 determines that a communication failure and / or other failures exist in the slave device, it determines whether it is necessary to send a control message indicating suspension of operation and / or restriction of operation to other slave devices among the multiple slave devices that have not failed, based on the device control requirements of the industrial system and / or the type of device controlled by the slave device.
[0062] Regarding determining whether a slave device has a communication fault and / or other faults, for example, determining whether any slave device has a communication fault, for example, determining whether any slave device has other faults.
[0063] Regarding determining whether it is necessary to send a control message for instructing to suspend and / or limit operation to other slave devices among multiple slave devices that have not failed; for example, slave devices 1 to 6 are slave devices that need to work together. Once any one of them fails, it is necessary to stop the operation of the six slave devices 1 to 6. If slave device 1 fails, it is necessary to send a control message for instructing to suspend operation to slave devices 2 to 5.
[0064] For example, slave devices 7-10 are independent of each other, such as sensors used for data acquisition. A failure in any one of them will not affect the normal operation of other slave devices. In this case, if, for example, slave device 7 fails, there is no need to send a control message to any of slave devices 8-10 to instruct to suspend operation and / or limit operation.
[0065] For another example, slave devices 11-20 are used to collaboratively control a robotic arm. At this time, a failure of slave device 11 affects the rotation function of the robotic arm, but does not affect the lifting and forward and backward movement functions of the robotic arm. At this time, a control message for instructing the restricted operation is sent to slave devices 12-20. It should be understood that there are many types of devices to be controlled in an industrial system, and the above examples are only for illustration, and can be adjusted according to actual conditions in specific use.
[0066] Therefore, based on the above solution, the master device has a fault detection function and can adjust the working status of each slave device in real time through control messages based on the faults occurring in the slave device and the control requirements of the industrial system.
[0067] Figure 4 4 is a flowchart of a method 400 for real-time communication of an industrial system from a device according to an embodiment of the present invention. The method 400 may be performed as follows: Figure 1 The slave device (any one of 1501 to 150n) shown in FIG. Figure 6 The method 400 is executed at the electronic device 600. It should be understood that the method 400 may further include additional steps not shown and / or may omit the steps shown, and the scope of the present invention is not limited in this respect.
[0068] In step 402, a control message from a master device is received via a CAN transceiver of the slave device, wherein the control message includes data about at least one of the multiple slave devices arranged in a predetermined message receiving and transmitting sequence of the multiple slave devices.
[0069] In step 404, the control unit of the current slave device determines data about the current slave device in the control message based on the received control message, so as to generate a response message and determine the message sending time of the current slave device.
[0070] In some embodiments, determining the message sending time of the current slave device includes: parsing the number of slave devices and the message sending and receiving order in the industrial system based on the received control message via the control unit of the current slave device; and determining, based on the parsing result of the control message, the time required for a slave device whose message sending and receiving order is before the current slave device to send a response message and the time required for the current slave device to send a response message.
[0071] Please refer to Figure 5 , Figure 5 A time slot diagram illustrating the sequence of sending response messages from a slave device according to an embodiment of the present invention is shown. For example, the message sending and receiving sequence is "slave device 1-slave device 2-...slave device N". Figure 5 As shown, slave device 2 sends a response message after slave device 1 sends a response message.
[0072] In step 406, if it is determined that the message sending time of the current slave device has arrived, the generated response message is broadcast to the industrial system network via the CAN transceiver of the current slave device.
[0073] Therefore, the above scheme can realize the master device sending data (control message) to any slave device, and each slave device can parse the message receiving and sending order of each slave device based on the control message received from the master device, and obtain the length range of the response message that each slave device needs to send, so as to determine the sending time required for each slave device, and thus determine the message sending time of the current slave device, thereby realizing that multiple slave devices reply to the data requested by the master station in sequence, ensuring the real-time nature of data interaction.
[0074] In addition, since each slave device can determine its own response message sending time, when the previous slave device fails to send the response message in time, it does not affect the subsequent slave devices to send the response message when the sending time arrives. In other words, even if some slave devices fail, it will not affect the normal operation of the entire system.
[0075] Figure 6 Schematic diagram of an example electronic device 600 that can be used to implement an embodiment of the present specification is shown. Figure 1 The master device 110 shown or the slave device (any one of 1501 to 150N) can be implemented by the electronic device 600. As shown, the electronic device 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the computer program instructions stored in the read-only memory (ROM) 602 or the computer program instructions loaded from the storage unit 608 to the random access memory (RAM) 603. In the random access memory 603, various programs and data required for the operation of the electronic device 600 can also be stored. The central processing unit 601, the read-only memory 602 and the random access memory 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0076] Multiple components in the electronic device 600 are connected to the input / output interface 605, including: an input unit 606, such as a keyboard, a mouse, a microphone, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0077] The various processes and processing described above, such as methods 200 to 400, may be performed by the central processing unit 601. For example, in some embodiments, methods 200 to 400 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the read-only memory 602 and / or the communication unit 609. When the computer program is loaded into the random access memory 603 and executed by the central processing unit 601, one or more actions of the methods 200 to 400 described above may be performed.
[0078] The present invention relates to methods, apparatuses, systems, electronic devices, computer-readable storage media and / or computer program products. The computer program products may include computer-readable program instructions for executing various aspects of the present invention.
[0079] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0080] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge computing devices. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.
[0081] The computer program instructions for performing the operation of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.
[0082] Various aspects of the present invention are described herein with reference to the flow chart and / or step diagram of the method, device (system) and computer program product according to an embodiment of the present invention. It should be understood that each side step of the flow chart and / or step diagram and the combination of the side steps of the flow chart and / or step diagram can be implemented by computer-readable program instructions.
[0083] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more steps in the flowchart and / or step diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more steps in the flowchart and / or step diagram.
[0084] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more steps in the flowchart and / or step diagram.
[0085] The flowchart and step diagram in the accompanying drawings show the possible architecture, functions and operations of the system, method and computer program product according to multiple embodiments of the present invention. In this regard, each square step in the flowchart or step diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the square steps can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive square steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square step in the step diagram and / or the flowchart, and the combination of the square steps in the step diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0086] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for real-time communication in an industrial system, characterized in that: The industrial system includes a master device and multiple slave devices, each device is configured to access the industrial system network through a CAN transceiver, and the control unit of each device is configured to communicate with the CAN transceiver based on a universal asynchronous receiver-transmitter. The method includes: At the master device, a control message is generated via a control unit of the master device based on a device control requirement of the industrial system and a predetermined message format, wherein the control message includes data about at least one of the multiple slave devices arranged in a predetermined message sending and receiving order of the multiple slave devices; sending the generated control message to the CAN transceiver of the master device via the universal asynchronous receiver-transmitter of the master device; and The generated control message is broadcast to the industrial system network via the CAN transceiver of the master device.
2. The method according to claim 1, characterized in that Also includes: In a current communication cycle, after broadcasting the control message, receiving a response message from a slave device from the industrial system network; as well as Based on the number and time of the received response messages and the predetermined message sending and receiving sequence, it is determined whether there is a faulty slave device among the multiple slave devices.
3. The method according to claim 2, characterized in that Determining whether there is a failed slave device among the plurality of slave devices comprises: In response to determining that the number of times that the response message of the target slave device is not correctly received reaches a first threshold, determining that the target slave device has a communication failure; Determine whether the slave device has other fault types based on the content of the received response message; and In response to determining that a communication failure and / or other failures exist in a slave device, based on the device control requirements of the industrial system and / or the type of device controlled by the slave device, it is determined whether it is necessary to send a control message for indicating suspension of operation and / or restriction of operation to other slave devices among the multiple slave devices that have not failed.
4. The method according to claim 1, characterized in that: The predetermined message format of the master device includes: Frame header, data length, master station code, number of slave devices, multiple slave device data bits, data check bit; The multiple slave device data bits include each slave device data bit arranged in a predetermined message sending and receiving sequence of the multiple slave devices.
5. The method according to claim 2, characterized in that: Before the master device communicates with the slave device, it also includes: Determining a predetermined message format based at least on a control requirement from a host computer and device information of each slave device; and A communication data protocol used when communicating with each of the plurality of slave devices is determined so that the plurality of slave device data bits can carry slave device data generated based on different communication data protocols.
6. A method for real-time communication in an industrial system, characterized in that: The industrial system includes a master device and multiple slave devices, each device is configured to access the industrial system network through a CAN transceiver, and the control unit of each device is configured to communicate with the CAN transceiver based on a universal asynchronous receiver-transmitter. The method includes: At the slave device, receiving a control message from the master device via a CAN transceiver of the slave device, the control message including data about at least one of the multiple slave devices arranged in a predetermined message receiving and transmitting order of the multiple slave devices; Determining, via the control unit of the current slave device, data about the current slave device in the control message based on the received control message, so as to generate a response message and determine a message sending time of the current slave device; and In response to determining the message transmission time arriving at the current slave device, the generated response message is broadcasted to the industrial system network via the CAN transceiver of the current slave device.
7. The method according to claim 6, characterized in that Determine the current message sending time of the slave device including: parsing, via a control unit of the current slave device, the number of slave devices in the industrial system and the order of sending and receiving messages based on the received control message; and Based on the parsing result of the control message, the time required for a slave device that precedes the current slave device in the message sending and receiving order to send a response message and the time required for the current slave device to send a response message are determined.
8. A computing device, characterized in that include: at least one processing unit; At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the device to perform the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a machine, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a machine, the method according to any one of claims 1 to 7 is performed.