Techno ‐ Economic Planning and Operation of the Microgrid Considering Real ‐ Time Pricing Demand Response Program

: The optimal planning of grid ‐ connected microgrids (MGs) has been extensively studied in recent years. While most of the previous studies have used fixed or time ‐ of ‐ use (TOU) prices for the optimal sizing of MGs, this work introduces real ‐ time pricing (RTP) for implementing a demand response (DR) program according to the national grid prices of Iran. In addition to the long ‐ term planning of MG, the day ‐ ahead operation of MG is also analyzed to get a better understanding of the DR program for daily electricity dispatch. For this purpose, four different days corresponding to the four seasons are selected for further analysis. In addition, various impacts of the proposed DR pro ‐ gram on the MG planning results, including sizing and best configuration, net present cost (NPC) and cost of energy (COE), and emission generation by the utility grid, are investigated. The optimi ‐ zation results show that the implementation of the DR program has a positive impact on the tech ‐ nical, economic, and environmental aspects of MG. The NPC and COE are reduced by about USD 3700 and USD 0.0025/kWh, respectively. The component size is also reduced, resulting in a reduc ‐ tion in the initial cost. Carbon emissions are also reduced by 185 kg/year.

Nevertheless, there are several challenges in utilizing RESs in Iran, namely operation and maintenance, control and shift of power between resources (energy management),

