beautypg.com

Filter functions – MTS Series 793 User Manual

Page 381

background image

Functions can access variables declared in the main routine. However, if a variable or parameter is declared
within the function by the same name, then the function can only see this local variable.

Filter Functions

Support is provided for designing low-pass, high-pass, band-pass, and band-stop infinite impulse response
(IIR) filters, and for low-pass finite impulse response (FIR) filters.

Note:

Use MyFIR and MyIIR calculations to create filters with custom coefficients.

The following enumerations can be used for the filter type argument:

0 = BUTTERWORTH

1 = CHEBYSHEV1

2 = CHEBYSHEV2

3 = ELLIPTIC

Example script for IIR filters

int iir[6];

real fLPass, fUPass, fLStop, fUStop;
real fPass, fStop, dPass, dStop;
int rsp;
int type;
function int OnInitialize() {

fPass = 20.0;
fStop = 90.0;
dPass = 0.001;
dStop = 0.01;
type = 0;
//rsp = IIRLP(iir, fPass, fStop, dPass, dStop, type);

fPass = 90.0;
fStop = 20.0;
dPass = 0.001;
dStop = 0.01;
type = 0;
//rsp = IIRHP(iir, fPass, fStop, dPass, dStop, type);

fLPass = 20;
fUPass = 40;
fLStop = 24;
fUStop = 26;
dPass = 0.001;
dStop = 0.1;
//rsp = IIRBS(iir, fLPass, fUPass, fLStop, fUStop, dPass, dStop, type);

fLPass = 23.5;
fLStop = 20.0;
fUStop = 30.0;
fUPass = 26.5;
dPass = 0.01;
dStop = 0.01;
//rsp = IIRBP(iir, fLPass, fUPass, fLStop, fUStop, dPass, dStop, type);
}

MTS Series 793 Control Software 381

Calculated Signals