From 6fffef208047dbb1d286f0fe5dae4e30e61fa122 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 3 Mar 2021 09:58:12 +0100
Subject: [PATCH] add workaround to read existing busaux files, fix reading aux
 power demand

---
 .../VectoCore/InputData/FileIO/JSON/BusAuxiliaryInputData.cs  | 4 +++-
 VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs    | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/BusAuxiliaryInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/BusAuxiliaryInputData.cs
index 4e8196bea1..b4f559513b 100644
--- a/VectoCore/VectoCore/InputData/FileIO/JSON/BusAuxiliaryInputData.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/JSON/BusAuxiliaryInputData.cs
@@ -94,7 +94,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
 
 
 			// SmartElectrical
-			electricalUserInputsConfig.AlternatorType = elData.GetEx<string>("SmartElectrical").ParseEnum<AlternatorType>();
+			electricalUserInputsConfig.AlternatorType = elData["SmartElectrical"] != null 
+				? (elData.GetEx<bool>("SmartElectrical") ? AlternatorType.Smart : AlternatorType.Conventional)
+				: elData.GetEx<string>("AlternatorType").ParseEnum<AlternatorType>();
 
 			// ResultCardIdle
 
diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs
index 0eecbdde6c..5970914ef4 100644
--- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs
@@ -546,8 +546,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
 			get { return new EngineeringAuxiliaryDataInputData() {
 				ElectricPowerDemand = Body["Padd_electric"] != null ? Body.GetEx<double>("Padd_electric").SI<Watt>() : 0.SI<Watt>(),
 				ConstantPowerDemand = Body["Padd"] != null ? Body.GetEx<double>("Padd").SI<Watt>() : 0.SI<Watt>(),
-				PowerDemandICEOffDriving = Body["P_aux_ICEOff_Driving"] != null ? Body.GetEx<double>("P_aux_ICEOff_Driving").SI<Watt>() : 0.SI<Watt>(),
-				PowerDemandICEOffStandstill = Body["P_aux_ICEOff_Standstill"] != null ? Body.GetEx<double>("P_aux_ICEOff_Standstill").SI<Watt>() : 0.SI<Watt>()
+				PowerDemandICEOffDriving = Body["Paux_ICEOff_Driving"] != null ? Body.GetEx<double>("Paux_ICEOff_Driving").SI<Watt>() : 0.SI<Watt>(),
+				PowerDemandICEOffStandstill = Body["Paux_ICEOff_Standstill"] != null ? Body.GetEx<double>("Paux_ICEOff_Standstill").SI<Watt>() : 0.SI<Watt>()
 			}; }
 		}
 
-- 
GitLab