Long-term smart grid planning under uncertainty considering reliability indexes

The electricity sector is fast moving towards a new era of clean generation devices dispersed along the network. On one hand, this will largely contribute to achieve the multi-national environment goals agreed via political means. On another hand, network operators face new complexities and challenges regarding network planning due to large uncertainties associated to renewable generation and electric vehicles integration. In addition, due to new technologies such as combined heat and power (CHP), the district heat demand is considered in the long-term planning problem. The 13-bus medium voltage network is evaluated considering the possibility of CHP units but also without. Results demonstrate that CHP can supply the district heat demand also contributing to network reliability reducing expected energy supplied and power losses avoiding the need to invest in new power lines for the considered lifetime project.


Introduction
The electricity sector is extremely important to the society. The energy needs are increasing and are satisfied by, mostly, non-renewable energy sources like coal or natural gas. However, this energy resources are scarce and can bring negative consequences to environment. In this way, there is a necessity to find new alternatives to, at least, reduce their use. In fact, environmental and technoeconomic factors have motivated the widespread adoption of Distributed Generation (DG) technologies in distribution networks. [1]. Therefore, the portion of DG based generated electricity is increasing as a consequence and will play an important role in distribution network systems. Nevertheless, DG based on renewable sources such as solar and wind and therefore carry an inherent variability [2].
Stochastic expansion model for the transmission problem have been proposed in [3]- [5] suggesting superior results compared with deterministic approaches when likely realizations are considered. Ref. [5] proposes a multiple resource expansion planning in smart grids. The two-stochastic model minimizes the expected cost in the entire planning horizon and in the second stage the realization of the load and wind generation are found. The results reveal that the expansion plans depend on the uncertainty level of prospective wind generation, existing capacity and transmission capacity. A stochastic planning approach of distribution lines is presented in [6]. The work is based on Monte Carlo and optimization procedure to minimize the conductor profile of a power line and the transformer capacity. The net present value of the total average annual costs is evaluated for the planning period of 30 years. The stochastic approach is compared with the deterministic one, and the results reveal that the former is able to increase the net present value by 13%-25%. The work presented in [1] concerns a multi-year distributed generation investment planning. The stochastic model considers uncertainty on emission price, demand growth, and renewable generation. The results in the real network suggest that compared to the naïve decisions, the stochastic model yields better and more robust decisions, namely amounting to more than 7%.
Combined heat and power (CHP) planning has demonstrated value in previous works [7], [8]. By definition, CHP plants can produce heat and power simultaneous, saving the heat that would be wasted in electricity production while saving up to 30% compared to conventional condensing power plants. Rong and Lahdelma [7] refers that when steam or hot water is produced for an industrial plant or a residential area, power can be produced as a by-product. Excess heat from an electric power plant can be used for industrial purposes, or for heating space and water. CHP is applied in the district heating concept. A district heating scheme comprises a network of insulated pipes used to deliver heat, in the form of hot water or steam, from the generation point to the final user. A district heating plant is often a CHP plant but renewables sources, for example biomass or solar energy, can be applied in district heating utilities, either completely or as a complement to traditional fossil fuels.
Ref. [7] proposes efficient algorithms for combined heat and power production planning in the electricity markets. Authors propose algorithms up to 1860 times faster than CPLEX. Fast solutions of hourly CHP models is important, because long-term planning model requires solving several hourly models, and a large number of scenarios in stochastic approaches. In [8] multiple energy infrastructures are addressed, namely for supplying electricity and gas loads. The planning model determines a least-cost network of transmission lines for both infrastructures. The authors demonstrate that the coupling multiple energy hubs offers advantages and more flexible options between the interconnected systems.
Taking into account current literature, in this work we propose to include heat and power demand in the grid expansion problem (new lines construction) in order to improve reliability indexes ensuring the radial topology of the distribution power network at minimum costs. Results indicate that it influences the grid planning and a joint planning is more indicated. The book chapter is organized as follows: After the brief introductory part, Section 2 presents the modelling of system uncertainties; Section 3, the problem formulation; Section 4 the adopted case study; Section 5 the results and its discussion and Section 6 the conclusions.

