AM263x Motor Control SDK  09.02.00
dcl_pid.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _DCL_PID_H_
34 #define _DCL_PID_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
48 #include "../dcl_common.h"
49 
50 //--- Linear PID controller --------------------------------------------------
51 
55 typedef struct dcl_pid_sps
56 {
65 } DCL_PID_SPS;
66 
69 #define PID_SPS_DEFAULTS { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f }
70 
73 typedef _DCL_VOLATILE struct dcl_pid
74 {
75  /* controller parameter */
84 
85  /* internal storage */
90 
91  /* miscellaneous */
95 
98 #define PID_DEFAULTS { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, \
99  1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, \
100  &(DCL_PID_SPS)PID_SPS_DEFAULTS, &(DCL_CSS)DCL_CSS_DEFAULTS }
101 
110 #define PID_INT_DEFAULTS .d2=0.0f, .d3=0.0f, .i10=0.0f, .i14=1.0f, \
111  .sps=&(DCL_PID_SPS)PID_SPS_DEFAULTS, .css=&(DCL_CSS)DCL_CSS_DEFAULTS
112 
118 #define DCL_initPID() &(DCL_PID)PID_DEFAULTS
119 
126 #define DCL_initPIDasParam(kp,ki,kd,kr,_c1,_c2,umax,umin) &(DCL_PID){ .Kp=kp, .Ki=ki, .Kd=kd, .Kr=kr, \
127  .c1=_c1, .c2=_c2, .Umax=umax, .Umin=umin, PID_INT_DEFAULTS }
128 
140 #define DCL_initPIDasSPS(pid_ptr,sps_ptr) \
141 ({ \
142  DCL_PID* new_pid = (pid_ptr) ? pid_ptr : DCL_initPID(); \
143  DCL_PID_SPS* new_sps = (sps_ptr) ? sps_ptr : &(DCL_PID_SPS)PID_SPS_DEFAULTS; \
144  if(sps_ptr) \
145  { \
146  *new_pid = (DCL_PID){ (new_sps)->Kp, (new_sps)->Ki, (new_sps)->Kd,(new_sps)->Kr,\
147  (new_sps)->c1, (new_sps)->c2, (new_sps)->Umax, (new_sps)->Umin, 0.0f, 0.0f, \
148  0.0f, 1.0f, (DCL_PID_SPS*)new_sps, &(DCL_CSS)DCL_CSS_DEFAULTS }; \
149  } \
150  new_pid; \
151 })
152 
159 {
160  dcl_interrupt_t ints;
161  ints = DCL_disableInts();
162  pid->d2 = pid->d3 = pid->i10 = 0.0f;
163  pid->i14 = 1.0f;
164  DCL_restoreInts(ints);
165 }
166 
173 {
174 
175 #ifdef DCL_ERROR_HANDLING_ENABLED
176  float32_t tau = (2.0f - pid->sps->c1 * pid->css->T) / (2.0f * pid->sps->c1);
177  float32_t ec2 = pid->sps->c1 * (pid->css->T - 2.0f * tau) / 2.0f;
178  uint32_t err_code = dcl_none;
179  err_code |= DCL_isValue(pid->sps->c2, ec2) ? dcl_none : dcl_param_invalid_err;
180  err_code |= (pid->sps->Umax > pid->sps->Umin) ? dcl_none : dcl_param_invalid_err;
181  err_code |= (pid->css->T > 0.0f) ? dcl_none : dcl_param_range_err;
182  err_code |= ((pid->sps->Kp > 0.0f) && (pid->sps->Ki > 0.0f) && (pid->sps->Kd > 0.0f) && (pid->sps->Kr > 0.0f)) ? dcl_none : dcl_param_range_err ;
183  if (err_code)
184  {
185  DCL_setError(pid,err_code);
186  DCL_getErrorInfo(pid);
187  DCL_runErrorHandler(pid);
188  }
189 #endif
190 
191  pid->Kp = pid->sps->Kp;
192  pid->Ki = pid->sps->Ki;
193  pid->Kd = pid->sps->Kd;
194  pid->Kr = pid->sps->Kr;
195  pid->c1 = pid->sps->c1;
196  pid->c2 = pid->sps->c2;
197  pid->Umax = pid->sps->Umax;
198  pid->Umin = pid->sps->Umin;
199 }
200 
207 {
208 
209 #ifdef DCL_ERROR_HANDLING_ENABLED
210  float32_t tau = (2.0f - pid->sps->c1 * pid->css->T) / (2.0f * pid->sps->c1);
211  float32_t ec2 = pid->sps->c1 * (pid->css->T - 2.0f * tau) / 2.0f;
212  uint32_t err_code = dcl_none;
213  err_code |= DCL_isValue(pid->sps->c2, ec2) ? dcl_none : dcl_param_invalid_err;
214  err_code |= (pid->sps->Umax > pid->sps->Umin) ? dcl_none : dcl_param_invalid_err;
215  err_code |= (pid->css->T > 0.0f) ? dcl_none : dcl_param_range_err;
216  err_code |= ((pid->sps->Kp > 0.0f) && (pid->sps->Ki > 0.0f) && (pid->sps->Kd > 0.0f) && (pid->sps->Kr > 0.0f)) ? dcl_none : dcl_param_range_err ;
217  if (err_code)
218  {
219  DCL_setError(pid,err_code);
220  DCL_getErrorInfo(pid);
221  DCL_runErrorHandler(pid);
222  }
223 #endif
224 
225  dcl_interrupt_t ints;
226  ints = DCL_disableInts();
227  pid->Kp = pid->sps->Kp;
228  pid->Ki = pid->sps->Ki;
229  pid->Kd = pid->sps->Kd;
230  pid->Kr = pid->sps->Kr;
231  pid->c1 = pid->sps->c1;
232  pid->c2 = pid->sps->c2;
233  pid->Umax = pid->sps->Umax;
234  pid->Umin = pid->sps->Umin;
235  DCL_restoreInts(ints);
236 }
237 
248 {
249  if (DCL_getUpdateStatus(pid))
250  {
253  return true;
254  }
255  return false;
256 }
257 
267 {
268 
269 #ifdef DCL_ERROR_HANDLING_ENABLED
270  uint32_t err_code = dcl_none;
271  err_code |= ((fc >= 1.0f / (2.0f * pid->css->T)) || (fc <= 0.0f)) ? dcl_param_range_err : dcl_none;
272  if (err_code)
273  {
274  DCL_setError(pid,err_code);
275  DCL_getErrorInfo(pid);
276  DCL_runErrorHandler(pid);
277  }
278 #endif
279 
280  float32_t T = pid->css->T;
281  float32_t tau = 1.0f / (2.0f * CONST_PI * fc);
282  pid->sps->c1 = 2.0f / (T + (2.0f * tau));
283  pid->sps->c2 = (T - (2.0f * tau)) / (T + (2.0f * tau));
284 }
285 
296 {
297 
298 #ifdef DCL_ERROR_HANDLING_ENABLED
299  uint32_t err_code = dcl_none;
300  err_code |= ((fc >= 1.0f / (2.0f * T)) || (fc <= 0.0f)) ? dcl_param_range_err : dcl_none;
301  if (err_code)
302  {
303  DCL_setError(pid,err_code);
304  DCL_getErrorInfo(pid);
305  DCL_runErrorHandler(pid);
306  }
307 #endif
308 
309  float32_t tau = 1.0f / (2.0f * CONST_PI * fc);
310  pid->c1 = 2.0f / (T + (2.0f * tau));
311  pid->c2 = (T - (2.0f * tau)) / (T + (2.0f * tau));
312 }
313 
322 {
323  float32_t tau = ((2.0f - pid->c1 * pid->css->T) / (2.0f * pid->c1));
324  return(1.0f / (2.0f * CONST_PI * tau));
325 }
326 
337 {
338 
339 #ifdef DCL_ERROR_HANDLING_ENABLED
340  uint32_t err_code = dcl_none;
341  err_code |= DCL_isZero(cimagf(zpk->z1) + cimagf(zpk->z2)) ? dcl_none : dcl_param_invalid_err;
342  err_code |= DCL_isZero(cimagf(zpk->p2)) ? dcl_none : dcl_param_invalid_err;
343  err_code |= (crealf(zpk->p2) <= DCL_c2Limit) ? dcl_none :dcl_param_invalid_err;
344  err_code |= (zpk->K >= 0.0f) ? dcl_none : dcl_param_range_err;
345  if (err_code)
346  {
347  DCL_setError(pid,err_code);
348  DCL_getErrorInfo(pid);
349  DCL_runErrorHandler(pid);
350  }
351 #endif
352 
353  float32_t beta1 = -(float32_t) crealf(zpk->z1 + zpk->z2);
354  float32_t beta0 = (float32_t) crealf(zpk->z1 * zpk->z2);
355  float32_t alpha1 = -(float32_t) crealf(zpk->p1 + zpk->p2);
356  float32_t alpha0 = (float32_t) crealf(zpk->p1 * zpk->p2);
357  float32_t T = pid->css->T;
358  float32_t a0p = 4.0f + (alpha1 * 2.0f * T) + (alpha0 * T * T);
359  float32_t b0 = zpk->K * (4.0f + (beta1 * 2.0f * T) + (beta0 * T *T)) / a0p;
360  float32_t b1 = zpk->K * (-8.0f + (2.0f * beta0 * T * T)) / a0p;
361  float32_t b2 = zpk->K * (4.0f - (beta1 * 2.0f * T) + (beta0 * T * T)) / a0p;
362  float32_t a2 = (4.0f - (alpha1 * 2.0f * T) + (alpha0 * T * T)) / a0p;
363  float32_t c2 = -a2;
364  float32_t tau = (T / 2.0f) * (1.0f - c2) / (1.0f + c2);
365  pid->sps->c1 = 2.0f / (T + 2.0f * tau);
366  pid->sps->c2 = c2;
367  float32_t det = (c2 + 1.0f);
368  det *= det;
369 
370 #ifdef DCL_ERROR_HANDLING_ENABLED
371  err_code = dcl_none;
372  err_code |= (DCL_isZero(det)) ? dcl_param_invalid_err : dcl_none;
373  if (err_code)
374  {
375  DCL_setError(pid,err_code);
376  DCL_getErrorInfo(pid);
377  DCL_runErrorHandler(pid);
378  }
379 #endif
380 
381  float32_t k1 = ((c2 * b0) - b1 - ((2.0f + c2) * b2)) / det;
382  float32_t k2 = (c2 + 1.0f) * (b0 + b1 + b2) / det;
383  float32_t k3 = ((c2 * c2 * b0) - (c2 * b1) + b2) / det;
384  pid->sps->Kp = k1;
385  pid->sps->Ki = k2 / k1;
386  pid->sps->Kd = k3 / (k1 * pid->sps->c1);
387 
388 #ifdef DCL_TESTPOINTS_ENABLED
389  pid->css->tpt = det;
390 #endif
391 
392 }
393 
404 {
405 #ifdef DCL_ERROR_HANDLING_ENABLED
406  uint32_t err_code = dcl_none;
407  err_code |= DCL_isZero(cimagf(zpk->z1) + cimagf(zpk->z2)) ? dcl_none : dcl_param_invalid_err;
408  err_code |= DCL_isZero(cimagf(zpk->p2)) ? dcl_none : dcl_param_invalid_err;
409  err_code |= (crealf(zpk->p2) <= DCL_c2Limit) ? dcl_none : dcl_param_invalid_err;
410  err_code |= (zpk->K >= 0.0f) ? dcl_none : dcl_param_range_err;
411  if (err_code)
412  {
413  DCL_setError(pid,err_code);
414  DCL_getErrorInfo(pid);
415  DCL_runErrorHandler(pid);
416  }
417 #endif
418 
419  float32_t beta1 = -(float32_t) crealf(zpk->z1 + zpk->z2);
420  float32_t beta0 = (float32_t) crealf(zpk->z1 * zpk->z2);
421  float32_t alpha1 = -(float32_t) crealf(zpk->p1 + zpk->p2);
422  float32_t alpha0 = (float32_t) crealf(zpk->p1 * zpk->p2);
423  float32_t T = pid->css->T;
424  float32_t a0p = 4.0f + (alpha1 * 2.0f * T) + (alpha0 * T * T);
425  float32_t b0 = zpk->K * (4.0f + (beta1 * 2.0f * T) + (beta0 * T * T)) / a0p;
426  float32_t b1 = zpk->K * (-8.0f + (2.0f * beta0 * T * T)) / a0p;
427  float32_t b2 = zpk->K * (4.0f - (beta1 * 2.0f * T) + (beta0 * T * T)) / a0p;
428  float32_t a2 = (4.0f - (alpha1 * 2.0f * T) + (alpha0 * T * T)) / a0p;
429  float32_t c2 = -a2;
430  float32_t tau = (T / 2.0f) * (1.0f - c2) / (1.0f + c2);
431  pid->sps->c1 = 2.0f / (T + 2.0f * tau);
432  pid->sps->c2 = c2;
433  float32_t det = (c2 + 1.0f);
434  det *= det;
435 
436 #ifdef DCL_ERROR_HANDLING_ENABLED
437  err_code = (DCL_isZero(det)) ? dcl_param_invalid_err : dcl_none;
438  if (err_code)
439  {
440  DCL_setError(pid,err_code);
441  DCL_getErrorInfo(pid);
442  DCL_runErrorHandler(pid);
443  }
444 #endif
445 
446  pid->sps->Kp = ((c2 * b0) - b1 - ((2.0f + c2) * b2)) / det;
447  pid->sps->Ki = (c2 + 1.0f) * (b0 + b1 + b2) / det;
448  pid->sps->Kd = ((c2 * c2 * b0) - (c2 * b1) + b2) / (det * pid->sps->c1);
449 
450 #ifdef DCL_TESTPOINTS_ENABLED
451  pid->css->tpt = det;
452 #endif
453 
454 }
455 
466 {
467  float32_t v1, v4, v5, v8, v9, v10, v12;
468 
469  v5 = (pid->Kr * rk) - yk;
470  v8 = ((rk - yk) * pid->Ki * pid->Kp * pid->i14) + pid->i10;
471  pid->i10 = v8;
472  v1 = yk * pid->Kd * pid->c1;
473  v4 = v1 - pid->d2 - pid->d3;
474  pid->d2 = v1;
475  pid->d3 = v4 * pid->c2;
476  v9 = ((v5 - v4) * pid->Kp) + v8;
477  v10 = DCL_runSat(v9, pid->Umax, pid->Umin);
478  v12 = (v10 == v9) ? 1.0f : 0.0f;
479  pid->i14 = v12 * lk;
480 
481 #ifdef DCL_TESTPOINTS_ENABLED
482  pid->css->tpt = v4;
483 #endif
484 
485  return(v10);
486 }
487 
498 {
499  float32_t v1, v4, v5, v6, v8, v9, v10, v12;
500 
501  v5 = rk - yk;
502  v6 = v5 * pid->Kp;
503  v8 = v5 * pid->Ki * pid->i14 + pid->i10;
504  pid->i10 = v8;
505  v1 = v5 * pid->Kd * pid->c1;
506  v4 = v1 - pid->d2 - pid->d3;
507  pid->d2 = v1;
508  pid->d3 = v4 * pid->c2;
509  v9 = v6 + v8 + v4;
510  v10 = DCL_runSat(v9, pid->Umax, pid->Umin);
511  v12 = (v10 == v9) ? 1.0f : 0.0f;
512  pid->i14 = v12 * lk;
513 
514 #ifdef DCL_TESTPOINTS_ENABLED
515  pid->css->tpt = v8;
516 #endif
517 
518  return(v10);
519 }
520 
523 #ifdef __cplusplus
524 }
525 #endif // extern "C"
526 
527 #endif // _DCL_PID_H_
dcl_pid::sps
DCL_PID_SPS * sps
updates controller parameter
Definition: dcl_pid.h:92
DCL_PID
_DCL_VOLATILE struct dcl_pid DCL_PID
dcl_pid::c1
float32_t c1
D path filter coefficient 1, default is 1.
Definition: dcl_pid.h:80
DCL_isValue
#define DCL_isValue(x, y)
Determines numerical proximity to specified value.
Definition: dcl_macro.h:72
CONST_PI
#define CONST_PI
Local definitions of the mathematical constant pi.
Definition: dcl_macro.h:55
dcl_pid::Umin
float32_t Umin
Lower saturation limit
Definition: dcl_pid.h:83
DCL_ZPK3::K
float32_t K
Real gain.
Definition: dcl_zpk3.h:69
DCL_setPIDfilterBW
_DCL_CODE_ACCESS void DCL_setPIDfilterBW(DCL_PID *pid, float32_t fc)
Loads the derivative path filter shadow coefficients.
Definition: dcl_pid.h:266
DCL_updatePID
_DCL_CODE_ACCESS bool DCL_updatePID(DCL_PID *pid)
A conditional update based on the update flag. If the update status is set, the function will update ...
Definition: dcl_pid.h:247
DCL_PID_SPS::Kp
float32_t Kp
Proportional gain.
Definition: dcl_pid.h:57
DCL_ZPK3::z2
float complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:64
DCL_PID_SPS::Umax
float32_t Umax
Upper saturation limit.
Definition: dcl_pid.h:63
DCL_ZPK3::p2
float complex p2
Complex poles 2.
Definition: dcl_zpk3.h:67
DCL_PID_SPS
Defines DCL_PID shadow parameter set used for updating controller parameter.
Definition: dcl_pid.h:56
dcl_none
@ dcl_none
No error.
Definition: dcl_error.h:57
dcl_pid::Umax
float32_t Umax
Upper saturation limit.
Definition: dcl_pid.h:82
dcl_pid
DCL_PID object for storing PID specific parameters.
Definition: dcl_pid.h:74
DCL_runErrorHandler
#define DCL_runErrorHandler(ptr)
Prototype for basic error handler.
Definition: dcl_error.h:108
DCL_PID_SPS::Kd
float32_t Kd
Derivative gain.
Definition: dcl_pid.h:59
DCL_getUpdateStatus
#define DCL_getUpdateStatus(p)
Determine whether a parameter update-in-progress flag is set.
Definition: dcl_css.h:122
dcl_pid::d3
float32_t d3
D path low-pass filter storage (c2)
Definition: dcl_pid.h:87
DCL_clearUpdateStatus
#define DCL_clearUpdateStatus(p)
Definition: dcl_css.h:116
DCL_PID_SPS::c2
float32_t c2
D path low-pass filter coefficient 2, default is 0.
Definition: dcl_pid.h:62
_DCL_CODE_ACCESS
#define _DCL_CODE_ACCESS
Defines the scope of dcl functions.
Definition: dcl_common.h:63
DCL_ZPK3::p1
float complex p1
Complex poles 1.
Definition: dcl_zpk3.h:66
DCL_resetPID
_DCL_CODE_ACCESS void DCL_resetPID(DCL_PID *pid)
Resets PID internal storage data with interrupt protection.
Definition: dcl_pid.h:158
DCL_forceUpdatePID
_DCL_CODE_ACCESS void DCL_forceUpdatePID(DCL_PID *pid)
Loads PID tuning parameter from its SPS parameter without interrupt protection.
Definition: dcl_pid.h:172
dcl_pid::Kp
float32_t Kp
Proportional gain.
Definition: dcl_pid.h:76
dcl_pid::i14
float32_t i14
Saturation multiplier, ranges between 1*lk ~ 0, where 0 means fully saturated.
Definition: dcl_pid.h:89
dcl_interrupt_t
uint32_t dcl_interrupt_t
Definition: dcl_common.h:107
DCL_getPIDfilterBW
_DCL_CODE_ACCESS float32_t DCL_getPIDfilterBW(DCL_PID *pid)
Calculates the active derivative path filter bandwidth in Hz.
Definition: dcl_pid.h:321
dcl_pid::Ki
float32_t Ki
Integral gain.
Definition: dcl_pid.h:77
DCL_isZero
#define DCL_isZero(x)
Determines floating point numerical proximity to zero.
Definition: dcl_macro.h:77
DCL_PID_SPS::Umin
float32_t Umin
Lower saturation limit.
Definition: dcl_pid.h:64
dcl_pid::c2
float32_t c2
D path filter coefficient 2, default is 0.
Definition: dcl_pid.h:81
dcl_param_range_err
@ dcl_param_range_err
Parameter range exceeded.
Definition: dcl_error.h:58
dcl_pid::Kr
float32_t Kr
Set point weight, default is 1.
Definition: dcl_pid.h:79
DCL_c2Limit
#define DCL_c2Limit
Defines the lower limit on derivative filter coefficient c2 in order for fc to lie below the Nyquist ...
Definition: dcl_macro.h:93
DCL_loadParallelPIDasZPK
_DCL_CODE_ACCESS void DCL_loadParallelPIDasZPK(DCL_PID *pid, DCL_ZPK3 *zpk)
Configures a parallel PID controller in ZPK form.
Definition: dcl_pid.h:403
DCL_runPIDSeries
_DCL_CRIT_ACCESS float32_t DCL_runPIDSeries(DCL_PID *pid, float32_t rk, float32_t yk, float32_t lk)
Executes an ideal form PID controller.
Definition: dcl_pid.h:465
DCL_runSat
#define DCL_runSat(data, Umax, Umin)
Macro to saturate a control variable but does not change the data itself unlike runClamp()
Definition: dcl_clamp.h:89
DCL_CSS
Defines the controller common support structure.
Definition: dcl_css.h:57
DCL_restoreInts
#define DCL_restoreInts(v)
Definition: dcl_common.h:106
dcl_pid::i10
float32_t i10
I path feedback storage.
Definition: dcl_pid.h:88
dcl_param_invalid_err
@ dcl_param_invalid_err
Parameter not valid.
Definition: dcl_error.h:59
DCL_ZPK3
Defines the DCL_ZPK3 structure.
Definition: dcl_zpk3.h:62
_DCL_VOLATILE
#define _DCL_VOLATILE
Defines volatile for DCL strctures.
Definition: dcl_common.h:79
dcl_pid::css
DCL_CSS * css
configuration & debugging
Definition: dcl_pid.h:93
DCL_getErrorInfo
#define DCL_getErrorInfo(ptr)
Macro to store error info in CSS.
Definition: dcl_error.h:98
DCL_PID_SPS::c1
float32_t c1
D path low-pass filter coefficient 1, default is 1.
Definition: dcl_pid.h:61
DCL_PID_SPS::Ki
float32_t Ki
Integral gain.
Definition: dcl_pid.h:58
DCL_setError
#define DCL_setError(ptr, code)
Macro to set error code in CSS.
Definition: dcl_error.h:80
_DCL_CRIT_ACCESS
#define _DCL_CRIT_ACCESS
Defines the scope of critical dcl functions.
Definition: dcl_common.h:70
DCL_setActivePIDfilterBW
_DCL_CODE_ACCESS void DCL_setActivePIDfilterBW(DCL_PID *pid, float32_t fc, float32_t T)
Loads the PID derivative path filter active coefficients.
Definition: dcl_pid.h:295
DCL_loadSeriesPIDasZPK
_DCL_CODE_ACCESS void DCL_loadSeriesPIDasZPK(DCL_PID *pid, DCL_ZPK3 *zpk)
Configures a series PID controller parameter in ZPK form.
Definition: dcl_pid.h:336
DCL_runPIDParallel
_DCL_CRIT_ACCESS float32_t DCL_runPIDParallel(DCL_PID *pid, float32_t rk, float32_t yk, float32_t lk)
Executes a parallel form PID controller.
Definition: dcl_pid.h:497
float32_t
float float32_t
Definition: dcl_common.h:58
DCL_updatePIDNoCheck
_DCL_CODE_ACCESS void DCL_updatePIDNoCheck(DCL_PID *pid)
Loads PID tuning parameter from its SPS parameter with interrupt protection.
Definition: dcl_pid.h:206
dcl_pid::d2
float32_t d2
D path low-pass filter storage (Kd * c1)
Definition: dcl_pid.h:86
dcl_pid::Kd
float32_t Kd
Derivative gain.
Definition: dcl_pid.h:78
DCL_ZPK3::z1
float complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:63
DCL_disableInts
#define DCL_disableInts()
Define enable and disable interrupt operations.
Definition: dcl_common.h:105
DCL_PID_SPS::Kr
float32_t Kr
Set point weight, default is 1.
Definition: dcl_pid.h:60