Method, system, equipment and medium for analyzing RB source file and writing RB source file into real-time database

By analyzing RB source files and storing data using arrays, parsing and writing to the real-time database in real time, the delay and timeliness problems in traditional power prediction methods are solved, and efficient data writing and processing is achieved.

CN120011434APending Publication Date: 2025-05-16BEIJING HUANENG XINRUI CONTROL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510071311.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

Traditional power prediction methods have problems of large delays and poor data ageing, especially when real-time and accuracy requirements are high in power systems. At the same time, how to efficiently write prediction results to a real-time database is also a technical challenge.

Method used

By analyzing the RB source file, the array map[] and array time[] are used to store power prediction ultra-short-term data and time data, and the data is written to the real-time database through real-time parsing. The specific steps include initializing the basic configuration, reading the time fields in the RB source file, judging the time consistency and copying the data to the array map[], and finally using the big-endian packaging method to convert the data into binary and write to the database.

Benefits of technology

It realizes efficient writing of power prediction results into a real-time database, with fast processing speed, guaranteed data timeliness and integrity, solving the problem of delay and timeliness in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120011434A_ABST
    Figure CN120011434A_ABST
Patent Text Reader

Abstract

The invention discloses a method, system and equipment for analyzing an RB source file and writing the RB source file into a real-time database and a medium. The method comprises the steps that basic configuration is initialized; an array map [] and an array time [] are established, the array map [] is used for storing power prediction ultra-short-term data, and the array time [] is used for storing time data; dividing the part below the suffix name in the file name of the power prediction RB file into lines, and writing the divided first data and second data into an array time []; reading the time field of each row in the power prediction RB source file in sequence, judging whether the read time is consistent with the time in the time [], and copying the power prediction ultra-short-term data in the array time [] to the array map [] when the read time is consistent with the time in the time []; and writing the data in the array map [] into the real-time database. The method, the system, the equipment and the medium can efficiently write the power prediction result into the real-time database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing and database management, and relates to a method, system, device and medium for parsing RB source files and writing them into a real-time database. Background Art

[0002] In the power system, power forecasting is an important basis for ensuring the stable operation of the power grid and optimizing dispatching decisions. With the development of smart grids, the real-time and accuracy requirements for power forecasting are getting higher and higher. Traditional methods mostly use batch processing to process power forecasting data, which has problems such as large processing delays and poor data timeliness. In addition, due to the huge amount of data in the power system, how to efficiently write the forecast results into the real-time database is also one of the current technical challenges. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a method, system, device and medium for parsing RB source files and writing them into a real-time database. The method, system, device and medium can efficiently write power prediction results into the real-time database.

[0004] In order to achieve the above object, the present invention adopts the following technical scheme:

[0005] In one aspect of the present invention, the method for parsing RB source files and writing them into a real-time database according to the present invention comprises:

[0006] Initialize basic configuration;

[0007] Create array map[] and array time[], where array map[] is used to store ultra-short-term power prediction data, and array time[] is used to store time data;

[0008] Separate the suffix of the power prediction RB file with an underscore, and write the first and second data after the separation into the array time[].

[0009] Read the time field of each line in the power prediction RB source file in turn, and determine whether the read time is consistent with the time in time[]. If they are consistent, copy the power prediction ultra-short-term data in the array time[] to the array map[].

[0010] Write the data in the array map[] into the real-time database.

[0011] The method for parsing RB source files and writing them into a real-time database according to the present invention is further improved in that:

[0012] Furthermore, the process of initializing the basic configuration is:

[0013] Bind the server's IP address and port number;

[0014] Configure the user and password (security credentials) of the real-time database;

[0015] Bind the IP address and port number of the real-time database;

[0016] Specify the path to the power prediction RB source file.

[0017] Further, the process of dividing the suffix in the file name of the power prediction RB file by an underscore is as follows:

[0018] Use the split function to separate the suffix in the file name of the power prediction RB file with an underscore.

[0019] Furthermore, the process of writing the data in the array map[] into the real-time database is:

[0020] By using the big-endian packing method, the data in the array map[] is converted into binary to obtain binary data;

[0021] The binary data is written into a real-time database.

[0022] Furthermore, it also includes: reading the total number of lines n of the power prediction RB source file.

[0023] In a second aspect of the present invention, the system for parsing RB source files and writing them into a real-time database according to the present invention comprises:

[0024] Initialization module, used to initialize basic configuration;

[0025] Establish a module for establishing an array map[] and an array time[], wherein the array map[] is used to store ultra-short-term power prediction data, and the array time[] is used to store time data;

[0026] The segmentation module is used to segment the suffix of the file name of the power prediction RB file with an underscore, and write the first and second data after segmentation into the array time[].

[0027] The copy module is used to read the time field of each line in the power prediction RB source file in turn, and determine whether the read time is consistent with the time in time[]. If they are consistent, the power prediction ultra-short-term data in the array time[] is copied to the array map[].

[0028] The first writing module is used to write the data in the array map[] into the real-time database.

[0029] Furthermore, the initialization module includes:

[0030] The first binding module is used to bind the IP address and port number of the server;

[0031] Configuration module, used to configure the user and password of the real-time database;

[0032] The second binding module is used to bind the IP address and port number of the real-time database;

[0033] Specify the module used to specify the power prediction RB source file path.

[0034] Furthermore, the first writing module includes:

[0035] The conversion module is used to convert the data in the array map[] into binary by using the big-endian packaging method to obtain binary data;

[0036] The second writing module is used to write the binary data into the real-time database.

[0037] In a third aspect of the present invention, the computer device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for parsing the RB source file and writing it into a real-time database are implemented.

[0038] In a fourth aspect of the present invention, the computer-readable storage medium of the present invention stores a computer program, and when the computer program is executed by a processor, the steps of the method for parsing the RB source file and writing it into a real-time database are implemented.

[0039] The present invention has the following beneficial effects:

[0040] The method, system, device and medium for parsing RB source files and writing them into a real-time database described in the present invention read the time field of each line in the power prediction RB source file in turn during specific operation, and determine whether the read time is consistent with the time in time[]. When they are consistent, the power prediction ultra-short-term data in the array time[] is copied to the array map[]. That is, a real-time parsing method is adopted, and the processing speed is faster, so that the power prediction results can be efficiently written into the real-time database.

[0041] Furthermore, by using the big-endian packing method, the data in the array map[] is converted into binary to obtain binary data, and then the binary data is written into the real-time database to maintain the integrity and standardization of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0043] Figure 1 This is a schematic diagram of a power prediction RB source file in Example 2;

[0044] Figure 2 The present invention is a flow chart of the method. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0047] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0048] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.

[0049] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0050] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0052] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0053] Embodiment 1

[0054] refer to Figure 1 The method for parsing RB source files and writing them into a real-time database according to the present invention comprises the following steps:

[0055] 1) Initialize basic configuration;

[0056] The process of step 1) is:

[0057] 11) Bind the server's IP address and port number;

[0058] 12) Configure the user and password (security credentials) of the real-time database;

[0059] 13) Bind the IP address and port number of the real-time database;

[0060] 14) Specify the power prediction RB source file path for real-time parsing of the RB source file.

[0061] 2) Establish a measurement point array;

[0062] The process of step 2) is:

[0063] 21) Establishing an array map[], wherein the array map[] is used to store power prediction ultra-short-term data;

[0064] 22) Create an array time[], where the array time[] is used to store time data.

[0065] 3) Read the file name;

[0066] 31) Use the split function to split the suffix in the power prediction RB file name with an underscore “_”, and store the first and second data after the split in the array time[].

[0067] 4) Read the total number of lines n of the RB source file;

[0068] Traverse the total number of lines in the RB source file to get n.

[0069] 5) Determine whether the time is consistent;

[0070] Read the time field in the first line of the power prediction RB source file, and determine whether the read time is consistent with the time in the array time[]. If the read time is consistent with the time in the array time[], copy the two elements of the array time[] to the array map[].

[0071] 6) Loop through and put all predicted data values ​​into the array map[];

[0072] The process of step 6) is:

[0073] 61) Set index idx, where idx=n-4.

[0074] 62) For loop traverses, starting i from 3 to n.

[0075] 63) Use the Fields function to get the predicted data value of the third column in each row of the array time[].

[0076] 64) Add the predicted data values ​​one by one to the array map[];

[0077] 7) Write to real-time database

[0078] 71) By using the big-endian packing method, the data in the array map[] is converted into binary to obtain binary data;

[0079] 72) Write the binary data into a real-time database.

[0080] Embodiment 2

[0081] In this embodiment, the power prediction RB source file is as follows: Figure 1 As shown, the method for parsing RB source files and writing them into a real-time database according to the present invention comprises the following steps:

[0082] 1) Initialize basic configuration;

[0083] The process of step 1) is:

[0084] 11) Bind the server's IP address and port number;

[0085] Specifically, bind the server's IP address and port number: https:127.0.0.1:8200.

[0086] 12) Configure the user and password (security credentials) of the real-time database;

[0087] 13) Bind the IP address and port number of the real-time database;

[0088] Specifically, bind the IP address and port number of the real-time database: https:127.0.0.1:8081.

[0089] 14) Specify the power prediction RB source file path for real-time parsing of the RB source file.

[0090] 2) Establish a measurement point array;

[0091] The process of step 2) is:

[0092] 21) Create an array map[] with a size of 18, where the array map[] is used to store power prediction ultra-short-term data.

[0093] 22) Create an array time[] with a size of 2, where the array time[] is used to store time data.

[0094] 3) Read the file name (XHGF_20240703_043000_CDQ.RB)

[0095] 31) Use the split function to split the suffix in the file name with an underscore “_”, and store the first and second data after the split in the array time[].

[0096] At this time, the data stored in the array time[] is [20240703,043000].

[0097] 4) Read the total number of lines n of the RB source file;

[0098] Traverse the total number of lines in the RB source file to get n.

[0099] 5) Determine whether the time is consistent;

[0100] By reading the time field in the first line of the RB source file, we can know whether the read time is consistent with the time in the array time[]. When the read time is consistent with the time in the array time[], the two elements of the array time[] are copied to the array map[].

[0101] 6) Loop through and put all predicted data values ​​into the array map[];

[0102] The process of step 6) is:

[0103] 61) Set index idx, where idx=n-4.

[0104] 62) For loop traverses, starting i from 3 to n.

[0105] 63) Use the Fields function to get the predicted data value of the third column in each row of the array time[].

[0106] 64) Add the predicted data values ​​one by one to the array map[];

[0107] For example, the data stored in the array map[] is: [20240703 043000 15.3314.5413.7512.9612.69 12.4312.1611.8911.7211.5513.28 14.12 12.75 12.63 12.91 10.23]

[0109] Including time, there are a total of 18 data elements.

[0110] 7) Write to real-time database

[0111] 71) By using the big-endian packing method, the data in the array map[] is converted to binary and the binary data is obtained: 61 33 149 211 160 65 117 71 174 65104 163 215 65 92 0 065 7992 41 6575 10 61 65 70 225 72 65 66 143 92 65 62 61 113 65 59 133 31 65 56204 20565 70 225 7272 65 66 142 72 65 66 14372 6566 14372 65 66 143 52 65 62123]

[0113] The first 8 bytes use the millisecond timestamp 1722025800 corresponding to 20240703,043000, and every 4 bytes thereafter represent a prediction data.

[0114] 72) Write the binary data into a real-time database.

[0115] Embodiment 3

[0116] The system for parsing RB source files and writing them into a real-time database according to the present invention comprises:

[0117] Initialization module, used to initialize basic configuration;

[0118] Establish a module for establishing an array map[] and an array time[], wherein the array map[] is used to store ultra-short-term power prediction data, and the array time[] is used to store time data;

[0119] The segmentation module is used to segment the suffix of the file name of the power prediction RB file with an underscore, and write the first and second data after segmentation into the array time[].

[0120] The copy module is used to read the time field of each line in the power prediction RB source file in turn, and determine whether the read time is consistent with the time in time[]. If they are consistent, the power prediction ultra-short-term data in the array time[] is copied to the array map[].

[0121] The first writing module is used to write the data in the array map[] into the real-time database.

[0122] As an implementation mode of the present invention, the initialization module includes:

[0123] The first binding module is used to bind the IP address and port number of the server;

[0124] Configuration module, used to configure the user and password of the real-time database;

[0125] The second binding module is used to bind the IP address and port number of the real-time database;

[0126] Specify the module used to specify the power prediction RB source file path.

[0127] As an implementation manner of the present invention, the first writing module includes:

[0128] The conversion module is used to convert the data in the array map[] into binary by using the big-endian packaging method to obtain binary data;

[0129] The second writing module is used to write the binary data into the real-time database.

[0130] The division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0131] Embodiment 4

[0132] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for parsing an RB source file and writing it into a real-time database are implemented, for example, comprising: initializing basic configuration; establishing an array map[] and an array time[], wherein the array map[] is used to store power prediction ultra-short-term data, and the array time[] is used to store time data; splitting the suffix in the file name of the power prediction RB file with an underscore, and writing the first data and the second data after the split into the array time[]; reading the time field of each line in the power prediction RB source file in turn, judging whether the read time is consistent with the time in time[], and when they are consistent, copying the power prediction ultra-short-term data in the array time[] into the array map[]; and writing the data in the array map[] into the real-time database. The memory may include a memory, such as a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk memory, etc. The processor, network interface, and memory are interconnected through an internal bus, and the internal bus may be an industrial standard architecture bus, a peripheral component interconnection standard bus, an extended industrial standard architecture bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory is used to store programs. Specifically, the program may include a program code, and the program code includes computer operation instructions. The memory may include a memory and a non-volatile memory, and provide instructions and data to the processor.

[0133] Embodiment 5

[0134] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for parsing RB source files and writing them into a real-time database are implemented, for example, including: initializing basic configuration; establishing an array map[] and an array time[], wherein the array map[] is used to store power prediction ultra-short-term data, and the array time[] is used to store time data; splitting the suffix in the file name of the power prediction RB file with an underscore, and writing the first data and the second data after the split into the array time[]; reading the time field of each line in the power prediction RB source file in sequence, judging whether the read time is consistent with the time in time[], and when consistent, copying the power prediction ultra-short-term data in the array time[] into the array map[]; writing the data in the array map[] into the real-time database. Specifically, the computer-readable storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may include random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include a read-only memory (ROM), a hard disk, a flash memory, an optical disk, a magnetic disk, etc.

[0135] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0136] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0137] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for parsing RB source files and writing them into a real-time database, characterized in that: include: Initialize basic configuration; Create array map[] and array time[], where array map[] is used to store ultra-short-term power prediction data, and array time[] is used to store time data; Separate the suffix of the power prediction RB file with an underscore, and write the first and second data after the separation into the array time[]. Read the time field of each line in the power prediction RB source file in turn, and determine whether the read time is consistent with the time in time[]. If they are consistent, copy the power prediction ultra-short-term data in the array time[] to the array map[]. Write the data in the array map[] into the real-time database.

2. The method for parsing RB source files and writing them into a real-time database according to claim 1, characterized in that: The process of initializing the basic configuration is: Bind the server's IP address and port number; Configure the user and password (security credentials) of the real-time database; Bind the IP address and port number of the real-time database; Specify the path to the power prediction RB source file.

3. The method for parsing RB source files and writing them into a real-time database according to claim 1, characterized in that: The process of dividing the suffix in the file name of the power prediction RB file with an underscore is as follows: Use the split function to separate the suffix in the file name of the power prediction RB file with an underscore.

4. The method for parsing RB source files and writing them into a real-time database according to claim 1, characterized in that: The process of writing the data in the array map[] into the real-time database is as follows: By using the big-endian packing method, the data in the array map[] is converted into binary to obtain binary data; The binary data is written into a real-time database.

5. The method for parsing RB source files and writing them into a real-time database according to claim 1, characterized in that: Also includes: The total number of lines n of the power prediction RB source file to read.

6. A system for parsing RB source files and writing them into a real-time database, characterized in that: include: Initialization module, used to initialize basic configuration; Establish a module for establishing an array map[] and an array time[], wherein the array map[] is used to store ultra-short-term power prediction data, and the array time[] is used to store time data; The segmentation module is used to segment the suffix of the file name of the power prediction RB file with an underscore, and write the first and second data after segmentation into the array time[]. The copy module is used to read the time field of each line in the power prediction RB source file in turn, and determine whether the read time is consistent with the time in time[]. If they are consistent, the power prediction ultra-short-term data in the array time[] is copied to the array map[]. The first writing module is used to write the data in the array map[] into the real-time database.

7. The system for parsing RB source files and writing them into a real-time database according to claim 6, characterized in that: The initialization module includes: The first binding module is used to bind the IP address and port number of the server; Configuration module, used to configure the user and password of the real-time database; The second binding module is used to bind the IP address and port number of the real-time database; Specify the module used to specify the power prediction RB source file path.

8. The system for parsing RB source files and writing them into a real-time database according to claim 6, characterized in that: The first writing module comprises: The conversion module is used to convert the data in the array map[] into binary by using the big-endian packaging method to obtain binary data; The second writing module is used to write the binary data into the real-time database.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for parsing the RB source file and writing it into a real-time database as described in any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for parsing RB source files and writing them into a real-time database as described in any one of claims 1 to 5 are implemented.