Programmable logic controller and communication method thereof

By building a central processor and network interface in the PLC and supporting the MQTT protocol, the wireless communication and cloud access capabilities of the PLC are realized, solving the problems of difficult and costly installation and maintenance of traditional PLCs, and the functions of remote maintenance and troubleshooting are realized.

CN119892873AActive Publication Date: 2025-04-25CHINA UNITED NETWORK COMM GRP CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510038102.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-04-25
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

Traditional PLCs do not have the ability to go directly to the cloud, and have high requirements for staff professionalism, so they are difficult and costly to install and maintain.

Method used

It provides a programmable logic controller with a built-in central processor and network interface, supports MQTT protocol, can encapsulate data into message queue telemetry transmission (MQTT) messages, and connect it to the communication module through a network interface to realize wireless communication and remote data transmission.

Benefits of technology

It realizes wireless connection and cloud access capabilities of PLC, reduces the difficulty and cost of installation and maintenance, reduces on-site operation requirements, and supports remote maintenance and troubleshooting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892873A_ABST
    Figure CN119892873A_ABST
Patent Text Reader

Abstract

The invention discloses a programmable logic controller and a communication method of the programmable logic controller, and relates to the technical field of industrial control. The programmable logic controller comprises a central processing unit and a network interface. Wherein the central processing unit is used for acquiring data from at least one external device. And running the user program and carrying out operation processing on data from at least one external device to obtain processed data and data to be transmitted by the network. And transmitting the processed data to at least one external device. And encapsulating the data to be transmitted by the network into a message queue telemetry transmission (MQTT) message, and sending the MQTT message to the network interface. Wherein the data to be transmitted by the network is obtained according to data from at least one external device. And the network interface is used for being connected with the communication module and sending the MQTT message to the communication module, so that the communication module remotely transmits the MQTT message through a network. And the data transmission module is used for being connected with each external device in the at least one external device and performing data transmission with each external device in the at least one external device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial control, and in particular to a programmable logic controller and a communication method of the programmable logic controller. Background Art

[0002] Programmable Logic Controller (PLC) is a digital electronic device specially used for industrial automation control. It plays a vital role in the field of industrial automation.

[0003] With the rise of Industry 4.0 and smart manufacturing, the communication and network functions of PLCs are becoming increasingly important. However, traditional PLCs do not have the ability to go directly to the cloud, and equipment operation requires employees to be on-site, which is time-consuming and error-prone. In addition, PLCs and the main control room rely on wired connections, and the installation and maintenance of wired wiring are cumbersome, requiring high professionalism from staff, and increasing the difficulty and cost of installation and maintenance. Summary of the invention

[0004] The technical problem to be solved by the present invention is that the traditional PLC does not have the ability to go directly to the cloud, has high requirements on the professionalism of the staff, and is difficult and costly to install and maintain.

[0005] In view of the above-mentioned deficiencies of the prior art, the following solutions are provided:

[0006] In a first aspect, the present invention provides a programmable logic controller, which includes a central processing unit and a network interface. The central processing unit is used to obtain data from at least one external device. The user program is run and the data from at least one external device is processed to obtain processed data and data to be transmitted over the network. The processed data is transmitted to at least one external device. And, the data to be transmitted over the network is encapsulated into a message queue telemetry transmission MQTT message, and the MQTT message is sent to the network interface. Among them, the data to be transmitted over the network is obtained based on the data from at least one external device. The network interface is used to connect to a fifth-generation mobile communication network communication module and send an MQTT message to the communication module so that the communication module remotely transmits the MQTT message through the network. And it is used to connect to each external device in at least one external device respectively, and to transmit data with each external device in at least one external device respectively.

[0007] Optionally, the programmable logic controller also includes a memory. The memory is connected to the central processing unit and is used to store system programs and system data. The memory also stores a transmission control protocol TCP / Internet protocol IP communication thread, and the TCP / IP communication thread is used to carry the MQTT protocol. The central processing unit is also used to run the TCP / IP communication thread, encapsulate the data to be transmitted over the network into an MQTT message, and send the MQTT message to the network interface.

