Skip to content

Conversation

@felipeserta
Copy link

Changed the index correction for control constants averages because of the last interation i++.

Changed the index correction for control constants averages because of the last interation i++.
@s-t-a-n
Copy link

s-t-a-n commented Jun 3, 2024

I was wondering too about the index correctness, but see the conditional block starting at 140:

            // Average all gains after the first two cycles
            if (cycle > 1) {
                pAverage += kp;
                iAverage += ki;
                dAverage += kd;
            }

The decrement seems to derive from that, not from the iteration. i == 1 when 1 cycle has completed. I assume the first cycle is discarded as the process is likely in a cold state and this serves to saturate the process first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants