Engee documentation

Dialog FIR Decimation

Polyphase thinning with FIR filter. FIR filter coefficients are set in the input field.

dialog fir decimation

Description

The Dialog FIR Decimation block performs efficient polyphase thinning using an integer downsampling factor on the first measurement.

Conceptually, the FIR decimator (as shown in the schematic) consists of a smoothing FIR filter followed by downsampling.

The FIR filter filters the data in each channel of the input signal with a direct-form FIR filter. The following downsampling reduces the samples of each channel of filtered data by taking each -th sample and discarding samples that follow it, where is the value of the decimation factor, which is set in the Decimation factor parameter. The resulting discrete-time signal has a sampling frequency reduced by a factor of compared to the original one.

fir decimation 1 en

FIR filter coefficients are set in the input field.

Note that the actual block algorithm implements the polyphase structure of a direct-form FIR filter, which is effectively equivalent to the combined system shown in the diagram. See Algorithms for more details.

Ports

Input

# IN_1 — input data
scalar | vector | matrix

Details

Input data for a block specified as a scalar, vector or matrix.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64.

Complex numbers support

Yes

Output

# OUT_1 — output data after thinning
scalar | vector | matrix

Details

Output data after thinning, returned as a scalar, vector or matrix.

Block behaviour depends on the value of Rate options parameter:

  • Enforce single-rate processing - when this value is selected, the block keeps the input sampling rate and thins the signal, reducing the output frame size by times.

  • Allow multirate processing - when this value is selected, the block thins the signal so that the output sample rate is times smaller than the input sample rate. The output frame size is the same as the input frame size.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64.

Complex numbers support

Yes

Parameters

Main

# FIR filter coefficients — coefficients of the low-pass FIR filter

Details

Specify the coefficients of the numerator of the FIR filter transfer function in descending order:

The transfer function of the FIR filter is defined as follows:


For operation as an effective smoothing filter, the coefficients typically correspond to a low-pass filter with a normalised cut-off frequency value of no more than , where is the decimation factor.

The block initialises all filter states with zero.

Default value

EngeeDSP.Functions.designMultirateFIR(1,2)

Program usage name

COEFF

Tunable

No

Evaluatable

Yes

# Decimation factor — decimation factor

Details

Specify an integer coefficient . The block reduces the sampling rate of the input sequence by this coefficient.

Default value

2

Program usage name

DF

Tunable

No

Evaluatable

Yes

# Filter structure — FIR filter structure
Direct form | Direct form transposed

Details

Specify the structure of the FIR filter: Direct form or Direct form transposed.

Values

Direct form | Direct form transposed

Default value

Direct form

Program usage name

FS

Tunable

No

Evaluatable

Yes

# Input processing — input signal processing type
Columns as channels (frame based) | Elements as channels (sample based)

Details

Specify whether the unit performs sample-based or frame-based processing. Options to select:

  • Elements as channels (sample based) - each input signal element is treated as an independent channel (sample based processing).

  • Columns as channels (frame based)` - each column of the input signal is treated as an independent channel (frame based processing).

Values

Columns as channels (frame based) | Elements as channels (sample based)

Default value

Columns as channels (frame based)

Program usage name

IP

Tunable

No

Evaluatable

Yes

# Rate options — the method by which the block thins the input data
Enforce single-rate processing | Allow multirate processing

Details

Specify the method by which the block should thin the input data. Options to choose from:

  • Enforce single-rate processing - when this method is selected, the block retains the sampling rate of the input signal and thins the signal, reducing the output frame size by a factor of . To select this method, the Input processing parameter must be set to Columns as channels (frame based).

If the Rate options parameter is set to Enforce single-rate processing, you can use the Dialog FIR Decimation block within the trigger subsystems.

  • Allow multirate processing - when this method is selected, the block thins the signal so that the output sampling rate is times lower than the input sampling rate.

Dependencies

To use this option, set the Input processing parameter to Columns as channels (frame based).

Values

Enforce single-rate processing | Allow multirate processing

Default value

Enforce single-rate processing

Program usage name

ROF

Tunable

No

Evaluatable

Yes

# Rate options — the method by which the block thins the input data
Allow multirate processing

Details

The block thins the data using the `Allow multirate processing' method - the output sampling rate is times lower than the input rate.

Dependencies

To use this parameter, set the Input processing parameter to Elements as channels (sample based).

Values

Allow multirate processing

Default value

Allow multirate processing

Program usage name

ROS

Tunable

No

Evaluatable

Yes

# Allow arbitrary frame length for fixed-size input signals — allow arbitrary frame size for fixed size input signals

Details

Specify whether fixed-size input signals (whose size does not change during simulation) can have an arbitrary frame size, i.e. the frame size does not have to be a multiple of the decimation factor. The block uses this parameter only for fixed-size input signals and ignores it if the input signal has a variable size.

For fixed size input signals:

  • If the Allow arbitrary frame length for fixed-size input signals checkbox is selected, the frame size of the signal does not have to be a multiple of the decimation factor. If the input signal is not a multiple of the decimation factor, the output is usually a variable-sized signal. Therefore, to support arbitrary input size, the block must also support variable-size operations, which can be enabled by selecting the Allow arbitrary frame length for fixed-size input signals checkbox.

  • If Allow arbitrary frame length for fixed-size input signals is unchecked, the input frame size must be a multiple of the decimation factor.

Dependencies

To use this option, set Input processing to Columns as channels (frame based) and Rate options to Enforce single-rate processing.

Default value

false (switched off)

Program usage name

AllowArbitrary

Tunable

No

Evaluatable

Yes

Read More

Polyphase Subfilters

The polyphase implementation of the FIR decimator decomposes the impulse response of the low-pass FIR filter into different subfilters, where is the downsampling or decimation factor. For more details on the polyphase implementation, see Algorithms.

Let denote the impulse response of a FIR filter of length , and denote the input signal. Thinning by a factor of the output signal from the filter is equivalent to downsampling convolution:

The key to the efficiency of polyphase filtering is that certain input values are multiplied only by selected impulse response values in downsampling convolution. For example, if , then the input values of are combined only with the filter coefficients of , and the input values of are combined only with the filter coefficients of . By separating the filter coefficients into two polyphase subfilters, no unnecessary calculations are performed in the convolution. The outputs of convolutions with polyphase subfilters are interleaved and summed to obtain the filter output.

Frame-based processing

When Input processing is set to Columns as channels (frame based), the unit performs time-based resampling of each column of the input signal. In this mode, the block can perform either single-rate or multirate processing. You can use the Rate options parameter to specify how the block will recalculate the input data:

  • If the Rate options parameter is set to Enforce single-rate processing, the block’s input and output data have the same sampling rate. To thin the output data while preserving the sampling rate of the input data, the block recalculates the data in each column of the input data so that the output data frame size has an upper bound of ceil( ), where is the input data frame size and is the decimation factor specified in the Decimation factor parameter.

In this mode, if the signal has a fixed size (the frame size does not change during simulation) and the Allow arbitrary frame length for fixed-size input signals checkbox is checked, the input frame size can be arbitrary and does not have to be a multiple of the decimation factor. If the Allow arbitrary frame length for fixed-size input signals checkbox is unchecked, the input frame size must be a multiple of the decimation factor.

This table shows support for arbitrary input frame size when Input processing is set to Columns as channels (frame based) and Rate options to Enforce single-rate processing.

Input signal Unit supports this signal Supports arbitrary input frame size Input size Output size

Fixed size signal

Yes

If the Allow arbitrary frame length for fixed-size input signals checkbox is selected

at

Upper limit of ceil( ) size by

  • When Rate options is set to Allow multirate processing, the input and output data of the FIR decimator block have the same size. However, the output data sampling rate is times lower than the input data sampling rate. In this mode, the block treats the input matrix to as independent channels. The block thins each column of the input signal in time, keeping the frame size constant, with the period of the output frame ( ) being times the period of the input frame ( ).

In this mode, the block accepts only fixed-size signals, and these signals can be of arbitrary frame size.

This table shows support for arbitrary input frame size when Input processing is set to Columns as channels (frame based) and Rate options is set to Allow multirate processing.

Input signal Unit supports this signal Support arbitrary input frame size Input size Output size

Fixed size signal

Yes

Always

on

on

Variable size signal

No

Not applicable

Not applicable

Not applicable

Reference-based processing

If Input processing is set to Elements as channels (sample based), the block treats the input matrix to as independent channels and time-samples each channel. The output sample period ( ) is times the input sample period ( ), while the input and output data sizes remain identical.

In this mode, the unit only accepts fixed size signals, and these signals can be of arbitrary frame size.

This table shows support for arbitrary input frame size when the Input processing parameter is set to Elements as channels (sample based). The Rate options parameter is automatically set to Allow multirate processing.

Input signal Unit supports this signal Supports arbitrary input frame size Input size Output size

Fixed size signal

Yes

Always

on

on

Variable size signal

No

Not applicable

Not applicable

Not applicable

Delay time

If the block operates in sample-based processing mode, it always has a zero delay. Zero delay means that the block transmits the first filtered input sample received at time , as the first output sample. This first output sample is followed by the filtered input samples , and so on.

Algorithms

FIR filtered thinning is efficiently implemented using a polyphase structure. For more details on polyphase structure, see Polyphase Subfilters.

To derive the polyphase structure, we start by defining the transfer function of the FIR filter:

where is the length of the FIR filter.

We can rearrange this equation as follows:

where is the number of polyphase components and its value is equal to the decimation factor, which is set in the parameter settings window.

We can write this equation in the form:

where , , …​, are the polyphase components of the FIR filter .

Conceptually, FIR filter thinning consists of a low-pass FIR filter followed by a downsampling element.

fir decimation 1 en

Let’s replace with its polyphase representation.

fir decimation 2

The identity for multivariate thinning is presented here.

fir decimation 3 en

Applying the identity for thinning moves the downsampling operation before the filtering operation. This move allows the signal to be filtered at a slower rate.

fir decimation 4

You can replace the delays and decimation factor at the input with a toggle switch.

fir decimation 5 en

When the first input sample arrives, the switch feeds it to the 0 branch and the decimator calculates the first output value. As more input samples are received, the switch moves counterclockwise through the branches , and up to the 0 branch, feeding one sample into each branch. When the switch reaches the 0 branch, the decimator produces the next set of output values. This process continues as long as data continues to flow. Each time the switch approaches the 0 branch, the decimator outputs . The decimator effectively outputs one sample for every samples it receives. Thus, the sampling rate at the output of the FIR decimator is .

References

  1. Fliege, N. J. Multirate Digital Signal Processing: Multirate Systems, Filter Banks, Wavelets. West Sussex, England: John Wiley & Sons, 1994.

  2. Orfanidis, Sophocles J. Introduction to Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1996.

Additional options

C code generation: Yes