+

CN116095161A - Method, system and application for converting PLC data into JSON format - Google Patents

Method, system and application for converting PLC data into JSON format Download PDF

Info

Publication number
CN116095161A
CN116095161A CN202211540683.0A CN202211540683A CN116095161A CN 116095161 A CN116095161 A CN 116095161A CN 202211540683 A CN202211540683 A CN 202211540683A CN 116095161 A CN116095161 A CN 116095161A
Authority
CN
China
Prior art keywords
data
node
red
plc
json format
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211540683.0A
Other languages
Chinese (zh)
Inventor
李志庚
魏振彦
安波
白天宇
成旗
马宏伟
马利剑
乔治
王振
万龙
高云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Teda Water Industry Co ltd
Original Assignee
Tianjin Teda Water Industry Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Teda Water Industry Co ltd filed Critical Tianjin Teda Water Industry Co ltd
Priority to CN202211540683.0A priority Critical patent/CN116095161A/en
Publication of CN116095161A publication Critical patent/CN116095161A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

本发明属于通信技术领域,公开了一种实现PLC数据转换为JSON格式的方法、系统及应用。该方法包括:搭建用于现场设备数据采集与传输的Node‑RED平台运行环境,并运行;利用OPC协议采集PLC子站的实时数据;利用OPC软件对采集的实时数据进行转化并发布;利用Node‑RED平台接收OPC软件的发布数据;利用Node‑RED平台把接收的发布数据转换为JSON格式。本发明利用计算机Node‑RED平台实现工业自动化行业中传统的PLC数据转换为计算机JSON格式语言,适用于工业物联网、大数据、云平台等智慧信息项目中。

Figure 202211540683

The invention belongs to the technical field of communication, and discloses a method, system and application for converting PLC data into JSON format. The method includes: building and running a Node-RED platform operating environment for field device data collection and transmission; using OPC protocol to collect real-time data of PLC sub-stations; using OPC software to convert and release the collected real-time data; using Node The ‑RED platform receives the published data from the OPC software; uses the Node‑RED platform to convert the received published data into JSON format. The invention uses the computer Node-RED platform to realize the conversion of traditional PLC data in the industrial automation industry into computer JSON format language, and is suitable for intelligent information projects such as industrial Internet of Things, big data, and cloud platforms.

Figure 202211540683

Description

一种实现PLC数据转换为JSON格式的方法、系统及应用A method, system and application for converting PLC data into JSON format

技术领域technical field

本发明属于通信技术领域,尤其涉及一种实现PLC数据转换为JSON格式的方法、系统及应用。The invention belongs to the technical field of communication, and in particular relates to a method, system and application for converting PLC data into JSON format.

背景技术Background technique

数字孪生技术和物联网技术是近些年发展的热门方向,数字工厂需要大量数据的支撑,工业数据又以PLC数据为主,数据的转换传输需要IT(Internet Technology,互联网技术)技术人员使用Visual Studio软件(Windows平台的应用程序开发软件)编写源代码实现功能,开发周期长,需要的IT技术门槛高,需要扎实的C(一种程序设计语言)、C++(一种程序设计语言)或者Java(一种程序设计语言)等计算机语言基础,而自控工程师多以研究逻辑控制为主要工作方向,主要以使用软件为主,并不适合对软件进行开发,而且更多的情况是,针对某一家PLC厂商编写的软件,并不能适用到其他PLC厂商,这时又要花费时间和经历重新编写与之对应的软件,导致重复开发,浪费时间和经历,效率太低。Digital twin technology and Internet of Things technology are popular directions of development in recent years. Digital factories need the support of a large amount of data, and industrial data is mainly PLC data. Data conversion and transmission require IT (Internet Technology, Internet technology) technicians to use Visual Studio software (application development software for Windows platform) writes source code to realize functions, the development cycle is long, and the IT technology threshold required is high. Solid C (a programming language), C++ (a programming language) or Java is required (a programming language) and other computer language foundations, while automatic control engineers mostly focus on the research of logic control, mainly using software, which is not suitable for software development, and more often, for a certain company The software written by PLC manufacturers cannot be applied to other PLC manufacturers. At this time, it will take time and experience to rewrite the corresponding software, resulting in repeated development, wasting time and experience, and the efficiency is too low.

Node-RED平台技术和OPC软件相结合的技术就很完美的解决了以上这些问题,OPC协议是国际通用技术协议,具有一定的开放性,可以读取各个厂商的PLC数据,并对数据进行转发。Node-RED平台技术是一种编程工具,用于以新颖有趣的方式将硬件设备,API和在线服务连接在一起。它提供了一个基于浏览器的编辑器,使得我们可以轻松地使用编辑面板中的各种节点将流连接在一起,只需单击即可将其部署到其运行时。Node-RED可以在本地安装,并通过浏览器来访问其可视化编排界面,其次还可以使用富文本编辑器在编辑器中创建JavaScript(一种具有函数优先的轻量级,解释型或即时编译型的编程语言)函数,内置库还允许保存有用的功能,模板或流程以供重复使用,并且最重要一点Node-RED技术是开源的。The combination of Node-RED platform technology and OPC software perfectly solves the above problems. The OPC protocol is an international general technical protocol with a certain degree of openness. It can read the PLC data of various manufacturers and forward the data. . Node-RED platform technology is a programming tool for connecting hardware devices, APIs, and online services together in new and interesting ways. It provides a browser-based editor that makes it easy to wire streams together using various nodes in the edit panel and deploy it to its runtime with a single click. Node-RED can be installed locally and access its visual layout interface through a browser. Secondly, you can also use a rich text editor to create JavaScript in the editor (a lightweight, interpreted or just-in-time compilation with function priority) programming language) functions, built-in libraries also allow saving useful functions, templates or processes for re-use, and most importantly Node-RED technology is open source.

随着工业4.0的到来,传统自动化行业已不能完全适应新技术的发展,传统工控技术需结合IT技术实现智慧化,例如数字孪生技术、智慧工厂。物联网技术正在进步,有很多的物联云平台可供选择,但其中关键的是数据以怎样的通道或形式进行对接。传统的工业控制以PLC为主,上位机软件通过读取PLC的数据,可以对控制对象实行数据监控或控制动作,但PLC厂家众多,每家PLC厂商的数据格式又都各不相同,如果想进行云平台与PLC间的数据对接,就一定要解决数据格式的不统一问题,同时还要保证数据的安全性和实时性。OPC软件能很好的解决各个PLC厂商间数据格式的问题,但OPC软件发布的数据还不能直接与云平台对接,这就需要协议的转换。With the advent of Industry 4.0, the traditional automation industry can no longer fully adapt to the development of new technologies. Traditional industrial control technology needs to be combined with IT technology to achieve intelligence, such as digital twin technology and smart factories. The Internet of Things technology is advancing, and there are many IoT cloud platforms to choose from, but the key is the channel or form of data connection. Traditional industrial control is mainly based on PLC. By reading the PLC data, the host computer software can implement data monitoring or control actions on the control objects. However, there are many PLC manufacturers, and the data formats of each PLC manufacturer are different. If you want to To carry out the data connection between the cloud platform and the PLC, it is necessary to solve the problem of inconsistency in the data format, and at the same time ensure the security and real-time performance of the data. OPC software can well solve the problem of data format between various PLC manufacturers, but the data released by OPC software cannot be directly connected to the cloud platform, which requires protocol conversion.

