CN113220692A - Load curve data access method - Google Patents

Load curve data access method Download PDF

Info

Publication number
CN113220692A
CN113220692A CN202110610073.2A CN202110610073A CN113220692A CN 113220692 A CN113220692 A CN 113220692A CN 202110610073 A CN202110610073 A CN 202110610073A CN 113220692 A CN113220692 A CN 113220692A
Authority
CN
China
Prior art keywords
time
value
load
index
storage area
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.)
Granted
Application number
CN202110610073.2A
Other languages
Chinese (zh)
Other versions
CN113220692B (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.)
Yantai Dongfang Wisdom Electric Co Ltd
Original Assignee
Yantai Dongfang Wisdom Electric 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 Yantai Dongfang Wisdom Electric Co Ltd filed Critical Yantai Dongfang Wisdom Electric Co Ltd
Priority to CN202110610073.2A priority Critical patent/CN113220692B/en
Publication of CN113220692A publication Critical patent/CN113220692A/en
Application granted granted Critical
Publication of CN113220692B publication Critical patent/CN113220692B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof
    • 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
    • G06F16/24553Query execution of query operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Software Systems (AREA)
  • Water Supply & Treatment (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Primary Health Care (AREA)
  • Marketing (AREA)
  • Human Resources & Organizations (AREA)
  • General Health & Medical Sciences (AREA)
  • Public Health (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a load curve data access method. When in storage: storing the capture time and the load value in a time storage area and a value storage area respectively; the capture time is stored according to the structural form of time slices, each time slice corresponds to a load value set, and the load value set comprises one load value or more than two continuous load values; the time segment includes time interval data corresponding to the load value sets, and also includes value index data pointing to storage positions of the corresponding load value sets in the value storage area. During searching: the searched time period is compared with the time interval data of the time segment, the time segment is positioned, and then the target load value in the value storage area is positioned according to the value index data of the time segment. The invention solves the irreconcilable contradiction between the searching and the integrity of the data record under the condition of forward modification time, and simultaneously avoids the influence of invalid data on the data searching.

Description

Load curve data access method
Technical Field
The invention relates to a method for accessing load curve data.
Background
The load curve recording function is one of important functions of the intelligent electric meter, and can store data according to data requirements preset by a user and fixed time intervals so as to count the power utilization condition of the user.
Conventional load curves are typically stored in time order, similar to the storage structure of "(time 1, data 1), (time 2, data 2)". The search generally adopts a dichotomy, because the time is stored in order, the dichotomy search is used, and the theoretical algorithm complexity is O (log)2 n) That is, a specific data is searched in a curve storing n pieces of data, and at most, log needs to be searched2 nNext, the process is carried out. The access mode of the load curve has the advantages of simple structure and high efficiency, and is very suitable for small embedded equipment such as an intelligent electric meter.
However, the conventional load curve access method has the following defects:
1) if the electricity meter time is modified forwards, part of the load curve records need to be erased, otherwise, the requirement of time-ordered storage cannot be met. For example, the following steps are carried out: assuming that the current time of the electric meter is T1, the current time needs to be modified forward to be T2(T2< T1) if the time is wrong after the time is set, the load curve records in the time from T2 to T1 must be erased after the time is modified, otherwise, the time of the load curve records cannot meet the requirement of ordering, and the binary search fails. However, in order to ensure traceability of the load curve data, in many cases, whether the time is ordered or not, all the recorded load data need to be saved for later query, in which case, erasing of the recorded load curve data is not allowed, and there is an irreconcilable contradiction between searching and completeness of the record.
2) Invalid data cannot be efficiently removed. The electric meter is used as industrial equipment, and the faced power utilization working condition is relatively complex. During the operation of the electric meter, frequent power failure and power supply or insufficient power supply voltage can occur. Under these conditions, the storage of the load curve may fail and invalid data may appear. If invalid data occurs in the dichotomy searching process, searching errors also occur. Limited by IO interaction speed and RAM capacity, the data of each load curve cannot be traversed at present to judge the effectiveness of the data. Therefore, the current more general solution is as follows: the power stability of the storage device when the power supply is unstable is improved by adopting the scheme of sequentially storing and searching by a dichotomy and increasing the standby power supply. However, this approach significantly increases hardware costs.
Disclosure of Invention
The invention provides a load curve data access method, which aims to: (1) the irreconcilable contradiction between the searching and the integrity of the data record under the condition that the time needs to be modified forwards is solved; (2) invalid data is prevented from influencing the data search.
The technical scheme of the invention is as follows:
a load curve data access method, the load curve data includes the load numerical value and captures the time corresponding to load numerical value, the main step is:
when in storage: storing the capture time and the load value in a time storage area and a value storage area respectively; the capturing time is stored according to the structural form of time slices, each time slice corresponds to a load value set, and the load value set comprises one load value or more than two continuous load values; the time segment comprises time interval data corresponding to the load value sets and also comprises value index data pointing to the storage positions of the corresponding load value sets in the value storage area;
during searching: the searched time period is compared with the time interval data of the time segment, the time segment is positioned, and then the target load value in the value storage area is positioned according to the value index data of the time segment.
As a further improvement of the method: and during storage, storing the load value, if the load value is successfully stored, storing or updating the corresponding time segment, and otherwise, directly finishing the storage.
As a further improvement of the method: and circularly storing the load value in the value storage area, namely returning to the beginning of the value storage area to cover the earliest data record to continue storing after the value storage area is full.
As a further improvement of the method: the time interval data includes a start time start _ time and a time interval; the start time start _ time refers to the capture time corresponding to the first load value in the load value set corresponding to the time slice, and the time interval is the capture period of the load value;
the numerical value index data comprises an interval starting index start _ index which points to the storage position of a first load numerical value in the load numerical value set corresponding to the time segment in the numerical value storage area;
the time slice also contains a bar value count, which refers to the number of load values in the set of load values.
As a further improvement of the method: the time segments are circularly stored in the time storage area, namely after the time storage area is full, the time segments return to the beginning of the time storage area to cover the earliest data record for continuous storage.
As a further improvement of the method: pointing to a valid time slice using a time slice start index start _ valid _ index and a current time slice index cur _ index; wherein the time slice start index start _ valid _ index points to the first valid time slice in the time storage area, and the current time slice index cur _ index points to the latest stored valid time slice in the time storage area.
As a further improvement of the method: when load curve data is newly added, the following steps are executed:
a-1, separating a load value from a capture time;
a-2, storing the load value into a value storage area, if the storage is successful, executing the step A-3, otherwise, ending the operation of newly adding the load curve data;
a-3, judging whether the capture time capture _ time of the current newly added load value is matched with the latest effective time segment or not, wherein the judgment conditions are as follows:
capture_time=start_time+interval*(count+1)
in the formula, start _ time, interval and count are respectively the start time, time interval and bar value of the latest valid time slice;
if the condition is met, executing the step A-4, otherwise executing the step A-5;
a-4, adding 1 to the number count of the latest effective time slice; then executing the step A-6;
a-5, newly building a time segment in the time storage area, wherein the starting time start _ time of the time segment is equal to the capture time capture _ time of the newly added load value, the time interval is equal to the current capture period, the interval starting index start _ index is equal to the storage position of the newly added load value, and the number count is equal to 1; then executing the step A-6;
a-6, finding a first effective time segment according to an inter-segment start index start _ valid _ index, and judging whether the storage position of the newly added load value is in the interval of a value storage area corresponding to the time segment;
if the storage position of the newly added load value is in the section of the value storage area corresponding to the time slice, and the start _ valid _ index is not equal to the cur _ index, the start _ time value in the first effective time slice is increased by the interval of the time slice, the start _ index value is increased by 1, and the count value is decreased by 1; then judging whether the count at the moment is less than 0, if so, adding 1 to the start _ valid _ index value;
if the storage position of the newly added load value is in the section of the value storage area corresponding to the time slice, and the start _ valid _ index is equal to the cur _ index, the start _ time value in the first valid time slice is increased by the interval of the time slice, the start _ index value is increased by 1, and the count value is decreased by 1.
As a further improvement of the method: when inquiring the load curve data, executing the following steps:
s-1, acquiring all currently valid time slices according to a time slice starting index start _ valid _ index and a current time slice index cur _ index;
s-2, traversing all effective time slices, and respectively judging whether a time interval [ start _ time, start _ time + count _ interval ] pointed by the time slice intersects with a queried time interval [ From _ T, To _ T ];
s-3, traversing all time segments with intersection, and for a certain time segment, setting the intersection as [ T1, T2], calculating a storage position interval where a load value needing to be returned is located according to the following formula:
Figure BDA0003095570600000061
and then returning the load value according to the calculated storage position interval.
As a further improvement of the method: the time segment also comprises a check field check, when other data except the check field check in the time segment is modified, the check value is recalculated according to the current value of the other data and is stored in the check field check.
Compared with the prior art, the invention has the following beneficial effects: (1) aiming at the data characteristics of a load curve, a load numerical value and capturing time are stored separately, time is compressed in a time-slice structural form, and the traditional bisection search is replaced by traversal search based on compression time, so that the normal search can be ensured without erasing data when the time is modified forwards; (2) when the load numerical value is stored wrongly (namely invalid data appears), the time segment is not updated, the influence of the invalid data is eliminated, and hardware does not need to be added; (3) and aiming at the scenes with large data volume and more time segments, the time segments are further subjected to grouping management, and the searching efficiency is improved.
Drawings
FIG. 1 is a schematic flow chart of the storage process of the method;
FIG. 2 is a flow chart illustrating the query process of the present method;
FIG. 3 is a schematic diagram of a time value storage area and a time storage area in the embodiment in which 3 pieces of load values are stored;
FIG. 4 is a schematic diagram of a time value storage area and a time storage area in the embodiment in which 4 pieces of load values are stored;
FIG. 5 is a schematic diagram of a time value storage area and a time storage area in the embodiment in which 5 pieces of load values are stored;
FIG. 6 is a schematic diagram of a time value storage area and a time storage area in which 6 pieces of load values are stored in the embodiment;
fig. 7 is a schematic diagram of a value storage area and a time storage area when 7 pieces of load values are stored and cyclic storage of the load values occurs in the embodiment.
Detailed Description
The technical scheme of the invention is explained in detail in the following with the accompanying drawings:
referring to fig. 1 and 2, a load curve data access method includes two processes of storing and querying. Wherein:
when in storage: referring to fig. 1, the capture time and the load value are stored in the time storage area and the value storage area, respectively.
The value storage area is related to the actual requirement of the user and contains data required by the user. The load value is stored in the value storage area in a circulating mode, namely after the value storage area is full, the load value returns to the beginning of the value storage area and is stored continuously in a mode of covering the earliest data record.
The capture time corresponding to each piece of data in the value storage area is stored in the time storage area. The time segments are circularly stored in the time storage area, namely after the time storage area is full, the time segments return to the beginning of the time storage area to cover the earliest data record for continuous storage.
Because the sequential circular storage mode is adopted, when the calculated target storage position exceeds the interval of the storage area during query, the system automatically returns to the initial position of the storage area to continue searching, namely the storage position is converted, rather than the out-of-range query. The skilled person knows how to perform the scaling and therefore the memory location scaling procedure involved is not detailed in this description and is set by the skilled person at his discretion when implemented.
The capture time is stored in the form of a structure of time slices. Each time segment corresponds to a load value set, and the load value set comprises one load value or more than two continuous load values; the time segment includes time interval data corresponding to the load value sets, and also includes value index data pointing to storage positions of the corresponding load value sets in the value storage area.
The data structure of the time slice is defined as:
Figure BDA0003095570600000081
specifically, the time interval data includes a start time start _ time and a time interval; the start time start _ time refers to a capturing time corresponding to the first load value in the set of load values corresponding to the time slice, and the time interval is a capturing period of the load values. Note that: the load curve Time interval within each Time segment (Time _ segment) must be the same.
The numerical value index data comprises an interval starting index start _ index which points to the storage position of a first load numerical value in the load numerical value set corresponding to the time segment in the numerical value storage area;
the time slice also contains a bar value count, which refers to the number of load values in the set of load values.
The time segment also comprises a check field check, when other data except the check field check in the time segment is modified, the check value is recalculated according to the current value of the other data and is stored in the check field check, and the integrity of the data is ensured. An appropriate verification algorithm can be selected according to actual requirements, and a commonly used verification algorithm is crc16 verification.
As shown in fig. 1, during storage, the load value is stored first, if the load value is successfully stored, the corresponding time slice is stored or updated, otherwise, the storage is directly finished.
Further, the time interval Index pointer Index _ pointer is established for indicating the state of the time storage area, and the structure is as follows:
Figure BDA0003095570600000091
the Index _ pointer points to a valid time slice using the time slice start Index start _ valid _ Index and the current time slice Index cur _ Index. Wherein the time slice start index start _ valid _ index points to the first valid time slice in the time storage area, and the current time slice index cur _ index points to the latest stored valid time slice in the time storage area.
Due to the compression characteristic of the Time _ segment with respect to the capture Time, the cyclic storage speed of the Time segment Time _ segment in the Time storage area is slower than the cyclic storage speed of the value storage area. Therefore, a portion of the Time _ segment in the Time store is necessarily invalid. The start _ valid _ index is used to indicate an index position in the Time storage area of the first valid Time slice structure Time _ segment. If the start _ valid _ index is less than or equal to the cur _ index, the Time storage area is not full and the cycle storage does not occur, and the valid Time _ segment index starts from the start _ valid _ index and ends at the cur _ index; otherwise, it is stated that the Time storage area has been cyclically stored, the valid Time _ segment index includes two sections, the first section starts from the start _ valid _ index and ends at the last section of the Time storage area, and the second section starts from the first section of the Time storage area and ends at the cur _ index.
As shown in fig. 1, when adding new load curve data, the following steps are performed:
a-1, separating a load value from a capture time;
a-2, storing the load value into a value storage area (sequential cycle storage), if the storage is successful, executing the step A-3, otherwise, ending the operation of adding the load curve data;
a-3, judging whether the capture time capture _ time of the current newly added load value is matched with the latest effective time segment or not, wherein the judgment conditions are as follows:
capture_time=start_time+interval*(count+1)
in the formula, start _ time, interval and count are respectively the start time, time interval and bar value of the latest valid time slice;
if the condition is met, executing the step A-4, otherwise executing the step A-5;
a-4, adding 1 to the number count of the latest effective time slice; then executing the step A-6;
a-5, newly building a time segment in the time storage area, wherein the starting time start _ time of the time segment is equal to the capture time capture _ time of the newly added load value, the time interval is equal to the current capture period, the interval starting index start _ index is equal to the storage position of the newly added load value, and the number count is equal to 1; then executing the step A-6;
a-6, finding a first effective time slice according to the inter-slice start index start _ valid _ index, and judging whether the storage position of the newly added load value is in the interval of the value storage area corresponding to the time slice: [ start _ index, start _ index + count ];
if the storage position of the newly added load value is in the section of the value storage area corresponding to the time slice, and the start _ valid _ index is not equal to the cur _ index, the start _ time value in the first effective time slice is increased by the interval of the time slice, the start _ index value is increased by 1, and the count value is decreased by 1; then judging whether the count at the moment is less than 0, if so, adding 1 to the start _ valid _ index value;
if the storage position of the newly added load value is in the section of the value storage area corresponding to the time slice, and the start _ valid _ index is equal to the cur _ index, the start _ time value in the first valid time slice is increased by the interval of the time slice, the start _ index value is increased by 1, and the count value is decreased by 1.
The above-mentioned new storage steps will be described in detail with reference to fig. 3 to 7:
assuming that the capture period of the load curve is 15 minutes, the maximum number of data stored in the numerical value storage area is 6, and the maximum number of Time _ segment stored in the Time storage area is 4. It should be noted that the above storage limitation is only used as an example, and the actual number of storage is much more than this.
As shown in fig. 3, the latest piece of load curve data is stored in the 3 rd piece of the value storage area, the Time is 00:45, and in the latest piece of Time _ segment of the Time storage area, the start _ Time is 00:45, start _ index is 3, interval is 15, and count is 1.
As shown in fig. 4, the new time is 01: 00, the value of the newly added curve is stored in the 4 th position of the value storage area, and the capturing Time of the newly added curve is matched with the latest Time segment Time _ segment according to the matching judgment formula in the step A-3. Therefore, the count field value of the latest Time fragment Time _ segment is added by 1; index _ pointer does not need to be updated.
As shown in fig. 5, data is newly added again, and the addition time is 01: and (3) for 30 load curves, storing the data of the newly added curve in the 5 th position of the value storage area, and obtaining that the capturing Time of the newly added curve is not matched with the latest Time segment Time _ segment according to the matching judgment formula in the step A-3. Therefore, a Time segment Time _ segment is newly created in the Time storage area, and start _ Time is 01: 30, start _ index is 5, interval is 15, and count is 1. Meanwhile, the cur _ Index field value in Index _ pointer is equal to the position Index of the newly created Time _ segment, and has a value of 3.
As shown in FIG. 6, data is newly added again, and the latest load curve data is stored in the 6 th piece of the value storage area at a time of 01:45, and the value storage area is full. The latest Time _ segment, start _ Time, of the Time storage area is 01: 30, start _ index is 5, interval is 15, and count is 2. As shown in fig. 7, the newly added time is 02: 00, the data of the newly added curve is stored circularly, the data at the 1 st position of the numerical value storage area is covered, and the capture Time of the newly added curve is matched with the latest Time _ segment according to the matching judgment formula in the step A-3, so that the value of the count field of the latest Time _ segment is added with 1. However, at this Time, the start _ valid _ Index field of the Index _ pointer, i.e., the first valid Time _ segment Index is 1, is located to the Time _ segment with Index 1, whose pointed value region has been overwritten, so the start _ Time field value increment interval becomes 00: 15; the start _ index field value is increased by 1 and has a value of 2; since the count field value is 2, minus 1 is not zero, it is only necessary to subtract 1 from the count field value of the Time _ segment without updating Index _ pointer.
During searching: the searched time period is compared with the time interval data of the time segment, the time segment is positioned, and then the target load value in the value storage area is positioned according to the value index data of the time segment.
As shown in fig. 2, the following steps are specifically executed when querying the load curve data:
s-1, acquiring all currently valid time slices according to a time slice starting index start _ valid _ index and a current time slice index cur _ index;
s-2, traversing all effective time slices, and respectively judging whether a time interval [ start _ time, start _ time + count _ interval ] pointed by the time slice intersects with a queried time interval [ From _ T, To _ T ];
s-3, traversing all time segments with intersection, and for a certain time segment, setting the intersection as [ T1, T2], calculating a storage position interval where a load value needing to be returned is located according to the following formula:
Figure BDA0003095570600000131
and then returning the load value according to the calculated storage position interval.
The time storage area compresses the capture time according to the storage characteristics of the load curve. Therefore, the storage space occupied by the time storage area is only related to the number of times the power outage duration exceeds the capture period, the number of times the user modifies the time span to exceed the capture period, and the number of times the user modifies the capture period.
According to empirical values, the Time segment store 2000 Time segments can meet the requirements in most cases (typically, the load curve storage Time will not exceed one year, the number of average blackouts per day exceeding the capture period will not be greater than 5, 365 x 5-1825). However, in extreme cases, for example, the storage Time of the load curve is required to be many years, or the number of power failures is too large due to poor power supply quality, which results in the number of Time _ segment storage in the Time storage area being much larger than 2000. At this time, a grouping function module is required to be provided for grouping and managing the valid time slots.
The steps of the initialization of the grouping function module are as follows:
GI-1, respectively calculating a relative value S of the starting time, a relative value E of the ending time and a time center point C of each effective time segment:
Figure BDA0003095570600000141
where Relative () denotes converting an absolute time to a Relative time value from some preset starting time; generally, relative time of 0 minutes is taken relative to 0 minutes of 1 month, 1 day, 0 of 1970, and the unit is minutes;
GI-2, setting the number of currently effective time segments as N and the number of groups as M, counting the minimum value of S of all the time segments and the maximum value of E of all the time segments, and respectively recording the minimum value and the maximum value as Min _ N and Max _ N;
GI-3, in the interval [ Min _ N, Max _ N]Randomly selecting M points as grouping central points, and taking G as a groupmRepresents, M ═ 1, 2, 3, …, M;
GI-4, respectively calculating the distance D between the time center point of each time segment and the center point of each group;
GI-5、traverse all time slices: setting the current time segment as the nth time segment, and taking out the time center point CnDistance from center of all packets { D nm1, 2, 3, …, and sorting the M-M groups in the order from small to large, and recording the group corresponding to the minimum distance D as the group where the nth time slice is located;
GI-6, after traversing, calculating a new time center point of each packet:
Figure BDA0003095570600000151
Cirepresenting the time center point of the ith time slice in the group, and I representing the number of the current time slices in the group;
GI-7, repeating the steps GI-4 to GI-6 until the time center point of the new packet calculated in the step GI-6 is the same as the time center point calculated last time;
GI-8, respectively counting the minimum value of S of all time segments in each group and the maximum value of E of all time segments in each group, and respectively recording the minimum value and the maximum value as a time lower limit Min _ T and a time upper limit Max _ T;
GI-9, storing packet data in the time packet storage area, wherein the packet data of each packet comprises: the time lower limit Min _ T, the time upper limit Max _ T, the time center point G of the grouping and the storage position of the corresponding time slice in the time storage area.
Based on the grouping function module, when the load curve data is newly added, after the steps a-1 to a-6 are executed, the newly added time segment and the updated time segment are taken out to traverse (for example, the first time segment and/or the last time segment are updated), the distances between the time center point of the time segment and the time center points of the groups are respectively calculated, the group with the minimum distance is selected as the group of the time segment, and the grouping data of the changed groups are recalculated.
Based on the grouping function module, when inquiring load curve data: firstly, traversing all the packets, and judging whether a time interval [ Min _ T, Max _ T ] formed by a time lower limit Min _ T and a time upper limit Max _ T of the packets intersects with a queried time interval [ From _ T, To _ T ] (judging the size relationship between Min _ T and Max _ T, From _ T and To _ T, and directly skipping when Min _ T is larger than To _ T, Max _ T and smaller than From _ T); for the groups with the intersection, time segments in the groups need To be taken out for traversing, and whether the time interval [ start _ time, start _ time + count _ interval ] pointed by each time segment intersects with the inquired time interval [ From _ T, To _ T ] is judged; then, referring to step S-3, traversing all time segments having intersection, and for a certain time segment, setting the intersection as [ T1, T2], calculating a storage location interval where the load value needing to be returned is located according to the following formula:
Figure BDA0003095570600000161
and finally returning the load value according to the calculated storage position interval.
Obviously, for the condition that a large number of time segments are generated due to frequent faults, the relatively continuous time segments can be divided into one group through grouping, so that the speed of finding the relevant time segments can be increased during query, and the query efficiency is improved.

Claims (9)

1. A load curve data access method, load curve data includes load value and capture time corresponding to the load value, characterized in that:
when in storage: storing the capture time and the load value in a time storage area and a value storage area respectively; the capturing time is stored according to the structural form of time slices, each time slice corresponds to a load value set, and the load value set comprises one load value or more than two continuous load values; the time segment comprises time interval data corresponding to the load value sets and also comprises value index data pointing to the storage positions of the corresponding load value sets in the value storage area;
during searching: the searched time period is compared with the time interval data of the time segment, the time segment is positioned, and then the target load value in the value storage area is positioned according to the value index data of the time segment.
2. The load curve data access method of claim 1, wherein: and during storage, storing the load value, if the load value is successfully stored, storing or updating the corresponding time segment, and otherwise, directly finishing the storage.
3. The load curve data access method of claim 1, wherein: and circularly storing the load value in the value storage area, namely returning to the beginning of the value storage area to cover the earliest data record to continue storing after the value storage area is full.
4. The load curve data access method of claim 3, wherein: the time interval data includes a start time start _ time and a time interval; the start time start _ time refers to the capture time corresponding to the first load value in the load value set corresponding to the time slice, and the time interval is the capture period of the load value;
the numerical value index data comprises an interval starting index start _ index which points to the storage position of a first load numerical value in the load numerical value set corresponding to the time segment in the numerical value storage area; the time slice also contains a bar value count, which refers to the number of load values in the set of load values.
5. The load curve data access method of claim 4, wherein: the time segments are circularly stored in the time storage area, namely after the time storage area is full, the time segments return to the beginning of the time storage area to cover the earliest data record for continuous storage.
6. The load curve data access method of claim 5, wherein: pointing to a valid time slice using a time slice start index start _ valid _ index and a current time slice index cur _ index; wherein the time slice start index start _ valid _ index points to the first valid time slice in the time storage area, and the current time slice index cur _ index points to the latest stored valid time slice in the time storage area.
7. The load curve data access method of claim 6, wherein: when load curve data is newly added, the following steps are executed:
a-1, separating a load value from a capture time;
a-2, storing the load value into a value storage area, if the storage is successful, executing the step A-3, otherwise, ending the operation of newly adding the load curve data;
a-3, judging whether the capture time capture _ time of the current newly added load value is matched with the latest effective time segment or not, wherein the judgment conditions are as follows:
capture_time=start_time+interval*(count+1)
in the formula, start _ time, interval and count are respectively the start time, time interval and bar value of the latest valid time slice;
if the condition is met, executing the step A-4, otherwise executing the step A-5;
a-4, adding 1 to the number count of the latest effective time slice; then executing the step A-6;
a-5, newly building a time segment in the time storage area, wherein the starting time start _ time of the time segment is equal to the capture time capture _ time of the newly added load value, the time interval is equal to the current capture period, the interval starting index start _ index is equal to the storage position of the newly added load value, and the number count is equal to 1; then executing the step A-6;
a-6, finding a first effective time segment according to an inter-segment start index start _ valid _ index, and judging whether the storage position of the newly added load value is in the interval of a value storage area corresponding to the time segment;
if the storage position of the newly added load value is in the section of the value storage area corresponding to the time slice, and the start _ valid _ index is not equal to the cur _ index, the start _ time value in the first effective time slice is increased by the interval of the time slice, the start _ index value is increased by 1, and the count value is decreased by 1; then judging whether the count at the moment is less than 0, if so, adding 1 to the start _ valid _ index value;
if the storage position of the newly added load value is in the section of the value storage area corresponding to the time slice, and the start _ valid _ index is equal to the cur _ index, the start _ time value in the first valid time slice is increased by the interval of the time slice, the start _ index value is increased by 1, and the count value is decreased by 1.
8. The load curve data access method of claim 6, wherein: when inquiring the load curve data, executing the following steps:
s-1, acquiring all currently valid time slices according to a time slice starting index start _ valid _ index and a current time slice index cur _ index;
s-2, traversing all effective time slices, and respectively judging whether a time interval [ start _ time, start _ time + count _ interval ] pointed by the time slice intersects with a queried time interval [ From _ T, To _ T ];
s-3, traversing all time segments with intersection, and for a certain time segment, setting the intersection as [ T1, T2], calculating a storage position interval where a load value needing to be returned is located according to the following formula:
Figure FDA0003095570590000041
and then returning the load value according to the calculated storage position interval.
9. A method for accessing load profile data according to any one of claims 1 to 8, wherein: the time segment also comprises a check field check, when other data except the check field check in the time segment is modified, the check value is recalculated according to the current value of the other data and is stored in the check field check.
CN202110610073.2A 2021-06-01 2021-06-01 Load curve data access method Active CN113220692B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110610073.2A CN113220692B (en) 2021-06-01 2021-06-01 Load curve data access method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110610073.2A CN113220692B (en) 2021-06-01 2021-06-01 Load curve data access method

Publications (2)

Publication Number Publication Date
CN113220692A true CN113220692A (en) 2021-08-06
CN113220692B CN113220692B (en) 2022-09-13

Family

ID=77082451

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110610073.2A Active CN113220692B (en) 2021-06-01 2021-06-01 Load curve data access method

Country Status (1)

Country Link
CN (1) CN113220692B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130110766A1 (en) * 2009-10-13 2013-05-02 Open Text Software Gmbh Method for performing transactions on data and a transactional database
CN103412889A (en) * 2013-07-19 2013-11-27 深圳市金正方科技股份有限公司 Data storage and query method of intelligent electric meter and system thereof
CN104050268A (en) * 2014-06-23 2014-09-17 西北工业大学 Continuous data protection and recovery method with log space adjustable online
CN104572486A (en) * 2015-01-29 2015-04-29 深圳市科陆电子科技股份有限公司 Method for dynamically storing data of electric energy meters
CN105718218A (en) * 2016-01-19 2016-06-29 国电南瑞三能电力仪表(南京)有限公司 Compressed storage method and system applicable for load records of electric energy meter or concentrator
CN108255981A (en) * 2017-12-28 2018-07-06 国网江苏省电力有限公司电力科学研究院 The storage and lookup method that section timestamp serial number index minute continuous time freezes
CN109597580A (en) * 2018-12-03 2019-04-09 烟台东方威思顿电气有限公司 Flash operating method suitable for the storage of intelligent electric meter load curve
CN110765074A (en) * 2019-09-20 2020-02-07 国网山东省电力公司青岛供电公司 Method and system for quickly accessing electric load curve data of acquisition terminal

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130110766A1 (en) * 2009-10-13 2013-05-02 Open Text Software Gmbh Method for performing transactions on data and a transactional database
CN103412889A (en) * 2013-07-19 2013-11-27 深圳市金正方科技股份有限公司 Data storage and query method of intelligent electric meter and system thereof
CN104050268A (en) * 2014-06-23 2014-09-17 西北工业大学 Continuous data protection and recovery method with log space adjustable online
CN104572486A (en) * 2015-01-29 2015-04-29 深圳市科陆电子科技股份有限公司 Method for dynamically storing data of electric energy meters
CN105718218A (en) * 2016-01-19 2016-06-29 国电南瑞三能电力仪表(南京)有限公司 Compressed storage method and system applicable for load records of electric energy meter or concentrator
CN108255981A (en) * 2017-12-28 2018-07-06 国网江苏省电力有限公司电力科学研究院 The storage and lookup method that section timestamp serial number index minute continuous time freezes
CN109597580A (en) * 2018-12-03 2019-04-09 烟台东方威思顿电气有限公司 Flash operating method suitable for the storage of intelligent electric meter load curve
CN110765074A (en) * 2019-09-20 2020-02-07 国网山东省电力公司青岛供电公司 Method and system for quickly accessing electric load curve data of acquisition terminal

Also Published As

Publication number Publication date
CN113220692B (en) 2022-09-13

Similar Documents

Publication Publication Date Title
CN108255981B (en) Method for storing and searching index minute freezing of timestamp sequence numbers of continuous time periods
CN108197181B (en) Compression storage method of time sequence data, electronic equipment and storage medium
CN107577436B (en) Data storage method and device
CN106649722B (en) Monitoring system high-frequency data storage and query method
CN103488709A (en) Method and system for building indexes and method and system for retrieving indexes
CN102541960A (en) Method and device of fuzzy retrieval
CN101944115A (en) Method and system for searching logs
CN111913925B (en) Data processing method and system in distributed storage system
CN104636349A (en) Method and equipment for compression and searching of index data
CN113220692B (en) Load curve data access method
CN113760957B (en) Method and system for retrieving historical data of electric energy meter
CN108446814A (en) With the tree searching method and device of sequential pipeline Job-Shop problem
CN113220668B (en) Load curve data access method based on grouping
CN110765074B (en) Method and system for quickly accessing electric load curve data of acquisition terminal
CN102760168B (en) Method and device for scanning fragmented files
CN113420036A (en) Consistency checking method for internal storage relation database of power grid monitoring system
US20070124279A1 (en) Method for quickly retrieving a record in a data page of a database
CN113419897A (en) File processing method and device, electronic equipment and storage medium thereof
CN114444137B (en) Method, system, equipment and medium for positioning cabinet expander where hard disk is located
CN114116643A (en) Log processing method and device for embedded system and storage medium
CN108776704B (en) Time sequence data indexing method based on regression analysis
CN112150102A (en) Smart grid information system account updating method and device combining RPA and AI
CN102760489B (en) Flash block selecting method and data storage device
CN111475502A (en) Data management method and system for distributed renewable energy
CN112286893B (en) Log processing method and device applied to embedded terminal

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
GR01 Patent grant
GR01 Patent grant