Day-Ahead Optimization of Prosumer Considering Battery Depreciation and Weather Prediction for Renewable Energy Sources

In recent years, taking advantage of renewable energy sources (RESs) has increased considerably due to their unique capabilities, such as a flexible nature and sustainable energy production. Prosumers, who are defined as proactive users of RESs and energy storage systems (ESSs), are deploying economic opportunities related to RESs in the electricity market. The prosumers are contracted to provide specific power for consumers in a neighborhood during daytime. This study presents optimal scheduling and operation of a prosumer owns RESs and two different types of ESSs, namely stationary battery (SB) and plugged-in electric vehicle (PHEV). Due to the intermittent nature of RESs and their dependency on weather conditions, this study introduces a weather prediction module in the energy management system (EMS) by the use of a feed-forward artificial neural network (FF-ANN). Linear regression results for predicted and real weather data have achieved 0.96, 0.988, and 0.230 for solar irradiance, temperature, and wind speed, respectively. Besides, this study considers the depreciation cost of ESSs in an objective function based on the depth of charge (DOD) reduction. To investigate the effectiveness of the proposed strategy, predicted output and the real power of RESs are deployed, and a mixed-integer linear programming (MILP) model is used to solve the presented day-ahead optimization problem. Based on the obtained results, the predicted output of RESs yields a desirable operation cost with a minor difference (US$0.031) compared to the operation cost of the system using real weather data, which shows the effectiveness of the proposed EMS in this study. Furthermore, optimum scheduling with regard to ESSs depreciation term has resulted in the reduction of operation cost of the prosumer and depreciation cost of ESS in the objective function has improved the daily operation cost of the prosumer by $0.8647.


