Data energy consumption processing method and device, terminal equipment and computer storage medium
1. A data energy consumption processing method is characterized by comprising the following steps:
presetting a meter reading period corresponding to equipment;
acquiring a first meter reading time and a first meter reading value reported currently;
acquiring second meter reading time and a second meter reading value of the second meter reading time reported last time;
judging whether a first meter reading period integral time exists between the first meter reading time and the second meter reading time;
and if so, calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value.
2. The method of claim 1,
the step of calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value comprises the following steps:
acquiring an absolute value of a first time difference between the first meter reading period integral point time and the first meter reading time;
acquiring an absolute value of a second time difference between the first meter reading period integral point time and the second meter reading time;
calculating a ratio of an absolute value of the first time difference to an absolute value of the second time difference;
and calculating the reading value of the first meter reading period corresponding to the integral point time of the first meter reading period based on the ratio and the first reading value and the second reading value.
3. The method of claim 2,
the step of calculating the reading value of the first reading period corresponding to the whole point time of the first reading period based on the ratio by the first reading value and the second reading value comprises the following steps:
calculating a meter reading difference value between the second meter reading value and the first meter reading value;
calculating the product of the ratio and the meter reading difference value;
and calculating the sum of the product and the second reading value to obtain the first reading period reading value.
4. The method of claim 1,
the data energy consumption processing method further comprises the following steps:
judging whether a first meter reading period integral point time and a second meter reading period integral point time exist between the first meter reading time and the second meter reading time;
if yes, calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value, the second meter reading value and the first meter reading period integral point time, and calculating a second meter reading period meter reading value corresponding to the second meter reading period integral point time based on the first meter reading value, the second meter reading value and the second meter reading period integral point time.
5. The method of claim 4,
the data energy consumption processing method further comprises the following steps:
acquiring an absolute value of a first time difference between the first meter reading period integral point time and the first meter reading time;
acquiring an absolute value of a second time difference between the first meter reading period integral point time and the second meter reading time;
calculating a first ratio of an absolute value of the first time difference to an absolute value of the second time difference;
calculating a first meter reading period meter reading value based on the first ratio, the first meter reading value and the second meter reading value;
acquiring an absolute value of a third time difference between the second meter reading period integral point time and the first meter reading time;
acquiring an absolute value of a fourth time difference between the second meter reading period integral point time and the second meter reading time;
calculating a second ratio of the absolute value of the third time difference to the absolute value of the fourth time difference;
and calculating the reading value of the second reading period based on the second ratio, the first reading value and the second reading value.
6. The method of claim 1,
the step of calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value comprises the following steps:
and calculating the average value of the first reading value and the second reading value to be used as the reading value of the first reading period corresponding to the whole point time of the first reading period.
7. The method of claim 1,
the data energy consumption processing method further comprises the following steps:
acquiring a reading value of every two reading periods corresponding to the whole time of the adjacent reading periods;
and calculating the difference value of the two reading periods of the meter reading as the period data energy consumption value.
8. The method of claim 1,
the data energy consumption processing method further comprises the following steps:
presetting a reporting frequency corresponding to the equipment;
and determining the first meter reading time and the second meter reading time according to the reporting frequency.
9. The data energy consumption processing device is characterized by comprising a presetting module, an obtaining module, a judging module and a calculating module; wherein the content of the first and second substances,
the preset module is used for presetting a meter reading period corresponding to the equipment;
the acquisition module is used for acquiring a first meter reading time reported currently and a first meter reading value of the first meter reading time;
the acquisition module is further used for acquiring a second meter reading time reported last time and a second meter reading value thereof;
the judging module is used for judging whether a first meter reading period integral time exists between the first meter reading time and the second meter reading time;
and if so, the calculating module is used for calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value.
10. A terminal device, comprising a memory and a processor, wherein the memory is coupled to the processor;
wherein the memory is used for storing program data, and the processor is used for executing the program data to realize the data energy consumption processing method of any one of claims 1-8.
11. A computer storage medium for storing program data, which when executed by a processor, is configured to implement the data energy consumption processing method of any one of claims 1 to 8.
Background
At present, energy consumption original data commonly used in the industry is instant energy consumption meter reading data (incremental data), that is, an original meter reading value at every moment is stored, and when the incremental data in a certain time range needs to be queried, the meter reading data in the time range is correspondingly obtained so as to obtain the incremental data through calculation. In the above manner, because of uncertainty of a certain time range, the meter reading data in the certain time range cannot be directly determined, and thus the efficiency of calculating data energy consumption based on the meter reading data is low.
Disclosure of Invention
The application provides a data energy consumption processing method and device, terminal equipment and a computer storage medium, and aims to solve the problem of low data energy consumption query efficiency in the prior art.
In order to solve the technical problem, the present application provides a data energy consumption processing method, where the data energy consumption processing method includes:
presetting a meter reading period corresponding to equipment;
acquiring a first meter reading time and a first meter reading value reported currently;
acquiring second meter reading time and a second meter reading value of the second meter reading time reported last time;
judging whether a first meter reading period integral time exists between the first meter reading time and the second meter reading time;
and if so, calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value.
In order to solve the technical problem, the application provides a data energy consumption processing device, which comprises a preset module, an acquisition module, a judgment module and a calculation module; wherein the content of the first and second substances,
the preset module is used for presetting a meter reading period corresponding to the equipment;
the acquisition module is used for acquiring a first meter reading time reported currently and a first meter reading value of the first meter reading time;
the acquisition module is further used for acquiring a second meter reading time reported last time and a second meter reading value thereof;
the judging module is used for judging whether a first meter reading period integral time exists between the first meter reading time and the second meter reading time;
and if so, the calculating module is used for calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value.
In order to solve the above technical problem, the present application provides a terminal device, which includes a memory and a processor, wherein the memory is coupled to the processor;
the memory is used for storing program data, and the processor is used for executing the program data to realize the data energy consumption processing method.
In order to solve the above technical problem, the present application further provides a computer storage medium for storing program data, where the program data is executed by a processor to implement the data energy consumption processing method as described above.
The data energy consumption processing method determines whether a first meter reading period integral time exists between a first meter reading time reported currently and a second meter reading time reported last time or not by presetting a meter reading period corresponding to equipment and by utilizing the first meter reading time reported currently and the second meter reading time reported last time, and if so, calculates a first meter reading period meter reading value corresponding to the first meter reading period integral time by utilizing the first meter reading value and the second meter reading value, so that the query of data energy consumption is facilitated, and the query efficiency of the data energy consumption is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a data energy consumption processing method provided herein;
FIG. 2 is a schematic flow chart of an embodiment of S105 in the data energy consumption processing method shown in FIG. 1;
FIG. 3 is a schematic flow chart diagram of an embodiment of S204 in the data energy consumption processing method shown in FIG. 2;
FIG. 4 is a schematic flow chart diagram illustrating an embodiment of a data energy consumption processing method provided herein;
FIG. 5 is a schematic flow chart diagram of an embodiment of S405 in the data energy consumption processing method shown in FIG. 4;
FIG. 6 is a schematic structural diagram of an embodiment of a data energy consumption processing apparatus provided in the present application;
fig. 7 is a schematic structural diagram of an embodiment of a terminal device provided in the present application;
FIG. 8 is a schematic structural diagram of an embodiment of a computer storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The present application provides a data energy consumption processing method, and specifically please refer to fig. 1, where fig. 1 is a schematic flow diagram of an embodiment of the data energy consumption processing method provided in the present application. The data energy consumption processing method in the embodiment can be applied to a data energy consumption processing device, and the data energy consumption processing device can be a server, a mobile device, or a system in which the server and the mobile device are matched with each other. Accordingly, each part, such as each unit, sub-unit, module, and sub-module, included in the mobile device may be all disposed in the server, may also be all disposed in the mobile device, and may also be disposed in the server and the mobile device, respectively.
Further, the server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules, for example, software or software modules for providing distributed servers, or as a single software or software module, and is not limited herein.
The data energy consumption processing method of the embodiment specifically comprises the following steps:
s101: and presetting a meter reading period corresponding to the equipment.
In the embodiment of the present disclosure, in consideration of that in the prior art, by reporting and storing the original meter reading value per second, when the data energy consumption sum of a certain period of time needs to be queried, all the original meter reading values in the storage database need to be retrieved to determine the meter reading value corresponding to the certain period of time, so as to obtain the data energy consumption sum. The method has the problem of huge data storage capacity, which causes waste of database resources. And the data query quantity is huge, and the data energy consumption query efficiency is low. In order to avoid the above problems. The data energy consumption processing device of the embodiment periodically reports all the original meter reading values, and stores the total data energy consumption in each period, so that the phenomenon that each second of original data is reported and stored to occupy a storage space is avoided, the data storage capacity is reduced, and the data energy consumption query efficiency is improved.
Specifically, the data energy consumption processing device presets a meter reading period corresponding to the equipment. Wherein, the meter reading period can be one hour, one day, one week or one month. The setting of the meter reading period can be set according to actual requirements, and this embodiment does not limit this.
S102: and acquiring a first meter reading time and a first meter reading value reported currently.
S103: and acquiring the second meter reading time and the second meter reading value reported last time.
In order to determine the data energy consumption corresponding to the time period to be inquired based on the meter reading period integral time. The data energy consumption processing device of this embodiment needs to obtain a first meter reading time reported currently, a first meter reading value corresponding to the first meter reading time, and a second meter reading time reported last time, and a second meter reading value corresponding to the second meter reading time, so as to determine a first meter reading periodic meter reading value based on the first meter reading value and the second meter reading value. And the first meter reading time and the second meter reading time are separated by a meter reading period.
The data energy consumption processing device can also determine the first meter reading time and the second meter reading time according to the reporting frequency corresponding to the preset equipment.
S104: and judging whether a first meter reading period integral point time exists between the first meter reading time and the second meter reading time.
Considering that the time of the whole point of each meter reading period may not be synchronous with the time of actually reporting the reading value, for example, the meter reading period is one hour, the time of the whole point of the meter reading period is zero, and the meter reading time corresponding to the actually reported reading value is 58 minutes, the reading value of each meter reading period cannot be accurately known, and further, the data energy consumption corresponding to the time period to be queried cannot be determined according to the time of the whole point of each meter reading period. Therefore, the data energy consumption processing apparatus of this embodiment determines whether a first meter reading period integral time exists between the first meter reading time and the second meter reading time by using the first meter reading time and the second meter reading time, and if so, executes S105. If not, the first meter reading period integral time does not exist between the first meter reading time and the second meter reading time.
S105: and calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value.
And the data energy consumption processing device calculates a first meter reading period meter reading value corresponding to the first meter reading period integral point time by using the first meter reading value and the second meter reading value.
It should be noted that, in some embodiments, when determining that the first meter reading cycle integral time exists between the first meter reading time and the second meter reading time, the data energy consumption processing device may determine that the first meter reading cycle integral time is exactly located at the first meter reading time, or that the first meter reading cycle integral time is exactly located at the second meter reading time. At this time, the data energy consumption processing device should further determine whether the first meter reading time is equal to the first meter reading period integral point time, and if the first meter reading time is equal to the first meter reading period integral point time, determine a first meter reading value corresponding to the first meter reading time as the first meter reading period meter reading value. Or judging whether the second meter reading time is equal to the first meter reading period integral point time or not, and if the second meter reading time is equal to the first meter reading period integral point time, determining a second meter reading value corresponding to the second meter reading time as the first meter reading period meter reading value.
In other embodiments, it is considered that when the data energy consumption processing device determines that the first meter reading period integral point time exists between the first meter reading time and the second meter reading time, there may also exist a time in which the first meter reading period integral point time is just in the middle of the first meter reading time and the second meter reading time. At this time, the data energy consumption processing device should further determine whether the intermediate time between the first meter reading time and the second meter reading time is equal to the first meter reading period integral point time, and if the intermediate time is equal to the first meter reading period integral point time, determine an average value of a first reading value corresponding to the first meter reading time and a second reading value corresponding to the second meter reading time as the first meter reading period reading value.
Further, in order to improve the query efficiency of the data energy consumption, the data energy consumption processing device may use a difference value between every two reading periods corresponding to the integral time of the adjacent reading periods as a period data energy consumption value, and store the period data energy consumption value, so that the period data energy consumption value can be conveniently used for subsequently querying the data energy consumption corresponding to a certain period of time, and the data energy consumption corresponding to the period of time can be quickly calculated by using the period data energy consumption value.
In the above scheme, the data energy consumption processing device determines whether a first meter reading period integral time exists between a first meter reading time reported currently and a second meter reading time reported last time through presetting a meter reading period corresponding to the device, and by using the first meter reading time reported currently and the second meter reading time reported last time, and if so, calculates a first meter reading period meter reading value corresponding to the first meter reading period integral time by using the first meter reading value and the second meter reading value, so that the query of data energy consumption is facilitated, and the query efficiency of data energy consumption is improved.
Continuing to refer to fig. 2, fig. 2 is a schematic flow chart of an embodiment of S105 in the data energy consumption processing method shown in fig. 1. On the basis of the above embodiment, S105 further includes the steps of:
s201: and acquiring an absolute value of a first time difference between the integral point time of the first meter reading period and the first meter reading time.
S202: and acquiring an absolute value of a second time difference between the integral point time of the first meter reading period and the second meter reading time.
Under the condition that a first meter reading period integral point time exists between the first meter reading time and the second meter reading time, the data energy consumption processing device calculates an absolute value of a first time difference between the first meter reading period integral point time and the first meter reading time by utilizing the first meter reading period integral point time and the first meter reading time. And calculating the absolute value of a second time difference between the first meter reading period integral point time and the second meter reading time by utilizing the first meter reading period integral point time and the second meter reading time.
S203: a ratio of the absolute value of the first time difference to the absolute value of the second time difference is calculated.
In order to accurately obtain the reading value in the first reading period, the data energy consumption processing device calculates the ratio of the absolute value of the first time difference to the absolute value of the second time difference.
S204: and calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the ratio, the first meter reading value and the second meter reading value.
And the data energy consumption processing device calculates a first meter reading period meter reading value corresponding to the first meter reading period integral point time by using the ratio, the first meter reading value and the second meter reading value.
Optionally, in this embodiment, S204 may be implemented by using the embodiment in fig. 3, and specifically includes S301 to S303:
s301: and calculating a meter reading difference value between the second meter reading value and the first meter reading value.
And the data energy consumption processing device calculates a meter reading difference value between the second meter reading value and the first meter reading value.
S302: and calculating the product of the ratio and the meter reading difference value.
In order to simplify the calculation, the ratio in this embodiment is a ratio of an absolute value of the second time difference to an absolute value of the first time difference, and the data energy consumption processing device calculates a product of a meter reading difference value of the second meter reading value and the first meter reading value and the ratio, so as to obtain a difference value between the second meter reading value and the first meter reading value in the meter reading period.
S303: and calculating the sum of the product and the second reading value to obtain a first reading value in the reading period.
And based on the obtained difference value between the second reading value and the first reading period reading value, the data energy consumption processing device calculates the sum of the difference value and the second reading value to obtain the first reading period reading value.
In the above scheme, the data energy consumption processing device obtains the absolute value of the first time difference between the first meter reading period integral point time and the first meter reading time, and obtains the absolute value of the second time difference between the first meter reading period integral point time and the second meter reading time. And calculating the ratio of the absolute value of the first time difference to the absolute value of the second time difference, so that the first meter reading period meter reading value corresponding to the integral point time of the first meter reading period is calculated by using the ratio, the first meter reading value and the second meter reading value, the data energy consumption corresponding to the time period to be inquired is determined based on the integral point time of the meter reading period, the inquiry of the data energy consumption is facilitated, and the inquiry efficiency of the data energy consumption is improved.
With continuing reference to fig. 4, fig. 4 is a schematic flow chart diagram of an embodiment of a data energy consumption processing method provided by the present application. Specifically, the data energy consumption processing method of this embodiment further includes the following steps:
s401: and presetting a meter reading period corresponding to the equipment.
S402: and acquiring a first meter reading time and a first meter reading value reported currently.
S403: and acquiring the second meter reading time and the second meter reading value reported last time.
S401 to S403 in this embodiment can refer to S101 to S103 in the above embodiments, and are not repeated herein.
S404: and judging whether the first meter reading period integral point time and the second meter reading period integral point time exist between the first meter reading time and the second meter reading time.
Considering the situation that multiple cycle time points may exist between the first meter reading time and the second meter reading time, the data energy consumption processing apparatus of this embodiment determines whether multiple cycle time points exist between the first meter reading time and the second meter reading time at the same time. Specifically, the data energy consumption processing device determines whether a first meter reading period integral point time and a second meter reading period integral point time exist between a first meter reading time and a second meter reading time, and if yes, S405 is executed. If not, it is indicated that a plurality of cycle integral point times do not exist between the first meter reading time and the second meter reading time simultaneously.
S405: and calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value, the second meter reading value and the first meter reading period integral point time, and calculating a second meter reading period meter reading value corresponding to the second meter reading period integral point time based on the first meter reading value, the second meter reading value and the second meter reading period integral point time.
When the data energy consumption processing device judges that a first meter reading period integral point time and a second meter reading period integral point time exist between a first meter reading time and a second meter reading time, a first meter reading period meter reading value corresponding to the first meter reading period integral point time is calculated by using the first meter reading value, the second meter reading value and the first meter reading period integral point time. And calculating a second meter reading period meter reading value corresponding to the second meter reading period integral point time by using the first meter reading value, the second meter reading value and the second meter reading period integral point time.
Optionally, in this embodiment, the embodiment of fig. 5 may be adopted to implement S405, which specifically includes S501 to S508:
s501: and acquiring an absolute value of a first time difference between the integral point time of the first meter reading period and the first meter reading time.
S502: and acquiring an absolute value of a second time difference between the integral point time of the first meter reading period and the second meter reading time.
S503: a first ratio of the absolute value of the first time difference to the absolute value of the second time difference is calculated.
S504: and calculating a first meter reading period meter reading value based on the first ratio, the first meter reading value and the second meter reading value.
When the data energy consumption processing device judges that the first meter reading period integral point time and the second meter reading period integral point time exist between the first meter reading time and the second meter reading time, a first ratio of an absolute value of a first time difference to an absolute value of a second time difference is obtained. And acquiring a first difference value between the first meter reading value and the second meter reading value, and calculating a product of the first ratio and the first difference value, so as to determine a first meter reading period meter reading value based on the sum of the product and the second meter reading value.
S505: and acquiring an absolute value of a third time difference between the second meter reading period integral point time and the first meter reading time.
S506: and acquiring an absolute value of a fourth time difference between the second meter reading period integral point time and the second meter reading time.
S507: a second ratio of the absolute value of the third time difference to the absolute value of the fourth time difference is calculated.
S508: and calculating a second meter reading periodic meter reading value based on the second ratio, the first meter reading value and the second meter reading value.
When the data energy consumption processing device judges that the first meter reading period integral point time and the second meter reading period integral point time exist between the first meter reading time and the second meter reading time, a second ratio of an absolute value of a third time difference and an absolute value of a fourth time difference is obtained, a first difference between the first meter reading value and the second meter reading value is obtained, the product of the second ratio and the first difference is calculated, and therefore the second meter reading period meter reading value is determined based on the sum of the product and the second meter reading value.
In the above scheme, when the data energy consumption processing device simultaneously has the first meter reading period integral point time and the second meter reading period integral point time between the first meter reading time and the second meter reading time, the first meter reading period meter reading value is calculated by using the first ratio, the first meter reading value and the second meter reading value, and the second meter reading period meter reading value is calculated by using the second ratio, the first meter reading value and the second meter reading value, so that the query of data energy consumption is facilitated, and the query efficiency of data energy consumption is improved.
To implement the data energy consumption processing method of the foregoing embodiment, the present application provides a data energy consumption processing apparatus, and specifically refer to fig. 6, where fig. 6 is a schematic structural diagram of an embodiment of the data energy consumption processing apparatus provided in the present application. The data energy consumption processing device 600 includes a presetting module 61, an obtaining module 62, a judging module 63, and a calculating module 64.
Specifically, the preset module 61 is configured to preset a meter reading period corresponding to the device.
The obtaining module 62 is configured to obtain a first meter reading time reported currently and a first meter reading value thereof.
The obtaining module 63 is further configured to obtain a second meter reading time reported last time and a second meter reading value thereof.
And the judging module 64 is used for judging whether the first meter reading period integral time exists between the first meter reading time and the second meter reading time.
And if so, the calculation module is used for calculating a first meter reading period meter reading value corresponding to the first meter reading period integral point time based on the first meter reading value and the second meter reading value.
To implement the data energy consumption processing method of the foregoing embodiment, the present application provides a terminal device, and specifically refer to fig. 7, where fig. 7 is a schematic structural diagram of an embodiment of the terminal device provided in the present application.
The terminal device 700 comprises a memory 71 and a processor 72, wherein the memory 71 and the processor 72 are coupled.
The memory 71 is used for storing program data and the processor 72 is used for executing the program data to realize the above-mentioned data energy consumption processing method.
In the present embodiment, the processor 72 may also be referred to as a CPU (Central Processing Unit). The processor 72 may be an integrated circuit chip having signal processing capabilities. The processor 72 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor 72 may be any conventional processor or the like.
The present application further provides a computer storage medium 800, as shown in fig. 8, the computer storage medium 800 is used for storing program data 81, and the program data 81 is used for implementing the data energy consumption processing method when being executed by the processor.
The method involved in the embodiments of the data energy consumption processing method of the present application, when implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a device, for example, a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:项目管理方法、系统、计算机设备和存储介质