# A Two-Grid Interline Dynamic Voltage Restorer Based on Two Three-Phase Input Matrix Converters
## 6 TI-IDVR Control Algorithm
### TTI-MC Control Algorithm  
With this control algorithm, it is guaranteed that the voltage level in the virtual dc-link is adequate so that the CSIs can compensate for the disturbances that appear in the feeders. The TTI-MC integrates the two feeders to the TI-IDVR and acquires power from both grids to supply power to the CSIs through the virtual dc-link. Figure 7 shows the modulation and control scheme of the TTI-MC.  
To ensure good current targeting and a power factor close to the unit in both feeders, their currents (\(i_{1}\) and \(i_{2}\)) and voltages (\(v_{1}\) and \(v_{2}\)) are measured. By focusing attention on feeder 1, its phase angle \(\theta_{1}\) is obtained by means of a PLL. \(\theta_{1}\) is used when performing the _abc-dq_ transformation of the currents measured in feeder 1. By using \(\theta_{1}\) in the transformation, it is guaranteed that the \(d\)-axis of the current aligns with the voltage vector of the same feeder. The reference of the reactive current is set to zero; \({}^{*}\!i_{\theta 1}=0\) to have a unit power factor. To control the active and reactive currents of the feeder, Proportional-Integral (PI) controllers are used. Subsequently, the _dq-abc_ transformation synchronized with the angle \(\theta_{1}\) is used to obtain the three-phase set of modulation references for feeder 1. This set of reference signals is divided by the virtual dc-link voltage calculated in the algorithm of CSI control.  
To prevent the reference set of feeder 1 from crossing with the reference set of feeder 2, the compensation voltages \(V_{\textit{offup}}\) and \(V_{\textit{offdown}}\) are added. \(V_{\textit{offup}}\) moves the reference set of feeder 1 up and \(V_{\textit{offdown}}\) moves the reference set of feeder 2 down.  
The trigger signals of the TTI-MC are generated using the CB-PWM technique with double reference. This technique compares the reference set of feeder 1 (\(v_{\textit{ref1}}\)) and the reference set of feeder 2 (\(v_{\textit{ref2}}\)) with the triangular carrier constructed in the PWM of the  
Figure 7: TTI-MC control algorithm and modulation.  
CSI. By comparing the reference set of feeder 1 (\(v_{r\
eq 1}\)) with the triangular carrier signal, the on and off times of the switches S1, S4 and S7 are obtained and the on and off times for switches S3, S6 and S9 are obtained by comparing the triangular carrier signal with the reference set of feeder 2 (\(v_{r\
eq 2}\)). To obtain the trigger signals of switches S2, S5 and S8, the logical operator XOR is used as follows: S2 = (S1) XOR (S3).  
With this control algorithm, the proposed TI-IDVR has good multi-functional performance and is able to compensate for deep and long-term sags, swells, interruptions, voltage imbalances and harmonic distortion. In addition, this algorithm has additional advantages such as:  
* The energy storage capacity to compensate for deep and long-term sags is not a limitation because the power is taken from the two feeders by means of the TTI-MC.
* There are no energy storage devices in the virtual dc-link. Therefore, it is not necessary to measure the voltage on the dc-link for control purposes.
* With this control scheme, the TTI-MC behaves like two Voltage Source Converters (VSCs) and integrates two feeders to the TI-IDVR using only a unified control algorithm. Under a conventional scheme, two VSCs and a controller are needed for each of them.
* The control algorithm for the TI-IDVR used in this work is more compact compared to the control algorithms used in conventional AC-DC-AC two-stage converters with energy storage elements used in IDVRs.