# Reallocating Charging Loads of Electric Vehicles in Distribution Networks
## 2 The Control Algorithm  
### Objective Function  
One contribution of this work is related to the reallocation of EV charging time periods to avoid violating network limits using non-linear programming algorithms. The aggregated EV charging power was maximized across the three phases using Equation (1), considering the dynamic model of aggregated residential loads in every minute.  
\[Maximize\,F=\sum_{l=0}^{1440}\left(\sum\left[F\left(t\right)_{\text{a,b,c}} \right]_{3\times 1}\ +\sum_{l=1}^{N}p\left(t\right)_{\text{a,b,cCust.n}_{l}}\right)\ \forall\ N\in\mathbb{Z}^{+} \tag{1}\]  
here  
\[\sum\left[F\left(t\right)_{\text{a,b,c}}\right]_{3\times 1}=\left(\sum_{k=1}^{M}P \left(t\right)_{\text{aEV}_{k}}+\sum_{k=1}^{M}P\left(t\right)_{\text{bEV}_{k}} +\sum_{k=1}^{M}P\left(t\right)_{\text{cEV}_{k}}\right)\ \forall\ M\in\mathbb{Z}^{+} \tag{2}\]  
where \(F\) is the objective function representing the aggregated charging power of EV loads in kW during a day (_i.e._, 1440 min), \(t\) is the current time step, and \(\text{a,b,c}\) are the three phases of the considered system. \(\left[F\left(t\right)_{\text{a,b,c}}\right]_{3\times 1}\) represents the requested EV charging loads across the three phases (_i.e._, decision variables). \(P\left(t\right)_{\text{aEV}}\), \(P\left(t\right)_{\text{bEV}}\) and \(P\left(t\right)_{\text{cEV}}\) represent the charging power of each EV per minute per phase in kW. \(p\left(t\right)_{\text{a,b,cCust.n}}\) is the dynamic residential load for each customer per minute across the three phases in kW. \(M\) and \(N\) are the total number of EVs and customers, respectively. \(\mathbb{Z}^{+}\) is the real integer positive number.  
The hosting capacity of the network components is calculated with \(F\) in every minute across the three phases. Further, this high time resolution means fast-queuing time process in reallocating EV charging loads. Therefore, the inconveniences of deferred EV users are reduced with this one-minute time resolution.  
The main advantage of the proposed centralized control algorithm is that EV charging loads are regularly shifted toward new charging time periods. If EV charging loads violate the network constraints, the centralized control algorithm will evaluate the number of EVs that should be deferred.  
The total loading power was determined using Equation (3) for each low voltage (LV) distribution transformer.  
\[S\left(t\right)_{\text{Tr.loading}}=\sum_{j=1}^{N_{l}}S\left(t\right)_{\text {L}}\forall N_{l}\in\mathbb{Z}^{+} \tag{3}\]  
where \(S\left(t\right)_{\text{Tr.loading}}\) is the apparent power of the distribution transformer in kVA at the time step \(t\), \(N_{l}\) is the total number of radial feeders that are served by the distribution transformer, and \(S\left(t\right)_{\text{L}}\) is the aggregated apparent power per LV feeder in kVA at the time step \(t\). The predefined constraints are assigned as follows:  
\[V_{\text{min}}\leq V\left(t\right)_{\text{a,b,cn}}\leq V_{\text{max}} \tag{4}\]  
\[VUF\left(t\right)_{\text{n}}\leq VUF\%_{\text{max}} \tag{5}\]  
\[I\left(t\right)_{\text{a,b,c,L}}\leq I_{\text{a,b,c,L}_{\text{rating}}} \tag{6}\]  
\[S\left(t\right)_{\text{Tr.loading}}\leq S_{\text{Tr.rating}} \tag{7}\]  
where \(V_{\text{min}}\), \(V_{\text{max}}\) are the lower and the upper limits of steady-state voltages (\(V\left(t\right)_{\text{a,b,cn}}\)) per phase in \(VUF\%_{\text{max}}\) is the maximum percentage of the voltage unbalance factor (\(VUF\left(t\right)_{\text{n}}\)) that can be allowed, \(I_{\text{a,b,c,L}_{\text{rating}}}\) is the rated current of steady-state currents (\(I\left(t\right)_{\text{a,b,c,L}}\)) per phase at the main distribution lines in Amps, and \(S_{\text{Tr.rating}}\) is the rated power of the distribution transformer in kVA.