From eac2e164bb947ed543a91c2f405e75ec19ed8323 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 6 May 2016 09:43:59 +0200
Subject: [PATCH] only compensate torque in brakes when stopping if clutch is
 engaged (otherwise no operating point might be found)

---
 VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs
index aa2fb87f4f..99ee2a0529 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs
@@ -77,7 +77,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				//          but this could lead to extrapolation of loss maps (in axlegear and gear).
 				// solution: we check here if the angularVelocity is 0 the first time and brake away all the torque if it is.
 				//           afterwards the vehicle is standing and other mechanisms take over (Driver.DriveTimeInterval)
-				if (DataBus.DriverBehavior == DrivingBehavior.Braking && !PreviousState.OutAngularVelocity.IsEqual(0) &&
+				if (DataBus.ClutchClosed(absTime) && DataBus.DriverBehavior == DrivingBehavior.Braking && !PreviousState.OutAngularVelocity.IsEqual(0) &&
 					angularVelocity.IsEqual(0)) {
 					brakeTorque = -torque;
 					if (!dryRun) {
-- 
GitLab