*2.4. Constraints*

For the optimal operating strategy in MGs, different equality and inequality constraints have to be maintained as presented in Equations (25)–(31). Equations (25) and (26) represent the active and reactive power balance constraints mentioned as P<sup>s</sup> and Q<sup>s</sup> that are the supplied active and reactive power by the main feeder and the active and reactive power losses denoted by *PTloss* and *QTloss* in the MG, respectively [57,58]. Equations (27)–(29) present the allowable limits of the output powers of different RERs. Equation (30) represents the output power for BG; PV and WT units must follow their operating limits. The power factor (PF) limits for each BG are maintained as in [59]. The bus voltage (*V*) limits should be in the range of [0.95–1.05] for each bus *j* [59], as presented in Equation (31). Equation (32) preserves the thermal capacity of the branches below their maximum thermal capacity for each branch [60,61]. Equation (33) gives the penetration bounds of the total renewable sources capacity in the system (KP) as [62,63]:

$$\left(P\_s + \sum\_{n=1}^{N\_{BG}} P\_{BG,n} + \sum\_{n=1}^{N\_W} P\_{w,n} + \sum\_{n=1}^{N\_{pv}} P\_{pv,n}\right)\_t = (P\_{Tloss} + P\_{load})\_t \qquad t = 1,2,...,24 \quad \text{(25)}$$

$$\left(Q\_S + \sum\_{n=1}^{N\_{BG}} Q\_{BG, \mathcal{U}} + \sum\_{n=1}^{N\_{\mathcal{U}}} Q\_{w, \mathcal{U}}\right)\_t = \left(Q\_{T \text{loss}} + Q\_{load}\right)\_t \qquad t = 1, 2, \dots, 24 \tag{26}$$

$$0 \le P\_{\text{BG},i,t} \le P\_{\text{BG},\max} \qquad i = 1,2,\ldots,\ldots\\N\_{\text{BG},\prime} \text{ } t = 1,2,\ldots,24 \tag{27}$$

$$0 \le P\_{pv, i, t} \le P\_{pv, max} \qquad i = 1, 2, \dots, \dots \\ N\_{pv}, t = 1, 2, \dots, \dots \\ 24 \tag{28}$$

$$0 \le P\_{w,i,t} \le P\_{w,\max} \qquad i = 1,2,\dots,N\_{\varpi}, \ t = 1,2,\dots,24 \tag{29}$$

$$\text{PF}\_{\text{BG},\text{min}} \le \text{PF}\_{\text{BG},i}, t \le \text{PF}\_{\text{BG},\text{max}} \qquad i = 1, 2, \dots, \dots \\ \text{N}\_{\text{BG}}, t = 1, 2, \dots, \dots \\ \text{24} \tag{30}$$

$$V\_{\text{j.min}} \le V\_{\text{j.t}} \le V\_{\text{j.max}} \qquad \text{j} = 1, 2, \dots, n \\ \text{bus. t} = 1, 2, \dots, 24 \tag{31}$$

$$I\_{br,t} \le I\_{br,\max} \qquad br = 1,2,...,n\_{br}, \ t = 1,2,...,24 \tag{32}$$

$$\left\{\sum\_{i=1}^{N\_{BG}} P\_{BG,i} + \sum\_{i=1}^{N\_w} P\_{w,i} + \sum\_{i=1}^{N\_{pv}} P\_{pv,i} \right\}\_t \le KP \left\{\sum\_{n=1}^{n\_{bus}} P\_{load,n} \right\}\_t, t = 1, 2, \dots, 24 \tag{33}$$