[0008] Optionally, the network interface includes a wide area network interface and a local area network interface. The wide area network interface is used to connect to the communication module and send an MQTT message to the communication module so that the communication module transmits the MQTT message remotely through the network. The local area network interface is used to connect to each of the at least one external device and transmit data to each of the at least one external device.

[0009] Optionally, the local area network interface is used to perform data transmission with each external device in the at least one external device through the serial communication protocol Modbus-RTU protocol.

[0010] Optionally, the programmable logic controller further includes an input module. The input module is used to be connected to the central processor and each of the at least one external device, receive data from each of the at least one external device, temporarily store data from each of the at least one external device, and send data from each of the at least one external device to the central processor.

[0011] Optionally, the input module includes an input interface and an input image register. The input interface is used to connect to each of the at least one external device, receive data from each of the at least one external device, and send data from each of the at least one external device to the input image register. The input image register is used to receive data from the input interface and temporarily store data from the input interface so that the central processing unit reads the data from the input interface from the input image register.

[0012] Optionally, the programmable logic controller further comprises an output module, which is used to be connected to the central processing unit and each of the at least one external device, and to send processed data to each of the at least one external device.

[0013] Optionally, the output module includes an output image register and an output interface. The output image register is used to receive processed data from the central processing unit, temporarily store the processed data, and send the processed data temporarily stored by the output image register to the output interface. The output interface is used to be connected to each of the at least one external device, to receive the processed data from the output image register, and to send the processed data to each of the at least one external device.

[0014] Optionally, the programmable logic controller further comprises a power module, which is used to be connected to an external power source and to supply power to the central processing unit, the input module and the output module.

[0015] In a second aspect, an embodiment of the present invention provides a communication method for a programmable logic controller, which is applied to a programmable logic controller, and the programmable logic controller includes a central processing unit and a network interface. The method includes: the central processing unit obtains data from at least one external device. The central processing unit runs a user program and performs calculations on the data from at least one external device to obtain processed data and data to be transmitted over the network. The central processing unit transmits the processed data to at least one external device. The central processing unit encapsulates the data to be transmitted over the network into an MQTT message and sends the MQTT message to the network interface. And, the network interface sends an MQTT message to the communication module, so that the communication module remotely transmits the MQTT message through the network and transmits data with each external device in at least one external device respectively, and transmits data with each external device in at least one external device respectively. Among them, the data to be transmitted over the network is obtained based on the data from at least one external device.

[0016] The programmable logic controller and the communication method of the programmable logic controller provided by the present invention have a built-in TCP / IP communication thread in the memory of the PLC, and combined with the communication component, the PLC can be deployed wirelessly and have the ability to access the Internet, that is, it has the ability to go directly to the cloud, so that the company's employees can perform remote maintenance and troubleshooting, reduce the need for on-site operations, and can greatly reduce the difficulty and cost of installation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A structural diagram of a programmable logic controller in an embodiment of the present invention;

[0018] Figure 2 A structural diagram of another programmable logic controller in an embodiment of the present invention;

[0019] Figure 3 A structural diagram of another programmable logic controller in an embodiment of the present invention;

[0020] Figure 4It is a structural diagram of another programmable logic controller in an embodiment of the present invention;

[0021] Figure 5 It is a structural diagram of another programmable logic controller in an embodiment of the present invention;

[0022] Figure 6 It is a structural diagram of another programmable logic controller in an embodiment of the present invention;

[0023] Figure 7 It is a structural diagram of another programmable logic controller in an embodiment of the present invention;

[0024] Figure 8 A schematic diagram of a work flow of a programmable logic controller I / O module in an example of an embodiment of the present invention;

[0025] Fig. 9 A schematic diagram of a structure in which a programmable logic controller is connected to a communication module in an example of an embodiment of the present invention;

[0026] Fig.10 A schematic diagram of a workflow of connecting a programmable logic controller and a communication module in an example of an embodiment of the present invention;

[0027] Fig.11 The present invention is a flowchart of a communication method of a programmable logic controller in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0029] It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention rather than to limit the present invention.

