diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs index b3a78863edc02b890562f07447399ccc58465954..d31536374c86c532f179ab069970064f7c6f4620 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Newtonsoft.Json.Linq; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; @@ -219,7 +220,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public ElectricMachineType ElectricMachineType { get; } - public Watt R85RatedPower => null; + public Watt R85RatedPower => !SavedInDeclarationMode ? null : Body.GetEx<double>("R85RatedPower").SI<Watt>(); public virtual KilogramSquareMeter Inertia => Body.GetEx<double>("Inertia").SI<KilogramSquareMeter>(); //public virtual Joule OverloadBuffer => Body.GetValueOrDefault<double>("ThermalOverloadBuffer")?.SI(Unit.SI.Mega.Joule).Cast<Joule>() ?? 1e18.SI<Joule>(); diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs index fa22ce9c5e3d2789ef29ae3b3f2c8a354b72f42d..d772d28ab91e466c186b99f62ec658b96fa61919 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs @@ -631,6 +631,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public virtual IList<ElectricMachineEntry<IElectricMotorEngineeringInputData>> Entries => _entries; + + } // ################################################################### diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index fa9df44b04f513ef6706ea59ca5748d1f4436b87..d8d4376f24ad9b1e207827f6680be2c3931da8ce 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -62,7 +62,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region Overrides of JSONVehicleDataV10_HEV_BEV public override TableData BoostingLimitations => null; - + + public override ArchitectureID ArchitectureID { get => VehicleType.GetArchitectureID(PowertrainPosition.IEPC); } + #endregion } @@ -120,27 +122,32 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON protected virtual JSONElectricMotors ReadMotors() { var retVal = new List<ElectricMachineEntry<IElectricMotorEngineeringInputData>>(); - foreach (var entry in Body["ElectricMotors"]) { - var tmp = new ElectricMachineEntry<IElectricMotorEngineeringInputData> { - Position = PowertrainPositionHelper.Parse(entry.GetEx<string>("Position")), - RatioADC = entry.GetEx<double>("Ratio"), - RatioPerGear = entry["RatioPerGear"] != null - ? entry["RatioPerGear"].Select(x => x.Value<double>()).ToArray() - : new double[] { }, - MechanicalTransmissionEfficiency = entry["MechanicalEfficiency"] != null - ? entry.GetEx<double>("MechanicalEfficiency") - : double.NaN, - MechanicalTransmissionLossMap = entry["MechanicalTransmissionLossMap"] != null - ? ReadTableData(Path.Combine(BasePath, entry.GetEx<string>("MechanicalTransmissionLossMap")), - "EM ADC LossMap") - : null, - Count = entry.GetEx<int>("Count"), - ElectricMachine = - JSONInputDataFactory.ReadElectricMotorData( - Path.Combine(BasePath, entry.GetEx<string>("MotorFile")), false) - }; - retVal.Add(tmp); + if (Body["ElectricMotors"] != null) { + foreach (var entry in Body["ElectricMotors"]) + { + var tmp = new ElectricMachineEntry<IElectricMotorEngineeringInputData> + { + Position = PowertrainPositionHelper.Parse(entry.GetEx<string>("Position")), + RatioADC = entry.GetEx<double>("Ratio"), + RatioPerGear = entry["RatioPerGear"] != null + ? entry["RatioPerGear"].Select(x => x.Value<double>()).ToArray() + : new double[] { }, + MechanicalTransmissionEfficiency = entry["MechanicalEfficiency"] != null + ? entry.GetEx<double>("MechanicalEfficiency") + : double.NaN, + MechanicalTransmissionLossMap = entry["MechanicalTransmissionLossMap"] != null + ? ReadTableData(Path.Combine(BasePath, entry.GetEx<string>("MechanicalTransmissionLossMap")), + "EM ADC LossMap") + : null, + Count = entry.GetEx<int>("Count"), + ElectricMachine = + JSONInputDataFactory.ReadElectricMotorData( + Path.Combine(BasePath, entry.GetEx<string>("MotorFile")), false) + }; + retVal.Add(tmp); + } } + return new JSONElectricMotors(retVal); }