## 1 Introduction
Meanwhile, study [19] considers the demand response exchange (DRX) market, which allows a VPP to buy demand response services (DR) to reduce the imbalance cost in the BE market. A few other works focus on the VPP's reserve trading in the BC market, which plays an essential role in maintaining the system frequency and stability. [PERSON] and [PERSON] [8] investigate the bidding strategy of a VPP in the joint energy and spinning reserve market. The authors consider only the reserve energy market while the adequacy reserve maintained by a VPP is a predetermined parameter. Several more recent studies [20; 21; 22] propose multi-stage scheduling models considering the BC market. In these papers, the VPP trades the reserve capacity simultaneously as energy trading in the day-ahead market. By contrast, the reserve capacity contract in practice should be determined several days before the day-ahead market, depending on the electricity market's rules in each country and the balancing product [23; 24; 25]. It is easy to see that computing the optimal reserve capacity trading is problematic because it is impossible to accurately predict the RES available power output and the local load. On the other hand, a reserve contract not only requires scheduling RESs less than the forecasting available power but also forces the ESS to maintain a minimum energy level to provide reserve service, thereby reducing the role of ESS in supplying the load. It can be seen that the probability of a power shortage depends on the penetration level of RES or demand. If the probability of reserve activation is quite small, the VPP's profit in the BC market may not be higher than the reduction in its profit in the day-ahead market. However, a few works consider the probability of reserve activation when determining the optimal reserve contract, such as [26; 27]. Moreover, these studies are implemented from the perspective of the grid manager, whose task is to optimally distribute the reserve capacity to all plants in the main grid, rather than to optimize individual power plants' profit. This paper proposes a two-stage scheduling problem of a CVPP, including RES units, ESSs, and demand. The CVPP participates in both reserve capacity and energy markets. The primary goal is to determine the VPP's optimal reserve contract to maximize the VPP's profit while still considering its operating scheme in the energy market. The optimal 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.