Data Structures | Typedefs | Functions
PID

Data Structures

struct  _PID_Obj_
 Defines the PID controller object. More...
 

Typedefs

typedef struct _PID_Obj_ PID_Obj
 Defines the PID controller object. More...
 
typedef struct _PID_Obj_PID_Handle
 Defines the PID handle. More...
 

Functions

void PID_getDerFilterParams (PID_Handle handle, float32_t *b0, float32_t *b1, float32_t *a1, float32_t *x1, float32_t *y1)
 Gets the derivative filter parameters. More...
 
static float32_t PID_getFbackValue (PID_Handle handle)
 Gets the feedback value in the PID controller. More...
 
static float32_t PID_getFfwdValue (PID_Handle handle)
 Gets the feedforward value in the PID controller. More...
 
static void PID_getGains (PID_Handle handle, float32_t *pKp, float32_t *pKi, float32_t *pKd)
 Gets the gains in the PID controller. More...
 
static float32_t PID_getKd (PID_Handle handle)
 Gets the derivative gain in the PID controller. More...
 
static float32_t PID_getKi (PID_Handle handle)
 Gets the integral gain in the PID controller. More...
 
static float32_t PID_getKp (PID_Handle handle)
 Gets the proportional gain in the PID controller. More...
 
static void PID_getMinMax (PID_Handle handle, float32_t *pOutMin, float32_t *pOutMax)
 Gets the minimum and maximum output value allowed in the PID controller. More...
 
static float32_t PID_getOutMax (PID_Handle handle)
 Gets the maximum output value allowed in the PID controller. More...
 
static float32_t PID_getOutMin (PID_Handle handle)
 Gets the minimum output value allowed in the PID controller. More...
 
static float32_t PID_getRefValue (PID_Handle handle)
 Gets the reference value in the PID controller. More...
 
static float32_t PID_getUi (PID_Handle handle)
 Gets the integrator start value in the PID controller. More...
 
PID_Handle PID_init (void *pMemory, const size_t numBytes)
 Initializes the PID controller. More...
 
void PID_setDerFilterParams (PID_Handle handle, const float32_t b0, const float32_t b1, const float32_t a1, const float32_t x1, const float32_t y1)
 Sets the derivative filter parameters. More...
 
static void PID_setFbackValue (PID_Handle handle, const float32_t fbackValue)
 Sets the feedback value in the PID controller. More...
 
static void PID_setFfwdValue (PID_Handle handle, const float32_t ffwdValue)
 Sets the feedforward value in the PID controller. More...
 
static void PID_setGains (PID_Handle handle, const float32_t Kp, const float32_t Ki, const float32_t Kd)
 Sets the gains in the PID controller. More...
 
static void PID_setKd (PID_Handle handle, const float32_t Kd)
 Sets the derivative gain in the PID controller. More...
 
static void PID_setKi (PID_Handle handle, const float32_t Ki)
 Sets the integral gain in the PID controller. More...
 
static void PID_setKp (PID_Handle handle, const float32_t Kp)
 Sets the proportional gain in the PID controller. More...
 
static void PID_setMinMax (PID_Handle handle, const float32_t outMin, const float32_t outMax)
 Sets the minimum and maximum output value allowed in the PID controller. More...
 
static void PID_setOutMax (PID_Handle handle, const float32_t outMax)
 Sets the maximum output value allowed in the PID controller. More...
 
static void PID_setOutMin (PID_Handle handle, const float32_t outMin)
 Sets the minimum output value allowed in the PID controller. More...
 
static void PID_setRefValue (PID_Handle handle, const float32_t refValue)
 Sets the reference value in the PID controller. More...
 
static void PID_setUi (PID_Handle handle, const float32_t Ui)
 Sets the integrator start value in the PID controller. More...
 
static void PID_run_parallel (PID_Handle handle, const float32_t refValue, const float32_t fbackValue, const float32_t ffwdValue, float32_t *pOutValue)
 Runs the parallel form of the PID controller. More...
 
static void PID_run_series (PID_Handle handle, const float32_t refValue, const float32_t fbackValue, const float32_t ffwdValue, float32_t *pOutValue)
 Runs the series form of the PID controller. More...
 

Detailed Description

Typedef Documentation

◆ PID_Obj

typedef struct _PID_Obj_ PID_Obj

Defines the PID controller object.

◆ PID_Handle

typedef struct _PID_Obj_* PID_Handle

Defines the PID handle.

Function Documentation

◆ PID_getDerFilterParams()

void PID_getDerFilterParams ( PID_Handle  handle,
float32_t b0,
float32_t b1,
float32_t a1,
float32_t x1,
float32_t y1 
)

Gets the derivative filter parameters.

       y[n] = b0*x[n] + b1*x[n-1] - a1*y[n-1]
