From 68225e6133c5f6ca6321ae82b9cdef08cf32140e Mon Sep 17 00:00:00 2001
From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at>
Date: Thu, 16 Feb 2023 18:01:42 +0100
Subject: [PATCH] use gearbox type from inputdata to lookup adas combinations

---
 VectoCore/VectoCore/OutputData/SumDataFields.cs | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/OutputData/SumDataFields.cs b/VectoCore/VectoCore/OutputData/SumDataFields.cs
index 13bd5fab6a..5c0b5fcee3 100644
--- a/VectoCore/VectoCore/OutputData/SumDataFields.cs
+++ b/VectoCore/VectoCore/OutputData/SumDataFields.cs
@@ -362,7 +362,20 @@ namespace TUGraz.VectoCore.OutputData
 			{ ROLLING_RESISTANCE_COEFFICIENT_WO_TRAILER, SumFunc((r, m) =>   r.VehicleData?.RollResistanceCoefficientWithoutTrailer)},
 			{ ROLLING_RESISTANCE_COEFFICIENT_W_TRAILER, SumFunc((r, m) =>    r.VehicleData?.TotalRollResistanceCoefficient)},
 			{ R_DYN, SumFunc((r, m) => (ConvertedSI)r.VehicleData?.DynamicTyreRadius)},
-			{ ADAS_TECHNOLOGY_COMBINATION, SumFunc((r, m) => r.VehicleData?.ADAS != null ? DeclarationData.ADASCombinations.Lookup(r.VehicleData.ADAS, r.GearboxData?.Type ?? GearboxType.NoGearbox).ID : "")},
+			{ ADAS_TECHNOLOGY_COMBINATION, SumFunc((r, m) => {
+				string ret = "";
+				if (r.VehicleData?.ADAS == null) {
+					return null;
+				}
+
+				var gbxType = r.InputData?.JobInputData.Vehicle.Components?.GetGearboxType() ??
+							r.InputData?.PrimaryVehicleData?.Vehicle.Components?.GetGearboxType();
+
+				if (gbxType != null) {
+					ret = DeclarationData.ADASCombinations.Lookup(r.VehicleData.ADAS, gbxType.Value).ID;
+				}
+				return ret;
+			})},
 			{ REESS_CAPACITY, SumFunc((r, m) => r.BatteryData?.Capacity != null ? $"{r.BatteryData?.Capacity.AsAmpHour} Ah" : r.SuperCapData?.Capacity != null ?  $"{r.SuperCapData.Capacity} F" : null)},
 			{ TCU_MODEL, SumFunc((r, m) =>  r.ShiftStrategy)},
 			{ PTO_TECHNOLOGY, SumFunc((r, m) => r.PTO?.TransmissionType ?? "")},
@@ -715,5 +728,7 @@ namespace TUGraz.VectoCore.OutputData
 		public static readonly WriteAuxEntry AuxDataValue = (r, m, a) => m.AuxiliaryWork(a).ConvertToKiloWattHour();
 
 	}
+
+
 	
 }
\ No newline at end of file
-- 
GitLab