System Uncertainties
Grid expansion and planning problems can be modeled as deterministic or stochastic problems. Usually, power system planners have considered this problem as a deterministic model, i.e. they considered parameters and inputs based on the assumption that the data for the problem is known accurately. Nonetheless, the inputs of the expansion model must be estimated, such as the load demand and the renewables penetration in the project lifespan, which is usually a decade at least. However, the projections are done with a large anticipation process depending on many factors and as a consequence they are not 100% accurate. The high deviations in the projections can have a relevant impact on the economic and technical aspects of daily grid operation. Therefore, the recent advances in expansion planning models are moving from deterministic to stochastic approaches in order to incorporate the uncertainty in projections for future in the planning models [9].
In practice, it is possible to feed a deterministic model with several likely scenarios and run each optimization independently. However, advanced stochastic models can provide better alternatives [10]- [13]. In order to capture the underlying uncertainty in the problem data, a sophisticated energy planning model is developed here. The ultimate goal is to find a solution that is feasible for all the supplied scenarios while minimizing or maximizing the objective function, e.g. the expected investment cost.
The steps involving stochastic programming are typically developing the possible scenarios that represent the underlying uncertainty. This step is usually a cumbersome task where lot of possible scenarios might be generated. Therefore, a second step is generally applied using scenario reduction techniques. The objective is to obtain a reduced set of likely scenarios that is feasible to be solved [14]. The third step involves developing a multi-scenario stochastic model to accommodate for the set of scenarios.
In the proposed model, the DSO faces several sources of uncertainty for the projections in 30 years, namely the forecast errors of load demand, number of consumers and the potential production of renewable units. These parameters are considered as potential uncertainties in this model [15]. In stochastic models, the optimal decisions are taken on the basis of future adaptability against a set of predicted scenarios [9]. The uncertainties related with these inputs are taken into account in the model and the planning problem is developed as a stochastic scenario-based optimization model.
In stochastic problems, where a set of scenarios needs to be handled, the main issue is to construct a set of realizations for the random variable. These scenarios should adequately represent the probabilistic characteristics of the data [16]. In this stochastic planning model, the initial set of scenarios is a large data set generated by the Monte Carlo Simulation (MCS) technique for representing the uncertainties which the DSO faces while solving the problem. The MCS parameters are the probability distribution functions of the forecast errors [17]. In order to include the forecast error, an additional term which can be positive or negative is added to the forecasted profile (x forecasted ) ( ) ( ), .
forecasted error The error term (x error ) is a zero-mean noise with standard deviation σ [16], [18]. Scenarios, which are projections for a specific date in future, are represented with x(s). The uncertainties of the forecast errors are modeled with the probability distribution functions, which are usually obtained from the historical data [16]. In this model, the forecast errors for the uncertain inputs are all represented by normal distribution functions.
Including all the generated scenarios in the planning problem results in a largescale optimization problem [16]. Generally, there should be a tradeoff between model accuracy and computation speed [15], [19]. In order to handle the computational tractability of the problem, the standard scenario reduction techniques developed in [20] are used. These scenario reduction algorithms exclude the scenarios with low probabilities and combines those that are close to each other in terms of statistic metrics [20]. They determine a scenario subset of the prescribed cardinality and probability which is closest to the initial distribution in terms of a probability metric [17]. The key purpose of scenario reduction is to decrease the dimensions of the problem. The number of variables and equations are reduced after applying these algorithms. Accordingly, the solutions can be found more efficiently, without losing the main statistical characteristics of the initial dataset [21]. However, the potential cost of applying these approaches is introducing imprecision in the final plans [19].
The reduction algorithms proposed in [20] consists of algorithms with different computational performance and accuracy, namely fast backward method, fast backward/forward method and fast backward/backward method. The selection of the algorithms depends on the problem size and the expected solution accuracy [17], [20]. For example, the best computational performance with the worst accuracy can be provided by the fast backward method for large scenario tress. Furthermore, the forward method provides best accuracy and highest computational time. Thus, it is usually used where the size of reduced subset is small [17]. Theses algorithms are also incorporated in a General Algebraic Modeling System (GAMS) tool called SCENRED. SCENRED can be used to reduce the randomly generated scenarios [22]