Literature Review
In order to utilize RESs in an economic and efficient manner, the optimal sizing of MG components is essential. According to the type of the optimization method, the full utilization of RESs and minimum investment along with the efficient MG performance can be assured [56]. For this purpose, various optimization methods have been employed in recent studies [57]. In Ref. [58], the optimal sizing of WT, photovoltaic (PV), and fuel cell (FC) units in a 31-bus distribution system, as well as the best location, are determined using the particle swarm optimization (PSO) technique. The aim of the study was to minimize the total cost of RESs, the total power losses, emissions, and total harmonic distortion (THD). The results showed that the utilization of RESs considerably decreases the emissions. In addition, it was revealed that RESs improve the voltage stability of the system. However, they neglected to consider an appropriate demand response (DR) program. The researchers in [59] proposed an optimal sizing ESS approach to minimize the total costs by optimizing generation power, thermal units, load demand, and wind curtailment. The authors proposed a method to transform the chance constraints, such as the network constraints, into deterministic constraints. They also considered the correlations of the forecast errors among WT and load at different buses, which improve the ESS operational reliability. In another research study [60], the authors adopted the fuzzification process to find the best location of RESs for optimizing a tri-objective function, including the installation cost, emissions, and reliability. Furthermore, different techniques such as the Least Square technique [61][62][63], the Loss of Power Supply Probability technique [64][65][66], and the Trade-Off technique [67,68] are represented to compute the optimal architecture of MG in terms of economic and technical analysis, which is known as techno-economic analysis.
One of the efficient ways to obtain the optimal sizing and combination of MGs' resources to electrify an MG is to employ HOMER Pro software. This software has extensively been used in the MG industry. In [69], the authors used HOMER Pro to compute the economic benefits of utilizing PV, WT, and ESSs in different climate zone of Iran. They also implemented an electricity pricing strategy based on the electricity tariffs considered by the Ministry of Energy of Iran. The optimization results indicate that a moderate and rainy climate zone such as Urmia city has the least net present cost (NPC) and levelized cost of energy (COE). However, a semi-moderate and rainy climate zone such as Golestan city has the highest NPC and COE. While the effect of different electricity pricing was investigated in this study, demand changes corresponding to the price changes were not investigated by the authors. The authors of [70] developed a decision-making method for the optimal sizing of RESs, diesel generators, and converters. In addition, a multi-criteria decision-making technique is proposed. According to this technique, a utility could concern various self-organize criteria for the best system configuration, each with a different weighting. The criteria were based on the costs of the system including, COE, COE, and investment costs. The optimal system considering the suggested technique consisted of a diesel generator, PV, WT, EES, and converter. However, DR programs have not been concerned in the proposed multi-criteria decision-making technique. In [71], the researchers used HOMER Pro for the techno-economic planning of islands in South Korea. In this study, three scenarios based on the three off-grid islands located in South Korea are optimized. The study prioritized the first scenario due to the competitiveness of economic results (lowest NPC and COE comparing other scenarios). The optimal system configuration for this island was obtained from a diesel generator, PV, WT, and ESS. Nevertheless, the pricing scheme was not clearly described in this study. In [72], an off-grid energy system was modeled by HOMER Pro for a local city in Kenya. The project was aimed to select a few feasible solutions obtained by HOMER, which provides the loads and then chooses the best available solution that could satisfy the objectives identified at the start of the study by analytic hierarchy process (AHP). The results indicated the importance of ESS utilization in the system architecture, which reduces the dumped energy to a satisfying value. A similar method was introduced in [73] for an educational institute. Therefore, they performed planning of the MG's energy resources using multi-criteria decision-making based on the AHP approach. Both studies neglected price and load changes in the decision-making process. However, considerable impacts of load and electricity price values cannot be ignored. In [74], an RESs-based MG including PV/WT/ESSs is proposed for a grid-connected hybrid system in Iran. The authors used this software to specify the optimum MG structure regarding predicted load data. They also considered the load growth rate in their study to consider the impact of consumption growth in the systems configuration and economic costs. To this end, the previous years' load data are used to forecast the future years' load data, and the growth rate is extracted from the mean growth rate of the predicted values. Among various system configurations, the one that is the most economical was selected. The combination of the WT system and ESSs, with a Total Net Present Cost (NPC) of 452,454 USD, was the optimum configuration. While the annual load growth rate is considered in this study, a practical technique that improves the flexibility of the system was not suggested by the authors. In another study [75], a hybrid Organic Rankine Cycle (ORC) is proposed and optimized for a household in Rayen, Iran. The exergy and exergo-economic analyses of hybrid ORC are also performed. Then, HOMER software is employed to optimize a stand-alone MG. The results showed that due to the higher COE and NPC of the ORC-based system, RESs-based energy systems are proposed for the residential area. The software is employed to optimize a stand-alone MG. The results showed that the optimum configuration of the MG consists of PV/WT/Diesel/ESSs with a total NPC of 268,592 USD. In [76], a grid-connected PV system for agricultural applications was proposed in Tabriz, Iran. They also utilized PVSYST software to calculate the performance of the grid-connected PV system, which has not been considered in previous research. The simulation results indicated that the utility grid supplied 79.836% of the required electricity of the selected location and merely 20% provided by the PV system. The suggested microgrid reduced greenhouse gas emissions by about 508,713 kg per year. In [77], an MG including PV/WT/microturbine/BSS/FC is optimized using HOMER software to anticipate the size of power generation units in a grid-connected MG based in Nain, Iran. They used real data of Nain city for load demand, market prices, and weather data for the optimization. According to the results, the demand was provided by 23% of PV power, 43% of WT power, 32% of microturbine participation and 2% of fuel cell power provision. However, the ESS as a back-up resource had few participations over a year.
In addition to traditional resources in MG such as DGs and RESs, demand response (DR) programs can also be introduced as the programmable resources in the MGs energy management. The DR programs are one of the effective resources to obtain the economic operation of MGs [51]. DR programs can enhance the performance of RESs in the MGs. They can decrease the peak load consumption and shave the daily load pattern so that the RESs supply the load demand efficiently. Therefore, the simultaneous utilization of the DR program and RESs can improve the operation and planning results of the MGs. In general, the DR programs are divided into two groups: incentive-based DR programs and price-based DR programs. The latest refer to users altering their consumptions based on the electricity price. Incentive-based DR programs refer to users decreasing or increasing their consumption based on financial incentives. The potential of DR and RESs integration has been investigated considerably [78]. Recent works in the literature discuss the merits of DR for RESs integration, particularly PV and WT systems, which are thoroughly analyzed in [79,80]. Furthermore, participating behavior, namely load shifting, load transfer, and load rebound is an essential factor for amending the reliability and feasibility of dispatching DR sources in MG operation. The potential and applicability of DR programs to MGs is yet another interesting research area, particularly in terms of peak consumed load demand minimization [81], pollution reduction [82], energy costs [83], and reliability improvement [84].
Nevertheless, few investigations have examined the participating behavior of DR programs in the long-term planning of residential MGs [85][86][87][88]. In [85], a multi-energy MG is optimized considering stochastic programming. The flexible demand control was also conducted by load shifting of controllable loads (on/off appliances scheduling). The model was applied for two days in the summer and winter seasons for a variety of studies, including the storage impact, energy sell-back to the network, charging and discharging of electric vehicles (EVs), and planning flexible equipment. According to the results, around 6% and 51% cost savings occurred for winter and summer days, respectively, when the power was offered to the power distribution system. In [86], an off-grid MG including RESs and ESSs system and a diesel generator is considered for addressing the issues of long-term optimal capacity determination, short-term operation, and planning for an off-grid MG. A RESs-based DR program dynamic pricing economic model to improve the flexibility of the system was proposed. The implemented model considers the intermittence of RESs as an instrument of effective demand-side flexibility improvement and system planning. The objective of this study was to minimize annual investments costs, operating costs, and demand-side management costs. According to the results, the mismatch between demand and generation was minimized through using the implemented DR-program, which considerably increased system flexibility. In [87], an integrated approach for optimal planning and operation of a multi-energy MG is proposed in which electrical loads are shifted based on TOU price signals. Uncertainties of various load and WT generation are considered using Monte Carlo simulation in this study. Then, the scenarios are reduced using the K-means clustering algorithm. Therefore, a two-stage optimization model represented as a stochastic programming problem was proposed in this study, which addresses the impacts of the uncertain parameters. In addition, Benders decomposing approach is applied to solve the complex model of coordinated planning and operation problem. The authors of [88] examined and investigated the capability of DR programs in equipment size optimization of an off-grid MG. Responsive loads could be controlled in order to balance the demand and supply, in such way that the low production flexibility compensates for a significant extent [88].

