diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 9e3a4519dd52c23e702d5c0a92027884275ac481..35d6312985479bde9fc340d951946ff704df380f 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -607,6 +607,12 @@ Public Class Gearbox End Get End Property + public readonly Property MinEngineSpeedPostUpshift as PerSecond Implements IGearshiftEngineeringInputData.MinEngineSpeedPostUpshift + get + Return Nothing + End Get + End Property + Public Overridable ReadOnly Property LoadStageShiftLines As TableData Implements IGearshiftEngineeringInputData.LoadStageShiftLines Get Return Nothing diff --git a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs index 1531d28d0661cae80a7369e0e29fa360325d4db4..e395bdd20ff03db8debcfe05636d61bcab7657bd 100644 --- a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs +++ b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs @@ -285,6 +285,7 @@ namespace TUGraz.VectoCommon.InputData TableData LoadStageShiftLines { get; } IList<double> LoadStageThresoldsUp { get; } IList<double> LoadStageThresoldsDown { get; } + PerSecond MinEngineSpeedPostUpshift { get; } } public interface ITorqueConverterEngineeringShiftParameterInputData diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index 84c37a92970674c80f12ccee6abd3e835f35cce6..a1f3b0d4a6e0ce83717471dc27dad2bebd93f584 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -405,6 +405,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public double? RatioEarlyDownshiftFC { get { return null; } } public int? AllowedGearRangeFC { get { return null; } } + public PerSecond MinEngineSpeedPostUpshift { get { return null; } } + public double? VeloictyDropFactor { get { return null; } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONTCUData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONTCUData.cs index 14fad26e2114a029fc90793671ae6b48ccc4ac11..f37c0ce0cf7ebfbda9fd2616680b696acf095c1b 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONTCUData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONTCUData.cs @@ -290,6 +290,17 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } } + public PerSecond MinEngineSpeedPostUpshift + { + get { + if (Body["MinEngineSpeedPostUpshift"] == null) { + return null; + } + + return Body.GetEx<double>("MinEngineSpeedPostUpshift").RPMtoRad(); + } + } + public TableData LoadStageShiftLines { get { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringGearshiftData.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringGearshiftData.cs index 38265ec2784688a4228ba80a5d388ff9a0288677..59517dec9695dc2724abb2efafbb03a394a0f6eb 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringGearshiftData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringGearshiftData.cs @@ -118,6 +118,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider public double? VeloictyDropFactor { get { return null; } } + public PerSecond MinEngineSpeedPostUpshift { get { return null; } } + public double? AccelerationFactor { get { return null; } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index afbe13ca47c2511bed52b3cacdee84fc294d5adc..d1c477c0bb5098646a468ce08f9055811f92cdaa 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -601,6 +601,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter AllowedGearRangeFC = gbxType.AutomaticTransmission() ? DeclarationData.GearboxTCU.AllowedGearRangeFCAT : DeclarationData.GearboxTCU.AllowedGearRangeFCAMT, VelocityDropFactor = DeclarationData.GearboxTCU.VelocityDropFactor, AccelerationFactor = DeclarationData.GearboxTCU.AccelerationFactor, + MinEngineSpeedPostUpshift = 0.RPMtoRad(), }; return retVal; diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index db9761b38d8cb9b3cb0f234019d2bceb5d96004c..a5a7867cea71246c885d49ef069696a56de41b28 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -460,6 +460,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter AllowedGearRangeFC = gsInputData.AllowedGearRangeFC ?? (gbxType.AutomaticTransmission() ? DeclarationData.GearboxTCU.AllowedGearRangeFCAT : DeclarationData.GearboxTCU.AllowedGearRangeFCAMT), VelocityDropFactor = gsInputData.VeloictyDropFactor ?? DeclarationData.GearboxTCU.VelocityDropFactor, AccelerationFactor = gsInputData.AccelerationFactor ?? DeclarationData.GearboxTCU.AccelerationFactor, + MinEngineSpeedPostUpshift = gsInputData.MinEngineSpeedPostUpshift ?? 0.RPMtoRad(), // voith gs parameters diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs b/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs index 6ce35c267c254d623e95a8bbc4ddb0c5cf22e30d..3a12a652b7dd50739703479686b12b9aa9dcaee9 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs @@ -64,7 +64,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data { public TableData GearshiftLines { get; set; } public IEnumerable<Tuple<double, double>> LoadstageThresholds { get; set; } - - + + public PerSecond MinEngineSpeedPostUpshift { get; set; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs index cfe92505e0a038a73e4ad6e0a3374f83bc192034..08ffb9dd3c2a423830d4afac4ab0e5eb1aa523af 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs @@ -116,7 +116,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent TorqueConverterLocked = tcLocked; } - public uint Gear { get; private set; } + public uint Gear { get; protected internal set; } public bool TorqueConverterLocked { get; private set; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs index 52630e06bbfd5974ad109b6f45c53cecdf0c8320..7181a90b4d41735577b810be6b14b2ff53b932a3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs @@ -26,7 +26,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private SimplePowertrainContainer TestContainer; private Gearbox TestContainerGbx; - //protected readonly VelocityRollingLookup VelocityDropData; + protected readonly VelocityRollingLookup VelocityDropData; private AccelerationCurveData accCurve; private Kilogram vehicleMass; @@ -56,12 +56,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // register pre-processors - //var maxG = runData.Cycle.Entries.Max(x => Math.Abs(x.RoadGradientPercent.Value())) + 1; - //var grad = Convert.ToInt32(maxG / 2) * 2; + var maxG = runData.Cycle.Entries.Max(x => Math.Abs(x.RoadGradientPercent.Value())) + 1; + var grad = Convert.ToInt32(maxG / 2) * 2; + if (grad == 0) { + grad = 2; + } - //VelocityDropData = new VelocityRollingLookup(); - //dataBus.AddPreprocessor( - // new VelocitySpeedGearshiftPreprocessor(VelocityDropData, runData.GearboxData.TractionInterruption, TestContainer, -grad, grad, 2)); + VelocityDropData = new VelocityRollingLookup(); + dataBus.AddPreprocessor( + new VelocitySpeedGearshiftPreprocessor(VelocityDropData, runData.GearboxData.TractionInterruption, TestContainer, -grad, grad, 2)); if (shiftStrategyParameters.AllowedGearRangeFC > 2 || shiftStrategyParameters.AllowedGearRangeFC < 1) { Log.Warn("Gear-range for FC-based gearshift must be either 1 or 2!"); @@ -80,11 +83,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fcUpshiftPossible = true; - //var estimatedVelocityPostShift = VelocityDropData.Interpolate(DataBus.VehicleSpeed, DataBus.RoadGradient); - //var vDrop = DataBus.VehicleSpeed - estimatedVelocityPostShift; - //var vehicleSpeedForGearRating = DataBus.VehicleSpeed - vDrop * shiftStrategyParameters.VelocityDropFactor; + var estimatedVelocityPostShift = VelocityDropData.Interpolate(DataBus.VehicleSpeed, DataBus.RoadGradient ?? 0.SI<Radian>()); + var vDrop = DataBus.VehicleSpeed - estimatedVelocityPostShift; + var vehicleSpeedPostShift = DataBus.VehicleSpeed - vDrop * shiftStrategyParameters.VelocityDropFactor; - var totalTransmissionRatio = DataBus.EngineSpeed / DataBus.VehicleSpeed; + //var totalTransmissionRatio = DataBus.EngineSpeed / DataBus.VehicleSpeed; + var totalTransmissionRatio = outAngularVelocity / DataBus.VehicleSpeed; for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { var tryNextGear = (uint)(currentGear + i); @@ -96,7 +100,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl fcUpshiftPossible = true; - //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedForGearRating, DataBus.DriverAcceleration, tryNextGear); + //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration, tryNextGear); var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, tryNextGear); var inAngularVelocity = ModelData.Gears[tryNextGear].Ratio * outAngularVelocity; @@ -108,6 +112,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } + var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio * ModelData.Gears[tryNextGear].Ratio)).Cast<PerSecond>(); + if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { + continue; + } + + var pNextGearMax = DataBus.EngineStationaryFullPower(estimatedEngineSpeed); + + if (!response.EnginePowerRequest.IsSmaller(pNextGearMax)) { + continue; + } + var fullLoadPower = response.EnginePowerRequest - response.DeltaFullLoad; var reserve = 1 - response.EnginePowerRequest / fullLoadPower; @@ -116,7 +131,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (reserve < ModelData.TorqueReserve /* && reserve > -0.1*/) { //var acc = EstimateAcceleration(outAngularVelocity, outTorque); - //var estimatedEngineSpeed = DataBus.VehicleSpeed * (totalTransmissionRatio / ModelData.Gears[currentGear].Ratio * ModelData.Gears[tryNextGear].Ratio); var accelerationFactor = outAngularVelocity * ModelData.Gears[currentGear].Ratio < fld[0].NTq98hSpeed ? 1.0 : VectoMath.Interpolate( @@ -127,7 +141,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } //var minAcc = VectoMath.Min(DataBus.DriverAcceleration, accCurve.Lookup(DataBus.VehicleSpeed).Acceleration * accelerationFactor); //var minAcc = DataBus.DriverAcceleration * accelerationFactor; - //response = RequestDryRunWithGear(absTime, dt, vehicleSpeedForGearRating, minAcc, tryNextGear); + //response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, minAcc, tryNextGear); var accelerationTorque = vehicleMass * DataBus.DriverAcceleration * DataBus.VehicleSpeed / outAngularVelocity; var reducedTorque = outTorque - accelerationTorque * (1 - accelerationFactor); @@ -265,12 +279,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl responseCurrent.EngineTorqueDemand.LimitTo( fld[currentGear].DragLoadStationaryTorque(responseCurrent.EngineSpeed), fld[currentGear].FullLoadStationaryTorque(responseCurrent.EngineSpeed)) - , responseCurrent.EngineSpeed).Value; + , responseCurrent.EngineSpeed, true).Value; } var fcNext = fcMap.GetFuelConsumption( response.EngineTorqueDemand.LimitTo( fld[tryNextGear].DragLoadStationaryTorque(response.EngineSpeed), - fld[tryNextGear].FullLoadStationaryTorque(response.EngineSpeed)), response.EngineSpeed).Value; + fld[tryNextGear].FullLoadStationaryTorque(response.EngineSpeed)), response.EngineSpeed, true).Value; if (!fcNext.IsSmaller(fcCurrent * shiftStrategyParameters.RatingFactorCurrentGear) || !fcNext.IsSmaller(minFc)) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index 9033c8f017b5f97864456c7db190a4988d5f8806..2525a62dc475b6febf97df4b8861dc400b836e50 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -46,7 +46,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public class ATGearbox : AbstractGearbox<ATGearbox.ATGearboxState> { - private readonly IShiftStrategy _strategy; + protected internal readonly IShiftStrategy _strategy; protected internal readonly TorqueConverter TorqueConverter; private IIdleController _idleController; protected bool RequestAfterGearshift; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs index 8ce84910aeef1703a059655f0f7c9738663823de..cc468e583ce3a408246cae4af1c6c31b1e35f180 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs @@ -109,7 +109,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var currentIdx = GearList.IndexOf(current); var vDrop = DataBus.DriverAcceleration * DeclarationData.Gearbox.PowershiftShiftTime; - var vehicleSpeedForGearRating = DataBus.VehicleSpeed - vDrop * shiftStrategyParameters.VelocityDropFactor; + var vehicleSpeedPostShift = DataBus.VehicleSpeed + vDrop * shiftStrategyParameters.VelocityDropFactor; for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { @@ -128,13 +128,26 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } + var inAngularVelocity = ModelData.Gears[next.Gear].Ratio * outAngularVelocity; + var totalTransmissionRatio = inAngularVelocity / DataBus.VehicleSpeed; + var estimatedEngineSpeed = (vehicleSpeedPostShift * totalTransmissionRatio).Cast<PerSecond>(); + if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { + continue; + } + var pNextGearMax = DataBus.EngineStationaryFullPower(estimatedEngineSpeed); + var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, next); - //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedForGearRating, DataBus.DriverAcceleration, next); + //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration, next); - var inAngularVelocity = ModelData.Gears[next.Gear].Ratio * outAngularVelocity; + if (!response.EnginePowerRequest.IsSmaller(pNextGearMax)) { + continue; + } + var inTorque = response.EnginePowerRequest / inAngularVelocity; + + // if next gear supplied enough power reserve: take it // otherwise take if (ModelData.Gears[next.Gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inAngularVelocity)) { @@ -157,6 +170,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var reducedTorque = outTorque - accelerationTorque * (1 - accelerationFactor); response = RequestDryRunWithGear(absTime, dt, reducedTorque, outAngularVelocity, next); + //response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration * accelerationFactor, next); fullLoadPower = response.EnginePowerRequest - response.DeltaFullLoad; reserve = 1 - response.EnginePowerRequest / fullLoadPower; if (reserve < ModelData.TorqueReserve) { @@ -249,12 +263,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl responseCurrent.EngineTorqueDemand.LimitTo( fld[currentGear].DragLoadStationaryTorque(responseCurrent.EngineSpeed), fld[currentGear].FullLoadStationaryTorque(responseCurrent.EngineSpeed)) - , responseCurrent.EngineSpeed).Value; + , responseCurrent.EngineSpeed, true).Value; } var fcNext = fcMap.GetFuelConsumption( response.EngineTorqueDemand.LimitTo( fld[next.Gear].DragLoadStationaryTorque(response.EngineSpeed), - fld[next.Gear].FullLoadStationaryTorque(response.EngineSpeed)), response.EngineSpeed).Value; + fld[next.Gear].FullLoadStationaryTorque(response.EngineSpeed)), response.EngineSpeed, true).Value; if (fcNext.IsSmaller(fcCurrent * shiftStrategyParameters.RatingFactorCurrentGear) && fcNext.IsSmaller(minFc)) { minFcGear = next; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index b7f78b120689e631f2cd066bdcfb727feea2a442..cc2bcf0066e553aca7a97ed3ba5d4e63eacd5201 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected readonly IDriverStrategy DriverStrategy; - public DrivingAction DrivingAction { get; private set; } + public DrivingAction DrivingAction { get; protected internal set; } public Driver(IVehicleContainer container, DriverData driverData, IDriverStrategy strategy) : base(container) { diff --git a/VectoCore/VectoCoreTest/Integration/AMTShiftStrategyTests.cs b/VectoCore/VectoCoreTest/Integration/AMTShiftStrategyTests.cs index 69b85edc1a554a3d108f2292637df436644021db..5aaa46c744751d9c962ff413f8fbd7fa19cc0c16 100644 --- a/VectoCore/VectoCoreTest/Integration/AMTShiftStrategyTests.cs +++ b/VectoCore/VectoCoreTest/Integration/AMTShiftStrategyTests.cs @@ -29,6 +29,15 @@ namespace TUGraz.VectoCore.Tests.Integration } + + [TestCase()] + public void VECTO_EffShift() + { + var jobName = + @"E:\QUAM\tmp\1a_EffShift_high-engine-rev_UD-cycle_LH-tractor_model\vecto_tractor_4x2_overdr_EffShift-def.vecto"; + RunJob_DeclSingle(jobName, 9); + } + [TestCase(@"E:\QUAM\tmp\AMT_ShiftStrategyNeu\VOLVO_AxleLossMapExtrapolation\Class5_TUG_Vehicle_VOLVO.xml", 5)] public void RunJob_DeclSingle(string jobName, int runIdx) { diff --git a/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs b/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs index 9a5882e8d7ac1999b168839bc39c12c23b92c777..b0621914d581aebcba5234717ab46eae5a25edfc 100644 --- a/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs +++ b/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs @@ -40,10 +40,14 @@ using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Models.Simulation; using TUGraz.VectoCore.Tests.Utils; +using System.Collections.Generic; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; namespace TUGraz.VectoCore.Tests.Integration.ShiftStrategy { @@ -104,5 +108,51 @@ namespace TUGraz.VectoCore.Tests.Integration.ShiftStrategy GraphWriter.Write(modFile); } + [TestCase()] + public void TestGearshiftTrigger() + { + var amtTestcase = @"E:\QUAM\tmp\AT_Vdrop\AMT_normal\MB_Citaro_G_MP156_ZF_Sort.vecto"; + var atTestcase = @"E:\QUAM\tmp\AT_Vdrop\AT_normal\MB_Citaro_G_MP156_ZF_Sort.vecto"; + + + var relativeJobPath = amtTestcase; + var writer = new FileOutputWriter(Path.Combine(Path.GetDirectoryName(relativeJobPath), "tmp", Path.GetFileName(relativeJobPath))); + var inputData = JSONInputDataFactory.ReadJsonJob(relativeJobPath); + var factory = new SimulatorFactory(ExecutionMode.Engineering, inputData, writer) { + WriteModalResults = true, + //ActualModalData = true, + Validate = false + }; + var jobContainer = new JobContainer(new MockSumWriter()); + var runs = factory.SimulationRuns().ToArray(); + var run = runs[0]; + + var container = run.GetContainer() as VehicleContainer; + var vehicle = container?.Vehicle as Vehicle; + + Assert.NotNull(container); + Assert.NotNull(vehicle); + + foreach (var preprocessor in container.Preprocessors) { + preprocessor.RunPreprocessing(); + } + + var decision = new List<Tuple<double, bool>>(); + for (var v = 10.0; v < 20; v += 0.1) { + vehicle.Initialize(v.KMPHtoMeterPerSecond(), 0.SI<Radian>()); + container.AbsTime = 0.SI<Second>(); + (container.Gearbox as Gearbox).Gear = 2; + //(container.Gearbox as ATGearbox)._strategy.NextGear.Gear = 0; + (container.Driver as Driver).DrivingAction = DrivingAction.Accelerate; + (container.Driver as Driver).DriverBehavior = DrivingBehavior.Accelerating; + var response = vehicle.Request( + 0.SI<Second>(), 0.5.SI<Second>(), 0.5.SI<MeterPerSquareSecond>(), 0.SI<Radian>(), false); + decision.Add(Tuple.Create(v, response is ResponseGearShift /* || (container.Gearbox as ATGearbox)._strategy.NextGear.Gear > 2) */)); + } + + foreach (var tuple in decision) { + Console.WriteLine("{0}: {1}", tuple.Item1, tuple.Item2 ? "1" : "0"); + } + } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 10f07d3ba4af5067ccef020e877975aa8cb61520..316aedef34f71c2bf5ecfbed42ddb0a7abd26842 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -2021,123 +2021,6 @@ <None Include="TestData\Integration\FullPowerTrain\unlimited.vacc"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\5_ms2.vacc"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\AccelerationReserveLookup.csv"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Acc_TUG.vacc"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Acc_ZF.vacc"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\HeavyUrban.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Interurban.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\MB_Citaro_G_MP156_HUB_UB_SUB.vveh"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\MB_Citaro_G_MP156_IUB.vveh"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\MB_Citaro_G_MP156_Sort.vveh"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\MB_Citaro_G_MP156_ZF_HUB_UB_SUB.vecto"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\MB_Citaro_G_MP156_ZF_IUB.vecto"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\MB_Citaro_G_MP156_ZF_Sort.vecto"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\OM470EU6_265kW_1700Nm_MP156_Engine.veng"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\OM470EU6_265kW_1700Nm_MP156_Fullload.vfld"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\OM470EU6_MP156_FCmap_komplett.vmap"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\PredictionTimeLookup.csv"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ShareEngineSpeedHigh.csv"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ShareIdleLow.csv"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ShareTq99L.csv"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ShiftParameters.vtcu"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Shift_tc.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Shift_V2_gear 1.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Shift_V2_gear 2.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Shift_V2_gear 3.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Shift_V2_gear 4.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Shift_V2_gear 5.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\SORT1_target_speed.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\SORT2_target_speed.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\SORT3_target_speed.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Suburban.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\Urban.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_1.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_2.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_3.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_4.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_5.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_6.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_EcoLife_1700_SN2837.vgbx"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Integration\ShiftStrategyV2\FC-Based_AT_TUG\ZF_EcoLife_1700_SN2837.vtcc"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="TestData\Integration\TotalMassExceededInMU\325kW.vfld"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>