Problem Formulation
The demand growing trend prompts an expansion of the distribution network. Thus, one of the proposals will be the construction of new lines, as it may influence the values of energy losses and energy not supplied. Costs related to the investment, network operation, satisfaction of all operational, physical and financial constraints leads to a planning problem.
A distribution network planning problem can be of two types [23], [24] : static and multi-step. The first one considers that the construction / expansion of medium voltage (MV) distribution network can be carried out in a single step, usually associated with small interventions.
The multi-stage planning problem is related to a long term where the investments are carried out at different stages of planning. One of the way to solve this problem is considering only a single step with several static problems, where the next step starts with the solution of the previous step as input.
The distribution network is spited into two subsystems: a primary one, supplied by MV, and a secondary one, supplied by low voltage LV. Carrying out the planning of these two subsystems simultaneous is very complex, so one of the solutions is to make the planning for the different subsystems separated. Thus, there is a decrease in complexity since the method no longer involves a high number of decision variables and also different voltage levels.
The problem considered in this book chapter are related to a MV primary network with several objectives. The objective function reflects the energy loss cost, the expected energy not supplied cost and the cost related to the investments, which in this case will be in the construction of new lines.
The main goal of this problem is to minimize the costs referred above subject to all technical network constraints. Indirectly the methods also minimize the number of switches to be operated, since there are constraints to deal with the network radiality. With this, the problem must consider the following constraints:  Power balance -Kirchhoff's first law;  Generation limits;  Lines / cable thermal limits;  Only one direction of power flow can exist;  Radiality condition.

a. Economic Evaluation
The uncertainty associated with any project that involves a large amount of investment requires careful and detailed economic analysis. One of the difficulties faced during the economic evaluation of projects is that the cash flows (entry and exit of money) are staggered over time. Gallo [25] says that it's common sense that the money owned today is more valuable than the same amount after a few years (inflation rate decreases purchasing power). Thus, using a discount rate and converting the financial amounts between different time periods it is possible to solve the above mentioned difficulty.
Bruni et al. [26] mention that an economic evaluation of projects usually involves a set of parameters to establish the viability of the project. Thus, the author refers to three commonly used tools:  Net Present Value -NPV: Is the difference between the money flows, duly updated during the project analysis period. This value should be positive indicating that the results achieved allow to cover the initial investment and still make a profit. If it is null, there was only recovery of the initial investment;  Internal Rate of Return -IRR: Is the rate that nullify the NPV. Obtaining a IRR above the discount rate indicates that the project is economically feasible. In other words, the project manages to generate a rate of return greater than the cost of capital;  Payback: is the number of years required to recover the investment. That is, it is the payback period of the initial investment, assuming that it was done all in year zero.
The planning method proposed in this book chapter considers the acquisition and connection of new power lines as the investment to be applied to the distribution network. Thus, the economic evaluation takes into account in addition to this Investment (INV), the profits achieved with the application of this new solution -through the reduction of power losses (PL) and expected energy not supplied (EENS). For the investment economic evaluation, the lifetime project and the discount rate must be defined by the investor. The typical duration for planning distribution networks is approximately 25 years [27].
All necessary investments and all obtained benefits in order to improve the reliability indexes are considered in the economic evaluation. The investment is considered profitable when the present value (PV) of the incoming related to the improvement of reliability indexes and losses reduction is greater than the investment made in new power lines construction. This means that the net present value (NPV) is positive (equation (1) ).
The benefit (BNF) corresponds to the savings whose are related to the reliability indexes improvement and losses savings. Investment is the total investment for the planning project.
The present value of the savings whose are related to the reliability indexes improvement and losses savings can be calculated by the capital recovery factor (CRF). CRF, presented in equation (2), is the ratio of a constant annuity to the present value of receiving that annuity for a given project lifetime. Thus, for t periods bnf1 = bnf2 = … = bnft = bnf -equation (3). where: dr is the discount rate, and t the project lifetime.

