CN103123598B - Online debugging implementation method of compiling soft programmable logic controller (PLC) - Google Patents

Online debugging implementation method of compiling soft programmable logic controller (PLC) Download PDF

Info

Publication number
CN103123598B
CN103123598B CN201110369506.6A CN201110369506A CN103123598B CN 103123598 B CN103123598 B CN 103123598B CN 201110369506 A CN201110369506 A CN 201110369506A CN 103123598 B CN103123598 B CN 103123598B
Authority
CN
China
Prior art keywords
plc
program
management module
breakpoint
interface
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.)
Active
Application number
CN201110369506.6A
Other languages
Chinese (zh)
Other versions
CN103123598A (en
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.)
Shenyang Institute of Computing Technology of CAS
Original Assignee
Shenyang Institute of Computing Technology of CAS
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 Shenyang Institute of Computing Technology of CAS filed Critical Shenyang Institute of Computing Technology of CAS
Priority to CN201110369506.6A priority Critical patent/CN103123598B/en
Publication of CN103123598A publication Critical patent/CN103123598A/en
Application granted granted Critical
Publication of CN103123598B publication Critical patent/CN103123598B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Programmable Controllers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the field of industrial automatic control, in particular to an Online debugging implementation method of a compiling soft programmable logic controller (PLC). A ladder diagram translator program translates PLC ladder diagrams into a high-level language program of a special structure and calls a high-level language compiler to generate an executable module in a compiling mode, and the executable module waits for calling of a PLC operation management module; the PLC operation management module dynamically calls the executable module generated in the compiling mode; a debugging interface is added to a PLC editing interface for man-machine interaction; and the PLC operation management module dynamically executes the program in the ladder diagrams according to information contained in the ladder diagrams in the high-level language executable module and interface operation information transmitted from the man-machine interaction debugging interface. Due to the method, the compiling soft PLC can be enabled to have the online debugging functions of adding breakpoints and single-step execution, and the soft PLC with the online debugging functions has higher efficiency in engineering development.

Description

