diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index f704edb773ff567b4066696aecb160a93fe1c676..cd55cf98a9c245406ea3d1187e4616f1984d6164 100644 --- a/VectoCore/VectoCore/Configuration/Constants.cs +++ b/VectoCore/VectoCore/Configuration/Constants.cs @@ -254,6 +254,8 @@ namespace TUGraz.VectoCore.Configuration public const string HybridStrategyParameters = ".vhctl"; public const string Json = ".json"; + + public const string IEPCDataFile = ".viepc"; } public static class SimulationSettings diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index 6fd637d21c13dfa1ea909c0d20a1b793f11ff6f0..4eaf2ce553f9b7ee72688b724f366546da3f4183 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -69,7 +69,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON private IBatteryPackEngineeringInputData Battery; private IElectricMotorEngineeringInputData ElectricMotor; private IBusAuxiliariesEngineeringData BusAux; - + private IIEPCEngineeringInputData IEPCData; public JSONComponentInputData(string filename, IJSONVehicleComponents job, bool tolerateMissing = false) { @@ -101,6 +101,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON case ".vaux": tmp = JSONInputDataFactory.ReadEngineeringBusAuxiliaries(filename, tolerateMissing); break; + case Constants.FileExtensions.IEPCDataFile: + tmp = JSONInputDataFactory.ReadIEPCEngineeringInputData(filename, tolerateMissing); + break; } if(tmp is IVehicleEngineeringInputData x1) VehicleData = x1; @@ -119,6 +122,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if(tmp is IElectricMotorEngineeringInputData x14) ElectricMotor = x14; if(tmp is IHybridStrategyParameters x15) HybridStrategyParameters = x15; if(tmp is IBusAuxiliariesEngineeringData x16) BusAux = x16; + if (tmp is IIEPCEngineeringInputData x17) IEPCData = x17; _filename = filename; } @@ -217,7 +221,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON }); } } - public IIEPCDeclarationInputData IEPC => null; + public IIEPCDeclarationInputData IEPC => IEPCData; IElectricStorageSystemDeclarationInputData IVehicleComponentsDeclaration.ElectricStorage => new JSONElectricStorageSystemEngineeringInputData(new List<IElectricStorageEngineeringInputData>() { diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs new file mode 100644 index 0000000000000000000000000000000000000000..3403efc7a2a832ebb77faf837d01b4b48f0fdad4 --- /dev/null +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Impl; +using TUGraz.VectoCore.Configuration; + +namespace TUGraz.VectoCore.InputData.FileIO.JSON +{ + public class JSONIEPCData : JSONFile, IIEPCEngineeringInputData + { + private readonly JObject _header; + + public JSONIEPCData(JObject data, string filename, bool tolerateMissing = false) + : base(data, filename, tolerateMissing) + { + _header = (JObject)data.GetEx(JsonKeys.JsonHeader); + } + + #region Overrides of JSONFile + + public override string AppVersion => _header.GetEx<string>(JsonKeys.AppVersion); + + #endregion + + #region Implementation of IComponentInputData + + public string Manufacturer => Constants.NOT_AVAILABLE; + public string Model => Body.GetEx<string>(JsonKeys.Component_Model); + + public DateTime Date => DateTime.MinValue; + + public CertificationMethod CertificationMethod => CertificationMethod.NotCertified; + public string CertificationNumber => Constants.NOT_AVAILABLE; + public DigestData DigestValue => null; + + #endregion + + #region Implementation of IIEPCDeclarationInputData + + public ElectricMachineType ElectricMachineType { get; } + public Watt R85RatedPower => null; + public KilogramSquareMeter Inertia => Body.GetEx<double>(JsonKeys.IEPC_Inertia).SI<KilogramSquareMeter>(); + public bool DifferentialIncluded => Body.GetEx<bool>(JsonKeys.IEPC_DifferentialIncluded); + public bool DesignTypeWheelMotor => Body.GetEx<bool>(JsonKeys.IEPC_DesignTypeWheelMotor); + public int? NrOfDesignTypeWheelMotorMeasured => Body.GetEx<int?>(JsonKeys.IEPC_NrOfDesignTypeWheelMotorMeasured); + public IList<IGearEntry> Gears => ReadGearEntries(Body[JsonKeys.Gearbox_Gears ]); + public IList<IElectricMotorVoltageLevel> VoltageLevels => ReadVoltageLevel(Body[JsonKeys.IEPC_VoltageLevels]); + public IList<IDragCurve> DragCurves => ReadDragCurve(Body[JsonKeys.IEPC_DragCurves]); + public TableData Conditioning => null; + + #endregion + + #region Implementation of IIEPCEngineeringInputData + + public double OverloadRecoveryFactor => Body.GetEx<double>(JsonKeys.IEPC_ThermalOverloadRecoveryFactor); + + #endregion + + + protected virtual IList<IGearEntry> ReadGearEntries(JToken gears) + { + var gearData = new List<IGearEntry>(); + var gearNumber = 1; + foreach (var gear in gears) { + gearData.Add(new GearEntry { + GearNumber = gearNumber, + Ratio = gear.GetEx<double>(JsonKeys.Gearbox_Gear_Ratio), + MaxOutputShaftTorque = gear.GetEx<double>(JsonKeys.Gearbox_Gear_MaxOutShaftTorque).SI<NewtonMeter>(), + MaxOutputShaftSpeed = gear.GetEx<double>(JsonKeys.Gearbox_Gear_MaxOutShaftSpeed).SI<PerSecond>() + }); + + gearNumber++; + } + return gearData; + } + + protected virtual IList<IElectricMotorVoltageLevel> ReadVoltageLevel(JToken voltageLevels) + { + var voltageLevelData = new List<IElectricMotorVoltageLevel>(); + foreach (var voltageLevel in voltageLevels) { + voltageLevelData.Add(new ElectricMotorVoltageLevel { + + VoltageLevel = voltageLevel.GetEx<double>(JsonKeys.IEPC_Voltage).SI<Volt>(), + ContinuousTorque = voltageLevel.GetEx<double>(JsonKeys.IEPC_ContinuousTorque).SI<NewtonMeter>(), + ContinuousTorqueSpeed = voltageLevel.GetEx<double>(JsonKeys.IEPC_ContinuousTorqueSpeed).RPMtoRad(), + OverloadTorque = voltageLevel.GetEx<double>(JsonKeys.IEPC_OverloadTorque).SI<NewtonMeter>(), + OverloadTestSpeed = voltageLevel.GetEx<double>(JsonKeys.IEPC_OverloadTorqueSpeed).RPMtoRad(), + OverloadTime = voltageLevel.GetValueOrDefault<double>(JsonKeys.IEPC_OverloadTime)?.SI<Second>() ?? 0.SI<Second>(), + FullLoadCurve = ReadTableData(voltageLevel.GetEx<string>(JsonKeys.IEPC_FullLoadCurve), "ElectricMotor FullLoadCurve"), + PowerMap = ReadPowerMap(voltageLevel[JsonKeys.IEPC_PowerMaps]) + }); + } + + return voltageLevelData; + } + + protected virtual IList<IElectricMotorPowerMap> ReadPowerMap(JToken powerMapEntry) + { + var powerMaps = new List<IElectricMotorPowerMap>(); + + foreach (var powerMap in powerMapEntry) { + var key = ((JProperty)powerMap).Name; + var value = ((JProperty)powerMap).Value.Value<string>(); + + powerMaps.Add(new JSONElectricMotorPowerMap { + Gear = Convert.ToInt32(key), + PowerMap = ReadTableData(value, "ElectricMotor Power Map") + }); + } + + return powerMaps; + } + + protected virtual IList<IDragCurve> ReadDragCurve(JToken dragCurveEntry) + { + var dragCurves = new List<IDragCurve>(); + + foreach (var dragCurve in dragCurveEntry) { + + var key = ((JProperty)dragCurve).Name; + var value = ((JProperty)dragCurve).Value.Value<string>(); + + dragCurves.Add(new DragCurveEntry { + Gear = Convert.ToInt32(key), + DragCurve = ReadTableData(value, "ElectricMotor Drag Curve") + }); + } + + return dragCurves; + } + } + + public class GearEntry : IGearEntry + { + #region Implementation of IGearEntry + + public int GearNumber { get; internal set; } + public double Ratio { get; internal set; } + public NewtonMeter MaxOutputShaftTorque { get; internal set; } + public PerSecond MaxOutputShaftSpeed { get; internal set; } + + #endregion + } + + public class DragCurveEntry : IDragCurve + { + #region Implementation of IDragCurve + + public int? Gear { get; internal set; } + public TableData DragCurve { get; internal set; } + + #endregion + } +} diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs index ee7398b57abf412bcfeeb3f1c0b1b05d693b87a0..95ce556f48230b0f939f8ad6f845ea039a80da9d 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs @@ -239,5 +239,18 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON throw new VectoException("Engineering BusAuxiliaries: Unsupported FileVersion. Got {0}", version); } } + + public static IIEPCEngineeringInputData ReadIEPCEngineeringInputData(string filename, + bool tolerateMissing = false) + { + var json = ReadFile(filename); + var version = ReadVersion(json); + switch (version) { + case 1: + return new JSONIEPCData(json, filename, tolerateMissing); + default: + throw new VectoException("Engineering IEPC: Unsupported FileVersion. Got {0}", version); + } + } } } diff --git a/VectoCore/VectoCore/JsonKeys.Designer.cs b/VectoCore/VectoCore/JsonKeys.Designer.cs index 6e6af76ed1e2ccfdbc8a9af7216d10b68c011ee3..66b4f77c11f151fee5be0f89bbdb00a856e4e5dc 100644 --- a/VectoCore/VectoCore/JsonKeys.Designer.cs +++ b/VectoCore/VectoCore/JsonKeys.Designer.cs @@ -60,6 +60,15 @@ namespace TUGraz.VectoCore { } } + /// <summary> + /// Looks up a localized string similar to AppVersion. + /// </summary> + internal static string AppVersion { + get { + return ResourceManager.GetString("AppVersion", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to Completed. /// </summary> @@ -69,6 +78,15 @@ namespace TUGraz.VectoCore { } } + /// <summary> + /// Looks up a localized string similar to Model. + /// </summary> + internal static string Component_Model { + get { + return ResourceManager.GetString("Component_Model", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to VACC. /// </summary> @@ -321,6 +339,24 @@ namespace TUGraz.VectoCore { } } + /// <summary> + /// Looks up a localized string similar to MaxOutShaftSpeed. + /// </summary> + internal static string Gearbox_Gear_MaxOutShaftSpeed { + get { + return ResourceManager.GetString("Gearbox_Gear_MaxOutShaftSpeed", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to MaxOutShaftTorque. + /// </summary> + internal static string Gearbox_Gear_MaxOutShaftTorque { + get { + return ResourceManager.GetString("Gearbox_Gear_MaxOutShaftTorque", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to Ratio. /// </summary> @@ -492,6 +528,141 @@ namespace TUGraz.VectoCore { } } + /// <summary> + /// Looks up a localized string similar to ContinuousTorque. + /// </summary> + internal static string IEPC_ContinuousTorque { + get { + return ResourceManager.GetString("IEPC_ContinuousTorque", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to ContinuousTorqueSpeed. + /// </summary> + internal static string IEPC_ContinuousTorqueSpeed { + get { + return ResourceManager.GetString("IEPC_ContinuousTorqueSpeed", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to DesignTypeWheelMotor. + /// </summary> + internal static string IEPC_DesignTypeWheelMotor { + get { + return ResourceManager.GetString("IEPC_DesignTypeWheelMotor", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to DifferentialIncluded. + /// </summary> + internal static string IEPC_DifferentialIncluded { + get { + return ResourceManager.GetString("IEPC_DifferentialIncluded", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to DragCurves. + /// </summary> + internal static string IEPC_DragCurves { + get { + return ResourceManager.GetString("IEPC_DragCurves", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to FullLoadCurve. + /// </summary> + internal static string IEPC_FullLoadCurve { + get { + return ResourceManager.GetString("IEPC_FullLoadCurve", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Inertia. + /// </summary> + internal static string IEPC_Inertia { + get { + return ResourceManager.GetString("IEPC_Inertia", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to NrOfDesignTypeWheelMotorMeasured. + /// </summary> + internal static string IEPC_NrOfDesignTypeWheelMotorMeasured { + get { + return ResourceManager.GetString("IEPC_NrOfDesignTypeWheelMotorMeasured", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to OverloadTime. + /// </summary> + internal static string IEPC_OverloadTime { + get { + return ResourceManager.GetString("IEPC_OverloadTime", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to OverloadTorque. + /// </summary> + internal static string IEPC_OverloadTorque { + get { + return ResourceManager.GetString("IEPC_OverloadTorque", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to OverloadTorqueSpeed. + /// </summary> + internal static string IEPC_OverloadTorqueSpeed { + get { + return ResourceManager.GetString("IEPC_OverloadTorqueSpeed", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to PowerMaps. + /// </summary> + internal static string IEPC_PowerMaps { + get { + return ResourceManager.GetString("IEPC_PowerMaps", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to ThermalOverloadRecoveryFactor. + /// </summary> + internal static string IEPC_ThermalOverloadRecoveryFactor { + get { + return ResourceManager.GetString("IEPC_ThermalOverloadRecoveryFactor", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Voltage. + /// </summary> + internal static string IEPC_Voltage { + get { + return ResourceManager.GetString("IEPC_Voltage", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to VoltageLevels. + /// </summary> + internal static string IEPC_VoltageLevels { + get { + return ResourceManager.GetString("IEPC_VoltageLevels", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to InterimStep. /// </summary> diff --git a/VectoCore/VectoCore/JsonKeys.resx b/VectoCore/VectoCore/JsonKeys.resx index bb4fdb88ba958319e22aff7b7e272c21af4177b6..d4411838a879b5d270f2375d1be41e0c8408139d 100644 --- a/VectoCore/VectoCore/JsonKeys.resx +++ b/VectoCore/VectoCore/JsonKeys.resx @@ -375,9 +375,9 @@ <data name="Vehicle_PTO_CycleDriving" xml:space="preserve"> <value>CycleDriving</value> </data> - <data name="HEV_Vehicle_MaxDrivetrainPower" xml:space="preserve"> - <value>MaxDrivetrainPower</value> - </data> + <data name="HEV_Vehicle_MaxDrivetrainPower" xml:space="preserve"> + <value>MaxDrivetrainPower</value> + </data> <data name="PrimaryVehicle" xml:space="preserve"> <value>PrimaryVehicle</value> </data> @@ -387,4 +387,61 @@ <data name="Completed" xml:space="preserve"> <value>Completed</value> </data> + <data name="AppVersion" xml:space="preserve"> + <value>AppVersion</value> + </data> + <data name="Component_Model" xml:space="preserve"> + <value>Model</value> + </data> + <data name="Gearbox_Gear_MaxOutShaftSpeed" xml:space="preserve"> + <value>MaxOutShaftSpeed</value> + </data> + <data name="Gearbox_Gear_MaxOutShaftTorque" xml:space="preserve"> + <value>MaxOutShaftTorque</value> + </data> + <data name="IEPC_ContinuousTorque" xml:space="preserve"> + <value>ContinuousTorque</value> + </data> + <data name="IEPC_ContinuousTorqueSpeed" xml:space="preserve"> + <value>ContinuousTorqueSpeed</value> + </data> + <data name="IEPC_DesignTypeWheelMotor" xml:space="preserve"> + <value>DesignTypeWheelMotor</value> + </data> + <data name="IEPC_DifferentialIncluded" xml:space="preserve"> + <value>DifferentialIncluded</value> + </data> + <data name="IEPC_DragCurves" xml:space="preserve"> + <value>DragCurves</value> + </data> + <data name="IEPC_FullLoadCurve" xml:space="preserve"> + <value>FullLoadCurve</value> + </data> + <data name="IEPC_Inertia" xml:space="preserve"> + <value>Inertia</value> + </data> + <data name="IEPC_NrOfDesignTypeWheelMotorMeasured" xml:space="preserve"> + <value>NrOfDesignTypeWheelMotorMeasured</value> + </data> + <data name="IEPC_OverloadTime" xml:space="preserve"> + <value>OverloadTime</value> + </data> + <data name="IEPC_OverloadTorque" xml:space="preserve"> + <value>OverloadTorque</value> + </data> + <data name="IEPC_OverloadTorqueSpeed" xml:space="preserve"> + <value>OverloadTorqueSpeed</value> + </data> + <data name="IEPC_PowerMaps" xml:space="preserve"> + <value>PowerMaps</value> + </data> + <data name="IEPC_ThermalOverloadRecoveryFactor" xml:space="preserve"> + <value>ThermalOverloadRecoveryFactor</value> + </data> + <data name="IEPC_Voltage" xml:space="preserve"> + <value>Voltage</value> + </data> + <data name="IEPC_VoltageLevels" xml:space="preserve"> + <value>VoltageLevels</value> + </data> </root> \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/FileIO/JsonReadTest.cs b/VectoCore/VectoCoreTest/FileIO/JsonReadTest.cs index 254f26e1a44cae413eeeffe9f1b0ab56c13f5430..961d558002a4affa912700e40c3766feb61aa804 100644 --- a/VectoCore/VectoCoreTest/FileIO/JsonReadTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/JsonReadTest.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -505,6 +506,110 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(true, busAux.HVACAux.AdjustableCoolantThermostat); Assert.AreEqual(true, busAux.HVACAux.EngineWasteGasHeatExchanger); } + + [TestCase()] + public void JSON_Read_IEPC() + { + var inputProvider = new JSONComponentInputData(@"TestData\BatteryElectric\IEPC\GenericIEPC.viepc", null); + var iepcData = (IIEPCEngineeringInputData)inputProvider.IEPC; + + Assert.AreEqual("3", iepcData.AppVersion); + Assert.AreEqual(DateTime.MinValue, iepcData.Date); + + Assert.AreEqual(false, iepcData.SavedInDeclarationMode); + Assert.AreEqual("Generic IEPC", iepcData.Model); + Assert.AreEqual(0.15.SI<KilogramSquareMeter>(), iepcData.Inertia); + Assert.AreEqual(false, iepcData.DifferentialIncluded); + Assert.AreEqual(false, iepcData.DesignTypeWheelMotor); + Assert.AreEqual(1, iepcData.NrOfDesignTypeWheelMotorMeasured); + Assert.AreEqual(0.9, iepcData.OverloadRecoveryFactor); + + TestIEPCGears(iepcData.Gears); + TestIEPCVoltageLevel(iepcData.VoltageLevels); + TestDragCurve(iepcData.DragCurves); + } + + private void TestDragCurve(IList<IDragCurve> dragCurvesData) + { + Assert.AreEqual(3, dragCurvesData.Count); + + var dragCurve = dragCurvesData[0]; + Assert.AreEqual(1, dragCurve.Gear); + Assert.IsNotNull(dragCurve.DragCurve); + + dragCurve = dragCurvesData[1]; + Assert.AreEqual(2, dragCurve.Gear); + Assert.IsNotNull(dragCurve.DragCurve); + + dragCurve = dragCurvesData[2]; + Assert.AreEqual(3, dragCurve.Gear); + Assert.IsNotNull(dragCurve.DragCurve); + } + + private void TestIEPCGears(IList<IGearEntry> gears) + { + Assert.AreEqual(3, gears.Count); + + var gear = gears[0]; + Assert.AreEqual(1, gear.GearNumber); + Assert.AreEqual(3.2, gear.Ratio); + Assert.AreEqual(10000.SI<NewtonMeter>(), gear.MaxOutputShaftTorque); + Assert.AreEqual(5000.SI<PerSecond>(), gear.MaxOutputShaftSpeed); + + gear = gears[1]; + Assert.AreEqual(2, gear.GearNumber); + Assert.AreEqual(1.6, gear.Ratio); + Assert.AreEqual(10000.SI<NewtonMeter>(), gear.MaxOutputShaftTorque); + Assert.AreEqual(5000.SI<PerSecond>(), gear.MaxOutputShaftSpeed); + + gear = gears[2]; + Assert.AreEqual(3, gear.GearNumber); + Assert.AreEqual(1.6, gear.Ratio); + Assert.AreEqual(10000.SI<NewtonMeter>(), gear.MaxOutputShaftTorque); + Assert.AreEqual(5000.SI<PerSecond>(), gear.MaxOutputShaftSpeed); + } + + private void TestIEPCVoltageLevel(IList<IElectricMotorVoltageLevel> voltageLevels) + { + Assert.AreEqual(2, voltageLevels.Count); + + var voltageLevel = voltageLevels[0]; + Assert.AreEqual(400.SI<Volt>(), voltageLevel.VoltageLevel); + Assert.AreEqual(200.SI<NewtonMeter>(), voltageLevel.ContinuousTorque); + Assert.AreEqual(2000.RPMtoRad(), voltageLevel.ContinuousTorqueSpeed); + Assert.AreEqual(500.SI<NewtonMeter>(), voltageLevel.OverloadTorque); + Assert.AreEqual(2000.RPMtoRad(), voltageLevel.OverloadTestSpeed); + Assert.AreEqual(60.SI<Second>(), voltageLevel.OverloadTime); + Assert.IsNotNull(voltageLevel.FullLoadCurve); + TestPowerMap(voltageLevel.PowerMap); + + voltageLevel = voltageLevels[1]; + Assert.AreEqual(800.SI<Volt>(), voltageLevel.VoltageLevel); + Assert.AreEqual(200.SI<NewtonMeter>(), voltageLevel.ContinuousTorque); + Assert.AreEqual(2000.RPMtoRad(), voltageLevel.ContinuousTorqueSpeed); + Assert.AreEqual(500.SI<NewtonMeter>(), voltageLevel.OverloadTorque); + Assert.AreEqual(2000.RPMtoRad(), voltageLevel.OverloadTestSpeed); + Assert.AreEqual(60.SI<Second>(), voltageLevel.OverloadTime); + Assert.IsNotNull(voltageLevel.FullLoadCurve); + TestPowerMap(voltageLevel.PowerMap); + } + + private void TestPowerMap(IList<IElectricMotorPowerMap> powerMapData) + { + Assert.AreEqual(3, powerMapData.Count); + + var powerMap = powerMapData[0]; + Assert.AreEqual(1, powerMap.Gear); + Assert.IsNotNull(powerMap.PowerMap); + + powerMap = powerMapData[1]; + Assert.AreEqual(2, powerMap.Gear); + Assert.IsNotNull(powerMap.PowerMap); + + powerMap = powerMapData[2]; + Assert.AreEqual(3, powerMap.Gear); + Assert.IsNotNull(powerMap.PowerMap); + } } public class MockDriverTestInputData : IDriverEngineeringInputData { diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericDrag.viepcd b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericDrag.viepcd new file mode 100644 index 0000000000000000000000000000000000000000..314a3b4215bb1aa40d2cff6c8ce1d423f740eeff --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericDrag.viepcd @@ -0,0 +1,11 @@ +n [rpm] , T_drag [Nm] +0, -1.89 +37, -2.01 +370, -3.02 +740, -4.14 +1110, -5.26 +1480, -6.38 +1850, -7.5 +2220, -8.62 +2590, -9.74 + diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericFld.viepcp b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericFld.viepcp new file mode 100644 index 0000000000000000000000000000000000000000..d7a681028a9a2a69ef89f14bd1b89e4ae5792efc --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericFld.viepcp @@ -0,0 +1,13 @@ +n [rpm] , T_drive [Nm] , T_drag [Nm] +0, 1030.00, -1030.00 +37, 1030.00, -1030.00 +370, 1030.00, -1030.00 +740, 1030.00, -1030.00 +1110, 1030.00, -1030.00 +1480, 1030.00, -1030.00 +1850, 1030.00, -1030.00 +2220, 858.33, -858.33 +2590, 735.71, -735.71 + + + diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/IEPC/GenericIEPC.viepc b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericIEPC.viepc similarity index 58% rename from VectoCore/VectoCoreTest/TestData/Hybrids/IEPC/GenericIEPC.viepc rename to VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericIEPC.viepc index 1564766f2cb4e71cf70b6a0e1110f4dc7ffc682d..78bd0500f2b6f975998f79b7e7ba894ef7265ca5 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/IEPC/GenericIEPC.viepc +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericIEPC.viepc @@ -12,59 +12,58 @@ "DifferentialIncluded": false, "DesignTypeWheelMotor": false, "NrOfDesignTypeWheelMotorMeasured": 1, - "ThermalOverloadRecoveryFactor": 0.9 + "ThermalOverloadRecoveryFactor": 0.9, "Gears": [ - { + { "Ratio": 3.2, "MaxOutShaftTorque": 10000, "MaxOutShaftSpeed": 5000 - }, - { + }, + { "Ratio": 1.6, "MaxOutShaftTorque": 10000, "MaxOutShaftSpeed": 5000 - } - { + }, + { "Ratio": 1.6, "MaxOutShaftTorque": 10000, "MaxOutShaftSpeed": 5000 - } - ] - "VoltageLevels" [ - { + } + ], + "VoltageLevels": [ + { "Voltage": 400, "ContinuousTorque": 200, - "ContinuoursTorqueSpeed": 2000 + "ContinuousTorqueSpeed": 2000, "OverloadTorque": 500, "OverloadTorqueSpeed": 2000, "OverloadTime": 60, - "FullLoadCurve": "GenericIEPC.viepcp" + "FullLoadCurve": "GenericFld.viepcp", "PowerMaps": { - "1": "PowerMap1.viepco", - "2": "PowerMap1.viepco", - "3": "PowerMap1.viepco", + "1": "GenericPowerMap.viepco", + "2": "GenericPowerMap.viepco", + "3": "GenericPowerMap.viepco" } - }, - { + }, + { "Voltage": 800, "ContinuousTorque": 200, - "ContinuoursTorqueSpeed": 2000 + "ContinuousTorqueSpeed": 2000, "OverloadTorque": 500, "OverloadTorqueSpeed": 2000, "OverloadTime": 60, - "FullLoadCurve": "GenericIEPC.viepcp" + "FullLoadCurve": "GenericFld.viepcp", "PowerMaps": { - "1": "PowerMap1.viepco", - "2": "PowerMap1.viepco", - "3": "PowerMap1.viepco", + "1": "GenericPowerMap.viepco", + "2": "GenericPowerMap.viepco", + "3": "GenericPowerMap.viepco" } - } - ] - - "DragCurves": { - "1": "GenericDrag.viepcd", - "2": "GenericDrag.viepcd", - "3": "GenericDrag.viepcd", - }, + } + ], + "DragCurves": { + "1": "GenericDrag.viepcd", + "2": "GenericDrag.viepcd", + "3": "GenericDrag.viepcd" + } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericPowerMap.viepco b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericPowerMap.viepco new file mode 100644 index 0000000000000000000000000000000000000000..2cc4c716211c5f1847b8dd7e5a7ec77f5ee757d3 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/IEPC/GenericPowerMap.viepco @@ -0,0 +1,379 @@ +n [rpm] , T [Nm] , P_el [kW] +0.00,-1030.00,0.000 +0.00,-978.50,0.000 +0.00,-927.00,0.000 +0.00,-875.50,0.000 +0.00,-824.00,0.000 +0.00,-772.50,0.000 +0.00,-721.00,-0.220 +0.00,-669.50,-0.510 +0.00,-618.00,-0.671 +0.00,-566.50,-0.765 +0.00,-515.00,-0.813 +0.00,-463.50,-0.826 +0.00,-412.00,-0.811 +0.00,-360.50,-0.771 +0.00,-309.00,-0.710 +0.00,-257.50,-0.629 +0.00,-206.00,-0.531 +0.00,-154.50,-0.416 +0.00,-103.00,-0.287 +0.00,-51.50,-0.143 +0.00,-10.30,-0.015 +0.00,10.30,0.059 +0.00,51.50,0.264 +0.00,103.00,0.527 +0.00,154.50,0.800 +0.00,206.00,1.080 +0.00,257.50,1.370 +0.00,309.00,1.667 +0.00,360.50,1.972 +0.00,412.00,2.285 +0.00,463.50,2.606 +0.00,515.00,2.935 +0.00,566.50,3.270 +0.00,618.00,3.613 +0.00,669.50,3.964 +0.00,721.00,4.321 +0.00,772.50,4.685 +0.00,824.00,5.056 +0.00,875.50,5.433 +0.00,927.00,5.818 +0.00,978.50,6.209 +0.00,1030.00,6.606 +37.00,-1030.00,0.000 +37.00,-978.50,0.000 +37.00,-927.00,0.000 +37.00,-875.50,0.000 +37.00,-824.00,0.000 +37.00,-772.50,0.000 +37.00,-721.00,-0.447 +37.00,-669.50,-0.678 +37.00,-618.00,-0.798 +37.00,-566.50,-0.860 +37.00,-515.00,-0.883 +37.00,-463.50,-0.876 +37.00,-412.00,-0.845 +37.00,-360.50,-0.792 +37.00,-309.00,-0.721 +37.00,-257.50,-0.633 +37.00,-206.00,-0.530 +37.00,-154.50,-0.413 +37.00,-103.00,-0.283 +37.00,-51.50,-0.141 +37.00,-10.30,-0.015 +37.00,10.30,0.055 +37.00,51.50,0.248 +37.00,103.00,0.495 +37.00,154.50,0.749 +37.00,206.00,1.011 +37.00,257.50,1.280 +37.00,309.00,1.556 +37.00,360.50,1.840 +37.00,412.00,2.129 +37.00,463.50,2.426 +37.00,515.00,2.729 +37.00,566.50,3.039 +37.00,618.00,3.355 +37.00,669.50,3.677 +37.00,721.00,4.005 +37.00,772.50,4.340 +37.00,824.00,4.680 +37.00,875.50,5.026 +37.00,927.00,5.378 +37.00,978.50,5.735 +37.00,1030.00,6.098 +370.00,-1030.00,-36.344 +370.00,-978.50,-34.617 +370.00,-927.00,-32.881 +370.00,-875.50,-31.134 +370.00,-824.00,-29.376 +370.00,-772.50,-27.609 +370.00,-721.00,-25.831 +370.00,-669.50,-24.043 +370.00,-618.00,-22.244 +370.00,-566.50,-20.436 +370.00,-515.00,-18.617 +370.00,-463.50,-16.789 +370.00,-412.00,-14.950 +370.00,-360.50,-13.102 +370.00,-309.00,-11.244 +370.00,-257.50,-9.375 +370.00,-206.00,-7.497 +370.00,-154.50,-5.609 +370.00,-103.00,-3.711 +370.00,-51.50,-1.802 +370.00,-10.30,-0.248 +370.00,10.30,0.515 +370.00,51.50,2.185 +370.00,103.00,4.271 +370.00,154.50,6.366 +370.00,206.00,8.470 +370.00,257.50,10.584 +370.00,309.00,12.707 +370.00,360.50,14.839 +370.00,412.00,16.982 +370.00,463.50,19.133 +370.00,515.00,21.294 +370.00,566.50,23.465 +370.00,618.00,25.644 +370.00,669.50,27.833 +370.00,721.00,30.032 +370.00,772.50,32.239 +370.00,824.00,34.456 +370.00,875.50,36.682 +370.00,927.00,38.918 +370.00,978.50,41.162 +370.00,1030.00,43.415 +740.00,-1030.00,-74.961 +740.00,-978.50,-71.312 +740.00,-927.00,-67.651 +740.00,-875.50,-63.979 +740.00,-824.00,-60.294 +740.00,-772.50,-56.597 +740.00,-721.00,-52.889 +740.00,-669.50,-49.169 +740.00,-618.00,-45.436 +740.00,-566.50,-41.693 +740.00,-515.00,-37.937 +740.00,-463.50,-34.170 +740.00,-412.00,-30.391 +740.00,-360.50,-26.600 +740.00,-309.00,-22.798 +740.00,-257.50,-18.984 +740.00,-206.00,-15.158 +740.00,-154.50,-11.321 +740.00,-103.00,-7.471 +740.00,-51.50,-3.607 +740.00,-10.30,-0.452 +740.00,10.30,1.051 +740.00,51.50,4.367 +740.00,103.00,8.495 +740.00,154.50,12.632 +740.00,206.00,16.780 +740.00,257.50,20.940 +740.00,309.00,25.111 +740.00,360.50,29.294 +740.00,412.00,33.488 +740.00,463.50,37.693 +740.00,515.00,41.910 +740.00,566.50,46.139 +740.00,618.00,50.379 +740.00,669.50,54.630 +740.00,721.00,58.893 +740.00,772.50,63.167 +740.00,824.00,67.452 +740.00,875.50,71.749 +740.00,927.00,76.057 +740.00,978.50,80.377 +740.00,1030.00,84.707 +1110.00,-1030.00,-113.264 +1110.00,-978.50,-107.719 +1110.00,-927.00,-102.159 +1110.00,-875.50,-96.584 +1110.00,-824.00,-90.994 +1110.00,-772.50,-85.390 +1110.00,-721.00,-79.770 +1110.00,-669.50,-74.136 +1110.00,-618.00,-68.486 +1110.00,-566.50,-62.822 +1110.00,-515.00,-57.144 +1110.00,-463.50,-51.450 +1110.00,-412.00,-45.742 +1110.00,-360.50,-40.018 +1110.00,-309.00,-34.281 +1110.00,-257.50,-28.528 +1110.00,-206.00,-22.760 +1110.00,-154.50,-16.978 +1110.00,-103.00,-11.179 +1110.00,-51.50,-5.359 +1110.00,-10.30,-0.563 +1110.00,10.30,1.626 +1110.00,51.50,6.595 +1110.00,103.00,12.768 +1110.00,154.50,18.951 +1110.00,206.00,25.148 +1110.00,257.50,31.359 +1110.00,309.00,37.584 +1110.00,360.50,43.824 +1110.00,412.00,50.078 +1110.00,463.50,56.347 +1110.00,515.00,62.631 +1110.00,566.50,68.929 +1110.00,618.00,75.242 +1110.00,669.50,81.569 +1110.00,721.00,87.911 +1110.00,772.50,94.268 +1110.00,824.00,100.638 +1110.00,875.50,107.024 +1110.00,927.00,113.423 +1110.00,978.50,119.838 +1110.00,1030.00,126.266 +1480.00,-1030.00,-151.257 +1480.00,-978.50,-143.841 +1480.00,-927.00,-136.405 +1480.00,-875.50,-128.950 +1480.00,-824.00,-121.475 +1480.00,-772.50,-113.982 +1480.00,-721.00,-106.469 +1480.00,-669.50,-98.937 +1480.00,-618.00,-91.386 +1480.00,-566.50,-83.815 +1480.00,-515.00,-76.226 +1480.00,-463.50,-68.618 +1480.00,-412.00,-60.990 +1480.00,-360.50,-53.344 +1480.00,-309.00,-45.678 +1480.00,-257.50,-37.993 +1480.00,-206.00,-30.289 +1480.00,-154.50,-22.565 +1480.00,-103.00,-14.819 +1480.00,-51.50,-7.042 +1480.00,-10.30,-0.493 +1480.00,10.30,2.246 +1480.00,51.50,8.883 +1480.00,103.00,17.106 +1480.00,154.50,25.338 +1480.00,206.00,33.588 +1480.00,257.50,41.855 +1480.00,309.00,50.141 +1480.00,360.50,58.446 +1480.00,412.00,66.770 +1480.00,463.50,75.112 +1480.00,515.00,83.474 +1480.00,566.50,91.854 +1480.00,618.00,100.253 +1480.00,669.50,108.671 +1480.00,721.00,117.108 +1480.00,772.50,125.563 +1480.00,824.00,134.038 +1480.00,875.50,142.531 +1480.00,927.00,151.043 +1480.00,978.50,159.573 +1480.00,1030.00,168.122 +1850.00,-1030.00,-188.930 +1850.00,-978.50,-179.665 +1850.00,-927.00,-170.376 +1850.00,-875.50,-161.062 +1850.00,-824.00,-151.723 +1850.00,-772.50,-142.360 +1850.00,-721.00,-132.971 +1850.00,-669.50,-123.558 +1850.00,-618.00,-114.120 +1850.00,-566.50,-104.657 +1850.00,-515.00,-95.170 +1850.00,-463.50,-85.659 +1850.00,-412.00,-76.122 +1850.00,-360.50,-66.561 +1850.00,-309.00,-56.976 +1850.00,-257.50,-47.365 +1850.00,-206.00,-37.729 +1850.00,-154.50,-28.067 +1850.00,-103.00,-18.376 +1850.00,-51.50,-8.638 +1850.00,-10.30,0.000 +1850.00,10.30,2.921 +1850.00,51.50,11.243 +1850.00,103.00,21.520 +1850.00,154.50,31.807 +1850.00,206.00,42.113 +1850.00,257.50,52.443 +1850.00,309.00,62.797 +1850.00,360.50,73.174 +1850.00,412.00,83.576 +1850.00,463.50,94.003 +1850.00,515.00,104.453 +1850.00,566.50,114.928 +1850.00,618.00,125.427 +1850.00,669.50,135.950 +1850.00,721.00,146.498 +1850.00,772.50,157.070 +1850.00,824.00,167.666 +1850.00,875.50,178.286 +1850.00,927.00,188.931 +1850.00,978.50,199.599 +1850.00,1030.00,210.291 +2220.00,-1030.00,-226.266 +2220.00,-978.50,-215.178 +2220.00,-927.00,-204.058 +2220.00,-875.50,-192.907 +2220.00,-824.00,-181.723 +2220.00,-772.50,-170.509 +2220.00,-721.00,-159.262 +2220.00,-669.50,-147.984 +2220.00,-618.00,-136.675 +2220.00,-566.50,-125.334 +2220.00,-515.00,-113.962 +2220.00,-463.50,-102.558 +2220.00,-412.00,-91.123 +2220.00,-360.50,-79.656 +2220.00,-309.00,-68.158 +2220.00,-257.50,-56.628 +2220.00,-206.00,-45.066 +2220.00,-154.50,-33.469 +2220.00,-103.00,-21.833 +2220.00,-51.50,-10.128 +2220.00,-10.30,0.000 +2220.00,10.30,3.656 +2220.00,51.50,13.687 +2220.00,103.00,26.025 +2220.00,154.50,38.369 +2220.00,206.00,50.739 +2220.00,257.50,63.137 +2220.00,309.00,75.565 +2220.00,360.50,88.023 +2220.00,412.00,100.512 +2220.00,463.50,113.032 +2220.00,515.00,125.583 +2220.00,566.50,138.165 +2220.00,618.00,150.778 +2220.00,669.50,163.421 +2220.00,721.00,176.096 +2220.00,772.50,188.801 +2220.00,824.00,201.537 +2220.00,875.50,214.304 +2220.00,927.00,227.101 +2220.00,978.50,239.929 +2220.00,1030.00,252.787 +2590.00,-1030.00,-263.249 +2590.00,-978.50,-250.362 +2590.00,-927.00,-237.434 +2590.00,-875.50,-224.467 +2590.00,-824.00,-211.460 +2590.00,-772.50,-198.413 +2590.00,-721.00,-185.327 +2590.00,-669.50,-172.200 +2590.00,-618.00,-159.035 +2590.00,-566.50,-145.830 +2590.00,-515.00,-132.585 +2590.00,-463.50,-119.301 +2590.00,-412.00,-105.977 +2590.00,-360.50,-92.614 +2590.00,-309.00,-79.211 +2590.00,-257.50,-65.768 +2590.00,-206.00,-52.283 +2590.00,-154.50,-38.755 +2590.00,-103.00,-25.173 +2590.00,-51.50,-11.490 +2590.00,-10.30,0.000 +2590.00,10.30,4.457 +2590.00,51.50,16.224 +2590.00,103.00,30.631 +2590.00,154.50,45.039 +2590.00,206.00,59.477 +2590.00,257.50,73.949 +2590.00,309.00,88.458 +2590.00,360.50,103.005 +2590.00,412.00,117.591 +2590.00,463.50,132.215 +2590.00,515.00,146.877 +2590.00,566.50,161.579 +2590.00,618.00,176.319 +2590.00,669.50,191.097 +2590.00,721.00,205.914 +2590.00,772.50,220.770 +2590.00,824.00,235.664 +2590.00,875.50,250.596 +2590.00,927.00,265.567 +2590.00,978.50,280.576 +2590.00,1030.00,295.623 \ No newline at end of file