From 20d16cd8e81f162c73175e3df9719e2ed3cb3dbf Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Thu, 7 May 2020 08:42:18 +0200
Subject: [PATCH] AT Gearbox: don't add losses if average speed is 0

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

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs
index 08b393ec5c..4edeb2ac9e 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs
@@ -301,7 +301,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
 			var avgInAngularVelocity = (PreviousState.InAngularVelocity + inAngularVelocity) / 2.0;
 			var inTorqueLossResult = effectiveLossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
-			var inTorque = outTorque * (avgOutAngularVelocity / avgInAngularVelocity) + inTorqueLossResult.Value;
+			var inTorque = avgInAngularVelocity.IsEqual(0) ? outTorque : outTorque * (avgOutAngularVelocity / avgInAngularVelocity) + inTorqueLossResult.Value;
 
 			var inertiaTorqueLossOut = !inAngularVelocity.IsEqual(0)
 				? Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) /
-- 
GitLab