## 3 ATC-Based Distributed Modeling for Multi-RMGs Integrated in ADN
### Optimization Model for ADN  
The general optimization problem of a DN within the ATC framework can be formulated as follows:  
\[\min:F_{ADN}+\sum_{t=1}^{T}\sum_{m=1}^{N_{\text{RMG}}}\pi(p_{m,t}^{\text{DN}}- \rho_{m,t}^{\text{GD}}) \tag{17}\]  
\[F_{ADN}=\sum_{t=1}^{T}\left[C^{\text{G}}P_{t}^{\text{G}}+\sum_{l=1}^{N_{\text {bias}}-1}C^{\text{G}}P_{l,t}^{\text{loss}}+\sum_{g=1}^{N_{\text{DG}}}C^{ \text{DG}}p_{g,t}^{\text{DG}}\right] \tag{18}\]  
In the above formulation, the objective function (17) consists of local optimization objective (18) of the ADN as well as its penalty functions. In the local optimization objective (18), the first item represents the cost of buying electricity from the upstream grid in tth hour, where \(C^{\text{G}}\) represents the price for purchasing electricity from the upstream grid ($\$/kW), \(P_{t}^{\text{G}}\) represents the power transferred from the upstream grid to the ADN (kW). The second item represents the power loss cost of ADN, where \(P_{l,t}^{\text{loss}}\) represents the power loss of lth branch of the ADN in tth hour. The third item is the generation costs of all controllable DGs in the ADN, where \(C^{\text{DG}}\) represents generation cost of controllable DG, \(p_{g,t}^{\text{DG}}\) represents the power output of the gth DG at the hour t.  
The above optimization problem is subject to the following constraints:  
Thus, the optimization problem of ADN can be reformulated as:  
\[\begin{array}{l}\min:\sum\limits_{t=1}^{T}\left[C^{\mathrm{G}}P_{t}^{\mathrm{G}}+ \sum\limits_{i=1}^{N_{\mathrm{bins}}}\sum\limits_{i\in\Psi(j)}C^{\mathrm{G}}r_{ ij}\widetilde{l}_{ij,t}+\sum\limits_{g=1}^{N_{\mathrm{DG}}}C^{\mathrm{DG}}p_{g,t}^{ \mathrm{DG}}\right]+\sum\limits_{t=1}^{T}\sum\limits_{m=1}^{N_{\mathrm{BAG}}} \pi(p_{m,t}^{\mathrm{DN}}-\hat{p}_{m,t}^{\mathrm{GD}})\\ \mathrm{s.t.}\ (\ref{eqn:p_m_m_m_m_m_m_m_m_m_m_  
Step 1. Initialize the input data. Set the initial values of the coupling variables (\(p_{m}^{\text{DN}}\), \(p_{m}^{\text{GD}}\)) and the Augmented Lagrangian penalty multipliers \(\alpha_{m}\), \(\beta_{m}\) and \(\gamma\), set the ATC convergence tolerances, set iteration index to n = 1.  
Step 2. Each RMG solves its own optimization problem independently and transfers its optimal virtual generation \(\tilde{p}_{m}^{\text{GD}}\) to the ADN level. In this step, the optimization problems in RMG level are optimized in parallel.  
Step 3. After receiving \(\tilde{p}_{m}^{\text{GD}}\) from the RMGs, the ADN solves its optimization problem of (29). Then its optimal virtual load \(\tilde{p}_{m}^{\text{DN}}\) is obtained and transmitted to the connected RMGs.  
Step 4. Check the following termination criteria (32) and (33).  
\[G_{ap}=\left\|p_{m,t}^{\text{GD},n}-p_{m,t}^{\text{DN},n}\right\|_{\infty} \leq\delta_{1} \tag{32}\]  
\[R_{el}=\left|\frac{(F_{ADN}^{n}-F_{ADN}^{n-1})+\frac{1}{\sum\limits_{m=1}^{N_{ \text{EMG}}}\left(F_{RMGm}^{n}-F_{RMGm}^{n-1}\right)}}{F_{ADN}^{n}+\sum\limits _{m=1}^{N_{\text{EMG}}}F_{RMGm}^{n}}\right|\leq\delta_{2} \tag{33}\]  
In the above formulation, the subscript \(n\) or (\(n\)-1) represents the \(n\)th or (\(n\)-1)th iteration. \(G_{ap}\) denotes the mismatch between the virtual generation and virtual load, which reflects the maximum gap in consistency constraints. \(R_{el}\) denotes the relative difference in objective function between two consecutive loop iterations. \(\delta_{1}\) and \(\delta_{2}\) represent pre-determined convergence tolerances. If the inequalities (32) and (33) both are satisfied, the iterative process stops, and the converged optimal result is obtained, otherwise, go to Step 5.  
Step 5. Set n=n+1 and update the Augmented Lagrangian penalty multipliers according to (34), and then return to Step 2.  
\[\begin{array}{l}\alpha_{m,t}^{n}=\alpha_{m,t}^{n-1}+2(\beta_{m,t}^{n-1})^{2 }(p_{m,t}^{\text{GD},n-1}-p_{m,t}^{\text{DN},n-1})\alpha,\beta\in(0,2)\\ \beta_{m,t}^{n}=\gamma p_{m,t}^{n-1}1\leq\gamma\leq 3\end{array} \tag{34}\]