Demand Response | Optimization Research on Dynamic Ice Storage System and Demand Response Strategy (Matlab Code Implementation)

Table of contents

1 Overview

 2 Control Algorithm Explanation

2.1 Stochastic open-loop optimal control (OLOC)

2.2 Model Predictive Control (MPC)

3 Mathematical model establishment 

3.1 Physical model

3.2 Economic Model

3.3 Stochastic Optimal Control Problem

4 Calculation examples and running results 

5 Matlab code implementation 


1 Overview

As an indispensable part of large buildings in modern cities, centralized air-conditioning systems consume more and more electricity. Some large and medium-sized cities

The power consumption of central air-conditioning has accounted for more than 20% of its peak hour power consumption[1-2], and together with industrial power loads, it has caused power peaks.

The peak load increases the peak-to-valley load difference of the power grid, resulting in a shortage of electricity during the day, but a large amount of electricity cannot be consumed at night. The ice storage system is used to store cold during the low valley period at night and release the cooling capacity during the daytime cooling period, which can reduce the energy consumption of the air conditioning refrigeration unit during the peak period of electricity consumption. On the one hand, it can effectively realize the "peak shifting" of electricity. On the other hand, due to the difference in peak and valley electricity prices, the ice storage system also saves the overall operating cost of the air conditioner and brings economic benefits.

In the context of rising global temperatures at this stage, I think this topic is worth studying. Global warming due to massive emissions of carbon dioxide.

(1) The idea of ​​all new power systems is unique, and it is particularly important to vigorously develop new energy sources such as wind and light, so I wrote a lot of article codes for microgrids. The search method is as follows.

(2) Demand response is mainly divided into price-based and incentive-based demand response. In the past, power system dispatching mainly relied on the power generation side. Drawing lessons from the beautiful country, the country has also begun to attach importance to demand response. Demand response programs encourage consumers to shed load when the grid peaks. I've also written a lot of code for articles on Demand Response. 

(3) The innovation of this paper: buildings with ice storage systems mainly use it to transfer cooling loads. Ice or chilled water is produced when electricity prices are low and stored to provide cold energy to users when electricity prices are high. In this paper , a combination of stochastic optimal control and model predictive control (MPC) is used to solve the problem.

 2  Control Algorithm Explanation

Two algorithms are used in this paper:  stochastic open-loop optimal control (SOOC) and model predictive control (MPC)  .

2.1  Stochastic Open-Loop Optimal Control (OLOC)

For the stochastic optimal control problem with random disturbance, this paper adopts the stochastic optimal open-loop control method (SOOC) in literature [8] to solve it. The following focuses on model predictive control (MPC).

2.2 Model Predictive Control (MPC)

2.2.1 Overview

MPC originated in the petrochemical industry and other industries, aiming to solve the problem that the classic proportional-integral-derivative (PID) control is difficult to deal with multivariable constraint optimal control. As a model-based control algorithm, the system model in its rolling optimization problem can be any model that describes the dynamic behavior of the system. Therefore, in principle, this method can deal with time-varying or non-time-varying, linear or nonlinear, and time-delayed or time-delayed. The optimal control problem of system constraints. It is based on this feature that MPC, as a kind of control algorithm with strong applicability, has been widely used in the field of power system optimal control.

With the maturity of MPC theory, many companies at home and abroad have specially developed commercial MPC software packages.

Model predictive control (model predictive control, MPC) is a type of feedback control strategy that has attracted the most attention in recent years. It is mainly composed of three links: model prediction, rolling optimization and feedback correction.

2.2.2 Mechanism of action

MPC began to sprout in the 1970s and 1980s. It has experienced the transition of three stages: model algorithm control, dynamic matrix control, and generalized predictive control. It has developed into a mature control theory[21]. At the next sampling time, repeat the above process, reconstruct the optimization problem with new measured values ​​and re-solve [22], the following conclusions can be drawn.

1) Different from conventional optimal control methods, the optimization objective of MPC is not globally invariant, but a rolling-forward finite time-domain optimization objective is adopted to approach the global optimal solution step by step with the local optimal solution. This limited time-domain optimization strategy can take into account uncertainties such as model mismatch and time variation, and is a compromise between optimal control and uncertainty.

2) MPC transforms the control problem into a rolling open-loop optimization problem in the finite time domain, which can consider the future behavior characteristics of the controlled object and is easy to deal with multi-coupling systems, so it can be easily expanded by combining various optimization algorithms.

                                                                  Figure 1 Principle of MPC

3 Mathematical model establishment 

This paper models costs in detail . The physical model was built on the one presented in [6] and extended to include a second ice maker, taking into account the ice maker's ramp constraints, time-varying coefficient of performance, and non-ideal storage and heat exchanger efficiencies. The resulting model is a fully observed MIMO stochastic system with linear time-varying dynamics.

