CN104133412A - Method for judging zero race condition of ladder diagram program - Google Patents
Method for judging zero race condition of ladder diagram program Download PDFInfo
- Publication number
- CN104133412A CN104133412A CN201410323117.3A CN201410323117A CN104133412A CN 104133412 A CN104133412 A CN 104133412A CN 201410323117 A CN201410323117 A CN 201410323117A CN 104133412 A CN104133412 A CN 104133412A
- Authority
- CN
- China
- Prior art keywords
- node
- trapezoid
- program
- ladder diagram
- real
- 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.)
- Pending
Links
Landscapes
- Programmable Controllers (AREA)
Abstract
The invention relates to a method for judging a zero race condition of a ladder diagram program. In the method, a ladder diagram is converted into a relation diagram which includes multiple tuples. If no line exists in real nodes which are formed through simulation of contact points, coils or function modules of the ladder diagram, an original point cannot be returned to along any line, the ladder diagram program is in a zero race condition. The method for judging the zero race condition of the ladder diagram program detects the race condition from an angle of structure of the ladder diagram program and the method is capable of simply, conveniently and rapidly judging that no race condition exists in the ladder diagram program. When the ladder diagram program is complex, if traditional model detection or theorem proving is used, work load is significantly huge and mistakes are likely to happen and the method for judging the zero race condition of the ladder diagram program is small in work load and not susceptible to mistakes.
Description
Technical field
The present invention relates to the verification method of PLC trapezoid figure program, more particularly, relate to a kind of method without " race " that judges trapezoid figure program.
Background technology
Programmable logic controller (PLC) (Programmable Logic Controller, PLC) be widely used in complicated embedded Control application program, as process industry, public place of entertainment, electric power, the Safety-Critical Systems such as traffic, chemical industry etc., require very high to the safe reliability of PLC program.At present, in the programming language of PLC, ladder diagram (Ladder Diagram) accounts for leading role, is to use at present maximum a kind of PLC programming languages.
" race " of ladder diagram refer in the situation that input and the state of functional module constant, output changes." race " is a kind of detected logic error that is difficult to, and its detection not only can expend substantial contribution, the system that has the utmost point to be strict with to program correctness for electric power, traffic etc., and " race " occurs will cause serious consequence.
" race " detection method of generally using is at present model testing and theorem proving, and the shortcoming that model detects is to want the state space of Ergodic Theory model, so be faced with the problem of " State space explosion "; Theorem proving can directly be processed unlimited state space, and it proves the system with Infinite State with being similar to structurized derivation.But theorem proving great majority are mutual, need people's participation, so the probability of not only makeing mistakes has improved greatly, the feasibility of automatic Verification has also reduced.
Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, it is object that a kind of complexity of take reduction detection is provided, structure from trapezoid figure program, find a correct conclusion, the quick determining program of detection that can be complicated is without the method without " race " of the judgement trapezoid figure program of " race ".
Technical scheme of the present invention is as follows:
A kind of method without " race " that judges trapezoid figure program, ladder diagram is converted into the graph of a relation that comprises polynary group, if there is not any circuit in the real node that the contact of ladder diagram, coil or functional module simulation form, make it all can not get back to initial point along any circuit, trapezoid figure program is without " race ".
As preferably, graph of a relation D is a four-tuple, comprises nonempty finite set V (D), V'(D), A (D) and c, be designated as D=(V, V', A, c); Wherein,
V={v
1, v
2, v
nbe the set of the real node of limited non-NULL, be used for representing the graphic element in ladder diagram;
V'={v'
1, v'
2, v'
mbe the set of limited non-NULL dummy node, for connecting real node, presentation logic relation " with ",
the set of two tuples that form of real node and dummy node, represent from real node to dummy node or dummy node to the directed arc set of real node, wherein, (V
x, V'
y) represent real node V
xto dummy node V'
ydirected arc, (V'
y, V
z) expression dummy node Vn
yto real node V
zdirected arc, node V
x, V'
y, V
zrepresent real node V
zstate variation depend on V
x;
C:A → Z
+represent the weights on each arc in graph of a relation, wherein, Z
+represent Positive Integer Set, on arc, weights size is the step of corresponding ladder diagram.
As preferably, if a real node only has input directed arc, do not export directed arc, claim that this reality node is root node; If, there is a circuit in a real node, make it can get back to initial point along this circuit, circuit table is shown the ring of a graph of a relation.
As preferably, the weights in graph of a relation on each arc are 1 expression the first step, and weights are 2 expression the second steps, by that analogy.
As preferably, the step that ladder diagram is converted into graph of a relation is as follows:
Step 1, the contact of trapezoid figure program, coil, functional module are modeled as to real node;
A coil of step 2, optional trapezoid figure program, supposes that this coil is C
x, corresponding real node is V
x;
Step 3, determine C
xthe number m of cut set
x, create m
xindividual dummy node;
Element in step 4, a cut set of traversal, the corresponding real node of connection element is to the directed arc of dummy node corresponding to this cut set; Connect dummy node to V
xdirected arc; For the directed arc from real node to real node is given weights; Repeat above-mentioned steps, until traveled through all cut sets;
Step 5, get C
xa contact on step path, judges whether trapezoid figure program exists and take the path that this contact is output winding, if had, and repeating step 3, step 4; If no, get another contact and judge, until traveled through all contacts;
If step 6 also exists other there is no the coil of traversal, repeating step 2, step 3, step 4, step 5, until traveled through all coils;
Step 7, a functional module of getting trapezoid figure program, suppose that corresponding real node is V
y, the number m of determination module cut set
y, create m
yindividual dummy node; Travel through the element in a module cut set, the real node that connection element is corresponding arrives the directed arc of the dummy node that this module cut set is corresponding; Connect dummy node to V
ydirected arc; For arc is given weights; Repeat above-mentioned steps, know and traveled through all module cut sets.
As preferably, described path, in ladder diagram, by contact, functional module and connect the circuit that the wire between them forms;
Described step path, for making the path of energy flow from left bus to coil;
Described cut set, is the contact in step path, the set that functional module forms, and if delete the arbitrary element in cut set, step path disconnects;
Described module cut set, the set being formed by the contact of controlling functional module all of the port, and if the arbitrary element in removing module cut set, functional module cannot normally be worked.
Beneficial effect of the present invention is as follows:
Thinking of the present invention is the structure detection " race " by trapezoid figure program, because trapezoid figure program is complicated, is difficult to observe and decide, so the present invention proposes the concept of graph of a relation.The logical relation of ladder diagram is clearly described with graph of a relation.Accordingly, the present invention proposes a kind of adequate condition without " race " of trapezoid figure program, be applied to large-scale trapezoid figure program checking, the present invention can simple, fastly judge the danger that ladder diagram does not exist " race " or may have " race ", has reduced the workload of program verification.
The method without " race " of judgement trapezoid figure program of the present invention, is to detect " race " from the angle of ladder diagram program structure, and the method can be easy, judges fast trapezoid figure program and do not have " race ".When trapezoid figure program is complicated, use traditional model to detect or theorem proving, workload is very huge, and easily makes mistakes, and workload of the present invention is little, is difficult for makeing mistakes.
Accompanying drawing explanation
Fig. 1 is that trapezoid figure program is converted into graph of a relation;
Fig. 2 is the sequential chart that trapezoid figure program is corresponding.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.
The trapezoid figure program that the present invention verifies is according to IEC61131-3 Standard compilation.
First: the definition of graph of a relation.
From formal viewpoint definition, a graph of a relation D is by nonempty finite set V (D), V'(D), A (D) and c form, and can be defined as a four-tuple, is designated as D=(V, V', A, c), wherein,
V={v
1, v
2, v
nrepresent the set of the real node of limited non-NULL to be used for representing the graphic element in ladder diagram, as contact, coil, functional module etc.;
V'={v'
1, v'
2, v'
mrepresent the set of limited non-NULL dummy node, and play the function served as bridge that connects real node, there is no concrete meaning, presentation logic relation " with ".Wherein,
the set of two tuples that form of real node and dummy node, represent from real node to dummy node or dummy node to the directed arc set of real node, wherein (V
x, V'
y) represent real node V
xto dummy node V'
ydirected arc; (V'
y, V
z) expression dummy node Vn
yto real node V
zdirected arc; So node V
x, V'
y, V
zbe expressed as real node V
zstate variation depend on V
x;
C:A → Z
+represent the weights on each arc, wherein Z in graph of a relation
+represent Positive Integer Set.On arc, weights size is the step of corresponding ladder diagram.Such as weights represent first step for " 1 ", for " 2 " represent second step, by that analogy.
If a real node only has input directed arc, do not export directed arc, claim that this reality node is root node; If, there is a circuit in a real node, make it can get back to initial point along this circuit, claim that circuit is the ring of a graph of a relation.
Second portion: ladder diagram is to graph of a relation method for transformation.
In order to set forth ladder diagram to the method for transformation of graph of a relation, we need to be defined as follows concept:
Path: in ladder diagram, path refers to by contact, functional module and connects the circuit that the wire between them forms.
Step path: can make energy flow from left bus to coil the path of (right bus).
Cut set: cut set is the contact in step path, the set that functional module forms, and delete the arbitrary element in cut set, all can make step path disconnect.
Module cut set: the set that module cut set is comprised of the contact of controlling functional module all of the port, and the arbitrary element in removing module cut set, all can make functional module cisco unity malfunction.
Concrete step of converting:
Step 1, the contact of trapezoid figure program, coil, functional module are modeled as to real node.
A coil of step 2, optional trapezoid figure program, supposes that this coil is C
x, corresponding real node is V
x.
Step 3, determine C
xthe number m of cut set
x, create m
xindividual dummy node.
Element in step 4, a cut set of traversal, the corresponding real node of connection element is to the directed arc of dummy node corresponding to this cut set; Connect dummy node to V
xdirected arc; For the directed arc from real node to real node is given weights.Repeat above-mentioned steps, until traveled through all cut sets.
Step 5, get C
xa contact on step path, judges whether trapezoid figure program exists and take the path that this contact is output winding, if had, and repeating step 3, step 4; If no, get another contact and judge, until traveled through all contacts.
If step 6 also exists other there is no the coil of traversal, repeating step 2, step 3, step 4, step 5, until traveled through all coils.
Step 7, a functional module of getting trapezoid figure program, suppose that corresponding real node is V
y.The number m of determination module cut set
y, create m
yindividual dummy node.Travel through the element in a module cut set, the real node that connection element is corresponding arrives the directed arc of the dummy node that this module cut set is corresponding; Connect dummy node to V
ydirected arc; For arc is given weights.Repeat above-mentioned steps, know and traveled through all module cut sets.
Third part: according to graph of a relation judgement " race " non-existent method.
For acyclic graph of a relation, any non-root node V
mcan find the real node V that controls its state
n, same V
nif be not root node, can find equally the real node of controlling its state, by that analogy, non-root node V
mfinally can regard as by root node and control its state.The state of root node is constant within the scan period of PLC, so V
nconstant, if V
nthe output winding of corresponding ladder diagram, illustrates that output winding state in the process of program execution is constant.
According to analysis above, can draw determination methods: if graph of a relation does not exist ring, it is exactly the adequate condition without " race " of trapezoid figure program that corresponding trapezoid figure program just exists " race ", this conclusion scarcely.
Embodiment
As shown in Figure 1, according to method of the present invention, be converted into graph of a relation:
First the contact of ladder diagram, coil, functional module are modeled as to real node, the trapezoid figure program from Fig. 1 can obtain the set of real node
Line taking circle Q
0.1as initial node, the real node of its correspondence is
traversal coil Q
0.1can obtain Q
0.1cut set be { M
0.1, M
0.2, { M
0.2, M
0.3, so create two dummy node v'
1, v'
2;
Traversal cut set { M
0.1, M
0.2interior element, M connected
0.1, M
0.2corresponding real node
to dummy node v'
1directed arc; Connect v'
1arrive
directed arc; According to the step at place, to arc, compose upper weights " 4 ".In like manner travel through cut set { M
0.2, M
0.3interior element, M connected
0.2, M
0.3corresponding real node
to dummy node v'
2directed arc; Connect v'
2arrive
directed arc, and compose weights " 4 " to arc.
By traversal coil Q
0.1contact on step path is known, does not have the path that the contact of take on step path is output winding, so get another coil M
0.0travel through.The same step, known M
0.0cut set only have { a M
0.1, so create a dummy node v'
3; Connect
to v'
3directed arc, connect v'
3arrive
directed arc; The weights of giving on arc are " 5 ".The same, traversal coil Q
0.0known cut set is { C
0, create a dummy node v'
4; Connect
to v'
4directed arc; Connect v'
4arrive
directed arc; Weights value of giving on arc is " 2 ".
Due to the coil that does not have to travel through, and there is functional module in ladder diagram, so traversal functional module determines that its module cut set is { I
0.0, M
0.0, Q
0.0, so create a dummy node v'
5; Real node corresponding to element in link block cut set, to the directed arc of dummy node, connects
to v'
5directed arc; Connect v'
5arrive
directed arc; For arc is given weights for " 1 ".
According to step above, can obtain the conversion results of Fig. 1.
As shown in Figure 2, although there is ring in the graph of a relation that trapezoid figure program is corresponding, it is not " race " that but the output state that functional module produces changes, there is the danger of " race " in known this trapezoid figure program of determination methods of summing up according to the present invention, from sequential chart, also can find out that " race " do not occur trapezoid figure program scarcely.
Above-described embodiment is only for the present invention is described, and not as limitation of the invention.So long as according to technical spirit of the present invention, to above-described embodiment change, modification etc. all will drop in the scope of claim of the present invention.
Claims (6)
1. the method without " race " that judges trapezoid figure program, it is characterized in that, ladder diagram is converted into the graph of a relation that comprises polynary group, if there is not any circuit in the real node that the contact of ladder diagram, coil or functional module simulation form, make it all can not get back to initial point along any circuit, trapezoid figure program is without " race ".
2. the method without " race " of judgement trapezoid figure program according to claim 1, is characterized in that, graph of a relation D is a four-tuple, comprises nonempty finite set V (D), V'(D), A (D) and c, be designated as D=(V, V', A, c); Wherein,
V={v
1, v
2, v
nbe the set of the real node of limited non-NULL, be used for representing the graphic element in ladder diagram;
V'={v'
1, v'
2, v'
mbe the set of limited non-NULL dummy node, for connecting real node, presentation logic relation " with ",
the set of two tuples that form of real node and dummy node, represent from real node to dummy node or dummy node to the directed arc set of real node, wherein, (V
x, V'
y) represent real node V
xto dummy node V'
ydirected arc, (V'
y, V
z) expression dummy node Vn
yto real node V
zdirected arc, node V
x, V'
y, V
zrepresent real node V
zstate variation depend on V
x;
C:A → Z
+represent the weights on each arc in graph of a relation, wherein, Z
+represent Positive Integer Set, on arc, weights size is the step of corresponding ladder diagram.
3. the method without " race " of judgement trapezoid figure program according to claim 2, is characterized in that, if a real node only has input directed arc, does not export directed arc, claims that this reality node is root node; If, there is a circuit in a real node, make it can get back to initial point along this circuit, circuit table is shown the ring of a graph of a relation.
4. the method without " race " of judgement trapezoid figure program according to claim 2, is characterized in that, the weights in graph of a relation on each arc are 1 expression the first step, and weights are 2 expression the second steps, by that analogy.
5. the method without " race " of judgement trapezoid figure program according to claim 2, is characterized in that, the step that ladder diagram is converted into graph of a relation is as follows:
Step 1, the contact of trapezoid figure program, coil, functional module are modeled as to real node;
A coil of step 2, optional trapezoid figure program, supposes that this coil is C
x, corresponding real node is V
x;
Step 3, determine C
xthe number m of cut set
x, create m
xindividual dummy node;
Element in step 4, a cut set of traversal, the corresponding real node of connection element is to the directed arc of dummy node corresponding to this cut set; Connect dummy node to V
xdirected arc; For the directed arc from real node to real node is given weights; Repeat above-mentioned steps, until traveled through all cut sets;
Step 5, get C
xa contact on step path, judges whether trapezoid figure program exists and take the path that this contact is output winding, if had, and repeating step 3, step 4; If no, get another contact and judge, until traveled through all contacts;
If step 6 also exists other there is no the coil of traversal, repeating step 2, step 3, step 4, step 5, until traveled through all coils;
Step 7, a functional module of getting trapezoid figure program, suppose that corresponding real node is V
y, the number m of determination module cut set
y, create m
yindividual dummy node; Travel through the element in a module cut set, the real node that connection element is corresponding arrives the directed arc of the dummy node that this module cut set is corresponding; Connect dummy node to V
ydirected arc; For arc is given weights; Repeat above-mentioned steps, know and traveled through all module cut sets.
6. the method without " race " of judgement trapezoid figure program according to claim 5, is characterized in that,
Described path, in ladder diagram, by contact, functional module and connect the circuit that the wire between them forms;
Described step path, for making the path of energy flow from left bus to coil;
Described cut set, is the contact in step path, the set that functional module forms, and if delete the arbitrary element in cut set, step path disconnects;
Described module cut set, the set being formed by the contact of controlling functional module all of the port, and if the arbitrary element in removing module cut set, functional module cannot normally be worked.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410323117.3A CN104133412A (en) | 2014-07-08 | 2014-07-08 | Method for judging zero race condition of ladder diagram program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410323117.3A CN104133412A (en) | 2014-07-08 | 2014-07-08 | Method for judging zero race condition of ladder diagram program |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104133412A true CN104133412A (en) | 2014-11-05 |
Family
ID=51806132
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410323117.3A Pending CN104133412A (en) | 2014-07-08 | 2014-07-08 | Method for judging zero race condition of ladder diagram program |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104133412A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108681503A (en) * | 2018-03-23 | 2018-10-19 | 杭州电子科技大学 | Safety detection method, device and the equipment of programmable controller program |
CN111427304A (en) * | 2020-03-26 | 2020-07-17 | 郑州信大捷安信息技术股份有限公司 | P L C program monitoring system and method |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102411330A (en) * | 2011-08-25 | 2012-04-11 | 华侨大学 | Method for converting PLC program into common Petri net |
CN103019233A (en) * | 2012-12-21 | 2013-04-03 | 华侨大学 | Method for detecting whether race condition exists in PLC (programmable logic controller) ladder diagram program or not |
-
2014
- 2014-07-08 CN CN201410323117.3A patent/CN104133412A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102411330A (en) * | 2011-08-25 | 2012-04-11 | 华侨大学 | Method for converting PLC program into common Petri net |
CN103019233A (en) * | 2012-12-21 | 2013-04-03 | 华侨大学 | Method for detecting whether race condition exists in PLC (programmable logic controller) ladder diagram program or not |
Non-Patent Citations (1)
Title |
---|
JILIANG LUO ETAL.: "Maximally permissive supervisor synthesis based on a new constraint", <AUTOMATICA> * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108681503A (en) * | 2018-03-23 | 2018-10-19 | 杭州电子科技大学 | Safety detection method, device and the equipment of programmable controller program |
CN108681503B (en) * | 2018-03-23 | 2021-10-22 | 杭州电子科技大学 | Safety check method, device and equipment for programmable controller program |
CN111427304A (en) * | 2020-03-26 | 2020-07-17 | 郑州信大捷安信息技术股份有限公司 | P L C program monitoring system and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103235593A (en) | System and method for automatically testing main control hardware of fan on basis of PLC (Programmable Logic Controller) | |
CN109344476B (en) | CIM model-based power distribution network single line diagram line branch structure generation method and device | |
CN106503376B (en) | A kind of automotive networking framework modeling and simulating method and system | |
CN103677815A (en) | Method for generating program to automatically test electrical performance of spacecraft low-frequency cable | |
CN103728885A (en) | Comprehensive wiring management method based on aviation bus | |
CN108959671B (en) | Real-time simulation modeling method for half-bridge and full-bridge modular multilevel converter | |
CN104133412A (en) | Method for judging zero race condition of ladder diagram program | |
CN104702598B (en) | A kind of intelligent grid distributed networking protocol safety detecting method | |
CN104198881B (en) | A kind of ANN fault distance-finding methods based on single-ended traveling wave wave head relative polarity and the time difference | |
CN110611312B (en) | On-line simulation system and method for panoramic data of substation bay level | |
CN110233477B (en) | Stability control simulation system based on three-defense line simulation | |
CN108764645A (en) | A kind of photo-voltaic power generation station low voltage crossing performance estimating method and system | |
CN108228186B (en) | Substation five-prevention locking rule expression verification method based on responsibility chain mode | |
CN104036667B (en) | A kind of virtual terminals of intelligent substation connects the implementation method of design training | |
CN104184215B (en) | Transformer station's dispatching automation joint debugging method and the Apparatus and system of application the method | |
CN105608256B (en) | A kind of parallel computation subnetting method for receiving different step-length interface delays | |
WO2014024640A1 (en) | Device for estimating error location in logic diagram and method therefor | |
CN104536433B (en) | A kind of EMUs end signal testing method | |
CN103942380A (en) | Graphical control system design and simulation tool | |
CN104198875B (en) | A kind of inspection method for transformer differential protection wiring | |
US10295996B2 (en) | Test device for monitoring control device | |
CN105229477A (en) | The method of area of computer aided determination power network impedance | |
CN104218668B (en) | The tracking defining method of the prepared auto restart of action is caused during device fails | |
CN109613840A (en) | A kind of semi-physical simulation method based on Matlab | |
CN105224736B (en) | A kind of smart electric grid system robustness verification method based on constraint solving |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20141105 |
|
RJ01 | Rejection of invention patent application after publication |