Optimal investment and operation of a microgrid to provide electricity and heat

Funding information The authors are submitting the extended version of their recommended paper from SPIES 2020 conference entitle “Optimal Power and Heat Scheduling of Microgrids under Renewable Generation Uncertainties”. Abstract This paper proposes a robust investment and operation model to attend the power and heat needs of a microgrid (MG) connected to the distribution system. The optimization algorithm decides on the best investment and operation of combined heat and power (CHP), boilers, PV power generation and battery energy storage systems (BESS). For the BESS, the algorithm estimates the optimal energy storage capacity (MWh) as well as the maximum hourly delivery capacity (MW). The non-linear and non-concave heat rate chart is recast by a mix-integer linear model to have a tractable and precise model. The model considers the uncertain in some parameters using probability density function (pdf) to portrait its behavior. Thus, the problem has been modeled using stochastic programming approach, and its objective function is the expected value of the annual operational cost. The model is tested using a real case where two adjacent consumers share the power and heat facilities to minimize the overall up to 17% depending on the gas price scenario. The results demonstrate the benefits of employing different technologies and the synergies of all technologies operating together.


Background
Increasing energy consumption and reducing fossil fuels resources have directed the attention to optimizing energy consumption and moving towards the use of renewable energy sources (RES) [1]. Besides the economic value of RES [2,3] and suggested regulations to encourage its investment [4], the presence of RES faces challenges such as reliability, security and sustainability [5]. The environmental

Literature review
The advantage of power generation in MGs over the conventional power generation units is reduced pollution emissions and increased economic benefits [1]. Due to the low reliability and uncertainty in RES, many studies have been conducted to ease the RES integration. In these studies, it has been shown that the controllability of battery energy storage system (BESS), can help to solve these problems, t [5,10,13,14]. The MG task is to supply the required heat and electricity to the customers in the grid. Combined-heat and power (CHP) systems are used to generate heat and electricity simultaneously. Using CHP has environmental and economic benefits for MGs. MG is used to maximize the revenue of distributed generation (DG) units using the MULTI-AGENT concept. The authors in [15] investigated the heat and power output of the CHP unit with a heat storage and electric boilers and proposed a model to reduce the curtailment of wind power and PV. They suggested CHP are an alternative for the battery energy storage system (BESS). The authors of [16] present a new method for the optimal scheduling in MGs based on the genetic algorithm (GA) and grey wolf optimization; however, the proposed model does not consider RES and BESS. Some papers [17,18].studied the optimal scheduling and combination of hydropower, combined heat and power, battery storage, and renewable energies based systems, which is not the case of this study. The model in [19] targeted maximizing the revenue by minimizing the cost of performance; however, it did not account for the uncertainty of the load and power production capacity. There are several optimization algorithms that had been proposed in the literature for the optimal scheduling of MG, despite the nonlinear nature of problems, that include mixedinteger programming, real-time rolling optimization, particle swarm optimization (PSO), and dynamic priority algorithm. A good review of these techniques can be found in [20]. The proposed optimizations in [21,22] are dealing with the problems as mixed-integer linear programming (MILP) problems. A comparison of the literature work and the proposed topic here is presented in Table 1.
The authors, in [21,28], have formulated and solved their optimization problems with MILP solvers (CPLEX) that can solve the problem quickly. In [29][30][31], the MILP method is widely used to optimize the power supply systems, for instance, considering photovoltaic (PV) solar energy and biomass as avail-able energy resources, and they have evaluated the cogeneration in hospital case studies.
The MGs include inflexible loads, RES and conventional generation and the main reasons for uncertainty in MGs are RES and loads, which increase the cost of MG operation [24,32,33]. In [34], the amount of power generation is assumed to match the predicted value, which indicates that the uncertainty has not been calculated. These factors lead to the use of BESSs to balance the load and power generation. Therefore, with proper sizing and placing of BESS and its operation, effective charging and discharging performance can lead to improved performance to solve MG problems [35].
In [36], BESS maintenance, charge and discharge costs are ignored, which imposes a high cost on the system and increases the operational costs. Only the cost of exchanging power with the upstream grid is considered. The authors, in [32], have considered the limitations of the grid and BESS by managing the BESS optimally using Lyapunov optimization.

