Data acquisition method and device, terminal and medium

By using the clock predictive function to calculate the clock deviation and adjust the collection of the time label, the data collection problem caused by the gap between the collection terminal and the clock to be collected is solved, and normal data collection and maintenance of the existence of clock deviations have reduced the maintenance of maintenance Cost and task pressure.

CN119383490APending Publication Date: 2025-01-28HOLLEY METERING LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411634659.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

When there is a clock difference between the acquisition terminal and the device to be collected, how to ensure that data acquisition and processing are not affected, and reduce the additional manual maintenance costs caused by clock error.

Method used

Based on the second clock based on the current first clock and the pre -determined clock prediction function to predict the target equipment, calculate the clock deviation, and use the clock deviation to adjust the initial collection time the label to obtain the target collection time the label to ensure the data collection of data collection Time and target equipment are consistent.

Benefits of technology

In the case of the deviation of the terminal and target equipment clocks, ensure the normal copy of the meter transmission data, reduce the pressure of operation and maintenance maintenance, reduce additional time task requirements, and improve the efficiency of collecting terminals and the service life of the target equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383490A_ABST
    Figure CN119383490A_ABST
Patent Text Reader

Abstract

The invention discloses a data acquisition method and device, a terminal and a medium, relates to the technical field of data acquisition, is applied to an acquisition terminal, and comprises the following steps: predicting a current second clock of target equipment based on a current local first clock and a predetermined clock prediction function, and calculating a clock skew based on the first clock and the second clock; determining a data type of to-be-collected target data, and calculating an initial collection time mark of the target data by using the first clock based on the data type; and adjusting the initial acquisition time mark by using the clock skew to obtain a target acquisition time mark, so as to acquire the target data in the target equipment based on the target acquisition time mark. Under the condition that clock out-of-tolerance occurs between the acquisition terminal and the target equipment, data acquisition and processing of the acquisition terminal and the target equipment are not affected, and extra manual maintenance cost caused by the clock out-of-tolerance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data acquisition technology, and in particular to a data acquisition method, device, terminal and medium. Background Art

[0002] For devices such as electric energy meters, water meters, gas meters, rail meters, and measuring switches, they all need to record the changes in the usage of a certain resource (such as electricity, water, and gas) over time, and in order to accurately count and bill, they all need clear time tags to determine the time period corresponding to the data. Therefore, it is necessary to use the corresponding collection terminal to be responsible for the data collection operation.

[0003] Taking the data collection of electric energy meters as an example, the power consumption information collection terminal is a device responsible for the collection of electric energy meter information at each information collection point, data management, data transmission, and execution or forwarding of control commands issued by the master station. Usually, the terminal collects electric energy meter data based on the terminal time. Due to the influence of the electric energy meter clock accuracy, clock battery, etc., the clock of the electric energy meter and the clock of the electric energy information collection terminal will deviate over time. When the deviation between the two exceeds a certain range (out of tolerance), the terminal's collection of electric energy meter data will be affected, which is manifested as the terminal cannot collect frozen data in the electric energy meter. At the same time, the failure to issue maintenance commands such as the failure of remote opening and closing of the electric energy meter seriously affects the terminal's data collection and maintenance of the electric energy meter.

[0004] At present, the common practice is to collect the real-time data of the electric energy meter, and then the terminal transfers the real-time data into daily frozen, monthly frozen, minute frozen data, etc. However, this method has great limitations, because the real-time data of the electric energy meter is changing all the time, and the terminal cannot trace the saved data. If a problem occurs and you want to view the original data of the meter, it cannot be achieved, and the wrong clock will cause the closing and closing to fail under the clock error. Due to the above reasons, when there is a deviation between the terminal and the electric energy meter clock, the time synchronization process will be started. Common time synchronization methods include terminal point-to-point time synchronization, terminal broadcast time synchronization, master station remote time synchronization, on-site manual time synchronization, etc. However, no matter which time synchronization method is used, it costs a certain price. For example, terminal point-to-point time synchronization and broadcast time synchronization require the terminal to perform additional time synchronization tasks, including reporting out-of-tolerance events, sending time synchronization, reporting time synchronization events, etc. For master station remote time synchronization, the master station needs to remotely send a time calibration command, which will interrupt the terminal's meter reading task and affect the terminal's original meter reading function. If the time is manually adjusted on site, additional manpower and material resources will be required. If the meter is damaged due to the clock battery, the meter will be directly replaced, which will reduce the service life of the meter.

[0005] In summary, how to ensure that data collection and processing of the collection terminal and the device to be collected are not affected when there is a clock deviation between the collection terminal and the device to be collected, and reduce the additional manual maintenance cost caused by the clock deviation is a problem that needs to be solved at present. Summary of the invention

[0006] In view of this, the purpose of the present invention is to provide a data collection method, device, terminal and medium, which can ensure that the data collection and processing of the collection terminal and the device to be collected are not affected when the clock difference between the collection terminal and the device to be collected is out of balance, and reduce the additional manual maintenance costs caused by the clock difference. The specific scheme is as follows:

[0007] In a first aspect, the present application discloses a data collection method, which is applied to a collection terminal, comprising:

[0008] Predicting a current second clock of the target device based on a local current first clock and a predetermined clock prediction function, so as to calculate a clock deviation based on the first clock and the second clock;

[0009] Determine a data type of target data to be collected, and calculate an initial collection time stamp of the target data using the first clock based on the data type;

[0010] The clock deviation is used to adjust the initial acquisition time scale to obtain a target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale.

