Multistage Stochastic Programming for VPP Trading in Continuous Intraday Electricity Markets

—The stochastic nature of renewable energy sources has increased the need for intraday trading in electricity markets. Intraday markets provide the possibility to the market participants to modify their market positions based on their updated forecasts. In this paper, we propose a multistage stochas- tic programming approach to model the trading of a Virtual Power Plant (VPP), comprising thermal, wind and hydro power plants, in the Continuous Intraday (CID) electricity market. The order clearing in the CID market is enabled by the two presented models, namely the Immediate Order Clearing (IOC) and the Partial Order Clearing (POC). We tackle the proposed problem with a modiﬁed version of Stochastic Dual Dynamic Programming (SDDP) algorithm. The functionality of our model is demonstrated by performing illustrative and large scale case studies and comparing the performance with a benchmark model.

Abstract-The stochastic nature of renewable energy sources has increased the need for intraday trading in electricity markets. Intraday markets provide the possibility to the market participants to modify their market positions based on their updated forecasts. In this paper, we propose a multistage stochastic programming approach to model the trading of a Virtual Power Plant (VPP), comprising thermal, wind and hydro power plants, in the Continuous Intraday (CID) electricity market. The order clearing in the CID market is enabled by the two presented models, namely the Immediate Order Clearing (IOC) and the Partial Order Clearing (POC). We tackle the proposed problem with a modified version of Stochastic Dual Dynamic Programming (SDDP) algorithm. The functionality of our model is demonstrated by performing illustrative and large scale case studies and comparing the performance with a benchmark model. Thermal generation at t, for delivery product d.

I. INTRODUCTION
D UE to the inherent stochasticity of Variable Renewable Energy Sources (VRES) the traded volumes in the short-term electricity markets are on the rise [1]. In several electricity markets around the world, the short-term trading time frames can be divided into Day-Ahead (DA), Intraday (ID) -within the day of delivery of electricity, and realtime (RT). ID markets provide the capability to the market participants to modify their day-ahead position (committed generation/consumption) through a market-based procedure. The deviations in the physical delivery from the final position at the gate closure of the ID market are subjected to imbalance penalties.
The intraday electricity markets in Europe take the form of either a continuous market clearing mechanism, or a discrete auctions scheme [1]. Continuous intraday (CID) trading is similar to the stock market and is based on the pay-as-bid principle. The traders can submit orders of the volumes that they are willing to buy (bid orders) or sell (ask orders) at a specific price, at any time during the trading horizon. For example, a bid order can be transacted whenever there is an ask order available with a price less than or equal to the price of the submitted bid order [2]. Discrete auction trading follows a merit-order approach with the auctions taking place only at prespecified times. As per May 2021, 22 European countries are coupled to trade in the intraday market through a single trading platform called Single Intraday Coupling (SIDC) [3]. The trade in this SIDC platform is organized using a CID mechanism, making this mechanism relevant to the market participants across Europe [3].
The Market Time Unit (MTU) is the time granularity into which the market is operated. It is being planned to reduce the MTU from 60 min to 15 min [4] in the European electricity markets. As a result, the ID traders who manage a VPP comprising a portfolio of assets for example, hydro, wind, thermal power plants, etc., are required to take faster decisions, while considering the technical limitations and uncertainties in the production of their assets. As a result, the complexity of the trading problem is becoming increasingly challenging for the human traders to handle, thus creating a paradigm shift towards a more automated trading environment [5].
In this paper, we model a sequential optimization problem to study the VPP participation in the CID market in a variable and uncertain environment. The decision problem is modeled as a Multi-Stage Stochastic integer Programming (MSSiP) problem where the decision at any given stage depends on the present stage and the expectation of the future stages. We solve the MSSiP problem using a modified version of Stochastic Dual Dynamic Programming (SDDP) algorithm. SDDP algorithm is a multi-stage Benders decomposition algorithm, which utilizes sampling approaches to counter the curse of dimensionality, considering the stage coupling and uncertainties. It was proposed in the seminal work of [6].

