CN112230929A - Data analysis method and device of CIM (common information model) and storage medium - Google Patents

Data analysis method and device of CIM (common information model) and storage medium Download PDF

Info

Publication number
CN112230929A
CN112230929A CN202011094885.8A CN202011094885A CN112230929A CN 112230929 A CN112230929 A CN 112230929A CN 202011094885 A CN202011094885 A CN 202011094885A CN 112230929 A CN112230929 A CN 112230929A
Authority
CN
China
Prior art keywords
cim
class
hash table
module
line
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011094885.8A
Other languages
Chinese (zh)
Other versions
CN112230929B (en
Inventor
翁毅选
徐原
马伟哲
赵利刚
史军
周挺辉
齐晖
甄鸿越
程维杰
黄冠标
陈择栖
洪潮
杨帆
翟鹤峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Power Supply Bureau Co Ltd
Research Institute of Southern Power Grid Co Ltd
Original Assignee
Shenzhen Power Supply Bureau Co Ltd
Research Institute of Southern Power Grid Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Power Supply Bureau Co Ltd, Research Institute of Southern Power Grid Co Ltd filed Critical Shenzhen Power Supply Bureau Co Ltd
Priority to CN202011094885.8A priority Critical patent/CN112230929B/en
Publication of CN112230929A publication Critical patent/CN112230929A/en
Application granted granted Critical
Publication of CN112230929B publication Critical patent/CN112230929B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9014Indexing; Data structures therefor; Storage structures hash tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data analysis method, a device and a storage medium of a CIM (common information model), comprising the following steps: constructing a data element class which comprises preset data attributes and methods; reading data information line by line, and performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model); constructing a first hash table, and storing a new class constructed by the data element class in the first hash table by taking the character string as a key; constructing a second hash table, and storing the example hash table into the second hash table by taking the character string as a key; the instance hash table stores the instance object generated by the CIM correspondingly by taking the unique code string ID corresponding to the CIM as a key; traversing the vector list, traversing the records in the CIM module from line to line for any CIM module in the vector list, generating and storing the class or object corresponding to the CIM module. The method can track the expansion and adjustment of the CIM model while adapting to the specific requirements of the power system model.

Description

