Optimal Capacity Sizing for the Integration of a Battery and Photovoltaic Microgrid to Supply Auxiliary Services in Substations under a Contingency

: Auxiliary services are vital for the operation of a substation. If a contingency a ﬀ ects the distribution feeder that provides energy for the auxiliary services, it could lead to the unavailability of the substation’s service. Therefore, backup systems such as diesel generators are used. Another alternative is the adoption of a microgrid with batteries and photovoltaic generation to supply substation auxiliary services during a contingency. Nevertheless, high battery costs and the intermittence of photovoltaic generation requires a careful analysis so the microgrid capacity is deﬁned in a compromise between the investment and the unavailability reduction of auxiliary services. This paper proposes a method for the capacity sizing of a microgrid with batteries, photovoltaic generation, and bidirectional inverters to supply auxiliary services in substations under a contingency. A set of alternatives is assessed through exhaustive search and Monte Carlo simulations to cater for uncertainties of contingencies and variation of solar irradiation. An unavailability index is proposed to measure the contribution of the integrated hybrid microgrid to reduce the time that the substation is not in operation. Simulations carried out showed that the proposed method identiﬁes the microgrid capacity with the lowest investment that satisﬁes a goal for the unavailability of the substation service.

annualized costs of the system, the loss of power supply probability (LPSP), and the cost of fuel pollution; the algorithm determines the non-dominated solutions sizing photovoltaic panels, wind turbines, batteries, and diesel generators for a DC load profile. Recently, reference [21] proposed a method for the design of a hybrid system composed of photovoltaic panels and biomass generators; a comparative analysis is carried out for different battery technologies based on technical and economic criteria, considering the net present value for a specified LPSP for a set of residential loads. Finally, [20] proposed the minimization of the net present value in the sizing of a microgrid based on photovoltaic panels, wind turbines, and fuel cells considering restrictions of deficit power-hourly interruption probability for residential customers. In conclusion, recent works on the sizing of microgrids consider a specific type of loads, most of them residential, in which the microgrid operates autonomously and is the main source of supply; the issues of continuous power supply are considered through indicators as LPSP.
Based on a mixed linear optimization model, [22] proposes a fault-tolerant supervisory controller for an isolated hybrid ac/dc microgrid seeking robust, efficient, and fault-resilient operation to meet demand with the highest possible utilization of renewable energy even under fault conditions. The reliability of the substation, considering an alternative source of power has been addressed in a few studies. For instance, an analysis of the continuity of the energy supply was done through Markov Chains in a 110/35 kV substation with distributed generation; from the analyzed cases, the more robust was the one in which distributed generation was connected to the low-voltage bus. The use of a compensation device, along with a voltage control system, has been proposed to improve the substation's operation, not only to deal with auxiliary services but also for the energy supplied by the substation [23]; more recently, voltage control was proposed to improve demand response in a smart substation [24].
Few studies have addressed the energy supply of ASS, although alternative means to meet the energy demands of those systems have been discussed and simulated. Specifically, a two-part work makes first a critical analysis of the different types of fuel-cells for energy supply that can be a backup or main source [1]; they can be combined with other technologies such as a photovoltaic generation to support an electrolysis system and also produce hot water for other uses; the second part discusses a case study of the use of fuel-cells in a real substation in Romania, bringing economic information of three possible uses for the fuel-cells [25]. The case with the best economic interest was selected to design a system for the ASS. This paper proposes a method for the capacity sizing of a microgrid with batteries, photovoltaic generation, and bi-directional inverters to supply the power demanded by ASS under a contingency. A set of alternatives is assessed through exhaustive search and Monte Carlo simulations to cater for uncertainties of contingencies and variation of solar irradiation. The main contribution of the paper is the capacity sizing method along with an unavailability index to measure the contribution of the hybrid microgrid to reduce the time that the substation is not in operation. The highlights of the proposed approach are described as follows:

1.
A microgrid based on a hybrid system of photovoltaic energy and batteries is adopted as a backup system for the operation of auxiliary loads in a substation. Generally, substation backup systems use diesel generators without mentioning the possibility of taking advantage of renewable energy sources. 2.
The influence of contingency rates and durations to determine the optimal size of the main components of the microgrid is assessed. Unlike other methods, it is unknown a priori the number of hours that the hybrid microgrid should be available to supply the substation loads.

3.
An exhaustive search is adopted to identify the optimal size of the main components of the microgrid, such as the photovoltaic panels, the batteries, and the inverter. The election of the technique is justified by the few components that compose the microgrid, which allows focusing on the sensitivity analysis of uncertain parameters of renewable generation and fault duration. This paper is organized as follows. Section 2 presents the proposed method for the capacity sizing of the microgrid, justifying, and explaining the particularities of each of the elements that are part of the proposed exhaustive search. Section 3 discusses the economic and operation assessment, summarizing, and linking the elements of the proposed sizing method. Section 4 illustrates the application of the method in a case study for auxiliary loads of a substation requiring 12 kW and assuming that the expected fault rates and fault durations of the main substation's feeder are 1 fault/year and 5 h, respectively. Additionally, a sensitivity analysis of these parameters and the costs of the main components is carried out. Conclusions are drawn in Section 5.

