AM243x Motor Control SDK  09.00.00
dcl_pid.h File Reference

Introduction

Contains 32-bit PID controller with its related structures and functions.

Go to the source code of this file.

Data Structures

struct  DCL_PID_SPS
 Defines DCL_PID shadow parameter set used for updating controller parameter. More...
 
struct  dcl_pid
 DCL_PID object for storing PID specific parameters. More...
 

Macros

#define PID_SPS_DEFAULTS   { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f }
 Defines default values to initialize DCL_PID_SPS. More...
 
#define PID_DEFAULTS
 Defines default values to initialize the DCL_PID structure. More...
 
#define PID_INT_DEFAULTS
 Macro for internal default values to initialize DCL_PID Example: DCL_PID pid_ctrl = { .Kp = 1.0f, .Ki = 0.0f, ... .Umin = -1.0f, PID_INT_DEFAULTS };. More...
 
#define DCL_initPID()   &(DCL_PID)PID_DEFAULTS
 Initialize DCL_PID struct with default parameters Example: DCL_PID* pid_ctrl = DCL_initPID();. More...
 
#define DCL_initPIDasParam(kp, ki, kd, kr, _c1, _c2, umax, umin)
 Initialize DCL_PID struct with input controller parameters Example: DCL_PID* pid_ctrl = DCL_initPIDasParam(1.0f,0.0f,0.0f,1.0f,1.0f,0.0f,1.0f,-1.0f); Note: input parameter needs to be in the same order as listed in PID_SPS struct. More...
 
#define DCL_initPIDasSPS(pid_ptr, sps_ptr)
 Initialize DCL_PID struct with SPS parameters Example: DCL_PID_SPS pid_sps = { .Kp = , .Ki = , ...}; //initial parameter DCL_PID pid_ctrl; DCL_initPIasSPS(&pid_ctrl,&pid_sps); Note: The newly declared DCL_PID structure will use the SPS input parameter as its attribute for sps. More...
 

Typedefs

typedef _DCL_VOLATILE struct dcl_pid DCL_PID
 
typedef _DCL_VOLATILE struct dcl_pidPID_Handle
 

Functions

_DCL_CODE_ACCESS void DCL_resetPID (DCL_PID *pid)
 Resets PID internal storage data with interrupt protection. More...
 
_DCL_CODE_ACCESS void DCL_fupdatePID (DCL_PID *pid)
 Loads PID tuning parameter from its SPS parameter. More...
 
_DCL_CODE_ACCESS _DCL_CODE_SECTION bool DCL_updatePID (DCL_PID *pid)
 Updates PID parameter from its SPS parameter with interrupt protection. More...
 
_DCL_CODE_ACCESS _DCL_CODE_SECTION bool DCL_pendingUpdatePID (DCL_PID *pid)
 A conditional update based on the pending-for-update flag. If the pending status is set, the function will update PID parameter from its SPS parameter and clear the status flag on completion. Note: Use DCL_setPendingStatus(pid) to set the pending status. More...
 
_DCL_CODE_ACCESS void DCL_updatePIDSPS (DCL_PID *pid)
 Update SPS parameter with active param, userful when needing to update only few active param from SPS and keep rest the same. More...
 
_DCL_CODE_ACCESS void DCL_setPIDfilterBW (DCL_PID *pid, float32_t fc)
 Loads the derivative path filter shadow coefficients. Note: Sampling period pid->css->t_sec are used in the calculation. New coefficients take effect when DCL_updatePID() is called. More...
 
_DCL_CODE_ACCESS void DCL_setActivePIDfilterBW (DCL_PID *pid, float32_t fc, float32_t t_sec)
 Loads the PID derivative path filter active coefficients Note: Sampling period pid->css->t_sec are used in the calculation. New coefficients take effect immediately. SPS & CSS contents are unaffected.
More...
 
_DCL_CODE_ACCESS float32_t DCL_getPIDfilterBW (DCL_PID *pid)
 Calculates the active derivative path filter bandwidth in Hz. Note: Sampling period pid->css->t_sec are used in the calculation. More...
 
_DCL_CODE_ACCESS void DCL_loadSeriesPIDasZPK (DCL_PID *pid, DCL_ZPK3 *zpk)
 Configures a series PID controller parameter in ZPK form. Note: Sampling period pid->css->t_sec are used in the calculation. Parameters take effect after call to DCL_updatePID(). Only z1, z2 & p2 considered, p1 = 0 assumed. More...
 
_DCL_CODE_ACCESS void DCL_loadParallelPIDasZPK (DCL_PID *pid, DCL_ZPK3 *zpk)
 Configures a parallel PID controller in ZPK form. Note: Sampling period pid->css->t_sec are used in the calculation. Parameters take effect after call to DCL_updatePID(). Only z1, z2 & p2 considered, p1 = 0 assumed. More...
 
_DCL_CODE_ACCESS _DCL_CODE_SECTION float32_t DCL_runPIDSeries (DCL_PID *pid, float32_t rk, float32_t yk, float32_t lk)
 Executes an ideal form PID controller. More...
 
_DCL_CODE_ACCESS _DCL_CODE_SECTION float32_t DCL_runPIDParallel (DCL_PID *pid, float32_t rk, float32_t yk, float32_t lk)
 Executes a parallel form PID controller. More...