Original Version of STM Board

Dependencies:   FastPWM mbed

Revision:
68:328e1be06f5d
Parent:
67:c2812cf26c38
Child:
69:3995ffeaa786
--- a/main.cpp	Tue May 12 07:43:44 2020 +0000
+++ b/main.cpp	Tue May 12 11:25:00 2020 +0000
@@ -184,7 +184,9 @@
 }
 
 
-float f_future[num_input_array] = {0.0f};
+float x_past[num_array_x_past] = {0.0f};
+float f_past[num_array_f_past] = {0.0f};
+float f_future[num_array_f_future] = {0.0f};
 
 float input[num_input] = { 0.0f };
 
@@ -404,10 +406,8 @@
             float output3[32] = { 0.0f };
             float output = 0.0f;
 
-            
-
             for (int index2 = 0; index2 < 32; index2++) {
-                for (int index1 = 0; index1 < 22; index1++) {
+                for (int index1 = 0; index1 < num_input; index1++) {
                     output1[index2] = output1[index2]
                                       + h1[index1][index2] * input[index1];
                 }
@@ -447,7 +447,7 @@
                 output = 1.0f/(1.0f+exp(-output));
             }
 
-            output = output * 24000.0f - 12000.0f;
+            output = output * 20000.0f - 10000.0f;
             if(output>=0) {
                 valve_pos.ref = output*0.0001f*((double)VALVE_MAX_POS - (double) VALVE_CENTER) + (double) VALVE_CENTER;
             } else {
@@ -455,7 +455,6 @@
             }
         }
         
-        
         if(LED==1) {
              LED=0;
         } else