Capacity Sizing of the Microgrid
Microgrids are configurations that include a set of energy sources and storage, used especially in applications of autonomous generation systems. Their main advantage is the relative simplicity of allocation and autonomy from a single generation resource, which gives them the ability to work independently of weather conditions and time of day. Nevertheless, the effectiveness in the application of hybrid systems depends on the correct sizing of the microgrid resources.
Microgrids are generally designed to increase the integration of renewable sources such as solar and wind energy. Although those sources are cleaner than conventional generators, their unpredictability and climate dependence limit their applications when loads require uninterrupted power. Consequently, and to increase reliable energy delivery, storage systems are used in the configuration of hybrid systems. This paper focuses on the design of a hybrid system consisting of a clean source of solar energy and a storage system based on batteries to be the backup service that provides energy to the ASS loads. Figure 1 shows the impact of the microgrid in the increasing of the availability time of the auxiliary services when the main supply system is under a contingency state. In Figure 1a, there is a set of auxiliary services supplied only by the distribution network; when the substation's feeder is in a contingency state, the ASS are interrupted. The time gap between the "main grid operation" and "repair" represents the fault detection time. Figure 1b shows the positive influence of the microgrid in a contingency state scenario; in the outage period, the microgrid supplies the loads, therefore increasing the time of availability of the ASS.
Traditionally, the components of hybrid systems are sized based on the assumption that the estimated value of the load and the predefined time to operate in autonomous mode are known [16]. However, a microgrid used as a backup service for ASS has characteristics that make unsuitable the a priori sizing of the microgrid capacity: It is sought that microgrids, as a support service for ASS, have the capacity to autonomously operate for a longer period than any contingency in the main supply system. However, considering that the main supply comes from the distribution system, the contingency durations have a random behavior depending on the feeder of the distribution network. Therefore, the energy that should supply the microgrid is not known in advance.
Although it is desirable that the microgrid is sized to meet any duration of contingency, in the practice investment limitations, physical limitations for installation, and the random behavior of the contingency's duration determine the selection of an appropriate investment. In consequence, the hybrid system must be sized to be able to provide the ASS loads for a desired proportion of the power distribution system contingency scenarios.
In the case of a hybrid system with few components, an exhaustive search is proposed here to assess the cost-effectiveness for each possible combination of photovoltaic systems and batteries. For this purpose, each possible configuration of the microgrid will be evaluated through economic and unavailability indicators. Simulations using the well-known Monte Carlo method are carried out to determine the performance in contingency state for each possible microgrid configuration, taking into account the uncertainties of the occurrence and duration of contingencies, as well as the random behavior of the solar irradiation. proposed in this work. They allow the compromise analysis between the economic value of the investment and the unavailable time of the ASS due to any contingency of the main system.

Economic Assessment
The total net cost will be used as an investment index for each possible microgrid configuration represented by the index s. This cost includes the cost of the batteries, the cost of the photovoltaic panel system, and the cost of the inverter. The latter is added, given its large proportion within the overall costs in hybrid systems.
For each case, the investment is calculated according to the number of components of the microgrid. For batteries, the cost is calculated based on their nominal storage capacity ( ), measured in kWh. The photovoltaic panels cost is calculated according to the units used on each microgrid s ( ), whilst the bidirectional inverter cost is calculated according to its power in kW . Thus, the total investment value for a microgrid configuration s is given by Equation (1). The equipment costs are , , and for batteries, photovoltaic panels, and inverter, respectively.
In addition to the investment costs in the microgrid, maintenance costs are also considered through the years of the equipment's lifespan ( ). For this purpose, the costs are brought to a present value at an interest rate . The annual maintenance cost for each equipment corresponds to a fraction of its investment, i.e., , , and for batteries, photovoltaic panels, and inverter. The maintenance cost is described in Equation (2).
Since the photovoltaic panels produce energy when solar irradiation is available (under fault and also in normal operation), a profit related to the selling of that energy ( ) could contribute As mentioned above, the possible combinations of microgrids are defined by two main aspects: the number of photovoltaic panels and the size of the battery bank; other components of the hybrid system (e.g., the inverter) take a secondary role in determining the sizing of the backup microgrid. Figure 2 shows how each configuration is created to be assessed by the exhaustive search method: each investment possibility for the photovoltaic panels, identified by letters within blue circles, is combined with each of the investment possibilities for the batteries, identified by numbers within green circles. As a result of all combinations, each microgrid configuration to be evaluated is defined by the letter and number of their main components, within yellow circles. To choose the best microgrid configuration from a set of possible configurations (yellow circles), two indexes are proposed in this work. They allow the compromise analysis between the economic value of the investment and the unavailable time of the ASS due to any contingency of the main system.

Economic Assessment
The total net cost will be used as an investment index for each possible microgrid configuration represented by the index s. This cost includes the cost of the batteries, the cost of the photovoltaic panel system, and the cost of the inverter. The latter is added, given its large proportion within the overall costs in hybrid systems.
For each case, the investment is calculated according to the number of components of the microgrid.
For batteries, the cost is calculated based on their nominal storage capacity (E bat s ), measured in kWh. The photovoltaic panels cost is calculated according to the units used on each microgrid s (N pv s ), whilst the bidirectional inverter cost is calculated according to its power in kW P In s . Thus, the total investment value I s for a microgrid configuration s is given by Equation (1). The equipment costs are c bat , c pv , and c In for batteries, photovoltaic panels, and inverter, respectively. In addition to the investment costs in the microgrid, maintenance costs are also considered through the years of the equipment's lifespan (τ). For this purpose, the costs are brought to a present value at an interest rate δ. The annual maintenance cost for each equipment corresponds to a fraction of its investment, i.e., mc bat , mc pv , and mc in for batteries, photovoltaic panels, and inverter. The maintenance cost is described in Equation (2).
Since the photovoltaic panels produce energy when solar irradiation is available (under fault and also in normal operation), a profit related to the selling of that energy (Pro f it PV ) could contribute to reducing the total cost. That profit is calculated by Equation (3) in terms of the mean annual energy generated by a photovoltaic panel (E PV ) and the energy price (π).
Energies 2020, 13, x FOR PEER REVIEW 7 of 23 to reducing the total cost. That profit is calculated by Equation (3) in terms of the mean annual energy generated by a photovoltaic panel ( ) and the energy price ( ). Finally, the economic index is the total cost of the system ( ), which corresponds to the sum of the investment and the maintenance costs, as shown in Equation (4).

