CN104460489A - Method for converting PLC instruction list into ladder diagram based on generator set controller - Google Patents

Method for converting PLC instruction list into ladder diagram based on generator set controller Download PDF

Info

Publication number
CN104460489A
CN104460489A CN201410634281.6A CN201410634281A CN104460489A CN 104460489 A CN104460489 A CN 104460489A CN 201410634281 A CN201410634281 A CN 201410634281A CN 104460489 A CN104460489 A CN 104460489A
Authority
CN
China
Prior art keywords
node
leaf
sys
series connection
instruction
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.)
Granted
Application number
CN201410634281.6A
Other languages
Chinese (zh)
Other versions
CN104460489B (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.)
Zhengzhou Smartgen Technology Co Ltd
Original Assignee
Zhengzhou Smartgen Technology 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 Zhengzhou Smartgen Technology Co Ltd filed Critical Zhengzhou Smartgen Technology Co Ltd
Priority to CN201410634281.6A priority Critical patent/CN104460489B/en
Publication of CN104460489A publication Critical patent/CN104460489A/en
Application granted granted Critical
Publication of CN104460489B publication Critical patent/CN104460489B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/056Programming the PLC

Abstract

The invention provides a method for converting a PLC instruction list into a ladder diagram based on a generator set controller. The method comprises the steps of (1) constructing an intermediate tree according to the PLC instruction list, (2) traversing the intermediate tree, and (3) outputting the ladder diagram generated in the step (2). According to method for converting the PLC instruction list into the ladder diagram, errors and redundancies can be automatically detected, the intermediate tree structure is generated through the PLC instruction list, and then the ladder diagram is generated through the intermediate tree.

Description

