Optimal Reserve and Energy Scheduling for a Virtual Power Plant Considering Reserve Activation Probability

: With the increasing share of variable and limitedly predictable renewable energy in power systems worldwide, ensuring reserve capacity to maintain the balance of supply and demand becomes more important. On the other hand, the development of the virtual power plant model (VPP) allows renewable sources and energy storage to participate in reserve service. This paper addresses the optimal reserve bidding strategy problem of a VPP comprising of renewable energy resources (RESs), energy storage systems (ESSs), and several customers. The VPP participates in balance capacity (BC), day-ahead (DA), and intra-day (ID) markets. The scheduling problem is formulated as a two-stage chance-constrained optimization model taking the uncertainty of RESs production, load consumption, and probability of reserve activation into account. The response of VPP after its reserve capacity is called and generated is also considered to increase the operational ﬂexibility of VPP. The proposed model is implemented on a test VPP system, and the effects of RESs sizing, ESSs sizing, and the probability of reserve activation are analyzed. Results indicate that the proposed model can perform well under real-world conditions.


Introduction
In recent years, due to the ever-increasing electricity demand and environmental problems, renewable energy sources (RESs), such as wind and solar power, have been quickly developed and have become an essential part of the electricity system. Many governments have provided incentives to increase investments in renewable energy plants, for example, allowing these sources to participate in the electricity market or provide regulation reserve service [1,2]. However, integrating RESs into the electricity market faces several challenges. The authors of [3][4][5][6] show that most electricity markets, such as PJM and AESO, require the participating resources to be at least 100 kW of capacity. Meanwhile, the rated capacity of RESs is typically small, especially rooftop solar systems in which sizing can be less than 10 kW. Another disadvantage of RESs is the stochastic nature of wind speed and solar radiation, meaning RESs maximum available power output can not be predicted with high accuracy. As a result, it is difficult to ensure that RESs can meet the registered schedule in the electricity market.
To overcome these issues, the concept of the virtual power plant (VPP) has been developed. A VPP aggregates the capacity of different types of RESs, flexible loads, energy storage systems (ESS), and acts as a single participant in the wholesale market [7][8][9][10]. A VPP can play two roles in the market: a supplier or a consumer, depending on the sizing of RESs and ESS in comparison to local demand. This paradigm shift allows small-scale resources to participate in the market and makes them more profitable [9,11]. This is because the operation of RESs, controllable demand, and ESS are coordinated; consequently, the available power output of each RES can be fully utilized while the timal scheduling problem is formulated as a two-stage chance-constrained optimization model to account for the uncertainty in RESs available power output and demand. The constraints, including uncertain parameters, are presented as probabilistic constraints with a chosen risk level [28]. This chance-constrained model can be solved by the Sample Average Approximation (SAA) algorithm, which is based on a Monte Carlo simulation to approximate each random parameter by a vector of N samples. The studies [29][30][31][32] show the effectiveness of this approach. Moreover, the probability of reserve activation is taken into account in this paper to ensure that the VPP can provide reserve service during the hours having the greatest risk of power shortages.
The salient features of the present study include the following: 1.
The research focuses on the VPP's optimal reserve sizing problem considering the probability of reserve activation each hour. Depending on the status of reserve activation, the VPP's operating scheme in electricity markets is determined to maximize the VPP's profit.

2.
The proposed optimal model is based on a two-stage chance-constrained problem which allows a certain risk level in the VPP's scheduling. This model is suitable for the short-term planning of power systems with uncertain resources and demand. 3.
The impact of ESS sizing, RES sizing, and the probability of reserve activation on the VPP's optimal reserve sizing is analyzed.
The rest of the paper is organized as follows: Section 2 demonstrates the operating model of the VPP in the BC and electricity markets as well as the assumptions used in this paper, thereby presenting a two-stage optimization model to determine the VPP's optimal reserve capacity. Section 3 presents the mathematical formulation of the proposed optimization model. Then, the computation results are collected and analyzed in Section 4. Finally, Section 5 concludes the paper.

