Transformer substation historical data storage method and device

By storing abnormal data into data files in the substation monitoring system and using the master-backup deployment and database status monitoring subthreads, data loss caused by the failure of the database master and backup nodes is solved, ensuring data integrity and reliability.

CN118916211APending Publication Date: 2024-11-08XUCHANG XJ SOFTWARE TECHNOLOGIES LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410880400.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

In the substation monitoring system, the failure of the database master node and the backup node simultaneously may lead to the loss of historical data.

Method used

The historical data storage service receives the data to be stored and stores it in the database. When the storage fails, the data is stored in the abnormal data list. After exceeding the set value, the data is saved in the data file and the database status monitoring sub- Threads ensure that the data is finally stored in the database.

Benefits of technology

It effectively avoids data loss caused by the simultaneous failure of the database master node and the backup node, and ensures data integrity and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916211A_ABST
    Figure CN118916211A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of transformer substation data processing, and particularly relates to a transformer substation historical data storage method and device. The method comprises the steps that a historical data storage service receives to-be-stored data and stores the to-be-stored data in a database, when the historical data storage service fails to store the data, the to-be-stored data which fails to be stored is stored in an abnormal data list, and when the data size in the abnormal data list exceeds a first set value, the to-be-stored data which fails to be stored is stored in the database; and storing the data in the abnormal data list in a data file, wherein the data file is stored in a server where the historical data storage service is located. The technical problem of data loss possibly caused by simultaneous failure of the main node and the backup node of the database in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of substation data processing, and in particular relates to a method and device for storing historical data of a substation. Background Art

[0002] In the substation monitoring system, historical data includes telemetry, remote pulse period sampling data, remote signal change historical data and system alarm data. When a system failure occurs, historical data plays an important role in fault analysis and diagnosis. When the historical storage service is abnormal or the master node and backup node of the database storing historical data fail at the same time, data loss may occur. Summary of the invention

[0003] The purpose of the present invention is to provide a method and device for storing historical data of a substation, so as to solve the technical problem in the prior art that simultaneous failure of a database master node and a backup node may lead to data loss.

[0004] To solve the above technical problems, the present invention provides a technical solution for a historical data storage method: a substation historical data storage method, the method comprising: a historical data storage service receives data to be stored and stores it in a database, when the historical data storage service fails to store data, the failed data to be stored is stored in an abnormal data list, when the amount of data in the abnormal data list exceeds a first set value, the data in the abnormal data list is saved in a data file, and the data file is stored on the server where the historical data storage service is located.

[0005] The beneficial effect of the above technical solution is that the technical solution of a historical data storage method of the present invention belongs to an improved invention. When an abnormality occurs in the database service, the storage service will be abnormal in saving data. At this time, the historical data storage service of the present invention will store the data to be stored that failed to be stored in the abnormal data list, and when the amount of data in the abnormal data list exceeds the first set value, the data in the abnormal data list will be saved in the data file, and the historical data storage service can save the data to be stored that failed to be stored through the saved data file. The present invention solves the technical problem in the prior art that the simultaneous failure of the database master node and the backup node may lead to data loss.

[0006] Furthermore, the historical data storage service monitors the connection status of the database through a database status monitoring sub-thread. When the database connection status is normal, the historical data storage service reads the data in the data file, stores the data in the data file in the database, and then deletes the data file whose data has been read.

[0007] Furthermore, the historical data storage service receives the data to be stored and stores it in the database in the following manner:

[0008] After receiving the data to be stored, the data to be stored is stored in a cache list, and the cache data is obtained and stored through the cache data acquisition sub-thread.

[0009] Furthermore, the historical data storage service is deployed in a master-slave mode, and the master-slave status of the historical data storage service in the current process is obtained through the master-slave module. If the historical data storage service currently in the master state is abnormal, the historical data storage service in the master state is changed to the backup state, and the historical data storage service in the backup state is changed to the master state;

[0010] The historical data storage service in the master state receives the data to be stored and stores it in the database, and after saving the data in the abnormal data list in the data file, synchronizes the data file to the server of the historical data storage service in the backup state.

[0011] Furthermore, the historical data storage service in the main state monitors the connection status of the database through the database status monitoring sub-thread. When the database connection status is normal, the historical data storage service in the main state reads the data in the data file and stores the data in the data file in the database, and then deletes the data file whose data has been read, and synchronously deletes the corresponding data file in the server where the historical data storage service in the backup state is located.

[0012] Furthermore, the database status monitoring sub-thread includes a periodic scheduled task or a message notification, and the historical data storage service determines the connection status of the database by means of the periodic scheduled task or the message notification.

[0013] Furthermore, the historical data storage service receives the data to be stored through a service interface or a message bus.

[0014] Furthermore, when the amount of data in the abnormal data list exceeds a first set value, the data in the abnormal data list is cleared.

[0015] Furthermore, before the historical data storage service exits, the function of saving cache data is called to save the data in the cache list in the database; and the function of saving abnormal data is called to save the data in the abnormal data list in the data file.

[0016] The present invention also provides a technical solution for a substation historical data storage device: a substation historical data storage device, including a historical data storage service and a database, the historical data storage service is deployed in a single machine or in a master-slave deployment, and the historical data storage service is used to execute computer program instructions to implement the substation historical data storage method as described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1is a schematic diagram of a device architecture in an embodiment of the present invention;

[0018] Figure 2 This is a flowchart of the historical data storage service in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] When an exception occurs in the database service, the storage service will have an exception in saving data. At this time, the historical data storage service of the present invention will store the data to be stored that failed to be stored in the abnormal data list, and when the amount of data in the abnormal data list exceeds the first set value, the data in the abnormal data list will be saved in the data file, and the historical data storage service can save the data to be stored that failed to be stored through the saved data file. The present invention solves the technical problem in the prior art that the simultaneous failure of the database master node and the backup node may lead to data loss.

[0020] Substation historical data storage device embodiment:

[0021] A substation historical data storage device, such as Figure 1 As shown, the device includes a historical data storage service and a database, wherein the historical data storage service is deployed as a primary and a backup, and the database is deployed as a single machine or a cluster. The historical data storage service is used to execute computer program instructions to implement the substation historical data storage method. Specifically, Figure 2 As shown, the substation historical data storage method is as follows:

[0022] The historical data storage service obtains the master-slave status through the master-slave module. When the historical data storage service is in the master state, it receives the data to be stored and stores the data in the cache list. It obtains the cache data in the cache data acquisition sub-thread and stores it. When the database has an exception or other circumstances cause the saving to fail, the data to be saved is stored in the abnormal data list. When the number of abnormal data lists exceeds the set value, the data in the abnormal data cache list is saved to the data file and synchronized to the designated directory of the historical data storage service server in the backup state through the file synchronization service. A sub-thread is created in the historical data storage service to periodically monitor the database status. If the database connection status is normal, the text data in the data file is read and the data storage interface is called for data storage. At the same time, the data files whose data have been read are deleted, and the file synchronization service synchronously deletes the data files with the same file name in the designated directory of the machine where the historical data storage service in the backup state is located.

[0023] The historical data storage service can be started on different servers respectively, and the active and standby service status of the current process can be obtained through the active and standby modules. When the module is the active module, historical data can be received through the message bus or service interface, and data caching and writing operations can be performed. The database can be deployed on a single machine or in a cluster. When the active service has an exception, the active and standby module changes the active service to the standby service, and the standby service status is changed to active. After the standby service switches to the active status, it receives data for historical storage.

[0024] When an exception occurs in the database service, an exception will occur in the data saved by the historical data storage service. The historical data storage service saves the abnormal data to the abnormal data list. When the number of data in the abnormal data list exceeds the first set value, the data in it will be saved to a data file, and the saved data file will be synchronized to the specified directory of the server where the backup service is located through the file service.

[0025] The main service determines the current database connection status through periodic timing tasks. When the connection status is normal, it obtains abnormal data from the data file and saves it. After successful saving, the corresponding saved data file is deleted. The server where the backup service is located synchronously deletes the data file with the same file name through the file synchronization service.

[0026] Historical data storage service processing flow: When the program is initialized, the master-slave module interface is called to determine the master-slave status. If it is not in the master state, a periodic judgment or message notification method is used to perform a master-slave status judgment cycle. If the service is in the master state, the data to be stored is received through the service interface or message bus and saved in the data cache. The program executes data storage cyclically to store the data in the historical data and the database. If the storage fails, the abnormal data is placed in the abnormal data cache list. When the data in the list reaches a certain amount, the data is saved in the data file and the data in the abnormal data list is cleared.

[0027] The historical data storage service periodically checks the database status through the database status monitoring sub-thread. If the database status is normal, it reads the abnormal data from the data file and stores the data by calling the historical data storage service to receive the data interface. After reading the data in the data file, the corresponding file is deleted. The server where the backup service is located synchronously deletes the data file with the same file name in the specified directory through the file synchronization service.

[0028] In other implementations, the database status monitoring sub-thread may also monitor the connection status of the database by means of message notification, and when the database connection status is normal, a notification message indicating that the connection status is normal is sent to the historical data storage service.

[0029] Before exiting, the historical data storage service calls the function of saving cache data in its program destructor to save the data in the cache list in the library; and calls the function of saving abnormal data to save the data in the abnormal data list in the data file.

[0030] Of course, in other implementations, the historical data storage service can be deployed on a single machine. In this case, after the data in the exception data list is saved in a data file, there is no need to back it up; accordingly, after the historical data storage service reads the data in the data file, there is no need to perform corresponding operations because there is no backup service.

[0031] Substation historical data storage method embodiment:

[0032] A method for storing historical data of a substation, the method comprising: a historical data storage service receives data to be stored and stores it in a database; when the historical data storage service fails to store data, the data to be stored that failed to be stored is stored in an abnormal data list; when the amount of data in the abnormal data list exceeds a first set value, the data in the abnormal data list is saved in a data file, and the data file is stored on a server where the historical data storage service is located. The specific method for storing historical data of a substation has been introduced in sufficient detail in the above-mentioned embodiment of the historical data storage device for a substation, and will not be repeated here.

[0033] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments without creative work, or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for storing historical data of a substation, It is characterized in that The method includes: a historical data storage service receives data to be stored and stores it in a database; when the historical data storage service fails to store data, the data to be stored that failed to be stored is stored in an abnormal data list; when the amount of data in the abnormal data list exceeds a first set value, the data in the abnormal data list is saved in a data file, and the data file is stored on a server where the historical data storage service is located.

2. The method for storing substation historical data according to claim 1, It is characterized in that The historical data storage service monitors the connection status of the database through a database status monitoring sub-thread. When the database connection status is normal, the historical data storage service reads the data in the data file, stores the data in the data file in the database, and then deletes the data file whose data has been read.

3. The method for storing substation historical data according to claim 1, It is characterized in that The historical data storage service receives the data to be stored and stores it in the database in the following ways: After receiving the data to be stored, the data to be stored is stored in a cache list, and the cache data is obtained and stored through the cache data acquisition sub-thread.

4. The method for storing substation historical data according to claim 1, It is characterized in that The historical data storage service is deployed in a master-slave mode. The master-slave module obtains the master-slave status of the historical data storage service in the current process. If the historical data storage service currently in the master state is abnormal, the historical data storage service in the master state is changed to the backup state, and the historical data storage service in the backup state is changed to the master state. The historical data storage service in the master state receives the data to be stored and stores it in the database, and after saving the data in the abnormal data list in the data file, synchronizes the data file to the server of the historical data storage service in the backup state.

5. The method for storing substation historical data according to claim 4, It is characterized in that The historical data storage service in the main state monitors the connection status of the database through the database status monitoring sub-thread. When the database connection status is normal, the historical data storage service in the main state reads the data in the data file and stores the data in the data file in the database, then deletes the data file whose data has been read, and synchronously deletes the corresponding data file in the server where the historical data storage service in the backup state is located.

6. The method for storing substation historical data according to claim 2 or 5, It is characterized in that The database status monitoring subthread includes a periodic timing task or a message notification, and the historical data storage service determines the connection status of the database through the periodic timing task or the message notification.

7. The method for storing substation historical data according to any one of claims 1 to 4, It is characterized in that The historical data storage service receives the data to be stored through a service interface or a message bus.

8. The method for storing substation historical data according to claim 3, It is characterized in that When the amount of data in the abnormal data list exceeds a first set value, the data in the abnormal data list is also cleared.

9. The method for storing substation historical data according to claim 3, It is characterized in that Before the historical data storage service exits, the cache data saving function is called to save the data in the cache list in the database; Call the save exception data function to save the data in the exception data list in the data file.

10. A device for storing historical data of a substation, It is characterized in that It includes a historical data storage service and a database. The historical data storage service is deployed in a single machine or in a master-slave deployment. The historical data storage service is used to execute computer program instructions to implement the substation historical data storage method as described in any one of claims 1 to 9.