Back to C-ASPT Contents Page
asptMcfdfxlms32f
API Summary
API to create and delete asptMcfdfxlms32f filters
- DT32S mcfdfxlms32fInit (asptMcfdfxlms32f *mcfdfxlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32S *ip,DT32F *w)
- DT32S mcfdfxlms32fInitStatic(asptMcfdfxlms32f *mcfdfxlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
- void mcfdfxlms32fFree(asptMcfdfxlms32f *mcfdfxlms)
API to filter and update asptMcfdfxlms32f filters
API to retrieve the properties of asptMcfdfxlms32f filters
- DT32S mcfdfxlms32fGetCoef(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S ref,DT32S act,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdfxlms32fGetSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdfxlms32fGetEstSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- mcfdfxlms32fGetCoefPtr( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetSecPathPtr( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetEstSecPathPtr( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetFilterLength( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetBlockLength( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetSecPathLength( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetEstSecPathLength( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetFftLength( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetStepSize( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetConstrain( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetNrefs( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetNacts( asptMcfdfxlms32f
*mcfdfxlms )
- mcfdfxlms32fGetNsens( asptMcfdfxlms32f
*mcfdfxlms )
API to set the properties of asptMcfdfxlms32f filters
- DT32S mcfdfxlms32fReset(asptMcfdfxlms32f *mcfdfxlms)
- DT32S mcfdfxlms32fResetDelayLine(asptMcfdfxlms32f *mcfdfxlms)
- DT32S mcfdfxlms32fResize(asptMcfdfxlms32f *mcfdfxlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S newLen,DT32S newBlock)
- DT32S mcfdfxlms32fSetCoef(asptMcfdfxlms32f *mcfdfxlms,DT32F *newCoef,DT32S ref,DT32S act,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdfxlms32fSetSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdfxlms32fSetEstSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- mcfdfxlms32fSetStepSize( asptMcfdfxlms32f
*mcfdfxlms, newSs )
- mcfdfxlms32fSetConstrain( asptMcfdfxlms32f
*mcfdfxlms, newC )
- mcfdfxlms32fSetSecPathLength( asptMcfdfxlms32f
*mcfdfxlms, newL )
- mcfdfxlms32fSetEstSecPathLength( asptMcfdfxlms32f
*mcfdfxlms, newL )
Description
Implements the Multi-Channel Frequency Domain Filtered-X LMS algorithm. This version is intended for simulation purposes only. For real-time application use asptRtmcfdfxlms filters instead.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
mcfdfxlms32fInit
DT32S mcfdfxlms32fInit (asptMcfdfxlms32f *mcfdfxlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32S *ip,DT32F *w)
Initializes an asptMcfdfxlms32f filter and allocates its necessary storage buffers - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mcfdfxlms : pointer to the asptMcfdfxlms32f filter to be initialized
- Nref : number of input reference signals
- Nact : number of secondary actuators
- Nsen : number of error sensors
- M : number of time domain filter coefficients
- L : block length (number of new samples each block)
- mu : step size.
- cs : constrained (1) or unconstrained (0) filter.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- mcfdfxlms is initialized using the given input arguments.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : ip/w is a NULL pointer
- ASPT_RANGE_ERR : Nref/Nact/Nsen/L/M/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
mcfdfxlms32fInitStatic
DT32S mcfdfxlms32fInitStatic(asptMcfdfxlms32f *mcfdfxlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
Initializes an asptMcfdfxlms32f filter to use pre-allocated memory blocks - Returns :
-
Error code. On failure, the filterLength member of the structure is set to zero.
- Input Parameters :
- mcfdfxlms : pointer to asptMcfdfxlms32f filter to be initialized
- Nref : number of input reference signals
- Nact : number of secondary actuators
- Nsen : number of error sensors
- M : number of time domain filter coefficients
- L : block length (number of new samples each block)
- mu : step size.
- cs : constrained (1) or unconstrained (0) filter.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- pCof : pointer to a pre-allocated memory in program memory of at
least [fftLength*Nact*(2*Nsen+Nref)] DT32F locations to be used for the filter coefficients and sec. source coefficients.
- pDat : pointer to a pre-allocated memory in data memory of at
least [C1*(Nref+Nact)+fftLength*(Nref+Nact+Nsen+2)+ BO2P1*Nref*Nact] DT32F locations to be used for data storage.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- mcfdfxlms is initialized using the given input arguments.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : ip/w/pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : Nref/Nact/Nsen/L/M/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
- Remarks :
-
fftLength = 2^(nextpow2(M+L-1)). C1 = fftLength - blockLength. BO2P1 = fftLength/2 + 1
<< Back to top
mcfdfxlms32fFilterUpdate
DT32S mcfdfxlms32fFilterUpdate(asptMcfdfxlms32f *mcfdfxlms, DT32F *ref, DT32F *prim, DT32F *sens)
Calculates the filter output and updates the coefficients vector according to the MCFDFXLMS algorithm. - Returns :
- Input Parameters :
- mcfdfxlms : pointer to asptMcfdfxlms32f filter
- ref : array of new reference samples at each input
- prim : array of primary source samples measured at the sensors
- Output Parameters :
- sen : array to store the calculated block of sensor samples [Nsen * blockLength]
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfdfxlms32fFilterOnly
DT32S mcfdfxlms32fFilterOnly(asptMcfdfxlms32f *mcfdfxlms, DT32F *ref, DT32F *prim, DT32F *sens)
Calculates the filter output but does not update the coefficients vector. It also updates the internal buffers and power estimate. - Returns :
- Input Parameters :
- mcfdfxlms : pointer to the asptMcfdfxlms32f filter
- ref : new reference block of samples.
- prim : primary source block of samples measured at sensor
- Output Parameters :
- sen : array to store the calculated block of sensor samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfdfxlms32fFree
void mcfdfxlms32fFree(asptMcfdfxlms32f *mcfdfxlms)
Frees the allocated memory for this asptMcfdfxlms32f filter. - Returns :
- Input Parameters :
- mcfdfxlms : pointer to the asptMcfdfxlms32f filter
- Remarks :
-
Use this function only with filters created with mcfdfxlms32fInit(). Do not use with asptMcfdfxlms32f filters created using mcfdfxlms32fInitStatic().
<< Back to top
mcfdfxlms32fReset
DT32S mcfdfxlms32fReset(asptMcfdfxlms32f *mcfdfxlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfdfxlms32fResetDelayLine
DT32S mcfdfxlms32fResetDelayLine(asptMcfdfxlms32f *mcfdfxlms)
Resets the internal delay line to zeros.- Returns :
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfdfxlms32fGetCoef
DT32S mcfdfxlms32fGetCoef(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S ref,DT32S act,DT32S ind,DT32S N,DT32S flip)
Copies N internal filter coefficients of the transfer function between ref and act starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter.
- dstBuf : destination buffer.
- ind : index to the first coefficient to be copied.
- ref,act : specify the transfer function to be copied
- N : number of coefficients to be copied.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/mcfdfxlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcfdfxlms32fSetCoef
DT32S mcfdfxlms32fSetCoef(asptMcfdfxlms32f *mcfdfxlms,DT32F *newCoef,DT32S ref,DT32S act,DT32S ind,DT32S N,DT32S flip)
Initializes N coefficients of the (time domain) controller filter between reference ref and actuator act, starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients initialized, otherwise an error code (negative int).
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter to be set.
- newCoef : new coefficients vector.
- ref, act : specify the filter to be set.
- ind : index to the first coefficient to be set.
- N : number of coefficients to be set.
- flip : if not 0, will copy the coefficients in reverse order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/mcfdfxlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcfdfxlms32fGetEstSecPath
DT32S mcfdfxlms32fGetEstSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
Copies N internal (time domain) coefficients from the estimated secondary path filter between actuator act and sensor sen, starting from secPathEst[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter.
- dstBuf : destination buffer.
- act, ref : specify the filter to be copied.
- ind : index to the first coefficient to be copied.
- N : number of coefficients to be copied.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/mcfdfxlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : act/sen/ind/N is not a valid input value
<< Back to top
mcfdfxlms32fSetEstSecPath
DT32S mcfdfxlms32fSetEstSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
Initializes N internal (time domain) coefficients from the estimated secondary path filter between actuator act and sensor sen, starting from secPathEst[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter.
- newCoef : destination buffer.
- act, ref : specify the filter to be copied.
- ind : index to the first coefficient to be initialized.
- N : number of coefficients to be initialized.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/mcfdfxlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
mcfdfxlms32fGetSecPath
DT32S mcfdfxlms32fGetSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
Copies N internal (time domain) coefficients from the secondary path filter between actuator act and sensor sen, starting from secPath[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter.
- dstBuf : destination buffer.
- act, ref : specify the filter to be copied.
- ind : index to the first coefficient to be copied.
- N : number of coefficients to be copied.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/mcfdfxlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : act/sen/ind/N is not a valid input value
<< Back to top
mcfdfxlms32fSetSecPath
DT32S mcfdfxlms32fSetSecPath(asptMcfdfxlms32f *mcfdfxlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
Initializes N internal (time domain) coefficients from the secondary path filter between actuator act and sensor sen, starting from secPath[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- mcfdfxlms : pointer to an asptMcfdfxlms32f filter.
- newCoef : destination buffer.
- act, ref : specify the filter to be copied.
- ind : index to the first coefficient to be initialized.
- N : number of coefficients to be initialized.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/mcfdfxlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
mcfdfxlms32fResize
DT32S mcfdfxlms32fResize(asptMcfdfxlms32f *mcfdfxlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S newLen,DT32S newBlock)
Resizes an asptMcfdfxlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- mcfdfxlms : pointer to the asptMcfdfxlms32f filter to be resized
- Nref : Number of reference signals
- Nact : Number of secondary actuators
- Nsen : Number of error sensors
- newLen : required new filter length
- newBlock : new block length
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : Nref/Nact/Nsen/newLength/newBlock is not a valid input value
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Use this function only with dynamically allocated asptMcfdfxlms32f filters.