Assessment of ASS Unavailability
Generally, the main system for supplying ASS is the distribution system. It is characterized by having a radial topology, where each consumer has a single supply path. This principle is equally scalable when it is the distribution system that supplies the ASS. However, the distribution networks Finally, the economic index is the total cost of the system (TC s ), which corresponds to the sum of the investment and the maintenance costs, as shown in Equation (4).

Assessment of ASS Unavailability
Generally, the main system for supplying ASS is the distribution system. It is characterized by having a radial topology, where each consumer has a single supply path. This principle is equally scalable when it is the distribution system that supplies the ASS. However, the distribution networks are the main source of interruptions in the power system [26], accounting for around 80% of the interruptions [27]. Moreover, in general, there has been an increase in the monthly half of outages in the United States from 2.5 to 14.5 in the period 2000-2013 [28]. The expectation is that the frequency and severity of the absences will continue to increase [13].
Thus, this paper proposed a method to size the microgrid aiming for the reduction of the impact of distribution system contingencies in the operation of ASS. For this purpose, the contingencies of the main supply system are characterized by their frequencies and durations [27]. These values can be obtained from statistical studies of the distribution system operator or, in the absence of data, can be considered expected values following a normal distribution function.
The unavailability index represents the expected proportion of hours that the substation's auxiliary services will be out of operation for a specific microgrid configuration. For the calculation of this index, it is assumed that (a) the main service feeder of the substation load has a known annual contingency rate λ; and (b) each contingency is characterized by a random duration, which follows a known probability function.
Given the random behavior of the contingency duration and the energy supplied by the photovoltaic panels, it is not possible to guarantee that the available energy of the microgrid in the contingency state is always enough to supply the ASS. Figure 3 shows the most probable cases when the microgrid acts as an autonomous backup for the ASS: (a) the available energy of the microgrid is equal or larger than the ASS energy requirement for the contingency duration of the main supply system, and (b) the microgrid does not have enough energy and therefore the ASS will be unavailable for a time smaller than the duration of the contingency. the United States from 2.5 to 14.5 in the period 2000-2013 [28]. The expectation is that the frequency and severity of the absences will continue to increase [13]. Thus, this paper proposed a method to size the microgrid aiming for the reduction of the impact of distribution system contingencies in the operation of ASS. For this purpose, the contingencies of the main supply system are characterized by their frequencies and durations [27]. These values can be obtained from statistical studies of the distribution system operator or, in the absence of data, can be considered expected values following a normal distribution function.
The unavailability index represents the expected proportion of hours that the substation's auxiliary services will be out of operation for a specific microgrid configuration. For the calculation of this index, it is assumed that (a) the main service feeder of the substation load has a known annual contingency rate ; and (b) each contingency is characterized by a random duration, which follows a known probability function.
Given the random behavior of the contingency duration and the energy supplied by the photovoltaic panels, it is not possible to guarantee that the available energy of the microgrid in the contingency state is always enough to supply the ASS. Figure 3 shows the most probable cases when the microgrid acts as an autonomous backup for the ASS: (a) the available energy of the microgrid is equal or larger than the ASS energy requirement for the contingency duration of the main supply system, and (b) the microgrid does not have enough energy and therefore the ASS will be unavailable for a time smaller than the duration of the contingency. The calculation of the unavailability time of ASS , for a contingency j considering these two possible cases, is detailed for a microgrid configuration s. The contingency j has a duration ; the microgrid s has an availability time dependent on the weather conditions at the time of the contingency, and the contingency starts at time . Thus, the microgrid has an amount of energy such that: a. The availability time of the microgrid is equal or longer than the contingency duration ≥ . In this case, is zero.
b. The availability time of the microgrid is shorter than the duration of the contingency < . In this case, is equal to the difference between the duration of the contingency and the availability time of the microgrid, i.e., = − .
The calculation of the unavailability index assesses the proportion of the unavailable time for the ASS concerning a large number of operating hours of the microgrid. Thus, the numerator The calculation of the unavailability time of ASS t Ind j , for a contingency j considering these two possible cases, is detailed for a microgrid configuration s. The contingency j has a duration t out j ; the microgrid s has an availability time tm s j dependent on the weather conditions at the time of the contingency, and the contingency starts at time t 0 j . Thus, the microgrid has an amount of energy such that: a.
The availability time of the microgrid is equal or longer than the contingency duration tm s j ≥ t out j . In this case, t Ind j is zero.
Energies 2020, 13, 6037 The availability time of the microgrid is shorter than the duration of the contingency tm s j < t out j . In this case, t Ind j is equal to the difference between the duration of the contingency and the availability time of the microgrid, i.e., t Ind j = t out j − tm s j .
The calculation of the unavailability index I s ind assesses the proportion of the unavailable time for the ASS concerning a large number of operating hours of the microgrid. Thus, the numerator calculates the total number of unavailable hours of a microgrid configuration s as the sum of the unavailable time for each contingency t Ind j . The number of contingencies is defined as the product of the expected feeder contingency rate of the distribution network λ and the number of years to be simulated N years . The denominator of the index defines the number of hours of simulation as the product between a large number of years of operation N years and the parameter α, which is the number of hours in a year. Based on the above, the unavailability index can be expressed by Equation (5). An availability index can be also formulated by Equation (6).

