http://www.paper.edu.cn
-1-
Interface for Resourceidservice services in the data Access tool DAF
Design and implementation
interface of the service
Design and implementation
Tao Xin, High stakes
School of Information Engineering, East China Jiaotong University, Nanchang (330013)
E-mail:[email protected]
Abstract: ResourceID is a 64-bit integer data that is used to locate the identity of the unique resource in the energy system,
Resourceidservice Service is an important service interface in the Data Access Facility specification called DAF,
ResourceID and text-form URIs (Uniform Resource Identifier) are used to convert each other to ensure
ResourceID, so the design and implementation of the interface for resource access brings great convenience, efficient
Of
Key words: data access tools; Generic component interface; 61970 series standard; common data Model
1. Introduction
In EMS, currently, the CIM model in IEC61970 has been opened by ABB, Alston, Siemens and more than 20
Commercial in Scada,na and OTS and other more than 30 kinds of applications; NERC,WSCC, California 150 and more than 30
The Power Enterprise accepts CIM. At present, many manufacturers of power automation systems have developed a new CIM-based
Generation of power dispatching automation products. The establishment of CIM model provides unified and integrated power system applications, a
Data exchange platform. In the process of interconnection between systems, each system is required to be uniquely positioned for its required resources.
When the system accesses each other, the parsing of resources becomes a very necessary work.
The Data Access Facility specification is referred to as DAF and is the OMG based on UMS (including power, water, gas
such as utility services) application needs and the development of information systems and the prospects for developing the data read API. DAF
It is mainly used to obtain the analytic data in near real-time or non-real-time mode from a UMS system or application. DAF and its
The difference between his database API is "simple, practical, easy to solve a certain range of applications (or systems) integration asked
Question ". The content of the 402 and 403 statutes of the CIS section of IEC61970 is based on the DAF specification.
Therefore, in order to realize the CIS interface, we have a good understanding of DAF, and the Resource Identification service in DAF is the heavy
to components. Its implementation is the basis of the resource location query. The following article will take the SCADA system as an example from several
Aspects to introduce the design and implementation of the service.
2. Resource Identification Service
Resource markers are compact resource flags in query and query results. Resourceidservice provides the ResourceID
and text-form URIs (Uniform Resource Identifier) convert to each other.
2.1 URI
The URI is co-constructed by the Uniform Resource Locator (Uniform Resource Identifier) and an optional fragment identifier
Yes. The URIs that are combined in this way are more specifically supposed to be called uri-reference. The format is:
<scheme-name>:<opaque-part>#<fragment-identifier> a total of three parts:
Scheme-name: schema name.
A combination of the main parts of the Opaque-part:uri; domain + path (pathname).
Fragment-identifier: Resource name [1].
For example, in HTTP mode, the URI for device Switch is:
http://www.paper.edu.cn
-2-
http://www.togest.com/jqsscada/Tang Shandong #switch where HTTP is the schema name; www.togest.com is the domain name,
/jqsscada/Tang Shandong, for the path, both add up is Opaque-part;switch is the resource name.
2.2 Resource Identifier ResourceID
The ResourceID is a compact, fixed-length alternative to URIs. In duplicate URI parsing, comparing and finding these are resource-intensive
Place, its introduction can make the DAF achieve higher performance, ResourceID can also simplify the implementation of DAF.
ResourceID sub-container and fragment two parts, both of which are 64-bit long integer, when processing large
Group associated resources and composite data sources, ResourceID's two domains are used to further improve the efficiency of the implementation. Container
and the fragment field correspond to the domain in the URI reference.
ResourceID are grouped according to containers, and in systems that contain multiple data sources, two of the following cases
ResourceID have the same container, different fragment values:
The same data source is assigned two ResourceID and can be
Resourceidservice converts URIs and ResourceID to each other.
When converted to a URI, two ResourceID produce the same scheme-name and Opaque-part [1].
Another implementation should ensure that the attribute values of two resources that have the same container value as the data source are from the same data source being
Get. The Container field corresponds to the body of the uri-reference, and the Fragment field corresponds to Fragment-identifier.
2.3 Assigning Resource Identifiers
In the DAF implementation, the resources and ResourceID are one by one corresponding. In order to ensure uniqueness, there are multiple data sources
In case of participation, DAF must coordinate the Container value in the ResourceID. The Container value in ResourceID
Generated when the system is initialized or configured. The method of generating the Container value is not within the DAF specification.
However, each data source must allocate fragments on its own. Therefore, in the URI reference, the Fragment-identifier is
Independently allocated and interpreted in the resource. Similar ResourceID fragment are also allocated in container.
2.4 URI converted to resource identifier
Uri-reference and resources are many-to-one relationships, and a uri-reference specifies a unique resource, but
A given resource can have several uri-reference. In the DAF implementation, the uri-reference of each resource
is different, which is the URI returned by Resourceidservice when ResourceID is converted.
Instead, Resourceidservice must be able to convert different uri-reference into ResourceID. This depends on the actual
Whether the Resourceidservice can convert uri-reference of the same resource into the same ResourceID.
2.5 Resource Identification Service
The user of the client generally only knows the URI of the resource being looked at does not know the ResourceID of the corresponding resource, or got
ResourceID also does not know the URI it represents, which requires resourceidservice to navigate, which can
The source identifier and URI are converted to each other. This way, from the client's perspective, there is an exact resource tag in a given environment
Services. Each data source implements this set of interfaces and is ready to use this interface to access other data sources. It consists of two interfaces:
Query ResourceID based on URI Get_resource_ids () and Get_uris () of the URI according to the ResourceID query.
3. Implementation of Resourceidservice Services
First, this article proposes that the URI format is as follows:
<schema-name> ': ' <opaque-part ' # ' <fragment-identifier> which:
http://www.paper.edu.cn
-3-
Schema-name: tentative for HTTP;
Opaque-part: Unified format for/www.togest.com/scada, such as
Www. Togest.com/scada;
Fragment-identifier: There are 3 kinds of forms,
1) for class: The name of the resource, such as: Class:breaker
2) for property: Name of the resource. Attribute name, such as: property:Breaker.ampRating
3) for Resourceinstance: The name of the resource instance, the value of the name attribute for the resource instances, with the slash "/"
Open, such as: Resourceinstance:company.fpl/substation.0-ind-r/breaker. The complete URI of the CB is shown in the following example
Shown
http://www. Togest.com/scada#class:breaker
http://www. Togest.com/scada#property:breaker. Amprating
http://www.togest. Cn/jqsscada#resourceinstance:
Company_a/substation1/breaker1
In this paper, we use the persistence layer framework to block the database-side implementation details, and consider the SCADA database
characteristics, the following treatment is done on ResourceID:
1) The value of container is unified as SCADA.
2) Fragment is the true object identifier OID in the system, and has "object identity in instances of all classes
Unique levels of uniqueness.
3) ResourceID represents the virtual OID of all resource instances, during the conversion from URI to ResourceID,
Automatically generated based on the fragment value and combined with the established container value. Since fragment has "in an instance of all classes
Object identity is unique, so in order to speed up the query, the fragment should contain a total of two
Class information (CID) and class instance (specific resource) information (RID). With these two messages, you can quickly locate the fragment,
That is, locating ResourceID.
4) C1assid represents a virtual OID of a resource class, and its fragment function and setting are basically the same as above, but
Simply include one message, the class information (CID), and the content of the RID is set to 0 uniformly.
5) PropertyId represents a virtual OID for a property of a resource class. The fragment of PropertyId is still in accordance with the previous law
Set, contains two information: class information (CID) and class attribute information (PID).
6) CID represents a resource class in the database of the actual ID, 32-bit int, and the name of the class and other information stored together
Within a separate Class table. The table does not need to be associated with the corresponding tables in the database for each class. When used, the pass-through
The reflection mechanism over Java looks up the CID for that class based on the name of the class being called. The CID is automatically produced by the ID auto-generator
Health
7) The PID represents the actual ID of a property in the database, the 32-bit int type, and the name of the property, the data type
and other information is stored in the property table. This table has a n:1 relationship with the Class table. PID is also automatic by ID
Generator to generate automatically.
8) The RID represents the actual ID of a resource instance in the database, and the 32-bit int type. By inheriting for each tree, you can
The tree sets an ID auto generator that comes from the generated RID, thus guaranteeing the uniqueness of the RID at the class level. Also
You can create a dedicated ID auto generator for each class to guarantee RID uniqueness in instances of a single class.
9) The function of PID and RID is same, can combine with CID to realize PropertyId uniqueness or
The uniqueness of ResourceID in instances of all classes.
10) Take the ResourceID process as an example: in the process of converting URIs to ResourceID, the CID
and RIDs are converted to string 32-bit 16 digits, which are 2 characters that are composed of 8 16 binary digits respectively
http://www.paper.edu.cn
-4-
String. The 2 strings are then combined into 1 strings consisting of 16 16 binary digits, so that the new string's
Total length up to 64 bits. Then use the Java wrapper class long to convert this 64-bit 16 binary number to a bit 64-bit long
Type number, which is the long type fragment. Finally, based on the previously obtained fragment value and the set Containe:
Value to build an instance of ResourceID. Reverse these steps to get the ResourceID-to-URI conversion,
ResourceID the process of being parsed.
One) The parsing process of the Resourceld is shown in Figure 1 (reversing the arrows in Figure 1, the start and end flags, which is
ResourceID of the production process).
Figure 1 The parsing process of ResourceID
ResourceID The advantage of this design is that you only need to store the OID of the class instance in the table corresponding to each class, and
A single table manages the c1assid of all classes and does not require an additional table to hold the OID for all instances of all classes.
It saves database space, reduces some association relationships, reduces database maintenance, and significantly improves data
Library query performance. Use RID as the OID of the class instance, that is, does not affect the ResourceID in the IEC-61970 standard API
is also easy to use as a primary key in other non-EMS applications involving the SCADA database, making it particularly suitable for
In the business application of the SCADA database built on CIM.
The Java reflection mechanism was used during the ResourceID to URI conversion. Reflection is accessing Java at run time
A method of class information that can be used to access fields and methods in a class instance, providing a way to run the class
A method that dynamically hooks together without having any source code links between classes.
[2], the results table of the limit test for reference [3]
"The use of reflection is slower than the method of direct access", but reflection gives the program a powerful flexibility to reflect
It is a very powerful Java to enable the program to have great flexibility and to realize the dynamic selection of program flow.
Characteristics.
In the process of realizing Resourceidservice, this paper designs Cimclass, Cimproperty and a general
Tool Class Cimresource.
1) Cimclass: The class information used to save the resource, including the name and CID of the class, and the CID as the Cimclass
http://www.paper.edu.cn
-5-
The OID itself, established in the database sequence automatically generated. The starting value for this sequence is 1 and the maximum value is
19999, the step size is 1.
2) Cimproperty: The attribute information used to save the resource, including the name of a property PID and the owning resource
Class of CID. With the PID as the OID, the same sequence, with a starting value of 20000, the maximum value of 199999, step
The length is 1.
3) Cimresource: Abstract information used to describe a resource instance, such as the RID of each instance, and provide a
Common public methods. The main methods of Cimresource include:
Cimresource (String URI): Public constructor, URI is an ingress parameter.
Opensession () and CloseSession (): Private methods, managing connection and deallocation of databases.
Endofuri (String URI): Private method, initial parsing URI. If the URI represents a class, the return value is URI
The name of the class represented; otherwise, the return value is the class name that the URI contains. property name or class name. The name of the resource instance
Property value/class name. The Name property value of the resource instance ... ".
Parseuritoclassname (): Private method, based on the return value of Endofuri (), determines whether the URI represents a class,
A property, or a resource instance, with the class name of the class to which the class name or attribute (or resource instance) belongs, and then select
Choose Genclassid (), Genpropertyid () or Genresourceid () to get cid,pid or rids.
GetClassID (Map uriinfo): A private method that finds the CID of a class based on the name of the class in the URI.
Getpropertyid (): A private method that finds the PID of a property based on the attribute information and the class name in the URI.
Genresourceid (): A private method that recursively checks based on the resource instance path in the URI, including the class name of each level class
Find the corresponding RID.
Tocimclassid (): Private method, based on ResourceID to obtain the class of CID.
Tovalueorproperty (): A public method that obtains the RID of a resource instance or a property based on ResourceID
Pid.
genfragment (int CID, int RID): Private method, based on the actual CID and RID (or PID) stored in the database
Generates a ResourceID (or c1assid, or PropertyId fragment section.
Parsefragment (long fragment, int flag): Public method, according to ResourceID (or PropertyId, or
C1ASSID) fragment part and flag identification, which resolves the RID (or PID) and CID from the fragment. If flag=0,
The CID is resolved, and if flag=1, the RID (or PID) is resolved. For C1assid, the resolved RID is 0.
Getresourceld (): A public method that encapsulates the full conversion process of URI to ResourceID, the return value is the corresponding
To the URI of the ResourceID (or PropertyId, or c1assid).
Through the encapsulation, parsing and using of the Cimresource class to the internal logic of Resourceidentifierservice
The process of ResourceID has become very concise and clear. The following examples illustrate:
String uri=http://www. Togest. Cn/scada#property:breaker. amprating;
Cimresource cr=new Cimresource (URI);
ResourceID r_ id=new Resourceld ();
R_ Id=cr.getresourceld ();
4. Conclusion
In this paper, the structure of the ResourceID and the structure of the URI to start with the SCADA system as an example,
, then illustrates the parsing process of the ResourceID in the form of a legend. Then by designing the Cimclass,
Cimproperty and a generic tool class Cimresource to implement Resourceidservice services for other
The implementation of the interface such as query service completes the basic service work.
http://www.paper.edu.cn
-6-
Reference documents
[1] OMG. Utility Management System (UMS) Data Access facility,version 2.0
[2] Deepak Alur,john Crupi,dan MALKS.J2EE core model (core EE Patterns best Practices anddesign strategies).
Beijing: Science Press, 2004
[3] Dennis M.SOSNOSKI.IBM developerworks China website, the dynamic nature of Java programming, Part II: Introduction
into reflection, 2003,8
The design and implementation of DAF Resourceidservice
Tao Xin,gao Jinbiao
East China Jiao Tong University,nanchang (330013)
Abstract
ResourceID is up to types data, used for the identification of uniqueness resources
System, Resourceidservice serves and is an important service interface of DAF, with offered
ResourceID and Text Form URI (Uniform Resource Identifier) Method to transform each other, the ones
That has guaranteed ResourceID is correct and analytic, so design and realize the great convenience,
Efficiency brought in visit of the resources of this interface.
Keywords:daf;cis;iec61970;cim
Data Access tool The interface design and implementation of Resourceidservice service in DAF