CN102508654B - Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller) - Google Patents

Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller) Download PDF

Info

Publication number
CN102508654B
CN102508654B CN201110308100.7A CN201110308100A CN102508654B CN 102508654 B CN102508654 B CN 102508654B CN 201110308100 A CN201110308100 A CN 201110308100A CN 102508654 B CN102508654 B CN 102508654B
Authority
CN
China
Prior art keywords
node
binary tree
instruction
ladder diagram
scanning
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.)
Expired - Fee Related
Application number
CN201110308100.7A
Other languages
Chinese (zh)
Other versions
CN102508654A (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.)
Jiangsu University of Science and Technology
Original Assignee
Jiangsu University of Science and Technology
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 Jiangsu University of Science and Technology filed Critical Jiangsu University of Science and Technology
Priority to CN201110308100.7A priority Critical patent/CN102508654B/en
Publication of CN102508654A publication Critical patent/CN102508654A/en
Application granted granted Critical
Publication of CN102508654B publication Critical patent/CN102508654B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Programmable Controllers (AREA)

Abstract

The invention provides a method for designing ladder diagram editing software of an embedded PLC (Programmable Logic Controller) and provides a method for establishing a binary tree by scanning a ladder diagram according to the direction of an 'energy flow' in the ladder diagram. According to the invention, the binary tree is taken as a center so that the conversion between the ladder diagram form and instruction list form of a user control program of the PLC is realized; and by utilizing a method for converting an instruction language into the binary tree, the mutual conversion between the ladder diagram which takes the binary tree as the center and an instruction list is finished. And finally, one editor of the embedded PLC is developed by applying VC++6.0 under a Windows platform; and the editor has the functions of realizing the drawing of the ladder diagram, and the mutual conversion between a ladder diagram language and an instruction list language and the like.

Description

The ladder diagram editor device method for designing of embedded programmable controller
Technical field
The present invention is specifically related to a kind of method for designing of ladder diagram editor device of embedded programmable controller, belongs to control system and electronic technology field.
Background technology
For a long time, PLC is the main battle ground in industrial control automation field all the time, for various automation control appliances provide control program very reliably.Along with industrial expansion, the application of Programmable Logic Controller in Industry Control is more and more extensive, also more and more higher to the requirement of Programmable Logic Controller, and therefore the Programmable Logic Controller of development of new is following development trend.
The PLC major part that China is used at present comes from Japan and more American-European countries, external PLC is mainly monopolized by Siemens Company, A-B company, Schneider company, Mitsubishi, Omron Corp, and the core technology of PLC rests in these countries and some large-scale foreign company's hands always.In recent years, China digested and assimilated by introducing these national technology, copied, make the PLC product of China have certain development, small-sized PLC produces in batches at present, and medium-sized PLC has also had finished product, and large-scale PLC at present also under study for action.Some products are not only supplied home market, and the product also having also exports.In PLC application aspect, China is very active, and the industry of application is also very wide.
There are at present many industrial automatic control products, electromechanical integrated product to start to turn to the control mode take computing machine as platform.The up-to-date soft PLC having released take computing machine as platform of German Industrial circle.The actual function of utilizing software to realize conventional P LC of soft PLC.The feature of soft PLC is:
(1) the flexible programmable logic control technology based on industrial computer, can make full use of latest computed machine high speed, large capacity, enrich function and various software resource.
(2) soft PLC is open programmable logic controller, can obtain application widely in control in real time, network control and step control field.
(3) soft PLC is real-time multi-task operating system, and strong instruction can be provided, more fast scanning and safe operation.
(4) open structure is easily connected to I/O module, PID module, motion-control module and device, network.
The advantage of soft PLC maximum is to possess flexible extension ability, and user can select the various hardware products of different manufacturers production, makes full use of the optkmal characteristics of each software, forms best control system.Simultaneously also very convenient with being connected of hardware.There is a lot of I/O cards can be directly connected on soft PLC computer bus.Thereby in the perfect adaptation that can reach industrial computer and PLC performance aspect soft and hardware two, having facilitated performance expansion and man-machine communication, is PLC one developing direction in future.
Up to the present, the embedded programmable controller of China has a great development, and the famous institutions of higher learning such as Wuhan University of Technology, Beijing University of Technology, Nanjing space flight and aviation university are obtaining certain achievement aspect the research of embedded programmable controller.In addition, the Ke Wei automatic control company of Huangshi has successfully developed the embedded programmable controller take 8051 single-chip microcomputers as hardware platform, has had independent intellectual property right, and product has come into the market to sell.
There is the huge market demand in China to PLC, but the PLC that China is used is external product substantially.Along with industrial expansion, novel and intelligent Programmable Logic Controller must be following development trend.Develop autonomous embedded programmable controller and not only can adapt to the in the future development trend of PLC, and China is broken to external monopolization also have certain meaning.
Soft PLC utilizes software to realize the function of conventional P LC, is the recent tendency of PLC technical development.But the design of embedded programmable controller entirety, also in the elementary step, all awaits further perfect in theoretical research and engineering application aspect at present.Develop a kind of product of maturation, have got long long way to go, be mainly reflected in the following aspects:
1, how host computer ladder diagram is changed to successful instruction list and be converted to the language that slave computer can be identified.
2, continue to improve the optimization of ladder diagram to the algorithm of instruction list language conversion.
3, improve the error detecing capability of ladder diagram instruction in editing machine.
4, can design a set of independently download tool in the face of host computer editing machine, the code of conversion can be downloaded in slave computer and move.
Summary of the invention
Ladder diagram is that PLC is the most basic, and the programming language of imagery is very convenient for being familiar with the operating personnel of relay.Therefore, the trapezoidal pattern programming language of the embedded programmable controller of the present invention's design remains ladder diagram, only trapezoid figure language will be converted to the language that embedded slave computer can be identified.The defect that the object of the invention is to exist according to prior art provides a kind of ladder diagram editor device method for designing of embedded programmable controller.
The ladder diagram editor device method for designing of a kind of embedded programmable controller of the present invention, comprises the steps:
Step 1: the design of component library;
Step 2: the drafting of ladder diagram;
Step 3: the modification of component attributes and deletion;
Step 4: syntax check:
First, whether have output winding or carry out coil, if do not had, report an error if detect each ladder diagram; Secondly check the generation that whether has short circuit, open circuit conditions: check in turn whether the branch road between two adjacent parallel wires has straight line to be directly connected, whether there is element to judge by scanning between two parallel wires, if there is element, prove it is not short circuit, if the number of element is zero, it is exactly short circuit, scanned element is all carried out to record, if find the element not scanning in addition after inspection scanning process finishes, just prove that the branch road at this element place is for opening circuit;
Step 5: ladder diagram changes into instruction list;
Adopt the method centered by " binary tree " to realize the conversion of ladder diagram to instruction list;
Step 6: instruction list converts ladder diagram to;
Wherein, described in step 5, the method for building up of binary tree comprises the steps:
The 1st step, first determines the direction of scanning, if scanning from left to right, writes down respectively the inflow node of element and flows out the chain tabular value of node; If scanning from top to bottom, by the outflow node of the element first scanning and after the inflow node of the element that scans be designated as a value; Judge that the mode scanning is, whether the horizontal ordinate of the inflow node of the horizontal ordinate of the outflow node of the element that judgement first scans and the next element that will scan is identical, is direction of scanning from top to bottom if identical, otherwise, be direction of scanning from left to right;
The 2nd step, if the inflow node chain tabular value of first node-flow ingress chain tabular value and second node is identical, the outflow node chain tabular value of first node-flow egress chain tabular value and second node is identical, two nodes be or relation, set up OR node, set up a little binary tree, two elements are respectively left and right subtree, and what first scan is left subtree; If there are multiple element parallel connections, according to after the parallel connection of sequencing the first two element, result in parallel and the 3rd element parallel connection, set up binary tree, by that analogy;
The 3rd step, if the outflow node chain tabular value of the inflow node chain tabular value of first node and second node is identical, two nodes be with relation, set up AND node, set up a little binary tree, two elements are respectively left and right subtree, and what first scan is left subtree; If there are multiple element series connection, according to after the series connection of sequencing the first two element, series connection result and the 3rd element series connection, set up binary tree, by that analogy;
The 4th step, the AND node of foundation and OR node, also set up new logical relation according to above-mentioned principle and other element, sets up new binary tree, by that analogy, converts ladder diagram to binary tree;
The 5th step: convert binary tree to instruction list language;
Described in step 6, instruction list converts ladder diagram to, is in the situation that confirming without grammer and logic error, first will scan instruction list, and concrete performing step is as follows:
1) do not have in vicious situation at definite grammer, scan instruction table, when reading LD or LDN instruction, apply for that a node sets up binary tree, first node, as the left subtree of binary tree, is then revised the node data of new binary tree according to the component data being kept in chained list after scanning in present instruction and step 5;
2) if while reading AND or AND NOT instruction, be exactly that row increase instruction, now apply for two new nodes, a father node as binary tree, then another revise the each node data of new binary tree according to the component data being kept in chained list after scanning in present instruction and step 5 as the right subtree of binary tree;
3) if while reading OR or OR NOT instruction, be exactly that row increases instruction, now apply for equally two new nodes, a father node as binary tree, then another revise the each node data of new binary tree according to the component data being kept in chained list after scanning in present instruction and step 5 as the right subtree of binary tree;
4) if read ALD instruction or OLD instruction, now apply for that a new node is as father node, current binary tree and last binary tree are merged, form a new binary tree, wherein previous binary tree is left sibling, current binary tree is right node, then revises the each node data of new binary tree according to the component data being kept in chained list in present instruction and step 5 after scanning;
5) in the time that logical block and individual node operate, individual node is equivalent to read LD instruction, serve as left subtree; In the time that multiple logical blocks and individual node operate, individual node and first logical block to be operated, then operate with other logical blocks successively, then revise the each node data of new binary tree according to the component data being kept in chained list in present instruction and step 5 after scanning;
6) repeat above-mentioned achievement method, until read OUT instruction, then revise the each node data of new binary tree according to the component data being kept in chained list in present instruction and step 5 after scanning, instruction list language conversion is become to binary tree;
7) adopt postorder traversal method, convert binary tree to ladder diagram.
Described above in setting up binary tree, series connection piece and parallel-connected blocks are all saved in chained list as data, set in the transfer process of instruction list in realization, adopt postorder traversal method to travel through tree, convert binary tree to instruction list language, the namely left subtree of first access tree, then postorder traversal right subtree and root node successively.
The present invention has provided the interpretation procedure of embedded programmable controller (PLC) ladder diagram instruction, proposed according to " flowing " in ladder diagram thus direction scan ladder diagram and set up the method for binary tree.Centered by binary tree, realize the conversion between the diagram in ladder form and instruction sheet form of PLC user control program, and the instruction list language conversion method that is binary tree, complete ladder diagram centered by binary tree and the mutual conversion of instruction list.Last a set of editing machine of applying VC++6.0 and having developed embedded programmable controller under windows platform, this editing machine can be realized the functions such as ladder diagram is drawn, trapezoid figure language and instruction list language is changed mutually.The ladder diagram editor device of research and development, its function comprises that user interface, ladder diagram editor module, ladder diagram are to the modular converter of instruction list etc.This ladder diagram editor device support is drawn ladder diagram element in the dilatory mode of mouse, support the operation such as insertion, deletion of ladder diagram element, support the change to the component attributes in ladder diagram, while running into grammer, morphology mistake in support editor ladder diagram process, point out mistake etc.
Accompanying drawing explanation
Fig. 1 is that element is drawn process flow diagram;
Fig. 2 is the drafting process flow diagram of row;
Fig. 3 is syntax check process flow diagram;
Fig. 4 is the process flow diagram of setting up binary tree;
Fig. 5 is ladder diagram and instruction table conversion regime.
Embodiment
Below in conjunction with drawings and Examples, the present invention is done to further detailed explanation.
The main interface of program
Main interface is mainly made up of parts such as title block, menu bar, tool bar hurdle, status bar, ladder diagram drawing district, instruction code/mistake viewing areas.
1, title block, for the title of the file that shows the title of the software using and editing.
2, menu bar, has held the option of all software functions that can use.As the processing to file (comprise newly-built, open, close, preserve, save as, attribute and exit etc.), editor's (comprise shearing, paste and copy), search etc.
3, tool bar hurdle, is generally used for placing the software function option that needs frequent use.Comprise conventional editting function, conventional ladder diagram element and connecting line, and the function of program operation etc.
4, ladder diagram drawing district, for drawing PLC trapezoid figure program.
5, instruction list viewing area, for idsplay order list language.
6, instruction code/mistake viewing area, for showing the result after PLC program compilation, person easy to use understands the problem place of program.
The design of component library
Describing an element, is mainly the various attributes of describing it, is mainly to embody graphic attribute and physical attribute in the middle of software.Graphic attribute refers to: slip-stick artist uses ladder diagram editor device that element is drawn on computer screen, forms ladder diagram, and in the time element being drawn on computer screen with element figure, the attribute such as coordinate, size of describing this element is just called as the graphic attribute of element.Physical attribute is exactly the attribute such as title, annotation of finger element.
In ladder diagram, the attribute of element can be with a quadruple notation: (component type, position, title).Wherein, component type represents the species of element, as horizontal line, normally opened contact, normally closed contact, often burst at the seams circle, timer, counter etc.; In order to represent the position of element, whole ladder diagram can be regarded as to a plane, then this plane is divided into a grid matrix, use the ranks of element in grid matrix just can represent; Title is also a necessary attribute of element, and it has represented the specific address in PLC hardware, as the 0th of 10.0 expression PLC hardware the contact.
Utilize OO concept, be a CLdsymbol class by the attribute representation of element, work out trapezoid figure program in compiler time, the information of ladder diagram element has been recorded in corresponding class formation, and they are: ranks position, element place, the symbol of element, variable that element is corresponding etc.
The drafting of ladder diagram
Ladder diagram editor only need clearly be expressed the contact between each graphic element and graphic element.Step, row and element in ladder diagram is all the entity object being generated by class separately, between them, gets in touch by chained list.Drawing in the process of ladder diagram, be mainly by creating new step object, row object and element object and its address pointer being inserted in corresponding chained list or change oneself attribute through the element object of existence.In ladder diagram editor process, be mainly drafting and the editor of element, row, step.
1, the drafting of element
Element is the least unit of composition ladder diagram, and the drafting of row and step has all comprised the drafting of element.Realize the drafting of element by changing the attribute of the element object having existed.Its flow process as shown in Figure 1.
2, the drafting of row
The design philosophy of drawing row generates a row object exactly, then according to the insertion position of specifying on ladder diagram, the address pointer of this row object is inserted in corresponding step chained list, and its flow process as shown in Figure 2.
3, the drafting of step
The design philosophy of drawing step is identical with the design philosophy of drawing row, and implementation method is similar.
The modification of component attributes and deletion
The element just having drawn, its every attribute generally can not meet the demands completely, need modify to it.Adopt the form of traditional setup of attribute dialog box that the property value of each element is set.Double-click element, will show a dialog box, in dialog box, show the value that user can revise.After user revises, click " determining " close box, the value of the new input of user will be presented on ladder diagram, i.e. the value of the new input of user has replaced original component attributes.
The deletion of element is exactly to choose element, utilizes the DEL key in delete key or the keyboard in toolbar to complete.
Syntax check
Carrying out ladder diagram to before instruction list conversion, guarantee that write ladder diagram does not meet the problem of standard.If had, may in the process of compiling, can provide error message.Therefore before instruction list conversion, carry out syntax check.
According to the feature of ladder diagram editor, first, whether have output winding or carry out coil, if do not had, report an error if detect each ladder diagram.Secondly check and whether have short circuit, open circuit conditions.The situation of short circuit is exactly between two parallel wires, to exist directly connected situation of straight line.When inspection, be exactly to check in turn whether whether the branch road between two adjacent parallel wires has straight line to be directly connected, can have element to judge by scanning between two parallel wires.If there is element, prove it is not short circuit, if the number of element is zero, be exactly short circuit.As for opening circuit, scanned element all can be carried out to record, if find the element not scanning in addition after inspection scanning process finishes, just prove that the branch road at this element place is for opening circuit.
After completing syntax check, can carry out next step work, ladder diagram is to instruction list conversion process, and this process comprises that ladder diagram arrives the transformation of tree, produced several steps such as instruction list language by tree, and process flow diagram is as shown in Figure 3.
Ladder diagram changes into instruction list
Ladder diagram is as a kind of graphical language, sequence of positions between row and capable, element and element and the attribute of each element self in the process of writing trapezoid figure program, are just stored, logical relation between element is not stored, and this is a difficult problem that must solve in the transfer process of ladder diagram.The present invention adopts the method centered by " binary tree " to realize the conversion of ladder diagram to instruction list.
When ladder diagram is accessed, be well-regulated, generally to start from left to right from bus, from top to bottom, therefore in setting up binary tree, there is certain rule: the node of each element of ladder diagram being regarded as to binary tree, start scanning by first element of the each step of ladder diagram, after having scanned, each step is set up to a binary tree.According to the similarity of ladder diagram and binary tree structure, will export as root node, other elements just look like to be the branch of binary tree.It should be noted that due to the serial or parallel connection that has piece, the logical relation between element also must be expressed as to the node of binary tree.Like this, can all utilize logical relation to associate all elements by scanning whole ladder diagram.So each ladder diagram network can be expressed as a binary tree, and the ordered arrangement that whole PLC user program is exactly a series of binary trees, namely binary tree forest.
The present invention has provided a kind of direction that " can flow " according to ladder diagram and has scanned ladder diagram, then sets up the method for binary tree by the inflow node of element in ladder diagram and the location logic relation flowing out between node, as shown in Figure 4.
The order of scanning ladder diagram is according to from left to right, and order from top to bottom, has just obtained the inflow node of each element and flowed out node, and these data are existed in storehouse.In the time scanning, in the time that the outflow node of certain element is identical with the inflow node of certain element, be designated as a value, just for the realization of parallel-connected blocks below provides convenience.Specific algorithm is as follows:
The 1st step, first determines the direction of scanning, if scanning from left to right, writes down respectively the inflow node of element and flows out the chain tabular value of node; If scanning from top to bottom, by the outflow node of the element first scanning and after the inflow node of the element that scans be designated as a value.Judge that the mode scanning is, whether the horizontal ordinate of the inflow node of the horizontal ordinate of the outflow node of the element that judgement first scans and the next element that will scan is identical, is direction of scanning from top to bottom if identical, otherwise, be scan mode from left to right.
The 2nd step, if the inflow node chain tabular value of first node-flow ingress chain tabular value and second node is identical, the outflow node chain tabular value of first node-flow egress chain tabular value and second node is identical, two nodes be or relation, set up OR node, set up a little binary tree, two elements are respectively left and right subtree, and what first scan is left subtree.If there are multiple element parallel connections, according to after the parallel connection of sequencing the first two element, result in parallel and the 3rd element parallel connection, set up binary tree, and other by that analogy.
The 3rd step, the inflow node chain tabular value of first node is identical with the outflow node chain tabular value of second node, two nodes be with relation, set up AND node, set up a little binary tree, two elements are respectively left and right subtree, and what first scan is left subtree.If there are multiple element series connection, according to after the series connection of sequencing the first two element, series connection result and the 3rd element series connection, set up binary tree, and other by that analogy.
The 4th step, the AND node of foundation and OR node, also set up new logical relation according to above-mentioned principle and other element, sets up new binary tree, by that analogy, converts ladder diagram to binary tree.
The 5th step: convert binary tree to instruction list language.
In setting up binary tree, series connection piece and parallel-connected blocks are all saved in chained list as data and have suffered.Therefore, realizing tree in the transfer process of instruction list, the present invention adopts postorder traversal method to travel through tree, converts binary tree to instruction list language, the namely left subtree of first access tree, then postorder traversal right subtree and root node successively.
Instruction list converts ladder diagram to
Being converted to trapezoid figure program from instruction catalogue program is the inverse process of trapezoid figure program to instruction catalogue program conversion.Therefore, above-mentioned transfer algorithm centered by binary tree is equally applicable to the conversion of instruction catalogue program to trapezoid figure program, as shown in Figure 5.
Be converted to trapezoid figure program by instruction catalogue program, needing problem to be processed is by the analysis to PLC instruction list, finds out its internal logic relation, and then obtains the logic state of output element, thereby realize the conversion of instruction list to ladder diagram.For instruction list and ladder diagram, the difference between the two is that ladder diagram is one-dimensional representation, and instruction code is two-dimensional representation.
While converting instruction list to ladder diagram, in the situation that confirming without grammer and logic error, first to scan instruction list.Concrete performing step is as follows:
1, do not have in vicious situation scan instruction table at definite grammer.When reading LD or LDN instruction, apply for that a node sets up binary tree, first node is as the left subtree of binary tree, simultaneously according to the node data of modifying of order binary tree.Generally, conversion adapts to obey some rules, is LD or LDN instruction as being connected with bus.
If 2 while reading AND or AND NOT instruction, be exactly that row increase instruction, now apply for two new nodes, a father node as binary tree, then another revise the each node data of new binary tree according to present instruction as the right subtree of binary tree.
If 3 while reading OR or OR NOT instruction, be exactly that row increases instruction, now apply for equally two new nodes, a father node as binary tree, then another revise the each node data of new binary tree according to present instruction as the right subtree of binary tree.
If 4 read ALD instruction or OLD instruction, now apply for that a new node is as father node, current binary tree and last binary tree are merged, form a new binary tree, wherein previous binary tree is left sibling, current binary tree is right node, then revises the each node data of new binary tree according to present instruction.
5, in the time that logical block and individual node operate, individual node is equivalent to read LD instruction, serve as left subtree; In the time that multiple logical blocks and individual node operate, individual node and first logical block be operated, then operate with other logical blocks successively, then revise the each node data of new binary tree according to present instruction.
6, repeat above-mentioned achievement method, until read OUT instruction, then revise the each node data of new binary tree according to present instruction, instruction list language conversion is become to binary tree.
7, adopt postorder traversal algorithm, convert binary tree to ladder diagram.

