Optimization Strategy of Conﬁguration and Scheduling for User-Side Energy Storage

: In order to reduce the impact of load power ﬂuctuations on the power system and ensure the economic beneﬁts of user-side energy storage operation, an optimization strategy of conﬁguration and scheduling based on model predictive control for user-side energy storage is proposed in this study. Firstly, considering the cost and beneﬁts of energy storage comprehensively, an energy storage conﬁguration optimization model with the highest annualized net income as the goal is built to determine the parameters for conﬁguring energy storage. Then, with the goal of maximizing the proﬁt during the scheduling period, pre-month scheduling optimization model, day-ahead scheduling optimization model and intra-day scheduling optimization model are established. The goal of the pre-month scheduling optimization model is to determine the maximum monthly demand; part of the scheduling results in the day-ahead scheduling optimization model directly participate in the intra-day scheduling; the intra-day rolling optimization relies on the advantages of real-time feedback and closed-loop scheduling to smooth out power ﬂuctuations caused by load forecast errors. Finally, the conﬁguration and economic beneﬁt of lithium iron phosphate batteries, lead-carbon batteries and sodium-sulfur batteries are analyzed and compared, and scheduling analysis is performed. The simulation results show that the proposed optimization method can cut peaks and ﬁll valleys, ensure the economic beneﬁts of users, and provide guidance for users to invest in energy storage.


Introduction
Energy storage can realize the migration of energy in time, and then can adjust the change of electric load. Therefore, it is widely used in smoothing the load power curve, cutting peaks and filling valleys as well as reducing load peaks [1][2][3][4][5][6]. China has also issued corresponding policies to encourage the development of energy storage on the user side, and pointed out that the peak-to-valley difference in electricity prices is expected to be further widened in the future, and the room for users to benefit from additional energy storage will be further expanded. Therefore, the research on the optimal configuration of user-side energy storage has certain practical significance. At the same time, in order to give full play to the advantages of energy storage, efficient scheduling strategies need to be adopted to ensure optimal operation of energy storage and reduce user electricity costs.
There have been some studies on user-side energy storage configuration, but there are few related papers on demand response. Refs. [7][8][9][10] established a capacity market model considering demand response, but failed to conduct in-depth research on energy storage configuration. Ref. [11] established an energy storage investment model under storage configuration model to solve the rated capacity and rated power of the additional energy storage. Second, under the two-part electricity price mechanism, based on the pre-month load forecast data, a pre-month optimization model with the maximum monthly income as the goal is built to determine the maximum monthly demand. Third, based on the monthly maximum demand value and day-ahead load forecast data, a day-ahead optimization model with the goal of maximizing daily income is built to obtain the charge and discharge power of the energy storage at each moment in the day before. Fourth, based on the results of the above model and the actual load data, the feedback correction is performed, and the energy storage output is optimized using the MPC-based rolling optimization scheduling strategy. Finally, the effectiveness and rationality of the proposed method are verified through simulation. Through the configuration of energy storage, peak shaving and valley filling are realized, the peak load is reduced, the smooth operation of the power grid is ensured and certain economic benefits are brought to users.

Life Model
The life of energy storage is determined by the number of cycles and the depth of discharge. The equivalent operating life T years of a lithium iron phosphate battery is [18]: where dod is the depth of charge and discharge of energy storage and c y is the average number of cycles of energy storage per year.

Cost Model
The cost model of energy storage includes installation costs, operation and maintenance costs, and capacity attenuation costs. At the same time, it also considers a regularized function for smoothing the power fluctuations of the grid connection point.

Annual Installation Costs
The cost of energy storage installation includes the battery body, power conversion device, supporting equipment and engineering expenses. The battery investment is proportional to the rated capacity of energy storage, the investment of power conversion device is proportional to the rated power of energy storage, and the costs of supporting equipment and engineering are proportional to the rated capacity of energy storage [19]. Therefore, the annual installation costs C 1 of energy storage can be expressed as: where E bat is the rated capacity of energy storage; P bat is the rated power of energy storage; c 11 is the price per unit capacity of energy storage; c 12 is the price per unit power of energy storage; and r is the discount rate.

Annual Operation and Maintenance Costs
The annual operation and maintenance costs of energy storage are related to the rated power of energy storage. The annual operation and maintenance costs C 2 can be expressed as: where c 2 is the operation and maintenance cost per unit power of energy storage.