[0030] It can be understood that, in the absence of conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other.

[0031] It can be understood that, for the convenience of description, the drawings of the present invention only show the parts related to the present invention, while the parts irrelevant to the present invention are not shown in the drawings.

[0032] It can be understood that each unit and module involved in the embodiments of the present invention may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.

[0033] It can be understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the drawings.

[0034] It is understood that the flowcharts and block diagrams of the present invention illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present invention. Each box in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or may be implemented by a combination of hardware and computer instructions.

[0035] It can be understood that the units and modules involved in the embodiments of the present invention can be implemented by software or hardware. For example, the units and modules can be located in a processor.

[0036] An embodiment of the present invention provides a programmable logic controller, such as Figures 1 to 7 As shown, the programmable logic controller 00 includes a central processing unit 1 and a network interface 2. The central processing unit 1 is used to obtain data from at least one external device 5. The user program is run and the data from at least one external device 5 is processed to obtain the processed data and the data to be transmitted over the network. The processed data is transmitted to at least one external device 5. And, the data to be transmitted over the network is encapsulated into an MQTT message, and the MQTT message is sent to the network interface 2. The data to be transmitted over the network is obtained based on the data from at least one external device 5. The network interface 2 is used to connect to the communication module 6 and send an MQTT message to the communication module 6 so that the communication module transmits the MQTT message remotely through the network. And it is used to connect to each external device 5 in at least one external device respectively, and to transmit data with each external device 5 in at least one external device respectively.

[0037] It can be understood that in addition to being able to realize data transmission between traditional PLCs and external devices, in an embodiment of the present invention, the central processor 1 can encapsulate the data to be transmitted over the network into a message queue telemetry transmission MQTT message. That is to say, the programmable logic controller 00 has a built-in MQTT protocol, so that the programmable logic controller 00 can communicate directly with the MQTT Broker without the support of external network devices or gateways, and can easily send data to the cloud or other devices to achieve remote monitoring and interoperability. This design can reduce the complexity of the overall system and additional hardware investment, and can support the Internet-based publish / subscribe model.

[0038] It can be understood that the data to be transmitted over the network refers to all or part of the data from at least one external device (for example, a part of the data is filtered out from the data from at least one external device), and the data needs to be sent to the cloud or other devices through the network. Exemplarily, the data with network transmission can be the operating data of some external devices in the at least one external device 5 (for example, the temperature data of the temperature sensor), so that the cloud or other devices can store the operating data of some external devices in the at least one external device 5, so that the user can view the operating data of some external devices in the at least one external device 5 through the cloud or other devices.

[0039] It can be understood that the processed data can represent an instruction. For example, the central processing unit 1 can obtain data from the temperature sensor, run the user program and perform calculations on the data from the temperature sensor to obtain processed data, and send the processed data (for example, instruction A) to the corresponding device (such as the air conditioning motor), so that the corresponding device takes action according to the instruction A (for example, starts or stops running).

[0040] It can be understood that the network interface 2 can use the MQTT Internet of Things transmission protocol, that is, it can independently interconnect with the Internet application platform.

[0041] Exemplarily, the data from at least one external device 5 may be data from one external device 5, or data from each external device 5 in a plurality of external devices. Each external device 5 in at least one external device may be a sensor, a button, or other device. Exemplarily, the communication module 6 may be a fifth generation mobile communication network technology (5th Generation Mobile Communication Technology, 5G) communication module, such as a Yanfei communication module. After connecting the programmable logic controller 00 to the Yanfei communication module, the functions of both the PLC and the gateway devices can be realized, and multiple methods such as 4G / 5G / WIFI / Ethernet can be supported to go directly to the cloud.

[0042] In some embodiments, Figure 2 As shown, the programmable logic controller 00 also includes a memory 7. The memory 7 is connected to the central processor 1 and is used to store system programs and system data. The memory 7 also stores a TCP / IP communication thread, which is used to carry the MQTT protocol. The central processor 1 is also used to run the TCP / IP communication thread, encapsulate the data to be transmitted over the network into an MQTT message, and send the MQTT message to the network interface 2.

