pr7

Dependencies:   mbed

Revision:
1:92f175969d90
Parent:
0:05dd1de8cc3f
Child:
2:1ded9d10f322
--- a/PID_Cntrl.cpp	Fri May 03 09:37:27 2019 +0000
+++ b/PID_Cntrl.cpp	Fri May 10 14:25:24 2019 +0000
@@ -1,18 +1,25 @@
-/*  
-    PI Controller class 
-    
-                    1          s             
-      G(s) = P + I --- + D --------- 
-                    s      T_f*s + p              
+/*
+    PID-T1 Controller class
+
+                      1           s
+      G(s) = Kp + Ki --- + Kd ---------
+                      s       T_f*s + p
+
+    Eigther reseting the Nucleo via the black button or save a new software on 
+    the Nucleo sets the analog output to zero. Zero is equal to -4 Ampere!!!
+    Therefor: NEVER !!! reset or save a new software while the VC is powered on
+    (the green button on the VC is glowing green)                      
+
 */
 
 #include "PID_Cntrl.h"
 using namespace std;
 
-PID_Cntrl::PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax)
+PID_Cntrl::PID_Cntrl(float Kp, float Ki, float Kd, float Tf, float Ts, float uMin, float uMax)
 {
-// ....
-
+    // link member variables
+    // ???
+    
     reset(0.0f);
 }
 
@@ -20,14 +27,35 @@
 
 void PID_Cntrl::reset(float initValue)
 {
-    // here code for resetting variables
+
+    // implement controller reset
+    // ???
 
 }
 
 float PID_Cntrl::update(double e)
 {
-    // here the main code!!!
+
+    // controller update function 
+    
+    // calculate uI
+    // ???
     
+    // saturate uI, uMin <= uI <= uMax (anti-windup for the integrator part)
+    // ???
+
+    // calculate uD
+    // ???
+    
+    // calculate u
+    // ???
+    
+    // saturate u, uMin <= u <= uMax
+    // ???
+    
+    // update signal storage
+    // ???
+
     return 0.0f;
 }