Introduction
Over the last two decades, using renewable energy sources (RESs) such as wind turbines (WTs) and photovoltaic (PV) systems has increased considerably due to some environmental concerns and Appl. Sci. 2020, 10 their unique features. From this perspective, traditional centralized power generations are replaced with modern forms of decentralized power generation, which can change consumption and production patterns pragmatically. In the modern electricity market, a new expression has been recently introduced to present a bilateral role. In fact, prosumers are regarded as an entity consumes electrical energy and reserve the capability to generate electricity in a reasonable way. It is often argued that market reform and regulatory support promote electricity market and ensure the promising profits to individual prosumers. In addition, the distribution system operator (DSO) encourages prosumers to achieve benefits and reduction in maintenance and expansion cost of equipment. In the U.S. and some European countries, the development of this kind of market has led to achieving a great balance between supplies and demand as well [1][2][3][4][5].
Recently, Iran's electricity market has depicted some developments in the increasing use of renewable energy sources as well as cost adjustment by the integration of prosumers and consumers in a prosumer market. These electricity markets have been established for prosumer aggregators, namely smart cities, zero-carbon building, off-grid islands, or residential and commercial aggregators. It is important to note that residential buildings play an active role in this market because they can be equipped with modern energy technologies such as plug-in hybrid electric vehicles (PHEVs). Besides, they can also supply energy for consumers through the nearest aggregator [6]. In fact, among different types of electric vehicles (EVs; such as a PHEV, fuel cell electric vehicle (FCEV) [7], and fully electric vehicle (FEV)), PHEV is the most prominent EV in Iran. Therefore, we have considered PHEV in our model [8].
Moreover, there is an ability to deploy load management and minimize energy consumption in order to achieve some economic benefits. Due to the high penetration of RESs and dynamic behavior of their electricity production during different days, a variable amount of electricity can be achieved in different hours of a specific day [9]. Although solar and wind generations are highly dependent on weather conditions, there may be insufficient renewable outputs energy during adverse weather conditions. As a result, decision-makers of this residential building intend to sell extra electricity to the consumers at a reasonable price. Similarly, consumers are also mainly motivated by the prices that are more affordable than utility rates. Since the electricity prices in Iran are based on the progressive tax scheme, where prices rise with more electricity consumption rate, consumers will avoid paying extra cost by a proper interacting with the prosumers.
The presence of local energy management systems (EMSs) seems essential in order to manage some energy storage systems like stationary batteries (SBs) and PHEVs in a sensible way. Energy storage systems (ESSs), along with other applications, are deployed to increase revenues and improve the operation of RESs efficiently. The primary purpose of taking advantage of energy management systems (EMS) in the current study is to reduce the incoming power from the utility at peak hours and providing extra-generated power for contracted consumers. As a result, an advanced charge and discharge schedule appears to be necessary, particularly for residential buildings, which have been contracted to some consumers with a specific amount of power during scheduled periods like peak hours. Likewise, this is more favorable to store generated electricity from RESs to support contracted consumers instead of purchasing from the network during peak hours.
Some studies have been conducted in order to focus on the optimal scheduling and operation of these ESSs in the power systems. In [10], the authors proposed comprehensive planning of ESSs, so that ESSs can mitigate WT output power fluctuation by using variable-interval optimization along with fuzzy controlling approaches. They also considered different characteristics of ESSs, including economic costs, state-of-health, and energy capacity for effective contribution. One of the applications of ESSs is the frequency regulation owing to their fast controlling abilities [11][12][13][14]. In addition to the mentioned application of ESSs, high penetration of RESs may result in voltage instability of the grids. From this perspective, they generally can be used to moderate voltage instability [15]. In these studies, researchers have not investigated the market-based operation or control of ESSs in order to achieve the maximum monetary incomes. In comparison to [11][12][13][14], this study purposes a market-based operation of ESSs in which the ESSs minimizes day-ahead operation cost of the prosumer. A different study presented an economical approach to define a policy for electricity pricing, which leads to the optimal charge and discharge of ESSs so that a metaheuristic algorithm is used for day-ahead scheduling of multicarrier energy networks [16]. However, they have neglected weather variability in the proposed method, which may affect the optimal result of the system.
In another study [17], researchers have proposed an optimum operational strategy for ESSs in order to maximize the level of profit from the South Korean demand response (DR) program. The fact is that ESSs are deployed in order to reduce peak load demand and make a useful contribution to grid reliability and stability simultaneously. It is argued that generating profit from ESSs may be difficult with the present DR program. Nevertheless, this study does not give any strategy for considering RESs in the proposed method. In fact, integration of RESs and ESSs would increase the level of profits from DR programs. Furthermore, some authors did not consider any specific factor for ESS aging. However, they verify that the proposed methods may be feasible in the near future by changing the conditions of the current DR. In [18], a two-phase ESS scheduling model has been introduced. In the first stage of the proposed model, ESS reduces peak load, and in the second stage, electricity trading is performed, which results in a minimization of the overall operating cost of the system by the use of the remaining capacity. Besides, this paper has presented some machine learning techniques for a load prediction. However, the authors indicated that in order to have a better prediction, it is advised to consider variables related to weather, namely ambient temperature, and other environmental factors. In a recent study [19], optimal scheduling and operation of ESSs by considering the corrective operation of ESS has been outlined in prosumer energy market where the objective is to achieve maximum profits of the prosumer. It is important to note that no weather predictions have been considered for RESs productions in their work. In fact, all their assumptions are generally based on historical data. In addition, several studies in recent years have worked on the optimal operation of PHEVs in different networks and markets [20][21][22]. Due to the high capital cost of ESSs, and a limited number of charge cycles, many new types of studies have deployed battery depreciation models in their studies [21][22][23].
In this paper, enhanced scheduling of the prosumer in a day-ahead electricity market has been proposed, which can benefit from RESs and ESSs simultaneously. Due to the high dependency of RESs upon weather conditions, they are assumed as intermittent energy sources. As a result, a feed-forward artificial neural network (FF-ANN) has been introduced in order to predict day-ahead weather conditions instead of using historical data for PV and WT productions. However, considering a weather predicting module in the EMS of the prosumer was neglected in recent studies [18,19]. As a matter of fact, neglecting uncertainties of weather parameter in the day-ahead operation of the prosumer would result in the inaccurate operation cost of the prosumer. In addition, some recent studies in the field of prosumer scheduling have neglected to consider a proper depreciation cost in the optimization model [20][21][22][23]. This paper tries to fill such a knowledge gap by regarding the depreciation cost of both SB and PHEV in the optimization model based on daily depth of charge (DOD) reduction because of the limited lifetime of the batteries. In the final step, mixed-integer linear programming (MILP) has also been used to minimize the operation cost of the prosumer in a fair way.

