.

MEIFilterGainTypePIV

Definition

 
static MEIDataType MEIFilterGainTypePIV[MPIFilterCoeffCOUNT_MAX] =
{    
    MEIDataTypeFLOAT, /* Kpp              */
    MEIDataTypeFLOAT, /* Kip              */


    MEIDataTypeFLOAT, /* Kpv              */


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


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


    MEIDataTypeFLOAT, /* Kdv              */


    MEIDataTypeFLOAT, /* OutputLimit      */
    MEIDataTypeFLOAT, /* OutputLimitHigh  */
    MEIDataTypeFLOAT, /* OutputLimitLow   */
    MEIDataTypeFLOAT, /* OutputOffset     */


    MEIDataTypeFLOAT, /* Kiv              */
    MEIDataTypeFLOAT, /* Vintmax          */

MEIDataTypeFLOAT, /* Ka0 */ MEIDataTypeFLOAT, /* Ka1 */ MEIDataTypeFLOAT, /* Ka2 */ };

Description

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

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

Sample Code

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

     returnValue =        
         getPivFilterCoeff(filter, MEIFilterGainPIVCoeffGAINVELOCITY_PROPORTIONAL, &kpv);
*/
long getPivFilterCoeff(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(MEIFilterGainTypePIV[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 | MEIFilterGainTypePID | MEIFilterGainPIV | MEIDataType | MPIFilterGain

 

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