CN116303124B - Data searching method and device, electronic equipment and storage medium - Google Patents

Data searching method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116303124B
CN116303124B CN202310329602.0A CN202310329602A CN116303124B CN 116303124 B CN116303124 B CN 116303124B CN 202310329602 A CN202310329602 A CN 202310329602A CN 116303124 B CN116303124 B CN 116303124B
Authority
CN
China
Prior art keywords
time
data
searching
freezing
record
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310329602.0A
Other languages
Chinese (zh)
Other versions
CN116303124A (en
Inventor
郭永娟
丁文豪
顾志勇
蒋紫松
王佳琪
宫金超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Chint Instrument and Meter Co Ltd
Original Assignee
Zhejiang Chint Instrument and Meter Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Chint Instrument and Meter Co Ltd filed Critical Zhejiang Chint Instrument and Meter Co Ltd
Priority to CN202310329602.0A priority Critical patent/CN116303124B/en
Publication of CN116303124A publication Critical patent/CN116303124A/en
Application granted granted Critical
Publication of CN116303124B publication Critical patent/CN116303124B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a data searching method, a data searching device, electronic equipment and a storage medium, wherein the method comprises the following steps: according to the freezing period and the searching interval time of the data, calculating the effective searching interval time of the data, acquiring a starting freezing storage address and an ending freezing storage address of the data freezing record, respectively marking the starting freezing storage address and the ending freezing storage address as a first storage address and a second storage address, respectively marking the starting time and the ending time of a data searching time interval as a first time and a second time, calculating the storage addresses respectively corresponding to the first time and the second time based on the effective searching interval time of the data, respectively corresponding to the recorded storage addresses of the first time and the second time, determining a data searching address range based on the first storage address, the second storage address and the storage addresses respectively corresponding to the first time and the second time, searching the data in the data searching address range based on the effective searching interval time of the data, reducing the searching data quantity and greatly improving the data searching efficiency.

Description

Data searching method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of electronic electric energy meters, in particular to a data searching method and device, electronic equipment and a storage medium.
Background
Along with the development of electronic technology, internet technology and digital communication technology, intelligent energy consumption and safe electricity consumption business are rapidly developed in the electric power industry, so as to meet the real-time requirement of data acquisition, clear requirements are provided for response time and communication throughput of an electric energy meter in data acquisition, in response search of the traditional electric energy meter for frozen data acquisition, a dichotomy is mostly adopted for searching, the data volume of one year is 525600 records in 1 minute interval period under the requirement of large-capacity data storage, 21 searches are needed under the limit condition for searching record data of given time, external flash operation is needed to be read in each search, and the requirement of responding to an acquisition request command in 50ms cannot be met completely. Therefore, how to improve the data searching efficiency is a problem to be solved.
Disclosure of Invention
Therefore, the technical problem to be solved by the invention is to overcome the defect of low efficiency of the existing data searching, so as to provide a data searching method, a device, electronic equipment and a storage medium.
According to a first aspect, an embodiment of the present invention discloses a data searching method, wherein an effective data searching interval time is calculated according to a freezing period and a searching interval time of current data freezing; acquiring a starting freezing storage address and an ending freezing storage address of the data freezing record, and respectively marking the starting freezing storage address and the ending freezing storage address as a first storage address and a second storage address; determining the starting time and the ending time of a data effective searching time interval, and respectively recording the starting time and the ending time as a first time and a second time; calculating a third storage address corresponding to the first time and a fourth storage address corresponding to the second time based on the data effective search interval time; determining a data search address range based on the first, second, third, and fourth memory addresses; searching the data in the data searching address range based on the effective searching interval time of the data.
Optionally, determining the start time and the end time of the data valid search time interval, respectively denoted as a first time and a second time, includes: acquiring the starting time and the ending time of the data freezing record to form a first time interval; acquiring a data searching time interval, and recording the data searching time interval as a second time interval; and determining an intersection of the first time interval and the second time interval, marking the intersection as a data effective searching time interval, and marking the starting time and the ending time of the data effective searching time interval as first time and second time respectively.
Optionally, the calculating the effective searching interval time of the data according to the period of data freezing and the searching interval time includes: and calculating the least common multiple of the freezing period and the searching interval time of data freezing, and recording the least common multiple as the effective searching interval time of the data.
Optionally, the calculating, based on the data valid search interval time, the third storage address corresponding to the first time and the fourth storage address corresponding to the second time includes: respectively adjusting the first time and the second time to be integral multiple times corresponding to the data effective searching interval time, calculating the time of the next integral multiple of the first time after adjustment, calculating the time of the last integral multiple of the second time after adjustment, and determining a new data effective searching time interval; calculating the number of records between the starting time of the new data effective searching time interval and the corresponding time of the latest data freezing record in the data freezing record, and recording the number of records as a first record number, wherein the first record number represents the number of the data effective searching interval time of the starting time from the corresponding time of the latest data freezing record; calculating the number of records between the ending time of the new data effective searching time interval and the corresponding time of the latest data freezing record in the data freezing record, and recording the number of records as a second number of records, wherein the second number of records represents the number of the data effective searching interval time of the ending time from the corresponding time of the latest data freezing record; and according to the address corresponding to the latest data record and the length of each record, calculating based on the first record number to obtain a third storage address corresponding to the first time, and calculating based on the second record number to obtain a fourth storage address corresponding to the second time.
Optionally, the determining the data search address range based on the first storage address, the second storage address, the third storage address, and the fourth storage address includes: judging the front-back sequence of the storage positions of the first storage address and the second storage address in the storage space; if the storage position of the second storage address is in front of the storage position of the first storage address, acquiring the freezing record time corresponding to the starting address of the freezing storage space; comparing the freeze record time to a first time; if the freezing record time is less than or equal to the first time, the first storage address is adjusted to be a starting address of a data search address range, and a fourth storage address corresponding to the second time is adjusted to be an ending address of the data search address range; and if the frozen recording time is longer than the first time, adjusting a third storage address corresponding to the first time to be a starting address of the data searching address range, and adjusting the second storage address to be an ending address of the data searching address range.
Optionally, the searching the data in the data searching address range based on the data valid searching interval time includes: searching the data in the search address range based on the data effective search interval time; and determining the data corresponding to the effective searching interval time of the first data as target data.
Optionally, the method further comprises: comparing the start time of the data freeze record with the first time; if the starting time of the data freezing record is equal to the first time, comparing record data corresponding to the starting time of the data freezing record with target data, and authenticating the correctness of the target data; if the starting time of the data freezing record is smaller than the first time, performing second data searching from the step of acquiring a starting freezing storage address and an ending freezing storage address of the data freezing record to the step of searching the data in the data searching address range based on the effective data searching interval time, comparing the data obtained by the second data searching with the target data, and authenticating the correctness of the target data; and if the starting time of the data freezing record is longer than the first time, searching the data in the data searching address range based on the data effective searching interval time based on the starting freezing storage address and the ending freezing storage address of the obtained data freezing record, searching the third data from the starting freezing storage address of the data freezing record in the data freezing opposite direction, comparing the data obtained by the third data searching with the target data, and authenticating the correctness of the target data.
According to a second aspect, an embodiment of the present invention further discloses a data searching apparatus, where the apparatus includes: the interval time calculation module is used for calculating the effective searching interval time of the data according to the freezing period and the searching interval time of the current data freezing; the storage address acquisition module is used for acquiring a start frozen storage address and an end frozen storage address of the data frozen record, which are respectively marked as a first storage address and a second storage address; the time determining module is used for determining the starting time and the ending time of the data effective searching time interval and respectively recording the starting time and the ending time as first time and second time; a storage address calculation module, configured to calculate a third storage address corresponding to the first time and a fourth storage address corresponding to the second time based on the data valid search interval time; a search range determining module configured to determine a data search address range based on the first storage address, the second storage address, the third storage address, and the fourth storage address; and the data searching module is used for searching the data in the data searching address range based on the effective searching interval time of the data.
According to a third aspect, an embodiment of the present invention further discloses an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the steps of the data search method according to the first aspect or any alternative implementation of the first aspect.
According to a fourth aspect, an embodiment of the present invention also discloses a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the data search method according to the first aspect or any of the alternative embodiments of the first aspect.
The technical scheme of the invention has the following advantages:
according to the data searching method, the data effective searching interval time is calculated according to the freezing period and the searching interval time of the data, the starting freezing storage address and the ending freezing storage address of the data freezing record are obtained and recorded as the first storage address and the second storage address respectively, the starting time and the ending time of the data searching time interval are determined and recorded as the first time and the second time respectively, the storage addresses respectively corresponding to the first time and the second time are calculated based on the data effective searching interval time, the data searching address range is determined based on the first storage address, the second storage address and the storage addresses respectively corresponding to the first time and the second time, and the data in the data searching address range is searched based on the data effective searching interval time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart showing a specific example of a data search method according to an embodiment of the present invention;
FIG. 2 is a schematic block diagram of a specific example of a data search device in an embodiment of the present invention;
fig. 3 is a schematic diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In addition, the technical features of the different embodiments of the present invention described below may be combined with each other as long as they do not collide with each other.
The embodiment of the invention discloses a data searching method, as shown in fig. 1, which comprises the following steps:
and step 101, calculating the effective searching interval time of the data according to the freezing period and the searching interval time of the current data freezing.
Exemplary, embodiments of the present application follow a fixed freezing period T w Freezing the data at the same time according to a fixed search interval time T r The data is searched, the freezing period and the searching interval time can be the same or different, but repeated data exists between the data corresponding to each freezing time and the data corresponding to each searching interval time, for example, the freezing period of the data is 5 minutes, the data searching interval time is 10 minutes, the freezing period of the data can be used as the data effective searching interval time, if the calculated amount is required to be reduced, the data effective searching interval time can also be used as the data effective searching interval time according to the data searching interval time,by way of example only, it may be determined by itself according to the actual circumstances.
Step 102, acquiring a start frozen storage address and an end frozen storage address of the data frozen record, which are respectively marked as a first storage address and a second storage address.
Exemplary, embodiments of the present application may obtain the initial freeze storage address Addr of the data freeze record directly in the memory of the electric energy meter first And ending the frozen memory address Addr later Respectively denoted as first and second memory addresses.
Step 103, determining the starting time and the ending time of the data effective searching time interval, which are respectively marked as a first time and a second time.
Illustratively, the data valid search time interval T valid The method can be to select a certain time interval within the data freezing recording time, and only by way of example, the method can only ensure that the effective data can be searched based on the effective data searching time interval, and the starting time and the ending time of the effective data searching time interval are respectively marked as a first time and a second time.
Step 104, calculating a third storage address corresponding to the first time and a fourth storage address corresponding to the second time based on the data effective search interval time.
In an exemplary embodiment, if a certain time interval within the data freezing and recording time is selected as the data valid search time interval, whether the corresponding frozen data exists at the first time can be determined, if yes, the storage address of the frozen data can be directly obtained as the third storage address corresponding to the first time, and if not, the adjacent valid search time within the valid search time interval can be selected based on the data valid search interval, and the storage address of the frozen data corresponding to the valid search time can be determined as the storage address corresponding to the first time, and if not, the calculation of the fourth storage address corresponding to the second time can be obtained according to the method.
Step 105, determining a data search address range based on the first, second, third and fourth memory addresses.
In an exemplary embodiment of the present application, based on the first storage address, the second storage address, the third storage address, and the fourth storage address, an intersection of 4 storage addresses may be selected as a data search address range, where a position of the storage address is a start point of the data search address range, a position of the storage address is a subsequent position of the storage address is an end point of the data search address range, and the first storage address and the second storage address may also be directly selected as the start point and the end point of the data search address range, to determine the data search address range, which is merely used as an example.
And step 106, searching the data in the data searching address range based on the effective searching interval time of the data.
By way of example, the embodiment of the application searches the data search address range based on the effective data search interval time, can detect less search times, improves the search efficiency, and can be applied to data search frozen in the metering core minutes of the internet of things, data search frozen in the management core minutes of the internet of things, daily frozen record search, hour frozen record search or month frozen record search without limitation.
According to the data searching method, the data effective searching interval time is calculated according to the freezing period and the searching interval time of the data, the starting freezing storage address and the ending freezing storage address of the data freezing record are obtained and recorded as the first storage address and the second storage address respectively, the starting time and the ending time of the data searching time interval are determined and recorded as the first time and the second time respectively, the storage addresses respectively corresponding to the first time and the second time are calculated based on the data effective searching interval time, the data searching address range is determined based on the first storage address, the second storage address and the storage addresses respectively corresponding to the first time and the second time, and the data in the data searching address range is searched based on the data effective searching interval time.
As an optional embodiment of the present invention, the determining a start time and an end time of the data valid search time interval, respectively denoted as a first time and a second time, includes: acquiring the starting time and the ending time of the data freezing record to form a first time interval; acquiring a data searching time interval, and recording the data searching time interval as a second time interval; and determining an intersection of the first time interval and the second time interval, marking the intersection as a data effective searching time interval, and marking the starting time and the ending time of the data effective searching time interval as first time and second time respectively.
Exemplary, the embodiment of the present application obtains intervals of start and end times of the periodic freeze recording of data, denoted as T record Acquiring a data search time interval, denoted as T read The data searching time interval can be changed according to practical situations, for example, 1 hour, 1 day or 1 month, and the intersection of the time interval of periodically freezing and recording data and the data searching time can be obtained as the effective searching time interval of the data, which is defined as T valid Ensuring that the data can search effective data, if the time interval of the data periodic freezing record and the data searching time interval have no intersection, T valid And if the electric energy meter is in an invalid section, the data is frozen and no effective record exists, and at the moment, the electric energy meter directly responds to the unsolicited data and does not execute subsequent operations.
As an optional embodiment of the present invention, the calculating the effective search interval time of the data according to the period of data freezing and the search interval time includes: and calculating the least common multiple of the freezing period and the searching interval time of data freezing, and recording the least common multiple as the effective searching interval time of the data.
Illustratively, in the embodiment of the present application, after obtaining the period of data freezing and the search interval time, the period T of data freezing may be calculated w And search interval time T r Least common multiple T of (2) s I.e. the effective data searching interval time, such as 5 minutes for data freezing period and 10 minutes for data searching interval time, thenThe least common multiple is 10, so that the effective searching interval time of the data can be determined to be 10 minutes, and the data corresponding to 5 minutes and 15 minutes does not need to be searched, thereby reducing the workload of data searching.
As an optional embodiment of the present invention, the calculating, based on the data valid search interval time, the third storage address corresponding to the first time and the fourth storage address corresponding to the second time includes: respectively adjusting the first time and the second time to be integral multiple times corresponding to the data effective searching interval time, calculating the time of the next integral multiple of the first time after adjustment, calculating the time of the last integral multiple of the second time after adjustment, and determining a new data effective searching time interval; calculating the number of records between the starting time of the new data effective searching time interval and the corresponding time of the latest data freezing record in the data freezing record, and recording the number of records as a first record number, wherein the first record number represents the number of the data effective searching interval time of the starting time from the corresponding time of the latest data freezing record; calculating the number of records between the ending time of the new data effective searching time interval and the corresponding time of the latest data freezing record in the data freezing record, and recording the number of records as a second number of records, wherein the second number of records represents the number of the data effective searching interval time of the ending time from the corresponding time of the latest data freezing record; and according to the address corresponding to the latest data record and the length of each record, calculating based on the first record number to obtain a third storage address corresponding to the first time, and calculating based on the second record number to obtain a fourth storage address corresponding to the second time.
Exemplary, embodiments of the present application utilize a least common multiple T s For example, if the least common multiple of the data effective search interval time is 10 minutes, the first time may be adjusted to an integer multiple of 10 minutes, and the subsequent time of the first time is an integer multiple of 20 minutes, and the subsequent time is an integer multiple of 30 minutesThen the integral multiple time corresponding to the second time can be obtained, a new effective searching time interval of the data is determined, the storage address of the frozen record of the latest data is known, the number of the effective searching interval time difference between the integral multiple time corresponding to the first time and the time corresponding to the frozen record of the latest data can be calculated, and the number N of the first record is recorded 1 For example, if the first time is an integer multiple time corresponding to 10 minutes and the time corresponding to the latest data freezing record is an integer multiple time corresponding to 50 minutes, the number of first records may be calculated to be 4, the storage address corresponding to the first time may be calculated according to the length of each record, the storage addresses corresponding to the first time and the second time may be calculated based on the storage address of any data freezing record in the data storage space range, and the storage address corresponding to the second time may be calculated by using the method described above to obtain the number N of second records 2 And will not be described in detail herein.
As an optional embodiment of the invention, the determining the data search address range based on the first storage address, the second storage address, the third storage address, and the fourth storage address comprises: judging the front-back sequence of the storage positions of the first storage address and the second storage address in the storage space; if the storage position of the second storage address is in front of the storage position of the first storage address, acquiring the freezing record time corresponding to the starting address of the freezing storage space; comparing the freeze record time to the first time; if the freezing record time is smaller than or equal to the first time, the first storage address is adjusted to be a starting address of the data search address range, and the fourth storage address corresponding to the second time is adjusted to be an ending address of the data search address range; and if the freezing record time is longer than the first time, adjusting a third storage address corresponding to the first time to be a starting address of the data search address range, and adjusting a second storage address to be an ending address of the data search address range.
The periodically frozen storage space in the embodiments of the present application is illustratively fixed, and the start and end addresses are also fixed for security After the memory of the electric energy meter is cleared, the data is frozen from the initial address of the memory space to the final address of the memory space, the memory space can be regarded as a continuous annular space, the first memory address and the second memory address are needed to be judged in the front-back sequence of the memory space, if the memory position of the first memory address is in front of the memory position of the second memory address, the memory space is indicated to be not full, the first memory address is directly used as the initial address of the data search address range, the second memory address is used as the final address of the data search address range, if the memory position of the first memory address is behind the memory position of the second memory address, the freezing record time T corresponding to the initial address of the frozen memory space can be obtained 1 Comparison T 1 Comparing with the first time, if the freezing record time is less than or equal to the first time, adjusting the first storage address to be the starting address of the data search address range, and adjusting the storage address corresponding to the second time to be the ending address of the data search address range; if the freezing record time is longer than the first time, the storage address corresponding to the first time is adjusted to be the initial address of the data search address range, the second storage address is adjusted to be the end address of the data search address range, the data search address range can be more accurately determined by judging the front-back sequence of the first storage address and the second storage address in the storage space and then carrying out subsequent adjustment on the data search address range according to different conditions, and then the accuracy of data search is improved, by way of example only.
As an optional embodiment of the present invention, the searching the data in the data search address range based on the data valid search interval time includes: searching the data in the search address range based on the data effective search interval time; and determining the data corresponding to the effective searching interval time of the first data as target data.
Illustratively, according to the embodiment of the present application, based on the search address range obtained in the above step, the data search is performed based on the data valid search interval time, for example, as mentioned in the above embodiment, the frozen data corresponding to 10 minutes may be directly determined as the target data, when the data corresponding to the first data valid search interval time is determined as the target data, the following data may be continuously acquired based on the data search address range, which is merely by way of example.
As an optional embodiment of the present invention, the method further comprises: comparing the start time of the data freeze record with the first time; if the starting time of the data freezing record is equal to the first time, comparing record data corresponding to the starting time of the data freezing record with target data, and authenticating the correctness of the target data; if the starting time of the data freezing record is smaller than the first time, performing second data searching from the step of acquiring a starting freezing storage address and an ending freezing storage address of the data freezing record to the step of searching the data in the data searching address range based on the effective data searching interval time, comparing the data obtained by the second data searching with the target data, and authenticating the correctness of the target data; and if the starting time of the data freezing record is longer than the first time, searching the data in the data searching address range based on the data effective searching interval time based on the starting freezing storage address and the ending freezing storage address of the obtained data freezing record, searching the third data from the starting freezing storage address of the data freezing record in the data freezing opposite direction, comparing the data obtained by the third data searching with the target data, and authenticating the correctness of the target data.
In the embodiment of the present application, after determining that the data corresponding to the effective search interval time of the first data is the target data, whether the target data is correct or not may be authenticated, the start time of the data freeze record may be compared with the first time, if the start time of the data freeze record is equal to the first time, the first data in the data freeze record is the data that we want to search, and is compared with the target data, whether the first data is the same data is determined, if the first data is the same data, it is proved that the searched target data is correct, if the first data is not the same data, the target data needs to be searched again based on the data searching method of the embodiment, after searching in the data searching address range to obtain the target data, verification is performed on the target data based on different situations that may occur, it is ensured that the searched data is the required data, and accuracy of the data searching is improved.
If the start time of the data freezing record is less than the first time, which indicates that there is invalid freezing record data from the address corresponding to the target data to the middle of the latest record data, the data searching method according to the above embodiment may perform the second data searching, find the data meeting the conditions, compare with the target data, determine whether the data is the same data, if the data is the same data, prove that the searched target data is correct, and if the data is not the same data, need to re-search to obtain the target data based on the data searching method according to the above embodiment.
If the start time of the data freezing record is longer than the first time, it indicates that the situation that the electric energy meter fails from the address corresponding to the target data to the middle of the latest record data occurs, and the third data search can be performed from the start freezing storage address of the data freezing record to the opposite direction of the data freezing, the data meeting the condition can be found, the data is compared with the target data, whether the data are the same data is judged, if the data are the same data, the searched target data are proved to be correct, if the data are not the same data, the data are required to be searched again based on the data searching method of the embodiment to obtain the target data, and the data authentication method is only used as an example.
The embodiment of the invention also discloses a data searching device, as shown in fig. 2, which comprises:
an interval time calculating module 201, configured to calculate an effective search interval time of data according to a freezing period and a search interval time of the current data freezing;
a storage address obtaining module 202, configured to obtain a start frozen storage address and an end frozen storage address of the data frozen record, which are respectively denoted as a first storage address and a second storage address;
a time determining module 203, configured to determine a start time and an end time of the data valid search time interval, which are respectively denoted as a first time and a second time;
A storage address calculation module 204, configured to calculate a third storage address corresponding to the first time and a fourth storage address corresponding to the second time based on the data valid search interval time;
a search range determining module 205 configured to determine a data search address range based on the first storage address, the second storage address, the third storage address, and the fourth storage address;
and the data searching module 206 is used for searching the data in the data searching address range based on the effective searching interval time of the data.
According to the data searching device, the data effective searching interval time is calculated according to the freezing period and the searching interval time of the data, the starting freezing storage address and the ending freezing storage address of the data freezing record are obtained and recorded as the first storage address and the second storage address respectively, the starting time and the ending time of the data searching time interval are determined and recorded as the first time and the second time respectively, the storage addresses respectively corresponding to the first time and the second time are calculated based on the data effective searching interval time, the data searching address range is determined based on the first storage address, the second storage address and the storage addresses respectively corresponding to the first time and the second time, and the data in the data searching address range is searched based on the data effective searching interval time.
As an alternative embodiment of the present invention, the time determining module includes: the first interval acquisition sub-module is used for acquiring the starting time and the ending time of the data freezing record to form a first time interval; the second interval acquisition sub-module is used for acquiring a data search time interval and recording the data search time interval as a second time interval; and the time interval determining sub-module is used for determining the intersection of the first time interval and the second time interval, marking the intersection as a data effective searching time interval, and marking the starting time and the ending time of the data effective searching time interval as first time and second time respectively.
As an alternative embodiment of the present invention, the interval time calculating module includes: and the interval time calculating sub-module is used for calculating the least common multiple of the freezing period and the searching interval time of data freezing and recording the least common multiple as the effective searching interval time of the data.
As an alternative embodiment of the present invention, the storage address calculation module includes: the interval adjustment sub-module is used for respectively adjusting the first time and the second time to be integral multiple times corresponding to the data effective searching interval time, calculating the time of the next integral multiple of the adjusted first time, calculating the time of the last integral multiple of the adjusted second time, and determining a new data effective searching time interval; a first record number determining submodule, configured to calculate a record number between a start time of the new data valid search time interval and a corresponding time of a latest data freezing record in the data freezing records, and record the record number as a first record number, where the first record number represents a number of data valid search interval times of the start time from the corresponding time of the latest data freezing record; a second record number determining submodule, configured to calculate a record number between an end time of the new data valid search time interval and a corresponding time of a latest data freezing record in the data freezing records, and record the record number as a second record number, where the second record number represents a number of data valid search interval times of the end time from the corresponding time of the latest data freezing record; and the storage address calculation sub-module is used for calculating a third storage address corresponding to the first time based on the first record number according to the address corresponding to the latest data record and the length of each record, and calculating a fourth storage address corresponding to the second time based on the second record number.
As an optional embodiment of the present invention, the search range determining module includes: a storage sequence judging sub-module, configured to judge a front-to-back sequence of the storage positions of the first storage address and the second storage address in the storage space; a time obtaining sub-module, configured to obtain a freeze record time corresponding to a start address of a frozen storage space if the storage position of the second storage address is before the storage position of the first storage address; a time comparison sub-module for comparing the freeze record time with a first time; the searching range determining sub-module is configured to adjust the first storage address to be a start address of a data searching address range if the frozen recording time is less than or equal to the first time, and adjust a fourth storage address corresponding to the second time to be an end address of the data searching address range; and the searching range determining sub-module is used for adjusting the third storage address corresponding to the first time to be the starting address of the data searching address range and adjusting the second storage address to be the ending address of the data searching address range if the freezing recording time is larger than the first time.
As an alternative embodiment of the present invention, the data search module includes: the data searching sub-module is used for searching the data in the searching address range based on the data effective searching interval time; and the target data determining sub-module is used for determining the data corresponding to the effective search interval time of the first data as target data.
As an optional embodiment of the present invention, the method further comprises: the time comparison module is used for comparing the starting time of the data freezing record with the first time; the data authentication module is used for comparing record data corresponding to the start time of the data freezing record with target data if the start time of the data freezing record is equal to the first time, and authenticating the correctness of the target data; the data authentication module is used for performing second data search from the step of acquiring a start freezing storage address and an end freezing storage address of the data freezing record to the step of searching the data in the data search address range based on the effective data search interval time if the start time of the data freezing record is smaller than the first time, comparing the data obtained by the second data search with the target data, and authenticating the correctness of the target data; and the data authentication module is used for carrying out third data search from the initial frozen storage address of the data frozen record to the opposite direction of data freezing based on the steps from the initial frozen storage address and the end frozen storage address of the obtained data frozen record to the step of searching the data in the data search address range based on the effective data search interval time if the initial time of the data frozen record is larger than the first time, comparing the data obtained by the third data search with the target data, and authenticating the correctness of the target data.
The embodiment of the present invention further provides an electronic device, as shown in fig. 3, which may include a processor 401 and a memory 402, where the processor 401 and the memory 402 may be connected by a bus or other means, and in fig. 3, the connection is exemplified by a bus.
The processor 401 may be a central processing unit (Central Processing Unit, CPU). The processor 401 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof.
The memory 402, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the data searching method in the embodiments of the present invention. The processor 401 executes various functional applications of the processor and data processing, i.e., implements the data search method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.
Memory 402 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created by the processor 401, or the like. In addition, memory 402 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 402 may optionally include memory located remotely from processor 401, such remote memory being connectable to processor 401 through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory 402 and when executed by the processor 401 perform the data search method in the embodiment shown in fig. 1.
The specific details of the electronic device may be understood correspondingly with respect to the corresponding related descriptions and effects in the embodiment shown in fig. 1, which are not repeated herein.
It will be appreciated by those skilled in the art that implementing all or part of the above-described embodiment method may be implemented by a computer program to instruct related hardware, where the program may be stored in a computer readable storage medium, and the program may include the above-described embodiment method when executed. Wherein the storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope as defined.

Claims (9)

1. A data searching method, the method comprising:
calculating effective searching interval time of the data according to the freezing period and searching interval time of the current data freezing;
acquiring a starting freezing storage address and an ending freezing storage address of the data freezing record, and respectively marking the starting freezing storage address and the ending freezing storage address as a first storage address and a second storage address;
determining the starting time and the ending time of a data effective searching time interval, and respectively recording the starting time and the ending time as a first time and a second time;
calculating a third storage address corresponding to the first time and a fourth storage address corresponding to the second time based on the data effective search interval time;
determining a data search address range based on the first memory address, the second memory address, the third memory address and the fourth memory address,
the calculating, based on the data valid search interval time, the third storage address corresponding to the first time and the fourth storage address corresponding to the second time includes:
Respectively adjusting the first time and the second time to be integral multiple times corresponding to the data effective searching interval time, calculating the time of the next integral multiple of the first time after adjustment, calculating the time of the last integral multiple of the second time after adjustment, and determining a new data effective searching time interval;
calculating the number of records between the starting time of the new data effective searching time interval and the corresponding time of the latest data freezing record in the data freezing record, and recording the number of records as a first record number, wherein the first record number represents the number of the data effective searching interval time of the starting time from the corresponding time of the latest data freezing record;
calculating the number of records between the ending time of the new data effective searching time interval and the corresponding time of the latest data freezing record in the data freezing record, and recording the number of records as a second number of records, wherein the second number of records represents the number of the data effective searching interval time of the ending time from the corresponding time of the latest data freezing record;
according to the address corresponding to the latest data freezing record and the length of each record, calculating based on the first record number to obtain a third storage address corresponding to the first time, and calculating based on the second record number to obtain a fourth storage address corresponding to the second time;
Searching the data in the data searching address range based on the effective searching interval time of the data.
2. The data searching method of claim 1, wherein determining a start time and an end time of the data valid search time interval, respectively denoted as a first time and a second time, comprises:
acquiring the starting time and the ending time of the data freezing record to form a first time interval;
acquiring a data searching time interval, and recording the data searching time interval as a second time interval;
and determining an intersection of the first time interval and the second time interval, marking the intersection as a data effective searching time interval, and marking the starting time and the ending time of the data effective searching time interval as first time and second time respectively.
3. The data searching method of claim 1, wherein calculating the data effective search interval time from the period of data freezing and the search interval time comprises:
and calculating the least common multiple of the freezing period and the searching interval time of data freezing, and recording the least common multiple as the effective searching interval time of the data.
4. The data search method of claim 1, wherein the determining a data search address range based on the first, second, third, and fourth memory addresses comprises:
Judging the front-back sequence of the storage positions of the first storage address and the second storage address in the storage space;
if the storage position of the second storage address is in front of the storage position of the first storage address, acquiring the freezing record time corresponding to the starting address of the freezing storage space;
comparing the freeze record time to a first time;
if the freezing record time is smaller than or equal to the first time, the first storage address is adjusted to be a starting address of a data search address range, and a fourth storage address corresponding to the second time is adjusted to be an ending address of the data search address range;
and if the frozen recording time is longer than the first time, adjusting a third storage address corresponding to the first time to be a starting address of the data searching address range, and adjusting the second storage address to be an ending address of the data searching address range.
5. The data searching method according to claim 2, wherein the searching for data in the data searching address range based on a data valid searching interval time comprises:
searching the data in the search address range based on the data effective search interval time;
And determining the data corresponding to the effective searching interval time of the first data as target data.
6. The data searching method of any one of claims 1-5, further comprising:
comparing the start time of the data freeze record with the first time;
if the starting time of the data freezing record is equal to the first time, comparing record data corresponding to the starting time of the data freezing record with target data, and authenticating the correctness of the target data;
if the starting time of the data freezing record is smaller than the first time, performing second data searching from the step of acquiring a starting freezing storage address and an ending freezing storage address of the data freezing record to the step of searching the data in the data searching address range based on the effective data searching interval time, comparing the data obtained by the second data searching with the target data, and authenticating the correctness of the target data;
and if the starting time of the data freezing record is longer than the first time, searching the data in the data searching address range based on the data effective searching interval time based on the starting freezing storage address and the ending freezing storage address of the obtained data freezing record, searching the third data from the starting freezing storage address of the data freezing record in the data freezing opposite direction, comparing the data obtained by the third data searching with the target data, and authenticating the correctness of the target data.
7. A data search device, the device comprising:
the interval time calculation module is used for calculating the effective searching interval time of the data according to the freezing period and the searching interval time of the current data freezing;
the storage address acquisition module is used for acquiring a start frozen storage address and an end frozen storage address of the data frozen record, which are respectively marked as a first storage address and a second storage address;
the time determining module is used for determining the starting time and the ending time of the data effective searching time interval and respectively recording the starting time and the ending time as first time and second time;
a memory address calculation module for calculating a third memory address corresponding to the first time and a fourth memory address corresponding to the second time based on the data valid search interval time,
the memory address calculation module includes:
the interval adjustment sub-module is used for respectively adjusting the first time and the second time to be integral multiple times corresponding to the data effective searching interval time, calculating the time of the next integral multiple of the adjusted first time, calculating the time of the last integral multiple of the adjusted second time, and determining a new data effective searching time interval;
A first record number determining submodule, configured to calculate a record number between a start time of the new data valid search time interval and a corresponding time of a latest data freezing record in the data freezing records, and record the record number as a first record number, where the first record number represents a number of data valid search interval times of the start time from the corresponding time of the latest data freezing record;
a second record number determining submodule, configured to calculate a record number between an end time of the new data valid search time interval and a corresponding time of a latest data freezing record in the data freezing records, and record the record number as a second record number, where the second record number represents a number of data valid search interval times of the end time from the corresponding time of the latest data freezing record;
the storage address calculation sub-module is used for calculating a third storage address corresponding to the first time based on the first record number according to the address corresponding to the latest data freezing record and the length of each record, and calculating a fourth storage address corresponding to the second time based on the second record number;
a search range determining module configured to determine a data search address range based on the first storage address, the second storage address, the third storage address, and the fourth storage address;
And the data searching module is used for searching the data in the data searching address range based on the effective searching interval time of the data.
8. An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the steps of the data search method of any of claims 1-6.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the data search method according to any one of claims 1-6.
CN202310329602.0A 2023-03-29 2023-03-29 Data searching method and device, electronic equipment and storage medium Active CN116303124B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310329602.0A CN116303124B (en) 2023-03-29 2023-03-29 Data searching method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310329602.0A CN116303124B (en) 2023-03-29 2023-03-29 Data searching method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116303124A CN116303124A (en) 2023-06-23
CN116303124B true CN116303124B (en) 2024-01-30

Family

ID=86783283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310329602.0A Active CN116303124B (en) 2023-03-29 2023-03-29 Data searching method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116303124B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2209074A1 (en) * 2009-01-19 2010-07-21 Huawei Technologies Co., Ltd. Data storage processing method, data searching method and devices thereof
CN103546592A (en) * 2013-10-22 2014-01-29 深圳市国电科技通信有限公司 Automatic energy meter address searching method
CN105339904A (en) * 2013-02-01 2016-02-17 辛博立科伊奥公司 Methods and systems for storing and retrieving data
CN108255981A (en) * 2017-12-28 2018-07-06 国网江苏省电力有限公司电力科学研究院 The storage and lookup method that section timestamp serial number index minute continuous time freezes
CN108920594A (en) * 2018-06-27 2018-11-30 杭州海兴电力科技股份有限公司 A kind of energy information search method and relevant apparatus
CN109614447A (en) * 2018-10-15 2019-04-12 国网新疆电力有限公司阿克苏供电公司 A kind of intelligent electric meter divides the storage method, querying method and device of freezing data
CN113760957A (en) * 2021-09-13 2021-12-07 华立科技股份有限公司 Retrieval method and system for historical data of electric energy meter
CN114385891A (en) * 2022-03-23 2022-04-22 北京文景松科技有限公司 Data searching method and device, electronic equipment and storage medium
CN114490518A (en) * 2020-10-23 2022-05-13 伊姆西Ip控股有限责任公司 Method, apparatus and program product for managing indexes of a streaming data storage system
CN114595391A (en) * 2022-03-17 2022-06-07 北京百度网讯科技有限公司 Data processing method and device based on information search and electronic equipment
CN115220930A (en) * 2022-06-21 2022-10-21 华立科技股份有限公司 Processing method for time-sharing shared memory of electric energy meter

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2209074A1 (en) * 2009-01-19 2010-07-21 Huawei Technologies Co., Ltd. Data storage processing method, data searching method and devices thereof
CN105339904A (en) * 2013-02-01 2016-02-17 辛博立科伊奥公司 Methods and systems for storing and retrieving data
CN103546592A (en) * 2013-10-22 2014-01-29 深圳市国电科技通信有限公司 Automatic energy meter address searching method
CN108255981A (en) * 2017-12-28 2018-07-06 国网江苏省电力有限公司电力科学研究院 The storage and lookup method that section timestamp serial number index minute continuous time freezes
CN108920594A (en) * 2018-06-27 2018-11-30 杭州海兴电力科技股份有限公司 A kind of energy information search method and relevant apparatus
CN109614447A (en) * 2018-10-15 2019-04-12 国网新疆电力有限公司阿克苏供电公司 A kind of intelligent electric meter divides the storage method, querying method and device of freezing data
CN114490518A (en) * 2020-10-23 2022-05-13 伊姆西Ip控股有限责任公司 Method, apparatus and program product for managing indexes of a streaming data storage system
CN113760957A (en) * 2021-09-13 2021-12-07 华立科技股份有限公司 Retrieval method and system for historical data of electric energy meter
CN114595391A (en) * 2022-03-17 2022-06-07 北京百度网讯科技有限公司 Data processing method and device based on information search and electronic equipment
CN114385891A (en) * 2022-03-23 2022-04-22 北京文景松科技有限公司 Data searching method and device, electronic equipment and storage medium
CN115220930A (en) * 2022-06-21 2022-10-21 华立科技股份有限公司 Processing method for time-sharing shared memory of electric energy meter

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Fast and efficient address search in System-on-a-Programmable-Chip using binary trees;Jesús Lázaro;Computers & Electrical Engineering;第96卷;全文 *
查询式搜索与探索式搜索行为比较研究――以健康信息为例;袁红;黄燕;;现代情报(第05期);全文 *

Also Published As

Publication number Publication date
CN116303124A (en) 2023-06-23

Similar Documents

Publication Publication Date Title
CN112291844B (en) Positioning method and device based on MR and MDT
CN112215273A (en) Intelligent building information monitoring method based on cloud platform and intelligent building system
CN116303124B (en) Data searching method and device, electronic equipment and storage medium
CN101572713A (en) Method for detecting worm and system thereof
CN113256982B (en) Vehicle illegal driving detection method and device, computer equipment and storage medium
EP3793333A1 (en) Filament current control method and apparatus
CN115378841B (en) Method and device for detecting state of equipment accessing cloud platform, storage medium and terminal
WO2022194008A1 (en) Map data processing method and apparatus
CN114398348A (en) Smart grid abnormal data processing method, gateway, electronic device and storage medium
CN114331092A (en) Equipment shadow, remote scheduling management method, device and system for engineering mechanical equipment
CN112766741A (en) Query method, system, terminal and storage medium
CN117411190B (en) Power distribution network topology identification method, equipment, system and medium based on multi-source information
US10965403B2 (en) Gap data collection for low energy devices
CN114339827B (en) Base station longitude and latitude calibration method and device
CN116963209A (en) Wireless sensor network mobile terminal network switching method considering time synchronization
CN117268450A (en) Calibration quality online verification method and device for vehicle-mounted sensor and electronic equipment
CN108377501B (en) Method, device and equipment for detecting spectrum conflict of TVWS
CN109785184A (en) Normal energy consumption interval computation method, abnormal energy consumption data detection method and device
CN116930683A (en) Power distribution network line fault positioning method and system
CN116305694A (en) Automatic drawing method for overhead line design drawing based on power grid graphic database
CN111522642A (en) Method for acquiring state monitoring data of wind turbine generator, query method and electronic equipment
CN116682191A (en) Subway tunnel inspection configuration method and system
CN113804213A (en) AStar fast path planning improvement algorithm
CN115767615A (en) Wireless problem analysis method and device based on planning cell
CN117452384A (en) Positioning method and device of Internet of vehicles equipment, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Zhengtai Instrument Measurement Industrial Park, No.1 Liangce Road, Beibaixiang Town, Leqing City, Wenzhou City, Zhejiang Province, 325603

Applicant after: ZHEJIANG CHINT INSTRUMENT & METER Co.,Ltd.

Address before: 325603 Wenzhou Daqiao Industrial Park, Yueqing City, Wenzhou City, Zhejiang Province

Applicant before: ZHEJIANG CHINT INSTRUMENT & METER Co.,Ltd.

GR01 Patent grant
GR01 Patent grant