In the following, the variable k indexes the set \ can={0, . . . , N− 1}, N = \ can / Δt is the number of discrete time steps of length Δt (hours) in the control horizon T (Δt=0.5 in the example in this paper). In this paper, we take T = 24 hours, although slightly modified, the horizon can be extended to a month or a cooling season.

3.1 Physical model

3.1.1 State variables of the system

 x_{1}(k): The charging state of the freezer (kWh_{th}), the upper bound is\overline{x_{1}}

(The capacity of the ice tank in the calculation example in this paper \overline{x}_{1}is 1760 (kWh_{th}))

(kWh_{th})The subscript "th" is included to emphasize that thermal energy is measured, not electrical energy (kWh). We use this convention throughout the article. The heat energy discharged by the chiller and the electrical energy required are related to the coefficient of performance of the chiller. For example, a typical ice-making chiller has a coefficient of performance of 562.5-3, so a thermal storage cost of 14-20$/kWhth roughly equates to a power storage cost of 35-60$/kWh.

x_{2}(k): is the building cooling deficit (kWhth), which is the sum of all unsatisfied cooling loads in the previous stage (lag cooling load). Note that x_{2}(k)this could be negative, for example if the building was pre-cooled overnight.


3.1.2 Control variables of the system 

 u_{1}(k): Electrical power allocated to ice making. (KW)

(The maximum power of the ice maker \overline{u}_{1}=94kW, the maximum slope of the ice maker in this article \Delta\overline{ u}_{1}=70.5kW

u_{2}(k): Cooling load satisfied by melting ice.(kWh_{th})

(The maximum amount of melting ice in each stage of this article u_{2}=510kW_{th}, the maximum climbing slope of melting ice \Delta\overline{ u}_{2}=510kW_{th})

u_{3}(k): Power consumed by the main chiller (KW), power consumed by the main chiller (main cooler) (kW)

(The maximum power of the main ice maker in this paper is \overline{u}_{3}=73kW, the maximum climb of the main ice maker \Delta \overline{u}_{3}=54.75kW)

 For each u_{i}(k), i ∈ {1,2,3}, define the maximum operating point \overline{u}_{i}\geq 0and maximum slope  \Delta \overline{u}_{i}.

To enforce the ramp constraint, we attach u(k-1) to the state, defined x(k) = [x1(k),x2(k),u(k -1)^{T}]^{T}.

This gives the state constraints x(k) ∈ X = [0, \overline{x_{1}}]×R4 and control constraints u(k) ∈ U(x(k)), where:

   

      


3.1.3 Disturbance variables of the system 

w1(k) is the building's demand for ice ( kWth )

w2 ( k ) is the building's remaining electrical needs (kW): lighting, plug loads, etc. (It can also be understood as the fixed load of the building)

We assume that the disturbance is normally distributed.

We also assume that, for all k ∈ T, the building operator has accurate knowledge at stage 0 of \overline{w}(k)and . \sum (k)Given these definitions, the state evolves according to the following equation:

    

Or more succinctly written as:

            

Among them, β∈[0,1] is the ice retention rate, η∈[0,1] is the heat exchange efficiency between the water tank and the building, \kappa _{ice} ( k )and \kappa_{ main} ( k )is the coefficient of performance of the refrigeration unit and the main refrigeration unit, respectively. The time dependence allows the chiller COP to vary with outside temperature.

We assume the controller has perfect knowledge at stage k x ( k ), although a Kalman filter can be added to estimate noisy or unmeasured states. 

(In this paper, the ice retention rate β is taken as: 0.98, the heat exchange efficiency between the water tank and the building)

3.2 Economic Model

3.2.1 Electric energy cost

Set as c_{e}(k) the electricity price ($/kWh), p(k) = u_{1}(k) + u_{3}(k) + w_{2}(k)which is the net power consumption, the energy cost is:

                

Energy prices for each day c_{e}(k)are published at 4pm the previous day, so they are known deterministically for a 24-hour simulation.


For i \in {1,2,3}, let be T_{i} \subseteq Tthe set of stages affected by the i-th demand cost, let be the {\overline{p}_{i}}(k)maximum power consumed before the i-th demand cost to stage k, ie on T_{i}∩ {0,...,k − 1}. The variable \overline{ p}_{i}(0)is initialized with the ith peak demand so far in the current month, or, if k = 0 is the beginning of the current month, the target demand limit based on historical data. Each \overline{p}_{i}obedience dynamic:

                    

a. This article takes the initial demand peak (all hours)\overline{p}_{1}(0)=200kW

b. Initial demand peak ((8:00 am to 10:00 pm)\overline{p}_{2}(0)=200kW

c. Initial Demand Peak ((8:00AM-6:00PM)\overline{p}_{3}(0)=200kW


3.2.2 Cost of price-based demand response

The ratio of customer electricity consumption volatility to price volatility over a period of time is called the electricity price expansion coefficient:

If the time-of-use electricity price strategy is implemented, the power consumption in different periods will shift due to the response of power users to the electricity price. In this paper, this paper uses the demand side response electricity price expansion coefficient matrix to describe the change of electricity demand.

The electricity price expansion coefficient matrix of the demand side response is composed of the elasticity coefficient of the ratio of the electric energy change to the price change. The user's power consumption is not only related to the current time period, but also related to other time periods. Therefore, the demand elasticity coefficient is divided into self-elasticity coefficient and cross-elasticity coefficient, which can be expressed as:

                                 k_{i i}=\frac{\Delta p_{i}}{p_{i}} \frac{m_{i}}{\Delta m_{i}}

                                  k_{i j}=\frac{\Delta p_{i}}{p_{i}} \frac{m_{j}}{\Delta m_{j}}

In the formula, k_{ii}, k_{ij}are ithe self-elasticity coefficient of the time period and the cross-elasticity coefficient of itime period to time period ; , are the load and electricity price of the original system, respectively; , are the change of the system load and electricity price, respectively.jpm\Delta p\Delta m

After adopting the demand side response, kthe load variation at each stage \Delta p(k)is as follows:

              \delta P(K)\eft[\ebagin{ccc} p_{F} & 0 \\ 0 & P_{P} & 0 \\ 0 0 & P_{G} \end{array}\oright]\bein{prerray}{Ccc} {FFG} {FFG} {FFG} {FFG} {FFG} {FFG} {FFG} {FFG} {FFG} {FF} , {FFG} K_{PP} & k_{Pg}\ k_{gf} & k__ & k_{gg} \end{array}\orray)\iright[\ Begin{c}{\lta m_{m_}{m_}{m}}{s}{s}{P}} m_{P}} m_{m}} m_{m}} m_{m}} m_{m}} m_{p}} m_{mumpo m_{mumpay m}} m_{mumpay m}& G}} \end{array}\right]