Energy Storage Capacity Attenuation Costs
Frequent charging and discharging of energy storage will gradually reduce the energy storage capacity, resulting in a decline in energy storage revenue. The amount of energy storage capacity attenuation is determined by the number of cycles and the depth of discharge, so the average annual loss function of energy storage revenue C 3 and the annual capacity attenuation of energy storage C rs can be expressed as [19]: where D y is the average annual operating days of energy storage; η is the energy storage charge and discharge efficiency; e fg is the peak-to-valley price difference; e fp is the peak-toaverage price difference; n is the number of cycles per day for energy storage; SOC max and SOC min are the upper and lower limits of the state of charge of energy storage; and δ(dod) is the capacity decay rate per cycle of energy storage at the depth of dod discharge.

Regularization Function for Smoothing the Power Fluctuation of the Grid Connection Point
The power curve of the grid-connected point is smoothed by controlling the charge and discharge power of the energy storage, and the power fluctuation of the grid-connected point is included in the costs in the form of a regularization function. The regularization function C 4 can be expressed as: where ε Z is the regularization coefficient of smoothing power; M is the number of months per year; D is the number of days per month; and H is the number of hours per day. P lb (i,j,t) is the grid-connected point power at time t on the j-th day of the i-th month after the energy storage is configured.

Revenue Model
The revenue model of energy storage includes electricity bill revenue, reduced transformer cost due to peak load reduction, recovery value, demand response benefit, reliability benefit from reduced power outages and government subsidy benefit.

Electricity Revenue
The electricity bill paid by large industrial users consists of two parts: the basic electricity bill and the kilowatt hour electricity bill. The basic electricity bill can be calculated according to the capacity of the transformer, or according to the maximum demand. Users whose basic electricity bill is charged according to the maximum demand shall sign a contract with the power grid company, and the basic electricity bill shall be calculated and collected according to the maximum monthly demand value of the contract. The kilowatt hour electricity bill is calculated and collected according to the user's actual monthly electricity consumption. Based on the two-part electricity price, taking into account the power supply pressure of the power grid, and using the characteristics of energy storage to cut peaks, the monthly basic electricity bill paid by users can be reduced; At the same time, energy storage transfers the load in the time dimension and utilizes the time-of-use electricity price. "Low storage and high discharge" can save electricity costs.
(1) The basic electricity revenue This paper calculates the basic electricity bill based on the maximum demand, and the user's monthly demand electricity bill R billing rules: where c b is the unit price of the maximum demand; P MM is the monthly maximum demand value signed by the contract; and P act is the actual measured monthly maximum demand value. The actual measured maximum demand exceeds 105% of the contractual approved value, and the basic electricity fee for the portion exceeding 105% is doubled. Therefore, energy storage can smooth the power curve of the grid connection point and reduce the maximum demand value through "low storage and high discharge". The annual basic electricity cost I 1 saved is: where E N (i) is the demand electricity bill for the i-th month without energy storage; and E Y (i) is the demand electricity bill for the i-th month with energy storage.
(2) The kilowatt hour electricity revenue The "low storage and high discharge" of energy storage can transfer the power load. According to the time-of-use tariff mechanism, users can generate revenue from peak shaving and valley filling. Therefore, the annual kilowatt hour electricity cost I 2 saved is: where P(i,j,t) is the absorbed power value of energy storage at time t on the j-th day of the i-th month, negative value for discharging and positive value for charging; and e(t) is the time-of-use electricity price at time t.

Reduced Average Annual Transformer Cost
With fixed power factor and load rate, the transformer parameters configured by the user depend on the annual peak load. In the project planning stage, the annual average transformer cost I 3 that can be reduced by reducing the annual load peak can be expressed as: where α is the ratio of transformer installation cost to equipment cost; c 3 is the unit price of the transformer; K is the load factor of the transformer; cosϕ is the power factor; P peak and P peak are the user's original annual load peak value and the annual load peak value after the energy storage is configured.

Recovery Value
After the energy storage is scrapped, it can be recycled to obtain benefits. The average annual recovery value I 4 of energy storage can be expressed as: where γ is the recovery factor and C 1 is the annual installation cost. Demand response means that when the reliability of the power system is threatened, the user reduces the power load for a specified period of time according to the notification of the power supplier to ensure the safe and stable operation of the power grid system. The revenue I 5 obtained by the user from the implementation of the demand response contract each year can be expressed as: where P r (j) is the benefit after implementing the demand response contract on the j-th day to reduce the corresponding load and P u (j) is the penalty paid for defaulting on the j-th day without reducing the load.

Reliability Benefit
Users can install energy storage to improve the reliability of power supply, and the number of power outages can be greatly reduced. The annual reliability benefit I 6 brought by energy storage can be expressed as: where ρ is the user's profit loss per unit capacity for 1 h of power outage and t t is the average annual outage time of the user's power outage reduced by adding energy storage to the rated power of the energy storage.

