*3.1. Health-Aware Perception Model*

The previous literature has used the SoH of an electrochemical battery to characterize its degree of life degradation. Within this segment, a health-aware perception model utilizing the battery's equivalent circuit is established. Since the dual-polarization (DP) equivalent circuit model is superior to the Thevenin model in the field of balance estimation precision and calculative speed, the DP model has been chosen to characterize the SOH of the battery. The DP model is essentially a series circuit, consisting of a power source, internal resistance, and a second-order RC parallel circuit, shown in Figure 2 [32].

**Figure 2.** DP equivalent circuit.

The spatial state equations for the DP equivalent circuit can be derived as follows:

$$\begin{cases} \boldsymbol{u}\_{t} = \boldsymbol{\mathcal{U}}\_{\boldsymbol{\alpha}\boldsymbol{\varepsilon}} - \boldsymbol{u}\_{\boldsymbol{c}1\_{1}t} - \boldsymbol{u}\_{\boldsymbol{c}2,t} - \boldsymbol{i}\_{t}\boldsymbol{R}\_{0} \\\ \boldsymbol{i}\_{t} = \frac{\boldsymbol{u}\_{\boldsymbol{c}1,t}}{R\_{1}} + \boldsymbol{\mathsf{C}}\_{1}\frac{d\boldsymbol{u}\_{\boldsymbol{c}1,t}}{dt} = \frac{\boldsymbol{u}\_{\boldsymbol{c}2,t}}{R\_{2}} + \boldsymbol{\mathsf{C}}\_{2}\frac{d\boldsymbol{u}\_{\boldsymbol{c}2,t}}{dt} \end{cases} \tag{1}$$

where *Uoc* is the open circuit voltage, *R*<sup>0</sup> is the internal resistance of the battery, *i*(*t*) is the internal current of the battery, and *uc*1,*<sup>t</sup>* and *uc*2,*<sup>t</sup>* represent voltage across the two RC circuits. By measuring the open circuit voltage and voltage across each RC circuit, the circuit current can be calculated using the spatial state equations. Battery capacity can then be calculated using Equation (2).

$$E\_{SES,t} = E\_{SES,t\_0} - \eta\_{SES} \int\_{t\_0}^{t} i\_t dt \tag{2}$$

where *ηSES* is the Coulombic efficiency of the battery, *ESES*,*t*<sup>0</sup> represents the rated capacity of the battery at initial state, *ESES*,*<sup>t</sup>* represents the capacity of the battery at time *t*, and *t*<sup>0</sup> represents the initial operating time of the battery. Based on the stored energy capacity, the SoH of the ES battery can be calculated.

The SoH of the ES battery at time *t SOHt* is expressed as the present available capacity divided by the rated capacity at initial state, as follows:

$$SOH\_l = \frac{E\_{SES,t}}{E\_{SES,t\_0}} \times 100\% \tag{3}$$

As energy storage batteries undergo continuous charging-and-discharging cycles, internal aging occurs, resulting in increased internal resistance and decayed capacity. For a brand-new RE storage battery, its initial *SoH* is 1. When *SoHt* is lower than a certain value *δ* or the internal resistance of the battery increases to more than twice the initial resistance, the energy storage battery should be dismantled and recycled. Therefore, the final state of health for the battery is *δ*, which is set to 0.8 in this paper [33–35]. Thus, the *SoHt* and internal resistance of energy storage batteries are subject to the following constraints:

$$\begin{cases} \begin{array}{c} SOH\_t \geq \delta \\ Z\_t \geq 2Z\_{\text{start}} \end{array} \end{cases} \tag{4}$$

where *Zt* is the internal resistance of the battery at time *t*. The relationship between SoH and battery internal resistance can be further established using DP equivalent circuits, which facilitates the determination of whether the battery is still suitable for ES based on its internal resistance, as shown below:

$$Z\_t = Z\_{\text{start}} + \frac{SOH\_{t0} - SOH\_t}{SOH\_{t0} - SOH\_{tN}} (Z\_{\text{end}} - Z\_{\text{start}}) \tag{5}$$