JSON是一种轻量级的数据交换格式,是IT技术行业适用比较广泛的计算机语言,同时很多云平台,如:阿里云、腾讯云、百度云等,均支持JSON格式的语言进行数据传输。云平台依靠数据的积累才能进行数据的分析、监视和利用,分析后的数据生成报表或者数据预警等。JSON is a lightweight data exchange format, and it is a widely used computer language in the IT technology industry. At the same time, many cloud platforms, such as Alibaba Cloud, Tencent Cloud, Baidu Cloud, etc., all support the language in JSON format for data transmission. The cloud platform relies on the accumulation of data to analyze, monitor, and utilize data, and the analyzed data generates reports or data early warnings.

通过上述分析,现有技术存在的问题及缺陷为:Through the above analysis, the problems and defects in the prior art are:

(1)现有工业自动化领域通讯协议中,进行数据的分析、监视和利用效率低,不能有效对异常数据进行预警显示。(1) In the existing communication protocols in the field of industrial automation, the efficiency of data analysis, monitoring and utilization is low, and abnormal data cannot be effectively displayed for early warning.

(2)现有技术中,不同厂商的产品进行集中监控效果差,需要很多对不同监控设备单独监控,造成成本高,而且现有技术监控的准确度低。(2) In the prior art, centralized monitoring of products from different manufacturers is not effective, requiring a lot of individual monitoring of different monitoring devices, resulting in high cost, and the accuracy of monitoring in the prior art is low.

发明内容Contents of the invention

为克服相关技术中存在的问题,本发明公开实施例提供了一种利用Node-RED平台(基于Javascript语言搭建的运行环境)实现PLC(Programmable Logic Controller,可编程逻辑控制器)数据转换为JSON格式(JavaScript Object Notation,一种轻量级的数据交换格式)的方法、系统及应用。In order to overcome the problems existing in the related technology, the disclosed embodiment of the present invention provides a kind of utilization Node-RED platform (based on the operating environment built by Javascript language) to realize PLC (Programmable Logic Controller, programmable logic controller) data conversion to JSON format (JavaScript Object Notation, a lightweight data exchange format) method, system and application.

所述技术方案如下:利用Node-RED实现PLC数据转换为JSON格式的方法,应用于信息数据处理终端,该方法包括以下步骤:Described technical scheme is as follows: Utilize Node-RED to realize the method that PLC data is converted into JSON form, is applied to information data processing terminal, and this method comprises the following steps:

S1,搭建用于现场设备数据采集与传输的Node-RED平台运行环境,并运行;S1, build and run the Node-RED platform operating environment for field device data collection and transmission;

S2,利用OPC协议采集PLC子站的实时数据;S2, using the OPC protocol to collect real-time data of the PLC sub-station;

S3,利用OPC软件对步骤S2采集的实时数据进行转化并发布;S3, using OPC software to convert and publish the real-time data collected in step S2;

S4,利用Node-RED平台接收OPC软件的发布数据;S4, using the Node-RED platform to receive the release data of the OPC software;

S5,利用Node-RED平台把接收的发布数据转换为JSON格式,并利用Node-RED平台自带的数据调试节点对转换后的数据进行测试。S5, use the Node-RED platform to convert the received published data into JSON format, and use the data debugging node that comes with the Node-RED platform to test the converted data.

在步骤S1中,现场设备包括:PLC设备、流量计、压力表、温度表中的一种或多种。In step S1, the field devices include: one or more of PLC devices, flow meters, pressure gauges, and temperature gauges.

在步骤S1中,搭建用于现场设备数据采集与传输的Node-RED平台运行环境,并运行具体包括以下步骤:In step S1, build the Node-RED platform operating environment for field device data collection and transmission, and run it specifically includes the following steps:

(1)安装Node-RED平台运行环境:(1) Install the Node-RED platform operating environment:

①搜索并下载Node.msi软件安装包;①Search and download the Node.msi software installation package;

②在Node.msi软件安装包上,安装该软件;② Install the software on the Node.msi software installation package;

③使用管理员权限打开Windows系统的命令提示符;③ Open the command prompt of the Windows system with administrator privileges;

④复制代码npm config set registry http://registry.npmmirror.com到输入框中并运行该代码;④Copy the code npm config set registry http://registry.npmmirror.com into the input box and run the code;

⑤复制代码npm install-g--unsafe-perm node-red pm2pm2-windows-startuppm2-windows-service到输入框中并运行该代码;⑤ Copy the code npm install-g--unsafe-perm node-red pm2pm2-windows-startuppm2-windows-service into the input box and run the code;

(2)使用CMD命令提示符运行Node-RED平台;(2) Use the CMD command prompt to run the Node-RED platform;

①开启Windows系统的命令提示符;① Open the command prompt of the Windows system;

②复制代码C:\Users\Administrator\AppData\Roaming\npm\node-red.cmd到输入框中并回车运行该代码。②Copy the code C:\Users\Administrator\AppData\Roaming\npm\node-red.cmd into the input box and press Enter to run the code.

在步骤S2中,利用OPC协议采集PLC子站的实时数据包括以下步骤:In step S2, utilizing the OPC protocol to collect the real-time data of the PLC sub-station includes the following steps:

步骤1,建立数据采集通道;Step 1, establish a data collection channel;

步骤2,在新建的数据通道内新建PLC数据;Step 2, create new PLC data in the newly created data channel;

步骤3,测试数据的正确性。Step 3, test the correctness of the data.

在步骤S3中,利用OPC软件对数据进行转化并发布包括以下步骤:In step S3, using the OPC software to convert and publish the data includes the following steps:

OPC软件通过IoT Gateway将采集的PLC数据转换为MQTT服务进行对外发布。The OPC software converts the collected PLC data into an MQTT service through the IoT Gateway for external release.

本发明的另一目的在于提供一种实现所述利用Node-RED实现PLC数据转换为JSON格式的方法的利用Node-RED实现PLC数据转换为JSON格式系统,所述利用Node-RED实现PLC数据转换为JSON格式系统包括:Another object of the present invention is to provide a kind of method that utilizes Node-RED to realize that PLC data is converted into JSON format and utilize Node-RED to realize that PLC data is converted into JSON format system, described utilize Node-RED to realize PLC data conversion Formatting systems for JSON include:

语言运行环境搭建模块,用于搭建现场设备数据采集与传输的Node-RED平台运行环境,并运行;The language operating environment building module is used to build the Node-RED platform operating environment for field device data collection and transmission, and run it;

实时数据采集模块,用于利用OPC协议采集PLC子站的实时数据;The real-time data acquisition module is used to collect the real-time data of the PLC substation using the OPC protocol;

数据转化模块,用于利用OPC软件对数据进行转化并发布;The data conversion module is used to convert and release data by using OPC software;

发布数据接收模块,用于利用Node-RED平台接收OPC软件的发布数据;Published data receiving module, used to receive the published data of OPC software by using the Node-RED platform;

格式转换模块,用于利用Node-RED平台把接收的数据转换为JSON格式。The format conversion module is used to convert the received data into JSON format using the Node-RED platform.

本发明的另一目的在于提供一种接收用户输入程序存储介质,所存储的计算机程序使电子设备执行所述利用Node-RED实现PLC数据转换为JSON格式的方法。Another object of the present invention is to provide a program storage medium for receiving user input, and the stored computer program enables electronic equipment to execute the method for converting PLC data into JSON format using Node-RED.

本发明的另一目的在于提供一种计算机设备,所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行所述利用Node-RED实现PLC数据转换为JSON格式的方法。Another object of the present invention is to provide a computer device, the computer device includes a memory and a processor, the memory stores a computer program, when the computer program is executed by the processor, the processor executes the Describe the method of using Node-RED to convert PLC data into JSON format.

本发明的另一目的在于提供一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时,使得所述处理器执行所述利用Node-RED实现PLC数据转换为JSON格式的方法。Another object of the present invention is to provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor performs the conversion of PLC data into JSON format using Node-RED. Methods.

本发明的另一目的在于提供一种化工、冶金行业数据信息集中监控设备,所述化工、冶金行业数据信息集中监控设备实施所述的利用Node-RED实现PLC数据转换为JSON格式的方法。Another object of the present invention is to provide a centralized monitoring device for data information in the chemical industry and metallurgical industry, which implements the method for converting PLC data into JSON format using Node-RED.

结合上述的所有技术方案,本发明所具备的优点及积极效果为:In combination with all the above-mentioned technical solutions, the advantages and positive effects of the present invention are:

第一、针对上述现有技术存在的技术问题以及解决该问题的难度,紧密结合本发明的所要保护的技术方案以及研发过程中结果和数据等,详细、深刻地分析本发明技术方案如何解决的技术问题,解决问题之后带来的一些具备创造性的技术效果,具体描述如下:本发明利用计算机Node-RED平台实现工业自动化行业中传统的PLC数据转换为计算机JSON格式语言,适用于工业物联网、大数据、云平台等智慧信息项目中。First, in view of the technical problems existing in the above-mentioned prior art and the difficulty of solving the problems, closely combine the technical solution to be protected in the present invention and the results and data in the research and development process, etc., to analyze in detail how the technical solution of the present invention solves it Technical problems, some creative technical effects brought after solving the problems, are specifically described as follows: The present invention uses the computer Node-RED platform to realize the conversion of traditional PLC data in the industrial automation industry into computer JSON format language, which is suitable for industrial Internet of Things, Smart information projects such as big data and cloud platforms.

第二、把技术方案看作一个整体或者从产品的角度,本发明所要保护的技术方案具备的技术效果和优点,具体描述如下:本发明可以将不同厂商的产品简单可靠的接入IT网络,实现系统网页端的集中监控,分散控制等功能。在传统的工业控制行业,OPC软件可以采集几乎所有品牌的PLC设备和仪表设备。为传统工业智慧信息化建设和数字孪生工厂技术做好了数据采集的坚实基础,以便后续的数据统计和数据分析带来便利。Second, regarding the technical solution as a whole or from the perspective of products, the technical effects and advantages of the technical solution to be protected by the present invention are specifically described as follows: the present invention can connect products of different manufacturers to IT networks simply and reliably, Realize the functions of centralized monitoring and decentralized control on the web page of the system. In the traditional industrial control industry, OPC software can collect almost all brands of PLC equipment and instrumentation equipment. It has laid a solid foundation for data collection for traditional industrial intelligence information construction and digital twin factory technology, so as to facilitate subsequent data statistics and data analysis.

第三、作为本发明的权利要求的创造性辅助证据,还体现在以下几个重要方面:本发明填补了IT技术领域利用网页端读取工业PLC数据的技术空白,本发明解决了PLC数据的数据格式转换为JSON数据格式的技术难题,本发明克服了IT技术和OT(OperatorTechnology,工业现场技术)技术不能很好融合的技术偏见。Third, as the auxiliary evidence of the inventiveness of the claims of the present invention, it is also reflected in the following important aspects: the present invention fills the technical gap of using the web page to read industrial PLC data in the field of IT technology, and the present invention solves the problem of PLC data data Format is converted into the technical problem of JSON data format, and the present invention overcomes the technical prejudice that IT technology and OT (OperatorTechnology, industrial site technology) technology cannot be well integrated.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理;The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure;

图1是本发明实施例提供的利用Node-RED实现PLC数据转换为JSON格式的方法流程图;Fig. 1 is the method flow diagram that utilizes Node-RED to realize that PLC data is converted into JSON format provided by the embodiment of the present invention;

图2是本发明实施例提供利用OPC协议采集PLC子站的实时数据流程图;Fig. 2 is that the embodiment of the present invention provides and utilizes the OPC protocol to collect the real-time data flowchart of PLC substation;

图3是本发明实施例提供的利用Node-RED实现PLC数据转换为JSON格式系统示意图;Fig. 3 is the schematic diagram of utilizing Node-RED to realize the conversion of PLC data into JSON format system provided by the embodiment of the present invention;

图4是本发明实施例提供的采用本发明方法实施的智慧水厂可视化技术实时在线展示的生产数据情况效果图;Fig. 4 is an effect diagram of the real-time online display of production data of the smart water plant visualization technology implemented by the method of the present invention provided by the embodiment of the present invention;

图中:1、运行环境搭建模块;2、实时数据采集模块;3、数据转化模块;4、发布数据接收模块;5、格式转换模块。In the figure: 1. Operating environment building module; 2. Real-time data acquisition module; 3. Data conversion module; 4. Release data receiving module; 5. Format conversion module.

具体实施方式Detailed ways

为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图对本发明的具体实施方式做详细的说明。在下面的描述中阐述了很多具体细节以便于充分理解本发明。但是本发明能够以很多不同于在此描述的其他方式来实施,本领域技术人员可以在不违背本发明内涵的情况下做类似改进,因此本发明不受下面公开的具体实施的限制。In order to make the above objects, features and advantages of the present invention more comprehensible, specific implementations of the present invention will be described in detail below in conjunction with the accompanying drawings. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, the present invention can be implemented in many other ways different from those described here, and those skilled in the art can make similar improvements without departing from the connotation of the present invention, so the present invention is not limited by the specific implementation disclosed below.