Annual Benefit from Government Subsidies
Suzhou implemented an energy storage subsidy policy in 2019, subsidizing users 0.3 yuan per kilowatt-hour of electricity discharged by energy storage. The annual subsidy benefit I 7 is: where P(i,j,t) − is the discharge power value of energy storage at time t on the j-th day of the i-th month, which is a negative value; e b is the subsidized electricity price per kilowatt-hour.

Energy Storage Configuration Model
The energy storage configuration model is used to determine the rated power and rated capacity of the energy storage installed by the user.

Objective Function
The objective function of the energy storage configuration optimization model is that the annualized net income of energy storage is the highest, and the capacity and power of the user's additional energy storage are optimized. The objective function G can be expressed as: where I 1 is the annual basic electricity cost saved by energy storage; I 2 is the annual electricity cost saved by energy storage; I 3 is the annual average transformer cost that can be reduced by reducing the annual load peak; I 4 is the average annual recovery value of energy storage; I 5 is the revenue that users obtain from the implementation of demand response contracts each year; I 6 is the annual reliability benefit of energy storage; I 7 is the average annual government subsidy revenue; C 1 is the annual installation cost of energy storage; C 2 is the annual operation and maintenance cost of energy storage; C 3 is the average annual revenue loss function caused by the attenuation of energy storage capacity; and C 4 is a regularized function for smoothing the power fluctuation of the grid connection point.

State-of-Charge Constraints
In a charge-discharge cycle of energy storage, the state of charge (SOC) at each moment should meet the upper and lower limits. During the operation of energy storage, the state of charge at t + 1 is related to the state of charge and power at t. The SOC of energy storage should be consistent at the beginning and end of the daily dispatch cycle to ensure the continuity of energy storage operation.
where SOC(i,j,t) is the state of charge of energy storage at time t on the j-th day of the i-th month; SOC(i,j,0) is the state of charge of the energy storage at the 0-th hour on the j-th day of the i-th month; and SOC(i,j,H) is the state of charge of energy storage at time H on the j-th day of the i-th month.

Power Limit Constraints
Overload operation will affect the performance of energy storage and shorten the operating life of energy storage. Therefore, the power value of energy storage at any time should not exceed its rated power.

Constraints on the Number of Daily Cycles
The energy storage should be operated at the pre-set daily cycle times every day.

Demand Control Constraints and Restrictions on Preventing Power Backwards
After the user configures energy storage, the power of the grid-connected point should not exceed the maximum demand value of this month, and there should be no reverse power transmission to the grid.
where P 1 (i,j,t) is the absorbed power value of the load at time t on the j-th day of the i-th month when no energy storage is configured; P lb (i,j,t) is the load power of the grid connection point after energy storage is configured; P min = 0, which is the minimum power on the grid-connected side; and P X (i) is the maximum demand in the i-th month after the user configures energy storage.

Magnification Constraint
The rated power and rated capacity of energy storage have a certain proportional relationship.

Peak Clipping Constraints
After energy storage peak shaving and valley filling, the load power of the grid connection point should not exceed the peak load after peak shaving.
where µ is the peak shaving rate. P lmax (i,j) is the peak load on the j-th day of the i-th month when no energy storage is configured.

Peak and Valley Constraints
In order to play the role of energy storage in peak shaving and valley filling, the load power value of the grid connection point after energy storage is configured should float within the load power curve range when energy storage is not configured.
where P lmin (i,j) is the minimum load on the j-th day of the i-th month when energy storage is not configured.

Energy Storage Scheduling Model
The energy storage scheduling model includes a pre-month optimization model and a daily optimization model. The pre-month optimization model is used to determine the monthly maximum demand value of energy storage, and the daily optimization model is used to determine the daily scheduling situation of energy storage.

Objective Function
The pre-month optimization model aims to maximize the user's monthly income, and optimizes and determines the maximum monthly demand based on the pre-month load forecast data. The monthly income of the user is calculated based on two parts: the basic electricity bill and the kilowatt hour electricity bill.
where Z 1 is the electricity demand income saved in the i-th month after the user configures energy storage; Z 2 is the monthly kilowatt hour electricity bill saved by users; P(j,t) is the absorbed power value of energy storage at time t of the j-th day, negative value for discharging and positive value for charging. The objective function is: where G M is the total electricity bill income of the current month.

Restrictions
Taking the energy storage power and capacity solved in the energy storage configuration model as the known quantities, the time in the constraints in Section 3.2 is changed from annual to monthly, which are the constraints of pre-month optimization model. They include state-of-charge constraints, power limit constraints, daily cycle times constraints, demand control constraints, restrictions on preventing power backwards, peak-shaving constraints and peak-valley constraints.

