mpiFilterPosfilterSectionGet

Declaration

int32_t mpiFilterPostFilterSectionGet(MPIFilter                   filter,
                                   int32_t                        sectionNumber,
                                   MPIFilterPostFilterSection  *section);

Required Header: stdmpi.h

Description

mpiFilterPostFilterSectionGet reads the configuration of a single section of an MPIFilter object's postfilter. It writes to *section the configuration of filter's postfilter sectionNumberth section.

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 section configuration is to be read.
sectionNumber the index of the postfilter section whose configuration is to be read.
section the data location where the postfilter's current section configuration data will be written.
Return Values
MPIMessageOK
MPIFilterMessageCONVERSION_DIV_BY_0
MPIFilterMessageSECTION_NOT_ENABLED
MPIFilterMessageINVALID_FILTER_FORM

Sample Code

/*   Test a section of a MPIFilter object's postfilter to 
     see if it is a notch type. 
     Sample usage:   

     returnValue =        
         isSectionTypeNotch(filter, 0, &isNotch);
*/
int32_t isSectionTypeNotch(MPIFilter filter, int32_t sectionIndex, int32_t* isNotch)
{
    MPIFilterConfig config;    
    MPIFilterPostFilterSection section;    
    int32_t returnValue = (isNotch==NULL) ? MPIMessageARG_INVALID : MPIMessageOK; 

    if (returnValue == MPIMessageOK)    
    {        
        returnValue =            
            mpiFilterPostFilterSectionGet(filter, sectionIndex, §ion);
        if (returnValue == MPIMessageOK)        
        {            
            *isNotch = (section.type == MPIFilterPostFilterSectionTypeNOTCH) ? TRUE : FALSE; 
        }    
     }    
     return returnValue;
}

See Also

MPIFilterPostFilterSection | mpiFilterPostFilterGet | meFilterPostfilterSectionSet | MPIFilterPostFilterSectionCOUNT_MAX | Post Filter Theory