Optimal Energy Management for Microgrids with Combined Heat and Power ( CHP ) Generation , Energy Storages , and Renewable Energy Sources

This paper studies an energy management problem for a typical grid-connected microgrid system that consists of renewable energy sources, Combined Heat and Power (CHP) co-generation, and energy storages to satisfy electricity and heat demand simultaneously. We formulate this problem into a stochastic non-convex optimization programming to achieve the minimum microgrid’s operating cost, which is difficult to solve due to its non-convexity and coupling feature of constraints. Existing approaches such as dynamic programming (DP) assume that all the system dynamics are known, which results in a high computational complexity and thus are not feasible in practice. The focus of this paper is on the design of a real-time energy management strategy for the optimal operation of microgrids with low computational complexity. Specifically, derived from a modified Lyapunov optimization technique, an online algorithm with random inputs (e.g., the charging/discharging of energy storage devices, power from the CHP system, the electricity from external power grid, and the renewables generation, etc.), which requires no statistic system information, is proposed. We provide an implementation of the proposed energy management algorithm and prove its optimality theoretically. Based on real-world data traces, extensive empirical evaluations are presented to verify the performance of our algorithm.


Introduction
Microgrids stand a good chance of becoming a future power grid paradigm that uses centralized power grids as well as local generated energy [1].They can be operated with or without a grid connection.Microgrids usually consist of distributed renewable energy, decentralized energy storage devices (e.g., PHEVs), a local CHP System (e.g., gas-fired generators), and flexible loads.
With environmental concerns growing, a future power grid is expected to integrate more renewable energy (e.g., solar or wind) to reduce the discharge of greenhouse gas.For instance, the European Commission intends to include 20% renewables into the EU energy profile by 2020 [2], and California aims to get 33% of retail sales from renewables by 2020 [3].As we know, the generation of renewable energy is intermittent and non-dispatchable.If we simply integrate large amounts of renewable energy, the system will encounter some reliability problems.Besides, renewable energy supply is a stochastic process, which brings a new dimension of uncertainty to energy management.Therefore, how to integrate the generation of renewables efficiently and ensure the reliability of our system simultaneously is of great importance for microgrids.
Energy storage devices are utilized to smooth energy fluctuations and reduce the system cost in a more environmentally friendly way by intelligent charging/discharging, which plays an important role in microgrids [4][5][6][7].Apart from its power management capability, energy storage devices can act as a backup in microgrids when the external grid breaks down, which will reduce the negative effects with a quick response [8,9].The distributed storage plays a significant role in the design and evolution of a power grid, and particularly increases additional design choices for reducing the operating cost of microgrids [10][11][12].The hybird energy storage system is considered for primary frequency control using a dynamic droop method in an isolated microgrid power system [13].Online energy management algorithms are developed to investigate the operating cost reduction for microgrids with an energy storage system [14].
Apart from renewables generation and energy storage devices, CHP systems are becoming very popular in the microgrids industry [15,16].CHP systems can generate both electricity and thermal energy simultaneously, which can achieve a much higher energy efficiency than generating electricity and heat separately [17].The characteristics of local generations and local consumptions of micrigrid make it more flexible in the utilization of renewable energy and CHP generation, which extends the adaptability of a traditional centralized grid.The power management strategy between different elements should be considered in order to design feasible control algorithms for microgrid systems [18].Furthermore, with the augmentation of CHP generation technology, microgrids can often be much more economical than the traditional grid by using centralized grid supply and separate heat supply [19,20].The integration analysis of hybrid energy storage system and novel CHP systems in residential scenarios are also investigated [21].
In this paper, we consider the grid connected microgrid.We aim to propose an intelligent scheduling action (e.g., charging/discharging of energy storage device, power drawn from centralized grid, power obtained from local generator, etc.) to achieve the operating minimum cost of microgrids while considering all the random inputs of the system.We first formulate the problem of achieving the minimum operating cost in microgrids as a stochastic non-convex programming.Considering that the dependence between power level of the battery pack and heat level of the water tank leads to this problem's non-convexity, we study the relationship between them and convert it into stochastic convex optimization programming.Then we adopt the Lyapunov optimization [22] approach to design an online algorithm of some random system inputs (e.g., the charging/discharging of the energy storage devices, power from the local generator, the electricity from the power grid, and the renewable energy generation from different sources, etc.), which requires no statistic information of our system.
The contributions of this paper are summarized as follows: 1.
We formulate a stochastic non-convex programming for the online scheduling problem to minimize the microgrid's cost, which captures the randomness in stochastic renewables, power and heat demands, charge level of energy storage, co-generation and physical constraints as well.2.
To solve this stochastic non-convex optimization problem, we convert it into the subproblem with convex property.Then we design an online algorithm to reduce the operating cost of microgrids by using the Lyapunov optimization approach which relies on no future knowledge about the system inputs with stochastic distribution.In this way, we can get the optimal average cost.