Objective Function
The day-ahead optimization model aims at maximizing the user's daily income, and optimizes and determines the daily scheduling situation of energy storage. The user's daily income only considers the kilowatt hour electricity fee, and the objective function can be expressed as: where G D is the kilowatt hour electricity fee income of the day; P(t) is the absorbed power value of the energy storage at time t, negative value for discharging and positive value for charging.

Restrictions
Taking the energy storage power and capacity solved in the energy storage configuration model and the monthly maximum demand solved in the pre-month optimization model as the known quantities, the time in the constraints in Section 3.2 is changed from annual to daily, which are the constraints of the daily optimization model. They include state-of-charge constraints, power limit constraints, daily cycle times constraints, demand control constraints, restrictions on preventing power backwards, peak-shaving constraints and peak-valley constraints.

Intra-Day Optimal Scheduling Strategy for Energy Storage Based on MPC
MPC is a model-based finite time-domain closed-loop control method, including model prediction, rolling optimization and feedback correction [41][42][43]. Feedback correction only adjusts the scheduling plan for the next time period. Model predictive control can correct the uncertainty problem caused by disturbance in time [43], and improve the actual control performance of the system.
The forecast time domain refers to the length of time for load forecasting, and the control time domain refers to the length of time to execute the results of energy storage scheduling. The basic working principle of MPC is shown in Figure 1 [40]. Its core idea is: at the initial time t 0 , based on the load forecast value in the predicted time domain, the model is optimized to obtain the scheduling plan in the entire time domain, and only execute the planned value of the first time interval (control time domain). In the next optimal scheduling, based on the latest actual value fed back by the system, the forecast time domain is shifted back by a time interval ∆t, and the model is optimized and solved to obtain the scheduling plan in the forecast time domain, and only the plan value of the first time interval (control time domain) is executed. In such a rolling operation, the prediction time domain is compressed to the end of the scheduling period as time passes, and the control time domain follows the prediction time domain to move backwards continuously until the scheduling plan of the entire scheduling period is completed.
Energy storage intra-day optimization scheduling strategy includes energy storage day-ahead optimization operation and MPC-based intra-day rolling optimization operation. Energy storage intra-day optimization scheduling strategy includes energy storage day-ahead optimization operation and MPC-based intra-day rolling optimization operation. Figure 2 is a flow chart of energy storage intra-day optimization scheduling strategy. The steps are as follows.
The first step is to obtain the optimal scheduling situation of the energy storage dayahead for the day to be scheduled based on the day-ahead load forecast data.
In the second step, starting from a time point of 0 o'clock, during the low electricity price period, the charging result of energy storage in the day-ahead optimal scheduling model is adopted. After entering the non-low electricity price period, the energy storage begins to discharge. The optimal scheduling result for the whole period is calculated with the maximum daily income as the goal, by using the known actual load data before time t and load forecast data at time t and after; only the energy storage power value at time t for scheduling is executed.
In the third step, at time t + 1, based on the determined energy storage operating power and load actual data at time t and before, and load forecast data at time t + 1 and after, the optimal scheduling is performed again. If the model has an optimal solution, only the energy storage power value at time t + 1 is executed; if the model does not have an optimal solution, the load forecast data is used at time t to optimize scheduling with the goal of maximizing daily income, and only the energy storage power value at time t + 1 is executed.
In the fourth step, it is judged whether the time t to be scheduled is greater than the number of samples per day of 96. If it is not greater, the optimization operation is continued; if it is greater, the optimization of the scheduling day ends.

Model Solving
The models in this paper are based on Python and are solved by the Gurobi optimizer. First, we build an energy storage configuration optimization model based on the user's one-year historical load data to optimize the rated power and capacity of the energy storage, and then calculate the costs and benefits of energy storage, and make a judgment on whether the user is suitable for additional energy storage. If the user is satisfied with the estimated revenue, we build a pre-month optimization model for energy storage based on the predicted data before the month and the configured energy storage power and capacity to solve the user's maximum monthly demand value; based on the above known quantities and day-ahead load forecast data, a daily energy storage optimization model is built, and an MPC-based intra-day optimization scheduling The first step is to obtain the optimal scheduling situation of the energy storage day-ahead for the day to be scheduled based on the day-ahead load forecast data.
In the second step, starting from a time point of 0 o'clock, during the low electricity price period, the charging result of energy storage in the day-ahead optimal scheduling model is adopted. After entering the non-low electricity price period, the energy storage begins to discharge. The optimal scheduling result for the whole period is calculated with the maximum daily income as the goal, by using the known actual load data before time t and load forecast data at time t and after; only the energy storage power value at time t for scheduling is executed.
In the third step, at time t + 1, based on the determined energy storage operating power and load actual data at time t and before, and load forecast data at time t + 1 and after, the optimal scheduling is performed again. If the model has an optimal solution, only the energy storage power value at time t + 1 is executed; if the model does not have an optimal solution, the load forecast data is used at time t to optimize scheduling with the goal of maximizing daily income, and only the energy storage power value at time t + 1 is executed.
In the fourth step, it is judged whether the time t to be scheduled is greater than the number of samples per day of 96. If it is not greater, the optimization operation is continued; if it is greater, the optimization of the scheduling day ends.