Parameters
[in]handleThe PID controller handle
[in]b0The numerator filter coefficient value for z^0
[in]b1The numerator filter coefficient value for z^(-1)
[in]a1The denominator filter coefficient value for z^(-1)
[in]x1The input value at time sample n=-1
[in]y1The output value at time sample n=-1
Returns
None

◆ PID_getFbackValue()

static float32_t PID_getFbackValue ( PID_Handle  handle)
inlinestatic

Gets the feedback value in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The feedback value in the PID controller

References _PID_Obj_::fbackValue.

◆ PID_getFfwdValue()

static float32_t PID_getFfwdValue ( PID_Handle  handle)
inlinestatic

Gets the feedforward value in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The feedforward value in the PID controller

References _PID_Obj_::ffwdValue.

◆ PID_getGains()

static void PID_getGains ( PID_Handle  handle,
float32_t pKp,
float32_t pKi,
float32_t pKd 
)
inlinestatic

Gets the gains in the PID controller.

Parameters
[in]handleThe PID controller handle
[out]pKpThe pointer to the proportional gain value
[out]pKiThe pointer to the integrator gain value
[out]pKdThe pointer to the derivative gain value
Returns
None

References _PID_Obj_::Kd, _PID_Obj_::Ki, and _PID_Obj_::Kp.

◆ PID_getKd()

static float32_t PID_getKd ( PID_Handle  handle)
inlinestatic

Gets the derivative gain in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The derivative gain in the PID controller

References _PID_Obj_::Kd.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_getKi()

static float32_t PID_getKi ( PID_Handle  handle)
inlinestatic

Gets the integral gain in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The integral gain in the PID controller

References _PID_Obj_::Ki.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_getKp()

static float32_t PID_getKp ( PID_Handle  handle)
inlinestatic

Gets the proportional gain in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The proportional gain in the PID controller

References _PID_Obj_::Kp.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_getMinMax()

static void PID_getMinMax ( PID_Handle  handle,
float32_t pOutMin,
float32_t pOutMax 
)
inlinestatic

Gets the minimum and maximum output value allowed in the PID controller.

Parameters
[in]handleThe PID controller handle
[out]pOutMinThe pointer to the minimum output value allowed
[out]pOutMaxThe pointer to the maximum output value allowed
Returns
None

References _PID_Obj_::outMax, and _PID_Obj_::outMin.

◆ PID_getOutMax()

static float32_t PID_getOutMax ( PID_Handle  handle)
inlinestatic

Gets the maximum output value allowed in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The maximum output value allowed

References _PID_Obj_::outMax.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_getOutMin()

static float32_t PID_getOutMin ( PID_Handle  handle)
inlinestatic

Gets the minimum output value allowed in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The minimum output value allowed

References _PID_Obj_::outMin.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_getRefValue()

static float32_t PID_getRefValue ( PID_Handle  handle)
inlinestatic

Gets the reference value in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The reference value in the PID controller

References _PID_Obj_::refValue.

◆ PID_getUi()

static float32_t PID_getUi ( PID_Handle  handle)
inlinestatic

Gets the integrator start value in the PID controller.

Parameters
[in]handleThe PID controller handle
Returns
The integrator start value for the PID controller

References _PID_Obj_::Ui.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_init()

PID_Handle PID_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the PID controller.

Parameters
[in]pMemoryA pointer to the memory for the PID controller object
[in]numBytesThe number of bytes allocated for the PID controller object, bytes
Returns
The PID controller (PID) object handle

◆ PID_setDerFilterParams()

void PID_setDerFilterParams ( PID_Handle  handle,
const float32_t  b0,
const float32_t  b1,
const float32_t  a1,
const float32_t  x1,
const float32_t  y1 
)

Sets the derivative filter parameters.

       y[n] = b0*x[n] + b1*x[n-1] - a1*y[n-1]
Parameters
[in]handleThe PID controller handle
[in]b0The numerator filter coefficient value for z^0
[in]b1The numerator filter coefficient value for z^(-1)
[in]a1The denominator filter coefficient value for z^(-1)
[in]x1The input value at time sample n=-1
[in]y1The output value at time sample n=-1
Returns
None

◆ PID_setFbackValue()

static void PID_setFbackValue ( PID_Handle  handle,
const float32_t  fbackValue 
)
inlinestatic

Sets the feedback value in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]fbackValueThe feedback value
Returns
None

References _PID_Obj_::fbackValue.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_setFfwdValue()

static void PID_setFfwdValue ( PID_Handle  handle,
const float32_t  ffwdValue 
)
inlinestatic

Sets the feedforward value in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]ffwdValueThe feedforward value
Returns
None

References _PID_Obj_::ffwdValue.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_setGains()

static void PID_setGains ( PID_Handle  handle,
const float32_t  Kp,
const float32_t  Ki,
const float32_t  Kd 
)
inlinestatic

Sets the gains in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]KpThe proportional gain for the PID controller
[in]KiThe integrator gain for the PID controller
[in]KdThe derivative gain for the PID controller
Returns
None

References _PID_Obj_::Kd, _PID_Obj_::Ki, and _PID_Obj_::Kp.

◆ PID_setKd()

static void PID_setKd ( PID_Handle  handle,
const float32_t  Kd 
)
inlinestatic

Sets the derivative gain in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]KdThe derivative gain for the PID controller
Returns
None

References _PID_Obj_::Kd.

◆ PID_setKi()

static void PID_setKi ( PID_Handle  handle,
const float32_t  Ki 
)
inlinestatic

Sets the integral gain in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]KiThe integral gain for the PID controller
Returns
None

References _PID_Obj_::Ki.

◆ PID_setKp()

static void PID_setKp ( PID_Handle  handle,
const float32_t  Kp 
)
inlinestatic

Sets the proportional gain in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]KpThe proportional gain for the PID controller
Returns
None

References _PID_Obj_::Kp.

◆ PID_setMinMax()

static void PID_setMinMax ( PID_Handle  handle,
const float32_t  outMin,
const float32_t  outMax 
)
inlinestatic

Sets the minimum and maximum output value allowed in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]outMinThe minimum output value allowed
[in]outMaxThe maximum output value allowed
Returns
None

References _PID_Obj_::outMax, and _PID_Obj_::outMin.

◆ PID_setOutMax()

static void PID_setOutMax ( PID_Handle  handle,
const float32_t  outMax 
)
inlinestatic

Sets the maximum output value allowed in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]outMaxThe maximum output value allowed
Returns
None

References _PID_Obj_::outMax.

◆ PID_setOutMin()

static void PID_setOutMin ( PID_Handle  handle,
const float32_t  outMin 
)
inlinestatic

Sets the minimum output value allowed in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]outMaxThe minimum output value allowed
Returns
None

References _PID_Obj_::outMin.

◆ PID_setRefValue()

static void PID_setRefValue ( PID_Handle  handle,
const float32_t  refValue 
)
inlinestatic

Sets the reference value in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]refValueThe reference value
Returns
None

References _PID_Obj_::refValue.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_setUi()

static void PID_setUi ( PID_Handle  handle,
const float32_t  Ui 
)
inlinestatic

Sets the integrator start value in the PID controller.

Parameters
[in]handleThe PID controller handle
[in]UiThe integral start value for the PID controller
Returns
None

References _PID_Obj_::Ui.

Referenced by PID_run_parallel(), and PID_run_series().

◆ PID_run_parallel()

static void PID_run_parallel ( PID_Handle  handle,
const float32_t  refValue,
const float32_t  fbackValue,
const float32_t  ffwdValue,
float32_t pOutValue 
)
inlinestatic

Runs the parallel form of the PID controller.

Parameters
[in]handleThe PID controller handle
[in]refValueThe reference value to the controller
[in]fbackValueThe feedback value to the controller
[in]ffwdValueThe feedforward value to the controller
[in]pOutValueThe pointer to the controller output value
Returns
None

References _PID_Obj_::derFilterHandle, _PID_Obj_::fbackValue, _PID_Obj_::ffwdValue, FILTER_FO_run(), _PID_Obj_::Kd, _PID_Obj_::Ki, _PID_Obj_::Kp, MATH_sat(), _PID_Obj_::outMax, _PID_Obj_::outMin, PID_getKd(), PID_getKi(), PID_getKp(), PID_getOutMax(), PID_getOutMin(), PID_getUi(), PID_setFbackValue(), PID_setFfwdValue(), PID_setRefValue(), PID_setUi(), _PID_Obj_::refValue, and _PID_Obj_::Ui.

◆ PID_run_series()

static void PID_run_series ( PID_Handle  handle,
const float32_t  refValue,
const float32_t  fbackValue,
const float32_t  ffwdValue,
float32_t pOutValue 
)
inlinestatic

Runs the series form of the PID controller.

Parameters
[in]handleThe PID controller handle
[in]refValueThe reference value to the controller
[in]fbackValueThe feedback value to the controller
[in]ffwdValueThe feedforward value to the controller
[in]pOutValueThe pointer to the controller output value
Returns
None

References _PID_Obj_::derFilterHandle, _PID_Obj_::fbackValue, _PID_Obj_::ffwdValue, FILTER_FO_run(), _PID_Obj_::Kd, _PID_Obj_::Ki, _PID_Obj_::Kp, MATH_sat(), _PID_Obj_::outMax, _PID_Obj_::outMin, PID_getKd(), PID_getKi(), PID_getKp(), PID_getOutMax(), PID_getOutMin(), PID_getUi(), PID_setFbackValue(), PID_setFfwdValue(), PID_setRefValue(), PID_setUi(), _PID_Obj_::refValue, and _PID_Obj_::Ui.


Copyright 2023, Texas Instruments Incorporated