2.2.4 Power balance constraint in the microgrid

With the existence of EVs and the MG, the power balance constraint in the microgrid has more terms than that in the DSWM problem, as follows:

$$\sum\_{i=1}^{n} P\_{i,G}(t) + \sum\_{l=1}^{q} P\_{l,R}(t) + P\_{\mathcal{g}}(t) = \sum\_{j=1}^{m} P\_{j,D}(t) + \sum\_{h=1}^{p} P\_{h,EV}(t) \tag{22}$$

## 2.2.5 PSwEV optimization problem

The PSwEV problem is to maximize the total revenue of DGs, EVs, load demands, and the microgrid operator, as follows:

$$\max\_{\mathbf{P}} \sum\_{t=1}^{N} \mathbf{g}(P(t)) \tag{23}$$

s.t. (22), (9), (10), (13)–(19), and (21) where

$$P(t) \triangleq \left[P\_{1,G}(t), \dots, P\_{n,G}(t), P\_{1,EV}(t), \dots, P\_{v,EV}(t), P\_{\mathcal{g}}(t)\right]^T; \mathbf{P} \triangleq \left[P(1)^T, \dots, P(N)^T\right]^T$$

$$\begin{split} \mathbf{g}(P(t)) & \triangleq \sum\_{i=1}^n \mathbf{W}\_{i,G}(P\_{i,G}(t), p(t)) - \sum\_{j=1}^m \mathbf{W}\_{j,D}(p(t)) + \sum\_{h=1}^v \mathbf{W}\_{h,EV}(P\_{h,EV}(t), p(t)) \\ & + \mathbf{W}\_{\eta\eta}(P\_{\mathcal{g}}(t), p(t)) \end{split}$$

Substituting (11), (12) and (18)–(20) into (23), the PSwEV maximization programming in (23) can be rewritten as a minimization problem below:

$$\min\_{\mathbf{P}} \sum\_{t=1}^{N} \left( \sum\_{i=1}^{n} \mathbf{C}\_{i} (P\_{i,G}(t)) - \sum\_{h=1}^{v} L\_{h} (P\_{h,EV}(t)) + q(t) P\_{\mathcal{g}}(t) \right) \tag{24}$$

s.t. (22), (9), (10), (13)–(19), and (21)
