From 947636fc7c341dfa0f3a53b9b4ee74d697ce9624 Mon Sep 17 00:00:00 2001 From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at> Date: Wed, 8 Sep 2021 14:39:06 +0200 Subject: [PATCH] added PEV primary bus E2 to reader --- .../VectoCommon/Models/PowertrainPosition.cs | 1 + ...MLDeclarationBusAuxiliariesDataProvider.cs | 3 +- .../XMLDeclarationComponentsDataProvider.cs | 26 +++++++++++++++- .../XMLDeclarationVehicleDataProvider.cs | 18 +++++++++++ ...XMLDeclarationInputDataV210InjectModule.cs | 12 +++++++ .../Reader/Impl/XMLComponentReader.cs | 28 ++++++++++++++++- .../XML/XMLDeclarationInputv210.cs | 31 +++++++++++++++++++ 7 files changed, 116 insertions(+), 3 deletions(-) diff --git a/VectoCommon/VectoCommon/Models/PowertrainPosition.cs b/VectoCommon/VectoCommon/Models/PowertrainPosition.cs index 4d3e806d6e..43044255f7 100644 --- a/VectoCommon/VectoCommon/Models/PowertrainPosition.cs +++ b/VectoCommon/VectoCommon/Models/PowertrainPosition.cs @@ -115,6 +115,7 @@ namespace TUGraz.VectoCommon.InputData { case "Components_PEV-E2_LorryType": case "Components_PEV-E3_LorryType": case "Components_PEV-E4_LorryType": + case "Components_PEV-E2_PrimaryBusType": return $"E{pos}"; default: return null; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs index 0a6ee94e74..01b1fccdab 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs @@ -24,11 +24,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider public const string XSD_TYPE = "AUX_Conventional_PrimaryBusType"; public const string XSD_HEV_P_TYPE = "AUX_HEV-P_PrimaryBusType"; public const string XSD_HEV_S_TYPE = "AUX_HEV-S_PrimaryBusType"; + public const string XSD_PEV_E2_TYPE = "AUX_PEV_PrimaryBusType"; public static readonly string QUALIFIED_XSD_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE); public static readonly string QUALIFIED_XSD_HEV_P_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_HEV_P_TYPE); public static readonly string QUALIFIED_XSD_HEV_S_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_HEV_S_TYPE); - + public static readonly string QUALIFIED_XSD_PEV_E2_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_PEV_E2_TYPE); public XMLDeclarationPrimaryBusAuxiliariesDataProviderV210( IXMLDeclarationVehicleData vehicle, XmlNode componentNode, string sourceFile) : base(componentNode) { } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs index a7d9c9cdc1..bcf80fb7b5 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs @@ -99,7 +99,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider public virtual IBusAuxiliariesDeclarationData BusAuxiliaries => null; public virtual IElectricStorageSystemDeclarationInputData ElectricStorage => _electricStorageSystemInputData ?? (_electricStorageSystemInputData = ComponentReader.ElectricStorageSystem); public virtual IElectricMachinesDeclarationInputData ElectricMachines => _electricMachinesInputData ?? (_electricMachinesInputData = ComponentReader.ElectricMachines); - public IIEPCDeclarationInputData IEPC => _iepcInputData ?? (_iepcInputData = ComponentReader.IEPCInputData); + public virtual IIEPCDeclarationInputData IEPC => _iepcInputData ?? (_iepcInputData = ComponentReader.IEPCInputData); #endregion @@ -428,4 +428,28 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider public XMLDeclarationHeavyLorryPEVExComponentDataV210(IXMLDeclarationVehicleData vehicle, XmlNode componentNode, string sourceFile) : base(vehicle, componentNode, sourceFile) { } } + + // --------------------------------------------------------------------------------------- + + public class XMLDeclarationPrimaryBusPEVE2ComponentDataV210 : XMLDeclarationComponentsDataProviderV10 + { + public new static readonly XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V210_JOBS; + public new const string XSD_TYPE = "Components_PEV-E2_PrimaryBusType"; + public new static readonly string QUALIFIED_XSD_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE); + + private IBusAuxiliariesDeclarationData _busAuxiliariesDeclarationInputData; + + public XMLDeclarationPrimaryBusPEVE2ComponentDataV210(IXMLDeclarationVehicleData vehicle, XmlNode componentNode, string sourceFile) + : base(vehicle, componentNode, sourceFile) { } + + #region Overrides of XMLDeclarationComponentsDataProviderV10 + + public override IEngineDeclarationInputData EngineInputData => null; + + public override IIEPCDeclarationInputData IEPC => null; + + public override IBusAuxiliariesDeclarationData BusAuxiliaries => _busAuxiliariesDeclarationInputData ?? + (_busAuxiliariesDeclarationInputData = ComponentReader.BusAuxiliariesInputData); + #endregion + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs index e070798c82..c856f25acb 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs @@ -1429,4 +1429,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider #endregion } + + // --------------------------------------------------------------------------------------- + + public class XMLDeclarationPEVPrimaryBusDataProviderV210 : XMLDeclarationPEVMediumLorryExDataProviderV210 + { + public new static readonly XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V210_JOBS; + public new const string XSD_TYPE = "Vehicle_PEV_PrimaryBusDeclarationType"; + public new static readonly string QUALIFIED_XSD_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE); + public XMLDeclarationPEVPrimaryBusDataProviderV210(IXMLDeclarationJobInputData jobData, XmlNode xmlNode, string sourceFile) + : base(jobData, xmlNode, sourceFile) { } + + #region Overrides of XMLDeclarationVehicleDataProviderV10 + + public override CubicMeter CargoVolume => null; + + #endregion + } + } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV210InjectModule.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV210InjectModule.cs index fe8d6b5124..52538e1447 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV210InjectModule.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV210InjectModule.cs @@ -58,6 +58,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.NinjectModules Bind<IXMLDeclarationVehicleData>().To<XMLDeclarationPEVMediumLorryExDataProviderV210>() .Named(XMLDeclarationPEVMediumLorryExDataProviderV210.QUALIFIED_XSD_TYPE); + Bind<IXMLDeclarationVehicleData>().To<XMLDeclarationPEVPrimaryBusDataProviderV210>() + .Named(XMLDeclarationPEVPrimaryBusDataProviderV210.QUALIFIED_XSD_TYPE); + Bind<IXMLVehicleComponentsDeclaration>().To<XMLDeclarationCompletedBusComponentsDataProviderV210>() .Named(XMLDeclarationCompletedBusComponentsDataProviderV210.QUALIFIED_XSD_TYPE); @@ -100,6 +103,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.NinjectModules Bind<IXMLVehicleComponentsDeclaration>().To<XMLDeclarationHeavyLorryPEVExComponentDataV210>() .Named(XMLDeclarationHeavyLorryPEVExComponentDataV210.QUALIFIED_XSD_PEV_E4_TYPE); + Bind<IXMLVehicleComponentsDeclaration>().To<XMLDeclarationPrimaryBusPEVE2ComponentDataV210>() + .Named(XMLDeclarationPrimaryBusPEVE2ComponentDataV210.QUALIFIED_XSD_TYPE); + Bind<IXMLComponentReader>().To<XMLComponentReaderV210_CompletedBus>().Named(XMLComponentReaderV210_CompletedBus.QUALIFIED_XSD_TYPE); Bind<IXMLComponentReader>().To<XMLComponentReaderV210_HEV_PxHeavyLorry>().Named(XMLComponentReaderV210_HEV_PxHeavyLorry.QUALIFIED_XSD_TYPE); @@ -137,6 +143,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.NinjectModules Bind<IXMLComponentReader>().To<XMLPEVHeavyLorryE4DeclarationComponentReaderV201>() .Named(XMLPEVHeavyLorryE4DeclarationComponentReaderV201.QUALIFIED_XSD_TYPE); + Bind<IXMLComponentReader>().To<XMLPEVPrimaryBusE2DeclarationComponentReaderV201>() + .Named(XMLPEVPrimaryBusE2DeclarationComponentReaderV201.QUALIFIED_XSD_TYPE); + Bind<IXMLGearboxReader>().To<XMLGearboxDeclarationComponentReaderV201>() .Named(XMLGearboxDeclarationComponentReaderV201.GEARBOX_READER_QUALIFIED_XSD_TYPE); @@ -187,6 +196,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.NinjectModules Bind<IXMLBusAuxiliariesDeclarationData>().To<XMLDeclarationPrimaryBusAuxiliariesDataProviderV210>() .Named(XMLDeclarationPrimaryBusAuxiliariesDataProviderV210.QUALIFIED_XSD_HEV_S_TYPE); + + Bind<IXMLBusAuxiliariesDeclarationData>().To<XMLDeclarationPrimaryBusAuxiliariesDataProviderV210>() + .Named(XMLDeclarationPrimaryBusAuxiliariesDataProviderV210.QUALIFIED_XSD_PEV_E2_TYPE); Bind<IXMLDeclarationVehicleData>().To<XMLDeclarationMediumLorryVehicleDataProviderV210>() .Named(XMLDeclarationMediumLorryVehicleDataProviderV210.QUALIFIED_XSD_TYPE); diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLComponentReader.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLComponentReader.cs index d3463ed67d..ea75e7e664 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLComponentReader.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLComponentReader.cs @@ -891,9 +891,35 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Reader.Impl #endregion } - + // --------------------------------------------------------------------------------------- + + public class XMLPEVPrimaryBusE2DeclarationComponentReaderV201 : XMLComponentReaderV10 + { + public new static readonly XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V210_JOBS; + public new const string XSD_TYPE = "Components_PEV-E2_PrimaryBusType"; + public new static readonly string QUALIFIED_XSD_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE); + + protected IBusAuxiliariesDeclarationData _busAuxInputData; + + public XMLPEVPrimaryBusE2DeclarationComponentReaderV201(IXMLDeclarationVehicleData vehicle, XmlNode componentsNode) + : base(vehicle, componentsNode) { } + + #region Overrides of XMLComponentReaderV10 + + public override IAuxiliariesDeclarationInputData AuxiliaryData => null; + public override IBusAuxiliariesDeclarationData BusAuxiliariesInputData => + _busAuxInputData ?? (_busAuxInputData = CreateComponent(XMLNames.Component_Auxiliaries, BusAuxCreator)); + + protected virtual IBusAuxiliariesDeclarationData BusAuxCreator(string version, XmlNode componentNode, string sourceFile) + { + return Factory.CreateBusAuxiliaires(version, Vehicle, componentNode, sourceFile); + } + #endregion + } + // --------------------------------------------------------------------------------------- + public class XMLGearboxDeclarationComponentReaderV201 : XMLComponentReaderV10 { public new static readonly XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V2101_JOBS; diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs index 6231c2d818..0c26c66546 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs @@ -1250,6 +1250,37 @@ namespace TUGraz.VectoCore.Tests.XML } + [TestCase(@"PrimaryBus\PEV_primaryBus_AMT_E2.xml")] + public void TestPEVPrimaryBusE2(string jobfile) + { + var filename = Path.Combine(BASE_DIR, jobfile); + var dataProvider = xmlInputReader.CreateDeclaration(XmlReader.Create(filename)); + Assert.NotNull(dataProvider.JobInputData); + var vehicle = dataProvider.JobInputData.Vehicle; + Assert.NotNull(vehicle); + Assert.IsNull(vehicle.Components.EngineInputData); + Assert.IsNotNull(vehicle.Components.ElectricMachines); + Assert.AreEqual(1, vehicle.Components.ElectricMachines.Entries.Count); + Assert.AreEqual(PowertrainPosition.BatteryElectricE2, vehicle.Components.ElectricMachines.Entries[0].Position); + Assert.IsNull(vehicle.Components.IEPC); + Assert.IsNotNull(vehicle.Components.GearboxInputData); + TestTorqueConverter(vehicle); + Assert.IsNotNull(vehicle.Components.AngledriveInputData); + Assert.IsNotNull(vehicle.Components.RetarderInputData); + Assert.IsNotNull(vehicle.Components.AxleGearInputData); + Assert.IsNotNull(vehicle.Components.AxleWheels); + Assert.IsNull(vehicle.Components.AuxiliaryInputData); + Assert.IsNotNull(vehicle.Components.BusAuxiliaries); + Assert.IsNotNull(vehicle.Components.AirdragInputData); + Assert.IsNotNull(vehicle.Components.ElectricStorage); + Assert.IsNull(vehicle.Components.PTOTransmissionInputData); + Assert.IsNull(vehicle.CargoVolume); + Assert.IsNotNull(vehicle.TorqueLimits); + Assert.IsNotNull(vehicle.ElectricMotorTorqueLimits); + Assert.IsNull(vehicle.MaxPropulsionTorque); + } + + #region Test existence of torque converter private void TestTorqueConverter(IVehicleDeclarationInputData vehicle) -- GitLab