diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 4e329695d5c183b8c56ad3d83e76a3a5df47ea06..26185cb3b29b475782d575af825ca3772bfef693 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -138,7 +138,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var dt = Constants.SimulationSettings.TargetTimeInterval; // MK 2016-02-10: SI doesn't allow inifinity anymore -- therefore simply a very negative value is used. - _engageTime = -1e10.SI<Second>(); //double.NegativeInfinity.SI<Second>(); + _engageTime = -double.MaxValue.SI<Second>(); //double.NegativeInfinity.SI<Second>(); if (Disengaged) { Gear = _strategy.InitGear(absTime, dt, outTorque, outAngularVelocity); @@ -326,7 +326,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (dryRun) { if ((DataBus.DriverBehavior == DrivingBehavior.Braking || DataBus.DriverBehavior == DrivingBehavior.Coasting) && - inAngularVelocity < DataBus.EngineIdleSpeed && DataBus.VehicleSpeed < Constants.SimulationSettings.VehicleStopClutchDisengageSpeed) { + inAngularVelocity < DataBus.EngineIdleSpeed && + DataBus.VehicleSpeed < Constants.SimulationSettings.VehicleStopClutchDisengageSpeed) { Disengaged = true; _engageTime = absTime + dt; _strategy.Disengage(absTime, dt, outTorque, outAngularVelocity); @@ -347,7 +348,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (shiftRequired) { _engageTime = absTime + ModelData.TractionInterruption; - Log.Debug("Gearbox is shifting. absTime: {0}, dt: {1}, interuptionTime: {2}, out: ({3}, {4}), in: ({5}, {6})", absTime, + Log.Debug("Gearbox is shifting. absTime: {0}, dt: {1}, interuptionTime: {2}, out: ({3}, {4}), in: ({5}, {6})", + absTime, dt, _engageTime, outTorque, outAngularVelocity, inTorque, inAngularVelocity); Disengaged = true; @@ -427,7 +429,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } } - + if (DataBus.VehicleStopped) { + Disengaged = false; + _engageTime = -double.MaxValue.SI<Second>(); + } AdvanceState(); }