System Architecture
The architecture of the proposed energy system has been shown in Figure 1. This layout includes RESs (e.g., PV and WT), ESSs (e.g., SB and PHEV), power conversion unit (PCU), prosumer load, and contracted power that the prosumer committed to supplying in a fair way. Electrical lines transfer electricity among the system, and RESs generate electricity and participate in the power supplying as well as possible grid sales. Nevertheless, the priority of RESs is to support load demand as much as possible. In this layout, PCU is deployed to convert power from DC/AC and AC/DC. ESSs can store additional energy as well as accumulates low-price electricity from the grid in order to inject into Appl. Sci. 2020, 10, 2774 4 of 22 prosumer self-consumption with proper scheduling. Data lines are designed for data transfer between components and EMS. The EMS collects data from each system and uses all gatherings in day-ahead optimization procedures. Moreover, EMS stores collected data in data storage for pattern-analyzing, such as weather conditions, price data, prosumer load, and contracted power. Besides, EMS is able to predict the day-ahead output power of RESs based on the stored historical weather data.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 4 of 23 supplying as well as possible grid sales. Nevertheless, the priority of RESs is to support load demand as much as possible. In this layout, PCU is deployed to convert power from DC/AC and AC/DC. ESSs can store additional energy as well as accumulates low-price electricity from the grid in order to inject into prosumer self-consumption with proper scheduling. Data lines are designed for data transfer between components and EMS. The EMS collects data from each system and uses all gatherings in day-ahead optimization procedures. Moreover, EMS stores collected data in data storage for pattern-analyzing, such as weather conditions, price data, prosumer load, and contracted power. Besides, EMS is able to predict the day-ahead output power of RESs based on the stored historical weather data.

The Role of Prosumer
Prosumers have an active interaction with system operation. From this view, they are able to store electrical energy during low electricity price or when surplus power is produced through RESs. Therefore, the stored energy is injected into loads during hours when the electricity price is high compared to other periods. In addition, they have to supply the contracted power to consumers during defined hours. Prosumers, unlike consumers, pay for specific contracted power. Since the electricity produced by the prosumers is lower than the utility, the consumers prefer to use electrical energy from the prosumer. For this reason, this type of energy trading between prosumers and consumers is considered an economic activity. It is worth mentioning that the prosumer benefits from minimizing imported electricity from the grid during contracted hours.
According to Figure 2, a typical prosumer market includes three sections: EMS section, system trading section, and data storage section. The EMS is utilized to monitor electricity generation and consumption continuously. This monitoring aims to achieve historical data by the examination of patterns for consumption load and electricity price. Moreover, EMS performs day-ahead prediction of RESs output power based on the recorded historical weather data. Then, the optimization is performed to reach the optimal operation of the understudy prosumer. Afterward, dispatching

The Role of Prosumer
Prosumers have an active interaction with system operation. From this view, they are able to store electrical energy during low electricity price or when surplus power is produced through RESs. Therefore, the stored energy is injected into loads during hours when the electricity price is high compared to other periods. In addition, they have to supply the contracted power to consumers during defined hours. Prosumers, unlike consumers, pay for specific contracted power. Since the electricity produced by the prosumers is lower than the utility, the consumers prefer to use electrical energy from the prosumer. For this reason, this type of energy trading between prosumers and consumers is considered an economic activity. It is worth mentioning that the prosumer benefits from minimizing imported electricity from the grid during contracted hours.
According to Figure 2, a typical prosumer market includes three sections: EMS section, system trading section, and data storage section. The EMS is utilized to monitor electricity generation and consumption continuously. This monitoring aims to achieve historical data by the examination of patterns for consumption load and electricity price. Moreover, EMS performs day-ahead prediction of RESs output power based on the recorded historical weather data. Then, the optimization is performed to reach the optimal operation of the understudy prosumer. Afterward, dispatching commands are sent to controllers related to these dispatchable sources. If islanded conditions have occurred, EMS analyzes the grid situation by simulation of frequency regulation and voltage stability and attempts to amend them by taking advantage of network optimization or any other schemes. The trading system is able to sell extra electricity to the grid and participate in the electricity market effectively. In addition, the electricity pricing of the prosumer and energy payments are estimated at this level of study. Customers should utilize an intelligent energy meter to forward the measured rates to EMS of the prosumer. Then, the incoming information to EMS is stored in data storage.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 5 of 23 commands are sent to controllers related to these dispatchable sources. If islanded conditions have occurred, EMS analyzes the grid situation by simulation of frequency regulation and voltage stability and attempts to amend them by taking advantage of network optimization or any other schemes. The trading system is able to sell extra electricity to the grid and participate in the electricity market effectively. In addition, the electricity pricing of the prosumer and energy payments are estimated at this level of study. Customers should utilize an intelligent energy meter to forward the measured rates to EMS of the prosumer. Then, the incoming information to EMS is stored in data storage.

Methodology
Based on the previous discussions, PV and WT are the main sources for generating electrical energy in this market. In addition, ESSs are used for economic and technical purposes, including the supply of prosumer and consumer contracted loads. In the following, mathematical formulations of RESs, ESSs, and battery depreciation processes are described. Furthermore, the methods, which have been allocated to the time-series FF-ANN prediction and optimization model are provided.

