Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose outputSum for monitoring and userspace anti-windup #65

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

drf5n
Copy link

@drf5n drf5n commented Mar 21, 2023

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

image

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.

@Dlloydev
Copy link
Owner

Very nice simulation setup!
Thanks for your recent comments and suggestions.
I agree with your suggestions, but I hope to get some time later today (but probably tomorrow) to have a closer look .

  • David Lloyd

@Dlloydev Dlloydev merged commit a686ab0 into Dlloydev:master Mar 22, 2023
@drf5n
Copy link
Author

drf5n commented Mar 23, 2023

Thanks. I updated the simulator at https://wokwi.com/projects/359818835102393345
to use your current version unmodified.

The current version doesn't seem to have migrated into the Arduino Library system yet, but should soon.

@Dlloydev
Copy link
Owner

Oh, I only pushed the updates ... I'll create a new version shortly (QuickPID 3.1.5) and tag so Arduino can migrate it.

Dlloydev added a commit that referenced this pull request Mar 23, 2023
Resolves #65, #66 and #67
Thanks @drf5n

Also adds a new "toggle" controller mode that toggles between manual and automatic mode.
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