.

BiQuad Filter

Overview

Overview

The BiQuad Filter block implements up to 16 second-order cascaded biquad blocks. Biquad coefficients are stored in a data file and loaded when the block is loaded. The firmware allows for up to 16 additional cascaded sections to be included in the data file, if desired.

BiQuad1

The configuration values for this block are as follows:

 
Coefficient File Name (.txt)

The filename of a text file containing the coefficients. See Generating Text Files.

Ts Sample period of the filter algorithm. This is the cycle time of the BiQuad block in Simulink simulation. This value has no effect on the BiQuad execution on the controller.
Subsample Code A code which determines the schedule for updating this block (every sample, even samples only, etc.) See Subsampling.
User Data 0 Application-specific data. See User Data Storage.
User Data 1 Application-specific data. See User Data Storage.

Generating Text Files

Text files can be generated using one of the Matlab Utilities. Advanced users can manually write their text file if the coefficients are already known.

Reading Text Files

Text files can be read by loading with the mdl2mw utility.

Single Stage Biquad Example

Sample data file for a single stage filter.

biquad

Coeff[0]  =  9.98E-01    B0
Coeff[1] = 2.00E+00 B1
Coeff[2] = 9.98E-01 B2
Coeff[3] = 1.9954991 -A1
Coeff[4] = -0.995509 -A2

Multistage Biquad Example

A biquad filter is a second order computational element. The biquad section can be defined by specifying 5 coefficents B0, B1, B2, A1, A2, taken directly from the z-domain transfer function of the biquad.

Cascaded Biquad Filters are specified by defining the the 5 coefficents for each of the sections.

biquad

The mechaware data file contains the coefficents for each of the sections sequentially. Note that the xfer function coefficents A1 and A2 are negated before entering into the file.

filter

Matlab/Simulink

Simulink Interface

BiQuad Simulink1

The BiqQuad Filter block computes a multi-section (up to 16 cascaded sections) biquad filter transformation on the input. The Input of the block is a double precision value, and may be connected to the output of any other MechaWare block. The Output is also double precision and can be used for the inputs of other MechaWare blocks.

The block has two user data fields (User Data 0, User Data 1) to store application-specific data for convenient storage and retrieval. See User Data Storage for details.

The block's update schedule is determined by the Subsample Code (See Subsampling). The following Parameter Dialog Box can be opened by double-clicking on the block in a Simulink Model:  

BiQuad Simulink2

C++ API

BIQBlock

Declaration

Public Method

BIQBlock&   BIQ();
Required Header: mechaware.h

Description

The BiQuad block implements up to 16 second-order cascaded biquad sections. Biquad coefficients are stored in a data file and loaded when the block is loaded. The firmware allows for up to 16 additional cascaded sections to be included in the data file, if desired.

Parameters

 
long BIQ().Length

Number of sections.

std::vector<double> BIQ().Coeff

The biquad coefficients.

std::vector<double> BIQ().Data

The working data for the filter. These data are usually only accessed during initialization.

Methods

Block Methods

See Also

BiQuad Filter with Lookup Coefficients

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2012 Motion Engineering