diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs index 0995064cb8fd55e555a1938c7a9fbb85352e68dc..9119340085f284bb1e24ca14c0bddd43989c89c7 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs @@ -54,5 +54,7 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus PCCStates PCCState { get; } MeterPerSecond NextBrakeTriggerSpeed { get; } + + MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed); } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 7c05025a819033a7b82299abc10ef78adfb36464..c715c37b3e0d175337294cbc339bc07dc062b6a0 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -2297,6 +2297,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public MeterPerSquareSecond DriverAcceleration => 0.SI<MeterPerSquareSecond>(); public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; #endregion diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs index 73b382beeb21e3eaa85a8dae4f3399d642ba313a..2a3536504c606286d67725930efb530d957a48fa 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs @@ -51,5 +51,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent void CommitSimulationStep(); DrivingBehaviorEntry BrakeTrigger { get; } + + MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed); } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index a45144c5ca126b8a02fa0e5e2eacba9db14483bc..18791f076709a1ac39c9f4eba9dffd5bad8e5b72 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -615,7 +615,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } - public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) + public virtual MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) { return (targetSpeed + GetOverspeed()).LimitTo( 0.KMPHtoMeterPerSecond(), VehicleCategory.IsBus() ? Constants.BusParameters.MaxBusSpeed : 500.KMPHtoMeterPerSecond()); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index 0772429479d101abae548bcb687b24678a259277..223a0e406f3beabcf2ccebe43b17ccc3e486b05f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -164,8 +164,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var distanceToSpeedChange = nextSpeedChange - PreviousState.Distance; var estimatedTimeToSpeedChange = distanceToSpeedChange / DataBus.VehicleInfo.VehicleSpeed; if (estimatedTimeToSpeedChange.IsSmaller(Constants.SimulationSettings.LowerBoundTimeInterval / 2) && - DataBus.VehicleInfo.VehicleSpeed.IsSmaller(Left.VehicleTargetSpeed, 1.KMPHtoMeterPerSecond()) && - DataBus.VehicleInfo.VehicleSpeed.IsSmaller(Right.VehicleTargetSpeed, 1.KMPHtoMeterPerSecond())) { + DataBus.VehicleInfo.VehicleSpeed.IsSmaller(DataBus.DriverInfo.ApplyOverspeed(Left.VehicleTargetSpeed), 0.1.KMPHtoMeterPerSecond()) && + DataBus.VehicleInfo.VehicleSpeed.IsSmaller(DataBus.DriverInfo.ApplyOverspeed(Right.VehicleTargetSpeed), 0.1.KMPHtoMeterPerSecond())) { CurrentState.Response = DriveDistance(absTime, ds); return CurrentState.Response; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index a144bd086921701c838a7bcda9c856dbe748d042..ee722f9eb5eb7e39bd5db0a6aa22c41f14c5686f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -1460,6 +1460,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public PCCStates PCCState => DriverStrategy.PCCState; public MeterPerSecond NextBrakeTriggerSpeed => DriverStrategy.BrakeTrigger?.NextTargetSpeed; + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => DriverStrategy.ApplyOverspeed(targetSpeed); protected override bool DoUpdateFrom(object other) => false; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs index bac76f36413474f983a7f45e4d82c470c8f05c14..43a228a11524d25d24f096038ddb6e048b888adc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs @@ -451,6 +451,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; public Meter Distance => CurrentState.Distance; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs index 3b9c6810b8434671e041ef0a3a9601f9ffe7b4ad..f714f1cf1684609a46fae159bf8ff071fcc6ea97 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs @@ -181,6 +181,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public MeterPerSquareSecond DriverAcceleration => 0.SI<MeterPerSquareSecond>(); public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; private void DetermineDriverAction() { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs index 2696b4904738e581962df417053be2ebe788e12e..ca3134ab842489fc0aafd2214f1fbcc94228befd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs @@ -34,6 +34,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public MeterPerSquareSecond DriverAcceleration => 0.SI<MeterPerSquareSecond>(); public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; #endregion diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs index 8fcefba0d8801f134f109730cf7e430a678d05db..a56ff6fe71f4ce3bc0013a24324bdd840bda4f0e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs @@ -202,6 +202,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; + #endregion #region Overrides of VectoSimulationComponent diff --git a/VectoCore/VectoCoreTest/Utils/MockDriver.cs b/VectoCore/VectoCoreTest/Utils/MockDriver.cs index e387785e4c503e0c6621f292b43b0a8b5d713440..9de8644de96570ac0096fcf9c6a9ba37d56033fa 100644 --- a/VectoCore/VectoCoreTest/Utils/MockDriver.cs +++ b/VectoCore/VectoCoreTest/Utils/MockDriver.cs @@ -125,6 +125,7 @@ namespace TUGraz.VectoCore.Tests.Utils public MeterPerSquareSecond DriverAcceleration { get; set; } public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; protected override bool DoUpdateFrom(object other) => false; diff --git a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs index 7e29d4735d9ca06ad56784601a403ee3e613bf57..fd9df1f47785fa529c45b046b9e688b42192d582 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs @@ -239,6 +239,7 @@ namespace TUGraz.VectoCore.Tests.Utils public MeterPerSquareSecond DriverAcceleration { get; set; } public PCCStates PCCState => PCCStates.OutsideSegment; public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); + public MeterPerSecond ApplyOverspeed(MeterPerSecond targetSpeed) => targetSpeed; public CycleData CycleData { get; set; }