From c33790787adefee2a1977fa2dbb275a0da9dfcd0 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Mon, 25 Apr 2016 16:05:30 +0200 Subject: [PATCH] corrected bug in driver for test "Coach_DriverStrategy_Decelerate_60_20_uphill_25" --- .../Models/SimulationComponent/Impl/Driver.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index 475f4f0dc2..8ca89e3e59 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -562,10 +562,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl }, evaluateFunction: acc => { - var tmp = ComputeTimeInterval(acc, ds); - retVal.SimulationInterval = tmp.SimulationInterval; - retVal.SimulationDistance = tmp.SimulationDistance; - return NextComponent.Request(absTime, tmp.SimulationInterval, acc, gradient, true); + // calculate new time interval only when vehiclespeed and acceleration are != 0 + // else: use same timeinterval as before. + if (!(acc.IsEqual(0) && DataBus.VehicleSpeed.IsEqual(0))) { + var tmp = ComputeTimeInterval(acc, ds); + retVal.Acceleration = tmp.Acceleration; + retVal.SimulationInterval = tmp.SimulationInterval; + retVal.SimulationDistance = tmp.SimulationDistance; + } + return NextComponent.Request(absTime, retVal.SimulationInterval, acc, gradient, true); }, criterion: response => { if (response is ResponseEngineSpeedTooLow) { -- GitLab