Data analysis method and device of CIM (common information model) and storage medium
Technical Field
The invention relates to the technical field of power grid design, in particular to a data analysis method and device of a CIM (common information model) and a storage medium.
Background
In the design and operation of a highly interconnected modern digital power grid, when the dispatching and operation main bodies of each level of the power grid face the same power system topological model, unified cooperation and close cooperation are needed. The International Electrotechnical Commission (IEC) proposed a Common Information Model (CIM) for power grid Model description in the International universal standard IEC61970, which provides guiding principles for power grid equipment and topology modeling. The principle is also applicable to national standards of power grid general model description specifications in China.
The CIM model is widely applied to an Operation Control and scheduling System (OCS) of the power System, and the System can detect and Control the real-time Operation state of the power System more accurately by remotely monitoring and measuring various devices in the power System. By analyzing and converting the CIM model data, the real-time and accurate running state data of the power system is obtained, and the efficiency and the accuracy of the real-time running state analysis of the power system are improved.
In the prior art, a method for analyzing and converting CIM model data includes: and (3) developing a common information model-based system by using an Eclipse modeling framework, and directly modeling the CIM.
The inventor finds that the following technical problems exist in the prior art in the process of implementing the invention: the general framework method can be adapted to the analysis of various types of XML files, and can better track the possible expansion and adjustment of the CIM model in the future, however, the general framework can only realize the analysis of data, cannot better realize the custom expansion and packaging of each part method of the class, and is difficult to adapt to the specific requirements of the power system model; the direct modeling method has high self-defining degree, can better pack classes and required methods, but cannot better track CIM model extension and adjustment, and needs a large amount of class-by-class coding to complete data analysis.
Disclosure of Invention
The embodiment of the invention provides a data analysis method of a CIM (common information model), which can track the expansion and adjustment of the CIM while adapting to the specific requirements of a power system model.
The embodiment of the invention provides a data analysis method of a CIM (common information model), which comprises the following steps:
constructing a data element class which comprises preset data attributes and methods;
reading data information line by line from an XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model), and storing the CIM into a vector list;
constructing a first hash table, storing a new class constructed by the data element class in the first hash table by taking a character string as a key, wherein the first hash table is empty in an initial state;
constructing a second hash table, and storing the example hash table into the second hash table by taking the character string as a key;
the instance hash table stores the instance object generated by the CIM correspondingly by taking the unique code string ID corresponding to the CIM as a key;
and traversing the record in any CIM module in the vector list line by line, and generating and storing the class or the object corresponding to the CIM module.
As an improvement of the above scheme, the reading data information line by line from the XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM module, and storing the CIM module in a vector list specifically includes:
reading the data information line by line from XML file, and using regular expression p according to XML grammar specification0="<cim.*rdf:ID.*>", and p1="</cim.*>"carry on the regular matching to the data information read line by line in pairs;
is and p0Behavior r of a match hitiAnd p is1Behavior r of a match hitj(ii) a Then r isiGo to rjContent constitutes a complete CIM module MkAnd storing the module into a vector list M;
wherein M ═ M1,M2,…,Mk,…,Mn],Mk=[ri,ri+1,…,rj-1,rj]。
As an improvement of the above scheme, the constructing a first hash table, storing a new class constructed by the data element class in the first hash table with a character string as a key, and the first hash table being empty in an initial state specifically includes:
constructing the first hash table Cls _ map, storing a new class some _ class constructed by the data element class in the first hash table Cls _ map by taking a character string Cls _ name as a key, wherein the Cls _ map is empty in an initial state
Wherein Cls _ map < string _ name, class name _ class >.
As an improvement of the above scheme, the constructing a second hash table, and storing the instance hash table into the second hash table with the character string as a key specifically includes:
constructing the second hash table Obj _ map, and storing an instance hash table ID _ map into the second hash table Obj _ map by taking the character string cls _ name as a key; the second hash table Obj _ map and the CIM module MkThe CIM module M is keyed by the corresponding unique code string IDkStoring the generated example object some _ object;
wherein Obj _ map < stringcls _ name, ID _ map < stringID, Cls _ map [ Cls _ name ] name _ object > >.
As an improvement of the above scheme, the constructing a data element class, where the data element class includes preset data attributes and methods, specifically includes: constructing a data element class mcs, wherein the following attributes and methods are preset in the data element class mcs:
attribute 1: cls _ name, recording the name of the current generation class;
the method comprises the following steps: instance _ init, which supports the generated class to generate a new instance;
the method 2 comprises the following steps: get _ attr, supporting the generated instance of the generated class to obtain the attribute of the instance;
the method 3 comprises the following steps: attr _ setter, which supports the generated instance of the generated class to assign the attribute of the instance;
the method 4 comprises the following steps: attr _ init, supporting the generated instance of the generated class to initialize a new attribute for the instance;
the method 5 comprises the following steps: has _ attr, supporting the generated instance of the generated class to search whether the instance contains a certain attribute;
the method 6 comprises the following steps: is _ single _ bus _ device, which supports the generated instance of the generated class to judge whether the instance is a single port element;
the method 7 comprises the following steps: the affileite _ substation _ function _ assign supports the generated example of the generated class to return the substation information to which the example belongs;
the method 8 comprises the following steps: the notification _ voltage _ function _ assign supports the generated example of the generated class to return the voltage grade and the reference voltage information corresponding to the example;
the method 9: get _ zone _ func, supporting the generated example of the generated class to return the area information of the example;
the method 10 comprises the following steps: get _ area _ func, and returning the partition information of the instance generated by supporting the generated class.
As an improvement of the above scheme, traversing the vector list, for any CIM module in the vector list, traversing records in the CIM module line by line, generating and storing a class or an object corresponding to the CIM module, specifically including:
r traversing to the vector listiWhen the method is used, the following steps are executed:
rule and p described according to CIM model0And riOf matching relation of from riStarting from the 5 th character and ending from the space character, extracting the CIM module MkA category field specified in XML, denoted as module _ type; from riThe sub-string "rdf, ID ═ begins with the 1 st character, to riEnding the line last 3 rd character (containing line feed character "\ n"), extracting module MkAn identification ID specified in XML, which is recorded as module _ ID;
if the module _ type does not exist in the key of the first hash table Cls _ map, calling the data element class mcs to construct a class Cls corresponding to the module _ type, making the cls.cls _ name be the module _ type, taking the cls.cls _ name as the key, and storing the key value pair < cls.cls _ name, Cls > into the first hash table Cls _ map;
if the module _ type already exists in the key of the first hash table Cls _ map, it indicates that the current module M is presentkThe class cls to which it belongs has been established by the meta class mcs;
call class Cls _ map [ module _ type ]]The initialization function instance _ init (i.e. method 1) of (c) will be the CIM module MkInstantiated as Objk
Traverse ri+1To rj-1When the method is used, the following steps are executed:
according to the syntactic rules of XML, according to the module MkThe description content of each line in the (C) to the current instance calls the class Cls _ map [ module _ type ]]Example operation methods 2 to 5, constructed by mcs, for example ObjkInitializing and assigning the attributes of the system;
go through to rjWhen the method is used, the following steps are executed:
pair of key values<module_id,Objk>And storing the data into the instance hash table ID _ map, and updating the second hash table Obj _ map.
The embodiment of the invention correspondingly provides a data analysis device of a CIM (common information model), which comprises the following steps:
the meta-class construction unit is used for constructing a data meta-class, and the data meta-class comprises preset data attributes and methods;
the data acquisition unit is used for reading data information line by line from the XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model) module, and storing the CIM module into a vector list;
the first hash table construction unit is used for constructing a first hash table, storing a new class constructed by the data element class in the first hash table by taking a character string as a key, and enabling the first hash table to be empty in an initial state;
the second hash table construction unit is used for constructing a second hash table and storing the example hash table into the second hash table by taking the character string as a key;
the first analysis unit is used for storing the instance object generated by the CIM correspondingly by taking the unique code string ID corresponding to the CIM as a key in the instance hash table;
and the second analysis unit is used for traversing the records in any CIM module in the vector list line by line, and generating and storing the class or the object corresponding to the CIM module.
Correspondingly, a third embodiment of the present invention provides a data analysis device for a CIM model, including: the data analysis method comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the data analysis method of the CIM model according to the first embodiment of the invention when executing the computer program.
Correspondingly, the fourth embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the data analysis method of the CIM model according to the first embodiment of the present invention.
The data analysis method of the CIM provided by the embodiment of the invention has the following beneficial effects:
a method based on Python meta-class carries out compromise between custom development and CIM model analysis; only the elementary classes mcs and the method thereof need to be encoded and created in advance, and all types in the CIM/XML are dynamically created by the elementary classes, so that the CIM model can be tracked better when being expanded and adjusted; by adding a new preset method in the step S101 through pre-coding, the packaging and the self-definition of the specific method of the power system model can be realized, and the application range of CIM model analysis is expanded; the expansion and adjustment of the CIM model can be tracked while the specific requirements of the power system model are adapted.
Drawings
Fig. 1 is a schematic flowchart of a data analysis method of a CIM model according to an embodiment of the present invention.
Fig. 2 is a schematic structural diagram of a data analysis apparatus of a CIM model according to a second embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a schematic flow chart of a data analysis method of a CIM model according to an embodiment of the present invention is shown, including:
s101, constructing a data element class, wherein the data element class comprises preset data attributes and methods;
further, the constructing a data element class, where the data element class includes preset data attributes and methods, specifically includes: constructing a data element class mcs, wherein the following attributes and methods are preset in the data element class mcs:
attribute 1: cls _ name, recording the name of the current generation class;
the method comprises the following steps: instance _ init, which supports the generated class to generate a new instance;
the method 2 comprises the following steps: get _ attr, supporting the generated instance of the generated class to obtain the attribute of the instance;
the method 3 comprises the following steps: attr _ setter, which supports the generated instance of the generated class to assign the attribute of the instance;
the method 4 comprises the following steps: attr _ init, supporting the generated instance of the generated class to initialize a new attribute for the instance;
the method 5 comprises the following steps: has _ attr, supporting the generated instance of the generated class to search whether the instance contains a certain attribute;
the method 6 comprises the following steps: is _ single _ bus _ device, which supports the generated instance of the generated class to judge whether the instance is a single port element;
the method 7 comprises the following steps: the affileite _ substation _ function _ assign supports the generated example of the generated class to return the substation information to which the example belongs;
the method 8 comprises the following steps: the notification _ voltage _ function _ assign supports the generated example of the generated class to return the voltage grade and the reference voltage information corresponding to the example;
the method 9: get _ zone _ func, supporting the generated example of the generated class to return the area information of the example;
the method 10 comprises the following steps: get _ area _ func, and returning the partition information of the instance generated by supporting the generated class.
Specifically, the implementation of the power system customization method can be accomplished by methods 6-10.
S102, reading data information line by line from an XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model), and storing the CIM into a vector list;
further, the reading data information line by line from the XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM module, and storing the CIM module in a vector list specifically includes:
reading the data information line by line from XML file, and using regular expression p according to XML grammar specification0="<cim.*rdf:ID.*>", and p1="</cim.*>"carry on the regular matching to the data information read line by line in pairs;
is and p0Behavior r of a match hitiAnd p is1Behavior r of a match hitj(ii) a Then r isiGo to rjContent constitutes a complete CIM module MkAnd storing the module into a vector list M;
wherein M ═ M1,M2,…,Mk,…,Mn],Mk=[ri,ri+1,…,rj-1,rj]。
S103, constructing a first hash table, storing a new class constructed by the data element class in the first hash table by taking a character string as a key, wherein the first hash table is empty in an initial state;
further, the constructing a first hash table, storing a new class constructed by the data element class in the first hash table with a character string as a key, where the first hash table is empty in an initial state specifically includes:
constructing the first hash table Cls _ map, storing a new class some _ class constructed by the data element class in the first hash table Cls _ map by taking a character string Cls _ name as a key, wherein the Cls _ map is empty in an initial state
Wherein Cls _ map < string _ name, class name _ class >.
S104, constructing a second hash table, and storing the example hash table into the second hash table by taking the character string as a key;
further, the constructing a second hash table, and storing the instance hash table into the second hash table with the character string as a key specifically includes:
constructing the second hash table Obj _ map, and storing an instance hash table ID _ map into the second hash table Obj _ map by taking the character string cls _ name as a key; the second hash table Obj _ map and the CIM module MkThe CIM module M is keyed by the corresponding unique code string IDkStoring the generated example object some _ object;
wherein Obj _ map < stringcls _ name, ID _ map < stringID, Cls _ map [ Cls _ name ] name _ object > >.
S105, storing the instance object generated correspondingly by the CIM by taking the unique code string ID corresponding to the CIM as a key in the instance hash table;
s106, traversing the records in any CIM module in the vector list line by line, generating and storing the class or object corresponding to the CIM module
Further, traversing the record in any CIM module in the vector list line by line, and generating and storing the class or object corresponding to the CIM module, specifically including:
go through to the riWhen the method is used, the following steps are executed:
rule and p described according to CIM model0And riOf matching relation of from riFrom the 5 th character to the end of the space character, the obtained character is extractedThe CIM module MkA category field specified in XML, denoted as module _ type; from riThe sub-string "rdf, ID ═ begins with the 1 st character, to riThe last 3 characters of the line are finished, and a module M is extractedkAn identification ID specified in XML, which is recorded as module _ ID;
if the module _ type does not exist in the key of the first hash table Cls _ map, calling the data element class mcs to construct a class Cls corresponding to the module _ type, making the cls.cls _ name be the module _ type, taking the cls.cls _ name as the key, and storing the key value pair < cls.cls _ name, Cls > into the first hash table Cls _ map;
if the module _ type already exists in the key of the first hash table Cls _ map, it indicates that the current module M is presentkThe class cls to which it belongs has been established by the meta class mcs;
call class Cls _ map [ module _ type ]]The initialization function instance _ init of (c) will be the CIM module MkInstantiated as Objk
Go through to the ri+1To rj-1When the method is used, the following steps are executed:
according to the syntactic rules of XML, according to the module MkThe description content of each line in the (C) to the current instance calls the class Cls _ map [ module _ type ]]Example operation methods 2 to 5, constructed by mcs, for example ObjkInitializing and assigning the attributes of the system;
go through to the rjWhen the method is used, the following steps are executed:
pair of key values<module_id,Objk>And storing the data into the instance hash table ID _ map, and updating the second hash table Obj _ map.
In a specific embodiment, the specific practical form of CIM has two CIM/XML formats and CIM/E format, and the two formats can be converted with each other. XML is short for eXtensible Markup Language (eXtensible Markup Language), a common format for transmitting and storing data in the field of information technology, and CIM/XML follows the syntax format of common XML; the CIM/E format is a model exchange format that is specifically tailored to the power system. The CIM describes resources and properties of each part of the power system by using a Resource Description Framework (RDF) schema. Any device in the power system, such as a transformer, a circuit breaker, a line, etc., or topology information, such as a reference voltage, a control area, etc., has a unique identification code RDF ID in the RDF schema as a basis for the device/topology parameter correlation.
The implementation mode of the RDF schema in CIM/XML and the description method of the power grid model are briefly introduced by adopting 14 lines of XML codes of a transformer and a high-voltage end winding thereof described by the RDF schema.
Figure BDA0002723141280000101
The description of the transformer starts on line 1 and ends on line 4:
line 1 describes the unique identification of the transformer in the RDF schema, i.e., RDF: ID 12345;
line 2 describes the name of the transformer;
line 3 describes that the transformer contains an instance attribute equal equipment container, and the unique identifier of the instance in the RDF schema is 453127;
line 4 serves as the end of the transformer module description flag line.
The description of the high-voltage end winding of the transformer starts from line 5 to line 14, and the description structure is similar to the foregoing structure:
line 5 describes the unique identification of the winding in the RDF schema, RDF: ID 123447;
lines 6 to 10 describe various physical electrical properties and parameters of the winding including 5 items of name, resistance, reactance, rated voltage, rated capacity.
Line 11 describes that the winding contains an instance attribute MemberOf _ PowerTransformer, the unique identification code of the instance in RDF schema is RDF: ID: 12345, i.e. corresponding to the transformer model in lines 1 to 4. The row means that the transformer winding described by the identification code rdf ID 123447 is subordinate to the transformer with rdf ID 12345;
the description information of lines 12 to 14 is similar to the previous description.
The code segment is written in an XML syntax format, any instance or attribute begins with < xxx > "and ends with < xxx/>, and the action scope of the instance or attribute is limited. Through identification and connection of the RDF schema, modeling of a huge power system topology can be achieved in the CIM.
In the method without using the meta-class, class codes of a plurality of specific classes are required to be written first, and then ten thousand objects are constructed in a corresponding classification mode according to the specific object description of CIM/XML; in the method using the element class, only 1 element class code needs to be written, and then a corresponding class is correspondingly constructed firstly according to the specific object description of CIM/XML, and then an instance object of the class is constructed; meanwhile, in the class construction process, the meta-class can dynamically intercept, modify and record various classes.
The data analysis method, the device and the storage medium of the CIM provided by the embodiment of the invention have the following beneficial effects:
a method based on Python meta-class carries out compromise between custom development and CIM model analysis; only the elementary classes mcs and the method thereof need to be encoded and created in advance, and all types in the CIM/XML are dynamically created by the elementary classes, so that the CIM model can be tracked better when being expanded and adjusted; by adding a new preset method in the step S101 through pre-coding, the packaging and the self-definition of the specific method of the power system model can be realized, and the application range of CIM model analysis is expanded; the expansion and adjustment of the CIM model can be tracked while the specific requirements of the power system model are adapted.
Referring to fig. 2, an embodiment of the present invention correspondingly provides a data analysis device for a CIM model, which is characterized by including:
a meta-class constructing unit 201, configured to construct a data meta-class, where the data meta-class includes preset data attributes and methods;
the data acquisition unit 202 is used for reading data information line by line from an XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model) module, and storing the CIM module into a vector list;
a first hash table constructing unit 203, configured to construct a first hash table, store a new class constructed by the data element class in the first hash table by using a character string as a key, where the first hash table is empty in an initial state;
a second hash table constructing unit 204, configured to construct a second hash table, and store the instance hash table into the second hash table by using the character string as a key;
a first parsing unit 205, configured to store, by using the unique encoded string ID corresponding to the CIM module as a key, the instance object generated by the CIM module in the instance hash table;
a second parsing unit 206, configured to traverse records in any of the CIM modules in the vector list line by line, and generate and store a class or an object corresponding to the CIM module.
Further, the reading data information line by line from the XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM module, and storing the CIM module in a vector list specifically includes:
reading the data information line by line from XML file, and using regular expression p according to XML grammar specification0="<cim.*rdf:ID.*>", and p1="</cim.*>"carry on the regular matching to the data information read line by line in pairs;
is and p0Behavior r of a match hitiAnd p is1Behavior r of a match hitj(ii) a Then r isiGo to rjContent constitutes a complete CIM module MkAnd storing the module into a vector list M;
wherein M ═ M1,M2,…,Mk,…,Mn],Mk=[ri,ri+1,…,rj-1,rj]。
Further, the constructing a first hash table, storing a new class constructed by the data element class in the first hash table with a character string as a key, where the first hash table is empty in an initial state specifically includes:
constructing the first hash table Cls _ map, storing a new class some _ class constructed by the data element class in the first hash table Cls _ map by taking a character string Cls _ name as a key, wherein the Cls _ map is empty in an initial state
Wherein Cls _ map < string _ name, class name _ class >.
Further, the constructing a second hash table, and storing the instance hash table into the second hash table with the character string as a key specifically includes:
constructing the second hash table Obj _ map, and storing an instance hash table ID _ map into the second hash table Obj _ map by taking the character string cls _ name as a key; the second hash table Obj _ map and the CIM module MkThe CIM module M is keyed by the corresponding unique code string IDkStoring the generated example object some _ object;
wherein Obj _ map < stringcls _ name, ID _ map < stringID, Cls _ map [ Cls _ name ] name _ object > >.
Further, the constructing a data element class, where the data element class includes preset data attributes and methods, specifically includes: constructing a data element class mcs, wherein the following attributes and methods are preset in the data element class mcs:
attribute 1: cls _ name, recording the name of the current generation class;
the method comprises the following steps: instance _ init, which supports the generated class to generate a new instance;
the method 2 comprises the following steps: get _ attr, supporting the generated instance of the generated class to obtain the attribute of the instance;
the method 3 comprises the following steps: attr _ setter, which supports the generated instance of the generated class to assign the attribute of the instance;
the method 4 comprises the following steps: attr _ init, supporting the generated instance of the generated class to initialize a new attribute for the instance;
the method 5 comprises the following steps: has _ attr, supporting the generated instance of the generated class to search whether the instance contains a certain attribute;
the method 6 comprises the following steps: is _ single _ bus _ device, which supports the generated instance of the generated class to judge whether the instance is a single port element;
the method 7 comprises the following steps: the affileite _ substation _ function _ assign supports the generated example of the generated class to return the substation information to which the example belongs;
the method 8 comprises the following steps: the notification _ voltage _ function _ assign supports the generated example of the generated class to return the voltage grade and the reference voltage information corresponding to the example;
the method 9: get _ zone _ func, supporting the generated example of the generated class to return the area information of the example;
the method 10 comprises the following steps: get _ area _ func, and returning the partition information of the instance generated by supporting the generated class.
Further, traversing the record in any CIM module in the vector list line by line, and generating and storing the class or object corresponding to the CIM module, specifically including:
go through the riWhen the method is used, the following steps are executed:
rule and p described according to CIM model0And riOf matching relation of from riStarting from the 5 th character and ending from the space character, extracting the CIM module MkA category field specified in XML, denoted as module _ type; from riThe sub-string "rdf, ID ═ begins with the 1 st character, to riThe last 3 characters of the line are finished, and a module M is extractedkAn identification ID specified in XML, which is recorded as module _ ID;
if the module _ type does not exist in the key of the first hash table Cls _ map, calling the data element class mcs to construct a class Cls corresponding to the module _ type, making the cls.cls _ name be the module _ type, taking the cls.cls _ name as the key, and storing the key value pair < cls.cls _ name, Cls > into the first hash table Cls _ map;
if the module _ type already exists in the key of the first hash table Cls _ map, it indicates that the current module M is presentkThe class cls to which it belongs has been established by the meta class mcs;
call class Cls _ map [ module _ type ]]The initialization function instance _ init of (c) will be the CIM module MkInstantiationIs Objk
Go through to the ri+1To rj-1When the method is used, the following steps are executed:
according to the syntactic rules of XML, according to the module MkThe description content of each line in the (C) to the current instance calls the class Cls _ map [ module _ type ]]Example operation methods 2 to 5, constructed by mcs, for example ObjkInitializing and assigning the attributes of the system;
go through to the rjWhen the method is used, the following steps are executed:
pair of key values<module_id,Objk>And storing the data into the instance hash table ID _ map, and updating the second hash table Obj _ map.
Correspondingly, the third embodiment of the present invention provides a data analysis device of a CIM model, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, the data analysis device of the CIM model according to the first embodiment of the present invention is implemented. The data analysis device of the CIM model can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The data parsing device of the CIM model may include, but is not limited to, a processor, and a memory.
Correspondingly, the fourth embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the data analysis method of the CIM model according to the first embodiment of the present invention.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor is a control center of the data analysis device of the CIM model, and various interfaces and lines are used to connect various parts of the data analysis device of the whole CIM model.
The memory may be used for storing the computer programs and/or modules, and the processor may implement various functions of the data parsing apparatus of the CIM model by executing or executing the computer programs and/or modules stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein, the module/unit integrated with the data analysis device of the CIM model can be stored in a computer readable storage medium if it is implemented in the form of software functional unit and sold or used as an independent product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (9)