3.
Through our evaluations by using practical data traces, we can see that by the proposed algorithm, we can achieve an approving empirical optimality ratio.

System Model and Problem Statement
The following components are typically included in our designed system: centralized power grid (supply power to the electricity load and charge the battery in an on-site way), large capacity battery (power energy storage), local co-generator (generate both heat and power energy simultaneously), external gas station (supply heat demand), thermal storage device (heat energy storage), and renewables generation (e.g., wind or solar).The system model is shown in Figure 1.For convenience of analysis, we assume that the system operates in discrete time with time slot t ∈ {0, 1, 2, • • • }.We then divide the time slots into frames of size T. Figure 2 gives the time structure of slots and frames.Let T m denote the set of time slots in time frame m, i.e., T m {mT, • • • , (m + 1)T − 1}.This structure of time slot and time frame is defined to illustrate the time scales of the system operation for easy theoretical analysis.Therefore, we have two time scales in the system.

System Model
(1) Local co-generation (CHP): We assume that electricity and heat energy can be generated simultaneously by our local generator.Here we use an idealized model, we will investigate a more practical CHP model in our future work.η ce and η ch are the conversion efficiencies from fuel to the electricity and thermal energy, respectively.At each time slot t, the co-generator generates electricity and thermal energy, whose amounts are denoted as η ce P c (t) and η ch P c (t), respectively.The generated electricity can be used for power supply to directly satisfy the net power demand (1 − r(t))η ce P c (t) or be charged into the battery r(t)η ce P c (t).Similarly, the generated thermal energy η ch P c (t) can be used for direct heat supply for users' heat demand (1 − u(t))η ch P c (t) or be charged into the thermal tank u(t)η ch P c (t), respectively.y(m t ) represents the on/off decision of the generator: y(m t ) = 1 represents switching on and y(m t ) = 0 denotes switching off in frame m t , which m t = [t/T] + 1 is defined as the number of slots in a frame.
(2) Centralized power grid: We assume that the power grid and microgrid are connected.The power can be acquired from the centralized power grid in an on-demand manner to meet electricity demands.The system obtains power in the amount of G l (t) for satisfying demands directly and the power in the amount of G s (t) for charging the battery, respectively.G l,max are defined as the upper bound of direct power supply from external power grid and G s,max denotes the upper bound of charging power for the battery from the external power grid, respectively.Then we have 0 Supposing that the power demand can be satisfied by power grid alone, we assume that L e,max ≤ G max holds at any time slot, where L e,max is the upper bound of L e (t).
(3) External gas station: The heat energy from the external gas station, η ah P a (t), can be used for direct heat supply and energy charging of the thermal tank.Using v(t) to denote the fraction for charging, we denote the amount for heat supply and heat charging as (1 − v(t))η ah P a (t) and v(t)η ah P a (t), respectively.Under the online control algorithm that we will propose later, the heat demand can be satisfied with the energy from the co-generation and gas station while the total cost can be minimized in an intelligent way which schedules the energy properly.
(4) Renewable energy: Let R(t) denote the renewable energy harvested at time t.In our model, the renewable energy is used as electricity supply for users first because it is free.If we have excess renewable energy when the power demand has been satisfied, we use this part of energy, which is called R c (t) to charge into the battery.In addition, the amount of renewable energy harvested in a time slot is bounded, and thus we have 0 ≤ R(t) ≤ R max , ∀t ∈ T. The excess renewable power that is charged to the battery cannot exceed the total amount of harvested renewable energy.Therefore, we have 0 ≤ R c (t) ≤ [−L e (t)] + , where [−L e (t)] + = max{R(t) − L e (t), 0}.Note that, although the system model we consider in this paper only involves the electricity renewable energy, heat renewable energy is applicable as well.
(5) Power and heat demands: In our microgrid system, the total demand includes the demand for power and heat.L e (t) represents power demand at time slot t, which must be satisfied once requested.The net power demand [L e (t)] + , which is the excess of power demand over renewable energy at time slot t, equals the subtraction of power demand and renewable energy, and can be expressed as [L e (t)] + = max{L e (t) − R(t), 0}.Let L e,max denote the maximum net power demand in a time slot, then we have 0 ≤ [L e (t)] + ≤ L e,max .The power can be acquired from power grid, local co-generator as well as the battery, denoted as G l (t), (1 − r(t))η ce P c (t) and D(t) respectively, to balance [L e (t)] + .It can be presented as follows: Similarly, the heat can be acquired from external natural gas station, co-generation as well as the thermal tank, denoted as (1 − v(t))η ah P a (t), (1 − u(t))η ch P c (t) and W(t) (more details about W(t) can be found in the thermal tank model) respectively, to balance the heat demand.Thus, at every time slot, we have: Let L w,max denote the maximum heat demand in a time slot.An additional constraint L w, max ≤ η ah P a, max has to be added to assure the balance of heat demand and supply at any time slot, where P a, max is the maximum heat output of the external gas station.Here η ah are defined as the conversion efficiencies from gas to the thermal energy.Let parameter r(t) denote the fraction of co-generated power that is used for charging.Then (1 − r(t)) denotes the fraction of co-generated power that is used for direct power supply.u(t) is defined as the dispatch ratio from CHP to thermal tank, v(t) denotes the dispatch ratio from thermal source to thermal tank.It should be noted that any stochastic information of the net power demands and heat demands is not required in our proposed algorithm.Here we use "≤" instead of "=" to insure mathematical rigorous.Actually, it could be "=" for both Equations ( 1) and (2) in our optimization problem.However, in the operation of the optimization problem, it should be consider the feasibility of the mathematical solution.In the algorithm design point of view, there is no difference for "=" and "≤" for Equation (2).We pointed out that if we change "≤" to "=" in Equation ( 2), the solution is the same.In fact, we can also change Equation (1) into "≤" and Equation (2) into "=" in the problem formulation.It has equivalent solutions for the two optimization problem.

