Transformer substation configuration description file comparison method and system, medium, equipment and product
Through structural comparison method and verification code comparison, the problem of low efficiency in SCD file comparison is solved, and more accurate and efficient difference analysis and report generation is achieved.
Patent Information
- Application Number
- CN202510428448.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-04-08
AI Technical Summary
The existing SCD file comparison methods are inefficient and cannot effectively deal with the differences caused by frequent changes in SCD files, resulting in an increase in repeated work by debuggers.
The structural comparison method is adopted to traverse the nodes of the SCD file in depth, compare them through the unique attribute identification and verification code of the node, and store the difference points using the data structure to improve the accuracy of positioning and comparison.
It improves the accuracy and efficiency of SCD file comparison, reduces the time for artificial classification summary, and simplifies the generation and analysis of differential reports.
Smart Images

Figure CN119940337A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of substation automation, and in particular relates to a method for generating a node difference report based on substation SCD file comparison. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Substation Configuration Description (SCD) file plays a critical role in the commissioning and operation of a substation.
[0004] The invention found that, during the debugging and operation maintenance of SCD files, due to the frequent changes of SCD files, the differences between various versions cause the debugging personnel to repeat the debugging work. There are two existing solutions to this problem: 1. When comparing different versions of SCD files, the contents of different files are stored in their respective arrays, and the characters are compared line by line to mark the differences. This method does not focus on the specific content of the SCD file, but only marks the differences. When there are many devices in the substation, it will take a lot of time and the comparison efficiency is low; 2. Pre-set the data model and communication service model, compare different versions of SCD files according to the set data model and the data attributes of the nodes, and compare all nodes that perform information interaction in different versions according to the set communication service model. Although this method takes into account the specific content of the SCD file, it still requires the construction of data models and communication service models. When there are many devices in the substation, it is obvious that building data models and communication service models requires a lot of work. Summary of the invention
[0005] In order to solve at least one technical problem existing in the above-mentioned background technology, the present invention provides a substation configuration description file comparison method, system, medium, equipment and product, which proposes a method for structural comparison of SCD files, focuses on the specific content of the SCD file, deeply traverses each node, and compares purposefully. For nodes without unique identification attributes, the method of calculating and comparing check codes is used, and the difference points are stored through the data structure, thereby improving the accuracy of positioning and comparison.
[0006] In order to achieve the above object, the present invention adopts the following technical solution: A first aspect of the present invention provides a substation configuration description file comparison method, comprising the following steps: Read the contents of each subnode in the two SCD files to be compared; Compare the contents of each subnode in the two SCD files to be compared, and store the comparison results in a data structure; wherein the comparison process of the contents of each subnode in the two SCD files to be compared includes: The first SCD file is used as a reference file, and the specified nodes of the first SCD file are traversed. According to the unique attribute identifier of the node and the check code calculated based on the node content, the corresponding node and the node data with differences are searched in the second SCD file, and the node data with differences are stored as a change item in the data structure. The second SCD file is used as a reference file, the designated nodes of the second SCD file are traversed, the corresponding nodes are searched in the first SCD file, and the node data that are not searched are stored as new items in the data structure.
[0007] Furthermore, searching the second SCD file for a corresponding node and different node data based on the unique attribute identifier of the node and the check code calculated based on the node content includes: Determine whether the comparison node has a unique identification attribute; If there is, search for the node corresponding to the node to be compared in the second SCD file according to the unique identification attribute value of the node to be compared. If it exists, compare the attribute values of the node corresponding to the node to be compared. If there is a difference in the attribute value, store it in the change item of the data structure; If not, first delete all attributes of the node to be compared, and calculate the check code C1 of the node to be compared, then traverse the corresponding nodes in the second SCD file, calculate the check code C2, compare C1 and C2, and determine whether C1 and C2 are equal. If they are equal, they are the same node. Further compare the attribute values of the nodes. If there are differences in the attribute values of the nodes, store them in the change items of the data structure.
[0008] Furthermore, the calculation method of the check code C1 and the check code C2 is: calculated according to the content sequence of the extracted CRS check code, and the calculation rules include: First, delete spaces, line breaks, carriage returns, and list characters between elements and attributes; Second, arrange all extracted element attributes in alphabetical order az; Third, elements without child elements and assigned values end with " / >"; Fourth, convert the sequence to a UTF-8 sequence and calculate the four-byte CRC-32 checksum. If the sequence is less than four bytes, fill the high byte with 0x0.
[0009] Furthermore, if there is no node corresponding to the node to be compared in the second SCD file, it means that the corresponding node in the second SCD file has been deleted, and a deletion item is stored in the data structure.
[0010] Furthermore, if the check codes C1 and C2 are not equal, there is no node identical to the check code C1 in the second SCD file, indicating that the node identical to the check code C1 in the second SCD file has been deleted and stored in the deleted item of the data structure.
[0011] Furthermore, after the data structure is obtained, a difference report is generated based on the comparison results stored in the data structure.
[0012] A second aspect of the present invention provides a substation configuration description file comparison system, comprising: A data reading module, which is used to read the content of each sub-node in the two SCD files to be compared; The file comparison module is used to compare the contents of each sub-node in the two SCD files to be compared, and store the comparison results in a data structure; wherein the comparison process of the contents of each sub-node in the two SCD files to be compared includes: The first SCD file is used as a reference file, and the specified nodes of the first SCD file are traversed. According to the unique attribute identifier of the node and the check code calculated based on the node content, the corresponding node and the node data with differences are searched in the second SCD file, and the node data with differences are stored as a change item in the data structure. The second SCD file is used as a reference file, the designated nodes of the second SCD file are traversed, the corresponding nodes are searched in the first SCD file, and the node data that are not searched are stored as new items in the data structure.
[0013] A third aspect of the present invention provides a computer-readable storage medium.
[0014] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the substation configuration description file comparison method as described above.
[0015] A fourth aspect of the present invention provides a computer device.
[0016] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the substation configuration description file comparison method as described above when executing the program.
[0017] A fifth aspect of the present invention provides a program product.
[0018] The program product is a computer program product, comprising a computer program, and when the computer program is executed by a processor, the steps in the substation configuration description file comparison method as described above are implemented.
[0019] Compared with the prior art, the present invention has the following beneficial effects: 1. When comparing existing SCD files of different versions, the specific content of the SCD file is not taken into consideration. The present invention pays attention to the specific content of the SCD file, deeply traverses each node, compares the contents of each sub-node respectively, processes nodes with unique identification attributes and nodes without unique identification attributes in their own way, thereby improving the accuracy of positioning and comparison.
[0020] 2. After the current SCD files are compared, different data are marked in a labeling manner, and then manually classified and summarized, which has a low efficiency. The present invention uses a data structure to store nodes with differences in the deletion item, and stores deleted nodes in the deletion item. On this basis, further processing is performed, and the comparison results can be directly called to generate a report display, and guiding prompts are given to facilitate analysis and processing.
[0021] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0023] Figure 1 It is an overall flow chart of the substation configuration description file comparison method provided by an embodiment of the present invention; Figure 2 It is a detailed comparison flow chart of the substation configuration description file comparison method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0025] It should be noted that the following detailed descriptions are all illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0026] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0027] In view of the technical problems existing in the comparison of SCD files of different versions mentioned in the background technology of this application, the present invention provides a method for structural comparison of SCD files, which mainly includes the following improvements: 1. When comparing existing SCD files of different versions, the specific content of the SCD file is not taken into consideration. The present invention pays attention to the specific content of the SCD file, deeply traverses each node, compares the contents of each sub-node respectively, processes nodes with unique identification attributes and nodes without unique identification attributes in their own way, thereby improving the accuracy of positioning and comparison.
[0028] 2. After the current SCD files are compared, different data are marked in a labeling manner, and then manually classified and summarized, which has a low efficiency. The present invention uses a data structure to store nodes with differences in the deletion items, and stores deleted nodes in the deletion items. On this basis, further processing is performed, and the comparison results can be displayed by directly calling the data structure.
[0029] Embodiment 1 like Figure 1 As shown, this embodiment provides a substation configuration description file comparison method, comprising the following steps: Step 1: Read the contents of each subnode in the two SCD files to be compared; In this embodiment, the content of each sub-node in the two SCD files to be compared includes: Substation, Communication, IED, DataTypeTemplates node and all sub-nodes under it.
[0030] Step 2: Compare the contents of each subnode in the two SCD files to be compared, obtain the difference data, and store the difference data in a data structure to generate a difference report; like Figure 2 As shown, the following takes two SCD files A and B to be compared as an example to illustrate the specific comparison method, including the following steps: Step 201: Take file A as the reference file, traverse the specified nodes of file A, and take a node a to be compared as an example, including the following steps: Step 211: Determine whether the node a to be compared has a unique identification attribute; Step 212: If yes, search for the node b corresponding to the node a to be compared in the B file according to the unique identification attribute value of the node a to be compared. If yes, compare the attribute values of the node b corresponding to the node a to be compared. If there is a difference in the attribute value, store it in the change item of the data structure. If no difference exists, it means that the corresponding node b in the B file has been deleted, and store it in the deletion item of the data structure. Step 2013: If not, first delete all attributes of the node a to be compared, and calculate the check code C1 of the node a to be compared, then traverse the corresponding nodes in the B file, use the same method to calculate the check code C2, compare C1 and C2, and determine whether C1 and C2 are equal. If they are equal, they are the same node. Further compare the attribute values of the nodes. If there are differences in the attribute values of the nodes, store them in the change item of the data structure. Otherwise, there is no node with the same check code C1 in the B file, indicating that the node with the same check code C1 in the B file has been deleted and stored in the deletion item of the data structure. In this embodiment, the calculation method of the check code C1 and the check code C2 of the node a to be compared is: extracting the content sequence used to calculate the CRC check code, and the calculation rules include: (1) Delete spaces, line breaks, carriage returns, and list characters between elements and attributes; (2) Arrange all extracted element attributes in alphabetical order az; (3) Elements without child elements or assigned values end with " / >"; (4) Convert the sequence to a UTF-8 sequence and calculate the four-byte CRC-32 checksum. If the number is less than four bytes, the high byte is filled with 0x0. CRC calculation parameters: bit number Width = 32; generated item Poly = 04C11DB7; initialization value Init = FFFFFFFF; whether the data to be tested is reversed RefIn = True; whether the calculated value is reversed RefOut = True; output data XOR item XorOut = FFFFFFFF.
[0031] Step 2014: Repeat steps 2011 to 2013 until all the specified nodes of file A are compared.
[0032] Step 202: Use file B as the reference file, traverse the specified node, and search for the corresponding node in file A. If the node does not exist, it means that the node does not exist in file A and is a newly added node. Store it as a newly added item in the data structure.
[0033] It should be noted that, in this embodiment, the check code may be a CRC (Cyclic Redundancy Check) check code, a parity check, MD5, SHA1, etc., which is not specifically limited in this embodiment and can be selected according to actual conditions; In this embodiment, the data structure can adopt a custom struct structure type, as shown below: typedef struct _DiffInf / / Difference information { QString oldVersion; / / Original version number QString oldRevision; / / Original revision number QString newVersion; / / New version number QString newRevision; / / New revision number QList<s_IEDRename> changedIEDs; / / Change type: secondary equipment QList <s_SNet changedStationInfos; / / Change category: station control layer network parameters QMap <QString, QList<s_GOOSEAttr> >changedGOOSEInfos; / / Change category: process layer GOOSE parameters QMap <QString, QList<s_SMVAttr> >changedSMVInfos; / / Change category: process layer SMV parameters QStringList deletedIEDs; / / Delete class; secondary equipment QMap <QString, QList<s_GOOSEAttr> >deletedGOOSEInfos; / / deleted class: process layer GOOSE parameters QMap <QString, QList<s_SMVAttr> >deletedSMVInfos; / / Delete class: process layer SMV parameters QStringList addedIEDs; / / New class: secondary equipment QMap <QString, QList<s_GOOSEAttr> >addedGOOSEInfos; / / New class: process layer GOOSE parameters QMap <QString, QList<s_SMVAttr> >addedSMVInfos; / / New class: process layer SMV parameters }s_DiffInf; Step 3: Destroy the two SCD file objects to be compared and release the memory space; In this embodiment, the two SCD file objects to be compared are destroyed and the memory space is released. The objects may be explicitly deleted or set to None, which may be determined according to the specific application scenario and programming language environment.
[0034] Step 4: Generate a difference report based on the data structure to display information and provide guiding prompts to facilitate analysis and processing.
[0035] In this embodiment, the results are displayed in a table format, which is concise and intuitive; the report is in XML format and can be displayed across machines and platforms. Table 1 shows the comparison results of two SCD files.
[0036] Table 1 Comparison results of two SCD files
[0037] Table 1 shows the difference in the comparison results.
[0038] Embodiment 2 This embodiment provides a substation configuration description file comparison system, including: A data reading module, which is used to read the content of each sub-node in the two SCD files to be compared; The file comparison module is used to compare the contents of each sub-node in the two SCD files to be compared, and store the comparison results in a data structure; wherein the comparison process of the contents of each sub-node in the two SCD files to be compared includes: The first SCD file is used as a reference file, and the specified nodes of the first SCD file are traversed. According to the unique attribute identifier of the node and the check code calculated based on the node content, the corresponding node and the node data with differences are searched in the second SCD file, and the node data with differences are stored as a change item in the data structure. The second SCD file is used as a reference file, the designated nodes of the second SCD file are traversed, the corresponding nodes are searched in the first SCD file, and the node data that are not searched are stored as new items in the data structure.
[0039] Among them, in the file comparison module, the checking code calculated based on the unique attribute identifier of the node and the content of the node is used to search for the corresponding node and the different node data in the second SCD file, including: Determine whether the comparison node has a unique identification attribute; If there is, search for the node corresponding to the node to be compared in the second SCD file according to the unique identification attribute value of the node to be compared. If it exists, compare the attribute values of the node corresponding to the node to be compared. If there is a difference in the attribute value, store it in the change item of the data structure; If not, first delete all attributes of the node to be compared, and calculate the check code C1 of the node to be compared, then traverse the corresponding nodes in file B, calculate the check code C2, compare C1 and C2, and determine whether C1 and C2 are equal. If they are equal, they are the same node. Further compare the attribute values of the nodes. If there are differences in the attribute values of the nodes, store them in the change items of the data structure.
[0040] The calculation method of the check code C1 and the check code C2 is: calculated according to the content sequence of the extracted CRS check code, and the calculation rules include: (1) Delete spaces, line breaks, carriage returns, and list characters between elements and attributes; (2) Arrange all extracted element attributes in alphabetical order az; (3) Elements without child elements or assigned values end with " / >"; (4) The sequence is converted to a UTF-8 sequence and a four-byte CRC-32 checksum is calculated. If the sequence is less than four bytes, the high byte is padded with 0x0.
[0041] Embodiment 3 This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the substation configuration description file comparison method as described above are implemented.
[0042] Embodiment 4 This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the substation configuration description file comparison method described above are implemented.
[0043] Embodiment 5 This embodiment provides a program product, which is a computer program product, including a computer program. When the computer program is executed by a processor, the steps in the substation configuration description file comparison method as described above are implemented.
[0044] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0045] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0046] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0047] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0048] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0049] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for comparing substation configuration description files, characterized in that: include: Read the contents of each subnode in the two SCD files to be compared; Compare the contents of each subnode in the two SCD files to be compared, and store the comparison results in a data structure; wherein the comparison process of the contents of each subnode in the two SCD files to be compared includes: The first SCD file is used as a reference file, and the specified nodes of the first SCD file are traversed. According to the unique attribute identifier of the node and the check code calculated based on the node content, the corresponding node and the node data with differences are searched in the second SCD file, and the node data with differences are stored as a change item in the data structure. The second SCD file is used as a reference file, the designated nodes of the second SCD file are traversed, the corresponding nodes are searched in the first SCD file, and the node data that are not searched are stored as new items in the data structure.
2. The substation configuration description file comparison method according to claim 1, characterized in that: The step of searching for a corresponding node and different node data in the second SCD file according to the unique attribute identifier of the node and the check code calculated based on the node content includes: Determine whether the comparison node has a unique identification attribute; If there is, search for the node corresponding to the node to be compared in the second SCD file according to the unique identification attribute value of the node to be compared. If it exists, compare the attribute values of the node corresponding to the node to be compared. If there is a difference in the attribute value, store it in the change item of the data structure; If not, first delete all attributes of the node to be compared, and calculate the check code C1 of the node to be compared, then traverse the corresponding nodes in the second SCD file, calculate the check code C2, compare C1 and C2, and determine whether C1 and C2 are equal. If they are equal, they are the same node. Further compare the attribute values of the nodes. If there are differences in the attribute values of the nodes, store them in the change items of the data structure.
3. The substation configuration description file comparison method according to claim 2, characterized in that: The calculation method of the check code C1 and the check code C2 is: calculated according to the content sequence of the extracted CRS check code, and the calculation rules include: First, delete spaces, line breaks, carriage returns, and list characters between elements and attributes; Second, arrange all extracted element attributes in alphabetical order az; Third, elements without child elements and assigned values end with " / >"; Fourth, convert the sequence to a UTF-8 sequence and calculate the four-byte CRC-32 checksum. If the sequence is less than four bytes, fill the high byte with 0x0.
4. The substation configuration description file comparison method according to claim 2, characterized in that: If there is no node corresponding to the node to be compared in the second SCD file, it means that the corresponding node in the second SCD file has been deleted, and a deletion item is stored in the data structure.
5. The substation configuration description file comparison method according to claim 2, characterized in that: If the check codes C1 and C2 are not equal, there is no node identical to the check code C1 in the second SCD file, indicating that the node identical to the check code C1 in the second SCD file has been deleted and stored in the deleted item of the data structure.
6. The substation configuration description file comparison method according to claim 1, characterized in that: After the data structure is obtained, a difference report is generated based on the comparison results stored in the data structure.
7. A substation configuration description file comparison system, characterized in that: include: A data reading module, which is used to read the content of each sub-node in the two SCD files to be compared; The file comparison module is used to compare the contents of each sub-node in the two SCD files to be compared, and store the comparison results in a data structure; wherein the comparison process of the contents of each sub-node in the two SCD files to be compared includes: The first SCD file is used as a reference file, and the specified nodes of the first SCD file are traversed. According to the unique attribute identifier of the node and the check code calculated based on the node content, the corresponding node and the node data with differences are searched in the second SCD file, and the node data with differences are stored as a change item in the data structure. The second SCD file is used as a reference file, the designated nodes of the second SCD file are traversed, the corresponding nodes are searched in the first SCD file, and the node data that are not searched are stored as new items in the data structure.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the substation configuration description file comparison method as described in any one of claims 1 to 6 are implemented.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the substation configuration description file comparison method according to any one of claims 1 to 6 are implemented.
10. A program product, the program product being a computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps in the substation configuration description file comparison method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Graphical comparing method for SCD (substation configuration description) files of intelligent substation
CN104636490A
File comparison method and device
CN115796146A
Differential information determination method and device, electronic equipment and storage medium
CN118193353A
Intelligent substation model consistency verification system and method
CN119003271A
Big data-based transformer substation file difference visual positioning method and system
CN119026590A