[0011] Optionally, the data types include real-time data, daily frozen data, monthly frozen data and minute frozen data;

[0012] Accordingly, the calculating the initial acquisition time stamp of the target data by using the first clock based on the data type includes:

[0013] If the target data to be collected is real-time data, the first clock is directly used as the initial collection time stamp of the target data;

[0014] If the target data to be collected is daily frozen data, the first clock is adjusted according to a one-day cycle using a preset first time adjustment formula to obtain an initial collection time scale of the target data;

[0015] If the target data to be collected is monthly frozen data, the first clock is converted from a timestamp format to a preset date and time format, and the first clock after the format conversion is normalized according to a monthly cycle, and then the normalized first clock is converted to a timestamp format to obtain an initial collection time stamp of the target data;

[0016] If the target data to be collected is minute frozen data, the first clock is adjusted according to a period of preset minutes using a preset second time adjustment formula to obtain an initial collection time mark of the target data.

[0017] Optionally, the adjusting the initial acquisition time scale by using the clock deviation to obtain a target acquisition time scale includes:

[0018] Determining whether the value of the clock deviation is zero;

[0019] If the value of the clock deviation is zero, the initial acquisition time scale is used as the target acquisition time scale;

[0020] If the value of the clock deviation is not zero, the initial acquisition time scale is adjusted by using a time scale adjustment rule corresponding to the data type set based on the clock deviation to obtain a target acquisition time scale.

[0021] Optionally, the adjusting the initial acquisition time scale by using the time scale adjustment rule corresponding to the data type set based on the clock deviation to obtain a target acquisition time scale includes:

[0022] If the data type is real-time data, performing a difference operation on the initial acquisition time scale and the clock deviation to obtain a first operation result, and using the first operation result as the target acquisition time scale;

[0023] If the data type is daily frozen data, the second clock is rounded according to a one-day cycle using a preset first time rounding formula to obtain a first rounded clock, and a difference operation is performed on the initial acquisition time scale and the first rounded clock to obtain a second operation result, so that the difference between the initial acquisition time scale and the second operation result is used as the target acquisition time scale;

[0024] If the data type is monthly frozen data, the first time rounding formula is used to round the first clock and the second clock according to a one-day cycle to obtain a second rounded clock and a third rounded clock, and a difference operation is performed on the second rounded clock and the third rounded clock to obtain a third operation result, so that the difference between the initial collection time scale and the third operation result is used as the target collection time scale;

[0025] If the data type is minute frozen data, the second clock is rounded to a period of a preset number of minutes using a preset second time rounding formula to obtain a fourth rounded clock, and a difference operation is performed on the initial acquisition time stamp and the fourth rounded clock to obtain a fourth operation result, so that the difference between the initial acquisition time stamp and the fourth operation result is used as the target acquisition time stamp.

[0026] Optionally, after acquiring the target data in the target device based on the target acquisition time stamp, the method further includes:

[0027] If the value of the clock deviation is zero, the collected target data is directly stored;

[0028] If the value of the clock deviation is not zero and the target data carries a time parameter, a difference operation is performed between the time parameter and the clock deviation, and the difference operation result is stored.

[0029] Optionally, the data collection method further includes:

[0030] When a maintenance command is issued to the target device, if the maintenance command carries a time parameter, a difference operation is performed on the time parameter and the clock deviation, and the time parameter in the maintenance command is updated using the difference operation result, so that the updated maintenance command is issued to the target device.

[0031] Optionally, the process of determining the clock prediction function includes:

[0032] When the current time meets the timestamp specified by the preset clock collection cycle, the current terminal clock is determined and the current device clock is collected;

[0033] Inputting the current terminal clock into a number of interpolation functions constructed based on historical terminal clocks and historical device clocks to obtain a predicted device clock;

[0034] The absolute value of the difference between each of the predicted device clocks and the current device clock is calculated respectively, and the interpolation function corresponding to the minimum absolute value is determined as the clock prediction function.

[0035] In a second aspect, the present application discloses a data collection device, which is applied to a collection terminal, comprising:

[0036] A clock deviation calculation module, used to predict a current second clock of a target device based on a local current first clock and a predetermined clock prediction function, so as to calculate a clock deviation based on the first clock and the second clock;

[0037] An acquisition time-scale calculation module, used for determining a data type of target data to be acquired, and calculating an initial acquisition time-scale of the target data using the first clock based on the data type;

[0038] The data acquisition module is used to adjust the initial acquisition time scale by using the clock deviation to obtain a target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale.

[0039] In a third aspect, the present application discloses a collection terminal, including:

[0040] Memory, used to store computer programs;

[0041] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed data collection method.

[0042] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed data acquisition method are implemented.

[0043] It can be seen that in the present application, the acquisition terminal predicts the current second clock of the target device based on the local current first clock and a predetermined clock prediction function, so as to calculate the clock deviation based on the first clock and the second clock; determines the data type of the target data to be collected, and calculates the initial collection time stamp of the target data based on the data type using the first clock; uses the clock deviation to adjust the initial collection time stamp to obtain the target collection time stamp, so as to collect the target data in the target device based on the target collection time stamp.

