Stochastic coordination of the wind and solar energy using energy storage system based on real-time pricing

In this paper, stochastic synchronization of the wind and solar energy using energy storage system based on real-time pricing in the day-ahead market along with taking advantage of the potential of demand response programming has been analyzed. Since renewable energies, loads and prices are uncertain, and planning is based on real-time pricing, the optimal biding proposition considers the wind power, solar system, and energy storage system. Uncertainty is addressed to solve the bidding strategy in a day-ahead market for optimal wind and PV power and optimal charging for energy storage. Batteries are the most promising device to compensate for the fluctuations of wind and photovoltaic power plants to mitigate their uncertainty. In general, using MILP is a suitable approach to address uncertainty as long as a linear formulation is acceptable for modeling either with continuous variables or integer ones. By setting some scenarios to formulate market prices, imbalance of energy, wind and solar system, the uncertainty problems could be easily solved by MILP solver. The model created enables the retailer to realize the potentials of the demand response program and exploit high technical and economic advantages. To ensure fair prices, a set of regulating constraints is considered for sales prices imposed by the regulation committees. A model is presented to optimize the electricity trading strategy in the electricity market, considering the uncertainty in the wholesale market price and the demand level. The retailer considered in this paper is a distribution company that is the owner and operator of the networks and operates under real-time pricing regulations. To model demand response, the elasticity coefficient is used. The proposed solution is implemented on a standard 144-bus sample network using a nonlinear integer programming method. The presented method results provide helpful and valuable information based on the optimal method proposed by the retailers considering the demand response program and real-time pricing system.

Cost of the service proposed to the customers in case of x at time h

Introduction
An energy generator, including wind and solar system (wind-solar system), faces uncertainty caused by wind sources and solar irradiation. This uncertainty is caused by the alternative and variable nature of wind sources and solar irradiation. Still, also it is caused by the uncertainty of electricity price in the day-ahead market. So, contribution strategy in the market for a wind-solar generator should be such that these uncertainties are considered such that maximum revenue is obtained from energy commerce in the day-ahead market. Otherwise, ignoring these uncertainties allows reducing income due to ignoring the effect of the imbalance penalty. Considering these uncertainties properly might reduce the decrease in revenue of the windsolar generator compared to independent operation of wind and solar systems. A power producer owning a wind system and a PV system, i.e., Wind-PV producer, faces augmented uncertainty established by the availability of the sources of energy, wind velocity and solar irradiance (Gomes et al. 2017a).
In Akbari et al. (2019), a new framework has been proposed in which demand response is used as an energy source for electricity retailers. In this method, demand response (DR) bases on step-reward have been introduced as a real-time source of the retailer. Also, the unpredictable behavior of the customers taking part in this DR based on the proposed reward has been modeled through the contribution coefficient based on the scenario. In Yang et al. (2018), the purpose is to offer a model for optimizing a retailer's profit while providing a certain amount of load through buying from the wholesale market and the dayahead market and exploiting demand response sources. Thus, the problem would be short-term scheduling for 24-h in various study steps modeled as mixed-integer programming.
In Díaz et al. (2019), a general framework was suggested for using the energy retail market by considering an algorithm based on uncoordinated game theory along with high changes of distributed renewable generation sources and demand along with applying the management of demand in the micro-grids. The proposed structure was developed based on junction property through using a large number of renewable and storage resources. Based on this structure, consumers can play a role in the market and DR along with local utilization, DG management, electricity generators, and energy storage resources for suggesting price. In Gomes et al. (2018), a decision-making framework was proposed based on random scheduling for a retailer to 1. First, the selling price of the electricity was determined for the customers based on time-oriented rate. Then, a sample of different contracts was controlled for providing demands and supporting against risks in a short period of time.
In Sekizaki and Nishizaki (2019), a method has been proposed to determine a proper pricing strategy for a retailer that provides electricity for the consumer in the short-term electricity market. The purpose is to minimize the energy buying costs of commercial opportunities which provide the daily market. A genetic algorithm has been designed for optimizing parameters that define the best buying strategy. GA performs general explorations, and it is very effective in solving the problem.
In Gomes et al. (2017b), protective tariffs, guaranteed network access, green generation certificate of awards, investment incentives, tax discounts, and low-level costs have been accepted as incentives for renewable generations in many countries. In Arribas et al. (2016), these resources have been used simultaneously, and simultaneous sale has been offered to reduce the effect of uncertainty and variability. In addition, this study has proposed a method to achieve this offer. The relationship and coordination between wind and solar energy have been studied in the Iberian Peninsula. The results suggest the simultaneous operation of these two systems to decrease the uncertainty of providing power. Studies have proposed various methods for wind energy sell strategy to handle uncertainty.
In Mahmoudi-Kohan et al. (2010), a strategy was proposed for suggesting the desired price for the customers for enhancing the profit of a retailer. Three steps are used based on load profile clustering techniques. In addition, this paper was suggested as a new acceptance function to increase the profit of the retailer. Further, a group of 300 customers of a 20 kV distribution network was assessed by using a new method. Based on the numerical results, the proposed plan can increase the profit of the retailer by offering different prices to different customers. Further, the number of the customers tending to buy electricity from the retailer increases by applying the proposed strategy. The price of a virtual plant in the market of energy and spinning reserve simultaneously was proposed in Mashhour and Moghaddas-Tafreshi (2011). The suggested pricing strategy is an unbalanced model based on the role of plants given the certain price which regards security constraints and demand-generation balance. The proposed pricing strategy is an unbalanced model based on the contribution of plants based on a specific price that considers demandgeneration balance and security constraints.
In Carrion et al. (2009), a bi-level scheduling approach has been proposed to solve a retailer's short-term decisionmaking. The retailer's objectives include defining contracts and offering the desired price to the consumers in a shortterm horizon. The retailer has to handle the uncertainty of future power pool, customers' demands, and competitors' prices estimated in this paper through random scheduling. In addition, a retailer's risk is modeled based on the conditional value at risk (CVAR) of profit. Customer's response to retailer price and competition among retailers is considered in the proposed bi-level model. In reference (Ahmadimanesh and Kalantar 2017;Samimi and Kazemi 2016), by integrating the demand response program in the short-term retailer decision, the retailer has tried, in addition to the short-run activities, to have an offer of optimal sales with the joint operation of the wind system and the solar system comes with an energy storage system. The uncertainty in the day-ahead market price and wind and solar energy products is one of the main characteristics of this proposal for sale. The created model enables the retailer to realize the potential of the demand response program and thus exploit high technical and economic benefits while also providing a better subscriber load while earning more money. In previous studies, the issue of the presence of retailers has not been addressed about the disparity of production. In reference (Morais et al. 2012;Samimi et al. 2017), a randomized planning model for separate active and reactive power planning in the distribution grid with the presence of solar and wind sources of energy in the day-ahead market is underway. The proposed reactive power of DGs is presented through the capability curve. To randomly model the problem, constructing scenarios or cases, and reducing their number, we used the probability density function of the prediction error of the output power of wind and solar power plants. The probability density function can be divided into arbitrary steps that each step has a certain probability of occurrence. In the suggested procedure, the cases are obtained by the roulette wheel mechanism and the Monte Carlo simulation based on probability density functions associated with random variables. To reduce the volume of computations, repeat scenarios and low probability scenarios are not considered. During this procedure, the random issue is broken down into many specific issues with different probabilities. The input data of the problem are obtained by Monte Carlo simulation, and then, the probability of normalization of each scenario is obtained. Each of the scenarios is solved separately, which at the final step of the optimization procedure provides a set of effective solutions for all cases. Finally, the solutions obtained from the confirmed cases should be based on their probability to find out the expected result of the random issue, and the most effective solution is obtained. The reference (Chowdhury et al. 2017) is to demand response in the short-term decisionmaking of distribution companies. A distribution company will have to decide on RTP sales prices, in addition to its current short-term activities. In Gazijahani et al. (2018), the results have shown that significant discrepancies have been created due to high marginal costs. Also, the increased use of DG resources in reducing network losses is assumed in the short run of a distribution company in Gazijahani et al. (2018). Reference (Xie et al. 2018) has developed an energy acquisition model for the distribution company, with diversified sources, including buying from the network, an investor-owned DG, a distributor-owned DG, and limited options. The developed model (Asensio et al. 2018) has expanded to include the dynamical behavior of distribution companies. The expanded model is a two-level optimization problem that includes issues that maximize both profits of distribution companies and social welfare. Reference (Ghahramani et al. 2019) deals with energy management and backup of intelligent distribution networks by considering uncertainties in controllable loads, batteries, and wind turbines. Since the most important issues and problems in future power grids are the issues of power consumption uncertainty and renewable energy output, this paper deals with solving these uncertainties based on the two-point estimation model for the next day electricity market. The proposed method is designed to reduce the cost of energy and reserve smart grids with wind, diesel, and battery systems. Two load response programs have also been used to manage the demand side of the 33-bus network. Reference (Nojavan et al. 2015) discusses the optimal bidding strategy of retailers in the electricity grid using a time-based responsiveness program under the uncertainty study of electricity prices. In the restructured market, retailers try to keep their subscribers at a lower cost (providing through upstream transmission, self-consumption, or even retail production) for subscribers. Uncertainty in the price of electricity, given the nature of the electricity market, is impossible to deny. To this end, in this reference, we propose a robust linear integer optimization method for determining the price proposition in the electricity market by retailers based on bilateral contract and pool market.
Reference (Ghasemi 2018), optimizing the pumpedstorage system, irrigation systems, and wind farm units in micro-grid connected to the upstream grid, reduces the costs. Also, the framework is equipped with two water storage systems for pumped-storage units. Optimization of this micro-grid has been done with the upstream network for the day-ahead market. It applied a two-point estimation method to investigate uncertainties related to electricity market price and wind system.
In Golmohamadi and Keypour (2018), a multi-stage stochastic model was proposed for a renewable distributed generation (RDG)-owning retailer to identify the trading strategies available in a competitive electricity market. The uncertainties related to clients' consumption, power output of wind resources, and wholesale electricity market price were considered based on auto-regressive integrated moving average (ARIMA) approach. In the suggested method, three trading floors were regarded for the retailer to hedge against the uncertainties. During the first stage, the retailer participates in day-ahead market to supply the clients, while intraday market allows the retailer to change the schedule of its consumption/RDG production among clients in the second stage. Finally, real-time market was considered for reducing the uncertainty at power delivery time in the third stage due to unfavorable uncertainties, especially in renewable power production. Further, the cost function of wind resources was incorporated in the objective function by considering capital, operation, and maintenance (O&M) cost in order to increase the use of the mechanism.
In addition, (Yi et al. 2017) reported how the uncertainty obtained from generating distributed renewable in an active area influences the cost-saving of the active district as well as average buying cost of utilities. Based on the result, the renewable uncertainty in an active district can raise the average buying cost of the utility serving the active district called local impact and decrease the average buying cost of other utilities by involving in the same electricity market called global impact. Further, the local impact could result in increasing in the electricity retail price of active district, leading to a cost-saving less compared to the case without considering renewable uncertainty. The results indicated an economic motivation for utilities to enhance their load predicting accuracy for the purpose of preventing from economy loss and even obtaining economic benefit in the electricity market. Finally, the theoretical results were confirmed by conducting extensive studies based on realworld traces.
In another study, (Olamaei et al. 2016) reviewed the available retail electricity market, some new developments, and a comprehensive understanding of the next-generation retail electricity market by explaining its expected features needs, challenges, and accordingly future research topics. Further, a framework was presented for combining retail and wholesale electricity markets. The suggested and framework could pinpoint the significance of new business models and regulatory initiatives to create decentralized markets for DERs at the retail level, along with developments in technology and infrastructure, which are necessary for allowing the common use of DERs in effective ways. A vanadium redox flow battery type is considered in (a) to (c), and the bounds are imposed on the state of charge in (b) by assuming the total discharge of the battery, i.e., a null depth of discharge. However, the lower bound of (b) should be considered with the state of charge value of energy related to the depth of discharge if the type of used battery can impose a non-null depth of discharge.
In this paper, demand response is integrated into the short-term decision-making of the retailer so that the retailer has to offer optimal price of simultaneous operation of wind-solar system and energy storage system in addition to common short-term activities. Uncertainty not only affects the price of the day-ahead market but also affects wind and solar energy generation. The developed model enables the retailer to realize potentials of the DR program and exploit high technical and economic advantages and gain higher revenue while providing optimal load of the users. In previous studies, the presence of the retailer and uncertainty of distributed generations were not considered. Previous studies, however, have not addressed the issue of retailer presence given the uncertainty of DGs.
The remainder of this paper is organized as follows. Section 3 presents problem modeling that contains the objective function. The objective function is to maximize the expected profit of the retailer as well as constraints of the optimization problem, load constraint demand, response model, and sale price constraints. Section 4 describes simulation results that show the excellent performance of the proposed method.

Proposed method
The proposed method, which is presented in Fig. 1, is split into three parts. The first part is devoted to all scenarios that may happen via generations such as solar system conversion and wind power that come from a database of solar irradiation and wind speed, along with the data from electricity market scenarios such as imbalance of power and market price. In the second part, after receiving data from the historical database related to generation and price, the problem is solved by presented formulation in this paper using GAMS software and MILP solver. Using twostage optimization, variables considered for the first stage are hourly bids for a day and the energy used for charging energy storage systems. In contrast, the imbalance of energy variables is related to the second stage. The third part is the outcome of optimization as an EXCEL file for optimal power generation and then market price.

Problem modeling
The objective function is to maximize the expected profit of the retailer. The retailer solves the problem by exchanging energy with the upstream network and using its assets to supply electricity and demand response programs. Equation (1) represents the mentioned objective function. A retailer that owns wind and solar systems has to handle the uncertainty originating from the accessibility of wind and solar resources. These uncertainties are due to the alternative and variable nature of wind and solar resources and uncertainty of the electricity price of the day-ahead market. So, the strategy of participating in a retailer's market should be such that these uncertainties are considered to obtain maximum revenue from energy commerce in the day-ahead market. Otherwise, ignoring these uncertainties, income might be reduced due to neglecting the effect of the imbalance penalty. Considering uncertainties properly might decrease probable revenue reduction of the retailer compared to independent operation of the wind and solar systems.

