Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 3c1db1e2 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Merge pull request #300 in VECTO/vecto-sim from ~EMKRISPMI/vecto-sim:master to master

* commit '46ae8a17':
  [VECTO-375] Driver Strategy OverspeedAllowed: Removed gradient parameter (not needed anymore)
  [VECTO-375] DriverStrategy Overspeed Allowed: Removed gradient from check if overspeed is allowed (brake bug on overspeed)
parents 202b38e9 46ae8a17
No related branches found
No related tags found
No related merge requests found
...@@ -181,7 +181,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -181,7 +181,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Log.Debug("Lookahead distance: {0} @ current speed {1}", lookaheadDistance, currentSpeed); Log.Debug("Lookahead distance: {0} @ current speed {1}", lookaheadDistance, currentSpeed);
var nextActions = new List<DrivingBehaviorEntry>(); var nextActions = new List<DrivingBehaviorEntry>();
foreach (var entry in lookaheadData) { foreach (var entry in lookaheadData) {
var nextTargetSpeed = OverspeedAllowed(entry.RoadGradient, entry.VehicleTargetSpeed) var nextTargetSpeed = OverspeedAllowed(entry.VehicleTargetSpeed)
? entry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed ? entry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed
: entry.VehicleTargetSpeed; : entry.VehicleTargetSpeed;
if (nextTargetSpeed < currentSpeed) { if (nextTargetSpeed < currentSpeed) {
...@@ -234,7 +234,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -234,7 +234,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected internal virtual Meter ComputeCoastingDistance(MeterPerSecond vehicleSpeed, protected internal virtual Meter ComputeCoastingDistance(MeterPerSecond vehicleSpeed,
DrivingCycleData.DrivingCycleEntry actionEntry) DrivingCycleData.DrivingCycleEntry actionEntry)
{ {
var targetSpeed = OverspeedAllowed(actionEntry.RoadGradient, actionEntry.VehicleTargetSpeed) var targetSpeed = OverspeedAllowed(actionEntry.VehicleTargetSpeed)
? actionEntry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed ? actionEntry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed
: actionEntry.VehicleTargetSpeed; : actionEntry.VehicleTargetSpeed;
...@@ -266,10 +266,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -266,10 +266,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return coastingDistance; return coastingDistance;
} }
public bool OverspeedAllowed(Radian gradient, MeterPerSecond velocity) public bool OverspeedAllowed(MeterPerSecond velocity)
{ {
return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverMode.Overspeed && return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverMode.Overspeed && velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed;
gradient < 0 && velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed;
} }
} }
...@@ -374,12 +373,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -374,12 +373,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Driver.DriverBehavior = DrivingBehavior.Driving; Driver.DriverBehavior = DrivingBehavior.Driving;
var velocity = targetVelocity; var velocity = targetVelocity;
if (DriverStrategy.OverspeedAllowed(gradient, targetVelocity)) { if (DriverStrategy.OverspeedAllowed(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, targetVelocity) && DataBus.VehicleSpeed.IsEqual(targetVelocity)) { if (DriverStrategy.OverspeedAllowed(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);
...@@ -389,7 +388,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -389,7 +388,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
} }
response.Switch(). response.Switch().
Case<ResponseUnderload>(r => { Case<ResponseUnderload>(r => {
if (DriverStrategy.OverspeedAllowed(gradient, targetVelocity)) { if (DriverStrategy.OverspeedAllowed(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.
Finish editing this message first!
Please register or to comment