[0044] Beneficial effect: In the present application, when the acquisition terminal needs to acquire data in the target device, it is first necessary to determine the current first clock of the local area, and predict the current second clock of the target device based on the first clock and the predetermined clock prediction function, so as to calculate the clock deviation between the terminal and the target device based on the first clock and the second clock. Further, the data type of the target data that needs to be acquired is determined, so as to calculate the initial acquisition time scale of the target data based on the data type using the first clock. It can be understood that when the acquisition terminal acquires data in the target device, the acquisition time scale used when issuing meter reading data is different according to different data types. Therefore, the present application needs to calculate the corresponding initial acquisition time scale based on the data type of the target data. Finally, the present application needs to adjust the initial acquisition time scale using the clock deviation to obtain the target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale. By adjusting the initial acquisition time scale using the clock deviation, the acquisition time can be made consistent with the time of the target device, so that the data in the target device can be acquired smoothly, avoiding the situation where the data cannot be acquired due to inconsistent time scales. In this way, through the above scheme, it can be seen that the present application allows a deviation between the clock of the target device and the clock of the collection terminal, and in the case of a deviation, it can also ensure that the meter reading data is read normally, without the need to spend the cost to maintain the clock of the target device, thereby reducing the pressure of operation and maintenance of the clock of the target device, and there is no need to perform additional time synchronization tasks, reducing the additional task pressure of the collection terminal. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0046] Figure 1 A flow chart of a data collection method disclosed in this application;

[0047] Figure 2 A flow chart of a specific data collection method disclosed in this application;

[0048] Figure 3 A flow chart of calculation and adjustment of an acquisition time scale disclosed in the present application;

[0049] Figure 4 This is a flowchart of a terminal issuing task disclosed in this application;

[0050] Figure 5 This is a structural schematic diagram of a data acquisition device disclosed in this application;

[0051] Figure 6 This is a structural diagram of a data collection terminal disclosed in this application. DETAILED DESCRIPTION

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

[0053] Taking the data collection of electric energy meters as an example, currently, the terminal collects the data of electric energy meters based on the time of the terminal. Due to the influence of the accuracy of the electric energy meter clock, clock battery, etc., the clock of the electric energy meter and the clock of the power consumption information collection terminal will deviate over time. When the two deviate and exceed a certain range (excessive tolerance), the terminal will not be able to collect the frozen data in the electric energy meter. The usual practice is to collect the real-time data of the electric energy meter, and the terminal will transfer the real-time data into daily frozen, monthly frozen, minute frozen data, etc. However, this method has great limitations, because the real-time data of the electric energy meter is changing all the time, and the terminal cannot trace the saved data. If a problem occurs and you want to view the original data of the meter, it cannot be achieved, and the wrong clock will cause the closing and closing to fail under the clock error. Due to the above reasons, when there is a deviation between the terminal and the electric energy meter clock, the time synchronization process will be started. Common time synchronization methods include terminal point-to-point time synchronization, terminal broadcast time synchronization, master station remote time synchronization, on-site manual time synchronization, etc., but no matter which time synchronization method is used, it costs a certain price.

[0054] To this end, the embodiments of the present application disclose a data collection method, device, terminal and medium, which can ensure that data collection and processing of the collection terminal and the device to be collected are not affected when a clock deviation occurs between the collection terminal and the device to be collected, and reduce the additional manual maintenance costs caused by the clock deviation.

[0055] See also Figure 1 As shown, the embodiment of the present application discloses a data collection method, which includes:

[0056] Step S11: predicting the current second clock of the target device based on the local current first clock and a predetermined clock prediction function, so as to calculate the clock deviation based on the first clock and the second clock.

[0057] In this embodiment, when the terminal needs to collect data from the target device, it first needs to determine the current local first clock, and predict the current second clock of the target device based on the first clock and a predetermined clock prediction function, thereby calculating the clock deviation between the terminal and the target device based on the first clock and the second clock.

[0058] It should be pointed out that the clock prediction function in this application is predetermined. The determination process of the clock prediction function includes: when the current time meets the timestamp specified by the preset clock acquisition cycle, determine the current terminal clock and collect the current device clock; input the current terminal clock into a number of interpolation functions constructed based on the historical terminal clock and the historical device clock to obtain the predicted device clock; calculate the absolute value of the difference between each predicted device clock and the current device clock, and determine the interpolation function corresponding to the minimum absolute value as the clock prediction function.

[0059] The following takes the target device as an electric energy meter as an example to illustrate the technical solution of the present application. Therefore, the device clocks mentioned above are all electric energy meter clocks. First, the preset clock collection cycle for collecting the electric energy meter clock is fixed. For example, it can be set to once a day, that is, the clock of the electric energy meter is collected every 24 hours, and it can be specifically set at zero o'clock every day. Therefore, when the current time meets the timestamp specified by the preset clock collection cycle, the current terminal clock is recorded and the current electric energy meter clock is collected. The current terminal clock is recorded as x0, and the current electric energy meter clock is recorded as y0, where x0 and y0 are both in time_t format, which is referred to as timestamp, specifically referring to the total number of seconds from 00:00:00 on January 1, 1970, Greenwich time to the present. Take x0 and y0 as samples and input the clock prediction function, recorded as Pre_diff_in(x0, y0).

[0060] Pre_diff_in(x0, y0) is processed as follows:

[0061] Select the clock of the last i cycles of the electric energy meter collected by the terminal according to the preset clock collection cycle, record the corresponding terminal clock as xi, and record the electric energy meter clock as yi, then the historical terminal clock and historical electric energy meter clock of the last three cycles are recorded as (x1, y1), (x2, y2), (x3, y3), and the function trend of the terminal clock and the electric energy meter clock is derived through the clock discrete points of the three cycles. This embodiment specifically selects three interpolation methods, and substitutes these data into the interpolation formula in turn to construct the corresponding interpolation function. It should be pointed out that the number of interpolation formulas is not limited to the three given in this embodiment, and the type of interpolation formula can also be selected and set according to the actual situation, and this implementation does not limit this.