A kind of PLC instruction list based on generator set controller turns the method for ladder diagram
Technical field
The present invention relates to a kind of method that instruction list turns ladder diagram, specifically, relate to a kind of method that PLC instruction list based on generator set controller turns ladder diagram.
Background technology
The programming language of PLC generally adopts trapezoid figure language (LD), repertoire la nguage (IL), functional module language (FBD), order functional sequence graph-based language (SFC) and structured text language (ST) five kinds, but, in the process used, sometimes need to transfer existing instruction list to ladder diagram, common method can not error correction in the process turning ladder diagram, and easily occurs translation error or redundancy.
In order to solve above Problems existing, people are seeking a kind of desirable technical solution always.
Summary of the invention
The object of the invention is for the deficiencies in the prior art, provide one and be easy to realize, the PLC ladder diagram based on generator set controller that automatically can detect mistake and redundancy turns the method for instruction list.
To achieve these goals, the technical solution adopted in the present invention is: a kind of PLC instruction list based on generator set controller turns the method for ladder diagram, comprises the following steps:
Step 1: build intermediary tree according to PLC instruction list:
Define a stack and preserve node, progressively translate the instruction of the every a line of PLC instruction list from top to bottom;
If a LD or LDNOT instruction, a newly-built leaf node X, and newly-built leaf node X is advanced stack;
If b encounters AND or ANDNOT instruction, generate a leaf node X, then judge the type of stack top node; If series connection node, this leaf node X is set to the child node of stack top node; If stack top node is leaf node or sys node, then a newly-built series connection node S, be the child node of newly-built series connection node S by the leaf node X of generation and stack top Node configuration, stack top node is popped, and newly-built series connection node S pushes on;
If c encounters OR and ORNOT instruction, generate a leaf node X, then judge the type of stack top node; If sys node, directly the leaf node X of generation is set to the child node of stack top node; If leaf node or series connection node, a newly-built sys node P, be the child node of this sys node P by leaf node X and stack top Node configuration, stack top node is popped, and this sys node P pushes on;
If d encounters ANDLD instruction, a newly-built series connection node S, pops the first two node of stack, and is the child node of this series connection node S by these two Node configurations, and this series connection node S pushes on;
If e encounters ORLD instruction, a newly-built sys node P, pops the first two node of stack, and is the child node of this sys node P by these two Node configurations, and this sys node P pushes on;
F, encounter OUT instruction, newly-built output node;
G, encounter END instruction, then terminate, intermediary tree has generated;
Wherein, the node of described intermediary tree comprises leaf node X and relation node, and described relation node is the father node of ladder diagram logic node, comprises series connection node S and sys node P; Described leaf node X is logic node switching value in ladder diagram; Each leaf node X must have individual relation father node, if the child node of relation node is relation node, relator node can not be identical with father node type.
Step 2: traversal intermediary tree:
A, traversal intermediary tree, if relation node, so continue recurrence and go down, until traverse leaf node X, be then depicted as a logic node of ladder diagram;
B, traverse next leaf node X, this leaf node X and a upper node have a common relation node, judge the type of this relation node, if series connection node S is then plotted in after the X-direction of a node, if sys node P is then plotted in below a node Y direction;
C, travel through all leaf node X of intermediary tree successively, according to step a, step b each leaf node X in intermediary tree is depicted as a logic node in ladder diagram.
Step 3: export the ladder diagram generated in step 2.
Hinge structure of the present invention has outstanding substantive distinguishing features and marked improvement, specifically, present approach provides a kind of method being generated ladder diagram by PLC instruction list, can automatically detect mistake and redundancy, generate intermediary tree structure by PLC ladder diagram, then generate instruction list by intermediary tree.
Accompanying drawing explanation
Fig. 1 is according to the intermediary tree that the PLC instruction list adopted generates in the step e that illustrates of the inventive method.
Fig. 2 is that the inventive method illustrates the middle intermediary tree finally generated according to the PLC instruction list adopted.
Fig. 3 is that the inventive method illustrates the middle ladder diagram finally generated according to the PLC instruction list adopted.
Embodiment
Below by embodiment, technical scheme of the present invention is described in further detail.
PLC instruction list based on generator set controller turns a method for ladder diagram, comprises the following steps:
Step 1: build intermediary tree according to PLC instruction list:
Define a stack and preserve node, progressively translate the instruction of the every a line of PLC instruction list from top to bottom;
If a LD or LDNOT instruction, a newly-built leaf node X, and newly-built leaf node X is advanced stack;
If b encounters AND or ANDNOT instruction, generate a leaf node X, then judge the type of stack top node; If series connection node, this leaf node X is set to the child node of stack top node; If stack top node is leaf node or sys node, then a newly-built series connection node S, be the child node of newly-built series connection node S by the leaf node X of generation and stack top Node configuration, stack top node is popped, and newly-built series connection node S pushes on;
If c encounters OR and ORNOT instruction, generate a leaf node X, then judge the type of stack top node; If sys node, directly the leaf node X of generation is set to the child node of stack top node; If leaf node or series connection node, a newly-built sys node P, be the child node of this sys node P by leaf node X and stack top Node configuration, stack top node is popped, and this sys node P pushes on;
If d encounters ANDLD instruction, a newly-built series connection node S, pops the first two node of stack, and is the child node of this series connection node S by these two Node configurations, and this series connection node S pushes on;
If e encounters ORLD instruction, a newly-built sys node P, pops the first two node of stack, and is the child node of this sys node P by these two Node configurations, and this sys node P pushes on;
F, encounter OUT instruction, newly-built output node;
G, encounter END instruction, then terminate, intermediary tree has generated;
Wherein, the node of described intermediary tree comprises leaf node X and relation node, and described relation node is the father node of ladder diagram logic node, comprises series connection node S and sys node P; Described leaf node X is logic node switching value in ladder diagram; Each leaf node X must have individual relation father node, if the child node of relation node is relation node, relator node can not be identical with father node type.
Step 2: traversal intermediary tree:
A, traversal intermediary tree, if relation node, so continue recurrence and go down, until traverse leaf node X, be then depicted as a logic node of ladder diagram;
B, traverse next leaf node X, this leaf node X and a upper node have a common relation node, judge the type of this relation node, if series connection node S is then plotted in after the X-direction of a node, if sys node P is then plotted in below a node Y direction;
C, travel through all leaf node X of intermediary tree successively, according to step a, step b each leaf node X in intermediary tree is depicted as a logic node in ladder diagram.
Step 3: export the ladder diagram generated in step 2.
The method turning ladder diagram to above-mentioned PLC instruction list is below made and being illustrated:
Instruction in PLC instruction list comprises following 10 kinds: LD, LDNOT, AND, ANDNOT, OR, ORNOT, ANDLD, ORLD, OUT, END.
When illustrating, intend adopting PLC instruction list as shown in the table:
LD X1
LD X2
ORNOT X3
ANDLD
OR X4
LD X5
LD X6
LD X7
OR X8
ANDLD
ORLD
OR X9
ANDLD
AND X10
OUT Fun#1
END。
Node preserved by a, a definition stack.
B, the first row " LD X1 " read in above-mentioned PLC instruction list, read LD instruction, then a newly-built leaf node X1, leaf node X1 pushes on.
C and read " LD X2 " instruction, with step b, a newly-built leaf node X2, leaf node X2 pushes on.
D, to read " ORNOT X3 ", newly-built leaf node X3.Because be ORNOT instruction, the type of stack top node be judged, i.e. the type of X2 node.Because X2 node is leaf node, so want a newly-built sys node P1, be the child node of sys node P1 by X2 node and X3 Node configuration, X2 node is popped, and sys node P1 pushes on, and now, has two nodes in stack: leaf node X1 and sys node P1.
E, read ANDLD, a newly-built series connection node S1, and be the child node of series connection node S1 by first in stack and second Node configuration, that is: leaf node X1 and sys node P1 is set to the child node of series connection node S1, leaf node X1 and sys node P1 pops, S1 node pushes on, and now only has a series connection node S1 in stack.Intermediary tree structure now as shown in Figure 1.
F, continuation reading command " OR X4 ", because be OR instruction, so the type of stack top node will be judged, because S1 is series connection node, so want a newly-built sys node P2, series connection node S1 and leaf node X4 is set to the child node of sys node P2, series connection node S1 pops, and sys node P2 pushes on.
G, reading command " LD X5 ", " LD X6 " and " LD X7 ", as step b, newly-built leaf node X5, leaf node X6 and leaf node X7, be pushed in stack successively respectively.
H, reading " OR X8 " instruction, newly-built leaf node X8, judge now stack top node type, because be leaf node X7, so want a newly-built sys node P3, be set to by leaf node X7 and leaf node X8 and the child node of interface P3, leaf node X7 pops, and sys node P3 pushes on.
I, reading " ANDLD " instruction, newly-built series connection node S2, be the child node of series connection node S2 by the node of first in stack and second Node configuration, leaf node X6 and sys node P3 pops, and series connection node S2 pushes on.Read " ORLD " instruction, a newly-built sys node P4, is set to the child node of sys node P4 by leaf node X5 and series connection node S2, leaf node X5 and series connection node S2 pops, and sys node P4 pushes on.
J, with step I until read OUT instruction, generate output node Fun#1.
K, reading END instruction, instruction list reads complete, and the intermediary tree of generation as shown in Figure 2.
L, traversal intermediary tree, if relation node, so continue recurrence and go down, until traverse leaf node, be then depicted as a logic node of ladder diagram.
M, traverse next leaf node, this leaf node and a upper node have a common relation node, judge the type of this relation node, if series connection node is then plotted in after the X-direction of a node, if sys node is then plotted in below a node Y direction.
N, travel through all leaf nodes of intermediary tree successively, according to step l, step m each leaf node in intermediary tree is depicted as a logic node in ladder diagram.
O, output generate final ladder diagram.
Finally should be noted that: above embodiment is only in order to illustrate that technical scheme of the present invention is not intended to limit; Although with reference to preferred embodiment to invention has been detailed description, those of ordinary skill in the field are to be understood that: still can modify to the specific embodiment of the present invention or carry out equivalent replacement to portion of techniques feature; And not departing from the spirit of technical solution of the present invention, it all should be encompassed in the middle of the technical scheme scope of request of the present invention protection.