A. Literature Review
There are several papers that study VPP bidding in DA and RT markets [7], [8], [9], [10]. Recent literature on intraday markets includes [11], where the strategy for the wind power plant to participate in the ID market is proposed based on the forecasts of up-and down-balancing prices. In [12], a bilevel optimization model is presented for a strategic producer to participate in the DA and ID markets. However, the aforementioned works do not consider the specific requirements of the CID market or the multiple stages of decision making. The problem of energy storage bidding in the CID market has been tackled using Reinforcement learning in [13] and [14].
A detailed literature review on recent works on ID markets is available in [15]. None of the research works so far have addressed the participation of a portfolio of the power plants in the CID market as an MSSiP problem.
The Stochastic Dynamic Programming (SDP) approach has been utilized in some research works to solve Multi-Stage Stochastic Programming (MSSP) problems [16]. However, the SDP approach suffers the curse of dimesionality making it difficult to apply the algorithm on large-scale problems. This is the main motivation behind employing the SDDP algorithm to model the VPP trading in a CID market as a sequential decision making problem. This algorithm has been widely used for long-term planning (expansion planning) [17], [18], [19], as well as for medium-term planning problems [20], [21].
Some research works leverage SDDP for solving models related to optimal short-term planning and operation problems under uncertainty. In [22], SDDP was used to solve a multistage stochastic transmission-constrained economic dispatch problem focusing on pumped hydro storage. The operation of a Distributed Energy Resources (DER) aggregator in RT markets has been modeled by using a modified version of SDDP in [23]. An MSSP model for minimizing the expected energy cost of operating a microgrid is proposed in [24]. SDDP requires the random data process, that acts as an input to the model, to be stagewise independent. Two approaches to cope with this in SDDP have been proposed in [25]; the first one models the data using autoregressive time series, while the other uses Markov chains to discretize the random data processes. In [26], an optimal bidding strategy for a VPP, comprising wind power parks, in the Spanish DA and six discrete auctions in ID market is solved with a variant of SDDP. However, none of the aforementioned works on SDDP has focused on modeling the trading of a VPP in the CID market.

B. Contributions & Organization
In this paper, we address the problem of participation of VPP in the European CID market, within a stochastic environment. We formulate the CID trade as an MSSiP problem. It is then solved by a modified SDDP approach. Specifically, the main contributions of our work are summarized in the following points: • We model the problem of a VPP with a portfolio of hydropower, wind and thermal generation, participating in the CID market, as an MSSiP problem. The proposed model warrants the trading decisions concurrently for all the 24 hourly delivery products, considering the forwardlooking approach enabled by dynamic programming; • We propose two order clearing models, namely the Immediate Order Clearing (IOC) and the Partial Order Clearing (POC), to capture two possibilities by which the submitted orders can be cleared in the CID market. The volume available in the Shared Order Book (SOB), which is the compilation of buy (bid) and sell (ask) orders that are submitted by market participants, is modeled using stochastic processes; • A modified SDDP algorithm is leveraged to solve the problem of VPP participation in the CID market considering stochastic wind generation, hydro inflow, and SOB volumes, using autoregressive (AR) processes. The proposed concept is displayed with an illustrative example with varied number of stages and transaction costs. We demonstrate the scalability and usefulness of our proposed models through case studies, comparing the results with the deterministic equivalents.

