# Virtual Flux Control Methods for Grid-Forming Converters: A Four-Method Comparison
## 3 Control Schemes
### Flatness-Based Control  
The concept of flatness originates from differential algebra [61] and describes a particular class of systems whose dynamics and trajectories can be fully determined by a specific set of variables. A system is considered differentially flat if there exists an appropriately chosen output variable, referred to as the \"flat output,\" from which all state variables and control inputs can be explicitly expressed as algebraic functions, using only a finite number of derivatives of this output without the need to integrate any differential equations [34; 36]. More formally, consider a system represented by  
\[\dot{x}=f(x,u) \tag{10}\]  
where \(x\in\mathbb{R}^{n}\) represents the state vector and \(u\in\mathbb{R}^{m}\) denotes the input vector. The system is said to be differentially flat if, and only if, all states and inputs can be rewritten as algebraic functions of a chosen system output \(y\) and a finite number of its derivatives  
\[y=(y_{1},y_{2},\cdots,y_{m})=\phi\Big{(}x,u,\dot{u},\cdots,u^{(s)}\Big{)} \tag{11}\]\[x=\varphi\left(y,\dot{y},\cdots,y^{(r)}\right) \tag{12}\]  
\[u=\sigma\left(y,\dot{y},\cdots,y^{(r+1)}\right) \tag{13}\]  
From (4), the flux generated in the filter inductor can be expressed as  
\[\psi_{L}=L_{f}i=\psi_{v}-\psi \tag{14}\]  
The variable \(\psi_{L}\) is proposed as the flat output of the system, which can be expressed in terms of the current \(i\), serving as the system's state variable  
\[y=\psi_{L}=L_{f}i=\phi(x) \tag{15}\]  
As observed, this satisfies the first condition in (11) required for the system to be classified as differentially flat. From (4), the current can be solved, expressing the state vector as a function of the system output, thereby fulfilling the second condition given in (12)  
\[x=i=\frac{y}{L_{f}}=\varphi(y) \tag{16}\]  
Finally, the internal voltage \(e\), obtained from (3), is considered as the system input. This voltage can be rewritten in terms of the derivative of the selected output  
\[u=e=\dot{y}+v=\sigma(\dot{y}) \tag{17}\]  
Thus, the third and final condition from (13) is also satisfied, ensuring that the system can be classified as differentially flat. As previously discussed, one of the key properties of differentially flat systems is that all system dynamics can be fully characterized through the selected flat output. Consequently, by imposing a trajectory on this output, it is possible to ensure that all system variables are properly controlled both in steady-state and during transient conditions. In the proposed control system, the reference output is chosen as the inductor flux \(\psi_{L}^{*}\), which its components \(dq\) can be obtained as  
\[\psi_{L,dq}^{*}=\psi_{dq}^{*}-\psi_{dq} \tag{18}\]  
where \(\psi_{d}^{*}\) represents the reference flux magnitude obtained from the RPC loop shown in Figure 2, while \(\psi_{q}^{*}\) is set to 0. In addition, \(\psi_{dq}\) represents the measured grid flux. To ensure that the system follows the reference accurately, a second-order control law is proposed to eliminate steady-state errors in both \(dq\) components, given by  
\[(\dot{\psi}_{L}^{*}-\dot{\psi}_{L})+2\xi\omega_{n}(\psi_{L}^{*}-\psi_{L})+ \omega_{n}^{2}\int(\psi_{L}^{*}-\psi_{L})\,dt=0 \tag{19}\]  
Solving for \(\dot{\psi}_{L}\) (which corresponds to the derivative of the system's output variable, \(\dot{y}\)), and substituting the result into (17), the internal converter voltages \(e_{dq}\) can be determined. Furthermore, for the Park transformations (\(dq\)-abc), the control angle obtained in the APS loop \(\Theta\), depicted in Figure 2, is used. These values are then used to compute the duty cycles required for the PWM modulator, which ultimately determines the switching states of the power semiconductors.