Constraints of the optimization problem
The retailer has to manage a set of technical and financial constraints described in the following:

Constraints of the optimization problem
These equations are considered to satisfy power flow conditions. Power flowing from bus i to bus i' in scenario x and hour h is as shown in Eq. (2): The power balance of bus i at hour h is shown as in Eq. (3): Fig. 1 The flow chart of the proposed method Stochastic coordination of the wind and solar energy using energy storage system based on real-time… 9611 Equation (2) and Eq. (3) hold for all buses except the reference bus. The reference bus is connected to the main network. Active and reactive power equations of the main bus are shown in Eq. (4): Total active and reactive loads of bus i in scenario x are given in Eq. (5): Active and reactive power lost in feeder f from bus i to bus i' is described in Eq. (6): Power introduced from the main bus should not exceed a certain amount due to constraints of the transformer: Equation (8) shows constraints of the feeder: which can be replaced by Eq. (9): Constraints of the distribution transformer should be taken into account for secure operation: Voltage constraint of all buses except the main bus connected to the distribution network should be observed.
Voltage of the main bus should remain fixed due to its key role. Voltage constraint of the buses is as follows: When the loads are disconnected, the following constraints are introduced to create a constant power factor:

Demand response model
Equation (14) shows demand elasticity compared to market price.

Sale price constraints
In RTP pricing, prices fluctuate constantly. This model assumes that the retailers buy electricity from the wholesale market and sell it to the customers as a service. The proposed price is formulated in Eq. (15): For the prices to be fair, constraints are applied by the regulatory institutions: We appreciate the reviewer's constructive comment. The energy storage system model is describing as below: Energy storage limits: Storage power limits: In (a) to (c), a vanadium redox flow battery type is considered, (b) imposes the bounds on the state of charge, assuming a possible total discharge of the battery, i.e., a null depth of discharge. But, if the type of battery used imposes a non-null depth of discharge, the lower bound of (b) should be considered with the state of charge value of energy associated with the depth of discharge.
The stochastic MILP formulation of the problems to support the biding strategies in a disjoint assessment of wind power and PV power systems is similar maximization problems, respectively, as follow: (1) Wind system e: (2) PV system f: Energy offer constraints h: 0 P PV t P PV max ; 8t ð24Þ Imbalance constraints Figure 1 shows the flowchart of what has been done based on the proposed method.

