CN112230929B - CIM model data analysis method, CIM model data analysis device and storage medium - Google Patents

CIM model data analysis method, CIM model data analysis device and storage medium Download PDF

Info

Publication number
CN112230929B
CN112230929B CN202011094885.8A CN202011094885A CN112230929B CN 112230929 B CN112230929 B CN 112230929B CN 202011094885 A CN202011094885 A CN 202011094885A CN 112230929 B CN112230929 B CN 112230929B
Authority
CN
China
Prior art keywords
class
hash table
cim
instance
module
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.)
Active
Application number
CN202011094885.8A
Other languages
Chinese (zh)
Other versions
CN112230929A (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.)
CSG Electric Power Research Institute
Shenzhen Power Supply Bureau Co Ltd
Original Assignee
CSG Electric Power Research Institute
Shenzhen Power Supply Bureau 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 CSG Electric Power Research Institute, Shenzhen Power Supply Bureau Co Ltd filed Critical CSG Electric Power Research Institute
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

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

Abstract

The invention discloses a data analysis method, a device and a storage medium of a CIM model, comprising the following steps: constructing a data element class, wherein the data element class comprises preset data attributes and methods; reading data information line by line, and performing regular matching on the data information read line by line according to the regular expression pair by pair to obtain a CIM module; 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 instance hash table into the second hash table by taking the character string as a key; the instance hash table stores instance objects generated by the CIM module by taking the unique code character string ID corresponding to the CIM module as a key; traversing the vector list, traversing the records in the CIM modules row by any CIM module in the vector list, generating and storing the classes or objects corresponding to the CIM modules. The invention can track CIM model expansion and adjustment while adapting to the own specific requirements of the power system model.

Description

