[chronojump] Fixed bug in runDoubleContacts new code, read: Message oneTCAfterTheTf



commit 2f88156da10ed597c72296698f5ad9af81b197a0
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Apr 6 14:41:27 2018 +0200

    Fixed bug in runDoubleContacts new code, read: Message oneTCAfterTheTf

 src/execute/run.cs        |    7 +++++++
 src/execute/runObjects.cs |   28 +++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 905b34a..c389893 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -753,6 +753,9 @@ public class RunIntervalExecute : RunExecute
                                                        needCallTrackDone = true;
                                                }
 
+                                               runEI.ChangePhase(RunExecuteInspector.Phases.IN, 
//runEIString +
+                                                               string.Format("Arrived (preparing track) 
timestamp: {0}", Math.Round(timestamp, 3)));
+
                                                runPTL.AddTF(timestamp);
                                        }
                                }
@@ -855,12 +858,15 @@ public class RunIntervalExecute : RunExecute
        //this will be protected and in run simple execute class
        protected override bool lastTfCheckTimeEnded()
        {
+               LogB.Information("In lastTfCheckTimeEnded()");
                TimeSpan span = DateTime.Now - timerLastTf;
                if(span.TotalMilliseconds > checkDoubleContactTime * 1.5)
                {
                        timerLastTf = DateTime.Now;
+                       LogB.Information("... ended success");
                        return true;
                }
+               LogB.Information("... ended NOT success");
                return false;
        }
 
@@ -875,6 +881,7 @@ public class RunIntervalExecute : RunExecute
        //and use static variables where needed
        protected override void trackDone()
        {
+               LogB.Information("In trackDone()");
                double myTrackTime = 0;
                if(runDC.UseDoubleContacts())
                        myTrackTime = runDC.GetTrackTimeInSecondsAndUpdateStartPos(); //will come in seconds
diff --git a/src/execute/runObjects.cs b/src/execute/runObjects.cs
index ad92888..9871275 100644
--- a/src/execute/runObjects.cs
+++ b/src/execute/runObjects.cs
@@ -85,6 +85,11 @@ public class RunPhaseInfoManage
        public int GetPosOfBiggestTC ()
        {
                LogB.Information("startPos at GetPosOfBiggestTC: " + startPos.ToString());
+
+               //Read below message: "Message oneTCAfterTheTf"
+               if(countTCs() == 1 && oneTCAfterTheTf())
+                       return 1;
+
                //if there's no tc, return -1, track duration will be tf duration
                //if there's one tc, return -1, track duration will be tc+tf duration
                if(countTCs() < 2)
@@ -166,6 +171,27 @@ public class RunPhaseInfoManage
                return count;
        }
 
+       /*
+        * "Message oneTCAfterTheTf"
+        * if in first track there's only one TC, take care because maybe it has been after the TF
+        * it can happen because tc will be lower than the margin: 300 ms (checktime) + 1.5 * checktime
+        * so first will be the TF, then waiting margin... but TC happens, and then track is processed, track 
should not include this tf
+        */
+       private bool oneTCAfterTheTf()
+       {
+               if(list.Count != 2)
+                       return false;
+
+               RunPhaseInfo first = (RunPhaseInfo) list[0];
+               RunPhaseInfo second = (RunPhaseInfo) list[1];
+
+               //check if firt is TF and second TC
+               if(! first.IsContact() && second.IsContact())
+                       return true;
+
+               return false;
+       }
+
        public int LastPositionOfList {
                get { return list.Count -1; }
        }
@@ -423,7 +449,7 @@ public class RunExecuteInspector
 
        public override string ToString()
        {
-               string report = string.Format("Report of race started at: {0}; ended at: {1}", 
dtStarted.ToShortTimeString(), dtEnded.ToShortTimeString());
+               string report = string.Format("RunExecuteInspector RunEI report of race started: {0}; ended: 
{1}", dtStarted.ToShortTimeString(), dtEnded.ToShortTimeString());
                report += "\n" + "Type: " + type.ToString();
                report += "\n" + "SpeedStartArrival: " + speedStartArrival;
                report += "\n" + "CheckDoubleContactMode: " + checkDoubleContactMode;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]