InfluxDB-based energy storage system accumulated electric quantity difference calculation method and device
By dividing time based on time interval attributes in InfluxDB and executing preset strategies in Java environment, the data omission and inaccurate calculation of the cumulative power difference value of the energy storage system are solved, and more accurate and efficient data analysis is achieved.
Patent Information
- Application Number
- CN202411809358.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-10
AI Technical Summary
When calculating the cumulative power difference of the energy storage system in InfluxDB, you may encounter data omissions and inaccurate calculations, especially because the default processing method of InfluxDB is to be left-closed and open right, sensor noise and insufficient time stamp accuracy.
By implementing a time division method based on time interval attributes in InfluxDB, the delayed additional time interval is set, and preset policies are executed in the Java environment for analysis to ensure data integrity and calculation accuracy.
It effectively avoids data omissions caused by InfluxDB's default processing method, improves calculation accuracy, and improves the efficiency of data analysis by quickly processing power difference information.
Smart Images

Figure CN119739761A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of energy storage data analysis, and specifically to a method and device for calculating the accumulated power difference of an energy storage system based on InfluxDB. Background Art
[0002] In the actual application of energy storage systems, data processing and analysis are often required. One of the important tasks is to calculate the difference between power consumption data based on InfluxDB. InfluxDB is a time series database used to handle massive writes and load queries. InfluxDB is designed to be used as the backend storage for any use case involving a large amount of timestamp data.
[0003] When calculating the accumulated power difference of the energy storage system in InfluxDB, data integrity issues may occur. The default processing method of InfluxDB is left-closed and right-open, which will cause data omissions and inaccurate calculations. Sensor noise will introduce errors, and insufficient timestamp precision will reduce accuracy. Therefore, it is urgent to provide an improved technical solution to calculate the accumulated power difference of the energy storage system. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present application provides a method and device for calculating the difference in accumulated electricity consumption of an energy storage system based on InfluxDB, which solves the problems of data omission and inaccurate calculation in difference calculation based on InfluxDB.
[0005] To achieve the above objectives, this application is implemented through the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for calculating the cumulative power difference of an energy storage system based on InfluxDB, the method comprising: obtaining target power consumption information within a target time period from an interface based on InfluxDB; checking the start time and end time of the target time period, and determining whether the target time period has a time interval attribute; in the case of the existence of the time interval attribute, dividing the target time period into multiple sub-time periods, and setting multiple target time intervals; wherein the multiple target time intervals include a delayed additional time interval; in the case of the absence of the time interval attribute, determining two target time intervals based on the target time period, wherein the two target time intervals include a delayed additional time interval; based on the mapping relationship between the target power consumption information and the target time interval, determining whether there is data greater than 0 in the target time interval; in the case of data greater than 0 in the target time interval, executing a preset first strategy through a preconfigured Java environment for analysis to obtain power difference information; in the case of data greater than 0 in the target time interval, executing a preset second strategy through a preconfigured Java environment for analysis to obtain power difference information.
[0007] According to a first aspect of an embodiment of the present application, the power difference information is used to characterize the accumulated power difference in each target time interval to analyze the historical power change trend of the energy storage system;
[0008] In the case where there is a time interval attribute, the target time period is divided into multiple sub-time periods, and multiple target time intervals are set, including: based on the start time and end time of the target time period, the time unit timeUnit and the parameter len are set; the target time period is divided according to the time unit timeUnit and the parameter len to obtain N sub-time periods; wherein N is a positive integer, the parameter len corresponds to the number of sub-time periods, and the time unit timeUnit corresponds to the length of each sub-time period; based on the N sub-time periods, N+1 target time intervals are set accordingly; wherein the N+1th target time interval is an additional time interval set later.
[0009] According to the first aspect of the embodiment of the present application, the time unit timeUnit corresponds to one of minutes, hours, days, months and years; the target time interval is an interval closed on the left and open on the right, the left endpoint of the first target time interval corresponds to the start time, and the left endpoint of the additional time interval corresponds to the end time.
[0010] According to the first aspect of the embodiment of the present application, when there is data greater than 0 in the target time interval, the preset first strategy is executed through the preconfigured Java environment for analysis to obtain the power difference information, including: retrieving and analyzing the power usage information corresponding to each target time interval in turn; when there is data greater than 0 in a target time interval, determining the first data greater than 0 as the target initial value; based on multiple target initial values corresponding to multiple target time intervals, calculating the difference in turn to obtain the power difference information.
[0011] According to the first aspect of the embodiment of the present application, when there is no data greater than 0 in the target time interval, the preset second strategy is executed through the preconfigured Java environment for analysis to obtain the power difference information, including: when there is no data greater than 0 in the target time interval, judging whether the target time interval is a delayed additional time interval; when the target time interval is a delayed additional time interval, judging whether the additional time interval corresponds to data greater than 0; if not, determining that the corresponding difference result is empty; if so, determining the first data greater than 0 and the last data as the target initial value and the target final value, respectively, and calculating the difference between the target initial value and the target final value to obtain the power difference information.
[0012] According to the first aspect of the embodiment of the present application, when there is no data greater than 0 in the target time interval, the preset second strategy is executed through the preconfigured Java environment for analysis to obtain the power difference information, and it also includes: when the target time interval is not a delayed additional time interval, judging whether there is a previous target time interval; if there is no previous target time interval, determining that the difference result of this group is empty; if there is a previous target time interval, judging whether there is data greater than 0 in the previous target time interval; when there is data greater than 0 in the previous target time interval, assigning the target initial value of the previous group to the target initial value of this group, and calculating the difference based on the target initial value of the next group and the target initial value of this group to obtain the power difference information; when there is no data greater than 0 in the previous target time interval, continuing to iterate forward to determine whether there is a previous target time interval.
[0013] According to the first aspect of the embodiment of the present application, the aforementioned InfluxDB-based method for calculating the cumulative electricity difference of the energy storage system also includes: checking the total electricity difference corresponding to the electricity difference information, and determining that the total electricity difference greater than 0 is the first target electricity difference; when the target electricity consumption information corresponds to more than two electricity metering devices, in a preconfigured Java environment, aggregating the first target electricity difference corresponding to each electricity metering device to obtain a second target electricity difference.
[0014] In the second aspect, an embodiment of the present application provides a device for calculating the cumulative power difference of an energy storage system based on InfluxDB, the device comprising: an acquisition module, a first judgment module, a first interval setting module, a second interval setting module, a second judgment module, a first analysis module and a second analysis module.
[0015] Specifically, the acquisition module is used to obtain the target power consumption information within the target time period from the interface based on InfluxDB; the first judgment module is used to check the start time and end time of the target time period, and determine whether the target time period has a time interval attribute; the first interval setting module is used to divide the target time period into multiple sub-time periods and set multiple target time intervals when the time interval attribute exists; wherein the multiple target time intervals include a delayed additional time interval; the second interval setting module is used to determine two target time intervals based on the target time period when the time interval attribute does not exist, wherein the two target time intervals include a delayed additional time interval; the second judgment module is used to determine whether there is data greater than 0 in the target time interval based on the mapping relationship between the target power consumption information and the target time interval; the first analysis module is used to execute the preset first strategy for analysis through the preconfigured Java environment to obtain the power difference information when there is data greater than 0 in the target time interval; the second analysis module is used to execute the preset second strategy for analysis through the preconfigured Java environment to obtain the power difference information when there is no data greater than 0 in the target time interval.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the method for calculating the accumulated power difference of the energy storage system based on InfluxDB in the aforementioned first aspect is implemented.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a program or instruction. When the program or instruction is executed by a processor, the method for calculating the accumulated power difference of an energy storage system based on InfluxDB in the aforementioned first aspect is implemented.
[0018] This application provides a method and device for calculating the cumulative power difference of an energy storage system based on InfluxDB. Compared with the prior art, it has the following beneficial effects:
[0019] This application first checks the rationality of the data for the acquired target time period, and judges whether the start time and the end time are reasonable to ensure the correctness of the subsequent calculation process; when the target time period has a time attribute, the target time period can be divided into multiple sub-time periods, that is, the data is grouped according to the specified time window; when the target time period does not have a time attribute, the target time period is not divided; in the process of processing the target time period, this application sets a delayed additional time interval. For any specific target time period, the additional time interval is used as a new query window to obtain data, ensuring that data can still be obtained and difference calculations can be performed when there is no data, which can avoid the data omission problem caused by the default processing method of InfluxDB's left-closed and right-open. This application integrates the data analysis process in the Java environment for processing to quickly process and obtain the power difference information. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 It is a flowchart of a method for calculating the cumulative power difference of an energy storage system based on InfluxDB provided in an embodiment of the present application;
[0022] Figure 2 yes Figure 1 An exemplary flow chart of S130;
[0023] Figure 3 It is a structural schematic diagram of a device for calculating the accumulated power difference of an energy storage system based on InfluxDB provided in an embodiment of the present application;
[0024] Figure 4 It is a structural schematic diagram of another device for calculating the accumulated power difference of an energy storage system based on InfluxDB provided in an embodiment of the present application;
[0025] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0028] The embodiments of the present application provide a method and device for calculating the difference in accumulated electricity consumption of an energy storage system based on InfluxDB, thereby solving the problems of data omission and inaccurate calculation in difference calculation based on InfluxDB.
[0029] The technical solution in the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows:
[0030] In the actual application of energy storage systems, data processing and analysis are often required. One of the important tasks is to calculate the difference between power consumption data based on InfluxDB. InfluxDB is a time series database used to handle massive writes and load queries. InfluxDB is designed to be used as the backend storage for any use case involving large amounts of timestamp data, including DevOps monitoring, application metrics, IoT sensor data, and real-time analysis.
[0031] When performing difference calculations in InfluxDB, data integrity issues may occur. The default processing method of InfluxDB is left closed and right open, which will cause data omissions and inaccurate calculations. If the sampling frequency is inconsistent, it will also affect the results. In addition, sensor noise will introduce errors, and insufficient timestamp precision will reduce accuracy. Queries on large-scale data may lead to performance degradation. Uneven data distribution will affect computing efficiency. Therefore, it is necessary to provide an improved technical solution.
[0032] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0033] The following first introduces a method for calculating the accumulated power difference of an energy storage system based on InfluxDB provided in an embodiment of the present application.
[0034] The present application embodiment provides a flow chart of a method for calculating the cumulative power difference of an energy storage system based on InfluxDB, such as Figure 1 As shown, the method for calculating the accumulated power difference of the energy storage system may include the following steps S110-S170.
[0035] S110. Obtain target power consumption information within a target time period from an interface based on InfluxDB.
[0036] S120: Check the start time and end time of the target time period, and determine whether the target time period has a time interval attribute. For example, you can check whether the start time and end time are on the same date, or whether other specific conditions are met.
[0037] S130. In the case where there is a time interval attribute, divide the target time period into multiple sub-time periods, and set multiple target time intervals; wherein the multiple target time intervals include a delayed additional time interval.
[0038] S140: In the absence of a time interval attribute, two target time intervals are determined based on the target time period, wherein the two target time intervals include a delayed additional time interval.
[0039] S150. Based on the mapping relationship between the target power consumption information and the target time interval, determine whether there is data greater than 0 in the target time interval. It can be understood that by determining whether there is data greater than 0 in the target time interval, negative numbers or invalid values can be prevented from interfering with the final result.
[0040] S160: When there is data greater than 0 in the target time interval, a preset first strategy is executed through a preconfigured Java environment to perform analysis to obtain power difference information.
[0041] S170: When there is no data greater than 0 in the target time interval, a preset second strategy is executed through a preconfigured Java environment to perform analysis to obtain power difference information.
[0042] The above is a specific implementation method of a method for calculating the cumulative power difference of an energy storage system based on InfluxDB provided in an embodiment of the present application. It can be understood that the present application first checks the rationality of the data for the acquired target time period, and judges whether the start time and the end time are reasonable to ensure the correctness of the subsequent calculation process; when the target time period has a time attribute, the target time period can be divided into multiple sub-time periods, that is, the data is grouped according to the specified time window; when the target time period does not have a time attribute, the target time period is not divided.
[0043] Furthermore, in the process of processing the target time period, the application sets a delayed additional time interval. For any specific target time period, the additional time interval is used as a new query window to obtain data, ensuring that data can still be obtained and difference calculation can be performed when there is no data, which can avoid the data omission problem caused by the default processing method of InfluxDB left closed and right open. The application integrates the data analysis process in the Java environment for processing to quickly process and obtain the power difference information.
[0044] In some embodiments, the power difference information is used to characterize the accumulated power difference in each target time interval to analyze the historical power change trend of the energy storage system.
[0045] like Figure 2 As shown, in the case where there is a time interval attribute, the target time period is divided into multiple sub-time periods, and multiple target time intervals are set, that is, the aforementioned S130 may specifically include the following steps:
[0046] S210 . Set the time unit timeUnit and parameter len based on the start time and end time of the target time period.
[0047] S220. Divide the target time period into N sub-time periods according to the time unit timeUnit and the parameter len, wherein N is a positive integer, the parameter len corresponds to the number of sub-time periods, and the time unit timeUnit corresponds to the length of each sub-time period.
[0048] S230: Based on the N sub-time periods, N+1 target time intervals are correspondingly set; wherein the N+1th target time interval is an additional time interval set later.
[0049] In the embodiment of the present application, it can be understood that the additional time interval is an interval delayed relative to the target time period to overcome the data omission problem caused by the default processing method of InfluxDB left closed and right open; the time length corresponding to the additional time interval is not limited, and illustratively, the time unit length corresponding to the additional time interval can be 1 minute. For any specific time period, a delay of one time unit is used as a new query window to obtain data, ensuring that the last record can still be obtained and the difference calculation can be performed when there is no data.
[0050] In some embodiments, the time unit timeUnit corresponds to one of minutes, hours, days, months, and years. It is understandable that the present application supports the calculation of power difference at different time granularities, is applicable to a variety of application scenarios, enhances the practicality of the method, has good scalability and flexibility, and can perform customized difference calculations according to the needs of actual application scenarios. Different time granularities include minutes, hours, days, months, and years.
[0051] The target time interval is a left-closed and right-open interval. The left endpoint of the first target time interval corresponds to the start time, and the left endpoint of the additional time interval corresponds to the end time.
[0052] It is understandable that the start time and end time of the target time period may be one of whole minutes, whole hours, whole days, whole months and whole years, that is, the start time and end time may correspond to the endpoints of the entire time unit, or may not correspond to the endpoints of the entire time unit.
[0053] In an example, the start time of the target time period is 2024-10-14 09:45:00, and the end time is 2024-10-14 10:30:00; in the process of dividing the sub-time periods, if 15 minutes is determined as a sub-time period, the divided target time intervals are: [09:45:00, 10:00:00), [10:00:00, 10:15:00), [10:15:00, 10:30:00), [10:30:00, 10:31:00), among which [10:30:00, 10:31:00) is an additional time interval and its corresponding time length is 1 minute.
[0054] In an example, the start time of the target time period is 2023-12-14 00:00:00, and the end time is 2024-10-01 00:00:00. In the process of dividing the sub-time periods, if one year is determined as a sub-time period and the division is performed based on the natural year, the target time intervals are: [2023-12-14 00:00:00, 2024-01-01 00:00:00), [2024-01-01 00:00:00, 2024-10-01 00:00:00), [2024-10-01 00:00:00, 2024-10-01 00:01:00); wherein, [2024-10-01 00:00:00, 2024-10-01 00:01:00) is an additional time interval and its corresponding time length is 1 minute.
[0055] In an example, the start time of the target time period is 2024-07-23 00:00:00, and the end time is 2024-08-06 00:00:00. In the process of dividing the sub-time periods, if January is determined as a sub-time period and the division is based on the natural month, the target time intervals are: [2024-07-23 00:00:00, 2024-08-01 00:00:00), [2024-08-01 00:00:00, 2024-08-06 00:00:00), [2024-08-06 00:00:00, 2024-08-06 00:01:00), where [2024-08-06 00:00:00, 2024-08-06 00:01:00) is an additional time interval and its corresponding time length is 1 minute.
[0056] It is understandable that in cases spanning years or months, the earliest target initial value is extracted according to a single month or year, and then the difference calculation is performed to ensure the consistency and accuracy of data across time periods.
[0057] In some embodiments, when there is data greater than 0 in the target time interval, the pre-configured Java environment is used to execute the preset first strategy for analysis to obtain the power difference information, that is, the aforementioned S160 may specifically include the following steps:
[0058] S310, searching and analyzing the electricity consumption information corresponding to each target time interval in turn.
[0059] S320: When there is data greater than 0 in a target time interval, determine the first data greater than 0 as the target initial value.
[0060] S330, based on multiple target initial values corresponding to multiple target time intervals, calculate the difference in sequence to obtain power difference information.
[0061] In the embodiment of the present application, it can be understood that in the process of calculating the power difference information, the present application adopts the initial value-initial value logic to group the data, that is, the data is grouped according to the specified time window, and the earliest target initial value is extracted from each group and calculated.
[0062] In some embodiments, when there is no data greater than 0 in the target time interval, the preset second strategy is executed through the preconfigured Java environment to perform analysis to obtain the power difference information, that is, the aforementioned S170 may specifically include the following steps:
[0063] S410: When there is no data greater than 0 in the target time interval, determine whether the target time interval is a delayed additional time interval.
[0064] S420: When the target time interval is a delayed additional time interval, determine whether there is data greater than 0 corresponding to the additional time interval.
[0065] S430: If it does not exist, determine that the corresponding difference result is empty.
[0066] S440: If it exists, determine the first data and the last data that are greater than 0 as the target initial value and the target final value respectively, and calculate the difference between the target initial value and the target final value to obtain the power difference information.
[0067] In some embodiments, the aforementioned S170 may further include the following steps:
[0068] S450: When the target time interval is not a delayed additional time interval, determine whether there is a previous target time interval.
[0069] S460: If there is no previous target time interval, determine that the difference result of this group is empty.
[0070] S470: If there is a previous target time interval, determine whether there is data greater than 0 in the previous target time interval.
[0071] S480. When there is data greater than 0 in the previous target time interval, assign the target initial value of the previous group to the target initial value of this group, calculate the difference based on the target initial value of the next group and the target initial value of this group, and obtain the power difference information.
[0072] S490: When there is no data greater than 0 in the previous target time interval, continue to iterate forward to determine whether there is a previous target time interval.
[0073] In some embodiments, the method for calculating the accumulated power difference of the energy storage system may further include the following steps: S180 - S190 .
[0074] S180. Check the total power difference corresponding to the power difference information, and determine that the total power difference greater than 0 is the first target power difference.
[0075] S190. When the target power usage information corresponds to more than two power metering devices, in a preconfigured Java environment, aggregate the first target power difference values corresponding to the respective power metering devices to obtain a second target power difference value.
[0076] In the embodiments of the present application, it can be understood that due to the performance limitations of InfluxDB in data aggregation, the present application performs data aggregation work in a Java application to increase processing speed.
[0077] In some embodiments, the present application provides an energy storage system cumulative power difference calculation device 500 based on InfluxDB, such as Figure 3 As shown, the energy storage system cumulative power difference calculation device 500 may include the following modules:
[0078] An acquisition module 510 is used to acquire target power consumption information within a target time period from an interface based on InfluxDB;
[0079] The first determination module 520 is used to check the start time and end time of the target time period and determine whether the target time period has a time interval attribute;
[0080] The first interval setting module 530 is used to divide the target time period into multiple sub-time periods and set multiple target time intervals when there is a time interval attribute; wherein the multiple target time intervals include a delayed additional time interval;
[0081] A second interval setting module 540 is used to determine two target time intervals based on the target time period when there is no time interval attribute, wherein the two target time intervals include a delayed additional time interval;
[0082] The second judgment module 550 is used to judge whether there is data greater than 0 in the target time interval based on the mapping relationship between the target power consumption information and the target time interval;
[0083] The first analysis module 560 is used to execute a preset first strategy to perform analysis through a preconfigured Java environment to obtain power difference information when there is data greater than 0 in the target time interval;
[0084] The second analysis module 570 is used to execute a preset second strategy to perform analysis through a preconfigured Java environment to obtain power difference information when there is no data greater than 0 in the target time interval.
[0085] According to an embodiment of the present application, any multiple modules among the acquisition module 510, the first judgment module 520, the first interval setting module 530, the second interval setting module 540, the second judgment module 550, the first analysis module 560 and the second analysis module 570 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module.
[0086] In some embodiments, Figure 4 As shown, the energy storage system cumulative power difference calculation device 500 may also include the following modules:
[0087] A difference checking module 580 is used to check the total power difference corresponding to the power difference information, and determine that the total power difference greater than 0 is the first target power difference;
[0088] The aggregation processing module 590 is used to aggregate the first target power difference values corresponding to each power metering device in a preconfigured Java environment to obtain a second target power difference value when the target power usage information corresponds to more than two power metering devices.
[0089] In some embodiments, the first interval setting module 530 may be specifically used to:
[0090] Based on the start and end time of the target time period, set the time unit timeUnit and parameter len;
[0091] Divide the target time period into N sub-time periods according to the time unit timeUnit and the parameter len, where N is a positive integer, the parameter len corresponds to the number of sub-time periods, and the time unit timeUnit corresponds to the length of each sub-time period;
[0092] Based on the N sub-time periods, N+1 target time intervals are correspondingly set; wherein the N+1th target time interval is an additional time interval set later.
[0093] In some embodiments, the first analysis module 560 may be specifically used to:
[0094] Search and analyze the electricity consumption information corresponding to each target time interval in turn;
[0095] When there is data greater than 0 in a target time interval, the first data greater than 0 is determined as the target initial value;
[0096] Based on multiple target initial values corresponding to multiple target time intervals, the differences are calculated in sequence to obtain power difference information.
[0097] In some embodiments, the second analysis module 570 may be specifically used to:
[0098] When there is no data greater than 0 in the target time interval, determine whether the target time interval is a delayed additional time interval;
[0099] When the target time interval is a delayed additional time interval, determining whether the additional time interval corresponds to data greater than 0;
[0100] If it does not exist, the corresponding difference result is determined to be empty;
[0101] If it exists, the first and last data pieces greater than 0 are respectively determined as the target initial value and target final value, and the difference between the target initial value and the target final value is calculated to obtain the power difference information.
[0102] In some embodiments, the second analysis module 570 may also be used to:
[0103] When the target time interval is not a delayed additional time interval, determining whether there is a previous target time interval;
[0104] If there is no previous target time interval, the difference result of this group is determined to be empty;
[0105] If there is a previous target time interval, determine whether there is data greater than 0 in the previous target time interval;
[0106] If there is data greater than 0 in the previous target time interval, the target initial value of the previous group is assigned to the target initial value of this group, and the difference is calculated based on the target initial value of the next group and the target initial value of this group to obtain the power difference information;
[0107] When there is no data greater than 0 in the previous target time interval, continue to iterate forward to determine whether there is a previous target time interval.
[0108] Figure 4 Each module in the device shown has the function of implementing each step in the aforementioned InfluxDB-based energy storage system cumulative power difference calculation method and can achieve its corresponding technical effect. For the sake of concise description, it will not be repeated here.
[0109] In some embodiments, the present application provides an electronic device, the structure diagram of the electronic device is as follows Figure 5 shown.
[0110] The electronic device may include a processor 610 and a memory 620 storing computer program instructions.
[0111] Specifically, the processor 610 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0112] The memory 620 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 620 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 620 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 620 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 620 is a non-volatile solid-state memory.
[0113] The memory 620 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory 620 includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it can perform any of the operations described in the above-mentioned embodiments of the method for calculating the cumulative power difference of the energy storage system based on InfluxDB.
[0114] The processor 610 reads and executes computer program instructions stored in the memory 620 to implement any one of the methods for calculating the accumulated power difference of the energy storage system based on InfluxDB in the above embodiments.
[0115] In one example, the electronic device may further include a communication interface 630 and a bus 600. Figure 5 As shown, the processor 610, the memory 620, and the communication interface 630 are connected via a bus 600 and communicate with each other.
[0116] The communication interface 630 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0117] Bus 600 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 600 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0118] In addition, in combination with the energy storage system cumulative power difference calculation method based on InfluxDB in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the energy storage system cumulative power difference calculation methods based on InfluxDB in the above embodiment is implemented.
[0119] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0120] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0121] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0122] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0123] In summary, compared with the prior art, this application has the following beneficial effects:
[0124] 1. This application supports the calculation of power difference at different time granularities, is applicable to a variety of application scenarios, enhances the practicality of the method, has good scalability and flexibility, and can perform customized difference calculations according to the needs of actual application scenarios. It can easily calculate the power of various time dimensions such as minutes, hours, days, months, and years, and provide basic data support for the development of energy storage systems.
[0125] 2. In the process of processing the target time period, this application sets a delayed additional time interval. For any specific target time period, the additional time interval is used as a new query window to obtain data, ensuring that data can still be obtained and difference calculation can be performed when there is no data, which can avoid data omissions caused by the default processing method of InfluxDB's left-closed and right-open.
[0126] 3. In the process of analyzing the target power consumption information corresponding to multiple power metering devices, the present application verifies the power difference information corresponding to each power metering device. After obtaining the first target power difference, the multiple first target power difference values are processed through a Java program. Compared with the InfluxDB environment, data aggregation can be performed quickly to obtain the final second target power difference value.
[0127] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for calculating the cumulative power difference of an energy storage system based on InfluxDB, characterized in that: include: Based on InfluxDB, the target electricity consumption information within the target time period is obtained from the interface; Checking the start time and end time of the target time period, and determining whether the target time period has a time interval attribute; In the case where the time interval attribute exists, the target time period is divided into multiple sub-time periods, and multiple target time intervals are set; wherein the multiple target time intervals include a delayed additional time interval; In the absence of the time interval attribute, two target time intervals are determined based on the target time period, wherein the two target time intervals include a delayed additional time interval; Based on the mapping relationship between the target power consumption information and the target time interval, determining whether there is data greater than 0 in the target time interval; When there is data greater than 0 in the target time interval, a preset first strategy is executed through a preconfigured Java environment to perform analysis to obtain power difference information; When there is no data greater than 0 in the target time interval, a preset second strategy is executed through a preconfigured Java environment to perform analysis to obtain power difference information.
2. The method for calculating the cumulative power difference of the energy storage system based on InfluxDB according to claim 1, characterized in that: The power difference information is used to characterize the accumulated power difference in each target time interval, so as to analyze the historical power change trend of the energy storage system; In the case where the time interval attribute exists, the target time period is divided into multiple sub-time periods, and multiple target time intervals are set, including: Based on the start time and end time of the target time period, set the time unit timeUnit and the parameter len; The target time period is divided according to the time unit timeUnit and the parameter len to obtain N sub-time periods; wherein N is a positive integer, the parameter len corresponds to the number of the sub-time periods, and the time unit timeUnit corresponds to the length of each of the sub-time periods; Based on the N sub-time periods, N+1 target time intervals are correspondingly set; wherein the N+1th target time interval is an additional time interval set later.
3. The method for calculating the cumulative power difference of the energy storage system based on InfluxDB according to claim 2, characterized in that: The time unit timeUnit corresponds to one of minute, hour, day, month and year; The target time interval is a left-closed and right-open interval, the left endpoint of the first target time interval corresponds to the start time, and the left endpoint of the additional time interval corresponds to the end time.
4. The method for calculating the cumulative power difference of the energy storage system based on InfluxDB according to claim 1, characterized in that: When there is data greater than 0 in the target time interval, the pre-configured Java environment is used to execute a preset first strategy for analysis to obtain power difference information, including: Retrieving and analyzing the electricity consumption information corresponding to each target time interval in turn; When there is data greater than 0 in a target time interval, the first data greater than 0 is determined as the target initial value; Based on the multiple target initial values corresponding to the multiple target time intervals, the differences are calculated in sequence to obtain the power difference information.
5. The method for calculating the cumulative power difference of the energy storage system based on InfluxDB according to claim 1, characterized in that: When there is no data greater than 0 in the target time interval, the second preset strategy is executed through the preconfigured Java environment to perform analysis to obtain the power difference information, including: If there is no data greater than 0 in the target time interval, determining whether the target time interval is a delayed additional time interval; In the case where the target time interval is a delayed additional time interval, determining whether data greater than 0 exists in the additional time interval; If it does not exist, the corresponding difference result is determined to be empty; If so, the first data and the last data greater than 0 are respectively determined as the target initial value and the target final value, and the difference between the target initial value and the target final value is calculated to obtain the power difference information.
6. The method for calculating the cumulative power difference of the energy storage system based on InfluxDB according to claim 5, characterized in that: Also includes: In the case where the target time interval is not a delayed additional time interval, determining whether there is a previous target time interval; If there is no previous target time interval, the difference result of this group is determined to be empty; If the previous target time interval exists, determining whether there is data greater than 0 in the previous target time interval; If there is data greater than 0 in the previous target time interval, the target initial value of the previous group is assigned to the target initial value of the current group, and the difference is calculated based on the target initial value of the next group and the target initial value of the current group to obtain the power difference information; When there is no data greater than 0 in the previous target time interval, continue to iterate forward to determine whether there is a previous target time interval.
7. The method for calculating the cumulative power difference of an energy storage system based on InfluxDB according to any one of claims 1 to 6, characterized in that: Also includes; Checking the total power difference corresponding to the power difference information, and determining that the total power difference greater than 0 is the first target power difference; In the case where the target power usage information corresponds to more than two power metering devices, in a preconfigured Java environment, the first target power difference values corresponding to the respective power metering devices are aggregated to obtain a second target power difference value.
8. A device for calculating the cumulative power difference of an energy storage system based on InfluxDB, characterized in that: include: An acquisition module is used to obtain target power consumption information within a target time period from an interface based on InfluxDB; A first judgment module is used to check the start time and end time of the target time period and to judge whether the target time period has a time interval attribute; A first interval setting module, configured to divide the target time period into multiple sub-time periods and set multiple target time intervals when the time interval attribute exists; wherein the multiple target time intervals include a delayed additional time interval; A second interval setting module, configured to determine two target time intervals based on the target time period in the absence of the time interval attribute, wherein the two target time intervals include a delayed additional time interval; A second judgment module is used to judge whether there is data greater than 0 in the target time interval based on the mapping relationship between the target power consumption information and the target time interval; A first analysis module is used to execute a preset first strategy to perform analysis through a preconfigured Java environment to obtain power difference information when there is data greater than 0 in the target time interval; The second analysis module is used to execute a preset second strategy for analysis through a preconfigured Java environment to obtain power difference information when there is no data greater than 0 in the target time interval.
9. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the method for calculating the accumulated power difference of an energy storage system based on InfluxDB as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the method for calculating the accumulated power difference of the energy storage system based on InfluxDB as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Emission factor calculator and emission factor calculation method
CN102334037A
Computer-implemented system and method for estimating electric baseload consumption using net load data
US10747914B1