1. A data analysis method of a CIM model is characterized by comprising the following steps:
constructing a data element class which comprises preset data attributes and methods;
reading data information line by line from an XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model), and storing the CIM into a vector list;
constructing a first hash table, storing a new class constructed by the data element class in the first hash table by taking a character string as a key, wherein the first hash table is empty in an initial state;
constructing a second hash table, and storing the example hash table into the second hash table by taking the character string as a key;
storing the instance object generated by the CIM correspondingly by using the unique code string ID corresponding to the CIM as a key in the instance hash table;
and traversing the record in any CIM module in the vector list line by line, and generating and storing the class or the object corresponding to the CIM module.
2. The method according to claim 1, wherein the reading data information line by line from the XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM module, and storing the CIM module in a vector list specifically comprises:
reading the data information line by line from XML file, and using regular expression p according to XML grammar specification0="<cim.*rdf:ID.*>", and p1="</cim.*>"carry on the regular matching to the data information read line by line in pairs;
is and p0Behavior r of a match hitiAnd p is1Behavior r of a match hitj(ii) a Then r isiGo to rjContent constitutes a complete CIM module MkAnd storing the module into a vector list M;
wherein M ═ M1,M2,…,Mk,…,Mn],Mk=[ri,ri+1,…,rj-1,rj]。
3. The method according to claim 2, wherein the constructing a first hash table, storing a new class constructed from the data element class in the first hash table by using a character string as a key, and the first hash table being empty in an initial state specifically comprises:
constructing the first hash table Cls _ map, storing a new class some _ class constructed by the data element class in the first hash table Cls _ map by taking a character string Cls _ name as a key, wherein the Cls _ map is empty in an initial state
Wherein Cls _ map < string _ name, class name _ class >.
4. The method for data parsing of a CIM model according to claim 3, wherein the constructing a second hash table and storing the instance hash table into the second hash table with the character string as a key specifically comprises:
constructing the second hash table Obj _ map, and storing an instance hash table ID _ map into the second hash table Obj _ map by taking the character string cls _ name as a key; the second hash table Obj _ map and the CIM module MkThe CIM module M is keyed by the corresponding unique code string IDkStoring the generated example object some _ object;
wherein Obj _ map < stringcls _ name, ID _ map < stringID, Cls _ map [ Cls _ name ] name _ object > >.
5. The data analysis method of the CIM model according to claim 4, wherein the building of the data element class, the data element class including preset data attributes and methods, specifically comprises: constructing a data element class mcs, wherein the following attributes and methods are preset in the data element class mcs:
attribute 1: cls _ name, recording the name of the current generation class;
the method comprises the following steps: instance _ init, which supports the generated class to generate a new instance;
the method 2 comprises the following steps: get _ attr, supporting the generated instance of the generated class to obtain the attribute of the instance;
the method 3 comprises the following steps: attr _ setter, which supports the generated instance of the generated class to assign the attribute of the instance;
the method 4 comprises the following steps: attr _ init, supporting the generated instance of the generated class to initialize a new attribute for the instance;
the method 5 comprises the following steps: has _ attr, supporting the generated instance of the generated class to search whether the instance contains a certain attribute;
the method 6 comprises the following steps: is _ single _ bus _ device, which supports the generated instance of the generated class to judge whether the instance is a single port element;
the method 7 comprises the following steps: the affileite _ substation _ function _ assign supports the generated example of the generated class to return the substation information to which the example belongs;
the method 8 comprises the following steps: the notification _ voltage _ function _ assign supports the generated example of the generated class to return the voltage grade and the reference voltage information corresponding to the example;
the method 9: get _ zone _ func, supporting the generated example of the generated class to return the area information of the example;
the method 10 comprises the following steps: get _ area _ func, and returning the partition information of the instance generated by supporting the generated class.
6. The method for analyzing data of a CIM module according to claim 5, wherein traversing records in any of the CIM modules in the vector list line by line, generating and storing a class or an object corresponding to the CIM module specifically includes:
go through to the riWhen the method is used, the following steps are executed:
rule and p described according to CIM model0And riOf matching relation of from riStarting from the 5 th character and ending from the space character, extracting the CIM module MkA category field specified in XML, denoted as module _ type; from riThe sub-string "rdf, ID ═ begins with the 1 st character, to riThe last 3 characters of the line are finished, and a module M is extractedkAn identification ID specified in XML, which is recorded as module _ ID;
if the module _ type does not exist in the key of the first hash table Cls _ map, calling the data element class mcs to construct a class Cls corresponding to the module _ type, making the cls.cls _ name be the module _ type, taking the cls.cls _ name as the key, and storing the key value pair < cls.cls _ name, Cls > into the first hash table Cls _ map;
if the module _ type already exists in the key of the first hash table Cls _ map, it indicates that the current module M is presentkThe class cls to which it belongs has been established by the meta class mcs;
call class Cls _ map [ module _ type ]]Will initialize function instance _ initThe CIM module MkInstantiated as Objk
Go through to the ri+1To rj-1When the method is used, the following steps are executed:
according to the syntactic rules of XML, according to the module MkThe description content of each line in the (C) to the current instance calls the class Cls _ map [ module _ type ]]Example operation methods 2 to 5, constructed by mcs, for example ObjkInitializing and assigning the attributes of the system;
go through to the rjWhen the method is used, the following steps are executed:
pair of key values<module_id,Objk>And storing the data into the instance hash table ID _ map, and updating the second hash table Obj _ map.
7. A data analysis device of a CIM model is characterized by comprising:
the meta-class construction unit is used for constructing a data meta-class, and the data meta-class comprises preset data attributes and methods;
the data acquisition unit is used for reading data information line by line from the XML file, performing regular matching on the data information read line by line in pairs according to a regular expression to obtain a CIM (common information model) module, and storing the CIM module into a vector list;
the first hash table construction unit is used for constructing a first hash table, storing a new class constructed by the data element class in the first hash table by taking a character string as a key, and enabling the first hash table to be empty in an initial state;
the second hash table construction unit is used for constructing a second hash table and storing the example hash table into the second hash table by taking the character string as a key;
the first analysis unit is used for storing the instance object generated by the CIM correspondingly by taking the unique code string ID corresponding to the CIM as a key in the instance hash table;
and the second analysis unit is used for traversing the records in any CIM module in the vector list line by line, and generating and storing the class or the object corresponding to the CIM module.
8. A data parsing apparatus of a CIM model, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing a data parsing method of a CIM model according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when running, controls an apparatus in which the computer-readable storage medium is located to perform a data parsing method of a CIM model according to any one of claims 1 to 6.
CN202011094885.8A 2020-10-14 2020-10-14 CIM model data analysis method, CIM model data analysis device and storage medium Active CN112230929B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011094885.8A CN112230929B (en) 2020-10-14 2020-10-14 CIM model data analysis method, CIM model data analysis device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011094885.8A CN112230929B (en) 2020-10-14 2020-10-14 CIM model data analysis method, CIM model data analysis device and storage medium