Energy Analysis for the Autonomous Service of Auxiliary Services
To determine the unavailability time in each interruption it is important to know both the energy requested by the ASS loads and the total energy available from the microgrid, which depends on the energy in the battery system and the energy generated by the photovoltaic panels during the contingency. Both energy components are described in this subsection.

Energy Requested by Auxiliary Services of the Substation
The ASS loads can be divided into three subgroups: permanent loads that are related to the equipment connected continuously as the protection, measurement, and communication devices; temporary loads with high power requirements of short duration and necessary for the reestablishment of service in the substation, e.g., drive motors; and instantaneous loads that are sources of high power requirements in extremely short periods. A representation of these types of loads and their durations is presented on the left of Figure 4 in which permanent loads are represented by green bars, temporary loads by yellow bars, and instantaneous loads by red bars.
Although it is desired to divide the representation of the contingency duration into smaller intervals, each with its own requested power level, it is not practical in terms of planning when considering the uncertainty in the duration of the contingency. Because of that, an equivalent load factor is used to approximate the ASS load requirements. This factor is obtained using the equivalence between energy consumption in Figure 4 as follows: 1.
Each demand level for period t, on the left-hand side of Figure 4 can be represented in terms of a load factor f i related to the nominal power of ASS, i.e., P t = f t · P nom . Thus, the total energy required by ASS for the contingency illustrated in Figure 4 is equal to Equivalently, the power level related to the right-hand side of Figure 4 can be expressed in terms of a global factor F g related to the nominal power of ASS, i.e., P eq = F g · P nom . Consequently, the total energy required by ASS for the contingency of Figure 4 is equal to E ASS = P eq · tm s Since the energy required by ASS is the same for both representations in Figure 4 the load factor for this example is Generalizing the calculation above, the general load factor can be written as shown in Equation (7): Thus, in the proposed method, the nominal power of ASS P nom and the global load factor F g allow determining the supplied energy by the microgrid in each contingency state using Equation (8).

Energy Analysis for the Autonomous Service of Auxiliary Services
To determine the unavailability time in each interruption it is important to know both the energy requested by the ASS loads and the total energy available from the microgrid, which depends on the energy in the battery system and the energy generated by the photovoltaic panels during the contingency. Both energy components are described in this subsection.

Energy Requested by Auxiliary Services of the Substation
The ASS loads can be divided into three subgroups: permanent loads that are related to the equipment connected continuously as the protection, measurement, and communication devices; temporary loads with high power requirements of short duration and necessary for the reestablishment of service in the substation, e.g., drive motors; and instantaneous loads that are sources of high power requirements in extremely short periods. A representation of these types of loads and their durations is presented on the left of Figure 4 in which permanent loads are represented by green bars, temporary loads by yellow bars, and instantaneous loads by red bars. Although it is desired to divide the representation of the contingency duration into smaller intervals, each with its own requested power level, it is not practical in terms of planning when considering the uncertainty in the duration of the contingency. Because of that, an equivalent load factor is used to approximate the ASS load requirements. This factor is obtained using the equivalence between energy consumption in Figure 4 as follows: 1. Each demand level for period t, on the left-hand side of Figure 4 can be represented in terms of a load factor related to the nominal power of ASS, i.e., = ⋅ . Thus, the total energy required by ASS for the contingency illustrated in Figure 4 is equal to = ⋅ + ⋅ + ⋅ + ⋅ = ( ⋅ + ⋅ + ⋅ + ⋅ ).
2. Equivalently, the power level related to the right-hand side of Figure 4 can be expressed in terms of a global factor related to the nominal power of ASS, i.e., = ⋅ . Consequently, the total energy required by ASS for the contingency of Figure 4 is equal to

Energy Generated by the Photovoltaic System
The operation of the photovoltaic system determines the power generated by the panels based on solar irradiation values and depending on the temperature of the solar cell. The relation between the solar irradiance and the output power of a solar generating source can be described by the set of Equations (9)-(13) [29].
Equation (9) calculates the temperature in the photovoltaic cell T c in terms of the ambient temperature T a , the nominal operating temperature of the cell N OT , and the solar irradiation G gh . Equation (10) calculates the current provided by the photovoltaic cell as a function of its temperature and the temperature coefficient for the current K i . Similarly, the voltage of the photovoltaic cell is calculated using Equation (11) as a function of T c and the temperature coefficient for the voltage K v . The cell efficiency is determined by the fill factor, calculated in Equation (12), in which I MPPT is the current at the maximum power point and V MPPT is the voltage at the maximum power point.
The previous equations allow the calculation of the output power of a set of solar cells P oper pv , corresponding to the product of the output power of each cell and the number of panels of the configuration N PV . Consequently, it is possible to calculate the energy generated by the panels for a desired time interval, i.e., the island operation mode of the microgrid tm s j as given by Equation (14).

