Energy consumption statistical method and device, readable storage medium and computer program product
Through the energy consumption statistics methods and devices on the platform side and metering equipment side, and the update mechanism of data packets and databases, the problem of discontinuous data uploading of metering equipment is solved, ensuring the accuracy and completeness of energy consumption statistics, and solving the problem of energy consumption statistics. Inaccuracies in billing.
Patent Information
- Application Number
- CN202410768580.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-11
AI Technical Summary
In the context of energy conservation, emission reduction and enterprise interconnection, energy consumption data uploaded by metering equipment is easily lost or discontinuous, leading to inaccurate energy consumption statistics and billing. Platform service interruptions can also lead to missing data, resulting in inaccurate energy statistics.
Provide an energy consumption statistics method and device that ensures the integrity and accuracy of data by receiving and processing data packets uploaded by metering equipment, using a first-in-first-out queue mechanism and a database update mechanism, including receiving data packets, updating the database, Data packages are generated and sent to the platform to ensure accurate calculation of energy consumption data for each statistical period.
Effectively complete energy consumption statistics, avoid data loss, ensure the accuracy of total energy consumption, improve the accuracy of energy consumption measurement, and avoid reduction in energy consumption billing due to missing data.
Smart Images

Figure CN118760689A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of energy consumption metering management, and in particular to an energy consumption statistics method, device, readable storage medium and computer program product. Background Art
[0002] In the context of energy conservation, emission reduction, enterprise interconnection and intelligence, metering equipment, such as electricity meters, will be installed in different places. Due to various emergencies encountered in the network signal, installation environment and data transmission process, in this case, the metering data uploaded by the metering equipment to the platform will be missing or disconnected, resulting in inaccurate energy consumption statistics and energy consumption billing, and loss of energy statistical data. In addition, on the platform side, because the platform's services are occasionally interrupted due to load pressure and other abnormal conditions, the metering data uploaded by the metering equipment is not received, which will cause the energy consumption metering data to be missing or discontinuous in the energy consumption statistics, and the energy consumption statistics and energy consumption billing are inaccurate. Summary of the invention
[0003] In view of this, embodiments of the present application provide an energy consumption statistics method, device, readable storage medium, and computer program product.
[0004] In the first aspect, an embodiment of the present application provides an energy consumption statistics method, which is applied to the platform side; the method includes: receiving a data packet uploaded by a metering device; wherein the data packet includes multiple entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last recorded entry in the data packet is the energy consumption metering data uploaded within its corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within its corresponding statistical period; updating the database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times within each statistical period; and performing energy consumption statistics based on the energy consumption metering data in the database.
[0005] In the above scheme, updating the database according to the entries in the data packet includes: obtaining the first statistical period to which the upload time of the data packet belongs; obtaining the second statistical period to which the upload time corresponding to the previous data packet adjacent to the data packet belongs; comparing the first statistical period and the second statistical period; in response to the first statistical period and the second statistical period being the same statistical period, directly updating the last recorded entry in the data packet to the database; in response to the first statistical period and the second statistical period not being the same statistical period, updating all the entries recorded in the data packet after the second statistical period to the database.
[0006] In the above scheme, the energy is electrical energy, and the energy consumption metering data increases cumulatively over time; the energy consumption statistics are performed based on the energy consumption metering data in the database, including: obtaining the period to be counted; in response to the period to be counted being the statistical period corresponding to the last recorded entry in the data packet, directly subtracting the energy consumption metering data corresponding to the last recorded entry in the data packet from the energy consumption metering data uploaded for the last time in the previous statistical period adjacent to it, to obtain the energy consumption in the period to be counted; in response to the period to be counted not being the statistical period corresponding to the entry except the last recorded entry in the data packet, obtaining the first energy consumption metering data uploaded for the last time in the period to be counted from the database; and obtaining the second energy consumption metering data uploaded for the last time in the previous statistical period adjacent to the period to be counted from the database; determining the difference between the first energy consumption metering data and the second energy consumption metering data as the energy consumption in the period to be counted.
[0007] In the above solution, the data packets are in a first-in-first-out queue, and the queue is updated at intervals of the preset period.
[0008] In the above scheme, the statistical period is 1 day.
[0009] In the second aspect, an embodiment of the present application also provides an energy consumption statistics method, which is applied to the metering device side, and the method includes: generating a data packet; wherein the data packet includes multiple entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last recorded entry in the data packet is the energy consumption metering data uploaded within its corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within its corresponding statistical period; and the data packet is sent to the platform.
[0010] In the above scheme, the data packet is a first-in-first-out queue; the generation of the data packet includes: obtaining energy consumption metering data at intervals of the preset period, and updating the obtained energy consumption metering data to the position of the corresponding statistical period in the queue to generate the data packet.
[0011] In the above scheme, the method also includes: when the depth of the queue reaches a preset depth and the last recorded entry in the queue is the energy consumption metering data uploaded for the last time in its corresponding statistical period, continue to obtain energy consumption metering data according to the preset period in the next statistical period, and delete the entry corresponding to the head of the queue, and insert the energy consumption metering data in the next statistical period into the tail of the queue to update the queue and maintain the depth of the queue at the preset depth.
[0012] In a third aspect, the embodiment of the present application further provides an energy consumption statistics device, which is applied to a platform side, and the device includes:
[0013] A receiving module, used to receive a data packet uploaded by a metering device; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period;
[0014] An update module, used to update a database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times in each statistical period;
[0015] The statistics module is used to perform energy consumption statistics based on the energy consumption metering data in the database.
[0016] In the above scheme, the update module is specifically used to: obtain the first statistical period to which the upload time of the data packet belongs; obtain the second statistical period to which the upload time corresponding to the previous data packet adjacent to the data packet belongs; compare the first statistical period and the second statistical period; in response to the first statistical period and the second statistical period being the same statistical period, directly update the last recorded entry in the data packet to the database; in response to the first statistical period and the second statistical period not being the same statistical period, update all entries recorded in the data packet after the second statistical period to the database.
[0017] In the above scheme, the statistical module is specifically used to: obtain the period to be counted; in response to the period to be counted being the statistical period corresponding to the last recorded entry in the data packet, directly subtract the energy consumption metering data corresponding to the last recorded entry in the data packet from the energy consumption metering data uploaded for the last time in the previous statistical period adjacent to it, to obtain the energy consumption in the period to be counted; in response to the period to be counted not being the statistical period corresponding to the data except the last recorded entry, obtain the first energy consumption metering data uploaded for the last time in the period to be counted from the database; and obtain the second energy consumption metering data uploaded for the last time in the previous statistical period adjacent to the period to be counted from the database; determine the difference between the first energy consumption metering data and the second energy consumption metering data as the energy consumption in the period to be counted; wherein, the energy is electrical energy, and the energy consumption metering data increases cumulatively over time.
[0018] In a fourth aspect, an embodiment of the present application further provides an energy consumption statistics device, which is applied to a metering device, and the device includes:
[0019] A generation module, used to generate a data packet; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period;
[0020] The sending module is used to send the data packet to the platform.
[0021] In the above scheme, the data packet is a first-in-first-out queue; the generation module is specifically used to: obtain energy consumption metering data at intervals of the preset period, and update the obtained energy consumption metering data to the position of the corresponding statistical period in the queue to generate the data packet.
[0022] In the above scheme, the generation module is also specifically used to: when the depth of the queue reaches a preset depth and the last recorded entry in the queue is the energy consumption metering data uploaded for the last time in its corresponding statistical period, continue to obtain energy consumption metering data according to the preset period in the next statistical period, and delete the entry corresponding to the head of the queue, and insert the energy consumption metering data in the next statistical period into the tail of the queue to update the queue and maintain the depth of the queue at the preset depth.
[0023] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, characterized in that when the computer program is loaded and executed by a processor, any of the methods described above is implemented.
[0024] In a sixth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program, characterized in that when the computer program is loaded and executed by a processor, it implements any of the methods described above.
[0025] The embodiment of the present application provides an energy consumption statistics method, device, readable storage medium and computer program product. The energy consumption statistics method is applied to the platform side, and mainly includes: receiving a data packet uploaded by a metering device; wherein the data packet includes multiple entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last recorded entry in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period; updating the database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times within each statistical period; and performing energy consumption statistics according to the energy consumption metering data in the database. The method provided in the embodiment of the present application uploads a package of data, and the package of data includes energy consumption metering data of different statistical periods. These statistical periods include energy consumption metering data within historical statistical periods. Therefore, the lost energy consumption metering data can be supplemented, and the total energy consumption can be ensured not to be lost, thereby avoiding the reduction of energy consumption charges due to the missing energy consumption metering data reported by the metering equipment, and improving the accuracy of energy consumption metering. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In the drawings, which are not necessarily drawn to scale, the same reference numerals may describe similar components in different views. The same numerals with different letter suffixes may represent different instances of similar components. The drawings generally illustrate various embodiments discussed in this document by way of example and not limitation.
[0027] Figure 1 A flow chart of a method for calculating energy consumption on a platform provided in an embodiment of the present application;
[0028] Figure 2 A schematic diagram of the structure of an Internet of Things architecture applicable to the embodiments of the present application;
[0029] Figure 3 A schematic diagram of a process for updating a database provided in an embodiment of the present application;
[0030] Figure 4 A schematic diagram of a process for performing statistics using energy consumption metering data in a database provided in an embodiment of the present application;
[0031] Figure 5 A schematic diagram of a flow chart of a method for calculating energy consumption on a metering device side provided in an embodiment of the present application;
[0032] Figure 6 A schematic diagram of the structure of the energy consumption statistics device on the platform side provided in the embodiment of the present application;
[0033] Figure 7 A schematic diagram of the structure of the energy consumption statistics device on the metering device side provided in the embodiment of the present application;
[0034] Figure 8 A schematic diagram of the structure of a computer program product provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0036] In the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implying the number of technical features indicated by the term. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0037] In addition, in the embodiments of the present application, directional terms such as "up", "down", "left" and "right" are defined relative to the orientation of the components in the drawings. It should be understood that these directional terms are relative concepts. They are used for relative description and clarification, and they may change accordingly according to changes in the orientation of the components in the drawings.
[0038] In the embodiments of the present application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device steps including a series of elements include those elements, and also include other elements not explicitly listed, or also include elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0039] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or related scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0040] See also Figure 1 , the embodiment of the present application provides an energy consumption statistics method applied to the platform side, specifically including:
[0041] Step 101: Receive a data packet uploaded by a metering device; wherein the data packet includes multiple entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last recorded entry in the data packet is the energy consumption metering data uploaded within its corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within its corresponding statistical period.
[0042] It should be noted that if Figure 2 As shown in Figure 1, a schematic diagram of the architecture of the Internet of Things. Figure 2 In the example, the IoT architecture 200 may include: an IoT platform 201 and at least one metering device 202 for measuring energy consumption, wherein the IoT platform is used to receive energy consumption metering data uploaded by the metering device, store the energy consumption metering data, and perform energy consumption statistics using the stored energy consumption metering data. The metering device is a device for measuring the energy consumed, and uploads the obtained energy consumption metering data to the platform. In one example, the metering device may be an electric energy meter, which may have metering functions, recording functions, monitoring functions, and communication functions.
[0043] In the present application, the platform can receive a data packet uploaded by a metering device, and the data packet is a set of energy metering data. Specifically, the data packet includes multiple entries, each entry corresponds to energy consumption metering data uploaded within a statistical period, and, in chronological order, the last recorded entry in the data packet is the energy consumption metering data uploaded within its corresponding statistical period; and the other recorded entries are the energy consumption metering data uploaded for the last time within its corresponding statistical period. It should be noted that the statistical period corresponding to the last recorded entry is the statistical period after the statistical periods corresponding to the remaining entries. In addition, the energy consumption metering data accumulates and increases over time, and is collected and uploaded according to a preset period within the corresponding statistical period.
[0044] Here, the energy source may be electric energy, water, natural gas, etc. In this application, electric energy is used as an example for explanation. That is to say, in the absence of other instructions, the energy source described below is electric energy.
[0045] Here, the data may include a first-in-first-out queue, and the queue is updated at intervals of the preset period.
[0046] Here, the statistical period may be 1 day. The preset period may be 1 day, that is, a set time interval within 24 hours.
[0047] For example, the understanding of the data packet is shown in Table 1.
[0048] Table 1 Data Pack
[0049]
[0050]
[0051] As shown in Table 1, the data packet records the energy consumption metering data of 10 statistical cycles and the corresponding upload time. Among them, the energy consumption metering data recorded in sequence number 0 is the latest uploaded data, that is, the last recorded energy consumption metering data, and its corresponding upload time can be any time uploaded according to the preset cycle within the statistical cycle (May 20, 2024), for example, the energy consumption metering data of 123.2kwh uploaded at 12:45:03 on May 20, 2024. The energy consumption metering data recorded in sequence numbers 1 to 9 is the energy consumption metering data uploaded for the last time in the corresponding statistical cycle. For example, the energy consumption metering data recorded in sequence number 2 is the energy consumption metering data of 121.2kwh uploaded at 23:53:03 on May 19, 2024 (the last upload time in the statistical cycle). The rest is similar and will not be repeated here.
[0052] In addition, the energy consumption metering data in the data packet is updated. The energy consumption metering data uploaded in the same statistical period only saves the latest metering data. That is, in the same statistical period, the data packet will change once every preset period until the last upload of energy consumption metering data in the statistical period. In addition, when the depth of the data packet reaches the preset depth (for example, 10), the energy consumption metering data uploaded in the next new statistical period will be stored at sequence number 0, and the energy consumption metering data in sequence number 9 will be deleted, and the original data will be postponed.
[0053] In this way, each time a data packet is uploaded, it is ensured that when the network is disconnected and retransmitted, energy consumption metering data of no more than a few statistical cycles can be uploaded to the platform, which facilitates the integrity of the platform's energy consumption metering data and effectively solves the problem of inaccurate and discontinuous energy consumption statistical data caused by the loss of reporting flow (energy consumption data flow) on the metering device side.
[0054] Step 102: Update the database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times in each statistical period.
[0055] like Figure 3 As shown, step 102 may include:
[0056] Step 301: obtaining a first statistical period to which the upload time of the data packet belongs;
[0057] Step 302: Obtain a second statistical period to which the upload time corresponding to a previous data packet adjacent to the data packet belongs;
[0058] Step 303: Compare the first statistical period and the second statistical period;
[0059] Step 304: in response to the first statistical period and the second statistical period being the same statistical period, directly updating the last recorded entry in the data packet to the database;
[0060] Step 305: In response to the first statistical period and the second statistical period being different from each other, all entries in the data packet recorded after the second statistical period are updated to the database.
[0061] It should be noted that the first statistical period and the second statistical period mentioned here are to distinguish the two statistical periods and are not used for order restrictions. That is, the first statistical period to which the upload time corresponding to the upload of the data packet belongs is obtained, and the second statistical period to which the upload time corresponding to the previous data packet adjacent to the data packet belongs is obtained, and then, the first statistical period and the second statistical period are compared, and in response to the first statistical period and the second statistical period being the same statistical period, the energy consumption metering data in the data packet is directly updated to the database. In response to the first statistical period and the second statistical period not being the same statistical period, the entries recorded in the second statistical period and the statistical period thereafter (including the first statistical period) in the data packet are all updated to the database.
[0062] For the sake of understanding, an example is given, assuming that Table 1 is the data packet. Table 2 below is an example of a previous data packet.
[0063] Table 2 An example of the previous data packet
[0064]
[0065]
[0066] As shown in Table 1, the upload time of the data packet is 12:45:03 on May 20, 2024, and its first statistical period is May 20, 2024; as shown in Table 2, the upload time of the previous data packet is 12:30:03 on May 20, 2024, and its second statistical period is May 20, 2024, that is, the first statistical period and the second statistical period are the same statistical period. At this time, only the entry with sequence number 0 in Table 1 needs to be updated to the database.
[0067] In another embodiment, as shown in Table 3 below, it is an example of another previous data packet.
[0068] Table 3 Another example of the previous data packet
[0069]
[0070]
[0071] As shown in Table 1, the upload time of the data packet is 12:45:03 on May 20, 2024, and its first statistical period is May 20, 2024; as shown in Table 3, the upload time of the previous data packet is 23:55:13 on May 18, 2024, and its second statistical period is May 18, 2024, that is, the first statistical period and the second statistical period are not in the same statistical period. At this time, all entries with serial numbers 0 and 1 in Table 1 need to be updated to the database.
[0072] Step 103: Perform energy consumption statistics according to the energy consumption metering data in the database.
[0073] In some embodiments, Figure 4 As shown, step 103 may include:
[0074] Step 401: Obtain the period to be counted;
[0075] Step 402: In response to the statistical period to be counted being the statistical period corresponding to the last entry recorded in the data packet, directly subtract the energy consumption metering data corresponding to the last entry recorded in the data packet from the energy consumption metering data uploaded last in the previous statistical period adjacent to the energy consumption metering data, to obtain the energy consumption in the statistical period to be counted;
[0076] Step 403: In response to the fact that the period to be counted is not the statistical period corresponding to the entry excluding the last record in the data, obtaining from the database the first energy consumption metering data uploaded for the last time during the period to be counted; and obtaining from the database the second energy consumption metering data uploaded for the last time during the previous statistical period adjacent to the period to be counted; and determining the difference between the first energy consumption metering data and the second energy consumption metering data as the energy consumption during the period to be counted.
[0077] It should be noted that when performing statistics on energy consumption based on energy consumption metering data in a database, there are different calculation formulas depending on the statistical period in which the statistical period is located.
[0078] Specifically, if the statistical period is the statistical period corresponding to the last recorded entry in the data packet, for example, referring to Table 1, if the statistical period is the statistical period corresponding to the entry with serial number 0, at this time, the energy consumption metering data corresponding to the last recorded entry in the data packet is directly subtracted from the energy consumption metering data uploaded for the last time in the previous statistical period adjacent to it, and the energy consumption in the statistical period is obtained, that is, the energy consumption metering data 123.2kwh corresponding to the entry with serial number 0 is subtracted from the energy consumption metering data 121.2kwh corresponding to the entry with serial number 1, and the energy consumption used before 12 o'clock in the statistical period (May 20, 2024) is obtained. The amount of energy consumption used before 12 o'clock in the statistical period (May 20, 2024) is 2kwh.
[0079] If the statistical period is not the statistical period corresponding to the last recorded entry in the data packet, for example, referring to Table 1, if the statistical period is the statistical period corresponding to the entry with serial number 1, at this time, the energy consumption in the statistical period is obtained by subtracting the first energy consumption metering data uploaded for the last time in the statistical period from the second energy consumption metering data uploaded for the last time in the adjacent previous statistical period, that is, the first energy consumption metering data uploaded for the last time in the statistical period (May 19, 2024) is 121.2 kwh, minus the second energy consumption metering data uploaded for the last time in the previous statistical period (May 18, 2024) is 114.2 kwh, and the energy consumption used in the statistical period is 7 kwh.
[0080] The energy consumption of each statistical period can be calculated according to the above calculation method, so the situation of missing energy consumption data statistics due to data loss can be avoided.
[0081] Based on the same inventive concept, on the metering device side, the present application embodiment also provides an energy consumption statistics method, see Figure 5 , which may include:
[0082] Step 501: Generate a data packet; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period;
[0083] Step 502: Send the data packet to the platform.
[0084] It should be noted that the data packets mentioned here are different from the previous Figure 1 The meaning of the data packets described in the previous section is the same, so we will not repeat them here. The following focuses on how to generate them.
[0085] In some embodiments, the data packet is a first-in-first-out queue; generating the data packet may include:
[0086] The energy consumption metering data is acquired at intervals of the preset period, and the acquired energy consumption metering data is updated to the position of the corresponding statistical period in the queue to generate the data packet.
[0087] In some embodiments, the method may further include:
[0088] When the depth of the queue reaches a preset depth and the last recorded entry in the queue is the energy consumption metering data uploaded for the last time in its corresponding statistical period, the energy consumption metering data continues to be obtained according to the preset period in the next statistical period, and the entry corresponding to the head of the queue is deleted, and the energy consumption metering data in the next statistical period is inserted into the tail of the queue to update the queue and maintain the depth of the queue at the preset depth.
[0089] Generally speaking, the metering device is configured with a cache function, and each metering device is configured with a cache function. Let's take one of the metering devices as an example for explanation. The metering device uses the cache function to maintain a cache queue (that is, a data packet). Each time the metering device uploads energy consumption metering data, it caches a copy of the uploaded energy consumption metering data into the cache queue, wherein the cache queue can cache energy consumption metering data of a statistical period of a preset depth. The cache queue is updated once every preset period. If it is within the same statistical period, the latest energy consumption metering data is updated to the corresponding entry; if the two times are no longer within the same statistical period, the energy consumption metering data in the new statistical period is stored at the end of the cache queue, and the energy consumption metering data at the head is deleted to maintain the cache depth at the preset depth. The specific generated data packets can be seen in Table 1.
[0090] like Figure 6 As shown, the embodiment of the present application also provides an energy consumption statistics device, which is applied to the platform side, and the device 60 includes:
[0091] The receiving module 601 is used to receive a data packet uploaded by a metering device; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last recorded entry in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period;
[0092] An updating module 602 is used to update a database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times in each statistical period;
[0093] The statistics module 603 is used to perform energy consumption statistics according to the energy consumption metering data in the database.
[0094] In some embodiments, the update module is specifically used to: obtain the first statistical period to which the upload time of the data packet belongs; obtain the second statistical period to which the upload time corresponding to the previous data packet adjacent to the data packet belongs; compare the first statistical period and the second statistical period; in response to the first statistical period and the second statistical period being the same statistical period, directly update the last recorded entry in the data packet to the database; in response to the first statistical period and the second statistical period not being the same statistical period, update all entries recorded in the data packet after the second statistical period to the database.
[0095] In some embodiments, the statistical module is specifically used to: obtain the period to be counted; in response to the period to be counted being the statistical period corresponding to the last recorded entry in the data packet, directly subtract the energy consumption metering data corresponding to the last recorded entry in the data packet from the energy consumption metering data uploaded for the last time in the previous statistical period adjacent to it, to obtain the energy consumption in the period to be counted; in response to the period to be counted not being the statistical period corresponding to the data except the last recorded entry, obtain the first energy consumption metering data uploaded for the last time in the period to be counted from the database; and obtain the second energy consumption metering data uploaded for the last time in the previous statistical period adjacent to the period to be counted from the database; determine the difference between the first energy consumption metering data and the second energy consumption metering data as the energy consumption in the period to be counted; wherein, the energy is electrical energy, and the energy consumption metering data increases cumulatively over time.
[0096] It should be noted that the energy consumption statistics device is a device for implementing the energy consumption statistics method on the platform side described above, and has the same technical features as the energy consumption statistics method described above. These technical features have been described in detail above and will not be repeated here.
[0097] like Figure 7 As shown, the embodiment of the present application further provides an energy consumption statistics device, which is applied to a metering device. The device 70 may include:
[0098] A generating module 701 is used to generate a data packet; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period;
[0099] The sending module 702 is used to send the data packet to the platform.
[0100] In the above scheme, the data packet is a first-in-first-out queue; the generation module is specifically used to: obtain energy consumption metering data at intervals of the preset period, and update the obtained energy consumption metering data to the position of the corresponding statistical period in the queue to generate the data packet.
[0101] In the above scheme, the generation module is also specifically used to: when the depth of the queue reaches a preset depth and the last recorded entry in the queue is the energy consumption metering data uploaded for the last time in its corresponding statistical period, continue to obtain energy consumption metering data according to the preset period in the next statistical period, and delete the entry corresponding to the head of the queue, and insert the energy consumption metering data in the next statistical period into the tail of the queue to update the queue and maintain the depth of the queue at the preset depth.
[0102] It should be noted that the energy consumption statistics device is a device for implementing the energy consumption statistics method on the metering device side described above, and has the same technical features as the energy consumption statistics method described above. These technical features have been described in detail above and will not be repeated here.
[0103] The embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored, characterized in that when the computer program is loaded and executed by a processor, any of the above methods is implemented. The aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0104] The present application embodiment also provides a computer program product 80, such as Figure 8 As shown, it includes a computer program 801, characterized in that when the computer program is loaded and executed by a processor, it implements any of the methods described above.
[0105] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0106] In addition, in the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0107] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0108] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0109] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0110] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0111] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
Claims
1. A method for energy consumption statistics, characterized in that: Applied to the platform side; the method comprises: Receive a data packet uploaded by a metering device; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period; Update the database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times in each statistical period; Energy consumption statistics are performed based on the energy consumption metering data in the database.
2. The method according to claim 1, characterized in that The updating of the database according to the entries in the data packet comprises: Obtaining a first statistical period to which the upload time of the data packet belongs; Obtain a second statistical period to which an upload time corresponding to a previous data packet adjacent to the data packet belongs; Comparing the first statistical period with the second statistical period; In response to the first statistical period and the second statistical period being the same statistical period, directly updating the last recorded entry in the data packet to the database; In response to the first statistical period and the second statistical period being different from each other, all entries in the data packet recorded after the second statistical period are updated to the database.
3. The method according to claim 1, characterized in that The energy source is electrical energy, and the energy consumption metering data increases cumulatively over time; the energy consumption statistics are performed according to the energy consumption metering data in the database, including: Get the period to be counted; In response to the statistical period to be counted being the statistical period corresponding to the last entry recorded in the data packet, directly subtracting the energy consumption metering data corresponding to the last entry recorded in the data packet from the energy consumption metering data uploaded last in the previous statistical period adjacent to the energy consumption metering data, to obtain the energy consumption in the statistical period to be counted; In response to the fact that the period to be counted is not the statistical period corresponding to the entry excluding the last record in the data, the first energy consumption metering data uploaded for the last time during the period to be counted is obtained from the database; and the second energy consumption metering data uploaded for the last time during the previous statistical period adjacent to the period to be counted is obtained from the database; and the difference between the first energy consumption metering data and the second energy consumption metering data is determined to be the energy consumption during the period to be counted.
4. The method according to claim 1, characterized in that: The data packets are in a first-in-first-out queue, and the queue is updated at intervals of the preset period.
5. The method according to claim 1, characterized in that The statistical period is 1 day.
6. A method for energy consumption statistics, characterized in that: Applied to the metering equipment side, the method includes: Generate a data packet; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period; The data packet is sent to the platform.
7. The method according to claim 6, characterized in that The data packet is a first-in-first-out queue; the generating of the data packet comprises: The energy consumption metering data is acquired at intervals of the preset period, and the acquired energy consumption metering data is updated to the position of the corresponding statistical period in the queue to generate the data packet.
8. The method according to claim 7, characterized in that The method further comprises: When the depth of the queue reaches a preset depth and the last recorded entry in the queue is the energy consumption metering data uploaded for the last time in its corresponding statistical period, the energy consumption metering data continues to be obtained according to the preset period in the next statistical period, and the entry corresponding to the head of the queue is deleted, and the energy consumption metering data in the next statistical period is inserted into the tail of the queue to update the queue and maintain the depth of the queue at the preset depth.
9. An energy consumption statistics device, characterized in that: Applied to the platform side, the device comprises: A receiving module, used to receive a data packet uploaded by a metering device; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period; An update module, used to update a database according to the entries in the data packet; the database is used to store energy consumption metering data corresponding to different upload times in each statistical period; The statistics module is used to perform energy consumption statistics based on the energy consumption metering data in the database.
10. An energy consumption statistics device, characterized in that: Applied to a metering device, the device comprises: A generation module, used to generate a data packet; wherein the data packet includes a plurality of entries; each entry corresponds to energy consumption metering data uploaded within a statistical period; the energy consumption metering data is continuously updated and collected and uploaded according to a preset period within the corresponding statistical period; the time interval of the preset period is less than the time interval of the statistical period; and, in chronological order, the last entry recorded in the data packet is the energy consumption metering data uploaded within the corresponding statistical period; the remaining recorded entries are the energy consumption metering data uploaded for the last time within the corresponding statistical period; The sending module is used to send the data packet to the platform.
11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is loaded and executed by a processor, the method described in any one of claims 1 to 5 or the method described in any one of claims 6 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is loaded and executed by a processor, the method described in any one of claims 1 to 5 or the method described in any one of claims 6 to 8 is implemented.
