AM243x Motor Control SDK  09.02.00
dcl_pidf64.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 EXPgResS 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_PID64_H_
34 #define _DCL_PID64_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
48 #include "../dcl_common.h"
49 
50 //--- Linear PID 64bit controller --------------------------------------------------
51 
55 typedef struct dcl_pid64_sps {
65 
68 #define PIDF64_SPS_DEFAULTS { 1.0L, 0.0L, 0.0L, 1.0L, 1.0L, 0.0L, 1.0L, -1.0L }
69 
72 typedef _DCL_VOLATILE struct dcl_pidf64 {
73  /* controller parameter */
82 
83  /* internal storage */
88 
89  /* miscellaneous */
93 
96 #define PIDF64_DEFAULTS { 1.0L, 0.0L, 0.0L, 1.0L, 1.0L, 0.0L, \
97  1.0L, -1.0L, 0.0L, 0.0L, 0.0L, 1.0L, \
98 &(DCL_PIDF64_SPS)PIDF64_SPS_DEFAULTS, &(DCL_CSSF64)DCL_CSSF64_DEFAULTS }
99 
108 #define PIDF64_INT_DEFAULTS .d2=0.0L, .d3=0.0L, .i10=0.0L, .i14=1.0L, \
109  .sps=&(DCL_PIDF64_SPS)PI_SPS_DEFAULTS, .css=&(DCL_CSSF64)DCL_CSS_DEFAULTS
110 
116 #define DCL_initPIDF64() &(DCL_PIDF64)PIDF64_DEFAULTS
117 
124 #define DCL_initPIDF64asParam(kp,ki,kd,kr,_c1,_c2,umax,umin) &(DCL_PIDF64){ .Kp=kp, .Ki=ki, .Kd=kd, .Kr=kr, \
125  .c1=_c1, .c2=_c2, .Umax=umax, .Umin=umin, PIDF64_INT_DEFAULTS }
126 
137 #define DCL_initPIDF64asSPS(pid_ptr,sps_ptr) \
138 ({ \
139  DCL_PIDF64* new_pid = (pid_ptr) ? pid_ptr : DCL_initPID(); \
140  DCL_PIDF64_SPS* new_sps = (sps_ptr) ? sps_ptr : &(DCL_PIDF64_SPS)PID_SPS_DEFAULTS; \
141  if(sps_ptr) \
142  { \
143  *new_pi = (DCL_PID){ (new_sps)->Kp, (new_sps)->Ki, (new_sps)->Kd,(new_sps)->Kr,\
144  (new_sps)->c1, (new_sps)->c2, (new_sps)->Umax, (new_sps)->Umin, 0.0L, 0.0L, \
145  0.0L, 1.0L,(DCL_PIDF64_SPS*)new_sps, &(DCL_CSS)DCL_CSS_DEFAULTS }; \
146  } \
147  new_pid; \
148 })
149 
156 {
157  dcl_interrupt_t ints;
158  ints = DCL_disableInts();
159  pid->d2 = pid->d3 = pid->i10 = 0.0L;
160  pid->i14 = 1.0L;
161  DCL_restoreInts(ints);
162 }
163 
170 {
171 
172 #ifdef DCL_ERROR_HANDLING_ENABLED
173  float64_t tau = (2.0L - pid->sps->c1 * pid->css->T) / (2.0L * pid->sps->c1);
174  float64_t ec2 = pid->sps->c1 * (pid->css->T - 2.0L * tau) / 2.0L;
175  uint32_t err_code = dcl_none;
176  err_code |= DCL_isValue(pid->sps->c2, ec2) ? dcl_none : dcl_param_invalid_err;
177  err_code |= (pid->sps->Umax > pid->sps->Umin) ? dcl_none : dcl_param_invalid_err;
178  err_code |= (pid->css->T > 0.0L) ? dcl_none : dcl_param_range_err;
179  err_code |= ((pid->sps->Kp > 0.0L) && (pid->sps->Ki > 0.0L) && (pid->sps->Kd > 0.0L) && (pid->sps->Kr > 0.0L)) ? dcl_none : dcl_param_range_err ;
180  if (err_code)
181  {
182  DCL_setError(pid,err_code);
183  DCL_getErrorInfo(pid);
184  DCL_runErrorHandler(pid);
185  }
186 #endif
187 
188  pid->Kp = pid->sps->Kp;
189  pid->Ki = pid->sps->Ki;
190  pid->Kd = pid->sps->Kd;
191  pid->Kr = pid->sps->Kr;
192  pid->c1 = pid->sps->c1;
193  pid->c2 = pid->sps->c2;
194  pid->Umax = pid->sps->Umax;
195  pid->Umin = pid->sps->Umin;
196 }
197 
198 
205 {
206 
207 #ifdef DCL_ERROR_HANDLING_ENABLED
208  float64_t tau = (2.0L - pid->sps->c1 * pid->css->T) / (2.0L * pid->sps->c1);
209  float64_t ec2 = pid->sps->c1 * (pid->css->T - 2.0L * tau) / 2.0L;
210  uint32_t err_code = dcl_none;
211  err_code |= DCL_isValue(pid->sps->c2, ec2) ? dcl_none : dcl_param_invalid_err;
212  err_code |= (pid->sps->Umax > pid->sps->Umin) ? dcl_none : dcl_param_invalid_err;
213  err_code |= (pid->css->T > 0.0L) ? dcl_none : dcl_param_range_err;
214  err_code |= ((pid->sps->Kp > 0.0L) && (pid->sps->Ki > 0.0L) && (pid->sps->Kd > 0.0L) && (pid->sps->Kr > 0.0L)) ? dcl_none : dcl_param_range_err ;
215  if (err_code)
216  {
217  DCL_setError(pid,err_code);
218  DCL_getErrorInfo(pid);
219  DCL_runErrorHandler(pid);
220  }
221 #endif
222 
223  dcl_interrupt_t ints;
224  ints = DCL_disableInts();
225  pid->Kp = pid->sps->Kp;
226  pid->Ki = pid->sps->Ki;
227  pid->Kd = pid->sps->Kd;
228  pid->Kr = pid->sps->Kr;
229  pid->c1 = pid->sps->c1;
230  pid->c2 = pid->sps->c2;
231  pid->Umax = pid->sps->Umax;
232  pid->Umin = pid->sps->Umin;
233  DCL_restoreInts(ints);
234 }
235 
246 {
247  if (DCL_getUpdateStatus(pid))
248  {
251  return true;
252  }
253  return false;
254 }
255 
265 {
266 
267 #ifdef DCL_ERROR_HANDLING_ENABLED
268  uint32_t err_code;
269  err_code = ((fc >= 1.0L / (2.0L * pid->css->T)) || (fc <= 0.0L)) ? dcl_param_range_err : dcl_none;
270  if (err_code)
271  {
272  DCL_setError(pid,err_code);
273  DCL_getErrorInfo(pid);
274  DCL_runErrorHandler(pid);
275  }
276 #endif
277 
278  float64_t T = pid->css->T;
279  float64_t tau = 1.0L / (2.0L * CONST_PI_F64 * fc);
280  pid->sps->c1 = 2.0L / (T + (2.0L * tau));
281  pid->sps->c2 = (T - (2.0L * tau)) / (T + (2.0L * tau));
282 }
283 
294 {
295 
296 #ifdef DCL_ERROR_HANDLING_ENABLED
297  uint32_t err_code;
298  err_code = ((fc >= 1.0L / (2.0L * T)) || (fc <= 0.0L)) ? dcl_param_range_err : dcl_none;
299  if (err_code)
300  {
301  DCL_setError(pid,err_code);
302  DCL_getErrorInfo(pid);
303  DCL_runErrorHandler(pid);
304  }
305 #endif
306 
307  float64_t tau = 1.0L / (2.0L * CONST_PI_F64 * fc);
308  pid->c1 = 2.0L / (T + (2.0L * tau));
309  pid->c2 = (T - (2.0L * tau)) / (T + (2.0L * tau));
310 }
311 
320 {
321  float64_t tau = ((2.0L - pid->c1 * pid->css->T) / (2.0L * pid->c1));
322  return(1.0L / (2.0L * CONST_PI_F64 * tau));
323 }
324 
335 {
336 
337 #ifdef DCL_ERROR_HANDLING_ENABLED
338  uint32_t err_code = dcl_none;
339  err_code |= DCL_isZero(cimag(zpk->z1) + cimag(zpk->z2)) ? dcl_none : dcl_param_invalid_err;
340  err_code |= DCL_isZero(cimag(zpk->p2)) ? dcl_none : dcl_param_invalid_err;
341  err_code |= (creal(zpk->p2) <= DCL_c2LimitF64) ? dcl_none :dcl_param_invalid_err;
342  err_code |= (zpk->K >= 0.0f) ? dcl_none : dcl_param_range_err;
343  if (err_code)
344  {
345  DCL_setError(pid,err_code);
346  DCL_getErrorInfo(pid);
347  DCL_runErrorHandler(pid);
348  }
349 #endif
350 
351  float64_t beta1 = -(float64_t) creal(zpk->z1 + zpk->z2);
352  float64_t beta0 = (float64_t) creal(zpk->z1 * zpk->z2);
353  float64_t alpha1 = -(float64_t) creal(zpk->p1 + zpk->p2);
354  float64_t alpha0 = (float64_t) creal(zpk->p1 * zpk->p2);
355  float64_t T = pid->css->T;
356  float64_t a0p = 4.0L + (alpha1 * 2.0L * T) + (alpha0 * T * T);
357  float64_t b0 = zpk->K * (4.0L + (beta1 * 2.0L * T) + (beta0 * T *T)) / a0p;
358  float64_t b1 = zpk->K * (-8.0L + (2.0f * beta0 * T * T)) / a0p;
359  float64_t b2 = zpk->K * (4.0L - (beta1 * 2.0L * T) + (beta0 * T * T)) / a0p;
360  float64_t a2 = (4.0L - (alpha1 * 2.0L * T) + (alpha0 * T * T)) / a0p;
361  float64_t c2 = -a2;
362  float64_t tau = (T / 2.0L) * (1.0L - c2) / (1.0L + c2);
363  pid->sps->c1 = 2.0L / (T + 2.0L * tau);
364  pid->sps->c2 = c2;
365  float64_t det = (c2 + 1.0L);
366  det *= det;
367 
368 #ifdef DCL_ERROR_HANDLING_ENABLED
369  err_code = dcl_none;
370  err_code |= (DCL_isZero(det)) ? dcl_param_invalid_err : dcl_none;
371  if (err_code)
372  {
373  DCL_setError(pid,err_code);
374  DCL_getErrorInfo(pid);
375  DCL_runErrorHandler(pid);
376  }
377 #endif
378 
379  float64_t k1 = ((c2 * b0) - b1 - ((2.0L + c2) * b2)) / det;
380  float64_t k2 = (c2 + 1.0L) * (b0 + b1 + b2) / det;
381  float64_t k3 = ((c2 * c2 * b0) - (c2 * b1) + b2) / det;
382  pid->sps->Kp = k1;
383  pid->sps->Ki = k2 / k1;
384  pid->sps->Kd = k3 / (k1 * pid->sps->c1);
385 
386 #ifdef DCL_TESTPOINTS_ENABLED
387  pid->css->tpt = det;
388 #endif
389 
390 }
391 
402 {
403 #ifdef DCL_ERROR_HANDLING_ENABLED
404  uint32_t err_code = dcl_none;
405  err_code |= DCL_isZero(cimag(zpk->z1) + cimag(zpk->z2)) ? dcl_none : dcl_param_invalid_err;
406  err_code |= DCL_isZero(cimag(zpk->p2)) ? dcl_none : dcl_param_invalid_err;
407  err_code |= (creal(zpk->p2) <= DCL_c2LimitF64) ? dcl_none : dcl_param_invalid_err;
408  err_code |= (zpk->K >= 0.0f) ? dcl_none : dcl_param_range_err;
409  if (err_code)
410  {
411  DCL_setError(pid,err_code);
412  DCL_getErrorInfo(pid);
413  DCL_runErrorHandler(pid);
414  }
415 #endif
416 
417  float64_t beta1 = -(float64_t) creal(zpk->z1 + zpk->z2);
418  float64_t beta0 = (float64_t) creal(zpk->z1 * zpk->z2);
419  float64_t alpha1 = -(float64_t) creal(zpk->p1 + zpk->p2);
420  float64_t alpha0 = (float64_t) creal(zpk->p1 * zpk->p2);
421  float64_t T = pid->css->T;
422  float64_t a0p = 4.0L + (alpha1 * 2.0L * T) + (alpha0 * T * T);
423  float64_t b0 = zpk->K * (4.0L + (beta1 * 2.0L * T) + (beta0 * T * T)) / a0p;
424  float64_t b1 = zpk->K * (-8.0L + (2.0L * beta0 * T * T)) / a0p;
425  float64_t b2 = zpk->K * (4.0L - (beta1 * 2.0L * T) + (beta0 * T * T)) / a0p;
426  float64_t a2 = (4.0L - (alpha1 * 2.0L * T) + (alpha0 * T * T)) / a0p;
427  float64_t c2 = -a2;
428  float64_t tau = (T / 2.0L) * (1.0L - c2) / (1.0L + c2);
429  pid->sps->c1 = 2.0L / (T + 2.0L * tau);
430  pid->sps->c2 = c2;
431  float64_t det = (c2 + 1.0L);
432  det *= det;
433 
434 #ifdef DCL_ERROR_HANDLING_ENABLED
435  err_code = (DCL_isZero(det)) ? dcl_param_invalid_err : dcl_none;
436  if (err_code)
437  {
438  DCL_setError(pid,err_code);
439  DCL_getErrorInfo(pid);
440  DCL_runErrorHandler(pid);
441  }
442 #endif
443 
444  pid->sps->Kp = ((c2 * b0) - b1 - ((2.0L + c2) * b2)) / det;
445  pid->sps->Ki = (c2 + 1.0L) * (b0 + b1 + b2) / det;
446  pid->sps->Kd = ((c2 * c2 * b0) - (c2 * b1) + b2) / (det * pid->sps->c1);
447 
448 #ifdef DCL_TESTPOINTS_ENABLED
449  pid->css->tpt = det;
450 #endif
451 
452 }
453 
464 {
465  float64_t v1, v4, v5, v8, v9, v10, v12;
466 
467  v5 = (pid->Kr * rk) - yk;
468  v8 = ((rk - yk) * pid->Ki * pid->Kp * pid->i14) + pid->i10;
469  pid->i10 = v8;
470  v1 = yk * pid->Kd * pid->c1;
471  v4 = v1 - pid->d2 - pid->d3;
472  pid->d2 = v1;
473  pid->d3 = v4 * pid->c2;
474  v9 = ((v5 - v4) * pid->Kp) + v8;
475  v10 = DCL_runSat(v9, pid->Umax, pid->Umin);
476  v12 = (v10 == v9) ? 1.0L : 0.0L;
477  pid->i14 = v12 * lk;
478 
479 #ifdef DCL_TESTPOINTS_ENABLED
480  pid->css->tpt = v5;
481 #endif
482 
483  return(v10);
484 }
485 
496 {
497  float64_t v1, v4, v5, v6, v8, v9, v10, v12;
498 
499  v5 = rk - yk;
500  v6 = v5 * pid->Kp;
501  v8 = v5 * pid->Ki * pid->i14 + pid->i10;
502  pid->i10 = v8;
503  v1 = v5 * pid->Kd * pid->c1;
504  v4 = v1 - pid->d2 - pid->d3;
505  pid->d2 = v1;
506  pid->d3 = v4 * pid->c2;
507  v9 = v6 + v8 + v4;
508  v10 = DCL_runSat(v9, pid->Umax, pid->Umin);
509  v12 = (v10 == v9) ? 1.0L : 0.0L;
510  pid->i14 = v12 * lk;
511 
512 #ifdef DCL_TESTPOINTS_ENABLED
513  pid->css->tpt = v8;
514 #endif
515 
516  return(v10);
517 }
518 
521 #ifdef __cplusplus
522 }
523 #endif // extern "C"
524 
525 #endif // _DCL_PIDF64_H_
DCL_updatePIDF64NoCheck
_DCL_CODE_ACCESS void DCL_updatePIDF64NoCheck(DCL_PIDF64 *pid)
Updates PID parameter from its SPS parameter with interrupt protection.
Definition: dcl_pidf64.h:204
dcl_pidf64::c1
float64_t c1
D path low-pass filter coefficient 1, default is 1.
Definition: dcl_pidf64.h:78
DCL_forceUpdatePIDF64
_DCL_CODE_ACCESS void DCL_forceUpdatePIDF64(DCL_PIDF64 *pid)
Loads PIDF64 tuning parameter from its SPS parameter without interrupt protection.
Definition: dcl_pidf64.h:169
DCL_isValue
#define DCL_isValue(x, y)
Determines numerical proximity to specified value.
Definition: dcl_macro.h:72
DCL_PIDF64_SPS::Umax
float64_t Umax
Upper saturation limit.
Definition: dcl_pidf64.h:62
DCL_PIDF64_SPS::c1
float64_t c1
D path low-pass filter coefficient 1, default is 1.
Definition: dcl_pidf64.h:60
DCL_loadSeriesPIDF64asZPK
_DCL_CODE_ACCESS void DCL_loadSeriesPIDF64asZPK(DCL_PIDF64 *pid, DCL_ZPK3F64 *zpk)
Configures a series PID controller parameter in ZPK form.
Definition: dcl_pidf64.h:334
DCL_ZPK3::K
float32_t K
Real gain.
Definition: dcl_zpk3.h:69
DCL_setPIDF64filterBW
_DCL_CODE_ACCESS void DCL_setPIDF64filterBW(DCL_PIDF64 *pid, float64_t fc)
Loads the derivative path filter shadow coefficients.
Definition: dcl_pidf64.h:264
dcl_pidf64::Kp
float64_t Kp
Proportional gain.
Definition: dcl_pidf64.h:74
DCL_resetPIDF64
_DCL_CODE_ACCESS void DCL_resetPIDF64(DCL_PIDF64 *pid)
Resets PID64 internal storage data with interrupt protection.
Definition: dcl_pidf64.h:155
DCL_ZPK3::z2
float complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:64
DCL_ZPK3::p2
float complex p2
Complex poles 2.
Definition: dcl_zpk3.h:67
dcl_pidf64::d3
float64_t d3
D path low-pass filter storage (c2)
Definition: dcl_pidf64.h:85
dcl_none
@ dcl_none
No error.
Definition: dcl_error.h:57
DCL_getPIDF64filterBW
_DCL_CODE_ACCESS float64_t DCL_getPIDF64filterBW(DCL_PIDF64 *pid)
Returns the active derivative path filter bandwidth in Hz.
Definition: dcl_pidf64.h:319
DCL_updatePIDF64
_DCL_CODE_ACCESS bool DCL_updatePIDF64(DCL_PIDF64 *pid)
A conditional update based on the update flag. If the update status is set, the function will update ...
Definition: dcl_pidf64.h:245
dcl_pidf64::Umin
float64_t Umin
Lower saturation limit.
Definition: dcl_pidf64.h:81
dcl_pidf64::Kd
float64_t Kd
Derivative gain.
Definition: dcl_pidf64.h:76
DCL_runErrorHandler
#define DCL_runErrorHandler(ptr)
Prototype for basic error handler.
Definition: dcl_error.h:108
dcl_pidf64::Umax
float64_t Umax
Upper saturation limit.
Definition: dcl_pidf64.h:80
DCL_PIDF64
_DCL_VOLATILE struct dcl_pidf64 DCL_PIDF64
DCL_PIDF64_SPS::Kd
float64_t Kd
Derivative gain.
Definition: dcl_pidf64.h:58
DCL_runPIDF64Series
_DCL_CRIT_ACCESS float64_t DCL_runPIDF64Series(DCL_PIDF64 *pid, float64_t rk, float64_t yk, float64_t lk)
Executes an ideal form PID64 controller.
Definition: dcl_pidf64.h:463
DCL_getUpdateStatus
#define DCL_getUpdateStatus(p)
Determine whether a parameter update-in-progress flag is set.
Definition: dcl_css.h:122
DCL_PIDF64_SPS::Kp
float64_t Kp
Proportional gain.
Definition: dcl_pidf64.h:56
DCL_clearUpdateStatus
#define DCL_clearUpdateStatus(p)
Definition: dcl_css.h:116
DCL_PIDF64_SPS::Umin
float64_t Umin
Lower saturation limit.
Definition: dcl_pidf64.h:63
DCL_c2LimitF64
#define DCL_c2LimitF64
Definition: dcl_macro.h:94
DCL_ZPK3F64::p1
double complex p1
Complex poles 1.
Definition: dcl_zpk3.h:85
_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_pidf64::c2
float64_t c2
D path low-pass filter coefficient 2, default is 0.
Definition: dcl_pidf64.h:79
dcl_pidf64::Kr
float64_t Kr
Set point weight, default is 1.
Definition: dcl_pidf64.h:77
DCL_setActivePIDF64filterBW
_DCL_CODE_ACCESS void DCL_setActivePIDF64filterBW(DCL_PIDF64 *pid, float64_t fc, float64_t T)
Loads the PID64 derivative path filter active coefficients.
Definition: dcl_pidf64.h:293
dcl_pidf64::d2
float64_t d2
D path low-pass filter storage (Kd * c1)
Definition: dcl_pidf64.h:84
DCL_loadParallelPIDF64asZPK
_DCL_CODE_ACCESS void DCL_loadParallelPIDF64asZPK(DCL_PIDF64 *pid, DCL_ZPK3 *zpk)
Configures a parallel PID controller in ZPK form.
Definition: dcl_pidf64.h:401
dcl_interrupt_t
uint32_t dcl_interrupt_t
Definition: dcl_common.h:107
DCL_PIDF64_SPS::Ki
float64_t Ki
Integral gain.
Definition: dcl_pidf64.h:57
DCL_PIDF64_SPS
Defines DCL_PIDF64 shadow PID64 controller structure used for updating controller parameter.
Definition: dcl_pidf64.h:55
dcl_pidf64::i10
float64_t i10
I path feedback storage.
Definition: dcl_pidf64.h:86
DCL_isZero
#define DCL_isZero(x)
Determines floating point numerical proximity to zero.
Definition: dcl_macro.h:77
dcl_param_range_err
@ dcl_param_range_err
Parameter range exceeded.
Definition: dcl_error.h:58
dcl_pidf64::sps
DCL_PIDF64_SPS * sps
updates controller parameter
Definition: dcl_pidf64.h:90
CONST_PI_F64
#define CONST_PI_F64
Definition: dcl_macro.h:57
DCL_CSSF64
Defines the 64bit CSS structure.
Definition: dcl_css.h:72
DCL_ZPK3F64::p2
double complex p2
Complex poles 2.
Definition: dcl_zpk3.h:86
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_ZPK3F64::K
float64_t K
Real gain.
Definition: dcl_zpk3.h:88
dcl_pidf64
DCL_PIDF64 object for storing 64bit PID specific parameters.
Definition: dcl_pidf64.h:72
dcl_pidf64::i14
float64_t i14
Saturation multiplier, ranges between 1*lk ~ 0, where 0 means fully saturated.
Definition: dcl_pidf64.h:87
DCL_restoreInts
#define DCL_restoreInts(v)
Definition: dcl_common.h:106
dcl_param_invalid_err
@ dcl_param_invalid_err
Parameter not valid.
Definition: dcl_error.h:59
DCL_runPIDF64Parallel
_DCL_CRIT_ACCESS float64_t DCL_runPIDF64Parallel(DCL_PIDF64 *pid, float64_t rk, float64_t yk, float64_t lk)
Executes an parallel form PID64 controller.
Definition: dcl_pidf64.h:495
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
float64_t
double float64_t
Definition: dcl_common.h:59
DCL_ZPK3F64
Defines the 64bit ZPK3 structure.
Definition: dcl_zpk3.h:81
DCL_PIDF64_SPS::Kr
float64_t Kr
Set point weight, default is 1.
Definition: dcl_pidf64.h:59
dcl_pidf64::css
DCL_CSSF64 * css
configuration & debugging
Definition: dcl_pidf64.h:91
DCL_getErrorInfo
#define DCL_getErrorInfo(ptr)
Macro to store error info in CSS.
Definition: dcl_error.h:98
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_pidf64::Ki
float64_t Ki
Integral gain.
Definition: dcl_pidf64.h:75
DCL_PIDF64_SPS::c2
float64_t c2
D path low-pass filter coefficient 2, default is 0.
Definition: dcl_pidf64.h:61
DCL_ZPK3F64::z2
double complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:83
DCL_ZPK3F64::z1
double complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:82
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