CIM model data analysis method, CIM model data analysis device and storage medium
Technical Field
The present invention relates to the field of power grid design technologies, and in particular, to a method, an apparatus, and a storage medium for data analysis of a CIM model.
Background
In the design and operation of a modern digital power grid with high interconnection, the scheduling and operation main bodies of all levels of the power grid need to be matched uniformly and closely when facing the same power system topology model. The international electrotechnical commission (International Electrotechnical Commission, IEC) has proposed in the international general standard IEC61970 a principle that a common information model (Common Information Model, CIM) with respect to grid model descriptions provides guidance for grid equipment and topology modeling. The above principle is equally applicable in national standards of national general model description specifications for power grids.
The CIM model is widely applied to an electric power system operation control and scheduling system (Operation Control System, OCS), and the system can accurately detect and control the real-time state of the electric power system operation through remote monitoring and measurement of various devices in the electric power system. By analyzing and converting CIM model data, real-time accurate running state data of the power system are obtained, and efficiency and accuracy of running state analysis of the real-time power system are improved.
In the prior art, the method for analyzing and converting CIM model data comprises the following steps: and (3) using an Eclipse modeling framework to realize the development of a public information model system and a direct modeling method for the CIM model.
The present inventors have found that in the process of implementing the present invention, the following technical problems exist in the prior art: the universal framework method can be suitable for analyzing various XML files, and well tracks possible CIM model expansion and adjustment in the future, however, the universal framework can only analyze data, can not well realize custom expansion and packaging of methods of each part of the class, and is difficult to adapt to the specific requirements of the power system model; the direct modeling method has high self-definition degree, can pack classes and required methods better, but cannot track CIM model expansion and adjustment better, and needs a large amount of coding class by class to finish data analysis.
Disclosure of Invention
The embodiment of the invention provides a data analysis method of a CIM model, which can track the expansion and adjustment of the CIM model while adapting to the own specific requirements of an electric power system model.
The first embodiment of the invention provides a data analysis method of a CIM model, which comprises the following steps:
constructing a data element class, wherein the data element class comprises preset data attributes and methods;
reading data information from an XML file line by line, 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 into a vector list;
constructing a first hash table, storing a new class constructed by the data element class into 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;
constructing a second hash table, and storing the instance hash table into the second hash table by taking the character string as a key;
the instance hash table stores an instance object generated correspondingly by the CIM module by taking a unique code character string ID corresponding to the CIM module as a key;
traversing the record in any CIM module in the vector list row by row, and generating and storing the class or object corresponding to the CIM module.
As an improvement of the above solution, 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 into a vector list, which specifically includes:
reading the data information line by line from an XML file, and expressing p in a regular expression according to an XML grammar specification 0 ="<cim.*rdf:ID.*>", and p 1 ="</cim.*>"pair by pair regular matching is carried out on the data information read row by row;
set and p 0 Behavior r of match hits i And p 1 Behavior r of match hits j The method comprises the steps of carrying out a first treatment on the surface of the R is then i Go to r j The content constitutes a complete CIM module M k Storing the module into a vector list M;
wherein M= [ M ] 1 ,M 2 ,…,M k ,…,M n ],M k =[r i ,r i+1 ,…,r j-1 ,r j ]。
As an improvement of the above solution, the constructing a first hash table, storing a new class constructed by the data element class in the first hash table by using a 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 name_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
Where cls_map < string cls_name, class name_class >.
As an improvement of the above solution, the constructing a second hash table, and storing the instance hash table in the second hash table by using 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 is mapped by the CIM module M k The CIM module M is keyed by the corresponding unique code string ID k Storing the corresponding generated instance object name_object;
where obj_map < strings_name, id_map < string ID, cls_map [ cls_name ] name_object > >.
As an improvement of the above solution, the construction of the data element class includes preset data attributes and methods, which 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;
method 1: instance_init, supporting the generated class to generate a new instance;
method 2: get_attr, support the instance generated by the generated class to obtain the properties of the instance;
method 3: attr_setter, supporting the instance generated by the generated class to assign the attribute of the instance;
method 4: attr_init, supporting the instance generated by the generated class to initialize new properties for the instance;
method 5: the has_attr supports the instance generated by the generated class to find whether the instance contains a certain attribute;
method 6: the instance generated by the support generated class judges whether the instance is a single port element or not;
method 7: an instance generated by supporting the generated class returns substation information subordinate to the instance;
method 8: the method comprises the steps that a generated instance supporting the generated class returns voltage class and reference voltage information corresponding to the instance;
method 9: get_zone_func, support the generated instance of the generated class to return the regional information to which the instance belongs;
the method 10 comprises the following steps: the get_area_func supports the instance generated by the generated class to return the partition information to which the instance belongs.
As an improvement of the above solution, the traversing the vector list, for any CIM module in the vector list, generating and storing a class or object corresponding to the CIM module from traversing a record in the CIM module row by row, specifically includes:
traversing r to the vector list i When the line is running, the following steps are executed:
rules and p described in terms of CIM model 0 And r i From r i Starting from the 5 th character to the end of the space character, extracting the CIM module M k A category field specified in XML, denoted module_type; from r i The 1 st character starts after "rdf: id=" "to r i Ending the 3 rd character (containing line-changing character "\n") of the line reciprocal, and extracting the module M k The identification ID specified in XML is denoted as module_id;
if the module_type does not exist in the key of the first hash table cls_map, calling a data element class mcs to construct a class Cls corresponding to the module_type, enabling cls.cls_name=module_type, taking cls.cls_name as the key, and storing a key value pair < cls.cls_name, cls > in the first hash table cls_map;
if module_type already exists in the key of the first hash table Cls_map, then the current module M is described k The belonging class cls has been established by meta-class mcs;
calling class Cls_map [ Module_type ]]Is to add the CIM module M to the initialization function instance_init (i.e. method 1) k Instantiated as Obj k
Traversal r i+1 To r j-1 When the line is running, the following steps are executed:
according to the grammar rules of XML, according to the module M k The description of the current instance, invoking class Cls_map [ module_type ]]Example operation methods 2 to 5 constructed by mcs for example Obj k Initializing and assigning various attributes of the product;
traversing to r j When the line is running, the following steps are executed:
couple key values<module_id,Obj k >And storing the second hash table obj_map into the instance hash table ID_map, and simultaneously updating the second hash table obj_map.
The second embodiment of the present invention correspondingly provides a data analysis device for a CIM model, including:
the meta-class construction unit is used for constructing a data meta-class, wherein the data meta-class comprises preset data attributes and a preset data attribute method;
the data acquisition unit is used for reading data information from the XML file line by line, carrying out regular matching on the data information read line by line according to a regular expression pair by pair to obtain a CIM module, and storing the CIM module into a vector list;
a first hash table construction unit, 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, and when the first hash table is empty in an initial state;
the second hash table construction unit is used for constructing a second hash table, and storing the instance hash table into the second hash table by taking the character string as a key;
the first parsing unit is used for storing the instance hash table by taking the unique code character string ID corresponding to the CIM module as a key and the instance object generated by the CIM module;
and the second parsing unit is used for traversing the record in any CIM module in the vector list row by row, and generating and storing the class or object corresponding to the CIM module.
The third embodiment of the invention correspondingly provides a data analysis device of a CIM model, which comprises: 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 the first embodiment of the present invention when the computer program is executed by the processor.
The fourth embodiment of the present invention provides a computer readable storage medium, which is characterized in that the computer readable storage medium includes a stored computer program, where when the computer program runs, a device where the computer readable storage medium is located is controlled to execute a data parsing method of a CIM model according to the first embodiment of the present invention.
The data analysis method of the CIM model provided by the embodiment of the invention has the following beneficial effects:
based on the Python meta-class method, a compromise is made between custom development and CIM model analysis; only meta-class mcs and the method thereof need to be created in advance, all types in CIM/XML are dynamically created by meta-class, and when CIM model faces expansion and adjustment, the CIM model can be tracked well; the new preset method is added in the step S101 through pre-coding, so that the special method of the electric power system model can be packed and customized, and the application range of CIM model analysis is enlarged; CIM model expansion and adjustment can be tracked while adapting to requirements specific to the power system model itself.
Drawings
Fig. 1 is a flow chart of a data parsing method of a CIM model according to an embodiment of the present invention.
Fig. 2 is a schematic structural diagram of a data analysis device for a CIM model according to a second embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flow chart of a data analysis method of a CIM model according to an embodiment of the present invention includes:
s101, constructing a data element class, wherein the data element class comprises preset data attributes and methods;
further, the construction of the data element class includes a preset data attribute and a preset method, and the method 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;
method 1: instance_init, supporting the generated class to generate a new instance;
method 2: get_attr, support the instance generated by the generated class to obtain the properties of the instance;
method 3: attr_setter, supporting the instance generated by the generated class to assign the attribute of the instance;
method 4: attr_init, supporting the instance generated by the generated class to initialize new properties for the instance;
method 5: the has_attr supports the instance generated by the generated class to find whether the instance contains a certain attribute;
method 6: the instance generated by the support generated class judges whether the instance is a single port element or not;
method 7: an instance generated by supporting the generated class returns substation information subordinate to the instance;
method 8: the method comprises the steps that a generated instance supporting the generated class returns voltage class and reference voltage information corresponding to the instance;
method 9: get_zone_func, support the generated instance of the generated class to return the regional information to which the instance belongs;
the method 10 comprises the following steps: the get_area_func supports the instance generated by the generated class to return the partition information to which the instance belongs.
Specifically, implementation of the power system customization method can be accomplished through the method 6-method 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 module, and storing the CIM module into a vector list;
further, the step of reading data information line by line from the XML file, and performing regular matching on the data information read line by line according to a regular expression pair to obtain a CIM module, and storing the CIM module into a vector list, which specifically includes:
reading the data information line by line from an XML file, and expressing p in a regular expression according to an XML grammar specification 0 ="<cim.*rdf:ID.*>", and p 1 ="</cim.*>"pair by pair regular matching is carried out on the data information read row by row;
set and p 0 Behavior r of match hits i And p 1 Behavior r of match hits j The method comprises the steps of carrying out a first treatment on the surface of the R is then i Go to r j The content constitutes a complete CIM module M k Storing the module into a vector list M;
wherein M= [ M ] 1 ,M 2 ,…,M k ,…,M n ],M k =[r i ,r i+1 ,…,r j-1 ,r j ]。
S103, constructing a first hash table, storing a new class constructed by the data element class into 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 the new class constructed by the data element class in the first hash table by using a character string as a key, and the first hash table is empty in an initial state, which specifically includes:
constructing the first hash table Cls_map, storing a new class name_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
Where cls_map < string cls_name, class name_class >.
S104, constructing a second hash table, and storing the instance 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 in the second hash table by using 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 is mapped by the CIM module M k The CIM module M is keyed by the corresponding unique code string ID k Storing the corresponding generated instance object name_object;
where obj_map < strings_name, id_map < string ID, cls_map [ cls_name ] name_object > >.
S105, storing the instance hash table by taking the unique code character string ID corresponding to the CIM module as a key and the instance object generated by the CIM module;
s106, 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
Further, traversing the record in any CIM module in the vector list row by row, generating and storing a class or object corresponding to the CIM module, and specifically including:
traversing to the (r) i When the line is running, the following steps are executed:
rules and p described in terms of CIM model 0 And r i From r i Starting from the 5 th character to the end of the space character, extracting the CIM module M k A category field specified in XML, denoted module_type; from r i The 1 st character starts after "rdf: id=" "to r i Ending the 3 rd character of the line reciprocal, extracting the module M k The identification ID specified in XML is denoted as module_id;
if the module_type does not exist in the key of the first hash table cls_map, calling a data element class mcs to construct a class Cls corresponding to the module_type, enabling cls.cls_name=module_type, taking cls.cls_name as the key, and storing a key value pair < cls.cls_name, cls > in the first hash table cls_map;
if module_type already exists in the key of the first hash table Cls_map, then the current module M is described k The belonging class cls has been established by meta-class mcs;
calling class Cls_map [ Module_type ]]Is used for initializing function instance_init of the CIM module M k Instantiated as Obj k
Traversing to the (r) i+1 To r j-1 When the line is running, the following steps are executed:
according to the grammar rules of XML, according to the module M k The description of the current instance, invoking class Cls_map [ module_type ]]Example operation methods 2 to 5 constructed by mcs for example Obj k Initializing and assigning various attributes of the product;
traversing to the (r) j When the line is running, the following steps are executed:
couple key values<module_id,Obj k >And storing the second hash table obj_map into the instance hash table ID_map, and simultaneously updating the second hash table obj_map.
In a specific embodiment, the specific practice of CIM has two CIM/XML formats and CIM/E formats, which can be converted with each other. XML is an abbreviation of extensible markup language (eXtensible Markup Language), which is a common format used for transmitting and storing data in the information technology field, and CIM/XML follows the grammar format of common XML; the CIM/E format is a model switching format specifically tailored to the power system. CIM uses resource description framework (Resource description framework schema, RDF schema) to describe the resources and properties of the various parts of the power system. 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 RDF scheme as a basis for the mutual association of device/topology parameters.
The implementation of 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 of the transformer described by the RDF schema.
Description of the transformer starts from line 1 to line 4:
line 1 describes the unique identification code of the transformer in RDF scheme, namely RDF: id=12345;
line 2 describes the name of the transformer;
line 3 describes that the transformer contains an instance attribute, equipmentContainer, whose unique identification code in RDF schema is 453127;
line 4 serves as a marker line for the end of the transformer module description.
The description of the high-voltage end winding of the transformer starts from line 5 to line 14 and has a similar structure as described above:
line 5 describes the unique identification code of the winding in RDF scheme, namely RDF: id= 123447;
lines 6 to 10 describe various physical electrical properties and parameters of the winding, including name, resistance, reactance, rated voltage, rated capacity 5.
Line 11 describes that the winding contains an instance attribute, memberof_powertransformer, whose unique identification code in RDF schema is RDF: id=12345, i.e. corresponds to the corresponding transformer model of lines 1 to 4. The row means that the transformer winding described in rdf: id= 123447 identifier is subordinate to the transformer in rdf: id=12345;
the description information of lines 12 to 14 is similar to the previous description.
In the code segment, writing in an XML grammar format, any instance or attribute starts with "< xxx >" and ends with "< xxx/>", so that the scope of the instance or attribute is limited. Modeling of a large power system topology can be achieved in the CIM through identification and connection of RDF schemas.
In the method without using meta-class, class codes of a plurality of specific classes are written first, and then tens of thousands of objects are constructed according to specific object description of CIM/XML in a corresponding classification; in the method for using the meta-class, only 1 meta-class code is required to be written, then the corresponding class is correspondingly constructed according to the specific object description of CIM/XML, and then the instance object of the class is constructed; meanwhile, in the construction process of the classes, the meta-classes can dynamically intercept, modify and record each class.
The data analysis method, the device and the storage medium of the CIM model provided by the embodiment of the invention have the following beneficial effects:
based on the Python meta-class method, a compromise is made between custom development and CIM model analysis; only meta-class mcs and the method thereof need to be created in advance, all types in CIM/XML are dynamically created by meta-class, and when CIM model faces expansion and adjustment, the CIM model can be tracked well; the new preset method is added in the step S101 through pre-coding, so that the special method of the electric power system model can be packed and customized, and the application range of CIM model analysis is enlarged; CIM model expansion and adjustment can be tracked while adapting to requirements specific to the power system model itself.
Referring to fig. 2, a second embodiment of the present invention correspondingly provides a data analysis device for a CIM model, which is characterized by comprising:
a meta class construction 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 configured to read data information from an XML file row by row, perform regular matching on the data information read row by row according to a regular expression pair by pair, obtain a CIM module, and store the CIM module in a vector list;
a first hash table construction 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, and when the first hash table is empty in an initial state;
a second hash table construction unit 204, configured to construct a second hash table, and store the instance hash table in the second hash table by using the character string as a key;
a first parsing unit 205, configured to store, in the instance hash table, an instance object generated by the CIM module corresponding to the unique code string ID corresponding to the CIM module as a key;
and a second parsing unit 206, configured to traverse the record in any of the CIM modules in the vector list row by row, and generate and store a class or object corresponding to the CIM module.
Further, the step of reading data information line by line from the XML file, and performing regular matching on the data information read line by line according to a regular expression pair to obtain a CIM module, and storing the CIM module into a vector list, which specifically includes:
reading the data information line by line from an XML file, and expressing p in a regular expression according to an XML grammar specification 0 ="<cim.*rdf:ID.*>", and p 1 ="</cim.*>"pair by pair regular matching is carried out on the data information read row by row;
set and p 0 Behavior r of match hits i And p 1 Behavior r of match hits j The method comprises the steps of carrying out a first treatment on the surface of the R is then i Go to r j The content constitutes a complete CIM module M k Storing the module into a vector list M;
wherein M= [ M ] 1 ,M 2 ,…,M k ,…,M n ],M k =[r i ,r i+1 ,…,r j-1 ,r j ]。
Further, the constructing a first hash table, storing the new class constructed by the data element class in the first hash table by using a character string as a key, and the first hash table is empty in an initial state, which specifically includes:
constructing the first hash table Cls_map, storing a new class name_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
Where cls_map < string cls_name, class name_class >.
Further, the constructing a second hash table, and storing the instance hash table in the second hash table by using 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 is mapped by the CIM module M k The CIM module M is keyed by the corresponding unique code string ID k Storing the corresponding generated instance object name_object;
where obj_map < strings_name, id_map < string ID, cls_map [ cls_name ] name_object > >.
Further, the construction of the data element class includes a preset data attribute and a preset method, and the method 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;
method 1: instance_init, supporting the generated class to generate a new instance;
method 2: get_attr, support the instance generated by the generated class to obtain the properties of the instance;
method 3: attr_setter, supporting the instance generated by the generated class to assign the attribute of the instance;
method 4: attr_init, supporting the instance generated by the generated class to initialize new properties for the instance;
method 5: the has_attr supports the instance generated by the generated class to find whether the instance contains a certain attribute;
method 6: the instance generated by the support generated class judges whether the instance is a single port element or not;
method 7: an instance generated by supporting the generated class returns substation information subordinate to the instance;
method 8: the method comprises the steps that a generated instance supporting the generated class returns voltage class and reference voltage information corresponding to the instance;
method 9: get_zone_func, support the generated instance of the generated class to return the regional information to which the instance belongs;
the method 10 comprises the following steps: the get_area_func supports the instance generated by the generated class to return the partition information to which the instance belongs.
Further, traversing the record in any CIM module in the vector list row by row, generating and storing a class or object corresponding to the CIM module, and specifically including:
traversing the (r) i When the line is running, the following steps are executed:
rules and p described in terms of CIM model 0 And r i From r i Starting from the 5 th character to the end of the space character, extracting the CIM module M k A category field specified in XML, denoted module_type; from r i The 1 st character starts after "rdf: id=" "to r i Ending the 3 rd character of the line reciprocal, extracting the module M k The identification ID specified in XML is denoted as module_id;
if the module_type does not exist in the key of the first hash table cls_map, calling a data element class mcs to construct a class Cls corresponding to the module_type, enabling cls.cls_name=module_type, taking cls.cls_name as the key, and storing a key value pair < cls.cls_name, cls > in the first hash table cls_map;
if module_type already exists in the key of the first hash table Cls_map, then the current module M is described k The belonging class cls has been established by meta-class mcs;
calling class Cls_map [ Module_type ]]Is used for initializing function instance_init of the CIM module M k Instantiated as Obj k
Traversing to the (r) i+1 To r j-1 When the line is running, the following steps are executed:
according to the grammar rules of XML, according to the module M k The description of the current instance, invoking class Cls_map [ module_type ]]Example operation methods 2 to 5 constructed by mcs for example Obj k Initializing and assigning various attributes of the product;
traversing to the (r) j When the line is running, the following steps are executed:
couple key values<module_id,Obj k >And storing the second hash table obj_map into the instance hash table ID_map, and simultaneously updating the second hash table obj_map.
The third embodiment of the invention provides a data analysis device of a CIM model, which comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the data analysis method of the CIM model is realized when the processor executes the computer program. The data analysis device of the CIM model can be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The data parsing device of the CIM model may include, but is not limited to, a processor, a memory.
The fourth embodiment of the present invention provides a computer readable storage medium, which is characterized in that the computer readable storage medium includes a stored computer program, where when the computer program runs, a device where the computer readable storage medium is controlled to execute the data parsing method of the CIM model according to the first embodiment of the present invention.
The processor may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is a control center of the data analysis device of the CIM model, and connects the respective parts of the data analysis device of the entire CIM model using various interfaces and lines.
The memory may be used to store the computer program and/or module, and the processor may implement various functions of the data parsing apparatus of the CIM model by running or executing the computer program and/or module stored in the memory and invoking 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 (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
Wherein the modules/units integrated by the data parsing means of the CIM model may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as independent products. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
It should be noted that the above-described apparatus embodiments are merely illustrative, and the units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the embodiment of the device provided by the invention, the connection relation between the modules represents that the modules have communication connection, and can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that changes and modifications may be made without departing from the principles of the invention, such changes and modifications are also intended to be within the scope of the invention.

Claims (9)

1. The data analysis method of the CIM model is characterized by comprising the following steps of:
constructing a data element class, wherein the data element class comprises preset data attributes and methods;
reading data information from an XML file line by line, 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 into a vector list;
constructing a first hash table, storing a new class constructed by the data element class into 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;
constructing a second hash table, and storing the instance hash table into the second hash table by taking the character string as a key;
storing the instance hash table by taking the unique code character string ID corresponding to the CIM module as a key and an instance object generated correspondingly to the CIM module;
traversing the record in any CIM module in the vector list row by row, and generating and storing the class or object corresponding to the CIM module.
2. The method for analyzing data of a CIM model of claim 1, wherein the reading data information from an XML file line by line, performing regular matching on the data information read line by line in pairs according to a regular expression, obtaining a CIM module, and storing the CIM module in a vector list, specifically includes:
from XMLReading the data information row by row in the part, and using a regular expression p according to XML grammar specification 0 ="<cim.*rdf:ID.*>", and p 1 ="</cim.*>"pair by pair regular matching is carried out on the data information read row by row;
set and p 0 Behavior r of match hits i And p 1 Behavior r of match hits j The method comprises the steps of carrying out a first treatment on the surface of the R is then i Go to r j The content constitutes a complete CIM module M k Storing the module into a vector list M;
wherein M= [ M ] 1 ,M 2 ,…,M k ,…,M n ],M k =[r i ,r i+1 ,…,r j-1 ,r j ]。
3. The method for resolving data of CIM model of claim 2, wherein the constructing a first hash table, storing the new class constructed by the data element class in the first hash table by using a character string as a key, wherein the first hash table is empty in an initial state, specifically comprises:
constructing the first hash table Cls_map, storing a new class name_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
Where cls_map < string cls_name, class name_class >.
4. The method for resolving data of CIM model of claim 3, wherein constructing the second hash table, and storing the instance hash table in the second hash table by using 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 is mapped by the CIM module M k The CIM module M is keyed by the corresponding unique code string ID k Storing the corresponding generated instance object name_object;
where obj_map < strings_name, id_map < string ID, cls_map [ cls_name ] name_object > >.
5. The method for analyzing data of a CIM model of claim 4, wherein the constructing a data element class includes a preset data attribute and method, and the method 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;
method 1: instance_init, supporting the generated class to generate a new instance;
method 2: get_attr, support the instance generated by the generated class to obtain the properties of the instance;
method 3: attr_setter, supporting the instance generated by the generated class to assign the attribute of the instance;
method 4: attr_init, supporting the instance generated by the generated class to initialize new properties for the instance;
method 5: the has_attr supports the instance generated by the generated class to find whether the instance contains a certain attribute;
method 6: the instance generated by the support generated class judges whether the instance is a single port element or not;
method 7: an instance generated by supporting the generated class returns substation information subordinate to the instance;
method 8: the method comprises the steps that a generated instance supporting the generated class returns voltage class and reference voltage information corresponding to the instance;
method 9: get_zone_func, support the generated instance of the generated class to return the regional information to which the instance belongs;
the method 10 comprises the following steps: the get_area_func supports the instance generated by the generated class to return the partition information to which the instance belongs.
6. The method for resolving data of a CIM model according to claim 5, wherein traversing the record in any CIM module in the vector list row by row, generating and storing a class or object corresponding to the CIM module, specifically includes:
traversing to the (r) i When the line is running, the following steps are executed:
rules and p described in terms of CIM model 0 And r i From r i Starting from the 5 th character to the end of the space character, extracting the CIM module M k A category field specified in XML, denoted module_type; from r i The 1 st character starts after "rdf: id=" "to r i Ending the 3 rd character of the line reciprocal, extracting the module M k The identification ID specified in XML is denoted as module_id;
if the module_type does not exist in the key of the first hash table cls_map, calling a data element class mcs to construct a class Cls corresponding to the module_type, enabling cls.cls_name=module_type, taking cls.cls_name as the key, and storing a key value pair < cls.cls_name, cls > in the first hash table cls_map;
if module_type already exists in the key of the first hash table Cls_map, then the current module M is described k The belonging class cls has been established by meta-class mcs;
calling class Cls_map [ Module_type ]]Is used for initializing function instance_init of the CIM module M k Instantiated as Obj k
Traversing to the (r) i+1 To r j-1 When the line is running, the following steps are executed:
according to the grammar rules of XML, according to the module M k The description of the current instance, invoking class Cls_map [ module_type ]]Example operation methods 2 to 5 constructed by mcs for example Obj k Initializing and assigning various attributes of the product;
traversing to the (r) j When the line is running, the following steps are executed:
couple key values<module_id,Obj k >And storing the second hash table obj_map into the instance hash table ID_map, and simultaneously updating the second hash table obj_map.
7. A data analysis device for a CIM model, comprising:
the meta-class construction unit is used for constructing a data meta-class, wherein the data meta-class comprises preset data attributes and a preset data attribute method;
the data acquisition unit is used for reading data information from the XML file line by line, carrying out regular matching on the data information read line by line according to a regular expression pair by pair to obtain a CIM module, and storing the CIM module into a vector list;
a first hash table construction unit, 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, and when the first hash table is empty in an initial state;
the second hash table construction unit is used for constructing a second hash table, and storing the instance hash table into the second hash table by taking the character string as a key;
the first parsing unit is used for storing the instance hash table by taking the unique code character string ID corresponding to the CIM module as a key and the instance object generated by the CIM module;
and the second parsing unit is used for traversing the record in any CIM module in the vector list row by row, and generating and storing the class or 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 of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored computer program, wherein the computer program when run controls a device in which the computer readable storage medium is located to perform a data parsing method of a CIM model according to any 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 CN112230929A (en) 2021-01-15
CN112230929B true 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)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* 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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
包含直流输电系统的公用信息模型的扩展;刘崇茹 等;《电力系统自动化》;第28卷(第20期);52-56 *