Battery Model and Thermal Tank Model
(1) Battery model: The dynamics of battery's state of charge (SOC) level B(t) is given as follows: where η d stands for discharging efficiency of battery and η c denotes the charging efficiency of it.
We can find that the battery must satisfy constraints of capacity and charge/discharge in any slot t.
where B max is the capacity of the battery and D max is the maximum discharging power of the battery in each time slot and TC char is the maximum charging power of the battery in each frame.
(2) Thermal tank model: We utilize a thermal tank to store the excess heat for later use.With the charging and discharging of tank at each time slot, the heat state evolves over time: where T(t) is the thermal tank's heat energy state at time slot t.Because heat energy stored in the thermal tank can not exceed the capacity of thermal tank, we have: Similarly, T max is the upper bound of the thermal tank and W max represents the discharging rate constraint of the thermal tank.

Problem Statement
System State and Constraint: According to the components described in our system, we define the system state as a state vector Q t : We assume that Q t is an i.i.d.process over time.Although some of the elements in Q t can be arbitrarily correlated, the control decisions at each time slot only depends on current system state Q t without any future system information.
Through jointly scheduling the power and heat energy storage, centralized power grid, the renewables, and co-generation, our system can realize the goal of minimizing the long-term time-averaged operating cost.In particular, the control vector at time slot t isdefined by: The total cost of our system includes the cost of power acquired from external power grid, the fuel consumption of the co-generation, and natural gas for generating heat, switching and sunk cost: We denote the real-time electricity price of power grid as C(t), which is bounded by C min and C max .C min and C max is the minimum and maximum electricity price.So we have C min ≤ C(t) ≤ C max .It should be noticed that although C(t) can also be a stochastic process, the statistics will not be depended in our algorithm.In this paper, we set the fuel price C f and the price of natural gas C g to be constants at each time slot.Actually, our algorithm is also available in the case that the fuel price and natural gas price are not fixed since our algorithm is based on the current system state which can be known at each time slot.
So far we can formulate our first optimization problem as follows: P1: min lim subject to At the beginning of each frame, the local generator make a decision on choosing the on/off statement by solving a mixed-integer stochastic optimization program with constraints.We then jointly decide other components (G l (t), G s (t), P c (t), P a (t), R c (t), r(t), u(t), v(t)) in each time slot.
Solving P1 is challenging.In this paper, we aim to develop an online algorithm which requires no system statistics and is easy to implement.