Claims (2)

1. a ladder diagram editor device method for designing for embedded programmable controller, comprises the steps:
Step 1: the design of component library;
Step 2: the drafting of ladder diagram;
Step 3: the modification of component attributes and deletion;
Step 4: syntax check:
First, whether have output winding or carry out coil, if do not had, report an error if detect each ladder diagram; Secondly check the generation that whether has short circuit, open circuit conditions: check in turn whether the branch road between two adjacent parallel wires has straight line to be directly connected, whether there is element to judge by scanning between two parallel wires, if there is element, prove it is not short circuit, if the number of element is zero, it is exactly short circuit, scanned element is all carried out to record, if find the element not scanning in addition after inspection scanning process finishes, just prove that the branch road at this element place is for opening circuit;
Step 5: ladder diagram changes into instruction list;
Adopt the method centered by " binary tree " to realize the conversion of ladder diagram to instruction list;
Step 6: instruction list converts ladder diagram to;
It is characterized in that, the method for building up of binary tree comprises the steps: described in step 5
The 1st step, first determines the direction of scanning, if scanning from left to right, writes down respectively the inflow node of element and flows out the chain tabular value of node; If scanning from top to bottom, by the outflow node of the element first scanning and after the inflow node of the element that scans be designated as a value; Judge that the mode scanning is, whether the horizontal ordinate of the inflow node of the horizontal ordinate of the outflow node of the element that judgement first scans and the next element that will scan is identical, is direction of scanning from top to bottom if identical, otherwise, be direction of scanning from left to right;
The 2nd step, if the inflow node chain tabular value of first node-flow ingress chain tabular value and second node is identical, the outflow node chain tabular value of first node-flow egress chain tabular value and second node is identical, two nodes be or relation, set up OR node, set up a little binary tree, two elements are respectively left and right subtree, and what first scan is left subtree; If there are multiple element parallel connections, according to after the parallel connection of sequencing the first two element, result in parallel and the 3rd element parallel connection, set up binary tree, by that analogy;
The 3rd step, if the outflow node chain tabular value of the inflow node chain tabular value of first node and second node is identical, two nodes be with relation, set up AND node, set up a little binary tree, two elements are respectively left and right subtree, and what first scan is left subtree; If there are multiple element series connection, according to after the series connection of sequencing the first two element, series connection result and the 3rd element series connection, set up binary tree, by that analogy;
The 4th step, the AND node of foundation and OR node, also set up new logical relation according to above-mentioned principle and other element, sets up new binary tree, by that analogy, converts ladder diagram to binary tree;
The 5th step: convert binary tree to instruction list language;
Described in step 6, instruction list converts ladder diagram to, is in the situation that confirming without grammer and logic error, first will scan instruction list, and concrete performing step is as follows:
1) do not have in vicious situation at definite grammer, scan instruction table, when reading LD or LDN instruction, apply for that a node sets up binary tree, first node, as the left subtree of binary tree, is then revised the node data of new binary tree according to the component data being kept in chained list after scanning in present instruction and step 5;
2) if while reading AND or AND NOT instruction, be exactly that row increase instruction, now apply for two new nodes, a father node as binary tree, then another revise the each node data of new binary tree according to the component data being kept in chained list after scanning in present instruction and step 5 as the right subtree of binary tree;
3) if while reading OR or OR NOT instruction, be exactly that row increases instruction, now apply for equally two new nodes, a father node as binary tree, then another revise the each node data of new binary tree according to the component data being kept in chained list after scanning in present instruction and step 5 as the right subtree of binary tree;
4) if read ALD instruction or OLD instruction, now apply for that a new node is as father node, current binary tree and last binary tree are merged, form a new binary tree, wherein previous binary tree is left sibling, current binary tree is right node, then revises the each node data of new binary tree according to the component data being kept in chained list in present instruction and step 5 after scanning;
5) in the time that logical block and individual node operate, individual node is equivalent to read LD instruction, serve as left subtree; In the time that multiple logical blocks and individual node operate, individual node and first logical block to be operated, then operate with other logical blocks successively, then revise the each node data of new binary tree according to the component data being kept in chained list in present instruction and step 5 after scanning;
6) repeat above-mentioned achievement method, until read OUT instruction, then revise the each node data of new binary tree according to the component data being kept in chained list in present instruction and step 5 after scanning, instruction list language conversion is become to binary tree;
7) adopt postorder traversal method, convert binary tree to ladder diagram.
2. the ladder diagram editor device method for designing of embedded programmable controller according to claim 1, it is characterized in that, in setting up binary tree, series connection piece and parallel-connected blocks are all saved in chained list as data, realizing tree in the transfer process of instruction list, adopt postorder traversal method to travel through tree, convert binary tree to instruction list language, the namely left subtree of first access tree, then postorder traversal right subtree and root node successively.
CN201110308100.7A 2011-10-11 2011-10-11 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller) Expired - Fee Related CN102508654B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110308100.7A CN102508654B (en) 2011-10-11 2011-10-11 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110308100.7A CN102508654B (en) 2011-10-11 2011-10-11 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Publications (2)

