DCL PI2 (double integrator) Controller Functions
Module: Digital Control Library (DCL)
Structures
Name |
|
|---|---|
struct |
DCL_PI2_SPS |
Types
Name |
|
|---|---|
typedef _DCL_VOLATILE struct |
DCL_PI2 |
Functions
Name |
|
|---|---|
_DCL_CODE_ACCESS void |
DCL_resetPI2(DCL_PI2 * pi2) |
_DCL_CODE_ACCESS void |
DCL_forceUpdatePI2(DCL_PI2 * pi2) |
_DCL_CODE_ACCESS void |
DCL_updatePI2NoCheck(DCL_PI2 * pi2) |
_DCL_CODE_ACCESS bool |
DCL_updatePI2(DCL_PI2 * pi2) |
DCL_runPI2Series(DCL_PI2 * pi2, float32_t rk, float32_t yk) |
Defines
Name |
|
|---|---|
PI2_SPS_DEFAULTS |
|
PI2_DEFAULTS |
|
PI2_INT_DEFAULTS |
|
DCL_initPI2() |
|
DCL_initPI2asParam(kp, ki, umax, umin) |
|
DCL_initPI2asSPS(pi2_ptr, sps_ptr) |
Detailed Description
Contains PI2 (double integrator) controller with its related structures and functions
Types Documentation
typedef DCL_PI2
typedef _DCL_VOLATILE struct DCL_PI2;
DCL_PI2 object for storing PI2 specific parameters PI2 - PI controller with double integrators.
Functions Documentation
function DCL_resetPI2
_DCL_CODE_ACCESS void DCL_resetPI2(
DCL_PI2 * pi2
)
Resets PI2 internal storage data with interrupt protection.
Parameters:
pi2 Pointer to the DCL_PI2 structure
function DCL_forceUpdatePI2
_DCL_CODE_ACCESS void DCL_forceUpdatePI2(
DCL_PI2 * pi2
)
Loads PI2 tuning parameter from its SPS parameter without interrupt protection.
Parameters:
pi2 Pointer to the DCL_PI2 controller structure
function DCL_updatePI2NoCheck
_DCL_CODE_ACCESS void DCL_updatePI2NoCheck(
DCL_PI2 * pi2
)
Loads PI2 tuning parameter from its SPS parameter with interrupt protection.
Parameters:
pi2 Pointer to the DCL_PI2 controller structure
function DCL_updatePI2
_DCL_CODE_ACCESS bool DCL_updatePI2(
DCL_PI2 * pi2
)
A conditional update based on the update flag. If the update status is set, the function will update PI2 parameter from its SPS parameter and clear the status flag on completion.
Parameters:
pi2 Pointer to the DCL_PI2 controller structure
Return: ‘true’ if an update is applied, otherwise ‘false’
Note: Note: Use DCL_setUpdateStatus(pi2) to set the update status.
function DCL_runPI2Series
_DCL_CRIT_ACCESSfloat32_t DCL_runPI2Series(
DCL_PI2 * pi2,
float32_t rk,
float32_t yk
)
Executes an inline series form PI2 controller on the FPU32.
Parameters:
pi2 Pointer to the DCL_PI2 structure
rk The controller set-point reference
yk The measured feedback
Return: The control effort
Macros Documentation
define PI2_SPS_DEFAULTS
#define PI2_SPS_DEFAULTS {1.0f, 0.0f, 1.0f, -1.0f}
Defines default values to initialize DCL_PI2_SPS.
define PI2_DEFAULTS
#define PI2_DEFAULTS {1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, &(DCL_PI2_SPS)PI2_SPS_DEFAULTS, &(DCL_CSS)DCL_CSS_DEFAULTS}
Defines default values to initialize DCL_PI2.
define PI2_INT_DEFAULTS
#define PI2_INT_DEFAULTS .i6 = 0.0f, .i9 = 0.0f, .i12 = 1.0f, .i13 = 1.0f, .sps = &(DCL_PI2_SPS)PI2_SPS_DEFAULTS, \
.css = &(DCL_CSS)DCL_CSS_DEFAULTS
Macro for internal default values to initialize DCL_PI2 Example: DCL_PI2 pi2_ctrl = { .Kp = 1.0f, .Ki = 0.0f, .Umax = 1.0f, .Umin = -1.0f, PI2_INT_DEFAULTS };.
define DCL_initPI2
#define DCL_initPI2(
)
&(DCL_PI2)PI2_DEFAULTS
Initialize DCL_PI2 struct with default parameters Example: DCL_PI2 pi2_ctrl = DCL_initPI2();.
Return: A DCL_PI2* pointer
define DCL_initPI2asParam
#define DCL_initPI2asParam(
kp,
ki,
umax,
umin
)
&(DCL_PI2) \
{ \
.Kp = kp, .Ki = ki, .Umax = umax, .Umin = umin, PI2_INT_DEFAULTS \
}
Initialize DCL_PI2 struct with input controller parameters Example: DCL_PI2* pi2_ctrl = DCL_initPI2asParam(1.0f,0.0f,1.0f,-1.0f);.
Return: A DCL_PI2* pointer
Note: Note: input parameter needs to be in the same order as listed in PI2_SPS struct
define DCL_initPI2asSPS
#define DCL_initPI2asSPS(
pi2_ptr,
sps_ptr
)
({ \
DCL_PI2 *new_pi = (pi2_ptr) ? pi2_ptr : DCL_initPI2(); \
DCL_PI2_SPS *new_sps = (sps_ptr) ? sps_ptr : &(DCL_PI2_SPS)PI2_SPS_DEFAULTS; \
if (sps_ptr) \
{ \
*new_pi = \
(DCL_PI){(new_sps)->Kp, (new_sps)->Ki, (new_sps)->Umax, (new_sps)->Umin, 0.0f, 0.0f, \
1.0f, 1.0f, (DCL_PI_SPS *)new_sps, &(DCL_CSS)DCL_CSS_DEFAULTS}; \
} \
new_pi; \
})
Initialize DCL_PI2 struct with sps parameters Example: DCL_PI2_SPS pi2_sps = { .Kp = , .Ki = , …}; DCL_PI2 pi2_ctrl; DCL_initPI2asSPS(&pi2_ctrl,&pi2_sps);.
Parameters:
pi2_ptr DCL_PI2* pointer that needs to be initialized
sps_ptr DCL_PI2_SPS* pointer with assigned parameters
Return: Returns DCL_PI2* with set sps parameters, default parameter will be used if sps_ptr is not specified