Model Solving
The models in this paper are based on Python and are solved by the Gurobi optimizer. First, we build an energy storage configuration optimization model based on the user's oneyear historical load data to optimize the rated power and capacity of the energy storage, and then calculate the costs and benefits of energy storage, and make a judgment on whether the user is suitable for additional energy storage. If the user is satisfied with the estimated revenue, we build a pre-month optimization model for energy storage based on the predicted data before the month and the configured energy storage power and capacity to solve the user's maximum monthly demand value; based on the above known quantities and day-ahead load forecast data, a daily energy storage optimization model is built, and an MPC-based intra-day optimization scheduling strategy is adopted to solve the daily energy storage scheduling situation. The flow chart of energy storage solution is shown in Figure 3.

Case Analysis
This paper compares the configuration and economics of three types of batteries: lithium iron phosphate batteries, lead-carbon batteries and sodium-sulfur batteries, and analyzes the optimal scheduling of energy storage for the most economical lithium iron phosphate batteries.

Parameter Description
Taking a large 10 kV industrial user in Beijing as an example, the power load data uses 13 months of data from 1 December 2019 to 31 December 2020. Figure 4 shows the In the pre-month optimization model and daily optimization model of energy storage, it is necessary to predict the future load data. This paper uses PyCharm Professional Version 2020.3.1 and Anaconda3 development environment to build a long and short-term memory load prediction model using the TensorFlow framework based on the Keras deep learning tool. The prediction error of the model is between 4.78% and 6.09% and the prediction accuracy is between 93.91% and 95.22%; the prediction accuracy thus meets the requirements [44]. The actual data required for the system operation phase is obtained through real-time collection.

Case Analysis
This paper compares the configuration and economics of three types of batteries: lithium iron phosphate batteries, lead-carbon batteries and sodium-sulfur batteries, and analyzes the optimal scheduling of energy storage for the most economical lithium iron phosphate batteries.

Parameter Description
Taking a large 10 kV industrial user in Beijing as an example, the power load data uses 13 months of data from 1 December 2019 to 31 December 2020. Figure 4 shows the load power curve. Because the user only consumes more electricity on working days, the configured energy storage only runs during working days, and energy storage on non-working days does not participate in energy scheduling. In this paper, three types of batteries (lithium iron phosphate batteries, lead-carbon batteries, and sodium-sulfur batteries) are used as examples to configure energy storage systems. Table 1 shows the relevant technical parameters of energy storage batteries [21]. Table 2 shows the relevant parameters of the transformer.

Parameters Values
Ratio of installation cost to equipment cost, α 0.30 Transformer unit cost, c 3 (USD/(kV·A)) 78.45 Load factor, K 0.75 Power factor, cos ϕ 0.85 Table 3 shows the peak and valley time-of-use electricity prices for large industries in the suburbs of Beijing. The basic electricity rate is USD 7.53/(kW·month). It can be seen from Table 3 that there are two peak periods for electricity prices in Beijing each day. Considering that energy storage utilizes the peak-valley price difference arbitrage, it is more appropriate for the number of cycles of energy storage to be one to two times per day. This paper takes the number of daily cycles as one time. Among other parameters, ε Z takes 10 −4 , which is the regularization coefficient of smoothing power. ρ takes USD 12.55/kWh, which is the loss of 1 h of power outage per unit capacity of large industrial users; t t takes 1 h, which is the correspondingly reduced average annual power outage time. β takes 0.2~10, which is the value range of the energy magnification coefficient. µ takes 10~30%, which is the value range of peak clipping rate. The sampling time window is 15 min, and the number of sampling points in a day T = 96. Table 3. Peak-to-valley time-of-use electricity prices for large industries in the suburbs of Beijing. According to the requirements of power-related documents, users can only participate in a certain number of demand responses. Therefore, this paper takes the 3 days with the largest electricity consumption in a year from 1 December 2019 to 30 November 2020 to participate in the demand response, namely 13 December 2019, 4 March and 7 July 2020. The time period for users to perform the demand response is from 10:00 to 15:00. The electric load needs to be reduced by 10% on the basis of the original electric power. The upper limit compensation price for user participation in the demand response is calculated at USD 15.69/kW, and no fine will be imposed on it for the time being.