Publication Number Publication Date
CN102508654A CN102508654A (en) 2012-06-20
CN102508654B true CN102508654B (en) 2014-07-02

Family

ID=46220747

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110308100.7A Expired - Fee Related CN102508654B (en) 2011-10-11 2011-10-11 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Country Status (1)

Country Link
CN (1) CN102508654B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559727B (en) * 2013-11-20 2016-04-20 北京四方继保自动化股份有限公司 A kind of ladder diagram data structure describes and scanning analytic method
CN103942081A (en) * 2014-03-07 2014-07-23 东莞市升力智能科技有限公司 Method for generating IL instruction lists of PLC ladder diagrams
CN104317631B (en) * 2014-10-24 2018-02-09 湖南先步信息股份有限公司 Conversion method of the statement list to ladder diagram
CN104331314B (en) * 2014-10-31 2017-06-27 郑州众智科技股份有限公司 A kind of method that PLC ladder diagrams based on generator set controller turn instruction catalogue
CN104460489B (en) * 2014-11-12 2017-04-12 郑州众智科技股份有限公司 Method for converting PLC instruction list into ladder diagram based on generator set controller
CN104834525A (en) * 2015-05-14 2015-08-12 南京南瑞继保电气有限公司 Graphical page linked network processing method based on relay points
JP6325500B2 (en) * 2015-09-17 2018-05-16 ファナック株式会社 Ladder diagram monitor device that can additionally display the operation status of CNC during comment
CN106990750B (en) * 2017-04-01 2019-12-24 贝加莱工业自动化(中国)有限公司 Ladder diagram online editing method
CN107678393B (en) * 2017-08-30 2020-10-27 广东工业大学 Intelligent spraying control system and method based on soft PLC
CN112180817B (en) * 2019-07-02 2021-11-16 北京东土科技股份有限公司 Method, device, equipment and storage medium for transforming ladder diagram into binary tree
CN110471700B (en) * 2019-08-06 2021-06-29 Oppo广东移动通信有限公司 Graphic processing method, apparatus, storage medium and electronic device
CN112327744B (en) * 2020-11-20 2021-10-22 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588256A (en) * 2004-09-23 2005-03-02 艾默生网络能源有限公司 Method and system for changing ladder diagram program into instruction listing program
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

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588256A (en) * 2004-09-23 2005-03-02 艾默生网络能源有限公司 Method and system for changing ladder diagram program into instruction listing program
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

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于嵌入式***的软PLC技术研究;袁海英等;《广西工学院学报》;20071231;第18卷(第4期);72-75 *
袁海英等.基于嵌入式***的软PLC技术研究.《广西工学院学报》.2007,第18卷(第4期),72-75.

