Disclosure of Invention
In order to solve the problems, the invention provides the method and the system for detecting the embedded ring of the template of the description file data type of the intelligent station, which provide convenience for users such as engineering personnel to detect model errors, reduce boring and odorless searching work, and improve the error detection speed, thereby improving the working efficiency.
In some embodiments, the following technical solutions are disclosed:
a method for detecting a nested loop of a data type template of an intelligent station description file comprises the following steps:
setting a stack, wherein the node type in the stack is { DOType node id, and the ith SDO node in the DOType node id }; i is calculated from 1;
(1) Collecting all N DOType type nodes containing SDO nodes in a data type template;
(2) Let the node to be traversed be (M, i); if a node of a certain DOType type has been traversed, marking that the node has been traversed and N=N-1, otherwise N remains unchanged;
(3) Stacking nodes to be traversed; judging whether the DOType node referenced by the ith SDO child node is in a stack or not, if so, forming an embedded ring from the DOType node referenced by the ith SDO child node to the DOType node where the ith SDO child node is located in the stack, and executing the step (4); otherwise, executing the step (6);
(4) Outputting and storing DOType type nodes contained in the embedded ring, and popping the last node to be stacked;
(5) Judging whether the node to be traversed has an SDO child node which is not traversed;
if present, let i=i+1, repeating steps (2) - (5);
otherwise, performing stack top node pop, wherein the DOType node after the pop is the node to be traversed, repeating the step (5) until the stack is empty, and switching to the step (8);
(6) Traversing DOType nodes M 'referenced by the ith SDO child node, namely enabling the nodes to be traversed to be (M', i), wherein i=1;
(7) Repeating steps (2) - (6);
(8) Selecting a node of a DOType type which is not traversed, and repeating the steps (2) - (7) until N=0;
(9) Judging whether nested ring information is output, if yes, outputting true, otherwise outputting false.
In other embodiments, the following technical solutions are disclosed:
a method for detecting a nested loop of a data type template of an intelligent station description file comprises the following steps:
setting a stack, wherein the node type in the stack is { datatype node id, and the i-th btype= "Struct" BDA node }, i is calculated from 1, and the btype of the following BDA node is equal to Struct for convenience in description and is not repeated;
(1) Collecting all N DATtype nodes containing BDA nodes in a data type template;
(2) Let the node to be traversed be (P, i); if a certain datatype node has been traversed, marking that the node has been traversed and n=n-1, otherwise N remains unchanged;
(3) Stacking nodes to be traversed; judging whether the DATtype node referenced by the ith BDA sub-node is in a stack or not, if so, forming an embedded ring from the DATtype node referenced by the ith BDA sub-node to the DATtype node where the ith BDA sub-node is located in the stack, and executing (4); otherwise, executing (6);
(4) The DAType node contained in the embedded ring is output and stored, and the last node which is put into the stack is popped;
(5) Judging whether a non-traversed BDA child node exists in the nodes to be traversed;
if present, let i=i+1, repeating steps (2) - (5);
otherwise, executing stack top node pop, wherein the node of the type DAType after the pop is the node to be traversed, repeating the step (5) until the stack is empty, and executing the step (8);
(6) Traversing a DAType node P 'referenced by an ith BDA child node, namely, enabling the node to be traversed to be (P', i), wherein i=1;
(7) Repeating steps (2) - (6);
(8) Selecting a node of a DAType which is not traversed, and repeating the steps (2) - (7) until N=0;
(9) Judging whether nested ring information is output, if yes, outputting true, otherwise outputting false.
In other embodiments, the following technical solutions are disclosed:
a terminal device comprising a processor and a computer-readable storage medium, the processor configured to implement instructions; the computer readable storage medium is for storing a plurality of instructions adapted to be loaded by a processor and to perform the intelligent station profile data type template nested loop detection method described above.
In other embodiments, the following technical solutions are disclosed:
a computer readable storage medium having stored therein a plurality of instructions adapted to be loaded by a processor of a terminal device and to perform the above-described intelligent station profile data type template nested loop detection method.
Compared with the prior art, the invention has the beneficial effects that:
the invention designs the definition of the intelligent station description file data type template embedded ring, and provides possibility for automatic and effective detection of the embedded ring; the method solves the problem that the prior art cannot effectively refer to, inquire and display node information in the ring because the nested ring existing in the data type template cannot be known.
The invention designs an automatic error detection technology for the configuration information of the intelligent substation, which is an effective means for detecting the error of a data type template; the algorithm of the invention has fast error detection speed and high error detection efficiency, and effectively solves the problems of large workload, low efficiency and high error rate of the manual detection method in the prior art.
Detailed Description
It should be noted that the following detailed description is illustrative and is intended to provide further explanation of the present application. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments in accordance with the present application. As used herein, the singular is also intended to include the plural unless the context clearly indicates otherwise, and furthermore, it is to be understood that the terms "comprises" and/or "comprising" when used in this specification are taken to specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof.
Example 1
In one or more embodiments, an intelligent station profile data type template nested loop detection method is disclosed.
First, the embodiment of the present invention is defined as follows for the nested ring:
d= { E }, where E is a DOType node (hereinafter referred to as a DOType node), and D is a finite set of E.
The attribute of the DOType node contains an id attribute, and the child node of the DOType node contains a type attribute.
The DOType node with id= "X" is simply referred to as X node.
Assuming that the child node type of the a node is an SDO node, and the attribute type= "B", the SDO node refers to a B node, which is a path a- > B in the data type template, where a, B are two DOType nodes on the path. If the cited node B contains the SDO type child node, the searching is continued, and the cycle is repeated.
If starting from a certain node, it is finally possible to return to the node, it is called a nested ring.
Note that the result of all the following operational calculations is a minimum nested ring, i.e. at most one nested ring is included in the nested ring, such as the ring C- > D- > B shown in fig. 2 is a nested ring, which contains only one small nested ring B- > D, and the nested ring a- > C- > D- > B contains more than one small nested ring, and is therefore not a minimum nested ring.
Referring to fig. 1, there are two SDO subnodes in the a node, which are the SDO subnode of type= "B" and the SDO subnode of type= "C", respectively. the SDO child node of type= "B" refers to node B, one of the nodes has a SDO child node of type= "C", one of the nodes refers to node C, and one of the nodes has a SDO child node of type= "a", so a- > B- > C forms a nested ring.
Based on the definition of the embedded ring, in this embodiment, the method for detecting the embedded ring of the intelligent station description file data type template specifically includes the following steps:
setting a stack, wherein the node type in the stack is { DOType node id, and the ith SDO node in the DOType node id }; i is calculated from 1;
(1) Collecting all N DOType type nodes containing SDO nodes in a data type template;
(2) Let the node to be traversed be (M, i); if a node of a certain DOType type has been traversed, marking that the node has been traversed and N=N-1, otherwise N remains unchanged;
(3) Stacking nodes to be traversed; judging whether the DOType node referenced by the ith SDO child node is in a stack or not, if so, forming an embedded ring from the DOType node referenced by the ith SDO child node to the DOType node where the ith SDO child node is located in the stack, and executing the step (4); otherwise, executing the step (6);
(4) Outputting and storing DOType type nodes contained in the embedded ring, and popping the last node to be stacked;
(5) Judging whether the node to be traversed has an SDO child node which is not traversed;
if present, let i=i+1, repeating steps (2) - (5);
otherwise, performing stack top node pop, wherein the DOType node after the pop is the node to be traversed, repeating the step (5) until the stack is empty, and switching to the step (8);
(6) Traversing DOType nodes M 'referenced by the ith SDO child node, namely enabling the nodes to be traversed to be (M', i), wherein i=1;
(7) Repeating steps (2) - (6);
(8) Selecting a node of a DOType type which is not traversed, and repeating the steps (2) - (7) until N=0;
(9) Judging whether nested ring information is output, if yes, outputting true, otherwise outputting false.
The following describes a nested ring detection method according to the present embodiment by taking the nested ring schematic diagram shown in fig. 1 as an example:
1): the nodes which meet the condition of containing SDO are found to have 3 nodes A, B and C. Traversing from a, the first SDO node type= "B" in node a, push { a,1}, stack. The SDO node references a node B node, is not in the stack,
2): traversing node B, only one SDO node in the node, its type= "C", push { B,1}, stack.
3): the SDO node references node C, which is not in the stack, and is traversed next, and only one SDO node of this node, whose type= "a", is pushed onto the stack { C, 1}.
4): the SDO node references node A, A in the stack, i.e., { A,1}. Thus, a ring is formed, the ring information is saved, A- > B- > C, and the last node { C,1} is popped off the stack, with { A,1} { B,1} remaining in the stack.
5): there are no other child nodes in node C, the { B,1} node is popped off, and only { A,1} node is in the stack. Returning to the node B, wherein only one node in the node B has traversed, popping { A,1}, and checking whether the node A has non-traversed child nodes or not when the stack is empty.
6): the child nodes of type= "C" are not traversed in the A node, the { A,2} is pushed, the SDO node refers to the node C node and is not in the stack, so the C node is traversed, only one SDO node is traversed in the node, the type= "A" is pushed in the stack, the { C,1} is pushed in the stack, the referenced node A is { A,2}, a nested ring A- > C is formed, the last node in the stack is popped out, at the moment, all child nodes in the remaining { A,2} in the stack are traversed, the last node in the last stack is popped out, and at the moment, the stack is empty.
7): and continuing to fall back to the node A, wherein all child nodes in the node A are traversed completely and the stack is empty, exiting the cycle, and finishing the algorithm if all the nodes in the graph are traversed completely.
In order to more fully describe the method disclosed in this embodiment, a nested ring detection method of this embodiment is described below by taking a nested ring schematic diagram shown in fig. 2 as an example:
referring to fig. 2, the nodes satisfying the condition containing SDO are found to have 4 nodes a, B, C, D in total.
1) Traversing from node a, the first SDO node type= "B" in node a, pushes { a,1} to the stack. The SDO node references node B and is not in the stack. Traversing the node B next;
2) There are 2 SDO nodes in the node B, SDO node type 1= "C", and { B,1} is stacked. The SDO node references the C node, which is not in the stack, and is traversed next.
3) There are 2 SDO nodes in the C node, SDO node type 1= "a", and { C,1} is stacked. The SDO node references node A, A in the stack, i.e., { A,1}. Thus, a ring is formed, the ring information is saved, A- > B- > C, and the last node { C,1} is popped off the stack, with { A,1} { B,1} remaining in the stack.
4) Traversing the 2 nd child node in node C, { C,2} pushes on the stack, where { A,1} { B,1} { C,2} remains in the stack. This node type= "D", D is not in the stack, and the D node is traversed next.
5) Only one child node in the node D is put in the stack { D,1}, where { a,1} { B,1} { C,2} { D,1} the child node type= "B", and the node B forms a ring in the stack, B- > C- > D. { D,1} pop-up, leave { A,1} { B,1} { C,2} in the stack.
6) Returning to node C, there are no more other non-traversed child nodes in C, { C,2} popped off the stack, leaving { A,1} { B,1}, in the stack.
7) Returning to the node B, and a child node in the node B, firstly popping { B,1} off the stack, and remaining { A,1} in the stack. Type= "D" of the 2 nd child node, D is not in the stack, node { B,2} is pushed on, and the information in the stack is { a,1} { B,2}. The next step traverses node D.
8) Only one child node in node D,1 is stacked, with a { a,1} { B,2} { D,1} stack. The child node type= "B", the B node forms a ring in the stack, B- > D. { D,1} pop-up, leave { A,1} { B,2} in the stack. At this point all SDO nodes in the node B have traversed, { B,2} pop off the stack, leaving { A,1} in the stack.
9) And returning to the node A, wherein the first child node is traversed, the stack is popped { A,1} and is empty.
10 The child node of type= "C" is not traversed in node a, the method is the same as above, wherein loop a- > C is obtained when traversing the first SDO node, and the steps are not repeated. At this time, all nodes in the graph are traversed, the stack is empty, and the algorithm is ended.
Example two
In one or more embodiments, an intelligent station profile data type template nested loop detection method is disclosed.
First, the embodiment of the present invention is defined as follows for the nested ring:
d= { E }, where E is a datatype node, and btype= "Struct" (a condition of btype= "Struct" is not described in detail below for convenience of description, abbreviated to datatype node), D is a finite set of E.
The attribute of the datatype node contains an id attribute, and the child node of the datatype node contains a type attribute.
The datae node of id= "X '" is simply referred to as X' node; assuming that the child node type of the a ' node is a BDA child node, its attribute type= "B '", the BDA child node refers to a corresponding B ' node, which is one path a ' - > B ' in the composition data type template, where a ', B ' are two nodes on the path.
If the referenced node B contains the BDA type child node and the attribute bType= "Struct", the searching is continued and the cycle is repeated.
If starting from a certain node, it is finally possible to return to the node, it is called a nested ring.
In fig. 3, there is one BDA child node in the a 'node, whose attribute btype= "Struct", type= "B'"; the child node of type= "B '" refers to the B' node, there is one BDA node of type= "C '" in this node, and the BDA node of attribute btype= "Struct", type= "C'" refers to the a 'node, so a' - > B '- > C' constitutes a nested ring.
In this embodiment, the method for detecting the nested loop of the intelligent station description file data type template includes the following steps:
setting a stack, wherein the node type in the stack is { DAType node id, i BDA node in the DAType node id }; i is calculated from 1;
(1) Collecting all N DATtype nodes containing BDA nodes in a data type template;
(2) Let the node to be traversed be (P, i); if a certain datatype node has been traversed, marking that the node has been traversed and n=n-1, otherwise N remains unchanged;
(3) Stacking nodes to be traversed; judging whether the DATtype node referenced by the ith BDA sub-node is in the stack or not, if so, forming an embedded ring from the DATtype node referenced by the ith BDA sub-node to the DATtype node where the ith BDA sub-node is located in the stack, and executing the step (4); otherwise, executing the step (6);
(4) The DAType node contained in the embedded ring is output and stored, and the last node which is put into the stack is popped;
(5) Judging whether a non-traversed BDA child node exists in the nodes to be traversed;
if present, let i=i+1, repeating steps (2) - (5);
otherwise, executing stack top node pop, wherein the node of the type DAType after the pop is the node to be traversed, repeating the step (5) until the stack is empty, and switching to the step (8);
(6) Traversing a DAType node P 'referenced by an ith BDA child node, namely enabling the node to be traversed to be (P', i), wherein i=1;
(7) Repeating steps (2) - (6);
(8) Selecting a node of a DAType which is not traversed, and repeating the steps (2) - (7) until N=0;
(9) Judging whether nested ring information is output, if yes, outputting true, otherwise outputting false.
The method for detecting the nested ring shown in fig. 3 is the same as the method for detecting the nested ring shown in fig. 1 in the first embodiment, and will not be described again.
It should be noted that, in the above embodiment, the type of DOType, the type of dataype, the type of SDO, and the type of BDA are all existing data type structures, and the definition refers to IEC61850-6.
By adopting the nested ring detection method in the embodiment, assuming that the number of SDO nodes in the model is m and the number of DOTypes containing the SDO nodes is n, the reference number of each DOType node is determined by the number of the SDO nodes, so that each DOType node has m references at most. Since there are at most n DOType nodes, the time complexity is O (m×n), thereby improving the working efficiency.
Example III
In one or more embodiments, a terminal device is disclosed that includes a processor for implementing instructions and a computer-readable storage medium; the computer readable storage medium is configured to store a plurality of instructions adapted to be loaded by a processor and to perform the intelligent station profile data type template nested loop detection method described in embodiment one or embodiment two.
In other embodiments, a computer readable storage medium is disclosed, in which a plurality of instructions are stored, wherein the instructions are adapted to be loaded by a processor of a terminal device and to perform the intelligent station description file data type template nested loop detection method described in embodiment one or embodiment two.
While the foregoing description of the embodiments of the present invention has been presented in conjunction with the drawings, it should be understood that it is not intended to limit the scope of the invention, but rather, it is intended to cover all modifications or variations within the scope of the invention as defined by the claims of the present invention.