CN113254475B - Historical data query and acquisition method for branch line monitoring terminal - Google Patents

Historical data query and acquisition method for branch line monitoring terminal Download PDF

Info

Publication number
CN113254475B
CN113254475B CN202110792768.7A CN202110792768A CN113254475B CN 113254475 B CN113254475 B CN 113254475B CN 202110792768 A CN202110792768 A CN 202110792768A CN 113254475 B CN113254475 B CN 113254475B
Authority
CN
China
Prior art keywords
time
read
record
mark
time mark
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
CN202110792768.7A
Other languages
Chinese (zh)
Other versions
CN113254475A (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.)
Wuhan Zhongyuan Electronic Information Co ltd
Original Assignee
Wuhan Zhongyuan Electronic Information 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 Wuhan Zhongyuan Electronic Information Co ltd filed Critical Wuhan Zhongyuan Electronic Information Co ltd
Priority to CN202110792768.7A priority Critical patent/CN113254475B/en
Publication of CN113254475A publication Critical patent/CN113254475A/en
Application granted granted Critical
Publication of CN113254475B publication Critical patent/CN113254475B/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/24Querying
    • G06F16/245Query processing
    • 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/24552Database cache management
    • 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
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • 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)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Economics (AREA)
  • Physics & Mathematics (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • Databases & Information Systems (AREA)
  • General Business, Economics & Management (AREA)
  • Tourism & Hospitality (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Marketing (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Quality & Reliability (AREA)
  • Operations Research (AREA)
  • Development Economics (AREA)
  • Game Theory and Decision Science (AREA)
  • Public Health (AREA)
  • Water Supply & Treatment (AREA)
  • General Health & Medical Sciences (AREA)
  • Primary Health Care (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a historical data query and acquisition method for a branch line monitoring terminal, which is characterized in that a flash data in the monitoring terminal is queried and read in an assignment cycle mode, and meanwhile, re-reading mark parameters are added in each cycle step and time marks obtained each time are compared, so that the query and acquisition steps are simplified, the use times of the step of obtaining a record address of a specified time mark are greatly reduced, the system operation pressure is reduced, and the query and acquisition efficiency is improved.

Description

Historical data query and acquisition method for branch line monitoring terminal
Technical Field
The invention relates to the technical field of electric quantity acquisition terminals, in particular to a historical data query and acquisition method for a branch line monitoring terminal.
Background
In the power system, a large amount of power utilization information data and history records exist, the current power utilization condition and the power grid condition can be analyzed by collecting and inquiring the history records, so that the record reading is the most basic operation, and when the data volume is large, the record reading speed can obviously restrict the result of the problem judgment and processing of the upper layer.
Usually, the history is stored in the flash memory, the read-write speed of the flash memory generally depends on the limitation of hardware, the MCU reads and queries a large amount of data from the external flash memory, and the process of reporting data in a specific format is the process of recording and transmitting. In the process, due to the limitation of hardware, the read-write delay is inevitably caused, so that the corresponding speed is improved mainly by depending on the design of a software search algorithm, the existing search algorithm is relatively clumsy, data search is usually carried out in a circular traversal mode, and the record of the power utilization information is usually stored according to a time sequence, so that the data search is usually carried out in a mode of not carrying out multiple times of circular traversal on the premise of correct initial time, and the difficulty and the delay of data search and acquisition can be greatly reduced.
Disclosure of Invention
In view of this, the invention provides a more reasonable and efficient historical data acquisition method for a branch line monitoring terminal.
The technical scheme of the invention is realized as follows: the invention provides a historical data query and acquisition method for a branch line monitoring terminal, which comprises the following steps:
step S1, acquiring a time mark set to be read, initializing the read time mark set, outputting a buffer area, reading a record and re-reading a mark to 0;
step S2, acquiring a designated time mark from the time mark set to be read, judging whether the time mark set to be read is larger than the read time mark set, if not, assigning the content of the output buffer area to the read record and entering step S1, and if so, entering step S3;
step S3, judging whether the read time mark set is 0 or the reread flag is 1, if yes, acquiring the recording address of the designated time mark, starting from the initial time mark of the time mark set to be read, and entering step S4, otherwise, directly entering step S4;
step S4, obtaining the time mark in the record address, judging whether the rereading mark is not 0, if yes, assigning the rereading mark to be 0, reading the content of the corresponding record address to an output buffer area, assigning the content to the read record by the output buffer area, assigning a read time mark set +1, adding the interval time to the specified time mark as the alternative initial specified time mark and entering step S2, if not, entering step S5;
step S5, determining whether the time stamp obtained in step S4 is not equal to the initial designated time stamp in step S2, if so, assigning a reread flag to 1 and entering step S2, otherwise, reading the content in the corresponding recording address to an output buffer area, assigning the content to the read record by the output buffer area, assigning a read time stamp set +1, adding the interval time to the initial designated time stamp as a substitute initial designated time stamp, and entering step S2.
Based on the above technical solution, preferably, in step S3, the method for obtaining the recording address of the specified time stamp includes:
step S31, reading the first record time mark of the flash memory, taking the address of the current time mark as the first address, judging whether the storage length of the flash memory is larger than the length of the content to be read, if so, entering step S32, and if not, returning to the value of 0 and ending;
step S32, reading the time mark of the current address storage record, judging whether the time mark is consistent with the designated time mark, if so, returning to the current address and ending, otherwise, entering step S33;
step S33, adding a length of a record to the current address as a substitute current address, subtracting the length of a record from the storage length of the flash memory as the substitute storage length of the flash memory, and going to step S31 to loop.
On the basis of the foregoing technical solution, preferably, after step S3 is finished, before step S4 is performed, the method further includes determining whether a return value is not 0, if so, step S4 is performed, otherwise, assigning a read record corresponding to the specified time scale, assigning a read time scale set +1, and performing step S2 by using the initial specified time scale plus the interval time as a substitute initial specified time scale.
On the basis of the foregoing technical solution, preferably, the method for assigning a value to the read record corresponding to the specified time stamp includes: and judging whether the read time scale set is not 0, if so, acquiring read records corresponding to adjacent time scales which are closest before and after the specified time scale, performing linear fitting according to adjacent read record values, calculating a value corresponding to the linear fitting at the specified time scale, and assigning the value to the read record corresponding to the specified time scale.
Still further preferably, the method of linear fitting includes obtaining a latest time scale t1 before the specified time scale and a corresponding read record q1, and obtaining an earliest time scale t2 after the specified time scale and a corresponding read record q2, respectively, to obtain a fitted straight line y = [ (q 2-q 1)/(t 2-t 1) ] x + q1, where x is a time difference between the specified time scale and the time scale t1, and y is the fitted read record at the specified time scale.
On the basis of the above technical solution, preferably, the linear fitting method includes dividing a time interval of a day into a peak interval, a normal interval, and a valley interval, determining time intervals in which t1 and t2 are located, and correcting a fitted straight line:
when t1 and t2 are both in the same time interval, the fitted straight line is unchanged; when t1 is in the peak interval and t2 is in the normal interval, the modified fitted straight line y = [ (q 2-q 1) × 1.2/(t 2-t 1) ] x + q 1;
when t1 is located in the peak region and t2 is located in the valley region, the modified fitted straight line y = [ (q 2-q 1) × 1.5/(t 2-t 1) ] x + q 1;
when t1 is in the normal interval and t2 is in the peak interval, the modified fitted straight line y = [ (q 2-q 1) × 0.8/(t 2-t 1) ] x + q 1;
when t1 is in the normal interval and t2 is in the valley interval, the modified fitted straight line y = [ (q 2-q 1) × 1.1/(t 2-t 1) ] x + q 1;
when t1 is located in the valley region and t2 is located in the normal region, the modified fitted straight line y = [ (q 2-q 1) × 0.9/(t 2-t 1) ] x + q 1;
when t1 is located in the valley region and t2 is located in the peak region, the modified fitted straight line y = [ (q 2-q 1) × 0.7/(t 2-t 1) ] x + q 1.
In addition to the above technical means, it is preferable that the peak section is (14:00,17:00] < u > (19:00,22: 00), the normal section is (8:00,14:00] < u > (17:00,19:00] < u > (22:00,24: 00), and the valley section is (0:00,8: 00).
On the basis of the above technical solution, preferably, if the read time mark set is not 0, further determining whether the corresponding specified time mark is the earliest record in the flash memory, if so, filling 0xff of a record corresponding length into the read record, assigning a read time mark set +1, adding the interval time to the initial specified time mark as a substitute initial specified time mark, and entering step S2; if not, the latest time mark recording address before the target time range in the flash memory is obtained, then the read time mark set +1 is assigned, the latest time mark before the target time range is added with the interval time as the alternative initial designated time mark, and the step S2 is entered.
Compared with the prior art, the historical data query method for the branch line monitoring terminal has the following beneficial effects that:
(1) according to the method, a rereading mark is given in the reading process, the rereading mark state is changed according to whether a subsequent time scale is corresponding or not, and whether the rereading mark state needs to be reacquired or not is judged by identifying the rereading mark state before acquiring the specified time scale address, so that the execution times of acquiring the specified time scale record address is greatly reduced, the task burden of a system is reduced, and the data query and acquisition efficiency is improved;
(2) furthermore, in order to avoid data query and acquisition errors, the method and the device also identify the address content of the specified time scale, prevent the data loss problem caused by power failure and the like, and obtain relatively reasonable missing data by fitting the data corresponding to the adjacent time scales before and after the time scale of the missing data;
(3) meanwhile, in order to further improve the accuracy of fitting the missing data, the fitting equation is subjected to coefficient correction according to the power utilization time period, the fitting accuracy is improved, and through experiments, the error of the fitting result of the missing data can be controlled within the range of +/-13%.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is an overall flow chart of a historical data query collection method of the present invention;
FIG. 2 is a flowchart illustrating an overall process of obtaining a record address of a specified time stamp in the present invention;
FIG. 3 is a diagram of historical data acquisition of monitoring terminals in a certain area;
FIG. 4 is a data acquisition diagram after data compensation is performed by the linear fitting method of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Generally, in a conventional historical data query and collection method, whether a target task is completed or not is judged by comparing a read time scale set with a to-be-read time scale set, if the target task is not completed, a method for obtaining a record address of a specified time scale is executed once, and in the method for obtaining the record address of the specified time scale, a target time scale record needs to be read in a mode of traversing historical data, so that the data collection becomes very inefficient in a processing mode, and the processing speed is slow when the method is applied to a relatively low end of a processor of a branch line monitoring terminal, which causes the query and collection of historical data to be very slow, in a monitoring terminal, the historical data is stored and erased in a circulating mode in a normal condition, and the time scale data contained in the query task is generally continuous, so that under the condition that the first time scale can be queried accurately, based on the point that the subsequent target task can be basically judged as the target data in a sequential reading mode, after the recording address of the specified time mark is obtained for the first time, the subsequent mode can be carried out in an updating, assigning and reading mode, so that a large amount of traversal workload is saved, but the monitoring terminal can also have power failure and other accidents, so that the time mark is discontinuous, and in order to avoid the problem, a time mark checking flow is also added in the technical scheme, the recording address query of the specified time mark is avoided as much as possible, and through the time mark checking mode, whether the next time mark recording acquisition needs geological query work or not is judged.
Based on the above purpose, the present application proposes a following query acquisition scheme, and a specific flow is shown in fig. 1:
s1, acquiring a time mark set to be read, initializing the read time mark set, an output buffer area, reading records and a rereading mark to 0;
s2, acquiring a designated time mark from the time mark set to be read, judging whether the time mark set to be read is larger than the read time mark set, if not, assigning the content of the output buffer area to the read record and entering S1, and if so, entering S3;
s3, judging whether the read time mark set is 0 or the reread mark is 1, if yes, acquiring the recording address of the designated time mark, starting from the initial time mark of the time mark set to be read, and entering the step S4, otherwise, directly entering the step S4;
s4, obtaining a time mark in the recording address, judging whether the rereading mark is not 0, if so, assigning the rereading mark to be 0, reading the content of the corresponding recording address to an output buffer area, assigning the content to the reading record by the output buffer area, assigning a read time mark set +1, adding an interval time to the assigned time mark as a substituted initial assigned time mark, and entering the step S2, otherwise, entering the step S5;
s5, judging whether the time scale obtained in the step S4 is not equal to the initial designated time scale in the step S2, if so, assigning a rereading flag to be 1 and entering the step S2, otherwise, reading the content in the corresponding recording address to an output buffer area, assigning the content to a read record by the output buffer area, assigning a read time scale set +1, adding the interval time to the initial designated time scale as a substituted initial designated time scale and entering the step S2.
Based on the method, after one target time mark point data is obtained each time, the obtained time marks are compared, whether the obtained time marks are the target time marks or not is judged, whether the situation that time mark records are missing or not is screened, if the situation is that the time mark records are missing, the re-reading mark is assigned for the next cycle, whether the operation of re-obtaining the specified time mark record address is carried out or not is judged according to the assignment situation, generally, the time mark records are continuous, the operation is not carried out after the first specified time mark record address obtaining operation is carried out, the assignment reading is directly carried out on the time marks read next time, and the method can save the step of obtaining the useless specified time mark record addresses for many times.
In step S1, before data query and collection, the system first obtains a task, that is, a time scale set to be read, where the set is usually power consumption data of a certain time period, and generally reads and stores an instantaneous power consumption data into a flash memory after a fixed time length according to a data storage rule of a collection terminal, where data in the flash memory is recorded sequentially according to the fixed time length. After the task target is obtained, initializing each parameter to 0, and simultaneously obtaining a first time point in the task target, namely a designated time scale;
in step S2, it is first determined whether the reading record is completed, that is, it is determined whether the time mark set to be read is larger than the read time mark set, if the reading is completed, the temporary storage content of the buffer area is directly output to obtain the target data, and if the reading is not completed, the process proceeds to step S3;
in step S3, whether to perform the step of obtaining the timing mark recording address is determined according to whether the first reading is performed or whether the re-reading is required;
in steps S4 and S5, an operation of acquiring a corresponding address recorded with a designated time mark is performed, then a time mark in the address is acquired, whether the acquisition step is a condition of re-reading is determined, if yes, it is considered that the acquired address is a corrected correct address, a content in the address is output to a value buffer, and a corresponding re-assignment operation is performed, and then the process is repeated, if not, it is determined whether the time mark in the acquired address is consistent with a target time mark, a condition of discontinuous time marks is eliminated, and then whether re-copying of the re-reading mark and the reading sound is performed is determined according to the consistency, and the step is matched with step S3, thereby implementing a plurality of unnecessary operations of reading addresses with the designated time mark.
Specifically, as shown in fig. 2, the method for acquiring a record address of a specified time stamp in the present application includes:
step S31, reading the first record time mark of the flash memory, taking the address of the current time mark as the first address, judging whether the storage length of the flash memory is larger than the length of the content to be read, if so, entering step S32, and if not, returning to the value of 0 and ending;
step S32, reading the time mark of the current address storage record, judging whether the time mark is consistent with the designated time mark, if so, returning to the current address and ending, otherwise, entering step S33;
step S33, adding a length of a record to the current address as a substitute current address, subtracting the length of a record from the storage length of the flash memory as the substitute storage length of the flash memory, and going to step S31 to loop.
In the method, the records in the flash memory are compared with the target according to the storage sequence in a traversal mode, so that whether the target is obtained or not is judged, and the circulation is stopped until the target is obtained.
As can be seen from the step S31, since there may be empty storage in the flash memory, if the flash memory directly enters the buffer area and is recorded without screening, the problem of missing data acquisition results may be caused, and in order to avoid this problem, the scheme adopted in this application includes:
after the step S3 is finished, before the step S4 is performed, the method further includes determining whether the return value is not 0, if yes, the step S4 is performed, otherwise, the read record corresponding to the specified time mark is assigned, the read time mark set +1 is assigned, the initial specified time mark plus the interval time is used as the alternative initial specified time mark, and the step S2 is performed.
Missing data is supplemented in a manual assignment mode, and accuracy of data query and acquisition results is improved.
The conventional manual collection method mainly adopts the previous data point for filling or manually fills a fixed value, so that the processing mode inevitably causes deviation between the result and the reality, and especially when different power consumption times are staggered, the result accuracy is seriously influenced by adopting the previous data point or the manual data point filling mode.
Specifically, the method includes the steps of judging whether a read time scale set is not 0, if yes, obtaining read records corresponding to adjacent time scales which are closest to each other before and after the specified time scale, performing linear fitting according to adjacent read record values, calculating a value corresponding to the linear fitting at the specified time scale, and assigning the value to the read record corresponding to the specified time scale.
Under normal conditions, the change of the named power consumption quantity is continuously changed according to a certain trend, and the condition that the power consumption quantity is suddenly changed basically does not exist, so that after two points in an interval range are obtained, the target value of the middle position can be basically predicted according to the trends of the two points, and therefore the method adopts a linear fitting mode to perform predictive fitting on the value of the position of the target point, and the error of missing value supplement is greatly reduced.
Specifically, the fitting method of the present application includes: and respectively obtaining the latest time mark t1 before the specified time mark and a corresponding read record q1, and obtaining the earliest time mark t2 after the specified time mark and a read record q2 thereof to obtain a fitted straight line y = [ (q 2-q 1)/(t 2-t 1) ] x + q1, wherein x is the time difference between the specified time mark and the time mark t1, and y is the read record fitted at the specified time mark.
For the predicted value, usually, no great deviation is generated in a short time, but if the actual numerical value time point is located in the intersection area of different electricity utilization habits, a certain error exists in the ordinary linear fitting, for example, the electricity utilization valley and the electricity utilization peak are respectively before and after the missing point, the actual point position may still be in the electricity utilization valley, if the linear fitting is directly adopted, the fitted numerical value exceeds the conventional numerical value of the electricity utilization valley, which is caused by the influence of the electricity utilization peak numerical value, the fitting result is inaccurate, in order to avoid the inaccuracy problem caused by the condition, in the application, the linear fitting straight line is corrected, the time interval of one day is divided into the peak interval, the normal interval and the valley interval, the slope of the fitting straight line is corrected according to different time intervals, and the correction parameter is an empirical value.
Specifically, the fitting method of the present application includes: dividing the time interval of one day into a peak interval, a normal interval and a valley interval, judging the time intervals of t1 and t2, and correcting the fitting curve:
when t1 and t2 are both in the same time interval, the fitted curve is unchanged;
when t1 is in the peak interval and t2 is in the normal interval, the modified fitting curve y = [ (q 2-q 1) × 1.2/(t 2-t 1) ] x + q 1;
when t1 is in the peak region and t2 is in the valley region, the modified fitting curve y = [ (q 2-q 1) × 1.5/(t 2-t 1) ] x + q 1;
when t1 is in the normal interval and t2 is in the peak interval, the modified fitting curve y = [ (q 2-q 1) × 0.8/(t 2-t 1) ] x + q 1;
when t1 is in the normal interval and t2 is in the valley interval, the modified fitting curve y = [ (q 2-q 1) × 1.1/(t 2-t 1) ] x + q 1;
when t1 is located in the valley region and t2 is located in the normal region, the modified fitting curve y = [ (q 2-q 1) × 0.9/(t 2-t 1) ] x + q 1;
when t1 is located in the valley region and t2 is located in the peak region, the modified fitting curve y = [ (q 2-q 1) × 0.7/(t 2-t 1) ] x + q 1.
Correspondingly, the peak interval is (14:00,17:00] < U (19:00,22: 00), < normal interval is (8:00,14:00 > < U (17:00,19:00 > < U (22:00,24: 00), < valley interval is (0:00,8: 00).
The accuracy of the fitting results is shown in fig. 3 and 4, and a certain area is 7: the actual instantaneous power consumption trend of 45-8:15 is shown in fig. 3, wherein 7:45 instantaneous power consumption is 1365kW, 8:00 instantaneous power consumption is 1685kW, and 8:15 instantaneous power consumption is 2421kW, the method is adopted for prediction, the 7:45 and 8:15 instantaneous power consumption is used as an input parameter, a correction fitting curve is y = [ (q 2-q 1) = 0.9/(t 2-t 1) ] x + q1, the predicted 8:00 instantaneous power consumption is 1787.4 kW through calculation, the error from an actual value is 6%, and the prediction accuracy is high.
Further, if the read time mark set is not 0, further determining whether the corresponding specified time mark is the earliest record in the flash memory, if so, filling 0xff of a corresponding length of a record into the read record, assigning a read time mark set +1, adding the interval time to the initial specified time mark as a substitute initial specified time mark, and entering step S2; if not, the latest time mark recording address before the target time range in the flash memory is obtained, then the read time mark set +1 is assigned, the latest time mark before the target time range is added with the interval time as the alternative initial designated time mark, and the step S2 is entered.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (8)

1. A historical data query and collection method for a branch line monitoring terminal is characterized by comprising the following steps:
step S1, acquiring a time mark set to be read, initializing the read time mark set, outputting a buffer area, reading a record and re-reading a mark to 0;
step S2, acquiring a designated time mark, judging whether the time mark set to be read is larger than the read time mark set, if not, assigning the content of the output buffer area to the read record and entering step S1, and if so, entering step S3;
step S3, judging whether the read time mark set is 0 or the reread flag is 1, if yes, acquiring the record address of the specified time mark, and entering step S4, otherwise, directly entering step S5;
step S4, obtaining the time mark in the record address, judging whether the rereading mark is not 0, if yes, assigning the rereading mark to be 0, reading the content of the corresponding record address to an output buffer area, assigning the content to the read record by the output buffer area, assigning a read time mark set +1, adding the interval time to the specified time mark as a substituted specified time mark, and entering step S2, if not, entering step S5;
step S5, judging whether the time scale obtained in step S4 is not equal to the specified time scale in step S2, if so, assigning a rereading flag to be 1 and entering step S2, if not, reading the content in the corresponding recording address to an output buffer area, assigning the content to a read record by the output buffer area, assigning a read time scale set +1, adding the specified time scale and interval time as a substituted specified time scale and entering step S2;
in the above steps, the designated time stamp starts from the initial time stamp of the time stamp set to be read.
2. The method for inquiring and collecting the historical data of the branch line monitoring terminal according to claim 1, wherein in step S3, the method for obtaining the record address of the designated time stamp includes:
step S31, reading the first record time mark of the flash memory, taking the address of the current time mark as the first address, judging whether the storage length of the flash memory is larger than the length of the content to be read, if so, entering step S32, and if not, returning to the value of 0 and ending;
step S32, reading the time mark of the current address storage record, judging whether the time mark is consistent with the designated time mark, if so, returning to the current address and ending, otherwise, entering step S33;
step S33, adding a length of a record to the current address as a substitute current address, subtracting the length of a record from the storage length of the flash memory as the substitute storage length of the flash memory, and going to step S31 to loop.
3. The method as claimed in claim 2, wherein after the step S3 is completed, before the step S4 is performed, the method further includes determining whether the return value is not 0, if so, the step S4 is performed, otherwise, the read record corresponding to the specified time mark is assigned, the read time mark set +1 is assigned, and the specified time mark plus the interval time is used as the alternative specified time mark and the step S2 is performed.
4. The method for querying and collecting the historical data of the branch line monitoring terminal according to claim 3, wherein the step of assigning the read record corresponding to the specified time stamp comprises: and judging whether the read time scale set is not 0, if so, acquiring read records corresponding to adjacent time scales which are closest before and after the specified time scale, performing linear fitting according to adjacent read record values, calculating a value corresponding to the linear fitting at the specified time scale, and assigning the value to the read record corresponding to the specified time scale.
5. The method for querying and collecting the historical data of the branch line monitoring terminal according to claim 4, wherein the linear fitting method comprises obtaining a latest time scale t1 before a specified time scale and a corresponding read record q1 thereof, obtaining an earliest time scale t2 after the specified time scale and a read record q2 thereof, and obtaining a fitted straight line y = [ (q 2-q 1)/(t 2-t 1) ] x + q1, wherein x is a time difference between the specified time scale and a time scale t1, and y is the read record obtained by fitting at the specified time scale.
6. The method for inquiring and collecting the historical data of the branch line monitoring terminal according to claim 5, wherein the linear fitting method comprises dividing the time interval of the day into a peak interval, a normal interval and a valley interval, judging the time intervals of t1 and t2, and correcting the fitted straight line, wherein the fitted straight line is not changed when t1 and t2 are both in the same time interval; when t1 is in the peak interval and t2 is in the normal interval, the modified fitted straight line y = [ (q 2-q 1) × 1.2/(t 2-t 1) ] x + q 1; when t1 is located in the peak region and t2 is located in the valley region, the modified fitted straight line y = [ (q 2-q 1) × 1.5/(t 2-t 1) ] x + q 1; when t1 is in the normal interval and t2 is in the peak interval, the modified fitted straight line y = [ (q 2-q 1) × 0.8/(t 2-t 1) ] x + q 1; when t1 is in the normal interval and t2 is in the valley interval, the modified fitted straight line y = [ (q 2-q 1) × 1.1/(t 2-t 1) ] x + q 1; when t1 is located in the valley region and t2 is located in the normal region, the modified fitted straight line y = [ (q 2-q 1) × 0.9/(t 2-t 1) ] x + q 1; when t1 is located in the valley region and t2 is located in the peak region, the modified fitted straight line y = [ (q 2-q 1) × 0.7/(t 2-t 1) ] x + q 1.
7. The method according to claim 6, wherein the peak interval is (14:00,17: 00) U (19:00,22: 00), the normal interval is (8:00,14: 00) U (17:00,19: 00) U (22:00,24: 00), and the valley interval is (0:00,8: 00).
8. The historical data query collection method for the branch line monitoring terminal according to claim 4, wherein if the read time mark set is not 0, it is further determined whether the corresponding specified time mark is the earliest record in the flash memory, if so, 0xff of a record corresponding in length is filled into the read record, the read time mark set +1 is assigned, the specified time mark plus the interval time is taken as the alternative specified time mark, and the process proceeds to step S2; if not, the latest time mark recording address before the target time range in the flash memory is obtained, then the read time mark set +1 is assigned, the latest time mark before the target time range is added with the interval time as the substitute designated time mark, and the step S2 is performed.
CN202110792768.7A 2021-07-14 2021-07-14 Historical data query and acquisition method for branch line monitoring terminal Active CN113254475B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110792768.7A CN113254475B (en) 2021-07-14 2021-07-14 Historical data query and acquisition method for branch line monitoring terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110792768.7A CN113254475B (en) 2021-07-14 2021-07-14 Historical data query and acquisition method for branch line monitoring terminal

Publications (2)

Publication Number Publication Date
CN113254475A CN113254475A (en) 2021-08-13
CN113254475B true CN113254475B (en) 2021-09-28

Family

ID=77191311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110792768.7A Active CN113254475B (en) 2021-07-14 2021-07-14 Historical data query and acquisition method for branch line monitoring terminal

Country Status (1)

Country Link
CN (1) CN113254475B (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE69432875T2 (en) * 1993-12-18 2004-05-19 Sony Corp. Data playback device and data recording medium
CN104331446B (en) * 2014-10-28 2017-07-18 北京临近空间飞行器系统工程研究所 A kind of massive data processing method mapped based on internal memory
US10671596B1 (en) * 2015-03-31 2020-06-02 EMC IP Holding Company LLC Consistency determination

Also Published As

Publication number Publication date
CN113254475A (en) 2021-08-13

Similar Documents

Publication Publication Date Title
US10678686B2 (en) Estimation method for read and write access performance using average read retry times and a valid data weight ratio
WO2021091489A1 (en) Method and apparatus for storing time series data, and server and storage medium thereof
JP7279266B2 (en) Methods and apparatus for storing and querying time series data, and their servers and storage media
CN111400204A (en) Solid-state disk caching method, system and related equipment
CN111083008A (en) Nginx-based traffic collection and analysis method
CN113254475B (en) Historical data query and acquisition method for branch line monitoring terminal
CN109634960B (en) Key value data storage method, device, equipment and storage medium
CN108829345A (en) The data processing method and terminal device of journal file
CN116431066B (en) Data storage method, device, electronic equipment and storage medium
CN107943415B (en) Method and system for searching free cluster based on FAT file system
CN115391355A (en) Data processing method, device, equipment and storage medium
CN115686362A (en) Data freezing method of intelligent electric meter
CN114356218B (en) Data error correction method, device and medium of Flash memory
CN111767165B (en) Data processing method, device and control equipment
CN115163266A (en) Method, device, equipment and medium for determining ash load of particle catcher
CN111368931B (en) Method for determining learning rate of image classification model
CN112445835B (en) Business data processing method and device, network management server and storage medium
CN104679803B (en) Method and device for processing data output by oil level sensor of vehicle
CN109299018B (en) Method and device for reading historical data in Flash memory
CN113625954A (en) Volume information query method, device, equipment and readable storage medium
CN111563106A (en) Data caching method, device and system and readable storage medium
CN115459299B (en) Low-voltage distribution reactive power regulation method, device, computer equipment and storage medium
CN116307121B (en) Stock material rotation period prediction method and device
CN118118553B (en) Intelligent sensor data caching method and system based on edge calculation
CN115982096A (en) Real-time database snapshot storage method and system based on hotspot file

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