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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The bounds are described by a limitation element equation<br />

GFLIB_<strong>Control</strong>lerPIpAW_Eq12. When the bounds are exceeded the non-linear<br />

saturation characteristic will take effect <strong>and</strong> influence the dynamic behavior. The<br />

described limitation is implemented on the integral part accumulator (limitation during<br />

the calculation) <strong>and</strong> on the overall controller output. There<strong>for</strong>e, if the limitation occurs,<br />

the controller output is clipped to its bounds <strong>and</strong> the wind-up occurrence of the<br />

accumulator portion is avoided by saturating the actual sum.<br />

Note<br />

All controller parameters <strong>and</strong> states can be reset during<br />

declaration using the<br />

GFLIB_CONTROLLER_PIAW_P_DEFAULT_F32 macro.<br />

4.43.5 Re-entrancy<br />

The function is re-entrant.<br />

4.43.6 Code Example<br />

#include "gflib.h"<br />

tFrac32 f32InErr;<br />

tFrac32 f32Output;<br />

GFLIB_CONTROLLER_PIAW_P_T_F32 trMyPI = GFLIB_CONTROLLER_PIAW_P_DEFAULT_F32;<br />

void main(void)<br />

{<br />

// input error = 0.25<br />

f32InErr = FRAC32 (0.25);<br />

// controller parameters<br />

trMyPI.f32PropGain = FRAC32 (0.01);<br />

trMyPI.f32IntegGain = FRAC32 (0.02);<br />

trMyPI.s16PropGainShift = 1;<br />

trMyPI.s16IntegGainShift = 1;<br />

trMyPI.f32IntegPartK_1 = FRAC32 (0);<br />

trMyPI.f32UpperLimit = FRAC32 (1.0);<br />

trMyPI.f32LowerLimit = FRAC32 (-1.0);<br />

// output should be 0x01EB851E<br />

f32Output = GFLIB_<strong>Control</strong>lerPIpAW_F32 (f32InErr, &trMyPI);<br />

// output should be 0x01EB851E<br />

f32Output = GFLIB_<strong>Control</strong>lerPIpAW (f32InErr, &trMyPI, Define F32);<br />

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

// Available only if 32-bit fractional implementation selected<br />

// as default<br />

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

// output should be 0x01EB851E<br />

f32Output = GFLIB_<strong>Control</strong>lerPIpAW (f32InErr, &trMyPI);<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 />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 283

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

Saved successfully!

Ooh no, something went wrong!