PV Unit
The output power of PV, which mostly depends on the ambient temperature and solar irradiation, is formulated based on Equation (1). Furthermore, module efficiency ( ) should be considered in the output power of PV units. Equations (1) and (2) are used for calculating PV output power over operation horizon [24,25]: is calculated as follows: Since the PV system is an alternative power resource, its output power may vary from one hour to another hour through changes in solar irradiance and temperature based on the above formulations. The PV model introduced in (2) does not reflect the thermal depreciation at high temperature. The thermal loss is quite severe in some harsh environment such as Asian countries, including Iran as well [26,27]. Therefore, including a term to consider thermal loss would

Methodology
Based on the previous discussions, PV and WT are the main sources for generating electrical energy in this market. In addition, ESSs are used for economic and technical purposes, including the supply of prosumer and consumer contracted loads. In the following, mathematical formulations of RESs, ESSs, and battery depreciation processes are described. Furthermore, the methods, which have been allocated to the time-series FF-ANN prediction and optimization model are provided.

PV Unit
The output power of PV, which mostly depends on the ambient temperature and solar irradiation, is formulated based on Equation (1). Furthermore, module efficiency (η PV t ) should be considered in the output power of PV units. Equations (1) and (2) are used for calculating PV output power over operation horizon [24,25]: η PV t is calculated as follows: Since the PV system is an alternative power resource, its output power may vary from one hour to another hour through changes in solar irradiance and temperature based on the above formulations. The PV model introduced in (2) does not reflect the thermal depreciation at high temperature. The thermal loss is quite severe in some harsh environment such as Asian countries, including Iran as well [26,27]. Therefore, including a term to consider thermal loss would demonstrate an exact model of PV performance. However, this study has not considered any thermal depreciation in the PV model.

WT Unit
WT produces electrical energy by exploiting of the wind kinetic energy. Environmental components such as wind speed, air density, aerodynamic coefficient, and surface area are regarded as essential Appl. Sci. 2020, 10, 2774 6 of 22 factors in the output power calculation of WT [28][29][30]. In this paper, the curve interpolation method is deployed to calculate WT output power. This method has been presented as an accurate solution in recent studies, which is formulated as follows [31]:

Energy Storage Systems
In this paper, energy storage systems include two appliances, namely stationary battery and plug-in hybrid electric vehicle. Both of them can be described with the same formulation because of their identical performance. However, different technical parameters of them have been proposed in this paper. Some restrictions related to energy storage systems are taken into account in Equations (4)-(12) [32,33]: In Equation (4), the level of charge in each ESS is defined by the state of charge (SOC), which is constrained by upper and lower bands defined in Equations (5)- (6). According to Equation (7), it is essential for ESS to have the same initial and final levels of SOC because ESS operates every day. It is worth mentioning that the full charging/discharging of ESSs is not recommended because it results in the fast depreciation of the batteries. From this perspective, full charging/discharging of ESS is prohibited in the day-ahead optimization as described in Equations (8)- (11). Since charging and discharging of ESS cannot occur at the same time, a binary value is defined in order to indicate this constraint, as shown in Equation (12).

Depreciation of ESSs
According to [34], the DOD of a battery influences its lifetime to a certain extent. In addition to this, prosumers, who contracted to provide a specific amount of power to the aggregator, may face major daily discharge-charge cycles. Consequently, this repetitive process will result in the depreciation of the batteries in the future. This battery depreciation can be introduced by taking into consideration a cost on DOD parameter at the end of a day.  (13) and (14) follows [35]: It is assumed that the battery pack would need a replacement when its total throughput is the same throughput as its lifespan. The battery depreciation cost coefficients per kWh are characterized using the following equations: For both types of ESSs, different depreciation costs have been regarded according to their characteristics. The formulation of total depreciation, including PHEV and SB, is described below:

Predicting Weather Parameters Using Time Series FF-ANN
Some recent studies have taken advantage of ANN for predicting weather conditions [36][37][38]. In this study, a multilayer perceptron (MLP) as an FF-ANN is used for weather parameter prediction. The backpropagation (BP) algorithm is also used for training the FF-ANN [39]. In this study, feedforward expresses the transaction of data from input to output. Feedforward output is determined by passing the input through the neural network. Feedforward networks perform with supervised learning rules, which calculate the best output to minimize the error between inputs and their respective outputs by modifying the network's weights.
Generally, the time series is a set of data points that are arranged by equal space-time. In fact, in time series prediction, a model is deployed to predict upcoming values based on recently recorded data [40]. In other words, future values are predicted by learning the previous data series. From this perspective, MLP-ANN is introduced to predict time series because this method yields more satisfactory results in some recent studies [41].
It is important to mention that MLP-ANN demands some memory for temporal information processing. Different methods are established for making this memory in ANN like time delays in this network. The fact is that these delays are used in order to adjust the parameters of ANN during the learning process. A typical modeling of time series with MLP-ANN has been shown in Figure 3. Three layers of this model include the input layer, hidden layer, and output layer. According to Figure 3, single variant inputs, which are depicted through X(n − 1), X(n − 2) . . . X(n − p), are the previous data samples, p is the prediction order, and y(n) is the output value, which indicates the prediction result. Appl. Sci. 2020, 10, x FOR PEER REVIEW 8 of 23 In this paper, solar irradiance, temperature, and wind speed predictions are represented based on last year's data that were gathered from a local meteorological center located in Kerman province, Iran. Figure    In this paper, solar irradiance, temperature, and wind speed predictions are represented based on last year's data that were gathered from a local meteorological center located in Kerman province, Iran. Figure 4 illustrates hourly data by year from 1 January 2007 to 31 December 2007. A three distinct MLP-ANN is considered in order to forecast the solar irradiance, temperature, and wind speed. Two different data of each parameter were used for the training and testing of the MLP-ANN method. In order to have a more suitable prediction for fay-ahead optimizations, the time horizon was proposed 24 h ahead at each time series. In addition to the mentioned considerations, input and output data were normalized to [0,1] as follows: Appl. Sci. 2020, 10, x FOR PEER REVIEW 8 of 23 In this paper, solar irradiance, temperature, and wind speed predictions are represented based on last year's data that were gathered from a local meteorological center located in Kerman province, Iran. Figure

Optimization Modeling
The main purpose of the mentioned objective function is to minimize the operation cost of the prosumer, which is mainly the electricity price that should be paid to the utility. Furthermore, it is essential to consider battery depreciation because of the high replacement cost of ESSs. As a result, battery depreciation can be included in this objective function as follows: S.t Equations (4) to (16) Optimization horizon considered one day-ahead ( = 24, = 1 ). Different optimization methods can be employed in order to solve this problem effectively. In this study, mixed-integer linear programming (MILP) was introduced to overcome this objective function in a sensible way. In fact, MILP is able to carry out complicated problems with less calculation time and find optimal global solutions [42]. Furthermore, Equation (21) indicates a balance between provided and demanded power in the prosumer grid. Equations (22) and (23) describe system capacity limits, which are −500 and 500 kWh for the lower and upper bands, respectively.

Prediction Results
Two different data, including real and predicted data, have been shown in Figure 5 to describe an ordinary summer day during this research. Figure 6 and Table 1 show an error histogram and linear regression results for predicted weather parameters. As can be seen from the results, it was evident that predicted values for temperature and solar irradiance were predicted accurately enough. However, wind speed was not predicted precisely in comparison to the two other parameters due to its high hourly variations. It is worth noting that in this paper, the application of MLP in time series prediction was investigated. Some theoretical details of the MLP are available in [43]. Prediction values were used for calculating PV and WT output power according to the mentioned equations. In the following, a case study was defined in a further subsection (4.3.3) in order to analyze the level of accuracy of these predictions.

Optimization Modeling
The main purpose of the mentioned objective function is to minimize the operation cost of the prosumer, which is mainly the electricity price that should be paid to the utility. Furthermore, it is essential to consider battery depreciation because of the high replacement cost of ESSs. As a result, battery depreciation can be included in this objective function as follows: Equations (4) to (16) Optimization horizon considered one day-ahead (t n = 24, d n = 1). Different optimization methods can be employed in order to solve this problem effectively. In this study, mixed-integer linear programming (MILP) was introduced to overcome this objective function in a sensible way. In fact, MILP is able to carry out complicated problems with less calculation time and find optimal global solutions [42]. Furthermore, Equation (21) indicates a balance between provided and demanded power in the prosumer grid. Equations (22) and (23) describe system capacity limits, which are −500 and 500 kWh for the lower and upper bands, respectively.