The Co-Generation System Scheduling Algorithm
From the above, we know that P1 is a challenge to solve by the current algorithm due to the non-convex optimization.However, we have found a feasible method to work out a convex optimization problem already.Therefore, in this section, we will change P1 into a convex optimization problem.It is a real-time algorithm derived from the two-timescale Lyapunov optimization techniques [23].

Problem Relaxation
Stochastic optimization framework guarantees the balance of average energy consumption and average energy generation in the long term; however, it can not provide their hard bounds in any time slot.Thus, the problem above cannot be settled directly through stochastic optimization framework under those circumstances (17).To solve the problem, we try to take expectation on both sides of ( 15) and ( 16), which leads to P2 as follows: P2: min (13), ( 14), ( 18), ( 19), ( 20), ( 21), (22).
After those operations, we finally obtain P2, which fits the stochastic optimization framework.P2 extends the limitation of Battery and Thermal tank storage.It no longer restricts the value of B(t) and T(t) in each time slot instead of restricting them in the whole process.Under the condition that the solutions must satisfy constraint (17) at each time slot, the framework is feasible to P1.As long as we define these two constants suitably, solutions to P2 can also be feasible solutions to P1.

Online Algorithm
To simplify the following discussion, the virtual queues E(t) and X(t) are respectively defined for the battery and thermal tank as follows: where θ and ε are two perturbation parameters, which are time-independent constants and will be specified later.
Then the queueing dynamics ( 15) and ( 16) can be transformed into: In addition, the Lyapunov function is defined to be: Then the T-slot conditional Lyapunov drift can be defined as follows: Consider any τ ∈ [t, ..., t + T − 1], squaring both sides of ( 28) and ( 29).Considering the result in one time slot after carrying out sub calculations, we can obtain: In each time slot, the CHP consume the fuel while the thermal source consumes the gas.The maximum amount of them are P c,max and P a,max separately.Similarly, R c,max and G s,max denote the maximum charging power from the renewable energy resource and the external power grid, respectively.We define B as: and taking the expectation conditional on E(t) and X(t) yields: For the purpose of keeping E(t) and X(t) stable under the stochastic optimization framework, we should minimize the right-hand side of (32).Beyond that, the goal of our control algorithm is to minimize the system energy cost.Accordingly, we set parameter V to denote the tradeoff between energy storage and consumption and the drift-plus-penalty function is defined as follows: In order to facilitate the algorithm, we conduct some manipulation and get the formula: The main concept of our control algorithm is minimizing the right-hand side of (34).In other words, by observing the system inputs, i.e., C(t), E(t), X(t), L e (t) and L w (t) at each time slot in a frame, then the values of G l (t), G s (t), r(t), P c (t), P a (t), R c (t), D(t) can be determined.
Derived from the analysis above, an online algorithm can be developed by solving P3: Here Observing P3, we can find the problem function includes the term P c (t)H c (t) and P a (t)H a (t) with r(t) and u(t) in H c (t) and v(t) in H a (t).It follows that the Hessian matrix of the function is not positive semi-definite, which makes P3 a non-convex optimization problem and challenging to solve.However, with a further investigation of P3, D(t) and W(t) can be decoupled from H d (t) and H w (t).
At first, we take the terms D(t)H d (t) and W(t)H w (t) into account.If H d (t) < 0, it is clear that D(t) = 0; otherwise, it can be easily obtained that D(t) = min{D max , L e (t)}.Similarly, if H w (t) < 0, we have W(t) = 0; otherwise, W(t) = W max .Consequently, we can only concentrate on the key part of (36) which is listed as follows: s.t.(37), ( 38) and (40) We discuss the solutions to minimize P3 when the local generator is on or off, respectively.We discuss the question under the circumstance that y(m t ) = 1 first.
First, we assume that both (37) and (40) are inactive.Analyzing those equations we can easily see the linear relationship between H a (t) and v(t).Therefore, we can set v(t) to be 0 or 1 to minimize H a (t).Similarly, r(t) and u(t) can also be decided to be 0 or 1 in order to minimize H c (t).
Secondly, supposing (37) to be active while (40) to be inactive, we have: Replacing G s (t) using ( 49) in ( 48), now the problem change into: Then the minimum of the above equation can be achieved by setting u(t) to be 0 or 1. Thirdly, supposing (37) to be inactive while (40) to be active, we have: and we replace P a (t) using ( 51) in ( 48), then we have: From this, what we need to discuss is the value of G s (t).If (η c − 1)E(t) + VC(t) ≥ 0, to minimize (55), G s (t) should be set to 0; If (η c − 1)E(t) + VC(t) < 0, we have G s (t) = G s,max .
The above analysis display the minimization is four different circumstances.
Theorem 1 shows that the battery and thermal tank both have finite capacities under the proposed algorithm, which means solutions of P3 are feasible solutions to P1 as well.
Theorem 2. The gap between the optimal cost of P1 and the expected cost obtained by solving P3 is no more than TB V , i.e., lim where f (t) is the energy cost at time slot t under the proposed algorithm, and P * 1 is the optimal solution to the original problem P1.