Energy Storage Optimization Configuration Results
The energy storage is configured based on the load data for a total of one year from 1 December 2019 to 30 November 2020. Based on the load characteristics of the example in this paper, energy storage only participates in energy scheduling during working days. There are a total of 252 working days in the selected configuration of energy storage. On average, it will work for 21 days of energy storage every month in 12 months. The energy storage configuration optimization model in Section 3 is used to optimize the configuration of three types of energy storage: lithium iron phosphate batteries, lead-carbon batteries, and sodium-sulfur batteries. Table 4 shows the optimized configuration of three types of energy storage: lithium iron phosphate batteries, lead-carbon batteries, and sodium-sulfur batteries. Different battery types have different technical parameters. Although energy storage is configured for the same large industrial user, the rated capacity and rated power of different types of energy storage configurations are different, and the equivalent operating years of the three types of batteries are also different.  Table 5 shows the costs and benefits of energy storage configuration. The ratio of the total investment cost to the average annual total benefit is expressed as the payback period. The ratio of the average annual total benefit to the average annual cost is expressed as a cost performance index. The ratio of the net benefit over the entire life cycle to the total investment cost is expressed as the rate of return on investment. It can be seen from Table 5 that the average annual net benefit, cost performance index and return on investment of lead-carbon batteries are significantly higher than those of lithium iron phosphate batteries and sodium-sulfur batteries, and the investment payback period is shorter than that of lithium iron phosphate batteries and sodium-sulfur batteries, and the cost is also lower. However, lead-carbon batteries have the shortest lifespan, and are suitable for users who are looking for rapid cost recovery and short-term rapid profitability. The average annual investment cost of sodium-sulfur batteries is the highest among the three, and the average annual total benefit is also the highest. Although the investment payback period of lithium iron phosphate battery is longer, its equivalent operating life is significantly longer than that of lead-carbon batteries and sodium-sulfur batteries. The advantages of lithium iron phosphate batteries are reflected in their high charge and discharge efficiency and long life. From a long-term perspective, the net and total benefits of lithium iron phosphate batteries during the entire life cycle are relatively ideal, belonging to the type with high yield and long life, and can be applied to systems with large capacity requirements.
Since the large industrial users selected in this example are pursuing long-term benefits, they choose to configure the lithium iron phosphate battery with the longest operating life and the largest net benefit in the whole life cycle. According to the configuration of the lithium iron phosphate battery in Table 4, the rated capacity is 2694 kWh as the benchmark, 500 is the step length, and a total of five capacity values are taken. When the rated capacity of energy storage is different, the change of the average annual net income of users with energy storage power is analyzed, as shown in Figure 5.

Monthly Demand Optimization Results
After determining the rated capacity and rated power of the energy storage configured by the user, the pre-month optimization model in Section 4.1 is used to optimize and determine the maximum demand to be reported in December 2020. Based on the load characteristics of the example in this paper, energy storage only participates in energy scheduling during working days, so the energy storage works for 23 days in the selected scheduling month. Table 6 shows the user's pre-month optimization results in December 2020. Through the "low storage and high discharge" and peak shaving effects of energy storage, users have a net benefit of USD 7892.07 in electricity savings in December compared to when energy storage is not configured, indicating that the configured energy storage can bring considerable benefits to users.

. Daily Scheduling Results
Based on the monthly maximum demand determined by the pre-month optimization model, the daily optimization model in Section 4.2 is further adopted for daily energy storage scheduling based on the load curve of any day in December 2020, and the typical day is 24 December 2020. Figure 6 shows the forecast load and actual load power curve. Figure 7 shows the comparison curve of energy storage power between day-ahead optimization and intra-day optimization. Figure 8 shows the results of day-ahead  Figure 5 shows the change curve of the average annual net income of users with energy storage capacity and power. It can be seen from Figure 5 that when the energy storage capacity is fixed, the average annual net income of users increases first and then decreases with the increase of energy storage power; when the energy storage power is fixed, the average annual net income of users decreases with the increase of energy storage capacity. With the increase of energy storage capacity, the energy storage power corresponding to the maximum value of the user's annual net income is also increasing. When the rated energy storage capacity is 2694 kWh, 3194 kWh, 3694 kWh, 4194 kWh and 4694 kWh, the maximum average annual net income of users corresponds to the energy storage rated power of 900 kW, 1200 kW, 1500 kW, 1800 kW and 2100 kW, the corresponding average annual net income of users at this time is USD 155,200, USD 148,159, USD 140,238, USD 131,121 and USD 121,255. From the above analysis, it can be seen that the user configures lithium iron phosphate batteries with an optimal rated capacity of 2694 kWh and an optimal rated power of 90 kW. At this time, the maximum average annual net income is USD 155,200, which is consistent with the optimization results in Tables 4 and 5.
In order to ensure that energy storage can play a certain role in demand response, users should not configure energy storage with too small capacity and power; in order to avoid excess resources and reduce costs as much as possible, users should not configure energy storage with excessive capacity and power. The energy storage rated capacity and rated power configured in this paper have the smallest value, the lowest cost, and the largest average annual net benefit on the basis of satisfying user demand response.