Contributions
The main contributions of this paper are summarized as follows: • The non-linear and non-concave models of the heat charts of the boilers and the CHP are sort-out by a piece-wise mixinteger model, which brings a precise and tractable model. The mixed-integer-problems can be handled very efficiently with off-the-shelf solver engines. • The proposed algorithm models the reactive balance within the MG. The optimal reactive power from BESS, CHP, DG and wholesale market. • A realistic and robust "Customer-DER's model" considers the actual economic regime, calculating the savings, revenues, investment, and O&M cost and how those are related with the customer consumption profile. Furthermore, the behaviour of the customer is modelled using realistic tariff models considering both the capacity-charge and the energycharge. • The proposed model takes into account the reliability of MG based on the impacts of BESS and CHP units on decreasing "energy not supply (ENS)".
• The proposed methodology is a stochastic model that considers the uncertainty of natural gas (NG) using an appropriate probability distribution function (PDF).

Paper organization
This paper is organized as follow. The problem formulation is presented in Section 3, describing the objective function along with the technical constraints of all the technologies involved. Next, in Section 4, the case to be used is described and the main considerations are introduced. Section 5 shows, describes, and discusses the main results. Finally, the main conclusions of the work are summarized in section 6.

PROBLEM FORMULATION
This paper presents an algorithm to minimize the investment and operation cost of an MG. The MG is made of a set of facilities in the same compound. The heat needs of each facility are attended by the equipment in such a facility. The active and reactive power demand along with the heat requirements are attended by the following set of equipment.
• Combined heat and power (CHP): These technologies can provide simultaneously heat and electricity. The alternator can provide active and reactive energy attending the power factor defined by the manufacturer. • Battery energy storage system (BESS): These technologies can provide simultaneously steam and electricity. The alternator can provide active and reactive energy attending the power factor defined by the manufacturer. • Boilers: The boiler using natural gas as fuel can produce heat. In fact, the boiler with the CHP must attend the heat required. • Distributed energy resources (DERs): The DERs are small power generation units close to the loads, usually renewable energy technologies. Here, the DER power generation profile is for PV system, since it is the most feasible technology at the distribution systems.
The optimization problem considers the operation and maintenance cost (O&M) and the investment cost (CAPEX). The model minimizes the annual operation cost, where the CAPEX is annualized using 15 years lifetime. The customer demand is modelled using two daily load profiles, summer (225.5 days) and winter (110.5 days). The electricity balance is attended using CHP, the distribution network and the BESS.
Next the mathematical formulation of the objective function and the constraints imposed by technologies are presented.

Objective function and constraints
The objective function (MGTC) minimizes the total long-term cost, which is the annual long-term cost to attend the electricity and heat needs. The five terms refer to the investment, operation and maintenance and fuel costs, if any of each of the energy sources. The investment cost is annualized linearly using the asset's lifetime. The last term in Equation (1) is the cost or revenue form exchanging electricity with the distribution company. The main novelty in this formulation is the cost of the reliability as well as the risk criteria involved.
EEX Disco represents the cost of buying energy from the utility's network. Note that, the electricity rates are modelled based on time-of-use tariffs scheme. The balance constraints of the active/reactive electricity generation and demand as well as the heat balance constraint are shown in Equations (2), (3) and (4).
In the following, different terms of the objective function and the related technical constraints of each technology are mathematically formulated.

Boiler model
The investment cost is presented in Equation (5). [2] and [13] are good references about boilers models.
The boiler burns natural gas to produce heat according to the heat rate chart, which is neither linear nor concave. This characteristic requires a recast process to obtain a tractable and precise model of the thermodynamic process (see Figure 1).
The total heat hourly production ST Boiler h,w, f is calculated according to the given piece-wise linearized function. To guarantee the sequential arrangement of the blocks l and to attend the minimum power output, it is necessary to add constraints Equations (7), (8) and (9) as follows: The hourly changes in heat output of the boiler are limited by the ramp-up and ramp-down constraints as in Equations (10) and (11), respectively.
The fuel's and O&M's cost of the boiler are calculated using Equations (12) and (13) respectively. Note that the O&M cost is associated with the capacity installed.
O&M Boiler Since the model is flexible in the number of blocks in the piecewise linearization and the introduction of binary variables, we can model any non-convex function.

