diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs index a0b36cdf6e89b5f6a7495cbe3784d3e46d82e877..ed61a684c6018fac14736e589be3fd234d0eba2e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs @@ -555,4 +555,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider #endregion } + + // --------------------------------------------------------------------------------------- + + public class XMLDeclarationExemptedVehicleDataProviderV221 : XMLDeclarationExemptedVehicleDataProviderV22 + { + public new static readonly XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V221; + + public new const string XSD_TYPE = "ExemptedVehicleDeclarationType"; + + public new static readonly string QUALIFIED_XSD_TYPE = + XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE); + + public XMLDeclarationExemptedVehicleDataProviderV221( + IXMLDeclarationJobInputData jobData, XmlNode xmlNode, string sourceFile) : base(jobData, xmlNode, + sourceFile) + { + } + } } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV221InjectModule.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV221InjectModule.cs new file mode 100644 index 0000000000000000000000000000000000000000..b94d2035f5529e0aa79bea3c26d5c9a59777d1d0 --- /dev/null +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV221InjectModule.cs @@ -0,0 +1,20 @@ +using Ninject.Modules; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces; + +namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.NinjectModules +{ + public class XMLDeclarationInputDataV221InjectModule : NinjectModule + { + #region Overrides of NinjectModule + + public override void Load() + { + Bind<IXMLDeclarationVehicleData>().To<XMLDeclarationExemptedVehicleDataProviderV221>() + .Named(XMLDeclarationExemptedVehicleDataProviderV221.QUALIFIED_XSD_TYPE); + + } + + #endregion + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationReaderInjectModule.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationReaderInjectModule.cs index ee091575f28f494f495c869bc65345b9fa7ff0eb..006ad0c4092f6e7b1836737b9ea0b3e07ed7c780 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationReaderInjectModule.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationReaderInjectModule.cs @@ -52,6 +52,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration new XMLDeclarationInputDataV20InjectModule(), new XMLDeclarationInputDataV21InjectModule(), new XMLDeclarationInputDataV22InjectModule(), + new XMLDeclarationInputDataV221InjectModule(), }); #endregion diff --git a/VectoCore/VectoCore/Utils/XMLDefinitions.cs b/VectoCore/VectoCore/Utils/XMLDefinitions.cs index 3451a7cf1c61fe0bfde40908a58a638b7901ae17..47e530052be76f97c86cf85c005b3e434b951413 100644 --- a/VectoCore/VectoCore/Utils/XMLDefinitions.cs +++ b/VectoCore/VectoCore/Utils/XMLDefinitions.cs @@ -78,6 +78,8 @@ namespace TUGraz.VectoCore.Utils public const string DECLARATION_DEFINITIONS_NAMESPACE_URI_V22 = DECLARATION_NAMESPACE + ":v2.2"; + public const string DECLARATION_DEFINITIONS_NAMESPACE_URI_V221 = DECLARATION_NAMESPACE + ":v2.2.1"; + public const string DECLARATION_INPUT_NAMESPACE = "urn:tugraz:ivt:VectoAPI:DeclarationInput"; diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index afd6d1c0b641a6f9e9c7dc9d6e1323521a2d962d..6da1864459b2a08a6b32d5bf6a94263556e44295 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -172,6 +172,7 @@ <Compile Include="InputData\FileIO\XML\Declaration\Interfaces\IXMLVehicleComponentsDeclaration.cs" /> <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV20InjectModule.cs" /> <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV21InjectModule.cs" /> + <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV221InjectModule.cs" /> <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV22InjectModule.cs" /> <Compile Include="InputData\FileIO\XML\Declaration\Reader\Impl\AbstractComponentReader.cs" /> <Compile Include="InputData\FileIO\XML\Declaration\Reader\Impl\XMLADASReader.cs" /> @@ -694,6 +695,9 @@ <EmbeddedResource Include="Resources\XSD\VectoOutputManufacturer.0.7.1.xsd"> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="Resources\XSD\VectoDeclarationDefinitions.2.2.1.xsd"> + <SubType>Designer</SubType> + </EmbeddedResource> <None Include="Utils\VectoVersionCore.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>VectoVersionCore.cs</LastGenOutput> diff --git a/VectoCore/VectoCoreTest/Integration/Declaration/ExemptedVehicleTest.cs b/VectoCore/VectoCoreTest/Integration/Declaration/ExemptedVehicleTest.cs index cd44b19d12724693c170d38f72451d49f2367e6f..3e4110be734f55e5cab7f4dd2f6caf5dad7333af 100644 --- a/VectoCore/VectoCoreTest/Integration/Declaration/ExemptedVehicleTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Declaration/ExemptedVehicleTest.cs @@ -46,7 +46,9 @@ using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.FileIO.XML; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; +using TUGraz.VectoCore.Tests.Integration.Declaration; using TUGraz.VectoCore.Tests.Models.Simulation; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; @@ -63,8 +65,8 @@ namespace TUGraz.VectoCore.Tests.Integration const string ExemptedVehicleV2 = @"Testdata\Integration\DeclarationMode\ExemptedVehicle\vecto_vehicle-sample_exempted_v2.xml"; const string ExemptedVehicleV2NoHEV = @"Testdata\Integration\DeclarationMode\ExemptedVehicle\vecto_vehicle-sample_exempted_v2_nonHEV.xml"; - private const string ExemptedAxl = @"TestData\Integration\DeclarationMode\ExemptedVehicle\exempted_axl.xml"; private const string ExemptedMin = @"TestData\Integration\DeclarationMode\ExemptedVehicle\exempted.xml"; + private const string ExemptedAxl = @"TestData\Integration\DeclarationMode\ExemptedVehicle\exempted_axl.xml"; private const string ExemptedAxlSleeperT = @"TestData\Integration\DeclarationMode\ExemptedVehicle\exempted_axl+sleeperT.xml"; private const string ExemptedAxlSleeperF = @"TestData\Integration\DeclarationMode\ExemptedVehicle\exempted_axl+sleeperF.xml"; private const string ExemptedSleeperT = @"TestData\Integration\DeclarationMode\ExemptedVehicle\exempted_sleeperT.xml"; @@ -281,6 +283,62 @@ namespace TUGraz.VectoCore.Tests.Integration } + + [ + TestCase(ExemptedMin, null, null, null, null, false), + TestCase(ExemptedAxl, AxleConfiguration.AxleConfig_4x2, null, 30000, 20000, false), + TestCase(ExemptedAxlSleeperT, AxleConfiguration.AxleConfig_4x2, true, 30000, 20000, false), + TestCase(ExemptedAxlSleeperF, AxleConfiguration.AxleConfig_4x2, false, 30000, 20000, false), + TestCase(ExemptedSleeperT, null, true, 30000, 20000, false), + TestCase(ExemptedSleeperF, null, false, 30000, 20000, false), + TestCase(ExemptedPEVMaxNetPower, AxleConfiguration.AxleConfig_4x2, true, 30000, 20000, true), + TestCase(ExemptedPEVMaxNetPower, AxleConfiguration.AxleConfig_4x2, null, null, null, true), + + TestCase(ExemptedMin_v2, null, null, null, null, false), + TestCase(ExemptedAxl_v2, AxleConfiguration.AxleConfig_4x2, null, 30000, 20000, false), + TestCase(ExemptedAxlSleeperT_v2, AxleConfiguration.AxleConfig_4x2, true, 30000, 20000, false), + TestCase(ExemptedAxlSleeperF_v2, AxleConfiguration.AxleConfig_4x2, false, 30000, 20000, false), + TestCase(ExemptedSleeperT_v2, null, true, 30000, 20000, false), + TestCase(ExemptedSleeperF_v2, null, false, 30000, 20000, false), + TestCase(ExemptedPEVMaxNetPower_v2, AxleConfiguration.AxleConfig_4x2, true, 30000, 20000, true), + TestCase(ExemptedPEVMaxNetPower_v2, AxleConfiguration.AxleConfig_4x2, null, null, null, true), + ] + public void TestExemptedVehiclesAxleConfSleeperCabMRF(string filename, AxleConfiguration? expectedMrfAxleConf, + bool? expectedMrfSleeperCab, double? expectedMaxNetPower1, double? expectedMaxNetPower2, bool zeHDV) + { + var writer = new MockDeclarationWriter(filename); + + + var inputData = xmlInputReader.CreateDeclaration(filename); + + var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) { + WriteModalResults = true, + ActualModalData = true + }; + var jobContainer = new JobContainer(new MockSumWriter()); + + var runs = factory.SimulationRuns().ToList(); + Assert.AreEqual(1, runs.Count); + foreach (var run in runs) { + jobContainer.AddRun(run); + } + //jobContainer.AddRuns(factory); + + jobContainer.Execute(); + jobContainer.WaitFinished(); + var progress = jobContainer.GetProgress(); + Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error))); + + + var validator = new XMLValidator(writer.GetReport(ReportType.DeclarationReportManufacturerXML).CreateReader()); + Assert.IsTrue(validator.ValidateXML(XmlDocumentType.ManufacturerReport)); + + var val2 = new XMLValidator(writer.GetReport(ReportType.DeclarationReportCustomerXML).CreateReader()); + Assert.IsTrue(val2.ValidateXML(XmlDocumentType.CustomerReport)); + + Assert.Fail("not fully implemented"); + } + private static void SetExemptedParameters(XPathNavigator nav, bool zeroEmission, bool hybrid, bool dualFuel) { var manager = new XmlNamespaceManager(nav.NameTable); diff --git a/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_PEV.xml b/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_PEV.xml index 2f664cb057fb287edbd4ab906d1ee34e40ae8fcc..67fdf8d43c5d419031f4de2955c8d878098da396 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_PEV.xml +++ b/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_PEV.xml @@ -13,6 +13,7 @@ <Date>2017-02-15T11:00:00Z</Date> <LegislativeClass>N3</LegislativeClass> <VehicleCategory>Tractor</VehicleCategory> + <AxleConfiguration>4x2</AxleConfiguration> <CurbMassChassis>7100</CurbMassChassis> <GrossVehicleMass>40000</GrossVehicleMass> <ZeroEmissionVehicle>true</ZeroEmissionVehicle> diff --git a/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_v2.2.1_PEV.xml b/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_v2.2.1_PEV.xml index 1edd71575a5cbe94cd0ba9772608012d5fb504da..88602ed6f44ea67db34625f82a3affa09a9c8fc7 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_v2.2.1_PEV.xml +++ b/VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/ExemptedVehicle/exempted_v2.2.1_PEV.xml @@ -14,6 +14,7 @@ <Date>2017-02-15T11:00:00Z</Date> <LegislativeClass>N3</LegislativeClass> <VehicleCategory>Tractor</VehicleCategory> + <AxleConfiguration>4x2</AxleConfiguration> <CurbMassChassis>7100</CurbMassChassis> <GrossVehicleMass>40000</GrossVehicleMass> <ZeroEmissionVehicle>true</ZeroEmissionVehicle>