Contributions
Reviewing the above-mentioned studies, there still exists a research gap in proposing a DR program that is based on the electricity usage features of consumer loads. To the best of the author's knowledge, there is no significant study in the size optimization of MGs using HOMER software that considers the DR program as a flexibility tool. Therefore, in this paper, a price-based DR program is implemented for long-term optimal capacity sizing and short-term operation of the grid-connected residential MG system located in Tehran, Iran. The MG has consisted of the PV unit, WT unit, bidirectional converter, and ESS. Then, the proposed DR program is compared with the TOU DR strategy currently employed in Iran's electricity market. Environmental impacts of the proposed DR program are also analyzed, and other analyses are also performed. The essential contributions of the paper are as follows:  Proposing a price-based DR program according to the long-term electricity load consumptions.
 Techno-economic analysis of an off-grid MG considering the price-based DR program to increase the flexibility of the system.  Considering coordinated planning and operation of the MG under different pricing schemes, as well as concerning the environmental impacts of each scheme.  Performing a sensitivity analysis on the inflation rate and discount rate to evaluate the corresponding effects on optimization results.

Materials and Methods
This section methodology of the study, including system architecture, optimization method, system components, energy management strategy, and the proposed DR program, is discussed.

System Overview
The understudy MG structure is represented in Figure 1. As illustrated, the understudy MG consists of RESs including a PV, WT system, battery bidirectional converter, and ESS. Energy management carries out an important task such as balancing demand and supply and cost optimization of the MG. The DR program is also connected to the energy management system, which can enhance system performance. The energy management system is responsible for finding the most economical system configuration and optimal equipment sizing. While the proposed system includes two renewable components and a battery ESS, the optimum design may not benefit from all these sources according to the economic profits.