Also Published As

Publication number Publication date
CN102508654A (en) 2012-06-20

Similar Documents

Publication Publication Date Title
CN102508654B (en) Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)
Park et al. Plant model generation for PLC simulation
CN103605660B (en) Graphic processing method for SCD (Substation Configuration Description) file
CN104239115A (en) Programming language compiling method of PLC (Programmable Logic Controller)
GB2213967A (en) Knowledge based method and apparatus for designing integrated circuits using functional specifications
CN104484499A (en) Dynamic simulation image rapid generation method for substation secondary circuit
Gourcuff et al. Efficient representation for formal verification of PLC programs
CN103941650B (en) Logical AND motion integrated manipulator
CN115098218B (en) Description and simulation method from FMU model to functional block model in configuration software
CN103942081A (en) Method for generating IL instruction lists of PLC ladder diagrams
CN110222407A (en) A kind of fusion method and device of BIM data
CN115562629A (en) RPA flow representation method, system, device and storage medium
CN101561671A (en) Method for deigning ladder diagram based on components
CN107122338A (en) A kind of method that functional diagram for digitizing I&C system is automatically converted into configuration file
CN101206468A (en) Modelling method in computer numerical control field
WO2014170992A1 (en) Programming tool
CN103885810A (en) Gerber file compiler based on regular expressions
CN112966315A (en) Three-dimensional design system and method for secondary automation system of intelligent substation
CN102937910B (en) System and method for cross-platform conversion of control algorithms
CN104238438A (en) PLC universal platform and design method thereof
Lyu et al. On automatic generation of OPC UA connections in IEC 61499 automation systems
CN115587480A (en) Digital simulation method and digital simulation device
CN108897535A (en) The method that primary compiling generates multiple configuration figures
CN114238072A (en) HIL requirement design method, HIL requirement design device, computer equipment and storage medium
CN112818433A (en) Rapid modeling method for simulation model of control system of nuclear power plant

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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140702

Termination date: 20161011