一、解释说明实施例:1. Example of explanation:

实施例1Example 1

如图1所示,本发明实施例提供的利用Node-RED实现PLC数据转换为JSON格式的方法,应用于信息数据处理终端,包括以下步骤:As shown in Figure 1, the method for utilizing Node-RED to convert PLC data into JSON format provided by the embodiment of the present invention is applied to an information data processing terminal and includes the following steps:

S1,搭建用于现场设备数据采集与传输的Node-RED平台运行环境,并运行;S1, build and run the Node-RED platform operating environment for field device data collection and transmission;

S2,利用OPC协议(OLE for Process Control,是由行业供应商、终端用户和软件开发者共同制定的一系列标准通用的规范)采集PLC子站的实时数据;S2, using the OPC protocol (OLE for Process Control, a series of standard and common specifications jointly formulated by industry suppliers, end users and software developers) to collect real-time data of PLC substations;

S3,利用OPC软件对步骤S2采集的实时数据进行转化并发布;S3, using OPC software to convert and publish the real-time data collected in step S2;

S4,利用Node-RED平台接收OPC软件的发布数据;S4, using the Node-RED platform to receive the release data of the OPC software;

S5,利用Node-RED平台把接收的发布数据转换为JSON格式;并利用Node-RED平台自带的数据调试节点对转换后的数据进行测试,保证数据在经过格式转换后的准确性。S5, use the Node-RED platform to convert the received published data into JSON format; and use the data debugging node that comes with the Node-RED platform to test the converted data to ensure the accuracy of the data after format conversion.

示例性的,在步骤S1中,包括:搭建用于现场设备数据采集与传输的Node-RED平台运行环境,并运行。现场设备包括流量计、压力表、温度表。Exemplarily, in step S1, it includes: building and running a Node-RED platform operating environment for field device data collection and transmission. Field devices include flow meters, pressure gauges, and temperature gauges.

在本发明实施例中,S4和S5的具体实施步骤如下:In the embodiment of the present invention, the specific implementation steps of S4 and S5 are as follows:

如果Node-RED平台安装完成并运行成功,那么在浏览器的地址栏输入127.0.0.1:1880后回车,就可以进入Node-RED平台组态界面;If the Node-RED platform is installed and running successfully, enter 127.0.0.1:1880 in the address bar of the browser and press Enter to enter the Node-RED platform configuration interface;

在页面的左侧边栏的节点中选择MQTT in节点(MQTT服务接收节点),拖拽到流程界面中,并对其进行参数设置,需要添加新的mqtt-broker(消息队列服务器)节点,节点的服务端填写OPC软件所在电脑的IP地址(Internet Protocol Address,互联网协议地址),端口号默认,主题名填写IoTgateway,输出选项选择:字符串,单击完成按钮;Select the MQTT in node (MQTT service receiving node) from the nodes on the left sidebar of the page, drag it to the process interface, and set its parameters. A new mqtt-broker (message queue server) node needs to be added. The server fills in the IP address (Internet Protocol Address) of the computer where the OPC software is located, the default port number, the theme name fills in IoTgateway, the output option selection: string, and click the Finish button;

在页面的左侧边栏的节点中选择JSON节点,拖拽到流程界面中,并对其进行参数设置,操作选项选择JSON字符串与对象互转,然后将下面的“格式化JSON字符串”选项勾选,单击完成按钮;Select the JSON node from the nodes on the left sidebar of the page, drag it into the process interface, and set its parameters, select the operation option to convert JSON string to object, and then set the "Format JSON String" option below Check it and click the Finish button;

在页面的左侧边栏的节点中选择debug节点(测试用节点),拖拽到流程界面中,并对其进行参数设置,将目标参数的“节点状态”选项勾选,单击完成按钮;Select the debug node (test node) from the nodes on the left sidebar of the page, drag it to the process interface, and set its parameters, check the "Node Status" option of the target parameter, and click the Finish button;

这时流程界面中一共有三个节点,分别是IoTgateway,JSON,Debug,使用连接线依次将三个节点相连,然后单击右上角的部署按钮,这时Node-RED平台就可以根据部署的流程将数据接收,并通过JSON节点将数据格式转换成JSON格式,最后通过Debug节点看到实时数据的显示,以便验证数据的准确性,此过程设置结束。At this time, there are three nodes in the process interface, which are IoTgateway, JSON, and Debug. Connect the three nodes in turn with connecting lines, and then click the deployment button in the upper right corner. At this time, the Node-RED platform can follow the deployment process. Receive the data, convert the data format into JSON format through the JSON node, and finally see the display of real-time data through the Debug node, so as to verify the accuracy of the data, and the setting of this process is over.

实施例2Example 2

基于实施例1提供的利用Node-RED实现PLC数据转换为JSON格式的方法,进一步的,步骤S101搭建Node-RED平台的运行环境,并运行:Based on the method of using Node-RED to convert PLC data into JSON format provided by Embodiment 1, further, step S101 builds the operating environment of the Node-RED platform, and runs:

(1)安装(1) installation

管理员模式下使用cmd运行Use cmd to run in administrator mode

npm config set registry http://registry.npmmirror.comnpm config set registry http://registry.npmmirror.com

npm install–g--unsafe-perm node-red pm2pm2-windows-startup pm2-windows-service;npm install --g --unsafe-perm node-red pm2pm2-windows-startup pm2-windows-service;

(2)运行(2) run

C:\Users\Administrator\AppData\Roaming\npm\node-red.cmdC:\Users\Administrator\AppData\Roaming\npm\node-red.cmd

或者or

pm2pm2

start C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\red.js。start C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\red.js.

具体包括:Specifically include:

(1)安装Node-RED平台运行环境:(1) Install the Node-RED platform operating environment:

①首先搜索并下载Node.msi(Windows平台应用程序名称)软件安装包,开源软件不存在侵权问题。①First search and download the Node.msi (Windows platform application program name) software installation package, open source software does not have infringement problems.

②在Node.msi软件安装包上,鼠标右键单击以管理员权限运行,安装该软件。② On the Node.msi software installation package, right-click to run with administrator privileges to install the software.

③使用管理员权限打开Windows系统的命令提示符。③ Open the command prompt of the Windows system with administrator privileges.

④复制代码npm config set registry http://registry.npmmirror.com(Windows平台标准代码)到输入框中并回车运行该代码。④ Copy the code npm config set registry http://registry.npmmirror.com (Windows platform standard code) to the input box and press Enter to run the code.

