Method, device and computer-readable medium for predicting power supply of electricity storage device
By constructing power consumption prediction, power generation prediction and power supply power prediction models, combined with gradient descent method, the problem of data mode changes on edge devices is solved, real-time prediction of household electricity consumption and optimization of power supply power is achieved, prediction accuracy and computing efficiency are improved, and carbon emissions are reduced.
Patent Information
- Application Number
- CN202111218790.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2041-10-20
AI Technical Summary
Machine learning models cannot respond correctly when encountering new data patterns on edge devices, resulting in erroneous results. Training the model in different contexts is not feasible, and it is impossible to effectively predict the power consumption and power supply power of the power storage device.
The electricity consumption prediction model, power generation prediction model and power supply power prediction model are constructed. Through the timing model and linear regression model combined with the gradient descent method, the cost function is optimized, and the electricity consumption and power generation are predicted, and the power supply power is optimized based on the household electricity data and weather data.
Real-time prediction of household electricity consumption and optimization of power supply power are achieved, computing efficiency and accuracy are improved, carbon emissions are reduced, and electricity consumption costs are optimized.
Smart Images

Figure CN114154781B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and specifically to a method and device for predicting the power supply of a power storage device and a computer-readable medium. Background Art
[0002] Each new scenario can generate data patterns that have not been seen before. When a machine learning model is deployed on an edge device, when the model encounters new data patterns, the solidified model cannot correctly respond to the new data patterns, thus producing incorrect results. In addition, training a model with data from one context and deploying it in an environment of another context usually does not produce the desired results. In fact, it is usually not feasible to train different models for different context environments because each model needs to collect, label, process data and tune the parameters of the model. Therefore, edge devices should be capable of locally collecting data and incrementally training.
[0003] How to predict the power consumption and provide prediction guidance for the power supply power of the power storage device is a technical problem that needs to be solved. Summary of the Invention
[0004] The technical task of the present invention is to provide a method and device for predicting the power supply of a power storage device and a computer-readable medium to solve the technical problem of how to predict the power consumption and provide prediction guidance for the power supply power of the power storage device in view of the above deficiencies.
[0005] In a first aspect, a method for predicting the power supply of a power storage device according to the present invention includes the following steps:
[0006] Taking one hour as a collection period, collecting the power consumption of household power consumption nodes and electrical equipment every day as historical power consumption data and storing it in an edge device;
[0007] Constructing a power consumption prediction model, where the power consumption prediction model is a time series model with power consumption data as input and the daily power consumption fluctuation period, power consumption change trend, and power consumption random fluctuation residual as output, and training the power consumption prediction model based on historical power consumption data;
[0008] Constructing a power generation prediction model, where the power generation prediction model is a linear regression model with weather data as input and power generation data as output, and training the power generation prediction model based on historical power generation data and weather data;
[0009] Constructing a power supply power prediction model, where a cost function is configured in the power supply power model, and the cost function is expressed as:
[0010] ,
[0011] Wherein, is Prediction of power consumption at a moment denotes prediction of power generation at a moment denotes remaining power data of the electricity storage device is change value at a moment is power supply of the electricity storage device at a moment, and is the electricity price at the moment;
[0012] Obtain the power consumption at the current moment through the trained power consumption prediction model, obtain the power generation at the current moment through the trained power generation prediction model, and obtain the current electricity price and the remaining power data of the electricity storage device, optimize the above cost function, and based on the optimized cost function, perform value selection according to time periods to obtain the power supply prediction.
[0013] Preferably, the time series model includes:
[0014] Continuous time series model, there is a total of one continuous time series model, which takes the electricity consumption data of N consecutive weeks as input, and predicts and outputs the electricity consumption fluctuation period, electricity consumption change trend and electricity consumption random fluctuation residual per hour per day;
[0015] Discrete time series model, there are a total of seven discrete time series models, corresponding to each day from Monday to Sunday in a week, for each discrete time series model, the day corresponding to it in a week is used as the target day, and the electricity consumption data of all target days in M weeks is used as input, and predicts and outputs the electricity consumption fluctuation period, electricity consumption change trend and electricity consumption random fluctuation residual per hour of the target day;
[0016] The N is a natural number greater than 4, and the M is a natural number greater than 8.
[0017] Preferably, the calculation formula for obtaining the power consumption prediction through the trained power consumption prediction model is:
[0018] ,
[0019] wherein, represents the sum of the predicted values of the discrete time series model,
[0020] represents the sum of the predicted values of the continuous time series model;
[0021] represents the predicted value of the continuous time series model at moment in a day.
[0022] Preferably, optimize the above cost function by the gradient descent method, including the following steps:
[0023] Determine the step size L and the constant max through iterative experiments, where the constant max is the upper limit for restricting the number of random gradient descents;
[0024] For each iteration, load the data in batches and calculate the gradient. The calculation formula for the current gradient is:
[0025] ,
[0026] is the current number of samples, is the current sample value, represents the th gradient of the function mapping of the sample;
[0027] Subtract from and add , in represents the rd gradient descent, where belongs to a random value and conforms to the distribution: ;
[0028] Update the gradient of to , and perform gradient update according to .
[0029] Preferably, the weather data includes temperature, humidity, and cloud cover.
[0030] In a second aspect, the device of the present invention includes: at least one memory and at least one processor;
[0031] The at least one memory is used to store machine-readable programs;
[0032] The at least one processor is used to call the machine-readable program and execute the method according to claim 1.
[0033] In a third aspect, for the computer-readable medium of the present invention, computer instructions are stored on the computer-readable medium, and when the computer instructions are executed by a processor, the processor executes the method according to claim 1.
[0034] The power supply prediction method, device, and computer-readable medium of the present invention have the following advantages:
[0035] 1. Collect data such as the electricity consumption of each household electricity consumption node or device, the power generation of the energy storage device, and the remaining capacity of the energy storage device every day, perform time series modeling and prediction, estimate the power generation according to the weather conditions of the next day, and make overall power supply in combination with the remaining capacity of the household energy storage facilities to cut peaks and fill valleys and optimize the electricity cost;
[0036] 2. In the prediction of household electricity consumption, real-time data collection, periodic offline training and model iteration update are carried out, which improves the operation efficiency and accuracy. Description of the Drawings
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to these drawings.
[0038] The present invention will be further described below with reference to the drawings.
[0039] Figure 1 It is a flow block diagram of the power supply prediction method for the energy storage device in Embodiment 1. Detailed Embodiment
[0040] The present invention will be further described below with reference to the drawings and specific embodiments, so that those skilled in the art can better understand the present invention and implement it, but the examples given are not intended to limit the present invention. Without conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0041] The embodiments of the present invention provide a method, device and computer-readable medium for predicting the power supply of an energy storage device, which are used to solve the technical problem of how to predict the electricity consumption and predict and guide the power supply power of the energy storage device.
[0042] Embodiment 1:
[0043] The method for predicting the power supply of the energy storage device of the present invention includes the following steps:
[0044] S100. Taking one hour as the collection period, collect the electricity consumption of each household electricity consumption node and electrical equipment every day as historical electricity consumption data and store it in the edge device;
[0045] S200. Construct an electricity consumption prediction model. The electricity consumption prediction model is a time series model with electricity consumption data as the input and the daily electricity consumption fluctuation period, electricity consumption change trend, and electricity consumption random fluctuation residual as the output. Train the electricity consumption prediction model based on the historical electricity consumption data;
[0046] S300. Construct a power generation prediction model. The power generation prediction model is a linear regression model with weather data as input and power generation data as output. Train the power generation prediction model based on historical power generation data and weather data;
[0047] S400. Construct a power supply power prediction model. A cost function is configured in the power supply power model, and the cost function is expressed as:
[0048] ,
[0049] where, is the predicted power consumption at time represents the predicted power generation power at time represents the remaining power data of the energy storage device at time is the change value at time is the power supply power of the energy storage device at time is the electricity price at time;
[0050] S500. Obtain the current power consumption through the trained power consumption prediction model, obtain the current power generation power through the trained power generation prediction model, and obtain the current electricity price and the remaining power data of the energy storage device. Optimize the above cost function. Based on the optimized cost function, perform value optimization according to time periods to obtain the power supply power prediction.
[0051] In this embodiment, the time series model includes a continuous time series model and a discrete time series model. There is a total of one continuous time series model, which takes the power consumption data of continuous N weeks as input, and predicts and outputs the power consumption fluctuation period, power consumption change trend, and power consumption random fluctuation residual per hour per day; there are a total of seven discrete time series models, corresponding to each day from Monday to Sunday in a week. For each discrete time series model, the day corresponding to it in a week is used as the target day, and the power consumption data of all target days in M weeks per hour is used as input, and the power consumption fluctuation period, power consumption change trend, and power consumption random fluctuation residual of the target day are predicted and output. Where N is a natural number greater than 4, and M is a natural number greater than 8. In specific applications, the values of N and M are set according to requirements.
[0052] The method for obtaining the power consumption prediction through the trained power consumption prediction model is as follows: sum the prediction values of the discrete time series models and divide by the sum of the continuous time series model to obtain a magnification factor; multiply the magnification factor by the value of each hour of the continuous time series model as the final result of the power consumption. The calculation formula is:
[0053] ,
[0054] Among them, represents the sum of the predicted values of the discrete time series model,
[0055] represents the sum of the predicted values of the continuous time series model;
[0056] represents the predicted value of the continuous time series model at the moment of the day.
[0057] In this embodiment, the above cost function is optimized by the gradient descent method, and the specific steps are as follows:
[0058] (1) Determine the step size L and the constant max through iterative experiments, where the constant max is the upper limit for restricting the number of random gradient descents;
[0059] For each iteration, load the data in batches and calculate the gradient. The calculation formula for the current gradient is:
[0060] ,
[0061] the current number of samples, is the current sample value, represents the th gradient of the function mapping of the sample;
[0062] (3) Subtract from and add , in represents the th gradient descent, where belongs to random values and conforms to the distribution: ;
[0063] (4) Update the gradient of to , and perform gradient update according to .
[0064] The power supply prediction method of the power storage device in this embodiment collects the power consumption of each household power node or device every day and records it in the storage of the edge device, with a cycle of one hour. Then the power consumption prediction is performed through the following steps: based on the power consumption data of the past seven days, time series decomposition can be performed to obtain three groups of data: daily power consumption fluctuation cycle, power consumption change trend and disordered fluctuation value. In this way, the continuous change of power is obtained. At the same time, the data from Monday to Sunday in the past ten weeks are divided into seven groups, one group of data for each day of the week, and the data is decomposed into a time series to obtain the daily power consumption fluctuation cycle, power consumption change trend and disordered fluctuation value. In this way, discrete power changes are obtained.
[0065] At the same time, power generation is predicted through the following steps: the power generation of the daily power storage equipment and the weather data of the day (including temperature, humidity, cloud cover, etc.) are collected to build a linear regression model for power generation, and the model is used to analyze the daily data to predict power generation.
[0066] Finally, the above power consumption data and power generation data are combined with the remaining power of the power storage device and the peak and valley electricity price for joint optimization to minimize the cost function. The cost obtained by this formula can be intuitively understood as the total electricity bill per day, and the daily electricity bill can be minimized through reasonable allocation.
[0067] The model optimization method is an improved gradient descent method. By reducing the computational consumption of gradient descent and combining the data block method to generate data streams, a power management model can be trained offline on the end side to estimate and regulate the power consumption of energy storage devices.
[0068] Traditional stochastic gradient descent mainly uses a batch-based method, but repeated calculation of gradients on the same data set will lead to redundancy, which is very expensive for MCU and cannot be widely promoted. In order to optimize gradient descent, it is necessary to reduce the consumption of gradient calculation; in order to optimize stochastic gradient descent, it is necessary to optimize the variance of stochastic gradient descent. The main idea of this embodiment is to minimize the sum of the loss functions.
[0069] First, for the optimized stochastic gradient descent (Optimized-SGD), set a step size L and a constant max to limit the number of stochastic gradient descents. These two parameters are determined by testing and verification using different combinations.
[0070] The outer for loop of this algorithm is indexed by epoch, and the inner for loop is indexed by epoch. It is a medium random value and conforms to the distribution: The execution steps are as follows: Step 1, in each epoch, calculate Indicates that the function is All gradients at a certain time. The calculation formula is: , where is the number of samples in the current epoch, represents the sample value of the current epoch. When calculating the stochastic gradient of each inner loop, since the amount of data is usually very large and cannot be stored in the memory of the MCU, the data is loaded in batches and the gradient is calculated;
[0071] The next calculation is to subtract from and add , which follows a uniform distribution;
[0072] Then update the gradient of to ;
[0073] According to perform gradient update.
[0074] When predicting the power generation of the electricity storage device, by inputting the time into the above pv numerical model, the output power guidance for the electricity storage device is obtained.
[0075] The data stream required by this algorithm is collected by the energy storage device and stored in the local flash memory. The amount of data is limited according to the actual flash memory size of the device. Such as periodic collection or smoothing of the collected data. When the model needs to be updated, the data is taken out for the specified preprocessing, and after model training through the above algorithm, the data storage is cleared locally.
[0076] When the core model of the energy storage device is iteratively updated, it is immediately put online for data analysis and prediction, the errors of the subsequent results are collected, and at the same time, the time node for the next round of model update is guided.
[0077] The method of this embodiment supports training and deployment on the device side by collecting the data stream of the running IoT device. Usually, resource-constrained devices at the microcontroller level only have a few MB of storage space, hundreds of KB of memory, and a clock frequency of dozens of MHz, and usually cannot afford modern machine learning algorithms with high computational complexity. And it is used in the prediction of household electricity consumption for real-time data collection and periodic offline training and model iterative update.
[0078] The current energy storage power station can participate in the power grid peak shaving daily, meet the power supply demand of the "midday peak + evening peak" in the region, effectively reduce the peak-valley difference, and optimize the load characteristics; during the period when the new energy and the load output do not match, store electricity to promote the consumption of new energy; in terms of reducing carbon emissions, the energy storage system can charge during the low output period of the thermal power unit, increase the output of the unit during the low period, reduce the peak shaving depth of the thermal power unit, effectively reduce the coal consumption per unit of electricity of the unit, and reduce carbon emissions.
[0079] Benefiting from the peak-valley electricity price characteristics of household electricity consumption and the greater sensitivity of household users to power consumption, automated power scheduling is more attractive to users of household energy storage devices. By adjusting the power supply in real time according to the time-of-use electricity price and the power consumption and storage power, the daily electricity bill of a single household is optimized.
[0080] Embodiment 2:
[0081] The device of the present invention includes: at least one memory and at least one processor; at least one memory for storing machine-readable programs; at least one processor for calling the machine-readable programs and executing the method disclosed in Embodiment 1.
[0082] Embodiment 3:
[0083] The computer-readable medium of the present invention stores computer instructions thereon, and when the computer instructions are executed by a processor, the processor executes the method disclosed in Embodiment 1. Specifically, a system or device equipped with a storage medium can be provided, on which software program codes for implementing the functions of any one of the above embodiments are stored, and the computer (or CPU or MPU) of the system or device reads and executes the program codes stored in the storage medium.
[0084] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments, so the program code and the storage medium storing the program code constitute a part of the present invention.
[0085] Examples of storage media for providing program codes include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0086] In addition, it should be clear that not only can the functions of any one of the above embodiments be realized by executing the program code read by the computer, but also by the operating system or the like operating on the computer based on the instructions of the program code to complete part or all of the actual operations.
[0087] In addition, it can be understood that the program code read from the storage medium is written into the memory provided in the expansion board inserted into the computer or into the memory provided in the expansion unit connected to the computer, and then based on the instructions of the program code, the CPU or the like installed on the expansion board or the expansion unit executes part and all of the actual operations, so as to realize the functions of any one of the above embodiments.
[0088] It should be noted that not all steps and modules in the above-mentioned processes and system structure diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities respectively, or some components in multiple independent devices may be jointly implemented.
[0089] In the above-mentioned embodiments, the hardware units can be implemented mechanically or electrically. For example, a hardware unit can include permanent dedicated circuits or logic (such as a dedicated processor, FPGA or ASIC) to complete corresponding operations. The hardware unit can also include programmable logic or circuits (such as a general-purpose processor or other programmable processors), which can be temporarily set by software to complete corresponding operations. The specific implementation method (mechanical method, or dedicated permanent circuit, or temporarily set circuit) can be determined based on cost and time considerations.
[0090] The present invention has been detailedly shown and described above through the drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above-mentioned multiple embodiments, those skilled in the art can know that more embodiments of the present invention can be obtained by combining the code review means in the above different embodiments, and these embodiments are also within the protection scope of the present invention.
Claims
1. A method for predicting the power supply of a power storage device, characterized in that It includes the following steps: Taking one hour as the collection period, collect the electricity consumption of each household electricity node and electrical equipment every day as historical electricity consumption data and store it in the edge device; Construct an electricity consumption prediction model. The electricity consumption prediction model is a time series model with electricity consumption data as the input and the daily electricity consumption fluctuation period, electricity consumption change trend, and electricity consumption random fluctuation residual as the output. Train the electricity consumption prediction model based on the historical electricity consumption data; Construct a power generation prediction model. The power generation prediction model is a linear regression model with weather data as the input and power generation data as the output. Train the power generation prediction model based on the historical power generation data and weather data; Construct a power supply power prediction model, and a cost function is configured in the power supply power model; Obtain the current electricity consumption power through the trained electricity consumption prediction model, obtain the current power generation power through the trained power generation prediction model, and obtain the current electricity price and the remaining power data of the energy storage device. Optimize the above cost function, and based on the optimized cost function, obtain the power supply power prediction; The time series model includes: A continuous time series model. There is only one continuous time series model, which takes the electricity consumption data of continuous N weeks as the input, and predicts and outputs the daily electricity consumption fluctuation period, electricity consumption change trend, and electricity consumption random fluctuation residual in hours; Discrete time series models. There are seven discrete time series models in total, corresponding to each day from Monday to Sunday in a week. For each discrete time series model, the day in a week corresponding to it is used as the target day, and the electricity consumption data of all target days in M weeks is used as the input, and predicts and outputs the hourly electricity consumption fluctuation period, electricity consumption change trend, and electricity consumption random fluctuation residual of the target day; The N is a natural number greater than 4, and the M is a natural number greater than 8; The calculation formula for obtaining the electricity consumption power prediction through the trained electricity consumption prediction model is: , Among them, represents the sum of the predicted values of the discrete time series model, Indicates summing the predicted values of the continuous time series model; Indicates the predicted value of the continuous time series model at a certain moment in a day in a day; Optimize the above cost function by the gradient descent method, including the following steps: Determine the step size L and the constant max through iterative experiments. The constant max is the upper limit of the number of random gradient descents; For each iteration, load the data in batches and calculate the gradient. The calculation formula for the current gradient is: , is the current number of samples, is the current sample value, represents the gradient of the function mapping for the -th sample; Subtract from and add to , in denotes the th gradient descent, where belongs to random values and conforms to the distribution: ; Update the gradient of to , and perform gradient update according to . The weather data includes temperature, humidity, and cloud cover.
2. Apparatus, characterized in that, It includes: At least one memory and at least one processor; The at least one memory is used to store machine-readable programs; The at least one processor is used to call the machine-readable program and execute the method described in claim 1.
3. A computer-readable medium, characterized in that, Computer instructions are stored on the computer-readable medium. When the computer instructions are executed by the processor, the processor executes the method described in claim 1.
Citation Information
Patent Citations
Electric energy management system of intelligent microgrid
CN105048457A