Back to C-ASPT Contents Page
asptMcfdadjlms32f
API Summary
API to create and delete asptMcfdadjlms32f filters
- DT32S mcfdadjlms32fInit (asptMcfdadjlms32f *mcfdadjlms,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 mcfdadjlms32fInitStatic(asptMcfdadjlms32f *mcfdadjlms,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 mcfdadjlms32fFree(asptMcfdadjlms32f *mcfdadjlms)
API to filter and update asptMcfdadjlms32f filters
API to retrieve the properties of asptMcfdadjlms32f filters
- DT32S mcfdadjlms32fGetCoef(asptMcfdadjlms32f *mcfdadjlms,DT32F *dstBuf,DT32S ref,DT32S act,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdadjlms32fGetSecPath(asptMcfdadjlms32f *mcfdadjlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdadjlms32fGetEstSecPath(asptMcfdadjlms32f *mcfdadjlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- mcfdadjlms32fGetCoefPtr( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetSecPathPtr( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetEstSecPathPtr( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetFilterLength( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetBlockLength( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetSecPathLength( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetEstSecPathLength( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetFftLength( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetStepSize( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetConstrain( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetNrefs( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetNacts( asptMcfdadjlms32f
*mcfdadjlms )
- mcfdadjlms32fGetNsens( asptMcfdadjlms32f
*mcfdadjlms )
API to set the properties of asptMcfdadjlms32f filters
- DT32S mcfdadjlms32fReset(asptMcfdadjlms32f *mcfdadjlms)
- DT32S mcfdadjlms32fResetDelayLine(asptMcfdadjlms32f *mcfdadjlms)
- DT32S mcfdadjlms32fResize(asptMcfdadjlms32f *mcfdadjlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S newLen,DT32S newBlock)
- DT32S mcfdadjlms32fSetCoef(asptMcfdadjlms32f *mcfdadjlms,DT32F *newCoef,DT32S ref,DT32S act,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdadjlms32fSetSecPath(asptMcfdadjlms32f *mcfdadjlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- DT32S mcfdadjlms32fSetEstSecPath(asptMcfdadjlms32f *mcfdadjlms,DT32F *dstBuf,DT32S act,DT32S sen,DT32S ind,DT32S N,DT32S flip)
- mcfdadjlms32fSetStepSize( asptMcfdadjlms32f
*mcfdadjlms, newSs )
- mcfdadjlms32fSetConstrain( asptMcfdadjlms32f
*mcfdadjlms, newC )
- mcfdadjlms32fSetSecPathLength( asptMcfdadjlms32f
*mcfdadjlms, newL )
- mcfdadjlms32fSetEstSecPathLength( asptMcfdadjlms32f
*mcfdadjlms, newL )
Description
Implements the Multi-Channel Real-Time Frequency Domain ADJLMS algorithm. This version is intended for simulation purposes only. For real-time application use asptRtmcfdadjlms filters instead.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
mcfdadjlms32fInit
DT32S mcfdadjlms32fInit (asptMcfdadjlms32f *mcfdadjlms,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 asptMcfdadjlms32f filter and allocates its necessary storage buffers - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mcfdadjlms : pointer to the asptMcfdadjlms32f 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 :
- mcfdadjlms 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
mcfdadjlms32fInitStatic
DT32S mcfdadjlms32fInitStatic(asptMcfdadjlms32f *mcfdadjlms,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 asptMcfdadjlms32f filter to use pre-allocated memory blocks - Returns :
-
Error code. On failure, the filterLength member of the structure is set to zero.
- Input Parameters :
- mcfdadjlms : pointer to the asptMcfdadjlms32f 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 [(Nref+Nact)*C1+(Nref+Nact)*fftLength+(Nref+1)*BO2P1] DT32F locations to be used for data storage.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- mcfdadjlms 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(max(M,sL,seL)+L+-1)). C1 = fftLength - blockLength. BO2P1 = fftLength/2 + 1
<< Back to top
mcfdadjlms32fFilterUpdate
DT32S mcfdadjlms32fFilterUpdate(asptMcfdadjlms32f *mcfdadjlms, DT32F *ref, DT32F *prim, DT32F *sens)
Calculates the filter output and updates the coefficients vector according to the MCFDADJLMS algorithm. - Returns :
- Input Parameters :
- mcfdadjlms : pointer to the asptMcfdadjlms32f 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
mcfdadjlms32fFilterOnly
DT32S mcfdadjlms32fFilterOnly(asptMcfdadjlms32f *mcfdadjlms, 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 :
- mcfdadjlms : pointer to the asptMcfdadjlms32f 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
mcfdadjlms32fFree
void mcfdadjlms32fFree(asptMcfdadjlms32f *mcfdadjlms)
Frees the allocated memory for this asptMcfdadjlms32f filter. - Returns :
- Input Parameters :
- mcfdadjlms : pointer to the asptMcfdadjlms32f filter
- Remarks :
-
Use this function only with filters created with mcfdadjlms32fInit(). Do not use with asptMcfdadjlms32f filters created using mcfdadjlms32fInitStatic().
<< Back to top
mcfdadjlms32fReset
DT32S mcfdadjlms32fReset(asptMcfdadjlms32f *mcfdadjlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- mcfdadjlms : pointer to an asptMcfdadjlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfdadjlms32fResetDelayLine
DT32S mcfdadjlms32fResetDelayLine(asptMcfdadjlms32f *mcfdadjlms)
Resets the internal delay line to zeros.- Returns :
- Input Parameters :
- mcfdadjlms : pointer to an asptMcfdadjlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfdadjlms32fGetCoef
DT32S mcfdadjlms32fGetCoef(asptMcfdadjlms32f *mcfdadjlms,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 :
- mcfdadjlms : pointer to an asptMcfdadjlms 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/mcfdadjlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcfdadjlms32fSetCoef
DT32S mcfdadjlms32fSetCoef(asptMcfdadjlms32f *mcfdadjlms,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 :
- mcfdadjlms : pointer to an asptMcfdadjlms32f 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/mcfdadjlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcfdadjlms32fGetEstSecPath
DT32S mcfdadjlms32fGetEstSecPath(asptMcfdadjlms32f *mcfdadjlms,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 :
- mcfdadjlms : pointer to an asptMcfdadjlms32f 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/mcfdadjlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : act/sen/ind/N is not a valid input value
<< Back to top
mcfdadjlms32fSetEstSecPath
DT32S mcfdadjlms32fSetEstSecPath(asptMcfdadjlms32f *mcfdadjlms,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 :
- mcfdadjlms : pointer to an asptMcfdadjlms32f 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/mcfdadjlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
mcfdadjlms32fGetSecPath
DT32S mcfdadjlms32fGetSecPath(asptMcfdadjlms32f *mcfdadjlms,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 :
- mcfdadjlms : pointer to an asptMcfdadjlms32f 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/mcfdadjlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : act/sen/ind/N is not a valid input value
<< Back to top
mcfdadjlms32fSetSecPath
DT32S mcfdadjlms32fSetSecPath(asptMcfdadjlms32f *mcfdadjlms,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 :
- mcfdadjlms : pointer to an asptMcfdadjlms32f 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/mcfdadjlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
mcfdadjlms32fResize
DT32S mcfdadjlms32fResize(asptMcfdadjlms32f *mcfdadjlms,DT32S Nref,DT32S Nact,DT32S Nsen,DT32S newLen,DT32S newBlock)
Resizes an asptMcfdadjlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- mcfdadjlms : pointer to the asptMcfdadjlms32f 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 asptMcfdadjlms32f filters.