## 3 ATC-Based Distributed Modeling for Multi-RMGs Integrated in ADN
### Optimization Model for RMG  
The RMG considered in this work corresponds to a cluster of household prosumers, therefore the main purpose of this paper is to promote the local consumption of energy generated by the DERs rather than exporting the surplus power to the distribution system. It is assumed that every household contains PV generator, EV, flexible loads (i.e., shiftable load and adjustable load), and inflexible loads. The optimization objective aims to minimize the total energy consumption cost within \(m\)th RMG during the dispatching time period (e.g., 24 h) by taking into account the demand response of EVs and shiftable loads. The optimization model of the \(m\)th RMG within the ATC framework can be formulated as follows  
\[\min:F_{RMGm}+\sum_{t=1}^{T}\pi(p_{m,t}^{\text{GD}}-\hat{p}_{m,t}^{DN}) \tag{4}\]  
\[F_{RMGm}=\sum_{t=1}^{T}\sum_{h=1}^{H}\lambda_{t}(P_{h,t}^{\text{infnfl}}+\tau_ {h,t}^{\text{ch}}p_{h,t}^{\text{EV\_ch}}-\tau_{h,t}^{\text{dis}}p_{h,t}^{ \text{EV\_dis}}+\sum_{k=1}^{N_{fl}}\mu_{h,k,t}P_{h,k,t}^{\text{fl}}-P_{h,t}^{ \text{PV}}) \tag{5}\]  
In the above formulation, the objective function (4) consists of local optimization objective (5) of the \(m\)th RMG as well as its penalty function \(\pi(\cdot)\). In function (5), \(P_{h,t}^{\text{infnfl}}\) represents the power demand for inflexible load within \(h\)th household at hour \(t\). \(P_{h,k,t}^{\text{fl}}\) represents the power demand of flexible load \(k\) within \(h\)th household at hour \(t\). \(P_{h,t}^{\text{EV\_ch}}\) and \(P_{h,t}^{\text{EV\_dis}}\) respectively represent the charging and discharging power of the EV within \(h\)th household at hour \(t\). \(P_{h,t}^{\text{PV}}\) represents the power output of the PV generator within \(h\)th household at hour \(t\). \(\lambda_{t}\) represents the electricity price at hour \(t\). \(\mu_{h,k,t}\) represents the demand response coefficient of flexible load \(k\) within \(h\)th household, \(\mu_{h,k,t}\) is a binary variable, where 1 denotes flexible load \(k\) put into operation at hour \(t\). \(\tau_{h,t}^{\text{ch}}\) is binary variable, where 1 indicates charging state of the EV within \(h\)th household at hour \(t\). \(\tau_{h,t}^{\text{dis}}\) is binary variable, where 1 denotes discharging state of the EV within \(h\)th household at hour \(t\). The above optimization problem is subject to the following constraints. 1. EV load constraints \[\tau_{h,t}^{\text{ch}}+\tau_{h,t}^{\text{dis}}\leq 1\] (6) \[\tau_{h,t}^{\text{ch}}P_{h,t}^{\text{min\_ch}}\leq P_{h,t}^{\text{EV\_ch}} \leq\tau_{h,t}^{\text{ch}}P_{h,t}^{\text{max\_ch}}\] (7) \[\tau_{h,t}^{\text{dis}}P_{h,t}^{\text{min\_dis}}\leq P_{h,t}^{\text{EV\_dis}} \leq\tau_{h,t}^{\text{dis\_dis}}P_{h,t}^{\text{max\_dis}}\] (8) \[E_{h}^{\text{EV\_min}}\leq E_{h,t}^{\text{EV}}\leq E_{h}^{\text{EV\_ max}}\] (9) \[E_{h,t}^{\text{EV}}=E_{h,t-1}^{\text{EV\_Dri}}+\eta_{h}^{\text{ch}}P_{h,t}^{ \text{EV\_ch}}-\frac{1}{\eta_{h}^{\text{dis}}}P_{h,t}^{\text{EV\_dis}}\] (10) Constraint (6) describes that a single EV cannot be in charging and discharging state simultaneously. Constraints (7) and (8) denote the minimum and maximum charging/discharging power limits. Constraint (9) limits the minimum and maximum allowable state-of-energy values of the EV. Constraint (10) shows energy stored in the EV in the current time period, which is associated with the energy remaining in the EV in the previous time period. The energy consumed during outdoor driving or the change in the amount of power generated through charging and discharging in the current time period. 2. Shiftable load constraints \[0\leq\sum_{k=1}^{N_{H}}P_{h,k,t}^{\text{fl}}\mu_{h,k,t}\leq P_{h}^{\text{DR}\_{ max}}\] (11) \[\sum_{t=1}^{T-t_{op,k}+1}\mu_{k,t}=1\] (12) \[\sum_{\ell=1}^{t_{op,k}}\left(1-\mu_{k,t-\ell+1}\right)=0\] (13) Constraint (11) denotes the shiftable load power limit. Constraint (12) guarantees that each shiftable load, i.e., shiftable household appliance can be scheduled just once over a 24-h time span.