diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/GearBoxDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/GearBoxDataAdapter.cs index 395bd92c7d526a7d4ed1b4a74f8ca5d65020295b..f46191b1a10dfd8f3a6f8e3a757452beb817a589 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/GearBoxDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/GearBoxDataAdapter.cs @@ -376,9 +376,25 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen gearsInput, engine, axlegearRatio, dynamicTyreRadius, runData.ElectricMachinesData?.FirstOrDefault()?.Item2); + ShiftPolygon extendedShiftPolygon = null; + if (gearbox.Type == GearboxType.MT) + { + extendedShiftPolygon = shiftPolygonCalculator != null + ? shiftPolygonCalculator.ComputeDeclarationExtendedShiftPolygon( + gearbox.Type, (int)i, engine?.FullLoadCurves[i + 1], gearbox.Gears, engine, axlegearRatio, + dynamicTyreRadius, runData.ElectricMachinesData?.FirstOrDefault()?.Item2) + : DeclarationData.Gearbox.ComputeManualTransmissionShiftPolygonExtended( + (int)i, engine?.FullLoadCurves[i + 1], + gearsInput, + engine, + axlegearRatio, + dynamicTyreRadius); + } + var gearData = new GearData { ShiftPolygon = shiftPolygon, + ExtendedShiftPolygon = extendedShiftPolygon, MaxSpeed = gear.MaxInputSpeed, MaxTorque = gear.MaxTorque, Ratio = gear.Ratio, diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 20ae30bec0c6406ab15da8548d25fb55325c5bc7..4ccd958b5e272e62247246d99037d8ebc197a591 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -58,6 +58,7 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricComponents.Batter using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.OutputData; using Point = TUGraz.VectoCommon.Utils.Point; +using System.Diagnostics; namespace TUGraz.VectoCore.Models.Declaration { @@ -1308,12 +1309,12 @@ namespace TUGraz.VectoCore.Models.Declaration return new ShiftPolygon(downShift, upShift); } - public static ShiftPolygon ComputeManualTransmissionShiftPolygon( int gearIdx, EngineFullLoadCurve fullLoadCurve, IList<ITransmissionInputData> gears, CombustionEngineData engine, double axlegearRatio, Meter dynamicTyreRadius) { - if (gears.Count < 2) { + if (gears.Count < 2) + { throw new VectoException("ComputeShiftPolygon needs at least 2 gears. {0} gears given.", gears.Count); } @@ -1324,10 +1325,42 @@ namespace TUGraz.VectoCore.Models.Declaration var diffRatio = gears[gears.Count - 2].Ratio / gears[gears.Count - 1].Ratio - 1; - var maxDragTorque = fullLoadCurve.MaxDragTorque * 1.1; + var p1 = new Point(engine.IdleSpeed.Value() / 2, 0); + var p2 = new Point(engine.IdleSpeed.Value() * 1.1, 0); + var p3 = new Point( + nVHigh.Value() * 0.9, + fullLoadCurve.FullLoadStationaryTorque(nVHigh * 0.9).Value()); + + var p4 = new Point((nVHigh * (1 + diffRatio / 3)).Value(), 0); + var p5 = new Point(fullLoadCurve.N95hSpeed.Value(), fullLoadCurve.MaxTorque.Value()); + + var p6 = new Point(p2.X, VectoMath.Interpolate(p1, p3, p2.X)); + var p7 = new Point(p4.X, VectoMath.Interpolate(p2, p5, p4.X)); + + return ComputeManualTransmissionShiftPolygonBase(gearIdx, fullLoadCurve, gears, p2, p3, p4, p5, p6, p7); + } + + public static ShiftPolygon ComputeManualTransmissionShiftPolygonExtended( + int gearIdx, + EngineFullLoadCurve fullLoadCurve, + IList<ITransmissionInputData> gears, + CombustionEngineData engine, + double axlegearRatio, + Meter dynamicTyreRadius) + { + if (gears.Count < 2) + { + throw new VectoException("ComputeShiftPolygon needs at least 2 gears. {0} gears given.", gears.Count); + } + + // ReSharper disable once InconsistentNaming + var engineSpeed85kmhLastGear = ComputeEngineSpeed85kmh(gears[gears.Count - 1], axlegearRatio, dynamicTyreRadius); + var nVHigh = VectoMath.Min(engineSpeed85kmhLastGear, engine.FullLoadCurves[0].RatedSpeed); + var diffRatio = gears[gears.Count - 2].Ratio / gears[gears.Count - 1].Ratio - 1; var p1 = new Point(engine.IdleSpeed.Value() / 2, 0); var p2 = new Point(engine.IdleSpeed.Value() * 1.1, 0); + var p3 = new Point( nVHigh.Value() * 0.9, fullLoadCurve.FullLoadStationaryTorque(nVHigh * 0.9).Value()); @@ -1338,11 +1371,28 @@ namespace TUGraz.VectoCore.Models.Declaration var p6 = new Point(p2.X, VectoMath.Interpolate(p1, p3, p2.X)); var p7 = new Point(p4.X, VectoMath.Interpolate(p2, p5, p4.X)); + /// Increase the torque at P6 by 20% and create a new extended shift polygon. + var extendedRatio = 0.20; + var p6YOffset = extendedRatio * p6.Y; + var p3Extended = new Point(p3.X, p3.Y + p6YOffset); + var p6Extended = new Point(p6.X, p6.Y + p6YOffset); + + return ComputeManualTransmissionShiftPolygonBase(gearIdx, fullLoadCurve, gears, p2, p3Extended, p4, p5, p6Extended, p7); + } + + private static ShiftPolygon ComputeManualTransmissionShiftPolygonBase( + int gearIdx, + EngineFullLoadCurve fullLoadCurve, + IList<ITransmissionInputData> gears, + Point p2, Point p3, Point p4, Point p5, Point p6, Point p7) + { + var maxDragTorque = fullLoadCurve.MaxDragTorque * 1.1; var fldMargin = ShiftPolygonFldMargin(fullLoadCurve.FullLoadEntries, (p3.X * 0.95).SI<PerSecond>()); var downshiftCorr = MoveDownshiftBelowFld(Edge.Create(p6, p3), fldMargin, 1.1 * fullLoadCurve.MaxTorque); var downShift = new List<ShiftPolygon.ShiftPolygonEntry>(); - if (gearIdx > 0) { + if (gearIdx > 0) + { downShift = new[] { p2, downshiftCorr.P1, downshiftCorr.P2 }.Select( point => new ShiftPolygon.ShiftPolygonEntry(point.Y.SI<NewtonMeter>(), point.X.SI<PerSecond>())) @@ -1351,7 +1401,8 @@ namespace TUGraz.VectoCore.Models.Declaration downShift[0].Torque = maxDragTorque; } var upShift = new List<ShiftPolygon.ShiftPolygonEntry>(); - if (gearIdx >= gears.Count - 1) { + if (gearIdx >= gears.Count - 1) + { return new ShiftPolygon(downShift, upShift); } @@ -1368,7 +1419,8 @@ namespace TUGraz.VectoCore.Models.Declaration // ReSharper restore InconsistentNaming var upShiftPts = IntersectTakeHigherShiftLine(new[] { p4, p7, p5 }, new[] { p2p, p6p, p3pExt }); - if (gears[gearIdx].MaxInputSpeed != null) { + if (gears[gearIdx].MaxInputSpeed != null) + { var maxSpeed = gears[gearIdx].MaxInputSpeed.Value(); upShiftPts = IntersectTakeLowerShiftLine( upShiftPts, @@ -1378,6 +1430,7 @@ namespace TUGraz.VectoCore.Models.Declaration upShiftPts.Select(point => new ShiftPolygon.ShiftPolygonEntry(point.Y.SI<NewtonMeter>(), point.X.SI<PerSecond>())) .ToList(); upShift[0].Torque = maxDragTorque; + return new ShiftPolygon(downShift, upShift); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs index ab50ed030df4b5664c7dfec8d57304e3751468cf..8de3f175e5fdf440fc7f713d410d8405d86ad772 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs @@ -273,13 +273,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine public PerSecond MaxSpeed => FullLoadEntries.MaxBy(e => e.EngineSpeed).EngineSpeed; - public PerSecond NTq99hSpeed => _nTq99hSpeed ?? (_nTq99hSpeed = FindEnginSpeedForTorque(0.99 * MaxTorque).Last()); + public PerSecond NTq99hSpeed => _nTq99hSpeed ?? (_nTq99hSpeed = FindEngineSpeedForTorque(0.99 * MaxTorque).Last()); - public PerSecond NTq99lSpeed => _nTq99lSpeed ?? (_nTq99lSpeed = FindEnginSpeedForTorque(0.99 * MaxTorque).First()); + public PerSecond NTq99lSpeed => _nTq99lSpeed ?? (_nTq99lSpeed = FindEngineSpeedForTorque(0.99 * MaxTorque).First()); public PerSecond NP99hSpeed => _nP99hSpeed ?? (_nP99hSpeed = ComputeNP99HSpeed()); - public PerSecond NTq98hSpeed => _nTq98hSpeed ?? (_nTq98hSpeed = FindEnginSpeedForTorque(0.98 * MaxTorque).Last()); + public PerSecond NTq98hSpeed => _nTq98hSpeed ?? (_nTq98hSpeed = FindEngineSpeedForTorque(0.98 * MaxTorque).Last()); public PerSecond NP98hSpeed => _nP98hSpeed ?? (_nP98hSpeed = ComputeNP98HSpeed()); @@ -360,11 +360,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine return retVal.First(x => x.IsBetween(p1.EngineSpeed, p2.EngineSpeed)).SI<PerSecond>(); } - private List<PerSecond> FindEnginSpeedForTorque(NewtonMeter torque) + private List<PerSecond> FindEngineSpeedForTorque(NewtonMeter torque) { var retVal = new List<PerSecond>(); foreach (var pair in FullLoadEntries.Pairwise(Tuple.Create)) { - var solution = FindEnginSpeedForTorque(pair.Item1, pair.Item2, torque); + var solution = FindEngineSpeedForTorque(pair.Item1, pair.Item2, torque); if (solution != null) { retVal.Add(solution); } @@ -373,7 +373,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine return retVal.Distinct(new SI.EqualityComparer<PerSecond>()).ToList(); } - private PerSecond FindEnginSpeedForTorque(FullLoadCurveEntry p1, FullLoadCurveEntry p2, NewtonMeter torque) + private PerSecond FindEngineSpeedForTorque(FullLoadCurveEntry p1, FullLoadCurveEntry p2, NewtonMeter torque) { if (p1.TorqueFullLoad.IsEqual(p2.TorqueFullLoad) && p1.TorqueFullLoad.IsEqual(torque)) { // horizontal line in FLD that equals requested torque diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs index 193add57691e876070d90db5f55f118c5cda1c84..75bcdde72ad2b77e8c32f7184e19309322fb0716 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs @@ -61,6 +61,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox [ValidateObject] public ShiftPolygon ShiftPolygon { get; internal set; } + public ShiftPolygon ExtendedShiftPolygon { get; internal set; } + public double TorqueConverterRatio { get; internal set; } public TransmissionLossMap TorqueConverterGearLossMap { get; internal set; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs index 29c5063ec40bbb23166b8ef296c50b7b4c5f6fa7..d0876dfb8e4fd56950d2ca2e70e254d05459091e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs @@ -116,6 +116,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null); + + ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, + Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null); } // public class GearInfo diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index 52fca738b1c6e9fe31e69391319fda500a9d6d66..a7a26138a5f2893c4cdd0fcb4f82f6bdd200df85 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -617,6 +617,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { return null; } + + public override ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null) + { + return null; + } } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs index cd8ef7a898661ff95adc0af1375a45a4967c9cca..6d49783a4723a5d0b2150e717720d5f51bf4f784 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs @@ -417,6 +417,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius); } + public override ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + return DeclarationData.Gearbox.ComputeManualTransmissionShiftPolygonExtended( + i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius); + } + protected override bool DoCheckShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, GearshiftPosition gear, Second lastShiftTime, IResponse response) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategy.cs index 5bab4a423b21d3d95b3e204b3610b98c3cf0b362..e142e9deb5e684b1fc72a91a61f15346fb16ffee 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategy.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Collections.Generic; using System.Linq; using TUGraz.VectoCommon.InputData; @@ -58,6 +59,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return DeclarationData.Gearbox.ComputeManualTransmissionShiftPolygon( i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius); } + + public ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null) + { + return DeclarationData.Gearbox.ComputeManualTransmissionShiftPolygonExtended( + i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius); + } } /// <summary> @@ -129,6 +138,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius, electricMotorData); } + public override ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null) + { + throw new NotImplementedException("Not applicable to AMT Gearbox."); + } + public static string Name => "AMT - Classic"; public override GearshiftPosition Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategyOptimized.cs index 95d5d075a83f2b226e7848d8c990a1b98d4b695f..d4018cb659930e10543510fa8466361ab264efe6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/AMTShiftStrategyOptimized.cs @@ -29,6 +29,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //return DeclarationData.Gearbox.ComputeManualTransmissionShiftPolygon( // i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius); } + + public ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + throw new NotImplementedException("Not applicable to AMT Gearbox."); + } } public class AMTShiftStrategyOptimized : AMTShiftStrategy { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategy.cs index 94dc120c21a8c6bdee90fafee8ffaac091eb9cec..59d60bc0c8d2963b696c1b5f226312bed149f8ba 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategy.cs @@ -50,6 +50,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies { public class ATShiftStrategyPolygonCalculator : IShiftPolygonCalculator { + public ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + throw new System.NotImplementedException(); + } + public ShiftPolygon ComputeDeclarationShiftPolygon( GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, @@ -89,6 +102,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies gearboxGears, engineData, axlegearRatio, dynamicTyreRadius, electricMotorData); } + public override ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + throw new System.NotImplementedException("Not applicable to AT Gearbox."); + } + + public static string Name => "AT - Classic"; public ATShiftStrategy(IVehicleContainer dataBus) : base(dataBus) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategyOptimized.cs index e9323a0875875d4743f425030b1f44efe0b361c9..28ab03bafc903ed84110cbc787d4810598644ee7 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ATShiftStrategyOptimized.cs @@ -44,6 +44,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies return new ShiftPolygon(shiftLine.Downshift.ToList(), upshift); } + public ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + throw new NotImplementedException("Not applicable to AT transmissions."); + } + } public class ATShiftStrategyOptimized : ATShiftStrategy diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/BaseShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/BaseShiftStrategy.cs index ee5cde7f70b5f01136c4287543c3d4e67b559925..1468a7251d2acc143b6427289b97d6780bbc6f79 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/BaseShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/BaseShiftStrategy.cs @@ -100,6 +100,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null); + public abstract ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null); + protected MeterPerSquareSecond EstimateAccelerationForGear(GearshiftPosition gear, PerSecond gbxAngularVelocityOut) { if (!Gears.Contains(gear)) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/MTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/MTShiftStrategy.cs index eb5215e876e4df9c408b66599fb9d88ba0a8b4c3..c1b570e1aa2396759705d642475017525c1913f5 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/MTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/MTShiftStrategy.cs @@ -29,19 +29,30 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Impl; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies { public class MTShiftStrategy : AMTShiftStrategy { + VelocitySpeedGearshiftPreprocessor PreprocessorSpeed; + VelocityRollingLookup velocityDropData = new VelocityRollingLookup(); + public MTShiftStrategy(IVehicleContainer bus) : base(bus) { EarlyShiftUp = false; SkipGears = true; + + PreprocessorSpeed = ConfigureSpeedPreprocessor(bus); + bus.AddPreprocessor(PreprocessorSpeed); } public new static string Name => "MT Shift Strategy"; @@ -108,7 +119,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, GearshiftPosition currentGear, IResponse response1) { // down shift - if (IsBelowDownShiftCurve(currentGear, inTorque, inAngularVelocity)) { + var interpolatedDroppedSpeed = velocityDropData.Interpolate(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + var droppedSpeed = interpolatedDroppedSpeed == 0.SI<MeterPerSecond>() || interpolatedDroppedSpeed == null + ? DataBus.VehicleInfo.VehicleSpeed : interpolatedDroppedSpeed; + + double droppedSpeedRatio = DataBus.VehicleInfo.VehicleSpeed / droppedSpeed; + if ((IsBelowDownShiftCurve(currentGear, inTorque, inAngularVelocity) && droppedSpeedRatio.IsSmallerOrEqual(2.0)) || + IsBelowExtendedDownShiftCurve(currentGear, inTorque, inAngularVelocity)) + { currentGear = Gears.Predecessor(currentGear); while (SkipGears && currentGear.Gear > 1) { currentGear = Gears.Predecessor(currentGear); @@ -133,5 +151,31 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies } return currentGear; } + + private VelocitySpeedGearshiftPreprocessor ConfigureSpeedPreprocessor(IVehicleContainer bus) + { + var TestContainer = new SimplePowertrainContainer(bus.RunData); + PowertrainBuilder.BuildSimplePowertrain(bus.RunData, TestContainer); + var TestContainerGbx = TestContainer.GearboxCtl as Gearbox; + if (TestContainerGbx == null) + { + throw new VectoException("Unknown gearboxtype: {0}", TestContainer.GearboxCtl.GetType().FullName); + } + + var maxGradient = bus.RunData.Cycle.Entries.Max(x => Math.Abs(x.RoadGradientPercent.Value())) + 1; + var gradient = Convert.ToInt32(maxGradient / 2) * 2; + if (gradient == 0) + { + gradient = 2; + } + + return new VelocitySpeedGearshiftPreprocessor( + velocityDropData, + bus.RunData.GearboxData.TractionInterruption, + TestContainer, + -gradient, + gradient, + 2); + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/PEVAMTShiftStrategy.cs index 262e96afbdb814835ecdb1babde4e3ba5de621f4..334b274fa0ca3e627ddd954ba6f27346fbac539e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/PEVAMTShiftStrategy.cs @@ -33,6 +33,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies _shiftStrategyParameters = shiftStrategyparamets; } + public ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + throw new NotImplementedException("Not applicable to PEVAMT Gearbox."); + } + public ShiftPolygon ComputeDeclarationShiftPolygon(GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData = null) @@ -927,6 +940,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies return _shiftPolygonImplementation.ComputeDeclarationShiftPolygon(gearboxType, i, engineDataFullLoadCurve, gearboxGears, engineData, axlegearRatio, dynamicTyreRadius, electricMotorData); } + public ShiftPolygon ComputeDeclarationExtendedShiftPolygon( + GearboxType gearboxType, + int i, + EngineFullLoadCurve engineDataFullLoadCurve, + IList<ITransmissionInputData> gearboxGears, + CombustionEngineData engineData, + double axlegearRatio, + Meter dynamicTyreRadius, + ElectricMotorData electricMotorData = null) + { + throw new NotImplementedException("Not applicable to PEVAMT gearbox."); + } + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ShiftStrategy.cs index 6aaf26834191e3a991169e3cfee8aab98e6ddb57..f91945551449c3b3bc249710373019269fb9ac38 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Shiftstrategies/ShiftStrategy.cs @@ -109,6 +109,24 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies return GearboxModelData.Gears[gear.Gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); } + protected bool IsBelowExtendedDownShiftCurve(GearshiftPosition gear, NewtonMeter inTorque, PerSecond inEngineSpeed) + { + if (!Gears.HasPredecessor(gear)) + { + return false; + } + return GearboxModelData.Gears[gear.Gear].ExtendedShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); + } + + protected bool IsAboveExtendedDownShiftCurve(GearshiftPosition gear, NewtonMeter inTorque, PerSecond inEngineSpeed) + { + if (!Gears.HasPredecessor(gear)) + { + return true; + } + return GearboxModelData.Gears[gear.Gear].ExtendedShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); + } + /// <summary> /// Tests if the operating point is above the up-shift curve (=outside of shift curve).