b. Target Reliability Values
Distribution system reliability is one of the most important issues in system planning and operation [28]. Institute of Electrical and Electronics Engineers (IEEE) [29] as well as others authors like Canizes et al [30], use the basic reliability indexes:  Failure rate (λ) -Is the number of faults of a given equipment in a given period of time. The failure rate represents the probability of an equipment failure;  Repair time (r) -Is the failure average duration;  Unavailability (U) -Is the annual outage duration.
In energy distribution systems, these indices are mathematically related according to the equation: With this, it will be possible to determine the Forced Outage Rate (FOR), another relevant index in the reliability analysis. FOR represents the probability of an unavailability network equipment when it is requested. This index is defined as the number of hours that the equipment is unavailable dividing by the difference between the number of total hours of a year (T), 8760 hours, and the repair time of equipment i.
The FOR is used to determine the power not supplied in each distribution network line by the following equation: Thus, the expected energy not supplied is: where: ij is the line between bus i and bus j, NL is the number of distribution network lines.
The reliability indices such as System Average Interruption Duration Index (SAIDI), System Average Interruption Frequency Index (SAIFI), and Expected Energy Not Supplied (EENS), adopted by the IEEE standard [31], are used to evaluate reliability of the system.
The network operator defines target values for the reliability indexes. To achieve the new reliability values, the system operator should improve the repair times and the failure rates.
The following reliability indexes (8)- (11) are considered in the proposed method:  System Average Interruption Duration Index Total customer interruption durations Total number of costumers in the system SAIDI   System Average Interruption Frequency Index Total number of customer interruptions Total number of costumers in the system SAIFI  c. Stochastic planning model The planner in the decision making under uncertainty has to make optimal decisions throughout a decision horizon with incomplete information. A number of stages can be defined for the considered decision horizon, representing a point in time where decisions are made or where uncertainty partially or totally vanishes [32].
In this book chapter is considered a two stages planning method with a stochastic process represented by a set of scenarios. Thus, two types of decisions can be used in the planning process: First-stage: The decision is made before stochastic process execution. Thus, the variables that represent the first stage does not depends on each stochastic process execution. These variables are known as "here and now" variables.
Second stage: The decision is made after knowing the stochastic process. Thus, the decision depends on each vector of stochastic process execution. When the stochastic process is represented by a set of scenarios, the second stage decision variables are defined for each considered scenario.
The two-stage stochastic programming is an effective approach to include the impacts of the decision in stochastic optimization problems. More theoretical background on stochastic programming models can be found in [32], [31].
Usually the distribution network planning is treated as a multiobjective optimization problem with non-linear programming. This is because in the formulation of the problem there are nonlinear constraints related to the power flow, binary variables among others. Thus, the planning model can be formulated as a mixed integer non-linear programming (MINLP), however this problem is complex and difficult to solve. Thus, it is important to find a simple method to avoid this complexity. The DC power flow constraints are considered in the optimization model (22). The usage of a DC model is justified because in many countries, like in Portugal, the distribution networks have voltage regulators and capacitors banks carefully positioned along the grid to keep the voltage and reactive power between the desire limits. Usually, the voltage stability is placed at the HV/MV substation level. However, in the Portuguese case the MV/LV transformers also have voltage regulators. Therefore, the problem will be formulated as a mixed integer linear programming (MILP).

Power losses linearization
To make the problem linear it will be necessary to linearize the objective function. In this case, the only nonlinear term in the objective function is the power losses. Abdel-Halim [33] addresses the linearization of power losses according to the Venikov method. This approach considers that the lines and cables in the system work close to the nominal current, i.e., the economic current density (Jeco.) where: Jeco -economic current density (A/mm 2 ) Scc -Line section (mm 2 ) Thus, the power losses can follow the equation (13): Replacing in (13) the equation (12): where: in which: k' and k'' are constants that depend on the type of service (one or three phases) S -Load (kVA) R -Line resistance (Ω/km) I -Current that flow in the line (A) ρ -Line resistivity at operating temperature (Ω.mm 2 /km) L -Line length (km) Replacing (15) and (16) into equation (14) the linear equation of power losses is: The current density value is calculated by equation (18): where: n -Number of active conductors h -number of service hours for the electric conduits per year q -Constant value dependent of the line/cable type p -Energy price €/kWh Proposed methodology Fig. 1 presents the scheme of the proposed methodology. The proposed methodology has five main steps, which are presented in more detail as follows.