Energy Available from the Storage System
A disadvantage of photovoltaic panels is that their generated energy must be consumed instantly. Moreover, given their dependence on weather conditions, it cannot be guaranteed that they are always continuous, which makes photovoltaic panels irregular and unreliable. Due to the above considerations, electrical energy storage systems are necessary to make better use of the power generated by the photovoltaic system, improving the availability and quality of energy.
In this work, a set of batteries is used as a storage system to jointly act in the microgrid to support the ASS. The use of batteries allows the microgrid to have a controlled power output, capable of reliably providing power to the ASS whenever necessary. For this purpose, it is assumed that the battery is always charged, and its capacity is available to support the ASS. Hence, the available energy of the battery E bat is expressed in Equation (15), in which η out represents the round-trip efficiency of the battery, E bat is the nominal capacity of the battery, and DoD represents the depth of discharge.

Bi-Directional Inverter
A bidirectional inverter with the ability to operate in grid-connected and island mode is required to operate the microgrid. The inverter allows the operation of the microgrid in autonomous mode to increase the time availability of ASS, the use of the energy of the main grid for charging the batteries, as well as the injection of the power of the solar panels into the main grid. Figure 5 illustrates the bidirectional flows that allow the inverter, either to feed the microgrid into the ASS loads or to subtract or inject power into the main grid from the photovoltaic system. charged, and its capacity is available to support the ASS. Hence, the available energy of the battery is expressed in Equation (15), in which represents the round-trip efficiency of the battery, is the nominal capacity of the battery, and represents the depth of discharge.

Bi-Directional Inverter
A bidirectional inverter with the ability to operate in grid-connected and island mode is required to operate the microgrid. The inverter allows the operation of the microgrid in autonomous mode to increase the time availability of ASS, the use of the energy of the main grid for charging the batteries, as well as the injection of the power of the solar panels into the main grid. Figure 5 illustrates the bidirectional flows that allow the inverter, either to feed the microgrid into the ASS loads or to subtract or inject power into the main grid from the photovoltaic system.
Thus, the inverter controls the operation of the microgrid, determining the input and output flows of each of the distributed sources to feed the ASS loads. To define the necessary inverter capacity in the proposed microgrid, two quantities are considered: the installed power of the photovoltaic panels and the maximum power of the ASS loads. Equation (16) summarizes the criteria to choose the inverter capacity.

Capacity Sizing Method
The solution strategy proposed in this paper for the capacity sizing of the hybrid microgrid is summarized in Figure 6. It calculates economic and unavailability indexes for each of the feasible configurations of the main components of the microgrid. The calculation of the economic index is direct and depends on the dimensions of the two main components of the microgrid: battery banks proposed microgrid, two quantities are considered: the installed power of the photovoltaic panels P PV s and the maximum power of the ASS loads. Equation (16) summarizes the criteria to choose the inverter capacity. P In s = max P PV s , P eq (16)

Capacity Sizing Method
The solution strategy proposed in this paper for the capacity sizing of the hybrid microgrid is summarized in Figure 6. It calculates economic and unavailability indexes for each of the feasible configurations of the main components of the microgrid. The calculation of the economic index is direct and depends on the dimensions of the two main components of the microgrid: battery banks and photovoltaic panels. On the other hand, the unavailability index is dependent on the capacity of the microgrid in dealing with feeder contingencies, which have a random duration behavior. Thus, the well-established Monte Carlo simulation method [30] is used here to calculate the total unavailability time for each of the possible microgrid configurations under evaluation. The details of the simulation procedure to calculate the unavailability index in Equation (5) are described below:

1.
Identify the microgrid configuration to be evaluated from the set of configurations (solar panel/battery banks).

2.
Determine the expected value of the substation feeder failure rate λ.

3.
Define the number of years to be simulated N years aiming at an appropriate convergence.

4.
Calculate the total number of simulations to be performed, i.e., the product between the total number of years to be simulated and the contingency rate (N years · λ).

5.
Generate the duration of the contingency j t out j , as well as the initial time of the contingency t 0 j according to corresponding density probability functions. 6.
Calculate the amount of energy requested by the ASS in contingency state j.

7.
Calculate the amount of energy available by the batteries in the contingency state j.

8.
Calculate the amount of available energy from photovoltaic panels in contingency state j.

9.
Determine the difference between the energy required by the substation and the available energy by the microgrid. If the difference is positive, i.e., the hybrid system is unable to supply the ASS load during the entire contingency state j. The microgrid's autonomy time tm s j is calculated by equating the available energy with the energy consumed by the load from t out j to tm s j , as follows: a. Calculate tm s j as the solution of Equation (17).
b. Take t ind j as the difference between t out j and tm s j if it is positive, i.e., t ind j = max t out j − tm s j , 0 .
10. Accumulate the total unavailable time t ind j using Equation (5). 11. Repeat steps 5-10 until all contingencies calculated in step 4 are evaluated. 12. Go back to step 1 and choose a new microgrid configuration to evaluate.  The aforementioned steps are summarized in Figure 7.
The associated optimization problem can be classified as a stochastic non-convex multi-objective problem, whereby the first objective in Equation (18) minimizes the economic index of a microgrid as a backup system for ASS loads, while the second objective in Equation (19) minimizes the expected value index of the ASS unavailability time due to faults in the main supply system. Both objectives present a conflicting nature since small investments in the microgrid leads to longer unavailability times and larger investments results in shorter unavailability times. Both objectives are subject to the set constraints (7)- (17), summarized in Equation (20), which are related to the operation of the power resources of the microgrid, ASS loads, and the autonomous operation of the microgrid for the contingency states of the ASS main supply.
Minimize TC s Minimize I disp s (19) subject to: Operation of the power resources of the microgrid ASS load constraints Autonomous operation of the microgrid for contingencies (20)