where *SOHt*<sup>0</sup> and *SOHtN* , respectively, represent the initial and final health status of the battery during its lifespan, *Zstart* and *Zend* are the battery's resistance at the beginning and end of the entire lifespan, respectively, and *tN* is the end time of the battery's lifespan.

In addition, the relationship between the maximum power output *Pt* of a battery at a certain moment and its SoH can be derived from DP equivalent circuits, as shown in Equation (6):

$$P\_t = \frac{Z\_{start}}{Z\_t} P\_0 \tag{6}$$

where *P*<sup>0</sup> refers to the maximum power output that the battery can produce at the initial state.

#### *3.2. Energy Storage Battery Life Degradation Model*

The life degradation of ES batteries is influenced by various external stress factors, such as temperature and operating time, and is also affected by the battery's life status. Therefore, its degradation can be considered as a nonlinear process that is the result of the combined effect of external stress and time by establishing a nonlinear life degradation model that can be decomposed into multiple stress factor models.

The life degradation caused by calendar aging *Lcal*, can be considered as a function of the average state of charge *Soc*(*κ*), battery average temperature *Tc*, and time *t*.

$$L\_{\rm cal} = \lg\_t(\overline{\mathbf{x}}, \mathbf{t}, T\_{\overline{\mathbf{C}}}) \tag{7}$$

Each charge and discharge cycle of the battery results in life degradation. The cumulative life degradation is obtained by adding up life degradation of each cycle.

$$L\_{\rm cyc} = \sum\_{t=1}^{N} \omega\_t g\_{\mathcal{E}}(\kappa\_{t\prime}, \theta\_{t\prime} T\_{\mathcal{E}}) \tag{8}$$

where *Lcyc*,*loss* refers to the life degradation caused by cycle aging; *ϑ<sup>t</sup>* represents the depth of discharge of the battery in the *t*-th cycle; and *ω<sup>t</sup>* is a 0–1 variable that characterizes the operating state of the battery in the cycle *t*, with a value of 1 indicating that the battery is in a cyclic charging-and-discharging state and 0 indicating that the battery is not undergoing charging and discharging, during which the life degradation of the battery only includes the life degradation caused by calendar aging. The life degradation of the entire lifetime of the battery can be represented as the function *gd* of *κ*, *t*, *Tc*, *ϑ*:

$$\log\_d(\kappa\_\prime t, T\_{\mathbb{C}\prime} \theta) = \lg\_t(\overline{\kappa}\_\prime t, \overline{T\_{\mathbb{C}}}) + \sum\_{t=1}^N \omega\_t \lg\_\varepsilon(\kappa\_{t\prime} \theta\_{t\prime} T\_{\mathbb{C}}) \tag{9}$$

If cycles are identical, in a single cycle, the average temperature and SOC equals the overall averages of the battery lifetime, thus *Tc* = *Tc*, *κ* = *κ*. Equation (8) can be simplified as shown below:

$$\mathbf{g}\_d(\kappa, t, T\_{\mathbb{C}}, \theta, N) = N \mathbf{g}\_d(\kappa, t, T\_{\mathbb{C}}, \theta, 1) = N \mathbf{g}\_{d, 1} \tag{10}$$

where *gd*(*κ*, *t*, *Tc*, *ϑ*, 1) is denoted as *gd*,1, which represents the life degradation during a single cycle, and *N* is the number of charge and discharge cycles.

The life degradation caused by calendar aging and cycle aging can be expressed in a product form of multiple linear stress factor models as follows:

$$\mathbf{g}\_{d,1} = [G(t) + G(\theta)]\mathbf{G}(\kappa)\mathbf{G}(T\_{\mathbb{C}}) \tag{11}$$

(1) The temperature stress model:

$$G(T\_{\mathbb{C}}) = e^{a\_0(T\_{\mathbb{C}} - T\_{ref}) \frac{T\_{ref}}{T\_{\mathbb{C}}}} \tag{12}$$

(2) The state-of-charge stress model:

$$G(\kappa) = \mathfrak{e}^{a\_1(\kappa - \kappa\_{ref})} \tag{13}$$

(3) The time stress model:

$$G(t) = a\_2 t$$

(4) The depth-of-discharge stress model:

$$\begin{array}{l} G(\theta) = \frac{1}{\frac{a\_3}{a\_3}\theta^{\mu\_4} + a\_5} \\ \theta\_t = \frac{P\_t^{c\bar{t}} + P\_t^{d\bar{s}}}{2E\_{c,t}} \end{array} \tag{15}$$

where *a*<sup>0</sup> represents the temperature stress coefficient; *Tref* refers the reference temperature in Kelvin (K); *a*<sup>1</sup> is the SOC stress coefficient; *κref* is the reference SOC, which can be generally taken as 0.4–0.5; *a*<sup>2</sup> is the time stress coefficient, indicating that after excluding factors such as temperature and life dependence, the degradation rate has a linear relationship with time; *Pch*(*t*) and *Pdis*(*t*) represent the charging and discharging powers of the battery during the *t*-th cycle, respectively; and *a*3, *a*4, and *a*<sup>5</sup> are stress coefficients about DOD.

According to the empirical formula [30], the life degradation of an energy storage battery can be calculated as follows:

$$L\_{loss} = 1 - \gamma\_{cell}e^{-v\_{cell}\mathbf{g}\_d} - (1 - \gamma\_{cell})e^{-\mathbf{g}\_d} \tag{16}$$

where *Lloss* represents the life degradation of the battery over its entire life cycle (pu), and *γcell* and *νcell* are parameters related to the formation process of SEI film.

#### *3.3. Dynamic Efficiency Model for Energy Storage Batteries*

#### 3.3.1. Segmented Linearization of Power for EES Batteries

At any given time, the operating power of the battery *P*(*t*) satisfies the following equation:

$$P\_{\rm c,t} = P\_t^{\rm cl} + P\_t^{\rm dis} \tag{17}$$

However, it is impossible for one battery to charge and discharge simultaneously at any given time, and one of *Pch <sup>t</sup>* or *Pdis <sup>t</sup>* must be zero. The dynamic behavior of the battery is simulated using the aforementioned DP equivalent circuit model, and the relationship between the battery SoH and internal resistance is calculated. The charge–discharge cycles of the battery will cause dynamic changes in its SoH and internal resistance, resulting in dynamic changes in the operational efficiency during different periods. To simplify the model, the charging and discharging power of the battery are segmented and linearized separately. If the charging power is divided into *M*<sup>1</sup> segments, it satisfies:

$$P\_t^{ch} = \sum\_{m=1}^{M\_1} P\_{cm,t} \tag{18}$$

$$P\_{\rm cm}^{\rm min} \omega\_{\rm c,m,t} \le P\_{\rm cm,t} \le P\_{\rm cm}^{\rm max} \omega\_{\rm c,m,t,t} \, m = 1,2,\dots,M\_1 \tag{19}$$

where *Pmax cm* and *Pmin cm* are the maximum and minimum of the charging power for the segment, respectively, and *ωc*,*m*,*<sup>t</sup>* is a 0–1 state variable that characterizes the charging state at time *t*, where a value of 1 indicates that the charging power is within the *m*th segment.

$$\sum\_{m=1}^{M\_1} \omega\_{\varepsilon, m, t} = 1\tag{20}$$

The above equation indicates that the battery charging power can only be within one power segment at any given moment. Similarly, for the discharging power, it is divided into *M*<sup>2</sup> segments, which satisfies:

$$P\_t^{dis} = \sum\_{j=1}^{M\_2} P\_{cj,t}' \tag{21}$$

$$P\_{cj,t}^{\text{min}} \, \pi\_{c,j,t} \le P\_{cj,t}' \le P\_{cj,t}^{\text{max}} \, \pi\_{c,j,t}, j = 1,2,\dots,M\_2 \tag{22}$$

$$\sum\_{j=1}^{M\_2} \pi\_{c,j,t} = 1\tag{23}$$

where *Pmax cj*,*<sup>t</sup>* and *<sup>P</sup>min cj*,*<sup>t</sup>* are the maximum and minimum of the discharging power for the *j*-th segment of the battery, respectively, and *πc*,*j*,*<sup>t</sup>* is a 0–1 state variable that characterizes the discharging power at *t*, where a value of 1 indicates that the discharging power is within the *j*-th segment.

#### 3.3.2. Storage Capacity of EES Batteries

After the time Δ*t*, the incremental capacity of the battery is as follows:

$$
\Delta E\_{c,t} = [\sum\_{m=1}^{M\_1} P\_{cm,t} \eta\_{cm}^{ch} + \frac{1}{\eta\_{cj}^{dis}} \sum\_{j=1}^{M\_2} P\_{cj,t}'] \Delta t \tag{24}
$$

$$
\Delta E\_{c,t} = E\_{c,t-1} - E\_{c,t} \tag{25}
$$

$$E\_c^{\min} \le E\_{c,t} \le E\_c^{\max} \tag{26}$$

where *ηch cj* and *<sup>η</sup>dis cj* refer to the charging and discharging efficiencies of the *m*-th segment, respectively, and *Emin <sup>c</sup>* and *Emax <sup>c</sup>* are the minimal and maximal battery capacity, respectively.

#### **4. Shared Energy Storage Operation Model**

In this section, we investigate the optimal strategy for the joint operation of RE units containing multiple wind turbines and SES, considering the dynamic degradation characteristics.

#### *4.1. Objective Function*

The objective function is to maximize profit, which comprises the revenue of the day-ahead electricity market and real-time electricity market, and the total cost of SES.

$$\max \sum\_{t \in \phi T} \left( R\_t^{DA} + R\_t^{BA} - C\_t^{sum} \right) \tag{27}$$

where *RDA <sup>t</sup>* denotes the day-ahead market revenue at time *t*, *RBA <sup>t</sup>* denotes the real-time market revenue at time *t*, and *Csum <sup>t</sup>* denotes the total cost of SES at time *t*.

The day-ahead energy market (DEM) revenue *RDA <sup>t</sup>* and real-time energy market (REM) revenue *RBA <sup>t</sup>* can be expressed as follows:

$$R\_t^{DA} = \lambda\_t^{DA} P\_t^{DA} \tag{28}$$

$$R\_t^{BA} = \lambda\_t^{down} P\_t^{down} - \lambda\_t^{up} P\_t^{up} \tag{29}$$

$$
\lambda\_t^{down} = \phi^{down} \lambda\_t^{DA}, \lambda\_t^{up} = \phi^{up} \lambda\_t^{DA} \tag{30}
$$

where *λDA <sup>t</sup>* is the DEM price at time *t*; *PDA <sup>t</sup>* is the total power in the DEM at time *t*; *Pdown t* and *Pup <sup>t</sup>* represent the positive and negative power imbalance at time *<sup>t</sup>* respectively; *<sup>λ</sup>down t* and *λup <sup>t</sup>* are the settlement prices for the positive and negative imbalances of electricity quantities in the balancing market, respectively; and *φdown* and *φup* are the penalty factors corresponding to positive and negative imbalances of electricity quantities, respectively.

The total cost of SES *Csum <sup>t</sup>* is expressed as Equation (33), and *Csum <sup>t</sup>* includes the investment cost of SES and its degradation cost, as follows:

$$C\_t^{rt} = \frac{C\_t^{inv} L\_{loss,t}}{24 \times (1 - 40\%)}\tag{31}$$

$$\mathbf{C}\_{t}^{inv} = \frac{\gamma (1+\gamma)^{y}}{(1+\gamma)^{y}-1} \times \frac{c\_{P}^{SES} P\_{\text{max}}^{SES} + c\_{E}^{SES} E\_{SES}}{T \times 365} \tag{32}$$

$$\mathbf{C}\_{t}^{sum} = \mathbf{C}\_{t}^{inv} + \mathbf{C}\_{t}^{at} \tag{33}$$

where *T* is all the dispatch cycle number of SES within one day, and *Lloss*,*<sup>t</sup>* is the lifespan degradation rate of EES batteries during period *t*. Typically, when the health status of a lithium-ion battery drops below 80%, the battery's utilization rate cannot meet the ES requirements and it should be recycled. *Cinv <sup>t</sup>* is the SES investment cost, *γ* refers to the annual percentage rate of funds, *y* is the lifespan of the SES device, *cSES <sup>P</sup>* and *<sup>c</sup>SES <sup>E</sup>* are the unit cost prices of shared energy per unit power and unit capacity, respectively, *PSES max* is the maximum power of the SES, and *ESES* is the capacity of SES.

The above utilizes the concept of unitized cost, which converts ES replacement cost into cost per unit charge–discharge capacity, in order to obtain the ES degradation cost at each moment.

### *4.2. Constraints*

In this paper, the wind turbine units and the collaborative entity of the SES are selected to participate in the day-ahead energy DEM. Therefore, the total power in the DEM is equal to the sum of the day-ahead power outputs from the wind turbines and the energy storage unit. Similarly, when they participate in the REM, the total power in the REM is equal to the sum of the real-time power outputs from the wind turbines and the energy storage unit, as follows:

$$P\_t^{DA} = P\_{wind,t}^{DA} + P\_{SES,t}^{DA} \tag{34}$$

$$P\_{\delta}^{BA} = P\_{wind,\delta}^{BA} + P\_{SES,\delta}^{BA} \tag{35}$$

where *PDA wind*,*<sup>t</sup>* is the wind power of the DEM at time *<sup>t</sup>*, *<sup>P</sup>DA SES*,*<sup>t</sup>* is the ES power of the DEM at time *t*, *PBA <sup>δ</sup>* is the total power in the REM at time *<sup>t</sup>*, *<sup>P</sup>BA wind*,*<sup>δ</sup>* is the wind power of the REM at time *δ*, and *PBA SES*,*<sup>δ</sup>* is the ES power of the REM at time *δ*. The participation of the energy storage unit in the DEM is determined by both its charging power and discharging power. It is the difference between the discharging power and the charging power. Since the energy storage unit can only be in either a charging or discharging state at a given time t, when it is in the discharging state, it generates positive revenue from participating in the DEM. On the other hand, when it is in the charging state, it incurs negative revenue from participating in the DEM. Therefore, the day-ahead power of the energy storage unit participating in the market is the difference between the discharging power and the charging power. The same principle applies to the power of the energy storage unit participating in REM.

$$P\_{SES,t}^{DA} = P\_{dis,t}^{DA} - P\_{ch,t}^{DA} \tag{36}$$

$$P\_{SES,\delta}^{BA} = P\_{dis,\delta}^{BA} - P\_{ch,\delta}^{BA} \tag{37}$$

where *PDA ch*,*<sup>t</sup>* is charging power of the DEM at time *<sup>t</sup>*, *<sup>P</sup>DA dis*,*<sup>t</sup>* is the ES discharging power of the DEM at time *t*, *PBA ch*,*<sup>t</sup>* is the ES charging power of the REM at time *<sup>t</sup>*, and *<sup>P</sup>BA dis*,*<sup>t</sup>* is the ES discharging power of the REM at time *t*. All four of these variables take non-negative values.

Constraints on the system are as follows:

(1) the constraints of wind power output are

$$0 \le P\_{wind,t}^{DA} \le P\_{sum,t}^{DA} \tag{38}$$

$$0 \le P\_{\text{wind},\delta}^{BA} \le P\_{\text{sum},t}^{BA} \tag{39}$$

where *PDA sum*,*<sup>t</sup>* represents the day-ahead forecasted total power for multiple wind turbines at time *t*, and *PBA sum*,*<sup>t</sup>* represents the real-time forecasted total power for multiple wind turbines at time *t*.

(2) Energy storage capacity and power constraints: Equation (40) represents the constraint on the ES capacity. Equation (41) represents the minimal and maximal of the charging and discharging powers. Equation (42) restricts the device from charging and discharging energy simultaneously. Equation (43) denotes the energy balance constraint of the ES; it means that the charging-and-discharging capacity during the 24 h regulation process must maintain balance with the initial energy level.

$$0 \le E\_{SES,t}^{DA} \le E\_{SES'} \, 0 \le E\_{SES,\delta}^{BA} \le E\_{SES} \tag{40}$$

$$\begin{cases} 0 \le P\_{ch,t}^{DA} \le \mu\_t^{ch} P\_{\text{max}}^{SES} \\ 0 \le P\_{dis,t}^{DA} \le \mu\_t^{dis} P\_{\text{max}}^{SES} \end{cases} \begin{cases} 0 \le P\_{ch,\delta}^{BA} \le \mu\_t^{ch} P\_{\text{max}}^{SES} \\ 0 \le P\_{dis,\delta}^{BA} \le \mu\_t^{dis} P\_{\text{max}}^{SES} \end{cases} \tag{41}$$

$$
\mu\_t^{char} + \mu\_t^{dis} \le 1 \tag{42}
$$

$$E\_{SES,0}^{DA} = E\_{SES,T'}^{DA} E\_{SES,0}^{BA} = E\_{SES,T}^{BA} \tag{43}$$

where *EDA SES*,*<sup>t</sup>* and *<sup>E</sup>BA SES*,*<sup>t</sup>* represent the day-ahead and REM storage capacities at different times, *PSES max* represents the maximum operational power of the SES, *μch <sup>t</sup>* and *μdis <sup>t</sup>* are 0–1 variables that represent the operation status of the ES at time *t*, and *EDA SES*,*<sup>T</sup>* and *<sup>E</sup>BA SES*,*T* represent the DEM and REM storage capacities at the last time *t* of the day.

Additionally, the energy iteration relationship of the ES unit in the DEM and REM is shown in Equations (44) and (45):

$$E\_{SES,t+1}^{DA} = E\_{SES,t}^{DA} + P\_{ch,t}^{DA} \cdot \eta\_t^{SES} - P\_{dis,t}^{DA} / \eta\_t^{SES}, \\ E\_{SES,0}^{DA} = 60\% \\ E\_{SES} \tag{44}$$

$$E\_{SES, \delta+1}^{BA} = E\_{SES, \delta}^{BA} + (P\_{\text{ch}, \delta}^{BA} \cdot \eta\_t^{SES} - P\_{\text{dis}, \delta}^{BA} / \eta\_t^{SES}) \Delta t \,, \delta \in [t, t+1] \,, E\_{SES, 0}^{BA} = 60\% \, E\_{SES} \tag{45}$$

where *ηSES <sup>t</sup>* represents the working efficiency of the ES at time *t*.

Taking into account the dynamic degradation characteristics of EES devices and using SoH as a medium, the changes in the performance parameters of ES are incorporated into the above constraints to reflect the influence of the degradation of ES life on the operation and benefits. The analysis in Section 3 reveals a nonlinear dependence between ES device parameters and SoH. To facilitate the optimization calculation, this nonlinear relationship is first linearized.

By using the idea of piecewise model linearization, the linear relationship between battery internal resistance *Zt* and *SoH* can be fitted as follows:

$$Z\_t = \alpha \text{SOH}\_t + \beta \tag{46}$$

Substituting Equation (46) into the expression for ES charging and discharging powers yields.

$$P\_{t, \text{max}}^{SES} = \frac{Z\_{start}}{\alpha SOH\_l + \beta} \cdot P\_{0, \text{max}}^{SES} \tag{47}$$

Similarly, the expression for different segments of ES capacity can be uniformly linearized.

$$E\_{SES,t} = aSOHt + b \tag{48}$$

We can substitute the ES parameter expressions obtained from Equations (47) and (48) into the constraints for ES power and capacity and update them on an hourly basis to account for the dynamic degradation characteristics of the ES device.

(3) Power balance constraints:

$$P\_{wind,\delta}^{BA} + g\_{SES,t} - d\_{SES,t} - P\_{wind,t}^{DA} = P\_t^{down} - P\_t^{up} \tag{49}$$

$$0 \le P\_t^{\mu p} \le M\_3 (1 - z\_t) \tag{50}$$

$$0 \le P\_t^{down} \le M\_4 z\_t \tag{51}$$

where *gSES*,*<sup>t</sup>* and *dSES*,*<sup>t</sup>* represent the charging and discharging quantities respectively, of the ES system, *zt* is a binary variable indicating the power imbalance status, and *M*<sup>3</sup> and *M*<sup>4</sup> are sufficiently large positive numbers.

Equations (27)–(51) are used to establish the coupling relationship between the DEM and REM of the alliance which is composed of REBs and SES.

#### **5. Cost Allocation Mechanism of Shared Energy Storage**

To ensure equitable distribution of investment costs for SES, this paper introduces the concept of a "revenue increase rate" as a measure to quantify the demand level of a REB for SES. This metric evaluates the number of occupied ES resources by the REB and the potential revenue that can be obtained. The analysis in this paper considers the market revenue of a REB, including electricity value and system flexibility, in both day-ahead and real-time balancing markets, and compares them with the benefits obtained when the REB participates individually in the market. Finally, the costs of the SES are allocated to each REB based on comprehensive revenue-increase-rate metrics for REB.

#### *5.1. Electricity Value in the Day-Ahead Market*

Before allocating the SES costs, it is essential to calculate the revenue obtained by each alliance member from selling electricity in the day-ahead market. The calculation method of this revenue is obtained by multiplying the declared power with the day-ahead market clearance price. To better solve the cost allocation problem, this paper uses the Vickrey–Clarke–Groves (VCG) mechanism, which is a widely used incentive-compatible mechanism for allocating social welfare [36]. In addition, this mechanism can help define the substitute value of SES for other electricity users. As multiple renewable energy base– energy storage systems jointly quoting can only obtain the alliance's overall quotation curve, this paper analyzes the demand for SES by different REBs through the substitute value method to obtain individual quotation curves for each entity. This method indirectly obtains the individual quotation curves of each entity by comparing the changes in the alliance's overall quotation curve, thereby better solving the cost allocation problem, as in Equation (52).

$$R\_{DA,i,t}^{\text{WTP}} = \sum\_{t \in \Gamma} \lambda\_t^{DA} \cdot (P\_{DA,t}^{C\*} - P\_{DA,-i,t}^{C\*})\_\prime \,\forall i, j, t \tag{52}$$

where *RWPP DA*,*i*,*<sup>t</sup>* represents the revenue obtained by a certain REB in the DEM, *<sup>P</sup>C*<sup>∗</sup> *DA*,*<sup>t</sup>* represents the optimal day-ahead declared power obtained by the optimization model, and *PC*<sup>∗</sup> *DA*,−*i*,*t* represents the optimal declared power corresponding to removing a specific REB.

#### *5.2. Flexibility Value in the Real-Time Balancing Market*

The revenue earned by the alliance members' flexibility during real-time operations is known as the flexibility value in the REM, which is obtained by multiplying the respective imbalanced electricity quantity with the corresponding settlement price. When comparing the individual deviation direction with the system's overall deviation direction, if they are opposite, this indicates that the member has alleviated the extent of system deviation, reduced the system's demand for flexibility, and increased overall revenue. Then, the member's revenue is positive. If the directions are the same, it indicates that the member has intensified the degree of system deviation, further increased the system's demand for flexibility, and decreased overall revenue, and the member's revenue is negative. Similar to measuring the energy value of each member in the DEM, we can extract the flexibility value of a member in the real-time market and represent the revenue of REB members in the real-time balancing market through the deviation that appears in the alliance as a whole, as shown in Equation (53):

$$R\_{BA,i,t}^{WPP} = \sum\_{t \in \Gamma} \sum\_{s \in \Omega} \delta\_s (\lambda\_{s,t}^+ (P\_{s,t}^{C+\*} - P\_{s,-i,t}^{C+\*}) + \lambda\_{s,t}^- (P\_{s,t}^{C-\*} - P\_{s,-i,t}^{C-\*}))\_r \forall s, i, t \tag{53}$$

where *δ<sup>s</sup>* is the possibility of the scenario, *RWPP BA*,*i*,*<sup>t</sup>* refers to the revenue obtained by the REB in the real-time balancing market, *<sup>P</sup>C*+<sup>∗</sup> *<sup>s</sup>*,*<sup>t</sup>* and *<sup>P</sup>C*−∗ *<sup>s</sup>*,*<sup>t</sup>* represent the most effective methods for making bids of positive and negative imbalance power of the alliance, respectively, obtained by solving the above optimization model, and *<sup>P</sup>C*+<sup>∗</sup> *<sup>s</sup>*,−*i*,*<sup>t</sup>* and *<sup>P</sup>C*−∗ *<sup>s</sup>*,−*i*,*<sup>t</sup>* represent the positive and negative imbalance power of the alliance, respectively, corresponding to removing a specific wind power merchant.

Similarly, by measuring the revenue obtained by a REB's individual participation in the market from both the day-ahead and real-time dimensions and comparing them with the revenue obtained after forming the alliance, the revenue increment of each REB in the alliance can be obtained, as shown in Equation (54).

$$
\Delta R\_{i,t}^{WPP} = R\_{DA,i,t}^{WPP} + R\_{BA,i,t}^{WPP} - R\_{i,t,D}^{WPP} \,\forall i, t \tag{54}
$$

where Δ*RWPP <sup>i</sup>*,*<sup>t</sup>* represents the revenue increase in a certain REB in the alliance, and *<sup>R</sup>WPP i*,*t*,*D* represents the revenue obtained by this REB's individual participation in the market.

Therefore, the revenue increase rate of each REB in the alliance's joint bidding is the ratio of the total revenue increase in this member in the DEM and REM and the total revenue increase in all members in the alliance, as shown in Equation (55).

$$\tau\_i^{\text{WPP}} = \frac{\sum\_{t \in \Gamma} T\_{i,t}^{\text{WPP}}}{\sum\_{i \in \mathcal{M}} \sum\_{t \in \Gamma} T\_{i,t}^{\text{WPP}} \prime \,\forall i \,\, t} \tag{55}$$

The main revenue improvement rate characterizes the proportion of the revenue that alliance members can obtain in the DEM and REM from two dimensions: the value of electricity energy and the value of flexibility. The coupling connection between the DEM and REM is established by the concept of imbalance power. Through the determination of penalty prices, a REB can be guided to overproduce or underproduce a certain amount of power in the DEM. SES can exert a controlling function over smoothing the power imbalance that arises as a result, thus achieving the goal of maximizing overall revenue. On this basis, the investment and depreciation costs of SES can be allocated according to the aforementioned revenue improvement rate, as shown in Equation (56).

$$\mathbf{C}\_{\mathbf{i}}^{\rm NPP} = \mathbf{C}\_{\rm SES} \cdot \mathbf{r}\_{\mathbf{i}}^{\rm NPP}, \mathbf{C}\_{\rm SES} = \mathbf{C}^{inv} + \mathbf{C}^{at} \tag{56}$$

where *CWPP <sup>i</sup>* represents the SES cost that must be allocated to a certain REB, and *CSES* represents the overall cost of SES.
