[go: up one dir, main page]

CN117742693A - System and method for automatically generating industrial equipment HMI interface based on PLC program - Google Patents

System and method for automatically generating industrial equipment HMI interface based on PLC program Download PDF

Info

Publication number
CN117742693A
CN117742693A CN202311872130.XA CN202311872130A CN117742693A CN 117742693 A CN117742693 A CN 117742693A CN 202311872130 A CN202311872130 A CN 202311872130A CN 117742693 A CN117742693 A CN 117742693A
Authority
CN
China
Prior art keywords
variable
plc
hmi
data
program
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
CN202311872130.XA
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.)
Hangzhou Dianzi University
Original Assignee
Hangzhou Dianzi University
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 Hangzhou Dianzi University filed Critical Hangzhou Dianzi University
Priority to CN202311872130.XA priority Critical patent/CN117742693A/en
Publication of CN117742693A publication Critical patent/CN117742693A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Programmable Controllers (AREA)

Abstract

本发明公开了一种基于PLC程序自动生成工业设备HMI界面的系统,其特征在于,包括:源代码获取单元,用于获取PLC设备运行程序的源代码;运行数据采集单元,用于获取PLC设备运行过程中的变量数据;数据处理单元,用于对获取的静态源代码和动态的变量数据进行数据处理得到变量基本信息并确定最佳匹配的控件类型;HMI代码生成单元,用于根据变量基本信息和控件类型信息,生成HMI代码进而生成HMI界面。采用本发明的技术方案,能够自动解析PLC程序,并根据程序中的变量历史值和代码逻辑生成对应的HMI界面,大大提高了界面开发的效率和自动化水平。

The invention discloses a system for automatically generating an industrial equipment HMI interface based on a PLC program. It is characterized in that it includes: a source code acquisition unit for obtaining the source code of the PLC equipment operating program; an operation data acquisition unit for obtaining the PLC equipment Variable data during operation; the data processing unit is used to process the obtained static source code and dynamic variable data to obtain the basic information of the variables and determine the best matching control type; the HMI code generation unit is used to process the obtained static source code and dynamic variable data according to the basic information of the variables. Information and control type information, generate HMI code and then generate HMI interface. The technical solution of the present invention can automatically analyze the PLC program and generate the corresponding HMI interface based on the historical values of variables and code logic in the program, which greatly improves the efficiency and automation level of interface development.

Description

