From 8fdf6687750388747cd557ab4fb542a506c7ae56 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 10 Feb 2017 14:02:47 +0100
Subject: [PATCH] engine idle controller: handle the case when the traction
 interruption is already over

---
 .../Models/SimulationComponent/Impl/CombustionEngine.cs        | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
index 7cb0e4d8fe..fa96536343 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
@@ -552,7 +552,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				}
 
 
-				var velocitySlope = (_engineTargetSpeed - _engine.PreviousState.EngineSpeed) /
+				var velocitySlope = (_dataBus.TractionInterruption - (absTime - _idleStart)).IsEqual(0) ? 0.SI<PerSquareSecond>() :
+					(_engineTargetSpeed - _engine.PreviousState.EngineSpeed) /
 									(_dataBus.TractionInterruption - (absTime - _idleStart));
 
 				var nextAngularSpeed = (velocitySlope * dt + _engine.PreviousState.EngineSpeed);
-- 
GitLab