|
AM263x Digital Power SDK
09.01.00
|
|
Go to the documentation of this file.
76 #include "../dcl_common.h"
83 typedef struct dcl_df13_sps {
94 #define DF13_SPS_DEFAULTS { 0.25f, 0.25f, 0.25f, 0.25f, 0.0f, 0.0f, 0.0f, 0.0f }
128 #define DF13_DEFAULTS { 0.25f, 0.25f, 0.25f, 0.25f, 0.0f, 0.0f, 0.0f, \
129 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, \
130 &(DCL_DF13_SPS)DF13_SPS_DEFAULTS, &(DCL_CSS)DCL_CSS_DEFAULTS }
140 #define DF13_INT_DEFAULTS .d1=0.0f, .d2=0.0f, .d3=0.0f, .d4=0.0f, .d5=0.0f, \
141 .d6=0.0f, .a0=0.0f, .d0=0.0f, .d7=0.0f, \
142 .sps=&(DCL_DF13_SPS)DF13_SPS_DEFAULTS, .css=&(DCL_CSS)DCL_CSS_DEFAULTS
149 #define DCL_initDF13() &(DCL_DF13)DF13_DEFAULTS
157 #define DCL_initDF13asParam(_b0,_b1,_b2,_b3,_a1,_a2,_a3) &(DCL_DF13){ .b0=_b0, .b1=_b1, \
158 .b2=_b2, .b3=_b3, .a1=_a1, .a2=_a2, .a3=_a3, DF13_INT_DEFAULTS }
170 #define DCL_initDF13asSPS(df_ptr,sps_ptr) \
172 DCL_DF13* new_df = (df_ptr) ? df_ptr : DCL_initDF13(); \
173 DCL_DF13_SPS* new_sps = (sps_ptr) ? sps_ptr : &(DCL_DF13_SPS)DF13_SPS_DEFAULTS; \
176 *new_df =(DCL_DF13){ (new_sps)->b0, (new_sps)->b1, (new_sps)->b2, (new_sps)->b3, \
177 (new_sps)->a1, (new_sps)->a2, (new_sps)->a3, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, \
178 0.0f, 0.0f, 0.0f, (DCL_DF13_SPS*)new_sps, &(DCL_CSS)DCL_CSS_DEFAULTS }; \
193 df->d1 = df->d2 = df->d3 = df->d4 = df->d5 = df->d6 = 0.0f;
204 df->b0 = df->sps->b0;
205 df->b1 = df->sps->b1;
206 df->b2 = df->sps->b2;
207 df->b3 = df->sps->b3;
208 df->a1 = df->sps->a1;
209 df->a2 = df->sps->a2;
210 df->a3 = df->sps->a3;
222 df->b0 = df->sps->b0;
223 df->b1 = df->sps->b1;
224 df->b2 = df->sps->b2;
225 df->b3 = df->sps->b3;
226 df->a1 = df->sps->a1;
227 df->a2 = df->sps->a2;
228 df->a3 = df->sps->a3;
273 #ifdef DCL_ERROR_HANDLING_ENABLED
295 float32_t a0p = 8.0f + (alpha2 * 4.0f * T) + (alpha1 * 2.0f * T * T) + (alpha0 * T * T * T);
297 df->sps->b0 = zpk->
K * (8.0f + (beta2 * 4.0f * T) + (beta1 * 2.0f * T * T) + (beta0 * T * T * T)) / a0p;
298 df->sps->b1 = zpk->
K * (-24.0f - (beta2 * 4.0f * T) + (beta1 * 2.0f * T * T) + (3.0f * beta0 * T * T * T)) / a0p;
299 df->sps->b2 = zpk->
K * (24.0f - (beta2 * 4.0f * T) - (beta1 * 2.0f * T * T) + (3.0f * beta0 * T * T * T)) / a0p;
300 df->sps->b3 = zpk->
K * (-8.0f + (beta2 * 4.0f * T) - (beta1 * 2.0f * T * T) + (beta0 * T * T * T)) / a0p;
302 df->sps->a1 = (-24.0f - (alpha2 * 4.0f * T) + (alpha1 * 2.0f * T * T) + (3.0f * alpha0 * T * T * T)) / a0p;
303 df->sps->a2 = (24.0f - (alpha2 * 4.0f * T) - (alpha1 * 2.0f * T * T) + (3.0f * alpha0 * T * T * T)) / a0p;
304 df->sps->a3 = (-8.0f + (alpha2 * 4.0f * T) - (alpha1 * 2.0f * T * T) + (alpha0 * T * T * T)) / a0p;
316 float32_t v4 = (ek * df->b0) + (df->d1 * df->b1) + (df->d2 * df->b2) + (df->d3 * df->b3) - (df->d4 * df->a1) - (df->d5 * df->a2) - (df->d6 * df->a3);
337 float32_t v4 = (ek * df->b0) + (df->d1 * df->b1) + (df->d2 * df->b2) + (df->d3 * df->b3) - (df->d4 * df->a1) - (df->d5 * df->a2) - (df->d6 * df->a3);
386 p->d4 = (ek * p->b0) + vk;
404 v9 = (ek * p->b1) + (p->d1 * p->b2) + (p->d2 * p->b3) - (uk * p->a1) - (p->d5 * p->a2) - (p->d6 * p->a3);
419 #endif // _DCL_DF13_H_
_DCL_CODE_ACCESS bool DCL_isStablePn3(float32_t a0, float32_t a1, float32_t a2, float32_t a3)
Determines stability of a third order polynomial with real coefficients P(z) = a0 z^3 + a1 z^2 + a2 z...
Definition: dcl_stability.h:93
float32_t b2
pos. coefficient to e(k-2)
Definition: dcl_df13.h:86
float32_t K
Real gain.
Definition: dcl_zpk3.h:69
_DCL_CODE_ACCESS void DCL_loadDF13asZPK(DCL_DF13 *df, DCL_ZPK3 *zpk)
Loads the DF13 shadow coefficients from a ZPK3 description. Note: Sampling period df->css->T are used...
Definition: dcl_df13.h:271
_DCL_CODE_ACCESS _DCL_CODE_SECTION bool DCL_updateDF13(DCL_DF13 *df)
A conditional update based on the update flag. If the update status is set, the function will update ...
Definition: dcl_df13.h:241
_DCL_VOLATILE struct dcl_df13 * DF13_Handle
float complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:64
_DCL_CODE_ACCESS bool DCL_isStableDF13(DCL_DF13 *df)
Determines stability of the shadow compensator.
Definition: dcl_df13.h:258
float32_t b3
pos. coefficient to e(k-3)
Definition: dcl_df13.h:104
float32_t b3
pos. coefficient to e(k-3)
Definition: dcl_df13.h:87
float32_t a0
No Longer Needed.
Definition: dcl_df13.h:91
#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:63
_DCL_CODE_ACCESS float32_t DCL_runDF13_C5(DCL_DF13 *p, float32_t ek, float32_t vk)
Legacy C28 Function for maintaining backwards compatibility. It Executes an immediate 3rd order Direc...
Definition: dcl_df13.h:384
float complex p2
Complex poles 2.
Definition: dcl_zpk3.h:67
_DCL_CODE_ACCESS float32_t DCL_runDF13_C6(DCL_DF13 *p, float32_t ek, float32_t uk)
Legacy C28 Function for maintaining backwards compatibility. It executes a partial pre-computed 3rd o...
Definition: dcl_df13.h:400
float32_t a0
No Longer Needed.
Definition: dcl_df13.h:117
float32_t d2
e(k-2)
Definition: dcl_df13.h:111
_DCL_CODE_ACCESS void DCL_resetDF13(DCL_DF13 *df)
Resets DF13 internal storage data with interrupt protection Implemented as inline C function.
Definition: dcl_df13.h:189
_DCL_CODE_ACCESS void DCL_runDF13PartialUpdate(DCL_DF13 *df, float32_t ek, float32_t uk)
Update DF13 controller based on pre-computed control effort.
Definition: dcl_df13.h:348
DCL_DF13_SPS * sps
updates compensator parameter
Definition: dcl_df13.h:122
float32_t a2
neg. coefficient to u(k-2)
Definition: dcl_df13.h:89
float32_t a2
neg. coefficient to u(k-2)
Definition: dcl_df13.h:106
#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:122
_DCL_CODE_ACCESS _DCL_CODE_SECTION float32_t DCL_runDF13Clamp(DCL_DF13 *df, float32_t ek, float32_t Umax, float32_t Umin)
Executes a 3rd order Direct Form 1 controller with clamp.
Definition: dcl_df13.h:367
#define DCL_clearUpdateStatus(p)
Definition: dcl_css.h:116
float32_t b0
pos. coefficient to e(k)
Definition: dcl_df13.h:84
float32_t d1
e(k-1)
Definition: dcl_df13.h:110
float32_t d7
No Longer Needed.
Definition: dcl_df13.h:119
float32_t a3
neg. coefficient to u(k-3)
Definition: dcl_df13.h:107
#define _DCL_CODE_ACCESS
Defines the scope of dcl functions (static inline/extern inline/none)
Definition: dcl_common.h:58
float32_t d0
No Longer Needed.
Definition: dcl_df13.h:118
float complex p1
Complex poles 1.
Definition: dcl_zpk3.h:66
DCL_CSS * css
configuration & debugging
Definition: dcl_df13.h:123
_DCL_CODE_ACCESS _DCL_CODE_SECTION void DCL_updateDF13NoCheck(DCL_DF13 *df)
Loads DF13 tuning parameter from its SPS parameter with interrupt protection.
Definition: dcl_df13.h:218
float32_t b1
pos. coefficient to e(k-1)
Definition: dcl_df13.h:102
@ dcl_none
No error.
Definition: dcl_error.h:57
float32_t a1
neg. coefficient to u(k-1)
Definition: dcl_df13.h:88
DCL_DF13 object for storing df13 specific parameters.
Definition: dcl_df13.h:99
_DCL_CODE_ACCESS void DCL_forceUpdateDF13(DCL_DF13 *df)
Loads DF13 tuning parameter from its SPS parameter without interrupt protection.
Definition: dcl_df13.h:202
uint32_t dcl_interrupt_t
Definition: dcl_common.h:99
float complex z3
Complex zeros 3.
Definition: dcl_zpk3.h:65
#define DCL_isZero(x)
Determines floating point numerical proximity to zero.
Definition: dcl_aux.h:77
_DCL_CODE_ACCESS float32_t DCL_runDF13PartialCompute(DCL_DF13 *df, float32_t ek)
Immediate computation to obtain DF13 servo error without updating the controller.
Definition: dcl_df13.h:335
_DCL_CODE_ACCESS _DCL_CODE_SECTION float32_t DCL_runDF13(DCL_DF13 *df, float32_t ek)
Executes a 3rd order Direct Form 1 controller.
Definition: dcl_df13.h:314
@ dcl_param_invalid_err
Parameter not valid.
Definition: dcl_error.h:59
Defines the DCL_DF13 shadow parameter set used for updating compensator parameter.
Definition: dcl_df13.h:83
float32_t d4
u(k-1)
Definition: dcl_df13.h:113
_DCL_VOLATILE struct dcl_df13 DCL_DF13
float32_t a1
neg. coefficient to u(k-1)
Definition: dcl_df13.h:105
Defines the controller common support structure.
Definition: dcl_css.h:57
float32_t d6
u(k-3)
Definition: dcl_df13.h:115
#define DCL_restoreInts(v)
Definition: dcl_common.h:98
float complex p3
Complex poles 3.
Definition: dcl_zpk3.h:68
_DCL_CODE_ACCESS bool DCL_runClamp(float32_t *data, float32_t Umax, float32_t Umin)
Saturates a control variable and returns true if either limit is exceeded.
Definition: dcl_clamp.h:59
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:71
float32_t b2
pos. coefficient to e(k-2)
Definition: dcl_df13.h:103
#define DCL_getErrorInfo(ptr)
Macro to store error info in CSS.
Definition: dcl_error.h:97
#define DCL_setError(ptr, code)
Macro to set error code in CSS.
Definition: dcl_error.h:79
float32_t d5
u(k-2)
Definition: dcl_df13.h:114
float32_t d3
e(k-3)
Definition: dcl_df13.h:112
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:54
float32_t b1
pos. coefficient to e(k-1)
Definition: dcl_df13.h:85
float32_t a3
neg. coefficient to u(k-3)
Definition: dcl_df13.h:90
float complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:63
#define DCL_disableInts()
Define enable and disable interrupt operations.
Definition: dcl_common.h:97
float32_t b0
pos. coefficient to e(k)
Definition: dcl_df13.h:101