.

meiFilterPosfilterGet

Declaration

 
long meiFilterPostfilterGet(MPIFilter             filter,
                            long                  *sectionCount,
                            MEIPostfilterSection  *sections);
 

Required Header: stdmei.h

Description

meiFilterPostfilterGet reads an MPIFilter object's postfilter configuration. It writes to sectionCount the number of sections within a postfilter if sectionCount is not NULL. It also writes to sections the current array of filter's postfilter sections if sections is not NULL.

The MPI calculates the post filter coefficients and takes into consideration the sample rate of the controller at that time. If you change the sample rate of the controller, you will need to recalculate the post filters. This can be done for all filters specified in Hertz by setting the filters again with the MPI. The MPI will calculate the filters using the current servo sample rate.

Postfilters are used to digitally filter the output of a control loop. One common use for postfilters is the compensation of system resonances.

 
filter the handle of the MPIFilter object whose postfilter configuration is to be read.
*sectionCount the data location where the postfilter's current section count will be written.
*sections the data location where the postfilter's current section configuration data will be written.
   
 
Return Values
MPIMessageOK  
MPIFilterMessageCONVERSION_DIV_BY_0  
MPIFilterMessageINVALID_FILTER_FORM  

Sample Code


/*   Count the number of resonator sections in a MPIFilter object's postfilter.   
     Sample usage:   

     returnValue =        
         filterResonatorCount(filter, &resonatorCount);
*/

long filterResonatorCount(MPIFilter filter, long* count)
{    
     MPIFilterConfig config;    
     MEIPostfilterSection sections[MEIMaxBiQuadSections];    
     long sectionCount, index;    
     long returnValue = (count==NULL) ? MPIMessageARG_INVALID : MPIMessageOK;    
    
     if (returnValue == MPIMessageOK)    
     {        
         returnValue =            
             meiFilterPostfilterGet(filter, &sectionCount, sections);  
      
         if (returnValue == MPIMessageOK)        
         {            
             for (*count=0, index=0; index sectionCount; ++index)            
             {                
                  if (section[index].type == MEIFilterTypeRESONATOR) ++(*count);
             }        
         }    
      }    
      return returnValue;
}

See Also

MEIPostfilterSection | meiFilterPostfilterGet | meiFilterPostfilterSet | meFilterPostfilterSectionGet | MEIMaxBiQuadSections | Post Filter Theory

 

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