Implementation method of integrated upper and lower computer PLC based on OPCUA
By using OPCUA and WEB server gateways in PLC, a cross-platform upper and lower computer integrated PLC system is realized, which solves the problem that the PLC system cannot achieve cross-platform use and security risks in the existing technology, and simplifies the operation and maintenance of the PLC system and integration process.
Patent Information
- Application Number
- CN202211189809.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-28
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-09-28
AI Technical Summary
When existing PLC systems implement the upper-level human-computer interface, they cannot be used across platforms, and the implementation method based on WEB services requires the integration of non-industrial control programs within the PLC, resulting in complex development, increased risks and security risks.
Using the integrated PLC implementation method of upper and lower computers based on OPCUA, the process of writing flowchart programs in the PLC generates HTML, JS and CSS files, and uses OPCUA file type node and WEB server gateway to realize cross-platform transmission of files and data and Presentation, the introduction of non-industrial control procedures within the PLC is avoided.
It realizes the integration of upper and lower computers that display PLC system content on any platform, simplifies the operation and maintenance and integration of the PLC system, and avoids potential failures and safety hazards.
Smart Images

Figure CN115480518B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of PLC (Programmable Logic Controller), and in particular relates to an OPC UA-based PLC implementation method integrating upper and lower computers. Background Art
[0002] PLC is an electronic device for digital computing designed for use in industrial environments. It uses a programmable memory to store instructions for performing logical operations, sequential operations, timing, counting and arithmetic operations, and can control various types of machinery or production processes through digital or analog input and output. PLC and its related peripherals should be designed to be easy to form an integral part of the industrial control system and easy to expand its functions.
[0003] OPC UA (OPC Unified Architecture) is an open international standard specification developed for secure and reliable data exchange in industries such as industrial automation. It was released by the OPC Foundation in 2008 and later developed into the international standard IEC62541, providing a safe, reliable and vendor-independent transmission of raw data and pre-processed information from the manufacturing level to the production plan or ERP level. Through OPC UA, all required information is available to each authorized application and each authorized person at any time and any place. This function is independent of the original application, programming language and operating system of the manufacturer. OPC UA is a supplement to the currently used OPC industrial standards, providing important features, including platform independence, scalability, high reliability and the ability to connect to the Internet.
[0004] WEB server is also called WWW (WORLD WIDE WEB) server. Its main function is to provide online information browsing service. WWW is a multimedia information query tool of the Internet. It is a service developed in recent years on the Internet. It is also the fastest growing and most widely used service. A web server is a program that can provide documents to browsers that make requests. The application layer uses the HTTP protocol, and the document format uses HTML (Hypertext Markup Language, a markup language that includes a series of tags. Through these tags, the document format on the network can be unified, so that scattered Internet resources can be connected into a logical whole).
[0005] The common front-end display method is HTML+CSS+JS:
[0006] (1) HTML (HyperText Markup Language): determines the structure and content of a web page, that is, "what content to display".
[0007] (2) CSS (Cascading Style Sheet): Cascading Style Sheet, used to design the presentation style of a web page, i.e. “how to display relevant content”.
[0008] (3) JS (JavaScript): A dynamic scripting language that controls the behavior (effect) of a web page, that is, "how the displayed content should respond to events."
[0009] There are two main ways to implement the upper computer human-machine interface (HMI) in the current PLC system:
[0010] (1) Based on the configuration software, the human-machine interface is designed. The designed human-machine interface can only be executed and displayed on the dedicated software of the host computer.
[0011] (2) Human-machine interface design based on touch screen related configuration software. The designed human-machine interface can only be downloaded to the touch screen for execution and display.
[0012] The above two human-machine interface implementation methods are both for PLC users to display content independently of PLC manufacturers, and fail to achieve the integrated presentation of upper and lower computers. Moreover, these two methods cannot be used across platforms.
[0013] Therefore, a cross-platform host computer implementation method is needed that can conveniently access the PLC system at any time and any place, and present the internal information of the PLC system in the way that the PLC manufacturer organizes and displays data, so as to efficiently perform PLC system operation, maintenance, integration and other tasks.
[0014] Based on the above purpose, some PLC manufacturers have provided PLC system WEB services based on existing WEB SERVER technology. Users can access PLC systems on various platforms to obtain real-time data. Take Siemens S7 series PLC as an example. Figure 1 , Figure 2 , Figure 3 As shown, using the above network transmission (HTTP protocol) plus browser method, the device side needs to do the following:
[0015] (1) An embedded HTTP server (such as boa, goahead, lighttpd, mongoose, etc.) needs to be integrated;
[0016] (2) Deploy a web application on an HTTP server;
[0017] (3) Provide webservice interface to the outside world.
[0018] It can be seen that although this method solves the problem of cross-platform use by users by providing the host computer human-machine interface (HMI) to the outside, it requires the additional integration of programs (HTTP server) that are not related to the industrial control of the PLC itself within the PLC. The development, deployment, and upgrade are relatively complex, and potential risks are introduced, such as increased load, program crashes, and security risks, which may cause overall abnormalities in the PLC system. Summary of the invention
[0019] Purpose of the invention: The technical problem to be solved by the present invention is to provide an OPCUA-based integrated PLC implementation method for upper and lower computers in view of the deficiencies in the prior art, including the following steps:
[0020] Step 1, write the flowchart program SCC1:
[0021] Step 2, compile the flowchart program SCC1 into a binary executable program of the PLC, and generate a SCC1.html file corresponding to the binary executable program, and download it to the corresponding storage path / na / hmi / html / SCC1.html in the PLC;
[0022] Step 3, when the PLC starts, the opcua server in the PLC adds an OPCUA file type node hmi.tar.gz, which has methods for opening a file Open, closing a file Close, reading file content Read, and writing content to a file Write, which can be called by the client, thereby realizing the file operation of the client on the server;
[0023] Step 4, when the Open method of the OPCUA file type node hmi.tar.gz is called, the / na / hmi / folder is packaged and compressed and stored as the / na / hmi / hmi.tar.gz file;
[0024] Step 5, add a WEB server gateway, the gateway has OPC UA client function, HTTP server function and instruction conversion function;
[0025] Step 6: Perform instruction conversion and data return;
[0026] Step 7. After completing steps 1 to 6, the / na / hmi / hmi.tar.gz file in the PLC can be read from the OPCUA client through the OPCUA protocol. The file contains the SCC1.html file, as well as the corresponding scc.js file and scc.css file. The WEB application provides a webservice interface to the outside world.
[0027] In step 2, the JS file / na / hmi / scripts / scc.js and CSS file / na / hmi / css / scc.css related to the built-in flowchart program SCC1 are installed in the PLC.
[0028] In step 4, the PLC provides the file node hmi.tar.gz to the outside through the OPCUA server service. When the client calls the Open method of the file node hmi.tar.gz, the callback function in the PLC packages the / na / hmi folder into an hmi.tar.gz compressed file and returns the file operation descriptor handle; when the client calls the read method of the file node hmi.tar.gz and passes in the file operation descriptor handle, the callback function in the PLC returns the binary code stream of the hmi.tar.gz file. The client saves the binary code stream as a file in the local file system, and after decompression, obtains the file that can be displayed in the PLC.
[0029] In step 5, the OPC UA client functions include: obtaining files required for upper computer display from the OPC UA server;
[0030] The HTTP server functions include: publishing the HTML file obtained from the OPCUA server in the form of a WEB service, specifically including: integrating an embedded HTTP server boa; deploying a web application; providing a webservice interface to the outside world;
[0031] The instruction conversion function includes: converting the data acquisition instruction provided to the browser in the WEB service into an instruction for acquiring OPC UA server data.
[0032] In step 6, after receiving the data request instruction sent by the upper computer and converted by the OPCUA client, the lower computer PLC sends a response message to the OPCUA client through the OPCUA protocol. After the OPCUA client forwards the response message to the WEB application, the WEB application converts the OPCUA response into an http response and sends it to the client browser in the upper computer.
[0033] In step 7, after the upper computer obtains the file that can be displayed in the PLC, if it wants to obtain relevant real-time data, the upper computer first sends an http request to the WEB application in the OPCUA client. After the WEB application forwards the http request to the OPCUA client, the OPCUA client converts the http request into an OPCUA request and sends it to the OPCUA server in the lower computer PLC.
[0034] The present invention has the following beneficial effects:
[0035] (1) Users can display the content of the PLC system on a cross-platform terminal (browser);
[0036] (2) The content opened by the user is in the PLC manufacturer's built-in format (HTML+JS+CSS), so that the upper and lower computers of the presented content can be integrated;
[0037] (3) Use the existing functions of the PLC to realize the transmission of files and data (OPCUA), and do not use methods such as WEB service software to add functions unrelated to industrial control to the PLC to avoid potential faults. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.
[0039] Figure 1 It is a schematic diagram showing how other manufacturers (Siemens) achieve integrated access between upper and lower computers.
[0040] Figure 2 , Figure 3 It is a schematic diagram showing the presentation effect seen on other terminals (mobile phones) after other manufacturers (Siemens) have achieved integrated access between upper and lower computers.
[0041] Figure 4 It is a schematic diagram of the programming software interface for programmers.
[0042] Figure 5 This is a schematic diagram of the host computer obtaining HTML / CSS / JS files.
[0043] Figure 6 It is a schematic diagram for obtaining relevant real-time data.
[0044] Figure 7 It is a schematic diagram of the transmission process between the lower computer PLC and the client browser in the upper computer.
[0045] Figure 8 This is a schematic diagram of the effect displayed on the final client.
[0046] Fig. 9 Yes Figures 4 to 8 Schematic diagram of the overall description. DETAILED DESCRIPTION
[0047] Example
[0048] This solution uses NAPro to dynamically generate the content (HTML) to be displayed and sends it to the PLC, uses HTML+CSS+JS for front-end display, and uses OPCUA for file and data transmission.
[0049] This embodiment takes the example of a user using NAPro programming software of AoTuo Technology to write a flowchart program SCC1, opening the HTML file corresponding to SCC1 in the browser of the host computer, and tracking the execution process of the flowchart as an example to describe in detail how this solution realizes the integrated presentation of the upper and lower computers:
[0050] (1) The user writes the flowchart program SCC1 in NAPro programming software:
[0051] (2) Click the download button of the NAPro programming software to compile SCC1 into a binary executable program for the PLC. At the same time, the SCC1.html file corresponding to the program is generated and downloaded to the corresponding storage path in the PLC ( / na / hmi / html / SCC1.html).
[0052] (3) The PLC has built-in JS (how to operate) and CSS (how to display) files related to this type of SCC process control diagram: / na / hmi / scripts / scc.js and / na / hmi / css / scc.css.
[0053] (4) When the PLC starts, the opcua server (OPCUA server) in the PLC adds the OPCUA file type (FILETYPE) node hmi.tar.gz. This node has methods such as Open (open file), Close (close file), Read (read file content), and Write (write content to file), which can be called by the client to realize the file operation of the client on the server.
[0054] (5) When the Open method of the OPCUA file type (FILETYPE) node hmi.tar.gz is called, the / na / hmi / folder is packaged and compressed and stored as the / na / hmi / hmi.tar.gz file.
[0055] (6) Add a web server gateway, in which a custom-developed software is installed, which has three functions:
[0056] 1. OPCUA client function: obtain the files required for upper computer display from the OPCUA server (PLC);
[0057] 2. HTTP server function: Publish the HTML file obtained from the OPCUA server (PLC) as a WEB service:
[0058] Integrate an embedded HTTP server boa;
[0059] Deploy a web application;
[0060] Provide webservice interface to the outside world.
[0061] 3. Instruction conversion function: convert the data acquisition instructions provided to the browser in the WEB service into instructions for obtaining OPCUA server data.
[0062] (7) The instruction conversion and data return steps of the previous step:
[0063] 1. Instruction conversion
[0064] 2. Data return
[0065] 3. Json string format example: {"steps":[{"step":"step0","state":"2","start":"17:25:08.145","end":"17:26:08.145"},{"step":"step1","state":"2","start":"17:36:08.145","end":"17:36:08.145"},{"step":"step2","state":"2 ","start":"17:45:08.145","end":"17:46:08.145"},{"step":"step3","state":"1","start":"17:55:08.145" ,"end":"17:56:08.145"},{"step":"step4","state":"0","start":"17:58:08.145","end":"17:59:08.145"}]}
[0066] (8) After completing the above steps, the OPCUA client (WEB server gateway) can read the / na / hmi / hmi.tar.gz file in the PLC through the OPCUA protocol, which contains the SCC1.html file and the corresponding scc.js and scc.css files (these two files are shared by SCC type HTML files and are specified in the HTML file) to provide a webservice interface to the outside world. In this way, each terminal can access the information in the PLC through a browser.
[0067] Figure 1This is to show how other manufacturers (Siemens) achieve integrated access between upper and lower computers. As can be seen in the figure, other manufacturers' implementation methods are to integrate an HTTP server in the PLC and deploy a WEB application, so that the PLC can be accessed from other terminals (such as PCs). This method requires additional integration of programs (HTTP servers) that are not related to the industrial control of the PLC itself inside the PLC. Development, deployment, and upgrades are more complicated, and potential risks are introduced, such as increased load, program crashes, and security risks, which may cause overall abnormalities in the PLC system.
[0068] Figure 2 It is to show the presentation effect seen on other terminals (PC computers) after other manufacturers (Siemens) realize integrated access between upper and lower computers.
[0069] Figure 3 It is to show the presentation effect seen on other terminals (mobile phones) after other manufacturers (Siemens) realize integrated access between upper and lower computers.
[0070] In order to illustrate the technical solution of the present invention, it is first explained step by step: where the lower computer display file (HTML) and real-time data come from, how to transmit the files and data to be displayed to the upper computer, so as to achieve integrated real-time and synchronous display of the upper and lower computers.
[0071] Figure 4 It is the programming software interface for programmers. In this interface, the flowchart program SCC1 is written to simulate the needs of the industrial site. This program is used to control the production equipment on the industrial site. Programmers can download the flowchart SCC1 to the lower-level PLC through the programming software, and let the PLC execute the relevant instruction logic according to the SCC1 flowchart. In the subsequent description, the following three points are specifically explained:
[0072] (1) How to convert the SCC1 flowchart into a file (HTML) that can be displayed on a cross-platform host computer;
[0073] (2) How to convert the SCC1 flowchart into HTML files and other CSS / JS files and transfer them to the host computer for storage;
[0074] (2) How to obtain real-time data from the PLC on the user's host computer and use the transmitted HTML / CSS / JS files to display the real-time status of the SCC1 flowchart execution in the PLC.
[0075] Figure 5This article explains how the host computer obtains HTML / CSS / JS files: The PLC provides the hmi.tar.gz file node through the OPCUA server service, and other OPCUA client clients can access this file node. When the client calls the Open method of this node, the callback function in the PLC packages the / na / hmi folder into an hmi.tar.gz compressed file and returns the file operation descriptor handle; when the client calls the read method of this node and passes in the file operation descriptor handle, the callback function in the PLC will return the binary code stream of the hmi.tar.gz file. The client saves this binary code stream as a file in the local file system, and after decompression, obtains the file that can be displayed in the PLC (such as a flow chart, system diagram, etc.).
[0076] Figure 6 It explains how the host computer obtains relevant real-time data (such as which step the flowchart is executed to) after obtaining files that can be displayed in the PLC (such as flowcharts, system diagrams, etc.). As shown in the figure, the host computer first sends an http request to the WEB application in the OPCUA client. After the WEB application forwards it to the OPCUA client, the OPCUA client converts the http request into an OPCUA request and sends it to the OPCUA server in the slave PLC.
[0077] Figure 7 It means that after receiving the data request instruction sent by the upper computer and converted by the OPCUA client, the lower computer PLC sends the response message to the OPCUA client through the OPCUA protocol. After the OPCUA client forwards it to the WEB application, the WEB application converts the OPCUA response into an http response and sends it to the client browser in the upper computer.
[0078] Figure 8 It explains the SCC1 flowchart in the user programming software, and the effect displayed on the final client after file and data transmission, including the SCC1 flowchart itself, and the color of the elements in the flowchart changed by the content in the real-time data (different colors represent different execution states, elements are filled with gray when there is no real-time data, elements are filled with blue when the program steps have been executed, and elements are filled with blue when the program steps are being executed).
[0079] Fig. 9 Yes Figures 4 to 8 The overall description is not a real screenshot, and its purpose is to show the transfer process of files and data.
[0080] The system of the present invention uses the host computer programming software NAPro, which is completely independently developed by AoTuo Technology Co., Ltd. (hereinafter referred to as AoTuo Technology), and the innovative SCC (Sequence Control Chart) process control chart to explain the principle. The present invention focuses on the presentation and explanation of the technical solution. Other display contents, such as system configuration diagram, system status, module information, topology, etc., are similar in principle and can be implemented by the technical means described in this solution, so they will not be repeated.
[0081] In a specific implementation, the present application provides a computer storage medium and a corresponding data processing unit, wherein the computer storage medium can store a computer program, and when the computer program is executed by the data processing unit, the invention content of the upper and lower integrated PLC implementation method based on OPCUA provided by the present invention and some or all of the steps in each embodiment can be run. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0082] Those skilled in the art can clearly understand that the technical solutions in the embodiments of the present invention can be implemented by means of computer programs and their corresponding general hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention can be essentially or partly contributed to the prior art in the form of a computer program, i.e., a software product, which can be stored in a storage medium and includes several instructions for enabling a device including a data processing unit (which can be a personal computer, a server, a single-chip microcomputer, a MUU or a network device, etc.) to execute the methods described in various embodiments of the present invention or certain parts of the embodiments.
[0083] The present invention provides an implementation method of an integrated upper and lower computer PLC based on OPCUA. There are many methods and ways to implement the technical solution. The above is only a preferred implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented using existing technologies.
Claims
1. The method for realizing PLC integrating upper and lower computers based on OPCUA is characterized in that: The following steps are involved: Step 1, write the flowchart program SCC1: Step 2, compile the flowchart program SCC1 into a binary executable program of the PLC, and generate a SCC1.html file corresponding to the binary executable program, and download it to the corresponding storage path / na / hmi / html / SCC1.html in the PLC; Step 3, when the PLC starts, add an OPCUA file type node hmi.tar.gz, which has methods for opening a file Open, closing a file Close, reading file content Read, and writing content Write to a file, for the client to call, thereby realizing the file operation of the client on the server; Step 4, when the Open method of the OPCUA file type node hmi.tar.gz is called, the / na / hmi folder is packaged and compressed and stored as the / na / hmi / hmi.tar.gz file; Step 5, add a WEB server gateway, the gateway has OPC UA client function, HTTP server function and instruction conversion function; Step 6: Perform instruction conversion and data return; Step 7: After completing steps 1 to 6, the OPCUA client can read the / na / hmi / hmi.tar.gz file in the PLC through the OPCUA protocol, which contains the SCC1.html file, as well as the corresponding scc.js file and scc.css file. The WEB application provides a webservice interface to the outside world. In step 4, the PLC provides the OPCUA file type node hmi.tar.gz to the outside through the OPCUA server service. When the client calls the Open method of the OPCUA file type node hmi.tar.gz, the callback function in the PLC packages the / na / hmi folder into an hmi.tar.gz compressed file and returns the file operation descriptor handle; when the client calls the read method of the OPCUA file type node hmi.tar.gz and passes in the file operation descriptor handle, the callback function in the PLC returns the binary code stream of the hmi.tar.gz file. The client saves the binary code stream as a file in the local file system, and after decompression, obtains the file that can be displayed in the PLC; In step 5, the OPC UA client functions include: obtaining files required for upper computer display from the OPC UA server; The HTTP server functions include: publishing the HTML file obtained from the OPCUA server in the form of a WEB service, specifically including: integrating an embedded HTTP server boa; deploying a web application; providing a webservice interface to the outside world; The instruction conversion function includes: converting the data acquisition instruction provided to the browser in the WEB service into an instruction for acquiring OPC UA server-side data.
2. The method according to claim 1, characterized in that In step 2, the JS file / na / hmi / scripts / scc.js and CSS file / na / hmi / css / scc.css related to the built-in flowchart program SCC1 are installed in the PLC.
3. The method according to claim 2, characterized in that In step 6, after receiving the data request instruction sent by the upper computer and converted by the OPCUA client, the lower computer PLC sends a response message to the OPCUA client through the OPCUA protocol. After the OPCUA client forwards the response message to the WEB application, the WEB application converts the OPCUA response into an http response and sends it to the client browser in the upper computer.
4. The method according to claim 3, characterized in that In step 7, after the upper computer obtains the file that can be displayed in the PLC, if it wants to obtain relevant real-time data, the upper computer first sends an http request to the WEB application in the OPCUA client. After the WEB application forwards the http request to the OPCUA client, the OPCUA client converts the http request into an OPCUA request and sends it to the OPCUA server in the lower computer PLC.
Citation Information
Patent Citations
An information integration system and method based on OPC UA
CN109257208A
Method and system for process controlling of plants in an OPC-UA based machine-to-machine network
US20180088548A1