A kind of on-line debugging implementation method compiling type Soft-PLC
Technical field
The present invention relates to field of industrial automatic control, particularly a kind of on-line debugging implementation method compiling type Soft-PLC.
Background technology
Along with industrial expansion, PLC is widely used at automation field owing to himself having able to programme and features such as programming language is general, modularization, reusable.
Trapezoid figure language is one of five kinds of language defined in IEC61131-3 standard.And due to it has programmed symbol can be corresponding with electrical equipment symbol, so become electrical engineers and the most familiar the most frequently used a kind of PLC programming language of mechanical engineer.
The program of PLC performs in the cycle, and for traditional trapezoid figure language, it does not have the debug function the same with higher level lanquage such as C language.Program debug personnel must by monitoring the situation that the condition adjudgement program of key point performs, if be designed with discrepancy and again must rerun debugging by coding.This not only makes the difficulty of program debug and workload very large, also makes increase the performance period of whole engineering.
In order to improve the efficiency of PLC program debug, need the debug function making it have the high-level programming languages such as similar C language, as arranged breakpoint, single step execution etc., to facilitate correct trend and the state of determining program in the debug process of program.
Summary of the invention
Cannot dynamically carry out the weak point of debugging when performing for existing PLC program, the technical problem to be solved in the present invention is to provide and a kind ofly can realizes PLC trapezoid figure program can realize the debug function of similar higher level lanquage compiling implement method when performing.
The technical scheme that the present invention is adopted for achieving the above object is: a kind of on-line debugging implementation method compiling type Soft-PLC, comprises the following steps:
Step 1: PLC ladder diagram is translated into the high-level language programs with special construction by ladder diagram translation program, and call Advanced Compiler Tools compiling generation executable module, wait for that PLC operation management module is called;
The executable module that step 2:PLC operational management module dynamic call compiling generates;
Step 3: increase Debugging interface at PLC editing interface and be used for carrying out man-machine interaction;
Step 4:PLC operational management module according to trapezoid figure program in higher level lanquage executable module with information and the man-machine interaction Debugging interface transmission interface operation information of coming in perform program in ladder diagram dynamically.
Described step 1 is specially: use ladder diagram translation program trapezoid figure program to be translated into each trapezoid figure program behavior higher level lanquage function; Define a kind of data structure to comprise a function pointer variable and represent the entry address of the higher level lanquage function of a line trapezoid figure program and a variable and represent this row and whether there is breakpoint; Ladder diagram translation program defines an above-mentioned one-dimentional structure body array according to the line number of ladder diagram, and the membership of this array is the line number of ladder diagram; Generate higher level lanquage configurator by the function entrance address variable in each element being written in Array for structural body as described above with the entry address of the capable corresponding higher level lanquage function of trapezoid figure program successively of generating; To whether be filled up in the breakpoint information variable in this row Array for structural body element with breakpoint information.
Described PLC operation management module obtains the first address of the function structure array represented in PLC logical program higher level lanquage executable module by communication modes; And according to the position of element in this structural array, i.e. the capable top-down order of trapezoid figure program executive routine successively; PLC operation management module and PLC human-computer interaction interface carry out the mutual of running state information.
Described man-machine interaction Debugging interface has the function of adding breakpoint after trapezoid figure program is capable; The breakpoint information of interpolation is sent to PLC operation management module by communication mode; There are single step run pattern and continuous operation mode two kinds of patterns, can switch under two states dynamically; The request that user continues to run can be responded, by this request notice PLC operation management module, and process the state that operational management program returns.
The reciprocal process of described PLC operation management module and PLC man-machine interaction Debugging interface is:
Current is single step run pattern, and single step executing state signal of communication is set to single step state by human-computer interaction interface;
PLC operation management module each only execution trapezoid figure program under single step run state is capable;
After pressing operation button, running status signal of communication is set to running status by human-computer interaction interface;
After PCL operational management program sees this state, continue to perform downwards a trapezoid figure program capable, and operation is completed signal of communication be set to;
After man-machine interface sees that operation completes, running status signal of communication is set to inoperative;
After PLC operation management module sees that operating state signal is set to inoperative, operation is completed signal of communication and be set to and do not complete.Whole recovering state is to original state;
In Debugging interface, under single step run pattern, or in the off-duty situation of PLC, user can add breakpoint dynamically on ladder diagram.The information of breakpoint is issued PLC operation management module by communication mode by man-machine interaction program;
PLC operation management module analyzes this information after obtaining breakpoint information, and changes the breakpoint indexed variable in corresponding structure as described in claim 3;
According to above-mentioned breakpoint indexed variable, PLC operation management module operationally judges whether this row has breakpoint.If this row has breakpoint, stopping continues to perform downwards by PLC operation management module.After waiting for that running status signal of communication is set to operation by human-computer interaction interface, then continue to perform next breakpoint place downwards.
The present invention has the following advantages:
1. utilize the inventive method that the Soft-PLC of compiling type can be made to possess interpolation breakpoint, the on-line debugging function that single step performs.
2. the Soft-PLC possessing on-line debugging function will possess higher efficiency in engineering development.When external hardware or functional requirement change, the PLC with debug function can make modification of program work become lighter, and accurately, reduces the probability because the error on programmed logic causes the accident.
Accompanying drawing explanation
Fig. 1 is the inventive method process flow diagram;
Fig. 2 is the implementation method process flow diagram of PLC operation management module of the present invention;
Fig. 3 is the state interaction figure between PLC human-computer interaction interface of the present invention and operational management program.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.
As shown in Figure 1, the present invention includes following steps:
Step 1: PLC ladder diagram is translated into the high-level language programs with special construction by ladder diagram translation program, and call Advanced Compiler Tools compiling generation executable module, wait for that PLC operation management module is called;
The executable module that step 2:PLC operational management module dynamic call compiling generates;
Step 3: increase Debugging interface at PLC editing interface and be used for carrying out man-machine interaction;
Step 4:PLC operational management module according to trapezoid figure program in higher level lanquage executable module with information and the man-machine interaction Debugging interface transmission interface operation information of coming in perform program in ladder diagram dynamically.
Breakpoint can be added after the program line that stops of needs in ladder diagram PLC ladder diagram editor interface programming personnel, and send to PLC operation management module by order.
The file translation of band ladder diagram becomes with the special high-level language programs of breakpoint information mark by ladder diagram translater.This high-level language programs has following feature (below with C programmer citing):
Each line program of ladder diagram, by generation function, will comprise row number information in the title of function, such as: void_PLC_LAD_0001 (void)
Definition one-dimentional structure body array, the number of array element is ladder diagram line number.
Structure is defined as follows:
PLC trapezoid figure program line function entry reference is defined as follows:
typedef void*(*FUN)(void);
If trapezoid figure program is 190 row definition of compiler structural array:
LADLINE lad[190];
The address of every line function is filled in the PLCline variable of each element in lad [190] and goes by ladder diagram translation program generation configurator.
The high-level language programs generated is given Advanced Compiler Tools and is generated executable module, is operationally run supervisor call dynamically and performs.
The entry address of ladder diagram first trip function is written to when wait condition meets in current execution row variable and performs use by operational management program according to Fig. 2.
Set up communication variable single step run state StepState and be initialized as 0.Whether this variable illustrates current is single step state, and whether can continue downward execution.
Whether judge whether human-computer interaction interface presses operation button, be 1 judgement by communication variables RunState.As shown in Figure 3, after pressing operation button, this variable can be set to 1.Represent that when this variable is 1 running single step run state puts 1, notice program below needs to continue to perform downwards.This variable represents when being 0 does not press operation button, will run settling signal clear 0.
When single step run state is 1, sufficient service condition with thumb down, cannot continue the trapezoid figure program performed below, performs so return when operation button is pressed in wait.
When single step run state is 0, represents current and meet single step executive condition, or not under single step execution pattern.Judge whether current line program is provided with breakpoint.If be provided with breakpoint, continue to wait for that human-computer interaction interface presses operation button.If do not arrange breakpoint or be provided with breakpoint and press operation button, at this moment meet executive routine condition, then perform the function that current line curline points to.And operation settling signal RunFinish is set to 1, and the instruction that notifier's machine interactive interface program presses operation is finished.As shown in Figure 3, human-computer interaction interface is after 1 monitoring RunFin signal, is reset by running status RunState and represents that last order all completes.As shown in Figure 1, RunFinish signal can reset by next cycle operational management program, makes program recovery arrive original state.
After having run current line, judge that whether current line is last column of this trapezoid figure program, if it is quit a program and wait for calling program again of next cycle.If not, then preserve when latent period meets executive condition the function entrance assignment of next line trapezoid figure program to current execution row cunline and call.

Claims (4)

1. compile an on-line debugging implementation method for type Soft-PLC, it is characterized in that, comprise the following steps:
Step 1: PLC ladder diagram is translated into high-level language programs by ladder diagram translation program, and call Advanced Compiler Tools compiling generation executable module, wait for that PLC operation management module is called;
The executable module that step 2:PLC operational management module dynamic call compiling generates;
Step 3: increase Debugging interface at PLC editing interface and be used for carrying out man-machine interaction;
Step 4:PLC operational management module according to trapezoid figure program in higher level lanquage executable module with information and the man-machine interaction Debugging interface transmission interface operation information of coming in perform program in ladder diagram dynamically;
Described step 1 is specially: use ladder diagram translation program trapezoid figure program to be translated into each trapezoid figure program behavior higher level lanquage function; Define a kind of data structure to comprise a function pointer variable and represent the entry address of the higher level lanquage function of a line trapezoid figure program and a variable and represent this row and whether there is breakpoint; Ladder diagram translation program defines an one-dimentional structure body array according to the line number of ladder diagram, and the membership of this array is the line number of ladder diagram; Generate higher level lanquage configurator by the function entrance address variable in each element being written in one-dimentional structure body array as described above with the entry address of the capable corresponding higher level lanquage function of trapezoid figure program successively of generating; To whether be filled up in the breakpoint information variable in this row Array for structural body element with breakpoint information.
2. a kind of on-line debugging implementation method compiling type Soft-PLC according to claim 1, it is characterized in that, described PLC operation management module obtains the first address of the function structure array represented in PLC logical program higher level lanquage executable module by communication modes; And according to the position of element in this structural array, i.e. the capable top-down order of trapezoid figure program executive routine successively; PLC operation management module and PLC human-computer interaction interface carry out the mutual of running state information.
3. a kind of on-line debugging implementation method compiling type Soft-PLC according to claim 1, it is characterized in that, described man-machine interaction Debugging interface has the function of adding breakpoint after trapezoid figure program is capable; The breakpoint information of interpolation is sent to PLC operation management module by communication mode; There are single step run pattern and continuous operation mode two kinds of patterns, can switch under two states dynamically; The request that user continues to run can be responded, by this request notice PLC operation management module, and process the state that operational management program returns.
4. a kind of on-line debugging implementation method compiling type Soft-PLC according to claim 1, it is characterized in that, the reciprocal process of described PLC operation management module and PLC man-machine interaction Debugging interface is:
Current is single step run pattern, and single step executing state signal of communication is set to single step state by human-computer interaction interface;
PLC operation management module each only execution trapezoid figure program under single step run state is capable;
After pressing operation button, running status signal of communication is set to running status by human-computer interaction interface;
After PCL operational management program sees this state, continue to perform downwards a trapezoid figure program capable, and operation is completed signal of communication be set to;
After man-machine interface sees that operation completes, running status signal of communication is set to inoperative;
After PLC operation management module sees that operating state signal is set to inoperative, operation is completed signal of communication and be set to and do not complete, whole recovering state is to original state;
In Debugging interface, under single step run pattern, or in the off-duty situation of PLC, user can add breakpoint dynamically on ladder diagram, and the information of breakpoint is issued PLC operation management module by communication mode by man-machine interaction program;
PLC operation management module analyzes this information after obtaining breakpoint information, and changes the breakpoint indexed variable in corresponding structure;
According to above-mentioned breakpoint indexed variable, PLC operation management module operationally judges whether this row has breakpoint; If this row has breakpoint, stopping continues to perform downwards by PLC operation management module; After waiting for that running status signal of communication is set to operation by human-computer interaction interface, then continue to perform next breakpoint place downwards.
CN201110369506.6A 2011-11-18 2011-11-18 Online debugging implementation method of compiling soft programmable logic controller (PLC) Active CN103123598B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110369506.6A CN103123598B (en) 2011-11-18 2011-11-18 Online debugging implementation method of compiling soft programmable logic controller (PLC)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110369506.6A CN103123598B (en) 2011-11-18 2011-11-18 Online debugging implementation method of compiling soft programmable logic controller (PLC)