Input data
The first step is to prepare all the input data to be consider in the model. Data like generation and load points, lines and new lines option characteristics, and reliability data. The data regarding to the predicted values for solar power and wind power, load and heat demand and the number of consumers as well as their standard deviation values are also considered.

Scenarios generation
In this step a set of scenarios is generated using Monte Carlo Simulation (MCS) following a normal distribution. The predicted and standard deviation values referred above are used as inputs for the MCS, which is implemented in MATLAB software.

Scenarios reduction
As a set of thousands of scenarios are generated, becomes imperative to handle with the computational tractability of the problem. Thus, the standard scenario reduction techniques developed in [20] is used. These scenario reduction algorithms exclude the scenarios with low probabilities and combines those that are close to each other in terms of statistic metrics [20]. They determine a scenario subset of the prescribed cardinality and probability which is closest to the initial distribution in terms of a probability metric [31]. The main purpose of scenario reduction is to reduce the size of the problem.
General Algebraic Modeling System (GAMS) with SCENRED toolbox considering the fast backward/forward method is used to deal with the scenarios reduction.
Long-term planning model using a two-stages stochastic method This optimization model has as outputs the decision variables regarding to the investment in new lines, power losses and expected energy not supplied costs, and the SAIDI, SAIFI reliability indexes. The total expected planning cost is represented by (19), corresponding to the first stage planning cost (PC 1 ) and second stage planning cost (PC 2 ) The expected planning cost for the first stage, PC 1 , is represented by (20), which includes the cost of new lines placement. where: CostINV -Initial investment in new lines (€) y(i,j,c) -Decision binary variable to connect bus i and j for the chosen line option c CRF-Capital Recovery Factor CostM -Maintenance cost (€) The expected planning cost in the second stage, PC 2 (21) includes the power losses cost (first term), expected energy not supplied costs (second term), and excess of power supply costs (third term).
FOR(i,j,c) and P(i,j,c) are respectively the forced outage rate and the power flow between bus i and bus j according to the chosen line option c. FOR is calculated considering the basis reliability indexes r and λ. Since these indexes are used to determine the remaining indicators, so, minimizing the FOR those indicators are also minimized. e T is the equivalent average time in hours and according to Gustafson [34] is the average number of hours during which it would be necessary for the peak load to be carried to give the same energy loss as that given by the actual load throughout the year. To obtain more reliable results, it is necessary to subtract to the e T the number of probable hours in which the lines may be out of service in the 8760 hours of the year.
The objective function (19) is subjected to several constraints. Below it is possible to find all the model constraints (22)-(44).

Radiality condition
This constraint ensures the radial topology of the distribution network.

Transfer buses
A bus with no generation or demand is referred as a transfer bus. This kind of buses are used to connect a load bus to other load bus and is not a terminal bus (main condition to use the transfer buses), i.e., there are at least two more circuits "leaving" the transfer bus.
To model the use of a transfer bus, first a binary variable must be defined such that is equal to 1 if the transfer bus is used; otherwise, is equal to 0. To consider transfer buses (24) is replaced by (26): where zj is the binary variable related to the transfer buses Constraints (26)-(29) avoid the loop generation due to the presence of transfer buses and also prevent the appearance of a terminal transfer bus (with only one connected circuit).

Avoid distributed generator isolation from substation
where D(g) is a fictitious load of each distributed generator that only can be fed by the substation. d(i,j,c) is the fictitious flow associated with branch i,j for c line option. If it is allowed to the distributed generators supply some loads independently, then (30)- (33) are not considered in the model.