⑤复制代码npm install-g--unsafe-perm node-red pm2pm2-windows-startuppm2-windows-service(Windows平台标准代码)到输入框中并回车运行该代码。⑤ Copy the code npm install-g--unsafe-perm node-red pm2pm2-windows-startuppm2-windows-service (Windows platform standard code) to the input box and press Enter to run the code.

(2)使用CMD(Command Prompt,命令提示符)命令提示符运行Node-RED平台(2) Use the CMD (Command Prompt, command prompt) command prompt to run the Node-RED platform

①使用管理员权限打开Windows系统的命令提示符。① Open the command prompt of the Windows system with administrator privileges.

②复制代码C:\Users\Administrator\AppData\Roaming\npm\node-red.cmd(Windows平台标准代码)到输入框中并回车运行该代码。② Copy the code C:\Users\Administrator\AppData\Roaming\npm\node-red.cmd (Windows platform standard code) to the input box and press Enter to run the code.

实施例3Example 3

基于实施例1提供的利用Node-RED实现PLC数据转换为JSON格式的方法,进一步的,如图2所示,步骤S102利用OPC协议采集PLC子站的实时数据包括以下步骤:Based on the method of utilizing Node-RED to realize PLC data conversion to JSON format provided by embodiment 1, further, as shown in Figure 2, step S102 utilizes the OPC protocol to collect the real-time data of PLC sub-stations and includes the following steps:

S201,建立数据采集通道;S201, establishing a data collection channel;

具体过程如下:The specific process is as follows:

打开OPC软件,在右侧项目树的连接性下面单击添加通道;Open the OPC software, and click Add Channel under the connectivity of the project tree on the right;

选择通道类型,根据PLC的品牌不同可以选择不同的通道类型,选择完成后单击下一步;Select the channel type, you can choose different channel types according to the brand of PLC, click next after the selection is completed;

为新建的通道指定一个名称,完成后单击下一步;Specify a name for the newly created channel, and click Next when finished;

虚拟网络设置和每周期的事务数选项默认不变,单击下一步;The virtual network settings and the number of transactions per cycle option remain unchanged by default, click Next;

网络适配器选择与PLC在同一网段内的网卡,完成后单击下一步;Network adapter Select the network card in the same network segment as the PLC, and click Next after completion;

优化方法和工作循环选项默认不变,单击下一步;The optimization method and duty cycle options remain unchanged by default, click Next;

浮点值选项默认不变,单击下一步;The floating-point value option remains unchanged by default, click Next;

套接字利用、每个设备的最大套接字数、端口、IP协议等选项默认不变,单击下一步;Socket utilization, maximum number of sockets per device, port, IP protocol and other options remain unchanged by default, click Next;

此页面是对刚刚设置的参数的总览,如果没有问题,可单击完成按钮,数据采集通道建立完成。This page is an overview of the parameters just set. If there is no problem, click the Finish button, and the data acquisition channel is established.

S202,在新建的数据通道内新建PLC数据;S202, creating new PLC data in the newly created data channel;

具体过程如下:The specific process is as follows:

在S201步骤新建的通道下面单击添加设备;Click Add Device under the newly created channel in step S201;

为新建的设备指定一个名称,完成后单击下一步;Specify a name for the newly created device, and click Next when finished;

根据需要连接的设备的通讯类型选择通讯型号,完成后单击下一步;Select the communication model according to the communication type of the device to be connected, and click Next after completion;

设置需要连接的设备的站点或节点,例如PLC站点的IP地址等;Set the site or node of the device that needs to be connected, such as the IP address of the PLC site, etc.;

扫描模式和缓存的初始更新选项默认不变,单击下一步;The initial update options of scan mode and cache remain unchanged by default, click Next;

连接超时、请求超时、超时前尝试次数、请求间延迟等选项默认不变,单击下一步;Connection timeout, request timeout, number of attempts before timeout, delay between requests and other options remain unchanged by default, click Next;

故障时降级选项默认不变,单击下一步;The downgrade option on failure remains unchanged by default, click Next;

设备启动时、对于重复标记、允许自动生成的子组等选项默认不变,单击下一步;When the device is started, the default options for repeat flags, allow automatically generated subgroups, etc. remain unchanged, click Next;

端口、IP协议、超时后关闭套接字等选项默认不变,单击下一步;Port, IP protocol, close socket after timeout and other options remain unchanged by default, click Next;

从零开始的寻址、从零开始的位寻址、保持寄存器位写入、Modbus(Modbusprotocol,串行通信协议)函数06、Modbus函数05等选项默认不变,单击下一步;The zero-based addressing, zero-based bit addressing, holding register bit write, Modbus (Modbus protocol, serial communication protocol) function 06, Modbus function 05 and other options remain unchanged by default, click Next;

Modbus字节顺序选项根据PLC子站的数据特点,适当选择启用或者禁用,首字排序为低选项根据PLC子站的数据特点,适当选择是否启用首字排序为低选项,首双字排序为低选项与首字排序为低选项同理,其余选项默认不变,单击下一步;The Modbus byte order option is properly selected to enable or disable according to the data characteristics of the PLC substation, and the first word sorting is low. According to the data characteristics of the PLC substation, it is properly selected whether to enable the first word sorting. The options are the same as the option that the first word is sorted as low, and the rest of the options remain unchanged by default, click Next;

输出线圈、输入线圈、内部寄存器、保持寄存器、块读取字符串等选项默认不变,单击下一步;The output coil, input coil, internal register, holding register, block read string and other options remain unchanged by default, click Next;

此页面是对刚刚设置的参数的总览,如果没有问题,可单击完成按钮,OPC软件与PLC子站的连接已建立完成。This page is an overview of the parameters just set. If there is no problem, click the Finish button, and the connection between the OPC software and the PLC substation has been established.

在OPC软件的主页面中标记名称对话框的空白处单击右键,新建标记,填写好标记的名称和地址,选择需要读取的地址的数据类型,单击确定,PLC数据新建完成。On the main page of the OPC software, right-click in the blank space of the tag name dialog box, create a new tag, fill in the tag name and address, select the data type of the address to be read, click OK, and the PLC data is created.

S203,测试数据的正确性。S203, testing the correctness of the data.

实施例4Example 4

基于实施例1提供的利用Node-RED实现PLC数据转换为JSON格式的方法,进一步的,步骤S103利用OPC软件对数据进行转化并发布包括以下步骤:Based on the method of utilizing Node-RED to realize the conversion of PLC data into JSON format provided by embodiment 1, further, step S103 utilizes OPC software to convert and release data including the following steps:

OPC软件具有IoT Gateway(IoT,Internet of things,即物联网,Gateway,网关,全称可解释为:物联网数据收发功能)功能,该功能可将采集的PLC数据转换为MQTT服务(Message Queuing Telemetry Transport,消息队列遥测传输)进行对外发布OPC software has the function of IoT Gateway (IoT, Internet of things, that is, Internet of Things, Gateway, gateway, the full name can be interpreted as: Internet of Things data sending and receiving function), which can convert the collected PLC data into MQTT service (Message Queuing Telemetry Transport , Message Queue Telemetry Transmission) for external publishing