II. BACKGROUND
In the European CID market, a Delivery Product (DP) refers to the time of physical delivery of electricity. For example, the first hourly DP of the day (D) would be the hour from 00:00 to 01:00. So, the CID trade for this product can take place on the D-1 (day before operation) starting at 15:00 CET. The CID market gate closure (GC) takes place a few minutes before the physical delivery of electricity. For example in Sweden, the GC for the first DP on day D takes place one hour before the delivery (23:00 on D-1). Similarly, there are 24 hourly DPs corresponding to the 24 hours of the day. Fig. 1 shows an illustration of the hourly DPs in the CID market. It is possible to trade simultaneously for multiple DPs. A VPP participates in the CID market with the objective to maximize its profit and update its position, with respect to the DA position, based on new information arriving on its stochastic parameters. Given the setup of the CID market, the VPP submits its orders directly to the Market Operator (MO) who clears the market and informs the VPP if its orders were accepted or not.
The problem of modeling and solving the optimal participation of a VPP in the CID market encompasses certain challenges due to the design of the CID market and the technical constraints of the VPP. In a CID market, trades can take place simultaneously for multiple DPs even though for the same VPP, the problem is coupled across the various DPs as shown in Fig. 1. At the same time, the position of the VPP evolves with time due to the trading that it is involved in based on new forecasts of the hydro inflow and wind. As a result, the model needs to capture these time-interlinked dynamics. Fig. 2 illustrates the multistage nature of the VPP participation in the CID market. Consider the VPP at a given stage and scenario, then each block (blue, violet, green, orange color) in Fig. 2 represents the state (including VPP position, portfolio generation, CID trades, and imbalances) of the VPP corresponding to a given DP. The reduction in the number of blocks at stage 'n' denotes that the gate-closure time of the first DP has passed. This demonstrates a decrement in the state space of the VPP, as the time proceeds in the CID market.

III. PROBLEM FORMULATION
A general multistage stochastic framework comprises the sequential decision making with the given uncertainty, where new information is assumed to be revealed at each stage. The evolution in time of an uncertain parameter can be generally modeled as a stochastic process. As shown in Eq. 1, the objective of an MSSP problem is to maximize the current profit while considering the expected future profit according to the dynamic programming concept [27].
where i t is the state variable that is used for interlinking the decision to the previous stage and j t is the stage variable that is only defined for a particular stage. The decision (i t ) taken at any stage t, depends on the realization of the uncertainty set (ζ t ) and the decision taken at the previous stage t − 1.
We study the problem of VPP participation in the CID market as an MSSiP problem -where each stage of the MSSiP problem (except the last stage) corresponds to a CID trading decision of the VPP for a DP. The last stage of each DP represents the physical delivery (the RT stage) of that DP. The VPP takes a decision at any trading stage by maximizing its profits, while considering the expected future profit at the upcoming stages.

A. Multi-stage Stochastic Programming Model
The objective of the VPP trading in the CID market is to maximize its profits by updating its position in the market from the DA position, while minimizing its imbalances considering the availability of updated forecasts. We assume the VPP to be a price taker, that submits orders with certain volumes at pre-specified price levels. All the variables and stochastic parameters discussed next are defined over scenarios but the indices for scenarios are dropped for brevity.
The objective term (2a) maximizes the profit of the VPP by selling in the CID market while minimizing the transaction cost (imposed by the market platform). Similarly, (2b) refers to the buying trade by the VPP in the CID market. Additionally, the trading decision of the VPP at each stage is also driven by the motivation to minimize its deviations given by δ + t,d and δ − t,d , which is accounted by (2c). The latter part in (2c) is to minimize the water spillage. The cost of the thermal generation at the RT stage is considered by (2d). The future value of the final hydro reservoir content is imposed by (2e). The objective function given in Eq. (2) is subjected to the constraints described next.
VPP position constraints: Let the VPP position for a DP, d, at the time of gate opening (t opn ) of the CID market be denoted by x topn,d . As this is the position of the VPP before trading in the CID market, it corresponds to its DA position (x DA d ) for the same DP: The position of the VPP at a given time, t, corresponding to a DP, d, is given by x t,d . It is updated based on the volume of the accepted bid order (v bid p b ,t,d ) or ask order (v ask p a ,t,d ) in the CID market at any stage t for each DP, d.