[0062] Interpolation formula 1 is a linear interpolation formula. Select two groups of two discrete points (x1, y1) and (x2, y2), (x2, y2) and (x3, y3) respectively. The expression of the function can be obtained by linear interpolation:

[0063] (a)f(x)=y1+(x-x1)(y2-y1) / (x2-x1);

[0064] (b)f(x)=y2+(x–x2)(y3–y2) / (x3–x2);

[0065] Interpolation formula 2 is the Lagrange interpolation formula. Lagrange interpolation is a polynomial interpolation method that can construct a polynomial function expression through given discrete points:

[0066] (c)f(x)=y1(x-x2)(x-x3) / (x1-x2)(x1-x3)+y2(x-x1)(x-x3) / (x2-x1)(x2-x3)+y3(x-x1)(x-x2) / (x3-x1)(x3-x2);

[0067] Interpolation formula 3 is the Newton interpolation formula. Newton interpolation is also a polynomial interpolation method that can construct a polynomial function expression through given discrete points:

[0068] Let f(x1)=y1;

[0069] f(x1,x2)=(y1-y2) / (x1-x2);

[0070] f(x2,x3)=(y2-y3) / (x2-x3);

[0071] f(x1,x2,x3)=(f(x1,x2)-f(x2,x3)) / (x1-x3);

[0072] (d)f(x)=f(x1)+(x-x1)f(x1,x2)+(x-x1)(x-x2)f(x1,x2,x3);

[0073] The present application inputs the current terminal clock into the above four interpolation functions constructed based on the historical terminal clock and the historical electric energy meter clock to obtain the predicted electric energy meter clock. That is, the present application takes x=x0, and substitutes it into the four interpolation function expressions (a), (b), (c), and (d) in turn to obtain the predicted electric energy meter clock f(x), and then calculates the absolute value of the difference between each predicted electric energy meter clock and the current electric energy meter clock, so as to determine the interpolation function corresponding to the minimum absolute value as the clock prediction function. That is, the present application takes the expression of the minimum value of |f(x)-y0| as the clock prediction function used to predict the electric energy meter clock when reading the meter.

[0074] In this way, the current local first clock is recorded as T1, and according to the obtained clock prediction function f(x), x=T1 is taken, and f(T1) is the current second clock of the target electric energy meter, recorded as T2. Then the clock deviation between the terminal and the electric energy meter at time T1 is ΔT=T1-T2.

[0075] Step S12: Determine the data type of the target data to be collected, and calculate the initial collection time stamp of the target data using the first clock based on the data type.

[0076] In this embodiment, the data type of the target data that needs to be collected is determined, and the initial collection time stamp of the target data is calculated based on the data type using the first clock. It can be understood that when the terminal collects data from the target device, the collection time stamp used when sending the meter reading data is different according to different data types. Therefore, this application needs to calculate the corresponding initial collection time stamp based on the data type of the target data.

[0077] Step S13: using the clock deviation to adjust the initial acquisition time scale to obtain a target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale.

[0078] In this embodiment, still taking the target device as an electric energy meter as an example, after calculating the initial acquisition time scale, it is necessary to use the clock deviation to adjust the initial acquisition time scale to obtain the target acquisition time scale, so as to collect the target data in the target electric energy meter based on the target acquisition time scale. By adjusting the initial acquisition time scale using the clock deviation, the acquisition time can be made consistent with the time of the electric energy meter, so that the data in the electric energy meter can be collected smoothly, avoiding the situation where the data cannot be collected due to inconsistent time scales. In this way, it can be seen from the above scheme that the present application allows the electric energy meter clock to have a deviation from the terminal clock, and in the case of a deviation, it can also ensure that the meter reading data is read normally, without the need to spend money to maintain the electric energy meter clock, thereby reducing the pressure of operation and maintenance of the electric energy meter clock, and there is no need to perform additional time synchronization tasks, reducing the additional task pressure of the terminal.

[0079] It can be seen that in this application, when the acquisition terminal needs to acquire data in the target device, it is first necessary to determine the current first clock of the local area, and predict the current second clock of the target device based on the first clock and the predetermined clock prediction function, so as to calculate the clock deviation between the terminal and the target device based on the first clock and the second clock. Further, the data type of the target data that needs to be acquired is determined, so as to calculate the initial acquisition time scale of the target data based on the data type using the first clock. It can be understood that when the acquisition terminal acquires data in the target device, the acquisition time scale used when issuing meter reading data is different according to different data types. Therefore, this application needs to calculate the corresponding initial acquisition time scale based on the data type of the target data. Finally, this application needs to adjust the initial acquisition time scale using the clock deviation to obtain the target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale. By adjusting the initial acquisition time scale using the clock deviation, the acquisition time can be made consistent with the time of the target device, so that the data in the target device can be acquired smoothly, avoiding the situation where data cannot be acquired due to inconsistent time scales. In this way, through the above scheme, it can be seen that the present application allows a deviation between the clock of the target device and the clock of the collection terminal, and in the case of a deviation, it can also ensure that the meter reading data is read normally, without the need to spend the cost to maintain the clock of the target device, thereby reducing the pressure of operation and maintenance of the clock of the target device, and there is no need to perform additional time synchronization tasks, reducing the additional task pressure of the collection terminal.

[0080] See also Figure 2 As shown, the embodiment of the present application discloses a specific data collection method. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, it includes:

