.

Fork of Cntrlol_Lib by Ruprecht Altenburger

Revision:
3:27b75e7dd54a
Parent:
2:1f8ddc46c578
Child:
4:9cf60fa0a579
--- a/PID_Cntrl.cpp	Fri Sep 28 12:37:19 2018 +0000
+++ b/PID_Cntrl.cpp	Thu Oct 18 05:44:36 2018 +0000
@@ -4,7 +4,7 @@
     everything is calculated in double
     
                      Ts         z - 1             
-      G(s) = P + I ------- + D -------
+      G(s) = P + I ------- + D -------          D corresponds Kd/Tf in Matlab-formlism pid(...)
                     z - 1       z - p              
 */
 
@@ -14,8 +14,8 @@
 PID_Cntrl::PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax)
 {
     setCoefficients(P, I, D, tau_f, Ts);
+    this->uMin = (double)uMin;
     this->uMax = (double)uMax;
-    this->uMin = (double)uMin;
     reset(0.0f);
 }
 
@@ -55,4 +55,14 @@
     Iold=Ipart;
     yold=Dpart;
     return (float)uc;
+}
+
+void PID_Cntrl::set_limits(double ll, double ul)
+{
+    this->uMin = (double)ll;
+    this->uMax = (double)ul;
+}
+float PID_Cntrl::get_ulimit(void)
+{
+    return (float)this->uMax;
 }
\ No newline at end of file