Fast Dynamic Time Warping for Temperature Compensation in Guided Waves

The paper discusses Structural Health Monitoring (SHM) based on ultrasonic guided waves for damage detection in structures. Guided waves allow inspection over long distances and inaccessible features, but are also sensitive to changes in environmental and operating conditions (EOC). The focus of this paper is on temperature compensation methods for guided waves. The compensation techniques include Baseline Signal Stretch (BSS), Optimal Baseline Selection (OBS), OBS+BSS, and Dynamic Time-Warping (DTW). In particular, a new, fast approximation of DTW is evaluated and compared with conventional but computationally expensive DTW. The FDTW algorithm utilizes a multilevel approach inspired by graph bisection principles to achieve precise warping path determination with linear computational complexity. The study evaluates the compensation performance of FDTW using a single baseline at a single temperature, thus addressing the complexity and inaccessibility issues of obtaining an extensive database of baseline signals in practical applications. The Open Guided Wave (OGW) dataset is employed for a fair comparison with other compensation methods. Results indicate that FDTW performs well, demonstrating comparable warping performance to DTW but with significantly reduced computational complexity. The analysis also includes comparisons with BSS, OBS+BSS, and DTW across a range of temperatures, highlighting the effectiveness of FDTW in mitigating errors introduced by larger temperature variations.


Introduction
The detection of damages in Structural Health Monitoring (SHM) based on ultrasonic guided waves, involves the permanent placement of sensors on the structure.This method offers significant advantages over traditional Non-Destructive Testing (NDT) methods, since it enables inspection of structures over long distances and of features that are not physically accessible [1].The sensors provide repeated measurements that aid in damage detection, utilizing signals acquired when the structure is assumed to be in a pristine condition, referred to as baseline signals.
Guided waves exhibit high sensitivity to both damages and changes in Environmental and Operating Conditions (EOC) [2], with temperature variations being particularly important.Efficient temperature compensation methods are crucial before comparing the measured signal to the baseline signal.This paper discusses several compensation techniques, including Baseline Signal Stretch (BSS) [3], Optimal Baseline Selection (OBS), OBS+BSS [4], and Dynamic Time-Warping (DTW) [5].Although DTW outperforms the other compensation methods, its computational complexity restricts practical use.The quadratic time complexity of DTW makes it impractical for long time sequences, contradicting the inherent advantage of long-distance propagation in guided waves for SHM.In practical use, due to the complexity and inaccessibility of the structure, it is also often not feasible to have multiple baselines under controlled EOC.
In this paper, we will analyze the compensation performance of a new, approximate version of DTW called Fast Dynamic Time Warping (FDTW) [6], using a single baseline at a single temperature.To ensure an unbiased and fair comparison, we will use a dataset provided by the Open Guide Wave (OGW) platform [7].

Principles and methods
In a guided waves SHM system, a group of sensors is strategically attached to minimize the number needed for inspecting the entire structure.One sensor is used as a transmitter, to induce vibrations in the structure, and these vibrations are then recorded by other attached transducers.This configuration is referred to as the pitch-catch mode, and the monitoring technique involving induced vibrations is termed active SHM.
In the baseline method, a reference signal is obtained when the structure is in an undamaged state and under controlled EOC.This baseline serves as a benchmark for comparing signals acquired during the operational phase.
A challenge with guided waves, known for their high sensitivity to damages and material changes [5], is that they are also sensitive to variations in EOC, where changes in temperature emerges as a dominant factor.Temperature fluctuations result in changes of Young's modulus of the material, influencing both group velocity (resulting in a stretch-like effect) and phase velocity changing the shape of wave packets) [4].While most compensation techniques primarily address changes in group velocity, they often overlook the effect of phase velocity variations.As a result, their performance deteriorates when the assumption that the temperature results in a stretch-like waveform distortion only no longer holds.

Temperature compensation methods
Numerous compensation strategies, such as DTW, OBS+BSS, and BSS, have been studied in the literature.This section offers a brief summary of the techniques used in this study before turning to FDTW as a temperature compensation technique.For more details, the reader is referred to the references given to the original methods.

BSS
The BSS is an approximate model which assumes that a uniform temperature change stretches the signal, while neglecting the alteration in the shape of the wave packet.It employs only one baseline and estimates the stretch factor β to compensate for effect of temperature.This approach models the change in temperature as where   () is the baseline signal and  ̂() represents the aligned baseline signal with a stretch factor of β.
To find optimal stretch factor  ̂ , we select value of β that minimizes the mean square error between the original baseline and the stretched baseline signal, as In multimode waves and dispersive propagation, a single stretch factor β cannot compensate for the temperature effect.This causes the stretch-based assumption to fail when the temperature variations are large.Poor temperature compensation introduces baseline suppression errors that sometimes mask critical damage information.

OBS+BSS
Before going into the combination of OBS and BSS, referred to as OBS+BSS, let us first have a look at OBS in isolation.The idea with OBS is to use multiple of baselines (m), acquired at different temperatures, and to compensate for the temperature changes by optimally selecting one of the previously stored baseline references.The performance of OBS relies heavily upon the resolution at which the baselines are recorded.
To find the optimal baseline for the measured signal () from the set of baselines, the criteria used to define the similarity is mean square error, where the baseline index,  ̂ is found minimizing the MSE, as according to above criterion the baseline with minimum mean square deviation is selected as optimal baseline signal, where  ̂ is the index of the baseline,   (;   ̂), that best matches the measured signal ().This selection is done under the assumption that changes due to damage being much smaller that the changes induced by the temperature.
The performance of OBS is limited by the number of baselines that have been acquired.In the absence of very densely recorded baselines this can result in poor agreement between the measured signal and the selected baseline.This, in turn, results in errors potentially masking defect signatures.To compensate for this shortcoming, the selected baseline is then adjusted using BSS.This method is referred to as OBS+BSS temperature compensation.OBS+BSS can perform well for wide range of temperatures, provided that a library of multiple baseline measurements can be acquired at controlled EOC.This is not always practical and will therefore limit the applicability of OBS and consequently, the performance of OBS+BSS.

DTW
In DTW, we do not assume uniform stretching to align the two signals.Instead, a warping path based on local stretching and compression is calculated.Following the notation in [5], DTW is implemented by: 1) Creation of local cost matrix, 2) formulation of global cost to form a global cost matrix, 3) determination of the warping path (W) using backtracking, and 4) and finally, alignment of the signal using warping path.
Given two time-series,  and , as formulation of local matrix and global cost can be done using many distance metrics.We will now describe the functions used in this paper.
The local cost matrix is defined as where   is the local cost matrix of size ( * ), (  ,   ) is the Euclidean distance between i th element in sequence  and the j th element in the sequence .
The global cost matrix is defined as To initiate and terminate the iterative DTW algorithm, some boundary conditions are required.The boundary conditions chosen in this paper are: which means the first sample from  is linked to the first sample from .More samples of  may be mapped to the first element of , but it indicates a starting point of the warping path.
The other boundary condition is at the other end of the sequences, forcing the last sample of  to be linked to the last sample of , as Again, this is not the only potential link to the last sample, but it will determine a unique end point of the warping path.
Upon completion of the mapping between the sequences.the warping path W is given by where k is the length of the warping path.
The optimal warping path is the path that minimizes the distance Dist(W) defined as: The construction of the cost has a computational complexity of ( 2 ), when both signals are of equal length .However, considering that temperature shifts typically affect only a few data points, creating the entire cost matrix of size  2 is not required.Furthermore, this can lead to overfitting of the signal, which can hide valuable damage information.This led to the development of the approximate algorithm, known as the Fast DTW (FDTW), which is described in the next section.

FDTW
The FDTW algorithm employs a multilevel strategy inspired by the principles of graph bisection.In graph bisection, the goal is to partition a graph into roughly equal segments.FDTW's multilevel approach is initiated by determining an optimal solution for a small graph and then iteratively extending and improving this solution for larger instances.By this multilevel strategy, FDTW effectively addresses the quadratic complexity problem of standard DTW, achieving precise warping path determination with linear computational complexity, both in time and space (memory requirements).
Below follows a brief description of the steps involved in the FDTW algorithm.

Algorithm
The FDTW algorithm uses a multilevel approach with three key operations: 1) Coarsening: Shrink a time series into a smaller time series that represents the same curve as accurately as possible with fewer data points.Reduction is done by averaging the adjacent pair of points, resulting a time series half the resolution of original time series.
Coarsening is performed several times until resulting time series is in range of  (called radius default is 2) resulting many different resolution of time series.Warping path is calculated for the lowest resolution.Below is the pseudo code for the coarsening operation.
2) Projection: It takes a warp path calculated at a lower resolution and determines what cells in the next higher resolution time series the warp path passes through.Since the resolution is increasing by a factor of two, a single point in the low-resolution warp path will map to at least four points at the higher resolution.
3) Refinement: Refinement finds the optimal warp path in the neighborhood of the projected path, where the size of the neighborhood is controlled by the radius parameter r.
These three operations are iterated through all the time series until the optimal warp path for full length time series is achieved.
If both series of equal length the complexity in the worst-case scenario is FDTW space Complexity = ((4 + 7)), where  is the radius, and  is the length of vectors.

OGW dataset
Analyzing the performance of various compensation techniques presents challenges due to variations in geometry, material properties, experimental design, and environmental conditions during experiments.To facilitate a fair comparison, we propose testing our FDTW temperature compensation algorithm on a pre-existing, published, and validated dataset.This approach The OGW dataset [7] contains measurements conducted with a range of frequencies, from 40 kHz up to 260 kHz.In this work, we have used the subset of data collected with the 260 kHz transducer, operating in a pitch catch mode, where transducer 4 serving as a pitch and transducer 10 as catch.A 5-cycle Hann-windowed sine wave with an excitation signal of ±100 V was applied to transducer 4. The resulting signal from transducer 10 was then amplified, digitized, and recorded for a duration of 1300 µs.During experimentation, the structure underwent temperature exposure ranging from 20 °C to 60 °C in increments of 0.5 °C.At 260 kHz in Carbon Fiber Reinforced Polymers (CFRP), strong attenuation is observed, leading to a loss of signal beyond 500 µs.To streamline processing and limit noise, we set a limit in our analysis to the first 500 µs of the signals.

Warping performance of FDTW
To evaluate the warping performance, we used the signal collected at 40 °C as the baseline and the signal at 25 °C as the measured signal, as illustrated in Fig. 1(a).Due to difficulty in inferring any changes from the figure alone, for a clearer visualization of the temperature effects throughout the paper, we will present results in plot within the time range of 180 µs to 320 µs as shown in the Fig. 1(b).A compression like effect is observed in the measured signal with respect to the baseline signal.
Fig. 2 illustrates the results of the FDTW process.In Fig. 2(a), the baseline signal at 40 ℃ and the measured signal at 25 ℃ are presented.The warping path is calculated using FDTW algorithm with the radius parameter  set to 20 timestamps.Using the warping path, a new aligned baseline signal is created remapping all the timestamps according to the calculated warping path.The baseline signal is now aligned with the measured signal, compensating for the compression effect.Consequently, the phase of the baseline signal perfectly aligns with the measured signal at 25 ℃.Notably, FDTW preserves the magnitude of the signal, aligning with the fundamental assumption of SHM that defects influence amplitude across the time trace.In the following sections we will provide a more extensive comparison of the performance of FDTW with other compensation methods.

BSS
The BSS single baseline approximation-based model encounters challenges in cases of significant temperature variations.Fig. 3 illustrates this effect with baseline signal at 40 ℃, and two measured signals at 25 ℃ shown in Fig. 3(a), and at 20 ℃ in Fig. 3(c).The estimation of the optimal stretch parameter β is based on Eq. ( 2), minimizing the mean-squared error between the aligned baseline signal and the measured signal.As demonstrated in Fig. 3(d), however, that BSS fails to align the baseline signal to the measured signal when the temperature difference is too large.To evaluate the warping performance, we introduce the measure AbsoluteError(t) defined as Fig. 4 shows the comparison of the warping performance using the () in Eq. ( 14), for the BSS and FDTW methods, respectively.The performance of FDTW is very good across all time stamps except between 210 µs and 290 µs.In this interval, the FDTW Error is comparable to that of BSS.This is because the measured signal has large amplitude variations in this interval, causing a large error even for minor phase shifts.A good compensation that does affect the damage detection performance should only compensate for phase change not for the amplitude variations.To have better understanding of warping performance across range of temperature we have define Absolute Error Sum (AES), defined as Fig. 5(a) shows the optimal β for the full temperature range, with the baseline signal taken at 40 ℃.For the baseline, the resulting stretch factor  = 1, meaning no compression or dilation.A value of  < 1 signifies a compression of the baseline, while  > 1 signifies a dilation of the baseline.For measured signals at 22 ℃ and below, the estimated β makes a jump from slightly below 1 to above 1, leading to a stretch of the baseline signal instead of compression.This is due to the fact that the stretch causes the signal to skip an entire cycle.Consequently, the AES increases rapidly when this happens.Similarly, the opposite effect is observed for temperatures at 56 ℃ and above, again causing the AES to increase, as shown in Fig. 5(b).
Above 22 ℃ and below 56 ℃, the AES increases more or less linearly as we move away from the baseline temperature.

OBS+BSS
In In Fig. 6(a) for temperature below 31 ℃ the value of optimal β is the dilation of first baseline at 20 ℃, for temperature between 31 ℃ to 50 ℃ optimal β is the compression and the dilation of second baseline at 40 ℃ and for temperature above 50 ℃ optimal β is compression of the third baseline at 60 ℃.In Fig. 6(b), the AES is depicted across temperatures, from 31 ℃ to 50 ℃ where the second baseline is employed AES is same as the BSS method.However, due integration of multiple baselines the OBS contribute to a decrease in AES outside the range of 31 ℃ to 50 ℃ due to baseline switching.

DTW
In DTW the optimal warping path is selected using minimum distance Dist(W) defined in Eq. (11).Using optimal warpath new temperature compensated aligned baseline signal is created for measured signal at 25 ℃.Both DTW and FDTW demonstrate excellent warping performance across all timestamps, as illustrated in Fig. 8, where the error plots overlap consistently.The degree of overlap is evident in the AES values 3.27 for DTW and 3.39 for FDTW.This suggests that same compensation performance can be achieved using FDTW.

Warping performance vs temperature
The temperature compensation performance across a range of temperatures is depicted in Fig. 9.The AES for BSS, OBS+BSS, DTW, and FDTW is illustrated.BSS exhibits effective performance only within a specific temperature range near the baseline.OBS+BSS performance relies on the resolution of the recorded baseline, leading to a rapid increase in AES as we deviate from the baseline temperature.We are single baseline methods, it's noteworthy that even though OBS+BSS utilizes three baselines, both DTW and FDTW continue to outperform OBS+BSS.Notably, FDTW demonstrates nearly identical performance to DTW across all temperatures, offering the advantage of introducing minimal variation with increasing temperature.

Conclusions
In this paper, we introduced FDTW as a novel approach for temperature compensation in guided wave systems.We conducted a comprehensive analysis, comparing its performance with existing methods such as BSS, OBS+BSS, and DTW.While DTW emerges as the topperforming method, its ( 2 ) complexity poses limitations, particularly hindering the full utilization in application of guided waves over long-distance propagation.Remarkably, FDTW exhibits performance very similar to DTW but with a complexity of approximately (), offering nearly linear complexity in both time and space.

X: a
Time Series of length N Y: a Time Series of length M minTSsize = radius+1 TimeSeries shrunkX = X.reduceByHalf()TimeSeries shrunkY = Y.reduceByHalf() IF N≤minTSsize OR M≤minTSsize) Dist,Path=DTW(X, Y) window = ExpandedResWindow(lowResPath, X, Y, radius) Dist.path=DTW(X,Y, window) ensures a fair evaluation by mitigating the influence of diverse experimental factors on the assessment of compensation technique.

Fig. 7 (
a) shows baseline signal and the measured signal.Temperature compensated aligned baseline signal using DTW and measured signal are shown in Fig. 7(b), as seen in Figure both signals are properly aligned.

Fig. 8 Absolute
Fig. 8 Absolute Error signal for DTW aligned signal and FDTW aligned signal at 25 ℃.
this paper we are using single baseline compensation methods, to see how DTW and FDTW performs if we have multiple baselines can we still outperform OBS+BSS.Performance of BSS depends upon selection of   in Eq. (3).We have set  0 = 20 ℃ and   = 20 ℃ resulting in 3 of baselines,   (;  20 ,  40 ,  60 ).