From 084d930012714dd06a1ff45e400df678e371c36c Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Tue, 26 Apr 2022 19:24:59 +0200
Subject: [PATCH] Retarder: Corrected error for TransmissionInputRetarder when
 Gearbox is diseanged but clutch is closed.

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

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs
index 515d8a6fc7..16d3959e7d 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs
@@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 
 		public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun)
 		{
-			if (angularVelocity == null || (_primaryRetarder && !DataBus.ClutchInfo.ClutchClosed(absTime))) {
+			if (angularVelocity == null || (_primaryRetarder && (!DataBus.ClutchInfo.ClutchClosed(absTime) || !DataBus.GearboxInfo.GearEngaged(absTime)))) {
 				return NextComponent.Request(absTime, dt, torque, angularVelocity, dryRun);
 			}
 			var avgAngularSpeed = (PreviousState.InAngularVelocity + angularVelocity) / 2.0;
-- 
GitLab