.

MEIFilterGainTypePID

Definition

 
static MEIDataType MEIFilterGainTypePID[MPIFilterCoeffCOUNT_MAX] =
{
    MEIDataTypeFLOAT, /* Kp               */
    MEIDataTypeFLOAT, /* Ki               */
    MEIDataTypeFLOAT, /* Kd               */

    MEIDataTypeFLOAT, /* Kpff             */
    MEIDataTypeFLOAT, /* Kvff             */
    MEIDataTypeFLOAT, /* Kaff             */
    MEIDataTypeFLOAT, /* Kfff             */

    MEIDataTypeFLOAT, /* MovingIMax       */
    MEIDataTypeFLOAT, /* RestIMax         */

    MEIDataTypeLONG,  /* DRate            */

    MEIDataTypeFLOAT, /* OutputLimit      */
    MEIDataTypeFLOAT, /* OutputLimitHigh  */
    MEIDataTypeFLOAT, /* OutputLimitLow   */
    MEIDataTypeFLOAT, /* OutputOffset     */
    MEIDataTypeFLOAT, /* Ka0              */
    MEIDataTypeFLOAT, /* Ka1              */
    MEIDataTypeFLOAT, /* Ka2              */
};

Description

MEIFilterGainTypePID is a static array that describes the data type of the coefficients for the PID algorithm. Specifically, an element of MEIFilterGainTypePID describes which member of the union MPIFilterCoeff to access when using the data structure MPIFilterCoeff.

MEIFilterGainTypePID allows for a more simple design of general case utilities and configuration routines. If it is known that only the PID parameters will be used, then the data structure MEIFilterGainPID can be used directly without having to manipulate MPIFilterCoeff, MPIFilterCoeff, and MEIFilterGainTypePID.

Sample Code

/*  Read the current value of a filter's PID coefficient.  Sample usage:

    returnValue =        
        getPidFilterCoeff(filter, MEIFilterGainPIDCoeffGAIN_PROPORTIONAL, &kp);
*/
long getPidFilterCoeff(MPIFilter filter, long index, double* value)
{    

    MPIFilterConfig config;    
    long returnValue = (value==NULL) ? MPIMessageARG_INVALID : MPIMessageOK; 

    if (returnValue == MPIMessageOK)    
    {        
        returnValue = mpiFilterConfigGet(filter, &config, NULL);        

        if (returnValue == MPIMessageOK)        
        {            
            switch(MEIFilterGainTypePID[index])            
            {                
                case MEIDataTypeLONG:                    
                    *value = config.gain[config.gainIndex].coeff[index].l;
                    break;                
                case MEIDataTypeFLOAT:                    
                    *value = config.gain[config.gainIndex].coeff[index].f;
                    break;                
                default:                   
                    returnValue = MPIMessageARG_INVALID;            
             }        
         }    
    }    
return returnValue;
}

See Also

MPIFilterCoeff | MEIFilterGainTypePIV | MEIFilterGainPID | MEIDataType | MPIFilterGain

 

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