From dcd1f806878a8d63505d3f2cb5055d04e0848407 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Thu, 22 Sep 2016 17:20:22 +0200 Subject: [PATCH] fix testcases: re-add min speed for coasting in testcases, add shift polygons to AT-gearbox testfiles, adapt for changes in the input data provider (empty list if no cycle or no acceleration curve) - is handled during validation of vecotrundata --- .../AbstractSimulationDataAdapter.cs | 8 ++++---- .../SimulationComponent/Data/AccelerationCurve.cs | 4 ++++ .../Models/SimulationComponent/Data/VehicleData.cs | 12 ++++++------ VectoCore/VectoCoreTest/FileIO/JsonTest.cs | 11 +++++------ VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs | 2 +- .../Integration/CoachAdvancedAuxPowertrain.cs | 2 +- .../VectoCoreTest/Integration/CoachPowerTrain.cs | 2 +- .../VectoCoreTest/Integration/Truck40tPowerTrain.cs | 2 +- .../Models/SimulationComponent/ATGearboxTest.cs | 6 +++--- .../Components/AT_GBX/GearboxPowerSplit.vgbx | 7 ++++--- .../Components/AT_GBX/GearboxSerialDualTC.vgbx | 11 ++++++----- 11 files changed, 36 insertions(+), 31 deletions(-) diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs index 15f8883ed2..46065fe683 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs @@ -141,15 +141,15 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { TransmissionLossMap axleLossMap; if (data.LossMap == null && useEfficiencyFallback) { - axleLossMap = TransmissionLossMapReader.Create(data.Efficiency, data.Ratio, "AxleGear"); + axleLossMap = TransmissionLossMapReader.Create(data.Efficiency, data.Ratio, "Axlegear"); } else { if (data.LossMap == null) { - throw new Exception("LossMap for AxleGear is missing."); + throw new InvalidFileFormatException("LossMap for Axlegear is missing."); } - axleLossMap = TransmissionLossMapReader.Create(data.LossMap, data.Ratio, "AxleGear"); + axleLossMap = TransmissionLossMapReader.Create(data.LossMap, data.Ratio, "Axlegear"); } if (axleLossMap == null) { - throw new Exception("LossMap for AxleGear is missing."); + throw new InvalidFileFormatException("LossMap for Axlegear is missing."); } return new AxleGearData { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs index ad52bffd29..35a68b857d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs @@ -31,6 +31,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Linq; using TUGraz.VectoCommon.Utils; @@ -100,7 +101,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data [DebuggerDisplay("Acceleration: {Acceleration}, Deceleration: {Deceleration}")] public class AccelerationEntry { + [Required, SIRange(0.3, 10)] public MeterPerSquareSecond Acceleration { get; set; } + + [Required, SIRange(-0.5, -10)] public MeterPerSquareSecond Deceleration { get; set; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs index 8d484b39a5..9f2c83b285 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs @@ -205,12 +205,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data } // vvvvvvv these checks apply only for declaration mode! vvvvvv - if (vehicleData.AxleConfiguration.NumAxles() != vehicleData.AxleData.Count) { - return - new ValidationResult( - string.Format("For a {0} type vehicle exactly {1} number of axles have to pe specified. Found {2}", - vehicleData.AxleConfiguration.GetName(), vehicleData.AxleConfiguration.NumAxles(), vehicleData.AxleData.Count)); - } + //if (vehicleData.AxleConfiguration.NumAxles() != vehicleData.AxleData.Count) { + // return + // new ValidationResult( + // string.Format("For a {0} type vehicle exactly {1} number of axles have to pe specified. Found {2}", + // vehicleData.AxleConfiguration.GetName(), vehicleData.AxleConfiguration.NumAxles(), vehicleData.AxleData.Count)); + //} if (vehicleData.TotalVehicleWeight() > gvwTotal) { return new ValidationResult( diff --git a/VectoCore/VectoCoreTest/FileIO/JsonTest.cs b/VectoCore/VectoCoreTest/FileIO/JsonTest.cs index 61d734158f..00fe6de361 100644 --- a/VectoCore/VectoCoreTest/FileIO/JsonTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/JsonTest.cs @@ -94,8 +94,8 @@ namespace TUGraz.VectoCore.Tests.FileIO var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); ((JObject)json["Body"]).Property("Cycles").Remove(); - AssertHelper.Exception<InvalidFileFormatException>( - () => { var tmp = new JSONInputDataV2(json, TestJobFile).Cycles; }, "Key Cycles not found"); + var tmp = new JSONInputDataV2(json, TestJobFile).Cycles; + Assert.AreEqual(0, tmp.Count); } [TestMethod] @@ -115,10 +115,9 @@ namespace TUGraz.VectoCore.Tests.FileIO var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); ((JObject)json["Body"]).Property("VACC").Remove(); - AssertHelper.Exception<VectoException>(() => { - IEngineeringInputDataProvider input = new JSONInputDataV2(json, TestJobFile); - var tmp = input.DriverInputData.AccelerationCurve; - }, "AccelerationCurve (VACC) required"); + IEngineeringInputDataProvider input = new JSONInputDataV2(json, TestJobFile); + var tmp = input.DriverInputData.AccelerationCurve; + Assert.IsNull(tmp); } [TestMethod] diff --git a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs index cb5971d3e6..b53a86c0bc 100644 --- a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs @@ -175,7 +175,7 @@ namespace TUGraz.VectoCore.Tests.Integration AccelerationCurve = AccelerationCurveReader.ReadFromFile(accelerationFile), LookAheadCoasting = new DriverData.LACData { Enabled = true, - //MinSpeed = 50.KMPHtoMeterPerSecond(), + MinSpeed = 50.KMPHtoMeterPerSecond(), //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 29e2aa7d5c..3018ddcc37 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs @@ -193,7 +193,7 @@ namespace TUGraz.VectoCore.Tests.Integration AccelerationCurve = AccelerationCurveReader.ReadFromFile(accelerationFile), LookAheadCoasting = new DriverData.LACData { Enabled = true, - //MinSpeed = 50.KMPHtoMeterPerSecond(), + MinSpeed = 50.KMPHtoMeterPerSecond(), //Deceleration = -0.5.SI<MeterPerSquareSecond>() LookAheadDistanceFactor = DeclarationData.Driver.LookAhead.LookAheadDistanceFactor, LookAheadDecisionFactor = new LACDecisionFactor() diff --git a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs index 5c4738dfb0..549d9d70cb 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -196,7 +196,7 @@ namespace TUGraz.VectoCore.Tests.Integration AccelerationCurve = AccelerationCurveReader.ReadFromFile(accelerationFile), LookAheadCoasting = new DriverData.LACData { Enabled = true, - //MinSpeed = 50.KMPHtoMeterPerSecond(), + MinSpeed = 50.KMPHtoMeterPerSecond(), //Deceleration = -0.5.SI<MeterPerSquareSecond>() LookAheadDistanceFactor = DeclarationData.Driver.LookAhead.LookAheadDistanceFactor, LookAheadDecisionFactor = new LACDecisionFactor() diff --git a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs index c9802f412b..10a8ec888a 100644 --- a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -230,7 +230,7 @@ namespace TUGraz.VectoCore.Tests.Integration AccelerationCurve = AccelerationCurveReader.ReadFromFile(accelerationFile), LookAheadCoasting = new DriverData.LACData { Enabled = true, - //MinSpeed = 50.KMPHtoMeterPerSecond(), + MinSpeed = 50.KMPHtoMeterPerSecond(), //Deceleration = -0.5.SI<MeterPerSquareSecond>(), LookAheadDistanceFactor = DeclarationData.Driver.LookAhead.LookAheadDistanceFactor, LookAheadDecisionFactor = new LACDecisionFactor() diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs index 8f62fa8781..e46ffa316d 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs @@ -27,10 +27,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent TestCase(5, 600, 1), TestCase(15, 100, 3), TestCase(15, 300, 3), - TestCase(15, 600, 2), + TestCase(15, 600, 3), TestCase(40, 100, 6), - TestCase(40, 300, 5), - TestCase(40, 600, 4), + TestCase(40, 300, 6), + TestCase(40, 600, 6), TestCase(70, 100, 6), TestCase(70, 300, 6), TestCase(70, 600, 6), diff --git a/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxPowerSplit.vgbx b/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxPowerSplit.vgbx index c9f9715f90..e6667e5d17 100644 --- a/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxPowerSplit.vgbx +++ b/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxPowerSplit.vgbx @@ -18,19 +18,19 @@ { "Ratio": 1.35, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, { "Ratio": 1.0, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, { "Ratio": 0.73, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, ], @@ -45,6 +45,7 @@ "TorqueConverter": { "Enabled": true, "File": "TorqueConverterPowerSplit.vtcc", + "ShiftPolygon": "AT-Shift.vgbs", "RefRPM": 1000.0, "Inertia": 0.0 }, diff --git a/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxSerialDualTC.vgbx b/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxSerialDualTC.vgbx index bc75d4a29b..350c460237 100644 --- a/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxSerialDualTC.vgbx +++ b/VectoCore/VectoCoreTest/TestData/Components/AT_GBX/GearboxSerialDualTC.vgbx @@ -18,31 +18,31 @@ { "Ratio": 4.35, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, { "Ratio": 2.4, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, { "Ratio": 1.8, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, { "Ratio": 1.3, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" }, { "Ratio": 1.0, "Efficiency": "0.98", - "ShiftPolygon": "<NOFILE>", + "ShiftPolygon": "AT-Shift.vgbs", "FullLoadCurve": "<NOFILE>" } ], @@ -57,6 +57,7 @@ "TorqueConverter": { "Enabled": true, "File": "TorqueConverter.vtcc", + "ShiftPolygon": "AT-Shift.vgbs", "RefRPM": 1000.0, "Inertia": 0.0 }, -- GitLab