.

BiQuad Filter with Lookup Coefficients

Overview

Overview

Description

The BiQuad Filter with Lookup Coefficients block works exactly like the standard BiQuad block, but the coefficients are re-calculated each sample. The value of each coefficient is interpolated from coefficient tables stored in the format used by BiQuad filters.

For example, lets assume we have a 2-Axis robot arm; at the start of the move, the end of the arm is 6 inches from the axis of rotation, and at the end of the move, robot arm is 24” from the axis of rotation (the arm is extending horizontally). If the robot arm has a load at the end, the inertia changes (I = Mass * Arm Length²) which means any kind of mechanical resonance present, will change based on the position of the arm. The BiQuad Filter with Lookup allows you to have your digital filter change based on an input, such as Actual Position.

There are 3 Lookup Modes; Discrete (0), Linear Interpolation (1), and Vector Interpolation (2). For more information about these types, see Lookup. Unlike the Lookup block, in Linear Interpolation mode if the input is less than the minimum table entry, the minimum is used. If the input is greater than the maximum table value (minimum value + (step size x entry count)), the maximum is used.

The calculation is made at the update rate of the block, which is determined by the Evaluate Block.

Example

In this example, the BiQuad with Lookup block is being used as a Post Filter after a PID Block. Such an implementation would be if you needed a 100 Hz Resonator filter to cancel out a resonance, but the resonance gradually moves to 300 Hz at the arm’s full extension. To accomplish this, add a Start position Resonator and an End Position Resonator. When the arm moves, this BiQuad re-calculates each sample so that the perfect resonance is cancelled out.


BiQuad1

The configuration values for this block are as follows:

Coefficient File Name (.txt)

The filename of a text file containing the coefficients (see Matlab/Simulink Tab for format).

Ts Sample period of the filter algorithm. This is the cycle time of the BiQuad block in a 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). 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.

Matlab/Simulink

Simulink Interface

BiQuad Simulink1

The BiQuad block with lookup table coefficients works exactly like the standard BiQuad block, but the coefficients are re-calculated each sample. The value of each coefficient is interpolated from coefficient tables stored in the format used by BiQuad filters.

Configuration file format:

This file contains a list of file names for loading the lookup tables. These tables are used to compute the BiQuad coefficients each sample. The first file name contains the lookup table data, type, size (all types), minimum input value and step size (FIXED type), or input vector (VECTOR type). The next N file names contain the BiQuad Coefficients used for interpolation. The number of file names for BiQuad coefficient files must match the lookup table size parameter. The format for these files is identical to the corresponding BiQuad or Lookup configuration files.

Example configuration file:

LOOKUP_BIQ0.TXT
BIQ1.TXT
BIQ2.TXT
BIQ3.TXT
BIQ4.TXT
BIQ5.TXT

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:

BiQuad Simulink2

 

 

C++ API

BIQ_LOOKUPBlock

Declaration

Public Method

class BIQ_LOOKUPBlock: public virtual Block
{
public:

	// User accessible coefficients
	long				Length;
	std::vector	Coeff;
	std::vector	Data;
	long				LookupType;
	long				LookupTableSize;
	std::vector	LookupTable;
};
Required Header: mechaware.h

Description

The BiQuad with Lookup 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 and lookup coefficients.

std::vector<double> Data

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

long
LookupType

Lookup Table Type (0 = Direct, 1 = Fixed, 2 = Vector)

long LookupTableSize

Number of points in the Lookup table (and input vector for type 2)

std::vector<double> LookupTable[ ]

Not used for Direct (type 0) lookup.

2 element vector for Fixed (type 1) lookup.
The two points are the Input Minimum and Spacing.

1xN vector for Vector (type 2) lookup.
Array of input values used for interpolation.

Methods

Block Methods

 

See Also

BiQuad

 

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