Numerical Simulations
In this section, we use Matlab to evaluate the performance of the proposed algorithms by numerical simulations.We consider a hotel with battery and thermal tank as well as the CHP system.In our simulation, each time slot represents 15 min and each frame consists of 4 time slots (i.e., one hour).The parameter settings are partly listed in Table 1 and detailed in Section 5.1.

Simulation Setup
Centralized Power Grid: We obtain the electricity price data of power grid from [24].The data trace is shown in Figure 3.The maximal supply power G l,max and charging power G s,max obtained from power grid are both set to be 32 kWh/h.

External Gas Station:
We assume that the natural gas price c g varies across time and has a uniform distribution between (0.004, 0.010)$/kBtu.The maximal thermal output is set as P a,max = 32 kBtu/h.The efficiency is set as η ah = 0.8.CHP System: The maximal thermal output of CHP system is set as P c,max = 50 kBtu/h.The overall CHP efficiency is assumed to be 80%, and the electricity conversion efficiency is in the range of 30-40%.The fuel cost of CHP is set as c f = 0.0035 $/kBtu.We set the minimal on/off period of CHP to be 1 h, i.e., 4 time slots.The sunk cost for maintaining the system in its active state is set as c m = 0.1 $/h.

Time
Harvested Wind Power: The harvested wind power data is obtained from [25].The data path is shown in Figure 4.
Battery and Thermal Tank Model: We set the maximal charging and discharging rates of the battery as C char = 20 kWh/h and D max = 30 kWh/h, while the charging and discharging efficiency is set as η c = 0.9 and η d = 1.1, respectively.Similarly, the heat storing and releasing efficiency of the thermal tank is also set as η ff = 0.9 and η fi = 1.1.The maximal heat output is set as 30 kBtu/h.

Results of the Simulation
With the parameters above, we simulate for 200 time slots and each time slot stands for 15 min.We let V = 5.
Figure 6 shows the process where the CHP system adaptively makes on/off decisions in 200 time slots.We can see that the decisions are made every 4 time slots.The sample paths in Figure 7 depict electricity and heat supplies in the first 24 h (i.e., 96 time slots).Both the electricity and heat demands can be satisfied with hybrid sources.
As shown in Figure 10, the cost drops when charging and discharging get more efficient.Figure 11 shows that the capacity of battery and thermal tank is linear with V, which is also indicated in Theorem 1.The total cost curve shown in Figure 12, on the other hand, converges to the minimum with increasing V. Furthermore, by comparing with the situations where CHP is permanently on and off, the effectiveness of our adaptive on/off decision policy can be verified.

Conclusions
In this paper, we studied the operating cost minimization problem for microgrids with CHP generation, energy storages, and renewable energy resources by using the Lyapunov approach.We designed an algorithm LYP that can achieve near-optimal performance by adjusting the value of V.According to a large amount of empirical evaluations, the microgrid operating cost can be reduced significantly through such an integration of centralized grid, renewable energy, power storage device, and co-generation.

Figure 1 .
Figure 1.Illustration of the System Model.

Figure 2 .
Figure 2. Illustration of time slot and time frame.

Figure 3 .
Figure 3. Data trace of electricity market prices.
Demand: We use the real demand data provided by California Commercial End-Use Survey (CEUS) [26] in our simulation.The data traces in 50 h (i.e., 200 time slots) are shown in Figure 5.

Figure 6 .
Figure 6.A sample path of on/off decisions in 200 time slots under V = 5.
minVC g [Th char − u(t)η ch P c (t)]Since T char − η ch u(t)P c (t) ≥ 0, to minimize (53) we can set v(t) = u(t) = 1.Then we discuss the circumstance that y(m t ) = 0.Because P c (t) is related to y(m t ), so when y(m t ) = 0, P c (t) = 0.The problem is reduced to the equation as follows: min G s (t)H s (t) + P a (t)H a (t) + R c (t)E(t)

Table 1 .
Parameter settings in numerical simulations.