Controllable DG units and external suppliers
Maximum and minimum limits for active generated power Parking lot constraints The EVs are treated as virtual batteries in the proposed model. A virtual battery can represent a parking lot or a set of EVs located in the network. In this model the EV charge is equal to charge limit multiplied by simultaneity factor (sf). sf is considered equal to 1. The generation curtailment power of non-dispatchable DG units cannot be higher than the predicted amount of generation.
, , District heating The use and development of district heating (DH) is increasing in several countries, namely in north of Europe. The generating heat plants in DH send out the heat to the households as water or steam. Thus, the constraints (45)-(46) could be consider to incorporate the heat demand in the proposed model. The considered heat plants in this model are the CHP and boiler plants.

CHP constraints
CHP plants in this model have the following operation region (Fig.2).

Evaluation metrics
The well-known indices, such as the expected value of perfect information (EVPI) and the value of stochastic solution (VSS) are used to evaluate the benefits of the stochastic programming [32]. The EVPI represents the amount that the decision maker is not able to gain due to the presence of imperfect information, e.g. forecasts. It is useful to evaluate how the uncertainty factors affect the evaluated optimal problem. Regarding VSS, it's represents the advantage of using stochastic programming over a deterministic approach [32].
EVPI for minimization problems can be represented by (47). The stochastic solution, represented by Z S* is calculated by the stochastic programming approach and represents the total expected cost (S). Z P* represents the wait-and-see solution (WSS). The WSS can be obtained by using the deterministic approach for each scenario. Then, WSS is computed by multiplying the individually obtained cost by each scenario probability. where Z D* is the optimal value of the modified stochastic problem. It is a deterministic version of the original problem with an average scenario. The optimal decision variables of the original stochastic problem are considered as input in the modified problem.

