# Experimental Validation of Peer-to-Peer Distributed Voltage Control System
## 3 Dual-Decomposition-Based P2P Voltage Control Algorithm  
The proposed P2P voltage control algorithm regulates the voltage within allowed limits based on an optimization problem. The algorithm uses a minimum change in reactive and active power consumption or injection of some participating inverters installed in the microgrid to control the voltage. The derivation of the algorithm is presented in [14] and here we present the algorithm in a more practical way. Without compensation, each inverter injects a certain amount of active power into the system. In reality, this active power originates from the solar energy received by the photovoltaic cell. The inverter can additionally inject reactive power, as long as the total apparent power does not exceed the inverter rating. The inverter has an additional degree of freedom; it can curtail a fixed percentage of the active power. Therefore, the actuator agent can take two actions: reducing the active power (by an amount \(\Delta P\)) and injecting or absorbing reactive power (by an amount \(\Delta Q\)). Figure 2: Schematic of the P2P voltage control testbed (VM stands for voltmeter, D2D: device-to-device communication module, **Right**: resistor, **Left**: inductor, Real-Time Target (RTT): real time target computer, R.Pi: raspberry pi computer, V: volt, L-L: line to line, labels (1)–(12) indicate the different parts of the testbed, labels (**1**)–(**11**) same as in Figure 1). Each actuator agent solves the following optimization problem to find \(\Delta P_{d}\) and \(\Delta Q_{d}\) :  
\[\underset{\Delta P,\Delta Q}{\text{argmin}} c^{\text{P}}(\Delta P_{d}^{(t)})^{2}+c^{\text{Q}}(\Delta Q_{d}^{(t)})^{2}+ \sum_{i=1}^{\mathcal{N}}\Big{(}(\lambda_{i}^{\text{max}})^{(t-1)}-(\lambda_{i} ^{\text{min}})^{(t-1)}\Big{)}\Big{(}v_{d,i}^{\text{P}}\Delta P_{d}^{(t)}+v_{d, i}^{\text{Q}}\Delta Q_{d}^{(t)}\Big{)}\] (1) Subject to: \[(-c_{r})(P_{d}^{\text{profile}})^{(t)}\leq\Delta P_{d}^{(t)}\leq 0\] \[-\sqrt{(S_{d})^{2}-\Big{(}(P_{d}^{\text{profile}})^{(t)}+\Delta P_ {d}^{(t)}\Big{)}^{2}}\leq\Delta Q_{d}^{(t)}\leq\sqrt{(S_{d})^{2}-\Big{(}(P_{d }^{\text{profile}})^{(t)}+\Delta P_{d}^{(t)}\Big{)}^{2}}\]  
where \(d\in\mathcal{D}\) is the number of the actuator agent (\(\mathcal{D}\) is the set of actuators participating in the voltage control). \(i\in\mathcal{N}\) is the number of the observer agent (\(\mathcal{N}\) is the set of observers participating in the voltage control). \(c^{\text{P}}(\Delta P_{d}^{(t)})^{2}\) represents the quadratic cost of a change in active power of inverter \(d\) with an amount \(\Delta P_{d}\) at time step \(t\), while \(c^{\text{Q}}(\Delta Q_{d}^{(t)})^{2}\) represents the quadratic cost of a change in reactive power of inverter \(d\) with an amount \(\Delta Q_{d}\) at time step \(t\). \(c^{\text{P}}\) and \(c^{\text{Q}}\) are constant factors used to penalize the control variables \(\Delta P_{d}\) and \(\Delta Q_{d}\). These factors define the priorities for the control actions. It is supposed that reactive power control of the inverter is cheaper than cutting its active power. Therefore, \(c^{\text{P}}\) should be greater than \(c^{\text{Q}}\) in a sense that gives priority of the control action to the reactive power. When the reactive power of the inverter is not sufficient, active power curtailment of the inverter will be used to regulate the system voltages. In our control system, we set \(c^{\text{P}}=200\) and \(c^{\text{Q}}=1\). Active power curtailment can be penalized more to minimize its use, but having higher \(c^{\text{P}}\) would decrease the speed of convergence when the curtailment is used to return the voltages back to the limits. It is worth mentioning that the factor \(c^{\text{Q}}\) can be calculated to incorporate losses on the network (related to reactive power compensation) and other costs. In reality, reactive power provision can lead to some additional losses in the network. An approximate cost factor can include the additional losses in the inverter [28].