PLC program generation method and system
Technical Field
The invention relates to the field of programmable logic controllers, in particular to a program generation method and a program generation system of a programmable logic controller.
Background
A PLC (Programmable Logic Controller) is a new generation of industrial automation control device based on a microprocessor specifically designed for application in an industrial environment. It uses a programmable memory, in which the instructions for implementing logical operation, sequence control, timing, counting and arithmetic operation are stored, and utilizes digital or analog input and output to control various mechanical equipments or production processes.
When the PLC is programmed, the PLC program needs to be designed and adjusted accordingly according to the difference in the types and the number of the application objects. The PLC programming method needs a programmer to manually analyze and process the data of the application object, and the programming efficiency is not high; meanwhile, when the process parameters of the application object are changed, the corresponding process modification cannot be flexibly dealt with. Finally, there is also a problem of inconsistent specification execution among multiple programs.
Disclosure of Invention
Aiming at the problems in the existing PLC programming, the embodiment of the invention provides a PLC program generation method and a system, which can greatly improve the automation of PLC program programming and improve the efficiency of PLC program programming.
The PLC program generation method provided by the embodiment of the invention comprises the following steps:
a PLC program template manufacturing step: based on the common application object, a universal PLC program template of the common application object is made;
item reference file making: based on the target realized by the single project, a project benchmark file composed of the parameters of the single project is manufactured;
a PLC program source file generating step: importing the PLC program template and the project reference file into a PLC program generating tool, and generating a PLC program source file according to the selected PLC brand;
a PLC program generating step: and importing the PLC program source file into PLC programming software to generate a PLC program.
The PLC program generating method provided by the invention aims at the similarity of the control flow of the PLC on some common application objects and makes a corresponding PLC program template. And simultaneously, according to the target realized by a single project, a project benchmark file is manufactured. The PLC program template and the project benchmark file are simultaneously imported into a PLC program generating tool, a corresponding PLC brand is selected according to specific equipment needing to be executed by the PLC program, a PLC program source file is generated, and finally the PLC program source file is imported into PLC programming software to generate the PLC program for the PLC equipment to execute. The PLC program generation method provided by the invention can greatly improve the automation degree of PLC program generation, reduce the workload of programmers, improve the efficiency of PLC program programming and reduce the probability of manual errors in programming.
Preferably, before the PLC program source file generating step, the method further includes:
parameter adjustment: and adjusting the equipment parameters of each equipment on the PLC program generation tool according to the mutual influence relation existing among the equipment in the single project.
Wherein the single item parameter comprises: symbol table, equipment table and process flow diagram.
The equipment parameters of each equipment are adjusted on the PLC program generation tool according to the mutual influence relationship existing among the equipment before the PLC program source file is generated, so that the requirement of process modification can be met quickly, and the cost of design change is reduced. Meanwhile, the PLC program execution specification is unified in the PLC program programming process, so that the later equipment maintenance cost can be reduced.
The embodiment of the invention also provides a PLC program generating system, which comprises a PLC program template manufacturing module, a project benchmark file manufacturing module, a PLC program generating tool and PLC programming software, wherein the PLC program template manufacturing module and the project benchmark file manufacturing module are respectively connected with the PLC program generating tool;
the PLC program template making module is used for making a PLC program template which is universal for common application objects based on the common application objects;
the project benchmark file production module is used for producing a project benchmark file formed by single project parameters based on the target realized by the single project;
PLC program generation tool: the system comprises a PLC program template and a project reference file, wherein the PLC program template and the project reference file are used for importing a PLC program source file according to a selected PLC brand;
and the PLC programming software is used for importing a PLC program source file and generating a PLC program.
The PLC program generation system provided by the invention aims at the similarity of control processes of the PLC on some common application objects, and corresponding PLC program templates are manufactured through the PLC program templates. And simultaneously, according to the target realized by a single project, a project benchmark file is manufactured. The PLC program template and the project benchmark file are simultaneously imported into a PLC program generating tool, a corresponding PLC brand is selected according to specific equipment needing to be executed by the PLC program, a PLC program source file is generated, and finally the PLC program source file is imported into PLC programming software to generate the PLC program for the PLC equipment to execute. The PLC program generation method provided by the invention can greatly improve the automation degree of PLC program generation, reduce the workload of programmers, improve the efficiency of PLC program programming and reduce the probability of manual errors in programming.
Preferably, the PLC program generation tool includes a parameter adjustment module, configured to adjust device parameters of each device on the PLC program generation tool according to an interaction relationship existing between the devices in the single project.
Drawings
Fig. 1 is a schematic flow chart of a PLC program generation method in embodiment 1 of the present invention;
fig. 2 is a schematic flow chart of a preferred embodiment of a PLC program generating method according to embodiment 1 of the present invention;
FIG. 3 is a schematic diagram of a PLC program generation tool;
fig. 4 is a schematic structural diagram of a PLC program generation system in embodiment 2 of the present invention;
fig. 5 is a schematic structural diagram of a preferred embodiment of a PLC program generation system in embodiment 2 of the present invention.
In the drawings: 100. a PLC program template manufacturing module; 200. a project benchmark file making module; 300. a PLC program generation tool; 310. a parameter adjusting module; 400. PLC programming software.
Detailed Description
The present invention will be further described with reference to the accompanying drawings and the detailed description, and it should be noted that any combination of the embodiments or technical features described below can be used to form a new embodiment without conflict.
Example 1:
as shown in fig. 1, the PLC program generating method provided in the embodiment of the present invention includes the following steps:
PLC program template creation step S10: based on the common application object, a universal PLC program template of the common application object is made;
the program template is manufactured based on the program unit of the user common equipment; by way of example of a body-in-white welding line, common applications include: tens of units such as a cylinder control unit, a robot control unit, a safety door unit, a motor unit and a water vapor unit. The program template may vary from one user's common device to another. Classifying equipment needing PLC programming according to functions, and making a program template by a software tool in an auxiliary way according to the function classification;
project reference file creation step S20: based on the target realized by the single project, a project benchmark file composed of the parameters of the single project is manufactured;
the project benchmark file refers to a storage file of project data; the reference file contains all parameters for the production of a project program, including: project, workstation, name of equipment, quantity, model, IP address, associated equipment attributes, and the like. Analyzing all PLC program modules through PGS (program generation kit) software, extracting required equipment attributes, operating grammars and making reference files.
PLC program source file generating step S30: importing the PLC program template and the project reference file into a PLC program generating tool, and generating a PLC program source file according to the selected PLC brand;
the PLC program generation tool provided in the embodiment of the present invention can fill parameters such as the number of devices, device names, device attribute values, and action sequences of a project into a project reference file in a specific format according to the needs of an actual project, and the PGS reads the project reference file, and fills each parameter into a corresponding program module according to operation syntax (addition, replacement, selection, and the like) in the program module, thereby finally obtaining a PLC program source file.
PLC program generation step S40: and importing the PLC program source file into PLC programming software to generate a PLC program. In the step of importing the PLC program source file into the PLC programming software, all or part of the program source file may be imported as needed.
The PLC programming software can adopt the existing mature programming software, such as Siemens TIA Portal, Rockwell Studio 5000, ohm dragon CX-One and the like.
The PLC program generating method provided by the invention aims at the similarity of control processes of the PLC on some common application objects and manufactures a corresponding PLC program template. And simultaneously, according to the target realized by a single project, a project benchmark file is manufactured. The PLC program template and the project benchmark file are simultaneously imported into a PLC program generating tool, a corresponding PLC brand is selected according to specific equipment needing to be executed by the PLC program, a PLC program source file is generated, and finally the PLC program source file is imported into PLC programming software to generate the PLC program for the PLC equipment to execute. The PLC program generation method provided by the invention can greatly improve the automation degree of PLC program generation, reduce the workload of programmers, improve the efficiency of PLC program programming and reduce the probability of manual errors in programming.
Each project consists of different types and quantities of equipment, and the specific process flow of the project is different, so that designers need to collect project data. The individual project parameters include: symbol tables, equipment tables and process flow diagrams and robot tables.
The robot table is used for summarizing robot information of items, and comprises the following components: robot name, number, process (gripping, welding), interference zone, robot symbol table.
As shown in fig. 2, in a preferred embodiment of the PLC program generating method according to the present invention, before the PLC program source file generating step, the method further includes:
parameter adjustment step S31: and adjusting the equipment parameters of each equipment on the PLC program generation tool according to the mutual influence relation existing among the equipment in the single project.
The device parameters include: the project, the workstation, the name, the number, the model, the IP address, the associated equipment attribute, the process, etc. The usage scenario of the user may vary.
The equipment parameters are derived from project data, part of the equipment parameters can be imported through files, and the other part of the equipment parameters needs to be manually searched from the project data files and then manually filled in.
As shown in fig. 3, the PLC program generating tool 300 includes a symbol table item, a robot item, a PLC card item, a timing GRAPH item, and an attribute window editing item, and may display a parameter item in a project reference file, analyze the project reference file, and display device information of a project according to a device type.
The equipment parameters of each equipment are adjusted on the PLC program generation tool according to the mutual influence relationship existing among the equipment before the PLC program source file is generated, so that the requirement of process modification can be met quickly, and the cost of design change is reduced. Meanwhile, the PLC program execution specification is unified in the PLC program programming process, so that the later equipment maintenance cost can be reduced.
According to the PLC program generation method provided by the invention, the conventional method that project parameters are mainly analyzed and modified by engineers and programmers and are manually programmed is changed, automatic software programming can be realized by designing a PLC program template and manufacturing a project reference file, the PLC program generation efficiency is improved, and compared with the conventional programming method, the PLC program completion time is reduced from 170 hours to 70 hours on average, and the program generation efficiency is greatly improved.
The PLC program generation method provided by the invention has the following advantages:
1. the applicability is wide;
can adapt to PLC of multiple brands: siemens, rocwell, ohilong, mitsubishi;
the method can flexibly cope with different user use scenes by modifying the configuration table;
2. program version management
The version management of the PLC program can be realized, and the program difference of different versions is marked.
Example 2:
the embodiment of the invention also provides a PLC program generating system, which includes a PLC program template making module 100, a project reference file making module 200, a PLC program generating tool 300 and PLC programming software 400, wherein the PLC program template making module 100 and the project reference file making module 200 are respectively connected to the PLC program generating tool 300, and the PLC program generating tool 300 is connected to the PLC programming software 400;
a PLC program template creating module 100 for creating a PLC program template that is common to common application objects based on the common application objects;
a project benchmark file creation module 200, configured to create a project benchmark file composed of a single project parameter based on a target achieved by a single project;
PLC program creation tool 300: the system comprises a PLC program template and a project reference file, wherein the PLC program template and the project reference file are used for importing a PLC program source file according to a selected PLC brand;
and the PLC programming software 400 is used for importing a PLC program source file and generating a PLC program.
The PLC program generation system provided by the invention aims at the similarity of control processes of PLC on some common application objects and manufactures a corresponding PLC program template through the PLC program template 100. And simultaneously, according to the target realized by a single project, a project benchmark file is manufactured. The PLC program source file is generated by simultaneously importing the PLC program template and the project reference file into the PLC program generation tool 300, selecting a corresponding PLC brand for a specific device to be executed by the PLC program, and finally importing the PLC program source file into the PLC programming software 400, thereby generating the PLC program to be executed by the PLC device. The PLC program generation method provided by the invention can greatly improve the automation degree of PLC program generation, reduce the workload of programmers, improve the efficiency of PLC program programming and reduce the probability of manual errors in programming.
Preferably, the PLC program generating tool includes a parameter adjusting module 310, configured to adjust the device parameters of each device in the PLC program generating tool according to the interaction relationship existing between the devices in the single project.
The PLC program generation system according to the present invention is mainly used to implement the PLC program generation method according to embodiment 1. The same portions as those in embodiment 1 will not be described herein.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.