[0043] It can be understood that the PLC memory generally includes system memory and user memory. The system memory stores the PLC system program and system data to ensure the normal operation of the PLC, and the user memory stores the programs and user data written by the user to realize specific control functions.

[0044] In an embodiment of the present invention, a TCP / IP communication thread is also stored in the memory 7. That is to say, an embodiment of the present invention adds a TCP / IP communication thread in the operating system inside the programmable logic controller 00, so that the programmable logic controller 00 itself has IP communication capability, which is a native capability of the programmable logic controller 00 and reduces the complexity of product hardware, system, and development.

[0045] For example, when adding a TCP / IP communication thread to the operating system inside the programmable logic controller 00, it is necessary to add an Internet communication driver in the runtime, so it is necessary to have runtime capabilities and real-time operating system capabilities, and ultimately achieve external high-speed IO scanning and medium and low-speed data coordinated transmission.

[0046] It can be understood that, compared with the related art that places protocol conversion outside the PLC and adds gateway devices to achieve PLC cloud access, the programmable logic controller 00 provided by the embodiment of the present invention has a high degree of integration, simple components and system structure, low complexity of the overall system, and direct communication between devices, which reduces potential failure points and makes the failure rate lower. In addition, the programmable logic controller 00 directly processes data internally and uses localized resources to reduce delays and error probabilities during data transmission. When problems occur, fault diagnosis and troubleshooting are relatively direct. At the same time, due to the high consistency of the structure, maintenance and support are relatively simple, reducing the risk of failures caused by improper maintenance.

[0047] In some embodiments, Figure 3 As shown, the network interface 2 includes a wide area network interface 21 and a local area network interface 22. The wide area network interface 21 is used to connect to the communication module 6 and send an MQTT message to the communication module 6 so that the communication module 6 transmits the MQTT message remotely through the network. The local area network interface 22 is used to connect to each external device in the at least one external device 5 and transmit data with each external device in the at least one external device.

[0048] Exemplarily, the WAN interface 21 and the LAN interface 22 can both be standard 8-bit modular interfaces, namely RJ45 interfaces. Through the WAN interface 21 and the communication module 6, the programmable logic controller 00 can be connected to an external device or an external network.

[0049] In some embodiments, the local area network interface 22 is used to perform data transmission with each external device in the at least one external device 5 through the Modbus-RTU protocol.

[0050] It can be understood that the WAN interface 21 corresponds to the MQTT communication mode of the WAN, and the LAN interface 22 corresponds to the Modbus TCP communication mode of the LAN.

[0051] In some embodiments, Figure 4 As shown, the programmable logic controller 00 further includes an input module 3. The input module 3 is used to be connected to the central processor 1 and each of the at least one external device 5, respectively, receive data from each of the at least one external device 5, temporarily store data from each of the at least one external device 5, and send data from each of the at least one external device 5 to the central processor 1.

[0052] It can be understood that the input module 3 can receive data from one external device in the at least one external device 5 at one time, or can receive data from multiple external devices in the at least one external device 5 separately.

[0053] In some embodiments, Figure 5 As shown, the input module 3 includes an input interface 31 and an input image register 32. The input interface 31 is used to connect to each external device 5 in at least one external device, receive data from each external device 5 in at least one external device, and send data from each external device 5 in at least one external device to the input image register 32. The input image register 32 is used to receive data from the input interface 31 and temporarily store the data from the input interface 31, so that the central processor 1 reads the data from the input interface 31 from the input image register 32.

[0054] It can be understood that each external device 5 (such as a sensor, a button, etc.) needs to be connected to the input interface 31 through a line. The input interface 31 processes these signals into signals that can be received by the central processing unit 1, that is, the input interface 31 can collect signals and convert them into digital signals, which are stored in the input image register 32. The central processing unit can read the data temporarily stored in the input image register 32 from the input image register 32, perform logical operations, sequential control and other processing according to the user program, and store the results in the output image register 41.