System and method for automatically generating industrial equipment HMI interface based on PLC program
Technical Field
The invention relates to the field of industrial automation, in particular to a system and a method for automatically generating an industrial equipment HMI interface based on a PLC program.
Background
In the field of industrial automation, PLC (Programmable Logic Controller) is a digital computer device for implementing automatic control, typically for controlling a machine or a factory production line. To better control and monitor the internal conditions of the devices controlled by the PLC, it is often necessary to configure the corresponding HMI (Human Machine Interface) interface for the PLC program.
The traditional HMI interface development method is that engineers manually write corresponding interfaces for the PLC programs. In detail, writing an HMI interface for a PLC requires manual work according to the following procedure: dragging (configuring) a creation control, binding the control to a designated variable of a PLC program, and writing a page read-write data script; manually writing an HMI program is a complex and time-consuming process, especially when the number of variables, pages, increases, and the developer needs to repeatedly drag the control arrangement control layout and perform the variable binding operation. In the development process, a great deal of repeated work exists, misoperation is easy to occur when the variables are bound, and when the variable addresses of the PLC program change, the HMI program also needs to change correspondingly. Generally speaking, manually writing an HMI procedure is a cumbersome process that is time-consuming, labor-consuming, and difficult to maintain, and is not conducive to efficient and automation of industrial production.
Therefore, in order to solve the technical defects in the prior art, a solution is needed to solve the technical problems in the prior art.
Disclosure of Invention
In order to solve the problems, the invention provides a system and a method for automatically generating an industrial equipment HMI interface based on a PLC program, which can automatically analyze the PLC program and generate a corresponding HMI interface according to a variable history value and code logic in the program, thereby greatly improving the efficiency and the automation level of interface development.
In order to solve the problems existing in the prior art, the technical scheme of the invention is as follows:
a system for automatically generating an industrial equipment HMI interface based on a PLC program, comprising:
the source code acquisition unit is used for acquiring source codes of the running program of the PLC equipment;
the operation data acquisition unit is used for acquiring variable data in the operation process of the PLC equipment;
the data processing unit is used for carrying out data processing on the acquired static source codes and dynamic variable data to obtain variable basic information and determining the control type of the optimal matching;
and the HMI code generating unit is used for generating HMI codes according to the variable basic information and the control type information so as to generate an HMI interface.
As a further improvement, the operation data acquisition unit is an external monitoring script which periodically acquires variable values during the operation of the PLC program and stores the variable values in a database or file.
As a further improvement scheme, the data processing unit analyzes and determines the control type corresponding to the variable according to the collected variable history value and the PLC program source code; and executing a clustering algorithm in the data processing unit, clustering according to variable characteristics of the static PLC program source code and the dynamic variable history value, and outputting variable control types and control initialization parameters.
As a further improvement scheme, in the HMI code generation unit, according to the mapping from variable characteristics to control types and a predefined control template library, the control is generated, the control attribute is filled, the data source of the control is bound to the PLC variable address, and meanwhile, page logic processing and control layout XML files are automatically generated.
As a further improvement scheme, a clustering algorithm is executed in the data processing unit, variables with similar characteristics are divided into the same category, and uniform control types are allocated; the classification features comprise variable types, variable history value conditions, grammar structures, statement logic contexts and program comments, and the feature weights can be adjusted according to actual application and requirements so as to ensure optimal control type matching.
The invention also discloses a method for automatically generating the HMI interface of the industrial equipment based on the PLC program, which comprises the following steps:
step S1: acquiring a source code of a running program of the PLC equipment and variable data in the running process of the PLC equipment;
step S2: processing data according to the variable history value and the PLC program source code acquired in the step S1 and determining the control type corresponding to the variable;
step S3: and (3) based on the result of the step (S2), carrying out automatic code generation by combining with a preset template to obtain an HMI control and page layout code, and compiling and generating an HMI executable operation program.
As a further improvement, in step S1, a monitoring script is started to periodically collect variable data to form a data set D for a PLC program running in the PLC device:
D={d 1 ,d 2 ,…,d i }
wherein d i A set of all variable values for the ith acquisition period; and formats the data into JSON or XML text format for ease of processing and analysis.
As a further improvement, in step S2, static code analysis is performed based on the PLC program source code, and basic information of each variable is extracted, wherein a static analysis function a is defined s =S c For each variable v εS → A c Static analysis extracts its attribute a v Including data type, scope, and context information in the program:
a v =(type v ,scope v ,context v )
data type v Data type being variable;
scope v The scope range of the variable is divided into a block level, a function level and a global level;
context information context v The context of variables in the program, including module location, nesting level, and logic function;
performing dynamic analysis, and processing variable data D acquired from the running of the PLC program to obtain dynamic clustering characteristics, wherein the characteristics describe the behavior mode of the variables, and the dynamic clustering characteristics comprise:
D v =(frequency v ,trend v ,range v ,center v ,spread v )
wherein the frequency characteristic frequency v The method comprises the following steps: the frequency of the variable value change;
trend feature trend v The method comprises the following steps: trend of variation of the variable over time;
trend value set range v The method comprises the following steps: a range of variation of the variable;
cluster center v The method comprises the following steps: in cluster analysis, the center point of variable data distribution;
distribution range spread v The method comprises the following steps: the distribution range or variance of variable data in the clusters.
As a further development, in step S2, the static and dynamic features D are combined v And a v Classifying the variables by using a clustering algorithm C to determine the proper control types of the variables;
merging static attributes a v And dynamic characteristics D v Construction of a feature vector f v Wherein, the method comprises the steps of, wherein,linking operations representing feature vectors:
f v =(type v ,scope v ,context v ,frequency v ,trend v ,range v ,center v ,spread v )
the clustering algorithm C is based on the feature vector f v Providing clustering of each variable v to determine the most appropriate control type t for the variable i
C v =Cluster(f v )
Clustering result C v For a series of statistics describing the distribution of historical values of variables, each cluster center or cluster represents a set of variables with similar characteristics that are best suited for a particular type of control, the cluster center or cluster corresponding to a different type of control.
As a further improvement scheme, a K-means clustering algorithm is adopted, and the process of obtaining the variable control type is expressed as an iterative process:
where k is the number of clusters, S i Is the ith cluster, mu i Is S i Is defined by a center point of (2); through the processing of a clustering algorithm without supervision learning, a plurality of categories t are obtained through the division of static characteristics and dynamic characteristics i The same category will be assigned and mapped to the same control type.
As a further improvement, in step S1, the monitoring script may be written by Python or Lua, and run on an external device (such as an industrial personal computer), and communicate with the PLC through a network protocol (such as Modbus, UDP, OPC, etc.), and periodically obtain real values of all variables in the program, and store the real values in a database or a file in a text format such as JSON, XML, etc., so as to facilitate subsequent analysis and use.
As a further improvement, in step S1, the real-time variable value, that is, the variable value result in the running process of the PLC program, is communicated with the PLC by the monitoring script in a preset period (much longer than the running period of the PLC), and is collected by the communication protocol supported by the PLC.
As a further development, in step S1, the PLC program is a text language (instruction sheet, structured text) or a graphic table (ladder diagram, functional block, sequential functional flow diagram) conforming to IEC61131-3, and the PLC program is five programming languages (FBD (Function Block Diagram), LD (Ladder Diagram), ST (Structured Text), SFC (Sequential Function Chart), IL (Instruction List)) based on the IEC61131-3 standard. The graphical form is parsed and marked to convert it into an equivalent XML text representation.
In step S2, the input of the variable analysis model is the static PLC program source code and the dynamic variable history value, the output is the variable control type and the control initialization parameter, and the model algorithm mainly includes but is not limited to the clustering algorithms such as K-means, hierarchical clustering, mean shift, etc.
As a further improvement scheme, in step S2, the model algorithm clusters according to the variable characteristics, classifies the variables with similar characteristics into the same category, and allocates uniform control types; classification features including, but not limited to, variable type, variable history value case, grammar structure, sentence logic context, and program annotation, feature weights can be adjusted according to actual application and requirements to ensure optimal control type matching.
As a further improvement, in step S3, the automatic code generation involves: generating HMI program source codes according to a predefined control template library by the system; the method mainly comprises control parameters, data synchronization logic and UI component layout, and is used for filling the control attributes and binding the control attributes to variable addresses.
As a further improvement, in step S3, the manual verification involves writing operation, that is, manually reviewing the control variable address and variable type related to writing operation in the data synchronization code, so as to ensure that the writing operation logic of the PLC meets the expectations.
Compared with the prior art, the invention has the beneficial effects that:
1. the analysis and understanding of the PLC program are realized, and the control types corresponding to the variables are obtained through automatic analysis. Starting from the static source code layers of the five PLC programs and the real values of the variables in the dynamic running process, analyzing the variables through a clustering algorithm, and thus obtaining the appropriate control corresponding to the variables;
2. the method has the advantages that the variable bound with the control is automatically generated, the situation of address binding errors is avoided, manual intervention can be effectively reduced, and the accuracy of HMI program development is improved;
3. automatic code generation is introduced, an HMI program is automatically generated aiming at the control code, the HMI program can be used as a semi-automatic HMI program development method, and the development of the HMI program is rapidly completed by combining manual correction, so that the development efficiency is greatly improved.
Drawings
For a clearer description of embodiments of the invention or of the solutions of the prior art, the drawings that are used in the description of the embodiments or of the prior art will be briefly described, the drawings in the description that follow are merely examples of embodiments of the invention, from which, to a person skilled in the art, further drawings can be obtained:
FIG. 1 is a schematic diagram of a system for automatically generating an HMI interface of an industrial device based on a PLC program according to the present invention;
FIG. 2 is a flow chart of a method for automatically generating an HMI interface of an industrial device based on a PLC program according to the present invention;
fig. 3 is a block diagram of a method for automatically generating an HMI interface for an industrial equipment based on a PLC program.
Detailed Description
The technical scheme of the invention is described in detail below with reference to the accompanying drawings and the specific embodiments.
Referring to fig. 1, a schematic diagram of a system for automatically generating an HMI interface of an industrial apparatus based on a PLC program according to the present invention is shown, including:
the source code acquisition unit is used for acquiring source codes of the running program of the PLC equipment;
the operation data acquisition unit is used for acquiring variable data in the operation process of the PLC equipment;
the data processing unit is used for carrying out data processing on the acquired static source codes and dynamic variable data to obtain variable basic information and determining the control type of the optimal matching;
and the HMI code generating unit is used for generating HMI codes according to the variable basic information and the control type information so as to generate an HMI interface.
In the above technical scheme, the operation data acquisition unit is an external monitoring script, and the script periodically acquires the variable value during the operation of the PLC program and stores the variable value in a database or a file.
The data processing unit analyzes and determines the control type corresponding to the variable according to the collected variable history value and the PLC program source code; and executing a clustering algorithm in the data processing unit, clustering according to variable characteristics of the static PLC program source code and the dynamic variable history value, and outputting variable control types and control initialization parameters.
And in the HMI code generation unit, generating a control and a page layout code according to the mapping of the variable characteristics to the control types and a predefined template, filling the attribute of the control, binding the control to a corresponding variable address, and automatically generating an XML layout file of the page layout and the control code, the component layout and the logic processing part of the HMI.
Executing a clustering algorithm in the data processing unit, dividing variables with similar characteristics into the same category, and distributing uniform control types; the classification features comprise variable types, variable history value conditions, grammar structures, statement logic contexts and program comments, and the feature weights can be adjusted according to actual application and requirements so as to ensure optimal control type matching.
Referring to fig. 2 and 3, the embodiment provides a method for automatically generating an HMI interface of an industrial device based on a PLC program, which specifically includes the following steps:
step S1: acquiring a source code of a running program of the PLC equipment and variable data in the running process of the PLC equipment;
step S2: processing data according to the variable history value and the PLC program source code acquired in the step S1 and determining the control type corresponding to the variable;
step S3: and (3) based on the result of the step (S2), carrying out automatic code generation by combining with a preset template to obtain an HMI control and page layout code, and compiling and generating an HMI executable operation program.
The specific steps are as follows:
s1: PLC data acquisition and storage
And running the PLC program and starting the monitoring script. The monitoring script is set to collect data every 100 milliseconds (Δt=1000 ms) as a period. The script is written by using Python, PLC variable data is obtained through an Ethernet UDP protocol, the script is configured to obtain variable data in the PLC once every 1000ms, 3600s are continuously collected, and a data set D is formed:
D={d 1 ,d 2 ,…,d i }
wherein d i Is the set of all variable values in the ith acquisition period. These data are then formatted into JSON or XML text format for ease of processing and analysis.
S2: PLC variable analysis and clustering
The variable analysis and clustering need to consider both static code analysis and dynamic variable history values.
The static code analysis is based on analysis of the source code of the PLC program, and basic information of each variable is extracted. And directly extracting various variable attributes for text engineering (instruction list and structured text), and directly extracting the text engineering (functional blocks and ladder diagram) after converting the text engineering (functional blocks and ladder diagram) into equivalent XML text expression by corresponding standards. Definition of the static analysis function A s =S c For each variable v εS → A c Static analysis can extract its attribute a v Including data type, scope, context information in the program, etc.:
a v =(type v ,scope v ,context v )
1. data type (type) v ): the data type of the variable, such as integer, floating point, boolean, character;
2. scope (scope) v ): scope ranges of variables, such as block level, function level, global level;
3. context information (context) v ): the context of variables in a program, such as at module location, nested levels, logic functions.
The dynamic analysis fully utilizes variable data D acquired from the running of the PLC program, and dynamic clustering features are obtained through processing, and describe the behavior modes of the variables, and the dynamic clustering features comprise:
D v =(frequency v ,trend v ,range v ,center v ,spread v )
1. frequency characteristics (frequency v ): the frequency of the variable value change;
2. trend feature (trend) v ): trend of variation over time, such as gradual increase, decrease or periodic variation;
3. trend value set (range) v ): the variable range, the maximum and minimum value, the value with the largest occurrence number and the average value of the variables;
4. clustering center (center) v ): in the process of aggregationIn class analysis, the center point of variable data distribution;
5. distribution range (spread) v ): the distribution range or variance of variable data in the clusters.
Clustering algorithm combines static and dynamic features D v And a v And classifying the variables by using a clustering algorithm C so as to determine the proper control types of the variables. The process is completed through various clustering algorithms, such as K-means clustering, hierarchical clustering or mean shift clustering, and the selection of the clustering algorithms can be determined according to the distribution characteristics of variable data and actual requirements.
Merging static attributes a v And dynamic characteristics D v Construction of a feature vector f v Wherein, the method comprises the steps of, wherein,linking operations representing feature vectors:
f v =(type v ,scope v ,context v ,frequency v ,trend v ,range v ,center v ,spread v )
the clustering algorithm C is based on the feature vector f v Providing clustering for each variable v, and determining the most suitable control type t of the variable i
C v =Cluster(f v )
Clustering result C v There may be a series of statistics describing the distribution of historical values of the variables, such as a cluster center, distance measure, or number of clusters, each cluster representing a set of variables with similar characteristics that are best suited for a particular type of control, the cluster center or cluster may correspond to different types of controls, such as a slider, switch button, text entry box, numeric dial, etc. generic controls.
In detail, the process of obtaining variable control types by the K-means clustering algorithm can be expressed as an iterative process:
where k is the number of clusters, S i Is the ith cluster, mu i Is S i Is defined by a center point of the lens. Through the processing of the cluster algorithm without supervision learning, a plurality of categories t can be obtained through the division of static characteristics and dynamic characteristics i The same category will be assigned and mapped to the same control type. For example: frequently changing digital analog values are mapped to digital text boxes, while boolean variables are mapped to switch controls, and readings from one temperature sensor may be mapped to a dashboard control with real-time updates, with a set of multiple temperature output values in the same function block mapped as a graph of curve data.
In general, through the static code structure and the dynamic value condition of the variable, similar variable characteristics are extracted according to the historical change frequency, the historical value mean value, the maximum value, the type and the logic context of the variable, and the HMI control type corresponding to the variable is obtained.
S3: HMI automatic code generation
After the variable basic information and the control type information are obtained, the system generates the control and page layout codes according to the mapping from the variable to the control type and the predefined template M according to the preset template. And filling the control attribute, binding the control to the corresponding variable address, and automatically generating the page layout of the HMI and the XML layout file of the control codes, the component layout and the necessary logic processing part.
After the code is generated, an additional safety check step is needed, and an engineer checks the control with the writing operation which possibly affects the safety of the equipment to prevent improper operation from affecting the running or safety of the equipment, such as an input box for setting the temperature and the on-off switching value of an on-site important switch. After the checking and necessary adjustment are completed, the codes are compiled into a final HMI executable operation interface which can be deployed on the touch equipment for operators to use.
By the method, the HMI interface synchronous with the PLC program can be systematically and efficiently created, the early version PLC project can be greatly convenient for a developer to be compatible, the HMI program for monitoring can be quickly manufactured, the development efficiency is improved, and meanwhile, the operation safety and the data consistency are ensured.
The above description of the embodiments is only for aiding in the understanding of the method of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1.一种基于PLC程序自动生成工业设备HMI界面的系统,其特征在于,包括:1. A system that automatically generates HMI interfaces for industrial equipment based on PLC programs, which is characterized by including: 源代码获取单元,用于获取PLC设备运行程序的源代码;The source code acquisition unit is used to obtain the source code of the PLC equipment running program; 运行数据采集单元,用于获取PLC设备运行过程中的变量数据;Operation data acquisition unit is used to obtain variable data during the operation of PLC equipment; 数据处理单元,用于对获取的静态源代码和动态的变量数据进行数据处理得到变量基本信息并确定最佳匹配的控件类型;The data processing unit is used to perform data processing on the obtained static source code and dynamic variable data to obtain the basic information of the variables and determine the best matching control type; HMI代码生成单元,用于根据变量基本信息和控件类型信息,生成HMI代码进而生成HMI界面。The HMI code generation unit is used to generate HMI code and then generate an HMI interface based on basic variable information and control type information. 2.根据权利要求1所述的基于PLC程序自动生成工业设备HMI界面的系统,其特征在于,运行数据采集单元为外部监控脚本,该脚本周期性采集PLC程序运行期间的变量值,并将其存储在数据库或文件中。2. A system for automatically generating industrial equipment HMI interfaces based on PLC programs according to claim 1, characterized in that the operating data collection unit is an external monitoring script, which periodically collects variable values during the operation of the PLC program and collects them. Stored in a database or file. 3.根据权利要求2所述的基于PLC程序自动生成工业设备HMI界面的系统,其特征在于,数据处理单元根据采集的变量历史值和PLC程序源码,分析并确定变量对应的控件类型;其中,数据处理单元中执行聚类算法,根据静态PLC程序源代码及动态变量历史值得到变量特征以及进行聚类,输出变量控件类型和控件初始化参数。3. A system for automatically generating industrial equipment HMI interfaces based on PLC programs according to claim 2, characterized in that the data processing unit analyzes and determines the control type corresponding to the variable based on the collected historical variable values and PLC program source code; wherein, The clustering algorithm is executed in the data processing unit, variable characteristics are obtained and clustered based on the static PLC program source code and dynamic variable history values, and the variable control type and control initialization parameters are output. 4.根据权利要求3所述的基于PLC程序自动生成工业设备HMI界面的系统,其特征在于,HMI代码生成单元中,根据变量特征到控件类型的映射以及预定义的控件模板库,生成控件并填充控件属性,将其数据源绑定到PLC变量地址上,同时自动生成页面逻辑处理和控件布局XML文件。4. A system for automatically generating industrial equipment HMI interfaces based on PLC programs according to claim 3, characterized in that, in the HMI code generation unit, controls are generated according to the mapping of variable characteristics to control types and the predefined control template library. Fill in the control properties, bind its data source to the PLC variable address, and automatically generate page logic processing and control layout XML files. 5.根据权利要求3所述的基于PLC程序自动生成工业设备HMI界面的系统,其特征在于,数据处理单元中执行聚类算法,将具有相似特征的变量划分为同一类别,并分配统一的控件类型;分类特征包括变量类型、变量历史值情况、语法结构、语句逻辑上下文和程序注释,各特征权重能够根据实际应用和需求进行调整,以确保最佳的控件类型匹配。5. The system for automatically generating industrial equipment HMI interfaces based on PLC programs according to claim 3, characterized in that a clustering algorithm is executed in the data processing unit to divide variables with similar characteristics into the same category and assign unified controls. Type; classification features include variable type, variable historical value, grammatical structure, statement logic context and program comments. The weight of each feature can be adjusted according to actual applications and needs to ensure the best control type matching. 6.一种基于PLC程序自动生成工业设备HMI界面的方法,其特征在于,包括以下步骤:6. A method for automatically generating an industrial equipment HMI interface based on a PLC program, which is characterized by including the following steps: 步骤S1:获取PLC设备运行程序的源代码以及获取PLC设备运行过程中的变量数据;Step S1: Obtain the source code of the PLC equipment running program and obtain the variable data during the operation of the PLC equipment; 步骤S2:根据步骤S1中采集的变量历史值和PLC程序源码,对数据进行处理并确定变量对应的控件类型;Step S2: Process the data and determine the control type corresponding to the variable based on the historical variable values and PLC program source code collected in step S1; 步骤S3:基于步骤S2的结果,结合预设模板进行自动代码生成,得到HMI控件和页面布局代码,并编译生成HMI可执行操作程序。Step S3: Based on the results of step S2, perform automatic code generation combined with the preset template to obtain the HMI control and page layout code, and compile and generate an HMI executable operating program. 7.根据权利要求6所述的基于PLC程序自动生成工业设备HMI界面的方法,其特征在于,步骤S1中,启动监控脚本对PLC设备中运行的PLC程序进行周期采集变量数据形成数据集D:7. The method of automatically generating an industrial equipment HMI interface based on a PLC program according to claim 6, characterized in that, in step S1, a monitoring script is started to periodically collect variable data of the PLC program running in the PLC equipment to form a data set D: D={d1,d2,…,di}D={d 1 ,d 2 ,…,d i } 其中,di为第i次采集周期内的所有变量值的集合;并将数据格式化为JSON或XML文本格式以方便处理和分析。Among them, di is the set of all variable values in the i-th collection cycle; and the data is formatted into JSON or XML text format to facilitate processing and analysis. 8.根据权利要求7所述的基于PLC程序自动生成工业设备HMI界面的方法,其特征在于,步骤S2中,基于PLC程序源代码执行静态代码分析,提取各变量基本信息,其中,定义静态分析函数As=Sc→A,对于每个变量v∈Sc,静态分析提取其属性av,包括数据类型、作用域范围和程序中的上下文信息:8. The method of automatically generating an industrial equipment HMI interface based on a PLC program according to claim 7, characterized in that, in step S2, static code analysis is performed based on the PLC program source code to extract basic information of each variable, wherein static analysis is defined Function A s = Sc → A, for each variable v ∈ S c , static analysis extracts its attributes a v , including data type, scope and context information in the program: av=(typev,scopev,contextv)a v = (type v , scope v , context v ) 数据类型typev为变量的数据类型;Data type type v is the data type of the variable; 作用域范围scopev为变量的作用域范围,分为块级、函数级和全局级;Scope scope scope v is the scope scope of the variable, which is divided into block level, function level and global level; 上下文信息contextv为变量在程序中的上下文,包括模块位置、嵌套层级和逻辑功能;The context information context v is the context of the variable in the program, including module location, nesting level, and logical function; 执行动态分析,利用从PLC程序运行时采集的变量数据D,经过处理得到动态聚类特征,该特征描述了变量的行为模式,包括:Perform dynamic analysis and use the variable data D collected from the running time of the PLC program to obtain dynamic clustering features after processing. This feature describes the behavior pattern of the variables, including: Dv=(frequencyv,trendv,rangev,centerv,spreadv)D v = (frequency v , trend v , range v , center v , spread v ) 其中,频率特征fequencyv为:变量值变化的频率;Among them, the frequency characteristic fequency v is: the frequency of variable value changes; 趋势特征trendv为:变量随时间的变化趋势;The trend characteristic trend v is: the changing trend of variables over time; 趋势值集合rangev为:变量的变化范围;The trend value set range v is: the range of change of the variable; 聚类中心centerv为:在聚类分析中,变量数据分布的中心点;The cluster center center v is: in cluster analysis, the center point of variable data distribution; 分布范围spreadv为:变量数据在聚类中的分布范围或方差。The distribution range spread v is: the distribution range or variance of the variable data in the cluster. 9.根据权利要求8所述的基于PLC程序自动生成工业设备HMI界面的方法,其特征在于,步骤S2中,结合静态和动态特征Dv和av,使用聚类算法C对变量进行分类,以确定变量合适的控件类型;9. The method of automatically generating an industrial equipment HMI interface based on a PLC program according to claim 8, characterized in that in step S2, a clustering algorithm C is used to classify variables in combination with static and dynamic features D v and a v , To determine the appropriate control type for the variable; 合并静态属性av和动态特征Dv构造特征向量fv,其中,表示特征向量的链接操作:Merge the static attributes a v and the dynamic features D v to construct the feature vector f v , where, Represents the link operation of feature vectors: fv=(typev,scopev,contextv,frequencyv,trendv,rangev,centerv,spreadv)f v = (type v ,scope v ,context v ,frequency v ,trend v ,range v ,center v ,spread v ) 聚类算法C依据特征向量fv提供对每个变量v进行聚类,以确定变量最合适的控件类型tiThe clustering algorithm C provides clustering of each variable v based on the feature vector f v to determine the most appropriate control type ti for the variable: Cv=Cluster(fv)C v =Cluster(f v ) 聚类结果Cv为一系列描述变量历史值分布的统计量,每个聚类中心或簇代表一组具有相似特征的变量,这些特征最适合于特定类型的控件,聚类中心或簇对应不同类型的控件。The clustering result C v is a series of statistics describing the distribution of historical values of variables. Each cluster center or cluster represents a group of variables with similar characteristics. These characteristics are most suitable for specific types of controls. The cluster centers or clusters correspond to different type of control. 10.根据权利要求9所述的基于PLC程序自动生成工业设备HMI界面的方法,其特征在于,采用K均值聚类算法,获得变量控件类型的过程表示为迭代过程:10. The method of automatically generating an industrial equipment HMI interface based on a PLC program according to claim 9, characterized in that, using a K-means clustering algorithm, the process of obtaining variable control types is expressed as an iterative process: 其中k是聚类的数量,Si是第i个聚类,μi是Si的中心点;经过无监督学习的聚类算法处理,通过静态特征和动态特征划分得到多个类别ti,相同的类别将会被分配映射为同样的控件类型。where k is the number of clusters, S i is the i-th cluster, μ i is the center point of S i ; after processing by the clustering algorithm of unsupervised learning, multiple categories t i are obtained by dividing static features and dynamic features, The same category will be assigned and mapped to the same control type.
CN202311872130.XA 2023-12-30 2023-12-30 System and method for automatically generating industrial equipment HMI interface based on PLC program Pending CN117742693A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311872130.XA CN117742693A (en) 2023-12-30 2023-12-30 System and method for automatically generating industrial equipment HMI interface based on PLC program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311872130.XA CN117742693A (en) 2023-12-30 2023-12-30 System and method for automatically generating industrial equipment HMI interface based on PLC program