Case Study
The proposed method was applied to define the best combination of batteries and photovoltaic panels for a microgrid by assessing the economic and unavailability indexes presented in Section 2. To consider the randomized behavior of the photovoltaic generation and the duration of the contingencies, Monte Carlo simulations were executed in a computer with an Intel i7-7700K processor using MATLAB [31].

Case Study
The proposed method was applied to define the best combination of batteries and photovoltaic panels for a microgrid by assessing the economic and unavailability indexes presented in Section 2. To consider the randomized behavior of the photovoltaic generation and the duration of the contingencies, Monte Carlo simulations were executed in a computer with an Intel i7-7700K processor using MATLAB [31].
Results of the economic and unavailability indexes for four cases: The ASS loads are divided into three large groups, each one with nominal power, total power, and load factor, as shown in Table 1. The topology of the sized microgrid is shown in Figure 8. Results of the economic and unavailability indexes for four cases: The ASS loads are divided into three large groups, each one with nominal power, total power, and load factor, as shown in Table 1. The topology of the sized microgrid is shown in Figure 8. Based on these data and assuming that the availability time of the microgrid can be divided into four intervals, as illustrated in Figure 4, the global power factor is calculated as shown in Table 2. Load factors for the permanent and temporary loads are in the corresponding interval. It is observed that the temporary loads are in intervals 2 and 4, whereby the power of the circuit breaker is in interval 2 and the drive motors are in interval 4. It is noteworthy that for the global load factor calculation, instantaneous loads are not considered, but are included in the sizing of the inverter. Accordingly, the equivalent power load is equal to 11,918.70 W, which can be rounded to 12 kW.
A state-of-the-art photovoltaic panel manufactured by Panasonic (VBHN330SJ47) was evaluated; it has the highest ratio of power generated per area used [32]. Each panel has 0.33 kWp, a cost per unit equal to $312/panel, and 1% of maintenance cost per year of the total installation cost as considering for the Brazilian commercial sector in 2019 [33]. The relevant data for obtaining the output power for the Panasonic panel model, expressed in (9)- (13), are shown in Table 3, based on the datasheet in [34]. These batteries have a modular capacity of 2 kWh, a cost per kWh equal to 420 $/kWh, a DoD equal to 90%, and a 95% round-trip efficiency. NMC li-ion battery units are considered due to their higher energy density (735 Wh/L) and their low self-discharge (0.1% per day) [11]. Other battery technologies have worst characteristics, as the li-ion NCA, LTO, and LFP (energy density of 620 Wh/L for the LTO option); more importantly, these technologies have a highest cost ($1050/kWh).
Moreover, the inverter cost is 105 $/kW, as suggested in [11]. Also, the maintenance cost for the batteries and inverters are assumed to be 1.5% per year of the total installation cost. A lifespan of 20 years is adopted; the maintenance costs of all equipment are calculated using an interest rate of 6%. Based on these data and assuming that the availability time of the microgrid can be divided into four intervals, as illustrated in Figure 4, the global power factor is calculated as shown in Table 2. Load factors for the permanent and temporary loads are in the corresponding interval. It is observed that the temporary loads are in intervals 2 and 4, whereby the power of the circuit breaker is in interval 2 and the drive motors are in interval 4. It is noteworthy that for the global load factor calculation, instantaneous loads are not considered, but are included in the sizing of the inverter. Accordingly, the equivalent power load is equal to 11,918.70 W, which can be rounded to 12 kW. A state-of-the-art photovoltaic panel manufactured by Panasonic (VBHN330SJ47) was evaluated; it has the highest ratio of power generated per area used [32]. Each panel has 0.33 kWp, a cost per unit equal to $312/panel, and 1% of maintenance cost per year of the total installation cost as considering for the Brazilian commercial sector in 2019 [33]. The relevant data for obtaining the output power for the Panasonic panel model, expressed in (9)- (13), are shown in Table 3, based on the datasheet in [34]. These batteries have a modular capacity of 2 kWh, a cost per kWh equal to 420 $/kWh, a DoD equal to 90%, and a 95% round-trip efficiency. NMC li-ion battery units are considered due to their higher energy density (735 Wh/L) and their low self-discharge (0.1% per day) [11]. Other battery technologies have worst characteristics, as the li-ion NCA, LTO, and LFP (energy density of 620 Wh/L for the LTO option); more importantly, these technologies have a highest cost ($1050/kWh). Table 3. Information of the photovoltaic panel.

Characteristic Data
Cost 312 ($/unit) Moreover, the inverter cost is 105 $/kW, as suggested in [11]. Also, the maintenance cost for the batteries and inverters are assumed to be 1.5% per year of the total installation cost. A lifespan of 20 years is adopted; the maintenance costs of all equipment are calculated using an interest rate of 6%. The energy price is 0.05 $/kWh.
The calculation of the unavailability index was done considering that the contingency durations follow a normal distribution with a mean equal to 5 h and a standard deviation equal to 3 h [35,36]. To guarantee the Monte Carlo convergence, the simulations are carried out for 5000 years. A total of 12,000 photovoltaic irradiation profiles, with a one-minute resolution, were generated using the CREST tool [37], corresponding to 100 monthly profiles; hourly temperature data for one year (2019) was obtained from the Renewables. Ninja online tool in [38]. Those profiles were generated using the geographical information of São Paulo city in Brazil.
With that information, the combination of technologies is analyzed from zero up to 96 battery modules (roughly 16 h of the ASS load) and from zero up to 110 photovoltaic panels (three times the ASS load).

