Fixed the ScaledPV and ScaledSP clamping issue.

Fork of PID by Aaron Berk

Files at this revision

API Documentation at this revision

Comitter:
vcr
Date:
Tue Jun 19 17:47:52 2018 +0000
Parent:
0:6e12a3e5af19
Commit message:
Commented the ScaledPV and Scaled SP clamping functions

Changed in this revision

PID.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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.