## 2 Proposed Multi-Stage Control Scheme and OPF Formulation
### OPF Problem Formulation  
The OPF-based problem consists of one objective in each stage. During high integration of PVs, there are significant changes in nodal voltages. The first stage's objective function (Equation (1)) represents the minimization of voltage deviation using a transformer tap. Figure 1: Multi-stage control scheme. The reference voltage value \(V^{\text{ref}}\) in this paper is set to 1.00 p.u., while \(V_{i,t}\) represents the node voltage value in time \(t\). \[OF_{1}=\sum_{i=1}^{N}\sum_{t=1}^{t}(V_{i,t}-V^{\text{ref}})^{2} \tag{1}\]  
The second stage's objective function (Equation (2)) refers to loss minimization with PV reactive power as the decision variable. \[OF_{2}=\sum_{t=1}^{t}\sqrt{P_{t}\text{loss}2+Q_{t}^{\text{loss}2}} \tag{2}\]  
where:  
\(P_{t}^{\text{loss}}\)--active power losses in time \(t\);  
\(Q_{t}^{\text{loss}}\)--reactive power losses in time \(t\). Network operational constraints are given below. Active and reactive power flow (balance equations) are expressed in Equations (3) and (4):  
\[P_{i,t}=\sum_{k=i}^{N}|V_{i,t}||V_{k,t}||Y_{ik}|\cos(\delta_{i,t}-\delta_{k,t}- \theta_{ik}) \tag{3}\]  
\[Q_{i,t}=\sum_{k=i}^{N}|V_{i,t}||V_{k,t}||Y_{ik}|\sin(\delta_{i,t}-\delta_{k,t}- \theta_{ik}) \tag{4}\]  
where:  
\(P_{i,t}\)--active power at bus \(i\) in time \(t\);  
\(Q_{i,t}\)--reactive power at bus \(i\) in time \(t\);  
\(V_{i,t}\)--voltage magnitude at bus \(i\) in time \(t\);  
\(V_{i,t}\)--voltage magnitude at bus \(k\) in time \(t\);  
\(Y_{ik}\)--\(i\),\(k\)th element of bus admittance matrix \(\mathbf{Y}_{bus}\);  
\(\delta_{i,t}\)--voltage phase angle at \(i\)th bus in time \(t\);  
\(\delta_{k,t}\)--voltage phase angle at \(k\)th bus in time \(t\);  
\(\theta_{ik}\)--phase angle of \(i\),\(k\)th element of bus admittance matrix \(\mathbf{Y}_{bus}\). Voltage constraints are defined between upper \(V_{i}^{\text{max}}\) and lower limits \(V_{i}^{\text{min}}\) (generally defined as \(\pm 10\%\) U\({}_{n}\) according to [31]) Equation (5):  
\[V^{\text{min}}\leq V_{i,t}\leq V^{\text{max}},\ \forall i\in N,\ \forall t\in T \tag{5}\]  
The PV inverter power capability curve is defined in Equation (6):  
\[S_{pv,t}\leq\sqrt{P_{pv,t}^{2}+Q_{pv,t}^{2}},\ \forall pv\in PV,\ \forall t\in T \tag{6}\]  
where:  
\(S_{pv,t}\)--apparent power of PV in time \(t\);  
\(P_{pv,t}\)--active power of PV in time \(t\);  
\(Q_{pv,t}\)--reactive power of PV in time \(t\). The decision variable's bounds are presented below. The decision variable in the first stage is the transformer tap setting (Equation (7)). A tap changer mechanism is set in the high-voltage winding side. Distribution MV/LV transformers generally have five tap positions with a voltage range from 0.95 p.u. to 1.05 p.u. with the step of 2.50%. The physical transformer tap mechanism presents a discrete variable that defines the optimization problem as mixed integer nonlinear programming (MINLP). Transformer tap bounds:  
\[ \begin{split} Tap^{\min}\leq Tap^{\min}_{t}\leq Tap^{\max},\ \forall Tap^{\min}_{t}\in\mathbb{Z},\ \forall t\in T\end{split}  \tag{7}\]  
where:  
\(\begin{split} Tap^{\min}\)**--**minimal transformer tap position;  
\(\begin{split} Tap^{\max}\)**--**maximum transformer tap position;  
\(\begin{split} Tap^{\min}_{t}\)**--**transformer tap position in time \(t\). **  
The transformer physically has a mechanical tap changer. A frequent changing of the tap position can lead to wear and reduce the operation lifespan of the transformer. Therefore, it is important to prevent the mechanical stress on transformers. In this study, the tap changes (\(\alpha\)) should be less than five times in the observed period. Two indicators are introduced. If the tap position is changed compared to the previous tap position, the indicator is set to 1. Otherwise, the indicator is set to 0 (Equation (8)). \[ \begin{split}\text{If}:|\ Tap_{t}-Tap_{t-1}|>0,\ \alpha=1,\forall t\in T\\ \text{If}:|\ Tap_{t}-Tap_{t-1}|=0,\ \alpha=0,\forall t\in T\end{split}  \tag{8}\]  
where:  
\(