Case I: Unavailability Index Goal
The optimal size of the solar photovoltaic and batteries is obtained in this case considering a goal of 0.003% for the unavailability index and adopting a fault rate equal to 1 for the feeder of the distribution system. Figure 9 shows the summary results of the unavailability index for each possible configuration of the microgrid. It is clear the inverse relationship between the number of energy resources in the microgrid and the unavailability index, i.e., as more capacity is installed in the microgrid, less time the ASS is unavailable in a contingency state. It is worth mentioning that the number of photovoltaic panels does not generate much influence on the index, contrary to what happens with batteries, whereby the addition of some units produces significant improvements in the index. This fact is explained by the climate dependence on the generation of power of photovoltaic panels and the availability of energy from batteries, which only depends on their state of charge.
hand, environmental concerns could inhibit the adoption of a technology that produces green-house emissions (although a small value). Moreover, operation policies could require two or more different backup alternatives, meaning that just a diesel generator would be insufficient to complain that kind of policy. For the particular Brazilian case, the regulation requires that at least two independent sources supply the ASS [41].

Case II: Limited Budget
The optimal size of the photovoltaic panel system and the batteries, in this case, is obtained considering that a limited budget of $40,000 for the economic index. The assumptions for calculating the unavailability are the same as in Case I.
As highlighted in the previous case of study, an increase in the size of the equipment brings a reduction in the index of unavailability. On the other hand, larger dimensions of the equipment require a higher investment, as shown in Figure 10. Thus, on many practical occasions, decisionmakers have an investment limit to achieve the lowest values of the unavailability index. Since the budget limitation should be enforced, the solution for this case is the combination that provides the best unavailability index that does not have a total cost above the budget limit. That solution defines the use of the 43 battery modules and 55 photovoltaic panels, leading to an unavailability index of 0.0046%. Note that this solution, shown by the black circle in Figure 10, is worse than the one found in Case I but has an economic index equal to $39,970. It is worthy to highlight that to satisfy the budget limit, fewer battery modules but more photovoltaic panels should be installed. The red line in Figure 9 indicates the solutions that reach the requested unavailability goal. Solutions on the left of that line do not satisfy the goal. From the set of feasible solutions, the one with 48 battery modules and 55 photovoltaic panels, represented by the black circle in Figure 9, has the best economic index ($44.172), i.e., it satisfies the unavailability goal and has the lowest total cost.
The worst unavailability index is the case when no batteries neither photovoltaic panels are present (0.0520%). On the other hand, 96 battery modules and 110 photovoltaic panels result in the lowest unavailability index (0%) but with an economic index of $88,344.
These solutions could be compared to a conventional backup diesel generator, which for a 12 kW/15 kVA power has a cost of about $3000 and consumes approximately 3.2 L/h [39]. Adopting a diesel price in Brazil of $0.55/L and considering that the expected number of fault hours per year is 5, the expected operation and maintenance cost of the diesel generator across the 20-year horizon is just $270.93 [39,40]. Therefore, an equivalent economic index would be just $3270.93. Although that value is just a fraction of the best economic index solution in Figure 9, it is worthy to highlight that the integration of a diesel generator in the microgrid has some disadvantages such as the need for safe storage and handling of 32 L of diesel to keep the service for faults up to ten hours. On the other hand, environmental concerns could inhibit the adoption of a technology that produces green-house emissions (although a small value). Moreover, operation policies could require two or more different backup alternatives, meaning that just a diesel generator would be insufficient to complain that kind of policy. For the particular Brazilian case, the regulation requires that at least two independent sources supply the ASS [41].

Case II: Limited Budget
The optimal size of the photovoltaic panel system and the batteries, in this case, is obtained considering that a limited budget of $40,000 for the economic index. The assumptions for calculating the unavailability are the same as in Case I.
As highlighted in the previous case of study, an increase in the size of the equipment brings a reduction in the index of unavailability. On the other hand, larger dimensions of the equipment require a higher investment, as shown in Figure 10. Thus, on many practical occasions, decision-makers have an investment limit to achieve the lowest values of the unavailability index. Since the budget limitation should be enforced, the solution for this case is the combination that provides the best unavailability index that does not have a total cost above the budget limit. That solution defines the use of the 43 battery modules and 55 photovoltaic panels, leading to an unavailability index of 0.0046%. Note that this solution, shown by the black circle in Figure 10, is worse than the one found in Case I but has an economic index equal to $39,970. It is worthy to highlight that to satisfy the budget limit, fewer battery modules but more photovoltaic panels should be installed.

Case III: Sensitivity Analysis for the Variation of Fault Rate
One of the most crucial parameters in the unavailability of ASS is the annual fault rate of the distribution system feeder, which in normal operation state supplies the ASS loads. Therefore, different values for the fault rate are analyzed here to find its influence on the microgrid sizing. The same unavailability index goal for Case I is used to defining the best solution for each fault rate. Table 4 presents the results obtained from the variation of the annual fault rate, in which is possible to verify that to maintain the same level of unavailability, more battery modules are required. It is observed that the economic index increases with the fault rate. It is worthy to highlight that the number of battery modules increases to maintain the required unavailability index; on the other hand, the number of photovoltaic panels varies without a clear trend, being reduced in some cases to save costs without compromising the goal.

