diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index f62b7a4410011ea623d59d5ce9c57872b0c89e7a..211d5ef1d72616df29f071ae51562a336e1778a1 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -846,6 +846,7 @@ namespace TUGraz.VectoCommon.InputData public interface IPneumaticSupplyDeclarationData { + CompressorDrive CompressorDrive { get; } string Clutch { get; } double Ratio { get; } @@ -975,4 +976,37 @@ namespace TUGraz.VectoCommon.InputData } } } + + public enum CompressorDrive + { + electrically, + mechanically + } + + public static class CompressorDriveHelper + { + public static CompressorDrive Parse(string parse) + { + switch (parse) + { + case nameof(CompressorDrive.electrically): + return CompressorDrive.electrically; + case nameof(CompressorDrive.mechanically): + return CompressorDrive.mechanically; + default: + throw new ArgumentOutOfRangeException(); + } + } + + public static string GetLabel(this CompressorDrive type) + { + switch (type) + { + case CompressorDrive.electrically: return nameof(CompressorDrive.electrically); + case CompressorDrive.mechanically: return nameof(CompressorDrive.electrically); + default: return null; + } + } + } + } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs index dddce37770b367b37342ed0c04611bd63579e42b..630bcb5fe4c74b1cce0b7b368691efac198d566e 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs +++ b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs @@ -1365,6 +1365,15 @@ namespace TUGraz.VectoCommon.Resources { } } + /// <summary> + /// Looks up a localized string similar to CompressorDrive. + /// </summary> + public static string CompressorDrive { + get { + return ResourceManager.GetString("CompressorDrive", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to Signature. /// </summary> diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.resx b/VectoCommon/VectoCommon/Resources/XMLNames.resx index e3656be828189918da7308e6d4d127a4b95e97f3..dc9fe851d60aab9da2f7dfe82b8344c6f6a55cbf 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.resx +++ b/VectoCommon/VectoCommon/Resources/XMLNames.resx @@ -1506,4 +1506,7 @@ <data name="BusAux_HVAC" xml:space="preserve"> <value>HVAC</value> </data> + <data name="CompressorDrive" xml:space="preserve"> + <value>CompressorDrive</value> + </data> </root> \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs index 3de7b5a3747a188e5f4674209b77e7bd73c39a7f..d47dea23f929a68593777861506b5a2a4470cb6e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs @@ -592,7 +592,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region Implementation of IPneumaticSupplyDeclarationData - public string Clutch { get; } + public CompressorDrive CompressorDrive { get; } + public string Clutch { get; } public virtual double Ratio { get { return Body["Aux"]?["PneumaticSupply"]?.GetEx<double>("Ratio") ?? 0.0; } } public virtual string CompressorSize { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs index b33ee82dcff969599dc060b1db7e793370f75f20..566ecab49c12fa47fe34aa309961ed2115427b71 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs @@ -138,6 +138,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider #region Implementation of IPneumaticSupplyDeclarationData + public CompressorDrive CompressorDrive + { + get { return CompressorDriveHelper.Parse(GetString(XMLNames.CompressorDrive)); } + } + public virtual string Clutch { get { return GetString(new[] { XMLNames.BusAux_PneumaticSystem, "Clutch" }); } } public virtual double Ratio diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs b/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs index 43fefb49581f233e3c0e0e229381fa1271ba2f58..800fa39358f383c6f9dd13777b8a6c07c75daebe 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs @@ -45,6 +45,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl { #region Implementation of IPneumaticSupplyDeclarationData + public CompressorDrive CompressorDrive { get; } public string Clutch { get; } public double Ratio { get; } public string CompressorSize { get; } diff --git a/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs b/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs index 563e08117233750b2ffab266e83e4edfe29f00a2..2e2d7352d77c68d325129097cf884af52772a7c8 100644 --- a/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs @@ -364,6 +364,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(50.SI(Unit.SI.Watt.Hour).Cast<WattSecond>(), aux.ElectricSupply.ElectricStorageCapacity); Assert.AreEqual("Large Supply 2-stage", aux.PneumaticSupply.CompressorSize);//SizeOfAirSupply + Assert.AreEqual(CompressorDrive.electrically, aux.PneumaticSupply.CompressorDrive); Assert.AreEqual("none", aux.PneumaticSupply.Clutch); Assert.AreEqual(1.000, aux.PneumaticSupply.Ratio); Assert.AreEqual(true, aux.PneumaticSupply.SmartAirCompression);