Coordination between the VPP and the Power Market
With the high penetration of RESs in the power system, the grid's operational framework changes. References [33,34] show that installing and connecting the ESS in the power system to support RESs provides ancillary services, and leverage energy arbitrage opportunities are increasingly interested. Some electricity markets, such as AEMO, have changed their rules to allow privately owned ESSs and RESs to participate in the electricity market. Accordingly, the VPP model is getting more and more attention.
This paper considers a CVPP consisting of RESs, ESSs, and demand, as shown in Figure 1. The VPP can participate in the DA market, both as supplier and consumer, i.e., the VPP either sells or purchases electricity from the main grid, depending on whether RESs available power output is higher or less than the local demand. The ESS also allows VPPs to trade in the BC market. While the ESS has a high investment cost, it has very low operating costs and the ability to change power output very quickly. Therefore, ESS can serve as an efficient reserve source compared to other alternatives, such as demand response or RES curtailment [34].
The BC market, in which supplier and demand trade their reserve capacity, plays an essential role in worldwide power systems. It can be seen that the transmission system operators (TSOs) should match the supply and demand to maintain frequency and achieve system stability. However, events such as prediction errors and power outages are unpredictable, and TSOs, therefore, need to be able to adjust for such unexpected power fluctuations. On the other hand, the power generation company shuts down unnecessary generators when there is no buyer, and restarting these units requires at least a few hours. The BC market helps the TSOs secure the number of generators (or the amount of capacity) that can be adjusted in advance.
The BC market has regulations on contract duration, minimum bid amount, and continuous operation time corresponding to each BC product in all countries. For example, the Japan electricity market requires that the BC market should be cleared before the operating day, at least one day for tertiary reserve-2, and at least one week for the other four types of reserve (Table 1). Moreover, each generation plant with a BC contract must supply a reserve capacity of at least 5 MW and maintain it for the required duration. Although the classification of reserve services may vary from country to country, they generally have similar requirements [24,35], and a VPP should satisfy these requirements to participate in the BC market. The BC market has regulations on contract duration, minimum bid amount, and continuous operation time corresponding to each BC product in all countries. For example, the Japan electricity market requires that the BC market should be cleared before the operating day, at least one day for tertiary reserve-2, and at least one week for the other four types of reserve (Table 1). Moreover, each generation plant with a BC contract must supply a reserve capacity of at least 5 MW and maintain it for the required duration. Although the classification of reserve services may vary from country to country, they generally have similar requirements [24,35], and a VPP should satisfy these requirements to participate in the BC market.
. Figure 1. The structure of the VPP. If a VPP joins the BC market, the VPP operator must solve the problem of determining its BC trading to maximize the total profit in both BC and DA markets. It should be noted that the profit obtained from the BC market consists of two parts: profit from the provision of reserve capacity and profit from the activation of reserve service. The VPP operator does not know whether its reserve service will be called and how much electric power will be generated for the reserve. It can be seen that if the VPP is not called to provide reserve service, its total profit may be lower than in the case that its full available capacity is sold to the energy market. Thus, the probability of reserve activation should be considered in the profit maximization problem from the BC market.  If a VPP joins the BC market, the VPP operator must solve the problem of determining its BC trading to maximize the total profit in both BC and DA markets. It should be noted that the profit obtained from the BC market consists of two parts: profit from the provision of reserve capacity and profit from the activation of reserve service. The VPP operator does not know whether its reserve service will be called and how much electric power will be generated for the reserve. It can be seen that if the VPP is not called to provide reserve service, its total profit may be lower than in the case that its full available capacity is sold to the energy market. Thus, the probability of reserve activation should be considered in the profit maximization problem from the BC market.
It is assumed that the VPP has a contract to provide reserve capacity, as described in Figure 2. In each hour of this period, the VPP is faced with two possibilities of either being called or not being called to provide reserve service. Considering ESSs integrated into the VPP, it can be seen that whether reserve capacity is fully/partly activated or not will affect the energy stored in the VPP. In addition, unlike the conventional power plants that commonly maintain a certain ramp magnitude, the maximum available power output of RESs is expected to be utilized without any curtailment. It can be solved by adjusting the day-ahead operating schedule in the intraday market ( Figure 2). However, this adjustment must ensure that the VPP has enough energy to provide reserve service during the next contracting period.

Uncertainty Parameters
A major challenge in implementing the two-stage model in the previous section is the variation in demand and RESs power output. It can be seen that this scheduling model is solved several days in advance; at that time, information on demand and RESs power output is uncertain and unknown. Therefore, uncertainties of demand and RESs power output should be taken into account in this model to ensure that the results are meaningful in the actual operation.
A common method to handle these uncertain parameters is to represent them as the sum of the predicted value and predictive errors as follows: where the errors and have a normal distribution function with means of 0, and the standard deviations and , respectively. This means that the maximum difference between the actual value and the forecasted data would be approximately 3 for RESs available power and 3 for demand. Another important uncertain parameter is the probability that the reserve is called and generated in each hour. Determining this parameter is difficult because it depends on many factors such as generator outages, line outages, market price, or bidding strategy. From the VPP operator's point of view, a two-stage scheduling model is proposed to maximize the VPP's profit in the reserve capacity and energy markets. This model determines the optimal reserve capacity and the possible operating scenarios of the VPP in the day-ahead and intraday markets. The uncertainty in RES and demand and the probability of reserve activation will be considered in this model.
The two stages are outlined as follows: 1.
In the first stage, the VPP decides its trading strategy in the BC market a few days before operating based on the long-term forecasted value. The reserve capacity SR t should be higher than the minimum bid amount and be maintained over the required continuous operating duration τ iON . The variable SR t is a here-and-now decision made before the realization of uncertain parameters.

2.
After determining SR t , the VPP should predict its energy trading scenarios P t sell /P t buy at hour t on the operating day. These scenarios are based on long-term forecasts and will be revised in the day-ahead market with the short-term forecast figures for load and RESs. At the same time, the scenarios of reserve activation are also taken into account to predict the amount of buying/selling energy that needs to be adjusted in the intraday market.
To simplify the model, we consider only two extreme scenarios of reserve activation: the entire reserve/no reserve is activated, where the probabilities of these cases in hour t are assumed to be p t SR , and 1 − p t SR , respectively.