Claims (1)

1. turn a method for ladder diagram based on the PLC instruction list of generator set controller, it is characterized in that, comprise the following steps:
Step 1: build intermediary tree according to PLC instruction list:
Define a stack and preserve node, progressively translate the instruction of the every a line of PLC instruction list from top to bottom;
If a LD or LDNOT instruction, a newly-built leaf node X, and newly-built leaf node X is advanced stack;
If b encounters AND or ANDNOT instruction, generate a leaf node X, then judge the type of stack top node; If series connection node, this leaf node X is set to the child node of stack top node; If stack top node is leaf node or sys node, then a newly-built series connection node S, be the child node of newly-built series connection node S by the leaf node X of generation and stack top Node configuration, stack top node is popped, and newly-built series connection node S pushes on;
If c encounters OR and ORNOT instruction, generate a leaf node X, then judge the type of stack top node; If sys node, directly the leaf node X of generation is set to the child node of stack top node; If leaf node or series connection node, a newly-built sys node P, be the child node of this sys node P by leaf node X and stack top Node configuration, stack top node is popped, and this sys node P pushes on;
If d encounters ANDLD instruction, a newly-built series connection node S, pops the first two node of stack, and is the child node of this series connection node S by these two Node configurations, and this series connection node S pushes on;
If e encounters ORLD instruction, a newly-built sys node P, pops the first two node of stack, and is the child node of this sys node P by these two Node configurations, and this sys node P pushes on;
F, encounter OUT instruction, newly-built output node;
G, encounter END instruction, then terminate, intermediary tree has generated;
Wherein, the node of described intermediary tree comprises leaf node X and relation node, and described relation node is the father node of ladder diagram logic node, comprises series connection node S and sys node P; Described leaf node X is logic node switching value in ladder diagram; Each leaf node X must have individual relation father node, if the child node of relation node is relation node, relator node can not be identical with father node type;
Step 2: traversal intermediary tree:
A, traversal intermediary tree, if relation node, so continue recurrence and go down, until traverse leaf node X, be then depicted as a logic node of ladder diagram;
B, traverse next leaf node X, this leaf node X and a upper node have a common relation node, judge the type of this relation node, if series connection node S is then plotted in after the X-direction of a node, if sys node P is then plotted in below a node Y direction;
C, travel through all leaf node X of intermediary tree successively, according to step a, step b each leaf node X in intermediary tree is depicted as a logic node in ladder diagram;
Step 3: export the ladder diagram generated in step 2.
CN201410634281.6A 2014-11-12 2014-11-12 Method for converting PLC instruction list into ladder diagram based on generator set controller Active CN104460489B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410634281.6A CN104460489B (en) 2014-11-12 2014-11-12 Method for converting PLC instruction list into ladder diagram based on generator set controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410634281.6A CN104460489B (en) 2014-11-12 2014-11-12 Method for converting PLC instruction list into ladder diagram based on generator set controller

