*3.4. Daily Profits Calculation*

The daily profits are calculated as the sum of the hourly profits. In Equation (9), the calculation of daily earnings is depicted. The daily losses are formulated as in Equation (10).

$$Earnings = \sum\_{h=1}^{24} \left( E\_{DM,\mathbb{C}}(h) \cdot \Pi\_{DM}(h) + E\_{ID,\mathbb{C}}(h) \cdot \Pi\_{ID}(h) \right). \tag{9}$$

$$Losses = \sum\_{h=1}^{24} \left( P\_{\varphi}(h) \cdot \Pi\_{ID}(h) + \lambda\_{\text{cost}}(h) \right). \tag{10}$$

where the following apply:


Downward deviations can be corrected in intraday markets in two ways:


The optimization algorithm chooses how to correct expected deviations depending on the intraday market prices and deviation costs at each hour.

#### **4. Optimization Problems for Market Participation**

In this work, market scheduling strategies are formulated as mathematical optimization problems. The progressive optimization approach, similar to the one described in [5], is employed. The day-ahead market scheduling problem is first solved to generate an hourly power schedule vector *PSch*. This vector is updated and sent to the secondary control level in real-time throughout the day. The process is illustrated in Figure 6.

**Figure 6.** Daily optimization process.

This section presents the formulation of the optimization problems. The day-ahead market offering is explained first, followed by the intraday market offering, and finally the proposed SE service optimization is described as a separate problem.
