diff --git a/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 8a64ff02d9b830eb838a2cfaeddcf394cd3e2c92..eedbdaeda2a9d6884a8f6247e022025ca4d4d141 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -298,7 +298,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return dryRunResponse; } - var shiftAllowed = !inEngineSpeed.IsEqual(0) && !DataBus.VehicleSpeed.IsEqual(0); + var shiftAllowed = !inEngineSpeed.IsEqual(0) && !DataBus.VehicleSpeed.IsEqual(0) && absTime.IsGreater(0); if (shiftAllowed) { var shiftRequired = _strategy.ShiftRequired(absTime, dt, outTorque, outAngularVelocity, inTorque, inEngineSpeed, diff --git a/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs b/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs index e206552002811b7c0e319804fa10e4ec2f40c2ed..7261ffba83022f26917342a65ddaeb23975cffc6 100644 --- a/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs +++ b/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs @@ -1,4 +1,5 @@ using System; +using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent.Data; @@ -133,7 +134,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private bool SpeedTooLowForEngine(uint gear, PerSecond outAngularSpeed) { - return (outAngularSpeed * Data.Gears[NextGear].Ratio).IsSmaller(DataBus.EngineIdleSpeed); + return (outAngularSpeed * Data.Gears[gear].Ratio).IsSmaller(DataBus.EngineIdleSpeed); } // original vecto2.2: (inAngularSpeed - IdleSpeed) / (RatedSpeed - IdleSpeed) >= 1.2 @@ -141,8 +142,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // = inAngularSpeed >= 1.2*RatedSpeed - 0.2*IdleSpeed private bool SpeedTooHighForEngine(uint gear, PerSecond outAngularSpeed) { - return (outAngularSpeed * Data.Gears[NextGear].Ratio).IsGreaterOrEqual(1.2 * DataBus.EngineRatedSpeed - - 0.2 * DataBus.EngineIdleSpeed); + return (outAngularSpeed * Data.Gears[gear].Ratio).IsGreaterOrEqual(1.2 * DataBus.EngineRatedSpeed - + 0.2 * DataBus.EngineIdleSpeed); } @@ -198,6 +199,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if in shift curve and torque reserve is provided: return the current gear if (!IsBelowDownShiftCurve(gear, inTorque, inAngularSpeed) && !IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && reserve >= Data.StartTorqueReserve) { + if ((inAngularSpeed - DataBus.EngineIdleSpeed) / (DataBus.EngineRatedSpeed - DataBus.EngineIdleSpeed) < + Constants.SimulationSettings.CluchNormSpeed && gear > 1) { + gear--; + } + return gear; } @@ -299,6 +305,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } + if ((Data.Gears[NextGear].Ratio * outAngularVelocity - DataBus.EngineIdleSpeed) / + (DataBus.EngineRatedSpeed - DataBus.EngineIdleSpeed) < + Constants.SimulationSettings.CluchNormSpeed && NextGear > 1) { + NextGear--; + } + return (NextGear != gear); }