CN101957745A - Method for converting ladder diagram language into structure text language - Google Patents

Method for converting ladder diagram language into structure text language Download PDF

Info

Publication number
CN101957745A
CN101957745A CN2009100125824A CN200910012582A CN101957745A CN 101957745 A CN101957745 A CN 101957745A CN 2009100125824 A CN2009100125824 A CN 2009100125824A CN 200910012582 A CN200910012582 A CN 200910012582A CN 101957745 A CN101957745 A CN 101957745A
Authority
CN
China
Prior art keywords
node
dummy
treatment
language
rule
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
CN2009100125824A
Other languages
Chinese (zh)
Other versions
CN101957745B (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 Zhongke CNC Technology Co.,Ltd.
Original Assignee
SHENYANG HIGH-END COMPUTER NUMERICAL CONTROL TECHNOLOGY Co Ltd
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 HIGH-END COMPUTER NUMERICAL CONTROL TECHNOLOGY Co Ltd, Shenyang Institute of Computing Technology of CAS filed Critical SHENYANG HIGH-END COMPUTER NUMERICAL CONTROL TECHNOLOGY Co Ltd
Priority to CN 200910012582 priority Critical patent/CN101957745B/en
Publication of CN101957745A publication Critical patent/CN101957745A/en
Application granted granted Critical
Publication of CN101957745B publication Critical patent/CN101957745B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a method for converting ladder diagram language into structure text language, which comprises the following steps of: storing the ladder diagram language into a storage structure beneficial to edition and conversion, and introducing virtual nodes at intersection points between vertical lines and other ladder diagram symbols which refer to real nodes; merging the virtual nodes to form an AOV (Amplitude Versus Offset) diagram; and converting the AOV diagram into a structure text by classifying different types of nodes according to the node sequence of the AOV diagram in topological sorting. The method has generality and can be used for accurately and effectively convert any complex ladder diagram into a structure text. Visual ladder diagram programming is realized in places where only structure text programming can be used formerly, so that user use is convenient, the threshold of PLC (Programmable Logic Controller) programming is reduced, and the programming efficiency of PLC is increased.

Description

Trapezoid figure language is converted to the method for structure text language
Technical field
The present invention relates to a kind of technology of utilizing the conversion of computer software implementation language, specifically a kind of trapezoid figure language is converted to the method for structure text language.
Background technology
Equipment manufacture is the basic industry of national economy and national defense construction, and its core technology is a digital control system.Programmable Logic Controller (PLC, Programmable Logic Controller) is the important component part of digital control system, and it has functions such as logical operation, arithmetical operation, timing, counting, data processing, transmission, communication, self diagnosis.The promulgation of rapid development of computer technology and IEC 61131-3 standard has promoted further developing of PLC.5 kinds of standard PLC programming languages of IEC 61131-3 standard code comprise 3 kinds of graphical language and 2 kinds of text language, are respectively ladder diagram (LD), order functional diagram (SFC), FBD (function block diagram) (FBD), structure text (ST), instruction list (IL).Wherein ladder diagram is very similar to the circuit diagram of electric control system, has visual and understandable advantage, be easy to be grasped by the electric personnel of factory, and be the main programming language of PLC.But, in present many digital control systems, can only directly move the text programming language.The text programming language is not directly perceived, and programming threshold height has limited the development and the application of digital control system.
Ladder diagram is a kind of graphical programming language of IEC 61131-3 standard code, as shown in Figure 1, can be used to representation function, and functional block and program are the behavior of program organization unit, and behavior and transfer in the order functional diagram.It is by the most widely-used a kind of graphical language in the PLC programming based on figured relay logic.The and arranged on left and right sides of trapezoid figure program has two vertical electric power paths, nominally the electric power path in left side is the electric power path on right side for power circuit provides energy, the terminal point of power circuit along horizontal step by each contact, function, functional block, coil etc. from left to right.The state of a Boolean variable has been represented in each contact, and each coil has been represented the state of a physical device.
Structure text is a kind of senior text language of IEC 61131-3 standard code, as shown in Figure 2, can be used for representation function, the behavior of functional block and program, the behavior that can also describe step, action and change in the order functional flow diagram.It is a programming language of developing for Industry Control Application specially, is mainly used in variable assignments, callback function and functional block, establishment expression formula, writes conditional statement and iterative program etc.Structure text program format freedom can be inserted tab, line feed character and note Anywhere between keyword and identifier.For the personnel of familiar with computers higher level lanquage exploitation, the structure text language is easy to learn and use especially, but it is directly perceived inadequately just to seem for the electrical engineering personnel of factory, grasps difficulty.
Therefore, realize the conversion of trapezoid figure language, under the environment that can only programme with structure text originally, realize that trapezoidal pattern programming is a very important problem, and still do not have the method for disclosed trapezoid figure language at present to the structure text language conversion to structure text.
Summary of the invention
At above shortcomings part in the prior art, the technical problem to be solved in the present invention provides the method that a kind of trapezoid figure language is converted to the structure text language, to realize the quick conversion of any trapezoid figure language to the structure text language.
For solving the problems of the technologies described above, the technical solution used in the present invention is:
The method that a kind of trapezoid figure language of the present invention is converted to the structure text language may further comprise the steps:
Trapezoid figure language is stored as helps the storage organization editing and change, the intersection point place that is included in other icons of vertical line and ladder diagram and is real node introduces dummy node;
Dummy node is merged, form AOV figure;
According to above-mentioned AOV figure, according to the node order of its topological sorting, handle according to the dissimilar classification of each node, AOV figure is converted to structure text.
The described storage organization that helps editing and changing is: be used to store the memory storage internal pointer direction of trapezoid figure language for reaching downward two kinds to the right.
Described dummy node is merged is the dummy node of Y coordinate minimum in the ladder diagram plane that the dummy node in the ladder diagram branch is merged to this branch.
Described node order according to its topological sorting is handled according to the dissimilar classification of each node, AOV figure is converted to structure text may further comprise the steps:
Judge whether AOV figure exists next dummy node or real node;
As existing, judge that then what type node is;
If be the common node in the real node, then carry out common node and handle;
If be dummy node, then carry out dummy node and handle;
If be the output node in the real node, then carry out output node and handle.
If there is no next dummy node or real node, then end process.
It is described that to carry out that common node handles be that the various conditions of each common node are judged that the rule of processing is as follows:
Rule 1: handling the node number of being expert at last time is-1, and when the in-degree of pre-treatment node was 0, operational character was empty;
Rule 2: when the row of pre-treatment node number with handled the number of being expert at of node institute last time when identical, operational character is " * ";
Rule 3: when pre-treatment node during for the next node of the dummy node just handled, operational character be a sky;
Rule 4: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node be same node toward first dummy node of output terminal direction and the dummy node of a last processed node, operational character is "+";
Rule 5: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node is not same node toward first dummy node of output terminal direction and the dummy node of a last processed node, when the pre-treatment node toward the in-degree of first dummy node of output terminal direction less than 2, operational character is "+";
Rule 6: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node is not same node toward first dummy node of output terminal direction and the dummy node of a last processed node, when the pre-treatment node toward the in-degree of first dummy node of output terminal direction more than or equal to 2, operational character is "+(";
Rule 7: when the pre-treatment node toward the in-degree of first dummy node of output terminal direction greater than 2, when the pre-treatment node be a sky toward first dummy node of input direction, when the pre-treatment node toward the out-degree of first dummy node of input direction greater than 1, current out-degree is 0, when the pre-treatment node is not 0 toward the current in-degree of first dummy node of input direction, the next node of this node is dummy node or horizontal line, and one ") will be added in this node back ".If when the pre-treatment node toward the row of first dummy node of input direction number greater than when the pre-treatment node toward the row of first dummy node of output terminal direction number, do not exist other node to satisfy above-mentioned condition in addition, and row is number bigger than the row of this node, at this moment adds one ") in this node back "; Record has added ") " node and right when the pre-treatment node accordingly toward first dummy node of input direction, use during for the processing dummy node;
Rule 8: when the pre-treatment node is worked as pre-treatment node first dummy nodes toward input direction toward the in-degree of first dummy node of output terminal direction greater than 2, when the pre-treatment node be a sky toward first dummy node of input direction, when the pre-treatment node toward the out-degree of first dummy node of input direction greater than 1, current out-degree and current in-degree are 0, the next node of this node is a dummy node, and this moment, one ") will be added in this node back ".Record has added ") " node and right when the pre-treatment node accordingly toward first dummy node of input direction, use during for the processing dummy node.
It is described that to carry out that dummy node handles be that the various conditions of each dummy node are judged that the rule of processing is as follows:
N: when the pre-treatment node; RightBracket: right parenthesis discriminant function; LeftBracket: left parenthesis discriminant function; HL: horizontal line; OC: operational character, wherein " * " represents AND, "+" expression OR;
Rule 1): when the in-degree and the out-degree of pre-treatment node all is 0, then the node of this dummy node for abandoning in the process that merges at dummy node need not be handled;
Rule 2): when the in-degree of pre-treatment node was 1, operational character added sky;
Rule 3): when the in-degree of pre-treatment node is 2, add one ") ";
Rule 4): when the in-degree of pre-treatment node greater than 2 the time, call right parenthesis discriminant function RightBracket () judge to add ") " number;
Rule 5): when the in-degree of pre-treatment node more than or equal to 1, and when the next node of pre-treatment node was not horizontal line, operational character will be added " * ";
Rule 6): when the out-degree of pre-treatment node was 1, operational character added sky;
Rule 7): when the out-degree of pre-treatment node was 2, operational character added " (";
Rule 8): when the out-degree of pre-treatment node greater than 2 the time, call left parenthesis discriminant function LeftBracket () and judge and will add " the number of (".
Described right parenthesis discriminant function RightBracket () is according to each the caudal knot point n2 that goes into arc when the pre-treatment node, reverse scanning to one a dummy node n1, the row of this dummy node n1 number is less than or equal to when the row of pre-treatment node n number, and deletion added ") handling to have write down in the middle of common node rule 7 and rule 8 processing procedures " record added ") " node and accordingly when the pre-treatment node toward first dummy node of input direction to n1, n2; Accumulative total residue record has added ") " node and accordingly when the pre-treatment node right toward first dummy node of input direction, and record, accumulative total different records occurs and added ") " record added ") " node and accordingly when the pre-treatment node toward first dummy node of input direction to n1, the logarithm of n2 is and will adds ") " number.
Described left parenthesis discriminant function LeftBracket () is according to each node that goes out arc when the pre-treatment node, forward scan to one a dummy node n1, the row of this dummy node n1 number is equal to or less than when the row of pre-treatment node n number, the number of different dummy node n1 appears in accumulative total, is and will adds " the number of (".
Described output node is handled and is comprised:
") checked in the parenthesis matching that common node is handled and dummy node is handled the expression formula of back formation " more at most up front polishing " (" exports the complete structure text sentence at last, the end process process.
The present invention has following beneficial effect and advantage:
1. the present invention has versatility, can correctly, effectively change any complicated ladder diagram is structure text, realizes visual in image trapezoidal pattern programming in place that originally can only the programming of utilization structure text, convenient for users to use, reduce the threshold of PLC programming, improved the programming efficiency of PLC.
Description of drawings
Fig. 1 is a simple ladder diagram statement;
Fig. 2 is and the corresponding structure text statement of Fig. 1;
Fig. 3 is the ladder diagram statement of a logic complexity;
Fig. 4 is the storage organization of the ladder diagram of Fig. 3 by data structure that the present invention adopts;
Fig. 5 is that the ladder diagram storage organization merges the AOV figure that the back forms among Fig. 4;
Fig. 6 is the process flow diagram of conversion method of the present invention;
Fig. 7 is apparatus of the present invention structured flowchart.
Embodiment
The method that a kind of trapezoid figure language of the present invention is converted to the structure text language may further comprise the steps:
Trapezoid figure language is stored as helps the storage organization editing and change, the intersection point place that is included in other icons of vertical line and ladder diagram and is real node introduces dummy node;
Dummy node is merged, form AOV figure;
According to above-mentioned AOV figure, according to the node order of its topological sorting, handle according to the dissimilar classification of each node, AOV figure is converted to structure text.
Present embodiment is an example with ladder diagram shown in Figure 3, and in the process of this ladder diagram of editor, the ladder diagram icon links to each other by connection in series-parallel relation, can with ladder diagram abstract be graph data structure, wherein icon is the summit of figure, annexation is an arc.For choose suitable rule by condition judgment more easily in node-classification is handled, the present invention adopts and helps editor and the storage of data converted structure, comprises being used to store the memory storage internal pointer direction of trapezoid figure language for reaching downward two kinds to the right.
typedef?struct__node{
Unsigned int type; // node type
Pos p; // site position
ParamList*Param; // node parameter
Void*firstin; // go into arc
Void*firstout; // go out arc
Int In; // in-degree
Int Out; // out-degree
Int curIn; // current in-degree
Int curOut; // current out-degree
Int visited; // access identities whether
Struct__node*next; // next node
Node; // node data structure
In the above Node data structure, current in-degree curIn and current out-degree curOut, thus be that the variable Rule of judgment of realizing topological sorting and being used as in the node processing procedure selects to handle rule in transfer process.
typedef?struct__arc{
Node*tail; The caudal knot point that // arc points to
Node*head; The node that // arc points to
Struct__arc*hlink; Another identical arc of // sensing arc head
Struct__arc*tlink; Another identical arc of // sensing arc tail
Arc; // arc data structure
Utilize above data structure storage ladder diagram shown in Figure 3, remove real node represent each icon 1,2,3,4,5,6,7,8,9,10,11,12,13,14, outside the 15}, position increase dummy node { a, b, c, d, e, f, g, h, i, j, k, l, m, n, the o} that intersects in parallel arranged.
Thus the storage organization of this ladder diagram of gained as shown in Figure 4, its arc points to be had only downwards or two kinds to the right.It is the dummy node of Y coordinate minimum in the ladder diagram plane that the dummy node in the ladder diagram branch is merged to this branch that dummy node is merged, and by the merging of dummy node, forms AOV figure, as shown in Figure 5.With dummy node j} is an example for c, g, when scanning dummy node c, the deletion arc<c, g 〉, the in-degree of g subtracts 1, the deletion arc<g, 10 〉, the out-degree of g subtracts 1, increases an arc<c, 10; Deletion arc<g, j 〉, the in-degree of j subtracts 1, deletion arc<j, 12〉and, the out-degree of j subtracts 1, increases an arc<c, 12 〉, so just { c, g, j} merge into dummy node c with dummy node.Other dummy nodes merge the same processing.After the merging, effectively dummy node only surplus a, b, c, d, k, l} sets up AOV figure thus.
According to the node order of its topological sorting, handle according to the dissimilar classification of each node, AOV figure is converted to structure text may further comprise the steps:
Judge whether AOV figure exists next dummy node or real node;
As existing, judge that then what type node is;
If be the common node in the real node, then carry out common node and handle;
If be dummy node, then carry out dummy node and handle;
If be the output node in the real node, then carry out output node and handle;
If there is no next dummy node or real node, then end process.
The method of topological sorting is, from left to right retrieves each node from top to bottom, handles current in-degree and be 0 node, and with its visit bit-identify, each current in-degree that goes out the node that arc points to subtracts 1 with it, and deletes this and go out arc, handles next current in-degree then and be 0 node.Like this order handled of node just be 1,2,5, c, 6,7, e, f, g, 10,11, d, 8, h, i, j, 12, k, 13, m, n, 15, l, 14, a, 3,9, b, 4, o}.They are divided into three types of processing, the processing sequence of common node be 1,2,5,6,7,10,11,8,12,13,15,14,3,9,4}, the processing sequence of dummy node be c, e, g, d, h, i, j, k, m, n, l, a, b, o}, output node are { 4}.
It is described that to carry out that common node handles be that the various conditions of each common node are judged that the rule of processing is as follows:
Used primary variables explanation: n: in the processing procedure when the pre-treatment node; M: node; VP: when pre-treatment node n first dummy node toward the output terminal direction; NV: the VP that preserves a node; LV: the dummy node of just having handled recently; LFV: when pre-treatment node first dummy node toward input direction; LL: handled the node number of being expert at last time, initial value is-1; VN: dummy node; HL: horizontal line; OC: operational character, wherein " * " represents AND, "+" expression OR; OCR: the operational character on the special node of part right side.
Rule 1: handling the node number of being expert at last time is-1, and when the in-degree of pre-treatment node is 0, and operational character is empty (OC:=NULL iff LL=-1 ∧ n->In=0);
Rule 2: when the row of pre-treatment node number with handled the number of being expert at of node institute last time when identical, operational character is " * " (OC:=" * " iff n->p->y=LL);
Rule 3: when pre-treatment node during for the next node of the dummy node just handled, operational character be sky (NULL iff n=LV->next);
Rule 4: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and working as the pre-treatment node is same node toward first dummy node of output terminal direction and the dummy node of a last processed node, and operational character is "+" (OC:="+" iff n->p->y ≠ LL ∧ VP=NV ∧ VP->In<2);
Rule 5: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node is not same node toward first dummy node of output terminal direction and the dummy node of a last processed node, when the pre-treatment node toward the in-degree of first dummy node of output terminal direction less than 2, operational character is "+" (OC:="+(" iff n->p->y ≠ LL ∧ VP ≠ NV ∧ VP->In>1);
Rule 6: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node is not same node toward first dummy node of output terminal direction and the dummy node of a last processed node, when the pre-treatment node toward the in-degree of first dummy node of output terminal direction more than or equal to 2, operational character is "+(" (OCR:=") " iff VP->In>2 ∧ LFV ≠ NULL ∧ LFV->Out>1 ∧ n->curIn=0 ∧ VP->curIn ≠ 0 ∧ (n->next=VN ∨ n->next=HL));
Rule 7: when the pre-treatment node toward the in-degree of first dummy node of output terminal direction greater than 2, when the pre-treatment node be a sky toward first dummy node of input direction, when the pre-treatment node toward the out-degree of first dummy node of input direction greater than 1, current out-degree is 0, when the pre-treatment node is not 0 toward the current in-degree of first dummy node of input direction, the next node of this node is dummy node or horizontal line, and one ") will be added in this node back ".If when the pre-treatment node toward the row of first dummy node of input direction number greater than when the pre-treatment node toward the row of first dummy node of output terminal direction number, do not exist other node to satisfy above-mentioned condition in addition, and row is number bigger than the row of this node, at this moment adds one ") in this node back "; Record has added ") " node and accordingly when the pre-treatment node right toward first dummy node of input direction, use when handling dummy node (OCR:=OCR+ ") " iffLFV->p->y>VP->p->y ∧ (
Figure B2009100125824D0000071
M P7 (m)=TURE ∧ m->p->y>n->p->y) (record has added ") " n and corresponding LFV, use during for the processing dummy node));
Rule 8: when the pre-treatment node is worked as pre-treatment node first dummy nodes toward input direction toward the in-degree of first dummy node of output terminal direction greater than 2, when the pre-treatment node be a sky toward first dummy node of input direction, when the pre-treatment node toward the out-degree of first dummy node of input direction greater than 1, current out-degree and current in-degree are 0, the next node of this node is a dummy node, and this moment, one ") will be added in this node back ".Record has added ") " node and accordingly when the pre-treatment node right toward first dummy node of input direction, use when handling dummy node (OCR:=") " iff VP->In>2 ∧ LFV ≠ NULL ∧ LFV->out>1 ∧ n->curIn=0 ∧ n->curOut=0 ∧ n->next=VN (record has added ") " n and corresponding LFV, use during for the processing dummy node)).
Carrying out the dummy node processing is that the various conditions of each dummy node are judged that the rule of processing is as follows:
N: when the pre-treatment node; RightBracket: right parenthesis discriminant function; LeftBracket: left parenthesis discriminant function; HL: horizontal line; OC: operational character, wherein " * " represents AND, "+" expression OR;
Rule 1): when the in-degree and the out-degree of pre-treatment node all is 0, then the node of this dummy node for abandoning in the process that merges at dummy node need not be handled (iff n->curIn=0 ∧ n->curOut=0 (node of this dummy node for abandoning in the process that merges at dummy node));
Rule 2): when the in-degree of pre-treatment node was 1, operational character added sky (OC:=NULLiff n->In=1);
Rule 3): when the in-degree of pre-treatment node is 2, add one ") " (OC:=") " iff n->In=2);
Rule 4): when the in-degree of pre-treatment node greater than 2 the time, call right parenthesis discriminant function RightBracket () judge to add ") " number (OC:=RightBracket () iff n->In>2);
Rule 5): when the in-degree of pre-treatment node more than or equal to 1, and when the next node of pre-treatment node is not horizontal line, operational character will be added " * " (OC:=OC+ " * " iff n->In>0 ∧ n->next ≠ HL);
Rule 6): when the out-degree of pre-treatment node was 1, operational character added sky (OC:=OC+NULLiff n->Out=1);
Rule 7): when the out-degree of pre-treatment node was 2, operational character added " (" (OC:=OC+ " (" iff n->Out=2);
Rule 8): when the out-degree of pre-treatment node greater than 2 the time, call left parenthesis discriminant function LeftBracket () and judge and will add " the number of (" (OC:=OC+LeftBracket () iff n->Out>2).
Described right parenthesis discriminant function RightBracket () is according to each the caudal knot point n2 that goes into arc when the pre-treatment node, reverse scanning to one a dummy node n1, the row of this dummy node n1 number is less than or equal to when the row of pre-treatment node n number, and deletion added ") handling to have write down in the middle of common node rule 7 and rule 8 processing procedures " record added ") " node and accordingly when the pre-treatment node toward first dummy node of input direction to n1, n2; Accumulative total residue record has added ") " node and accordingly when the pre-treatment node right toward first dummy node of input direction, and record, accumulative total different records occurs and added ") " record added ") " node and accordingly when the pre-treatment node toward first dummy node of input direction to n1, the logarithm of n2 is and will adds ") " number.
Described left parenthesis discriminant function LeftBracket () is according to each node that goes out arc when the pre-treatment node, forward scan to one a dummy node n1, the row of this dummy node n1 number is equal to or less than when the row of pre-treatment node n number, the number of different dummy node n1 appears in accumulative total, is and will adds " the number of (".
It is that ") checked in parenthesis matching to common node is handled and dummy node is handled the expression formula of back formation that output node is handled " more at most up front polishing " (" exports the complete structure text sentence at last, the end process process.
The processing sequence that each node draws by preamble selects suitable rule to handle, and is as follows:
Node Rule OpCode Expression formula
?1 P1 NULL 1
?2 P2 * 1*2
?5 P5 + 1*2+5
?c X2,X8 *(( 1*2+5*((
?6 P3 NULL 1*2+5*((6
?7 P2 * 1*2+5*((6*7
?e,f,g X1 1*2+5*((6*7
?10 P4 + 1*2+5*((6*7+10
?11 P2 * 1*2+5*((6*7+10*11
?d X3 ) 1*2+5*((6*7+10*11)
?8 P2 * 1*2+5*((6*7+10*11)*8
h,i,j X1 1*2+5*((6*7+10*11)*8
12 P4 + 1*2+5*((6*7+10*11)*8+12
k X5,X7 *( 1*2+5*((6*7+10*11)*8+12*(
13 P3 NULL 1*2+5*((6*7+10*11)*8+12*(13
m,n X1 1*2+5*((6*7+10*11)*8+12*(13
15 P4 + 1*2+5*((6*7+10*11)*8+12*(13+15
1 X3,X6 ) 1*2+5*((6*7+10*11)*8+12*(13+15)
14 P2 * 1*2+5*((6*7+10*11)*8+12*(13+15)*14
a X4,X7 ))*( 1*2+5*((6*7+10*11)*8+12*(13+15)*14))*(
3 P3 NULL 1*2+5*((6*7+10*11)*8+12*(13+15)*14))*(3
9 P4 + 1*2+5*((6*7+10*11)*8+12*(13+15)*14))*(3+9
b X3,X6 ) 1*2+5*((6*7+10*11)*8+12*(13+15)*14))*(3+9)
4 Output ( 4=(1*2+5*((6*7+10*11)*8+12*(13+15)+14))*(3+9)
Above-mentioned conversion method needs one to be used to edit the storage editing machine of row trapezoid figure language arbitrarily, one is used to merge dummy node, form the AOV figure converter of AOV figure, and one be used for that AOV figure is carried out topological sorting and obtain each node processing sequence, and the structure text converter that obtains the structure text language is handled in each node classification.
Editing machine is made up of with dummy node insert module and ladder diagram display module icon insert module, arc.Wherein the icon insert module is inserted icon according to position of inserting and type, and is accepted correlation parameter when editor's ladder diagram; Arc and dummy node insert module are judged new necessary arc and the dummy node of relation interpolation that inserts icon and former icon; At last demonstrate ladder diagram at display on the common computer or the display on the digital control system by the ladder diagram display module.
AOV figure converter merges module by dummy node scan module and dummy node and forms.AOV figure converter is scanned all dummy nodes by the dummy node scan module after receiving the ladder diagram that is editted by editing machine, finds out the dummy node that meets the merging condition; Transfer to dummy node for the dummy node that meets the merging condition and merge resume module, dummy node merges module the dummy node in the branch of required processing dummy node place is merged into a dummy node, forms AOV figure.
The structure text converter is made up of AOV figure node topological sorting module, node classification processing module and structure text acquisition module.The structure text converter is schemed each node topological sorting by AOV figure node topological sorting module to AOV after receiving the AOV figure of AOV figure converter, obtains a node sequence; Node classification processing module is handled each node one by one according to this node sequence then, by structure text statement acquisition module the structure text statement is printed on the display screen at last and also simultaneously the structure text statement is write file.
The inventive method realizes with Programming with Pascal Language such as C, C++, Delphi, may operate in DOS, Windows, the linux system.According to the above conversion method that provides, can be integrated into independently PLC system, also can make functional block and be integrated in the existing digital control system, increase the programming mode of digital control system.

Claims (10)

1. a trapezoid figure language is converted to the method for structure text language, it is characterized in that may further comprise the steps:
Trapezoid figure language is stored as helps the storage organization editing and change, the intersection point place that is included in other icons of vertical line and ladder diagram and is real node introduces dummy node;
Dummy node is merged, form AOV figure;
According to above-mentioned AOV figure, according to the node order of its topological sorting, handle according to the dissimilar classification of each node, AOV figure is converted to structure text.
2. be converted to the method for structure text language by the described trapezoid figure language of claim 1, it is characterized in that: the described storage organization that helps editing and changing is: be used to store the memory storage internal pointer direction of trapezoid figure language for reaching downward two kinds to the right.
3. be converted to the method for structure text language by the described trapezoid figure language of claim 1, it is characterized in that: described dummy node is merged is the dummy node of Y coordinate minimum in the ladder diagram plane that the dummy node in the ladder diagram branch is merged to this branch.
4. be converted to the method for structure text language by the described trapezoid figure language of claim 1, it is characterized in that: described node order according to its topological sorting, handle according to the dissimilar classification of each node, AOV figure is converted to structure text may further comprise the steps:
Judge whether AOV figure exists next dummy node or real node;
As existing, judge that then what type node is;
If be the common node in the real node, then carry out common node and handle;
If be dummy node, then carry out dummy node and handle;
If be the output node in the real node, then carry out output node and handle.
5. be converted to the method for structure text language by the described trapezoid figure language of claim 4, it is characterized in that: if there is no next dummy node or real node, then end process.
6. be converted to the method for structure text language by the described trapezoid figure language of claim 4, it is characterized in that:
It is described that to carry out that common node handles be that the various conditions of each common node are judged that the rule of processing is as follows:
Rule 1: handling the node number of being expert at last time is-1, and when the in-degree of pre-treatment node was 0, operational character was empty;
Rule 2: when the row of pre-treatment node number with handled the number of being expert at of node institute last time when identical, operational character is " * ";
Rule 3: when pre-treatment node during for the next node of the dummy node just handled, operational character be a sky;
Rule 4: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node be same node toward first dummy node of output terminal direction and the dummy node of a last processed node, operational character is "+";
Rule 5: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node is not same node toward first dummy node of output terminal direction and the dummy node of a last processed node, when the pre-treatment node toward the in-degree of first dummy node of output terminal direction less than 2, operational character is "+";
Rule 6: when the row of pre-treatment node number with to handle the number of being expert at of node institute last time inequality, and when the pre-treatment node is not same node toward first dummy node of output terminal direction and the dummy node of a last processed node, when the pre-treatment node toward the in-degree of first dummy node of output terminal direction more than or equal to 2, operational character is "+(";
Rule 7: when the pre-treatment node toward the in-degree of first dummy node of output terminal direction greater than 2, when the pre-treatment node be a sky toward first dummy node of input direction, when the pre-treatment node toward the out-degree of first dummy node of input direction greater than 1, current out-degree is 0, when the pre-treatment node is not 0 toward the current in-degree of first dummy node of input direction, the next node of this node is dummy node or horizontal line, and one ") will be added in this node back ".If when the pre-treatment node toward the row of first dummy node of input direction number greater than when the pre-treatment node toward the row of first dummy node of output terminal direction number, do not exist other node to satisfy above-mentioned condition in addition, and row is number bigger than the row of this node, at this moment adds one ") in this node back "; Record has added ") " node and right when the pre-treatment node accordingly toward first dummy node of input direction, use during for the processing dummy node;
Rule 8: when the pre-treatment node is worked as pre-treatment node first dummy nodes toward input direction toward the in-degree of first dummy node of output terminal direction greater than 2, when the pre-treatment node be a sky toward first dummy node of input direction, when the pre-treatment node toward the out-degree of first dummy node of input direction greater than 1, current out-degree and current in-degree are 0, the next node of this node is a dummy node, and this moment, one ") will be added in this node back ".Record has added ") " node and right when the pre-treatment node accordingly toward first dummy node of input direction, use during for the processing dummy node.
7. be converted to the method for structure text language by the described trapezoid figure language of claim 4, it is characterized in that: described to carry out that dummy node handles be that the various conditions of each dummy node are judged that the rule of processing is as follows:
N: when the pre-treatment node; RightBracket: right parenthesis discriminant function; LeftBracket: left parenthesis discriminant function; HL: horizontal line; OC: operational character, wherein " * " represents AND, "+" expression OR;
Rule 1): when the in-degree and the out-degree of pre-treatment node all is 0, then the node of this dummy node for abandoning in the process that merges at dummy node need not be handled;
Rule 2): when the in-degree of pre-treatment node was 1, operational character added sky;
Rule 3): when the in-degree of pre-treatment node is 2, add one ") ";
Rule 4): when the in-degree of pre-treatment node greater than 2 the time, call right parenthesis discriminant function RightBracket () judge to add ") " number;
Rule 5): when the in-degree of pre-treatment node more than or equal to 1, and when the next node of pre-treatment node was not horizontal line, operational character will be added " * ";
Rule 6): when the out-degree of pre-treatment node was 1, operational character added sky;
Rule 7): when the out-degree of pre-treatment node was 2, operational character added " (";
Rule 8): when the out-degree of pre-treatment node greater than 2 the time, call left parenthesis discriminant function LeftBracket () and judge and will add " the number of (".
8. be converted to the method for structure text language by the described trapezoid figure language of claim 7, it is characterized in that: described right parenthesis discriminant function RightBracket () is according to each the caudal knot point n2 that goes into arc when the pre-treatment node, reverse scanning to one a dummy node n1, the row of this dummy node n1 number is less than or equal to when the row of pre-treatment node n number, and deletion added ") handling to have write down in the middle of common node rule 7 and rule 8 processing procedures " record added ") " node and accordingly when the pre-treatment node toward first dummy node of input direction to n1, n2; Accumulative total residue record has added ") " node and accordingly when the pre-treatment node right toward first dummy node of input direction, and record, accumulative total different records occurs and added ") " record added ") " node and accordingly when the pre-treatment node toward first dummy node of input direction to n1, the logarithm of n2 is and will adds ") " number.
9. be converted to the method for structure text language by the described trapezoid figure language of claim 7, it is characterized in that: described left parenthesis discriminant function LeftBracket () is according to each node that goes out arc when the pre-treatment node, forward scan to one a dummy node n1, the row of this dummy node n1 number is equal to or less than when the row of pre-treatment node n number, the number of different dummy node n1 appears in accumulative total, is and will adds " the number of (".
10. be converted to the method for structure text language by the described trapezoid figure language of claim 4, it is characterized in that: described output node is handled and is comprised:
") checked in the parenthesis matching that common node is handled and dummy node is handled the expression formula of back formation " more at most up front polishing " (" exports the complete structure text sentence at last, the end process process.
CN 200910012582 2009-07-16 2009-07-16 Method for converting ladder diagram language into structure text language Active CN101957745B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200910012582 CN101957745B (en) 2009-07-16 2009-07-16 Method for converting ladder diagram language into structure text language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200910012582 CN101957745B (en) 2009-07-16 2009-07-16 Method for converting ladder diagram language into structure text language

Publications (2)

Publication Number Publication Date
CN101957745A true CN101957745A (en) 2011-01-26
CN101957745B CN101957745B (en) 2013-04-17

Family

ID=43485090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200910012582 Active CN101957745B (en) 2009-07-16 2009-07-16 Method for converting ladder diagram language into structure text language

Country Status (1)

Country Link
CN (1) CN101957745B (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102354144A (en) * 2011-09-06 2012-02-15 北京联合大学 Method for converting ladder diagram into PLC (Programmable Logic Controller) program command
CN103123598A (en) * 2011-11-18 2013-05-29 中国科学院沈阳计算技术研究所有限公司 Online debugging implementation method of compiling soft programmable logic controller (PLC)
CN103941627A (en) * 2014-01-08 2014-07-23 东南大学 SFC-to-ladder-diagram conversion method based on PLC programming
CN103942081A (en) * 2014-03-07 2014-07-23 东莞市升力智能科技有限公司 Method for generating IL instruction lists of PLC ladder diagrams
CN104049959A (en) * 2013-03-15 2014-09-17 苏州精易会信息技术有限公司 Method for converting flow chart into executable language
CN105302057A (en) * 2015-11-22 2016-02-03 苏州和瑞科自动化科技有限公司 PLC programming method used in material carrying among grid arrays
CN106200541A (en) * 2015-05-08 2016-12-07 杭州电子科技大学 A kind of method that FBD is converted to AOV structure
CN107710086A (en) * 2015-04-09 2018-02-16 倍福自动化有限公司 Translation module, processing module and control system
CN107885898A (en) * 2016-09-30 2018-04-06 欧姆龙株式会社 Device, program development support apparatus and program are supported in program development
CN105955184B (en) * 2016-05-18 2018-09-11 天津畅乐电子科技股份有限公司 One kind realizing multi-process universal control method based on PLC
CN109032056A (en) * 2018-06-13 2018-12-18 华东师范大学 Programmable logic controller (PLC) programming language conversion method
CN109143952A (en) * 2018-06-13 2019-01-04 华东师范大学 Programmable logic controller (PLC) programming language converting system
CN112327744A (en) * 2020-11-20 2021-02-05 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller
CN113433885A (en) * 2021-07-22 2021-09-24 上海繁易信息科技股份有限公司 Method for converting ladder diagram of PLC programming system into structured text
CN115335782A (en) * 2020-03-26 2022-11-11 三菱电机株式会社 Programming support program, programming support device, and programming support method
CN115658079A (en) * 2022-10-24 2023-01-31 上海繁易信息科技股份有限公司 Method and related equipment for converting function block diagram into structured text

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107193534B (en) * 2017-05-15 2020-05-22 华南理工大学 Method for converting PLC ladder diagram into instruction list and explaining and executing

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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 (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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 (1)

* Cited by examiner, † Cited by third party
Title
朱兆斌等: "软PLC中梯形图向指令表转化的实现", 《机械与电子》 *

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102354144A (en) * 2011-09-06 2012-02-15 北京联合大学 Method for converting ladder diagram into PLC (Programmable Logic Controller) program command
CN102354144B (en) * 2011-09-06 2013-07-03 北京联合大学 Method for converting ladder diagram into PLC (Programmable Logic Controller) program command
CN103123598A (en) * 2011-11-18 2013-05-29 中国科学院沈阳计算技术研究所有限公司 Online debugging implementation method of compiling soft programmable logic controller (PLC)
CN103123598B (en) * 2011-11-18 2015-03-18 中国科学院沈阳计算技术研究所有限公司 Online debugging implementation method of compiling soft programmable logic controller (PLC)
CN104049959A (en) * 2013-03-15 2014-09-17 苏州精易会信息技术有限公司 Method for converting flow chart into executable language
CN103941627A (en) * 2014-01-08 2014-07-23 东南大学 SFC-to-ladder-diagram conversion method based on PLC programming
CN103942081A (en) * 2014-03-07 2014-07-23 东莞市升力智能科技有限公司 Method for generating IL instruction lists of PLC ladder diagrams
US10732608B2 (en) 2015-04-09 2020-08-04 Beckhoff Automation Gmbh Translation module, processing module and control system
CN107710086A (en) * 2015-04-09 2018-02-16 倍福自动化有限公司 Translation module, processing module and control system
CN106200541A (en) * 2015-05-08 2016-12-07 杭州电子科技大学 A kind of method that FBD is converted to AOV structure
CN105302057A (en) * 2015-11-22 2016-02-03 苏州和瑞科自动化科技有限公司 PLC programming method used in material carrying among grid arrays
CN105302057B (en) * 2015-11-22 2018-04-13 苏州和瑞科自动化科技有限公司 A kind of PLC program design method carried for material between grid array
CN105955184B (en) * 2016-05-18 2018-09-11 天津畅乐电子科技股份有限公司 One kind realizing multi-process universal control method based on PLC
US11073818B2 (en) 2016-09-30 2021-07-27 Omron Corporation Development support apparatus, program development support method, and program development support program
CN109564415A (en) * 2016-09-30 2019-04-02 欧姆龙株式会社 Program development auxiliary device, program development householder method and program development auxiliary program
CN107885898A (en) * 2016-09-30 2018-04-06 欧姆龙株式会社 Device, program development support apparatus and program are supported in program development
CN109143952A (en) * 2018-06-13 2019-01-04 华东师范大学 Programmable logic controller (PLC) programming language converting system
CN109032056B (en) * 2018-06-13 2020-01-10 华东师范大学 Programmable logic controller programming language conversion method
CN109143952B (en) * 2018-06-13 2020-05-12 华东师范大学 Programmable logic controller programming language conversion system
CN109032056A (en) * 2018-06-13 2018-12-18 华东师范大学 Programmable logic controller (PLC) programming language conversion method
CN115335782A (en) * 2020-03-26 2022-11-11 三菱电机株式会社 Programming support program, programming support device, and programming support method
CN112327744A (en) * 2020-11-20 2021-02-05 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller
CN112327744B (en) * 2020-11-20 2021-10-22 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller
CN113433885A (en) * 2021-07-22 2021-09-24 上海繁易信息科技股份有限公司 Method for converting ladder diagram of PLC programming system into structured text
CN115658079A (en) * 2022-10-24 2023-01-31 上海繁易信息科技股份有限公司 Method and related equipment for converting function block diagram into structured text
CN115658079B (en) * 2022-10-24 2023-10-13 上海繁易信息科技股份有限公司 Method for converting functional block diagram into structured text and related equipment

Also Published As

Publication number Publication date
CN101957745B (en) 2013-04-17

Similar Documents

Publication Publication Date Title
CN101957745B (en) Method for converting ladder diagram language into structure text language
CN108958736B (en) Page generation method and device, electronic equipment and computer readable medium
CN106737676B (en) It is a kind of based on script can secondary development industrial robot programing system
CN109272571B (en) System and method for converting PDS three-dimensional data into Flowmaster model
CN102541514A (en) Method for converting structural text language into trapezoidal graph language
CN102508654A (en) Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)
CN112990850A (en) Flow implementation method and system based on rule engine
CN111158680A (en) Page construction method, device, equipment and storage medium
CN101986282B (en) Topology adaptation method and device
CN115240048A (en) Deep learning operator positioning fusion method and device for image classification
CN116301735B (en) Method, device and storage medium for organizing software elements into software data links
CN110009100B (en) Calculation method of user-defined operator and related product
CN106200541B (en) Method for converting function block diagram into AOV structure
CN104424329A (en) Method for compressing regular expression and method and device for matching character strings
CN107315863B (en) Layout optimization method and device, terminal and storage medium
CN104486117A (en) Configuration command interaction method and configuration command interaction system of multi-board card core switch
CN112180817B (en) Method, device, equipment and storage medium for transforming ladder diagram into binary tree
CN113238746A (en) Hybrid programming control method, device, equipment and storage medium
CN111027196A (en) Simulation analysis task processing method and device for power equipment and storage medium
CN111475159A (en) Method, device and storage medium for automatically generating program
CN105630789A (en) Query plan converting method and device
CN116957170B (en) Constraint intensive reduction method and system for power system optimization problem
CN114840178B (en) Process file generation method, device and equipment based on digital simulation platform
CN113671924B (en) DCS real-time value setting method and system, equipment and storage medium
CN117112402A (en) Efficient test case generation method, system, equipment and medium

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
ASS Succession or assignment of patent right

Free format text: FORMER OWNER: SHENYANG INSTITUTE OF COMPUTING TECHNOLOGY, CHINESE ACADEMY OF SCIENCES

Effective date: 20150804

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20150804

Address after: 110171 Liaoning Province, Shenyang Hunnan New District Nanping Road No. 16

Patentee after: Shenyang High-End Computer Numerical Control Technology Co., Ltd.

Address before: 110171 Liaoning Province, Shenyang Hunnan New District Nanping Road No. 16

Patentee before: Shenyang High-End Computer Numerical Control Technology Co., Ltd.

Patentee before: Shenyang Institute of computing technology, Chinese Academy of Sciences

C56 Change in the name or address of the patentee
CP03 Change of name, title or address

Address after: Nanping Road in Dongling District of Shenyang city of Liaoning Province, No. 110171 16-2

Patentee after: SHENYANG GAOJING NUMERICAL CONTROL INTELLIGENT TECHNOLOGY CO., LTD.

Address before: 110171 Liaoning Province, Shenyang Hunnan New District Nanping Road No. 16

Patentee before: Shenyang High-End Computer Numerical Control Technology Co., Ltd.

CP01 Change in the name or title of a patent holder

Address after: Nanping Road in Dongling District of Shenyang city of Liaoning Province, No. 110171 16-2

Patentee after: Shenyang Zhongke CNC Technology Co.,Ltd.

Address before: Nanping Road in Dongling District of Shenyang city of Liaoning Province, No. 110171 16-2

Patentee before: SHENYANG GOLDING NC & INTELLIGENCE TECH. Co.,Ltd.

CP01 Change in the name or title of a patent holder