From be8fa5ff1ee27d611f6885dad14693b4ce59ef38 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 28 Feb 2020 09:30:13 +0100
Subject: [PATCH] throw exception if FWD vehicle is declared but no axlegear
 ratio is provided in gbx

---
 .../DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs      | 3 +++
 .../Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs      | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs
index 11ecb3ad5b..29073277e1 100644
--- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs
+++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs
@@ -523,6 +523,9 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
 
 		public AxleGearData CreateDummyAxleGearData(IGearboxDeclarationInputData gbxData)
 		{
+			if (double.IsNaN(gbxData.AxlegearRatio)) {
+				throw new VectoException("Axlegear ratio required in gearbox data for gearboxes with included axlegear");
+			}
 			return new AxleGearData() {
 				AxleGear = new TransmissionData() {
 					Ratio = gbxData.AxlegearRatio,
diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs
index bcd17322cf..b9cc76a1c2 100644
--- a/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs
+++ b/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs
@@ -81,7 +81,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl {
 													_segment.Missions.First().Loadings.First());
 			_airdragData = DataAdapter.CreateAirdragData(vehicle.Components.AirdragInputData,
 												_segment.Missions.First(), _segment);
-			if (InputDataProvider.JobInputData.Vehicle.Components.GearboxInputData.DifferentialIncluded) {
+			if (InputDataProvider.JobInputData.Vehicle.AxleConfiguration.AxlegearIncludedInGearbox()) {
 				_axlegearData = DataAdapter.CreateDummyAxleGearData(InputDataProvider.JobInputData.Vehicle.Components.GearboxInputData);
 			} else { 
 				_axlegearData = DataAdapter.CreateAxleGearData(InputDataProvider.JobInputData.Vehicle.Components.AxleGearInputData);
-- 
GitLab