Case study
This section presents a case study to demonstrate how the proposed method is applied. A distribution network (Fig. 3) with 13 buses, 30kV and one substation (located in bus 1) is used in this book chapter. Connections between buses are made by AA 90 overhead lines type. The dashes lines presented in Fig. 3 are new connection options and do not exist in the actual network. Fig. 4, Fig. 5 and Fig. 6 present respectively the standard deviation for each resource, the load and heat demand predictions and the intermittent energy resources (solar and wind) and consumers predictions for year 2050.   This network has 9 load points, one parking lot for EVs, 4 DG units (one wind generator, one solar generator and 2 biomass units). This distribution network has also 2 storage systems located at buses 2 and 4. The energy resources data as well as the prediction for the number of consumers are shown in Table 1 and Table 2 respectively.
In this case study, the owners of energy storage systems (ESS) are external players. These owners have an agreement to keep a 20% reserve capacity for the network operator (this capacity should not be by the ESS owner). This capacity can be used for instance to deal with excess or a lack of generation by the network operator. Two 1MW ESS units are available in the network. 0.4MW of capacity are reserved for the system operator (0.2MW for charge and 0.2MW for discharge). The others distributed energy resources belongs to the network operator. Average wind and solar power prediction, as well as the load demand prediction (taking into account 120 scenarios) are presented in Fig. 7 and Fig. 8 respectively.
The EVs Parking lot is located at bus 3 and has 20 car places. The maximum charge capacity for each place is 60kW. In this case study, a simultaneity factor equal to one is considered. Thus, the maximum charge capacity for the parking lot is 1200kW. Wind and solar power are average predicted values for the lifetime project over the year. Thus, these average values considering their standard deviations will be considered in the scenarios generation. Through Fig. 7 it is possible to see that the expected minimum for wind power and solar power are 0.1702MW and 0.2680MW respectively. Considering the expected uncertain, the expected maximum for wind power and solar power are 0.7707MW and 0.7470MW respectively.  Fig. 8 the demand for EV parking lot considered in this case study is equal to the maximum charge capacity of the parking. As it said above a simultaneity factor equal to one is also considered. The expected minimum for power demand and for number of consumers are 5.2859MW and 631 consumers respectively with expected uncertain of 2.8052MW and 155 consumers respectively. Thus, the expected maximum for load demand is 8.0911MW and for the number of consumers is 786.
To complement the study presented in this book chapter it will be considered the possibility to have a district heating (Fig. 9). To supply the required heat demand, 4 heat sources are considered, 2 heat-only boiler stations (or just boiler stations) and 2 CHP units. In addition to providing heat, the CHP units also provides electrical power, so this kind of unit can contribute to an improvement of the EENS. As a result, can also contribute to the reduction of the network investment costs and in energy not supplied and power losses costs.
Thus, 2 CHP units and 2 heat-only boiler stations are carefully installed in the distribution network (Fig. 9). The heat demand points are in the same load demand buses. Table 6 and Table 7 present the heat resource and demand data. In Fig. 10 is depicted the expected minimum (2.8802MWth) and the expected uncertain (0.9027MWth).
The following four case studies are presented to show the impact of using storage units and the district heating in the distribution network planning problem.
District heating is only affected by CHP units and heat-only boiler stations. However, CHP heat and electricity supply are dependent as can be seen in Erro! A origem da referência não foi encontrada..
 Case A -ESS and CHP are not considered;  Case B -ESS is considered and CHP is not;  Case C -CHP is considered and ESS is not;  Case D -ESS and CHP are considered. Table 3 presents the initial average values of SAIDI and SAIFI indexes, i.e, the values for the actual network considering and not considering the district heating (CHP units). For all analyses conducted in this case study it is intended to achieve a reduction at least 30% in SAIDI and 15% in SAIFI. In this case study, the way to achieve these reductions is investing in new lines construction. Two lines option are considered. Table 4 and Table 5 present the lines thermal limits, the basic reliability indexes (failure rate -λ and repair time -r) for the investment opinion 1 (line AA90) and option 2 (line AA160) respectively. The bold rows represent new option connections between buses. It is possible to see in Table 4 several cost and maintenance costs equal to zero. This means that the respectively AA90 line type exist in the actual network, thus its costs are considered zero in the proposed long-term planning method. This method considers also the possibility to change a line type for the other (AA90 by AA160). These tables also show the construction line cost (line cost plus installation cost). The maintenance cost for each new line is also presented.  The most commonly cogeneration units used are the single-cycle gas or steam turbine units. In this book chapter, the cogeneration unit used is the single-cycle steam turbine without condensation. Considering this kind of unit, the feasibility region is convex, which means that any point belonging to a straight line drawn between two distinct points belongs to the feasibility region presented. The considered CHP units presents the following convex feasibility region (Fig. 11).  Heat-only boiler --10-10 2 The EENS cos is 3 m.u/kWh, and of 0.12 m.u./kWh for loss cost. For the expected energy not supplied cost, investment cost, loss cost, a discount rate of 5% is considered for a 30 years lifetime project, which leads to a Capital Recovery Factor equal to 15.37. In this case study, the considered value for Te is 4500 hours and all the terms of the objective function (21) have the identical importance for the distribution system operator.
The proposed work was developed in MATLAB R2014b and TOMLAB 8.1 64 bits with CPLEX solver (version 12.5) using a computer with one Intel Xeon E5-2620 v2 processor and 16 GB of RAM running Windows 10 Pro.