[0081] Step S21: predicting the current second clock of the target device based on the local current first clock and a predetermined clock prediction function, so as to calculate the clock deviation based on the first clock and the second clock.

[0082] Step S22: Determine the data type of the target data to be collected, and calculate the initial collection time stamp of the target data using the first clock based on the data type.

[0083] In this embodiment, the above data types can mainly include real-time data, daily frozen data, monthly frozen data and minute frozen data. Correspondingly, the calculation of the initial acquisition time scale of the target data using the first clock based on the data type includes: if the target data to be collected is real-time data, the first clock is directly used as the initial acquisition time scale of the target data; if the target data to be collected is daily frozen data, the first clock is adjusted according to a cycle of one day using a preset first time rounding formula to obtain the initial acquisition time scale of the target data; if the target data to be collected is monthly frozen data, the first clock is converted from a timestamp format to a preset date and time format, and the first clock after the format conversion is adjusted according to a cycle of one month, and then the adjusted first clock is converted to a timestamp format to obtain the initial acquisition time scale of the target data; if the target data to be collected is minute frozen data, the first clock is adjusted according to a cycle of a preset number of minutes using a preset second time rounding formula to obtain the initial acquisition time scale of the target data.

[0084] That is, if Figure 3 As shown, taking the collection of electric energy meter data as an example, this application needs to calculate the initial collection time scale used when collecting different types of electric energy meter data based on T1. Assuming T1=947470800, the details are as follows:

[0085] 1. If the target data to be collected is real-time data, the first clock is directly used as the initial collection time stamp of the real-time data, that is, when collecting real-time data, the time does not need to be processed, and it is recorded as T_Real=T1. For example, when T1=947470800, it is the total number of seconds from 00:00:00 on January 1, 1970 to 10:20:00 on January 10, 2000 Greenwich Mean Time, that is, the clock at this moment is 10:20:00 on January 10, 2000.

[0086] 2. If the target data to be collected is daily frozen data, the first clock is adjusted according to the cycle of one day using the preset first time rounding formula to obtain the initial collection time stamp of the daily frozen data. Specifically, the cycle of the daily frozen data is 1 day, which is converted into the second interval D_I=24*60*60, T_Day=T1 / D_I*D_I. According to the program processing rules, the first time rounding formula will round T1 according to the cycle of 1 day to 0:00 on the day, and the initial collection time stamp used for collecting the daily frozen data time stamp is 0:00 on January 10, 2000.

[0087] 3. If the target data to be collected is monthly frozen data, first convert the first clock from the timestamp format (time_t format) to the preset date and time format (YY-MM-DD HH:MM:SS format), that is, 10:20 on January 10, 2000, and then adjust the first clock after the format conversion according to the cycle of one month, that is, modify it to 0:00 on January 1, 2000, and then convert the adjusted first clock to the timestamp format to obtain the initial collection time stamp of the monthly frozen data, recorded as T_Mon; that is, the time stamp used to collect the monthly frozen time stamp corresponds to 0:00 on January 1, 2000.

[0088] 4. If the target data to be collected is minute frozen data, the first clock is adjusted according to the preset number of minutes using the preset second time rounding formula to obtain the initial collection time scale of the minute frozen data. Specifically, assuming that the period of the minute frozen data is 15 minutes, the conversion to the second interval is M_I=15*60, T_Min=T1 / M_I*M_I. According to the program processing rules, the second time rounding formula can round the time to the time of the most recent 15-minute period, and the time scale used to collect the 15-minute frozen time scale is 10:15 on January 10, 2000. The other minute freezing processes are the same as above, and M_I is changed to the corresponding minute freezing period.

[0089] Step S23: determining whether the value of the clock deviation is zero; if the value of the clock deviation is zero, taking the initial acquisition time stamp as the target acquisition time stamp.

[0090] In this embodiment, when the clock deviation is used to adjust the initial acquisition time scale, it is first determined whether the value of the clock deviation is zero. If the value of the clock deviation is zero, it means that there is no deviation between the acquisition terminal and the target device, and the initial acquisition time scale is directly used as the target acquisition time scale. That is, when ΔT is 0, the time scales used for collecting real-time data, daily frozen data, monthly frozen data, and minute frozen data are T_Real, T_Day, T_Mon, and T_Min, respectively.

[0091] Step S24: If the value of the clock deviation is not zero, the initial acquisition time scale is adjusted by using a time scale adjustment rule corresponding to the data type and set based on the clock deviation to obtain a target acquisition time scale.

[0092] In this embodiment, when the value of the clock deviation is not zero, it indicates that there is a deviation between the acquisition terminal and the target device, including positive deviation and negative deviation. At this time, it is necessary to adjust the initial acquisition time scale by using the time scale adjustment rule corresponding to the data type set based on the clock deviation to obtain the target acquisition time scale.