Publications (2)

Publication Number Publication Date
CN103123598A CN103123598A (en) 2013-05-29
CN103123598B true CN103123598B (en) 2015-03-18

Family

ID=48454586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110369506.6A Active CN103123598B (en) 2011-11-18 2011-11-18 Online debugging implementation method of compiling soft programmable logic controller (PLC)

Country Status (1)

Country Link
CN (1) CN103123598B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103529749B (en) * 2013-10-29 2017-07-25 威海麦科电气技术有限公司 The ladder diagram program development system and method for a kind of PLC
CN104331017B (en) * 2014-11-12 2018-04-20 深圳市英威腾电气股份有限公司 A kind of frequency converter Programmable logical controller function realizing method, device and frequency converter
CN106200445B (en) * 2015-05-06 2018-09-25 西门子工厂自动化工程有限公司 The adjustment method of logic controller
CN105676808B (en) * 2015-12-31 2018-06-26 北京四方继保自动化股份有限公司 A kind of implementation method of industrial control system logic break point debugging function
CN109313597A (en) * 2016-12-22 2019-02-05 深圳配天智能技术研究院有限公司 Numerical control device, digital control system and its adjustment method based on trapezoidal pattern programming language
US11454945B2 (en) 2019-04-16 2022-09-27 Siemens Aktiengesellschaft Method and device for calling program module in PLC ladder programming environment
CN110442076A (en) * 2019-07-03 2019-11-12 苏州保控电子科技有限公司 The method of PLC technology based on ST language pointer variable
CN110519092B (en) * 2019-08-27 2022-11-22 深圳力维智联技术有限公司 Edge gateway, configuration tool and soft PLC function scripting implementation method
CN110989487B (en) * 2019-12-23 2021-05-18 北京东土科技股份有限公司 PLC initialization method and device for industrial server and readable storage medium
CN111897249B (en) * 2020-05-25 2021-09-03 南方电网科学研究院有限责任公司 Method and device for online debugging parameters of direct current control system and storage medium
CN113625652B (en) * 2021-07-29 2023-04-25 广东工贸职业技术学院 Numerical control embedded PLC intermediate file processing and decoding execution method
CN114232182A (en) * 2021-12-28 2022-03-25 中国科学院宁波材料技术与工程研究所 Three-dimensional loom control system based on PC and weaving method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957745A (en) * 2009-07-16 2011-01-26 沈阳高精数控技术有限公司 Method for converting ladder diagram language into structure text language

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957745A (en) * 2009-07-16 2011-01-26 沈阳高精数控技术有限公司 Method for converting ladder diagram language into structure text language

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PLC在线调试与监控方法的研究与实现;俞乐勤;《万方学位论文数据库》;20110928;第9页第2段、第10页第1段、第20页第3段、23页第1段、24页、第48页第2段;图3.1、3.2、3.6、3.8、4.1 *

