Technical Note · Signal Processing
Real-Time Digital Resampling in Vibration Control
How a controller turns one fixed converter rate into every rate a test needs, what separates good resampling from bad, and why doing it in real time is the hard part.
Key takeaways
- Resampling converts a stream of samples from one rate to another. Done properly, it gives, to within the filter's ripple and stop-band depth, the same result as digitizing at the new rate through an ideal anti-alias filter.
- With real-time resampling, a controller can digitize once, at a fixed high rate behind a fixed analog filter, and then produce every rate it needs: test bandwidths, several simultaneous streams, and order-domain data that follow a changing frequency.
- Doing it badly is easy. Dropping samples aliases; simple interpolation applied directly to the samples adds distortion far above the noise floor of a 24-bit system.
- Doing it well takes long, carefully designed filters on every channel, running continuously with no gaps and a known delay. Multi-stage designs and dedicated FPGA and DSP hardware make that practical.
- Panther's digital resampling uses a floating-point resample ratio, not just integer ratios. With FPGA and DSP decimation it supports multiple data streams at independent sample rates, and Panther Sine tracks the sample rate digitally to follow the drive.
One converter rate, many useful rates
A vibration controller needs data at many different rates. A random test at 2,000 Hz wants about 5,120 samples per second. A low-frequency test at 50 Hz with fine resolution wants far fewer. A shock pulse wants the highest rate available. A sine sweep is measured best at a constant number of samples per cycle, a rate that changes continuously. And a lab often wants two of these at once: a control stream, plus a wider-band stream to watch for problems or to record.
The converters, however, are best run at one fixed rate. A fixed rate lets the analog anti-alias filter be fixed, which is what gives it deep rejection and close phase match between channels. Changing the converter clock instead brings back all the problems of analog tracking described in Digital Tracking Sampling in Sine Vibration Control.
Real-time digital resampling resolves the conflict. The analog front end runs at a single rate, and everything after it is produced digitally, at whatever rate each part of the test needs (Figure 1).
Kinds of sample-rate change
All sample-rate changes rebuild the underlying continuous signal mathematically and then sample it again at new instants. They differ in how the new instants relate to the old ones, and that sets how hard they are (Table 1).
| Kind | Ratio | Typical use in vibration work | Main difficulty |
|---|---|---|---|
| Decimation | Integer reduction (÷2, ÷4, ÷8 …) | Lower bandwidth and finer resolution from a high-rate converter | Alias rejection before samples are discarded |
| Interpolation | Integer increase (×2, ×4 …) | Bringing a drive signal up to the DAC rate | Image rejection: removing copies of the spectrum |
| Rational | L/M | Matching two fixed rates, such as a recorded file and the system | Both of the above, efficiently |
| Arbitrary (fractional) | Any real number | Rates that are not related to the converter clock at all | Computing values between samples accurately |
| Time-varying | Changes continuously | Order-domain data that follow a drive or a shaft | All of the above, updated sample by sample, with no gaps |
Integer decimation is the classic case, and most analyzers support it. The harder cases are the ones where the new samples fall between the old ones at positions that never repeat: arbitrary and time-varying ratios. These are what make computed (digital) order tracking possible, and they are what demand the highest-quality interpolation.
Reducing the rate: alias rejection
To lower the rate, the signal must first be filtered so that nothing remains above the new Nyquist frequency, half the new sample rate. Otherwise components above it fold into the measurement band, exactly as they would at an unfiltered converter. Once folded, they cannot be separated from real data.
Figure 2 shows why the filter matters. Keeping every eighth sample passes everything in the red zones straight into the band. Averaging groups of samples is a filter, but a weak one: it rejects only 6 dB at its worst point, and its response droops by 2.3 dB at the top of the measurement band. A proper decimation filter does three things at once: it is flat across the band, it rejects everything that would fold into the band by at least the system's dynamic range, and it is identical on every channel so that phase between channels is preserved.
Where the rejection must start. Content only folds into the band from fs,new − B upward. That gives the filter a transition band between B and fs,new − B to roll off in. With the common choice fs = 2.56 × B, the transition band is 0.56 B wide.
Values between samples: interpolation quality
For arbitrary and time-varying ratios, the resampler must compute the signal at instants that fall between the original samples. The way it does that sets the quality of everything downstream.
Linear interpolation draws straight lines between samples. It is cheap, and it is fine for plotting, but as a measurement step it adds error at −41 dB for a signal at one tenth of Nyquist and −6 dB near the top of the band. That is about 70 dB above a typical 24-bit system floor of around −110 dB. Cubic interpolation is better, but not by enough. (Linear or cubic interpolation can work well as the last step after the signal has first been upsampled by a large factor with a good filter, and many efficient real-time resamplers are built that way. Applied directly to the samples, as here, they are not adequate.) A band-limited interpolator, a windowed-sinc filter evaluated at the exact fractional position, reconstructs the signal correctly across the usable band: its error here stays near −118 dB, and −101 dB even at the top of the band.
The cost is computation: each new sample takes dozens of multiplies per channel, with coefficients that depend on where the new sample falls. That is easy offline and demanding in real time.
What "real time" requires
Resampling a recorded file on a PC is routine. Doing it inside a controller, where it is part of the measurement and the control loop, adds four requirements:
- Continuous, gap-free operation. Every input sample must be processed, on every channel, for the length of the test. A dropped block is a discontinuity in the data and a disturbance in the control loop.
- Bounded, known delay. Every filter delays the signal. The controller must account for that delay exactly, and keep it short wherever the loop must respond quickly, as in sine control at high frequencies.
- Exact channel-to-channel match. Every channel must pass through identical filters with identical timing, or transfer functions, coherence and multi-axis control are corrupted (see Coherence and Phase Matching).
- Rate changes on the fly. For order-domain data, the ratio changes with every sample as the drive frequency or shaft speed changes, and the filter cutoffs must follow.
Meeting all four, for many channels and several streams at once, is a computational problem as much as a mathematical one. Splitting the work into stages helps a great deal:
| Design | Filter taps | Multiplies per second | Filter delay |
|---|---|---|---|
| Single stage, ÷64 | 1,795 | 7.4 million | 3.4 ms |
| Three stages, ÷4 ÷4 ÷4 | 173 (27 + 32 + 114) | 2.8 million | 3.7 ms |
The three-stage design needs about a tenth of the filter coefficients and well under half the arithmetic of the single-stage design for comparable filtering, at a slightly longer delay. (Pass-band ripple adds across stages, so each stage is designed a little tighter.) The early stages can be short because they only need to protect the bands that will eventually fold into the measurement; the last stage does the precise work at a low rate, where it is cheap. The delay is set mainly by that last, sharpest stage, which is why a controller chooses its decimation chain with the control loop in mind.
Increasing the rate: the output side
The drive signal has the opposite problem. A controller synthesizes the drive at the test's own rate, but the digital-to-analog converter runs much faster. Raising the rate creates images, copies of the drive spectrum at multiples of the original sample rate, which must be filtered out before they reach the amplifier and shaker. Multi-stage digital smoothing filters raise the rate and remove most of the images, and an analog reconstruction filter after the converter removes the rest. Done well, the shaker sees only the intended spectrum, with negligible high-frequency energy that the controller did not ask for.
What real-time resampling makes possible
- Any test bandwidth from one front end. The analog filter and converter stay fixed; the bandwidth is chosen in software.
- Several streams at once. The same digitized channels can feed a control stream and a second, independently filtered stream at a different rate, for example a sine test with a wide-band stream for time histories and spectra.
- Order-domain data. Resampling at a ratio that follows the drive or a shaft gives a constant number of samples per cycle (see Digital Tracking Sampling).
- Better low-frequency testing. Decimation gives fine frequency resolution at low frequencies without an unwieldy frame size, and combines with overlap processing to keep the loop responsive (see Overlap Processing in Panther Vibration Controllers).
- Re-analysis after the test. A recording made at a high rate can be analyzed later at any lower bandwidth, with proper digital decimation filtering, so a test never has to be repeated just to look at it differently.
Common misconceptions
| Misconception | Reality |
|---|---|
| "Lowering the sample rate just means keeping fewer samples." | Only after everything above the new Nyquist frequency has been filtered out. Otherwise it folds into the band and cannot be removed (Figure 2). |
| "Interpolation between samples is a detail." | It sets the floor of the result. Linear interpolation adds error of −41 dB at one tenth of Nyquist, and more at higher frequencies, ruining the dynamic range of a 24-bit system (Figure 3). |
| "Resampling is something you do afterwards on a PC." | Offline resampling is useful for analysis, but a controller needs it in real time, on every channel, with no gaps and a known delay, because it is part of the measurement and the control loop. |
| "A higher hardware sample rate makes resampling unnecessary." | A higher rate gives more bandwidth, not finer resolution at low frequency, a second bandwidth, or order-domain data. Those still need the rate changed. |
| "All decimation filters are the same." | Pass-band flatness, stop-band depth, channel-to-channel match and delay all differ, and each one shows up in the measurement. |
Quick reference
| Quantity | Formula or rule | Example |
|---|---|---|
| Bandwidth from sample rate | B = fs / 2.56 | 4,096 samples/s → 1,600 Hz |
| Where alias rejection is needed | From fs,new − B upward | 4,096 − 1,600 = 2,496 Hz |
| Frequency resolution | Δf = fs / frame size | 4,096 / 4,096 = 1 Hz |
| FIR length (Kaiser estimate) | N ≈ (A − 8) / (14.4 · Δf/fs) | 96 dB, narrow transition → long filter; use stages |
| Linear-phase FIR delay | (N − 1) / 2 samples | Set mainly by the last, sharpest stage |
| Dynamic range target | Resampling error below the converter floor | 24-bit, >110 dB system → error well below −100 dB |
How Panther helps
- One fixed, well-filtered front end: simultaneous 24-bit sampling at up to 262,144 samples/s, with fixed analog anti-aliasing (524 kHz) giving more than 105 dB of alias attenuation.
- Floating-point resample ratio: Panther's digital resampling is not limited to integer ratios. The ratio is a floating-point value, so the new rate does not have to be a whole-number fraction of the converter rate.
- Real-time digital decimation and filtering: frequency-range reduction runs on on-board FPGA and DSP hardware, with more than 96 dB of digital stop-band attenuation at Nyquist. Panther shows the resulting sample rate and the over-sample ratio set by the decimation or resampling filter set.
- Multiple data streams at independent sample rates: the same channel data can be filtered and decimated into a second acquisition stream during a test (the number of streams depends on the software license), such as a sine test with time histories and power spectra alongside control. Panther RMA supports a primary and two secondary streams. All active streams can be recorded to disk gap-free.
- Rates that follow the test: Panther Sine's High Precision Frequency Track (HPFT) channel provides digital sample-rate tracking, and Panther RMA converts data to the order domain frame by frame, referenced to its dedicated 1 MHz tachometer input. See Digital Tracking Sampling in Sine Vibration Control.
- Clean drive output: output frequency-range reduction uses 10-stage smoothing filters, and analog reconstruction filters (1 kHz, 10 kHz, 25 kHz or off) provide more than 96 dB of image attenuation, at output rates up to 262,144 samples/s.
- Re-analysis from stream files: the bandwidth of a recorded stream file can be changed in the offline Analyzer, which performs digital filter decimation as required when lower bandwidths are wanted.
- Any sample rate for files: Panther's data export tools can rewrite any digitized or ASCII time-history file at a sample rate of your choice, for use on Panther or Lynx.
References and further reading
- R. E. Crochiere and L. R. Rabiner, Multirate Digital Signal Processing, Prentice Hall, 1983.
- A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Pearson.
- T. I. Laakso, V. Välimäki, M. Karjalainen and U. K. Laine, "Splitting the Unit Delay: Tools for Fractional Delay Filter Design," IEEE Signal Processing Magazine 13(1), 1996.
- J. F. Kaiser, "Nonrecursive Digital Filter Design Using the I0-sinh Window Function," Proc. IEEE International Symposium on Circuits and Systems, 1974.
- Spectral Dynamics Technical Library: Digital Tracking Sampling in Sine Vibration Control; FFT Fundamentals: Resolution, Windowing and Leakage; Dynamic Range Considerations in Vibration Testing; Overlap Processing in Panther Vibration Controllers.