CHP model
The CHP unit cost encompasses the annualized investment cost, the O&M annual cost and the annual fuel consumption (Equation (14)). The hourly energy delivered (electricity and thermal) must be lower than the installed (Equation (15)). Also, constraints Equations (16) and (17) represent the fuel cost and the reactive power limit, respectively.
Note that, Equation (16) presents an input-output linear model, which is not realistic. As presented before in the boiler case, a piece-wise linearization recast process is required. Also, it is necessary to add the constraints associated with the rampup and ramp-down Equations (18) and (19). [36] provides additional information about the linearization and the definition of the ramp-up and ramp-down constraints.
Notice the model considers a detailed model in the reactive management.

Distributed generation
The investment and O&M costs are presented in Equation (20). The hourly production of DG is limited by the installed capacity and the available resources (Equation (21)). h portraits the typical production profile and is a parameter provided by the resource's assessment study. Also, constraint Equation (22) restricts the generated reactive energy.

Battery energy storage system model
The BESS absorbs energy from the network and injects it to the network when it is profitable. The cost of the BESS has two investment components, the inverter, which limits the power delivery capacity, and the battery size, which limits the energy storage capacity.
The continuity of the stored energy, usually referred as stateof-charge, is calculated through Equation (21). The charging and discharging process losses are calculated in Equation (22). Constraints Equations (23) and (24) formulate the energy capacity and charging/discharging power rate of BESS, respectively. Moreover, Equation (25) represents the state of the charge of the battery energy storage system.
The reactive power of BESS is limited by the power factor defined by the manufacturer (Equation (26)).

Reliability model
Both the BESS and the CHP can provide power when there is no supply from the upstream distribution network, thus the electricity load reliability can be improved. The next two constraints present the calculation of the cost of the ENS.
Note that, Equation (30) calculates the cost of ENS as of the function of probability of failure ( ) and the price of ENS ( ENS h,w ). The hourly expected ENS is calculated in Equation (31), which is the demand while the network is unavailable, and is attended locally using the energy stored in the BESS and the CHP capacity available (CAV CHP h ).
The available capacity of the CHP is equal to the installed capacity discounting the heat required Equation (32). An important effort was made to get a process model but keeping it as mix-integer linear model. In this way, the results are precise getting an optimal solution.

From deterministic to stochastic
The model presented so far, is a deterministic model. In this section the uncertainty is discussed, and the solution approach is presented. The current paper considers the price of natural gas ( gas ) as the main uncertain parameter. Thus, the NG price is represented by a discrete probability density function (pdf), where the price is modelled by a set of 2-tuplas (priceprobability). Under this consideration, all the operational variables take (the hourly energy production) changes with the realization of the NG's price and are named second stage variables. The investment decisions (the size of the equipment) are longterm variables and do not change with the price realization. They are named first stage variables. Since every realization of the pdf brings a different solution of the problem, it is necessary to define a criterion to optimize the objective function considering all the realization scenarios. Here the expected value (EV) is used as decision criterion. The EV minimizes the weighted average value of the objective function over all the scenarios. Reference [23] takes the decision considering either risk-neutral, -taker and -adverse strategies. Reference [37] considers uncertainty in the wind energy production, load and market price and solve the problem using GAMS.

CASE STUDY AND CONSIDERATIONS AND SIMULATION RESULTS
The case study has the following characteristics: • Two seasons are modelled, W = {summer, winter} . The winter season encompasses 110.5 days while the summer is 255.5 days. • There are two facilities f1 (hospital) and f2 (leisure centre).
Each facility attends its own heat demand using its own facilities, i.e. boilers and CHP. F1 counts with CHP 1 and boiler 1, and f2 counts with CHP2, CHP3 and boiler2. • The electricity sources are the CHP, BESS, PV systems and the electricity exchanged with the distribution  Table 2. The efficiency of all the technologies proposed here are taken from [38].
The daily maximum active power demand and the heat needs by facility and season are shown in Table 3, and all quantities are in kWh/hour. The demands are not coincident. The thermal need is attended locally but the power can be provided either from the MG or taken from the distribution company.
It is notable that most of the energy need is thermal; therefore, the decision will be driven mainly by the CHP and natural gas price.
In the stochastic model, the NG's price is represented by probability density function (pdf) like the one shown in Figure 2.
Simulations' results are divided in three sections: deterministic model analysis, reliability analysis and stochastic model analysis. The simulations were done using GAMS and CPLEX as