Publications (1)

Publication Number Publication Date
CN117742693A true CN117742693A (en) 2024-03-22

Family

ID=90259284

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311872130.XA Pending CN117742693A (en) 2023-12-30 2023-12-30 System and method for automatically generating industrial equipment HMI interface based on PLC program

Country Status (1)

Country Link
CN (1) CN117742693A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118981183A (en) * 2024-08-06 2024-11-19 哈尔滨宇龙自动化有限公司 A method and system for linking numerical values and scripts based on HMI

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118981183A (en) * 2024-08-06 2024-11-19 哈尔滨宇龙自动化有限公司 A method and system for linking numerical values and scripts based on HMI

Similar Documents

Publication Publication Date Title
EP3217238B1 (en) Automation control system point configuration from controller program files
US9354629B2 (en) Methods and apparatus to configure a process control system using an electronic description language script
KR102553315B1 (en) Program generating device, control method of program generating device, control program, and recording medium
CN113168564A (en) Method and system for generating artificial intelligence model
CN115053209B (en) Method and system for generating engineering drawings in engineering system
US20250085700A1 (en) Generative ai for industrial automation design environment
EP4550116A1 (en) Plc program generator/copilot using generative ai
CN117742693A (en) System and method for automatically generating industrial equipment HMI interface based on PLC program
CN115202636A (en) Programming system of programmable logic controller
CN111475159B (en) A method, device and storage medium for automatically generating programs
CN118113269A (en) Method, device, equipment and storage medium for generating intelligent industrial control program
US20200387132A1 (en) Configuring and building an automation system to perform rule-based transformations on complex technical systems
CN115185238B (en) Method for converting ICC configuration of nuclear power station DCS system into IEE graphical configuration
CN119357632B (en) Method and device for automatically generating drawings combining multi-dimensional integration of project information
Schütz et al. MDE of manufacturing automation software—Integrating SysML and standard development tools
CN119557940A (en) An interactive nuclear system automatic modeling system and method
US20240354062A1 (en) Method and system for generating automation domain objects using knowledge from another automation domain object
Runde et al. EDDL and semantic web—From field device integration (FDI) to Future Device Management (FDM)
Paganus et al. Automatic generation of dynamic simulation models based on standard engineering data
CN103177064A (en) Method for admitting appointed content of electronic document automatically
KR102851699B1 (en) AI based PLC-code automatic generation system and method
US20220342376A1 (en) Apparatus and method for extracting common command information from plc ladder information
US20250298586A1 (en) Integrated design environment in-line generative ai code editor
CN120745341B (en) A method and system for intelligent calculation and prediction of springback in hyperbolic aluminum plates
EP4621555A1 (en) Integrated design environment in-line generative ai code editor

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