Discrete Wavelet Transform for the Real-Time Smoothing of Wind Turbine Power Using Li-Ion Batteries

: Energy Storage Systems (EES) are key to further increase the penetration in energy grids of intermittent renewable energy sources, such as wind, by smoothing out power ﬂuctuations. In order this to be economically feasible; however, the ESS need to be sized correctly and managed efﬁciently. In the study, the use of discrete wavelet transform (Daubechies Db4) to decompose the power output of utility-scale wind turbines into high and low-frequency components, with the objective of smoothing wind turbine power output, is discussed and applied to four-year Supervisory Control And Data Acquisition (SCADA) real data from multi-MW, on-shore wind turbines provided by the industrial partner. Two main research requests were tackled: ﬁrst, the effectiveness of the discrete wavelet transform for the correct sizing and management of the battery (Li-Ion type) storage was assessed in comparison to more traditional approaches such as a simple moving average and a direct use of the battery in response to excessive power ﬂuctuations. The performance of different storage designs was compared, in terms of abatement of ramp rate violations, depending on the power smoothing technique applied. Results show that the wavelet transform leads to a more efﬁcient battery use, characterized by lower variation of the averaged state-of-charge, and in turn to the need for a lower battery capacity, which can be translated into a cost reduction (up to − 28%). The second research objective was to prove that the wavelet-based power smoothing technique has superior performance for the real-time control of a wind park. To this end, a simple procedure is proposed to generate a suitable moving window centered on the actual sample in which the wavelet transform can be applied. The power-smoothing performance of the method was tested on the same time series data, showing again that the discrete wavelet transform represents a superior solution in comparison to conventional approaches.


Introduction
Wind energy is one of the most environmental-friendly and promising renewable energy sources. The intermittent nature of the wind, however, sets limits on a large-scale penetration into the electricity grid [1,2]. In fact, the variability of the wind resource can create grid instability issues, in terms of frequency and voltage. In addition, random fluctuations of wind power, if not properly regulated, may lead to the risk of undesired curtailment [3]. Therefore, in order to prevent possible damages, the requirements of the electrical system are very restrictive, constraining the power gradients that the network can absorb, as discussed in more detail in the following. This has led to the development of power smoothing approaches, i.e., methods capable of mitigating fluctuations, smoothing the power profile fed into the network [4]. Approaches without Energy Storage Systems (ESS) are becoming popular due to their low upfront investment cost, but are not mature for widespread application [5]. Studies are mainly focused on inertia control approach and The ramp rate is usually defined over periods of one minute or 10 min. Often the difference ∆P is normalized with respect to the wind plant's nominal power P nom . of the power plant [25]: [P(t) − P(t − ∆t)] P nom × 100 (%) (2) The typical ramp requirement is 10% of rated power per minute, but each national grid typically has its own regulation. Table 1 reports the maximum ramp rate specifications of some countries [4,15,19,[26][27][28]. Upon examination of the table, ramp-rate limits vary greatly from country to country and are typically more stringent for weaker grids. Constraints on single wind turbine power fluctuations are often not this restrictive for modern electrical systems. This is due to the fact that there is spatial smoothing of aggregate wind energy generation because multiple plants in a certain region likely experience different wind speed time-series, which in practice reduces the aggregated variability [29].
Based on the comparative nature of the present study, a ramp-rate of 10% per minute is used in this study, regardless of wind farm capacity, as this is a recurrent constraint on many grids, even in case of those with high installed wind capacity, as the USA. Table 1. Ramp rate limits for some relevant countries in the world.

Case Study
One of the main points of strength of the present study is the possibility of basing the analysis on real wind turbine data collected in the field. In fact, thanks to the courtesy of EUNICE ENERGY GROUP (EEG), the authors had access to 48-months real data from two multi-MW onshore wind turbines (WTs) installed in a wind park of EEG located at a complex terrain region on the Greek mainland (Figure 1), which is in operation since 2011. The use of data from turbines operating in a complex terrain is thought of particular relevance for the study, since storage systems could be largely effective in this type of application, where gustiness and non-uniform wind field are more likely.

Case Study
One of the main points of strength of the present study is the possibility of basing the analysis on real wind turbine data collected in the field. In fact, thanks to the courtesy of EUNICE ENERGY GROUP (EEG), the authors had access to 48-months real data from two multi-MW onshore wind turbines (WTs) installed in a wind park of EEG located at a complex terrain region on the Greek mainland (Figure 1), which is in operation since 2011. The use of data from turbines operating in a complex terrain is thought of particular relevance for the study, since storage systems could be largely effective in this type of application, where gustiness and non-uniform wind field are more likely.
As a first step, the Supervisory Control And Data Acquisition (SCADA) data was analyzed in detail and properly purged of those values that do not correspond to normal operation of the turbine (e.g., maintenance periods, acquisition system errors, lightening, icing, etc.). This led to the definition of a reliable and coherent data set in the form of turbine power as a function of time and wind speed for both the turbines under investigation (see Figure 2). Please note that power data in Figure 2 and in the rest of the study are presented in a non-dimensional form (i.e., divided by the nominal power) to preserve the non-disclosure agreement with the industrial partner.  As a first step, the Supervisory Control And Data Acquisition (SCADA) data was analyzed in detail and properly purged of those values that do not correspond to normal operation of the turbine (e.g., maintenance periods, acquisition system errors, lightening, icing, etc.). This led to the definition of a reliable and coherent data set in the form of turbine power as a function of time and wind speed for both the turbines under investigation (see Figure 2). Please note that power data in Figure 2 and in the rest of the study are presented in a non-dimensional form (i.e., divided by the nominal power) to preserve the non-disclosure agreement with the industrial partner. Reference power curve (data from [30]) and data for turbine #1.
As a second step, a refinement of temporal series was needed. In fact, one remember that in the common industrial practice SCADA data are commonly a with a timestep of 10 min; the typical ramp rate required by network protocols, h is defined as 10% of rated power capacity per minute. Since standard deviations o data inside each 10-min bin were not available, 1-min resolution data were gen posteriori by means of a properly tuned random function. The function extracts, 10-min bin, 9 values in the range between the maximum and the minimum pow ported by the SCADA (so that no wind speed could be introduced that was not pr reality), while the 10th value is the mean power on that period. The high-resolutio time series maintains the same Annual Energy Production that would be calculate the original SCADA data; in other words, the random values were selected so energy produced in the 10 min bin is equal to the sum of the energy produced eac bin in the same period. An example of the outcomes of the procedure is shown in 3a,b. Ideally, it would have been preferable to use real 1-min data over this ener servative extrapolated data. However, this approach is arguably conservative with to battery sizing requirements as it is highly unlikely that the wind speed, and output power, will follow a completely random pattern in the sub 10-min windo (a) (b)  Reference power curve (data from [30]) and data for turbine #1.
As a second step, a refinement of temporal series was needed. In fact, one should remember that in the common industrial practice SCADA data are commonly acquired with a timestep of 10 min; the typical ramp rate required by network protocols, however, is defined as 10% of rated power capacity per minute. Since standard deviations of power data inside each 10-min bin were not available, 1-min resolution data were generated a posteriori by means of a properly tuned random function. The function extracts, for each 10-min bin, 9 values in the range between the maximum and the minimum power as reported by the SCADA (so that no wind speed could be introduced that was not present in reality), while the 10th value is the mean power on that period. The high-resolution power time series maintains the same Annual Energy Production that would be calculated using the original SCADA data; in other words, the random values were selected so that the energy produced in the 10 min bin is equal to the sum of the energy produced each 1-min bin in the same period. An example of the outcomes of the procedure is shown in Figure 3a,b. Ideally, it would have been preferable to use real 1-min data over this energy-conservative extrapolated data. However, this approach is arguably conservative with respect to battery sizing requirements as it is highly unlikely that the wind speed, and thus the output power, will follow a completely random pattern in the sub 10-min window [4]. Reference power curve (data from [30]) and data for turbine #1.
As a second step, a refinement of temporal series was needed. In fact, one should remember that in the common industrial practice SCADA data are commonly acquired with a timestep of 10 min; the typical ramp rate required by network protocols, however, is defined as 10% of rated power capacity per minute. Since standard deviations of power data inside each 10-min bin were not available, 1-min resolution data were generated a posteriori by means of a properly tuned random function. The function extracts, for each 10-min bin, 9 values in the range between the maximum and the minimum power as reported by the SCADA (so that no wind speed could be introduced that was not present in reality), while the 10th value is the mean power on that period. The high-resolution power time series maintains the same Annual Energy Production that would be calculated using the original SCADA data; in other words, the random values were selected so that the energy produced in the 10 min bin is equal to the sum of the energy produced each 1-min bin in the same period. An example of the outcomes of the procedure is shown in Figure  3a,b. Ideally, it would have been preferable to use real 1-min data over this energy-conservative extrapolated data. However, this approach is arguably conservative with respect to battery sizing requirements as it is highly unlikely that the wind speed, and thus the output power, will follow a completely random pattern in the sub 10-min window [4].  Analyzing the data in further detail, Probability Density Functions (PDF, in Figure 4) and Cumulative Density Functions (CDF, in Figure 5) were used to highlight the distribu-  Analyzing the data in further detail, Probability Density Functions (PDF, in Figure 4) and Cumulative Density Functions (CDF, in Figure 5) were used to highlight the distribution of ramp rates occurrence. Upon examination of the CDF, it is apparent that, as expected, most of the ramp rates are under the regulation threshold; in particular, over 20% of the cases are over the 10% limit in the 1-min data series, which is a considerable amount. Smoothing all the ramp rates might require a very large battery capacity, which could make a project economically not convenient. As it is often the case in the field of engineering, the solution to the problem might be a tradeoff between multiple objectives, i.e., smoothing effectiveness and battery size in the present application. This is the reason why the effectiveness and the costs of the power smoothing system will be evaluated in terms of abatement ratio (AR), defined as [4]: AR is equal to 1 if all the ramp-rate violations are smoothed, while it gets lower and lower as the ESS falls behind and is unable to absorb the power surplus from the power plant. Rather than simply describing the percentage of fluctuations that violate the ramp-rate limits, this parameter quantifies the percentage of fluctuations, which violated the constraints in the un-smoothed signal, which have been removed in the smoothed one. By defining this parameter, a storage system that maximizes AR while keeping costs reasonable can be selected.
Energies 2021, 14, x FOR PEER REVIEW 6 of 33 tion of ramp rates occurrence. Upon examination of the CDF, it is apparent that, as expected, most of the ramp rates are under the regulation threshold; in particular, over 20% of the cases are over the 10% limit in the 1-min data series, which is a considerable amount.
Smoothing all the ramp rates might require a very large battery capacity, which could make a project economically not convenient. As it is often the case in the field of engineering, the solution to the problem might be a tradeoff between multiple objectives, i.e., smoothing effectiveness and battery size in the present application. This is the reason why the effectiveness and the costs of the power smoothing system will be evaluated in terms of abatement ratio (AR), defined as [4]: AR is equal to 1 if all the ramp-rate violations are smoothed, while it gets lower and lower as the ESS falls behind and is unable to absorb the power surplus from the power plant. Rather than simply describing the percentage of fluctuations that violate the ramprate limits, this parameter quantifies the percentage of fluctuations, which violated the constraints in the un-smoothed signal, which have been removed in the smoothed one. By defining this parameter, a storage system that maximizes AR while keeping costs reasonable can be selected.     tion of ramp rates occurrence. Upon examination of the CDF, it is apparent that, as expected, most of the ramp rates are under the regulation threshold; in particular, over 20% of the cases are over the 10% limit in the 1-min data series, which is a considerable amount.
Smoothing all the ramp rates might require a very large battery capacity, which could make a project economically not convenient. As it is often the case in the field of engineering, the solution to the problem might be a tradeoff between multiple objectives, i.e., smoothing effectiveness and battery size in the present application. This is the reason why the effectiveness and the costs of the power smoothing system will be evaluated in terms of abatement ratio (AR), defined as [4]: AR is equal to 1 if all the ramp-rate violations are smoothed, while it gets lower and lower as the ESS falls behind and is unable to absorb the power surplus from the power plant. Rather than simply describing the percentage of fluctuations that violate the ramprate limits, this parameter quantifies the percentage of fluctuations, which violated the constraints in the un-smoothed signal, which have been removed in the smoothed one. By defining this parameter, a storage system that maximizes AR while keeping costs reasonable can be selected.

Methodology
The following section will describe the methods and related algorithms used in the study. A theoretical overview of the Wavelet transform is discussed, followed by a detailed overview of the implemented smoothing method, with special focus on the proposed method for using DWT online. The conventional methods against which the proposed smoothing algorithm is benchmarked are also discussed. In addition, the methods for battery sizing, operation, and aging are presented.

Discrete-Wavelet Based Signal Approximation
The Discrete Wavelet transform (DWT) was selected as the most promising power smoothing technique to be investigated for the scopes of the present study. Generally speaking, the Wavelet transform can be seen as an analysis tool for extracting local-frequency information from a non-stationary signal [31]. A complete overview on the mathematical formulation of the method is beyond the scope of the present study and does not represent an original contribution. However, to convey the basic elements needed to understand the developed algorithm, a brief dissertation on the wavelet theory is here reported. For more information, the reader could refer to refs. [32][33][34][35][36][37][38] which were used for this discussion.
In signal processing, the most popular technique is the ubiquitous Fourier Transform (FT), i.e., the definition of the amplitude of all the frequency components that, summed together as correspondent sinusoidal waves, are able to reproduce the original signal. The problem of the FT is, however, represented by the fact that no indication about the exact time in which each frequency gave its contribution is provided. In case of a stationary problems, this is not a particular issue, as the properties of the signal are maintained over time in a recurring way. On the other hand, when the signal is not stationary, like a wind power time series, the most straightforward option is to modify the approach by representing the signal in two dimensions, i.e., with time and frequency coordinates. To do so, one small signal section (defined by a window function) is analyzed time by time; assuming the stationarity of the signal inside this window, the Fourier transform is applied section by section, sliding the window along the signal. This method is usually called Short-Time Fourier Transform (STFT) and it can provide more specific information about the location of the different frequency components. On the other hand, its accuracy is intrinsically affected by the selection of the signal-cutting window, which can be well explained by Heisenberg's uncertainty principle applied to signal processing, stating that one cannot identify correctly at the same time the frequency and the time of occurrence of this frequency. Mathematically, this can be expressed in terms of standard deviations of the time σ t and frequency σ ν as follows: Based on Equation (4), one can readily notice that, defining a certain level of accuracy in time or frequency with the choice of window size, the other follows accordingly.
Moving from this background, particular attention is currently given to the use of Wavelet analysis, since it implies a windowing technique with modulated windows able to mitigate or suppress the signal-cutting problem. In further detail, wavelet functions are defined conventionally as wave-like oscillations of finite amplitude that have null average [35]. Wavelet have the advantage that they can be manipulated either by sliding them along the signal or by varying their extension. In other words, the wavelet approach can be seen as a windowing technique with variable-size regions. it allows using long time intervals where more precise low-frequency information is required, while short time intervals are used where more precise high-frequency information is required. By doing so, the wavelet transform allows the variation of σ t and σ ν at different frequencies, without violating the uncertainty principle and thus allowing for both a correct definition of the frequency content in the signal and their location in the time domain: this kind of approach is defined multiresolution analysis (MRA). Many different shapes of the wavelet function are available, usually referred to as mother wavelet [38]. The extension of the wavelet is governed by the scale factor a, while the movement along the time axis is described by the translation factor b (Equation (5)). By translating and scaling the mother wavelet shape, it is possible to obtain an infinite number of wavelets ψ a,b (t), identified by parameters a and b and defined as follows: where the term 1/ √ a is used to normalize the wavelet. The theoretical aspects, described in the previous introductive part, bring to define the continuous wavelet transform (CWT) for a signal f(t) by adopting a mother wavelet function ψ(t) which is properly written as: where the superscript * denotes the complex conjugate. The inverse wavelet transform can be defined in the following form: where the term C ψ is the admissibility constant and its value depends on the chosen wavelet. For more information, please refer to [34]. It is worth pointing out here, however, that in terms of applicability CWT has three main issues: 1.
Redundancy, since CWT is defined as a continuous integral, affecting considerably the calculation time; 2.
CWT is defined on an infinite number of wavelets identified by the scale and translation factors, which can assume infinite values; 3.
For most of the functions the wavelet transforms have no analytical solutions, and they can be calculated only numerically.
In order to make CWT more practical and easily applicable to engineering problems, the Discrete Wavelet Transform (DWT) is introduced. To remove the redundancy, DWT considers only discrete values of the scale and translation factors. The wavelet is discretized by a logarithmic discretization of the scale parameter a. The size of the steps taken between b locations is correlated to the scale parameter by proportionality. The discretized wavelet therefore takes the following form (Equation (8)): being m and n integers that control the wavelet dilation and translation, respectively. More precisely, different m values correspond to wavelet of different widths. The value of the translation parameter depends on the width of the wavelet: narrower wavelets will be translated with a smaller step to cover the entire signal extension; wider wavelets, on the other hand, will have a larger step. Commonly, for practical reasons a 0 and b 0 are chosen equal to 2 and 1 respectively, so that the samplings of both the frequency axis and the time axis correspond to dyadic samplings. A dyadic grid is the most efficient discretization for practical purpose and allows the construction of an orthonormal wavelet basis.
With the removal of redundancy, the second goal is to reduce the number of wavelets needed in the wavelet transform, which is still infinite. In the Fourier analysis, the spectrum of the signal is dilated and moved to higher frequencies, as consequence of a time compression. Similarly, a wavelet compression of a factor 2 will bring to a spectrum expansion by the same factor and a frequency shifting upwards. Otherwise, the wavelet spectrum is halved as a result of a doubling of its width in the time domain [37]. Since a wavelet can be seen in first approximation as a band-pass filter, this last aspect leads to a halving of the bandwidth. By exploiting this property, it is, therefore, possible to cover the signal spectrum with the wavelet spectra of different extensions. A good coverage can be obtained if the spectra associated with the wavelets of different scales are connected, without leaving any gap. This process, however, would require an infinite number of wavelets of different scales to cover the entire signal spectrum down to zero frequencies. It is therefore necessary to introduce a new element of the wavelet analysis, which is the scaling function. The scaling function is associated with the smoothing of the signal and its spectrum has the nature of a low-pass filter. Mathematically, the scaling function has the same form of the wavelet: that is, and it satisfies the following property: where φ 0,0 is called father scaling function or father wavelet. By introducing the scaling function, the problem of the infinite number of wavelets has been resolved setting a lower bound for the wavelets. In this way, one wavelet is analogous to a band-pass filter and a scaling function is a low-pass filter and, consequently, a series of dilated wavelets together with a scaling function is a filter bank. Finally, for resolving the third issue of CWT, fast algorithms to calculate the wavelet transform must be developed. The most efficient way in terms of calculation time is to divide the signal spectrum in two (equal) parts, i.e., a low-pass and a high-pass frequency band. The high-pass band includes the smallest details, while the low-pass part still contains some information and therefore it is possible to split it again, creating an iterated filter bank. The number of bands is limited by for example the amount of data or computation power available. The advantage of this scheme is that we must design only two filters, while the disadvantage is that the signal spectrum coverage is fixed. A more detailed dissertation on the frequency range characterization related to the wavelet transform is present in [39].
Ultimately, as in many practical applications signals are discrete, described wavelet transforms must also be discretized. In fact, discrete wavelets are not time-discrete but only the translation and the scale step are discrete. To achieve the time-discretization, the wavelet filter bank can be implemented as a digital filter bank. This brings to define wavelet families through two filter banks: the scaling filter and the wavelet filter. This last procedure can be seen in analogy with the Fast Fourier Transform as reported in [40].
In order to clarify this process, Figure 6 shows the application of DWT on a small sample of the original wind power signal of the present case of study. As discussed, the scope is to decompose the wind power into high-frequency and low-frequency components. Discrete wavelet transform returns two sets of coefficients: approximation coefficients (in red in Figure 6) and detail coefficients (in green in Figure 6), which represent the output of the low pass filter (averaging filter) and high pass filter (difference filter), respectively. Then, DWT is applied iteratively on the low pass set, so that the original signal is also sampled down by a factor of 2. The process is shown in Figure 6a. In this way, it is possible to analyze in the signal at different frequency levels reaching the required degree of decomposition. Once the wavelet coefficients are calculated, the inverse discrete wavelet transform is applied to each level separately to reconstruct a power signal filtered from the high-frequency components (Equation (11), where n is the level of decomposition selected). The wavelet decomposition diagram of wind power is shown in Figure 7, where A and D represent the low frequency and the high frequency components of the signal, respectively.
As a final remark, it is worth noting that, to ensure an accurate signal reconstruction, an appropriate choice of the most suitable mother wavelet must be made. In fact, the best wavelet to perform the analysis depends on the type of signal and the phenomenon of interest [21]. In this study, the Daubechies Db4 has been selected as mother wavelet because of its specific properties, i.e., orthogonality, energy preservation and support of higher polynomials grade for the same number of vanishing moments in comparison with other families, in accordance with literature results [41]. In particular, the Daubechies wavelet Db4 offers an appropriate trade-off between wavelength and smoothness, resulting in an optimal behavior for wind power smoothing and short-term wind power forecasting.
As a final remark, it is worth noting that, to ensure an accurate signal reconstruction, an appropriate choice of the most suitable mother wavelet must be made. In fact, the best wavelet to perform the analysis depends on the type of signal and the phenomenon of interest [21]. In this study, the Daubechies Db4 has been selected as mother wavelet because of its specific properties, i.e., orthogonality, energy preservation and support of higher polynomials grade for the same number of vanishing moments in comparison with As a final remark, it is worth noting that, to ensure an accurate signal reconstructio

Wavelet-Based Smoothing Algorithm and ESS Model
The DWT is at the core of the proposed smoothing method. The signal is first decomposed into a low frequency component that will be outputted to the grid and a high frequency one that will be absorbed by the ESS. This concept remains the same in both the battery sizing algorithm, presented in Section 3.2.1 and the battery management algorithm, shown in Section 3.2.2. The constraints on the ESS's operation are at times a significant bottleneck and cause the power output to the grid to change significantly. For this reason, the ESS and the smoothing algorithm have to be treated as a single system as will be explained in the following subsections.

DWT-Based Battery Operation Design Algorithm
The wavelet-based analysis is applied to the smoothing of a wind turbine's power output by firstly decomposing the signal into low and high frequency components. This section in focused on the description of the algorithm used for batter sizing. Therefore, the DWT is performed on the entire dataset at once. The flowchart in Figure 8 describes the logic of the algorithm. The inputs of the model are shown in Table 2. All the algorithms developed in the study were realized in the Python programming language. As shown in Figure 8, once the input data is acquired, the DWT is performed, and the recursive part of the algorithm begins and the procedure cycles through all the timesteps of the input data.
Energies 2021, 14, x FOR PEER REVIEW 11 of 33 battery sizing algorithm, presented in Section 3.2.1 and the battery management algorithm, shown in Section 3.2.2. The constraints on the ESS's operation are at times a significant bottleneck and cause the power output to the grid to change significantly. For this reason, the ESS and the smoothing algorithm have to be treated as a single system as will be explained in the following subsections.

DWT-Based Battery Operation Design Algorithm
The wavelet-based analysis is applied to the smoothing of a wind turbine's power output by firstly decomposing the signal into low and high frequency components. This section in focused on the description of the algorithm used for batter sizing. Therefore, the DWT is performed on the entire dataset at once. The flowchart in Figure 8 describes the logic of the algorithm. The inputs of the model are shown in Table 2. All the algorithms developed in the study were realized in the Python programming language. As shown in Figure 8, once the input data is acquired, the DWT is performed, and the recursive part of the algorithm begins and the procedure cycles through all the timesteps of the input data.  After the DWT of the power signal is calculated, the target smoothed power output is reconstructed considering the frequency threshold given by the selected level of decomposition. A higher level of wavelet decomposition will smooth out a larger portion of the signal, while a lower level will filter out fewer high frequency components. Possible neg- After the DWT of the power signal is calculated, the target smoothed power output is reconstructed considering the frequency threshold given by the selected level of decomposition. A higher level of wavelet decomposition will smooth out a larger portion of the signal, while a lower level will filter out fewer high frequency components. Possible negative values of the low-frequency component have also to be checked as they are physically wrong: these values are set equal to zero. Subsequently, a first use of the battery is made: a positive smoothing involves a discharge of the battery while a negative smoothing entails a charge of the battery as illustrated in Figure 9. ative values of the low-frequency component have also to be checked as they are physically wrong: these values are set equal to zero. Subsequently, a first use of the battery is made: a positive smoothing involves a discharge of the battery while a negative smoothing entails a charge of the battery as illustrated in Figure 9. The smoothed power resulted by the DWT is then checked for ramp rate violations. If no violation occurs, the power output is equal to the power smoothed by the DWT, and battery parameters are updated before the next timestep. If a ramp rate violation takes place, an additional smoothing step is required. It is readily noticeable that the algorithm needs to work in tight connection with the battery model as the battery is required to absorb the excess power, which can be easily computed as: To model real-world operation some constraints regarding the battery have to be introduced and will be detailed in the following section.

DWT-Based Real-Time Battery Control
The Discrete Wavelet Transform is typically used in many engineering applications for the analysis of acquired signals; this kind of approach perfectly fits the application where it is used to properly size a storage system based on either historic data, like those available in this study, or synthesized ones.
On the other hand, the present study aims at showing this method can be exploited for performing power smoothing in real time. To this end, however, the conventional method needs to be re-arranged. More specifically, it is commonly acknowledged that DWT exhibits problems of border distortion [42], i.e., inaccurate signal reconstruction is expected at the tails of the data fed to the DWT. This is of course an issue in a real-time application, where the value that needs to be handled at each timestep is exactly the last one in the series, without any future knowledge of the signal, placing the point of interest on the edge of the signal to be smoothed.
A simple and efficient approach to reduce signal discontinuities is the use of a symmetric extension method has been recently proposed in [43] and further expanded in the present study. In detail, if the goal is to calculate the real-time DWT of the signal in at certain time i, good results can be achieved by applying the DWT to a mowing window W_i symmetrically extended as follows: The smoothed power resulted by the DWT is then checked for ramp rate violations. If no violation occurs, the power output is equal to the power smoothed by the DWT, and battery parameters are updated before the next timestep. If a ramp rate violation takes place, an additional smoothing step is required. It is readily noticeable that the algorithm needs to work in tight connection with the battery model as the battery is required to absorb the excess power, which can be easily computed as: To model real-world operation some constraints regarding the battery have to be introduced and will be detailed in the following section.

DWT-Based Real-Time Battery Control
The Discrete Wavelet Transform is typically used in many engineering applications for the analysis of acquired signals; this kind of approach perfectly fits the application where it is used to properly size a storage system based on either historic data, like those available in this study, or synthesized ones.
On the other hand, the present study aims at showing this method can be exploited for performing power smoothing in real time. To this end, however, the conventional method needs to be re-arranged. More specifically, it is commonly acknowledged that DWT exhibits problems of border distortion [42], i.e., inaccurate signal reconstruction is expected at the tails of the data fed to the DWT. This is of course an issue in a real-time application, where the value that needs to be handled at each timestep is exactly the last one in the series, without any future knowledge of the signal, placing the point of interest on the edge of the signal to be smoothed.
A simple and efficient approach to reduce signal discontinuities is the use of a symmetric extension method has been recently proposed in [43] and further expanded in the present study. In detail, if the goal is to calculate the real-time DWT of the signal in at certain time i, good results can be achieved by applying the DWT to a mowing window W_i symmetrically extended as follows: In other words, the signal upon which the DWT will be performed is made of lw values before time i and ls mirrored values with respect to time i. Since the DWT is applied on a moving window of length lw+ls at each timestep, the choice of the lengths ls and lw becomes fundamental to reach high accuracy and acceptable computation time, especially important for an online tool. Considering the DWT implementation and operation as explained in [44,45], the required length of the symmetric window increases with the rise of the decomposition level, and also depends on the mother wavelet function itself. In addition, as it will be shown clearly in Section 4.5, increasing lw over a certain point does not add any information for the definition of the real-time value at the present timestep because of the multi-resolution properties (in time and frequency) of the wavelet transform. Indeed, unlike the Fourier transform, the wavelet analysis acts only close to the chosen timestep, with a range defined by the wavelet family features and decomposition level [31]. From another perspective, when increasing the level of decomposition, lower frequencies need to be approximated using the DWT, and therefore a longer window is needed. This proposed real-time method will often be referred to in the following parts of this study as "online" DWT, while when the DWT is performed on the entire dataset at once we will refer to it as "offline".

ESS Model
Lithium-Ion batteries were selected as the technology to be used in the HESS because of the high efficiency and resiliency to cyclic operations in comparison to other battery technologies [46]. The dynamic behavior of the batteries is neglected as Li-ion batteries have a very fast response time (within milliseconds), much shorter than the timestep assumed in the analysis (one minute). In order to obtain more realistic results, both operating constraints and battery degradation were accounted for, since it is well known that batteries tend to reduce their available capacity due to cyclic operation. Calendar or shelf aging was not considered in this study as the battery is continuously in operation and this aging mechanism only affects battery lifetime when the component is stored at a constant state of charge for prolonged periods of time.
State of Charge (SOC) is an expression of the residual battery capacity as a percentage of maximum capacity. To prevent quick battery degradation, SOC is always somehow limited by the control system, as very deep charge-discharge cycles are particularly damaging. In this study, the allowed variation range for SOC was between 0.15 and 0.95. Other characteristics to need to be monitored are the charge and discharge currents, which have to be limited to prevent battery damage. Within the framework of the present modeling approach, where the SOC range is restricted, voltage can be considered constant, and currents can be evaluated in terms of charge and discharge power (kW). As the current magnitude depends on the battery size, the "C-rate parameter" is defined as C-rate = Power (kW)/Capacity (kWh). High C-rates generate an increase of the battery working temperature, reducing efficiency and lifetime. Therefore, precautionary constant C-rates of 1 for the charge phase and 2 for the discharge phase are used to prevent any issues related to temperature operation and losses of performance [47]. Moreover, charging and discharging operations entail significant losses, which are quantified in terms of their respective efficiencies [48]. They are relative to different parameters, such as SOC and temperature. Assuming that the latter is constant given the constraints on C-rates, a non-linear behavior of the charge/discharge efficiencies in function of the SOC is taken into consideration to model in a more accurate way the battery operation. As shown in Figure 10, because of limitations due to the electrochemical processes, discharging (spontaneous reaction) is more efficient than charging (non-spontaneous reaction) [49]. State of Health (SOH) provides an indication of the aging of a battery compared to ideal conditions. SOH values are expressed as a percentage, where 100% corresponds to a new battery and 70% corresponds to a battery that needs to be replaced in this study. This latter value is in agreement with the common prescriptions that can be found in literature (e.g., [50]). It is important to note that SOC and SOH jointly influence battery operation. The residual charge in the battery at any given time and the C-rate can be expressed as: Therefore, as the battery ages, it might not be able to fulfill the operational requirements as both capacity and sustainable C-rates decline. The SOH of the battery is updated every 24 h accounting for battery ageing. In order to model the reduction of the maximum battery capacity caused by cyclic degradation, concepts from the field of fatigue are adapted to the present case. Battery lifetime is often estimated as the number of full charge-discharge cycles that the battery can sustain. In real-world applications however the charge-discharge profile is irregular and full cycles are rare. According to many engineering applications, the Rainflow cycle counting method is adopted to accurately identify cycles in an irregular battery SOC profile [51] and to obtain an equivalent set of constant-amplitude cycles that the battery has performed in the analyzed interval. The process is clearly explained in [52]. For each set of constant amplitude cycles the damage D caused on the battery can be calculated: where EOL_(Cycle_m) are the maximum cycles that the battery can tolerate at the given SOC, and N_m are the cycles the battery went through at the SOC. For each SOC, the cycles the battery can tolerate can be approximated with a battery specific Wöhler curve: The parameters A and B were estimated based on available data and literature. In particular, B= −1.5 which is a typical empirical value for this type of batteries also used by other authors in similar studies [4]. The constant A = 5200 is instead referred to the Samsung battery model with the main technical specifications reported in Table 3, being equal to the End of Life (EOL) cycle lifetime of 70%. In other words, after 5200 full cycles, the battery must be replaced because the relative capacity reaches 70% of the nominal capacity. State of Health (SOH) provides an indication of the aging of a battery compared to ideal conditions. SOH values are expressed as a percentage, where 100% corresponds to a new battery and 70% corresponds to a battery that needs to be replaced in this study. This latter value is in agreement with the common prescriptions that can be found in literature (e.g., [50]). It is important to note that SOC and SOH jointly influence battery operation. The residual charge in the battery at any given time and the C-rate can be expressed as: Therefore, as the battery ages, it might not be able to fulfill the operational requirements as both capacity and sustainable C-rates decline. The SOH of the battery is updated every 24 h accounting for battery ageing. In order to model the reduction of the maximum battery capacity caused by cyclic degradation, concepts from the field of fatigue are adapted to the present case. Battery lifetime is often estimated as the number of full charge-discharge cycles that the battery can sustain. In real-world applications however the charge-discharge profile is irregular and full cycles are rare. According to many engineering applications, the Rainflow cycle counting method is adopted to accurately identify cycles in an irregular battery SOC profile [51] and to obtain an equivalent set of constantamplitude cycles that the battery has performed in the analyzed interval. The process is clearly explained in [52]. For each set of constant amplitude cycles the damage D caused on the battery can be calculated: where EOL_(Cycle_m) are the maximum cycles that the battery can tolerate at the given SOC, and N_m are the cycles the battery went through at the SOC. For each SOC, the cycles the battery can tolerate can be approximated with a battery specific Wöhler curve: The parameters A and B were estimated based on available data and literature. In particular, B = −1.5 which is a typical empirical value for this type of batteries also used by other authors in similar studies [4]. The constant A = 5200 is instead referred to the Samsung battery model with the main technical specifications reported in Table 3, being equal to the End of Life (EOL) cycle lifetime of 70%. In other words, after 5200 full cycles, the battery must be replaced because the relative capacity reaches 70% of the nominal capacity.
The cumulative damage gives an indication of the amount of equivalent full cycles so that it is possible to evaluate the SOH of the battery, and consequently the reduction of available capacity due to the degradation, using the function given by the interpolation of battery datasheet: SOH(day(i)) = 2.404 * 10 −7 * 5200 D 2 − 7.019 * 10 −3 * (5200 D) + 100 (19) In particular, this equation derived by a second order interpolation among three points (n • cycles; SOH): (0; 100%), (3200, 80%), (5200, 70%).
It is important to notice that with the imposed limitations on C-rates and assuming controlled operating temperature, other charge or discharge power degradation mechanisms were here reasonably neglected.

Effects of Battery Constraints on the Wavelet Smoothing Algorithm
The effects of the introduced constraints on battery operation can now be explained. Indeed, to account for these battery-related limits, a SOC feedback strategy is a basic and important strategy to keep the SOC of BESS within its proper range while the BESS is smoothing out the fluctuations of the power signal [53]. Unlike other approaches that act directly on the SOC profiles [54], the control method developed in this study is applied directly to the wind power signal using the DWT. By doing so, the results of Section 4.2 will show that an alleviation of the battery operation stress around the SOC limits can be achieved and, by consequence, a more effective battery management. In particular, the algorithm behavior is different in charging mode (E_batt > 0) and discharging mode (E_batt < 0). Battery SOC is updated at every timestep as summarized in Table 4. The effects on power output are shown in Figure 11. Analyzing Figure 11, when the battery performance is limited by the C-rate or the SOC, the power output profile is forced to follow the red line. Therefore, depending on the battery capacity, it is possible that not all the ramp violations can be smoothed. For this reason, it is important to quantify the smoothing performance in connection with the battery capacity.

Conventional Power-Smoothing Methods for Benchmarking
In order to assess the potentiality of the proposed wavelet approach, it is here compared to two other conventional power smoothing methods. The methods are implemented similarly to the wavelet algorithm and can be conceptually illustrated as in Figure 8.
The first method is the "ramp rate shaving" approach, which directly smooths out the power when there is a ramp rate violation, i.e., the ramp rate is higher than the grid code limit. This approach does not operate a continuous smoothing, but the BESS is activated only during violation occurrences [4]. This is a simple way of providing the required smoothing, but it comes with non-negligible downsides, which will be shown in the following sections.
The other approach is the "simple moving average" (SMA) approach [55], which calculates the smooth power output at the current timestep as the average of the previous n timesteps [56]. If P wind (i) is the wind power at the timestep i, the approach can be expressed as: With this method, short-term averages (low n) respond quickly to changes in the power output, while long-term averages (high n) are slow to react. The battery operates continuously, storing or releasing the energy in accordance with the difference between the real wind power value and the smoothed one, predicted by the SMA. In case of ramp rate violation of the smoothed power profile, a second smoothing to respect the grid code requirement is necessary. This second smoothing is performed with the ramp rate shave method.

Cost Analysis
To the best of authors' knowledge, no clear regulations about economic benefits and penalties associated to wind-farm violation of the ramp rate limits are in place at the time of writing, at least in European countries. As a result, no indication on fees regarding grid code violations are indicated by the literature. Therefore, the requirements reported in Table 1 are currently only recommended. According to industry insiders, however, such mechanism will arise in the near future. In order to provide a quantification of the possible benefits introduced using the wavelet method for power smoothing, the authors decided to compare the overall cost of the storage system (i.e., capital cost for batteries and maintenance cost, in the form of battery replacement [57]) with that resulting from a storage management based on the conventional methods presented in Section 4.3. While not ideal, since this study is comparative, such an analysis can still provide meaningful information.
The cost analysis is done on a 20-year time window, which is a common windpark lifespan. According to published data, a typical battery and inverter system costs 300-350 €/kWh for large systems (>10 MWh) and 400-500 €/kWh for smaller systems [58]. In this case, considering the turbines' rated power, a unit price of 500 €/kWh is assumed. Additionally, the cost over the period must also consider the maintenance cost and, above all, the replacement times, i.e., the substitution due to the degradation during operation. For instance, a small battery, which has to satisfy higher charge-discharge cycles, tends to age faster than a bigger one. Subsequently, the management of the battery is fundamental in order to preserve it and reduce the degradation rate. Moreover, a maximum life expectancy of 10 years is considered for precautionary reasons as most suppliers suggest [59]. The cost of the battery directly depends on the capacity. Therefore, since the battery needs to be replaced during the wind turbine's lifetime, future capital costs need to be actualized using a discount and inflation rates. All the economic parameters are resumed in Table 5. The cost analysis is made in a differential way. This involves assuming that revenues and maintenance costs are equal for all of the power smoothing approaches. Therefore, only differential costs have to be accounted for, these are the capital costs related to initial battery purchase and replacement. Because SCADA data is available for a 4-year period only, this data is repeated until the 20-year limit is reached. The annual cost at year n is calculated as: The total cost over the WT lifetime is:

Sensitivity Analysis on the Wavelet Level Decomposition and Abatement Ratio
The wavelet smoothing power profile depends on the choice of the level of decomposition. To this end, a preliminary analysis was made to assess the best level to use for the present application. The main results are reported in Figure 12, where #1 represents Level 1 (i.e., one application of the DWT on the signal). Turbine WT1 was used as a reference in the rest of study.  The cost analysis is made in a differential way. This involves assuming that revenues and maintenance costs are equal for all of the power smoothing approaches. Therefore, only differential costs have to be accounted for, these are the capital costs related to initial battery purchase and replacement. Because SCADA data is available for a 4-year period only, this data is repeated until the 20-year limit is reached. The annual cost at year n is calculated as: The total cost over the WT lifetime is:

Sensitivity Analysis on the Wavelet Level Decomposition and Abatement Ratio
The wavelet smoothing power profile depends on the choice of the level of decomposition. To this end, a preliminary analysis was made to assess the best level to use for the present application. The main results are reported in Figure 12, where #1 represents Level 1 (i.e., one application of the DWT on the signal). Turbine WT1 was used as a reference in the rest of study. As expected, based on the nature of the wavelet transform, conceived to filter the high frequency components from the lower ones, it is apparent that the higher the order of the wavelet, the smoother the signal. For the limit investigated cases (levels from 1 to 7), a smoothing level equal to one does not smooth the signal (the processed signal nearly follows the raw wind power trend), whilst a level equal to seven creates a flat signal that cuts out all the fluctuations. The objective of the ESS however is not to completely levelout the turbine's power output but rather to smooth-out the high-frequency fluctuations. To select the appropriate level of decomposition, however, battery behavior and size have to be accounted for. In fact, selecting a higher level of smoothing means that more energy As expected, based on the nature of the wavelet transform, conceived to filter the high frequency components from the lower ones, it is apparent that the higher the order of the wavelet, the smoother the signal. For the limit investigated cases (levels from 1 to 7), a smoothing level equal to one does not smooth the signal (the processed signal nearly follows the raw wind power trend), whilst a level equal to seven creates a flat signal that cuts out all the fluctuations. The objective of the ESS however is not to completely level-out the turbine's power output but rather to smooth-out the high-frequency fluctuations. To select the appropriate level of decomposition, however, battery behavior and size have to be accounted for. In fact, selecting a higher level of smoothing means that more energy must be stored or released from the battery and, therefore, a bigger battery capacity is needed to satisfy the requirements. Consequently, the selection of the wavelet level decomposition is a trade-off between the abatement ratio, i.e., the effectiveness of ramp rate reduction, and the battery capacity, i.e., the ability to follow a specific power output profile at a reasonable cost. Figure 13 illustrates the abatement ratio as a function of the battery capacity for the seven wavelet decomposition levels discussed above. As expected, the curves present an asymptotic trend in dependency on the battery capacity, with higher-order Wavelet methods reaching smaller AR in case of small batteries, which are not able to store/release the amounts of energy needed to smooth out the original power production of the wind turbine. For the selected case study, if one sets a threshold for AR lower than 98%, the best performance (i.e., the lowest battery capacity able to guarantee such level of abatement) is given by level #2. On the other hand, if AR = 100% is requested, the Wavelet level #3 has to be preferred. Beyond the analysis of the pure frequency components that each decomposition level is able to deal with, it is also worth remembering that very high levels of decomposition not only implicate the requirement of a bigger capacity to reach a high abatement ratio, but also cause the absorbed or released theoretical power to be significant. In such cases the C-rate limits are a significant constraint and play a key role in limiting the smoothing effectiveness.
Energies 2021, 14, x FOR PEER REVIEW 19 of 33 must be stored or released from the battery and, therefore, a bigger battery capacity is needed to satisfy the requirements. Consequently, the selection of the wavelet level decomposition is a trade-off between the abatement ratio, i.e., the effectiveness of ramp rate reduction, and the battery capacity, i.e., the ability to follow a specific power output profile at a reasonable cost. Figure 13 illustrates the abatement ratio as a function of the battery capacity for the seven wavelet decomposition levels discussed above. As expected, the curves present an asymptotic trend in dependency on the battery capacity, with higher-order Wavelet methods reaching smaller AR in case of small batteries, which are not able to store/release the amounts of energy needed to smooth out the original power production of the wind turbine. For the selected case study, if one sets a threshold for AR lower than 98%, the best performance (i.e., the lowest battery capacity able to guarantee such level of abatement) is given by level #2. On the other hand, if AR = 100% is requested, the Wavelet level #3 has to be preferred. Beyond the analysis of the pure frequency components that each decomposition level is able to deal with, it is also worth remembering that very high levels of decomposition not only implicate the requirement of a bigger capacity to reach a high abatement ratio, but also cause the absorbed or released theoretical power to be significant. In such cases the C-rate limits are a significant constraint and play a key role in limiting the smoothing effectiveness. The multivariate analysis of Figure 13 showed that the choice of the decomposition level and the resulting system cost are strongly related to the selected Abatement Ratio that one wants to achieve for the system. The meaning of the AR threshold is apparent upon examination of Figure 14, which reports the PDF and CDF of the ramp rates managed by the system in case of abatement ratios of 0% and 90%, respectively. The multivariate analysis of Figure 13 showed that the choice of the decomposition level and the resulting system cost are strongly related to the selected Abatement Ratio that one wants to achieve for the system. The meaning of the AR threshold is apparent upon examination of Figure 14, which reports the PDF and CDF of the ramp rates managed by the system in case of abatement ratios of 0% and 90%, respectively. The PDF with 90% AR is narrower than the original one because most of the ramp rates are concentrated in the range of ±10%. In particular, the CDF indicates that an abatement ratio of 90% reduces the overall ramp violations from 22% to 2%. This means that with a battery with reasonable capacity and cost, it is possible to eliminate over 90% of the  The PDF with 90% AR is narrower than the original one because most of the ramp rates are concentrated in the range of ±10%. In particular, the CDF indicates that an abatement ratio of 90% reduces the overall ramp violations from 22% to 2%. This means that with a battery with reasonable capacity and cost, it is possible to eliminate over 90% of the ramp rate violations. In addition, no ramp-rate violations exceeding 63% rated power are recorded and even the ramp rate violations that exceed 20% are greatly reduced to a mere 1.6%.
Upon examination of the results in Figure 13, a Wavelet decomposition level of two was selected as the best compromise for the present application. As shown in figure, the optimal level of decomposition depends on the level of smoothing required, but also on the power output of the specific wind turbine or wind farm under consideration. In general, the optimal decomposition level can be determined using the proposed technique on historical data, if available. As discussed, if these latter are not available as in the case of new wind farms, synthetic power data can be derived combining anemometric measurements acquired during the wind farm planning with turbine performance curve. In addition to that, it could be possible also to find optimal level for different seasons using for example genetic algorithms as proposed in [19], but this additional study is out of scope of this paper. Furthermore, accounting for seasonal variation is not a trivial task as significant year-to-year variations can occur, and then very long time histories are needed to make the results significant.

Wavelet-Based Power Smoothing Performance against Conventional Methods
The smoothing capability of the Wavelet method (decomposition level #2) is compared to the conventional methods presented in Section 3.2. The ramp rate shave method is also targeted in the following as "Direct" approach since the smoothing is applied directly on the ramp rate violation. In addition, the optimal n for the Simple Moving Average has been selected as 20 by a sensitivity analysis. Figure 15 compares the Wavelet, the direct method, and the moving average in terms of AR vs. battery capacity. Upon examination of the figure, it is apparent that the wavelet shows by far the best performance, reaching for each battery capacity the highest abatement ratio. From another perspective, this means that, for a selected AR (e.g., 90%) the use of the Wavelet approach allows one to select the smallest battery capacity. This result is due to the benefits associated with the analysis of the power output as a signal. Indeed, high ramp rates are directly related to high frequency components, which can be effectively located and filtered by the wavelet transform. The direct smoothing method, instead, only activates the ESS when a ramp violation occurs: this lower use of the battery potentially reduces cyclic wear but, at the same time, the intermittent operation might force the battery to provide large power and energy transients, impacting the smoothing effectiveness. The moving average approach predicts every point based on the average of a given number of previously recorded data points. This approach, even if providing a smoother power profile, is not able to properly follow the power fluctuations. This result is due to the benefits associated with the analysis of the power output as a signal. Indeed, high ramp rates are directly related to high frequency components, which can be effectively located and filtered by the wavelet transform. The direct smoothing method, instead, only activates the ESS when a ramp violation occurs: this lower use of the battery potentially reduces cyclic wear but, at the same time, the intermittent operation might force the battery to provide large power and energy transients, impacting the smoothing effectiveness. The moving average approach predicts every point based on the average of a given number of previously recorded data points. This approach, even if providing a smoother power profile, is not able to properly follow the power fluctuations. In fact, the high wind variability implicates unexpected power variations, and a moving average approach cannot manage these occurrences, strongly cutting these peaks. This results in a more intense use of the battery and, in turn, higher degradation and less effective smoothing. In fact, a bigger battery is needed to have the same abatement ratio of the wavelet approach. These aspects can be further clarified analyzing the comparison of theoretical power smoothing profiles and delivered power to the grid presented in Figure 16a,b, respectively. This result is due to the benefits associated with the analysis of the power output as a signal. Indeed, high ramp rates are directly related to high frequency components, which can be effectively located and filtered by the wavelet transform. The direct smoothing method, instead, only activates the ESS when a ramp violation occurs: this lower use of the battery potentially reduces cyclic wear but, at the same time, the intermittent operation might force the battery to provide large power and energy transients, impacting the smoothing effectiveness. The moving average approach predicts every point based on the average of a given number of previously recorded data points. This approach, even if providing a smoother power profile, is not able to properly follow the power fluctuations. In fact, the high wind variability implicates unexpected power variations, and a moving average approach cannot manage these occurrences, strongly cutting these peaks. This results in a more intense use of the battery and, in turn, higher degradation and less effective smoothing. In fact, a bigger battery is needed to have the same abatement ratio of the wavelet approach. These aspects can be further clarified analyzing the comparison of theoretical power smoothing profiles and delivered power to the grid presented in Figure  16a,b, respectively.  The theoretical smoothing profiles (i.e., the ones coming from the purely mathematical application of the algorithms) for the three methods reported in Figure 16a show different fluctuations independently from the BESS constraints. The plots in Figure 16b instead show the smoothing effect on the real power profile delivered to the grid also accounting for the battery operating constraints. The wavelet timeseries remains quite regular and coherent with the trend of Figure 16a. On the other hand, the moving average requires a massive use of the battery and it is not able to follow the theoretical smoothing profile. This is due to the time-lag between the predicted smooth signal and the raw power output. This causes the available battery capacity to quickly dry up. Similar phenomena can be observed for the direct method, although battery operation in this case is sporadic, the battery can be called to provide only ramp-up (as observed around timestep 561,300) or ramp-down power compensation, therefore exhausting the available battery capacity. Once the battery is completely full or completely empty, no more smoothing can be provided and the power outputted to the grid closely resembles the raw power timeseries.
Consequently, the energy that flows in and out from the battery is very different for the three methods, as shown in Figure 17.
Moreover, it is apparent that the battery management provided by the wavelet approach is able to cope with fast and deep fluctuations as around timestep 561,300: in this case, it is the only one which allows for the high energy release requested by the power smoothing requirements. To further highlight the differences in battery operation imposed by the different methods, Figure 18 shows the SOC series for the three methods considering a battery with the same capacity (330 kWh) and the entire data history available from experiments. The discussed tendencies are even more apparent here, with the direct method implying variations of the SOC with high amplitudes, but lower frequency than the moving average approach, which seems to be the worst between the two methods, involving very high amplitudes and frequencies. In particular, one can notice that the SOC profile for the moving average approach provides a battery operation around minimum SOC, which is an extremely non-recommended condition. The wavelet method also has a quite high frequency of battery usage, but with much smaller variations of the SOC. To evaluate the difference more quantitatively, one can consider the mean percentage SOC variation between two consecutive timesteps as in Equation (23).
For wavelet SOC profile, the mean SOC variation results 64% lower than that of the Direct approach. This implies a better operation of the battery, particularly in terms of ramp rate management. High SOC variability means a worse regulation of power, and a lower capability of the system to manage unpredictable power variation. The theoretical smoothing profiles (i.e., the ones coming from the purely mathematical application of the algorithms) for the three methods reported in Figure 16a show different fluctuations independently from the BESS constraints. The plots in Figure 16b instead show the smoothing effect on the real power profile delivered to the grid also accounting for the battery operating constraints. The wavelet timeseries remains quite regular and coherent with the trend of Figure 16a. On the other hand, the moving average requires a massive use of the battery and it is not able to follow the theoretical smoothing profile. This is due to the time-lag between the predicted smooth signal and the raw power output. This causes the available battery capacity to quickly dry up. Similar phenomena can be observed for the direct method, although battery operation in this case is sporadic, the battery can be called to provide only ramp-up (as observed around timestep 561,300) or ramp-down power compensation, therefore exhausting the available battery capacity. Once the battery is completely full or completely empty, no more smoothing can be provided and the power outputted to the grid closely resembles the raw power timeseries.
Consequently, the energy that flows in and out from the battery is very different for the three methods, as shown in Figure 17. Moreover, it is apparent that the battery management provided by the wavelet approach is able to cope with fast and deep fluctuations as around timestep 561,300: in this case, it is the only one which allows for the high energy release requested by the power smoothing requirements. To further highlight the differences in battery operation imposed by the different methods, Figure 18 shows the SOC series for the three methods considering a battery with the same capacity (330 kWh) and the entire data history available from experiments. The discussed tendencies are even more apparent here, with the direct method implying variations of the SOC with high amplitudes, but lower frequency than the moving average approach, which seems to be the worst between the two methods, involving very high amplitudes and frequencies. In particular, one can notice that the SOC profile for the moving average approach provides a battery operation around minimum SOC, which is an extremely non-recommended condition. The wavelet method also has a quite high frequency of battery usage, but with much smaller variations of the SOC. To evaluate the difference more quantitatively, one can consider the mean percentage SOC variation between two consecutive timesteps as in Equation (23).
For wavelet SOC profile, the mean SOC variation results 64% lower than that of the Direct approach. This implies a better operation of the battery, particularly in terms of  Moreover, the degradation per cycle is higher according to the Wöhler curve. The wavelet approach, conversely, uses the battery continuously with charge/discharge micro-cycles, providing better operation. In particular, the use of the battery controlled by wavelet is almost continuous for almost the whole time, differently from the direct approach, which provides sporadic battery activation and consequently a worse control of battery operation with respect of ramp rate requirements. Table 6 shows the calculated mean value of the SOC and its standard deviation in the entire time frame covered by experiments: the main result is that wavelet approach is able to manage the battery at higher SOC so that efficiencies in charging and discharging mode are both optimized.
Similar conclusions can be drawn (Table 7) when comparing the SOC trends considering a battery capacity that allows one to reach the same abatement ratio (AR = 90%). In Moreover, the degradation per cycle is higher according to the Wöhler curve. The wavelet approach, conversely, uses the battery continuously with charge/discharge microcycles, providing better operation. In particular, the use of the battery controlled by wavelet is almost continuous for almost the whole time, differently from the direct approach, which provides sporadic battery activation and consequently a worse control of battery operation with respect of ramp rate requirements. Table 6 shows the calculated mean value of the SOC and its standard deviation in the entire time frame covered by experiments: the main result is that wavelet approach is able to manage the battery at higher SOC so that efficiencies in charging and discharging mode are both optimized. Similar conclusions can be drawn (Table 7) when comparing the SOC trends considering a battery capacity that allows one to reach the same abatement ratio (AR = 90%). In this case, the three methods need different battery capacities (larger for the conventional approaches, 330 kWh vs. 465 kWh from Figure 14); notwithstanding this, their battery operation is still featured by higher SOC variations (Figure 19, for the same time frames discussed before) in comparison to the wavelet approach, corroborating the higher efficiency of the latter in the management of the storage. It is also worth pointing out that the behavior of the BESS, in terms of SOC, is almost independent on the capacity and on the abatement ratio, while it is strictly conditioned by the power control approach.   As a conclusive analysis for this section, the methods compared in case of a single demonstrative turbine were also tested in case both available turbines are considered as served by a single battery, i.e., similarly to a small wind park. In this case, in fact, since the turbines barely work with the same exact wind, the ramp rates violations could be As a conclusive analysis for this section, the methods compared in case of a single demonstrative turbine were also tested in case both available turbines are considered as served by a single battery, i.e., similarly to a small wind park. In this case, in fact, since the turbines barely work with the same exact wind, the ramp rates violations could be either make more intense or, more often, partially shaved out. It is then worth assessing the type of benefit achievable with the proposed DWT approach also in this case.
As shown in Figure 20a, the wavelet-based power smoothing leads again to notable benefits in comparison with conventional approaches, favorably also managing the aforementioned mistuning of the wind fluctuations on the two turbines. Figure 20b and Table 8 instead report a comparison of the system performance in case a single accumulation system is used for both turbines or each turbine is served by a dedicated battery pack; the results refer to a 90% AR and wavelet-based battery management. In case of a combined management, the BESS system can be 35% smaller in comparison to that needed for a single turbine. Further analyses will be devoted at extending the analysis to a real wind turbine park, so to prove the industrial impact of these techniques.

Wavelet-Based Power Smoothing Economics against Conventional Methods
From an economic perspective, the main parameters that affect system cost are the battery capacity and the replacement times of the components. The main results are shown in Figure 21 and in Table 9.  For high abatement ratios (typical for this kind of application), the wavelet represents the best trade-off between performance and cost. This result is entirely related to the

Wavelet-Based Power Smoothing Economics against Conventional Methods
From an economic perspective, the main parameters that affect system cost are the battery capacity and the replacement times of the components. The main results are shown in Figure 21 and in Table 9.

Wavelet-Based Power Smoothing Economics against Conventional Methods
From an economic perspective, the main parameters that affect system cost are the battery capacity and the replacement times of the components. The main results are shown in Figure 21 and in Table 9.  For high abatement ratios (typical for this kind of application), the wavelet represents the best trade-off between performance and cost. This result is entirely related to the  For high abatement ratios (typical for this kind of application), the wavelet represents the best trade-off between performance and cost. This result is entirely related to the smaller capacity that the wavelet method requires for a given AR. The effect of the battery replacement time on total discounted system cost can be seen by analyzing the SOH of the system, which is shown in Figure 21 for the various smoothing methods. From Figure 22a, where the methods are compared with the same battery capacity, it is apparent how the SOH slope for the direct approach is lower than the other methods, due to the intermittent use of the battery. In terms of replacements, the moving average method is clearly the worst as only one battery replacement is needed for the first two methods, whilst two are required for the moving average approach. Very similar considerations can be made in case of Figure 22b where the methods are compared at the same AR. Again, the direct method guarantees lower battery degradation. As previously noted however, this effect is totally offset from an economic perspective by the smaller capacity that can be used with the wavelet approach.
worst as only one battery replacement is needed for the first two methods, whilst two are required for the moving average approach. Very similar considerations can be made in case of Figure 22b where the methods are compared at the same AR. Again, the direct method guarantees lower battery degradation. As previously noted however, this effect is totally offset from an economic perspective by the smaller capacity that can be used with the wavelet approach.
To complete the analysis, the upper chart in Figure 23 compares the trends of AR already discussed in Figure 20a with the specific cost needed to get one percentage point of this AR. As attended, the ability of the DWT of providing the higher AR for each battery capacity generally results in a lower specific cost. It is interesting to note, that an exception occurs for the lowest tested battery capacity, where the direct method provides a lower specific cost. The reason for this can be related to the number of battery replacements, shown in the lower chart of Figure 23: for the lowest capacity considered, also the wavelet approach would lead to two battery replacements. At this capacity the wavelet-based power smoothing still ensures an AR more than three times higher than the other two methods. As shown in the upper graph in Figure 23, this compensates partly for the extra replacement with respect to the direct method, as specific cost is only marginally higher than the direct method and much lower respect to the simple moving average. For low capacities, only the battery managed with a moving average approach needs to be replaced for more than two times. After 330 kWh, all methods lead to only one replacement. The results of Figure 23 agree with the discussed trends in terms of SOC and SOH profiles.  To complete the analysis, the upper chart in Figure 23 compares the trends of AR already discussed in Figure 20a with the specific cost needed to get one percentage point of this AR. As attended, the ability of the DWT of providing the higher AR for each battery capacity generally results in a lower specific cost. It is interesting to note, that an exception occurs for the lowest tested battery capacity, where the direct method provides a lower specific cost. The reason for this can be related to the number of battery replacements, shown in the lower chart of Figure 23: for the lowest capacity considered, also the wavelet approach would lead to two battery replacements. At this capacity the wavelet-based power smoothing still ensures an AR more than three times higher than the other two methods. As shown in the upper graph in Figure 23, this compensates partly for the extra replacement with respect to the direct method, as specific cost is only marginally higher than the direct method and much lower respect to the simple moving average. For low capacities, only the battery managed with a moving average approach needs to be replaced for more than two times. After 330 kWh, all methods lead to only one replacement. The results of Figure 23 agree with the discussed trends in terms of SOC and SOH profiles.

Effectiveness in Case of A Reduction of the Ramp Rate Requirements
In a future scenario, a higher penetration of wind energy in the grid is favorably seen and presently assumed as feasible [60]. To this end, especially in weak networks, a reduction of the maximum allowable ramp rate will be required. To explore the potential benefits of the use of the wavelet approach also in this scenario, simulations were repeated imposing a limit of on ramp rates violation per minute of 5%. The results are reported in Figure 24a. Upon examination of the trends, the same considerations seen for the 10% case are still valid, with the wavelet still being able to ensure the best performance thanks to the lower needed battery capacity and to the more efficient management of the power in the same.
Comparing now the 5% and 10% cases (Figure 24b), one can notice how the stricter limit on the ramp rates brings to an increase in battery size to reach the same abatement ratio. This is due to the higher energy flows that need to be managed by the system. On the other hand, the percentage increment of the capacity is fortunately not directly scalable with the limit. For instance, for an abatement ratio 90%, a reduction of the limit of 50% implies a battery capacity increase of only 10% (360 kWh vs. 330 kWh). This is in fact a

Effectiveness in Case of A Reduction of the Ramp Rate Requirements
In a future scenario, a higher penetration of wind energy in the grid is favorably seen and presently assumed as feasible [60]. To this end, especially in weak networks, a reduction of the maximum allowable ramp rate will be required. To explore the potential benefits of the use of the wavelet approach also in this scenario, simulations were repeated imposing a limit of on ramp rates violation per minute of 5%. The results are reported in Figure 24a.

Effectiveness in Case of A Reduction of the Ramp Rate Requirements
In a future scenario, a higher penetration of wind energy in the grid is favorably seen and presently assumed as feasible [60]. To this end, especially in weak networks, a reduction of the maximum allowable ramp rate will be required. To explore the potential benefits of the use of the wavelet approach also in this scenario, simulations were repeated imposing a limit of on ramp rates violation per minute of 5%. The results are reported in Figure 24a. Upon examination of the trends, the same considerations seen for the 10% case are still valid, with the wavelet still being able to ensure the best performance thanks to the lower needed battery capacity and to the more efficient management of the power in the same.
Comparing now the 5% and 10% cases (Figure 24b), one can notice how the stricter limit on the ramp rates brings to an increase in battery size to reach the same abatement ratio. This is due to the higher energy flows that need to be managed by the system. On the other hand, the percentage increment of the capacity is fortunately not directly scalable with the limit. For instance, for an abatement ratio 90%, a reduction of the limit of 50% implies a battery capacity increase of only 10% (360 kWh vs. 330 kWh). This is in fact a Upon examination of the trends, the same considerations seen for the 10% case are still valid, with the wavelet still being able to ensure the best performance thanks to the lower needed battery capacity and to the more efficient management of the power in the same.
Comparing now the 5% and 10% cases (Figure 24b), one can notice how the stricter limit on the ramp rates brings to an increase in battery size to reach the same abatement ratio. This is due to the higher energy flows that need to be managed by the system. On the other hand, the percentage increment of the capacity is fortunately not directly scalable with the limit. For instance, for an abatement ratio 90%, a reduction of the limit of 50% implies a battery capacity increase of only 10% (360 kWh vs. 330 kWh). This is in fact a key result, suggesting that even if a stricter threshold will be likely implemented in the future, the corresponding increments in battery size and cost will be moderate.

Wavelet-Based Power Smoothing Performance in Real-Time Operation
As discussed, the application of DWT directly for real-time control of a hybrid system is not straightforward. The effectiveness of the algorithm proposed in Section 3.2.2 is here discussed. To this end, a correct selection of the symmetric extension length ls and the moving window length lw for the real-time algorithm is key. Therefore, a sensitivity analysis has been carried out first. Considering results of the "offline" analysis, the same wavelet family "Db4", a level decomposition 2 and a 330-kWh battery capacity have been set. An obvious constraint is that lw cannot be lower than ls. The results are shown in Table 10. They show how no noticeable improvement is achieved by increasing lw and ls over 24. As attended, the AR tends to saturate for very small values of lw and ls, indicating that for this level of decomposition and wavelet family ("Db4" family at decomposition level 2), a very small amount of data beyond the eight-sample bin used for the transform is sufficient to efficiently operate the ESS. Based on the results of Table 10, a window length and a symmetric extension length of 24 samples were considered in the real-time algorithm. Real-time wavelet-based power smoothing performance has been then compared with the offline wavelet presented in previous sections and with conventional approaches (ramp rate shaving and moving average), which have an intrinsic online operation. In addition, a further version of the moving average, called "centered moving average" was also investigated. This makes use of the same proposal made for using the DTW, i.e., a mirroring of the last 24 samples.
The results are reported in Figure 25a in the usual form of abatement ratio vs. storage capacity. Upon examination of the figure, it is apparent that the wavelet-based method provides much better results than conventional approaches also when applied online for real-time control. The reasons behind this are again apparent from a perusal of Figure 25b, which confirms the discussed benefits in terms of battery management. With the proposed method, the SOC profile remains stabler than that with other methods, thus improving the smoothing efficiency and the decreasing battery aging. In particular, it is worth remarking that, even though quite simplified, the proposed methodology using the symmetric data extension proved to be efficient, obtaining comparable results than those of the offline wavelet; this is even more interesting since it is able to guarantee these results even without forecasting data. The results of this comparison are reported in Figure 26 in case of a battery capacity of 330 kWh. As shown in Figure 26a, the abatement ratio in comparison with the offline wavelet method is only 1.8% lower; the power fed into the grid has almost the same profile for a significant time interval for both the online and offline algorithms. In Figure 26b, the SOC of the BESS is also shown. The battery operation in real-time control mode is similar to offline mode; both profiles have the same trend and only the slightly higher mean SOC variation of the online wavelet as a consequence of a lower Abatement Ratio performance. As a final remark, the wavelet-based online method was evaluated in terms of computational efficiency. Analyses were made with a CPU with an Intel i7-1065G7 processor and 8 GB of RAM. A mean computational time of 2.3 × 10 −4 s for each iteration was measured. The order of magnitude is then very low in comparison with the control timescale of a minute. This result suggests the capability of the control algorithm to be applied for timescale of seconds and lower and thus proves that it is of industrial relevance.

Conclusions
In the study, the discrete wavelet transform (DWT) method was implemented in a Python script and applied to the power smoothing of multi-MW wind turbines installed onshore in a wind park on the Greek mainland, for which detailed experimental data on field were available. In addition, a model of the hybrid system was developed, including a Li-Ion battery model able to account for the main constraint posed by real-world operation of such systems, like limits on maximum and minimum SOC, variation in SOH due to cyclic aging, maximum charging/discharging rates, etc.
The developed model was then used to assess the capabilities of the DWT in comparison to more conventional methods like the direct ramp rate shaving and the simple moving average. More specifically, the scope of the comparison was twofold. As a final remark, the wavelet-based online method was evaluated in terms of computational efficiency. Analyses were made with a CPU with an Intel i7-1065G7 processor and 8 GB of RAM. A mean computational time of 2.3 × 10 −4 s for each iteration was measured. The order of magnitude is then very low in comparison with the control timescale of a minute. This result suggests the capability of the control algorithm to be applied for timescale of seconds and lower and thus proves that it is of industrial relevance.

Conclusions
In the study, the discrete wavelet transform (DWT) method was implemented in a Python script and applied to the power smoothing of multi-MW wind turbines installed onshore in a wind park on the Greek mainland, for which detailed experimental data on field were available. In addition, a model of the hybrid system was developed, including a Li-Ion battery model able to account for the main constraint posed by real-world operation of such systems, like limits on maximum and minimum SOC, variation in SOH due to cyclic aging, maximum charging/discharging rates, etc.
The developed model was then used to assess the capabilities of the DWT in comparison to more conventional methods like the direct ramp rate shaving and the simple moving average. More specifically, the scope of the comparison was twofold. As a final remark, the wavelet-based online method was evaluated in terms of computational efficiency. Analyses were made with a CPU with an Intel i7-1065G7 processor and 8 GB of RAM. A mean computational time of 2.3 × 10 −4 s for each iteration was measured. The order of magnitude is then very low in comparison with the control timescale of a minute. This result suggests the capability of the control algorithm to be applied for timescale of seconds and lower and thus proves that it is of industrial relevance.

Conclusions
In the study, the discrete wavelet transform (DWT) method was implemented in a Python script and applied to the power smoothing of multi-MW wind turbines installed onshore in a wind park on the Greek mainland, for which detailed experimental data on field were available. In addition, a model of the hybrid system was developed, including a Li-Ion battery model able to account for the main constraint posed by real-world operation of such systems, like limits on maximum and minimum SOC, variation in SOH due to cyclic aging, maximum charging/discharging rates, etc.
The developed model was then used to assess the capabilities of the DWT in comparison to more conventional methods like the direct ramp rate shaving and the simple moving average. More specifically, the scope of the comparison was twofold.
First, the historic power time series were used as a benchmark to study the performance of different battery sizes in dependence on the different power smoothing technique and the target smoothing capabilities. By doing so, it was shown that, when using the wavelet approach, the same smoothing performance, in terms of abatement ratio, can be achieved with a smaller battery capacity with respect to the other algorithms. This is due to unique capability of the wavelet transform to act as a filter bank that decomposes the signal and cuts a certain range of high frequency components. Since high ramp gradients are directly linked to high frequencies, this approach is able to smooth the power signal effectively. Moreover, the better management achievable with the wavelet approach leads to fewer battery replacements. As a result, at AR 90%, the benefit of the wavelet method is a reduction of the overall cost of the power smoothing system of about 28% in comparison with other approaches. Finally, it was shown that a reduction of the maximum ramp rate requirements (foreseeable in the future to enable a higher penetration of wind power in the grid energy mix) seems not bring to an excessive increase in costs (only +10% reducing the ramp rate limit from 10% to 5%). This is a very interesting prospect for weak grids, which will probably need such stricter limits. As a general remark, one should notice that the proposed approach can be of use in the design phase of any new hybrid system, once real data are replaced with synthetic ones coming from historic wind data combined with the performance characteristics of the turbines.
As a second step, a methodology to adapt the discrete wavelet transform for use as a real-time control algorithm of the hybrid system has been implemented. This has been achieved by a symmetric signal extension of a limited number of samples in order to avoid border issues; even if simple, this method proved to be effective and computationally efficient. The method was then compared to other techniques, now using the experimental database in a time-marching way. Again, the wavelet approach showed superior performance than other methods, ensuring higher abatement ratios for each battery size considered. The limited number of samples used allows for the algorithm to be very inexpensive computationally and thus suitable for real-world implementation. The potential impact of the application of DWT-based methods such as the one studied herein are significant. As shown in this work, wind turbine power output can be smoothed to the same effectiveness of other methods using smaller batteries, thus lowering upfront investment costs. Moreover, although not specifically assessed in this preliminary study, if and when grid code requirements such as the ones shown in Section 2.1 become mandatory for renewable energy power plants, efficient ESS management will be crucial to lowering overall LCOE. Future studies could further improve the method, e.g., by applying machine learning algorithms for the optimization of DWT decomposition level according to a predictive SOC allocation strategy.