*3.3. Optimization*

The aim of the proposed model is the maximization of the aggregator's total profit which consists of income obtained from the operation of renewable resources (wind and solar), DERs, ALs and ESSs, all managed by the aggregator. The total income is divided among the DRA participants due to their contribution.

For the purposes of the simulations, only the market price of electrical energy was taken under consideration. Income resulting from RES subsidies were neglected, as they are the topic of separate research.

The resulting objective function is given by Equation (10). 

$$\begin{split}obj &= \max \left\{ \sum\_{t=1}^{T} \left[ \sum\_{r=1}^{R} \left( E\_{RES}^{t} \cdot p^{t} \right) + \sum\_{g=1}^{G} \left( E\_{g}^{t} \cdot p^{t} \right) - \sum\_{a=1}^{A} \left( E\_{AL}^{t} \cdot p^{t} \right) \right. \\ &\left. + \sum\_{s=1}^{S} \left( \left( E\_{\exp s}^{t} \cdot p^{t} \right) - \left( E\_{imp}^{t} \cdot p^{t} \right) \right) \right] \right\} \end{split} \tag{10}$$

The provision of the ASs is enforced by the DRA through proper constraints. The proposed model comprises three types of services: load profile shaping, load levelling and a combined service (simultaneous smoothing and load levelling). Changes in operational points for the provision of ASs may be formulated by the DRA coordinator as an o ffer submitted to the market. Previously described balancing and reserves remain outside the scope of this article.

Both Equations (11) and (12) describe constraints that correspond to maximum ramps (load profile smoothing) when Equation (13) results in the provision of peak shaving and valley filling (load levelling service).

$$
\Delta PCC\_{\%} = \frac{PCC^{t-1} - PCC^t}{PCC\_{\text{maxref}}} \cdot 100\% \tag{11}
$$

$$-\Delta PCC\_{\%} \le \Delta PCC\_{\text{defs}\%} \le \Delta PCC\_{\%} \tag{12}$$

$$PCC\_{\text{des \\_min}} \le PCC^t \le PCC\_{\text{des \\_max}} \tag{13}$$

All parameters with the indication des have to be treated as values desired by the system operator as a part of the provision of ASs.

The demand change at the PCC is given by Equation (14) and described as the percentage ratio of the di fference between the maximum and the minimum load regarding the maximum load during the simulations' time horizon.

$$
\Delta Dem = \frac{PCC\_{\text{max}} - PCC\_{\text{min}}}{PCC\_{\text{max}}} \cdot 100\% \tag{14}
$$