Monthly Demand Optimization Results
After determining the rated capacity and rated power of the energy storage configured by the user, the pre-month optimization model in Section 4.1 is used to optimize and determine the maximum demand to be reported in December 2020. Based on the load characteristics of the example in this paper, energy storage only participates in energy scheduling during working days, so the energy storage works for 23 days in the selected scheduling month. Table 6 shows the user's pre-month optimization results in December 2020. Through the "low storage and high discharge" and peak shaving effects of energy storage, users have a net benefit of USD 7892.07 in electricity savings in December compared to when energy storage is not configured, indicating that the configured energy storage can bring considerable benefits to users. Based on the monthly maximum demand determined by the pre-month optimization model, the daily optimization model in Section 4.2 is further adopted for daily energy storage scheduling based on the load curve of any day in December 2020, and the typical day is 24 December 2020. Figure 6 shows the forecast load and actual load power curve. Figure 7 shows the comparison curve of energy storage power between day-ahead optimization and intra-day optimization. Figure 8 shows the results of day-ahead scheduling optimization. Figure 9 shows the results of intra-day scheduling optimization. Figure 10 shows the comparison results of SOC for day-ahead optimization and intra-day optimization of energy storage. scheduling optimization. Figure 9 shows the results of intra-day scheduling optimization. Figure 10 shows the comparison results of SOC for day-ahead optimization and intra-day optimization of energy storage.   It can be seen from Figure 6 that the load forecast curve and the actual load curve have basically the same changing trend. However, the actual load curve has large power fluctuations, and there are many valleys and peaks, while the power change of the load forecast curve is relatively stable. This difference is caused by load forecast errors and is difficult to avoid.    It can be seen from Figure 6 that the load forecast curve and the actual load curve have basically the same changing trend. However, the actual load curve has large power fluctuations, and there are many valleys and peaks, while the power change of the load forecast curve is relatively stable. This difference is caused by load forecast errors and is  It can be seen from Figure 6 that the load forecast curve and the actual load curve have basically the same changing trend. However, the actual load curve has large power fluctuations, and there are many valleys and peaks, while the power change of the load forecast curve is relatively stable. This difference is caused by load forecast errors and is difficult to avoid. energy storage has different levels of output during the two peak electricity price periods. However, under the day-ahead optimization scheduling method, the energy storage has been completely discharged during the first peak electricity price period, resulting in no electricity to be discharged when the discharge is required at the subsequent peak time. This can also be seen in the SOC comparison results of the day-ahead operation and intraday operation of energy storage in Figure 10. It can be seen from Table 7 that during the day-ahead optimization operation, the saved electricity bill income for the day is USD 152.25; during the intra-day optimization operation, the saved electricity bill income for the day is USD 158.71. It can be found that, on the basis of meeting the maximum monthly demand, the intra-day optimized operation strategy is USD 6.45 more than the day-ahead optimized operation method in terms of peak-shaving and valley-filling revenue on this scheduling day, and the revenue has increased by 4.24%. It can be seen that the intra-day optimization operation strategy In order to illustrate the effectiveness of the intra-day rolling optimization scheduling strategy, Figure 7 compares the output curves of energy storage under the two optimization methods of day-ahead and intra-day. It can be seen that during the low electricity price period (0:00-7:00) of the two optimized operation methods, the energy storage is uniformly charged, and the "low storage and high discharge" arbitrage is used to improve the economic benefits of users. However, due to the existence of day-ahead load forecast errors, the energy storage curve in the discharge phase is quite different. Due to the continuous update of the rolling optimization model, there are multiple discharges in the energy storage during the optimization operation in the day, which is more in line with the volatility of the load power under actual conditions, and avoids the occurrence of no electricity to be discharged due to excessive discharge of energy storage, and improves the utilization rate of energy storage to a certain extent.
The rolling optimization of the daily operation of energy storage determines the charging and discharging power of the energy storage based on the load forecast data and the latest feedback actual load data, under the premise of meeting the system constraints, with the goal of maximizing the daily income. But only the energy storage plan value for the first time interval is executed. This is repeated over time until the energy storage completes the day's scheduling. The optimization result is shown in Figure 9; it can be seen that the energy storage output can quickly respond to actual load power fluctuations during daily operation, and the coordination ability of the entire user system is further strengthened, making it easier to reach a balanced state. The rolling optimization strategy running within the day can dynamically respond to load forecast errors, effectively cut peaks and fill valleys for user systems, and reduce peak load.
Due to the error of the day-ahead load forecast, when the system adopts the results of the day-ahead optimization model of the energy storage, there is a power imbalance in actual operation, which causes a great burden on the large power grid. The rolling optimization strategy of energy storage intra-day operation updates the system status to the latest after each system operation, and performs feedback correction on the system, which can smooth power fluctuations and improve the robustness and accuracy of system operation optimization scheduling.
Comparing Figures 8 and 9, it can be seen that the energy storage operation under the rolling optimization strategy of intra-day operation is more reasonable, and energy storage has different levels of output during the two peak electricity price periods. However, under the day-ahead optimization scheduling method, the energy storage has been completely discharged during the first peak electricity price period, resulting in no electricity to be discharged when the discharge is required at the subsequent peak time. This can also be seen in the SOC comparison results of the day-ahead operation and intra-day operation of energy storage in Figure 10.
It can be seen from Table 7 that during the day-ahead optimization operation, the saved electricity bill income for the day is USD 152.25; during the intra-day optimization operation, the saved electricity bill income for the day is USD 158.71. It can be found that, on the basis of meeting the maximum monthly demand, the intra-day optimized operation strategy is USD 6.45 more than the day-ahead optimized operation method in terms of peakshaving and valley-filling revenue on this scheduling day, and the revenue has increased by 4.24%. It can be seen that the intra-day optimization operation strategy proposed in this paper can generate more considerable benefits on the basis of not exceeding the maximum monthly demand. The reason is that the day-ahead optimization operation method is a full-time offline optimization based on the load day-ahead forecast data. Load forecasting has errors; the errors accumulate over time during scheduling. The model accuracy is not high. In the actual operation process, the large power grid can smooth the error, which will generate more power purchase costs. The intra-day optimization operation strategy is based on the partial scheduling results of the day-ahead optimization operation method, taking into account the error of the load forecast data, the actual load data is fed back to the model in real time, forming a closed loop and continuously rolling forward optimization. The impact of load forecast errors on system scheduling is reduced, and the economy and reliability of user-side energy storage scheduling are improved.

