SCD configuration tool, icd and scd data type template merging method and storage medium
Patent Information
- Application Number
- CN202610989720.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-11-03
AI Technical Summary
现有SCD配置工具在合并ICD与SCD数据类型模板时,导致SCD文件中重复定义的数据类型增多,影响传输、解析和比对效率。
Data type templates are merged using a hierarchical approach. Starting from the lowest level, the IDs of ICD and SCD files are compared. If they match, the content is further compared. If they match, no addition is made. If they do not match, the data type template is replaced or added to ensure that no duplicate definitions are made.
By using hierarchical division and content comparison methods, duplicate definitions in SCD files are reduced, improving merging and application efficiency.
Smart Images

Figure CN123030669A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent substation technology, specifically relating to an SCD configuration tool, a method for merging ICD and SCD data type templates, and a storage medium. Background Technology
[0002] The Substation Configuration Description File (SCD) of a smart substation is generated and maintained by an SCD configuration tool. The SCD integrates the ICDs (Intelligent Device Description Files) of all Intelligent Electrical Equipment (IEDs) in the substation. An ICD is a general template file describing the standardized capabilities of the corresponding IED, defining the data model and services possessed by the IED. The data model is built from data type templates. For example, Chinese patent application CN112949228A discloses an automatic configuration method and device for SCD files in a smart substation. This method imports the ICD model files of the bay-level and process-level equipment capabilities from the actual engineering configuration into each bay, retains the original communication configuration, and uses the SCD configuration tool to update the virtual terminal connection relationships based on standardized virtual terminal names to complete the SCD configuration.
[0003] Therefore, when a smart substation is modified, such as adding a new IED in the SCD or replacing the model of an existing IED, the data type template in the ICD file corresponding to the modified IED needs to be merged with the data type template in the SCD file. The data type template is a mold library of data types, defining all reusable data types for IED instantiation. Each data type template has a unique identifier, i.e., id. Currently, when merging, the SCD configuration tool generally performs a simple comparison of the various data type id identifiers in the data type templates of the ICD and SCD files. Data types with different ids are directly added to the SCD, and data types with the same id are simply modified before being added to the SCD. This leads to an increase in duplicate data types in the SCD, making the SCD file too large, which in turn affects the efficiency of SCD file transmission, parsing, and comparison. Summary of the Invention
[0004] The purpose of this invention is to provide an SCD configuration tool, a method for merging ICD and SCD data type templates, and a storage medium to solve the problem of increased redundant data types in the SCD after merging ICD and SCD data type templates in existing SCD configuration tools.
[0005] To address the aforementioned technical problems, the first aspect of this invention provides a method for merging ICD and SCD data type templates, comprising: The data type templates are divided into levels, and the merging starts from the lowest level of data type templates. First, the IDs of the data type templates in the ICD and SCD files are compared. If the IDs match, the content of the data type templates is further compared. If both the IDs and the content match, the data type template is not added to the SCD file. If the IDs match but the content does not match, the IDs of the data type templates in the ICD file and the IDs of the referenced data type templates are modified to the new IDs, and the modified data type templates are added to the SCD file. If the IDs are inconsistent, the SCD file is traversed to determine if a data type template with the same content exists. If it exists, the data type template is not added to the SCD file. If it does not exist, the data type template is added to the SCD file directly. Once the lowest-level data type templates have been merged, the data type templates of the next higher level are merged based on the merged ICD file, until the highest-level data type templates have been merged.
[0006] In one possible implementation, if the IDs are different but the content is the same, the ID of the data type template with the same content is obtained from the SCD file, and this ID is used to replace the ID of the corresponding data type template in the ICD file and the ID of the referenced data type template.
[0007] In one possible implementation, the data type templates include LNodeType, DOType, DAType, and EnumType. During the merging process, the data type templates of EnumType are merged first. Based on the ICD file obtained after merging the data type templates of EnumType, the data type templates of DAType are merged. Based on the ICD file obtained after merging the data type templates of DAType, the data type templates of DOType are merged. Based on the ICD file obtained after merging the data type templates of DOType, the data type templates of LNodeType are merged.
[0008] In one possible implementation, when merging DAType data type templates, first merge the DAType data type templates whose BDA child nodes do not reference other DAType data type templates, and then merge the DAType data type templates whose BDA child nodes reference other DAType data type templates that have already been merged.
[0009] In one possible implementation, when merging DOType data type templates, first merge DOType data type templates that do not have SDO child nodes, and then merge DOType data type templates that have been merged and whose SDO child nodes reference DOType data type templates.
[0010] In one possible implementation, consistency of LNodeType data type template content means that the lnClass attribute and DO child nodes of the LnodeType data type template are the same in both the ICD file and the SCD file.
[0011] In one possible implementation, consistency of DOType data type template content means that the cdc attribute, DA child node, and SDO child node of the DOType data type template are identical in both the ICD file and the SCD file.
[0012] In one possible implementation, the id of the LNodeType data type template referenced in the ICD file refers to the id of the LNodeType data type template used in the lnType attribute of LN0 and LN nodes.
[0013] To address the aforementioned technical problems, a second aspect of the present invention provides an SCD configuration tool, which uses the steps of the above method to merge ICD and SCD data type templates.
[0014] To address the aforementioned technical problems, a third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0015] The beneficial effects of this invention are as follows: When adding a new IED to the SCD or performing model replacement on an existing IED, the data type templates are hierarchically divided. According to the hierarchical architecture of the data type templates, starting from the lowest level data type template, the corresponding data templates in the ICD and SCD files are compared and merged from low to high level. During merging, the ID is compared first, and the content of the data type template is further compared based on whether the IDs are the same or different. Based on the comparison results of the ID and content, it is determined whether to add a data type template to the SCD file, thereby ensuring that no duplicate data types are added to the SCD. Furthermore, merging the data type templates of the upper level based on the merged ICD file at the lower level can ensure the accuracy of merging and improve merging efficiency, thereby achieving the effect of simplifying the SCD file and improving the application efficiency of the SCD file. Attached Figure Description
[0016] Figure 1 This is a flowchart of the ICD and SCD data type template merging process of the present invention; Figure 2 This is a flowchart of the EnumType data type template merging process of the present invention; Figure 3 This is a flowchart of the DAType data type template merging process of the present invention; Figure 4This is a flowchart of the DOType data type template merging process of the present invention; Figure 5 This is a flowchart of the LnodeType data type template merging process of the present invention; Figure 6 This is a schematic diagram of the SCD configuration tool structure of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the present invention clearer, the specific embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0018] This invention performs a detailed comparison of all data types in the ICD and SCD when adding a new IED to the SCD or performing model replacement on an existing IED. Based on the comparison results, it determines whether to add the data to the SCD, thereby ensuring that no duplicate data types are added to the SCD, achieving the effect of simplifying the SCD file and improving the application efficiency of the SCD file.
[0019] Implementation Method for Merging ICD and SCD Data Type Templates The present invention provides a method for merging ICD and SCD data type templates. When adding a new IED to the SCD or performing model replacement on an existing IED, all data type templates in the ICD and SCD are classified and compared in detail. Based on the comparison results, it is determined whether to add them, thereby ensuring that no duplicate data type templates are added to the SCD, achieving the effect of simplifying the SCD file and improving the application efficiency of the SCD file.
[0020] The data type templates for ICD and SCD generally include: LNodeType (Logical Node Type): Attributes include id (identifier of the data template) and lnClass (standard class name); the element is a DO node, and each DO node represents a data object owned by this logical node type.
[0021] DOType (Data Object Type): Attributes include id and cdc (Common Data Class). DOType includes SDO child nodes and / or DA child nodes, with SDO child nodes referencing other types of DOType.
[0022] DAType (Data Attribute Type): Attributes include id; elements are BDA (Basic Data Attribute) child nodes. BDA child nodes under the DAType data type can reference EnumType or other DAType data type templates. When referencing other DAType data types, it indicates that there is a nested relationship between the current DAType data type comparison nodes.
[0023] EnumType (enumeration type): The attribute includes id, and its element is an EnumVal child node.
[0024] IED assembles its own data model by referencing the above data type templates.
[0025] Based on the above data type templates, such as Figure 1 As shown, the specific implementation process of the ICD and SCD data type template merging method of the present invention includes: 1. Traverse the EnumType data type nodes in the ICD file and compare and merge them with the EnumType data type templates in the SCD.
[0026] like Figure 2 As shown, it includes the following steps: 1) Obtain a list of all EnumType data type nodes in the ICD file corresponding to the modified IED.
[0027] 2) Traverse the list and compare and merge the results.
[0028] 3) First, determine whether all EnumType data type nodes have been compared and merged. If they have been compared and merged, end the process; otherwise, obtain the current EnumType data type comparison node and continue the comparison.
[0029] 4) Start the comparison. First, obtain the ID of the comparison node for the current EnumType data type.
[0030] 5) Search for EnumType data type nodes with the same ID in the SCD file.
[0031] 6) If there are EnumType data type nodes with the same ID in the SCD file, compare whether the EnumVal child nodes under the two EnumType data type nodes are the same.
[0032] If the child nodes of EnumVal are the same, then it is determined that the two EnumType data type nodes have the same id and the same content, and step 8 is executed.
[0033] If the EnumVal child nodes are different, continue traversing the EnumType data type nodes in the SCD file, comparing the EnumVal child nodes under the current EnumType data type comparison node and the EnumType data type node in the SCD file. If an EnumType data type node with the same content as the current EnumType data type comparison node (i.e., the same EnumVal child node) is found during the traversal, it is determined that the ids are different but the content is the same, and step 10 is executed. If no EnumType data type node with the same content is found in the SCD file after the traversal, it is determined that the ids are the same but the content is different, and step 9 is executed.
[0034] 7) If no EnumType data type node with the same ID exists in the SCD file, continue traversing the EnumType data type nodes in the SCD file, comparing the EnumVal child nodes under the current EnumType data type node with those under the EnumType data type node in the SCD file. If an EnumType data type node with the same content is found in the SCD file during the traversal, it is determined that the IDs are different but the content is the same, and step 10) is executed. If no EnumType data type node with the same content is found in the SCD file after the traversal, it is determined that the IDs are different and the content is different, and step 11) is executed.
[0035] 8) If the IDs and contents are the same, it means that there is an identical EnumType data type template in the SCD file. It is not necessary to replace the source ID of the EnumType data type in the ICD file, nor is it necessary to add the current EnumType data type comparison node to the SCD file. Return to step 3).
[0036] 9) If the IDs are the same but the content is different, it indicates that there is an EnumType data type template with the same but different IDs in the SCD file. A new ID for the unique EnumType data type is generated in the SCD file. This new ID replaces the ID of the current EnumType data type comparison node in the ICD file, as well as the old ID in the ICD file that uses this EnumType data type template. For example, replace the old ID of the EnumType data type template referenced in the DA node in DOType and the BDA node in DAType with the new ID. Add the current EnumType data type comparison node in the modified ICD file to the SCD file and return to step 3).
[0037] 10) If the values are different but the content is the same, it means that there are identical EnumType data types in the SCD file but with different values. The source value needs to be replaced, and the data type does not need to be added to the SCD file. Therefore, obtain the value of the EnumType data type node with the same content in the SCD file, replace the value of the current EnumType data type comparison node in the ICD file with this value, and replace the source value of the comparison node using the current EnumType data type in the ICD file. For example, replace the old value of the DA node in DOType and the BDA node in DAType that use the current EnumType data type in the ICD file, and return to step 3).
[0038] 11) If the IDs are different and the content is different, it means that the EnumType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current EnumType data type comparison node in the ICD file to the SCD file and return to step 3).
[0039] After all the EnumType data type nodes in the ICD file have been compared and merged with the SCD, all the EnumType data types in the ICD file that need to have their IDs replaced have been replaced. The DA nodes in the DOType and the BDA nodes in the DAType that use the old IDs have also been replaced. All the EnumType data type nodes that need to be added have been added to the SCD file.
[0040] 2. After the EnumType data type templates are merged, the DAType data type nodes in the ICD file are traversed and compared and merged with the DAType data type templates in the SCD.
[0041] like Figure 3 As shown, it includes the following steps: 1) Obtain a list of all DAType data type nodes in the ICD file and add them to the comparison queue.
[0042] 2) Set the current DAType data type comparison node index to 0, pointing to the first node in the queue.
[0043] 3) Determine if the queue to be compared is empty. If it is empty, it means that all DAType data type nodes have been compared and merged, and the process ends. If it is not empty, continue to determine if the index of the current DAType data type comparison node has exceeded the tail of the queue. If it has exceeded the tail, reset the index of the current DAType data type comparison node to 0, pointing to the first node in the queue.
[0044] 4) Obtain the current DAType data type comparison node based on the current comparison node index.
[0045] 5) Obtain the list of BDA child nodes that reference other DAType data types under the current DAType data type comparison node.
[0046] 6) If the list is empty, proceed to step 8).
[0047] 7) If the list is not empty, iterate through the list of BDA child nodes to check if there is a DAType data type node referenced by BDA in the comparison queue. If it exists, increment the index of the current comparison node and execute step 3); if it does not exist, execute step 8).
[0048] This invention first compares and merges DAType data types that do not have nesting relationships, and then compares and merges other DAType data types referenced by BDA child nodes. The comparison and merging of DAType data types has been completed, which can improve the accuracy of the comparison and avoid merging errors.
[0049] 8) Remove the current DAType data type comparison node from the comparison queue.
[0050] 9) Start the comparison. First, obtain the type ID of the comparison node for the current DAType data type.
[0051] 10) Find the DAType data type node with the same id in the SCD file.
[0052] 11) If there are DAType data type nodes with the same ID in the SCD file, compare whether the BDA child nodes under the two nodes are the same.
[0053] If the BDA child nodes are the same, it is determined that the two DAType data type nodes have the same ID and the same content, and step 13 is executed.
[0054] If the BDA child nodes are different, continue traversing the DAType data type nodes in the SCD file, comparing the BDA child nodes under the current DAType data type comparison node and the DAType data type node in the SCD file. If a DAType data type node with the same content (i.e., the same BDA child nodes) is found during the traversal, it is determined that the ids are different but the content is the same, and step 15 is executed; if no DAType data type node with the same content is found after the traversal, it is determined that the ids are the same but the content is different, and step 14 is executed.
[0055] 12) If no DAType data type node with the same ID exists, continue traversing the DAType data type nodes in the SCD file and compare the BDA child nodes under the current DAType data type node with those under the DAType data type node in the SCD file. If a DAType data type node with the same content is found during traversal, it is determined that the IDs are different but the content is the same, and step 15 is executed. If no DAType data type node with the same content is found after traversal, it is determined that the IDs are different and the content is different, and step 16 is executed.
[0056] 13) If the IDs and contents are the same, it means that there is an identical DAType data type template in the SCD file. It is not necessary to replace the source ID of the current DAType data type comparison node in the ICD file, and it is not necessary to add it to the SCD file. Then return to step 3).
[0057] 14) If the IDs are the same but the content is different, it indicates that there are DAType data types with the same ID but different content in the SCD file. The source ID needs to be replaced, and the data needs to be added to the SCD file. A new ID for the unique DAType data type is generated in the SCD file. This new ID replaces the ID of the current DAType data type comparison node in the ICD file, as well as the old ID in the ICD file that uses this DAType data type. For example, the old IDs referencing this DAType data type in the DA node of DOType and the BDA node of DAType are replaced with the new IDs. The modified current DAType data type comparison node in the ICD file is added to the SCD file, and the process returns to step 3).
[0058] 15) If the id is different but the content is the same, it means that there is the same DAType data type in the SCD file but the id is different. The source id needs to be replaced, but it does not need to be added to the SCD file. Then, obtain the id of the DAType data type node with the same content in the SCD file, replace the id of the current DAType data type comparison node in the ICD file with this id, and replace the old id of the DAType data type in the ICD file. For example, replace the old id of the DA node in DOType and the BDA node in DAType that references the DAType data type with the new id, and return to step 3).
[0059] 16) If the IDs are different and the content is different, it means that the DAType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current DAType data type comparison node in the ICD file to the SCD file and return to step 3).
[0060] After all DAType data type nodes in the ICD file have been compared and merged with the SCD, all DAType data types in the ICD file whose IDs need to be replaced have been replaced. The DA nodes in the DOType and the BDA nodes in the DAType that use the old ID have also been replaced. All DAType data type nodes that need to be added have been added to the SCD file.
[0061] 3. After the DAType data type templates are merged, the DOType data type nodes in the ICD file are traversed and compared and merged with the DOType data type templates in the SCD.
[0062] like Figure 4 As shown, it includes the following steps: 1) Obtain a list of all DOType data type nodes in the ICD file and add them to the comparison queue.
[0063] 2) Set the current DOType data type comparison node index to 0, pointing to the first node in the queue.
[0064] 3) Determine if the queue to be compared is empty. If it is empty, it means that all DOType data type nodes have been compared and merged, and the process ends. If it is not empty, continue to determine if the index of the current DOType data type comparison node has exceeded the tail of the queue. If it has exceeded the tail, reset the index of the current comparison node to 0 and point to the first node in the queue.
[0065] 4) Obtain the current DOType data type comparison node based on the current comparison node index.
[0066] 5) Get the list of SDO child nodes under the current DOType data type comparison node.
[0067] 6) If the SDO child node list is empty, proceed to step 8).
[0068] 7) If the SDO child node list is not empty, iterate through the SDO child node list and check if there is a DOType data type node referenced by the SDO child node in the comparison queue. If it exists, increment the index of the current comparison node and execute step 3); if it does not exist, execute step 8).
[0069] 8) Remove the current DOType data type comparison node from the comparison queue.
[0070] 9) Start the comparison. First, obtain the type ID of the comparison node for the current DOType data type.
[0071] 10) Search for DOType data type nodes with the same id in the SCD file.
[0072] 11) If there are DOType data type nodes with the same id in the SCD file, compare whether the cdc attribute, DA child node and SDO child node of the two nodes are the same.
[0073] If the cdc attribute, DA child node, and SDO child node are all the same, then it is determined that the two DOType data type nodes have the same id and the same content (that is, the same content means that the cdc attribute, DA child node, and SDO child node are all the same), and step 13 is executed. If any of the cdc attribute, DA child node, or SDO child node is different, continue traversing the DOType data type nodes in the SCD file, comparing the cdc attribute, DA child node, and SDO child node of the current comparison node with those of the DOType data type nodes in the SCD file. If a DOType data type node with the same content is found during the traversal, it is determined that the ids are different but the content is the same, and step 15 is executed. If no DOType data type node with the same content is found after the traversal, it is determined that the ids are the same but the content is different, and step 14 is executed.
[0074] 12) If no DOType data type node with the same id exists in the SCD file, continue traversing the DOType data type nodes in the SCD file and compare the cdc attribute, DA child node, and SDO child node of the current DOType data type comparison node with the DOType data type node in the SCD file. If a DOType data type node with the same content is found during the traversal, it is determined that the ids are different but the content is the same, and step 15 is executed. If no DOType data type node with the same content is found after the traversal, it is determined that the ids are different and the content is different, and step 16 is executed.
[0075] 13) If the IDs and contents are the same, it means that there is an identical DOType data type in the SCD file. The source ID does not need to be replaced, and it does not need to be added to the SCD file. Then return to step 3.
[0076] 14) If the IDs are the same but the content is different, it indicates that there are DOType data types with the same ID but different values in the SCD file. The source ID needs to be replaced, and the DOType data type needs to be added to the SCD file. A new ID for the unique DOType data type is generated in the SCD file. This new ID replaces the type ID of the current DOType data type comparison node in the ICD file, as well as the old ID of the DOType data type used in the ICD file. For example, the old ID of the DOType data type referenced in the SDO node in DOType and the DO node in LNodeType is replaced with the new ID. The modified current DOType data type comparison node in the ICD file is added to the SCD file, and the process returns to step 3).
[0077] 15) If the IDs are different but the content is the same, it indicates that there are identical DOType data types in the SCD file but with different IDs. The source ID needs to be replaced, but it does not need to be added to the SCD file. Then, obtain the ID of the DOType data type node with the same content in the SCD file, replace the ID of the current DOType data type comparison node in the ICD file with this ID, and replace the old ID of the DOType data type used by the SDO node in the DOType and the DO node in the LNodeType in the ICD file. Return to step 3).
[0078] 16) If the IDs are different and the contents are different, it means that the DOType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current DOType data type comparison node in the ICD file to the SCD file and return to step 3).
[0079] After all DOType data type nodes in the ICD file have been compared and merged with the SCD, all DOType data types in the ICD file that need to have their IDs replaced have been replaced. The SDO nodes in the DOTypes using the old IDs and the DO nodes in the LNodeTypes have also been replaced. All DOType data type nodes that need to be added have been added to the SCD file.
[0080] 4. After the DOType data type templates are merged, the LNodeType data type nodes in the ICD file are traversed and compared and merged with the LNodeType data type templates in the SCD.
[0081] like Figure 5 As shown, it includes the following steps: 1) Obtain a list of all LNodeType data type nodes in the ICD file.
[0082] 2) Traverse the list and compare and merge the results.
[0083] 3) First, determine whether all LNodeType data type nodes have been compared and merged. If they have been compared and merged, end the process; otherwise, obtain the current LNodeType data type comparison node and continue the comparison.
[0084] 4) Start the comparison. First, obtain the type id and lnClass of the node to be compared, which are of the current LNodeType data type.
[0085] 5) Search for nodes with the same ID and data type LNodeType in the SCD file.
[0086] 6) If there are LNodeType data type nodes with the same id, compare whether the lnClass attribute and DO child nodes of the two nodes are the same.
[0087] If the lnClass attribute and the DO child node are the same, then it is determined that the two LNodeType data type nodes have the same id and the same content, and step 8 is executed.
[0088] If the lnClass attribute and any of the DO child nodes are different, continue traversing the LNodeType data type nodes in the SCD file, comparing the lnClass attribute and DO child nodes of the current LNodeType data type comparison node with those of the LNodeType data type nodes in the SCD file. If an LNodeType data type node with the same content is found during traversal, it is determined that the ids are different but the content is the same, and step 10 is executed. If no LNodeType data type node with the same content is found after traversal, it is determined that the ids are the same but the content is different, and step 9 is executed.
[0089] 7) If no LNodeType data type node with the same id exists, continue traversing the LNodeType data type nodes in the SCD file, comparing the lnClass attribute and DO child nodes of the current comparison node and the LNodeType data type node in the SCD file. If an LNodeType data type node with the same content is found during traversal, it is determined that the ids are different but the content is the same, and step 10 is executed. If no LNodeType data type node with the same content is found after traversal, it is determined that the ids are different and the content is different, and step 11 is executed.
[0090] 8) If the IDs and contents are the same, it means that there is an identical LNodeType data type in the SCD file. The source ID does not need to be replaced, and it does not need to be added to the SCD file. Then return to step 3.
[0091] 9) If the IDs are the same but the content is different, it indicates that there are LNodeType data types with the same ID but different values in the SCD file. The source ID needs to be replaced and added to the SCD file. A new ID for the unique LNodeType data type is generated in the SCD file. This new ID replaces the type ID of the current LNodeType data type comparison node in the ICD file, and also replaces the old ID of the LNodeType data type used in the lnType attribute of the LN0 and LN nodes in the ICD file. The modified current LNodeType data type comparison node in the ICD file is added to the SCD file, and the process returns to step 3).
[0092] 10) If the values are different but the content is the same, it means that there are identical LNodeType data types in the SCD file but with different values. The source value needs to be replaced, but it does not need to be added to the SCD file. Then, obtain the type value of the LNodeType data type node with the same content in the SCD file, replace the type value of the current LNodeType data type comparison node in the ICD file with this value, and replace the old value of the LNodeType data type used in the lnType attribute of the LN0 and LN nodes in the ICD file with this value. Return to step 3).
[0093] 11) If the IDs are different and the content is different, it means that the LNodeType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current LNodeType data type comparison node in the ICD file to the SCD file and return to step 3).
[0094] After all LNodeType data type nodes in the ICD file have been compared and merged with the SCD, all LNodeType data types in the ICD file that need to have their IDs replaced have been replaced, and the lnType attribute of the LN0 and LN nodes using the old IDs has also been replaced. All LNodeType data type nodes that need to be added have been added to the SCD file.
[0095] This concludes the entire data type template comparison and merging process.
[0096] Based on the above implementation process, the method for merging ICD and SCD data type templates of the present invention includes the following steps: Data type templates are divided into hierarchical categories, and merging begins with the lowest-level data type templates. First, the IDs of the data type templates in the ICD and SCD files are compared.
[0097] If the IDs match, the content of the data type templates is further compared. If both the IDs and the content match, the data type template is not added to the SCD file. If the IDs match but the content does not match, the IDs of the data type templates in the ICD file and the IDs of the referenced data type templates are modified to the new IDs, and the modified data type templates are added to the SCD file.
[0098] If the IDs are inconsistent, the SCD file is traversed to determine if a data type template with the same content exists. If it exists, the data type template is not added to the SCD file. Instead, the ID of the data type template with the same content is retrieved from the SCD file, and this ID is used to replace the ID of the corresponding data type template in the ICD file and the ID of the referenced data type template. If it does not exist, the data type template is directly added to the SCD file.
[0099] Once the lowest-level data type templates have been merged, the data type templates of the next higher level are merged based on the merged ICD file, until the highest-level data type templates have been merged.
[0100] When the data type templates include LNodeType, DOType, DAType, and EnumType, during the merging process, the data type templates of EnumType are merged first. Based on the ICD file obtained after merging the data type templates of EnumType, the data type templates of DAType are merged. Based on the ICD file obtained after merging the data type templates of DAType, the data type templates of DOType are merged. Based on the ICD file obtained after merging the data type templates of DOType, the data type templates of LNodeType are merged.
[0101] When merging DAType data type templates, first merge the DAType data type templates whose BDA child nodes do not reference other DAType data type templates, and then merge the DAType data type templates whose BDA child nodes reference other DAType data type templates that have already been merged.
[0102] When merging DOType data type templates, first merge DOType data type templates that do not have SDO child nodes, and then merge DOType data type templates that have been merged and whose SDO child nodes reference DOType data type templates.
[0103] SCD Configuration Tool Implementation Method An SCD configuration tool of the present invention is illustrated in the following diagram. Figure 6As shown, the system includes a memory, a processor, a system bus, and a computer program stored in the memory. The processor and memory communicate and exchange data via the system bus. The processor executes the computer program to implement the steps of the ICD and SCD data type template merging method of the present invention. The processor can be a microprocessor (MCU) or other processing device; the memory can be any type of memory that stores information using electrical energy, such as non-volatile storage media (including computer programs, databases), or other types of memory.
[0104] The method includes the following steps: Divide the data type templates into hierarchical categories and start merging from the lowest level of data type templates, first comparing the IDs of the data type templates.
[0105] If the IDs match, the content of the data type templates is further compared. If both the IDs and the content match, the data type template is not added to the SCD file. If the IDs match but the content does not match, the IDs of the data type templates in the ICD file and the IDs of the referenced data type templates are modified to the new IDs, and the modified data type templates are added to the SCD file.
[0106] If the IDs are inconsistent, the SCD file is traversed to determine if a data type template with the same content exists. If it exists, the data type template is not added to the SCD file. Instead, the ID of the data type template with the same content is retrieved from the SCD file, and this ID is used to replace the ID of the corresponding data type template in the ICD file and the ID of the referenced data type template. If it does not exist, the data type template is directly added to the SCD file.
[0107] Once the lowest-level data type templates have been merged, the data type templates of the next higher level are merged based on the merged ICD file, until the highest-level data type templates have been merged.
[0108] When the data type templates include LNodeType, DOType, DAType, and EnumType, during the merging process, the data type templates of EnumType are merged first. Based on the ICD file obtained after merging the data type templates of EnumType, the data type templates of DAType are merged. Based on the ICD file obtained after merging the data type templates of DAType, the data type templates of DOType are merged. Based on the ICD file obtained after merging the data type templates of DOType, the data type templates of LNodeType are merged.
[0109] Specifically, the implementation process of this method is as follows: 1. Traverse the EnumType data type nodes in the ICD file and compare and merge them with the EnumType data type templates in the SCD.
[0110] 1) Obtain a list of all EnumType data type nodes in the ICD file corresponding to the modified IED.
[0111] 2) Traverse the list and compare and merge the results.
[0112] 3) First, determine whether all EnumType data type nodes have been compared and merged. If they have been compared and merged, end the process; otherwise, obtain the current EnumType data type comparison node and continue the comparison.
[0113] 4) Start the comparison. First, obtain the ID of the comparison node for the current EnumType data type.
[0114] 5) Search for EnumType data type nodes with the same id in the SCD file.
[0115] 6) If there are EnumType data type nodes with the same ID in the SCD file, compare whether the EnumVal child nodes under the two EnumType data type nodes are the same.
[0116] If the child nodes of EnumVal are the same, then it is determined that the two EnumType data type nodes have the same id and the same content, and step 8 is executed.
[0117] If the EnumVal child nodes are different, continue traversing the EnumType data type nodes in the SCD file, comparing the EnumVal child nodes under the current EnumType data type comparison node and the EnumType data type node in the SCD file. If an EnumType data type node with the same content as the current EnumType data type comparison node (i.e., the same EnumVal child node) is found during the traversal, it is determined that the ids are different but the content is the same, and step 10 is executed. If no EnumType data type node with the same content is found in the SCD file after the traversal, it is determined that the ids are the same but the content is different, and step 9 is executed.
[0118] 7) If no EnumType data type node with the same ID exists in the SCD file, continue traversing the EnumType data type nodes in the SCD file, comparing the EnumVal child nodes under the current EnumType data type node with those under the EnumType data type node in the SCD file. If an EnumType data type node with the same content is found in the SCD file during the traversal, it is determined that the IDs are different but the content is the same, and step 10) is executed. If no EnumType data type node with the same content is found in the SCD file after the traversal, it is determined that the IDs are different and the content is different, and step 11) is executed.
[0119] 8) If the IDs and contents are the same, it means that there is an identical EnumType data type template in the SCD file. It is not necessary to replace the source ID of the EnumType data type in the ICD file, nor is it necessary to add the current EnumType data type comparison node to the SCD file. Return to step 3).
[0120] 9) If the IDs are the same but the content is different, it indicates that there is an EnumType data type template with the same but different IDs in the SCD file. A new ID for the unique EnumType data type is generated in the SCD file. This new ID replaces the ID of the current EnumType data type comparison node in the ICD file, as well as the old ID in the ICD file that uses this EnumType data type template. For example, replace the old ID of the EnumType data type template referenced in the DA node in DOType and the BDA node in DAType with the new ID. Add the current EnumType data type comparison node in the modified ICD file to the SCD file and return to step 3).
[0121] 10) If the values are different but the content is the same, it means that there are identical EnumType data types in the SCD file but with different values. The source value needs to be replaced, and the data type does not need to be added to the SCD file. Therefore, obtain the value of the EnumType data type node with the same content in the SCD file, replace the value of the current EnumType data type comparison node in the ICD file with this value, and replace the source value of the comparison node using the current EnumType data type in the ICD file. For example, replace the old value of the DA node in DOType and the BDA node in DAType that use the current EnumType data type in the ICD file, and return to step 3).
[0122] 11) If the IDs are different and the content is different, it means that the EnumType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current EnumType data type comparison node in the ICD file to the SCD file and return to step 3).
[0123] After all the EnumType data type nodes in the ICD file have been compared and merged with the SCD, all the EnumType data types in the ICD file that need to have their IDs replaced have been replaced. The DA nodes in the DOType and the BDA nodes in the DAType that use the old IDs have also been replaced. All the EnumType data type nodes that need to be added have been added to the SCD file.
[0124] 2. After the EnumType data type templates are merged, the DAType data type nodes in the ICD file are traversed and compared and merged with the DAType data type templates in the SCD.
[0125] 1) Obtain a list of all DAType data type nodes in the ICD file and add them to the comparison queue.
[0126] 2) Set the index of the current DAType data type comparison node to 0, pointing to the first node in the queue.
[0127] 3) Determine if the queue to be compared is empty. If it is empty, it means that all DAType data type nodes have been compared and merged, and the process ends. If it is not empty, continue to determine if the index of the current DAType data type comparison node has exceeded the tail of the queue. If it has exceeded the tail, reset the index of the current DAType data type comparison node to 0, pointing to the first node in the queue.
[0128] 4) Obtain the current DAType data type comparison node based on the current comparison node index.
[0129] 5) Obtain the list of BDA child nodes that reference other DAType data types under the current DAType data type comparison node.
[0130] 6) If the list is empty, proceed to step 8).
[0131] 7) If the list is not empty, iterate through the list of BDA child nodes to check if there is a DAType data type node referenced by BDA in the comparison queue. If it exists, increment the index of the current comparison node and execute step 3); if it does not exist, execute step 8).
[0132] This invention first compares and merges DAType data types that do not have nesting relationships, and then compares and merges other DAType data types referenced by BDA child nodes. The comparison and merging of DAType data types has been completed, which can improve the accuracy of the comparison and avoid merging errors.
[0133] 8) Remove the current DAType data type comparison node from the comparison queue.
[0134] 9) Start the comparison. First, obtain the type ID of the comparison node for the current DAType data type.
[0135] 10) Find the DAType data type node with the same id in the SCD file.
[0136] 11) If there are DAType data type nodes with the same ID in the SCD file, compare whether the BDA child nodes under the two nodes are the same.
[0137] If the BDA child nodes are the same, it is determined that the two DAType data type nodes have the same ID and the same content, and step 13 is executed.
[0138] If the BDA child nodes are different, continue traversing the DAType data type nodes in the SCD file, comparing the BDA child nodes under the current DAType data type comparison node and the DAType data type node in the SCD file. If a DAType data type node with the same content (i.e., the same BDA child nodes) is found during the traversal, it is determined that the ids are different but the content is the same, and step 15 is executed; if no DAType data type node with the same content is found after the traversal, it is determined that the ids are the same but the content is different, and step 14 is executed.
[0139] 12) If no DAType data type node with the same ID exists, continue traversing the DAType data type nodes in the SCD file and compare the BDA child nodes under the current DAType data type node with those under the DAType data type node in the SCD file. If a DAType data type node with the same content is found during traversal, it is determined that the IDs are different but the content is the same, and step 15 is executed. If no DAType data type node with the same content is found after traversal, it is determined that the IDs are different and the content is different, and step 16 is executed.
[0140] 13) If the IDs and contents are the same, it means that there is an identical DAType data type template in the SCD file. It is not necessary to replace the source ID of the current DAType data type comparison node in the ICD file, and it is not necessary to add it to the SCD file. Then return to step 3).
[0141] 14) If the IDs are the same but the content is different, it indicates that there are DAType data types with the same ID but different content in the SCD file. The source ID needs to be replaced, and the data needs to be added to the SCD file. A new ID for the unique DAType data type is generated in the SCD file. This new ID replaces the ID of the current DAType data type comparison node in the ICD file, as well as the old ID in the ICD file that uses this DAType data type. For example, the old IDs referencing this DAType data type in the DA node of DOType and the BDA node of DAType are replaced with the new IDs. The modified current DAType data type comparison node in the ICD file is added to the SCD file, and the process returns to step 3).
[0142] 15) If the id is different but the content is the same, it means that there is the same DAType data type in the SCD file but the id is different. The source id needs to be replaced, but it does not need to be added to the SCD file. Then, obtain the id of the DAType data type node with the same content in the SCD file, replace the id of the current DAType data type comparison node in the ICD file with this id, and replace the old id of the DAType data type in the ICD file. For example, replace the old id of the DA node in DOType and the BDA node in DAType that references the DAType data type with the new id, and return to step 3).
[0143] 16) If the IDs are different and the content is different, it means that the DAType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current DAType data type comparison node in the ICD file to the SCD file and return to step 3).
[0144] After all DAType data type nodes in the ICD file have been compared and merged with the SCD, all DAType data types in the ICD file whose IDs need to be replaced have been replaced. The DA nodes in the DOType and the BDA nodes in the DAType that use the old ID have also been replaced. All DAType data type nodes that need to be added have been added to the SCD file.
[0145] 3. After the DAType data type templates are merged, the DOType data type nodes in the ICD file are traversed and compared and merged with the DOType data type templates in the SCD.
[0146] 1) Obtain a list of all DOType data type nodes in the ICD file and add them to the comparison queue.
[0147] 2) Set the current DOType data type comparison node index to 0, pointing to the first node in the queue.
[0148] 3) Determine if the queue to be compared is empty. If it is empty, it means that all DOType data type nodes have been compared and merged, and the process ends. If it is not empty, continue to determine if the index of the current DOType data type comparison node has exceeded the tail of the queue. If it has exceeded the tail, reset the index of the current comparison node to 0 and point to the first node in the queue.
[0149] 4) Obtain the current DOType data type comparison node based on the current comparison node index.
[0150] 5) Get the list of SDO child nodes under the current DOType data type comparison node.
[0151] 6) If the SDO child node list is empty, proceed to step 8).
[0152] 7) If the SDO child node list is not empty, iterate through the SDO child node list and check if there is a DOType data type node referenced by the SDO child node in the comparison queue. If it exists, increment the index of the current comparison node and execute step 3); if it does not exist, execute step 8).
[0153] 8) Remove the current DOType data type comparison node from the comparison queue.
[0154] 9) Start the comparison. First, obtain the type ID of the comparison node for the current DOType data type.
[0155] 10) Search for DOType data type nodes with the same id in the SCD file.
[0156] 11) If there are DOType data type nodes with the same id in the SCD file, compare whether the cdc attribute, DA child node and SDO child node of the two nodes are the same.
[0157] If the cdc attribute, DA child node, and SDO child node are all the same, then it is determined that the two DOType data type nodes have the same id and the same content (the same content means that the cdc attribute, DA child node, and SDO child node are all the same), and step 13 is executed. If any of the cdc attribute, DA child node, or SDO child node is different, continue traversing the DOType data type nodes in the SCD file, comparing the cdc attribute, DA child node, and SDO child node of the current comparison node with those of the DOType data type nodes in the SCD file. If a DOType data type node with the same content is found during the traversal, it is determined that the ids are different but the content is the same, and step 15 is executed. If no DOType data type node with the same content is found after the traversal, it is determined that the ids are the same but the content is different, and step 14 is executed.
[0158] 12) If no DOType data type node with the same id exists in the SCD file, continue traversing the DOType data type nodes in the SCD file and compare the cdc attribute, DA child node, and SDO child node of the current DOType data type comparison node with the DOType data type node in the SCD file. If a DOType data type node with the same content is found during the traversal, it is determined that the ids are different but the content is the same, and step 15 is executed. If no DOType data type node with the same content is found after the traversal, it is determined that the ids are different and the content is different, and step 16 is executed.
[0159] 13) If the IDs and contents are the same, it means that there is an identical DOType data type in the SCD file. The source ID does not need to be replaced, and it does not need to be added to the SCD file. Then return to step 3.
[0160] 14) If the IDs are the same but the content is different, it indicates that there are DOType data types with the same ID but different values in the SCD file. The source ID needs to be replaced, and the DOType data type needs to be added to the SCD file. A new ID for the unique DOType data type is generated in the SCD file. This new ID replaces the type ID of the current DOType data type comparison node in the ICD file, as well as the old ID of the DOType data type used in the ICD file. For example, the old ID of the DOType data type referenced in the SDO node in DOType and the DO node in LNodeType is replaced with the new ID. The modified current DOType data type comparison node in the ICD file is added to the SCD file, and the process returns to step 3).
[0161] 15) If the IDs are different but the content is the same, it indicates that there are identical DOType data types in the SCD file but with different IDs. The source ID needs to be replaced, but it does not need to be added to the SCD file. Then, obtain the ID of the DOType data type node with the same content in the SCD file, replace the ID of the current DOType data type comparison node in the ICD file with this ID, and replace the old ID of the DOType data type used by the SDO node in the DOType and the DO node in the LNodeType in the ICD file. Return to step 3).
[0162] 16) If the IDs are different and the contents are different, it means that the DOType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current DOType data type comparison node in the ICD file to the SCD file and return to step 3).
[0163] After all DOType data type nodes in the ICD file have been compared and merged with the SCD, all DOType data types in the ICD file that need to have their IDs replaced have been replaced. The SDO nodes in the DOTypes using the old IDs and the DO nodes in the LNodeTypes have also been replaced. All DOType data type nodes that need to be added have been added to the SCD file.
[0164] 4. After the DOType data type templates are merged, the LNodeType data type nodes in the ICD file are traversed and compared and merged with the LNodeType data type templates in the SCD.
[0165] 1) Obtain a list of all LNodeType data type nodes in the ICD file.
[0166] 2) Traverse the list and compare and merge the results.
[0167] 3) First, determine whether all LNodeType data type nodes have been compared and merged. If they have been compared and merged, end the process; otherwise, obtain the current LNodeType data type comparison node and continue the comparison.
[0168] 4) Start the comparison. First, obtain the type id and lnClass of the node to be compared, which are of the current LNodeType data type.
[0169] 5) Search for nodes with the same ID and data type LNodeType in the SCD file.
[0170] 6) If there are LNodeType data type nodes with the same id, compare whether the lnClass attribute and DO child nodes of the two nodes are the same.
[0171] If the lnClass attribute and the DO child node are the same, then it is determined that the two LNodeType data type nodes have the same id and the same content, and step 8 is executed.
[0172] If the lnClass attribute and any of the DO child nodes are different, continue traversing the LNodeType data type nodes in the SCD file, comparing the lnClass attribute and DO child nodes of the current LNodeType data type comparison node with those of the LNodeType data type nodes in the SCD file. If an LNodeType data type node with the same content is found during traversal, it is determined that the ids are different but the content is the same, and step 10 is executed. If no LNodeType data type node with the same content is found after traversal, it is determined that the ids are the same but the content is different, and step 9 is executed.
[0173] 7) If no LNodeType data type node with the same id exists, continue traversing the LNodeType data type nodes in the SCD file, comparing the lnClass attribute and DO child nodes of the current comparison node and the LNodeType data type node in the SCD file. If an LNodeType data type node with the same content is found during traversal, it is determined that the ids are different but the content is the same, and step 10 is executed. If no LNodeType data type node with the same content is found after traversal, it is determined that the ids are different and the content is different, and step 11 is executed.
[0174] 8) If the IDs and contents are the same, it means that there is an identical LNodeType data type in the SCD file. The source ID does not need to be replaced, and it does not need to be added to the SCD file. Then return to step 3.
[0175] 9) If the IDs are the same but the content is different, it indicates that there are LNodeType data types with the same ID but different values in the SCD file. The source ID needs to be replaced and added to the SCD file. A new ID for the unique LNodeType data type is generated in the SCD file. This new ID replaces the type ID of the current LNodeType data type comparison node in the ICD file, and also replaces the old ID of the LNodeType data type used in the lnType attribute of the LN0 and LN nodes in the ICD file. The modified current LNodeType data type comparison node in the ICD file is added to the SCD file, and the process returns to step 3).
[0176] 10) If the values are different but the content is the same, it means that there are identical LNodeType data types in the SCD file but with different values. The source value needs to be replaced, but it does not need to be added to the SCD file. Then, obtain the type value of the LNodeType data type node with the same content in the SCD file, replace the type value of the current LNodeType data type comparison node in the ICD file with this value, and replace the old value of the LNodeType data type used in the lnType attribute of the LN0 and LN nodes in the ICD file with this value. Return to step 3).
[0177] 11) If the IDs are different and the content is different, it means that the LNodeType data type does not exist in the SCD file and needs to be added directly to the SCD file. Then add the current LNodeType data type comparison node in the ICD file to the SCD file and return to step 3).
[0178] After all LNodeType data type nodes in the ICD file have been compared and merged with the SCD, all LNodeType data types in the ICD file that need to have their IDs replaced have been replaced, and the lnType attribute of the LN0 and LN nodes using the old IDs has also been replaced. All LNodeType data type nodes that need to be added have been added to the SCD file.
[0179] This concludes the entire data type template comparison and merging process.
[0180] Computer-readable storage medium implementation The present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements the steps of a method for merging ICD and SCD data type templates. This method has been described in detail in the embodiments of the method for merging ICD and SCD data type templates, and will not be repeated here.
Claims
1. A method for merging ICD and SCD data type templates, characterized in that, include: The data type templates are divided into levels, and the merging starts from the lowest level of data type templates. First, the IDs of the data type templates in the ICD and SCD files are compared. If the IDs match, the content of the data type templates is further compared. If both the IDs and the content match, the data type template is not added to the SCD file. If the IDs match but the content does not match, the IDs of the data type templates in the ICD file and the IDs of the referenced data type templates are modified to the new IDs, and the modified data type templates are added to the SCD file. If the IDs are inconsistent, the SCD file is traversed to determine if a data type template with the same content exists. If it exists, the data type template is not added to the SCD file. If it does not exist, the data type template is added to the SCD file directly. Once the lowest-level data type templates have been merged, the data type templates of the next higher level are merged based on the merged ICD file, until the highest-level data type templates have been merged.
2. The method for merging ICD and SCD data type templates according to claim 1, characterized in that, If the IDs are different but the content is the same, then obtain the ID of the data type template with the same content from the SCD file, and use this ID to replace the ID of the corresponding data type template in the ICD file and the ID of the referenced data type template.
3. The method for merging ICD and SCD data type templates according to claim 2, characterized in that, The data type templates include LNodeType, DOType, DAType, and EnumType. During the merging process, the data type templates of EnumType are merged first. Based on the ICD file obtained after merging the data type templates of EnumType, the data type templates of DAType are merged. Based on the ICD file obtained after merging the data type templates of DAType, the data type templates of DOType are merged. Based on the ICD file obtained after merging the data type templates of DOType, the data type templates of LNodeType are merged.
4. The method for merging ICD and SCD data type templates according to claim 3, characterized in that, When merging DAType data type templates, first merge the DAType data type templates whose BDA child nodes do not reference other DAType data type templates, and then merge the DAType data type templates whose BDA child nodes reference other DAType data type templates that have already been merged.
5. The method for merging ICD and SCD data type templates according to claim 3, characterized in that, When merging DOType data type templates, first merge DOType data type templates that do not have SDO child nodes, and then merge DOType data type templates that have been merged and whose SDO child nodes reference DOType data type templates.
6. The method for merging ICD and SCD data type templates according to claim 3, characterized in that, The consistency of LNodeType data type template content means that the lnClass attribute and DO child nodes of the LnodeType data type template are the same in both the ICD file and the SCD file.
7. The method for merging ICD and SCD data type templates according to claim 3 or 5, characterized in that, The consistency of DOType data type template content means that the cdc attribute, DA child node, and SDO child node of the DOType data type template are the same in both the ICD file and the SCD file.
8. The method for merging ICD and SCD data type templates according to claim 3, characterized in that, The id of the LNodeType data type template referenced in the ICD file refers to the id of the LNodeType data type template used in the lnType attribute of LN0 and LN nodes.
9. An SCD configuration tool, characterized in that, The SCD configuration tool completes the merging of ICD and SCD data type templates using the steps of the method described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Intelligent substation SCD file automatic configuration method and device
CN112949228A
