From d8760d0d6afb1cda838d66cb7d129eb57950e3aa Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Mon, 7 May 2018 16:30:05 +0200 Subject: [PATCH] correct testcases due to other modifications (mileage counter in vehicle container) --- .../DeclarationModeVectoRunDataFactory.cs | 2 +- .../Simulation/Impl/VehicleContainer.cs | 2 +- .../VectoCoreTest/Integration/ATPowerTrain.cs | 8 +++++--- .../Integration/CoachAdvancedAuxPowertrain.cs | 10 +++++----- .../Integration/CoachPowerTrain.cs | 9 +++++---- .../SimulationRuns/FullPowertrain.cs | 3 +++ .../SimulationRuns/MinimalPowertrain.cs | 14 +++++++------ .../Integration/Truck40tPowerTrain.cs | 9 +++++---- .../Simulation/LossMapRangeValidationTest.cs | 20 +++++++++++++------ 9 files changed, 47 insertions(+), 30 deletions(-) diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs index a1564e1af4..7352abc28e 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs @@ -185,7 +185,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl ? _municipalPtoTransmissionData : _ptoTransmissionData, InputDataHash = InputDataProvider.XMLHash, - SimulationType = SimulationType.DistanceCycle + SimulationType = SimulationType.DistanceCycle }; simulationRunData.EngineData.FuelConsumptionCorrectionFactor = DeclarationData.WHTCCorrection.Lookup( diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index ee2d540538..48467a2291 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -352,7 +352,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public Meter Distance { get { - if (RunData.SimulationType != SimulationType.DistanceCycle) { + if (RunData == null || (RunData.SimulationType & SimulationType.DistanceCycle) == 0 ) { return 0.SI<Meter>(); } if (MilageCounter != null) { diff --git a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs index abfa03730a..837a568ea8 100644 --- a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs @@ -38,6 +38,7 @@ using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -104,7 +105,8 @@ namespace TUGraz.VectoCore.Tests.Integration JobName = modFileName, Cycle = cycleData, Retarder = new RetarderData() { Type = RetarderType.None }, - Aux = new List<VectoRunData.AuxData>() + Aux = new List<VectoRunData.AuxData>(), + SimulationType = SimulationType.DistanceCycle }; var container = new VehicleContainer(ExecutionMode.Engineering, modData) { RunData = runData, @@ -142,7 +144,7 @@ namespace TUGraz.VectoCore.Tests.Integration Gears = ratios.Select((ratio, i) => Tuple.Create((uint)i, new GearData { - //MaxTorque = 2300.SI<NewtonMeter>(), + //MaxTorque = 2300.SI<NewtonMeter>(), LossMap = ratio.IsEqual(1) ? TransmissionLossMapReader.Create(0.96, ratio, string.Format("Gear {0}", i)) : TransmissionLossMapReader.Create(0.98, ratio, string.Format("Gear {0}", i)), @@ -232,7 +234,7 @@ namespace TUGraz.VectoCore.Tests.Integration LookAheadCoasting = new DriverData.LACData { Enabled = true, MinSpeed = 50.KMPHtoMeterPerSecond(), - //Deceleration = -0.5.SI<MeterPerSquareSecond>() + //Deceleration = -0.5.SI<MeterPerSquareSecond>() LookAheadDistanceFactor = DeclarationData.Driver.LookAhead.LookAheadDistanceFactor, LookAheadDecisionFactor = new LACDecisionFactor() }, diff --git a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs index f2f64156c4..3de184dd2d 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs @@ -36,6 +36,7 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -79,9 +80,7 @@ namespace TUGraz.VectoCore.Tests.Integration WriteAdvancedAux = true, WriteModalResults = true }; - var container = new VehicleContainer(ExecutionMode.Engineering, modData) { - RunData = new VectoRunData { JobName = modFileName, Cycle = cycleData } - }; + var container = new VehicleContainer(ExecutionMode.Engineering, modData); var gearboxData = CreateGearboxData(); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(highEnginePower ? EngineFileHigh : EngineFile, @@ -100,9 +99,10 @@ namespace TUGraz.VectoCore.Tests.Integration VehicleData = vehicleData, AirdragData = airdragData, GearboxData = gearboxData, - EngineData = engineData + EngineData = engineData, + SimulationType = SimulationType.DistanceCycle }; - + container.RunData = runData; cycle.AddComponent(new Driver(container, driverData, new DefaultDriverStrategy())) .AddComponent(new Vehicle(container, vehicleData, airdragData)) .AddComponent(new Wheels(container, vehicleData.DynamicTyreRadius, vehicleData.WheelsInertia)) diff --git a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs index 01d338e761..6daeda6883 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -38,6 +38,7 @@ using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -76,9 +77,7 @@ namespace TUGraz.VectoCore.Tests.Integration { var fileWriter = new FileOutputWriter(modFileName); var modData = new ModalDataContainer(modFileName, FuelType.DieselCI, fileWriter) { WriteModalResults = true }; - var container = new VehicleContainer(ExecutionMode.Engineering, modData) { - RunData = new VectoRunData { JobName = modFileName, Cycle = cycleData } - }; + var container = new VehicleContainer(ExecutionMode.Engineering, modData); var gearboxData = CreateGearboxData(); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(engineHighPower ? EngineFileHigh : EngineFile, @@ -102,9 +101,11 @@ namespace TUGraz.VectoCore.Tests.Integration AxleGearData = axleGearData, GearboxData = gearboxData, EngineData = engineData, - AirdragData = airDragData + AirdragData = airDragData, + SimulationType = SimulationType.DistanceCycle }; + container.RunData = runData; var tmp = cycle.AddComponent(new Driver(container, driverData, new DefaultDriverStrategy())) .AddComponent(new Vehicle(container, vehicleData, airDragData)) .AddComponent(new Wheels(container, vehicleData.DynamicTyreRadius, vehicleData.WheelsInertia)) diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index 1826542ecd..dee862d16d 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -52,6 +52,7 @@ using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; using NUnit.Framework; +using TUGraz.VectoCore.InputData.Reader.Impl; namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns { @@ -80,6 +81,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var fileWriter = new FileOutputWriter("Coach_FullPowertrain_SimpleGearbox"); var modData = new ModalDataContainer("Coach_FullPowertrain_SimpleGearbox", FuelType.DieselCI, fileWriter); var container = new VehicleContainer(ExecutionMode.Engineering, modData); + container.RunData = new VectoRunData() { SimulationType = SimulationType.DistanceCycle }; var gearboxData = CreateSimpleGearboxData(); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, gearboxData.Gears.Count); @@ -145,6 +147,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var fileWriter = new FileOutputWriter("Coach_FullPowertrain"); var modData = new ModalDataContainer("Coach_FullPowertrain", FuelType.DieselCI, fileWriter); var container = new VehicleContainer(ExecutionMode.Engineering, modData); + container.RunData = new VectoRunData() {SimulationType = SimulationType.DistanceCycle }; var gearboxData = CreateGearboxData(); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, gearboxData.Gears.Count); diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs index 69924926e5..e467f1f3b9 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs @@ -49,6 +49,7 @@ using TUGraz.VectoCore.Utils; using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; using NUnit.Framework; using System.IO; +using TUGraz.VectoCore.InputData.Reader.Impl; namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns { @@ -64,13 +65,13 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns public const string AccelerationFile2 = @"TestData\Components\Truck.vacc"; public const double Tolerance = 0.001; - [OneTimeSetUp] - public void RunBeforeAnyTests() - { - Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); - } + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } - [TestCase] + [TestCase] public void TestWheelsAndEngineInitialize() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 1); @@ -202,6 +203,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var fileWriter = new FileOutputWriter("Coach_MinimalPowertrainOverload"); var modData = new ModalDataContainer("Coach_MinimalPowertrainOverload", FuelType.DieselCI, fileWriter); var container = new VehicleContainer(ExecutionMode.Engineering, modData); + container.RunData = new VectoRunData() { SimulationType = SimulationType.DistanceCycle }; var cycle = new DistanceBasedDrivingCycle(container, cycleData); cycle.AddComponent(new Driver(container, driverData, new DefaultDriverStrategy())) diff --git a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs index 900a1a51d8..9ee0735d5b 100644 --- a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -37,6 +37,7 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -88,9 +89,7 @@ namespace TUGraz.VectoCore.Tests.Integration var modData = new ModalDataContainer(Path.GetFileName(modFileName), FuelType.DieselCI, fileWriter) { WriteModalResults = true }; - var container = new VehicleContainer(ExecutionMode.Engineering, modData) { - RunData = new VectoRunData { JobName = modFileName, Cycle = cycleData } - }; + var container = new VehicleContainer(ExecutionMode.Engineering, modData); var gearboxData = CreateGearboxData(); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, gearboxData.Gears.Count); @@ -109,8 +108,10 @@ namespace TUGraz.VectoCore.Tests.Integration VehicleData = vehicleData, AirdragData = airdragData, AxleGearData = axleGearData, - GearboxData = gearboxData + GearboxData = gearboxData, + SimulationType = SimulationType.DistanceCycle }; + container.RunData = runData; IShiftStrategy gbxStrategy; switch (gbxType) { diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs index 49d754b93f..b946802f98 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs @@ -30,9 +30,10 @@ */ using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.IO; using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; @@ -60,9 +61,16 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation public const string GearboxIndirectLoss = @"TestData\Components\Indirect Gear.vtlm"; public const string GearboxDirectLoss = @"TestData\Components\Direct Gear.vtlm"; public const string GearboxLimited = @"TestData\Components\limited.vtlm"; - public const string GearboxShiftPolygonFile = @"TestData\Components\ShiftPolygons.vgbs"; - //public const string GearboxFullLoadCurveFile = @"TestData\Components\Gearbox.vfld"; - + public const string GearboxShiftPolygonFile = @"TestData\Components\ShiftPolygons.vgbs"; + //public const string GearboxFullLoadCurveFile = @"TestData\Components\Gearbox.vfld"; + + + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } + /// <summary> /// VECTO-173 /// </summary> -- GitLab