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

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

allow driver strategy to override announced driving action.

necessary if slight braking is required when accelerating from stop due to engine inertia (special case, vehicle stops too early when halting uphill)
parent 8606185f
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.DataBus;
using TUGraz.VectoCore.Models.SimulationComponent.Impl;
using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData; using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData;
namespace TUGraz.VectoCore.Models.SimulationComponent namespace TUGraz.VectoCore.Models.SimulationComponent
...@@ -83,12 +84,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent ...@@ -83,12 +84,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
/// <param name="gradient"></param> /// <param name="gradient"></param>
/// <param name="previousResponse"></param> /// <param name="previousResponse"></param>
/// <param name="targetDistance"></param> /// <param name="targetDistance"></param>
/// <param name="overrideAction"></param>
/// <returns> /// <returns>
/// * ResponseSuccess /// * ResponseSuccess
/// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached. /// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached.
/// </returns> /// </returns>
IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient,
IResponse previousResponse = null, Meter targetDistance = null); IResponse previousResponse = null, Meter targetDistance = null, DrivingAction? overrideAction = null);
/// <summary> /// <summary>
/// perform a 'roll driving action', i.e., the clutch is open and the vehicle rolls without motoring. adjust the acceleration /// perform a 'roll driving action', i.e., the clutch is open and the vehicle rolls without motoring. adjust the acceleration
......
...@@ -653,7 +653,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -653,7 +653,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = Driver.DrivingActionAccelerate(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient); response = Driver.DrivingActionAccelerate(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient);
if (response is ResponseUnderload) { if (response is ResponseUnderload) {
response = Driver.DrivingActionBrake(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient, response); response = Driver.DrivingActionBrake(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient, response, overrideAction: DrivingAction.Accelerate);
} }
} else { } else {
response = Driver.DrivingActionBrake( response = Driver.DrivingActionBrake(
......
...@@ -478,10 +478,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -478,10 +478,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return response; return response;
} }
public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, IResponse previousResponse = null, Meter targetDistance = null, DrivingAction? overrideAction = null)
IResponse previousResponse = null, Meter targetDistance = null)
{ {
DrivingAction = DrivingAction.Brake; DrivingAction = overrideAction ?? DrivingAction.Brake;
IterationStatistics.Increment(this, "Brake"); IterationStatistics.Increment(this, "Brake");
Log.Debug("DrivingAction Brake"); Log.Debug("DrivingAction Brake");
......
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