From 1fc09598aed9b1a2bee01dbb79dab1e04f453310 Mon Sep 17 00:00:00 2001 From: Stefanos Doumpoulakis <dubulak@gmail.com> Date: Wed, 8 Mar 2023 13:50:04 +0200 Subject: [PATCH] bugfix: TC info for all gears --- .../EngineeringDataAdapter.cs | 30 ++- .../EngineeringModeVectoRunDataFactory.cs | 19 +- .../Integration/TorqueConverterTest.cs | 43 +++++ .../CityBus_AT_Ser-TC_all_gears.vecto | 44 +++++ ...s_P44_Sort2_with_gear_TCinv_grade_1Hz.vdri | 172 ++++++++++++++++++ 5 files changed, 290 insertions(+), 18 deletions(-) create mode 100644 VectoCore/VectoCoreTest/Integration/TorqueConverterTest.cs create mode 100644 VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/CityBus_AT_Ser-TC_all_gears.vecto create mode 100644 VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/Mss_P44_Sort2_with_gear_TCinv_grade_1Hz.vdri diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index cc5641aa7a..0f652842d6 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -371,7 +371,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter LossMap = lossMap, }; - CreateATGearData(retVal.Type, i, gearData, tcShiftPolygon, gearDifferenceRatio, gears, vehicleCategory); + CreateATGearData(retVal.Type, i, gearData, tcShiftPolygon, gearDifferenceRatio, gears, vehicleCategory, runData.Cycle); gears.Add(i + 1, gearData); } @@ -404,7 +404,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter protected virtual void CreateATGearData( GearboxType gearboxType, uint i, GearData gearData, ShiftPolygon tcShiftPolygon, double gearDifferenceRatio, Dictionary<uint, GearData> gears, - VehicleCategory vehicleCategory) + VehicleCategory vehicleCategory, IDrivingCycleData cycle) { if (gearboxType == GearboxType.ATPowerSplit && i == 0) { // powersplit transmission: torque converter already contains ratio and losses @@ -415,14 +415,24 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter // torqueconverter is active in first gear - duplicate ratio and lossmap for torque converter mode CreateTCFirstGearATSerial(gearData, tcShiftPolygon); } - if (i == 1 && gearDifferenceRatio >= DeclarationData.Gearbox.TorqueConverterSecondGearThreshold(vehicleCategory)) { - // ratio between first and second gear is above threshold, torqueconverter is active in second gear as well - // -> duplicate ratio and lossmap for torque converter mode, remove locked transmission for previous gear - CreateTCSecondGearATSerial(gearData, tcShiftPolygon); - - // NOTE: the lower gear in 'gears' dictionary has index i !! - gears[i].Ratio = double.NaN; - gears[i].LossMap = null; + if (i == 1) { + if ((cycle != null) && ((cycle.CycleType == CycleType.MeasuredSpeedGear) || (cycle.CycleType == CycleType.VTP))) { + CreateTCSecondGearATSerial(gearData, tcShiftPolygon); + } + else if (gearDifferenceRatio >= DeclarationData.Gearbox.TorqueConverterSecondGearThreshold(vehicleCategory)) { + // ratio between first and second gear is above threshold, torqueconverter is active in second gear as well + // -> duplicate ratio and lossmap for torque converter mode, remove locked transmission for previous gear + CreateTCSecondGearATSerial(gearData, tcShiftPolygon); + + // NOTE: the lower gear in 'gears' dictionary has index i !! + gears[i].Ratio = double.NaN; + gears[i].LossMap = null; + } + } + else { + if ((cycle != null) && ((cycle.CycleType == CycleType.MeasuredSpeedGear) || (cycle.CycleType == CycleType.VTP))) { + CreateTCSecondGearATSerial(gearData, tcShiftPolygon); + } } } } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs index 17625e4109..4f98504df4 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs @@ -514,7 +514,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl if (InputDataProvider.JobInputData.JobType != VectoSimulationJobType.ConventionalVehicle) { driver.EngineStopStart.UtilityFactorDriving = 1; } - + var vehicle = InputDataProvider.JobInputData.Vehicle; var engineData = dao.CreateEngineData(vehicle, engineMode); engineData.FuelMode = modeIdx; @@ -528,15 +528,21 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl } }; var tmpStrategy = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData)); + + var crossWindRequired = vehicle.Components.AirdragInputData.CrossWindCorrectionMode == + CrossWindCorrectionMode.VAirBetaLookupTable; + + var drivingCycle = GetDrivingCycle(cycle, crossWindRequired); + var drivingCycleProxy = new DrivingCycleProxy(drivingCycle, cycle.Name); + var gearboxData = dao.CreateGearboxData( InputDataProvider, new VectoRunData() { EngineData = engineData, VehicleData = tempVehicle, - AxleGearData = axlegearData + AxleGearData = axlegearData, + Cycle = drivingCycleProxy }, tmpStrategy); - var crossWindRequired = vehicle.Components.AirdragInputData.CrossWindCorrectionMode == - CrossWindCorrectionMode.VAirBetaLookupTable; var angledriveData = dao.CreateAngledriveData(vehicle.Components.AngledriveInputData); var ptoTransmissionData = dao.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData); @@ -561,9 +567,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl "PTO During Drive", false) : null; - - var drivingCycle = GetDrivingCycle(cycle, crossWindRequired); - var battery = dao.CreateBatteryData(vehicle.Components.ElectricStorage, vehicle.InitialSOC); var superCap = dao.CreateSuperCapData(vehicle.Components.ElectricStorage, vehicle.InitialSOC); var averageVoltage = battery != null ? CalculateAverageVoltage(battery): null; @@ -617,7 +620,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl dao.CreateBusAuxiliariesData(vehicle.Components.AuxiliaryInputData, vehicleData, jobType), Retarder = dao.CreateRetarderData(vehicle.Components.RetarderInputData, powertrainPosition), PTO = ptoTransmissionData, - Cycle = new DrivingCycleProxy(drivingCycle, cycle.Name), + Cycle = drivingCycleProxy, ExecutionMode = ExecutionMode.Engineering, PTOCycleWhileDrive = ptoCycleWhileDrive, diff --git a/VectoCore/VectoCoreTest/Integration/TorqueConverterTest.cs b/VectoCore/VectoCoreTest/Integration/TorqueConverterTest.cs new file mode 100644 index 0000000000..8fc56b61b3 --- /dev/null +++ b/VectoCore/VectoCoreTest/Integration/TorqueConverterTest.cs @@ -0,0 +1,43 @@ +using NUnit.Framework; +using System; +using System.IO; +using System.Linq; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory; +using TUGraz.VectoCore.OutputData; +using TUGraz.VectoCore.OutputData.FileIO; + +namespace TUGraz.VectoCore.Tests.Integration +{ + [TestFixture] + [Parallelizable(ParallelScope.All)] + public class TorqueConverterTest + { + public const String P1SerialJob = @"TestData/Integration/EngineeringMode/CityBus_AT/CityBus_AT_Ser-TC_all_gears.vecto"; + + [OneTimeSetUp] + public void Init() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } + + [Category("Integration")] + [ + TestCase(P1SerialJob, 0, TestName = "Torque Converter active for all gears") + ] + public void RunCycle(string jobFile, int cycleIdx) + { + var inputProvider = JSONInputDataFactory.ReadJsonJob(jobFile); + + var writer = new FileOutputWriter(jobFile); + + var factory = new SimulatorFactoryEngineering(inputProvider, writer, false) { WriteModalResults = false }; + factory.SumData = new SummaryDataContainer(writer); + + var run = factory.SimulationRuns().ToArray()[cycleIdx]; + run.Run(); + + Assert.IsTrue(run.FinishedWithoutErrors); + } + } +} diff --git a/VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/CityBus_AT_Ser-TC_all_gears.vecto b/VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/CityBus_AT_Ser-TC_all_gears.vecto new file mode 100644 index 0000000000..c7eab35797 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/CityBus_AT_Ser-TC_all_gears.vecto @@ -0,0 +1,44 @@ +{ + "Header": { + "CreatedBy": " ()", + "Date": "2016-10-13T10:06:19.6886564Z", + "AppVersion": "3", + "FileVersion": 3 + }, + "Body": { + "SavedInDeclMode": false, + "EngineOnlyMode": false, + "VehicleFile": "CityBus_AT_Ser.vveh", + "EngineFile": "Engine_175kW_6.8l.veng", + "GearboxFile": "GearboxSerial.vgbx", + "AuxiliaryAssembly": "Classic", + "AuxiliaryVersion": "CLASSIC", + "AdvancedAuxiliaryFilePath": "", + "Aux": [], + "Padd": 3540.0, + "VACC": "Driver.vacc", + "StartStop": { + "Enabled": false, + "MaxSpeed": 5.0, + "MinTime": 5.0, + "Delay": 5.0 + }, + "LAC": { + "Enabled": true, + "PreviewDistanceFactor": 10.0, + "DF_offset": 2.5, + "DF_scaling": 1.5, + "DF_targetSpeedLookup": "", + "Df_velocityDropLookup": "" + }, + "OverSpeedEcoRoll": { + "Mode": "Off", + "MinSpeed": 50.0, + "OverSpeed": 5.0, + "UnderSpeed": 5.0 + }, + "Cycles": [ + "Mss_P44_Sort2_with_gear_TCinv_grade_1Hz.vdri" + ] + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/Mss_P44_Sort2_with_gear_TCinv_grade_1Hz.vdri b/VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/Mss_P44_Sort2_with_gear_TCinv_grade_1Hz.vdri new file mode 100644 index 0000000000..eef4b31102 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/EngineeringMode/CityBus_AT/Mss_P44_Sort2_with_gear_TCinv_grade_1Hz.vdri @@ -0,0 +1,172 @@ +t [s], v [km/h], gear [-], tc_active [-], grad [%] +0,0,0,1,0 +1,0,0,1,0 +2,0,0,1,0 +3,0,1,1,0 +4,0,1,1,0 +5,2.8125,1,1,0 +6,9.4609375,1,0,0 +7,13.007813,1,0,0 +8,17.289063,2,0,0 +9,19.960938,3,0,0 +10,19.46875,3,0,0 +11,19.582031,3,0,0 +12,19.75,3,0,0 +13,19.902344,3,0,0 +14,20.007813,3,0,0 +15,20.078125,3,0,0 +16,20.136719,3,0,0 +17,19.996094,3,0,0 +18,19.925781,3,0,0 +19,19.867188,3,0,0 +20,20.039063,3,0,0 +21,19.300781,3,0,0 +22,18.167969,3,0,0 +23,15.082031,2,0,0 +24,11.050781,2,1,0 +25,8.8984375,2,1,0 +26,6.9257813,2,1,0 +27,3.0273438,2,1,0 +28,0.2734375,2,1,0 +29,0,1,1,0 +30,0,1,1,0 +31,0,1,1,0 +32,0,1,1,0 +33,0,1,1,0 +34,0,1,1,0 +35,0,1,1,0 +36,0,1,1,0 +37,0,1,1,0 +38,0,1,1,0 +39,0,1,1,0 +40,0,1,1,0 +41,0,1,1,0 +42,0,1,1,0 +43,0,1,1,0 +44,0,1,1,0 +45,0,1,1,0 +46,0,1,1,0 +47,0,1,1,0 +48,0,1,1,0 +49,3.3320313,1,1,0 +50,9.8632813,1,0,0 +51,13.492188,1,0,0 +52,17.808594,2,0,0 +53,21.421875,3,0,0 +54,24.824219,3,0,0 +55,27.335938,4,0,0 +56,29.886719,4,0,0 +57,32.390625,4,0,0 +58,34.71875,4,0,0 +59,36.996094,4,0,0 +60,38.859375,4,0,0 +61,40.625,5,0,0 +62,40.265625,5,0,0 +63,40.300781,5,0,0 +64,40.40625,5,0,0 +65,40.492188,5,0,0 +66,40.292969,5,0,0 +67,39.753906,5,0,0 +68,38.691406,5,0,0 +69,36.8125,4,0,0 +70,33.726563,4,0,0 +71,30.296875,4,0,0 +72,27.328125,3,0,0 +73,23.125,3,0,0 +74,17.0625,3,0,0 +75,10.375,2,1,0 +76,4.90625,2,1,0 +77,0.5546875,2,1,0 +78,0,1,1,0 +79,0,1,1,0 +80,0,1,1,0 +81,0,1,1,0 +82,0,1,1,0 +83,0,1,1,0 +84,0,1,1,0 +85,0,1,1,0 +86,0,1,1,0 +87,0,1,1,0 +88,0,1,1,0 +89,0,1,1,0 +90,0,1,1,0 +91,0,1,1,0 +92,0,1,1,0 +93,0,1,1,0 +94,0,1,1,0 +95,0,1,1,0 +96,0,1,1,0 +97,0,1,1,0 +98,3.3789063,1,1,0 +99,9.5664063,1,0,0 +100,13.148438,1,0,0 +101,17.703125,2,0,0 +102,21.402344,2,0,0 +103,24.707031,3,0,0 +104,27.222656,4,0,0 +105,29.726563,4,0,0 +106,32.207031,4,0,0 +107,34.558594,4,0,0 +108,36.84375,4,0,0 +109,38.683594,4,0,0 +110,40.429688,5,0,0 +111,42.085938,5,0,0 +112,43.710938,5,0,0 +113,45.363281,5,0,0 +114,46.855469,5,0,0 +115,48.246094,6,0,0 +116,49.625,6,0,0 +117,50.820313,6,0,0 +118,51.214844,6,0,0 +119,50.582031,6,1,0 +120,50.144531,5,1,0 +121,50.230469,5,0,0 +122,50.273438,5,0,0 +123,50.308594,5,0,0 +124,50.308594,5,0,0 +125,50.414063,6,0,0 +126,50.511719,6,0,0 +127,50.59375,6,0,0 +128,50.617188,6,0,0 +129,50.441406,6,0,0 +130,50.40625,6,0,0 +131,50.300781,6,0,0 +132,50.1875,6,0,0 +133,50.273438,6,0,0 +134,50.230469,6,0,0 +135,50.285156,6,0,0 +136,50.203125,6,0,0 +137,50.179688,6,0,0 +138,50.171875,6,0,0 +139,49.632813,6,0,0 +140,49.089844,6,0,0 +141,48.5,6,1,0 +142,47.769531,6,1,0 +143,45.601563,5,0,0 +144,41.222656,5,0,0 +145,37.300781,4,0,0 +146,33.363281,4,0,0 +147,28.441406,3,0,0 +148,23.433594,3,0,0 +149,16.535156,3,0,0 +150,9.3359375,2,1,0 +151,3.1289063,2,1,0 +152,0,2,1,0 +153,0,1,1,0 +154,0,1,1,0 +155,0,1,1,0 +156,0,0,1,0 +157,0,0,1,0 +158,0,0,1,0 +159,0,0,1,0 +160,0,0,1,0 +161,0,0,1,0 +162,0,0,1,0 +163,0,0,1,0 +164,0,0,1,0 +165,0,0,1,0 +166,0,0,1,0 +167,0,0,1,0 +168,0,0,1,0 +169,0,0,1,0 +170,0,0,1,0 \ No newline at end of file -- GitLab