From 8b2c0535509578ff1cd6b4d5fda619276275a170 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 18 May 2016 17:02:03 +0200
Subject: [PATCH] change: costing no longer relies on minimum velocity. only if
 distance is negative braking starts immediately

---
 .../SimulationComponent/Impl/DefaultDriverStrategy.cs  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs
index 56972493d3..c578eacbb9 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs
@@ -274,8 +274,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			var currentSpeed = Driver.DataBus.VehicleSpeed;
 
 			// distance until halt
-			var lookaheadDistance = Formulas.DecelerationDistance(currentSpeed, 0.SI<MeterPerSecond>(),
-				Driver.DriverData.LookAheadCoasting.Deceleration);
+			//var lookaheadDistance = Formulas.DecelerationDistance(currentSpeed, 0.SI<MeterPerSecond>(),
+			//	Driver.DriverData.LookAheadCoasting.Deceleration);
+			var lookaheadDistance = (currentSpeed.Value() * 3.6 * 10).SI<Meter>();
+
 			lookaheadDistance = VectoMath.Max(2 * ds, 1.2 * lookaheadDistance);
 			var lookaheadData = Driver.DataBus.LookAhead(lookaheadDistance);
 
@@ -287,8 +289,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 					: entry.VehicleTargetSpeed;
 				if (nextTargetSpeed < currentSpeed) {
 					var coastingDistance = ComputeCoastingDistance(currentSpeed, entry);
-					if (!Driver.DriverData.LookAheadCoasting.Enabled ||
-						currentSpeed < Driver.DriverData.LookAheadCoasting.MinSpeed ||
+					if ( /*!Driver.DriverData.LookAheadCoasting.Enabled ||
+						currentSpeed < Driver.DriverData.LookAheadCoasting.MinSpeed || */
 						coastingDistance < 0) {
 						var brakingDistance = Driver.ComputeDecelerationDistance(nextTargetSpeed) + BrakingSafetyMargin;
 						Log.Debug(
-- 
GitLab