AM261x Motor Control SDK  10.02.00
dcl_nlpid.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023-2025 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 #ifndef _DCL_NLPID_H_
33 #define _DCL_NLPID_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
47 #include <math.h>
48 #include "../dcl_common.h"
49 
52 #define DCL_DELTA_MIN 1.0e-04f
53 
57 #define DCL_GAMMA_MAX 100
58 
61 typedef struct dcl_nlpid_sps
62 {
80 
83 #define NLPID_SPS_DEFAULTS { 1.0f, 0.0f, 0.0f, \
84  1.0f, 1.0f, 1.0f, \
85  0.1f, 0.1f, 0.1f, \
86  1.0f, 1.0f, 1.0f, \
87  1.0f, 0.0f, \
88  1.0f, -1.0f }
89 
92 typedef _DCL_VOLATILE struct dcl_nlpid
93 {
94  /* controller parameter */
111 
112  /* internal storage */
117 
119 
120  /* miscellaneous */
124 
127 #define NLPID_DEFAULTS { 1.0f, 0.0f, 0.0f, \
128  1.0f, 1.0f, 1.0f, \
129  0.1f, 0.1f, 0.1f, \
130  1.0f, 1.0f, 1.0f, \
131  1.0f, 0.0f, \
132  1.0f, -1.0f, \
133  0.0f, 0.0f, 0.0f, 1.0f, 0.0f, \
134  &(DCL_NLPID_SPS)NLPID_SPS_DEFAULTS, &(DCL_CSS)DCL_CSS_DEFAULTS }
135 
144 #define NLPID_INT_DEFAULTS .d2=0.0f, .d3=0.0f, .i7=0.0f, .i16=1.0f, i18=0.0f,\
145  .sps=&(DCL_PID_SPS)PID_SPS_DEFAULTS, .css=&(DCL_CSS)DCL_CSS_DEFAULTS
146 
153 {
154  dcl_interrupt_t ints;
155 
156  ints = DCL_disableInts();
157  pid->d2 = pid->d3 = pid->i7 = 0.0f;
158  pid->i16 = 1.0f;
159  DCL_restoreInts(ints);
160 }
161 
168 {
169 
170 #ifdef DCL_ERROR_HANDLING_ENABLED
171  float32_t tau = (2.0f - pid->sps->c1 * pid->css->T) / (2.0f * pid->sps->c1);
172  float32_t ec2 = pid->sps->c1 * (pid->css->T - 2.0f * tau) / 2.0f;
173  uint32_t err_code = dcl_none;
174  err_code |= ((pid->sps->c2 < (ec2 - DCL_FPU32_TOL)) || (pid->sps->c2 > (ec2 + DCL_FPU32_TOL))) ? dcl_param_invalid_err : dcl_none;
175  err_code |= (pid->sps->delta_p < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
176  err_code |= (pid->sps->delta_i < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
177  err_code |= (pid->sps->delta_d < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
178  err_code |= (pid->sps->Umax <= pid->sps->Umin) ? dcl_param_invalid_err : dcl_none;
179  err_code |= (pid->css->T <= 0.0f) ? dcl_param_range_err : dcl_none;
180  err_code |= ((pid->sps->Kp < 0.0f) || (pid->sps->Ki < 0.0f) || (pid->sps->Kd < 0.0f)) ? dcl_param_range_err : dcl_none;
181  if (err_code)
182  {
183  DCL_setError(pid,err_code);
184  DCL_getErrorInfo(pid);
185  DCL_runErrorHandler(pid);
186  }
187 #endif
188 
189  pid->Kp = pid->sps->Kp;
190  pid->Ki = pid->sps->Ki;
191  pid->Kd = pid->sps->Kd;
192  pid->alpha_p = pid->sps->alpha_p;
193  pid->alpha_i = pid->sps->alpha_i;
194  pid->alpha_d = pid->sps->alpha_d;
195  pid->delta_p = pid->sps->delta_p;
196  pid->delta_i = pid->sps->delta_i;
197  pid->delta_d = pid->sps->delta_d;
198  pid->gamma_p = pid->sps->gamma_p;
199  pid->gamma_i = pid->sps->gamma_i;
200  pid->gamma_d = pid->sps->gamma_d;
201  pid->c1 = pid->sps->c1;
202  pid->c2 = pid->sps->c2;
203  pid->Umax = pid->sps->Umax;
204  pid->Umin = pid->sps->Umin;
205 }
206 
213 {
214  dcl_interrupt_t ints;
215 
216  ints = DCL_disableInts();
218  DCL_restoreInts(ints);
219 }
220 
231 {
232  if (DCL_getUpdateStatus(pid))
233  {
236  return true;
237  }
238  return false;
239 }
240 
249 {
250  float32_t tau = 1.0f / (2.0f * CONST_PI * fc);
251 
252 #ifdef DCL_ERROR_HANDLING_ENABLED
253  uint32_t err_code = dcl_none;
254  err_code |= ((fc >= 1.0f / (2.0f * pid->css->T)) || (fc <= 0.0f)) ? dcl_param_range_err : dcl_none;
255  if (err_code)
256  {
257  DCL_setError(pid,err_code);
258  DCL_getErrorInfo(pid);
259  DCL_runErrorHandler(pid);
260  }
261 #endif
262 
263  pid->sps->c1 = 2.0f / (pid->css->T + 2.0f * tau);
264  pid->sps->c2 = (pid->css->T - 2.0f * tau) / (pid->css->T + 2.0f * tau);
265 }
266 
277 {
278  float32_t tau;
279 
280 #ifdef DCL_ERROR_HANDLING_ENABLED
281  uint32_t err_code = dcl_none;
282  err_code |= ((fc >= 1.0f / (2.0f * T)) || (fc <= 0.0f)) ? dcl_param_range_err : dcl_none;
283  if (err_code)
284  {
285  DCL_setError(pid,err_code);
286  DCL_getErrorInfo(pid);
287  DCL_runErrorHandler(pid);
288  }
289 #endif
290 
291  tau = 1.0f / (2.0f * CONST_PI * fc);
292  pid->c1 = 2.0f / (T + 2.0f * tau);
293  pid->c2 = (T - 2.0f * tau) / (T + 2.0f * tau);
294 }
295 
303 {
304  float32_t tau = ((2.0f - pid->c1 * pid->css->T) / (2.0f * pid->c1));
305  return(1.0f / (2.0f * CONST_PI * tau));
306 }
307 
316 {
317  return((float32_t) powf(delta, (alpha - 1.0f)));
318 }
319 
328 {
329  return((float32_t) powf(gamma, (1.0f / (alpha - 1.0f))));
330 }
331 
339 {
340  float32_t xP = (float32_t) powf(pid->sps->delta_p, (pid->sps->alpha_p - 1.0f));
341  float32_t xI = (float32_t) powf(pid->sps->delta_i, (pid->sps->alpha_i - 1.0f));
342  float32_t xD = (float32_t) powf(pid->sps->delta_d, (pid->sps->alpha_d - 1.0f));
343 
344 
345 #ifdef DCL_ERROR_HANDLING_ENABLED
346  uint32_t err_code = dcl_none;
347  err_code |= ((pid->sps->delta_p > 1.0f) || (pid->sps->delta_p > 1.0f) || (pid->sps->delta_p > 1.0f)) ? dcl_param_range_err : dcl_none;
348  err_code |= (pid->sps->delta_p < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
349  err_code |= (pid->sps->delta_i < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
350  err_code |= (pid->sps->delta_d < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
351  err_code |= ((xP > DCL_GAMMA_MAX) || (xI > DCL_GAMMA_MAX) || (xD > DCL_GAMMA_MAX)) ? dcl_param_range_err : dcl_none;
352  if (err_code)
353  {
354  DCL_setError(pid,err_code);
355  DCL_getErrorInfo(pid);
356  DCL_runErrorHandler(pid);
357  }
358 #endif
359 
360  pid->sps->gamma_p = xP;
361  pid->sps->gamma_i = xI;
362  pid->sps->gamma_d = xD;
363 }
364 
372 {
373  float32_t xP = (float32_t) powf(pid->delta_p, (pid->alpha_p - 1.0f));
374  float32_t xI = (float32_t) powf(pid->delta_i, (pid->alpha_i - 1.0f));
375  float32_t xD = (float32_t) powf(pid->delta_d, (pid->alpha_d - 1.0f));
376 
377 #ifdef DCL_ERROR_HANDLING_ENABLED
378  uint32_t err_code = dcl_none;
379  err_code |= ((pid->delta_p > 1.0f) || (pid->delta_p > 1.0f) || (pid->delta_p > 1.0f)) ? dcl_param_range_err : dcl_none;
380  err_code |= (pid->delta_p < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
381  err_code |= (pid->delta_i < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
382  err_code |= (pid->delta_d < DCL_DELTA_MIN) ? dcl_param_range_err : dcl_none;
383  err_code |= ((xP > DCL_GAMMA_MAX) || (xI > DCL_GAMMA_MAX) || (xD > DCL_GAMMA_MAX)) ? dcl_param_range_err : dcl_none;
384  if (err_code)
385  {
386  DCL_setError(pid,err_code);
387  DCL_getErrorInfo(pid);
388  DCL_runErrorHandler(pid);
389  }
390 #endif
391 
392  pid->gamma_p = xP;
393  pid->gamma_i = xI;
394  pid->gamma_d = xD;
395 }
396 
407 {
408  float32_t v1, v2, v3, v4, v5, v8, v9, v10, v12, v13, v14;
409 
410  // pre-conditioning block
411  v1 = (rk - yk) * 0.5f;
412  v2 = (v1 < 0.0f) ? -1.0f : 1.0f;
413  v3 = fabsf(v1);
414 
415 #ifdef DCL_ERROR_HANDLING_ENABLED
416  err_code |= ((pid->alpha_p >= 2.0f) || (pid->alpha_p <= 0.0f)) ? dcl_param_range_err : dcl_none;
417  err_code |= ((pid->alpha_i >= 2.0f) || (pid->alpha_i <= 0.0f)) ? dcl_param_range_err : dcl_none;
418  err_code |= ((pid->alpha_d >= 2.0f) || (pid->alpha_d <= 0.0f)) ? dcl_param_range_err : dcl_none;
419  err_code |= (v3 > 1.0f) ? dcl_input_range_err : dcl_none;
420  if (err_code)
421  {
422  DCL_setError(pid,err_code);
423  DCL_getErrorInfo(pid);
424  DCL_runErrorHandler(pid);
425  }
426 #endif
427 
428  // non-linear modules
429  v4 = ((v3 > pid->delta_p) ? (v2 * (float32_t) powf(v3, pid->alpha_p)) : (v1 * pid->gamma_p));
430  v5 = ((v3 > pid->delta_i) ? (v2 * (float32_t) powf(v3, pid->alpha_i)) : (v1 * pid->gamma_i));
431  v9 = ((v3 > pid->delta_d) ? (v2 * (float32_t) powf(v3, pid->alpha_d)) : (v1 * pid->gamma_d));
432 
433  // integral path
434  v8 = (v5 * pid->Kp * pid->Ki * pid->i16) + pid->i7;
435  pid->i7 = v8;
436 
437  // derivative path
438  v10 = v9 * pid->Kd * pid->c1;
439  v12 = v10 - pid->d2 - pid->d3;
440  pid->d2 = v10;
441  pid->d3 = v12 * pid->c2;
442 
443  // output sum & clamp
444  v13 = (pid->Kp * (v4 + v12)) + v8;
445  v14 = DCL_runSat(v13, pid->Umax, pid->Umin);
446  pid->i16 = (v14 == v13) ? lk : 0.0f;
447 
448 #ifdef DCL_TESTPOINTS_ENABLED
449  pid->css->tpt = v14;
450 #endif
451 
452 #ifdef DCL_ERROR_HANDLING_ENABLED
454 #endif
455 
456  return(v14);
457 }
458 
469 {
470  float32_t v1, v2, vd2, v3, vd3, v4, v5, v6, v8, v9, v15, v16, v17;
471 
472  // pre-conditioning block for P & I
473  v1 = (rk - yk) * 0.5f;
474  v2 = (v1 < 0.0f) ? -1.0f : 1.0f;
475  v3 = fabsf(v1);
476 
477 #ifdef DCL_ERROR_HANDLING_ENABLED
478  err_code |= ((pid->alpha_p >= 2.0f) || (pid->alpha_p <= 0.0f)) ? dcl_param_range_err : dcl_none;
479  err_code |= ((pid->alpha_i >= 2.0f) || (pid->alpha_i <= 0.0f)) ? dcl_param_range_err : dcl_none;
480  err_code |= (v3 > 1.0f) ? dcl_input_range_err : dcl_none;
481  if (err_code)
482  {
483  DCL_setError(pid,err_code);
484  DCL_getErrorInfo(pid);
485  DCL_runErrorHandler(pid);
486  }
487 #endif
488 
489  // P & I non-linear modules
490  v4 = ((v3 > pid->delta_p) ? (v2 * (float32_t) powf(v3, pid->alpha_p)) : (v1 * pid->gamma_p));
491  v5 = ((v3 > pid->delta_i) ? (v2 * (float32_t) powf(v3, pid->alpha_i)) : (v1 * pid->gamma_i));
492 
493  // D path non-linear block
494  vd2 = (yk < 0.0f) ? -1.0f : 1.0f;
495  vd3 = fabsf(yk);
496 
497 #ifdef DCL_ERROR_HANDLING_ENABLED
498  err_code |= ((pid->alpha_d >= 2.0f) || (pid->alpha_d <= 0.0f)) ? dcl_param_range_err : dcl_none;
499  err_code |= (vd3 > 1.0f) ? dcl_input_range_err : dcl_none;
500  if (err_code)
501  {
502  DCL_setError(pid,err_code);
503  DCL_getErrorInfo(pid);
504  DCL_runErrorHandler(pid);
505  }
506 #endif
507 
508  v6 = ((vd3 > pid->delta_d) ? (vd2 * (float32_t) powf(vd3, pid->alpha_d)) : (yk * pid->gamma_d));
509 
510  // integral path
511  v8 = (v5 * pid->Kp * pid->Ki * pid->i16) + pid->i7;
512  pid->i7 = v8;
513 
514  // derivative path
515  v15 = v6 * pid->Kd * pid->c1;
516  v16 = v15 - pid->d2 - pid->d3;
517  pid->d2 = v15;
518  pid->d3 = v16 * pid->c2;
519 
520  // output sum & clamp
521  v9 = (pid->Kp * (v4 - v16)) + v8;
522  v17 = DCL_runSat(v9, pid->Umax, pid->Umin);
523  pid->i16 = (v17 == v9) ? lk : 0.0f;
524 
525 #ifdef DCL_TESTPOINTS_ENABLED
526  pid->css->tpt = v17;
527 #endif
528 
529 #ifdef DCL_ERROR_HANDLING_ENABLED
531 #endif
532 
533  return(v17);
534 }
535 
536 //--- Basic non-linear function ----------------------------------------------
537 
547 {
548  float32_t v2 = (x < 0.0f) ? -1.0f : 1.0f;
549  float32_t v3 = fabsf(x);
550 
551  return((v3 > delta) ? (v2 * (float32_t) powf(v3, alpha)) : (x * powf(delta, (alpha - 1.0f))));
552 }
553 
556 #ifdef __cplusplus
557 }
558 #endif // extern "C"
559 
560 #endif // _DCL_NLPID_H_
DCL_runNLF
_DCL_CRIT_ACCESS float32_t DCL_runNLF(float32_t x, float32_t alpha, float32_t delta)
Executes a basic non-linear control function.
Definition: dcl_nlpid.h:546
DCL_NLPID_SPS::Umin
float32_t Umin
Lower saturation limit.
Definition: dcl_nlpid.h:78
DCL_NLPID_SPS::delta_i
float32_t delta_i
I path linearized range, default is 0.1.
Definition: dcl_nlpid.h:70
dcl_nlpid::delta_d
float32_t delta_d
D path linearized range, default is 0.1.
Definition: dcl_nlpid.h:103
DCL_NLPID_SPS::alpha_i
float32_t alpha_i
I path non-linear exponent, default is 1.
Definition: dcl_nlpid.h:67
DCL_NLPID_SPS::Ki
float32_t Ki
Linear integral gain.
Definition: dcl_nlpid.h:64
dcl_nlpid::delta_p
float32_t delta_p
P path linearized range, default is 0.1.
Definition: dcl_nlpid.h:101
CONST_PI
#define CONST_PI
Local definitions of the mathematical constant pi.
Definition: dcl_macro.h:53
DCL_NLPID_SPS::Kp
float32_t Kp
Linear proportional gain.
Definition: dcl_nlpid.h:63
DCL_updateNLPID
_DCL_CODE_ACCESS bool DCL_updateNLPID(DCL_NLPID *pid)
A conditional update based on the update flag. If the update status is set, the function will update ...
Definition: dcl_nlpid.h:230
DCL_resetNLPID
_DCL_CODE_ACCESS void DCL_resetNLPID(DCL_NLPID *pid)
Resets NLPID internal storage data with interrupt protection.
Definition: dcl_nlpid.h:152
DCL_NLPID_SPS
Defines the shadow DCL_NLPID controller structure.
Definition: dcl_nlpid.h:62
DCL_setActiveNLPIDgamma
_DCL_CODE_ACCESS void DCL_setActiveNLPIDgamma(DCL_NLPID *pid)
Computes the linearized gains for each path and loads the parameters in the active NLPID structure.
Definition: dcl_nlpid.h:371
DCL_updateNLPIDNoCheck
_DCL_CODE_ACCESS void DCL_updateNLPIDNoCheck(DCL_NLPID *pid)
Loads PID tuning parameter from its SPS parameter with interrupt protection.
Definition: dcl_nlpid.h:212
dcl_none
@ dcl_none
No error.
Definition: dcl_error.h:57
DCL_NLPID_SPS::delta_p
float32_t delta_p
P path linearized range, default is 0.1.
Definition: dcl_nlpid.h:69
DCL_NLPID_SPS::Umax
float32_t Umax
Upper saturation limit.
Definition: dcl_nlpid.h:77
DCL_getNLPIDfilterBW
_DCL_CODE_ACCESS float32_t DCL_getNLPIDfilterBW(DCL_NLPID *pid)
Returns the derivative LP filter bandwidth in Hz.
Definition: dcl_nlpid.h:302
DCL_setActiveNLPIDfilterBW
_DCL_CODE_ACCESS void DCL_setActiveNLPIDfilterBW(DCL_NLPID *pid, float32_t fc, float32_t T)
Loads the NLPID derivative path filter active coefficients.
Definition: dcl_nlpid.h:276
DCL_runErrorHandler
#define DCL_runErrorHandler(ptr)
Prototype for basic error handler.
Definition: dcl_error.h:108
DCL_getUpdateStatus
#define DCL_getUpdateStatus(p)
Determine whether a parameter update-in-progress flag is set.
Definition: dcl_css.h:121
DCL_GAMMA_MAX
#define DCL_GAMMA_MAX
Sets an upper bound on allowable controller gain, and therefore fixes the minimum linear region semi-...
Definition: dcl_nlpid.h:57
dcl_nlpid::gamma_d
float32_t gamma_d
D path gain limit, default is 1.
Definition: dcl_nlpid.h:106
DCL_runNLPIDParallel
_DCL_CRIT_ACCESS float32_t DCL_runNLPIDParallel(DCL_NLPID *pid, float32_t rk, float32_t yk, float32_t lk)
Executes a parallel form non-linear PID controller.
Definition: dcl_nlpid.h:406
DCL_clearUpdateStatus
#define DCL_clearUpdateStatus(p)
Definition: dcl_css.h:115
dcl_nlpid
Defines the active DCL_NLPID controller structure.
Definition: dcl_nlpid.h:93
_DCL_CODE_ACCESS
#define _DCL_CODE_ACCESS
Defines the scope of dcl functions.
Definition: dcl_common.h:63
dcl_nlpid::alpha_i
float32_t alpha_i
I path non-linear exponent, default is 1.
Definition: dcl_nlpid.h:99
dcl_nlpid::delta_i
float32_t delta_i
I path linearized range, default is 0.1.
Definition: dcl_nlpid.h:102
DCL_NLPID_SPS::gamma_p
float32_t gamma_p
P path gain limit, default is 1.
Definition: dcl_nlpid.h:72
DCL_NLPID_SPS::c2
float32_t c2
D path low-pass filter coefficient 2, default is 0.
Definition: dcl_nlpid.h:76
DCL_setNLPIDfilterBW
_DCL_CODE_ACCESS void DCL_setNLPIDfilterBW(DCL_NLPID *pid, float32_t fc)
Loads the shadow derivative LP filter coefficients.
Definition: dcl_nlpid.h:248
dcl_nlpid::Kd
float32_t Kd
Linear derivative gain.
Definition: dcl_nlpid.h:97
dcl_nlpid::Kp
float32_t Kp
Linear proportional gain.
Definition: dcl_nlpid.h:95
dcl_nlpid::css
DCL_CSS * css
configuration & debugging
Definition: dcl_nlpid.h:122
DCL_NLPID_SPS::gamma_i
float32_t gamma_i
I path gain limit, default is 1.
Definition: dcl_nlpid.h:73
dcl_nlpid::Umax
float32_t Umax
Upper saturation limit.
Definition: dcl_nlpid.h:109
dcl_interrupt_t
uint32_t dcl_interrupt_t
Definition: dcl_common.h:109
DCL_runNLPIDSeries
_DCL_CRIT_ACCESS float32_t DCL_runNLPIDSeries(DCL_NLPID *pid, float32_t rk, float32_t yk, float32_t lk)
Executes a series form non-linear PID controller.
Definition: dcl_nlpid.h:468
dcl_nlpid::Umin
float32_t Umin
Lower saturation limit.
Definition: dcl_nlpid.h:110
DCL_NLPID_SPS::alpha_d
float32_t alpha_d
D path non-linear exponent, default is 1.
Definition: dcl_nlpid.h:68
DCL_setNLPIDgamma
_DCL_CODE_ACCESS void DCL_setNLPIDgamma(DCL_NLPID *pid)
Computes the linearized gains for each path Note: active coefficients not update DCL_updateNLPID() ca...
Definition: dcl_nlpid.h:338
dcl_nlpid::c1
float32_t c1
D path low-pass filter coefficient 1, default is 1.
Definition: dcl_nlpid.h:107
DCL_NLPID_SPS::Kd
float32_t Kd
Linear derivative gain.
Definition: dcl_nlpid.h:65
dcl_param_range_err
@ dcl_param_range_err
Parameter range exceeded.
Definition: dcl_error.h:58
dcl_nlpid::alpha_d
float32_t alpha_d
D path non-linear exponent, default is 1.
Definition: dcl_nlpid.h:100
DCL_DELTA_MIN
#define DCL_DELTA_MIN
Sets the lower bound on the linear region semi-width.
Definition: dcl_nlpid.h:52
dcl_nlpid::i18
float32_t i18
No longer needed.
Definition: dcl_nlpid.h:118
DCL_getNLPIDgamma
_DCL_CODE_ACCESS float32_t DCL_getNLPIDgamma(float32_t alpha, float32_t delta)
Returns the linearized region gain for specified (alpha,delta)
Definition: dcl_nlpid.h:315
dcl_nlpid::Ki
float32_t Ki
Linear integral gain.
Definition: dcl_nlpid.h:96
DCL_NLPID_SPS::alpha_p
float32_t alpha_p
P path non-linear exponent, default is 1.
Definition: dcl_nlpid.h:66
dcl_nlpid::d2
float32_t d2
D path low-pass filter storage (Kd * c1)
Definition: dcl_nlpid.h:113
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:90
dcl_nlpid::sps
DCL_NLPID_SPS * sps
updates controller parameter
Definition: dcl_nlpid.h:121
DCL_FPU32_TOL
#define DCL_FPU32_TOL
Define the acceptable FPU numerical tolerances.
Definition: dcl_macro.h:60
DCL_NLPID_SPS::c1
float32_t c1
D path low-pass filter coefficient 1, default is 1.
Definition: dcl_nlpid.h:75
DCL_CSS
Defines the controller common support structure.
Definition: dcl_css.h:56
dcl_input_range_err
@ dcl_input_range_err
Input range exceeded.
Definition: dcl_error.h:61
dcl_nlpid::d3
float32_t d3
D path low-pass filter storage (c2)
Definition: dcl_nlpid.h:114
DCL_NLPID_SPS::delta_d
float32_t delta_d
D path linearized range, default is 0.1.
Definition: dcl_nlpid.h:71
DCL_restoreInts
#define DCL_restoreInts(v)
Definition: dcl_common.h:108
dcl_nlpid::alpha_p
float32_t alpha_p
P path non-linear exponent, default is 1.
Definition: dcl_nlpid.h:98
dcl_param_invalid_err
@ dcl_param_invalid_err
Parameter not valid.
Definition: dcl_error.h:59
_DCL_VOLATILE
#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:75
dcl_nlpid::i16
float32_t i16
Saturation multiplier, ranges between 1*lk ~ 0, where 0 means fully saturated.
Definition: dcl_nlpid.h:116
dcl_nlpid::c2
float32_t c2
D path low-pass filter coefficient 2, default is 0.
Definition: dcl_nlpid.h:108
DCL_NLPID
_DCL_VOLATILE struct dcl_nlpid DCL_NLPID
DCL_clearControllerStatus
#define DCL_clearControllerStatus(p)
Definition: dcl_css.h:129
dcl_nlpid::gamma_i
float32_t gamma_i
I path gain limit, default is 1.
Definition: dcl_nlpid.h:105
dcl_nlpid::gamma_p
float32_t gamma_p
P path gain limit, default is 1.
Definition: dcl_nlpid.h:104
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:67
DCL_getNLPIDdelta
_DCL_CODE_ACCESS float32_t DCL_getNLPIDdelta(float32_t alpha, float32_t gamma)
Returns the semi-width of the linear gain region for specified (alpha,gamma)
Definition: dcl_nlpid.h:327
float32_t
float float32_t
Definition: dcl_common.h:58
dcl_nlpid::i7
float32_t i7
I path feedback storage.
Definition: dcl_nlpid.h:115
DCL_NLPID_SPS::gamma_d
float32_t gamma_d
D path gain limit, default is 1.
Definition: dcl_nlpid.h:74
DCL_forceUpdateNLPID
_DCL_CODE_ACCESS void DCL_forceUpdateNLPID(DCL_NLPID *pid)
Loads NLPID tuning parameter from its SPS parameter without interrupt protection.
Definition: dcl_nlpid.h:167
DCL_disableInts
#define DCL_disableInts()
Define enable and disable interrupt operations.
Definition: dcl_common.h:107