# Sustainable Operation of Active Distribution Networks
## 3 Agents' Modeling
### Active Distribution Network Management Agent (ADNM/A)  
ADNM/A gathers the aggregated responses from the cluster agents as well as the information for the forecasted price of electricity, the node loads of the network, and the power produced by RESs. Equations (20)-(27) can be used to estimate the time-varying maximum and minimum bounds of the buildings' electric power consumption. \[P_{\_}{HVAC,total,max}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,max}(t) \tag{20}\]  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]  
\[P_{\_}{EL,total,max}(t)=\sum_{\_}{CB}P_{\_}{EL,CB,max}(t) \tag{22}\]  
\[P_{\_}{EL,total,min}(t)=\sum_{\_}{CB}P_{\_}{EL,CB,min}(t) \tag{23}\]  
with  
\[P_{\_}{HVAC,CB,max}(t)=\sum_{\_}{b}P_{\_}{HVAC,b,max}(t) \tag{24}\]  
\[P_{\_}{HVAC,CB,min}(t)=\sum_{\_}{b}P_{\_}{HVAC,b,min}(t) \tag{25}\]  
\[P_{\_}{EL,CB,max}(t)=\sum_{\_}{b}P_{\_}{EL,b,max}(t) \tag{26}\]  
Figure 4: Flexibility of a CPEV/A to adjust its active power. \[P_{EL,CB,min}(t)=\sum_{b}P_{EL,b,min}(t) \tag{27}\]  
where \(P_{HVAC,b,max}\),\(P_{HVAC,b,min}\) are the \(b\)th building's HVAC system power consumption boundaries; \(P_{HVAC,CB,max}\),\(P_{HVAC,CB,min}\) are the respective boundaries of CBTL/A; \(P_{HVAC,total,max}\),\(P_{HVAC,total,min}\) are buildings' total HVAC power consumption boundaries; \(P_{EL,b,max}\),\(P_{EL,b,min}\) are the \(b\)th building's electrical load consumption boundaries; \(P_{EL,CB,max}\),\(P_{EL,CB,min}\) are the respective boundaries of CBEL/A; and \(P_{EL,total,max}\),\(P_{EL,total,min}\) are the total electrical loads' power consumption boundaries. Equations (28)-(35) can be used to estimate the time-varying maximum and minimum bounds of the power and stored energy of the aggregate battery. \[P_{PB,max}(t)=\sum_{CEV}P_{CEV,max}(t) \tag{28}\]  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]0  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]1  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]2  
with  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]3  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]4  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]5  
\[P_{\_}{HVAC,total,min}(t)=\sum_{\_}{CB}P_{\_}{HVAC,CB,min}(t) \tag{21}\]6  
The PEVs' plugging and unplugging over time affects the total stored energy of the dynamic equivalent aggregate battery. The resulting change of the aggregate SoC is indicated by \(SoC_{PB,diff}\) and estimated in Equations (36)-(38). \[SoC_{CEV,diff}(t)=\sum_{ \begin{subarray}{c}T_{0}:\Delta t:t\\ \end{subarray} }(SoC_{0,CEV}(t)-SoC_{T,CEV}(t)) \tag{36}\]  
\[SoC_{0,CEV}(t)=\sum_{ \begin{subarray}{c}\forall th\ EV\ plugged\ at\ t,\\ \in CEV\end{subarray} }SoC_{0}(i) \tag{37}\]  
\[SoC_{T,CEV}(t)=\sum_{ \begin{subarray}{c}\forall th\ EV\ unplugged\ at\ t,\\ \in CEV\end{subarray} }SoC_{target}(i) \tag{38}\]  
Equation (39) indicates the total stored energy of the equivalent PEVs' battery at the next time interval, assuming that \(P_{PB,total}(t)\) is the optimal total active power of the aggregate battery and by adopting a generator convention. \[SoC_{PB}(t+\Delta t)= \begin{cases}SoC_{PB}(t)-P_{PB,total}(t)\cdot n_{ch}\cdot \Delta t,&P_{PB,total}(t)<0\\ SoC_{PB}(t)-\frac{P_{PB,total}(t)}{n_{dis}}\cdot\Delta t,&P_{PB,total}(t)\geq 0\end{cases}