Engee documentation

tsa

Averaging of a time-synchronous signal.

Library

EngeeDSP

Syntax

Function call

  • ta,t,p,rpm = tsa(x,fs,tp) — returns the time-synchronous average value of the signal x, sampled with frequency fs, by the pulses specified in the input argument tp, as well as the vector of sampling periods t, corresponding to ta, vector of phase values p and a constant rotation speed rpm, measured in rpm, corresponding to ta.

  • ta,t,p,rpm = tsa(x,t,tp) — returns the time-synchronous average value of the signal x, sampled by the time values stored in the input argument t.

  • ta,t,p,rpm = tsa(___,Name=Value) — sets additional parameters for any of the previous syntax options using arguments like «name-value». For example, you can specify the number of tachometer pulses per revolution of the shaft, or choose to average the signal in the time or frequency domain.

  • tsa(___;out=:plot) — plots a time-synchronous averaged signal and time domain signals corresponding to each signal segment on the current graph.

Arguments

Input arguments

# x — input signal

+ vector

Details

The input signal is set as a vector.

Типы данных

Float32, Float64, Int64

# fs — sampling rate
scalar

Details

The sampling rate, set as a positive scalar.

Типы данных

Float32, Float64, Int64

# tp — pulse time

+ scalar | vector

Details

Pulse time, set as a scalar or vector:

  • scalar — a constant time interval during which rotations occur;

  • vector — non-negative, strictly increasing moments of time that determine the constant phase of rotation.

Use the function tachorpm to extract the sampling periods of the tachometer pulses from the tachometer signal.

Типы данных

Float32, Float64, Int64

# t — sampling periods

+ scalar

Details

Sampling periods, defined as a scalar, are the time interval between successive samples. x.

Типы данных

Float32, Float64, Int64

Input arguments «name-value»

Specify optional argument pairs as Name=Value, where Name — the name of the argument, and Value — the appropriate value. Type arguments «name-value» they should be placed after the other arguments, but the order of the pairs does not matter. You can specify multiple pairs «name-value».

Example: ta = tsa(x, Method = "pchip", ResampleFactor = 10) indicates that the signal should be upsampled in 10 once and averaged in the time domain using piecewise cubic Hermite interpolation.

# Method — averaging algorithm

+ "linear" (by default) | "spline" | "pchip" | "fft"

Details

An interpolation scheme defined by one of the following values:

  • "linear" — performing linear interpolation and averaging in the time domain;

  • "spline" — performing cubic spline interpolation and time domain averaging;

  • "pchip" — performing piecewise cubic Hermite interpolation and time domain averaging;

  • "fft" — performing averaging in the frequency domain.

# NumRotations — the number of revolutions of the shaft

+ 1 (by default) | scalar

Details

The number of revolutions of the shaft in the argument ta, set as a positive integer.

Типы данных

Float32, Float64, Int64

# PulsesPerRotation — the number of time points per revolution of the shaft

+ 1 (by default) | scalar

Details

The number of time points per revolution of the shaft, set as a positive scalar.

Типы данных

Float32, Float64, Int64

# ResampleFactor — the coefficient by which the sampling rate increases

+ 1 (by default) | scalar

Details

The coefficient by which the sampling rate increases, set as a positive integer.

Типы данных

Float32, Float64, Int64

# out — type of output data

+ :data (by default) | :plot

Details

Type of output data:

  • :data — the function returns data;

  • :plot — the function returns a graph.

Output arguments

# ta — average values of the time-synchronous signal

+ vector

Details

The average values of the time-synchronous signal, returned as a vector.

# t — sampling periods

+ vector

Details

Sampling periods returned as a vector.

# p — phase values

+ vector

Details

Phase values returned as a vector, expressed in revolutions.

Argument p it has the same values as the temporary values of the argument. ta.

# rpm — constant rotation speed

+ scalar

Details

Constant rotation speed, returned as a scalar, expressed in rpm.

Examples

Synchronous time averaging of a sine wave

Details

Let’s calculate the time-synchronous averaging of a noisy sine wave.

We will generate a signal consisting of a sine wave immersed in white Gaussian noise. The signal is sampled at a frequency 500 Hz during 20 seconds. Specify the frequency of the sine wave 10 Hz and noise dispersion 0.01. Let’s plot one period of the signal.

fs = 500
t = 0:1/fs:20-1/fs

f0 = 10
y = sin.(2π * f0 * t) + randn(length(t)) / 10

plot(t, y, xlims=(0, 1/f0))

tsa 1

Let’s calculate the time-synchronous averaging of the signal. As a synchronizing signal, we use a set of pulses with the same period as the sinusoid. In the function tsa setting for the argument out meaning :plot to display the result.

import EngeeDSP.Functions: tsa

tPulse = 0:1/f0:maximum(t)

tsa(y, fs, tPulse, out = :plot)

tsa 2

Algorithms

With the specified input signal, sampling frequency, and set of tachometer pulses, the function tsa performs the following steps:

  1. Determines the start and end time of the cycle based on the tachometer pulses and the value specified for the argument PulsesPerRotation.

  2. Resamples the input signal based on the value specified for the argument ResampleFactor.

  3. Averages the oversampled signal based on the value specified for the argument Method.

    • If for an argument Method the value is set "fft", function:

      1. Splits the signal into segments corresponding to different cycles.

      2. Calculates the discrete Fourier transform of each segment.

      3. Truncates longer transformations so that all transformations have the same length.

      4. Averages the spectra.

      5. Calculates the inverse discrete Fourier transform of the average value to convert it to the time domain.

    • If for an argument Method one of the time domain methods is defined, the function:

      1. Using this method, it interpolates the signal onto a grid of evenly distributed samples corresponding to different cycles.

      2. Combines the signal segments obtained by oversampling based on the value specified for the argument NumRotations.

      3. Calculates the average value of all segments.

Literature

  1. Bechhoefer, Eric, and Michael Kingsley. «A Review of Time-Synchronous Average Algorithms.» Proceedings of the Annual Conference of the Prognostics and Health Management Society, San Diego, CA, September-October, 2009.