## 5 Semi-Active Structural Control
### Semi-Active Controller Based on the Frequency of the Vibrations
If the calculated fitness value is better than the best value recorded up to that point, the new parameters \(\left(k_{gTMD},\ d_{gTMD}\right)\) are stored in the lookup table corresponding to the current wave frequency, \(f_{waves}\). This process is repeated iteratively until the stop condition of the GA is met, signaled by \(op_{end}=1\). At this point, the scheduler resets the GA and assigns a new wave frequency, \(f_{waves}\). The procedure continues until all frequencies in the predefined frequency list have been tested. In this study, the TMD parameters were optimized using the GA for the second natural frequency, corresponding to excitation of the turbine by an external force at 0.54 Hz. The configuration of the GA was consistent with that described previously. The optimized values for the TMD spring stiffness and damping coefficient were determined to be 29.950 N/m and 29.530 Ns/m, respectively. It is important to highlight that these values for the damping coefficient and spring stiffness are relatively high. This can be attributed to the fact that the tower is excited by a force at 0.54 Hz, meaning it tends to oscillate in a rapid manner--approximately every two seconds. As the TMD mass aims to oscillate at the same frequency, it is logical that these coefficients reach high values in order to minimize the mass stroke and effectively counteract the external force frequency. Following the completion of the optimization, the frequency-based semi-active TMD is implemented according to the scheme illustrated in Figure 8.  
The main frequency, \(f_{peak}\), is determined in real time by the frequency detector, freqDet. Details of the frequency detection process are provided in Section Determination of the Frequency in Real Time. The detected frequency is then used as an index in the lookup table \(free2 par\) to retrieve the corresponding pair of parameters \(\left(k_{gTMD},\ d_{gTMD}\right)\), which are subsequently applied as inputs to the TMD. Figure 7: Frequency-based semi-active TMD optimization scheme. Determination of the Frequency in Real Time  
In order to adjust the semi-active TMD in real time to any given frequency, it is necessary to identify the current frequency online [26]. For this purpose, the Short-Time Fourier Transform (STFT) is applied. The STFT is widely used for analyzing non-stationary signals, as it provides an effective time-frequency representation of many signal types [27]. To determine the frequencies present at a specific moment in time \(t\), a small segment of the signal around that instant is selected, and a Fourier analysis is performed on this segment. This is achieved by multiplying the signal \(s(\tau)\) by a window function \(h(t)\), centered at \(t\), resulting in the modified signal segment, where \(\tau\) represents the current time. \[s_{t}(\tau)=s(\tau)h(\tau-t), \tag{15}\]  
The two time variables that define the modified signal are the current time, \(\tau\), and the time of interest, \(t\). The window function is chosen so that the signal contribution is negligible for time periods far from \(t\), while remaining effectively constant near \(t\). In this study, a Hamming window function was utilized. Multiple simulations were conducted to determine the optimal window length, revealing that the accuracy of the detected frequency is highly sensitive to this parameter. Following extensive testing, the window length was optimized using Genetic Algorithms, yielding a length of 12 s with an overlap of 3.2 s.  
By sliding the window along the signal, the data are segmented accordingly. The STFT is then applied to each segment to identify the frequencies present in that specific portion of the signal. This process generates a new spectrum for each time interval. A summary of the method is illustrated in Figure 9, where TTDspFA represents the tower top displacement (TTD) in the fore-aft direction, \(w\) is the window length (12 s), and \(l\) is the overlap. The resulting signal, \(f_{i}\), corresponds to the dominant frequency identified for each segment of the signal.