Results and discussion
Two-stage stochastic method is applied to solve a long-term planning problem in the considered case study. This optimization problem considered 120 scenarios and deals with 167,009 variables and 86,492 constraints. Table 8 presents the peak memory and the execution time for the two-stage stochastic long-term planning problem. The execution times are less than an hour, so they are compatible for the available timeframe in the planning-making process. A memory test was made to evaluate the impact on computer system resources through MATLAB memory profiler. This command report the peak memory for each function used in the methodology developed code. As can be seen in Table 8 the higher peak memory was verified in case A. Even the peak memory doesn't exceed 300 MB in this case. Thus, the proposed work in this book chapter is compatible with a wide range of available computers in the market. Fig. 12 and Fig. 13 present the optimal radial topology for the two-stage stochastic method (Z S* ) without district heating and considering district heating, respectively. In other words, it is being considered the uncertainty in load and heat demand, in the number of consumers, and in the wind and solar power in the actual distributed power network (without any option of line construction).  Table 9 it is possible to see the costs for power losses and EENS when the two-stage stochastic method is applied to the actual network with and without district heating. Once the district heating is affected by CHP units, and for the distribution power network this kind of units are distributed generators it is verified (as can be seen in Table 9) a reduction in the power losses and EENS costs. The next two figures (Erro! A origem da referência não foi encontrada. and Erro! A origem da referência não foi encontrada.) present the studies referred to case A and B using the two-stage stochastic optimization model. Optimal investment (construction of new lines) to be applied in network in order to improve the reliability indexes and at the same time minimizing the power losses cost, expected energy not supplied cost and the investment cost is obtained. These studies, also present the optimal radial topology to be chosen in order to operate in considered conditions (taking into account all scenarios). For case A three new lines are chosen, one AA90 connected between bus 7 and bus 10, and two AA160 connected between bus 1 and bus 7 and bus 6 and bus 9. The total cost associated to this case is 3,516,065 m.u. and the total benefit of this investment is 1,604,200 m.u. for the lifetime project.
Regarding to case B four new lines are selected, three AA90 between buses 7-10, 6-9 and 11-12 and one AA160 between busses 1-7. In this case the total cost is 3,565,618 m.u. and the total benefit is 1,740,050 m.u.. Erro! A origem da referência não foi encontrada. and Erro! A origem da referência não foi encontrada., are related to the studies made for case C and D. Also, the optimal topology to be operated for each case is also obtained. For case C and D three new lines are chosen, one AA90 connected between bus 7 and bus 10, and two AA160 connected between bus 1 and bus 7 and bus 6 and bus 9. Case C presents a total cost of 2,863,415 m.u. and a total benefit of 69,060 m.u.. Regarding to case D the total cost is 2,701,645 m.u. and the total benefit is 177,710 m.u..  Table 10. Through this table it is possible to see that the substitution of the existence lines wasn't selected by proposal model.  Table 11 and Table 12 present the result costs for each objective term as well as the total costs and the monetary benefits achieved in each case. Once CHP units are used in the district heating cases and they also contribute as distributed generators to the distribution power network, the EENS costs and losses costs are lower than the cases without district heating. Hence, the total costs for the cases that include CHP units are also lower as well as benefit. It can be said that with the necessary investment to achieve the desired values of SAIDI and SAIFI the total monetary benefit is small when compared with the cases without CHP. Analyzing Table 13, can be seen that the payback for cases C and D is greater than the lifetime project and present an IRR negative. So, this means that the investment will not be recovered in the lifetime project. Thus, the investment in new lines construction to improve the SAIDI and SAIFI will not be economically feasible. In Fig. 18 is depicted a comparison between the total costs obtained by the twostage stochastic method (Z s* ) and deterministic method (Z d* ). It is evident the lower costs presented by the two-stage stochastic method for each case. The higher costs are present in cases A and C of deterministic method, this is due to the existence generation power excess and the non-existence of ESS. Results suggest that ESS contributes to avoid a higher cost when the deterministic model is used and shows advantage of Two-stage stochastic method (even without ESS the generation power excess is zero). The values of the quality indices are shown in Fig. 19. Case A and case C are good proofs of the previous statement, where the VSS is higher in cases A and C (180% and 222%) which means that without ESS the stochastic model is more important to achieve lower expected costs mitigating the uncertainty. In fact, these VSS very high values for cases A and C are related to the existence of generation power excess.
For cases A, B, C and D a reduction of 64%, 11%, 69% and 22% is obtained when Z s* is used. The new reliability indexes when the two-stage stochastic model is used are shown in Fig. 20 and Fig. 21. As can be seen the obtained values are lower when compared with the initial values of SAIDI and SAIFI ( Table 3). The reliability indexes values in the case B have more considerable changes when compared with the other three cases, this is related to the new lines constructions that the two-stochastic model has chosen (Table 10).