|
AM243x Motor Control SDK
09.00.00
|
|
Go to the documentation of this file.
50 #include "../dcl_common.h"
57 typedef struct dcl_df11_sps
64 #define DF11_SPS_DEFAULTS { 0.5f, 0.5f, 1.0f }
86 #define DF11_DEFAULTS { 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, \
87 &(DCL_DF11_SPS)DF11_SPS_DEFAULTS, &(DCL_CSS)DCL_CSS_DEFAULTS }
96 #define DF11_INT_DEFAULTS .d1=0.0f, .d2=0.0f, .sps=&(DCL_DF11_SPS)DF11_SPS_DEFAULTS, .css=&(DCL_CSS)DCL_CSS_DEFAULTS
103 #define DCL_initDF11() &(DCL_DF11)DF11_DEFAULTS
111 #define DCL_initDF11asParam(_b0,_b1,_a1) &(DCL_DF11){ .b0=_b0, .b1=_b1, .a1=_a1, \
124 #define DCL_initDF11asSPS(df_ptr,sps_ptr) \
126 DCL_DF11* new_df = (df_ptr) ? df_ptr : DCL_initDF11(); \
127 DCL_DF11_SPS* new_sps = (sps_ptr) ? sps_ptr : &(DCL_DF11_SPS)DF11_SPS_DEFAULTS;\
130 *new_df = (DCL_DF11){ (new_sps)->b0, (new_sps)->b1, (new_sps)->a1, \
131 0.0f, 0.0f, (DCL_DF11_SPS*)new_sps, &(DCL_CSS)DCL_CSS_DEFAULTS }; \
144 df->d1 = df->d2 = 0.0f;
155 df->b0 = df->sps->b0;
156 df->b1 = df->sps->b1;
157 df->a1 = df->sps->a1;
172 df->b0 = df->sps->b0;
173 df->b1 = df->sps->b1;
174 df->a1 = df->sps->a1;
209 df->sps->b0 = df->b0;
210 df->sps->b1 = df->b1;
211 df->sps->a1 = df->a1;
236 #ifdef DCL_ERROR_HANDLING_ENABLED
250 df->sps->b0 = zpk->
K * (2.0f - (
float32_t) crealf(zpk->
z1) * t_sec) / a0p;
251 df->sps->b1 = zpk->
K * (-2.0f - (
float32_t) crealf(zpk->
z1) * t_sec) / a0p;
252 df->sps->a1 = (-2.0f - (
float32_t) crealf(zpk->
p1) * t_sec) / a0p;
266 #ifdef DCL_ERROR_HANDLING_ENABLED
279 df->sps->b0 = Kp * ((Ki * t_sec) + 2.0f) / 2.0f;
280 df->sps->b1 = Kp * ((Ki * t_sec) - 2.0f) / 2.0f;
293 df->d2 = (ek * df->b0) + (df->d1 * df->b1) - (df->d2 * df->a1);
305 #endif // _DCL_DF11_H_
float32_t K
Real gain.
Definition: dcl_zpk3.h:69
@ dcl_param_warn_err
Parameter warning.
Definition: dcl_error.h:60
#define _DCL_CODE_SECTION
Defines dcl function section that users can specify in the linker file(.cmd) and to accelerate perfor...
Definition: dcl_common.h:60
#define DCL_clearPendingStatus(p)
Definition: dcl_css.h:129
#define DCL_setUpdateStatus(p)
Macros to set and clear the update-in-progress flag.
Definition: dcl_css.h:116
_DCL_VOLATILE struct dcl_df11 DCL_DF11
#define DCL_runErrorHandler(ptr)
Prototype for basic error handler.
Definition: dcl_error.h:107
#define DCL_getUpdateStatus(p)
Determine whether a parameter update-in-progress flag is set.
Definition: dcl_css.h:123
DCL_DF11 object for storing df11 specific parameters.
Definition: dcl_df11.h:69
_DCL_CODE_ACCESS _DCL_CODE_SECTION bool DCL_pendingUpdateDF11(DCL_DF11 *df)
A conditional update based on the pending-for-update flag. If the pending status is set,...
Definition: dcl_df11.h:191
#define DCL_clearUpdateStatus(p)
Definition: dcl_css.h:117
#define _DCL_CODE_ACCESS
Defines the scope of dcl functions (static inline/extern inline/none)
Definition: dcl_common.h:55
float complex p1
Complex poles 1.
Definition: dcl_zpk3.h:66
@ dcl_none
No error.
Definition: dcl_error.h:57
_DCL_CODE_ACCESS bool DCL_isStablePn1(float32_t a1)
Determines stability of a first order real polynomial P(z) = z + a1.
Definition: dcl_stability.h:58
_DCL_CODE_ACCESS void DCL_resetDF11(DCL_DF11 *df)
Resets DF11 internal storage data with interrupt protection.
Definition: dcl_df11.h:141
_DCL_CODE_ACCESS void DCL_loadDF11asPI(DCL_DF11 *df, float32_t Kp, float32_t Ki)
Loads compensator coefficients to emulate series form PI Note: Sampling period df->css->t_sec are use...
Definition: dcl_df11.h:264
uint32_t dcl_interrupt_t
Definition: dcl_common.h:96
float32_t d2
u(k-1)
Definition: dcl_df11.h:77
#define DCL_isZero(x)
Determines floating point numerical proximity to zero.
Definition: dcl_aux.h:77
_DCL_CODE_ACCESS void DCL_updateDF11SPS(DCL_DF11 *df)
Update SPS parameter with active param, userful when needing to update only few active param from SPS...
Definition: dcl_df11.h:207
_DCL_CODE_ACCESS void DCL_loadDF11asZPK(DCL_DF11 *df, DCL_ZPK3 *zpk)
Loads the DF11 shadow coefficients from a ZPK3 description Note: Sampling period df->css->t_sec are u...
Definition: dcl_df11.h:234
@ dcl_param_invalid_err
Parameter not valid.
Definition: dcl_error.h:59
float32_t a1
neg. coefficient to u(k-1)
Definition: dcl_df11.h:61
float32_t b0
pos. coefficient to e(k)
Definition: dcl_df11.h:59
_DCL_CODE_ACCESS bool DCL_isStableDF11(DCL_DF11 *df)
Determines stability of the shadow DF11 compensator.
Definition: dcl_df11.h:220
float32_t b1
pos. coefficient to e(k-1)
Definition: dcl_df11.h:60
Defines the controller common support structure.
Definition: dcl_css.h:57
#define DCL_getPendingStatus(p)
Determine whether a parameter pending-for-update flag is set.
Definition: dcl_css.h:135
#define DCL_restoreInts(v)
Definition: dcl_common.h:95
Defines the DCL_ZPK3 controller structure.
Definition: dcl_zpk3.h:62
#define _DCL_VOLATILE
Defines volatile for DCL strctures Flags can be defined in dcl.h or user files before including DCL l...
Definition: dcl_common.h:68
Defines DCL_DF11 shadow parameter set used for updating compensator parameter.
Definition: dcl_df11.h:58
DCL_CSS * css
Pointer to the common support structure.
Definition: dcl_df11.h:81
_DCL_CODE_ACCESS _DCL_CODE_SECTION float32_t DCL_runDF11(DCL_DF11 *df, float32_t ek)
Executes a 1st order Direct Form 1 controller.
Definition: dcl_df11.h:291
float32_t a1
neg. coefficient to u(k-1)
Definition: dcl_df11.h:73
#define DCL_getErrorInfo(ptr)
Macro to store error info in CSS.
Definition: dcl_error.h:97
_DCL_VOLATILE struct dcl_df11 * DF11_Handle
#define DCL_setError(ptr, code)
Macro to set error code in CSS.
Definition: dcl_error.h:79
_DCL_CODE_ACCESS _DCL_CODE_SECTION bool DCL_updateDF11(DCL_DF11 *df)
Updates DF11 parameter from its SPS parameter with interrupt protection.
Definition: dcl_df11.h:166
float32_t b0
pos. coefficient to e(k)
Definition: dcl_df11.h:71
DCL_DF11_SPS * sps
Pointer to the shadow parameter set.
Definition: dcl_df11.h:80
_DCL_CODE_ACCESS void DCL_fupdateDF11(DCL_DF11 *df)
Loads DF11 tuning parameter from its SPS parameter.
Definition: dcl_df11.h:153
float float32_t
Defines single,double precision data type. Note: Assumes ABI to be TI_EABI, does not support legacy T...
Definition: dcl_common.h:51
float32_t d1
e(k-1)
Definition: dcl_df11.h:76
float32_t b1
pos. coefficient to e(k-1)
Definition: dcl_df11.h:72
float complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:63
#define DCL_disableInts()
Define enable and disable interrupt operations.
Definition: dcl_common.h:94