From 73fb9a55f2852841754b0a4e659045086330a8fb Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Mon, 27 Jun 2016 13:56:53 +0200 Subject: [PATCH] move acceleration estimation to AMT class --- .../Impl/AMTShiftStrategy.cs | 31 +++++++++++++- .../Impl/MTShiftStrategy.cs | 40 ------------------- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs index 76bde3d9f7..b06249f7a3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs @@ -160,12 +160,41 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected virtual uint CheckUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear) { - return DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear); + // if the driver's intention is _not_ to accelerate or drive along then don't upshift + if (DataBus.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverBehavior != DrivingBehavior.Driving) { + return currentGear; + } + if ((absTime - Gearbox.LastDownshift).IsSmaller(10.SI<Second>())) { + return currentGear; + } + var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear); + if (nextGear == currentGear) { + return nextGear; + } + + // estimate acceleration for selected gear + if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) { + // if less than 0.1 for next gear, don't shift + if (nextGear - currentGear == 1) { + return currentGear; + } + // if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift! + if (nextGear > currentGear && + EstimateAccelerationForGear(currentGear + 1, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) { + return currentGear; + } + nextGear = currentGear + 1; + } + + return nextGear; } protected virtual uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear) { + if ((absTime - Gearbox.LastUpshift).IsSmaller(10.SI<Second>())) { + return currentGear; + } return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs index 3e869f9cd0..b1cbd03883 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs @@ -11,45 +11,5 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Data.EarlyShiftUp = false; Data.SkipGears = true; } - - protected override uint CheckUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear) - { - // if the driver's intention is _not_ to accelerate or drive along then don't upshift - if (DataBus.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverBehavior != DrivingBehavior.Driving) { - return currentGear; - } - if ((absTime - Gearbox.LastDownshift).IsSmaller(10.SI<Second>())) { - return currentGear; - } - var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear); - if (nextGear == currentGear) { - return nextGear; - } - - // estimate acceleration for selected gear - if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) { - // if less than 0.1 for next gear, don't shift - if (nextGear - currentGear == 1) { - return currentGear; - } - // if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift! - if (nextGear > currentGear && - EstimateAccelerationForGear(currentGear + 1, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) { - return currentGear; - } - } - - return nextGear; - } - - protected override uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear) - { - if ((absTime - Gearbox.LastUpshift).IsSmaller(10.SI<Second>())) { - return currentGear; - } - return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear); - } } } \ No newline at end of file -- GitLab