METHOD AND AN APPARATUS FOR SPLITTING AND RECOVERING DATA IN A POWER SYSTEM
First Claim
1. A method for splitting and recovering data in a power system, comprising:
- a database access layer calling interfaces TableOpen and TableGet corresponding to a first database to inquire in the first database when the database access layer receives a read request to a grid model and static parameters, wherein the input parameters of TableOpen are const char* app_name and const int table_no, and the input parameter of TableGet is char*field_name, and the output parameters of TableGet are char**field_buf_ptr and intbufsize, andthe database access layer calling an interface SelectSql corresponding to a second database to inquire in the second database by means of a data recovery unit DB_SERVICE when the database access layer receives a read request to historical data, wherein the input parameter of SelectSql is constchar*sql_str, and the output parameters of SelectSql are TSelectResultStru_outout_select result and SEQDBErrorStru_outout_db_error, whereinthe first database and the data recovery unit DB-SERVICE are set in a platform layer of the power system, and the first database and a second database constitute the whole database environment of the power system,the first database runs in the memory of the power system, which is consisted of the real-time image in the memory of a grid model and static parameters of the second database,the grid model, static parameters and historical data are stored in the second database,the access interfaces of the first and second databases are encapsulated in a database access layer,the data recovery unit DB-SERVICE is responsible for all of the associated read-write operations with the second database;
the data recovery unit DB_SERVICE calling a main thread of a service process db_commit to write the received historical data with time scale characters into different files one by one when it receives a write request, and storing these files in a hard drive according to time to form a set of file sequence, and calling another thread of the service process db_commit to judge the state of the second database, such that the another thread can access and parse the file sequence to write its content to the second database if the second database is normal, or otherwise the another thread be into a state of loop waiting,the data recovery unit DB-SERVICE calling a synchronization program DB_Modify_Server to write the real-time data from the first database to the second database as the historical data when it receives a synchronization request from the second database, and calling the synchronization program DB_Modify_Server to access the grid model and static parameters of the second database to update the first database when it receives a synchronization request from the first database, andthe accesses of the grid model, static parameters and historical data are encapsulated into different services in the data recovery unit DB_SERVICE.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and an apparatus for splitting and recovering data in a power system are provided in the invention. The method includes the steps of setting a first database and a data recovery unit in a platform layer of the power system. The first database runs in a memory of the power system and is composed of the real-time image in the memory of a grid model and static parameters of a second database. The first database is used to provide the inquiry service of the grid model and static parameters for the power system. The data recovery unit is responsible for all of the associated read-write operations with the second database. After data are written into, the data recovery unit stores the data as historical data according to the time scale characters, and writes the historical data to the second database when the second database is normal.
-
Citations
2 Claims
-
1. A method for splitting and recovering data in a power system, comprising:
-
a database access layer calling interfaces TableOpen and TableGet corresponding to a first database to inquire in the first database when the database access layer receives a read request to a grid model and static parameters, wherein the input parameters of TableOpen are const char* app_name and const int table_no, and the input parameter of TableGet is char*field_name, and the output parameters of TableGet are char**field_buf_ptr and intbufsize, and the database access layer calling an interface SelectSql corresponding to a second database to inquire in the second database by means of a data recovery unit DB_SERVICE when the database access layer receives a read request to historical data, wherein the input parameter of SelectSql is constchar*sql_str, and the output parameters of SelectSql are TSelectResultStru_outout_select result and SEQDBErrorStru_outout_db_error, wherein the first database and the data recovery unit DB-SERVICE are set in a platform layer of the power system, and the first database and a second database constitute the whole database environment of the power system, the first database runs in the memory of the power system, which is consisted of the real-time image in the memory of a grid model and static parameters of the second database, the grid model, static parameters and historical data are stored in the second database, the access interfaces of the first and second databases are encapsulated in a database access layer, the data recovery unit DB-SERVICE is responsible for all of the associated read-write operations with the second database;
the data recovery unit DB_SERVICE calling a main thread of a service process db_commit to write the received historical data with time scale characters into different files one by one when it receives a write request, and storing these files in a hard drive according to time to form a set of file sequence, and calling another thread of the service process db_commit to judge the state of the second database, such that the another thread can access and parse the file sequence to write its content to the second database if the second database is normal, or otherwise the another thread be into a state of loop waiting,the data recovery unit DB-SERVICE calling a synchronization program DB_Modify_Server to write the real-time data from the first database to the second database as the historical data when it receives a synchronization request from the second database, and calling the synchronization program DB_Modify_Server to access the grid model and static parameters of the second database to update the first database when it receives a synchronization request from the first database, and the accesses of the grid model, static parameters and historical data are encapsulated into different services in the data recovery unit DB_SERVICE.
-
-
2. An apparatus for splitting and recovering data in a power system, comprising:
-
a first database, a data recovery unit DB_SERVICE, and a second database, wherein the first database and the data recovery unit DB-SERVICE are set in a platform layer of the power system, and the first database and a second database constitute the whole database environment of the power system, the first database runs in the memory of the power system, which is consisted of the real-time image in the memory of a grid model and static parameters of the second database, the grid model, static parameters and historical data are stored in the second database, the access interfaces of the first and second databases are encapsulated in a database access layer, the first database is used to call its corresponding interfaces TableOpen and TableGet to inquire when the database access layer receives a read request to the grid model and the static parameters, the input parameters of TableOpen are const char* app_name and const int table_no, and the input parameter of TableGet is char*field_name, the output parameters of TableGet is char**field_buf_ptr and intbufsize, the first database is also used to write the real-time data of the first database to the second database as the historical data by means of a synchronization program DB_Modify_Server of the data recovery unit DB_SERVICE, the second database is used to call its corresponding interface SelectSql to inquire by means of the data recovery unit DB_SERVICE when the database access layer receives a read request to the historical data, the input parameter of SelectSql being constchar*sql_str, the output parameters being TSelectResultStru_outout_select_result and SEQDBErrorStru_outout_db_error, and the second database is also used to access the grid model and static parameters of the second database to update the first database by means of the synchronization program DB_Modify_Server of the data recovery unit DB_SERVICE, the data recovery unit DB_SERVICE set in a platform layer of the power system with the first database is responsible for all of the associated read-write operations with the second database, and the data recovery unit DB_SERVICE encapsulates the accesses of the grid model, static parameters and historical data into different services, and the data recovery unit DB-SERVICE is used for calling a main thread of a service process db_commit to write the received historical data with time scale characters into different files one by one when it receives a write request, and storing these files in a hard drive according to time to form a set of file sequence, and calling another thread of the service process to judge the state of the second database, such that another thread can access and parse the file sequence to write its content into the second database if the second database is normal, or otherwise the another thread be into the state of loop awaiting.
-
Specification