From 5897a70455377f53652490e3519cf0a7bcc2796c Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 20 Feb 2019 16:39:08 +0100
Subject: [PATCH] allow reduction of traction interruption interval by 10%

---
 .../VectoCore/Models/SimulationComponent/Impl/Gearbox.cs   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs
index 185c02af60..d3b575effe 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs
@@ -274,6 +274,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				};
 			}
 
+			var remainingTime = _engageTime - (absTime + dt);
+			var withinTractionInterruption = absTime.IsSmaller(_engageTime) && (absTime + dt).IsSmaller(_engageTime);
+			if (withinTractionInterruption && remainingTime.IsSmaller(Constants.SimulationSettings.LowerBoundTimeInterval) && remainingTime.IsSmaller(ModelData.TractionInterruption * 0.1)) {
+				// interval has already been prolonged, but has been overruled. if remaining time is less than 10%, reduce traction interruption time 
+				_engageTime = absTime + dt;
+			}
+
 			if ((inTorque * avgInAngularVelocity).IsGreater(0.SI<Watt>(), Constants.SimulationSettings.LineSearchTolerance)) {
 				return new ResponseOverload {
 					Source = this,
-- 
GitLab