B. Order Clearing Models
The volume submitted in the market can be either completely or partially transacted. The volume that is not cleared at the stage it is submitted, can either be cancelled or added in the SOB. This depends on the type of the order [28]. Hence, we present two distinct order clearing models to account for the two possible types of orders by the VPP. For enabling the VPP to adopt the forward-looking approach, we further discuss how the VPP estimates the order volume available in the SOB at any stage. Note that the price level index in this subsection III-B refers to p a unless mentioned otherwise.
1) Immediate Order Clearing (IOC) Model: In this model, it is assumed that the order volume submitted by the VPP to the CID market can only be cleared at that time instant t, while any remaining order volume is cancelled. This is similar to the market order that can be placed by participants in the CID market. Firstly, we discuss about the ask orders submitted by the VPP at predefined price levels. An example with two price levels is shown in Fig. 3. The bid order volume available in the SOB that can be matched with the ask order submitted by the VPP at a price level p is given by the summation of all the bid order volume available at a price above price level p at time t, and is denoted by p n=1 B ask n,t,d . This volume is considered as a stochastic input and obtained from the market data which is elaborated in Section IV. Based on the order clearing principle of the CID market, ask order volume can be cleared with the bid order volume that is available at a price greater than or equal to the price at which the ask order is submitted. This is realized at the price level, p = 1, by considering the minimum of the submitted ask order volume s ask p,t,d and the bid volume (B ask p,t,d ) available in the SOB at a price greater than that at price level p.
For the next price levels, the entire bid order volume available at the price level above p, which is not cleared with the submitted VPP orders at p − 1 can be matched with the VPP ask order at price level p, s ask p,t,d .
s ask n,t,d , s ask p,t,d , If α ask p,t,d turns out to be negative, then it indicates that no volume is cleared, which is imposed by: To ensure that the VPP does not submit any order beyond the GC of CID market for a DP, we impose s ask p,t,d = 0 for the last stage of each DP.
Similar to ask orders, the bid orders submitted by the VPP at t can also be cleared by the IOC model and the part of the bid volume that cannot be cleared at t is eliminated from the SOB. The bid volume posted at P bid p b ,t,d available at stage t is given by s bid p b ,t,d . This is cleared with the ask volume available in the CID market at a price equal to or lower than P bid p b ,t,d , to give the bid order volume (v bid p b ,t,d ) accepted at stage t. In order to make sure that bids and asks are not posted by the VPP at the same stage, we impose the following constraints: where ψ ask t,d and ψ bid t,d are binary variables corresponding toS ask t,d andS bid t,d respectively. The volumes cleared (v ask p a ,t,d , v bid p b ,t,d ) are non-negative variables. 2) Partial Order Clearing (POC) Model: In this case, we assume that the order volume posted by the VPP in the market might not be cleared at the time t when it is submitted. It is similar to the limit order that can be submitted by market participants in the CID market. This way, any submitted order in the CID market at t is available for transaction at t and if it is not cleared then it is available in the SOB at t + 1. For the sake of simplicity, it is assumed to be eliminated from the SOB beyond t + 1. Considering the above assumption, we can allow for a partial order clearing in two consecutive stages and therefore denote the order volume available at price level p a (hereafter denoted as p ∈ P), k ask p,t,d by: As shown in Fig. 4, the bid volume available to be cleared with the ask order at price level p 1 is given by B ask 1,t,d , which is the bid order volume available at a price above p 1 . The ask order volume submitted by the VPP at p 1 would be cleared with the available bid order volume which is represented by: Similarly, the bid volume above p 2 and remaining bid volume above price level p 1 and can be transacted with the ask order volume of the VPP at price level p 2 and so on. The generalized expression for the bid volume available for clearing with the VPP ask order at price level p is given by: s ask n,t,d + k ask n,t−1,d − v ask n,t−1,d , For each price level {2, ..., n}, the volume that can be potentially transacted is given by: Again, if the value of β ask p,t,d is negative according to Eq. (11) then it indicates that no volume is cleared, which is ensured by imposing the following constraint: The total bid order volume (k bid p b ,t,d ) at t can be divided into two components, the submitted bid volume at t and the remaining bid volume from t − 1. Similar to the ask POC model, the bid volume cleared at any price level considers the bid volume, k bid p b ,t,d and the bid volume available at a lower price than that price level. Additionally, the set of equations in (8) are also imposed in the POC clearing model to ensure non-simultaneous submission of ask and bid orders to the CID market.
As the POC model involves additional variables and equations to allow for partial clearing of orders, it increases the computational complexity. However, the theoretical comparison of IOC and POC models would require the discussion about whether it is profitable for the VPP to submit a market order or a limit order. This topic is well studied in financial market literature [29]. It is an interesting direction for future work in the context of CID electricity markets.