[0055] In some embodiments, Figure 6 As shown, the programmable logic controller 00 further includes an output module 4. The output module 4 is used to be connected to the central processor 1 and each external device 5 in the at least one external device, and to send processed data to each external device 5 in the at least one external device.

[0056] It can be understood that the output module 4 can send the processed data to one external device in the at least one external device 5 at a time, or can send the processed data to multiple external devices in the at least one external device 5 separately.

[0057] In some embodiments, Figure 7 As shown, the output module 4 includes an output image register 41 and an output interface 42. The output image register 41 is used to receive processed data from the central processor 1, temporarily store the processed data, and send the processed data temporarily stored by the output image register 41 to the output interface 42. The output interface 42 is used to be connected to each external device 5 in at least one external device, to receive the processed data from the output image register 41, and to send the processed data to each external device 5 in at least one external device.

[0058] In some embodiments, the programmable logic controller 00 further includes a power module (not shown in the figure). The power module is used to connect to an external power source to supply power to the central processor 1, the input module 3 and the output module 4.

[0059] Exemplarily, the power module 8 can be connected to a 220V power supply to provide power support for various structures inside the programmable logic controller 00.

[0060] The following is an example to illustrate a programmable logic controller provided by an embodiment of the present invention.

[0061] In this example, the structure of the programmable logic controller (hereinafter referred to as PLC) and the functions of each structure are as follows:

[0062] 1.1 Power switch (i.e. power module): connect the PLC to a 220V power supply to provide power support for each unit inside it.

[0063] 1.2 Connection between external devices and PLC input interface: First, external devices (such as sensors, buttons, etc.) need to be connected to the PLC input interface through lines. The input interface processes these signals into signals that can be received by the central processing unit (CPU).

[0064] 1.3 Input interface / output interface: Secondly, the input interface will collect signals and convert them into digital signals, which are stored in the input image register. Figure 8As shown, the input interface / output interface will have multiple I / O modules (for example, I / O point 1, I / O point 2, ..., I / O point 5), each I / O point can be configured as a specific signal type (such as digital input / output, analog input / output), and is assigned a unique address or identifier (such as unique address A1, unique address A2, unique address B). In the PLC program, each I / O point has a unique address, which is used to reference the value of the point in the program. Through the address allocation table, the PLC can know which addresses correspond to which external devices (such as device A, device B, device C) or signals.

[0065] 1.4CPU Processing: Then the CPU reads the data from the input image register, performs logical operations, sequential control and other processing according to the user program, and stores the result in the output image register.

[0066] 1.5 Memory: The system memory stores the PLC's system programs and system data to ensure the normal operation of the PLC; the user memory stores user-written programs and user data to implement specific control functions.

[0067] 1.6MQTT / TCP interface: Finally, the data to be transmitted is encapsulated into an MQTT message, including the topic (Topic), payload (Payload) and other parts. Through the MQTT protocol, the encapsulated data is sent to the specified destination using the network cable (RJ45 interface) to achieve remote data transmission.

[0068] 1.7 Function of indicator light: Through different on and off states, it can intuitively display the current status of external equipment or system, provide operation feedback, and send out alarm signals when a fault occurs.

[0069] When in use, the programmable logic controller in this example can be connected to the 5G communication module, such as Fig. 9 As shown, the connection method is as follows:

[0070] 2.1 Physical connection: First, use a network cable with an RJ45 interface, insert one end into the MQTT network interface or TCP network interface of the PLC, and the other end into the RJ45 interface of the 5G communication module. This step ensures the physical connection between the PLC and the 5G communication module.

[0071] 2.2 Network configuration: After connection, the PLC and 5G communication module need to be configured, including setting network parameters such as IP address, subnet mask, gateway, etc. to ensure that they can communicate with each other in the same network. These configurations are usually performed through the PLC programming software or the configuration interface of the 5G communication module.

[0072] Connect the programmable logic controller in this example to the 5G communication module, such as Fig. 9 As shown, the data transmission process is as follows:

[0073] 3.1 SIM card slot: First insert the IoT card, which provides network connection function to ensure that data can be transmitted and exchanged in the 5G network.

[0074] 3.2RJ45: Then receive data. Once the PLC is successfully connected to the 5G communication module and the network parameters are configured, the PLC can send data to the 5G communication module through the RJ45 interface. The 5G communication module receives this data through its built-in RJ45 interface.

[0075] 3.3 Baseband processor: During the transmission, the data is first processed by the baseband chip to complete tasks such as signal encoding and modulation, and convert the digital signal into a baseband signal suitable for transmission.

[0076] 3.4 RF front-end processing: The baseband signal enters the RF front-end and is filtered out by a filter to remove clutter and interference to ensure the purity of the signal.

[0077] 3.5 Filters: Filters are then used to select signals within a specific frequency range and suppress unwanted interference and noise. In the receiver, filters suppress image frequency interference, ensure signal purity, reduce additional losses and optimize overall performance.

[0078] 3.6 Power amplifier: Next, the weak signal received is amplified by the power amplifier, while minimizing the noise introduced by itself to improve the sensitivity of the receiver.

[0079] 3.7 Antenna transmission: The amplified signal is transmitted through the antenna and propagates in space in the form of radio waves.

[0080] 3.8 Wireless transmission: Finally, the processed data is wirelessly transmitted through the wireless module of the 5G communication module. The 5G communication module uses the 5G network to transmit data to a remote server or other external device. During the transmission process, the data will go through processes such as encoding and modulation to adapt to the characteristics of the wireless channel.

[0081] 3.9 Remote Reception: Ultimately, the data is transmitted to a designated remote server or other receiving device via the 5G network. After receiving the data, the receiving device will perform decryption, decoding and other processing to restore the original data.

[0082] like Fig.10 As shown, the overall workflow for connecting the programmable logic controller in this example with the 5G communication module is described as follows:

[0083] 1. Device perception:

[0084] Identify and confirm the on-site process equipment, including the equipment type, quantity, and communication protocol of the on-site process.

[0085] 2. Scheme analysis and design:

[0086] Design a suitable communication solution according to the external device type and communication protocol, and select Modbus-RTU protocol as the communication standard between PLC and external devices.

[0087] 3.(Modbus-RTU protocol):

[0088] Determine the use of Modbus-RTU protocol and plan the settings of the master and slave stations, as well as the data transmission format and rate.

[0089] 4. Connect to PLC and allocate I / O points:

[0090] Connect the PLC to the external devices on site and assign the corresponding I / O points to ensure that each external device has corresponding input and output points.

[0091] 5.Configure the PLC hardware system:

[0092] Configure the PLC hardware system according to the requirements and design plan, including communication module, power module, etc.

[0093] 6.(MQTT--RJ45):

[0094] The MQTT protocol is used for communication between the PLC and the host computer, and the physical connection is achieved through the RJ45 interface.

[0095] 7.5G communication module:

[0096] Integrate 5G communication module to achieve high-speed and stable communication between PLC and remote application platform.

[0097] 8. Communication signal processing:

[0098] Process the communication signal to ensure the integrity and accuracy of the data, and realize the functions of signal amplification and filtering.

[0099] 9.(5G wireless network):

[0100] Utilize 5G wireless network technology to achieve wireless connection and data transmission between PLC and remote application platform.

[0101] 10. Application Platform:

[0102] Build an application platform to receive data uploaded by PLC, process, analyze and store it, and realize remote monitoring and control functions.

[0103] 11. Generate reports and issue instructions:

[0104] Generate corresponding reports based on the processed data for users to view and analyze; at the same time, users can

[0105] Understandably, the PLC in this example supports wired communication extensions such as RS485 and RS232; for example, it supports wireless communication extensions such as Zigbee-Modbus, Lora, and Xingshan. In addition, the PLC in this example has 14 digital inputs, 10 digital outputs, and 1 Modbus-RTU, and can be expanded to 7 modules at most, with an upper limit of 64 digital outputs and 112 digital / analog inputs, achieving plug-and-play.

