From f51ce32c181f95ce050d4c8fe0271b84a28f05e6 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 25 Sep 2019 16:18:29 +0200
Subject: [PATCH] fix: mapping of vecto gears to voith model gear count

---
 .../Impl/ATShiftStrategyVoith.cs                   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs
index 21edb45fd0..6400fcefbe 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs
@@ -220,7 +220,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 
 				var nextGear = _gearbox.TorqueConverterLocked ? gear + 1 : gear;
 
-				var shiftSpeed = UpshiftLines[(int)gear + (dualTCTransmission ? 2 : 1)].LookupShiftSpeed(
+				var gearIdx = (int)gear;
+				if (_gearbox.TorqueConverterLocked) {
+					gearIdx += 1;
+				}
+
+
+				var shiftSpeed = UpshiftLines[gearIdx].LookupShiftSpeed(
 					_loadStage, DataBus.RoadGradient, DataBus.DriverAcceleration, _accMin, _accMax);
 				var shiftSpeedGbxOut = shiftSpeed / ModelData.Gears[nextGear].Ratio;
 				if (outAngularVelocity > shiftSpeedGbxOut) {
@@ -246,7 +252,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				return false;
 			}
 
-			var shiftSpeed = DownshiftLines[(int)gear + (dualTCTransmission ? 2 : 1)].LookupShiftSpeed(
+			var gearIdx = (int)gear;
+			if (_gearbox.TorqueConverterLocked) {
+				gearIdx += 1;
+			}
+			var shiftSpeed = DownshiftLines[gearIdx].LookupShiftSpeed(
 				_loadStage, DataBus.RoadGradient, DataBus.DriverAcceleration, -0.4.SI<MeterPerSquareSecond>(),
 				-0.2.SI<MeterPerSquareSecond>());
 			if (inAngularVelocity < shiftSpeed) {
-- 
GitLab