A A A Synchronization in multi-sensor measurements: importance and methods Tyler Dare 1 The Pennsylvania State University P.O. Box 30 State College, PA 16804 ABSTRACT Measurement methods with multiple sensors are powerful tools in assessing and diagnosing noise. As sensor counts increase, the number of sensors can exceed the number of available channels in a single data acquisition system. In these cases, multiple data acquisition systems can be used, but synchronizing the sampling of each system is critical for an accurate measurement. In this tutorial, di ff erent methods of synchronization are discussed, along with the benefits and drawbacks of each. Additionally, methods of post-processing data to synchronize measurements are presented for use in cases where hardware-based synchronization is not feasible. 1. INTRODUCTION There are many measurement methods in noise control engineering that rely on simultaneous acquisition of multiple sensors. Common multi-sensor methods include – Sound intensity, requiring two microphones or a microphone and a particle velocity probe, – Modal analysis, requiring an instrumented hammer and several accelerometers, – Beamforming, acoustic cameras, and other microphone array methods, and – Transfer path analysis, in which there may be several monitoring sensors. Note that in most multi-sensor methods, phase information between sensors is required. Accurate measurement of phase requires that data from all sensors be acquired simultaneously. A data acquisition system (DAQ) can usually can be relied on to synchronize data from all sensors attached to it. However, there are some cases where multiple DAQs must be used, either because there are not enough channels for all sensors to use a single system or because certain sensors must be used with dedicated systems, such as high-speed cameras or laser vibrometers. In these cases, various methods of synchronization can be used to adjust signals so that phase-based techniques can still be used. If at all possible, it is strongly preferred to synchronize data acquisition systems using hardware. Systems are available with synchonization over ethernet [1] [2]. For other systems, a sample clock signal [3] and / or start trigger [4] from an external source can be connected. However, many portable analyzers [5] [6] and sound level meters are not designed with synchronization in mind. 1 tpd10@psu.edu a slaty. inter.noise 21-24 AUGUST SCOTTISH EVENT CAMPUS O ¥, ? GLASGOW 2. MISALIGNED SIGNALS One common issue when using multiple systems is that signals can be misaligned. In other words, one data acquisition system may begin its acquisition at a slightly di ff erent time than another system. Misalignment will usually happen whenever two systems are not linked in any electronic way, for example when two systems are “synchronized” by their operators attempting to press the start button at the same time. To get rid of misalignment, it is helpful to have the same signal acquired by both systems, or at least two similar signals that would be expected to be aligned in time. Consider one signal that is being acquired by two separate DAQs. In this example, DAQ A starts its measurement slightly earlier in time than DAQ B. DAQ B’s acquisition is delayed by T , as illustrated in Figure 1 (left). Note however that the two systems do not “know” the correct time, so the output of the two systems, as shown in Figure 1 (center), makes it appear that the feature in DAQ B arrives earlier than DAQ A, not later. If there is an impulsive signal acquired by both systems, it can be easy to shift one of the signals until they are aligned. Note, however, that signals can only be lined up to within one data point unless one of the signals is resampled as a post-processing step. For more complicated signals, an optimum shift of the signals can be performed using the cross- correlation. Cross-correlation can be thought of as a sliding dot product, where one signal is shifted one sample point at a time and the sum of the product of the shifted signal and the non-shifted signal is calculated for each shift. If the sampled signals are x n and y n , where n = 1 ... N denotes the sample point, then the cross-correlation for a shift of r points is [7] N − r X ˆ R xy ( r ) = 1 N − r n = 1 x n y n + r . (1) The shift that gives the best alignment of the two signals is that which corresponds to the maximum of the cross-correlation. Cross-correlation can be normalized by the root-mean-square of each signal to yield a value between -1 and 1. Cross-correlation tends to be more robust to noise in the signals compared to aligning signals based on their peaks or by eye. This method is also insensitive to scaling factors in the signals. The process of aligning two signals based on their cross-correlation is illustrated in Figure 1 (right). 1 1 1 DAQ A DAQ B Analog signal DAQ A DAQ B 0.8 0.8 0.8 0.6 0.6 0.6 Normalized cross-correlation 0.4 0.4 0.4 0.2 0.2 0.2 Signal Signal 0 0 0 -0.2 -0.2 -0.2 -0.4 -0.4 -0.4 -0.6 -0.6 -0.6 -0.8 -0.8 -0.8 -1 -1 -1 0 1 2 Time, s 0 0.5 1 1.5 Time, s -30 -20 -10 0 10 20 30 Lag, samples Figure 1: Left: DAQ B begins aquisition slightly after DAQ A. Center: Aligning samples makes it appear as though the signal reaches DAQ B earlier. Right: Cross-correlation used to identify how many samples the signals are misaligned by. When the two signals are periodic or nearly periodic, the cross-correlation will be periodic as well. The cross-correlation will then have peaks spaced every T · f s samples, where T is the period and f s is the sample rate. If periodic signals must be measured with two separate DAQ systems, it is often helpful to introduce an impulse or otherwise non-periodic signal into the system. For example, simply clapping next to microphones after starting the acquisition can provide enough information to synchronize the starting times of the DAQ systems. If there is an unused channels in each system, one of the best ways to align the systems is to split a signal from a white noise generator into both signals. Random noise is uncorrelated, so the cross-correlation will be near zero at every point except the correct shift. 3. UNSYNCHRONIZED SAMPLE CLOCKS In many cases, it will be obvious when signals are misaligned. A more subtle problem arises when two DAQ systems start at the same time, but sample at slightly di ff erent rates. Even though two systems sample at nominally the same rate, there is some uncertainty in their precise sample rate. Sample rate accuracies are typically on the order of 10–100 ppm [6] [8]. Therefore, for a nominal sample rate of 10000 Hz, the actual sample rate may be 9999–10001 Hz. Consider a sinusoidal signal at 100 Hz that is being sampled by two DAQ systems, each with a nominal sample rate of 10000 Hz. In reality, DAQ A samples at precisely 10000 Hz, but DAQ B samples at 9999 Hz. The analog signal and the resultant output are shown in Figure 2. Even though the two systems are measuring the same signal, the slightly slower sample rate in System B makes it appear that the measured signal is slightly higher in frequency. After a long enough measurement time, the two systems will drift in and out of phase. The e ff ect of unsynchronized sample clocks can also be illustrated with broadband signals. Consider a Gaussian random noise signal sampled by the two systems described above. As with the sine wave example, the response from the two systems drifts out of phase, as illustrated in Figure 3. The systems measure for 100 s and the frequency response function (FRF) and coherence between the two signals is measured, with the output of DAQ A as the reference and the output of DAQ B 1 1 Analog signal DAQ A, fs = 10000 Hz DAQ B, fs = 9999 Hz DAQ A, fs = 10000 Hz DAQ B, fs = 9999 Hz 0.5 0.5 Signal Signal 0 0 -0.5 -0.5 -1 -1 0 1 2 3 4 5 Time, s 10 -3 5 5.002 5.004 Time, s Figure 2: Left: analog signal sampled by two systems with slightly di ff erent sample rates. Right: output after 5 s, with the two DAQ systems appearing out-of-phase. as the response. The FRF magnitude and phase and the coherence are shown in Figure 3. Since the underlying analog signal is the same for the two systems, an ideal result would be an FRF of unit magnitide and zero phase and a coherence of 1 across all frequencies. Instead, the FRF magnitude and phase approach a noise floor at frequencies above 100 Hz. This roll-o ff frequency will change depending on the window length of the FRF estimate. Because the relationship between the input and output changes as a function of time, the coherence is degraded. 4 4 DAQ A, fs = 10000 Hz DAQ B, fs = 9999 Hz DAQ A, fs = 10000 Hz DAQ B, fs = 9999 Hz 2 2 Signal Signal 0 0 -2 -2 -4 -4 0 1 2 3 4 5 Time, s 10 -3 1 1.001 1.002 1.003 1.004 Time, s Figure 3: Left: Analog broadband signal sampled by two systems with slightly di ff erent sample rates. Right: Output after 1 s, with the two DAQ systems appearing out-of-phase. 10 1 1 180 0.8 90 10 0 FRF phase, deg. FRF magnitude 0.6 Coherence 0 0.4 10 -1 -90 0.2 -180 10 -2 0 10 0 10 1 10 2 10 3 10 4 10 0 10 1 10 2 10 3 10 4 10 0 10 1 10 2 10 3 10 4 Frequency, Hz Frequency, Hz Frequency, Hz Figure 4: Frequency response function magnitude (left), frequency response function phase (center), and coherence (right) of signals from Figure 3. 4. SYNCHRONIZATION THROUGH SIGNAL PROCESSING In cases where it is not possible to use a shared sample clock for the two systems, some improvement can be made through post-processing. A general method is 1. Select a signal on each system for which the underlying analog signal is as similar as possible. 2. Resample one signal to match the other. 3. Shift the resampled signals in time such that the start times are aligned using cross-correlation, as described above. 4.1. Selecting reference signals For each data acquisition system that needs to be synchronized, select one signal. The ideal signal is random noise from a function generator that has been passed into each system. If it is not possible to have an external noise source due to channel count limitations or because the data has already been acquired, select signals that would be expected to be coherent. For example, choose sensors on each system that are close physically and measure the same phenomenon. Avoid choosing sensors that move relative to each other or cases where the source is moving, since Doppler shifts will a ff ect coherence measurements. After selecting a signal on each system, arbitrarily call one of these signals the “reference” signal. For the following discussion, consider signals from systems A and B, where we have measured x A ( t ) and x B ( t ) and want to resample data from system B to be synchronized with system A. 4.2. Fourier resampling Resampling is accomplished through Fourier resampling, in which the linear spectrum of a signal is used to interpolate between data points. The precise details of the resampling depends on the number of points N in the original signal and the desired number of points M in the resampled signal. 1. if M > N , then points must be added to make the signal longer. (a) Compute the linear spectrum of the original signal, X O , with the zero frequency point at the beginning of the spectrum and the Nyquist frequency point approximately in the middle of the spectrum. (b) If N is odd, then insert M − N zeros into X O between the two points on opposite sides of the Nyquist frequency. (c) If N is even, then split the point at the Nyquist frequency in X O in half and insert M − N − 1 zeros between these two points. 2. If M < N , then points must be removed to make the signal shorter. (a) Low-pass filter x O with an 8th order low-pass Butterworth filter, with cuto ff frequency of 0 . 6 M N f s . This step ensures that removing points does not cause aliasing issues in the resulting signal. (b) Compute the linear spectreum of the filtered signal, X O , with the zero frequency point at the beginning of the spectrum and the Nyquist frequency point approximately in the middle of the spectrum. (c) Remove N − M points from X O , starting with the Nyquest frequency point and adjacent points. 3. Adjust the amplitude of the resampled linear spectrum to match the amplitude of the original signal by multiplying by N M . 4. Compute the resampled signal, x R , by taking the inverse discrete Fourier transform of the resampled linear spectrum. 5. After resampling, truncate either the resampled signal or the reference signal so that they are the same length. An example of the resampling process is shown in Figure 5. The original signal (blue circles) was sampled at 20 Hz for 2.25 s, or 45 samples. The signal was then upsampled to 20.9 Hz by inserting 2 samples into the center of the linear spectrum, so that the resampled signal (red) is 47 samples long but still lasts for 2.25 s. 2 Linear spectrum, V s Original Resampled 0.6 Original Resampled 1.5 0.4 0.2 1 0 0.5 -0.2 0 5 10 15 20 Frequency, Hz Signal, V 0 1 Linear spectrum, V s -0.5 Original Resampled 0.5 -1 0 -1.5 -0.5 -1 -2 0 5 10 15 20 Frequency, Hz 0 0.5 1 1.5 2 Time, s Figure 5: Left: Original signal and resampled signals. Right: Real (top) and imaginary (bottom) parts of linear spectra. Notice two zero-valued points inserted near the new Nyquist frequency of 10.4 Hz. The optimal resampling is then found by adding or removing points from the x B until the average coherence between x A and x B is maximized. For broadband signals, simply taking the average coherence across the entire frequency range is a good metric. For tonal signals, the average coherence at the frequency points of interest may perform better. An example of the average coherence as a function of the number of points added or removed is shown in Figure 6. With an original sample length of 30 s, the best coherence is found by adding 30 samples to x B , meaning the sample rate needed to be increased by 0.01% to match x A . 1 0.8 Average coherence 0.6 0.4 0.2 0 -50 -40 -30 -20 -10 0 10 20 30 40 50 Points added to x B Figure 6: Average coherence between the two signals in Figure 3 with di ff erent amounts of resampling. Points are added or removed from x B until the coherence with x A is maximized. After the optimal resampling and alignment have been found, all other channels in DAQ B are resampled by adding or removing and then shifting by the same number of points as the was done with the reference signal. 5. CONCLUSIONS Methods were presented to synchronize data acquisition systems. Synchronization in terms of both start time and sample clock is necessary for common phase-based measurement techniques. It is preferrable to synchronize via hardware where possible, but in cases where hardware synchronization is not feasible, improvements can be made using cross-correlation and Fourier based resampling. REFERENCES [1] Pacific Instruments. Model 6010U Enclosure, 4-slot, USB Data & Control Interface. Specification sheet, 2022. [2] National Instruments. cDAQ -9185 4-Slot, Extended Temperature, Ethernet CompactDAQ Chassis, 2017. [3] Stanford Research Systems. MODEL DS 345 Synthesized Function Generator, 2016. [4] Vision Research. PHANTOM v2512 / v2012, 2021. [5] Brüel & Kjær. PHOTON + dynamic signal analyzer system data, 2016. [6] Crystal Instruments. CoCo-80X / 90X Handheld Analyzers, 2022. [7] Allan G. Bendat, Julius S.; Piersol. Random Data . John Wiley & Sons, Inc., second edition, 1986. [8] National Instruments. NI USB-443x Specifications, 2011. Previous Paper 238 of 769 Next