Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PID by
Diff: PID.cpp
- Revision:
- 1:add8ed7b2590
- Parent:
- 0:6e12a3e5af19
diff -r 6e12a3e5af19 -r add8ed7b2590 PID.cpp --- a/PID.cpp Thu Sep 02 16:48:10 2010 +0000 +++ b/PID.cpp Tue Jun 19 17:47:52 2018 +0000 @@ -225,20 +225,21 @@ //Pull in the input and setpoint, and scale them into percent span. float scaledPV = (processVariable_ - inMin_) / inSpan_; - if (scaledPV > 1.0) { + /*if (scaledPV > 1.0) { scaledPV = 1.0; } else if (scaledPV < 0.0) { scaledPV = 0.0; } - + */ float scaledSP = (setPoint_ - inMin_) / inSpan_; - if (scaledSP > 1.0) { + /*if (scaledSP > 1.0) { scaledSP = 1; } else if (scaledSP < 0.0) { scaledSP = 0; } - + */ float error = scaledSP - scaledPV; + //Check and see if the output is pegged at a limit and only //integrate if it is not. This is to prevent reset-windup.