Keywords

1 Introduction

With the in-depth development of the “double carbon” action, the State Grid Corporation of China is accelerating the construction of a new power system with new energy as the main body [1]. While large-scale access of new energy, new equipment and multiple loads, it poses new challenges to the data carrying capacity, real-time and security of the existing intelligent terminal equipment of the power system.

At present, the real-time data storage and processing of power system intelligent terminal mainly rely on embedded real-time database. Most of the existing embedded real-time database cores adopt open-source general products, which lack consideration of power model, especially the new power system intelligent terminal model, and there are great security risks, which affect the stability and security of power system.

In this paper, an implementation method of embedded real-time database for new power intelligent terminal is proposed, which takes dynamic connection library as the carrier, tree structure model as the modeling basis, separated storage as the data basis, memory mapping rules and improved breadth first search algorithm as the logical basis, and constructs a new power intelligent terminal environment with low energy consumption, high timeliness, high security and professional embedded real-time database.

2 Background and Related Work

2.1 Characteristic Analysis of New Power Intelligent Terminal

One of the main technical features of the new generation power system in the energy transformation is the multi energy complementarity between the power system and other energy systems [2], and one of its key cores is digitization. At the same time, for the power industry, the power intelligent terminal equipment is progressing day by day under the promotion of the policy of “new digital infrastructure”. The application scenario type and number of new power intelligent terminals represented by intelligent distribution terminals, intelligent vehicle charging piles and intelligent electricity meters [3] continue to grow. The integration of different types of terminals is imperative, and gradually presents the technical characteristics of “digitization”, “intelligence” and “integration”. The continuous upgrading of embedded technology, 5g network and other hardware and network technologies will further accelerate the integration process of power, energy and Internet of things.

In terms of digitization, under the new power system, in addition to the metering function of traditional electric energy meters, smart meters also have two-way multi rate metering function, user end control function, two-way data communication function of multiple data transmission modes [4], etc. The real-time data that needs to be stored and processed at the same time will increase exponentially. In the future, the measurement data acquisition frequency of smart meters will be further improved. Taking the power consumption information acquisition system as an example, the current data acquisition frequency of smart terminals has been increased from 1/360 to 1/15, and the amount of data has increased by 24 times. In terms of intelligence, the smart grid puts forward higher requirements for user side metering devices. On the one hand, it should be able to comprehensively monitor the real-time load of users and monitor the real-time load, voltage, current, power factor, harmonic and other grid parameters of each power terminal to ensure power supply; On the other hand, it is necessary to control the electric equipment, and select the appropriate time to automatically operate or stop according to the real-time electricity price of the system and the wishes of users, so as to realize the functions of peak shifting and valley filling. In terms of integration, due to the inseparable relationship among power terminals, 5g terminals and Internet of things terminals [5, 6], these infrastructure terminals can usually be integrated. For example, after the integration of power and Internet of things, an industrial Internet of things suitable for power grid, namely power Internet of things, will be formed, which will produce various types of intelligent integration terminal requirements.

Therefore, under the new power system, the power intelligent terminal needs to process a wider range of data, faster frequency and stronger timeliness requirements.

2.2 Relevant Research Work

The research on embedded real-time database abroad started earlier, among which the representative ones are Berkeley DB and SQLite. However, the research shows that their performance in real-time applications is poor [7]. At this stage, the domestic research on embedded real-time database mainly relies on open source database and focuses on application research. Among them, a real-time database implementation method for micro grid intelligent terminal [8] adopts MySQL database, which maps the data tables, fields and records constituting the real-time database to the memory of the intelligent terminal through file mapping to form a database entity. The disadvantage is that data access and submission need complex lexical and syntax analysis, and the CPU resource overhead is huge. The cross platform lightweight database packaging method and system based on mobile terminal [9] realizes the database operation on HTML page (IOS and Android), and solves the problem of repeated development of database operation functions on HTML page based on different mobile intelligent terminal platforms. The disadvantage is that the database adopts open source SQLite products, and the system security is not guaranteed. Design and implementation of embedded real-time database based on ARM platform [10] transplanted the traditional real-time database on ARM platform and realized the basic storage function. The disadvantage is that it needs to call a special interface and is lack of friendliness to the application of power equipment. At the same time, domestic researchers also try to use the embedded real-time operating system to solve the problem of real-time data storage of embedded devices, such as VxWorks, QNX, ucLinux and RTEMS. Since the embedded real-time system essentially belongs to the category of operating system, it is qualitatively different from the embedded real-time database. To sum up, the existing embedded real-time database in China is mainly a general relational database. There are many problems in the embedded equipment of power system, such as high system resource consumption, weak matching with the model of power intelligent terminal equipment, and unable to guarantee security.

3 Design and Implementation of Embedded Real-Time Database

3.1 Design Framework

The overall deployment of the embedded real-time database for the new power intelligent terminal described in this paper is shown in Fig. 1. It is divided into four layers from the outside to the inside, marked with serial numbers ①–④. The outermost layer is layer ①, which represents the entity of the new power system intelligent terminal equipment. It is composed of microprocessor, register, digital I/O interface and other units, which is used to carry the embedded operating system. Layer ② is the embedded container, usually the embedded container represented by docker, which is deployed in the embedded operating system to carry different embedded applications. Layer ③ is embedded application, usually data access application and embedded data center application, which are used to collect and store real-time data. Layer ④ is the embedded real-time database, which is embedded in the embedded application in the form of dynamic link library, coupled with the application through the database interface, does not occupy independent process handles, saves system resources to a great extent, and supports embedded and container deployment.

Fig. 1.
figure 1

Deployment diagram of embedded real-time database

The overall system structure of embedded real-time database for new power intelligent terminal is shown in Fig. 2. From bottom to top, the real-time database includes storage layer, model layer and application layer. The storage layer is used to store specific measurement type data, including storage interface, lightweight cache, data compression, data storage, resource optimization and other modules. The model layer is the object model management module, which is used to build and store the device model and associate it with the measuring points, including model interface, model algorithm and model storage modules. The application layer is used for data query and analysis, and provides application capabilities such as model construction and data access through the interface.

Fig. 2.
figure 2

Structure diagram of embedded real-time database system

3.2 Tree Structure Model Design

The traditional relational data model uses two-dimensional tables to represent the relationship between entities. In data modeling, it is necessary to split the data objects, store their respective information in the corresponding table fields, and connect each table when necessary. This model design generally has storage redundancy in power intelligent terminal. Due to the large amount of correlation calculation required for multi table connection, it needs to consume a lot of CPU system resources, which is easy to affect the performance and stability of embedded applications. According to the technical characteristics of the new power system intelligent terminal and combined with the design of the power equipment IOT terminal model, the object model management module in this paper realizes the organization and management function of the power intelligent terminal model by using the tree structure. As shown in Fig. 3, the tree structure includes leaf nodes and non leaf nodes, in which the non leaf nodes are used as the index of the tree. The leaf node records the measurement point ID when it is created and is associated with the measurement point ID of the database storage layer.

Fig. 3.
figure 3

Schematic diagram of tree structure model

In terms of model storage, this paper uses the improved document structure (i-json) storage device model to store the model in a document as a unit, supports array and document nesting, and the information to be split in the ordinary relational model is represented by a document. Based on the JSON (JavaScript object notation) structure, i-json optimizes and adds the complete path, node type and node attribute information of nodes, and supports nested structures and arrays. The specific structure definition is shown in the Table 1.

Table 1. I-json structure diagram.

The object model equipment attributes include dynamic attributes and static attributes. The dynamic attributes are used to describe the collected measurement type data of the equipment, including but not limited to three-phase current, three-phase voltage, active power, reactive power, etc. Static attributes are used to describe the file type data of equipment, including but not limited to serial number, attribute name, type, unit, collection cycle, etc. The specific equipment attributes are different according to the functions of intelligent terminal equipment.

3.3 Separate Storage Design

In order to reduce storage redundancy, this paper adopts a separate storage design, which separates the power IOT terminal model storage process from the collected data storage process, and separates the traditional measurement point model from the measurement data. The dynamic attribute management of power intelligent terminal is realized by hash algorithm, and the association relationship between equipment dynamic attributes and equipment measurement data is established and maintained by measuring point mapping rules.

The measurement point model and data compression storage of the storage layer are associated through the hash algorithm. The hash function adopts the executable link format function elfhash (extensible and linking format, ELF), takes the absolute length of the string as the input, and combines the decimal values of the characters through coding conversion to ensure that the generated measurement point ID positions can be evenly distributed, At the same time, it is convenient to locate the location according to the point name, and has high query performance. The model data association process is shown in Fig. 4.

Fig. 4.
figure 4

Schematic diagram of model data association mode

In addition, the tree model node of the model layer is associated with the measuring point model through the measuring point mapping rules, which is mainly combined into the full path equipment attribute according to the model path and node name, and is associated with the measuring point name in the measuring point model through this attribute. Generally, the full path equipment attribute combines the model path and node name through the path symbol “/”, and the measuring point name in the measuring point model is defined according to the combined equipment attribute. Since the path and node name can be used to describe the unique equipment attribute, the combined string can also define the unique measuring point name, so as to ensure the uniqueness of the measuring point.

3.4 Heads Improved Breadth First Search Algorithm

Considering that after the introduction of the tree structure, the access to the measured point data needs to be searched and located through the tree model, in order to improve the query performance and reduce the CPU resource consumption of the embedded system, the real-time database adopts the improved breadth first search (e-bfs) algorithm. First, access the starting vertex v, then start from V, access each unreachable adjacent vertex W1, W2, W3… Wn of V in turn, and then access all unreachable adjacent vertices of W1, W2,…, WI in turn. Then, start from these accessed vertices and perform pruning optimization by comparing the initials of adjacent node names with query conditions. Then access all their adjacent vertices that have not been accessed, and so on until all vertices on the way have been accessed. The specific implementation steps are shown in Fig. 5.

Fig. 5.
figure 5

Flow chart of e-bfs search algorithm

4 Performance Test

The test selected power secondary equipment terminal embedded ARM development board, processor armv7 processor Rev 2 (v7l), memory 240 MB and external memory 216 MB. Simulate the real-time data acquisition and storage connected to 100 power devices, with an average of 40 dynamic attributes for each device, and conduct data submission according to the second frequency. Compare and analyze the CPU resource utilization of the embedded system during the operation of the embedded real-time database (hs-ertdb) and SQLite database described in this paper. The test results are shown in Fig. 6.

Fig. 6.
figure 6

CPU resource usage

The experimental results show that in the process of data submission, the CPU resources of SQLite database fluctuate greatly and have low stability. The minimum utilization rate is 20%, the maximum is 80%, and the average utilization rate is about 45%. The hs-ertdb database CPU utilization realized in this paper has small fluctuation range and high stability. The average utilization rate is about 15%, and the CPU energy consumption in the same scenario is reduced by 30%.

5 Conclusion

In this paper, an embedded real-time database implementation method is proposed for the new power system intelligent terminal equipment, a lightweight power model construction scheme based on tree structure is proposed, a new power terminal model data separation storage mode is constructed, the model search algorithm is optimized, and the lightweight embedded real-time database is realized. Experiments show that the embedded real-time database realized by this method has good performance and low energy consumption, and is suitable for intelligent terminal equipment in new power system.