Expose outputSum for monitoring and userspace anti-windup #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR moves the outputSum variable from public to private.
While the same functionality might be provided by a GetIntegral() and SetIntegral(value) or a user-space
myPID.SetMode(myPID.Control::manual);Output=value;myPID.SetMode(myPID.Control::automatic);
trick, moving the variable up to Public is a minimal change.Why I think it is an important change is it helps for understanding the trickiest parts of PIDs: the behavior of the integral term. Good explanations of the functionality of PIDs often include graphs of the behavior of the components. Without access to the internal outputSum, it is impossible to see what is going on in the black box.
I've been experimenting with simulating a 1-D heat transfer problem controlled by a PID:
https://wokwi.com/projects/359818835102393345
Note that it shows the exposed integral on the LCD and the time-series, which I think is very helpful for understanding the interactions of the tuning parameters.