[0106] The communication method provided by the embodiment of the present invention is applied to the above-mentioned programmable logic controller 00, which includes a central processing unit 1 and a network interface 2. Fig.11 As shown, the communication method of the programmable logic controller includes steps 1101 to 1105.

[0107] Step 1101: The central processing unit obtains data from at least one external device.

[0108] Step 1102: The central processing unit runs the user program and performs calculations on data from at least one external device to obtain processed data and data to be transmitted over the network.

[0109] In step 1102, data to be transmitted over the network is obtained based on data from at least one external device.

[0110] Step 1103: The central processing unit transmits the processed data to at least one external device.

[0111] Step 1104: The central processor encapsulates the data to be transmitted over the network into an MQTT message, and sends the MQTT message to the network interface.

[0112] In some embodiments, Figure 2 As shown, the programmable logic controller 00 also includes a memory 7, which is connected to the central processor 1 and is used to store system programs and system data. The memory 7 stores a TCP / IP communication thread, which is used to carry the MQTT protocol. The implementation method of step 1104 includes: the central processor runs the TCP / IP communication thread, encapsulates the data to be transmitted over the network into an MQTT message, and sends the MQTT message to the network interface.

[0113] Step 1105 , the network interface sends an MQTT message to the communication module, so that the communication module remotely transmits the MQTT message through the network and performs data transmission with each external device in at least one external device, and performs data transmission with each external device in at least one external device.

[0114] In some embodiments, Figure 3 As shown, the network interface 2 includes a wide area network interface 21 and a local area network interface 22. The wide area network interface 21 is connected to the communication module 6, and the local area network interface 22 is respectively connected to each external device in the at least one external device 5. The implementation method of step 1105 includes: the wide area network interface 21 sends an MQTT message to the communication module 6, so that the communication module 6 transmits the MQTT message remotely through the network. The local area network interface 22 performs data transmission with each external device in the at least one external device.

[0115] In some embodiments, the local area network interface 22 performs data transmission with each external device in the at least one external device through the Modbus-RTU protocol.

[0116] In some embodiments, Figure 4 As shown, the programmable logic controller 00 further includes an input module 3. The input module 3 is respectively connected to the central processor 1 and each of the at least one external device 5. The method further includes: the input module 3 receives data from each of the at least one external device 5, temporarily stores the data from each of the at least one external device 5, and sends the data from each of the at least one external device 5 to the central processor 1.

[0117] In some embodiments, Figure 5 As shown, the input module 3 includes an input interface 31 and an input image register 32. The input interface 31 is respectively connected to each external device in at least one external device 5. The specific implementation method of the input module 3 receiving data from each external device 5 in at least one external device, temporarily storing the data from each external device 5 in at least one external device, and sending the data from each external device 5 in at least one external device to the central processor 1 includes: the input interface 31 receives data from each external device 5 in at least one external device, and sends the data from each external device 5 in at least one external device to the input image register 32. The input image register 32 receives data from the input interface 31, temporarily stores the data from the input interface 31, so that the central processor 1 reads the data from the input interface 31 from the input image register 32.

[0118] In some embodiments, Figure 6As shown, the programmable logic controller 00 further includes an output module 4. The output module 4 is respectively connected to the central processor 1 and each of the at least one external device 5. The method further includes: the output module 4 sends processed data to each of the at least one external device 5 respectively.

[0119] In some embodiments, Figure 7 As shown, the output module 4 includes an output image register 41 and an output interface 42. The output interface 42 is respectively connected to each external device in at least one external device 5. The implementation method of the output module 4 sending processed data to each external device 5 in at least one external device includes: the output image register 41 receives the processed data from the central processor 1, temporarily stores the processed data, and sends the processed data temporarily stored by the output image register 41 to the output interface 42. The output interface 42 receives the processed data from the output image register 41, and sends the processed data to each external device 5 in at least one external device.

[0120] The specific scheme and beneficial effects of the communication method of a programmable logic controller provided by an embodiment of the present invention can be referred to the relevant description of a programmable logic controller 00 provided by an embodiment of the present invention, and will not be repeated here.