In the formula, the subscripts f, p, grepresent the different time periods to which the expansion coefficient belongs.

To sum up. The load demand matrix at each time after adopting the demand side response is\dot{p}(k)

                           \dot{p}(k)=p(k)+\Delta p(\mathrm{k})

So the price-based demand response cost is:

                      g_{d}(k)=\sum_{i=1}^{3} c_{d i}(k) \dot{p}(k) \Delta t

In the formula, c_{di} is the time-of-use electricity price, c_{d1}the valley electricity price is , c_{d2}the flat section electricity price is , and c_{d3}the peak electricity price is .


3.2.3 Punishment cost for insufficient cooling energy supply

In order to avoid insufficient cold energy supply to the load. A penalty term can be imposed so that the cooling load demand is met as much as possible in all phases, imposing a quadratic penalty on the deviation of the supplied cooling energy from the required cooling energy:

    

Here c_{u}(k) > 0, the price of unsatisfied cooling load ($/(kWh _{th})^{2}), is modeled as being proportional to the building occupancy at stage k and inversely proportional to its thermal mass.


3.2.4 Costs of Incentive Demand Response

The controllable load refers to some electrical equipment with certain flexibility in the electricity consumption period, such as washing machine, rice cooker with timer, etc., as well as the ice machine in this paper. In the scheduling period, the direct control method of incentive demand response is used to transfer the load, and compensation is given. The cost of incentive demand response is:

 

In the formula,  c_{dr}($/kWh) is the price obtained by participating incentive demand responders in the incentive demand response plan, and is the active power loss in the first stage \hat{p}(k)calculated by the demand response plan .k


The net phase cost is the sum of the electricity cost and the cooling undersupply penalty cost:

                       g_{k}(k)=g_{e}(k)+g_{u}(k)