具体过程如下:The specific process is as follows:

打开OPC软件,在右侧项目树的IoT Gateway选项下面单击Add Agent(添加代理节点);Open the OPC software, and click Add Agent under the IoT Gateway option in the project tree on the right;

在新打开的New Agent(新代理节点)对话框中为Agent(代理节点)指定一个名称,类型选择MQTT Client(MQTT消息队列客户端),设置完成后单击下一步;In the newly opened New Agent (new agent node) dialog box, specify a name for Agent (agent node), select MQTT Client (MQTT message queue client) as the type, and click Next after the setting is complete;

在新的设置界面对MQTT Broker(MQTT消息队列服务器)参数进行设置,URL参数(uniform resource locator,统一资源定位系统)填写本机网卡的IP地址,端口号保持不变。Topic(主题)参数是为此MQTT Broker指定一个名称,这个名称在之后的Node-RED平台采集数据时会用到。Publish(数据发布参数)中的参数默认即可,设置完成后单击下一步;Set the MQTT Broker (MQTT message queue server) parameters in the new setting interface, fill in the IP address of the local network card in the URL parameter (uniform resource locator, and the uniform resource locator system), and keep the port number unchanged. The Topic (topic) parameter is to specify a name for this MQTT Broker, which will be used when the Node-RED platform collects data later. The parameters in Publish (data publishing parameters) can be defaulted, and click Next after the setting is complete;

在新的设置界面对Credentials参数(通讯凭证参数)进行设置,Client ID(客户端号)是为此Credentials指定一个名称,Username(用户名)和Password(密码)参数可根据项目需求来决定是否启用,如果对其进行设置了,那么在之后的Node-RED平台采集数据时会用到。设置完成后单击完成,对MQTT数据发布通道的建立完成;Set the Credentials parameter (communication certificate parameter) in the new setting interface. The Client ID (client number) is to specify a name for this Credentials. The Username (username) and Password (password) parameters can be used according to project requirements. , if it is set, it will be used when the Node-RED platform collects data later. After the setting is complete, click Finish to complete the establishment of the MQTT data publishing channel;

在新建的Agent中,单击Add items(添加新标签),在打开的标记浏览器中选择需要发布的数据,单击下面的应用按钮,弹出IoT Item参数(新建标签的参数)设置对话框,此对话框中的参数保持默认即可,单击OK按钮,此时已完成了PLC数据在MQTT服务器中的发布。In the newly created Agent, click Add items (add a new label), select the data to be published in the opened tag browser, click the Apply button below, and the IoT Item parameter (parameter of the new label) setting dialog box will pop up. The parameters in this dialog box can be kept as default, click the OK button, and the publishing of PLC data in the MQTT server has been completed.

实施例5Example 5

如图3所示,本发明实施例提供的利用Node-RED实现PLC数据转换为JSON格式系统包括:As shown in Figure 3, the system provided by the embodiment of the present invention using Node-RED to convert PLC data into JSON format includes:

平台运行环境搭建模块1,用于搭建现场设备数据采集与传输的Node-RED平台运行环境,并运行;Platform operating environment building module 1, which is used to build the Node-RED platform operating environment for field device data collection and transmission, and run it;

实时数据采集模块2,用于利用OPC协议采集PLC子站的实时数据;Real-time data acquisition module 2, for utilizing OPC agreement to gather the real-time data of PLC sub-station;

数据转化模块3,用于利用OPC软件对数据进行转化并发布;The data conversion module 3 is used to convert and publish the data using OPC software;

发布数据接收模块4,用于利用Node-RED平台接收OPC软件的发布数据;Release data receiving module 4, for utilizing Node-RED platform to receive the release data of OPC software;

格式转换模块5,用于利用Node-RED平台把接收的数据转换为JSON格式。The format conversion module 5 is used to convert the received data into JSON format by using the Node-RED platform.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts that are not detailed or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.

上述装置/单元之间的信息交互、执行过程等内容,由于与本发明方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。The information interaction and execution process between the above-mentioned devices/units are based on the same idea as the method embodiment of the present invention, and its specific functions and technical effects can be found in the method embodiment section, and will not be repeated here.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Completion of modules means that the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present invention. For the specific working process of the units and modules in the above system, reference may be made to the corresponding process in the foregoing method embodiments.

二、应用实施例:2. Application examples:

应用例Application example

本发明实施例提供的利用Node-RED实现PLC数据转换为JSON格式的方法可应用于化工、冶金行业数据信息集中监控设备。进行废水污水的实时处理监控。The method for converting PLC data into JSON format by using Node-RED provided by the embodiment of the present invention can be applied to centralized monitoring equipment for data information in chemical and metallurgical industries. Real-time treatment and monitoring of wastewater and sewage.

本发明实施例提供了一种计算机设备,该计算机设备包括:至少一个处理器、存储器以及存储在所述存储器中并可在所述至少一个处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述任意各个方法实施例中的步骤。An embodiment of the present invention provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and operable on the at least one processor, and the processor executes the The steps in any of the above method embodiments are implemented when the computer program is described.

本发明实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时可实现上述各个方法实施例中的步骤。An embodiment of the present invention also provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.

本发明实施例还提供了一种信息数据处理终端,所述信息数据处理终端用于实现于电子装置上执行时,提供用户输入接口以实施如上述各方法实施例中的步骤,所述信息数据处理终端不限于手机、电脑、交换机。The embodiment of the present invention also provides an information data processing terminal, the information data processing terminal is used to provide a user input interface to implement the steps in the above-mentioned method embodiments when the information data processing terminal is implemented on an electronic device, the information data Processing terminals are not limited to mobile phones, computers, and switches.

本发明实施例还提供了一种服务器,所述服务器用于实现于电子装置上执行时,提供用户输入接口以实施如上述各方法实施例中的步骤。The embodiment of the present invention also provides a server, which is configured to provide a user input interface to implement the steps in the foregoing method embodiments when executed on an electronic device.

本发明实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行时可实现上述各个方法实施例中的步骤。An embodiment of the present invention provides a computer program product. When the computer program product is run on an electronic device, the electronic device can realize the steps in the foregoing method embodiments when executed.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random AccessMemory,RAM)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the method of the above-mentioned embodiments in the present application can be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. The computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program codes to the photographing device/terminal device, recording medium, computer memory, read-only memory (Read-Only Memory, ROM), random access memory (Random AccessMemory, RAM), electrical carrier signals, telecommunication signals, and software distribution media. Such as U disk, mobile hard disk, magnetic disk or optical disk, etc.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts that are not detailed or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.

三、实施例相关效果的证据:3. Evidence of the relevant effects of the embodiment:

某市经济技术开发区内某水厂开展智慧信息化建设,其目标是使用智慧大屏可视化技术实时在线展示数字孪生水厂。在智慧信息化建设过程中需要收集水厂厂区内各工段的PLC实时数据。由于现场PLC厂家不同,所以需要一种通用的通讯协议来采集不同的PLC厂家的实时数据,这时就用到了OPC通讯协议。按照本文所述方法,使用OPC通讯协议后,所有工段的设备使用情况和生产数据均能采集到智慧水厂服务器端。虽然PLC的实时数据已经采集完成,但智慧大屏可视化技术需要通过网页端实时在线展示数据,网页浏览器并不能直接从OPC通讯协议中获取PLC的实时数据,这时就需要利用Node-RED平台对OPC通讯协议采集的PLC实时数据进行格式的转换,转换为网页浏览器能够接收的通用数据格式——JSON格式。这时在网页浏览器端就可以直接在线显示水厂各工段PLC的设备使用情况和生产数据了。图4为采用此方法实施的智慧水厂可视化技术实时在线展示的生产数据情况效果图。A water plant in a city's economic and technological development zone is carrying out smart information construction, and its goal is to use the smart large-screen visualization technology to display the digital twin water plant online in real time. In the process of intelligent informatization construction, it is necessary to collect PLC real-time data of each section in the water plant. Due to the different PLC manufacturers on site, a common communication protocol is needed to collect real-time data from different PLC manufacturers. At this time, the OPC communication protocol is used. According to the method described in this article, after using the OPC communication protocol, the equipment usage and production data of all sections can be collected to the server of the smart water plant. Although the real-time data of the PLC has been collected, the smart large-screen visualization technology needs to display the data online in real time through the web page. The web browser cannot directly obtain the real-time data of the PLC from the OPC communication protocol. At this time, the Node-RED platform is needed. Convert the format of the PLC real-time data collected by the OPC communication protocol into a common data format that can be received by web browsers——JSON format. At this time, the equipment usage and production data of the PLC in each section of the water plant can be directly displayed online on the web browser. Figure 4 is an effect diagram of the real-time online display of production data of the smart water plant visualization technology implemented by this method.

以上所述,仅为本发明较优的具体的实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,都应涵盖在本发明的保护范围之内。The above is only a preferred specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any person familiar with the technical field is within the technical scope disclosed in the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles shall fall within the protection scope of the present invention.

Claims (10)

1.一种利用Node-RED实现PLC数据转换为JSON格式的方法,其特征在于,应用于信息数据处理终端,该方法包括以下步骤:1. A method utilizing Node-RED to realize PLC data conversion into JSON format, is characterized in that, being applied to information data processing terminal, the method may further comprise the steps: S1,搭建用于现场设备数据采集与传输的Node-RED平台运行环境,并运行;S1, build and run the Node-RED platform operating environment for field device data collection and transmission; S2,利用OPC协议采集PLC子站的实时数据;S2, using the OPC protocol to collect real-time data of the PLC sub-station; S3,利用OPC软件对步骤S2采集的实时数据进行转化并发布;S3, using OPC software to convert and publish the real-time data collected in step S2; S4,利用Node-RED平台接收OPC软件的发布数据;S4, using the Node-RED platform to receive the release data of the OPC software; S5,利用Node-RED平台把接收的发布数据转换为JSON格式,并利用Node-RED平台自带的数据调试节点对转换后的数据进行测试。S5, use the Node-RED platform to convert the received published data into JSON format, and use the data debugging node that comes with the Node-RED platform to test the converted data. 2.根据权利要求1所述的利用Node-RED实现PLC数据转换为JSON格式的方法,其特征在于,在步骤S1中,现场设备包括:PLC设备、流量计、压力表、温度表中的一种或多种。2. the method utilizing Node-RED to realize PLC data conversion into JSON format according to claim 1, it is characterized in that, in step S1, field equipment comprises: one in PLC equipment, flowmeter, pressure gauge, temperature gauge one or more species. 3.根据权利要求1所述的利用Node-RED实现PLC数据转换为JSON格式的方法,其特征在于,在步骤S1中,搭建用于现场设备数据采集与传输的Node-RED平台运行环境,并运行具体包括以下步骤:3. utilize Node-RED according to claim 1 to realize the method that PLC data is converted into JSON format, it is characterized in that, in step S1, set up the Node-RED platform operating environment that is used for field equipment data collection and transmission, and The operation specifically includes the following steps: (1)安装Node-RED平台运行环境:(1) Install the Node-RED platform operating environment: ①搜索并下载Node.msi软件安装包;①Search and download the Node.msi software installation package; ②在Node.msi软件安装包上,安装该软件;② Install the software on the Node.msi software installation package; ③使用管理员权限打开Windows系统的命令提示符;③ Open the command prompt of the Windows system with administrator privileges; ④复制代码npm config set registry http://registry.npmmirror.com到输入框中并运行该代码;④Copy the code npm config set registry http://registry.npmmirror.com into the input box and run the code; ⑤复制代码npminstall-g--unsafe-perm node-red pm2 pm2-windows-startup pm2-windows-service到输入框中并运行该代码;⑤ Copy the code npminstall-g--unsafe-perm node-red pm2 pm2-windows-startup pm2-windows-service into the input box and run the code; (2)使用CMD命令提示符运行Node-RED平台;(2) Use the CMD command prompt to run the Node-RED platform; ①开启Windows系统的命令提示符;① Open the command prompt of the Windows system; ②复制代码C:\Users\Administrator\AppData\Roaming\npm\node-red.cmd到输入框中并回车运行该代码。②Copy the code C:\Users\Administrator\AppData\Roaming\npm\node-red.cmd into the input box and press Enter to run the code. 4.根据权利要求1所述的利用Node-RED实现PLC数据转换为JSON格式的方法,其特征在于,在步骤S2中,利用OPC协议采集PLC子站的实时数据包括以下步骤:4. utilize Node-RED according to claim 1 to realize the method that PLC data is converted into JSON form, it is characterized in that, in step S2, utilize the real-time data of OPC agreement to gather PLC substation to comprise the following steps: 步骤1,建立数据采集通道;Step 1, establish a data collection channel; 步骤2,在新建的数据通道内新建PLC数据;Step 2, create new PLC data in the newly created data channel; 步骤3,测试数据的正确性。Step 3, test the correctness of the data. 5.根据权利要求1所述的利用Node-RED实现PLC数据转换为JSON格式的方法,其特征在于,在步骤S3中,利用OPC软件对数据进行转化并发布包括以下步骤:5. utilize Node-RED according to claim 1 to realize the method that PLC data is converted into JSON form, it is characterized in that, in step S3, utilize OPC software to convert data and publish and comprise the following steps: OPC软件通过IoT Gateway将采集的PLC数据转换为MQTT服务进行对外发布。The OPC software converts the collected PLC data into an MQTT service through the IoT Gateway for external release. 6.一种实现权利要求1-5任意一项所述利用Node-RED实现PLC数据转换为JSON格式的方法的利用Node-RED实现PLC数据转换为JSON格式系统,其特征在于,所述利用Node-RED实现PLC数据转换为JSON格式系统包括:6. a kind of realization claim 1-5 utilizes Node-RED to realize the method that PLC data is converted into JSON format and utilizes Node-RED to realize that PLC data is converted into JSON format system, it is characterized in that, described utilize Node -RED implements PLC data conversion into JSON format system includes: 语言运行环境搭建模块(1),用于搭建现场设备数据采集与传输的Node-RED平台运行环境,并运行;The language operating environment building module (1) is used to build the Node-RED platform operating environment for field device data collection and transmission, and run it; 实时数据采集模块(2),用于利用OPC协议采集PLC子站的实时数据;The real-time data acquisition module (2), is used for utilizing OPC agreement to gather the real-time data of PLC sub-station; 数据转化模块(3),用于利用OPC软件对数据进行转化并发布;Data transformation module (3), is used for utilizing OPC software to transform and release data; 发布数据接收模块(4),用于利用Node-RED平台接收OPC软件的发布数据;Release data receiving module (4), for utilizing Node-RED platform to receive the release data of OPC software; 格式转换模块(5),用于利用Node-RED平台把接收的数据转换为JSON格式。The format conversion module (5) is used to utilize the Node-RED platform to convert the received data into JSON format. 7.一种接收用户输入程序存储介质,其特征在于,所存储的计算机程序使电子设备执行权利要求1-5任意一项所述利用Node-RED实现PLC数据转换为JSON格式的方法。7. A program storage medium for receiving user input, characterized in that the stored computer program enables the electronic device to execute the method for converting PLC data into JSON format using Node-RED according to any one of claims 1-5. 8.一种计算机设备,其特征在于,所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行权利要求1-5任意一项所述利用Node-RED实现PLC数据转换为JSON格式的方法。8. A computer device, characterized in that the computer device comprises a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor performs claim 1 -A method for converting PLC data into JSON format using Node-RED as described in any item. 9.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时,使得所述处理器执行权利要求1-5任意一项所述利用Node-RED实现PLC数据转换为JSON格式的方法。9. A computer-readable storage medium, storing a computer program, characterized in that, when the computer program is executed by a processor, the processor is made to perform any one of claims 1-5 using Node-RED to achieve The method of converting PLC data to JSON format. 10.一种化工、冶金行业数据信息集中监控设备,其特征在于,所述化工、冶金行业数据信息集中监控设备实施权利要求1-5任意一项所述的利用Node-RED实现PLC数据转换为JSON格式的方法。10. A centralized monitoring device for data information in the chemical industry and metallurgical industry, characterized in that, the centralized monitoring device for data information in the chemical industry and metallurgical industry implements the use of Node-RED to realize PLC data conversion as described in any one of claims 1-5. method in JSON format.
CN202211540683.0A 2022-12-02 2022-12-02 Method, system and application for converting PLC data into JSON format Pending CN116095161A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211540683.0A CN116095161A (en) 2022-12-02 2022-12-02 Method, system and application for converting PLC data into JSON format

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211540683.0A CN116095161A (en) 2022-12-02 2022-12-02 Method, system and application for converting PLC data into JSON format