Optimization Method
The optimization is performed according to the financial factors for feasible planning for investigations. The system configurations are ranked according to the lowest NPC. The NPC of equipment is the current values of all equipment operating and installing costs minus the current values of all the incomes the system obtains during the optimization period. The costs consist of initial investment, replacement, O&M, and buying electricity from the utility. Incomes consists of grid sales revenue and salvage value. HOMER computes the annualized cost by dividing the NPC by the capital recovery factor (CRF) in the project time horizon. The following Equations (1)-(4) are used for calculating the annualized cost of the system [74,88].
In this equation, , is the capital recovery factor, R is the project lifetime (year), i is the real discount rate (%), i′ is the nominal discount rate, and f is the inflation rate. In addition, is the NPC of the system, is the capital cost of the system, & is the operating and maintenance cost, is the emissions cost, is the replacement cost, is the cost for purchasing power from the grid, is the revenue from selling power to the grid, is the salvage value at the end of the project. The COE is computed as the mean cost per kWh of useful electricity generated by the MG, as follows [58,88].
In (2), is Levelized COE, , is the total annualized cost, and is the total load served

Renewability
Renewable fraction (RF) is the other important term associated with the extent of using renewable generation in hybrid systems. The RF shows the ratio of the delivering energy to the load originated from RESs. Equations (6) and (7) are used for the definition of RF [44][45][46].
Where is conventional electrical generation per kWh/yr. Moreover, the renewable penetration (RP) in each time-step describes that is the total renewable output power (kW) and is the total electrical load served (kW).

Solar PV System
The solar irradiance and temperature are used for calculating the PV system's output power. Generally, there are two kinds of PV panel choices in Iran: concentric and generic flat plate. The latter is more profitable; hence, a flat plate is considered in this study for further analysis. For the proposed MG, a generic flat-plate PV is utilized with an efficiency of 16.25%, a rated capacity of 1 kW, and an operating temperature of 45 °C. This kind of PV is represented with a converter, and the converter efficiency curve is modulated based on the datasheet (95%) [74]. The PV system output power can be computed as follows [44,47].
In this equation, is the derating factor of PV per percent, represents the PV array rated capacity, which means that the output power of the PV array under standard test condition is in kW, indicates hourly solar irradiance on the PV surface in kW/m 2 , , denotes the solar irradiation under standard test conditions, the temperature coefficient of power is shown by (%/°C), signifies hourly temperature of the PV cell, and , shows the temperature of the PV cell under standard test conditions.

WT System
In order to model and take the number and cost of WTs to fit the load demands with other resources optimally, the initial step is to determine the type of the WT. Referring to the components' library, there are possibilities for different WT size ranges from 1000 to 1500 kW. In this paper, a generic model with a rated 1 kW capacity WT is selected [74]. The overall WT output power is computed using Equation (9) [89].
In the above equation, is the air density (0.1225 × 10 −1 kg/m 3 ), A is the cross-sectional area of wind, V is the wind speed, and is the power efficiency of the WT system. The capital cost for the WT system is 725 USD, and the O&M cost is 70.0 USD/year.

Battery ESS
In HOMER, batteries are used as the backup resources during power outages or insufficiencies of RESs in demand provision [90]. However, these resources play an important role in the stand-alone operation of MGs because it is usually cost-effective to sell generated power by RESs to the utility grid than storing it into battery ESS [68]. As there is an existing variability in load demand and RESs generations, it is recommended to consider ESS in the recommended system structure. In this paper, we proposed a battery ESS with a capital cost of 124 USD and an O&M cost of 10 USD/yr. The battery ESS output power is computed as (10) [91].
In the above equation, and are the voltage and total capacity (A.h) of the battery. In addition, shows the state of charge of the battery during the operation of the MG.

Converter
Systems containing both DC and AC components require a converter. In this paper, a generic converter is considered, and its inverter consists of a power converter unit, power control unit, power distribution unit, and bypass unit [88]. The converter has an initial cost of 137.5 USD and O&M cost of 10 USD/year, also, the converter efficiency is considered as 95% [74].

DR Program
DR programs can respond to market price signals by increasing the demand-side flexibility via reducing or temporary shifting load peaks. DR programs are also applicably proposing incentive mechanisms that result in the avoidance of capacity investment and costly electricity purchasing [50]. One of the most important components for the successful DR performance is the RTP mechanism. In this regard, an RTP strategy based on the TOU pricing is suggested in this paper. The RTP model will be utilized for implementing the proposed DR program. More information regarding the proposed method can be found in [92].
In this paper, five types of loads are considered for MG. The loads are HVAC and fans ( ), interior lights ( ), exterior lights ( ), main equipment ( ), and misc equipment ( ). The total load demand of the MG according to load types could be calculated as shown in (11). (11) The mean load is computed as shown in (12).
, , where is the float factor, , and , are respectively the upper and lower bounds of RTP. In the proposed method, the price-based DR program has been suggested to evaluate the effects of the DR on the MG planning and operation, as (15).
In the above equation, is the load profile of the MG, e represents the demandprice elasticity coefficient that is considered as [−0.5], and is TOU prices (see Figure  2) [51].
Hourly base data for load consumption and electricity price (TOU) are collected.