Publications (2)

Publication Number Publication Date
CN112230929A true CN112230929A (en) 2021-01-15
CN112230929B CN112230929B (en) 2023-11-03

Family

ID=74111902

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011094885.8A Active CN112230929B (en) 2020-10-14 2020-10-14 CIM model data analysis method, CIM model data analysis device and storage medium

Country Status (1)

Country Link
CN (1) CN112230929B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051267A (en) * 2021-03-08 2021-06-29 国网江苏省电力有限公司扬州供电分公司 Automatic generation method and system for CIM (common information model) of electric-heat conversion equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040025142A1 (en) * 2002-08-05 2004-02-05 Sun Microsystems, Inc. Method and apparatus for managing objects in a CIM environment
US7499992B1 (en) * 2008-02-27 2009-03-03 International Business Machines Corporation Association traversal translation for common information model
CN104166942A (en) * 2014-07-02 2014-11-26 国家电网公司 Method and system for searching cross-regional power supply range based on CIM model
CN105630500A (en) * 2015-12-25 2016-06-01 江苏东大金智信息系统有限公司 CIM object model for data processing and programming frame thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040025142A1 (en) * 2002-08-05 2004-02-05 Sun Microsystems, Inc. Method and apparatus for managing objects in a CIM environment
US7499992B1 (en) * 2008-02-27 2009-03-03 International Business Machines Corporation Association traversal translation for common information model
CN104166942A (en) * 2014-07-02 2014-11-26 国家电网公司 Method and system for searching cross-regional power supply range based on CIM model
CN105630500A (en) * 2015-12-25 2016-06-01 江苏东大金智信息系统有限公司 CIM object model for data processing and programming frame thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘崇茹 等: "包含直流输电系统的公用信息模型的扩展", 《电力系统自动化》, vol. 28, no. 20, pages 52 - 56 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051267A (en) * 2021-03-08 2021-06-29 国网江苏省电力有限公司扬州供电分公司 Automatic generation method and system for CIM (common information model) of electric-heat conversion equipment
CN113051267B (en) * 2021-03-08 2024-05-03 国网江苏省电力有限公司扬州供电分公司 Automatic CIM model generation method and system for electrothermal conversion equipment