C. Technical Constraints of the VPP's Portfolio
Hydropower constraints: The hydro inflow is considered to be a stochastic input with a different inflow uncertainty for each DP, which is represented by I t,d . The hydropower reservoir content at a given stage, t, for a DP, d, depends on the content for DP, d − 1, at the same stage, t, as well as the inflow, outflow, and hydropower generation corresponding to the same stage and DP. However, this relation holds only until the last stage of the previous DP. For the remaining stages of the DP, d, the hydropower reservoir content corresponding to that DP at stage, t, is impacted by the reservoir content in the previous stage, t − 1, for the same DP, d. Along with that, the reservoir content is also influenced by the inflow, outflow, and hydropower generation corresponding to the same DP. Fig.  5 demonstrates the CID timeline with two DPs showing the interlinking between the hydropower reservoir content with stage and DPs. The first stage of the multistage model for a DP, d corresponds to the gate-opening (GO) of the CID market for that DP and the last stage to the RT of the DP, d. We assume that the last opportunity to trade in the CID market is given by the penultimate stage, T d − 1, which corresponds to the gate-closure (GC) of the CID market for the same DP, d. The constraint to account for interlinking between the DPs for the hydropower reservoir content, h t,d , until the last stage of previous DP, d − 1, is given by: Interlinking the hydropower reservoir content for the remaining stages in the trading horizon of DP, d, yields: The variable domains for the hydro reservoir content and hydropower production are: Thermal production constraints: We define thermal generation (g t,d ) as a function of stage t and DP, d to provide a flexible portfolio for participation of the VPP in the CID market trade. It is constrained by generation limits as per: The thermal power generation (g rt d ) at the RT stage (T d ) for a DP, d is equal to that at the gate closure time (T d−1 ) for the same DP, d. It follows from the assumption that the thermal power generation is not subjected to variability and can deliver the same energy in the RT, that it has committed at the GC of the CID market.
In order to interlink the thermal generation to be delivered for DP, d (g rt d ) with that delivered for the previous DP, d−1, we account for the up-regulation (u rt d ) and down-regulation (d rt d ) of the thermal power plant corresponding to DP, d as given in Eq. (15). For the first DP, the thermal generation of the last hour of previous day (G init ) is taken as the reference for calculating the thermal regulation. As G init acts as an input in determining the actual thermal generation level, the cost for up or down regulation is included in the objective function (2). For the remaining DPs, their respective RT stages occur after the thermal power plant has been dispatched for their corresponding prior DP. Therefore, the real generation of the thermal unit for the prior DP is considered while deciding for the up or down-regulation of for any DP other than for d = 1. Fig. 6 demonstrates this interlinking of the thermal generation between DPs, d 1 and d 2 . It also shows how the activated up and down-regulation contribute in determining the thermal generation for a DP, d given the thermal generation of the previous DP, d − 1. VPP imbalances: The relation between the VPP position (x t,d ), generation from wind power (W t,d ), hydropower (h t,d ) and thermal (g t,d ) can result into imbalances at each time and each DP, d. Therefore, we introduce non-negative variables, one for the positive imbalances, δ + t,d and the other for the negative imbalances, δ − t,d , for each stage and DP:

D. Mixed-integer Reformulation
Equations (5), (6), (7), (10), (11), and (12) comprise the min and max functions, making them non-linear. We reformulate those equation using the Big M method. This is illustrated for Eq. (5) below: where φ is a binary variable and M is a large positive number. The other non-linear expressions can also be reformulated in the similar way as in (17). The updated set of variables for problem 2 is:

E. Solution Methodology
We leverage the Approximate Dual Dynamic Programming (ADDP) algorithm [25], a modified version of SDDP, which is a two-step procedure. Central to this algorithm is the construction of the lattice, i.e., a graph with layers where each layer represents a stage. It comprises nodes that denote a state of the stochastic process, while arcs denote the probability of transition from one node to the other. In a lattice, unlike scenario trees, each node can have multiple predecessors. The first step of the algorithm is to create a discrete lattice out of the continuous Markov process in such a way so that its optimal policy is as close as possible to the optimal policy of the true process. The second step is to solve the discrete Markov Decision Process (MDP) using SDDP, a simulationbased iterative algorithm that conducts a forward pass to determine the approximate optimal policy by sampling a sequence of state transition from the scenario lattice. We denote the sample average reward collected during the forward pass as the simulated reward, which is in the form of a distribution with a standard deviation that reduces with iterations. In the backward pass, new hyperplanes are added to the set of supporting hyperplanes to determine the approximate post-decision value function. This value function acts as an upper bound to the true value function and is utilized in the next iteration of the forward pass to determine the approximate optimal policy. Expected reward is the approximate reward obtained using the value function approximation that enters the firststage problem. It includes the first-stage objective function and the cost-to-go approximated by hyperplanes. Since the proposed model in Section III comprises of integer variables, we utilize Stochastic Dual Dynamic integer Programming (SDDiP) algorithm, a further extension of ADDP, which is proposed in [27]. We adopt the strengthened Benders' cut for our model to be used in the SDDiP algorithm and follow the procedure as per the first step of [30]. However, we do not proceed with the second step which involves the binarization of the continuous, time-interlinked variables to be able to apply Lagrangian cut as it adds significant computational burden, which is not favourable to our application.

IV. STOCHASTIC PROCESS MODELING
We employ a stochastic process modelling and simulation methodology to model the evolution of the uncertain factors in time. The uncertainties of interest for the VPP under the proposed framework are the wind power, hydro inflow forecast errors, bid and ask volumes available in the SOB within the different price levels. The VPP is assumed to receive forecasts for both wind power production and hydro inflow, which improve in stages closer to the time of physical delivery. The autoregressive (AR) processes are introduced to capture the forecast errors at each stage (ξ t ) associating them with their lag values (ξ t−i ), serially independent and a identically distributed (i.i.d.) noise, t [31].
R i the autocorrelation coefficients (calculated from the historical data), and l the number of lags for the AR model. Without reducing the generality of our methodology, we make certain simplifying assumptions for the practical implementation of the case study. We assume a first-order AR process, i.e., AR(1), and we disregard the correlation coefficients between the wind and inflow processes. Also, it is assumed that the AR noise follows a normal distribution (µ, σ). Following this method, the actual wind generation and inflow can be expressed as: Ŵ t,d andÎ t,d are the wind and hydro inflow forecasts at the GO of the CID market for each DP, and ξ W t,d , ξ I t,d their forecast errors respectively.
Additionally, we also consider the bid (B ask p a ,t,d ) and ask (A bid p b ,t,d ) volumes available in the SOB from the other traders as stochastic inputs. For these volumes, the historical ID trade data is analysed from Nord Pool for the period 2019-2020 [32]. A number of price levels are selected and the temporal evolution of the total volume within those ranges from the historical CID trades is studied. For each price range, defined by two consecutive price levels, we calculate the total accepted ask and bid volumes for a specific price area combination and interpolate this data to create an evenly-spaced time series. Subsequently, this time series is deployed to fit the AR models to create scenarios for the available order volume at a specific time. We use AR(1) models for creating scenarios for each of the ask and bid volume time series corresponding to each DP, assuming that there are no correlations between them and the time series of other DPs.