Start
The total load demand value is calculated.
Average load demand is calculated based on total load demand value.
Real time price is computed based on the TOU price and the hourly/average load demand data.
Modified load demand data based on real time electricity price is calculated.

Energy Management Strategy
HOMER software benefits from two energy management systems, i.e., cycle charging (CC) and load following (LF). In this paper, the LF dispatch strategy is used for energy management of the MG. In this energy management strategy, HOMER dispatches the MG's controllable power resources i.e., grid and ESS, to meet the hourly electrical load demand at the minimum NPC, providing the operating reserve requirements. The NPC consists of capital cost, O&M cost, and replacement cost. For this purpose, HOMER computes the marginal and fixed costs of each dispatchable resource [92].
The fixed and marginal costs of the utilized battery ESS are equal to zero and the ESS degradation cost, respectively. In addition, the grid fixed cost is zero, and the marginal cost is equal to the grid electricity price. The marginal cost of the grid rises by considering a cost for carbon emissions.
After characterizing each dispatchable resource, HOMER explores to find the optimum configuration of production resources that supply electrical load demand and operating reserve at minimum cost. Figure 3 shows a flowchart of the energy management system in HOMER. In general, the output power of RESs is designated for supplying primary loads, and surplus power will be used for grid sales or storing in the ESS according to their marginal costs.

