Latest changes without errors

Dependents:   SNOCC_V1 SNOCC_V2

Revision:
9:c17042fc1c98
Parent:
8:8b37dcdc2b36
Child:
10:08e1dc33199e
--- a/VCODATA.cpp	Sun Apr 23 18:25:27 2017 +0000
+++ b/VCODATA.cpp	Mon May 15 22:52:28 2017 +0000
@@ -91,16 +91,22 @@
                     ConsMin=this->NAV_DATA[vel].LAST_NAV_DATA[cons_mile_p];    
                 }
                 else{
-                    int eps_m=1;
+                    int vel2=0;
+                    float ConsMin2=0;
+                    n_events_eps=0;
                     for (int eps=1; eps < Ratio_Min;eps++){
                         if (this->NAV_DATA[vel+eps].LAST_NAV_DATA[cons_mile_p]<=ConsMin) {//hay valores menores al minimo hallado en un entorno de v?
                             n_events_eps++;  
-                            ConsMin=this->NAV_DATA[vel+eps].LAST_NAV_DATA[cons_mile_p];
-                            eps_m=eps;
+                            if (n_events_eps==1){ 
+                            ConsMin2=this->NAV_DATA[vel+eps].LAST_NAV_DATA[cons_mile_p];
+                            vel2=vel+eps;
+                            }                           
                         }
                     }
-                    if (n_events_eps >= n_events_critical) vel=vel+eps_m;    // falso minimo (hay muchos valores menores al minimo hallado)
-                                                                             // nueva ubicación del minimo                       
+                    if (n_events_eps >= n_events_critical){    // falso minimo (hay muchos valores menores al minimo hallado)
+                       ConsMin=ConsMin2;
+                       vel=vel2;                               // nueva ubicación del minimo                       
+                    }   
                     else {
                             GET_Min=1;
                             VCO=vel-1;
@@ -115,26 +121,34 @@
                     GET_MAX=POSIBLE;   
                 }
                 else{
+                    n_events_eps=0;
+                    float ConsMAX2=0;
                     if (GET_MAX==POSIBLE){
-                    int eps_m=1;
+                    int vel2=0;
                     for (int eps=1; eps<Ratio_Min;eps++){
                         if (this->NAV_DATA[vel+eps].LAST_NAV_DATA[cons_mile_p]>ConsMAX) {//hay valores mayores al maximo hallado en un entorno de v?
-                            n_events_eps++;  
-                            ConsMAX=this->NAV_DATA[vel+eps].LAST_NAV_DATA[cons_mile_p];
-                            eps_m=eps;
+                            n_events_eps++; 
+                            if (n_events_eps==1){ 
+                            ConsMAX2=this->NAV_DATA[vel+eps].LAST_NAV_DATA[cons_mile_p];
+                            vel2=vel+eps;
                             }
                         }
-                        if (n_events_eps > n_events_critical) vel=vel+eps_m;    // falso maximo (hay muchos valores mayores al maximo hallado)
-                                                                                // nueva ubicación del maximo                       
+                    }
+                        if (n_events_eps > n_events_critical) { // falso maximo (hay muchos valores mayores al maximo hallado)
+                            vel=vel2;                           // nueva ubicación del maximo siguiente   
+                            ConsMAX=ConsMAX2;
+                        }                                                                       
                         else GET_MAX=SI;
+                        
+                                                    
                      }   
         }
         } 
                     
     }
     
-    //return (VCO);  
-    return (int(ConsMAX*100));                  
+    return (VCO);  
+                     
 }
 
 //---------------------------------------------------------------------------------------------------------------------------------------