diff --git a/VECTO.sln.DotSettings b/VECTO.sln.DotSettings index da8636e08f14ca7c6cafe1c23d59aeb3afa2c978..5e2e17e67b6bab61d1229d5068df245ad4c1db32 100644 --- a/VECTO.sln.DotSettings +++ b/VECTO.sln.DotSettings @@ -25,6 +25,7 @@ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CSV/@EntryIndexedValue">CSV</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HVAC/@EntryIndexedValue">HVAC</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MT/@EntryIndexedValue">MT</s:String> + <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NS/@EntryIndexedValue">NS</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PT/@EntryIndexedValue">PT</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PTO/@EntryIndexedValue">PTO</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RP/@EntryIndexedValue">RP</s:String> diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs index da5dc761a03bf8698a83fd0cb022a2e750810d4c..ba8e4cbf2a337d40895c9fb95fc33594994ea29c 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs @@ -79,6 +79,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl IterationStatistics.Increment(this, "Distance", Container.Distance.Value()); IterationStatistics.Increment(this, "Time", AbsTime.Value()); IterationStatistics.FinishIteration(AbsTime); + response.AbsTime = AbsTime; return response; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 5d337831f92c22bfdc6fc4329ffeea2501d1b090..cad1becf321290bda7bce67603ee7814d067e166 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -266,9 +266,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return coastingDistance; } - public bool OverspeedAllowed(MeterPerSecond velocity) + public bool OverspeedAllowed(MeterPerSecond velocity, bool prohibitOverspeed = false) { - return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverMode.Overspeed && velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed; + if (prohibitOverspeed) { + return false; + } + return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverMode.Overspeed && + velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed; } } @@ -344,7 +348,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (newOperatingPoint.SimulationInterval.IsSmaller(Constants.SimulationSettings.LowerBoundTimeInterval)) { // the next time interval will be too short, this may lead to issues with inertia etc. // instead of accelerating, drive at constant speed. - response = DoHandleRequest(absTime, ds, Driver.DataBus.VehicleSpeed, gradient); + response = DoHandleRequest(absTime, ds, Driver.DataBus.VehicleSpeed, gradient, true); return response; } Log.Debug("Exceeding next ActionDistance at {0}. Reducing max Distance from {2} to {1}", @@ -355,7 +359,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl }; } - protected abstract IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient); + protected abstract IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, + bool prohibitOverspeed = false); protected abstract IResponse CheckRequestDoesNotExceedNextAction(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, IResponse response, out Meter newSimulationDistance); @@ -367,18 +372,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public class DriverModeDrive : AbstractDriverMode { - protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) + protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, + bool prohibitOverspeed = false) { IResponse response; Driver.DriverBehavior = DrivingBehavior.Driving; var velocity = targetVelocity; - if (DriverStrategy.OverspeedAllowed(targetVelocity)) { + if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) { velocity += DriverData.OverSpeedEcoRoll.OverSpeed; } if (DataBus.ClutchClosed(absTime)) { // drive along - if (DriverStrategy.OverspeedAllowed(targetVelocity) && DataBus.VehicleSpeed.IsEqual(targetVelocity)) { + if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed) && + DataBus.VehicleSpeed.IsEqual(targetVelocity)) { response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient); if (response is ResponseSuccess && response.Acceleration < 0) { response = Driver.DrivingActionAccelerate(absTime, ds, targetVelocity, gradient); @@ -388,7 +395,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } response.Switch(). Case<ResponseUnderload>(r => { - if (DriverStrategy.OverspeedAllowed(targetVelocity)) { + if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) { response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient); if (response is ResponseUnderload || response is ResponseSpeedLimitExceeded) { response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient); @@ -488,7 +495,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected BrakingPhase Phase; protected bool RetryDistanceExceeded; - protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) + protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, + bool prohibitOverspeed = false) { IResponse response = null; if (DataBus.VehicleSpeed <= DriverStrategy.BrakeTrigger.NextTargetSpeed) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 47a5f50001acdcfe3d2c4c066d651cedd50b8109..ff961c1bf5aa3513eea8d5283a47ad11d184b79b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -223,7 +223,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var shiftTimeExceeded = absTime.IsSmaller(_engageTime) && _engageTime.IsSmaller(absTime + dt, Constants.SimulationSettings.LowerBoundTimeInterval); // allow 5% tolerance of shift time - if (shiftTimeExceeded) { + if (shiftTimeExceeded && (_engageTime - absTime) > Constants.SimulationSettings.LowerBoundTimeInterval/2) { return new ResponseFailTimeInterval { Source = this, DeltaT = _engageTime - absTime,