Case Study and Results
In this paper, a residential household in Tehran, the capital of Iran, is selected as the case study. The reason for studying this city is the availability of the infrastructure for implementing large-area MGs and DR programs. The location of the understudy household is depicted in Figure 4. Tehran is located in semi-arid weather conditions [69]. Weather parameters including air temperature, solar irradiation, and wind speed are represented in Figure 5. The monthly values are gathered from NASA's surface meteorology that can be found in the software's environment. Figure 5a,b indicate that the understudy location benefits from adequate solar energy over a year. Nevertheless, a notable solar potential is available during the summer months of the year. As can be seen in Figure 5a,b, the maximum daily temperature is below 30 °C, and solar irradiation scarcely arrives at its peak value at 0.95 kWh/m 2 /day. The location has a moderate wind potential over the year (Figure 5c) [74]. In order to have accurate techno-economic values for the grid-connected MG, it is necessary to consider realistic technical and economic data. In this paper, essential economic parameters, such as inflation and discount rates, are assumed as 16.18% and 18%, respectively [69,[93][94][95][96][97]. Furthermore, the simulation lifetime is considered to be 25 years.

Utility Grid and DR Program Implementation
TOU pricing is considered a DR strategy that is implemented in many countries, including Iran. According to this DR strategy, three electricity rates are determined according to the hour of the day. The rates are defined according to the off-peak, mid-peak, and peak hours of the day. The rates could be changed during the hot and cold months. For instance, in peak months, two peak periods could be considered by the utility grid. It is assumed that the consumers react to the price signals and lower their consumption during peak prices and increase their usage in off-peak hours of the days. This strategy ultimately led to peak load shaving and flexibility of the power system.
In Iran, the Ministry of Energy (MOE) is responsible for defining the TOU rates. There are generally two types of electricity tariffs in Iran. The first one is the constant electricity pricing, and the second is TOU electricity pricing. In order to implement TOU prices, it is necessary to install smart meters. Such meters are substituting with the mechanical and analog devices, which are merely used for recoding constant electricity prices. In contrast, smart meters can be used for registering three different rates over a day. According to the legislation, the electricity price at peak hours is four times higher than the mid-peak prices. Furthermore, the electricity price in off-peak times is a quarter of the mid-peak price. Figure 6 shows the TOU electricity prices for the residential sector over a year. As can be seen, there are four peak hours with the highest electricity prices. In addition to this, a fixed feed-in tariff (FiT) is also considered in this study [92]. It means that surplus electricity generated by RESs could be sold to the utility grid according to this rate. To perform long-term planning and implement a DR program, it is essential to have hourly load values for at least a year. In this study, five types of load consumption are considered for the consumer, including Fans & HVAC, interior and exterior lights, main and miscellaneous interior equipment. Hourly load consumption according to the mentioned category is depicted in Figure 7 [93]. It is clear that interior equipment has the highest consumption rate among the other ones. In addition, Fans and HVAC have minor electricity consumptions especially compared to interior equipment. After collecting five load categories, it is time to calculate the total hourly load values to optimize and implement the proposed DR program. As mentioned in (13)

Interior Equipment (Misc) Consumptions [kWh]
Hour and total hourly load values are used for calculating RTP. Figure 8 shows RTP values based on the load consumptions. In fact, real-time electricity values are in response to electricity demand. It can be seen that in the hours with higher load consumption, electricity prices are greater than those hours with lower load consumption. So, instead of having a fixed pattern for electricity usage, which may be ineffective because of variability in consumer power usage, an efficient RTP is considered in response to load consumption. The proposed DR program is implemented by RTP and TOU pricing according to (14). Figure 9 shows load demand data with and without implementing the proposed DR program. As can be seen, a significant reduction in load demand consumption occurred over the year. The aim of the DR program is to shave the load profile over the year so as to achieve a flatter pattern for load demand. A flatter load profile not only has economic merits for the consumer but also for power systems. For example, improvement in the stability of power systems on a large scale. Table 1 shows grid emission production in grams per kilogram [74]. These criteria will be used for evaluating the environmental impacts of implementing the DR program in the MG structure.

Long-Term Planning Results
In order to conduct better evaluations of the proposed DR method, two scenarios are defined based on the type of the DR program, as shown below.  Scenario 1: Optimal planning of the MG using TOU pricing mechanism.  Scenario 2: Optimal planning of the MG using RTP mechanism.

Scenario 1
This scenario is designated for considering standard TOU pricing in the planning of the MG. Therefore, the proposed MG is optimized using the RESs and other specifications of the system. Table 2 shows techno-economic results of the proposed MG, including component sizing and NPC. As can be seen, solar PV with a capacity of 11 kW in addition to 6 kW of converter were found to be economical for supplying the MG's load demand. In contrast, the utilization of the WT system and BSS were not found to be economical. For the WT system, the higher initial cost and potential of the environment are two important reasons. BSS is a backup resource, and it is equipped when there is a lack of power in the system. Since the utility grid is assumed to be reliable, typically, there would not be any need for backup resources in the system structure. The NPC (−19,687 USD) and COE (−0.0635 USD/kWh) values show the system's high profits, which is particularly due to the electricity sell-back to the utility grid. Other configurations show that the increase in system equipment, including the WT system and BSS, raises the NPC and COE values. However, utilizing both WT and PV systems such as configuration 3, the RF of the system improves from 87.2% to 89.5%.  Figure 10 shows the electricity purchased/sold to the utility grid over the months. It is clear that a significant amount of produced electrical energy by the PV unit is sold to the utility grid. In addition, the purchasing power from the utility grid is lower than the electricity sold every month. In cold months, we observe that the need for electricity is increased; therefore, the amount of sell-back electricity decreases. Variability in PV output power can be observed in Figure 11. It indicates that the output power of the PV unit is highly dependent on weather conditions. Table 3 also indicates the number of produced emissions through the grid connection. As mentioned before, the utilization of grid connections causes the production of greenhouse gas emissions. In this scenario, 1397 kg/yr of carbon dioxide is produced, which is significant compared to sulfur dioxide (6.08 kg/yr) and nitrogen oxides (2.96 kg/yr).  Figure 11. Average monthly PV system output power. In this scenario, simulations are performed using the proposed DR program. The optimal sizing results of this scenario are indicated in Table 4. As can be observed, the optimal capacity for a solar PV system is reduced from 11 kW in Scenario 1 to 9 kW in Scenario 2. In addition to this, the NPC and COE are obtained as −23,461 USD and −0.0660 USD/kWh. In comparison to the previous scenario, improvements in both NPC and COE can be observed. The main reason is the modifications of the consumer's load profile. As indicated, the proposed DR program modified the consumer's peak load consumption, and the total demand for electricity was reduced. Therefore, the consumer can sell more electricity to the grid and obtain economic profits.  Figure 12 shows the purchased/sold electricity from/to the utility grid. A result that claims attention is the lower level of monthly load consumption in this scenario, which shows the significance of the DR program on the consumption rate. In addition to this, electricity sell-back is increased as a result of a decrease in total load consumption. However, the total generated electricity by the PV system is a bit lower than the previous scenario because of the lower designated capacity ( Figure 13). Table 5 also shows the amount of the emitted greenhouse gases in Scenario 2. Comparing the values with previous scenario, it can be seen that the proposed DR program had a positive impact on the environmental issues of MGs. The value of produced CO2, as well as other emissions, is reduced over a year. Therefore, it can be concluded that implementation of an efficient DR program such as the proposed one can significantly improve the system's technical, economic, and environmental performances.

Day-Ahead Operation Results
This section may be divided by subheadings. It should provide a concise and precise description of the experimental results, their interpretation, as well as the experimental conclusions that can be drawn.
To better understand the DR program of the operation of the MG, two scenarios are considered based on the utilization of the proposed DR program, as shown below.  Scenario 1: Optimal operation of the MG using TOU pricing mechanism.  Scenario 2: Optimal operation of the MG using RTP mechanism.
Most of the previous papers do not consider the operation of the optimal system and focus mainly on the planning and techno-economic results. However, it is of great importance to analyze the daily operation of the MG to get more insights into the system's behavior. Therefore, in the following, we will analyze the results and draw some important conclusions.

Scenario 1
In this scenario, the day-ahead operation results of the MG are presented using TOU pricing. To have a more accurate understanding, a sample day from each season is selected for further analysis. Hence, four days are considered as representative of the four seasons selected in this study. The reason for selecting four days is the variability of load consumption, renewables output power, and grid sales/purchases in each season. In this way, a better understating of the MG over the optimization period could be achieved. The daily standard deviation (STD) values for the load demand corresponding to four seasons are indicated in Table 6. Figure 14a-d shows the power balance of the MG, including the generated PV system, electricity consumption, grid sales, and purchases during four days. Figure 14a shows the operating results for a winter day. It is clear that PV output power could not fully supply the load demand at most hours; hence, the MG is forced to buy electricity from the grid, especially in peak hours. Peak generation has occurred at 10:00, and peak load consumption has occurred at 20:00. At three distinct hours, we can see that the MG is injecting extra generated electricity back into the grid. Figure 14b indicates the operation of the MG over a spring day. PV production is relatively significant at this time of the year, and the PV system is able to provide load demand for twelve hours of the day. In addition to this, a significant amount of surplus generation is sold to the grid, which obtains economic profits for the MG. Similar to the winter day, there are two peaks on this day. However, the overall consumption on the winter day is more remarkable than on the spring day. Figure 14c also shows the optimal operation of the MG on the summer day. Power generation by the PV system is considerable even from a spring day. PV generation started at 6:00 and lasted for 14 h. Furthermore, the PV is the primary source of power supply in the MG system. On the summer day, most PV generation occurred between 12:00 and 4:00, while this has taken place from 8:00 to 13:00 on the spring day. Finally, Figure 14d indicates the power balance results of the optimal system on the fall day. The operation is more similar to the winter day. However, the main difference is in the PV production, which more considerable than the winter day.

Scenario 2
In this scenario, the day-ahead operation results of the system are represented using the RTP mechanism. The operation results for the same days as Scenario 1 are indicated in Figure 15a-d. The daily standard deviation (STD) values for the load demand corresponding to four seasons are indicated in Table 7. An important result that claims attention is the impact of the suggested DR program on the load consumption profile. Applying the DR program could successfully shave the two peaks, as shown in Figure 15a. This has resulted in a decrease in the purchasing power from the grid during peak hours and, ultimately, a reduction in the NPC of the system. Considering the proposed DR program, the MG is more responsive to the electricity prices. Similar to BSS, the DR program is a flexible resource for the MGs. While the optimum system was not equipped with BSS, the DR program played a similar role as BSS for the MG. Typically, BSS are charged during off-peak times and discharged in peak times when the electricity price is higher than average. The proposed DR program also plays relatively the same role as BSS in the MG operation. The same conclusions are also valid for the other operation days, as illustrated in Figure 15b-d. (d)

Sensitivity Analysis
In this subsection, two sensitivity analyses on the inflation rate and discount rate are performed in order to evaluate the optimal configuration and economic results of the system under pessimistic economic conditions. Similar to previous subsections, two cases as sensitivity analyses are suggested based on the proposed RTP-based DR program.

Sensitivity Analysis 1
In this part, TOU-based prices are utilized to perform sensitivity analysis. To this end, the implemented inflation and discount rates are increased from 0% to 100%. Simulation results, including optimal configuration type and the values for the NPC and COE, are indicated as shown in Figure 16. It can be seen from Figure 16a that the optimal system configuration under different values of inflation and discount rates is not affected by utilizing the WT units. However, under higher inflation rates and moderate discount rates, we can observe the integration of the WT system to the MG structure ( Figure 16a). Furthermore, the increase of the inflation rate reduces the NPC and COE of the system ( Figure  16b). This is primarily due to the considerable impact of the inflation rate on the annual cost of the system, as shown in Equation (1). In some conditions, higher renewable penetration and grid revenues cannot be ignored. However, the discount rate has an adverse impact on the system costs, as illustrated in Figure 16c. It can be seen that the discount rate increases the NPC and COE of the system. The discount rate also is correlated with the annual cost of the system.

Sensitivity Analysis 2
In this part, simulation results using the proposed RTP mechanism are presented. Sensitivity analyses results are indicated in Figure 17. The results show that the increase of the inflation rate (in lower discount rates) will lead to the integration of WT units to the MG architecture, which could decrease NPC and COE of the system. This is mainly because of renewable penetration increase and financial incomes from the sell-back energy to the grid. However, the major impact of the inflation rate (as well as the discount rate) is on the annual cost of the system (Figure 17b). Similar to previous sensitivity analysis, the discount rate has a negative impact on the system costs, as demonstrated in Figure  17c. As illustrated, the increase of discount rates will raise the NPC and COE of the system.

Conclusions
In this paper, a renewable-based MG is proposed for optimal planning and dayahead operation. The MG is a residential household located in Tehran, Iran. The location has significant potentials for solar radiation and a moderate temperature. An RTP-based DR program is also implemented in HOMER software to improve the techno-economic performance. The HOMER Optimizer is also used for finding optimal sizing of the components.
Two electricity pricing mechanisms, TOU pricing and RTP, are compared in two scenarios. Among the proposed system components (PV/WT/ESS/converter), the combination of PV and converter found to be economical in both scenarios. The DR program significantly shaved the peak load values. Moreover, the MG planning results indicated that the proposed DR program reduces NPC and COE from −19,687 USD to −23,461 USD and −0.0635 USD to −0.0660 USD/kWh, respectively. The obtained results for NPC and COE indicate an improvement in the financial results of the study. While purchasing power from the utility grid decreased, the power sales to the grid increased. The capacity of the PV system was also reduced from 9 to 12 kW. In addition, carbon emissions are reduced from 1397 to 1212 kg/yr by implementing the proposed DR program. Daily operation results indicated that the proposed DR program modifies load profiles for economic purposes. Since the battery ESS is considered a backup resource, it was not found to be economical in the optimum configuration. However, under an unreliable electricity grid, it could be essential for a constant power supply. The results of sensitivity analysis showed the negative impact of discount rate on the NPC and COE of the MG. In addition, higher inflation rates reduce the NPC and COE of the MG due to the renewable penetration and grid revenues. Uncertainties of RESs may affect the planning results; hence, for future work, stochastic planning of the proposed method will be conducted by the authors.

Conflicts of Interest:
The authors declare no conflict of interest.