Simulation results and discussion
In this section, the modeled problem is simulated on a distribution network. This network is the 20 kV network of Finland taken from Xie et al. (2018). As can be seen in Fig. 2, this distribution network (Safdarian et al. 2014) has 144 distribution feeders and 144 distribution stations.
Different case studies are considered to study other factors like the uncertainty of wind and solar generation resources (Gomes et al. 2017b) and the presence of DGs (connected in bus NO. 9, 15, 35). Table 1 shows case studies for simulation of the system of interest. Figure 3 shows that the developed scenarios for wind generation power of DG units are. These scenarios are obtained using the Monte Carlo method. Figures 3 and 4 illustrate scenarios related to wind and solar power generation capacity. These scenarios are similar to those generated by the wind scenario, meaning that the Monte Carlo method is used to create the scenario. Using this approach, the possibility of being close to the real trend of wind power generation will increase. As a result, the output wind power generation is most reliable, and the result would be interpreted correctly. Using the Monte Carlo method for solar power, ten possible scenarios were gained based on historical data, and these trends are the likely probability of solar output generation. By focusing more in detail on these trends, at hours 0 to 5 and 21 to 24 are not uncertain, solar power generation values for the summer months are set at zero (Gomes et al. 2017b).
Comparing Figs. 3 and 4 shows that changes and scattering in the wind section are far more than solar section; in addition, it suggests that uncertainty of wind generation is more than solar power generation. Table 2 illustrates the matrix of scenarios created for wholesale prices and the implementation of demand response programs, each generating ten strategies. The maximum limit for carrying a demand response plan is 16 cents. These scenarios are created in the MATLAB software environment using the Monte Carlo method (Gomes et al. 2017b). Table 2 shows the ten most possible scenarios for the wholesale price and program cost for 24 h. Monte Carlo methods gain these data. Using scenarios reduction strategy, Table 3 is the most probable scenario that can be practical with a total probability of 0.999 after reducing the scenario. Figure 5 shows the average hourly price of electricity. This price is obtained by adding wholesale price and variable price of the service received by the retailer. As shown in Fig. 5, a uniform pricing scenario for low-consumption customers is very costly such that they should pay a high price at peak hours. Thus, by implementing the proposed method, customers' costs are reduced to a great extent.  (Gomes et al. 2017b) 4.1 First case study Figure 6 show the network load profiles obtained from customers' loads in the first or basic case (fixed pricing) and after implementing the proposed method. As can be seen in Fig. 6, a more uniform load profile is more desirable. Thus, considering the figure, a better load profile is obtained, which reduces network losses also. Figure 7 shows the minimum voltage of buses at different hours. By implementing the proposed method (RTP), significant changes occur in the voltage of the worst buses of the network. Considering the potentials of the proposed program, changes of the worst buses in terms of voltage improve. Figure 8 shows average network losses in basic cases and using the RTP method. According to this figure, the worst case of the network in terms of losses occurs in peak hours between 7 to 13 and 17 to 21; considering real-time pricing, network losses are reduced significantly.  Stochastic coordination of the wind and solar energy using energy storage system based on real-time… 9615 Figure 9 shows load changes of the network vs. demand elasticity. As demand elasticity increases, load curves become more uniform. Elasticity changes help the retailer monitor network and behavior of customers and make better and more optimal decisions. For instance, for the elasticity of -0.1, customers' behaviors would be close to the basic scenario, which changes by increasing elasticity. Table 4 shows sensitivity analysis results on the elasticity factor. As can be seen, as elasticity increases, the retailer's profit increases, and customers' costs and electric losses reduce significantly.

Second case study
In this scenario, according to Table 1, demand elasticity and price uncertainty in the presence of thermal DGs comprising DG units with 500 MW capacity are considered. Wind and solar systems are uncertain, as shown in Figs. 3 and 4. Figure 10 and Table 5 show the average network loss of the basic method and second case study. According to the figure, network losses are reduced significantly with the introduction of wind and solar resources. Installing renewable sources on the points with very low voltage drop Also, in Table 6, the comparison of the first and second studies has been made. The improvement in the second case study is better than the first one. Table 6 is a comparative table based on financial considerations. Case studies are compared by several economic indexes and show the superiority of the proposed method.

Conclusion
This paper has been focused on optimizing and maximizing the retail profit that has scattered production resources, relying on demand response programs, and considering uncertainty parameters such as load, price, and production, along with energy management planning and real-time pricing. Since the trailer has some assets which have not contributed to the electricity market, with the introduction of renewable sources to the system, they do not contribute to the electricity market and only help the retailer provide a part of the consumer's demanded power. Thus, less energy is bought from the power network. According to the obtained results, in the first case study, the retailer's profit is improved by 3%, and it is enhanced by 3.5% in the second case study. In the proposed method, system losses in the first and second case studies are improved by 2.3%   Author contributions The authors contributed to each part of this paper equally. The authors read and approved the final manuscript.
Funding This study was not funded any institution and organization.

Declarations
Conflict of interest Authors declare that he has no conflict of interest.
Human and animal rights This article does not contain any studies with human participants performed by any of the authors.
Informed consent Informed consent was obtained from all individual participants included in the study. Stochastic coordination of the wind and solar energy using energy storage system based on real-time… 9619