Open
Conversation
drf5n
pushed a commit
to drf5n/Arduino-PID-Library
that referenced
this pull request
Mar 21, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I recently made a mechanical relay based PID with time proportioning control but I noticed some behavior in the sample that was unexpected, and this pull request is an attempt to address those.
First, is that given a window size of 5000 and a PID output of say, 2000 I would expect the PID to be on for 2000 out of 5000 milliseconds. The call to myPID.Compute(); inside the main loop changed the output each loop so out of a 5000 millisecond slice of time, the output could vary between 2000 and 0. I am not an expert in PIDs but it seems like it would make it hard to maintain a consistent temperature when the response depended on more than just the output state.
The other change I made was to put in a floor so that the relay would be on for a minimum amount of time. My assumption is that mechanical relays have a response time, and anything below the response time is not useful.
Finally, thank you for writing the PID library and contributing, I find it very useful and I'm glad you made it.