.

BiQuad Filter

Overview

Overview

Description

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. The update rate is determined by the Subsample Code.

Note: BiQuad blocks are often used as alternatives to PID or to supplement an existing PID control loop.

Example

In the following diagram the Biquad Block is used as a Post Filter after a PID Block:

This is useful in a implementation that requries a 200 Hz Lowpass filter on your control loop. To configure, tune your PID Loop and add a BiQuad Filter after the PID.

Note: It is required to generate your BiQuad values. For more information, see Matlab Utilities.


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.
Evaluate Block This block allows you to specify whether the block executes Every Sample, Every Other Sample (Odd or Even), or Every Fourth Sample (and specify the First, Second, Third, or Fourth) or background. This provides greater flexibility in controlling the execution of a model and to preserve performance for other areas of motion control.
User Defined Block Priority When selected, allows you to enter a Priority Code to modify Execution Ordering of this block. For more information, see Block Execution Order and User Defined Block Priority.
Priority For an explanation of how the Priority field is used by the MechaWare Model Downloader, see Block Execution Order and User Defined Block Priority.
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 Evaluate Block. The following Parameter Dialog Box can be opened by double-clicking on the block in a Simulink Model:  

C++ API

BIQBlock

Declaration

Public Method

class BIQBlock: public virtual Block
{
public:

	// User accessible coefficients
	long				Length;
	std::vector	Coeff;
	std::vector	Data;
}; 
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 Length

Number of sections.

std::vector<double> Coeff

The biquad coefficients.

std::vector<double> 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