[0093] In a specific implementation, the above-mentioned use of the time scale adjustment rule corresponding to the data type set based on the clock deviation to adjust the initial acquisition time scale to obtain the target acquisition time scale includes: if the data type is real-time data, then performing a difference operation on the initial acquisition time scale and the clock deviation to obtain a first operation result, and using the first operation result as the target acquisition time scale; if the data type is daily frozen data, then using a preset first time rounding formula to round the second clock according to a one-day cycle to obtain a first rounded clock, and performing a difference operation on the initial acquisition time scale and the first rounded clock to obtain a second operation result, so as to use the difference between the initial acquisition time scale and the second operation result as the target acquisition time scale; if the data type is daily frozen data, then performing a difference operation on the second clock according to a one-day cycle to obtain a first rounded clock, and using the difference between the initial acquisition time scale and the first rounded clock to obtain a second operation result, so as to use the difference between the initial acquisition time scale and the second operation result as the target acquisition time scale; If the data type is frozen data in months, the first time rounding formula is used to round the first clock and the second clock to a period of one day to obtain a second rounded clock and a third rounded clock, and a difference operation is performed on the second rounded clock and the third rounded clock to obtain a third operation result, so that the difference between the initial collection time mark and the third operation result is used as the target collection time mark; if the data type is frozen data in minutes, the preset second time rounding formula is used to round the second clock to a period of a preset number of minutes to obtain a fourth rounded clock, and a difference operation is performed on the initial collection time mark and the fourth rounded clock to obtain a fourth operation result, so that the difference between the initial collection time mark and the fourth operation result is used as the target collection time mark.

[0094] Take the target device as an electric energy meter as an example. That is, when the clock deviation is not zero, for data of different data types in the electric energy meter, different time scale adjustment rules need to be set according to the clock deviation to adjust the calculated initial acquisition time scale, such as Figure 3 As shown, the details are as follows:

[0095] 1. If the data type is real-time data, its initial acquisition time scale is T_Real, and the corresponding time scale adjustment rule is to perform a difference operation on the initial acquisition time scale and the clock deviation to obtain a first operation result, and use the first operation result as the target acquisition time scale, that is, the target acquisition time scale T_real_meter=T_Real-ΔT.

[0096] 2. If the data type is daily frozen data, its initial collection time stamp is T_Day, and the corresponding time stamp adjustment rule is to first use the first time rounding formula to round the second clock according to a one-day cycle to obtain the first rounded clock, that is, T2_day=T2 / D_I*D_I, and then perform a difference operation on the initial collection time stamp T_Day and the first rounded clock T2_day to obtain the second operation result, that is, ΔT_day=T_Day-T2_day, ΔT_day represents the time difference between the daily frozen time stamps of the terminal and the electric energy meter clock, and then use the difference between the initial collection time stamp T_Day and the second operation result ΔT_day as the target collection time stamp, that is, the target collection time stamp T_day_meter=T_day-ΔT_day.

[0097] 3. If the data type is monthly frozen data, its initial collection time stamp is T_Mon. It should be pointed out that when the clock difference between the terminal and the electric energy meter is too large, after the terminal and the electric energy meter time are adjusted by month, the deviation of the monthly frozen time is large, so it is adjusted by daily frozen time. When reading, the daily frozen data in the electric energy meter is used as the monthly frozen data. The corresponding time scale adjustment rule is to first use the first time rounding formula to round the first clock and the second clock according to the cycle of one day to obtain the second rounded clock and the third rounded clock, that is, according to T1, the program calculates the time of 0 o'clock on T1 day, recorded as T1_mon, T1_mon=T1 / D_I*D_I, where D_I=24*60*60. Similarly, T2_mon=T2 / D_I*D_I. Then, the second rounded clock T1_mon and the third rounded clock T2_mon are differenced to obtain the third operation result, that is, ΔT_mon=T1_mo–T2_mon, ΔT_mon represents the daily time difference between the terminal and the electric energy meter clock. Finally, the difference between the initial acquisition time scale T_Mon and the third operation result ΔT_mon is used as the target acquisition time scale, that is, the target acquisition time scale T_mon_meter=T_Mon-ΔT_mon.

[0098] 4. If the data type is minute frozen data, its initial acquisition time scale is T_Min, and the corresponding time scale adjustment rule is to first use the second time rounding formula to round the second clock according to the preset number of minutes to obtain the fourth rounded clock, that is, T2_min=T2 / M_I*M_I, and then perform a difference operation on the initial acquisition time scale T_Min and the fourth rounded clock T2_min to obtain the fourth operation result, that is, ΔT_min=T1_min-T2_min. ΔT_min is the time difference between the terminal and the minute frozen time of the electric energy meter, and finally the difference between the initial acquisition time scale T_Min and the fourth operation result ΔT_min is used as the target acquisition time scale, that is, the target acquisition time scale T_Min_meter=T_Min-ΔT_min.

[0099] Step S25: collecting the target data in the target device based on the target collection time stamp.

[0100] In this embodiment, target data in the target device is collected based on the target collection time stamp. Figure 4 As shown, taking the collection of electric energy meter data as an example, when collecting real-time data, the clock deviation between the terminal clock and the electric energy meter clock is determined. When ΔT is not 0, T_Real_meter is used to collect the real-time data of the electric energy meter, otherwise T_Real is used to collect the real-time data of the electric energy meter. When collecting daily frozen data, if ΔT_day is not 0, T_Day_meter is used as the daily freezing time mark to collect the daily frozen data of the electric energy meter, otherwise T_Day is used to collect the daily frozen data of the electric energy meter. When collecting monthly frozen data, if ΔT_mon is not 0, T_Mon_meter is used as the monthly freezing time mark to collect the monthly frozen data of the electric energy meter, otherwise T_Mon is used to collect the monthly frozen data of the electric energy meter. When collecting minute frozen data, if ΔT_min is 0, T_Min_meter is used as the minute freezing time mark to collect the minute frozen data of the electric energy meter, otherwise T_Min is used to collect the minute frozen data of the electric energy meter. In addition, for data of other data types, there is no need to process time and data can be collected directly.