Publications (1)

Publication Number Publication Date
CN116095161A true CN116095161A (en) 2023-05-09

Family

ID=86207133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211540683.0A Pending CN116095161A (en) 2022-12-02 2022-12-02 Method, system and application for converting PLC data into JSON format

Country Status (1)

Country Link
CN (1) CN116095161A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109150703A (en) * 2018-08-23 2019-01-04 北方工业大学 A kind of intelligent cloud gateway for industrial Internet of things and its communication method
CN112769685A (en) * 2019-11-05 2021-05-07 中国科学院沈阳自动化研究所 Industrial gateway from UPC UA to MQTT and communication method thereof
CN113759815A (en) * 2021-08-03 2021-12-07 北京工业职业技术学院 IOTPLC processing platform of interconnected factory based on edge calculation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109150703A (en) * 2018-08-23 2019-01-04 北方工业大学 A kind of intelligent cloud gateway for industrial Internet of things and its communication method
CN112769685A (en) * 2019-11-05 2021-05-07 中国科学院沈阳自动化研究所 Industrial gateway from UPC UA to MQTT and communication method thereof
CN113759815A (en) * 2021-08-03 2021-12-07 北京工业职业技术学院 IOTPLC processing platform of interconnected factory based on edge calculation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
EMQX: "使用Node-RED处理MQTT数据", pages 1 - 4, Retrieved from the Internet <URL:https://blog.csdn.net/emqx_broker/article/details/124945140> *

Similar Documents

Publication Publication Date Title
CN108366067B (en) System and method for testing consistency of universal service protocol of power system
EP2460258B1 (en) Method and device for auto-generating goose signal connection topology from substation level
CN101262486B (en) Modbus bus analysis system based on built-in platform
US8726298B1 (en) Cloud-based instrument driver system
CN111343020A (en) Unified management method and device for multi-protocol Internet of things equipment
CN101963798B (en) Embedded rail transit station equipment information collection method
CN103227449B (en) A kind of protective device definite value Automatic Checking System
WO2011150715A1 (en) Method and device for collecting data of third-party equipment in distributed control system
CN118034673B (en) Visual editing generation and dynamic analysis system for equipment model of Internet of things
CN104053164A (en) Internet of things gateway testing system and method
Găitan et al. Modbus protocol performance analysis in a variable configuration of the physical fieldbus architecture
CN114020400A (en) A noVNC-based remote virtual simulation method, system, device and medium
WO2024140914A1 (en) Simulation platform and simulation method based on internet-of-things management system
CN119149429A (en) Method, device, equipment and medium for exporting code coverage rate data
CN106646105A (en) Data transmission method between main station and travelling wave range finding devices
CN118294809B (en) Linkage control method and system for battery detection equipment and external connection equipment
CN117234146B (en) A cloud-based PLC multi-protocol I/O device remote control method and system
CN114268650A (en) Configuration method and system for establishing communication connection
CN105407150A (en) Remote control method of application program
CN116095161A (en) Method, system and application for converting PLC data into JSON format
CN117118783A (en) Standardized data acquisition intelligent gateway adaptation system and device definition method
CN103905455A (en) Communication protocol platform and access method thereof
CN117812167A (en) Industrial protocol conversion gateway and protocol conversion method based on Python
CN114707905A (en) SG-CIM-based Internet of things terminal modeling and application method and system
CN110098991B (en) A device that connects the EtherCAT bus system to the general IoT cloud platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载