Uncertainty Parameters
A major challenge in implementing the two-stage model in the previous section is the variation in demand and RESs power output. It can be seen that this scheduling model is solved several days in advance; at that time, information on demand and RESs power output is uncertain and unknown. Therefore, uncertainties of demand and RESs power Appl. Sci. 2021, 11, 9717 6 of 23 output should be taken into account in this model to ensure that the results are meaningful in the actual operation.
A common method to handle these uncertain parameters is to represent them as the sum of the predicted value and predictive errors as follows: where the errors P t RES−error and P t D−error have a normal distribution function with means of 0, and the standard deviations σ t RES and σ t D , respectively. This means that the maximum difference between the actual value and the forecasted data would be approximately 3σ t RES for RESs available power and 3σ t D for demand. Another important uncertain parameter is the probability that the reserve is called and generated in each hour. Determining this parameter is difficult because it depends on many factors such as generator outages, line outages, market price, or bidding strategy. While Y. Yamin [36] focuses on predicting the reserve probability based on an artificial neural network (ANN), other studies [26,37,38] use the loss of load probability (LOLP) or the expected energy not served (EENS) to determine the reserve requirements and build the reliability-constrained unit commitment model. A recent study [39] builds the probability functions of the reserve activation based on historical observations for the period 2015-2018, obtained from Elia, the Belgian transmission system operator. Then, this probability function is applied to determine the ESS scheduling in the day-ahead energy and reserve market.
In this paper, the reserve activation probability in each hour is assumed to be an independent random variable that follows the uniform distribution function and can be predicted from historical outage data: where p max is the maximum possible value of the reserve activation probabilities obtained from historical data.

Mathematical Formulation
This article deals with the optimal scheduling strategy of a VPP, including RES units, ESS, and demand, which aims to participate in both the BC and the energy markets. Based on the forecasted data of demand and RES available power output, the VPP operator calculates its reserve capacity and the amount of energy that can be sold or purchased each hour. Consequently, the RESs operating schedules and the ESS charge/discharge states are determined to maximize the total revenue of the VPP obtained in both the BC and the energy markets.
The VPP decisions under uncertainty are handled by two-stage chance-constrained programming. In the first stage, VPP reserve capacity SR t is decided for every hour during a 24-h horizon. Other operational parameters of the VPP, such as the energy trading with the main grid or the ESS charge/discharge power, are determined in the second stage. As can be seen, the first-stage decision has only one value held until the actual operation time. By contrast, the second-stage decisions are expressed as a range of values to ensure the availability of these decisions if the actual data differ from the predicted value. In addition, the second-stage decisions can be adjusted as soon as the latest short-term forecast data with high accuracy are available. Using the chance-constrained model ensures that the constraints in this problem are met with a chosen probability even if the predictive errors are quite high.

Objective Function
The objective function of the proposed problem is to maximize the VPP profit including profit from both the BC market and the energy market. With two scenarios and corresponding probabilities presented in the previous section, the objective function can be formulated as follows: In the above equations, ξ represents a random vector including RESs available power and demand.

Constraints
The proposed problem is formulated based on two cases of reserve activation. Therefore, the market participation model and the operation of each component in the VPP are accomplished under the first-stage constraints and two sets of the second-stage constraints as follows.

The First-Stage Constraints
In this model, the first-stage constraints describe the reserve capacity trading between the VPP and BC market. Equation (4) ensures that the reserve capacity should be limited by the rated power of the RES and ESS. With the binary variable u t SR equal to 1 if the VPP decides to sell reserve capacity, Equation (4) ensures that the VPP can maintain reserve service for a period of at least τ iON . Then, this service can stop for a period of τ iOFF before a new regulation period, τ iOFF can be set to zero. • RES operating constraint: For a given forecasted available power P t RES f and the minimum power threshold P t RESmin , the power output of the RES must satisfy Equation (5). Equation (6) shows that RES can supply electricity directly to the local loads and contribute to the contract of the VPP in the BC market and the DA market. Besides, RES's excess energy (if any) is stored in the ESS to utilize RES's available power output.
• ESS constraints: This article uses ESS to store the excess power of RESs or purchased power from the DA market if the electricity price is low. The stored energy will be released to supply the peak load of VPP or sell to both BC and DA markets if the electricity price is high. Equations (7) and (8) show that the charging/discharging power of the ESS is limited by the rated power P ESSmax . In these constraints, the binary variable u t SS makes sure that the ESS can only be in one state: charging or discharging. Equation (9) shows that the energy E t SS stored in the ESS should be limited by its rated capacity at all times. Furthermore, Equation (10) makes sure that the energy stored in the ESS will be set to a certain value after each operating day.
Appl. Sci. 2021, 11, 9717 • Day-ahead market's constraints: Constraints (11) and (12) show the role of RES and ESS in the DA market. Meanwhile, constraint (13) shows that the arbitrage between the BC and the DA market is not permitted. This means that the VPP is not allowed to buy electricity from the DA in order to sell to the BC market at the same time.
• Active power balance constraint: The VPP's operator must balance demand and supply in all operating scenarios. If the reserve bids are called on to produce, the total active power output from RES and ESS must meet the demand and the power supplied to the main grid according to the signed BC and DA contract. This equation is formulated as a probability constraint to guarantee that the probability of power imbalance is less than a risk level ε, even if the difference between the real-time data and the predicted value of ξ is quite high.
2. Case 2: The reserve bid is not activated: Similar to case 1, the constraints in case 2 are shown as follows: • RES operating constraint: • ESS constraints: • Day-ahead market's constraints: 0 ≤ P t buy,2 (ξ) = P t grid−load,2 (ξ) • Active power balance constraint: Pr P t RES,2 (ξ) + P disch,t ESS,2 (ξ) + P t buy,2 (ξ) = P t sell,2 (ξ) + P ch,t ESS,2 (ξ) Appl. Sci. 2021, 11, 9717 9 of 23 3. Constraint shows the association between case 1 and case 2: During the reserve contract period, it is necessary to ensure that the VPP is always ready to provide reserve at any time. Therefore, even if the reserve is not called and generated, the VPP is not allowed to sell that part of the capacity to the energy market. Consequently, the VPP's buying/selling power in the energy market should be the same for cases 1 and 2. When there is no reserve contract, the VPP's buying/selling power is allowed to be adjusted to take full advantage of the power output of the RESs. In addition, since the ESS provides a part of reserve capacity, the energy in the ESS immediately before the contract period should be the same in both cases. The following constraints can secure these issues:

Sample Average Approximation Methodology
The two-stage chance-constrained optimization model in the above section can be solved by the sample average approximation approach. In this approach, the true distribution of each uncertain parameter is approximated by a set of independent samples by using a Monte Carlo simulation while the corresponding sample average function replaces the objective function. Many studies in the literature show that SAA effectively solves a chance-constrained optimization problem [28,29,[34][35][36][37]. However, it can be seen that the more uncertain parameters, the larger the size of the optimization problem and the longer the computing time. To overcome this challenge, a common technique to improve computational efficiency is using clustering methods such as K-means, Fuzzy C-means methods [38,39]. This technique reduces a large number of initial samples into a small number of clusters, then these clusters are represented as a new set of samples and used to solve the SAA problem.
Algorithm 1 outlines the main steps of the SAA algorithm combined K-means approach to solve a general chance-constrained optimization problem as follows: where x is the first-stage variable, y is the second-stage variable, ξ is random input data, and ε is the risk level of the chance constraint in the problem (25).
In the first step, we generate M independent sample sets of size N. Then, the k-means clustering approach is applied to divide each set into N L clusters. Each cluster's centroid will be considered a scenario in SAA algorithm with its probability is equal to the total probabilities of all samples inside the cluster. Consequently, the optimization problem in Equations (25) and (26) are reformulated as: p n Q(y n , ξ n ) (27) subject to where 1 (0,∞) (G(x, y n , ξ n )) is equal to one if G(x, y n , ξ n ) ≥ 0 and zero otherwise, p n is nth centroid's probability (n = 1, 2, . . . , N L ), and γ is the risk level of the SAA model (27) Based on the method presented in [29,40], the SAA problem (27) is implemented S iterations. In each iteration, this model will be solved M times in correspondence to M sample sets so that we can obtain M first-stage optimal solutions x m s and optimal values V m s (1 ≤ s ≤ S, 1 ≤ m ≤ M). As the optimal problem contains chance constraint, so we need to check the feasibility of the first-stage solution x m s by evaluating the (1 − β)-confidence upper bound of the chance constraint with N samples (N N) as follows: where g(x m s ) = Pr(G(x m s , y, ξ) ≤ 0) = 1 N ∑ N n=1 1 (0,∞) (G(x m s , y n , ξ n )); and Φ −1 is the inverse normal distribution function. If U(x m s ) is less than or equal to the risk level ε then x m s is a feasible solution with the confidence level (1 − β). The conclusion in [29] shows that we can obtain the best solution if γ = ε/2. Following [29,40], the average of the Lth smallest optimal values V L s obtained in S iterations can be treated as the lower boundL of the true optimal value, where L is calculated as in [29]. Moreover, the true optimal value's upper bound can be estimated by Equation (30).
If the optimality gap U −L / U × 100% is smaller than a given threshold , the algorithm terminates, and the first-stage optimal solutionx which corresponds to the upper bound U will be the optimal solution to the original problem. Solve the SAA model in Equation (27) to obtain the solution x m s and the optimal value V m s . (iv) Generate a large sample set of size N and evaluate the upper bound of the chance constraint U(x m s ) by Equation (29). If U(x m s ) ≤ ε, go to (v); else, skip (v) and go to the next iteration. (v) Estimate the upper bound of the optimal value U(V m s ).
Determine the Lth smallest optimal values V L s based on the method presented in [29].

2.
Determine the upper bound U of the true optimal by Equation (30) and the corresponding solutionx.

3.
Calculate the lower boundL as the average of all V L s . 4.
Calculate the optimality gap g = U −L / U × 100% and compare it to the threshold . If g ≤ ,x is the final result; else, adjust N L and go back to step 1.

Study System
In this section, the proposed optimal model is implemented on a CVPP test system including RESs, battery storage systems, and residential consumers. Assuming that the CVPP test system is located in the Vietnamese power grid, this system uses the data collected from Vietnam's electricity market, including wholesale tariff and typical wind, solar, and load profiles. In fact, the VPP model and a BC market have not been applied in Vietnam. However, with the rapid increase in RES sources, it is expected that this model will soon become relevant.
Until now, the Vietnamese government has had many policies to encourage renewable energy sources, especially solar energy. Accordingly, RESs are allowed to participate in the DA market at a preferential price of 83.8 USD per MWh [41]. In contrast, the electricity buying price in the wholesale market follows a three-tier tariff with peak-load, regular, and off-peak prices at 129.6 USD, 70.44 USD, and 45.65 USD per MWh, respectively ( Figure 3) [42]. This tariff will be used in the proposed scheduling model. When a VPP enters the BC market, we assume that they can earn $8.38 for 1 MW of reserve capacity. Meanwhile, the price of each MWh of the activated reserve is 30% higher than the electricity selling price, i.e., 108.9 USD/MWh. The VPP must be able to generate a reserve power of at least 1 MW and maintain it for at least 3 h continuously. In the VPP test system, the RESs are assumed to be wind power plants with the forecasted power curves of a wind generator (in p.u.) illustrated in Figure 4. Meanwhile, the battery storage systems can be treated as a large-scale storage system with technical data shown in Table 2. The residential consumers have aggregated daily consumption equal to 510 MWh while their peak-load consumption can reach approximately 29 MW. Figure 5 describes the typical daily load considered as the long-term predictive data of consumers in this study.
To account for the uncertainty in demand and RES power output, the forecast errors are assumed as a normal distribution with a mean of zero and a standard deviation of 0.033 and 0.05, respectively, for demand and RESs power output. This means that the maximum errors described by the error bars in Figures 4 and 5 are approximately 10% for demand and 15% for RESs power output. The risk level of probability constraints is assumed to be 5%.   In the VPP test system, the RESs are assumed to be wind power plants with the forecasted power curves of a wind generator (in p.u.) illustrated in Figure 4. Meanwhile, the battery storage systems can be treated as a large-scale storage system with technical data shown in Table 2. The residential consumers have aggregated daily consumption equal to 510 MWh while their peak-load consumption can reach approximately 29 MW. Figure 5 describes the typical daily load considered as the long-term predictive data of consumers in this study. In the VPP test system, the RESs are assumed to be wind power plants with the forecasted power curves of a wind generator (in p.u.) illustrated in Figure 4. Meanwhile, the battery storage systems can be treated as a large-scale storage system with technical data shown in Table 2. The residential consumers have aggregated daily consumption equal to 510 MWh while their peak-load consumption can reach approximately 29 MW. Figure 5 describes the typical daily load considered as the long-term predictive data of consumers in this study.
To account for the uncertainty in demand and RES power output, the forecast errors are assumed as a normal distribution with a mean of zero and a standard deviation of 0.033 and 0.05, respectively, for demand and RESs power output. This means that the maximum errors described by the error bars in Figures 4 and 5 are approximately 10% for demand and 15% for RESs power output. The risk level of probability constraints is assumed to be 5%.

Maximum/Minimum Energy Storage Limit (MWh) 20 Discharging/Charging Power (MW)
10 Charging Efficiency 90% The scheduling model is performed with the reserve activation probability in each hour generated from the uniform distribution function (0,0.05), so that the highest probability of reserve activation in every hour is 0.05. Furthermore, the impact of different aspects such as RESs power rating and ESSs capacity is also evaluated. The optimization problems are solved using CPLEX version 12.6 and the YALMIP toolbox [43] on a 64-bit core i5 1.9 GHz personal computer with 16 GB RAM.

The Impact of the Reserve Activation Probability
With the wind farm's aggregated capacity of 30 MW and the power curve (in p.u.) given in Section 4.1, we have the forecasted wind power and demand data presented in Figure 6. To evaluate the effect of the reserve activation probability on the VPP's optimal schedule, we randomly generate three scenarios , , and of the reserve probability and apply them to the proposed model. Moreover, we consider a scenario with a reserve activation probability of 0.05 for all hours to see the effect of this uncertain parameter on the optimal results. The VPP's optimal reserve capacity corresponding to each scenario is presented in Figure 7. It can be seen that the ESS provides all the reserve capacity.  To account for the uncertainty in demand and RES power output, the forecast errors are assumed as a normal distribution with a mean of zero and a standard deviation of 0.033 and 0.05, respectively, for demand and RESs power output. This means that the maximum errors described by the error bars in Figures 4 and 5 are approximately 10% for demand and 15% for RESs power output. The risk level of probability constraints is assumed to be 5%.
The scheduling model is performed with the reserve activation probability in each hour generated from the uniform distribution function U(0, 0.05), so that the highest probability of reserve activation in every hour is 0.05. Furthermore, the impact of different aspects such as RESs power rating and ESSs capacity is also evaluated. The optimization problems are solved using CPLEX version 12.6 and the YALMIP toolbox [43] on a 64-bit core i5 1.9 GHz personal computer with 16 GB RAM.

The Impact of the Reserve Activation Probability
With the wind farm's aggregated capacity of 30 MW and the power curve (in p.u.) given in Section 4.1, we have the forecasted wind power and demand data presented in Figure 6. To evaluate the effect of the reserve activation probability on the VPP's optimal schedule, we randomly generate three scenarios p 1 , p 2 , and p 3 of the reserve probability and apply them to the proposed model. Moreover, we consider a scenario with a reserve activation probability of 0.05 for all hours to see the effect of this uncertain parameter on the optimal results. The VPP's optimal reserve capacity corresponding to each scenario is presented in Figure 7. It can be seen that the ESS provides all the reserve capacity.

Maximum/Minimum Energy Storage Limit (MWh) 20 Discharging/Charging Power (MW)
10 Charging Efficiency 90% The scheduling model is performed with the reserve activation probability in each hour generated from the uniform distribution function (0,0.05), so that the highest probability of reserve activation in every hour is 0.05. Furthermore, the impact of different aspects such as RESs power rating and ESSs capacity is also evaluated. The optimization problems are solved using CPLEX version 12.6 and the YALMIP toolbox [43] on a 64-bit core i5 1.9 GHz personal computer with 16 GB RAM.

The Impact of the Reserve Activation Probability
With the wind farm's aggregated capacity of 30 MW and the power curve (in p.u.) given in Section 4.1, we have the forecasted wind power and demand data presented in Figure 6. To evaluate the effect of the reserve activation probability on the VPP's optimal schedule, we randomly generate three scenarios , , and of the reserve probability and apply them to the proposed model. Moreover, we consider a scenario with a reserve activation probability of 0.05 for all hours to see the effect of this uncertain parameter on the optimal results. The VPP's optimal reserve capacity corresponding to each scenario is presented in Figure 7. It can be seen that the ESS provides all the reserve capacity.    Figure 6 shows that the wind farm's available power output from hour 3 to hour 5, hour 9 to hour 16, and hour 22 to hour 24 is relatively higher than the demand. Therefore, it is clear that the VPP can provide reserve service during these periods; on the contrary, this service is unlikely to be available during the rest of the day. Figure 7a shows the VPP's optimal reserve contract if the probability of reserve activation is 0.05 for every hour. It can be seen that the VPP only provides reserve service when the power output of RES is redundant.
By contrast, the optimal results in the scenario show that the VPP's reserve service is available in hours 6 and 17 while wind power is equal to or even less than the demand (Figure 7b). This is due to the high probability of calling reserve during these hours. Note that the main role of ESS is to store the excess energy of RES or buy low-priced electricity from the network; then the ESS energy will be discharged to provide reserve or supply the load when the RES' power output is low and avoid the VPP having to buy electricity at a high price from the system. It is easy to see that the VPP provides a reserve service when the RES power output is not high enough will to cause the VPP to reduce the selling power or buy more electricity at other times to recharge ESS. This means that the probabilities of calling reserve in hours 6 and 17 are high enough so that the VPP expects the profit obtained from the BC market will be greater than the profit decline in the energy market. The optimal results in scenarios 2 and 3 also show the same thing. Even in scenario 3, the wind power in hours 15 and 16 is higher than the load by approximately the minimum threshold , but VPP still decide not to provide reserve service during these hours due to the very small probability of calling reserve (less than 1%) (Figure 7d).
As discussed in Section 2, the energy trading scheme during the period without reserve contract is assumed to be adjustable in the intraday market to utilize the RES available power output and maximize the VPP profit. This adjustment is not allowed to affect the performance of the reserve contract next period, even in an extreme case. Figure 8 shows the energy trade between the VPP and the main grid in scenario for two extreme cases: (a) the full reserve capacity is called and generated for the entire contract duration, and (b) the reserve capacity is not called and generated. Similarly, the operating  Figure 6 shows that the wind farm's available power output from hour 3 to hour 5, hour 9 to hour 16, and hour 22 to hour 24 is relatively higher than the demand. Therefore, it is clear that the VPP can provide reserve service during these periods; on the contrary, this service is unlikely to be available during the rest of the day. Figure 7a shows the VPP's optimal reserve contract if the probability of reserve activation is 0.05 for every hour. It can be seen that the VPP only provides reserve service when the power output of RES is redundant.
By contrast, the optimal results in the scenario p 1 show that the VPP's reserve service is available in hours 6 and 17 while wind power is equal to or even less than the demand (Figure 7b). This is due to the high probability of calling reserve during these hours. Note that the main role of ESS is to store the excess energy of RES or buy low-priced electricity from the network; then the ESS energy will be discharged to provide reserve or supply the load when the RES' power output is low and avoid the VPP having to buy electricity at a high price from the system. It is easy to see that the VPP provides a reserve service when the RES power output is not high enough will to cause the VPP to reduce the selling power or buy more electricity at other times to recharge ESS. This means that the probabilities of calling reserve in hours 6 and 17 are high enough so that the VPP expects the profit obtained from the BC market will be greater than the profit decline in the energy market. The optimal results in scenarios 2 and 3 also show the same thing. Even in scenario 3, the wind power in hours 15 and 16 is higher than the load by approximately the minimum threshold SR min , but VPP still decide not to provide reserve service during these hours due to the very small probability of calling reserve (less than 1%) (Figure 7d).
As discussed in Section 2, the energy trading scheme during the period without reserve contract is assumed to be adjustable in the intraday market to utilize the RES available power output and maximize the VPP profit. This adjustment is not allowed to affect the performance of the reserve contract next period, even in an extreme case. Figure 8 shows the energy trade between the VPP and the main grid in scenario p 1 for two extreme cases: (a) the full reserve capacity is called and generated for the entire contract duration, and (b) the reserve capacity is not called and generated. Similarly, the operating plans of ESS and RES corresponding to two cases are described in Figures 9 and 10, respectively. In the proposed model, VPP selling/buying energy and the operating parameters of ESS and RES in each hour are second-stage variables considering the uncertain nature of RESs and demand. Therefore, the results can be treated as predictions of future trading plans with the mean value and the fluctuation range represented by bar charts and error bars, respectively. For simplicity, Figures 9 and 10 show only the mean value of the obtained results.
the obtained results.
It is clear that with a relatively small probability of reserve activation, the energy trading scheme in Figure 8b can be applied in the DA market. Meanwhile, Figure 8a shows that the VPP's highest adjustment in the intraday market if the reserve capacity is fully called and generated during the entire contract period. On the other hand, the ESS provides all reserve capacity; therefore, the ESS energy is maintained at the maximum level during the contract period to be available for reserve provisioning (Figure 9b). After each provisioning period of the reserve, the VPP's adjustment should bring the ESS's energy back to its maximum level just before the next reserve period (Figure 9a). This is still necessary even if the actual provisioning level is lower than the extreme case in this paper. Moreover, Figure 10 shows that the RES power output is fully utilized in both cases of providing reserve.     It is clear that with a relatively small probability of reserve activation, the energy trading scheme in Figure 8b can be applied in the DA market. Meanwhile, Figure 8a shows that the VPP's highest adjustment in the intraday market if the reserve capacity is fully called and generated during the entire contract period. On the other hand, the ESS provides all reserve capacity; therefore, the ESS energy is maintained at the maximum level during the contract period to be available for reserve provisioning (Figure 9b). After each provisioning period of the reserve, the VPP's adjustment should bring the ESS's energy back to its maximum level just before the next reserve period (Figure 9a). This is still necessary even if the actual provisioning level is lower than the extreme case in this paper. Moreover, Figure 10 shows that the RES power output is fully utilized in both cases of providing reserve. Table 3 shows the optimal profit of the VPP corresponding to each scenario of p and compares them with the case where VPP does not participate in the BC market. It is easy to see that the VPP becomes more profitable when entering the BC market because reserve energy is 30% higher than the wholesale price. Even if the reserve capacity is not activated, they still profit from the provision of reserve capacity. Paying attention to the difference between the reserve activation probabilities during the hours helps the VPP sell reserve at the higher probability hours, thereby earning a higher profit. Next, the change of the optimal results as the probability of contingencies increases or decreases is evaluated. Note that in the above section, we assume that the maximum probability of active reserve is 0.05. However, in practice, depending on the penetration level of the RESs in the power system, this probability may be higher. Figure 11 shows the VPP's optimal reserve capacity if the reserve activation probabilities in scenario p 1 are multiplied by two, four, and six times, corresponding to the maximum value of 0.1, 0.2, and 0.3. It can be seen that, as the reserve activation probability increases, the number of hours that the VPP can provide the reserve service decreases. It seems that the VPP expects to profit from the provision of reserve control rather than from the actual reserve energy called and generated. This can be explained because RES power output is not enough to supply the load, especially in the period from hour 17 to hour 21, so that the ESS needs to provide a part of the load. An activated reserve contract period will use most of the ESS energy so that the VPP must purchase electricity from the main grid (hour 18 in Figures 8a  and 9a). However, the peak-load price of 129.6 USD/MWh is higher than the total reserve capacity and reserve energy price; consequently, the operating cost increases.

The Impact of the RES Sizing
This section tests the VPP model with the wind farm's maximum available power output of 20 MW. With the power curve (in p.u) given in Section 4.1, we have the forecasted wind and load capacity shown in Figure 12. It is easy to see that the wind capacity is not enough to supply the load most of the time. Therefore, ESS needs to increase the purchase of electricity with the off-peak price to store and provide to the local load during the peakload period instead of focusing on reserve service. As a result, the reserve capacity and the number of hours of reserve service decreases, and the value of the reserve activation probability each hour has little effect on the optimal results ( Figure 13). Note that we are only interested in the VPP's ability to provide reserve service when the RES power output is even less than the local load in this section. If the RES power output during most hours of the day is higher than the load, deciding whether to enter the BC market or not becomes much simpler.  Table 3 shows the optimal profit of the VPP corresponding to each scenario of and compares them with the case where VPP does not participate in the BC market. It is easy to see that the VPP becomes more profitable when entering the BC market because reserve energy is 30% higher than the wholesale price. Even if the reserve capacity is not activated, they still profit from the provision of reserve capacity. Paying attention to the difference between the reserve activation probabilities during the hours helps the VPP sell reserve at the higher probability hours, thereby earning a higher profit. Table 3. The VPP's optimal profit.

Scenario
No Reserve = .
The optimal profit (USD) 3548 4134 4168 4230 4499 Next, the change of the optimal results as the probability of contingencies increases or decreases is evaluated. Note that in the above section, we assume that the maximum probability of active reserve is 0.05. However, in practice, depending on the penetration level of the RESs in the power system, this probability may be higher. Figure 11 shows the VPP's optimal reserve capacity if the reserve activation probabilities in scenario are multiplied by two, four, and six times, corresponding to the maximum value of 0.1, 0.2, and 0.3. It can be seen that, as the reserve activation probability increases, the number of hours that the VPP can provide the reserve service decreases. It seems that the VPP expects to profit from the provision of reserve control rather than from the actual reserve energy called and generated. This can be explained because RES power output is not enough to supply the load, especially in the period from hour 17 to hour 21, so that the ESS needs to provide a part of the load. An activated reserve contract period will use most of the ESS energy so that the VPP must purchase electricity from the main grid (hour 18 in Figures  8a and 9a). However, the peak-load price of 129.6 USD/MWh is higher than the total reserve capacity and reserve energy price; consequently, the operating cost increases.  during the peak-load period instead of focusing on reserve service. As a result, the reserve capacity and the number of hours of reserve service decreases, and the value of the reserve activation probability each hour has little effect on the optimal results ( Figure 13). Note that we are only interested in the VPP's ability to provide reserve service when the RES power output is even less than the local load in this section. If the RES power output during most hours of the day is higher than the load, deciding whether to enter the BC market or not becomes much simpler.

The Impact of the ESS Sizing
In this section, we consider the effect of the ESS sizing on the VPP's optimal reserve capacity. Figures 14 and 15 show the optimal reserve contract of the VPP for three scenarios of reserve activation probability and several ESS sizing. It can be seen that when the rated capacity of the ESS is 20 MWh, and the rated power varies from 10 MW to 30 MW,

The Impact of the ESS Sizing
In this section, we consider the effect of the ESS sizing on the VPP's optimal reserve capacity. Figures 14 and 15 show the optimal reserve contract of the VPP for three scenarios of reserve activation probability and several ESS sizing. It can be seen that when the rated capacity of the ESS is 20 MWh, and the rated power varies from 10 MW to 30 MW, the obtained results show that the rated power of the ESS does not affect the optimal reserve sizing much. Meanwhile, when the ESS rated power is 10 MW and the rated capacity increases from 10 MW to 40 MW, the optimal reserve capacity also increases for all three scenarios of the reserve probability. However, while the scenario p 1 still maintains three contract periods, the number of provisioning periods in scenarios p 2 and p 3 decreases, and the reserve capacity in each period increase significantly. It can be explained that in scenario p 1 , most of hours with a high probability of reserve activation also have a relatively high RES power output. By contrast, in scenarios p 2 and p 3 , there are some hours of high RES power output but low probability of reserve activation, so that the high rated capacity of ESS will help VPP to accumulate energy to provide higher reserve capacity during high-probability hours.
Appl. Sci. 2021, 11, x FOR PEER REVIEW 18 of 25 forecasted wind and load capacity shown in Figure 12. It is easy to see that the wind capacity is not enough to supply the load most of the time. Therefore, ESS needs to increase the purchase of electricity with the off-peak price to store and provide to the local load during the peak-load period instead of focusing on reserve service. As a result, the reserve capacity and the number of hours of reserve service decreases, and the value of the reserve activation probability each hour has little effect on the optimal results ( Figure 13). Note that we are only interested in the VPP's ability to provide reserve service when the RES power output is even less than the local load in this section. If the RES power output during most hours of the day is higher than the load, deciding whether to enter the BC market or not becomes much simpler.  In this section, we consider the effect of the ESS sizing on the VPP's optimal reserve capacity. Figures 14 and 15 show the optimal reserve contract of the VPP for three scenarios of reserve activation probability and several ESS sizing. It can be seen that when the

Conclusions
This paper considers and analyzes the VPP's optimal scheduling problem in the BC and energy markets. The main purpose is determining the VPP optimal reserve sizing and the possible operating scenarios of the VPP in the DA and ID markets. This task is challenging because the VPP operators do not know whether their reserve service will be called; hence, the profit from provisioning reserve service is uncertain. To solve this problem, we build a two-stage chance-constrained model considering the probability of reserve activation. The uncertainty in the load and the RES maximum power output is also taken into account. The influence of reserve activation probability, RES capacity, and ESS sizing on optimal reserve capacity is studied and analyzed.
The results show that paying attention to the hourly reserve probability will help schedule the operation of the VPP to provide redundancy at times of high reserve activation probability. The results also show that the reserve provisioning duration decreases if the reserve probability increases with the given input parameters. From that, it can be seen that the VPP expects to make a profit from reserve capacity provision than from the actual reserve energy generated. Furthermore, ESS plays a significant role in providing reserve, helping the VPP provide reserve even in the shortage of power output.
The proposed approach can be applied to any VPP models with different types of RES or controllable loads. Moreover, the model can be readily adapted to study the influence of other factors, such as the reserve activation price. There are some limitations to the proposed model. For example, the demand response, which can be treated as a reserve in the peak-load periods, was not accounted for. These topics are left for future work.