V. RESULTS AND DISCUSSION
The simulations for the trade of VPP in the CID market have been carried out in Python 3.7 and the SDDiP model has been solved with the help of QUASAR [25] using the FICO Xpress solver. All the simulations were performed with an Intel(R) Core(TM) i7-10850H CPU @2.70 GHz machine.

A. Illustrative Example
In this example, we consider the gate-opening of the CID market to be at 15:00 CET of the D-1 (one day before the day of physical delivery) while the gate-closure is at 23:00 CET for DP, d = 1. The gate-opening is same for d = 2 while the gate-closing happens at 00:00 CET. For the sake of simplicity, we assume one trade per hour. Therefore, the total number of trades for d = 1 are 7 and for d = 2 are 9 while the 8 th stage for d = 1 and 10 th stage for d = 2 are the RT stages for the two DPs respectively. We obtain a lattice for 10 stages with 901 nodes with 1 root node and 100 nodes per stage and 62555 arcs [33]. The average computation time for the case studies of the illustrative examples were 40 seconds.  (20) 20 (20) The inputs considered for the autoregressive (AR) processes are shown in Table I. The minimum and maximum reservoir content is 0 and 100 MWh respectively. The up-and downregulation capacity of the thermal unit is considered to be 10 MW/h. The minimum and maximum generation is taken to be 0 and 20 MWh respectively. While we provide a general formulation for multiple price levels in the SOB, the case study is limited to two price levels each for ask and bid volumes. The prices at which the VPP is able to buy are e 20/MWh  Fig. 7. On deploying the SDDiP algorithm in our model, the expected reward at the first stage and the mean of the distribution of simulated rewards is checked for convergence. The obtained value functions at the end of the simulation are used as the decision policy which provides a solution for a given stage, state, and relevant decision history. The decision variables as shown in Fig. 7 are obtained by simulating 2000 scenarios from the AR processes with the decision policy. The outcome for the hydropower and thermal production at each stage of the CID market is demonstrated for both the DPs. As a result of the submitted order volume (s ask ) and the available volume in the CID market for realizing the trade, the cleared volume (v ask ) is illustrated in the figure. For example, at stage 1, the submitted ask order was 40 MWh while only 20 MWh were cleared according to the IOC model described in Section III-B1 as the average value of bid volume in SOB was 20 MWh. The evolution of the VPP position over stages as a result of the realized trades is shown in Fig. 7. The positive imbalances of the VPP for both the DPs are shown in the plots and they were found to be 0 for all the stages except the last stage for d = 2 where a small amount of positive imbalance was found at the RT stage due to uncertain parameters.
For the d = 1, in the beginning of the CID market, the VPP predominantly tries to sell in the CID market with the expectation of increased inflow. This leads to an increase in the VPP position for the d = 1. The thermal generation is envisaged to be reduced to minimize the eventual cost of generation whereas the portfolio of the VPP is balanced by increasing the hydropower generation. On average, the VPP sells further as it receives a higher price in the CID market than its expected cost of thermal generation. Furthermore, the presumption of increase in hydropower inflow and availability of reservoir volume supports the VPP's decision to sell. However, in some of the scenarios, where the VPP comes across reduction in wind and inflow, it buys from the market, reducing its position. Beyond stage 6, as the RT stage approaches, the VPP is not willing to trade further and tries to maintain its position so as to minimize its expected imbalances at the RT stage. It can be observed from Fig. 7 that the number of stages for d = 2 are more than that for d = 1 as the gate-opening time for the DPs is the same while the gate-closure time is later for d = 2 as compared to d = 1. In this DP too, the VPP attempts to sell with the anticipated increase in inflow. As we also consider the future water value of the hydro reservoir, this restricts the usage of the hydro reservoir content further reducing the volume sold by the VPP after stage 3. Moreover, the VPP predominantly buys at stage 4 and beyond as it is less expensive to buy back energy rather than produce it using the thermal unit. However, its position is almost unchanged from stage 7. At the RT stage, the hydropower generation compensates for the reduction in thermal generation that allows to avoid the additional generation cost.
We evaluate the rewards obtained by the VPP as per the IOC model when the number of stages (trades) are increased for both the DPs as shown in the Table II. Thereafter, we analyze the impact of different transaction costs on the rewards of the VPP with the increase in the number of stages. It can be seen that the increase in the number of trades does not provide any further benefit beyond six trades per hour (54, 60 stages) for 10 C/MWh transaction cost. However, for a higher transaction cost (20 C/MWh) no significant added benefit is observed beyond three trades per hour (27, 30 stages).
2) Partial Order Clearing Results: According to the CID market principle, if the submitted order volume is not completely cleared then it can be added in the SOB. This feature of the CID market proposed in the POC model described in Section III-B2. Fig. 8 demonstrates the results of the submitted order (s ask ), available bid order in the order book (f ask ), net ask order from the VPP (k ask ), and the resulting cleared volume (v ask ). It can be seen that the ask volume cleared in the CID market is the minimum of f ask and k ask . Consider the stage 2 where the average submitted ask volume is 44 MWh, in which however, only 30 MWh is cleared as that is the maximum buy volume available in the SOB. The remainder volume (14 MWh) that could not be cleared at stage 2 is then carried forward to the next stage where it is added together with the incoming ask order (8 MWh) at stage 3. The total ask volume at stage 3 is 22 MWh, which can be cleared with the buy volume at stage 3. Therefore, there would be no volume carried forward to stage 4 in this case.