Conclusions
Taking user-side energy storage as the research object, the paper considers demand response to establish an energy storage configuration optimization model, and proposes a rolling optimization scheduling strategy based on MPC for online energy management. The conclusions are as follows: (1) The established model comprehensively considers the cost models, such as energy storage installation cost, operation and maintenance cost, capacity attenuation cost, regularization function for smoothing the power fluctuation of the grid connection point, and the revenue models, such as electricity tariff revenue, reduced transformer cost due to peak load reduction, recovery value, demand response benefit, reliability benefit due to reduced power outages and government subsidy benefit. The refinement of the model in the planning stage has greatly improved the accuracy of energy storage configuration, which is closer to the actual project. (2) After the user participates in the power demand response, the energy storage will be discharged in a large amount during the agreed time period, and the charging and discharging activities will be carried out according to the "low storage and high discharge" during the rest of the time period. The configured energy storage achieves peak shaving and valley filling and reduction of load peaks, creating economic benefits for users and ensuring the safe and reliable operation of the power grid. (3) The proposed optimal scheduling strategy, from full-time offline optimization to partial real-time optimization, not only ensures the economic benefits of users, but also improves the accuracy of energy storage optimization scheduling. It is robust in an uncertain load forecasting environment. (4) The characteristics of MPC rolling optimization and feedback correction make the model constantly updated, and there may be no optimal solution. In order to make the optimization go forward in a normal and orderly manner, the load forecast data are used at the moment before the scheduling time, and the actual load data are not replaced, which ensures the feasibility of the optimized scheduling model. In the transmission system, the grid power, load power and energy storage power are collected in real time through the power meter, and these data are returned to the control system. Through the proposed model, the scheduling plan is calculated in a few seconds and the scheduling command is able to be sent to the energy storage system for implementation. However, this may lead to some problems. For example, the actual load value may suddenly be too large or too small due to disturbances in the system or errors in the measured load data. This load value is fed back to the terminal control system, which calculates it as normal data. It will affect the performance of the energy storage scheduling model. This will be our next step of research.