Case IV: Sensitivity Analysis for the Variation of Fault Duration
The duration of interruptions affecting the feeder of the distribution system, which in normal operating state supplies the ASS loads, has a direct relation with the size of the microgrid. Therefore, different values for fault duration are analyzed here in order to find their influence on the microgrid sizing. The same unavailability index objective for Case I is used to define the best solution. Table 5 presents the results obtained from the variation of the fault duration; the mean fault duration is shown in the first column and the standard deviation is changed proportionally. It is possible to verify that, to maintain the same level of unavailability, more battery modules are needed. It is observed that the economic index also increases with the failure duration. The number of battery modules increases to maintain the necessary unavailability rate; moreover, the number of

Case III: Sensitivity Analysis for the Variation of Fault Rate
One of the most crucial parameters in the unavailability of ASS is the annual fault rate of the distribution system feeder, which in normal operation state supplies the ASS loads. Therefore, different values for the fault rate are analyzed here to find its influence on the microgrid sizing. The same unavailability index goal for Case I is used to defining the best solution for each fault rate. Table 4 presents the results obtained from the variation of the annual fault rate, in which is possible to verify that to maintain the same level of unavailability, more battery modules are required. It is observed that the economic index increases with the fault rate. It is worthy to highlight that the number of battery modules increases to maintain the required unavailability index; on the other hand, the number of photovoltaic panels varies without a clear trend, being reduced in some cases to save costs without compromising the goal.

Case IV: Sensitivity Analysis for the Variation of Fault Duration
The duration of interruptions affecting the feeder of the distribution system, which in normal operating state supplies the ASS loads, has a direct relation with the size of the microgrid. Therefore, different values for fault duration are analyzed here in order to find their influence on the microgrid sizing. The same unavailability index objective for Case I is used to define the best solution. Table 5 presents the results obtained from the variation of the fault duration; the mean fault duration is shown in the first column and the standard deviation is changed proportionally. It is possible to verify that, to maintain the same level of unavailability, more battery modules are needed. It is observed that the economic index also increases with the failure duration. The number of battery modules increases to maintain the necessary unavailability rate; moreover, the number of photovoltaic panels also increases. If the mean fault duration increases from 5 to 10 h, the economic index becomes 95% larger. On the other hand, an improvement in the fault duration from 5 h to 1 h leads to a cost reduction of more than six times. This highlights that an enhancement of feeder reliability results in lower microgrid costs.

Case V: Sensitivity Analysis for the Variation of Battery and Photovoltaic Panel Prices
Given that the adoption of economies of scale foresees a decrease in the prices of photovoltaic panels and batteries, it is important to analyze the influence of the prices of such equipment in the sizing of the microgrid. For that purpose, price variations from 75% up to 125% of the base photovoltaic panels cost are analyzed (see Table 6). Moreover, price variations from 50% up to 125% of the base battery module cost are analyzed (see Table 7). The same assumptions for the unavailability index goal in Case I are adopted here. All solutions shown have an unavailability index equal to 0.003%, i.e., all satisfy the requested goal. Higher costs for photovoltaic panels result in a relatively small increase in the economic index but causing the selection of lower panels (27 for a 25% increase). On the other hand, a 25% price reduction leads to using almost all panels studied (110) and has a reduction of almost 15% in the economic index.
Regarding battery modules, there is an influence of the price on the solution, but it is not so strong as seen with the photovoltaic panels. The number of battery modules increases by only two units when the price is reduced by 50%. However, it is remarkable the reduction in the economic index (36%) since the corresponding solution requires less photovoltaic panels. This indicates that, with the Energies 2020, 13, 6037 20 of 23 ongoing reduction in energy storage prices, technology would be the most cost-effective alternative to supply ASS in substations under a contingency.

Conclusions
This paper addresses the optimal sizing of a microgrid for the reserve supply of the substation's auxiliary services intending to reduce the time of unavailability of these loads when the main supply is under contingency. Unlike other backup systems, which usually use diesel generators, the backup microgrid is formed by the integration of environmentally friendly technologies such as photovoltaic panels together with battery systems as a unique distributed generation unit named microgrid, which increases the backup system dispatchability.
To deal with the high cost of batteries and the intermittence of photovoltaic generation, a careful analysis determines the capacity of the microgrid identifying the best compromise between the investment and the reduction of the unavailability of auxiliary services. For this purpose, two indexes are proposed to evaluate a set of multiple alternatives using an exhaustive search and Monte Carlo simulations to address the uncertainties of contingencies and variations in solar irradiation.
One of the indexes determines the economic value of the main elements of the microgrid such as the photovoltaic panels, the batteries, and the inverter. Furthermore, an index of unavailability is proposed to measure the contribution of the integrated hybrid microgrid to reduce the time in which the substation is unavailable. The results show the conflicting relationship between both indexes, where a decrease in the unavailability index leads to an increase in the economic index. Hence, the optimal size of the microgrid components is determined by the achievement of the target in the unavailability index with the lowest cost. Besides, the results show the importance of batteries to increase the availability of auxiliary services of the substation above the photovoltaic panels.
Future works may consider the possibility of using the microgrid as the main system for supplying auxiliary services in the substation, considering other components of storage and generation, such as fuel cells, hydrogen storage, and electric vehicles, among others.