[0121] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A programmable logic controller, characterized in that: include: A central processing unit, used for acquiring data from at least one external device; running a user program and performing computation on the data from at least one external device to obtain processed data and data to be transmitted over a network; Transmitting the processed data to at least one external device; and encapsulating the data to be transmitted over the network into a message queue telemetry transmission MQTT message, and sending the MQTT message to the network interface; wherein the data to be transmitted over the network is obtained based on the data from the at least one external device; and The network interface is used to connect to the communication module and send the MQTT message to the communication module so that the communication module remotely transmits the MQTT message through the network; and is used to connect to each of the at least one external device and transmit data with each of the at least one external device.

2. The programmable logic controller according to claim 1, characterized in that: Also includes: A memory connected to the central processing unit, for storing system programs and system data; the memory also stores a transmission control protocol TCP / Internet protocol IP communication thread, and the TCP / IP communication thread is used to carry the MQTT protocol; the central processing unit is also used to run the TCP / IP communication thread, encapsulate the data to be transmitted over the network into the MQTT message, and send the MQTT message to the network interface.

3. The programmable logic controller according to claim 1, characterized in that: The network interface comprises: A wide area network interface, used to connect to the communication module and send the MQTT message to the communication module, so that the communication module transmits the MQTT message remotely through the network; and The local area network interface is used to be connected to each external device in the at least one external device respectively, and to perform data transmission with each external device in the at least one external device respectively.

4. The programmable logic controller according to claim 3, characterized in that: The local area network interface is used to perform data transmission with each external device in the at least one external device through the serial communication protocol Modbus-RTU protocol.

5. The programmable logic controller according to claim 1, characterized in that: Also includes: An input module is used to be connected to the central processor and each external device in the at least one external device, receive data from each external device in the at least one external device, temporarily store the data from each external device in the at least one external device, and send the data from each external device in the at least one external device to the central processor.

6. The programmable logic controller according to claim 5, characterized in that: The input module comprises: an input interface, used to be connected to each of the at least one external device, receive data from each of the at least one external device, and send the data from each of the at least one external device to the input image register; and The input image register is used to receive data from the input interface and temporarily store the data from the input interface so that the central processing unit reads the data from the input interface from the input image register.

7. The programmable logic controller according to claim 5, characterized in that: Also includes: The output module is used to be connected to the central processing unit and each external device in the at least one external device respectively, and to send the processed data to each external device in the at least one external device respectively.

8. The programmable logic controller according to claim 7, characterized in that: The output module comprises: an output image register, used to receive the processed data from the central processing unit, temporarily store the processed data, and send the processed data temporarily stored by the output image register to an output interface; and The output interface is used to be connected to each external device in the at least one external device, to receive the processed data from the output image register, and to send the processed data to each external device in the at least one external device.

9. The programmable logic controller according to claim 7, characterized in that: Also includes: A power supply module is used to be connected to an external power supply and to supply power to the central processing unit, the input module and the output module.

10. A communication method for a programmable logic controller, characterized in that: Applied to a programmable logic controller, the programmable logic controller includes a central processing unit and a network interface; the method includes: The central processing unit acquires data from at least one external device; The central processing unit runs the user program and performs calculation processing on the data from the at least one external device to obtain processed data and data to be transmitted over the network; the data to be transmitted over the network is obtained based on the data from the at least one external device; The central processing unit transmits processed data to at least one external device; The central processor encapsulates the data to be transmitted over the network into an MQTT message, and sends the MQTT message to the network interface; and The network interface sends the MQTT message to the communication module, so that the communication module remotely transmits the MQTT message through the network and performs data transmission with each external device in the at least one external device, and performs data transmission with each external device in the at least one external device.

Citation Information

Patent Citations

  • Programmable logic controller PLC system and data uploading method

    CN109917742A

  • System monitoring method based on industrial internet cloud platform, electronic equipment and medium

    CN115550464A

  • Data processing method and device based on edge gateway equipment and readable storage medium

    CN119232545A

  • Control architecture including a programmable logic controller and a cloud computing system

    US20170108844A1

  • Distributed data processing system having several local system and communication modules for use in such data processing system

    US4396983A