03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Function GFLIB_<strong>Control</strong>lerPIr_F32<br />

4.45.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltInErr;<br />

tFloat fltOutput;<br />

GFLIB_CONTROLLER_PIAW_P_T_FLT trMyPI = GFLIB_CONTROLLER_PIAW_P_DEFAULT_FLT;<br />

void main(void)<br />

{<br />

// input error = 0.25<br />

fltInErr = (tFloat)(0.25);<br />

}<br />

// controller parameters<br />

trMyPI.fltPropGain = (tFloat)(0.04);<br />

trMyPI.fltIntegGain = (tFloat)(0.02);<br />

trMyPI.fltIntegPartK_1 = 0;<br />

trMyPI.fltUpperLimit = (tFloat)(1.0);<br />

trMyPI.fltLowerLimit = (tFloat)(-1.0);<br />

// output should be 1.5e-2<br />

fltOutput = GFLIB_<strong>Control</strong>lerPIpAW_FLT (fltInErr, &trMyPI);<br />

// output should be 1.5e-2<br />

fltOutput = GFLIB_<strong>Control</strong>lerPIpAW (fltInErr, &trMyPI, Define FLT);<br />

// ##############################################################<br />

// Available only if single precision floating point implementation<br />

// selected as default<br />

// ##############################################################<br />

// output should be 1.5e-2<br />

fltOutput = GFLIB_<strong>Control</strong>lerPIpAW (fltInErr, &trMyPI);<br />

4.46 Function GFLIB_<strong>Control</strong>lerPIr_F32<br />

This function calculates a st<strong>and</strong>ard recurrent <strong>for</strong>m of the Proportional-Integral controller,<br />

without integral anti-windup.<br />

4.46.1 Declaration<br />

tFrac32 GFLIB_<strong>Control</strong>lerPIr_F32(tFrac32 f32InErr, GFLIB_CONTROLLER_PI_R_T_F32 *const pParam);<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

292 Freescale Semiconductor, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!