[0101] It should also be pointed out that after the target data in the target device is collected based on the target collection time stamp, the following steps are also included: if the value of the clock deviation is zero, the collected target data is directly stored; if the value of the clock deviation is not zero, and the target data carries a time parameter, the time parameter is subtracted from the clock deviation, and the result of the subtraction is stored. That is, if ΔT is zero, the collected target data is directly stored; if ΔT is not zero, and the collected target data also carries a time parameter, the time parameter is subtracted from the clock deviation, and the result of the subtraction is stored. For example, if the real-time data contains time parameters, such as the time when the maximum demand occurs, it is recorded as DATA_TIME_Real, processed as DATA_TIME_Real-ΔT, and then the processed value is stored; if the daily frozen data contains time, it is processed as DATA_TIME_Day-ΔT_day, and then the processed value is stored; if the monthly frozen data contains time, it is processed as DATA_TIME_Mon-ΔT_mon, and then the processed value is stored; if the minute frozen data contains time, it is processed as DATA_TIME_Min-ΔT_min, and then the processed value is stored.

[0102] In this way, since the time of the acquisition terminal is consistent with the time of the target device, the frozen data in the target device can be collected smoothly, and the data cannot be collected due to incorrect time stamps. At the same time, all data comes from the target device, and the data with time parameters will also be synchronized with the terminal clock and stored after processing. Therefore, all data stored and reported with time parameters are based on the terminal clock. Therefore, it can be considered that there is no problem of out-of-tolerance on the target device, and it always maintains consistency with the terminal clock. Data without time parameters is directly stored and reported, and the data source is reliable and traceable.

[0103] When it is necessary to trace the data in the terminal, record the acquisition time stamp T_read used for different data collection, as well as the time deviation ΔT_read between the terminal and the target device at the time of collection. If the data contains a time stamp, the real data DATA_deal of the target device is obtained after processing according to ΔT_read. Use a tool that reads the target device, such as a handheld device, to directly use the acquisition time stamp T_read to collect the data DATA_meter of the target device, and determine the consistency of DATA_deal and DATA_meter to achieve the purpose of data tracing.

[0104] In addition, if Figure 4 As shown, in addition to issuing collection tasks, the terminal can also issue maintenance tasks to maintain the target device. Therefore, the above method also includes: when issuing a maintenance command to the target device, if the maintenance command carries a time parameter, the time parameter and the clock deviation are differenced, and the time parameter in the maintenance command is updated using the difference result to issue the updated maintenance command to the target device. That is, when the terminal performs maintenance on the target device, it determines whether the issued maintenance command carries a time parameter. If it carries a time parameter, the time parameter is taken out and recorded as T_send, and after T_send-ΔT processing, it is issued for maintenance. In this way, since the issued time is consistent with the time of the target device, the target device can be smoothly maintained, such as opening and closing the switch.

[0105] For a more specific processing procedure of the above step S21, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0106] It can be seen that through the above scheme, this application first allows the time of the target device to deviate from the terminal time. Therefore, there is no need to spend money to maintain the clock of the target device, nor is there any need to perform additional time synchronization tasks. Secondly, in the case of deviations, it can also ensure that the meter reading data is read normally, and the data source in the terminal is reliable and can be traced. At the same time, the remote maintenance of the target device is not affected, which reduces the additional task pressure of the terminal and improves the meter reading efficiency of the terminal. At the same time, it reduces the pressure of operation and maintenance of the target device clock and can also increase the service life of the target device.

[0107] See also Figure 5 As shown, the embodiment of the present application discloses a data acquisition device, which is applied to a collection terminal, including:

[0108] A clock deviation calculation module 11, configured to predict a current second clock of a target device based on a local current first clock and a predetermined clock prediction function, so as to calculate a clock deviation based on the first clock and the second clock;

[0109] An acquisition time-scale calculation module 12, used for determining a data type of target data to be acquired, and calculating an initial acquisition time-scale of the target data using the first clock based on the data type;

[0110] The data acquisition module 13 is used to adjust the initial acquisition time scale by using the clock deviation to obtain a target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale.

[0111] It can be seen that in this application, when the acquisition terminal needs to acquire data in the target device, it is first necessary to determine the current first clock of the local area, and predict the current second clock of the target device based on the first clock and the predetermined clock prediction function, so as to calculate the clock deviation between the terminal and the target device based on the first clock and the second clock. Further, the data type of the target data that needs to be acquired is determined, so as to calculate the initial acquisition time scale of the target data based on the data type using the first clock. It can be understood that when the acquisition terminal acquires data in the target device, the acquisition time scale used when issuing meter reading data is different according to different data types. Therefore, this application needs to calculate the corresponding initial acquisition time scale based on the data type of the target data. Finally, this application needs to adjust the initial acquisition time scale using the clock deviation to obtain the target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale. By adjusting the initial acquisition time scale using the clock deviation, the acquisition time can be made consistent with the time of the target device, so that the data in the target device can be acquired smoothly, avoiding the situation where data cannot be acquired due to inconsistent time scales. In this way, through the above scheme, it can be seen that the present application allows a deviation between the clock of the target device and the clock of the collection terminal, and in the case of a deviation, it can also ensure that the meter reading data is read normally, without the need to spend the cost to maintain the clock of the target device, thereby reducing the pressure of operation and maintenance of the clock of the target device, and there is no need to perform additional time synchronization tasks, reducing the additional task pressure of the collection terminal.

[0112] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part refer to the description of the embodiments of the method part, which will not be described here. In addition, the invention has the same beneficial effects as the above-mentioned data acquisition method.

[0113] Figure 6 A schematic diagram of the structure of a collection terminal provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data collection method performed by the collection terminal disclosed in any of the aforementioned embodiments.

