# A Two-Grid Interline Dynamic Voltage Restorer Based on Two Three-Phase Input Matrix Converters
## 5 Carrier Based PWM with Double Reference Algorithm for the TTI-MC  
The CB-PWM modulation technique has been widely adopted for the generation of trigger signals in electronic power converters. In [37; 38], the CB-PWM technique is used with two references for the purpose of integrating two power generators into the power grid. In this work, we use the MCB-PWM with two modified references to integrate two feeders with their respective loads to a TI-IDVR that can be used in a multi-feeder system or in a CPP.  
Figure 4: Space vector representation of the active states of the CSI.  
The MCB-PWM with double reference implemented for TTI-MC modulation employs two sets of reference signals that share a triangular carrier signal. One set of the reference signals corresponds to feeder 1 and the other to feeder 2. The set of reference signals corresponding to feeder1 is placed above the set of signals corresponding to feeder 2. For clarity, we will call phase \(a\), phase \(b\) and phase \(c\) the three phases of feeder 1; the three phases of feeder 2 will be referred to as phase \(r\), phase \(y\) and phase \(w\).  
The MCB-PWM process with double references implemented to generate the trigger signals for the switches of a branch of the TTI-MC is shown in Figure 5. The upper (\(v_{m}\)) and lower (\(v_{rr}\)) reference signals are compared with the signal triangular carrier (\(v_{tri}\)) to obtain the trigger signals of switches S1 and S3. To obtain the trigger signal of switch S2, the logical operator XOR is used between signals S1 and S3. The ratio of the trigger signals can be written functionally as follows:  
\[S_{1}=\left\{\begin{array}{ll}1,\ v_{ra}\geq v_{tri}\\ 0,\ v_{ra}<v_{tri}\\ S_{2}=S_{1}\ \text{XOR}\ S_{3}\end{array}\right.\qquad S_{3}=\left\{\begin{array}{ll} 1,\ v_{rr}\leq v_{tri}\\ 0,\ v_{rr}>v_{tri}\end{array}\right. \tag{34}\]  
where \(v_{ra}\) and \(v_{rr}\) are the upper and lower modulation reference signals that correspond to phase \(a\) of feeder 1 and phase \(r\) of feeder 2. \(v_{tri}\) is the triangular carrier signal. \(d_{1}\) and \(d_{3}\) are the duty cycles for switches S1 and S3. The reference signals are given by:  
\[v_{ra}=\frac{m_{i1}\cos(\omega_{1}t+\theta_{a})+V_{off1}}{v_{dclink}}+V_{offup} \tag{35}\]  
\[v_{rr}=\frac{m_{i2}\cos(\omega_{2}t+\theta_{r})+V_{off2}}{v_{dclink}}+V_{offdown} \tag{36}\]  
where \(m_{i1}\) and \(m_{i2}\) are the modulation indices, \(\omega_{1}\) and \(\omega_{2}\) are the angular frequencies, \(\theta_{a}\) and \(\theta_{r}\) are the phase angles of the upper and lower input voltages, and \(V_{off1}\) and \(V_{off2}\) are the compensation variables utilized to improve the modulation indices, which are given by:  
\[v_{off1} = -0.5(max(v_{ra},v_{rb},v_{rc})+\ min(v_{ra},v_{rb},v_{rc})) \tag{37}\] \[v_{off2} = -0.5(max(v_{rr},v_{ry},v_{rw})+\ min(v_{rr},v_{ry},v_{rw})) \tag{38}\]  
where \(v_{m}\), \(v_{rb}\) and \(v_{rc}\) are the reference voltages of feeder 1, and \(v_{rr}\), \(v_{ry}\) and \(v_{rw}\) are the reference voltages of feeder 2. Finally, \(V_{offup}\) and \(V_{offdown}\) are the offset signals (up and down) that prevent crossing between the reference signal sets. It should be mentioned that the sum of the modulation indices must be less than or equal to 1 for each of the sets of the reference signals if the frequencies of the two feeders are different [37].