## 2 Wind Farm Modeling
### Wind Farm Simulator  
WFSim developed by Delft University of Technology is a dynamic medium fidelity wind farm modeling tool. Navier-Stokes equations used to model flow field form the fundamental lead in developing the WFSim [26]. WFSim's computational complexity is reduced by simplifying the three-dimensional flow equation to two-dimensional equation by disregarding flow features in the z-direction, where it solves the Navier-Stokes equation to get flow velocities at hub height. The WFSim is a control-oriented, medium-fidelity modeling tool that can be used to build and test various control techniques with tuning parameters. It employs flow velocities to determine the total power output [29]. It allows wind farms to be designed flexibly, and control methods based on actuator disk theory and actuator line model can be applied to the models.  
A schematic representation of WFSim is shown in Figure 2. It consists of two modules, i.e., a flow model and a rotor model, as shown in the diagram. The flow model defines the behavior of the flow field by taking into account the atmospheric conditions, force on the flow field by the wind turbines, wind velocities, pressure, wind directions, and so on. The inputs to the flow model are the atmospheric condition \(\mathrm{q_{atm}}\) and the force f applied by the turbines on the flow field. The output from the flow model are state variables \(\mathbf{q}=[\mathrm{u}\,\mathrm{v}\,\mathrm{p}]^{T}\) that comprise velocities \(\mathrm{u}\) and \(\mathrm{v}\) in the x and y directions, respectively, and air pressure \(\mathrm{p}\). The rotor model calculates the force exerted on the flow field by the turbines and is linked to the power generated by the turbines. The inputs to the rotor model include \(\mathbf{q}\) in addition to the control input \(\omega\), which influences force f, fed to the flow model and is a function of power P. [PERSON]'s mixing length model [26] is the turbulence model used in WFSim, and wind farm turbines in wind farm are modeled as non-rotating actuator disk models.  
Figure 2: Block diagram of wind farm simulator.  
Mathematically, \(f\) in Figure 3 applied by the turbine to the flow field is expressed in terms of hub-height flow velocity \(U_{n}\), yaw angle \(\gamma_{n}\), and inflow angle \(\phi\) as follows:  
\[f=\sum_{n=1}^{N_{T}}f_{n} \tag{1}\]  
\[f_{n}=\frac{c_{f}}{2}C_{T_{n}}^{{}^{\prime}}[U_{n}\text{cos}(\gamma_{n})]^{2} \begin{pmatrix}\text{cos}(\gamma_{n}+\phi)\\ \text{sin}(\gamma_{n}+\phi)\end{pmatrix}\times H[\frac{D}{2}-\parallel s-t_{n} \parallel{}_{2}]\delta[(s-t_{n}).e_{\perp,n}] \tag{2}\]  
where \(c_{f}\) is a tuning parameter, \(N_{T}\) denotes the number of turbines and, H and \(\delta\) are Heaviside and Dirac delta functions, respectively [26]. For the \(n^{th}\) turbine, the disk-based thrust coefficient \(C_{T_{n}}^{{}^{\prime}}\)[30] is a function of axial induction factor \(a_{n}\) and classical thrust coefficient \(C_{T_{n}}\) as follows:  
\[C_{T_{n}}^{{}^{\prime}}=\frac{C_{T_{n}}}{(1-a_{n})^{2}} \tag{3}\]  
The power P generated by the wind farm is function of air density \(\delta\), swept area A, wind flow velocity \(U_{n}\), and yaw angle \(\gamma_{n}\) as follows:  
\[P=\sum_{n=1}^{N_{T}}\frac{1}{2}\rho AC_{T_{n}}[U_{n}\text{cos}\gamma_{n}]^{3} \tag{4}\]  
where \(C_{T_{n}}=C_{P}C^{\prime}T_{n}\) is the loss factor, which is the function of \(C_{P}\), a tuning variable. The control variables in the WFSim model are yaw angle \(\gamma_{n}\) and \(C^{\prime}T_{n}\), which relates to \(a_{n}\). These control variables are regulated to maximize the energy production and enhance the wind farm performance.