# Optimal Power Dispatch of an Offshore Wind Farm under Generator Fault
## 4 Optimal Power Dispatch with Fault Accommodation
### Fault Accommodation and Optimization  
It can be seen that the problem in this paper is a constrained multi-objective optimization problem from the objectives summarized at the beginning of this section. In order to achieve these objectives, the PSO algorithm applied to power dispatch of the WF should be implemented by formulating the problem as:  
\[\min \frac{|\sum_{i=1}^{n}P_{i}(k)-P_{\text{dem}}(k)|}{P_{\text{dem}}( k)}*k1+(1-r(\mathbf{P}(k-1),\mathbf{P}(k)))*k2+\frac{\sum_{i=1}^{n}|P_{i}  
will not exceed the power limit. This also means that the faulty turbine will not produce more power than the power limit, and the WT's fault will not deteriorate further.  
The first term in the objective function indicates the degree of deviation between the power output of the WF and the power demand. For the active power control of the WF, tracking the reference from the TSO is a basic function and has a high priority. Hence, it has a large weight in the objective function. From this term, it is obvious that we care more about the total power output from WF than the power of individual WTs in WFC. This means that there is much flexibility to dispatch the power of each WT while ensuring the WF power output meets the power demand.  
Although the wake loss reduction is not directly contained in the objective function, the power output of the WF will also try to follow the power demand even if the power demand is high. Therefore, tracking a high power demand also means the power maximization. The effect of the power improvement was verified in Section 5.  
When the power demand is lower than the available power of the WF, there will be many situations that meet the required power tracking. Moreover, the initialization of PSO includes a random process. Therefore, the output from PSO in this state may be quite different from the previous state. If this happens, it will cause the power fluctuation of the WT to become larger. It should be noted that the power fluctuation here does not refer to the dynamic change of power, but the change of power when the WF model changes from one static state to another. In order to reduce this power fluctuation, we added the second term of the objective function. Here, the correlation coefficient of \(P_{i}(k)\) and \(P_{i}(k-1)\) is calculated, and then, the value will be subtracted by one. If there is no fluctuation, the value of this term is zero. The larger this value, the larger the fluctuation. The expression of the correlation coefficient is shown in (10).  
\[\mathrm{r}(\mathbf{P}(k-1),\mathbf{P}(k))=\frac{\mathrm{cov}(\mathbf{P}(k-1),\mathbf{P}(k))}{ \mathrm{std}(\mathbf{P}(k-1))\cdot\mathrm{std}(\mathbf{P}(k))} \tag{10}\]  
where \(\mathrm{cov}(\mathbf{P}_{i}(k),\mathbf{P}(k-1)\) is the covariance of \(\mathbf{P}(k)\) and \(\mathbf{P}(k-1)\) and \(\mathrm{std}(P(k))\) and \(\mathrm{std}(\mathbf{P}(k-1))\) are the standard deviations of \(\mathbf{P}(k)\) and \(\mathbf{P}(k-1)\). According to the WT model, if the power reference is larger than the available power, the WT can only produce power as large as the available power. When the control strategy and the properties of the WT are fixed, the available power depends on the wind speed. Due to the wake effect, the wind speed of the downstream WT is affected by the upstream WT. Therefore, the wind speed of the downstream WT can only be obtained after the operating state of the upstream WT is determined. During the iterative process of PSO, the selection of \(P_{\mathrm{r}i}(k)\) does not take the available power into account. There will be many solutions with the power reference in excess of the available power. This will also affect the optimization process. In order to avoid this situation, a penalty function was added as the third term of the objective function, which represents the deviation between power references and power outputs of all WTs. With this approach, many unreasonable power references can be removed.