Publications (2)

Publication Number Publication Date
CN104460489A true CN104460489A (en) 2015-03-25
CN104460489B CN104460489B (en) 2017-04-12

Family

ID=52906724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410634281.6A Active CN104460489B (en) 2014-11-12 2014-11-12 Method for converting PLC instruction list into ladder diagram based on generator set controller

Country Status (1)

Country Link
CN (1) CN104460489B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112327744A (en) * 2020-11-20 2021-02-05 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000276212A (en) * 1999-03-23 2000-10-06 Digital Electronics Corp System and method for simulating control program for industrial controller and recording medium recording software therefor
CN101364098A (en) * 2008-09-12 2009-02-11 南京航空航天大学 Method and system for conversing trapezoidal pattern to be instruction catalogue program, and interpretation execution method and system
JP2010286954A (en) * 2009-06-10 2010-12-24 Koyo Electronics Ind Co Ltd Ladder program monitoring method
CN102354144A (en) * 2011-09-06 2012-02-15 北京联合大学 Method for converting ladder diagram into PLC (Programmable Logic Controller) program command
CN102508654A (en) * 2011-10-11 2012-06-20 江苏科技大学 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000276212A (en) * 1999-03-23 2000-10-06 Digital Electronics Corp System and method for simulating control program for industrial controller and recording medium recording software therefor
CN101364098A (en) * 2008-09-12 2009-02-11 南京航空航天大学 Method and system for conversing trapezoidal pattern to be instruction catalogue program, and interpretation execution method and system
JP2010286954A (en) * 2009-06-10 2010-12-24 Koyo Electronics Ind Co Ltd Ladder program monitoring method
CN102354144A (en) * 2011-09-06 2012-02-15 北京联合大学 Method for converting ladder diagram into PLC (Programmable Logic Controller) program command
CN102508654A (en) * 2011-10-11 2012-06-20 江苏科技大学 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112327744A (en) * 2020-11-20 2021-02-05 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller

Also Published As

Publication number Publication date
CN104460489B (en) 2017-04-12

Similar Documents

Publication Publication Date Title
CN104166942B (en) Trans-regional supply district searching method and its system based on CIM
WO2013075125A3 (en) Systems, methods, and devices for multi-tiered error correction
CN104331314A (en) Method for converting PLC (Programmable Logic Controller) ladder diagram into instruction list based on generator set controller
CN103259718A (en) Flow table conversion method and device
CN109039788A (en) Port configuration method, device and the storage medium of the network equipment
CN104460489A (en) Method for converting PLC instruction list into ladder diagram based on generator set controller
CN109491821A (en) Primary particle inversion resistant hardened system and method
CN102684943A (en) Textile industrial ethernet monitoring system and method thereof
CN104660663B (en) Operation method of server cluster
CN107479878A (en) A kind of lua Modular development methods and Development Framework based on openresty
CN103928910A (en) Protection system of ultra-high-voltage direct-current transmission converter station
KR102505454B1 (en) Static Var Compensator of controller system and Controlling Method Thereof
CN104410575A (en) Device and method for MAC address hardware learning in multi-chip stacking mode
CN102736552A (en) Method for converting ladder diagram developed by programmable logic controller (PLC) into statement list
CN101841430A (en) Method and device for correcting command line
CN104503354A (en) Digital control system
CN104049959A (en) Method for converting flow chart into executable language
CN204302972U (en) The two network data read-write system of a kind of EtherCAT
JP5894553B2 (en) Control system, line connection diagnosis method and program
KR20110012342A (en) Method of designing programmable logic controller ladder logic and generating ladder code
CN102317885B (en) Computer system and method of configuring clock thereof
US9241043B2 (en) Method of connecting a hardware module to a fieldbus
CN205142255U (en) MVB repeater based on two independent FPGA
CN204229182U (en) Digitizing And Control Unit
JP2006040148A (en) Safety controller, safety control system and communication error detection method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant