A method and system for improving the efficiency of recording data and investigation of intelligent internet-of-things electric energy meters
By creating a multi-level directory structure in smart IoT energy meters and optimizing the record file length, the problem of low search efficiency when dealing with large amounts of data has been solved, resulting in faster data search speed and a better user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD
- Filing Date
- 2024-03-11
- Publication Date
- 2026-07-24
AI Technical Summary
In existing technologies, smart IoT energy meters suffer from low data search efficiency and poor user experience when recording large amounts of data, especially when MCU resources are limited, frequent access to and reading of files leads to slow search speed.
A storage structure is adopted that creates a first-level directory and multiple second-level subdirectories based on a preset time period. Business data is stored in chronological order, and the length of record files is optimized through a search time model to improve search efficiency.
By optimizing the storage structure and search logic, the data retrieval speed and efficiency of smart IoT energy meters at a specified time point have been significantly improved, enhancing the user experience.
Smart Images

Figure CN118227562B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology application technology, and more specifically, to a method and system for improving the efficiency of data retrieval from smart IoT energy meters. Background Technology
[0002] The smart IoT electricity meter is the latest smart electricity meter launched by the State Grid Corporation of China, and it is the first time that an operating system + file system + APP application model has been adopted on an electricity meter. On the one hand, considering the security of smart electricity use, the State Grid Corporation of China is responsible for the unified development of the operating system, file system, and core APP, providing a unified interface, while the meter manufacturers develop the corresponding business application APPs. On the other hand, due to cost control constraints, the MCU and other resources of the electricity meter are limited.
[0003] Smart meter applications require storing large amounts of different types of recorded data, such as minute-based, hourly, and daily data freezes. Minute-based data freezes, in particular, require high data density and long storage periods. In the early stages of the meter's operation, when the amount of stored data is small, the search speed is acceptable when accessing records through the file system. However, after the meter has been running for a period of time and the amount of recorded data has reached a certain level, the search efficiency of the recorded data decreases, resulting in a poor user experience.
[0004] In existing technologies, electricity meter records are required to be stored in chronological order, and subsequent searches are also based on the record time point as the tag. Under the current operating system and file system, the existing record data storage scheme creates directories according to record type. One directory is created for each type of record data, and all record files of that type are stored in the directory. When creating a single file, the maximum length supported by the system is used to reduce the number of record files.
[0005] However, with the large amount of data recorded by the electricity meter, after the electricity meter has been running for a while, a large number of files still need to be created in a single directory. When searching for the recorded data at a specific point according to the time tag, it is necessary to first locate the directory and file, and then read and compare the data in the file. Considering that the MCU resources are limited, the length of the records that can be read and temporarily stored each time is limited. Frequent access and reading of files are required, which makes the data search and retrieval speed slow and inefficient.
[0006] Therefore, a technology is needed to improve the efficiency of tracing data recorded by smart IoT energy meters. Summary of the Invention
[0007] The present invention provides a method and system for improving the efficiency of data retrieval from smart IoT energy meters, in order to solve the problem of how to improve the efficiency of data retrieval from smart IoT energy meters.
[0008] To address the aforementioned problems, this invention provides a method for improving the efficiency of data retrieval from smart IoT energy meters, the method comprising:
[0009] A first-level directory is created based on a preset time period, and multiple second-level subdirectories are created under the first-level directory;
[0010] Multiple record files are created in the second-level subdirectory, and these record files are used to store business data.
[0011] The business data records are stored in the corresponding record files in chronological order.
[0012] Based on the timestamp of the business data to be searched, the first-level directory and the second-level subdirectory are located sequentially. The stored business data is then searched in the record files of the located second-level subdirectories.
[0013] Preferably, the preset time period is minutes, hours, or days.
[0014] Preferably, the establishment of multiple record files in the secondary subdirectory further includes: establishing a search time model based on the maximum number of business data records that the record file can record and the single access time of the business data record; determining the length of the record file based on the search time model, so that the time for finding the business data record is optimized.
[0015] Preferably, the search time model includes:
[0016]
[0017] N = NUM max ÷M
[0018]
[0019] Among them, T max N represents the maximum time for recording business data; N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file; T1 is a constant representing the time to search the directory once; T2 is a constant representing the time to read the contents of a record file once; NUM MAX This is a fixed value, representing the maximum number of business data records that all record files can record.
[0020] Based on another aspect of the present invention, the present invention provides a system for improving the efficiency of data retrieval from smart IoT energy meters, the system comprising:
[0021] A creation unit is used to create a first-level directory based on a preset time period, and to create multiple second-level subdirectories under the first-level directory; multiple record files are created in the second-level subdirectories, and the record files are used to store business data;
[0022] Storage unit, used to store the business data records into corresponding record files in chronological order;
[0023] The lookup unit is used to locate the first-level directory and the second-level subdirectory in sequence based on the time tag of the business data to be searched, and then search for the stored business data in the record file of the located second-level subdirectory.
[0024] Preferably, the preset time period is minutes, hours, or days.
[0025] Preferably, the establishment unit, used to establish multiple record files in the secondary subdirectory, further includes: establishing a search time model based on the maximum number of business data records that the record file can record and the single access time of the business data record; and determining the length of the record file based on the search time model, so that the time for finding the business data record is optimized.
[0026] Preferably, the search time model includes:
[0027]
[0028] N = NUM max ÷M
[0029]
[0030] Among them, T max N represents the maximum time for recording business data; N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file; T1 is a constant representing the time to search the directory once; T2 is a constant representing the time to read the contents of a record file once; NUM MAX This is a fixed value, representing the maximum number of business data records that all record files can record.
[0031] In another aspect, the present invention provides a computer-readable storage medium storing a computer program for executing a method to improve the efficiency of data retrieval from smart IoT energy meters.
[0032] According to another aspect of the present invention, an electronic device is provided, characterized in that the electronic device includes: a processor and a memory; wherein,
[0033] Memory, used to store processor-executable instructions;
[0034] A processor is used to read executable instructions from memory and execute the instructions to implement a method for improving the efficiency of data retrieval from smart IoT energy meters.
[0035] This invention provides a method and system for improving the efficiency of data retrieval from smart IoT energy meters. The method includes: creating a primary directory based on a preset time period, and creating multiple secondary subdirectories under the primary directory; establishing multiple record files in the secondary subdirectories, where the record files are used to store business data; storing the business data records into the corresponding record files in chronological order; and locating the primary directory and secondary subdirectories sequentially based on the timestamp of the business data to be searched, and then searching for the stored business data in the record files of the located secondary subdirectories. This invention's business data storage scheme creates directories based on records, creating one directory for each type of data, storing all record files of that type within the directory, and using the maximum length supported by the system when creating individual files to reduce the number of record files. Attached Figure Description
[0036] Exemplary embodiments of the present invention can be more fully understood by referring to the following figures:
[0037] Figure 1 This is a flowchart illustrating a method for improving the efficiency of data retrieval from smart IoT energy meters according to a preferred embodiment of the present invention.
[0038] Figure 2 A system structure diagram according to a preferred embodiment of the present invention; and
[0039] Figure 3 This is a system structure diagram illustrating a preferred embodiment of the present invention for improving the efficiency of data retrieval from smart IoT energy meters. Detailed Implementation
[0040] Exemplary embodiments of the invention will now be described with reference to the accompanying drawings. However, the invention may be embodied in many different forms and is not limited to the embodiments described herein. These embodiments are provided to fully and completely disclose the invention and to fully convey its scope to those skilled in the art. The terminology used in the exemplary embodiments illustrated in the drawings is not intended to limit the invention. In the drawings, the same units / elements are referred to by the same reference numerals.
[0041] Unless otherwise stated, the terms used herein (including technical terms) have their common meaning as understood by one of ordinary skill in the art. Furthermore, it is understood that terms defined in commonly used dictionaries should be understood to have a meaning consistent with the context of their relevant field, and not to be interpreted as having an idealized or overly formal meaning.
[0042] Figure 1 This is a flowchart illustrating a method for improving the efficiency of data retrieval from smart IoT energy meters according to a preferred embodiment of the present invention.
[0043] This invention addresses the problem of low access and retrieval efficiency and poor user experience when frozen data is stored at a specified time point throughout the entire lifecycle of a smart IoT energy meter, especially after all record files are full.
[0044] This invention optimizes the structure of single-type data record files by creating second-level subdirectories and calculating the optimal record file length, thus minimizing the overall search time. When searching for records with a specified time stamp (minute), the search logic first locates the corresponding subdirectory and its corresponding file, then performs a secondary search within the file, thereby improving the efficiency of record retrieval by reducing the search time.
[0045] like Figure 1 As shown, the present invention provides a method for improving the efficiency of data retrieval from smart IoT energy meters, the method comprising:
[0046] Step 101: Create a first-level directory based on a preset time period, and create multiple second-level subdirectories under the first-level directory; preferably, the preset time period is minutes, hours or days.
[0047] Step 102: Create multiple log files in the second-level subdirectory. These log files are used to store business data.
[0048] Preferably, the creation of multiple record files in the second-level subdirectory further includes: establishing a search time model based on the maximum number of business data records that the record file can record and the single access time of the business data record; determining the length of the record file based on the search time model to optimize the time for finding business data records.
[0049] Preferably, the search time model includes:
[0050]
[0051] N = NUM max ÷M
[0052]
[0053] Among them, Tmax N represents the maximum time for recording business data; N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file; T1 is a constant representing the time to search the directory once; T2 is a constant representing the time to read the contents of a record file once; NUM MAX This is a fixed value, representing the maximum number of business data records that all record files can record.
[0054] like Figure 2 As shown, this invention establishes a three-level directory structure using minute-based freezing as an example.
[0055] Figure 2 Taking minute freeze records as an example, under the minute freeze directory, create two-level subdirectories, namely minute freeze subdirectory 1 to subdirectory N. Each subdirectory contains n separate minute freeze record files, and each record file stores m record data.
[0056] The total record search time in this invention is mainly divided into two parts: the time to search the file containing the record, and the time to search for the record at a specific time within the record file. Under the condition of limited MCU resources, both require multiple accesses to the file system. Taking binary search as an example, the time to search for the record at a specific time can be abstracted into the following mathematical model:
[0057] Formula 1:
[0058] Formula 2: N = NUM max ÷M
[0059] In the above formula, where:
[0060] T max This represents the longest recorded search time.
[0061] N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file.
[0062] T1 (a constant) represents the time required to search the file directory once; T2 (a constant) represents the time required to read the file content once.
[0063] NUM MAX (Fixed value) represents the maximum number of business data records that all record files can record.
[0064] The integrated data model is as follows:
[0065] In practical applications, considering the maximum number of frozen records and the single access time of the file system, the above formula is used to calculate T. max达到 Minimum is sufficient.
[0066] Step 103: Store the business data records into the corresponding record files in chronological order;
[0067] Step 104: Based on the timestamp of the business data to be searched, locate the first-level directory and the second-level subdirectory in sequence, and search for the stored business data in the record file of the located second-level subdirectory.
[0068] Figure 3 This is a system structure diagram illustrating a preferred embodiment of the present invention for improving the efficiency of data retrieval from smart IoT energy meters.
[0069] like Figure 3 As shown, this invention provides a system for improving the efficiency of data retrieval from smart IoT energy meters. The system includes:
[0070] The establishment unit 301 is used to create a first-level directory based on a preset time period, and to create multiple second-level subdirectories under the first-level directory; multiple record files are established in the second-level subdirectories, and the record files are used to store business data; preferably, the preset time period is minutes, hours or days.
[0071] Preferably, the establishment unit 301 is used to establish multiple record files in the second-level subdirectory, and further includes: establishing a search time model based on the maximum number of business data records that the record file can record and the single access time of the business data record, and determining the length of the record file based on the search time model so that the time for finding the business data record is optimized.
[0072] Preferably, the search time model includes:
[0073]
[0074] N = NUM max ÷M
[0075]
[0076] Among them, T max N represents the maximum time for recording business data; N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file; T1 is a constant representing the time to search the directory once; T2 is a constant representing the time to read the contents of a record file once; NUM MAX This is a fixed value, representing the maximum number of business data records that all record files can record.
[0077] Storage unit 302 is used to store business data records into corresponding record files in chronological order;
[0078] The lookup unit 303 is used to locate the first-level directory and the second-level subdirectory in sequence based on the time tag of the business data to be searched, and to search for the stored business data in the record file of the located second-level subdirectory.
[0079] The present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, the computer program being used to execute a method for improving the efficiency of data retrieval from smart IoT energy meters.
[0080] This invention provides an electronic device, characterized in that the electronic device includes: a processor and a memory; wherein,
[0081] Memory, used to store processor-executable instructions;
[0082] A processor is used to read executable instructions from memory and execute the instructions to implement a method for improving the efficiency of data retrieval from smart IoT energy meters.
[0083] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present invention can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0084] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0085] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0086] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0087] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0088] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
[0089] The invention has been described with reference to a few embodiments. However, as will be known to those skilled in the art, and as defined in the appended claims, other embodiments besides those disclosed above fall equivalently within the scope of the invention.
[0090] Generally, all terms used in the claims are to be interpreted according to their ordinary meaning in the art, unless otherwise expressly defined herein. All references to “a / the / the [device, component, etc.]” are openly interpreted as at least one instance of said device, component, etc., unless otherwise expressly stated. The steps of any method disclosed herein need not be performed in the exact order disclosed unless explicitly stated otherwise.
Claims
1. A method for improving the efficiency of data retrieval from smart IoT energy meters, the method comprising: A first-level directory is created based on a preset time period, and multiple second-level subdirectories are created under the first-level directory; Multiple record files are created in the second-level subdirectory. These record files are used to store business data. The creation of multiple record files in the second-level subdirectory also includes: establishing a search time model based on the maximum number of business data records that a record file can store and the single access time to a business data record; determining the length of the record file based on the search time model to optimize the time for finding the business data record; the search time model includes: Among them, T max N represents the maximum time for recording business data; N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file; T1 is a constant representing the time to search the directory once; T2 is a constant representing the time to read the contents of a record file once; NUM MAX This is a fixed value, representing the maximum number of business data records that all record files can record; The business data records are stored in the corresponding record files in chronological order. Based on the timestamp of the business data to be searched, the first-level directory and the second-level subdirectory are located sequentially. The stored business data is then searched in the record files of the located second-level subdirectories.
2. The method according to claim 1, wherein the preset time period is minutes, hours, or days.
3. A system for improving the efficiency of data retrieval from smart IoT energy meters, the system comprising: A creation unit is used to create a first-level directory based on a preset time period, and to create multiple second-level subdirectories under the first-level directory; Multiple record files are created in the second-level subdirectory. These record files are used to store business data. The method further includes: establishing a search time model based on the maximum number of business data records that the record file can store and the single access time of each business data record; determining the length of the record file based on the search time model to optimize the time for finding the business data record; the search time model includes: Among them, T max N represents the maximum time for recording business data; N represents the maximum number of record files; M represents the maximum number of business data records that can be recorded in a single record file; T1 is a constant representing the time to search the directory once; T2 is a constant representing the time to read the contents of a record file once; NUM MAX This is a fixed value, representing the maximum number of business data records that all record files can record; Storage unit, used to store the business data records into corresponding record files in chronological order; The lookup unit is used to locate the first-level directory and the second-level subdirectory in sequence based on the time tag of the business data to be searched, and then search for the stored business data in the record file of the located second-level subdirectory.
4. The system according to claim 3, wherein the preset time period is minutes, hours, or days.
5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for performing the method according to any one of claims 1-2.
6. An electronic device, characterized in that, The electronic device includes: a processor and a memory; wherein, The memory is used to store the processor-executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method of any one of claims 1-2.