gpa in double prescision

Dependencies:   mbed

Revision:
7:b3c5116e9fab
Parent:
0:15be70d21d7c
Child:
12:e54941459353
--- a/PI_Cntrl.cpp	Thu Mar 01 17:47:55 2018 +0000
+++ b/PI_Cntrl.cpp	Fri Mar 02 17:11:34 2018 +0000
@@ -29,8 +29,9 @@
 
 float PI_Cntrl::doStep(float error){
     float kpe = Kp * error;
-    float i_part = 1.0f/Tn * Ts * (kpe-del) + i_part_old;  // I with windup subtraction
-    float y_out_temp = (kpe + i_part_old );               // temporary variable
+    float i_part = Ts/Tn*(kpe-1.0f*del) + i_part_old; // I with windup subtraction
+    i_part_old = i_part; 
+    float y_out_temp = (kpe + i_part);                   // unconstrained output
     float y_out;
     // -------- limit output --------
     if(y_out_temp > out_max)
@@ -42,6 +43,6 @@
     // -------- Anti-Windup -------- 
     del = (y_out_temp - y_out);
     // -------- Timeshift --------
-    i_part_old = i_part;
+    
     return y_out;
     }
\ No newline at end of file