Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 826bce1d authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

bugfix: overspeed depends on targetVelocity

parent b76d9591
No related branches found
No related tags found
No related merge requests found
...@@ -175,7 +175,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -175,7 +175,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
ActionDistance = entry.Distance - brakingDistance, ActionDistance = entry.Distance - brakingDistance,
TriggerDistance = entry.Distance, TriggerDistance = entry.Distance,
NextTargetSpeed = NextTargetSpeed =
OverspeedAllowed(entry.RoadGradient) OverspeedAllowed(entry.RoadGradient, entry.VehicleTargetSpeed)
? entry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed ? entry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed
: entry.VehicleTargetSpeed : entry.VehicleTargetSpeed
}); });
...@@ -188,7 +188,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -188,7 +188,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Action = DefaultDriverStrategy.DrivingBehavior.Coasting, Action = DefaultDriverStrategy.DrivingBehavior.Coasting,
ActionDistance = entry.Distance - coastingDistance, ActionDistance = entry.Distance - coastingDistance,
TriggerDistance = entry.Distance, TriggerDistance = entry.Distance,
NextTargetSpeed = OverspeedAllowed(entry.RoadGradient) NextTargetSpeed = OverspeedAllowed(entry.RoadGradient, entry.VehicleTargetSpeed)
? entry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed ? entry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed
: entry.VehicleTargetSpeed : entry.VehicleTargetSpeed
}); });
...@@ -207,10 +207,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -207,10 +207,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return nextActions.Count == 0 ? null : nextActions.OrderBy(x => x.ActionDistance).First(); return nextActions.Count == 0 ? null : nextActions.OrderBy(x => x.ActionDistance).First();
} }
public bool OverspeedAllowed(Radian gradient) public bool OverspeedAllowed(Radian gradient, MeterPerSecond velocity)
{ {
return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverData.DriverMode.Overspeed && return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverData.DriverMode.Overspeed &&
gradient < 0 && Driver.DataBus.VehicleSpeed > Driver.DriverData.OverSpeedEcoRoll.MinSpeed; gradient < 0 && velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed;
} }
} }
...@@ -267,12 +267,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -267,12 +267,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
IResponse response = null; IResponse response = null;
var velocity = targetVelocity; var velocity = targetVelocity;
if (DriverStrategy.OverspeedAllowed(gradient)) { if (DriverStrategy.OverspeedAllowed(gradient, targetVelocity)) {
velocity += DriverData.OverSpeedEcoRoll.OverSpeed; velocity += DriverData.OverSpeedEcoRoll.OverSpeed;
} }
if (DataBus.ClutchClosed(absTime)) { if (DataBus.ClutchClosed(absTime)) {
// drive along // drive along
if (DriverStrategy.OverspeedAllowed(gradient) && DataBus.VehicleSpeed.IsEqual(targetVelocity)) { if (DriverStrategy.OverspeedAllowed(gradient, targetVelocity) && DataBus.VehicleSpeed.IsEqual(targetVelocity)) {
response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient); response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
if (response is ResponseSuccess && response.Acceleration < 0) { if (response is ResponseSuccess && response.Acceleration < 0) {
response = Driver.DrivingActionAccelerate(absTime, ds, targetVelocity, gradient); response = Driver.DrivingActionAccelerate(absTime, ds, targetVelocity, gradient);
...@@ -293,7 +293,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -293,7 +293,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}); });
}). }).
Case<ResponseUnderload>(r => { Case<ResponseUnderload>(r => {
if (DriverStrategy.OverspeedAllowed(gradient)) { if (DriverStrategy.OverspeedAllowed(gradient, targetVelocity)) {
response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient); response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
if (response is ResponseUnderload || response is ResponseSpeedLimitExceeded) { if (response is ResponseUnderload || response is ResponseSpeedLimitExceeded) {
response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient); response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment