From f10a1b220d418a05ba830d2575f8dfee62fdd1d8 Mon Sep 17 00:00:00 2001
From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at>
Date: Wed, 10 May 2023 12:44:12 +0200
Subject: [PATCH] override axlegear required in IEPC_E rundata factory

---
 ...clarationModeCompletedBusRunDataFactory.cs | 36 +++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/CompletedBusRunDataFactory/DeclarationModeCompletedBusRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/CompletedBusRunDataFactory/DeclarationModeCompletedBusRunDataFactory.cs
index c2ff859e9b..57170787a3 100644
--- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/CompletedBusRunDataFactory/DeclarationModeCompletedBusRunDataFactory.cs
+++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/CompletedBusRunDataFactory/DeclarationModeCompletedBusRunDataFactory.cs
@@ -1008,8 +1008,40 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.CompletedBusRun
 				throw new NotImplementedException();
 			}
 
-			#endregion
-		}
+            #endregion
+
+			protected override bool AxleGearRequired()
+			{
+				var vehicle = PrimaryVehicle;
+				var iepcInput = vehicle.Components.IEPC;
+				var axleGearRequired = !iepcInput.DifferentialIncluded && !iepcInput.DesignTypeWheelMotor;
+				if (axleGearRequired && vehicle.Components.AxleGearInputData == null)
+				{
+					throw new VectoException(
+						$"Axlegear required for selected type of IEPC! DifferentialIncluded: {iepcInput.DifferentialIncluded}, DesignTypeWheelMotor: {iepcInput.DesignTypeWheelMotor}");
+				}
+
+				//var numGearsPowermap =
+				//	iepcInput.VoltageLevels.Select(x => Tuple.Create(x.VoltageLevel, x.PowerMap.Count)).ToArray();
+				//var gearCount = iepcInput.Gears.Count;
+				//var numGearsDrag = iepcInput.DragCurves.Count;
+
+				//if (numGearsPowermap.Any(x => x.Item2 != gearCount))
+				//{
+				//	throw new VectoException(
+				//		$"Number of gears for voltage levels does not match! PowerMaps: {numGearsPowermap.Select(x => $"{x.Item1}: {x.Item2}").Join()}; Gear count: {gearCount}");
+				//}
+
+				//if (numGearsDrag > 1 && numGearsDrag != gearCount)
+				//{
+				//	throw new VectoException(
+				//		$"Number of gears drag curve does not match gear count! DragCurve {numGearsDrag}; Gear count: {gearCount}");
+				//}
+
+				return axleGearRequired || vehicle.Components.AxleGearInputData != null;
+
+			}
+        }
 		#endregion BatteryElectric
 
 		public class Exempted : CompletedBusBase
-- 
GitLab