Demand response cost is the sum of price-based demand response cost and incentive-based demand response cost: 

       g_{N}\left(\mathbf{x}(N),\{\mathbf{u}(k), \mathbf{w}(k)\}_{k \in T}\right)=g_{d}\left(\{\mathbf{u}(k), \mathbf{w}(k)\}_{k \in T}\right)+g_{\mathrm{dr}}\left(\{\mathrm{dr}}\left(\{\mathbf{u}(k) mathbf{u}(k), \mathbf{w}(k)\}_{k \in T_{\text{dd}}}\right) 


3.3  Stochastic Optimal Control Problem

Given the initial state x0, \in _{N-1}the total expected cost of a special policy π={μ0,...,} is: (where u(K)=μk(x(K)))

   

where the expectation exceeds w(k) for all k ∈ T. Therefore, the stochastic optimal control problem is:

   

 where constraints apply to all k\in \year.

4 Calculation examples and running results 

 

 

 

 

 

 

Part of the code: 

%% 状态和控制时间序列(图 3. MPC 策略下的状态和控制)

%====(1)绘制 x1, 冰罐的充电状态=====
ks = 0 : 1 : N;
figure(iFigure); clf
subplot(5,1,1)
bar(ks,x(1,:),'r')
title('冰库中的冷量', 'FontSize', titleSize)
ylabel('x_1(kWh_{cool})')
set(gca,'XLim',[0,N],'XTick',0:12:N,'XTickLabel',0:2:round(N/2))

%====(2)绘制x2, 为建筑冷却不足(kWhcool)即前阶段所有未满足的冷却负荷的总和(滞后冷却负荷、积压的冷负荷。)
subplot(5,1,2)
bar(ks,x(2,:),'g') %绘制阶梯图
title('冷量供应不足', 'FontSize', titleSize)
ylabel('x_2(kWh_{cool})')
set(gca,'XLim',[0,N],'XTick',0:12:N,'XTickLabel',0:2:round(N/2))

%=====(3)绘制u1, 制冰机消耗的功率。======
subplot(5,1,3)
bar(ks(1:end-1),u(1,:),'b')
title('制冰机消耗的有功功率', 'FontSize', titleSize)
ylabel('u_1(kW)')
set(gca,'XLim',[0,N],'XTick',0:12:N,'XTickLabel',0:2:round(N/2))

%====(4)绘制u2, 冰融化提供的冷却。=====
subplot(5,1,4)
bar(ks(1:end-1),u(2,:),'c')
title('融化冰所提供的冷量', 'FontSize', titleSize)
ylabel('u_2(kW_{cool})')
set(gca,'XLim',[0,N],'XTick',0:12:N,'XTickLabel',0:2:round(N/2))

%======绘制u3, 主制冰机消耗的功率。=====
subplot(5,1,5)
bar(ks(1:end-1),u(3,:),'m')
title('主制冰机消耗的有功功率', 'FontSize', titleSize)
ylabel('u_3(kW)')
set(gca,'XLim',[0,N],'XTick',0:12:N,'XTickLabel',0:2:round(N/2))
xlabel('时间(小时)')

%% 电力和成本时间序列;成本条形图(图 4. MPC 策略下的电力和成本)
%该模块绘制了耗电量及其基线,以及阶段成本和总成本条形图。

%==(1)绘制总电力、其基线,以及如果所有冷负荷直接由主冷水机组(称为pNaive)满足,所消耗的有功功率。===

% pNaive = w(1,:)./params.kMain + w(2,:);
% figure(iFigure+1); clf
% subplot(2,1,1)
% hold on
% plot(ks(1:end-1), u(1,:) + u(3,:) + w(2,:), 'c.-')  %MPC
% plot(ks(1:end-1), params.pBase, 'b')  %OLOC方法,不考虑DR
% %plot(ks(1:end-1), pNaive, 'r')   %pNaive = (w(1,:)./TSDRparams.kMain + w(2,:));如果所有冷负荷直接由主冷水机组(称为pNaive)满足
% set(gca,'XLim',[0,N],'XTick',0:12:N,'XTickLabel',0:6:round(N/2), ...
%     'YLim',[0,50*ceil(max(pNaive)/50)])
% title('有功功率消耗', 'FontSize', titleSize)
% ylabel('有功功率(kW)')
% legend(legLabel,'随机开环最优控制','理想情况', ...   %,, '随机开环最优控制', '冷负荷全部由制冰机供冷',
%     'Location', 'SouthEast', 'Orientation', 'Horizontal')
% box on


%======(2)阶段成本和总成本条形图。==========

%  figure(iFigure+2); clf
figure(iFigure+1);
%subplot(2,1,2)
barsToPlot = [costs.energyCosts', costs.DRcosts', costs.disutilityCosts'];
bar(0:N-1, barsToPlot, 'stack')
title('成本', 'FontSize', titleSize)
xlabel('时间(小时)')
ylabel('成本')
legend('电能成本', '激励型需求响应成本', '冷量供应不足惩罚成本', ...  
    'Location', 'SouthWest', 'Orientation', 'Horizontal')
set(gca, 'XLim', [0,N], 'XTick',0:12:N,'XTickLabel',0:6:round(N/2))

5 Matlab code implementation 

Guess you like

Origin blog.csdn.net/weixin_61181717/article/details/131761171