## 3 Coordinated Control Scheme for the Energy Router
### Reference Voltage and Current Compensation Strategy for Mode Switching of the Energy Router
#### 3.2.2 Reference Current Compensation  
It is assumed that \(i_{\text{dref},i}\) and \(i_{\text{qref},i}\) are the active and reactive output currents generated by PQ control before switching, \(i_{\text{dref},u}\) and \(i_{\text{qref},u}\) are the active and reactive output currents generated by V/f control after switching. Since \(i_{\text{dref},u}\) and \(i_{\text{qref},u}\) are adjusted to steady values from zero by PI regulators of V/f control gradually, there will be an abrupt change between the steady output currents before switching and the output currents after switching. The following reference current compensation equation is established to avoid this abrupt change,  
\[\left\{\begin{array}{l}i_{\text{dref}}=i_{\text{dref},i}+i_{\text{dref},u}\\ i_{\text{qref}}=i_{\text{qref},i}+i_{\text{qref},u}\end{array}\right. \tag{7}\]  
Equation (7) indicates that output currents \(i_{\text{dref},i}\) and \(i_{\text{qref},i}\) before switching are added to the reference currents as compensation during the course of switching.  
In PQ control, sinusoidal signal of the power grid is taken as the reference vector and the direction of \(d\) axis coincides with it. In V/f control, sinusoidal signal generated by the virtual phase-locked loop is taken as the reference vector of the \(d\) axis direction. During the course of switching, the phase of the sinusoidal vector under PQ control is taken as initial phase of \(d\) axis direction. After switching, the phase of \(d\) axis direction will be gradually converging to the phase of sinusoidal vector generated by the virtual phase-locked loop under V/f control.  
If the HEMS is in isolated mode for a long time, active and reactive output currents generated by V/f control will already be steady values. In this paper, \(i_{\text{dref},\text{island}}\) and \(i_{\text{qref},\text{island}}\) are used to represent active and reactive output current of V/f control. The \(d\) axis and \(q\) axis components of the reference currents during the course of switching can be chosen as,  
\[\left\{\begin{array}{l}i_{\text{dref}}=i_{\text{dref},\text{island}}\\ i_{\text{qref}}=i_{\text{qref},\text{island}}\end{array}\right. \tag{8}\]  
Equation (8) indicates that the steady active and reactive output currents before switching are used as actual reference currents during the course of switching. It is an effective solution to suppress transient impact and achieve smooth transition. After switching, \(i_{\text{dref}}\) and \(i_{\text{qref}}\) will be gradually converging to a new steady state according to the actual active reference power \(P_{\text{ref}}\) and reactive reference power \(Q_{\text{ref}}\) of the PQ control.  
Figure 5: The compensation strategy for the main DC/AC converter.  
In order to ensure smooth transition of \(d\) axis direction, the phase of the sinusoidal vector under V/f control should to be taken as initial phase of \(d\) axis direction during the course of switching. After switching, the phase of \(d\) axis direction will gradually converge to the phase of sinusoidal vector of the power grid under PQ control.