Microgrids operation by considering Demand response and Supply programs in the presence of IGDT-Based Reverse Risk

Concerning the advantages of smart microgrids and the importance of selecting and using technologies accustomed to optimized planning and design of typology and capacity of supplies, demand response programs, and energy-storage charges, the existing research has focused on the optimized design of microgrids using ant colony optimization algorithm. Conditions of the optimization problem are enacted on the objective function based on technical and operational limitations of supplies and microgrids, which may lead to the limitation of response space of the problem. Additionally, a methodology is proposed for modeling and analyzing a novel design to consider the uncertainty of production and demand with reverse risk in the design of residential microgrids. The proposed methodology focuses on the uncertainty of photovoltaic production and load demand by solving two-dimensional multipurpose optimization problems based on information gap decision theory (IGDT). In the mentioned approach, the photovoltaic generation’s uncertainty and charge are integrated into an equation to be solved as a problem. Regardless of the likelihood density function of uncertainty parameters and without preparing a firm framework, the current method integrates wind and photovoltaic production into the microgrids. The results of the mentioned method are conclusive, which makes the problems solvable.


I. INTRODUCTION
Due to various equipment installed in microgrids, and different types of technology, capacity, technical parameters, investment expenses, and productivity, there is a wide range of responses to microgrid design problems. So, to find the optimized response, the design problem of microgrids can be stated as an optimization problem aimed at minimizing of expenses of microgrid design. In recent research, it has been attempted to design an optimized model of microgrids. Nevertheless, a few types of research 2 have focused on optimized modeling of residential microgrids. The optimized design of microgrids has been investigated as a case study. Robust optimization has been used for local distributed generation units to minimize investment, productivity, and pollution expenses [1]. Capacity planning is investigated separately [2]. Determination of optimized energy storage capacity in microgrids to minimize expenses is investigated [3]. The environmental effects of installing wind and photovoltaic units and diesel units in remote microgrids are investigated [4,5]. An optimal microgrid design was established considering load and PV power output uncertainties to promote the supply-demand balance using the particle swarm optimization (PSO) algorithm [6]. Some other papers have studied the multi-objective problem in multigrid networks. Ref [7] designed a market operator (MO) and a distribution network operator (DNO) for a network of microgrids in consideration of multiple objectives. In [8], a new market mechanism has proposed to quantify the value of emergency energy transactions in renewable-based multi-microgrid (MMG) systems. Ref [9] addressed the energy dispatch problem for multi-stakeholder multiple microgrids (MMGs) under uncertainty while considering independent market operators (IMOs). Ref [10] has done an optimal design of microgrid considering the dynamic state of distribution units by distributed particle filter (DPF) technique. The development design of microgrids, including distributed generation units and CHP, is investigated to minimize investment, productivity, and pollution expenses in microgrids [11]. A novel method is proposed for the design and productivity of microgrids connected to the network. The mentioned method is based on a decision tree [12]. In the research, as mentioned earlier, the design of microgrids is generally discussed, and there has not been a point related to residential microgrids. The optimized capacity of photovoltaic units and batteries installed in residential microgrids is calculated to minimize annual expenses [13]. A residential microgrid model including wind-power and photovoltaic units is discussed. The design problem of residential microgrids is expressed as an optimization problem in this research which is investigated using PSCAD in order to evaluate the effect of these units and other parameters on the microgrid [14]. In other researches which have focused on the same subject, potential effect of EVs and inflexible charges are investigated [15][16][17][18][19]. Short-term planning of smart grids has been done to find the optimized control on economic distribution in DSM [20][21][22][23][24][25][26][27]. Due to the usage of renewable resources in microgrids, some of the parameters, including spatial factors, temperature, sunray, and wind speed, can affect the output of photovoltaic systems. These parameters can lead to unexpected changes in PV output [28,29]. Under the mentioned conditions, suitable methods and approaches must be used to compensate for the complications arising due to the uncertainty of wind and photovoltaic power plants, which affect the productivity of microgrids. For instance, modeling the uncertainty of renewable resources using random techniques and fuzzy approaches has been investigated in many studies [15,18]. Although advantages of the mentioned techniques have been discussed, these techniques are not free of disadvantages. For instance, random methods such as Monte Carlo [17,19], scenariobased modeling [16,30], and point estimation [20] cannot predict uncertainty without probability density function. The fuzzy technique needs a membership function. Additionally, fuzzy numbers are not easy to work with [21]. Recently, information gap decision theory (IGDT) has been a promising method for applicable industrial programs in order to deal with uncertainty. Specially, power system engineers who try to reduce productivity expenses are into using the mentioned method, IGDT. Accordingly, this theory is no dependent upon information related to past inclination of uncertainty parameters [22,23]. For instance, options of purchasing energy for retailers and wholesalers are mentioned by [24] and [25] respectively. Optimized production strategies of power markets are mentioned based on IGDT [26]. Additionally, [27] have met demands arisen for huge electric consumption based on IGDT. The known theory of IGDT explains uncertainty of power production in wind plants [23,[31][32][33][34]. However, daily changes of uncertainty parameters are not investigated. Ref [35] focus on IGDT for models based on UC concerning the uncertainty of wind plants and regardless of simultaneous uncertainty. A hierarchical management system of frequency and energy is mentioned, composed of an island microgrid [36]. However, values of uncertainty parameters are not investigated simultaneously. The novelty of this work lies in the creation of an integrated latent model that takes advantage of different aspects and features of energy consumption in modern energy systems. One of the designed microgrid features is that the load flexibility obtained by using demand response smart grid programs that plan high-consuming electrical appliances like washing machines, dryers, dishwashers, and electric cars is intended to user benefit rather than user benefit their random access. In this paper, in order to evaluate the efficiency of the designed microgrid from the economic and reliability perspective, error occurrence and blackout likelihood in residential 3 microgrids are also considered. Due to error in the connection line between the microgrid and the main grid or in the generation units in the microgrid, in some hours the microgrid may not be able to provide part of the consumption load. This leads to subscribers' power outage and blackout which has been considered in the optimal design of the residential microgrid. More importantly, in order to increase the strength and resistance of the designed system, a risk-averse strategy has been used in the face of uncertainty parameters. In this strategy, the uncertainty of the parameters will have a negative impact on the objective function, so that the actual power of the consumption load is greater than the predicted power, and the actual generation power of the renewable units is considered less than their predicted power. The maximum radius of uncertainty in the generation of renewable wind, photovoltaic, and load resources will be achieved by implementing the IGDT method via solving a multi-objective optimization problem, to determine the strength and resilience of the designed microgrid against uncertainty parameters for decision makers. The proposed method considers the uncertainty of photovoltaic and wind power generation and load demand simultaneously with solving the problem of optimizing two-level multi-objective using IGDT theory. At the first level, it is assumed that the predicted value for generating renewable resources and system load demand is equal to their actual values. At this level, the objective function of the problem is the annual cost of the microgrid. After optimizing the problem at the first level and determining the minimum annual cost of the microgrid by considering a critical cost for the objective function to deal with uncertainties, in the second level the maximum radius of uncertainty of wind and photovoltaic units, and consumption load is calculated using IGDT theory so that the microgrid resistance to these uncertainties can be measured. Another feature of this article compared to previous researches is the use of the ant colony optimization algorithm for the stochastic design of residential microgrids due to the existence of discrete variables in problem modeling. Therefore, the operations mentioned above are matched with principles of a smart grid this model can be used for large-scale modeling including operational patterning with no need of burdening calculations.

II. FORMULATION
The recommended method is enacted on a residential microgrid in Okinawa, Japan [37]. The block diagram is shown in Figure 1. Thus, to determine the strength and resistance of the system for supplying the required demand, the maximum uncertainty radius of wind and photovoltaic resources and consumption load are taken into account based on IGDT by solving a multipurpose optimization problem. Time considered in a model is ∆t=1 which is discarded to simplify the equations.

A. POWER BALANCE
According to Figure (1 (2) According to the fact that production of renewable resources fluctuates and can be affected easily, renewable production can be way higher than consumption. Therefore, renewable production can be limited based on the following restrictions which can restrict power distribution: The power which is sold to or purchased from the main grid cannot exceed the maximum amount mentioned in the contract: Generally, u is the only binary variable. This variable restricts purchasing power from and selling power to the main grid, which is impossible in the real world. According to the following equation, the production capacity of 1 kW of wind unit per hour can be Value of the parameters ، and are 3, 10, and 20 m/s, respectively. The diagram is shown in Figure  2 [37]. According to [37], NWT is considered a continuous variable. Production output of 1 kW for a photovoltaic unit can be stated as a function of IG and Ta: In the above equation, IG per hour depends on the solar panel's inclination angle, 30 degrees as the optimized angle [37].

Battery
The balance of energy equation for a batter is explained as follows: In the equation mentioned above, energy stored in the battery at t+1 is a function of energy stored at t and the amount of charge and discharge at t. According to the following equations, energy stored in the battery per hour is limited by the minimum and maximum value of SOC: The total reduction of battery capacity at every time can be calculated as the following: According to the above equation, ZB expresses the linear depreciation coefficient, which is investigated in some research for all battery technologies based on long-term measurement of the electric field in the energy storage system. To make sure that all energy expenses are taken into account, energy stored in the battery at the end of the period must be more than the energy at the beginning: According to the following equations, the charge and discharge battery's power is restricted by technical features of the battery:

C. INVERTER MODEL
According to the following equation, the nominal capacity of the bilateral inverter must be bigger than electrical power passing through the inverter in both directions of AC to DC and vice versa:

D. CONSUMPTION LOAD MODEL
In the current paper, consumption load is explained in three ways: Thermal load: TRNSYS software packages are used to predict the annual thermal load required for a Japanese household living in a 100 m 2 one-story building in Okinawa. According to Figure  3, the consumption load of residential microgrids can be calculated by multiplying the figure's height by the number of houses. Uncontrollable appliances: Every house is laden with uncontrollable appliances such as cooking machines, hairdryers, vacuum cleaners, lighting, and computers. PNCL indicates these devices.

-Controllable loads:
In Table (1), three different patterns of charging time of automobiles are mentioned. According to this modeling methodology, to reduce the problem dimensions and the time required for optimizing consumption loads, both uncontrollable and controllable consumers must be included in the problem. Total consumption load is bigger than or equal to uncontrollable and controllable consumption loads plus unsupplied energy. This equation can be true for every interval at T: In the above relation, , indicates the minimum operational time for m during to ration, which is shown as the following: Some appliances such as washing machines must be kept on continuously when they are supposed to be used. Some other appliances, such as electric cars, do not need to be continuously connected to the network. They can be charged for an hour, and then they can be disconnected. It is possible to charge them later again. In this relation, , indicates maximum continuous hours / ; required for each appliance (m). Additionally, this parameter shows the total hours / ; an appliance is on continuously (such as charging electric cars). According to the following relation, consumption load at ∈ must be bigger than or equal to uncontrollable subtraction loads from unsupplied loads at the same time to make sure that controllable loads are supplied: The following relation shows that for every D-hour period, the total consumption load is equal to the sum of controllable and uncontrollable loads at the same period: Some appliances need a network connection for more than an hour to work. According to table 1, an electric car needs 3 × 2 kWh, which means 2 kWh for 3 hours. Therefore, to prevent responses that may lead to energy accumulation in an hour, for example, 1 × 6 kWh for electric cars, the following relation is used to find the most suitable solution for the problem: Binary coefficient , is calculated based on consumption time:

E. OBJECTIVE FUNCTION
The objective function of the mentioned problem minimizes the annual grid expenses (ACS). Annual grid expenses include purchase, operation, maintenance (O&M), replacement and purchasing power from the main grid, and outage expenses (unsupplied energy). It is worth noting that profit made out of selling power to the grid is taken into account negatively. Accordingly, the objective function for the residential microgrids is defined as: The period is taken three years. In relation (25), ; indicates the loss of battery value reduction due to reduced capacity, and it is expressed as the multiplication of battery capacity at the end of the optimization period by replacement expenses. Photovoltaic and wind units do not need replacement expenses to be considered, while inverters need one replacement. All expenses must be calculated annually (annual value). In (25), all expenses must be mentioned annually to express objective function as the function of annual expenses of the considered grid. Because the microgrid simulation is performed only for one day (T), the amount of power bought 6 from the main grid and sold to the same grid plus unsupplied energy expenses are related to the same day. Therefore, to express the expenses annually, the number of days must be taken into account to calculate the annual operating expenses of the microgrid. Purchase, operation and maintenance expenses, and replacement costs (Table 4) can be indicated in present value. According to [33], the present value coefficient is multiplied by P2A (250). The present value coefficient is calculated as the following: Variables of optimized design for microgrids problem are: Variable 1: installed capacity of wind turbine (N_WT) Variable 2: installed capacity of photovoltaic panels (N_PV) Variable 3: installed capacity of the battery (N_B) Variable 4: installed capacity of the inverter (N_Inv) Variables 5-16: operation hours of appliances as controllable loads, which are expressed as the following: Variable 5: operation hours of appliance 1 (washing machine) Variable 6: operation hours of appliance 2 (cleandryer machine) Variable 7: operation hours of appliance 3 (dishwasher) Variables 8-10: operation hours of appliance 4 (EV1 car) which is 3 hours Variables 11-13: operation hours of appliance 5 (EV2 car) which is 3 hours Variables 14-16: operation hours of appliance 6 (EV3 car) which is 3 hours Accordingly, variables of the optimization problem can be expressed as = [ 1 , 2 , … , , … , −1 , ]; in which has gotten 16 members. Variables 5-16 are related to the operation time of controllable appliances. Operation time is calculated by the ACO optimization algorithm, which is generally used to control when response loads are connected to the microgrid. ACO flowchart is shown in Figure 4.

III. INFORMATION GAP-BASED DECISION THEORY
IGDT method can compensate uncertainty of information-deficit problems to make the optimized decision [22]. The strength function expresses the most considerable uncertainty (failure is impossible) [31,38]. Assume that the indefinite input parameters vector is indicated by R. Then, X can be a set of decision variables, and can show a set of uncertainty. Unknown input parameters behave like the following: In the above mentioned, shows the uncertainty parameter and is the predicted value of the uncertainty parameter.
indicates the maximum deviation of the uncertainty parameter from the predicted value. This coefficient is called uncertainty radius. Accordingly, the strength function is: , , In the above relation, ( , ); symbolizes the system model. The least requirement of the system can be set by RC. Strength function is shown bŷ( , ).
It is worth noting that strength value is dependent on decision variables and the least requirements asked by RC. According to the mentioned relation, the general optimization problem is:   (31) It is stated that there are no differences between uncertainty and predicted parameters: The initial value of the objective function shown by fo can be calculated via (34) Λ c shows the critical value that the objective function cannot exceed. Although this parameter can be defined based on decision making requirements, it is defined as a sub-function of f0. Also, ς c is a positive parameter that is set by decision-makers to be used to define the critical value of Λ c . Therefore, the mentioned strategy, which is defined for the EMS model, can be expressed as the following: J 0 indicates the total expenses of the microgrid design (25). On the other hand, it is assumed that the output power of wind and photovoltaic units and power demands are not matched with the predicted values.
According to reverse risk, power generation of wind and photovoltaic units is less than the predicted values, while system demand is more than the predicted demands. Accordingly, the following relations are added to the existing ones: , , In the above relations, ω pv and ω pd indicate weighted factors for objective functions ξ pv and ξ pd , respectively. It is worth stating that different methods solve multipurpose optimization problems. Among the available methods, we can point to weighted sum, fussy method, and ϵ-limitation methods [39].
According to the fact that the weighted sum is simplified [40], it is used in this study to calculate demand and supply simultaneously. It is worth noting that results obtained from weighted sum can be generalized due to conditions used in the mentioned method.
Accordingly, other multipurpose optimization methods can provide the same solutions [41].

IV. RISK AVERSION OF IGDT BASED ON MICROGRID DESIGN
The following steps should be mentioned to examine the proposed model:

9
Step 1: preparing classified input information as known and predicted data. Available information includes equipment price, equipment features, uncontrollable loads, battery parameters, and inverter parameters. Predicted data for the daily generation of wind and photovoltaic units can be counted as input.
Step 2: according to the inputs prepared in the previous step and formulation of microgrid design, the ACO algorithm named optimization motor triggers problem solving and determination of the optimized equipment sizes and the optimized distribution according to technical requirements mentioned in the previous sections. Then, optimized total expenses can be sent to the following step. It is worth noting that some of the restrictions enacted on the microgrid design are used in the following steps. These restrictions can be taken as the output. This step's number of optimization variables is 16 decision-making variables defined in section 2.
Step 3: the worsening extent of the objective function is selected to determine the exact threshold for total expenses in the face of uncertainty of renewable generation. Decision-makers set the threshold.
Step 4: IGDT can maximize the uncertainty radius of wind and photovoltaic generation based on the ACO algorithm. At the same time, load demand is met based on different restrictions mentioned in step 2 and enacted in step 3 to satisfy the system. The number of optimization variables of this step is 16 decision-making variables mentioned in step 1, 3 decision-making variables mentioned for uncertainty radius of wind and photovoltaic units and consumption load. The maximum value of these three variables is set to maximize objective function in 43 to prevent design expenses from exceeding critical value. The operational results determine the specific interval of demand and supply. Additionally, precise decision-making about equipment and its distribution is done. The Flowchart mentioned for the following steps can be seen in Figure 5. It is worth noting that the microgrid model can be explained as the summation of the relations mentioned in 48:

V.SIMULATION RESULTS
A simulation of the proposed method has been done for a residential microgrid in Okinawa, Japan [37], as shown in Figure 1. Ant colony optimization (ACO) in MATLAB has been used to simulate the method. The total consumption load for this microgrid is 4000 kWh for 24 hours. The number of subscribers connected to the microgrid is 266. Accordingly, the consumption load of every subscriber is 15 kWh in 24 hours. The effect of controllable loads can be expressed as a percentage of uncontrollable loads. Therefore, demand response is evaluated in 4 steps in which the percentage of controllable demand to consumption load ratio are 0%, 15%, 30%, and 45%, respectively. The diagram of the uncontrollable load is shown in Figure 6 for different deviation levels of wind standards. The average amount of uncontrollable load in every hour of the day can be calculated by averaging the annual values. The average temperature for every annual time can be seen in Figure 7. The average temperature for every day can be calculated by averaging the annual values. The sunlight diagram can be seen in Figure 8. The wind speed diagram is shown in Figure 9. The average wind speed is 4.68 m/s. According to the fact that simulation of the microgrid is done for one sample day, weather data and consumption load collected for one year can be 12 averaged for one day to simulate data for one 24-hour day. Table 2 gives the information about averaged uncontrollable consumption load, averaged controllable consumption load for every subscriber, average temperature, wind speed, and sunlight for a 24-hour day. Information related to controllable loads is given in Table 1. To conduct the simulation, it must calculate controllable ad uncontrollable consumption loads per every percentage of demand response for every demand response between 0% to 45%. To this end, the following hypotheses are considered: If the demand response is 0%, a controllable load is not used. In this case, the number of subscribers is 266. The average consumption load per subscriber and total microgrid load per hour is mentioned in Table 2. If demand response is 15%, only the first three controllable appliances (washing machine, dishwasher, and dry-cleaner) are used. According to the fact that we have 226 subscribers, the total controllable load is 519 kWh. The uncontrollable load's diagram must be multiplied by a coefficient to calculate consumption loads of 4000 kWh. The reason is that the total consumption load must be the same in every case to compare the results of various cases. It must be valid for 30% and 40% demand response percentages. In the case that demand response is 30%, almost 60% of subscribers use electric cars in addition to the first three appliances (washing machine, dishwasher, and dry-cleaner). In this case, the number of subscribers is 215 to have equal consumption load in different cases. If demand response is 45%, all subscribers use all controllable appliances. Considering 190 subscribers for this case, the total uncontrollable load is as follows ( Table 3).   Information about electricity prices bought from the main grid is mentioned in Figure 10. For hours between 7 and 23, the purchase is 0.32 S/kWh while determines 0.12 S/kWh for other hours. The sale price for the main grid is 80% of the purchase price. Tables (4) and (5) represent economic and technical information and other parameters considered for optimization. Data required by photovoltaic units are mentioned in [37]. To this end, data from [42] is used. According to the above, the mentioned framework includes some of the recent research through which the framework is explained. Simulation is done for 400 various percentages (0%, 15%, 30%, and 45%) of demand responses to examine the methodology.

A. BASE CASE (BC)
The current case study assumes that the uncertainty parameters related to wind power, solar energy, and demand equal the predicted values. The base case must be calculated for the objective function in the first stage. To this end, the uncertainty of wind and photovoltaic generation is not taken into account to focus on the determination of optimized annual expenses, equipment optimized sizes required for grid design, and explaining the role of productive resources in meeting demands. Total expenses of microgrid design are mentioned by (41), which is the summation of the purchase price, operation and maintenance expenses, and replacement and exchange prices. The related data is mentioned in Table 6. The objective function value for every percentage of demand response is sent to the second optimization level to conduct case study B. Additionally, the total consumption of energy and cooperation degree of generators in meeting demands (including purchasing power from the main grid, wind unit, photovoltaic unit, and battery which charge itself by discharging) is mentioned in the same Table for every percentage of demand response. In the last column of the same Table, battery charging capacity and the power sold to the main grid are mentioned. Figure 11 depicts the convergence of the objective function in the simulation of case study B for a demand response of 0% done based on ACO. According to this figure, the ACO managed to find the converged optimized response after 221 repetitions. Additionally, it is evident that the objective function starts at 245622 USD and goes to 237349 USD at the end. Despite complications of the optimization problem, ACO managed to find the optimized response to reduce the objective function into the converged value. The time interval for solving the optimization problem is taken 500 repetitions based on ACO. Consequently, we consider 50 particles, and the time would be 2 minutes. Table 7 represents appliances installed in the microgrid used in the current case study simulation. According to this Table, an increase in demand response leads to a reduction in battery capacity. The main battery in the microgrid can increase operational capacity by transporting consumption loads. Therefore, there is less need for batteries in times of increased demand responses because of the increase in the ability of consumption loads transportation. The increase in demand response leads to a reduction in the capacity of photovoltaic units, which may boost the capacity of wind units. An increase in demand response may cause higher delivery of consumption loads, leading to frequent usage of wind units and fewer photovoltaic ones. The objective function for various demand response percentages is shown in Figure 12. So that, Increasing the amount of this percentage may reduce the microgrid's expenses. If demand response is not considered, the total microgrid expense is 237349 USD. Consideration of a 15% demand response leads to a 4.2% reduction in expenses. In this case, the grid expense is 227389 USD. 30% and 45% increase in demand response can reduce expenses by 7.06% and 9.14%. In the following, the distribution of operational power and consumption loads in a residential microgrid for 24 hours is simulated and evaluated concerning various percentages of demand response in the base case (A). Simulation of other cases leads to the same results; thus, the power distribution of case A is evaluated. Figure 13 shows power distribution over the microgrid while demand response is not considered. According to this figure, the wind unit operational capacity increases in the early and late hours of the day, while photovoltaic units increase at midday. As for charge and discharge ability, electricity is cheaper between 1:00 and 7:00 when microgrid demand is lower. Excess power is purchased from the main grid to charge the battery. On the other hand, electricity is expensive between 8:00 and 23:00 when the battery is used to meet microgrid demand to reduce costs. Obviously, between 11:00 and 14:00, when the photovoltaic generation is high, a part of that power is used to charge the battery. Then, the battery can be used in the early hours of the night when the photovoltaic unit generates no power. Additionally, the wind unit meets the demand at 24:00 when the photovoltaic unit has no generation. Since renewable units have the highest generation at 12:00 -13:00, some of that power is sold to the grid at midday. Power distribution over the microgrid can be optimized to reduce expenses.

16
The distribution of controllable loads for various demand responses is shown in Figure 14. As for demand response of 15%, controllable loads are postponed to 7:00 and 24:00 when electricity is cheap. A part of the controllable load is delivered to 13:00 when photovoltaic generation is high and the grid is loaded with the excess load. As for demand response of 30%, a part of controllable is delivered to 1:00, 3:00, 5:00, 7:00, and 24:00 when electricity is cheap. A part of the consumption load goes to lowdemand hours (between 9:00 and 14:00 when photovoltaic generation is high or between 22:00 and 23:00 when the grid is asked for lower demand). As for demand response of 45%, a part of the consumption load is delivered to 1:00, 2:00, 3:00, and 24:00 when electricity is cheap. Another part is timerestricted and cannot be delivered in cheap hours. In this case, desired times can be 11:00 and 14:00 when photovoltaic generation is high or 22:00 and 23:00 when the grid faces less demand. Therefore, distribution is done in a way that grid expenses may reduce.
(a) Power distribution over microgrid for demand response of 45% is shown in Figure 15. It is shown that wind generation is considered in the early and late hours of the day, while photovoltaic generation is the best option at midday. Between 1:00 and 7:00, when electricity is cheap and the demand is low, the line's share of the power is bought from the main grid to charge the battery and meet controllable loads. Between 8:00 and 16:00, photovoltaic units can meet consumer demand. Therefore, there is no need to purchase the power or discharge the battery. Between 17:00 and 23:00, when photovoltaic generation reduces and controllable demands must be met, batteries are discharged into the grid. Obviously, at 24:00, when electricity is cheap and photovoltaic generation is zero, the main part of power is purchased from the main grid to meet consumption demands. Distribution over the microgrid represents the optimized power distribution at various hours to reduce microgrid expenses.

B. RISK-AVERSE STRATEGY (RAS)
In a case study (A) which is called the base case, uncertainty parameters related to solar energy, wind power, and demand are equal to the predicted ones. Optimization based on optimized power distribution is evaluated regardless of demand response. In the case of study B, the focus is on determining the maximum uncertainty radius in risk-averse considering excess expenses as a critical point of the objective function. In this case, the designed microgrid's resistance is investigated concerning uncertainty. Additionally, a descriptive investigation of optimized sizes is conducted. This case study focuses on a demand response of 45%.

-IMPERFECT PV PREDICTION
In this case, it is assumed that distributed power flow during 24 hours is predicted. On the other hand, ξ pd = 0. Accordingly, demand and supply are the same. Also, it is assumed that wind speed is predicted and ξ wt = 0. In a photovoltaic system, a reduction in predicted power can negatively affect the objective function. In other words, expenses rise. According to (46), photovoltaic generation reduces to calculate the maximum uncertainty radius. In this case, ς c goes from 0 to 40%. It aims to determine the microgrid's resistance in a risk-averse method. Considering J 0 + |J 0 | ς c The maximum uncertainty radius of the photovoltaic unit in the risk-averse method is determined. Table 8 summarizes the results of the case study. It is shown that the power supplied by the photovoltaic system is kept fixed while ς c increases as expected. This Table mentions the power supplied by the various resources, objective function, and total energy consumption. It is worth noting that the energy supplied by the battery is calculated based on discharged power. Figure 16 shows the changes in different options againstς c . As it is shown, an increase in ς c may lead to a reduction in photovoltaic generation and its role in supplying demands. Accordingly, bigger batteries and wind units are designed for the microgrid to increase the generation of wind units and batteries. According to the figure, when ς c = 36% and expenses soar by 36%, uncertainty is 1 for the photovoltaic unit. On the other hand, the microgrid cannot meet demands when the uncertainty for the photovoltaic unit is 1.

-IMPERFECT WT PREDICTION
The effect of uncertainty on wind turbines is investigated. In a risk-averse strategy, wind turbines behave similarly to photovoltaic units. A reduction in the predicted power can negatively affect the objective function. This way, expenses increase. According to (45), wind turbine generation reduces risk-averse strategy. It is assumed that the power flow is predicted for 24 hours and ξ pd = 0. Consequently, predicted demand and actual demand are the same. Additionally, the output of the photovoltaic system exceeds the predicted value and ξ pv = 0. Under these circumstances, ς c changes from 0 to 40% to determine the maximum uncertainty radius to increase wind turbine output. It aims to determine microgrid resistance in risk-averse strategy when expenses for designing microgrid change from 0 to 40%. Table 9 is a summary of the results of this case study. In this Table, power supplied by different resources is mentioned. Figure 17 represents the role of various options againstς c . Accordingly, an increase in ς c may lead to a decrease in wind turbine output. Therefore, bigger photovoltaic units and batteries are required to increase power generation. The bigger batteries and PV cells lead to increased expenses in this case. According to figure 3, ς c = %40 and ξ wt = 82.2%, only 17.8% of the predicted wind power meets demands.

-IMPERFECT LOAD PREDICTION
Compared to the previous cases, the effect of load uncertainty is investigated here. Therefore, it is assumed that solar energy and wind speed are predicted, and PV output and wind power are the same as the predicted values. It means that = = 0. In wind turbines and PV units, a decrease in the predicted value can negatively affect objective function, increasing expenses. According to (47), system load is increased to calculate the maximum uncertainty radius in the RA strategy. Table 10 is a summary of the results obtained from this case study. It is shown that power supplied by PV unit is kept fixed while ; increases as expected. Figure 18 shows the changes caused by different energy resources. Figure 6 is a comparison between every resource and its base value when ; changes from 0 to 24%. It is evident that the energy fed by ESS increases while goes up while it has the same effect for both = 0 and = 20%.

-IMPERFECT WT AND PV LOAD PREDICTION
In cases, B-1, B-2, and B-3, the uncertainty of photovoltaic generation, wind power, and load are investigated, respectively. If the effect of uncertainty on both load and photovoltaic units matches the prediction, a multipurpose maximization problem is solved to determine and . In the following relation, the weighted sum can be used to solve the optimization problem [43]. This method uses prioritization to select weighted coefficients [44,45]. To this end, daily photovoltaic generation (primary value) is divided by daily consumption. Therefore, is taken as the unit value because deviation from the predicted value can significantly affect expenses which are shown in Figures 3 and 5. Table 11 is a summary of results. It is obvious that any changes in can lead to reduction in photovoltaic generation while load increases. Figure 19 represents the effect of various resources as well as the maximization of uncertainty on photovoltaic generation, wind power 20 and load compared to the conservative parameter of .

VI. CONCLUSION
In this paper, the first step of microgrid design focuses on demand response based on ant colony optimization (ACO). Results have shown that using demand response in all scenarios reduces expenses because there is no longer a need to install batteries and generation units while controllable loads are transferred to cheap hours. Additionally, it is indicated that Power distribution, charge, and discharge reduce microgrid expenses. Then, an IGDT-based framework is proposed for microgrid design. Also, the uncertainty of photovoltaic generation, wind power, and load is determined for the microgrid to calculate the expenses of photovoltaic, wind, and load generation while deviation is examined based on IGDT. Results have shown that considering excess expenses in the base case is the easiest way to determine the maximum uncertainty radius for photovoltaic generation, wind power, and load to keep the grid stable. According to the IGDT, the results are valid. Additionally, this method is more expensive while designers and owners of the microgrid believe in its efficiency.