Also Published As

Publication number Publication date
CN112230929A (en) 2021-01-15

Similar Documents

Publication Publication Date Title
CN108279932B (en) Method and device for dynamically configuring user interface of mobile terminal
CN105335137B (en) Method and apparatus for handling source file
CN109558525B (en) Test data set generation method, device, equipment and storage medium
CN106407111B (en) Terminal test device, terminal test equipment and variable maintaining method
KR101574524B1 (en) Method and recording medium for compatibility between iec61850 and opc ua
CN109447820B (en) Data processing method, device, computer equipment and storage medium
US20120254849A1 (en) Ontology updating apparatus, method and system
CN103268325A (en) Dynamic checking method of intelligent substation IED (intelligent electronic device) model configuration correctness based on SCD (security coding device) files
CN110019111B (en) Data processing method, data processing device, storage medium and processor
CN103927385A (en) Unifying method and device of data model
CN104267966A (en) Method and device for generating program codes of software
CN111159897B (en) Target optimization method and device based on system modeling application
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
CN104750468B (en) A kind of server-side topological data conversion method and conversion equipment
US8266589B2 (en) Optimizing the handling of source code requests between a software configuration management (SCM) system and a software integrated development environment (IDE) using projected ancillary data
CN112230929B (en) CIM model data analysis method, CIM model data analysis device and storage medium
KR100762712B1 (en) Method for transforming of electronic document based on mapping rule and system thereof
CN109068286B (en) Information analysis method, medium and equipment
CN116384109A (en) Novel power distribution network-oriented digital twin model automatic reconstruction method and device
CN115809290A (en) Method, device, equipment and medium for generating data persistence layer entry
CN109671475A (en) HL7v3 data persistence method, storage medium, electronic equipment and system
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN114519071A (en) Generation method, matching method, system, device and medium of rule matching model
CN110019177A (en) The method and apparatus of rule storage

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