Also Published As

Publication number Publication date
CN112230929B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
CN111708539B (en) Application program code conversion method and device, electronic equipment and storage medium
US8782597B2 (en) Ontology updating apparatus, method and system
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN102663094A (en) IEC61970CIM model checking method
CN111585344B (en) Substation intelligent checking method and device based on total station IED simulation
CN105760272B (en) Monitoring backstage business customizing method and its system based on plug-in unit
CN111159897B (en) Target optimization method and device based on system modeling application
CN103927385A (en) Unifying method and device of data model
CN110737425B (en) Method and device for establishing application program of charging platform system
CN106570153A (en) Data extraction method and system for mass URLs
CN111897828A (en) Data batch processing implementation method, device, equipment and storage medium
CN106776779B (en) Method for generating entity file by JSON data based on Mac platform
CN111245633B (en) Configuration file of micro-grid main equipment and operation method thereof
CN112230929A (en) Data analysis method and device of CIM (common information model) and storage medium
CN103164532B (en) The classification piecemeal abstracting method of grid model data and system
CN109068286B (en) Information analysis method, medium and equipment
CN114928587B (en) AIoT equipment multiplexing modeling method based on cloud edge cooperative system
CN103942322A (en) Distribution network model discrepant data merging method based on XML files
CN106570152A (en) Mobile phone number volume extracting method and system
CN115391343A (en) Bill data processing method and device, electronic equipment and storage medium
CN113626995B (en) Substation logic model handover method based on digital design
CN112131239B (en) Data processing method, computer equipment and readable storage medium
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN114579136A (en) Code processing method and device, computer equipment and storage medium
CN113741864A (en) Automatic design method and system of semantic service interface based on natural language processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant