CN105787808A - IEC61968 standard document generation system and method based on generic programming and reflection mechanism - Google Patents
IEC61968 standard document generation system and method based on generic programming and reflection mechanism Download PDFInfo
- Publication number
- CN105787808A CN105787808A CN201610115419.0A CN201610115419A CN105787808A CN 105787808 A CN105787808 A CN 105787808A CN 201610115419 A CN201610115419 A CN 201610115419A CN 105787808 A CN105787808 A CN 105787808A
- Authority
- CN
- China
- Prior art keywords
- xsd
- xml
- data
- module
- file
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/06—Energy or water supply
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
- G06F8/22—Procedural
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Economics (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- Public Health (AREA)
- Strategic Management (AREA)
- Tourism & Hospitality (AREA)
- Primary Health Care (AREA)
- General Business, Economics & Management (AREA)
- Marketing (AREA)
- Human Resources & Organizations (AREA)
- General Health & Medical Sciences (AREA)
- Water Supply & Treatment (AREA)
- Stored Programmes (AREA)
Abstract
本发明涉及一种基于泛型编程和反射机制的IEC61968标准文档生成系统及方法,IEC61968标准文档生成系统包括Xsd处理模块、配置文件处理模块、XML生成模块、数据查询模块和XML文档输出模块;Xsd处理模块分别与配置文件处理模块和XML文档输出模块传递数据;XML生成模块与配置文件处理模块、数据查询模块和XML文档输出模块传递数据。本发明是在配电网IEC61968标准基础上,使用泛型编程和反射机制技术,生成符合IEC61968标准的XML文档通用方法。使用此方法可避免为配电个应用系统重复开发文档转换程序,统一数据交换文档格式,降低配电各个应用集成的实施难度及实施成本,推进配电信息化的建设,提高配电信息化工作效率和正确性,从而提高配电网运行水平。
The invention relates to an IEC61968 standard document generation system and method based on generic programming and reflection mechanism. The IEC61968 standard document generation system includes an Xsd processing module, a configuration file processing module, an XML generation module, a data query module and an XML document output module; Xsd The processing module transfers data with the configuration file processing module and the XML document output module respectively; the XML generation module transfers data with the configuration file processing module, the data query module and the XML document output module. The invention is based on the distribution network IEC61968 standard, uses generic programming and reflection mechanism technology, and generates a general method for XML documents conforming to the IEC61968 standard. Using this method can avoid repeated development of document conversion programs for power distribution application systems, unify the format of data exchange documents, reduce the implementation difficulty and cost of the integration of various power distribution applications, promote the construction of power distribution informatization, and improve the work of power distribution informatization Efficiency and correctness, thereby improving the operation level of distribution network.
Description
技术领域technical field
本发明涉及一种电力系统及其自动化的生成系统及方法,具体涉及一种基于泛型编程和反射机制的IEC61968标准文档生成系统及方法。The invention relates to a power system and its automatic generation system and method, in particular to an IEC61968 standard document generation system and method based on generic programming and reflection mechanism.
背景技术Background technique
对于IEC61968标准的CIM模型及XMLSchema:目前,大部分配电网企业使用IEC61968所定义的配电网通用信息模型(DistributionCommonInformationModel,以下简称CIM模型),描述配电网的主要对象,尤其是和电网运行有关的数据。IEC61968所制定的CIM模型,是用面向对象技术定义的类(Class)的集合。每一个配电网中的设备、行为,事件,原则上都可以用CIM模型中的一个或若干个类的实例来表述。而配电网中的业务,可以通过多个类的实例的顺序组合表达。虽然IEC61968尚在制定和完善过程中,此标准已成为配电企业信息集成公认的规范。For the CIM model and XMLSchema of the IEC61968 standard: At present, most distribution network enterprises use the Distribution Common Information Model (Distribution Common Information Model, hereinafter referred to as the CIM model) defined by IEC61968 to describe the main objects of the distribution network, especially the operation of the distribution network. relevant data. The CIM model formulated by IEC61968 is a collection of classes (Class) defined by object-oriented technology. In principle, the equipment, behavior and events in each distribution network can be expressed by one or several instances of classes in the CIM model. The business in the distribution network can be expressed through the sequential combination of instances of multiple classes. Although IEC61968 is still in the process of formulation and improvement, this standard has become a recognized specification for information integration of power distribution enterprises.
IEC61968所关注的是配电网业务应用间的集成,希望通过此标准规范各个应用间交换数据的方式,方法。由于配电网在信息化过程中,缺乏统一的规划和管理,各个业务部门开发的应用系统采用不同的专有数据格式及数据接口,阻碍了各个应用系统的互联互通。IEC61968标准为促进各个配电应用系统的集成,在IEC61970标准的CIM模型的基础上,定义了配电业务数据的统一模型,并推荐使用XMLSchema标准(http://www.w3.org/2001/XMLSchema)作为规范数据交换格式的标准。因此,符合IEC61968标准的交换数据文档应该是以某个XMLSchema文档为约束的XML文档,其中的语义内容是由IEC61968标准所定义的CIM模型,即面向对象的类的实例来表达。IEC61968 focuses on the integration of distribution network business applications, and hopes to standardize the way and method of data exchange between various applications through this standard. Due to the lack of unified planning and management in the informationization process of the distribution network, the application systems developed by various business departments use different proprietary data formats and data interfaces, which hinders the interconnection of various application systems. In order to promote the integration of various power distribution application systems, the IEC61968 standard defines a unified model of power distribution business data on the basis of the CIM model of the IEC61970 standard, and recommends the use of the XMLSchema standard (http://www.w3.org/2001/ XMLSchema) as a standard for standardizing data exchange formats. Therefore, the exchange data document conforming to the IEC61968 standard should be an XML document constrained by an XMLSchema document, and the semantic content in it is expressed by the CIM model defined by the IEC61968 standard, that is, an instance of an object-oriented class.
配电业务系统之间交换的数据要以基于IEC61968的XMLSchema为格式约束,才能符合IEC61968标准的要求。The data exchanged between power distribution business systems must be constrained by XMLSchema based on IEC61968 in order to meet the requirements of the IEC61968 standard.
XMLSchema一般用后缀为“.xsd”的文件进行存储,因此XMLSchema通常也被称为Xsd,在本文中,XMLSchema和Xsd两个术语将不加区别的等同使用。XMLSchema is generally stored with a file with the suffix ".xsd", so XMLSchema is usually also called Xsd. In this article, the two terms XMLSchema and Xsd will be used equally without distinction.
依此标准,配电网的原有业务系统须将原有的数据接口改造为可输出或接受以XMLSchema文档为约束的XML文档。在本案中,将讨论将配电网数据转换为以某个XMLSchema文档为约束的XML文档的通用方法。According to this standard, the original business system of the distribution network must transform the original data interface into an XML document that can output or accept XMLSchema documents as constraints. In this case, a general method for transforming distribution network data into an XML document constrained by an XMLSchema document will be discussed.
此问题可总结为:依据现有的业务数据生成遵从某个IEC61968标准子集的XMLSchema(Xsd)的XML。具体到IT技术上,即是由Xsd(XMLschema)文件生成具体的XML的问题,可也定义为:This problem can be summarized as: generate XMLSchema (Xsd) XML conforming to a subset of the IEC61968 standard based on existing business data. Specific to IT technology, that is, the problem of generating specific XML from Xsd (XMLschema) files can also be defined as:
由一个Xsd(其中可包含对其他Xsd文件的引用),及原有业务数据(可包括关系型数据库中关系数据,xml文件,xml数据库中记录及其他类型数据),生成一个符合Xsd约束的合法xml文件。From an Xsd (which can contain references to other Xsd files) and original business data (which can include relational data in relational databases, xml files, records in xml databases, and other types of data), generate a legal Xsd-constrained xml file.
Xsd文件实际上是一种规则的集合,而符合这种规则的XML实例文件可以有无穷多个,根据Xsd文件生成XML相当于实现的映射关系。显然要实现这种映射,必须辅以实际的数据和具体的生成算法。The Xsd file is actually a collection of rules, and there can be infinitely many XML instance files that conform to this rule. Generating XML according to the Xsd file is equivalent to realizing the mapping relationship. Obviously, to realize this kind of mapping, it must be supplemented with actual data and specific generation algorithms.
形象的说,IEC61968标准定义的CIM模型中的类可看作工业生产的标准部件,如轴承,曲轴等;而符合IEC61968规范的某个Xsd,可看作一件产品的装配图;而生成XML的过程,就是产品组装的过程。Visually speaking, the classes in the CIM model defined by the IEC61968 standard can be regarded as standard components of industrial production, such as bearings, crankshafts, etc.; and a certain Xsd that conforms to the IEC61968 specification can be regarded as an assembly drawing of a product; and the generated XML The process is the process of product assembly.
目前在业界中使用Xsd生成XML的方法,在Java编程技术中有XMLbeans和jaxb技术,这两项技术的基本思想都是将Xsd转换为Java的类,并使用此代码生成XML文件,这种方法的局限性在于对每一个Xsd都要生成Java源代码,这种方式形成了Java源代码与Xsd的绑定,一旦Xsd发生变化,Java代码就要发生相应改变,并重新编译才能工作;程序被绑定在某几个固定的Java类中,难以适应需处理较多Xsd及Xsd经常发生变化的情况。C#及其他编程语言的情况与Java类似。而在配电业务系统可能使用的基于IEC61968的Xsd会相当多,如配电自动化系统所使用的Xsd可达上百个,而且会因为业务安排的变化而变化,显然使用此类方法难以处理配电业务中的XML生成问题。Currently in the industry, Xsd is used to generate XML. In Java programming technology, there are XMLbeans and jaxb technologies. The basic idea of these two technologies is to convert Xsd into Java classes and use this code to generate XML files. This method The limitation is that the Java source code must be generated for each Xsd. This method forms the binding between the Java source code and the Xsd. Once the Xsd changes, the Java code must be changed accordingly and recompiled to work; the program is Binding in some fixed Java classes, it is difficult to adapt to the situation where many Xsds need to be processed and Xsds often change. The situation with C# and other programming languages is similar to Java. However, there may be quite a few Xsds based on IEC61968 used in the power distribution business system. For example, the Xsds used in the power distribution automation system can reach hundreds, and they will change due to changes in business arrangements. XML generation problem in electric business.
对于泛型编程:For generic programming:
Java,C++,C#是最广泛使用的编程语言,这些语言对数据类型的严格检查,导致同一算法需针对不同数据类型开发不同的函数(如排序算法,需针对整形,浮点型,字符型等数据类型开发不同函数),增加了编程的复杂性。泛型编程技术则允许数据类型作为一种参数传递到函数中,这使得使用同一函数处理多个数据类型的相同算法成为可能。泛型编程以迭代器(Iterators)和容器(Containers)为基础,是一种泛型算法(GenericAlgorithms)技术,容器可容纳类型参数指定的数据类型的集合,使这些泛型算法有东西可以操作。其中的泛型算法(algorithms)、泛型迭代器(iterators)、泛型容器(containers)以及函数对象(functionobjects)等技术不仅使多个数据类型可共享通用函数,而且使程序结构更加简洁,合理,直观易懂。Java, C++, and C# are the most widely used programming languages. These languages strictly check the data types, so that the same algorithm needs to develop different functions for different data types (such as sorting algorithms, which need to be used for integer, floating-point, character, etc. Data types develop different functions), which increases the complexity of programming. Generic programming technology allows the data type to be passed to a function as a parameter, which makes it possible to use the same function to process the same algorithm for multiple data types. Generic programming is based on iterators (Iterators) and containers (Containers). It is a generic algorithm (GenericAlgorithms) technology. The container can accommodate a collection of data types specified by type parameters, so that these generic algorithms can operate. Among them, generic algorithms (algorithms), generic iterators (iterators), generic containers (containers), and function objects (functionobjects) and other technologies not only enable multiple data types to share common functions, but also make the program structure more concise and reasonable. , intuitive and easy to understand.
IEC61968CIM模型中的类(Class)数以千计,大多数类派生自一个基本类(IdentifiedObject),而且都有相似的结构和属性,在业务逻辑中的地位和作用相似度很高,因此很适合用泛型编程方式通用化处理。There are thousands of classes (Class) in the IEC61968CIM model, most of which are derived from a basic class (IdentifiedObject), and all have similar structures and attributes, and their status and functions in business logic are very similar, so they are very suitable Generalize with generic programming.
对于JAVA反射机制:For the JAVA reflection mechanism:
Java反射机制(Reflection)是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法和属性;这种动态获取的信息以及动态调用对象的方法的功能称为Java语言的反射机制。我们可以于运行时加载、探知、使用编译期间完全未知的classes。换句话说,Java程序可以加载一个运行时才得知名称的class,获悉其完整构造(但不包括methods定义),并生成其对象实体、或对其fields设值、或调用其methods。The Java reflection mechanism (Reflection) is in the running state. For any class, you can know all the properties and methods of this class; for any object, you can call any of its methods and properties; this dynamically obtained information And the function of dynamically calling the method of the object is called the reflection mechanism of the Java language. We can load, detect, and use classes that are completely unknown during compilation at runtime. In other words, a Java program can load a class whose name is known at runtime, learn its complete structure (but not including methods definition), and generate its object entity, or set values for its fields, or call its methods.
反射机制的动态加载,探知、使用编译期间完全未知的Class本专利有重要作用,程序在处理Xsd时,可无须在编译时了解Xsd的具体结构和组成,就能在运行时动态生成Xsd中的元素所对应的CIM模型类,并设置模型类的属性,调用模型类的函数,使XML生成程序的编写摆脱了对Xsd结构,组成的依赖。The dynamic loading of the reflection mechanism, detecting and using completely unknown Classes during compilation This patent plays an important role. When the program processes Xsd, it can dynamically generate Xsd at runtime without knowing the specific structure and composition of Xsd at compile time. The CIM model class corresponding to the element, set the attribute of the model class, call the function of the model class, so that the writing of the XML generation program can get rid of the dependence on the Xsd structure and composition.
目前,符合IEC61968标准的XML文档是配电业务系统之间规范数据交换的必要条件。而传统的生成XML的方法不具有通用性,需单独为各个配电业务系统开发相应的生成程序,而且难以应对业务流程改变带来的Xsd的变化。At present, the XML document conforming to the IEC61968 standard is a necessary condition for standardizing data exchange between power distribution business systems. However, the traditional method of generating XML is not universal. It needs to develop corresponding generating programs for each power distribution business system separately, and it is difficult to cope with the change of Xsd brought about by the change of business process.
发明内容Contents of the invention
为解决上述现有技术中的不足,本发明的目的是提供一种基于泛型编程和反射机制的IEC61968标准文档生成系统及方法,本发明通用且适应多个Xsd及Xsd变化的XML生成程序将促进配电业务系统之间的集成,降低配电业务整合的成本,提高配电业务的工作效率。In order to solve the deficiencies in the above-mentioned prior art, the object of the present invention is to provide a kind of IEC61968 standard document generation system and method based on generic programming and reflection mechanism, the XML generation program that the present invention is general and adapts to multiple Xsd and Xsd changes will Promote the integration between power distribution business systems, reduce the cost of power distribution business integration, and improve the work efficiency of power distribution business.
本发明的目的是采用下述技术方案实现的:The object of the present invention is to adopt following technical scheme to realize:
本发明提供一种基于泛型编程和反射机制的IEC61968标准文档生成系统,其改进之处在于,所述IEC61968标准文档生成系统包括Xsd处理模块、配置文件处理模块、XML生成模块、数据查询模块和XML文档输出模块;所述Xsd处理模块分别与配置文件处理模块和XML文档输出模块传递数据;所述XML生成模块与配置文件处理模块、数据查询模块和XML文档输出模块传递数据。The present invention provides an IEC61968 standard document generation system based on generic programming and reflection mechanism. The improvement is that the IEC61968 standard document generation system includes an Xsd processing module, a configuration file processing module, an XML generation module, a data query module and The XML document output module; the Xsd processing module transfers data with the configuration file processing module and the XML document output module respectively; the XML generation module transfers data with the configuration file processing module, the data query module and the XML document output module.
进一步地,所述Xsd处理模块用于解析Xsd文件结构,获得Xsd命名空间,简单数据类型,用于XML根元素的复杂数据类型,以及此xsd文件所引用的其他Xsd文件;所述配置文件处理模块用于读取、解析配置文件,获得要生成的XML文件的根元素名称,CIM类与数据类型的映射关系,对复杂数据类型生成元素的条件限定(包括此数据类型的子元素生成的数目限制,复杂数据类型元素的嵌套层数限制);Further, the Xsd processing module is used to parse the Xsd file structure to obtain the Xsd namespace, simple data types, complex data types for XML root elements, and other Xsd files referenced by this xsd file; the configuration file processing The module is used to read and parse configuration files, obtain the root element name of the XML file to be generated, the mapping relationship between CIM classes and data types, and limit the conditions for generating elements of complex data types (including the number of child elements generated by this data type limit, the nesting level limit of complex data type elements);
所述XML生成模块的功能是根据Xsd处理模块获得的命名空间,数据类型,及配置文件处理模块的获得的配置信息,首先生成根元素,随后递归生成根元素的多个子元素,直至生成符合Xsd所规范的顺序结构的XML结构体;所述数据查询模块根据当前的数据类型以及对应的CIM类,获得当前处理元素的实际数据记录(特定元素可从配置文件中获得,如根元素);The function of the XML generation module is to first generate a root element according to the namespace obtained by the Xsd processing module, the data type, and the configuration information obtained by the configuration file processing module, and then recursively generate a plurality of sub-elements of the root element until generating an Xsd conforming The XML structure of the standardized sequence structure; the data query module obtains the actual data record of the current processing element according to the current data type and the corresponding CIM class (the specific element can be obtained from the configuration file, such as the root element);
所述XML文档输出模块负责将XML生成模块生成的数据结构体中数据依此写入XML文档对象,并输出为文件。The XML document output module is responsible for writing the data in the data structure generated by the XML generating module into the XML document object and outputting it as a file.
一种基于泛型编程和反射机制的IEC61968标准文档通用生成系统的生成方法,其改进之处在于,A method for generating a general generation system for IEC61968 standard documents based on generic programming and reflection mechanism, the improvement of which is that
所述方法包括下述步骤:The method comprises the steps of:
(1)根据Xsd文件集合,配置XML生成参数;(1) Configure XML generation parameters according to the Xsd file collection;
(2)读取配置,获得要生成的XML文件的根元素名称,并从Xsd文件集合中获得根元素的定义;(2) Read the configuration, obtain the root element name of the XML file to be generated, and obtain the definition of the root element from the Xsd file collection;
(3)针对当前处理的根元素名称,获得相应的IEC61968CIM模型类的名称,使用JAVA语言的反射机制生成CIM模型类的实例;(3) Obtain the name of the corresponding IEC61968CIM model class for the root element name currently processed, and use the reflection mechanism of the JAVA language to generate an instance of the CIM model class;
(4)通过数据查询接口获得当前处理元素的实际数据记录,并依据实际数据记录的数据设置步骤(3)生成的CIM模型类的实例属性;(4) Obtain the actual data record of the current processing element through the data query interface, and set the instance attributes of the CIM model class generated in step (3) according to the data of the actual data record;
(5)如果当前生成元素是由其他更基本的元素派生出来,即面向对象技术中的继承关系,则将此基本元素设定为当前生成元素,并执行(3)-(4)步骤;(5) If the current generated element is derived from other more basic elements, that is, the inheritance relationship in object-oriented technology, then set this basic element as the current generated element, and perform steps (3)-(4);
(6)如果当前元素有sequence子元素,生成sequence子元素中的CIM模型元素对应的模型类实例;(6) If the current element has a sequence sub-element, generate a model class instance corresponding to the CIM model element in the sequence sub-element;
(7)使用泛型编程容器容纳实例,并遍历每一个上一步骤形成的模型类实例,对每个实例执行步骤(4)-(6);(7) Use the generic programming container to hold the instance, and traverse each model class instance formed in the previous step, and perform steps (4)-(6) for each instance;
(8)直到所有元素被遍历,并没有新元素生成时,在内存中形成以CIM类实例为基础部件的且以Xsd所规范的顺序结构的数据结构体;(8) When all elements are traversed and no new elements are generated, a data structure with the CIM class instance as the basic component and the sequence structure specified by Xsd is formed in the memory;
(9)生成XML文档对象,依据上一步骤所生成的数据结构体,将数据结构体中数据依此写入XML文档对象,并输出为文件。(9) Generate an XML document object, write the data in the data structure body into the XML document object according to the data structure generated in the previous step, and output it as a file.
进一步地,所述步骤(1)中,依据业务需求及实际情况(如现场数据完备情况或数据质量等)生成配置文件,对Xsd文件存储位置、业务数据库的访问方式、业务文件的存储位置、数据匹配方式以及Xsd元素映射参数进行配置,配置文件处理模块读取配置文件,并在内存中生成配置参数表。Further, in the step (1), a configuration file is generated according to business requirements and actual conditions (such as on-site data completeness or data quality, etc.), and the storage location of the Xsd file, the access method of the business database, the storage location of the business file, The data matching method and Xsd element mapping parameters are configured, and the configuration file processing module reads the configuration file and generates a configuration parameter table in memory.
进一步地,所述步骤(2)中,Xsd处理模块对Xsd文件进行解析,依据Xsd元素映射参数生成Xsd元素映射表,所述Xsd元素映射表中定义了Xsd元素与相应的CIM类的一一映射关系;XML生成模块读取配置参数表,找到要生成的XML的根元素,并设定为当前生成元素。Further, in the step (2), the Xsd processing module parses the Xsd file, generates an Xsd element mapping table according to the Xsd element mapping parameter, and defines the Xsd element and the corresponding CIM class one by one in the Xsd element mapping table Mapping relationship; the XML generation module reads the configuration parameter table, finds the root element of the XML to be generated, and sets it as the current generated element.
进一步地,所述步骤(3)中,XML生成模块从Xsd元素映射表中查找当前生成元素所对应的CIM类,使用映射机制生成CIM类实例。Further, in the step (3), the XML generation module searches the Xsd element mapping table for the CIM class corresponding to the currently generated element, and uses the mapping mechanism to generate a CIM class instance.
进一步地,所述步骤(4)中,通过数据查询模块的数据查询接口查询CIM类实例对应的业务数据,并根据填写当前CIM类实例的实例属性,包括CIM类的通用属性,包括名称属性(name)和标识符属性(mrid),以及CIM类的特有属性,如线路类的长度属性和开关类的容量属性。Further, in the step (4), query the service data corresponding to the CIM class instance by the data query interface of the data query module, and fill in the instance attributes of the current CIM class instance, including the general attributes of the CIM class, including the name attribute ( name) and identifier attribute (mrid), as well as specific attributes of the CIM class, such as the length attribute of the line class and the capacity attribute of the switch class.
进一步地,所述步骤(9)中,调用XML文档输出模块,依据所有CIM类所形成的数据结构体,生成XML文档,并输出为XML文件。Further, in the step (9), the XML document output module is invoked to generate an XML document according to the data structure formed by all CIM classes, and output it as an XML file.
与最接近的现有技术相比,本发明提供的技术方案具有的优异效果是:Compared with the closest prior art, the excellent effect that the technical solution provided by the present invention has is:
本发明是在配电网IEC61968标准基础上,使用泛型编程和反射机制技术,生成符合IEC61968标准的XML文档通用方法。使用此方法可根据某个给定的基于IEC61968标准某一子集的XMLSchema文档,生成符合IEC61968标准的XML文档,以便配电网各个应用间使用此XML进行数据交换和互操作。使用此方法可避免为配电个应用系统重复开发文档转换程序,统一数据交换文档格式,降低配电各个应用集成的实施难度及实施成本,推进配电信息化的建设,提高配电信息化工作效率和正确性,从而提高配电网运行水平。The invention is based on the distribution network IEC61968 standard, uses generic programming and reflection mechanism technology, and generates a general method for XML documents conforming to the IEC61968 standard. This method can be used to generate an XML document conforming to the IEC61968 standard according to a given XMLSchema document based on a certain subset of the IEC61968 standard, so that various applications in the distribution network can use this XML for data exchange and interoperability. Using this method can avoid repeated development of document conversion programs for power distribution application systems, unify the format of data exchange documents, reduce the implementation difficulty and cost of the integration of various power distribution applications, promote the construction of power distribution informatization, and improve the work of power distribution informatization Efficiency and correctness, thereby improving the operation level of distribution network.
附图说明Description of drawings
图1是本发明提供的XML生成程序模块图。Fig. 1 is a block diagram of the XML generation program provided by the present invention.
具体实施方式detailed description
下面结合附图对本发明的具体实施方式作进一步的详细说明。The specific implementation manners of the present invention will be further described in detail below in conjunction with the accompanying drawings.
以下描述和附图充分地示出本发明的具体实施方案,以使本领域的技术人员能够实践它们。其他实施方案可以包括结构的、逻辑的、电气的、过程的以及其他的改变。实施例仅代表可能的变化。除非明确要求,否则单独的组件和功能是可选的,并且操作的顺序可以变化。一些实施方案的部分和特征可以被包括在或替换其他实施方案的部分和特征。本发明的实施方案的范围包括权利要求书的整个范围,以及权利要求书的所有可获得的等同物。在本文中,本发明的这些实施方案可以被单独地或总地用术语“发明”来表示,这仅仅是为了方便,并且如果事实上公开了超过一个的发明,不是要自动地限制该应用的范围为任何单个发明或发明构思。The following description and drawings illustrate specific embodiments of the invention sufficiently to enable those skilled in the art to practice them. Other embodiments may incorporate structural, logical, electrical, process, and other changes. The examples merely represent possible variations. Individual components and functions are optional unless explicitly required, and the order of operations may vary. Portions and features of some embodiments may be included in or substituted for those of other embodiments. The scope of embodiments of the present invention includes the full scope of the claims, and all available equivalents of the claims. These embodiments of the present invention may be referred to herein, individually or collectively, by the term "invention", which is for convenience only and is not intended to automatically limit the application if in fact more than one invention is disclosed The scope is any individual invention or inventive concept.
本发明提供的基于泛型编程和反射机制的IEC61968标准文档通用生成系统结构示意图如图1所示,包括Xsd处理模块、配置文件处理模块、XML生成模块、数据查询模块和XML文档输出模块;所述Xsd处理模块分别与配置文件处理模块和XML文档输出模块传递数据;所述XML生成模块与配置文件处理模块、数据查询模块和XML文档输出模块传递数据。The IEC61968 standard document general generation system schematic diagram based on generic programming and reflection mechanism provided by the present invention is shown in Figure 1, including Xsd processing module, configuration file processing module, XML generation module, data query module and XML document output module; The Xsd processing module transfers data with the configuration file processing module and the XML document output module respectively; the XML generation module transfers data with the configuration file processing module, the data query module and the XML document output module.
所述Xsd处理模块用于解析Xsd文件结构,获得Xsd命名空间,简单数据类型,用于XML根元素的复杂数据类型,以及此xsd文件所引用的其他Xsd文件;所述配置文件处理模块用于读取、解析配置文件,获得要生成的XML文件的根元素名称,CIM类与数据类型的映射关系,对复杂数据类型生成元素的条件限定,包括此数据类型的子元素生成的数目限制,复杂数据类型元素的嵌套层数限制;Described Xsd processing module is used for parsing Xsd file structure, obtains Xsd namespace, simple data type, the complex data type that is used for XML root element, and other Xsd files that this xsd file refers; Described configuration file processing module is used for Read and parse the configuration file to obtain the name of the root element of the XML file to be generated, the mapping relationship between CIM classes and data types, the conditions for generating elements of complex data types, including the limit on the number of child elements generated by this data type, complex Nesting layer limit of data type elements;
所述XML生成模块的功能是根据Xsd处理模块获得的命名空间,数据类型,及配置文件处理模块的获得的配置信息,首先生成根元素,随后递归生成根元素的多个子元素,直至生成符合Xsd所规范的顺序结构的XML结构体;所述数据查询模块根据当前的数据类型以及对应的CIM类,获得当前处理元素的实际数据记录;The function of the XML generation module is to first generate a root element according to the namespace obtained by the Xsd processing module, the data type, and the configuration information obtained by the configuration file processing module, and then recursively generate a plurality of sub-elements of the root element until generating an Xsd conforming The XML structure of the standardized sequence structure; the data query module obtains the actual data record of the current processing element according to the current data type and the corresponding CIM class;
所述XML文档输出模块负责将XML生成模块生成的数据结构体中数据依此写入XML文档对象,并输出为文件。The XML document output module is responsible for writing the data in the data structure generated by the XML generating module into the XML document object and outputting it as a file.
本发明的应用场景是,所应用的配电网业务系统需要将数据转换为符合IEC61968标准某一子集的XMLSchema的XML文档,以便与其他业务系统进行数据交换。The application scenario of the present invention is that the applied distribution network business system needs to convert data into an XML document conforming to a certain subset of the IEC61968 standard XMLSchema, so as to exchange data with other business systems.
本发明提供的基于泛型编程和反射机制的IEC61968标准文档通用生成方法,在配电网IEC61968标准基础上,使用泛型编程和反射机制技术,生成符合IEC61968标准的XML文档通用方法。使用此方法可根据某个给定的基于IEC61968标准某一子集的XMLSchema文档,生成符合IEC61968标准的XML文档,以便配电网各个应用间使用此XML进行数据交换和互操作。具体步骤如下:The general method for generating IEC61968 standard documents based on generic programming and reflection mechanism provided by the present invention uses generic programming and reflection mechanism technology on the basis of distribution network IEC61968 standard to generate a general method for XML documents conforming to IEC61968 standard. This method can be used to generate an XML document conforming to the IEC61968 standard according to a given XMLSchema document based on a certain subset of the IEC61968 standard, so that various applications of the distribution network can use this XML for data exchange and interoperability. Specific steps are as follows:
(1)根据Xsd文件集合,配置XML生成参数;依据业务需求及实际情况(如现场数据完备情况或数据质量等)生成配置文件,对Xsd文件存储位置,业务数据库的访问方式,业务文件的存储位置,数据匹配方式以及Xsd元素映射等参数进行配置,配置文件处理模块读取此配置文件,并在内存中生成配置参数表。(1) Configure XML generation parameters according to the Xsd file collection; generate configuration files according to business requirements and actual conditions (such as on-site data completeness or data quality, etc.), store Xsd files, access methods of business databases, and store business files Position, data matching method, Xsd element mapping and other parameters are configured, and the configuration file processing module reads this configuration file and generates a configuration parameter table in memory.
(2)读取配置,获得要生成的XML文件的根元素名称,并从Xsd文件集合中获得此元素的定义;Xsd处理模块对Xsd文件进行解析,依据Xsd元素映射参数生成Xsd元素映射表,此表中定义了Xsd元素与相应的CIM类的一一映射关系;XML生成模块读取配置参数表,找到要生成的XML的根元素,并设定为当前生成元素。(2) Read the configuration, obtain the root element name of the XML file to be generated, and obtain the definition of this element from the Xsd file collection; the Xsd processing module parses the Xsd file, and generates the Xsd element mapping table according to the Xsd element mapping parameters, This table defines the one-to-one mapping relationship between Xsd elements and corresponding CIM classes; the XML generation module reads the configuration parameter table, finds the root element of the XML to be generated, and sets it as the current generated element.
(3)针对当前处理的元素的名称,获得相应的IEC61968的CIM模型类的名称,使用JAVA语言的反射机制生成此CIM模型类的实例;(3) Obtain the name of the CIM model class of corresponding IEC61968 at the name of the element of current processing, use the reflection mechanism of JAVA language to generate the instance of this CIM model class;
(4)通过数据查询模块查询此实例对应的业务数据,并据此填写当前CIM类实例的各个属性。(4) Query the business data corresponding to this instance through the data query module, and fill in each attribute of the current CIM class instance accordingly.
(5)如果当前生成元素是由其他更基本的元素派生(即面向对象技术中的继承关系)出来,则将此基本元素设定为当前生成元素,并执行4-5步骤。(5) If the current generated element is derived from other more basic elements (that is, the inheritance relationship in object-oriented technology), set this basic element as the current generated element, and perform steps 4-5.
(6)如果此元素有sequence子元素,生成sequence子元素中的CIM模型元素对应的模型类实例;(6) If this element has a sequence sub-element, generate a model class instance corresponding to the CIM model element in the sequence sub-element;
(7)使用泛型编程容器容纳这些sequence子元素,并使用4-6步骤遍历此容器内所有元素。使用泛型编程容器容纳这些实例,并遍历每一个实例,对每个实例执行4-6步骤;(7) Use a generic programming container to accommodate these sequence sub-elements, and use 4-6 steps to traverse all elements in this container. Use generic programming containers to accommodate these instances, and traverse each instance, and perform steps 4-6 for each instance;
(8)直到Xsd内所有元素被遍历,并没有新元素生成时,在内存中形成了以CIM类实例为基础部件的,以Xsd所规范的顺序结构的数据结构体。(8) Until all the elements in Xsd are traversed and no new elements are generated, a data structure with the CIM class instance as the basic component and the order structure specified by Xsd is formed in the memory.
(9)调用XML文档输出模块,依据所有CIM类所形成的数据结构体,生成XML文档,并输出为XML文件。(9) Call the XML document output module to generate XML documents according to the data structures formed by all CIM classes, and output them as XML files.
本发明可避免为配电个应用系统重复开发文档转换程序,统一数据交换文档格式,降低配电各个应用集成的实施难度及实施成本,推进配电信息化的建设,提高配电信息化工作效率和正确性,从而提高配电网运行水平。The present invention can avoid repeated development of document conversion programs for each application system of power distribution, unify the format of data exchange documents, reduce the implementation difficulty and implementation cost of each application integration of power distribution, promote the construction of power distribution informatization, and improve the efficiency of power distribution informatization and correctness, thereby improving the operation level of the distribution network.
以上实施例仅用以说明本发明的技术方案而非对其限制,尽管参照上述实施例对本发明进行了详细的说明,所属领域的普通技术人员依然可以对本发明的具体实施方式进行修改或者等同替换,这些未脱离本发明精神和范围的任何修改或者等同替换,均在申请待批的本发明的权利要求保护范围之内。The above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art can still modify or equivalently replace the specific embodiments of the present invention. , any modifications or equivalent replacements that do not deviate from the spirit and scope of the present invention are within the protection scope of the claims of the present invention pending application.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610115419.0A CN105787808A (en) | 2016-03-01 | 2016-03-01 | IEC61968 standard document generation system and method based on generic programming and reflection mechanism |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610115419.0A CN105787808A (en) | 2016-03-01 | 2016-03-01 | IEC61968 standard document generation system and method based on generic programming and reflection mechanism |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN105787808A true CN105787808A (en) | 2016-07-20 |
Family
ID=56386803
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610115419.0A Pending CN105787808A (en) | 2016-03-01 | 2016-03-01 | IEC61968 standard document generation system and method based on generic programming and reflection mechanism |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN105787808A (en) |
Cited By (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107766304A (en) * | 2017-10-23 | 2018-03-06 | 国电南瑞科技股份有限公司 | A kind of binary profile file generation method based on XML |
| CN109101595A (en) * | 2018-07-27 | 2018-12-28 | 郑州云海信息技术有限公司 | A kind of information query method, device, equipment and computer readable storage medium |
| CN109522453A (en) * | 2018-10-22 | 2019-03-26 | 中国航空综合技术研究所 | A kind of standard criterion digitalized processing method towards equipment technology index |
| CN110874213A (en) * | 2019-11-12 | 2020-03-10 | 广州银汉科技有限公司 | Runtime type extension and reflection method of static strong type language |
| CN110990411A (en) * | 2019-12-18 | 2020-04-10 | 上海米哈游网络科技股份有限公司 | Data structure generation method and device and calling method and device |
| CN111090971A (en) * | 2019-12-11 | 2020-05-01 | 哈尔滨安天科技集团股份有限公司 | Method and device for exporting multi-source information as Excel file |
| CN112035707A (en) * | 2020-08-17 | 2020-12-04 | 深圳市中盛瑞达科技有限公司 | Operation conversion method and system |
| CN112347736A (en) * | 2020-12-01 | 2021-02-09 | 中国商用飞机有限责任公司 | Method for converting structured data files relating to civil aviation regulations into word documents |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102929664A (en) * | 2012-10-16 | 2013-02-13 | 南京通达海信息技术有限公司 | Conventional data exchange method based on XSD structure |
| CN104050265A (en) * | 2014-06-20 | 2014-09-17 | 国家电网公司 | General bus adaptor construction method based on IEC 61968 standards |
| CN104331839A (en) * | 2014-10-22 | 2015-02-04 | 国家电网公司 | CIM ontology modeling calibration system and method by utilizing high-speed IO technology |
-
2016
- 2016-03-01 CN CN201610115419.0A patent/CN105787808A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102929664A (en) * | 2012-10-16 | 2013-02-13 | 南京通达海信息技术有限公司 | Conventional data exchange method based on XSD structure |
| CN104050265A (en) * | 2014-06-20 | 2014-09-17 | 国家电网公司 | General bus adaptor construction method based on IEC 61968 standards |
| CN104331839A (en) * | 2014-10-22 | 2015-02-04 | 国家电网公司 | CIM ontology modeling calibration system and method by utilizing high-speed IO technology |
Non-Patent Citations (2)
| Title |
|---|
| 沈兵兵等: "基于IEC61968的电力系统互操作体系构建思路", 《南方电网技术》 * |
| 王伊晓等: "基于IEC 61968的电网静态拓扑模型表达方式研究", 《华东电力》 * |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107766304A (en) * | 2017-10-23 | 2018-03-06 | 国电南瑞科技股份有限公司 | A kind of binary profile file generation method based on XML |
| CN109101595A (en) * | 2018-07-27 | 2018-12-28 | 郑州云海信息技术有限公司 | A kind of information query method, device, equipment and computer readable storage medium |
| CN109522453A (en) * | 2018-10-22 | 2019-03-26 | 中国航空综合技术研究所 | A kind of standard criterion digitalized processing method towards equipment technology index |
| CN110874213A (en) * | 2019-11-12 | 2020-03-10 | 广州银汉科技有限公司 | Runtime type extension and reflection method of static strong type language |
| CN111090971A (en) * | 2019-12-11 | 2020-05-01 | 哈尔滨安天科技集团股份有限公司 | Method and device for exporting multi-source information as Excel file |
| CN110990411A (en) * | 2019-12-18 | 2020-04-10 | 上海米哈游网络科技股份有限公司 | Data structure generation method and device and calling method and device |
| CN110990411B (en) * | 2019-12-18 | 2024-02-06 | 上海米哈游网络科技股份有限公司 | Data structure generation method and device, and calling method and device |
| CN112035707A (en) * | 2020-08-17 | 2020-12-04 | 深圳市中盛瑞达科技有限公司 | Operation conversion method and system |
| CN112035707B (en) * | 2020-08-17 | 2021-03-30 | 深圳市中盛瑞达科技有限公司 | Operation conversion method and system |
| CN112347736A (en) * | 2020-12-01 | 2021-02-09 | 中国商用飞机有限责任公司 | Method for converting structured data files relating to civil aviation regulations into word documents |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105787808A (en) | IEC61968 standard document generation system and method based on generic programming and reflection mechanism | |
| US20220350803A1 (en) | Query Generation Based On Merger Of Subqueries | |
| CN107908672B (en) | Application report realization method, device and storage medium based on Hadoop platform | |
| US7194485B2 (en) | Mapping XML schema components to qualified java components | |
| US7917463B2 (en) | System and method for data warehousing and analytics on a distributed file system | |
| CN103412853B (en) | A kind of automatic example generation method for file convertor | |
| CN111400288A (en) | Data quality inspection method and system | |
| US20110153505A1 (en) | Deliver application services through business object views | |
| Hamouda et al. | Document-oriented data schema for relational database migration to NoSQL | |
| CN107315768A (en) | The distribution information interacting method and system mapped based on Heterogeneous Information model | |
| CN104111998A (en) | Method and device for sorting coding and integrated exchange and management of heterogeneous data of enterprise | |
| CN110955714B (en) | Method and device for converting unstructured text into structured text | |
| CN108108466A (en) | Distributed system log query analysis method and device | |
| CN111897856A (en) | Supervision message generation method, device, electronic device and readable storage medium | |
| CN114996319B (en) | Data processing method, device and equipment based on rule engine and storage medium | |
| CN105573274A (en) | TS16949 association object control method based on PLM system | |
| CN107766451A (en) | A kind of integration across database associative search method towards electric power big data | |
| CN105893053A (en) | Excel annotation-based report generation method | |
| CN117216034A (en) | Data blood margin analysis method and system | |
| CN116010380A (en) | Data warehouse automatic management method based on visual modeling | |
| Tacke Genannt Unterberg et al. | Maximizing reuse and interoperability in industry 4.0 with a minimal data exchange format for machine data | |
| Korotkiy et al. | From relational data to RDFS models | |
| CN110826151B (en) | Electric automobile model design method | |
| WO2025107621A1 (en) | Assembly-based large-scale software construction method and device, and medium | |
| Dibowski et al. | Ontology-based device descriptions and triple store based device repository for automation devices |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| TA01 | Transfer of patent application right | ||
| TA01 | Transfer of patent application right |
Effective date of registration: 20170519 Address after: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15 Applicant after: China Electric Power Research Institute Applicant after: State Grid Corporation of China Applicant after: State Grid Beijing Electric Power Company Address before: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15 Applicant before: China Electric Power Research Institute Applicant before: State Grid Corporation of China |
|
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160720 |