πŸ“¦ Archived documentation: r1 (committed 2026-07-24) View current documentation β†’

scope

High-speed waveform capture, FFT, enveloping/demodulation and amplitude extraction.

Available on: Flexs Q5C

The scope object is the heart of the Q5C: it captures high-frequency waveforms from the accelerometer channels, computes FFTs (optionally with band-pass filtering and envelope demodulation for bearing diagnostics), and extracts peak and band amplitudes from the spectrum.

The typical analysis pattern is:

  1. scope.getWaveform(...) β€” capture and transform a waveform.
  2. scope.getPeak(...) β€” find the running-speed peak to establish RPM.
  3. scope.getAmplitudes(...) β€” read fault-frequency amplitudes computed from that RPM.
  4. Assign the result object to an io group so it is datalogged or make the information available to your plc systems via ModBUS or EtherIP.

See the Variable Speed Bearing Vibration Analysis examples for complete diagnostic scripts, including lubrication-film monitoring at high frequency and enveloped captures for bearing fault detection.

vibration-capture1.png

Functions

scope.getWaveform()

scope.getWaveform(options) β†’ capture | false

Captures a waveform on a channel and optionally computes an FFT with band-pass filtering and envelope demodulation.

Performs a capture and prepares the spectrum that subsequent scope.getPeak() and scope.getAmplitudes() calls will read from. The single argument is an options object:

Option Type Meaning
ch number Input channel index (e.g. 0).
osr number Oversampling ratio β€” controls the effective sample rate / bandwidth (e.g. 64, 128, 4096). Higher OSR = lower bandwidth, finer low-frequency resolution.
size number Number of samples in the capture (e.g. 2048, 4096). More samples = finer frequency bins.
fft boolean Compute an FFT of the capture.
bandpass boolean Apply a band-pass filter between fMin and fMax before analysis.
fMin number (Hz) Lower frequency bound. Setting 3–4 kHz on an enveloped capture filters for just bearing faults.
fMax number (Hz) Upper frequency bound.
demod boolean Enable envelope demodulation (amplitude demodulation), the standard technique for exposing repetitive bearing-impact frequencies.
demodRatio number Demodulation ratio (e.g. 32, 64).

Capture recipes from the factory examples:

High-frequency capture for lubrication-film health (degraded lubrication causes metal-to-metal contact producing high-frequency vibration):

scope.getWaveform({ "ch":0, "osr":64, "size":4096, "fft":true,
                    "bandpass":false, "fMin":0, "fMax":12000,
                    "demod":false, "demodRatio":1 });

Enveloped capture for bearing fault diagnosis:

scope.getWaveform({ "ch":0, "osr":64, "size":2048, "fft":true,
                    "bandpass":true, "fMin":500, "fMax":32000,
                    "demod":true, "demodRatio":64 });

Narrow capture around line frequency for precise speed measurement:

scope.getWaveform({ "ch":0, "osr":4096, "size":4096, "fft":true,
                    "bandpass":false, "fMin":120, "fMax":190,
                    "demod":false, "demodRatio":8 });

The return value is truthy on a successful capture β€” check it before trusting the amplitudes extracted afterwards, and log the value on failure.

Arguments

NameTypeRequiredDefaultDescription
options object yes β€” Capture configuration β€” see the option table in the description.

Returns

capture | false Truthy capture handle on success, false/error value on a failed capture.

Example

let cap = scope.getWaveform({ "ch": 0, "osr": 64, "size": 2048, "fft": true,
  "bandpass": true, "fMin": 500, "fMax": 32000, "demod": true, "demodRatio": 64 });

if(cap){
  // spectrum ready β€” use scope.getPeak / scope.getAmplitudes
} else {
  print("Failed capture:", cap);
}

scope.getPeak()

scope.getPeak(fMin, fMax, [label]) β†’ { bin, freq, amp }

Finds the highest-amplitude peak in a frequency range of the most recent FFT β€” typically used to measure running speed.

Searches the spectrum of the most recent scope.getWaveform() capture between fMin and fMax and returns the dominant peak.

The optional label string draws a named marker on the FFT amplitude chart in the web interface for the associated capture, which makes verifying the speed lock-on easy.

Measuring RPM. Search a window around the expected electrical or mechanical frequency, then convert. For a 10-pole motor near line frequency:

let speed = scope.getPeak(50, 70, "hz");
let rpm = speed.freq * 120 / 10;

For better precision, re-find the speed on a strong harmonic using a tight tolerance window seeded from the first estimate:

let peak180hz = rpm/60*15;
let speed = scope.getPeak(peak180hz*0.98, peak180hz*1.02, "Speed"); // Β±2%
rpm = speed.freq * 4;

Arguments

NameTypeRequiredDefaultDescription
fMin number (Hz) yes β€” Lower bound of the search window.
fMax number (Hz) yes β€” Upper bound of the search window.
label string optional β€” Optional marker label shown on the FFT chart for this capture.

Returns

object { bin, freq, amp } β€” e.g. {"bin":322,"freq":59.977173,"amp":0.037552}

Example

scope.getWaveform({ "ch":0, "osr":4096, "size":4096, "fft":true,
  "bandpass":false, "fMin":120, "fMax":190, "demod":false, "demodRatio":8 });

let speed = scope.getPeak(50, 70, "hz");
print(string(speed)); // {"bin":322,"freq":59.977173,"amp":0.037552}
let rpm = speed.freq * 120 / 10; // 10-pole motor

scope.getAmplitudes()

scope.getAmplitudes(freqs, [binWidth], [aggregation]) β†’ object

Extracts amplitudes at named fault frequencies or frequency bands from the most recent FFT.

Reads amplitudes out of the most recent capture's spectrum and returns an object with the same keys as the input, ready to assign to an io group for datalogging.

Each entry in freqs maps a label to either:

  • a single frequency in Hz β€” read using the default binWidth and aggregation; or
  • an array [fMin, fMax, aggregation] β€” a band, e.g. [3500, 12000, "RMS"] or [3500, 24000, "AVG"].

Each label also automatically creates a marker on the FFT amplitude chart for the associated capture.

Bearing fault frequencies. Fault frequencies are usually derived from the measured RPM using the bearing's geometry coefficients, e.g. for a Link-Belt F-B22463H:

function getFaultFrequencies(rpm){
  return {
    "Fundamental":        rpm/60,
    "Fundamental Train":  0.0071*rpm,
    "Inner Ring Defect":  0.1717*rpm,
    "Outer Ring Defect":  0.1283*rpm,
    "Roller Defect":      0.0548*rpm,
    "Pelton Cup":         rpm/60*16,
    "Generator Pole":     rpm/60*10,
  };
}

Arguments

NameTypeRequiredDefaultDescription
freqs object yes β€” Map of "label": frequencyHz or "label": [fMin, fMax, aggregation] entries.
binWidth number optional 3 Width in FFT bins used for entries given as a single precise frequency.
aggregation string optional "MAX" Default aggregation for single-frequency entries: "MAX", "AVG" or "SUM" (bands may also use "RMS").

Returns

object Same keys as freqs, with the measured amplitude for each.

Example

let amplitudes = scope.getAmplitudes(getFaultFrequencies(rpm),
                                     2,       // bins wide per precise frequency
                                     "MAX");  // aggregation: "MAX","AVG","SUM"

// band amplitudes for lubrication film health
let hf = scope.getAmplitudes({ lubricationFilm: [3500, 24000, "AVG"] });

amplitudes.speed = rpm;                    // datalog the speed too
for(let i in hf){ amplitudes[i] = hf[i]; } // merge the hf measurements
io["Front Bearing"] = amplitudes;          // everything in io is logged