## 4 Formulation of the Proposed Modeling Framework with MESSs
### Operation Constraints of Distribution Systems and Network Topology  
In this research, the power flow analysis of DS was performed using a linearized power flow model [31] as described by the following constraints.  
\[\sum\limits_{(i,j)\in I}P_{ij,s}-\sum\limits_{(k,j)\in I}P_{ik,t,s}=P_{i,t,s}^ {MG-MESS}+P_{i,t,s}^{MG-PL}-P_{i,t,s}^{D-restored}\,\qquad\forall i\in\Phi,t\in T,s\in\omega \tag{13}\]  
\[\sum\limits_{(i,j)\in I}Q_{ij,t,s}-\sum\limits_{(k,j)\in I}Q_{ik,t,s}=Q_{i,t,s }^{MG-MESS}+Q_{i,t,s}^{MG-PL}-Q_{i,t,s}^{D-restored}\,\qquad\forall i\in\Phi,t\in T,s\in\omega \tag{14}\]  
\[V_{i,t,s}-V_{j,t,s}\leq MF(1-\theta_{ij,t,s})+\frac{R_{ij}P_{ij,t,s}+X_{ij}Q_{ ij,t,s}}{V_{0}},\qquad\forall(i,j)\in I,t\in T,s\in\omega \tag{15}\]  
\[V_{i,t,s}-V_{j,t,s}\geq MF(1-\theta_{ij,t,s})+\frac{R_{ij}P_{ij,t,s}+X_{ij}Q_{ ij,t,s}}{V_{0}},\qquad\forall(i,j)\in I,t\in T,s\in\omega \tag{16}\]  
\[-\theta_{ij,t,s}\times P_{ij}^{Max}\leq P_{ij,t,s}\leq P_{ij}^{Max}\times \theta_{ij,t,s}\qquad\forall(i,j)\in I,t\in T,s\in\omega \tag{17}\]  
\[-\theta_{ij,t,s}\times Q_{ij}^{Max}\leq Q_{ij,t,s}\leq Q_{ij}^{Max}\times \theta_{ij,t,s}\qquad\forall(i,j)\in I,t\in T,s\in\omega \tag{18}\]  
\[V_{i}^{Min}\leq V_{i,t,s}\leq V_{i}^{Max}\qquad\forall i\in\Phi,t\in T,s\in\omega \tag{19}\]  
\[V_{i,t,s}=V_{0}\qquad\forall i\in\Phi\,t\in T,s\in\omega \tag{20}\]  
\[0\leq P_{i,t,s}^{C\&IN-restored}\leq PD_{i,t,s}\qquad\forall i\in\Phi_{C\&IN},t \in T,s\in\omega \tag{21}\]  
\[0\leq Q_{i,t,s}^{P-restored}\leq PD_{i,t,s}\qquad\forall i\in\Phi_{R},t\in T,s\in\omega \tag{22}\]  
\[0\leq Q_{i,t,s}^{C\&IN-RES}\leq QD_{i,t,s}\qquad\forall i\in\Phi_{C\&IN},t\in T,s\in\omega \tag{23}\]  
\[0\leq Q_{i,t,s}^{R-RES}\leq QD_{i,t,s}\qquad\forall i\in\Phi_{R},t\in T,s\in\omega \tag{24}\]  
Constraints (13) and (14) define the AC linearized active and reactive power flow, which must be evaluated at each bus (\(i\)), time interval (\(t\)), and scenario (\(S\)). Equation (15) use the big-M method to impose constraints on line voltage drop [31]. As in Equations (17) and (18), the active and reactive line capacity constraints should be limited to allowable levels. The lower and upper bounds on voltage magnitude are enforced by (19). The initial voltage of MG buses is set to V\({}_{0}\) by (20). The active and reactive restored load restriction for critical (commercial and industrial) and non-critical (residential) loads is represented by Constraints (21)-(24), respectively.  
\[\left\{\begin{array}{l}\theta_{ij,t,s}=(1-ST_{ij,t})\text{ if }\theta_{ij,t,s}\in\Phi,t\in T,s\in\omega\\ \theta_{ij,t,s}=\{0,1\},\qquad\text{ if }\theta_{ij,t,s}\in\Phi_{ Flex},t\in T,s\in\omega\\ \theta_{ij,t,s}=\theta_{ji,t,s}\qquad\forall(i,j)\in\Phi_{ Fixed},t\in T,s\in\omega\\ \sum_{(i,j)\in t}\theta_{ij,t,s}=|\Phi|-|\aleph|\qquad\forall t\in T,s\in\omega \end{array}\right. \tag{25}\]  
\[\theta_{ij,t,s}=\theta_{ji,t,s}\qquad\forall(i,j)\in\Phi_{ Fixed},t\in T,s\in\omega \tag{26}\] \[\sum_{(i,j)\in t}\theta_{ij,t,s}=|\Phi|-|\aleph|\qquad\forall t\in T,s\in\omega \tag{27}\]  
The constraints on the network topology can be separated into two categories: the integer Constraint (25) for the binary variables of the connection matrix (ST), and the radiality Constraints (26) and (27) to ensure the radial operation of the DS. As a result of the flexibility of the operation and protection coordination, radial architecture was employed with various MGs throughout the distribution network. As a result, the radial DS configuration was employed in this study and should be kept during the reconfiguration procedure. Then, the cardinality of the set in the radial DS arrangement was indicated, as seen in (27), which is a condition for radial DS configuration.