Template for group 4

Dependencies:   mbed

Fork of RT2_P3_students_G4 by Ruprecht Altenburger

Files at this revision

API Documentation at this revision

Comitter:
altb
Date:
Fri Apr 27 06:54:18 2018 +0000
Parent:
10:85840c065e00
Commit message:
..

Changed in this revision

PI_Cntrl.cpp Show annotated file Show diff for this revision Revisions of this file
PI_Cntrl.h Show annotated file Show diff for this revision Revisions of this file
--- a/PI_Cntrl.cpp	Fri Apr 27 06:34:29 2018 +0000
+++ b/PI_Cntrl.cpp	Fri Apr 27 06:54:18 2018 +0000
@@ -11,51 +11,3 @@
 #include "PI_Cntrl.h"
 
 using namespace std;
-
-PI_Cntrl::PI_Cntrl(float Kp, float Tn, float Ts)
-{
-    setCoefficients(Kp, Tn, Ts);
-    uMax = 10000000000.0;
-    uMin = -uMax;
-    reset(0.0f);
-}
-
-PI_Cntrl::PI_Cntrl(float Kp, float Tn, float Ts, float uMax)
-{
-    setCoefficients(Kp, Tn, Ts);
-    this->uMax = (double)uMax;
-    uMin = -(double)uMax;
-    reset(0.0f);
-}
-
-PI_Cntrl::PI_Cntrl(float Kp, float Tn, float Ts, float uMax, float uMin)
-{
-    setCoefficients(Kp, Tn, Ts);
-    this->uMax = (double)uMax;
-    this->uMin = (double)uMin;
-    reset(0.0f);
-}
-
-PI_Cntrl::~PI_Cntrl() {}
-
-void PI_Cntrl::reset(float initValue)
-{
-    s = (double)initValue;
-}
-
-void PI_Cntrl::setCoefficients(float Kp, float Tn, float Ts)
-{
-    b0 = (double)Kp*(1.0 + (double)Ts/(double)Tn);
-    b1 = -(double)Kp;
-    b2 = (double)Ts/(double)Tn;    
-}
-
-float PI_Cntrl::doStep(double e)
-{
-    double u = b0*e + s;          // unconstrained output
-    double uc = u;                // constrained output
-    if(u > uMax) uc = uMax;
-    else if(u < uMin) uc = uMin;
-    s = b1*e + u - b2*(u - uc);
-    return (float)uc;
-}
\ No newline at end of file
--- a/PI_Cntrl.h	Fri Apr 27 06:34:29 2018 +0000
+++ b/PI_Cntrl.h	Fri Apr 27 06:54:18 2018 +0000
@@ -6,29 +6,9 @@
 {
 public:
 
-    PI_Cntrl(float Kp, float Tn, float Ts);
-    PI_Cntrl(float Kp, float Tn, float Ts, float uMax);
-    PI_Cntrl(float Kp, float Tn, float Ts, float uMax, float uMin);
-
-    float operator()(float error) {
-        return doStep((double)error);
-    }
-
-    virtual     ~PI_Cntrl();
-
-    void        reset(float initValue);
-    float       doStep(double error);
 
 private:
 
-    double b0;
-    double b1;
-    double b2;
-    double s;
-    double uMax;
-    double uMin;
-    
-    void        setCoefficients(float Kp, float Tn, float Ts);
 
 };