2.2.1. Initialization Setups

As the ICD of each microgrid is completed before QLCDA by each MGO, the scheduling plans are assumed to be fixed during one time slot, therefore the initial bidding quantity of QLCDA are set as the results of ICD. For seller microgrid *i*, the initial bidding price in time slot *T* is calculated as follows:

$$p\_i^{initial} = p\_{grid,bus}^t + \left(p\_-hl^t - p\_-ll^t\right) \cdot rand\_l. \tag{1}$$

Similar to the seller, buyer microgrid *j* submits the bidding price as follows:

$$p\_{j}^{initial} = p\_{grid, sell}^{t} - \left(p\_{-}hl^{t} - p\_{-}ll^{t}\right) \cdot rand\_{j},\tag{2}$$

where *<sup>p</sup>tgrid*,*buy* and *<sup>p</sup>tgrid*,*sell* represent energy purchase and sell price of the grid in time slot *t* respectively. *<sup>p</sup>*\_*hl<sup>t</sup>* and *<sup>p</sup>*\_*ll<sup>t</sup>* are the highest/lowest bidding price limitation of this market in time slot *t*. *randi* and *randj* are random real numbers generated from the range of [0.95,1] to obtain higher/lower initial bidding price for sellers/buyers.

As each microgrid is equipped with BESS already, it is essential to consider the application of BESS in QLCDA and make full use of its charging and discharging capacity to improve real-time SDR inside the distribution network. The charging ability of microgrid *i*'s BESS is given by:

$$P\_{bess,i}^{t,charge} = \frac{\mathbb{C}\_i \cdot \min\left(SOC\_i^{\Delta, charge}, \left(1 - SOC\_i^t\right)\right)}{\Delta t \cdot \eta\_i^{\prime charge}}.\tag{3}$$

Similarly, the discharging ability of microgrid *i*'s BESS is calculated as follows:

$$P\_{\text{bess},i}^{t,\text{discharge}} = \frac{\text{C}\_{i} \cdot \min\left(\text{SOC}\_{i}^{\Delta,\text{discharge}}, \text{SOC}\_{i}^{t}\right) \cdot \eta\_{i}^{\text{discharge}}}{\Delta t},\tag{4}$$

where *Ci* is the capacity of microgrid *i*'s BESS, *SOCti* is the initial SOC of BESS in time slot *t*. Due to the limitation of material technology, charging and discharging behaviors of BESS are constrained, *SOC*Δ,*charge i* and *SOC*Δ,*discharge i* represent the ramp constraints on charging and discharging of microgrid *i*'s BESS, respectively. Practical operations of BESS will cause energy loss, therefore we set *ηcharge i* and *ηdischarge i* as the charging and discharging efficiency of BESS, respectively. During the QLCDA process, updated bidding quantity can't exceed the restrictions on these two parameters. Δ*t* is the bidding cycle in this energy trading market.