[0114] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the acquisition terminal 20; the communication interface 24 can create a data transmission channel between the acquisition terminal 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0115] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0116] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0117] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the acquisition terminal 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the data acquisition method performed by the acquisition terminal 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the acquisition terminal, the data 223 can also include data collected by its own input and output interface 25, etc.

[0118] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the data acquisition method disclosed in any of the aforementioned embodiments are implemented.

[0119] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0120] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0121] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.

[0122] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0123] The above is a detailed introduction to a data acquisition method, device, terminal and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A data collection method, characterized in that: Applied to acquisition terminals, including: Predicting a current second clock of the target device based on a local current first clock and a predetermined clock prediction function, so as to calculate a clock deviation based on the first clock and the second clock; Determine a data type of target data to be collected, and calculate an initial collection time stamp of the target data using the first clock based on the data type; The clock deviation is used to adjust the initial acquisition time scale to obtain a target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale.

2. The data collection method according to claim 1, characterized in that: The data types include real-time data, daily frozen data, monthly frozen data and minute frozen data; Accordingly, the step of calculating the initial acquisition time stamp of the target data by using the first clock based on the data type includes: If the target data to be collected is real-time data, the first clock is directly used as the initial collection time stamp of the target data; If the target data to be collected is daily frozen data, the first clock is adjusted according to a one-day cycle using a preset first time adjustment formula to obtain an initial collection time scale of the target data; If the target data to be collected is monthly frozen data, the first clock is converted from a timestamp format to a preset date and time format, and the first clock after the format conversion is normalized according to a monthly cycle, and then the normalized first clock is converted to a timestamp format to obtain an initial collection time stamp of the target data; If the target data to be collected is minute frozen data, the first clock is adjusted according to a period of preset minutes using a preset second time adjustment formula to obtain an initial collection time mark of the target data.

3. The data collection method according to claim 1, characterized in that: The step of adjusting the initial acquisition time scale by using the clock deviation to obtain a target acquisition time scale includes: Determining whether the value of the clock deviation is zero; If the value of the clock deviation is zero, the initial acquisition time scale is used as the target acquisition time scale; If the value of the clock deviation is not zero, the initial acquisition time scale is adjusted by using a time scale adjustment rule corresponding to the data type set based on the clock deviation to obtain a target acquisition time scale.

4. The data collection method according to claim 3, characterized in that: The adjusting the initial acquisition time scale by using the time scale adjustment rule corresponding to the data type set based on the clock deviation to obtain the target acquisition time scale includes: If the data type is real-time data, performing a difference operation on the initial acquisition time scale and the clock deviation to obtain a first operation result, and using the first operation result as the target acquisition time scale; If the data type is daily frozen data, the second clock is rounded according to a one-day cycle using a preset first time rounding formula to obtain a first rounded clock, and a difference operation is performed on the initial acquisition time scale and the first rounded clock to obtain a second operation result, so that the difference between the initial acquisition time scale and the second operation result is used as the target acquisition time scale; If the data type is monthly frozen data, the first time rounding formula is used to round the first clock and the second clock according to a one-day cycle to obtain a second rounded clock and a third rounded clock, and a difference operation is performed on the second rounded clock and the third rounded clock to obtain a third operation result, so that the difference between the initial collection time scale and the third operation result is used as the target collection time scale; If the data type is minute frozen data, the second clock is rounded to a period of a preset number of minutes using a preset second time rounding formula to obtain a fourth rounded clock, and a difference operation is performed on the initial acquisition time stamp and the fourth rounded clock to obtain a fourth operation result, so that the difference between the initial acquisition time stamp and the fourth operation result is used as the target acquisition time stamp.

5. The data collection method according to claim 3, characterized in that: After acquiring the target data in the target device based on the target acquisition time stamp, the method further includes: If the value of the clock deviation is zero, the collected target data is directly stored; If the value of the clock deviation is not zero and the target data carries a time parameter, a difference operation is performed between the time parameter and the clock deviation, and the difference operation result is stored.

6. The data collection method according to claim 1, characterized in that: Also includes: When a maintenance command is issued to the target device, if the maintenance command carries a time parameter, a difference operation is performed on the time parameter and the clock deviation, and the time parameter in the maintenance command is updated using the difference operation result, so that the updated maintenance command is issued to the target device.

7. The data collection method according to any one of claims 1 to 6, characterized in that: The process of determining the clock prediction function includes: When the current time meets the timestamp specified by the preset clock collection cycle, the current terminal clock is determined and the current device clock is collected; Inputting the current terminal clock into a number of interpolation functions constructed based on historical terminal clocks and historical device clocks to obtain a predicted device clock; The absolute value of the difference between each of the predicted device clocks and the current device clock is calculated respectively, and the interpolation function corresponding to the minimum absolute value is determined as the clock prediction function.

8. A data acquisition device, characterized in that: Applied to acquisition terminals, including: A clock deviation calculation module, used to predict a current second clock of a target device based on a local current first clock and a predetermined clock prediction function, so as to calculate a clock deviation based on the first clock and the second clock; An acquisition time-scale calculation module, used for determining a data type of target data to be acquired, and calculating an initial acquisition time-scale of the target data using the first clock based on the data type; The data acquisition module is used to adjust the initial acquisition time scale by using the clock deviation to obtain a target acquisition time scale, so as to acquire the target data in the target device based on the target acquisition time scale.

9. A collection terminal, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the data collection method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the data acquisition method according to any one of claims 1 to 7 are implemented.