Also Published As

Publication number Publication date
CN103123598A (en) 2013-05-29

Similar Documents

Publication Publication Date Title
CN103123598B (en) Online debugging implementation method of compiling soft programmable logic controller (PLC)
US7302676B2 (en) Method for debugging flowchart programs for industrial controllers
CN100465838C (en) New style open type numerical control system realizing method based on multiple CPU parallel processing technology
CN102581850B (en) GSK-Link bus based modular robot control device and control method
CN104898546A (en) PLC (Programmable Logic Controller) on-line debugging system and method based on SOC (System On Chip)
CN106371813A (en) Simulink-based motor controller software generation method for electric vehicle
CN106737676B (en) It is a kind of based on script can secondary development industrial robot programing system
CN108897676B (en) Flight guidance control software reliability analysis system and method based on formalization rules
CN105676808B (en) A kind of implementation method of industrial control system logic break point debugging function
CN103514072A (en) Method and device for debugging graphical service for visual programming
CN112860362B (en) Visual debugging method and system for robot automation process
CN102722601B (en) Implementation method of formal semantic integration framework for model transformation of numerical control system
CN105740139A (en) Virtual environment based embedded software debugging method
CN202622807U (en) Modularization robot control device based on GSK-Link bus
CN110861085B (en) VxWorks-based mechanical arm instruction interpreter system
CN108446218A (en) A kind of automatic Verification device of structured text program
CN110442520B (en) Cross debugging system and method based on PLC programming language
Hujo et al. Toward a graphical modeling tool for response-time requirements based on soft and hard real-time capabilities in industrial cyber-physical systems
CN104238438A (en) PLC universal platform and design method thereof
Bourne CML: a meta-interpreter for manufacturing
CN112558541B (en) PLC programming extension system and method and electronic equipment
Younis et al. UML-based approach for the re-engineering of PLC programs
CN102722142A (en) Special control system of bearing cutting automation production line based on graphic programming
CN116301836A (en) Embedded development system based on domestic autonomous controllable environment
CN112465281A (en) Stability control strategy prejudging method under real-time power system scene

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant