From c94d74bbb09f1255686fa8727eb1fc5a78dd0253 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 9 Aug 2017 09:54:09 +0200
Subject: [PATCH] fix: waiting time has to be from previous state

---
 .../SimulationComponent/Impl/DistanceBasedDrivingCycle.cs   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs
index 45a94f3974..41e0fb4be6 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs
@@ -179,11 +179,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 		private Second GetStopTimeInterval()
 		{
 			if (!Left.PTOActive || IdleController == null) {
-				if ((Left.StoppingTime - CurrentState.WaitTime).IsGreater(2 * Constants.SimulationSettings.TargetTimeInterval,
+				if ((Left.StoppingTime - PreviousState.WaitTime).IsGreater(2 * Constants.SimulationSettings.TargetTimeInterval,
 					0.1 * Constants.SimulationSettings.TargetTimeInterval)) {
 					return 2 * Constants.SimulationSettings.TargetTimeInterval;
 				}
-				return Left.StoppingTime - CurrentState.WaitTime;
+				return Left.StoppingTime - PreviousState.WaitTime;
 			}
 			if (Left.StoppingTime.IsGreater(6 * Constants.SimulationSettings.TargetTimeInterval)) {
 				// 7 phases
@@ -538,4 +538,4 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			CycleIntervalIterator.Dispose();
 		}
 	}
-}
\ No newline at end of file
+}
-- 
GitLab