scieee AI-readable full text Open interactive document viewer

A novel algorithm based on the combination of AC-OPF and GA for the optimal sizing and location of DERs into distribution networks

García Muñoz, Fernando Esteban,Díaz González, Francisco,Corchero García, Cristina

Abstract

This article proposes an algorithm to obtain an optimal local solution for the network planning process related to the optimal integration of different renewable energy sources (RES) and different BatteryEnergy Storage Systems (BESS) into a distribution network (DN). The algorithm provides strategicinformation related to investment and operation costs regarding the type of technology, location,and sizing. The mathematical formulation is based on an AC optimal power flow (OPF) to ensurethe network’s minimal stability conditions. Besides, through the use of linearization and a modifiedversion of a genetic algorithm (GA), the algorithm proposed breaks the 24 h wall, used until now inthe literature, and extend it to 8760 h, which represents a much more realistic scenario to define thestorage and power generation capacity of a DN in a planning context. The algorithm has been testedin a modified version of the IEEE 33-bus considering two cases of study: an off-grid case and grid-connected case, to measure the CapEx and OpEx variability, achieving to show that a grid-connectedsystem reduces the installed capacity of DG and BESS in 37.4% and the CapEx 22.8%

Full text

Highlights A novel algorithm based on the combination of AC-OPF and GA for the optimal sizing and location of DERs into distribution networks Fernando García-Muñoz,Francisco Díaz-González,Cristina Corchero-García •A novel algorithm is presented for the optimal simultaneous integration of DG and BESS into DN in terms of capacity and location. •A feasible solution for 8760 hours as a time horizon, which breaks the 24-hours wall of related literature •A much more realistic sizing for DG and BESS for distribution network planning is obtained. •The impact of an Off-grid and Grid-connected system on the planning process in terms of CapEx/OpEx. A novel algorithm based on the combination of AC-OPF and GA for the optimal sizing and location of DERs into distribution networks Fernando García-Muñoza,b,c,Francisco Díaz-Gonzálezaand Cristina Corchero-Garcíab aDepartament d′Enginyeria Elèctrica, Universitat Politècnica de Catalunya ETS d′Enginyeria Industrial de Barcelona, Avinguda Diagonal, 647, Pl. 2, 08028 Barcelona, Spain bIREC Catalonia Institute for Energy Research, C. Jardins de les Dones de Negre, 1, Pl. 2a, 08930 Sant Adrià del Besòs, Spain cIndustrial Engineering Department, University of Santiago de Chile, Avenida Ecuador 3769, Santiago 9170124, Chile ARTICLE INFO Keywords: Distributed generation Distribution networks Energy storage systems Power system planning Renewable energy sources ABSTRACT This article proposes an algorithm to obtain an optimal local solution for the network planning process related to the optimal integration of different renewable energy sources (RES) and different Battery Energy Storage Systems (BESS) into a distribution network (DN). The algorithm provides strategic information related to investment and operation costs regarding the type of technology, location, and sizing. The mathematical formulation is based on an AC optimal power flow (OPF) to ensure the network’s minimal stability conditions. Besides, through the use of linearization and a modified version of a genetic algorithm (GA), the algorithm proposed breaks the 24 hours wall, used until now in the literature, and extend it to 8760 hours, which represents a much more realistic scenario to define the storage and power generation capacity of a DN in a planning context. The algorithm has been tested in a modified version of the IEEE 33-bus considering two cases of study: an off-grid case and gridconnected case, to measure the CapEx and OpEx variability, achieving to show that a grid-connected system reduces the installed capacity of DG and BESS in 37.4% and the CapEx 22.8%. 1. Introduction A global transition to 100% renewable energy is feasible [1]. New energy efficiencies and technologies are allowing a decline in renewable energy costs, improving the competitiveness regarding the traditional power plants. Besides, the transition process from the traditional centralized system towards a clean and sustainable energy system is being promoted by different countries worldwide through new policies on renewables, opening new energy market opportunities [2]. Under this global context, work in [3] supports the idea that to achieve a successful transition and to be aligned with the Paris agreement, it is required optimal planning of different types of distributed generation (DG) and BESS into DN that involves the sizing and location simultaneously, and that takes into consideration realistic constraints and the stochastic behaviour of RES for a period greater than 24 hours. The AC-OPF model appears as a proper alternative to include realistic constraints in the planning process. However, its formulation is a mixed-integer non-linear and nonconvex problem, which means a high computational burden to solve, even for a concise time horizon [4,5]. Unfortunately, to address long-term planning, a long-time-interval must be taken into account to include RES’s stochastic behaviour. Therefore, two issues are considered in this article to achieve a model for the optimal planning to transform a centralized network into an active network; i) to create a mathematical formulation for the simultaneous integration of different DG and BESS in terms of location and sizing, and ii) to reduce the computational times of AC-OPF to include stochasticity of the RESs behaviour properly. [email protected] (F. García-Muñoz) ORCID(s): 0000-0001-9376-4357 (F. García-Muñoz) The first problem has been widely addressed in different publications [6,7,8,9,10,11,12]. Work in [6] presents a mixed-integer linear problem based on DC-OPF to obtain storage devices’ capacity and location. In [7], the impedance matrix is used to observe the voltage variation and define the optimal placement and sizing of a battery storage system. Work in [8] proposes a mixed-integer non-linear problem, which maximizes the battery lifespan to obtain its location and capacity. In [9], an optimal allocation model is proposed to minimize the investment and operational cost of integrating batteries in a DN, considering a stochastic model. Work in [10] proposes planning based on K-means clustering for the location and sizing of PV generation in a distribution network. [11] uses an ant-lion optimization algorithm to solve the optimal allocation and sizing of PV panels and wind energy based on a loss sensitive factor. [12] obtains the optimal placement and sizing of DG through Monte Carlo simulation to model the renewable resources’ behaviour and use a nondominated sorting genetic algorithm (NSGA-II) to solve an OPF applied for DC. The previous literature shows that few researches address the location and sizing of different types of BESS and DG simultaneously. For example, [13] proposes a formulation to obtain the optimal sizing of DG and BESS simultaneously, however, the location is not part of the model, and the time period is 24h. Work in [14] presents a methodology to obtain the optimal placement and capacity of DG and BESS, also for 24h, considering a Losses-Voltage-Factor (LVF) to ensure the right voltage limits, but not based on the power flow equations; hence, some critical variables like the reactive power, and offset angle are not considered. The same issue is tackled in [15] to apply it for a large-scale DN, the formulation is based on an OPF, and the time interval is the same First Author et al.: Preprint submitted to Elsevier Page 1 of 11 Short Title of the Article Nomenclature 𝑆𝑒𝑡𝑠 𝑖∈𝔹 Set of buses 𝑡∈𝕋 Set of time periods. (𝑖, 𝑗) ∈ 𝕃 Set of lines, such that 𝕃= {(𝑖, 𝑗); 𝑖, 𝑗 ∈𝔹} . 𝑘∈𝔾𝑡𝑦𝑝𝑒 Set of type of generation source. 𝑙∈𝔹𝑡𝑦𝑝𝑒 Set of type of batteries. 𝑃 𝑎𝑟𝑎𝑚𝑒𝑡𝑒𝑟𝑠 𝑃 𝐺𝑚𝑖𝑛 𝑖,𝑡 Minimum active power output of bus 𝑖 at period 𝑡 in [%]. 𝑃 𝐺𝑚𝑎𝑥 𝑖,𝑡 Maximum active power output of bus 𝑖 at period 𝑡 in [%]. 𝑄𝐺𝑚𝑖𝑛 𝑖,𝑡 Minimum reactive power output of bus 𝑖 at period 𝑡 in [%]. 𝑄𝐺𝑚𝑎𝑥 𝑖,𝑡 Maximum reactive power output of bus 𝑖 at period 𝑡 in [%]. 𝑃 𝐿𝑖,𝑡, 𝑄𝐿𝑖,𝑡 Active and reactive load of bus 𝑖 at period 𝑡 [MW],[MVAr]. 𝑉𝑚𝑖𝑛 𝑖, 𝑉 𝑚𝑎𝑥 𝑖 Minimum and maximum voltage allowed for bus 𝑖 [p.u.]. 𝐵𝑠𝑖,𝑗 Non-zero upper diagonal bus admittance matrix elements [p.u.]. 𝑆𝑚𝑎𝑥 𝑖,𝑗 Allowed maximum power of the line between buses 𝑖 and 𝑗 [MVA]. 𝐺𝑖𝑗 𝑖,𝑗 , 𝐵𝑖𝑗 𝑖,𝑗 Conductance and susceptance of the line between buses 𝑖 and 𝑗 such that 𝑖≠𝑗[𝑝.𝑢.] . 𝐺𝑖 𝑖, 𝐵𝑖 𝑖 Conductance and susceptance of the line between buses 𝑖 and 𝑗 such that 𝑖=𝑗[𝑝.𝑢.] . 𝑠𝑏 Base power [MVAr]. 𝑟𝑖,𝑗 Line resistance between buses 𝑖 and 𝑗 [p.u.]. 𝑆𝑂𝐶𝑚𝑖𝑛 𝑙 Minimum state of charge of battery type 𝑙 [%]. 𝑆𝑂𝐶𝑚𝑎𝑥 𝑙 Maximum state of charge of battery type 𝑙 [%]. 𝑈𝑔 𝑘 Maximum rated power of generator type 𝑘 [MW]. 𝑈𝑏 𝑙 Maximum rated power of battery type 𝑙 [MWh]. 𝜑𝑙 Eciency of battery type 𝑙 [%]. 𝑀𝑙 Maximum charge/discharge power for battery type 𝑙 in a period [MW]. 𝑂𝑀𝐺𝑘 𝑖 Operational and maintenance cost for generation type 𝑘 of bus 𝑖 [ e k/MW/yr]. 𝑂𝑀𝐵𝑙 𝑖 Degradation cost for battery type 𝑙 of bus 𝑖 [ e k/MWh]. 𝐼𝑏𝑡 𝑙 Installation cost of storage type 𝑙 [ e k]. 𝐼𝑔𝑛 𝑘 Installation cost of generator type 𝑘 [ e k]. 𝐶𝐵𝐶𝑎𝑝 𝑙 Capital cost of storage type 𝑙 [ e k/MWh]. 𝐶𝑃 𝐺𝐶𝑎𝑝 𝑘 Capital cost of generator type 𝑘 [ e k/MW]. 𝑉 𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝑝𝑔𝑘 𝑖,𝑡, 𝑞𝑔𝑘 𝑖,𝑡 Active and reactive power of generator type 𝑘 of bus 𝑖 at period 𝑡 [MW],[MVAr]. 𝑣𝑖,𝑡 Voltage of bus 𝑖 at period 𝑡 [p.u]. 𝜃𝑖,𝑡 Angle of bus 𝑖 at period 𝑡 [p.u]. 𝑝𝑖,𝑗,𝑡 Active power in line between buses 𝑖 and 𝑗 at period 𝑡 [MW]. 𝑞𝑖,𝑗,𝑡 Reactive power in line between buses 𝑖 and 𝑗 at period 𝑡 [MVAr]. 𝑐ℎ𝑙 𝑖,𝑡 Power absorbed for the storage type 𝑙 of bus 𝑖 at period 𝑡 [MW]. 𝑑𝑠𝑙 𝑖,𝑡 Power injected for the storage type 𝑙 of bus 𝑖 at period 𝑡 [MW]. 𝑠𝑜𝑐𝑙 𝑖,𝑡 State of charge of battery type 𝑙 of bus 𝑖 at period 𝑡 [MWh]. 𝛾𝑝 𝑘,𝑖 Active power capacity of generator 𝑘 in bus 𝑖 [MW]. 𝛾𝑞 𝑘,𝑖 Reactive power capacity of generator 𝑘 in bus 𝑖 [MVAr]. 𝛾𝑏 𝑙,𝑖 Storage power capacity of battery 𝑙 in bus 𝑖 [MWh]. 𝑤𝑙 𝑖,𝑡 Binary variable: 1 if the battery type 𝑙 is charging in bus 𝑖 at period 𝑡 , 0 otherwise. 𝑥𝑘 𝑖 Binary variable: 1 if the generator type 𝑘 is installed in bus 𝑖 , 0 otherwise. 𝑦𝑙 𝑖 Binary variable: 1 if the battery type 𝑙 is installed in bus 𝑖 , 0 otherwise. as the previous articles except that here the model uses the worst 24h. However, this hypothetical case does not guarantee a feasible solution for other time periods. A stochastic multi-objective framework to face optimal planning is presented by [16] with a long-term vision. The formulation generates multiple scenarios for the distributed energy resources (DERs) and a time step of one year (not by hours), making it possible to develop planning for ten years, using a particle swarm optimization to reduce the computational burden. Thereby, the related literature possesses a common factor; the formulation is applied for a short time interval due to its high complexity. Regarding the second problem, OPF difficulty comes from non-convexity and non-linearity; therefore, deleting one of these issues through a convex relaxation or a linearization, respectively, the time execution could decrease considerably. Recent studies have suggested several techniques and methodologies to provide formulations that guarantee convergence in large-scale DN. Works [17,18] present different convex relaxation methods to tackle this issue. An improving successive linear programming (SLP) is done by [5] to reduce the number of iterations. In [17], the approach combines quadratic programming (QP) with second-order cone programming (SOCP) to solve a multiperiod AC-OPF. [18] provides a comparison between the use of a quadratic convex (QC) relaxation with semi-definite programming (SDP) and First Author et al.: Preprint submitted to Elsevier Page 2 of 11 Short Title of the Article second-order cone relaxation. [19,20] present a summary of the different techniques applied to power system planning, including the interior point method, Newton method, quadratic programming, and a hybrid version of linear programming and integer programming. The present paper is the continuation of [21] where, through the use and modification of existing techniques, a novel algorithm is constructed to find the optimal capacity and location for different types of DG and different types of BESS considering 8760 h, which represents a time horizon much bigger than the 24 h used until now in the related literature. The information in terms of placement and sizing of DERs provided by the algorithm is relevant when DN planning is developed. This is a strategic decision because the capacity installed cannot be modified every year. In this way, both the CapEx and OpEx, given by the algorithm, correspond exclusively to the installed capacity and operational cost, which are significant input for a proper economic evaluation, and therefore for a planning process. However, the economic analysis (through NPV, IRR, and payback) is out of this paper’s scope because it would require a proper explanation about financing, amortization, taxes, revenue/savings, discount rate, load and pricing forecast, among others, and must be addressed in detail in a separate study. The main contributions of the present study are summarized in what follows: •We present a new general model that provides economic information, like CapEx and OpEx, about the optimal integration of DG and BESS into a DN in terms of sizing and location, considering physical and technical constraints. •We have extended the time horizon, from 24 h to 8760 h, for sizing and location problems based on AC-OPF, improving the existing models related to network planning. •We have established a methodological framework for distribution system operators (DSO) to measure the economic effort to integrate renewable resources into the DN. The rest of the paper is organized as follows. Section 2 describes the non-linear formulation for the optimal integration of DG and BESS into a DN, which by itself does not allow a time horizon of more than 12 hours due to its high computational burden. Section 3 presents a linearization to tackle the non-linearity of the original problem, establishing the MILP that is used in the algorithm. In section 4, the novel algorithm is explained, which uses a modified GA for handling binary variables. In section 5, the algorithm is tested in two different cases of study. And finally, the results are discussed in section 6. 2. Location and sizing optimization model for a DN 2.1. Islanded mode The mixed-integer nonlinear programming problem presented in [21] is explained as follows: 𝑀𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝐹 =𝐵𝐼+𝐵𝐶+𝐷𝐺𝐼+𝐷𝐺𝐶.(1) Where: 𝐵𝐼=∑ 𝑙∈𝔹𝑡𝑦𝑝𝑒 ∑ 𝑖∈𝔹 𝑦𝑙 𝑖𝐼𝑏𝑡 𝑙+𝛾𝑏 𝑙,𝑖𝐶𝐵𝐶𝑎𝑝 𝑙,(2) 𝐷𝐺𝐼=∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 ∑ 𝑖∈𝔹 𝑥𝑘 𝑖𝐼𝑔𝑛 𝑘+𝛾𝑝 𝑘,𝑖𝐶𝑃 𝐺𝐶𝑎𝑝 𝑘,(3) 𝐵𝐶=∑ 𝑙∈𝔹𝑡𝑦𝑝𝑒 ∑ 𝑖∈𝔹∑ 𝑡∈𝕋 𝑂𝑀𝐵𝑙 𝑖(𝑑𝑠𝑙 𝑖,𝑡Δ𝑡𝜑𝑙),(4) 𝐷𝐺𝐶=∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 ∑ 𝑖∈𝔹∑ 𝑡∈𝕋 𝑂𝑀𝐺𝑘 𝑖(𝑝𝑔𝑘 𝑖,𝑡).(5) The objective function (OF) goal in (1) is to minimize the investment and operation cost of DG and BESS into a low voltage distribution network such that the system operates in islanded mode, using storage devices to maximize the electricity generated through the RES. Thus, the OF does not optimize the use of DG or BESS in electricity market terms, i.e., it is not intended to maximize the benefits of the battery operator to demonstrate the viability of its business model, based on market variables, for example, the price of electricity or the provision of auxiliary services. The DERs investment has been addressed in Eqs. (2) and (3) for BESS and DG, respectively, separating the location and sizing variables into two different terms with their respective cost associated (to avoid the non-linearity of multiply these variables). The cost related to the location is an installation cost that does not depend on generation or storage capacity. Thus, for BESS, the location costs include the power electronics and plant balance system and are related to the maximum power absorbed or injected into the grid (𝑀𝑙). On the other hand, BESS’s and DG’s capacities variables have associated their respective capital cost in €/MWh, and €/MW. Therefore, the capital cost at a certain point is determined by the capacity installed 𝛾𝑏∕𝛾𝑝(obtained through the model) multiplied by their respective capital cost, plus the installation cost. The degradation cost for batteries is represented in Eq. (4), including only the energy injected from the battery [MWh] and not the energy absorbed to promote energy storage into the BESS and avoid much charging/discharging cycles since the battery discharge only when is strictly necessary and charge always when is possible, without cost. Eq. (5) considers an equal structure as Eq. (4) but for DG operations. The formulation of the constraints are as follows: Eq. (6) and (7) correspond to reactive and active nodal power flow equations, therefore; ∀𝑖∈𝔹,∀𝑡∈𝕋, −𝑣2 𝑖,𝑡𝐵𝑖 𝑖+𝑣𝑖,𝑡 ∑ (𝑖,𝑗)∈𝕃 𝑣𝑗,𝑡[𝐺𝑖𝑗 𝑖,𝑗 𝑠𝑖𝑛(Δ𝜃𝑖,𝑗,𝑡) − 𝐵𝑖𝑗 𝑖,𝑗 𝑐𝑜𝑠(Δ𝜃𝑖,𝑗,𝑡)] =∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 𝑞𝑔𝑘 𝑖,𝑡 −𝑄𝐿𝑖,𝑡,(6) First Author et al.: Preprint submitted to Elsevier Page 3 of 11 Short Title of the Article 𝑣2 𝑖,𝑡𝐺𝑖 𝑖+𝑣𝑖,𝑡 ∑ (𝑖,𝑗)∈𝕃 𝑣𝑗,𝑡[𝐺𝑖𝑗 𝑖,𝑗 𝑐𝑜𝑠(Δ𝜃𝑖,𝑗,𝑡) + 𝐵𝑖𝑗 𝑖,𝑗 𝑠𝑖𝑛(Δ𝜃𝑖,𝑗,𝑡)] =∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 𝑝𝑔𝑘 𝑖,𝑡 −𝑃 𝐿𝑖,𝑡 +∑ 𝑙∈𝔹𝑡𝑦𝑝𝑒 (𝑑𝑠𝑙 𝑖,𝑡 −𝑐ℎ𝑙 𝑖,𝑡).(7) Constraints (8) and (9) correspond to the active and reactive power flow equations, therefore; ∀(𝑖, 𝑗) ∈ 𝕃,∀𝑡∈𝕋, 𝑣𝑖,𝑡𝑣𝑗,𝑡[𝐺𝑖𝑗 𝑖,𝑗 𝑐𝑜𝑠(Δ𝜃𝑖,𝑗,𝑡) + 𝐵𝑖𝑗 𝑖,𝑗 𝑠𝑖𝑛(Δ𝜃𝑖,𝑗,𝑡)] − 𝐺𝑖𝑗 𝑖,𝑗 𝑣2 𝑖,𝑡 =𝑝𝑖,𝑗,𝑡, (8) 𝑣𝑖,𝑡𝑣𝑗,𝑡[𝐺𝑖𝑗 𝑖,𝑗 𝑠𝑖𝑛(Δ𝜃𝑖,𝑗,𝑡) − 𝐵𝑖𝑗 𝑖,𝑗 𝑐𝑜𝑠(Δ𝜃𝑖,𝑗,𝑡)] + 𝑣2 𝑖,𝑗 (𝐵𝑖𝑗 𝑖,𝑗 −𝐵𝑠𝑖,𝑗 ) =𝑞𝑖,𝑗,𝑡.(9) Active and reactive power limits are considered in constraints (10) - (12), therefore; ∀𝑖∈𝔹,∀𝑘∈𝔾𝑡𝑦𝑝𝑒, 𝛾𝑝 𝑘,𝑖𝑃 𝐺𝑚𝑖𝑛 𝑘,𝑡 ≤𝑝𝑔𝑘 𝑖,𝑡 ≤𝛾𝑝 𝑘,𝑖𝑃 𝐺𝑚𝑎𝑥 𝑘,𝑡 ,(10) 𝛾𝑞 𝑘,𝑖𝑄𝐺𝑚𝑖𝑛 𝑘,𝑡 ≤𝑞𝑔𝑘 𝑖,𝑡 ≤𝛾𝑞 𝑘,𝑖𝑄𝐺𝑚𝑎𝑥 𝑘,𝑡 ,(11) 𝛾𝑝 𝑘,𝑖 ≤𝑥𝑘 𝑖𝑈𝑔 𝑘.(12) Eq. (10) establishes that the active power injected must be bounded by the generation capacity installed multiplied by the maximum power that can be generated in a given period. This maximum power corresponds to the RES’s generation’s normalized curve under certain weather conditions (see section 5.3 for an example). Eq. (11) follows the same structure as Eq. (10). Eq. (12) indicates that the capacity installed is less or equal to a maximum capacity allowed multiplied by the binary variable associated with whether the RES is installed. These sets of equations allow introducing DGs’ stochastic behaviour into a modified version of AC-OPF model [21]. The voltage and apparent power limits are represented by the following constraints; ∀𝑖∈𝔹,∀𝑡∈𝕋,∀𝑙∈𝔹𝑡𝑦𝑝𝑒, 𝑉𝑚𝑖𝑛 𝑖≤𝑣𝑖,𝑡 ≤𝑉𝑚𝑎𝑥 𝑖,(13) √𝑝2 𝑖,𝑗,𝑡 +𝑞2 𝑖,𝑗,𝑡 ≤𝑆𝑚𝑎𝑥 𝑖,𝑗 .(14) To model the behaviour of the batteries, the following constraints are added. Therefore; ∀𝑖∈𝔹,∀𝑡∈𝕋,∀𝑙∈𝔹𝑡𝑦𝑝𝑒, 𝑠𝑜𝑐𝑙 𝑖,𝑡+1 =𝑠𝑜𝑐𝑙 𝑖,𝑡 + [𝜑𝑙𝑐ℎ𝑙 𝑖,𝑡 −1 𝜑𝑙𝑑𝑠𝑙 𝑖,𝑡]Δ𝑡, (15) (𝛾𝑏 𝑙,𝑖)𝑆𝑂𝐶𝑚𝑖𝑛 𝑙≤𝑠𝑜𝑐𝑙 𝑖,𝑡 ≤𝑆𝑂𝐶𝑚𝑎𝑥 𝑙(𝛾𝑏 𝑙,𝑖),(16) 𝛾𝑏 𝑙,𝑖 ≤𝑦𝑙 𝑖𝑈𝑏 𝑙,(17) 𝑐ℎ𝑙 𝑖,𝑡 ≤𝑤𝑙 𝑖,𝑡𝑀𝑙,(18) 𝑑𝑠𝑙 𝑖,𝑡 ≤𝑀𝑙(1 − 𝑤𝑙 𝑖,𝑡) − 𝑀𝑙(1 − 𝑦𝑙 𝑖),(19) 𝑤𝑙 𝑖,𝑡 ≤𝑦𝑙 𝑖.(20) Constraint (15) represents the 𝑠𝑜𝑐𝑙 𝑖,𝑡+1 for the next period of the battery, which is in MWh and not in percentage, as usual, to keep the linearity in Eqs. (16) and (17). Eq. (16) represents the upper and lower bound for the 𝑠𝑜𝑐𝑙 𝑖,𝑡 in MWh, where the limits depend on the one hand, of the installed capacity, and on the other hand, of the maximum/minimum operational limits allowed in the battery (𝑆𝑂𝐶𝑚𝑎𝑥 𝑙/𝑆𝑂𝐶𝑚𝑖𝑛 𝑙) in percentage. Thus, for a capacity of 10 MWh and 90%/10% as operational limits, the 𝑠𝑜𝑐𝑙 𝑖,𝑡+1 will not be less than 1 MWh or greater than 9 MWh. Eq. (17) restricts the installed capacity to a maximum capacity allowed, multiplied by the binary variable whether the battery is installed. Constraints (18)-(20) define the charging/discharging process through a binary variable 𝑤𝑙 𝑖,𝑡 which is bounded by the battery whether it is installed, and where 𝑀𝑙represents the maximum energy injected/absorbed for a battery in a certain period. In the case that the battery is not installed (Eq. 20), constraints (15)-(19) are zero; otherwise, if the battery is charging, the discharging process is modeled through Eq. (19). 2.2. Grid-connected mode If the model proposed is used for a grid-connected mode, the main grid’s reactive (𝑔𝑞) and active (𝑔𝑝) power must be included as variables in the right-side of Eq. (6) and (7), respectively, as follows: −𝑣2 𝑖,𝑡𝐵𝑖 𝑖+𝑣𝑖,𝑡 ∑ (𝑖,𝑗)∈𝕃 𝑣𝑗,𝑡[𝐺𝑖𝑗 𝑖,𝑗 𝑠𝑖𝑛(Δ𝜃𝑖,𝑗,𝑡) − 𝐵𝑖𝑗 𝑖,𝑗 𝑐𝑜𝑠(Δ𝜃𝑖,𝑗,𝑡)] =∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 𝑞𝑔𝑘 𝑖,𝑡 −𝑄𝐿𝑖,𝑡 +𝑔𝑞𝑖,𝑡,(21) 𝑣2 𝑖,𝑡𝐺𝑖 𝑖+𝑣𝑖,𝑡 ∑ (𝑖,𝑗)∈𝕃 𝑣𝑗,𝑡[𝐺𝑖𝑗 𝑖,𝑗 𝑐𝑜𝑠(Δ𝜃𝑖,𝑗,𝑡) + 𝐵𝑖𝑗 𝑖,𝑗 𝑠𝑖𝑛(Δ𝜃𝑖,𝑗,𝑡)] =∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 𝑝𝑔𝑘 𝑖,𝑡 −𝑃 𝐿𝑖,𝑡 +∑ 𝑙∈𝔹𝑡𝑦𝑝𝑒 (𝑑𝑠𝑙 𝑖,𝑡 −𝑐ℎ𝑙 𝑖,𝑡) + 𝑔𝑝𝑖,𝑡.(22) Furthermore, the power provided by the grid is included in Eq. (1) as follows: 𝐹=𝐵𝐼+𝐵𝐶+𝐷𝐺𝐼+𝐷𝐺𝐶+∑ 𝑖∈𝔹∑ 𝑡∈𝕋 (Λ𝑃 𝑟𝑡)(𝑔𝑞𝑖,𝑡 +𝑔𝑝𝑖,𝑡). (23) 𝑃 𝑟 represents the energy price and Λ, a penalization parameter to handle the trade-off between RES assets and the energy bought to the grid. Thus, the bigger is Λ, the bigger is the willingness to install DERs, and the less is the grid dependence. 3. Linear optimization model The linearization method presented in [4] is used in this article because it does not require new information about the network, considers the reactive power and voltage as variables, and guarantees the convergence of the OPF, which is applied over the non-linear constraints present in the power flow equations and the apparent power limit. Therefore, the left sides of Eq. (6) and (7) are modified and expressed, respectively ∀𝑖∈𝔹,∀𝑡∈𝕋, as follows: −𝑣𝑠𝑖,𝑡[𝐵𝑖 𝑖+∑ (𝑖,𝑗)∈𝕃 (𝐵𝑖𝑗 𝑖,𝑗 −𝐵𝑠𝑖,𝑗 )] + ∑ (𝑖,𝑗)∈𝕃 𝑞𝑖,𝑗,𝑡 =∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 𝑞𝑔𝑘 𝑖,𝑡 −𝑄𝐿𝑖,𝑡,(24) 𝑣𝑠𝑖,𝑡[𝐺𝑖 𝑖+∑ (𝑖,𝑗)∈𝕃 𝐺𝑖𝑗 𝑖,𝑗 ] + ∑ (𝑖,𝑗)∈𝕃 𝑝𝑖,𝑗,𝑡 =∑ 𝑘∈𝔾𝑡𝑦𝑝𝑒 𝑝𝑔𝑘 𝑖,𝑡 −𝑃 𝐿𝑖,𝑡 First Author et al.: Preprint submitted to Elsevier Page 4 of 11 Short Title of the Article +∑ 𝑙∈𝔹𝑡𝑦𝑝𝑒 (𝑑𝑠𝑙 𝑖,𝑡 −𝑐ℎ𝑙 𝑖,𝑡).(25) Constraints (24) and (25) represent the linear version of the balance in nodes. Specifically, the left side have been rewritten in terms of 𝑞𝑖,𝑗,𝑡 and 𝑝𝑖,𝑗,𝑡, and the voltage has been replaced by 𝑣𝑠𝑖,𝑡, which is 𝑣2 𝑖,𝑡 =𝑣𝑠𝑖,𝑡∀(𝑖, 𝑗) ∈ 𝕃,∀𝑡∈𝕋. Therefore, Eq. (13), which limits the voltage, is expressed now as: (𝑉𝑚𝑖𝑛 𝑖)2≤𝑣𝑠𝑖,𝑡 ≤(𝑉𝑚𝑎𝑥 𝑖)2.(26) Linearization of the power flow Eqs. (8) and (9) can be achieved using a Taylor series expansion for sine and cosine, considering 𝜃𝑖,𝑗,𝑡 is a small number and the voltage is closer to 1.0 p.u. leading to the following set of Eqs. ∀(𝑖, 𝑗) ∈ 𝕃,∀𝑡∈𝕋, 𝐺𝑖𝑗 𝑖,𝑗 [𝑣𝑠𝑖,𝑡 −𝑣𝑠𝑗,𝑡 2]−𝐵𝑖𝑗 𝑖,𝑗 (Δ𝜃𝑖,𝑗,𝑡) + 𝐿𝑃𝑖,𝑗 =𝑝𝑖,𝑗,𝑡,(27) −𝐵𝑖𝑗 𝑖,𝑗 [𝑣𝑠𝑖,𝑡 −𝑣𝑠𝑗,𝑡 2]−𝐺𝑖𝑗 𝑖,𝑗 (Δ𝜃𝑖,𝑗,𝑡) + 𝐿𝑄𝑖,𝑗 =𝑞𝑖,𝑗,𝑡.(28) Eqs. (27) and (28) corresponds to the new active and reactive power flow equations and they are in terms of a loss factor, which are approximated through the follow expressions: 𝐿𝑃𝑖,𝑗 =𝐺𝑖𝑗 𝑖,𝑗 [Δ 𝜃𝑖,𝑗,𝑡]𝑚𝑖,𝑗 +𝐺𝑖𝑗 𝑖,𝑗 [ 𝑉𝑖,𝑡 − 𝑉𝑗,𝑡  𝑉𝑖,𝑡 + 𝑉𝑗,𝑡 ] − 𝐺𝑖𝑗 𝑖,𝑗 2[(Δ 𝜃𝑖,𝑗,𝑡)2+ (Δ  𝑉𝑖,𝑗,𝑡)2],(29) 𝐿𝑄𝑖,𝑗 = −𝐵𝑖𝑗 𝑖,𝑗 [Δ 𝜃𝑖,𝑗,𝑡]𝑚𝑖,𝑗 −𝐵𝑖𝑗 𝑖,𝑗 [ 𝑉𝑖,𝑡 − 𝑉𝑗,𝑡  𝑉𝑖,𝑡 + 𝑉𝑗,𝑡 ] + 𝐵𝑖𝑗 𝑖,𝑗 2[(Δ 𝜃𝑖,𝑗,𝑡)2+ (Δ  𝑉𝑖,𝑗,𝑡)2],(30) Both constraints (29) and (30) are composed of a loss factor related to the angle, voltage, and offset. Furthermore, 𝑚𝑖,𝑗 represents an incident vector of branch (𝑖, 𝑗). i.e. the 𝑖𝑡ℎ node is 1, the 𝑗𝑡ℎ − 1 and the other values are zero.  𝜃𝑖,𝑗,𝑡 and  𝑉𝑖,𝑗,𝑡 are parameters associated with an angle and voltage obtained in a base case using the original model. The apparent power limits expressed in (14) is the last constraint that needs to be linearized. Thus, using the method presented in [4], Eq. (14) is approximated by the following set of constraints ∀(𝑖, 𝑗) ∈ 𝕃,∀𝑡∈𝕋,∀𝑟∈ℝ: 𝐴𝑟 𝑖,𝑗 𝑝𝑖,𝑗,𝑡 +𝐵𝑟 𝑖,𝑗 𝑞𝑖,𝑗,𝑡 +𝐶𝑟 𝑖,𝑗 ≥0,(31) −𝐴𝑟 𝑖,𝑗 𝑝𝑖,𝑗,𝑡 +𝐵𝑟 𝑖,𝑗 𝑞𝑖,𝑗,𝑡 +𝐶𝑟 𝑖,𝑗 ≥0,(32) where: 𝐴𝑟 𝑖,𝑗 = −𝑆𝑚𝑎𝑥 𝑖,𝑗 𝑐𝑜𝑠(𝛽𝑟 𝑖,𝑗 ) ; 𝐵𝑟 𝑖,𝑗 = −𝑆𝑚𝑎𝑥 𝑖,𝑗 𝑠𝑖𝑛(𝛽𝑟 𝑖,𝑗 ),(33) 𝐶𝑟 𝑖,𝑗 = (𝑆𝑚𝑎𝑥 𝑖,𝑗 )2;𝛽𝑟 𝑖,𝑗 =𝛼+ (𝑟− 1)𝜋− 2𝛼 ℝ− 1 .(34) Eq. (31) and (32) emerge as a set of constraints which represent a polygon formed by 𝑟∈ℝlines that define a feasible region approximation of the original constraint (14), which is a circle. Thus, the bigger the set ℝ, the closer will be the polygon to the circle. Finally, the mixed-integer linear problem (MILP) to tackle the optimal integration of DGs and BESS using a multiperiod AC-OPF can be expressed by the following equations: 𝑀𝑖𝑛𝑦𝑙 𝑖,𝑥𝑘 𝑖,𝛾𝑏 𝑙,𝑖,𝛾𝑝 𝑘,𝑖,𝑑𝑠𝑙 𝑖,𝑡,𝑝𝑔𝑘 𝑖,𝑡 (𝐹). Subject to: •Power flow equations: (24) (25) (27) (28) (29) (30). •Limits: (26) (33) (34) (10) (11) (12). •Battery: (15) (16) (17) (18) (19) (20). 4. Algorithm for sizing & location of DGs and BESS The algorithm proposed in this section uses the logic behind the GA as a backbone, intending to reduce the complexity generated by the binary variables since the formulation presented in the previous sections by itself cannot be applied in a time horizon beyond 24 h. 4.1. Proposal The GA algorithm was presented by [22] in 1975, and, until today, it has been used to solve OPF problems [23,24]. However, the GA has not been applied in its original form because to do this; would require defining the mathematical formulation in a Fitness Function (FF), which would not allow us to include the decision variables related to the battery behaviour, capacity/location, and satisfy the network technical constraints for multiple periods, at the same time. In this context, it is proposed to use the GA logic and replace the FF with the formulation presented at the end of section 3 (the MILP problem). By doing this, the computational time is sacrificed, but all the variables and constraints of the original formulation are considered. Therefore, for each iteration, the algorithm proposed resolves the MILP model to obtain the DERs capacities, with the difference that the binary variables are replaced by parameters generated randomly, and therefore, the MILP problem becomes an LP. The solution to each optimization problem will be called FF to follow the same language of the GA. 4.2. Operation The algorithm operation is explained in detail using as support the flowchart in Fig. 1 4.2.1. Chromosome structure There are two sets of binary variables in our work; the first one is associated with DG and BESS location, and the second one with the charge and discharge of batteries for every hour. Both are generated randomly every iteration. Fig. 2, illustrates an example of a chromosome for each case. The first one, associated with the location, is composed of DG genes in blue and BESS in red; the label is one First Author et al.: Preprint submitted to Elsevier Page 5 of 11 Short Title of the Article Figure 1: Algorithm for sizing & location of DGs and BESS when the element is installed and zero otherwise, thus, their dimensions depend on the number of buses and the type of DG and BESS. On the other hand, the second chromosome’s dimension depends on the number of buses, the type of battery, and the period. In this case, the red labels indicate that the value has been set to zero because there is no battery type 𝑙installed in bus 𝑖. These binary variable models the behaviour if the battery type 𝑙at period 𝑡is charging or discharging. However, if the battery is not installed in the bus 𝑖, all the values associated with that bus are zero. For example, following Fig. 2, the bus 1 has installed a battery type 2 (𝑦2 1= 1) and not type 1 (𝑦1 1= 0), thus, the binary variable for charge/discharge for the battery type 1, 𝑤1 1,𝑡 will be always zero, and the battery type 2 𝑤2 1,𝑡 could be one or zero. 4.2.2. Set initial parameters The main input parameters are described as following: •Load: corresponds to two vectors; i) one for the normalized load curve, ii) a second one with the maxi- Figure 2: Example of a chromosome structure mum load allowed of every bus. •Price: refers to the price curve, which is exclusively parameters for the grid-connected case. •WT/PV power generation: represents the RES’s behaviour through normalized curves between [0,1]. •Network data: related to the technical information to run the classic OPF model. •Size population: refers to the number of possible solutions for every iteration. 4.2.3. Create an initial population The initial population is created through the random generation of the binary variables, where every one of these variables sets, called chromosomes, represents a candidate for the optimal solution. The LP (ex MILP) is then executed for every chromosome to obtain the optimal sizing and its respective FF value. If the LP solution is infeasible, the FF for that set of locations is penalized. The infeasibilities can emerge when the LP is solved for locations that do not satisfy the network constraints to meet the electricity load. If this occurs, the function by parts explained in section 4.3 is applied not to maintain the infeasibility across the while loop. 4.2.4. GA and LP model The while loop starts applying the classic GA steps for every chromosome belonging to the initial population; i) the chromosomes are sorted top-down depending on their FF forming couples for mating; ii) the offspring of the matings are called New Locations which suffer a random mutation to increase the variability; iii) for every new chromosome the LP model is executed to obtain the new FF, wherein the case of infeasibility the FF is penalized; iv) if one of these FF is better than the best FF, then its location becomes the new best location with the best FF; v) finally, an extra mutation process (see 4.3) is applied for all chromosomes to improve the convergence of the algorithm. 4.3. Convergence In order to improve the algorithm convergence, a new Superfluous installation mutation is introduced to reduce some First Author et al.: Preprint submitted to Elsevier Page 6 of 11 Short Title of the Article noise in the LP solutions (see Fig. 1). Due to the objective function structure of the MILP (binary variables for the locations and continuous variables for the capacities of the DERs), when the binary variables are established randomly, some DERs may have zero capacity due to the LP solution. Therefore, these superfluous locations are modified following a function by parts for two cases: feasibility and infeasibility solutions, therefore; ∀𝑝∈ Φ : 𝐶ℎ𝑖,𝜓 𝑝=⎧ ⎪ ⎨ ⎪ ⎩ 𝑃(1) 𝐼+1 𝑖𝑓 𝛾𝜓,𝑖 = 0 𝑎𝑛𝑑 𝐶ℎ𝑖,𝜓 𝑝= 1 1−𝑃(1) 𝐼+1 𝑖𝑓 𝛾𝜓,𝑖 = 0 𝑎𝑛𝑑 𝐶ℎ𝑖,𝜓 𝑝= 0 Where Φrepresents the chromosome population. 𝐶ℎ𝑖,𝜓 𝑝 corresponds to the chromosome 𝑝at bus 𝑖and the types of DGs (𝑘) and BESS (𝑙) which are grouped in 𝜓.𝑃(1) is the probability of obtaining a one and 𝐼is the number of iterations. Therefore, the previous function defined by parts means; if the capacity 𝛾𝜓,𝑖 obtained as the optimal solution is zero in a bus when the DG or BESS is installed (𝐶ℎ𝑖,𝜓 𝑝= 1), that device or generator is replaced by a zero or one by the function defined by parts. For infeasible solutions, the buses without DG or BESS are changed from 0 to 1, and the random selector is applied oppositely. Note that the probability of replacing a 1 for a 0 for feasible solutions, increasing when the number of iterations rises. Applying this criterion, the convergence speed increases, and the infeasibilities tend to disappear when the number of iterations increases. 5. Case study and computational results 5.1. Case study Two cases are considered to observe the variability of the investment. The first case is an autonomous system, where the electricity demand is supplied only by DG and BESS, and a second case where the main grid supports the system. In the latter case, it has been used the equations presented in section 2.2 and to ensure that the energy obtained from the grid is only at critical hours; the Λparameter has been set in 5 (obtained after executing the algorithm for different penalization values). Thus, the model is willing to install a higher RES capacity and buy less energy from the main grid. Wind turbines (WT) and photovoltaic (PV) panels are considered the distributed generation resources, and Leadacid and Li-ion batteries storage systems. The parameters associated with the RES uncertainty 𝑃 𝐺𝑚𝑖𝑛 𝑖,𝑡 and 𝑃 𝐺𝑚𝑎𝑥 𝑖,𝑡 , are generated through the formulation used in [10]. The chromosome’s length for the genetic algorithm has 132 gens, explained by 33 buses, 2 types of DG, and 2 types of batteries. The data corresponds to the Lugo, Galicia region’s historical information in the north of Spain 2018 [25,26]. The well-known IEEE 33 Bus Radial Distributed System, 32 lines and 32 load buses [27] is used to test the mathematical formulation, and the algorithm set out in this article. The network has been extended for 8760 h, i.e., one year. In order to estimate the DERs operational cost, the electricity load corresponds to a forecast for the next 20 years. Thus, the DERs capacity obtained through the algorithm satisfies the load requirement for a typical time horizon in a planning process. 5.2. Model validation The mathematical formulation proposed in this article has been programmed in Python, using BONMIN and CPLEX as leading solvers for the MINLP and MILP, respectively. The non-linear and linear formulation for the AC-OPF model has been validated using a 5-bus system [28] as reference taking into account the location and the capacity as fixed parameters of the model, to make the results comparable with the reference values as can be observed in Table 1. Table 1 Model validation for the 5-bus test system Location Power Generated [MW] [28]AC-OPF Model AC-OPF Linearized DC-OPF Model Bus 2 0.0 0.0 0.0 0.0 Bus 4 14.773 14.848 14.186 14.718 Bus 5 5.227 5.694 5.89 5.814 5.3. Worst-case scenario and parameters In order to provide a DERs capacity closer to a real case, the time horizon must be extended beyond 24 hours because there are some factors to take into account to enlarge the study period. i) if the worst-case scenario of 24 hours is considered, the algorithm could overestimate the total capacity installed because it could not harness the battery behaviour to fulfil some gap between generation and demand. Likewise, ii) if the battery starts the period fully charged, the LP result could overestimate the installed capacity for the storage devices, sizing a capacity needs to supply the 100% of the load, without considering the DGs. iii) If the weather conditions in the worst 24 hours have a suitable wind resource but not the minimum to provide solar energy, the mathematical model does not install PV panels. This situation could generate infeasibilities in other seasons with high irradiance and low wind speed. Thus, a critical scenario must be defined in which the solution (capacity) reported by this scenario, is a feasible solution for a multi-period ACOPF for 8760 h. In this way, a hypothetical critical scenario of 192 consecutive hours (8 days) is created, uniting the worst eight days of the historical data (not necessarily consecutive), understanding the worst as days with a high difference between load and available generation. Fig. 3shows these 192 hours, where the curves have been normalized to represent the percentage of available power generated by a WT or a PV panel. For example, in Fig. 3, if the capacity of PV is 1 MW, and the available power for solar generation is 0.15 at hour 13 of the first day, it implies that the maximum power that can be injected into the grid from the PV panel is 15% of the PV First Author et al.: Preprint submitted to Elsevier Page 7 of 11 Short Title of the Article Figure 3: The hypothetical worst-case scenario of 192 consecutive hours. capacity, which is 0.15 MW. Thus, the most critical days belong to December, January, and February, where there are many days with more than 6 consecutive hours with a deficient generation. The parameters used for the mathematical model include installation and capital cost for WT/ PV/ Li-ion/ Lead-acid batteries, voltages, max capacities allowed, among others. They have been set out in [21,29] following the breakdown cost in [30,31], and the energy prices have been taken from [32] 5.4. Algorithm performance In order to size the performance of the algorithm, four components are considered: execution time, size population, number of iterations, and accuracy. The first component is measured comparing the computational burden when the mathematical formulation presented at the end of Section 3 is solved i) only with CPLEX, and ii) solved with the algorithm. For both cases, different time horizons are considered within the worst-case scenario. Table 2shows these results, where for a short time horizons, the CPLEX time is lower than the time offered by the algorithm. However, for a time horizon of 24 hours or greater, the execution time of CPLEX increases much faster than the algorithm’s execution time. Likewise, the FF value found by the algorithm is far from the optimal value obtained by CPLEX, only 2.5%, which is considered an acceptable value for this study. Two considerations are established to study the effect of the size population and the number of iteration over the algorithm accuracy; i) a single hour as the time horizon, ii) an OF value like the reference (505.62 ek - solving the original MILP using CPLEX). Table 3 shows the results for the different population sizes and the number of iterations, where every combination of these parameters has been executed 5 times. Thus, (A) in Table 3represents the best value obtained in the 5 executions. (B) the percentage of execution that reaches the best value. (C) corresponds to the error regarding the optimal reference value, in this case, 505.62, and (D) shows the average of the number of iteration that each execution required to reach the best value. Therefore, under these results, the number of iterations seems to be more relevant than the population size because when 30 iterations Figure 4: Algorithm convergence are considered, for every execution, no matter the population size, the algorithm reaches the optimal value. However, when the number of iterations is 15, only 40% of the executions with a population size of 16 reaches the optimal value; the remaining cases have 2.97% of error regarding the optimal reference value. To visualize the convergence of the algorithm is required a more vast number of iterations and uses a reference value to stop the chromosome mating when it reaches this value. Thus, Fig. 4shows the convergence of the algorithm when it is executed for one hour in the test system, considering a population of 50 chromosomes and 100 iterations. Each colour line represents one chromosome, which is a set of locations of DG and BESS. Close to iteration 100, every chromosome has found the optimal solution. Table 2 Algorithm performance versus MILP Period [h] 1 6 12 24 48 MILP [s] 3.61 102.5 209.1 1660.5 8516.7 FF [k ¿ ] 553.4 807.1 1132.6 1139.4 1150.7 Status ok ok ok ok ok Algorithm [s] 41.73 151 311.1 880 2716.6 FF [k ¿ ] 553.4 823.5 1151.8 1161 1178.1 Status ok ok ok ok ok Δ Time [s] 38.1 48.5 102.1 -780.5 -5800 Δ FF[%] 0% 2.0% 1.7% 1.9% 2.4% Table 3 Algorithm accuracy considering an optimal value as a reference Population Iteration (A) (B) (C) (D) 4 15 520.63 20% 2.97% 12.8 8 15 520.63 60% 2.97% 10.8 12 15 520.63 80% 2.97% 8.6 16 15 505.63 40% 0.00% 10.8 4 30 505.62 100% 0.00% 15.6 8 30 505.62 100% 0.00% 19.2 12 30 505.62 100% 0.00% 12.8 16 30 505.62 100% 0.00% 18.8 First Author et al.: Preprint submitted to Elsevier Page 8 of 11