Deterministic model
The simulations are run in a sequential way to show the behaviour of the system in different circumstances and the impact of every technology in the development of the MG as well as the impact of different regulatory technologies. The total active power production-demand of the compound and heat at the hospital by each technology are shown in Figures 3 and 4, respectively.
It is worth to notice that sometimes there is a mismatch between the production and the demand, for instance the active power at hour 11. This is because the BESS is taking energy from the system, which here is represented by a negative value. The capacity installed by technology is shown in Table 4 in (kW).
To understand the benefits from the incorporation of these technologies, five scenarios are defined as it can be seen in Table 5. The column Q's price (£/MVArh) defines whether or not the CHP, BESS and the PV can provide reactive power and thus getting benefits from importing less or exporting to the distribution network.
The simulations result for each scenario are shown in Table 6. The columns from the total MG cost (MGTC) until the revenue from selling energy to the system (P export revenue) show the annual cost or revenue (£/year). The column improvement shows the cost reduction comparing the scenario against E0. E0, with an annual cost of 929,993 £/year as the base-case where the MG owner invests in the boiler to get the required steam but does not invest in any electricity component (CHP; PV or BESS). Since CHP represents the most expensive component of the MG, E1 invests in all the components except the CHP (CAP CHP f = 0), reaching a modest 6.4% cost reduction, but limiting the investment to 18,765 £/year. Notice there is no CHP fuel cost (CHP fuel cost), which is obvious. However, it interesting that it is not profitable to invest in BESS either.
In E2, E3 and E4, the algorithm decides what the best size is and the operation of the CHP, under different NG's price, along with all other technologies considered. The differences in the cost reduction is relevant, from 38.4% to 7.5% when the NG's price is 22 and 36 £/MWh, respectively. Notice in these scenarios that the powers imported from the distribution company increase proportionally to the natural gas price. E5 considers the energy production facilities that are not allowed to provide reactive power, which increases the MG payment to the distribution company and therefore increasing the operation cost. In the last scenario, the cost reduction is about 17% compared with the base case. It is clear here that the cost driver is the NG price and hence, it is convenient to get a price hedge instrument.

Stochastic model
So far, the simulations were done considering a deterministic model. Next the results of the simulations considering the uncertainty in NG's price are presented. The expected value of the operation cost is 732,103.82 £/year, and the size of the assets are shown in Table 7.
The obtained results for the second-stage variables are shown in Figure 5. The stochastic model is very useful not only to take more accurate decisions since the investment decisions are obtained based on all scenarios and its probabilities, but also to understand the risk associated with them. For instance, the operation cost, without CHP and BESS, which is basically taking electricity from the distribution network, is 971,883.46 £/year. Therefore, the investments are profitable with a confidence near to 99.5% when the price is lower than 38 £/MWh.

Reliability analysis
The model presented here is MG connected to the distribution system. In such case, the consumer can attend the load with the local resources when the distribution network is unavailable. In the following, a comparison of the cost of the ENS with and without the on-site technologies is presented. The reliability improvements from the BESS integration are modest, 5.3-4.4%, but the improvements because of combined operation of BESS and CHP are relevant, 21.9-17%. It is important to notice that the ENS's is part of the objective function. Thus, the size of the devices (CHP and BESS) is decided considering the improvement in the reliability.

CONCLUSION AND DISCUSSION
This paper had presented a robust investment and operation stochastic programming model for the provision of power and heat demands of MG in connection with the distribution grid. Not only the investment decision but also the operation of a variety of resources including CHP, boilers, PV power and BESS have been considered under study. The study accounted for the volatility of uncertain resources. The proposed approach presented a detailed model for each component of the MG. The boiler was represented by a high-resolution piecewise chat to handle non-concave and linear input-output chart. The BESS was modelled separating the battery investment from the inverter capacity, minimizing the total cost, and the limits of reactive power from every device and the global demand are related in a reactive balance equation. The study demonstrated that the overall cost has been reduced by about 17% according to the gas price scenario. The MGs improves the reliability, measured by the cost of the Energy-not-supplied, especially because of CHP.
The paper concluded that important benefits can be achieved from the implementation of MG energy management approach. Depending in the natural gas price, which was found as the main cost driver, the benefits can reach 36% compared with the base case (not investing in CHP, PV systems and BESS).
The model presented was focused on the consumer benefit; however, it is important to carry-out a model integrating the distribution company. The goal in this future work should be to assess the impact of the MG in the distribution networks, since the MG does not take energy but needs the capacity available.