Prediction Results
Two different data, including real and predicted data, have been shown in Figure 5 to describe an ordinary summer day during this research. Figure 6 and Table 1 show an error histogram and linear regression results for predicted weather parameters. As can be seen from the results, it was evident that predicted values for temperature and solar irradiance were predicted accurately enough. However, wind speed was not predicted precisely in comparison to the two other parameters due to its high hourly variations. It is worth noting that in this paper, the application of MLP in time series prediction was investigated. Some theoretical details of the MLP are available in [43]. Prediction values were used for calculating PV and WT output power according to the mentioned equations. In the following, a case study was defined in a further subsection (Section 4.

Case Studies
In order to analyze the behavior of the prosumer, three case studies were introduced according to the system architecture, which has been shown in Figure 1. The three considered case studies are as follows.

•
Case 1: Day-ahead scheduling of the prosumer considering predicted weather data. • Case 2: Day-ahead scheduling of the prosumer considering ESSs depreciation cost and predicted weather data. • Case 3: Day-ahead scheduling of the prosumer considering real weather data.
As discussed in previous sections, no power loss was assumed in the mentioned objective function since the grid of the prosumer had relatively short lines in comparison to the transmission or distribution lines. Parameters of PV and WT are shown in Table 2, as well as technical parameters of the energy storage system are depicted in Table 3. Table 2. Technical parameters photovoltaic (PV) and wind turbine (WT) units [44].  In this study, residential buildings with net metering devices were included in a time of use (TOU) pricing program with different hourly rates [45]. TOU rates were used as prosumer payments to the utility. These rates were based on real electricity prices utilized in Iran's electricity market during the summer season. However, the rates differ from region to region depending on their varying climates. In a particular case, the city of Kerman (30 • 28 39"N, 57 • 08 34"E) was included in tropical region 2 (out of 4 tropical regions) due to its hot and dry weather during the summer season. Table 3 depicts the TOU rates utilized in all simulations [46]. According to Table 4, two mid-peak (07:00 to 13:00, 17:00 to 19:00) and peak (13:00 to 17:00, 19:00 to 23:00) time intervals and one off-peak (23:00 to 07:00) time interval occurs during a day. Both Figures 7 and 8 show the output power of PV and WT units based on predicted weather parameters. In the following, Figure 9 illustrates the prosumer consumption pattern during an ordinary day. The fact is that these values were acquired from a typical residential building that was recorded during the specific year. The load profile depicted in Figure 9 has one major peak consumption at noon (12:00). Figure 10 illustrates the contracted power that the prosumer was committed to supplying to the consumer. From this perspective, the prosumer agreed to a contract for providing a total of 16 kW of power during specific hours of the day (14:00 and 16:00) according to Figure 10.

PV Parameter
In this study, residential buildings with net metering devices were included in a time of use (TOU) pricing program with different hourly rates [45]. TOU rates were used as prosumer payments to the utility. These rates were based on real electricity prices utilized in Iran's electricity market during the summer season. However, the rates differ from region to region depending on their varying climates. In a particular case, the city of Kerman (30°28‵39‶N, 57°08‵34‶E) was included in tropical region 2 (out of 4 tropical regions) due to its hot and dry weather during the summer season. Table 3 depicts the TOU rates utilized in all simulations [46]. According to Table 4, two mid-peak (07:00 to 13:00, 17:00 to 19:00) and peak (13:00 to 17:00, 19:00 to 23:00) time intervals and one off-peak (23:00 to 07:00) time interval occurs during a day. Both Figures 7 and 8 show the output power of PV and WT units based on predicted weather parameters. In the following, Figure 9 illustrates the prosumer consumption pattern during an ordinary day. The fact is that these values were acquired from a typical residential building that was recorded during the specific year. The load profile depicted in Figure 9 has one major peak consumption at noon (12:00). Figure 10 illustrates the contracted power that the prosumer was committed to supplying to the consumer. From this perspective, the prosumer agreed to a contract for providing a total of 16 kW of power during specific hours of the day (14:00 and 16:00) according to Figure 10.      In this paper, GAMS (GAMS Development Corporation, Washington, D.C , USA) software was deployed to solve MILP problems through CPLEX (IBM ILOG CPLEX Optimization Studio, New York, USA) solver. In addition, a 64-bit personal computer with 8 GB RAM and Core i5 (Intel) CPU was used during all simulations. Predicted values of weather parameters were linked from the MATLAB (MathWorks, Massachusetts, USA) environment to GAMS through the GDXMRW interface [47].    In this paper, GAMS (GAMS Development Corporation, Washington, D.C , USA) software was deployed to solve MILP problems through CPLEX (IBM ILOG CPLEX Optimization Studio, New York, USA) solver. In addition, a 64-bit personal computer with 8 GB RAM and Core i5 (Intel) CPU was used during all simulations. Predicted values of weather parameters were linked from the MATLAB (MathWorks, Massachusetts, USA) environment to GAMS through the GDXMRW interface [47]. In this paper, GAMS (GAMS Development Corporation, Washington, DC, USA) software was deployed to solve MILP problems through CPLEX (IBM ILOG CPLEX Optimization Studio, New York, USA) solver. In addition, a 64-bit personal computer with 8 GB RAM and Core i5 (Intel) CPU was used during all simulations. Predicted values of weather parameters were linked from the MATLAB (MathWorks, Massachusetts, USA) environment to GAMS through the GDXMRW interface [47].

Case 1
In the first case, day-ahead optimization was conducted by taking advantage of TOU prices and real load data as well as predicted weather data according to details described in previous sections. The predicted output power of PV and WT were calculated based on the Equations (1)-(3). Optimization results are shown in Figures 11 and 12. Based on the results in Figure 11a,b, SB and PHEV were charged at separate hours during mostly off-peak and mid-peak periods. SB and PHEV also discharged the stored power during peak hours when the prosumer was responsible for providing the consumer load. Based on Figure 12, the prosumer imported less power from the utility grid in the hours between 7:00 and 11:00 because of sufficient production of the PV and WT system, which reduced the operation cost of the prosumer. It is worth mentioning that according to Figure 12, a noticeable decline had occurred at 14:00 since SB was discharging its power in order to supply the consumer load in a reasonable way. Furthermore, a considerable increase had occurred at 15:00, which is ordinary since the EMS was charging SB and PHEV to supply the contracted load in the hours between 14:00 and 16:00. Therefore, SB discharged at 14:00 to support the contracted power. Although PHEV was discharged at 13:00 with a small amount of electricity (0.2163 kW), the significant injection had occurred at 16:00. Then, SB and PHEV were charged at 17:00 and 18:00, respectively, because the TOU prices were at a lower level in comparison to the peak hours. In the following, ESSs were discharged in peak periods for having a minimum operation cost. According to Figure 11b, PHEV was discharged at 19:00 and 20:00, while SB was discharged at 22:00. Finally, when the peak period ended at 22:00, EMS was making a proper plan in order to charge the ESSs after this time, which resulted in more power import from the grid by the prosumer based on the overall trend in Figure 12. following, ESSs were discharged in peak periods for having a minimum operation cost. According to Figure 11b, PHEV was discharged at 19:00 and 20:00, while SB was discharged at 22:00. Finally, when the peak period ended at 22:00, EMS was making a proper plan in order to charge the ESSs after this time, which resulted in more power import from the grid by the prosumer based on the overall trend in Figure 12.
RESs are merely allocated to provide the prosumer load and consumer contracted power. The main reason is that the production of the RESs is much less than all electricity consumption, and the utility grid provides them to meet the customers' requirements. It is important noting that RESs do not inject electricity into the utility grid, and ESSs are charged through the utility grid instead of RESs due to economic benefits. This pattern may differ from one day to another and depends on input data such as weather and load and data. In this case, the objective function value was achieved at $20.353. In addition, revenues of contracted power were not considered in the objective function due to fixed costs of payments.  In order to have a better understanding of ESSs depreciation, this case study was conducted. The objective function in the previous case study was acquired by considering the depreciation cost  In order to have a better understanding of ESSs depreciation, this case study was conducted. The objective function in the previous case study was acquired by considering the depreciation cost of ESS. In this case, simulations were performed with and without considering ESSs depreciation as RESs are merely allocated to provide the prosumer load and consumer contracted power. The main reason is that the production of the RESs is much less than all electricity consumption, and the utility grid provides them to meet the customers' requirements. It is important noting that RESs do not inject electricity into the utility grid, and ESSs are charged through the utility grid instead of RESs due to economic benefits. This pattern may differ from one day to another and depends on input data such as weather and load and data. In this case, the objective function value was achieved at $20.353. In addition, revenues of contracted power were not considered in the objective function due to fixed costs of payments.

Case 2
In order to have a better understanding of ESSs depreciation, this case study was conducted. The objective function in the previous case study was acquired by considering the depreciation cost of ESS. In this case, simulations were performed with and without considering ESSs depreciation as described in subsection (Section 3.1.4). The patterns of ESSs SOC were depicted for the understudy day ( Figure 13). Some significant reductions occurred when ESSs was discharging to obtain maximum profits from the market. According to the previous description, the initial and final values of SOC should be equal in the day-ahead operation of ESSs. The minimum values of SOC for SB and PHEV on the day were achieved as 1.25 kW and 1.14 kW, respectively. These two values were regarded in the first case study and the objective function achieved as $20.353. However, if the ESSs depreciation term D ESS d has not been regarded in the mentioned objective function, the value of US$21.248751 would have been achieved, which shows an increase in the operation cost of the prosumer. The difference between the two values was US$0.8647 for a typical summer day. With regard to the ESS lifetime, a higher value will be obtained, which shows the effect of battery depreciation on the system operation cost. Moreover, the daily value of minimum SOC (SOC min,SB d ,SOC min,PHEV d ) changes based on the operational parameters, such as load data (including prosumer load data and contracted load with the consumer) and availability of RESs. As a result, long-term optimization seems necessary in order to analyze the precise value of ESSs depreciation cost.

Case 3
In all previous cases, the output power of PV and WT units was presented under predicting conditions. To evaluate the effect of predicted and real weather data on changes in the operation cost of prosumer, this case study was introduced. Real weather data were deployed for optimization. Figure 14 demonstrated the power flow of the system based on predicted and real data. As can be seen, both diagrams followed a similar pattern where the performance of the system was not changed significantly. However, for the case with predicted weather data, less electrical power was imported from the grid between 4:00 and 11:00. The trend was reversed from 12:00 to 18:00, where the case with real data imported more electricity. Between 18:00 and 3:00, the exchanged power was the same for both cases (real and predicted weather data) because the PV as the main source of energy had no output power in this period. It is important to say that the operation cost of the prosumer, when the real data was used, would be US$20.384, which shows a slight increase in comparison to the use of the predicted data for the understudy day. The difference between real and predicted operation cost was US$0.031, which is a desirable value. Therefore, the proposed EMS for the day-ahead operation of the prosumer, which considered intermittency of RESs and ESSs depreciation cost, was effective according to the obtained results.

Case 3
In all previous cases, the output power of PV and WT units was presented under predicting conditions. To evaluate the effect of predicted and real weather data on changes in the operation cost of prosumer, this case study was introduced. Real weather data were deployed for optimization. Figure 14 demonstrated the power flow of the system based on predicted and real data. As can be seen, both diagrams followed a similar pattern where the performance of the system was not changed significantly. However, for the case with predicted weather data, less electrical power was imported from the grid between 4:00 and 11:00. The trend was reversed from 12:00 to 18:00, where the case with real data imported more electricity. Between 18:00 and 3:00, the exchanged power was the same for both cases (real and predicted weather data) because the PV as the main source of energy had no output power in this period. It is important to say that the operation cost of the prosumer, when the real data was used, would be US$20.384, which shows a slight increase in comparison to the use of the predicted data for the understudy day. The difference between real and predicted operation cost was US$0.031, which is a desirable value. Therefore, the proposed EMS for the day-ahead operation of the prosumer, which considered intermittency of RESs and ESSs depreciation cost, was effective according to the obtained results.

Conclusions
In this paper, the authors introduced a day-ahead optimization for the prosumer by considering weather predictions for PV and WT output power. Linear regression results for predicted and real weather data achieved 0.96, 0.988, and 0.230 for solar irradiance, temperature, and wind speed, respectively. According to the results, solar irradiance and temperature were accurately predicted, however, due to high hourly intermittency of wind speed, it was not properly predicted. The operation cost of the prosumer by using the predicted data had shown a minor difference (US$0.031) with the operation cost of the system with real weather data. In order to investigate the performance of ESS, the depreciation cost was proposed in the optimization model, and the prosumer interaction

Conclusions
In this paper, the authors introduced a day-ahead optimization for the prosumer by considering weather predictions for PV and WT output power. Linear regression results for predicted and real weather data achieved 0.96, 0.988, and 0.230 for solar irradiance, temperature, and wind speed, respectively. According to the results, solar irradiance and temperature were accurately predicted, however, due to high hourly intermittency of wind speed, it was not properly predicted. The operation cost of the prosumer by using the predicted data had shown a minor difference (US$0.031) with the operation cost of the system with real weather data. In order to investigate the performance of ESS, the depreciation cost was proposed in the optimization model, and the prosumer interaction with the market was analyzed. ESSs reduced the operation cost of the prosumer by optimal charge and discharge cycles. Moreover, the depreciation cost of ESS in the objective function improved the daily operation cost of the prosumer by US$0.8647. Due to a high variability of wind speed, MLP-ANN could not accurately predict the hourly wind speed. Therefore, it is highly suggested to implement and evaluate different predicting algorithms to validate the proposed optimization model.
Uncertainty of the load demand may affect the operation cost of the prosumer. However, this study had not considered the load prediction for the day-ahead operation of the study, hence, it could be considered alongside the weather prediction in the future works. Moreover, a comprehensive model for depreciation cost of ESSs could be considered in the future works in which the gap between the highest and lowest SOC is minimized in every day.