B. Comparison with the Deterministic Solution
With the aim to demonstrate the scalability of our model, the CID trading model of the VPP is implemented in an more detailed case study including all the 24 hourly DPs. As shown in Table III, the cases 1a and 1b have 10 stages for the first DP, adding one stage for each consecutive DP, making it 10, 11, ..., 33 stages. The cases 2a and 2b had 10, 12, 14, ..., 56 stages. Similarly, cases 3a and 3b considered 10, 13, 16, .., 79 stages while cases 4a and 4b had 10, 14, 18, ..., 102 stages. All the 1b, 2b, 3b, and 4b cases represent the deterministic equivalent of the 1a, 2a, 3a, and 4a models respectively. In the deterministic model, the AR processes are fixed to their respective mean values. It can be seen from the Table III that the our proposed model provides higher rewards and lesser standard error in the simulated reward as compared to the corresponding deterministic equivalent. However, it comes at the cost of added computation time and the number of linear programs (LPs) solved. No final imbalances were found in any of the aforementioned cases.

VI. CONCLUSIONS
In this paper, we have modeled the problem of a VPP, with wind, hydro and thermal power generation portfolio, participation in the continuous intraday market as a multistage stochastic integer programming problem (MSSiP). The proposed MSSiP problem has been tackled using a modified version of Stochastic Dual Dynamic Programming (SDDP) algorithm where the stochastic inputs are modeled as autoregressive processes. Our model enables simultaneous order posting for multiple delivery products at any given time in the CID market trading horizon. Furthermore, two order clearing models, namely the Immediate Order Clearing (IOC) and the Partial Order Clearing (POC) have been presented to model the trading process in the CID market. It was found that the increase in the number of trading stages does not add any further reward beyond a particular number of stages and also depends on the transaction costs. The effectiveness of our approach is demonstrated by comparing the performance of the VPP through our proposed model for all the 24 hourly delivery products with the corresponding deterministic equivalent. The proposed model was found to provide higher rewards at the cost of higher computation time with respect to the deterministic model.

VII. ACKNOWLEDGEMENTS
We are grateful to Nils Löhndorf for providing us with the opportunity to use QUASAR.