PLC equipment remote communication method and device, electronic equipment and storage medium
By reconstructing the communication function of the CODESYS runtime layer inside the PLC device, the remote communication function of the PLC device is realized, which solves the problem of complex hardware deployment and increased cost when the PLC device is connected to the wide area network, improves the system communication efficiency and reduces the cost.
Patent Information
- Application Number
- CN202311847358.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2024-10-18
AI Technical Summary
Existing PLC equipment requires external DTU equipment when accessing the WAN, resulting in complex hardware deployment, low system communication efficiency, increased system volume, and increased costs.
By reconstructing the underlying functions SysComRead and SysComWrite of the CODESYS runtime layer in the PLC device software, the remote communication function within the PLC device is realized, and the program download and monitoring of the PLC device by the PLC programming software in the wide area network are supported.
It solves the problems of increased system cost, larger system volume, and complicated hardware deployment caused by external DTU equipment, realizes efficient remote communication with PLC equipment, and reduces system costs.
Smart Images

Figure CN118795833A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of PLC control technology, and in particular to a method, device, electronic device and storage medium for remote communication of PLC equipment. Background Art
[0002] The PLC (programmable logic controller) in the existing industrial automation field is mainly connected to the PC through a serial port line or Ethernet, and the program download, upload and online monitoring are realized with the help of PLC programming software (such as CODESYS).
[0003] With the development of industrial Internet and Internet of Things technology, more and more PLCs need to be connected to the WAN to achieve remote program download, upload, and monitoring of PLC devices to reduce operation and maintenance costs. At present, the main way for PLC devices to access the WAN is to rely on PLC gateways or DTU (Data Transfer Unit) devices, externally purchased DTU devices or PLC gateways, DTU devices are connected to traditional PLCs through serial ports on one side and to cloud servers through Ethernet on the other side, and finally establish a communication link with a specific PC in the WAN to achieve program download, monitoring and upload between the PLC programming software on the industrial control PC and the remote PLC device. This external communication device solution has the following problems: complex hardware deployment; low system communication efficiency; increased system size; increased system cost. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present disclosure provide a method, apparatus, electronic device and storage medium for remote communication of a PLC device, which can realize a communication function equivalent to that of a DTU in the runtime inside the PLC device, and realize program downloading and monitoring of the PLC device by the PLC programming software in the wide area network.
[0005] In a first aspect of an embodiment of the present disclosure, a method for remote communication of a PLC device is provided, which is applied to a PLC device, and the method includes:
[0006] Reconstruct the underlying functions SysComRead and SysComWrite based on the CODESYS runtime layer in the PLC device software;
[0007] Remote communication on PLC device software runtime.
[0008] According to a second aspect of the embodiments of the present disclosure, a PLC device is provided, including:
[0009] The reconstruction module is configured to reconstruct based on the underlying functions SysComRead and SysComWrite of the CODESYS runtime layer in the PLC device software;
[0010] The communication module is configured to perform remote communication on the PLC device software runtime.
[0011] According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:
[0012] at least one processor;
[0013] a memory for storing the at least one processor-executable instruction;
[0014] Wherein, the at least one processor is used to execute the instructions to implement the above method.
[0015] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the above method.
[0016] At least one of the above technical solutions adopted in the embodiments of the present disclosure can achieve the following beneficial effects: by reconstructing the underlying functions SysComRead and SysComWrite of the CODESYS runtime layer in the PLC device software, it can support both the download and monitoring of programs of the PLC device by the local PLC programming software and the download and monitoring of programs of the PLC device by the PLC programming software in the wide area network through TCP and P2P communication. Since the communication function equivalent to that of DTU is realized in the runtime inside the PLC device, the problems of increased system cost, increased system volume and complex hardware deployment caused by external DTU devices are solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 A flow chart of a PLC device remote communication method applied to a PLC device provided in an embodiment of the present disclosure;
[0020] Figure 2 A schematic diagram of a communication system model for remote communication of a PLC device provided in an embodiment of the present disclosure;
[0021] Figure 3 A flowchart of a PLC device remote communication method provided by an embodiment of the present disclosure;
[0022] Figure 4 A schematic diagram of the logical structure of the virtual serial port management software of the industrial control PC provided in the embodiment of the present disclosure;
[0023] Figure 5 A schematic diagram of the logical structure of a signaling / code stream forwarding server provided in an embodiment of the present disclosure;
[0024] Figure 6 is a schematic diagram of the software logic structure of the PLC device provided by the embodiment of the present disclosure;
[0025] Figure 7 A structural block diagram of a PLC device provided in an embodiment of the present disclosure;
[0026] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure;
[0027] Fig. 9 A schematic diagram of the structure of an exemplary computer system provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0029] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0030] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0034] For ease of understanding, the technical terms involved in the embodiments of the present disclosure are first introduced below.
[0035] 1. PLC
[0036] Programmable Logic Controller (PLC) is a digital computing controller with a microprocessor for automatic control. It can load control instructions into memory at any time for storage and execution. The programmable controller consists of CPU, instruction and data memory, input / output interface, power supply, digital analog conversion and other functional units. The early programmable logic controller only had the function of logic control, so it was named programmable logic controller. Later, with the continuous development, these computer modules with simple functions at the beginning have various functions including logic control, timing control, analog control, multi-machine communication, etc., and the name was changed to programmable controller (PLC). However, because its abbreviation PC conflicts with the abbreviation of personal computer (Personal Computer), and because of habit, people still often use the name of programmable logic controller and still use the abbreviation PLC.
[0037] The programmable logic controllers used in industry today are already equivalent to or close to a compact computer host. Their advantages in scalability and reliability make them widely used in various industrial control fields. Whether in computer direct control systems, centralized distributed control systems DCS, or fieldbus control systems FCS, there are always a large number of PLC controllers.
[0038] 2. PLC programming software CODESYS
[0039] CODESYS software tool is a software development platform for Industry 4.0 and IoT applications based on advanced NET architecture and IEC 61131-3 international programming standards. The unique advantage of CODESYS software platform is that users can use this single software tool suite to achieve a complete industrial automation solution, that is, under the CODESYS software platform, they can achieve: logic control (PLC), motion control (Motion Control) and CNC control, human-machine interface (HMI), network visualization programming and remote monitoring based on WebService, redundancy control (Redundancy) and safety control (Safety), etc.
[0040] 3. CODESYS Runtime
[0041] In order to program and engineer devices using CODESYS based on the IEC61131-3 standard programming language, the corresponding software is required: CODESYS runtime system. It can transform any embedded or PC-based device into an industrial controller that complies with the IEC61131-3 standard. In addition, this real-time runtime system also contains important additional components such as fieldbus, motion control, visualization, etc., so that the PLC controller can communicate with other components in the automation environment or realize other complex functions.
[0042] The CODESYS code execution mechanism is compilation execution, that is, the IEC code written in the CODESYS IDE is compiled into machine code by the integrated compiler, and then downloaded to the CODESYS Runtime through the network cable or serial port. CODESYS Runtime can mobilize the resources of the hardware platform (such as clock resources, memory resources, etc.) to process these instructions.
[0043] 4. Introduction to PLCopen Specification
[0044] IEC61131 is an international standard for general-purpose programmable controllers (PLCs). It was an industry standard first initiated by several European companies with leading PLC technology. Among them, IEC 61131-3 is an international standard specification for PLC programming, which has defined 6 programming language standards.
[0045] PLCopen is an IEC 61131-3 promotion group headquartered in Europe. It is a global membership organization. Several well-known PLC product manufacturers in the organization have improved some of the technical details in order to make the product application programming of different PLC manufacturers universal, eliminate product technology differences and barriers, and when users choose to use different brands of PLC, they do not have to learn the corresponding programming methods separately.
[0046] In addition to providing standardized recommendations for general logic control instructions, program structure, and keywords contained in various languages, the PLCopen specification also stipulates technical specifications for motion control function blocks MC, including the naming of MC function modules, specific functions, input and output variable definitions, related timing logic, etc., to maximize the interoperability of user programming technologies.
[0047] 5.MQTT
[0048] MQTT (Message Queuing Telemetry Transport) is a "lightweight" messaging protocol based on the publish / subscribe paradigm, released by IBM.
[0049] MQTT can be interpreted as a low-overhead, low-bandwidth instant messaging protocol that can provide real-time and reliable messaging services for connected remote devices with very little code and bandwidth. It is suitable for remote devices with low hardware performance and poor network conditions. Therefore, the MQTT protocol is widely used in IoT (Internet of things), small device applications, mobile applications, etc.
[0050] For IoT devices to work, they must be connected to the Internet so that they can collaborate with each other and with backend services. The basic network protocol of the Internet is TCP / IP, and the MQTT protocol is built on the TCP / IP protocol stack, so it has gradually become the standard for IoT communication.
[0051] Combine the following Figure 1-Figure 9 , the method, apparatus, electronic device and storage medium for remote communication of PLC devices provided in the embodiments of the present disclosure are described.
[0052] Figure 1 A flow chart of a PLC device remote communication method applied to a PLC device provided in an embodiment of the present disclosure is shown as follows: Figure 1 As shown, the method includes:
[0053] S111, reconstruct the underlying functions SysComRead and SysComWrite based on the CODESYS runtime layer in the PLC device software;
[0054] The PLC device is reconstructed based on the underlying functions SysComRead and SysComWrite of the CODESYS runtime layer in the PLC device software.
[0055] Among them, the PLC equipment software consists of: real-time operating system and BSD layer, signaling / code stream communication processing layer, CODESYS runtime layer, and IEC61131-3 user program layer.
[0056] S112. Perform remote communication on the PLC device software runtime.
[0057] The PLC device communicates remotely with the industrial control PC on the PLC device software runtime.
[0058] Optionally, step S112, performing remote communication on the PLC device software runtime includes:
[0059] S1122, the PLC device receives a first connection request forwarded by the industrial control PC through the signaling / code stream forwarding server;
[0060] S1125. The PLC device forwards a second connection request including the first IP address and the first UDP port to the industrial control PC through the signaling / code stream forwarding server;
[0061] S1127, the PLC device receives the second IP address and the second UDP port forwarded by the industrial control PC through the signaling / code stream forwarding server;
[0062] S1129. The PLC device forwards the hole punching request sent to and received from the industrial control PC through the signaling / code stream forwarding server to request UDP hole punching with the industrial control PC.
[0063] Optionally, after the PLC device receives the first connection request forwarded by the industrial control PC through the signaling / code stream forwarding server in step S1122, the method further includes:
[0064] S1123, the PLC device enters the ready state and replies to the industrial control PC that it has entered the ready state.
[0065] Optionally, before the PLC device forwards the second connection request including the first IP address and the first UDP port to the industrial control PC through the signaling / code stream forwarding server in step S1125, the method further includes:
[0066] S1124. The PLC device interacts with the signaling / code stream forwarding server to obtain its own first IP address and first UDP port.
[0067] Optionally, after the PLC device forwards the hole punching request sent to and received from the industrial control PC through the signaling / code stream forwarding server in step S1129 to request UDP hole punching with the industrial control PC, the method further includes:
[0068] If the industrial control PC receives the hole punching response message sent by the PLC device, the industrial control PC and the PLC device perform point-to-point communication;
[0069] Exemplarily, if the industrial control PC receives a hole punching response message sent by the PLC device, and the industrial control PC and the PLC device perform point-to-point communication, the transmitted UDP data packet includes: packet type, sequence number and data content.
[0070] If the industrial control PC does not receive the hole punching response message sent by the PLC device, the industrial control PC and the PLC device continue to perform data communication through the signaling / code stream forwarding server.
[0071] In the embodiment of the present disclosure, the underlying functions SysComRead and SysComWrite of the CODESYS runtime layer in the PLC device software are reconstructed to support both the download and monitoring of programs of the PLC device by the local PLC programming software and the download and monitoring of programs of the PLC device by the PLC programming software in the wide area network through TCP and P2P communication. Since the communication function equivalent to that of DTU is realized in the runtime inside the PLC device, the problems of increased system cost, increased system volume and complex hardware deployment caused by external DTU devices are solved.
[0072] Figure 2 A schematic diagram of a communication system model for remote communication of a PLC device provided in an embodiment of the present disclosure, such as Figure 2 As shown, the description is as follows:
[0073] The virtual serial port management software runs on the industrial control PC. On the one hand, it establishes serial port communication with the PLC programming software on the industrial control PC through virtual serial port technology, and on the other hand, it establishes reliable communication with the signaling / code stream forwarding server through TCP.
[0074] The PLC device establishes reliable communication with the signaling / code stream forwarding server through TCP. Through the forwarding function of the signaling / code stream forwarding server, the PLC device and the industrial control PC conduct reliable signaling communication through the virtual serial port management software.
[0075] The virtual serial port management software of the PLC device and industrial control PC interacts with the signaling / stream forwarding server through UDP to obtain their respective IP and UDP port numbers.
[0076] The virtual serial port management software of the PLC device and the industrial control PC performs UDP hole punching: if UDP hole punching is successful, the PLC device and the virtual serial port management software of the industrial control PC establish P2P communication for remote communication of the PLC program; if UDP hole punching fails, the virtual serial port management software of the PLC device and the industrial control PC realizes remote communication of the PLC program through the signaling / code stream forwarding server.
[0077] Figure 3 A flow chart of a PLC device remote communication method provided by an embodiment of the present disclosure, such as Figure 3 As shown, the method includes:
[0078] S311, the virtual serial port management software of the industrial control PC establishes a TCP connection with the signaling / code stream forwarding server, and then the virtual serial port management software of the industrial control PC establishes a communication connection with the PLC device through the signaling / code stream forwarding server.
[0079] S312, the virtual serial port management software of the industrial control PC performs UDP interaction with the signaling / code stream forwarding server to obtain its own first IP address and first UDP port.
[0080] S313. The virtual serial port management software of the industrial control PC forwards the communication connection request including the first IP address and the first UDP port to the designated PLC device through the signaling / code stream forwarding server.
[0081] S314. After receiving the communication connection request, the PLC device performs UDP interaction with the signaling / code stream forwarding server to obtain its own second IP address and second UDP port.
[0082] S315. The PLC device forwards the communication connection request including the second IP address and the second UDP port to the virtual serial port management software of the industrial control PC through the signaling / code stream forwarding server.
[0083] S316, the virtual serial port management software of the industrial control PC and the PLC device respectively forward the hole punching request to each other through the signaling / code stream forwarding server to request UDP hole punching with the other party.
[0084] S317: If the virtual serial port management software of the industrial control PC receives the hole punching response message sent by the PLC device, the virtual serial port management software of the industrial control PC performs point-to-point communication with the PLC device.
[0085] S318. For the point-to-point communication established above, the reliability of the P2P communication is achieved by adding the packet type, sequence number and data content into the UDP data packet.
[0086] S319: If the virtual serial port management software of the industrial control PC does not receive the hole punching response message sent by the PLC device, the virtual serial port management software of the industrial control PC and the PLC device continue to communicate using the signaling / code stream forwarding server.
[0087] The integrity implementation scheme of P2P communication is as follows:
[0088] After the above step S317, the point-to-point (P2P) communication is established, the communication data of all PLC devices and PLC programming software can be transmitted on the P2P channel. Since the P2P channel uses the UDP protocol, UDP is not a connection-type protocol, so it has the advantages of low resource consumption and fast processing speed, but it is easy to lose data. According to this feature of UDP, a certain protocol is required on the P2P channel to ensure the integrity of data communication.
[0089] Exemplarily, this is achieved by adding a packet type, sequence number, and data content to a UDP data packet: the packet type indicates whether the UDP packet is a data packet or a command packet; the sequence number field is a continuous value: the data receiving end replies ACK or NAK to the sending end based on whether the sequence number field is continuous, and the receiving end determines whether retransmission is required based on the received ACK or NAK signal, ultimately achieving orderly sending and receiving of UDP packets.
[0090] Figure 4 A schematic diagram of the logical structure of the virtual serial port management software of the industrial control PC provided in the embodiment of the present disclosure is shown in FIG. Figure 4 As shown, the description is as follows:
[0091] 1. The virtual serial port management software of the industrial control PC creates a virtual serial port through the virtual serial port communication module to realize the serial port communication between the PLC programming software and the virtual serial port management software.
[0092] 2. The virtual serial port management software of the industrial control PC can use the MQTT protocol through the online PLC management module but is not limited to this technical means. By adding wildcards at appropriate positions in the subscription / publishing topic string, it can broadcast queries and display online PLC device information.
[0093] 3. The virtual serial port management software of the industrial control PC can use the MQTT protocol but is not limited to this technical means through the signaling transceiver module. By adding the ID number of the target PLC device at an appropriate position in the subscription / publishing topic string, with the help of the signaling / code stream forwarding server, the virtual serial port management software of the industrial control PC can achieve reliable signaling communication with the specified PLC device in the wide area network.
[0094] 4. The virtual serial port management software of the industrial control PC interacts with the signaling / stream forwarding server through the UDP hole punching module, obtains its own IP address and UDP port, and forwards the communication connection request including its own IP address and UDP port to the specified PLC device. Then, the hole punching request is forwarded to the PLC device to request the other party to perform UDP hole punching.
[0095] 5. If a hole-punching response message is received from the PLC device, the virtual serial port management software of the industrial control PC establishes reliable UDP communication with the specified PLC device through the communication processing module; if no hole-punching response message is received from the PLC device, the virtual serial port management software of the industrial control PC communicates data with the specified PLC device through the communication processing module via the signaling / code stream forwarding server.
[0096] Figure 5 A schematic diagram of the logical structure of the signaling / code stream forwarding server provided in the embodiment of the present disclosure, such as Figure 5 As shown, the description is as follows:
[0097] 1. The signaling / code stream forwarding server uses the signaling forwarding module to realize the signaling communication between the virtual serial port management software of the designated industrial control PC and the designated PLC device. The technical implementation scheme can choose the MQTT protocol but is not limited to this technical means.
[0098] 2. The signaling / code stream forwarding server uses the UDP interaction module to allow the virtual serial port management software of the industrial control PC and the PLC device interacting with it to obtain their own IP addresses and UDP port numbers respectively.
[0099] 3. After the UDP hole punching between the virtual serial port management software of the industrial control PC and the PLC device fails, the signaling / code stream forwarding server realizes the data communication between the virtual serial port management software of the industrial control PC and the PLC device through the code stream forwarding module.
[0100] Figure 6 is a schematic diagram of the software logic structure of the PLC device provided by the embodiment of the present disclosure, such as Figure 6 As shown, the description is as follows:
[0101] 1. PLC equipment obtains multi-task real-time scheduling and synchronization capabilities through real-time operating system and BSD module, and PLC has TCP and UDP communication capabilities through BSD board-level driver package.
[0102] 2. The PLC device can use the MQTT protocol but is not limited to this technical means through the signaling transceiver module. By adding the ID number of the virtual serial port management software of the target industrial control PC at the appropriate position in the subscription / publishing topic string, with the help of the signaling / code stream forwarding server, reliable signaling communication between the PLC device and the virtual serial port management software of the designated industrial control PC in the wide area network can be achieved.
[0103] 3. The PLC device interacts with the signaling / code stream forwarding server through the UDP hole punching module, obtains its own IP address and UDP port, and forwards the communication connection request including its own IP address and UDP port to the virtual serial port management software of the specified industrial control PC. Then, the hole punching request is forwarded to the virtual serial port management software of the industrial control PC to request UDP hole punching with the other party.
[0104] 4. If a hole punching response message is received from the virtual serial port management software of the industrial control PC, the PLC device establishes reliable P2P communication with the virtual serial port management software of the designated industrial control PC through the communication processing module; if a hole punching response message is not received from the virtual serial port management software of the industrial control PC, the PLC device communicates data with the virtual serial port management software of the designated industrial control PC through the communication processing module with the aid of a signaling / code stream forwarding server.
[0105] 5. The PLC device can download, upload, monitor and execute the IEC61131-3 program written by the user through the CODESYS runtime module. The underlying functions SysComRead and SysComWrite of the CODESYS runtime module are reconstructed to associate them with the above communication processing module, thereby realizing remote program download, upload and monitoring.
[0106] 6. The IEC61131-3 application program written by electrical engineers in high-level languages such as ST language or T-diagram is stored in the IEC61131-3 user program module. The runtime will execute the program in the IEC61131-3 user program module to enable the PLC to perform related operations as expected.
[0107] Figure 7 A structural block diagram of a PLC device provided in an embodiment of the present disclosure, such as Figure 7 As shown, the PLC device 700 includes:
[0108] The reconstruction module 701 is configured to reconstruct the underlying functions SysComRead and SysComWrite based on the CODESYS runtime layer in the PLC device software;
[0109] The communication module 702 is configured to perform remote communication on the PLC device software runtime.
[0110] In some embodiments, the communication module 702 includes:
[0111] A first receiving submodule is configured to receive a first connection request forwarded by the industrial control PC through the signaling / code stream forwarding server;
[0112] The request submodule is configured to forward the second connection request including the first IP address and the first UDP port to the industrial control PC through the signaling / code stream forwarding server;
[0113] The second receiving submodule is configured to receive the second IP address and the second UDP port forwarded by the industrial control PC through the signaling / code stream forwarding server;
[0114] The hole punching module is configured to forward the hole punching request sent to and received from the industrial control PC through the signaling / code stream forwarding server to request UDP hole punching with the industrial control PC.
[0115] In some embodiments, the communication module 702 further includes:
[0116] The preparation submodule is configured to enter the preparation state and reply to the industrial control PC that it has entered the preparation state.
[0117] In some embodiments, the communication module 702 further includes:
[0118] The acquisition submodule is configured to interact with the signaling / code stream forwarding server to acquire its own first IP address and first UDP port.
[0119] In some embodiments, the communication module 702 further includes:
[0120] The communication submodule is configured such that if the industrial control PC receives a hole punching response message sent by the PLC device, the industrial control PC and the PLC device perform point-to-point communication; if the industrial control PC does not receive a hole punching response message sent by the PLC device, the industrial control PC and the PLC device continue to perform data communication through the signaling / code stream forwarding server.
[0121] In some embodiments, the PLC device and the virtual serial port management software running on the industrial control PC respectively establish TCP connections with the signaling / code stream forwarding server, and the signaling / code stream forwarding server adopts the MQTT protocol.
[0122] In some embodiments, if the industrial control PC receives a hole punching response message sent by the PLC device, the industrial control PC and the PLC device perform point-to-point communication, and the transmitted UDP data packet includes: packet type, sequence number and data content.
[0123] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0124] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Figure 8 As shown, an embodiment of the present disclosure further provides an electronic device, which includes at least one processor 801 and a memory 802 coupled to the processor 801, wherein the memory 802 is used to store instructions executable by at least one processor 801, wherein the at least one processor 801 is used to execute instructions to implement the steps of the above-mentioned method of an embodiment of the present disclosure.
[0125] The processor 801 may also be referred to as a central processing unit (CPU), which may be an integrated circuit chip having signal processing capabilities. Each step in the method described in the embodiment of the present disclosure may be completed by an integrated logic circuit of hardware in the processor 801 or by instructions in the form of software. The processor 801 may be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method described in the embodiment of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a memory 802, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, or other mature storage media in the art. The processor 801 reads the information in the memory 802 and completes the steps of the method described in the embodiment of the present disclosure in combination with its hardware.
[0126] In addition, various operations / processes according to the present application, when implemented by software and / or firmware, can be transmitted from a storage medium or a network to a computer system having a dedicated hardware structure, for example, Fig. 9 The computer system 900 shown is installed with the programs constituting the software. When the various programs are installed, the computer system can execute various functions, including the functions described above. Fig. 9 A schematic diagram of the structure of an exemplary computer system provided for an embodiment of the present disclosure.
[0127] Computer system 900 is intended to represent various forms of digital electronic computer equipment, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0128] like Fig. 9As shown, the computer system 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the computer system 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0129] A plurality of components in the computer system 900 are connected to the I / O interface 905, including: an input unit 906, an output unit 907, a storage unit 908, and a communication unit 909. The input unit 906 may be any type of device capable of inputting information to the computer system 900, and the input unit 906 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 907 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 908 may include, but is not limited to, a disk, an optical disk. The communication unit 909 allows the computer system 900 to exchange information / data with other devices over a network such as the Internet, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, for example, a Bluetooth™ device, a WI-FI device, a WiMax device, a cellular communication device, and or the like.
[0130] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above. For example, in some embodiments, the above-mentioned method of the application of the embodiment of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via the ROM 902 and / or the communication unit 909. In some embodiments, the computing unit 901 may be configured to perform the above-mentioned method of the application of the embodiment of the present disclosure by any other appropriate means (e.g., by means of firmware).
[0131] An embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above method.
[0132] The computer-readable storage medium may be a volatile memory, such as a random-access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or it may be a respective device including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0133] It should be noted that the computer-readable storage medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiment of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the embodiment of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0134] In the disclosed embodiments, computer program codes for performing the operations of the present application may be written in one or more programming languages or a combination thereof, the programming languages including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the computer, partially on the computer, as an independent software package, partially on the computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the 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., via the Internet using an Internet service provider).
[0135] The modules, components or units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the modules, components or units do not, in some cases, limit the modules, components or units themselves.
[0136] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0137] It should be noted that, in this article, terms such as "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0138] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.
Claims
1. A method for remote communication of a PLC device, applied to a PLC device, characterized in that: The method comprises: Reconstruct the underlying functions SysComRead and SysComWrite based on the CODESYS runtime layer in the PLC device software; Remote communication on PLC device software runtime.
2. The method according to claim 1, characterized in that Remote communication on the PLC device software runtime includes: Receiving a first connection request forwarded by the industrial control PC through the signaling / code stream forwarding server; forwarding a second connection request including the first IP address and the first UDP port to the industrial control PC through the signaling / code stream forwarding server; Receive the second IP address and the second UDP port forwarded by the industrial control PC through the signaling / code stream forwarding server; The hole punching request sent to and received from the industrial control PC is forwarded by the signaling / code stream forwarding server to request UDP hole punching with the industrial control PC.
3. The method according to claim 2, characterized in that After receiving the first connection request forwarded by the industrial control PC through the signaling / code stream forwarding server, the method further includes: Enter the ready state and reply to the industrial control PC that it has entered the ready state.
4. The method according to claim 2, characterized in that: Before forwarding the second connection request including the first IP address and the first UDP port to the industrial control PC through the signaling / code stream forwarding server, the method further includes: Interact with the signaling / stream forwarding server to obtain its own first IP address and first UDP port.
5. The method according to claim 4, characterized in that After forwarding the hole punching request sent to and received from the industrial control PC by the signaling / code stream forwarding server to request UDP hole punching with the industrial control PC, the method further includes: If the industrial control PC receives the hole punching response message sent by the PLC device, the industrial control PC and the PLC device perform point-to-point communication; If the industrial control PC does not receive the hole punching response message sent by the PLC device, the industrial control PC and the PLC device continue to perform data communication through the signaling / code stream forwarding server.
6. The method according to any one of claims 1 to 5, characterized in that: The PLC device and the virtual serial port management software running on the industrial control PC respectively establish a TCP connection with the signaling / code stream forwarding server, and the signaling / code stream forwarding server adopts the MQTT protocol.
7. The method according to claim 5, characterized in that If the industrial control PC receives the hole punching response message sent by the PLC device, the industrial control PC and the PLC device perform point-to-point communication, and the transmitted UDP data packet includes: packet type, sequence number and data content.
8. A PLC device, characterized in that: include: The reconstruction module is configured to reconstruct based on the underlying functions SysComRead and SysComWrite of the CODESYS runtime layer in the PLC device software; The communication module is configured to perform remote communication on the PLC device software runtime.
9. An electronic device, characterized in that: include: at least one processor; a memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 7.
