File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ namespace qlibs {
188188 public:
189189 pidAutoTuning () = default ;
190190 pidGains getEstimates ( void ) const noexcept ;
191+ bool enableOrder2Estimates ( const bool en ) noexcept ;
191192 };
192193
193194 /* *
Original file line number Diff line number Diff line change @@ -470,10 +470,22 @@ bool pidAutoTuning::step( const real_t u,
470470 return ready;
471471}
472472/* ============================================================================*/
473+ bool pidAutoTuning::enable2ndOrderEstimates ( const bool en ) noexcept
474+ {
475+ if ( en ) {
476+ estimationStep = estimationStepN2;
477+ computeParameters = computeParamsN2;
478+ }
479+ else {
480+ estimationStep = estimationStepN1;
481+ computeParameters = computeParamsN1;
482+ }
483+ }
484+ /* ============================================================================*/
473485pidGains pidAutoTuning::getEstimates ( void ) const noexcept
474486{
475487 pidGains gains = { 0 .0_re, 0 .0_re, 0 .0_re };
476- const real_t tau = sysParams.tau1 ;
488+ const real_t tau = sysParams.tau1 + sysParams. tau2 ;
477489 const real_t k = sysParams.gain ;
478490 const real_t td = tau*0 .1_re;
479491
You can’t perform that action at this time.
0 commit comments