Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

fix in driver strategy: if the estimated new simulation interval becomes zero...

fix in driver strategy: if the estimated new simulation interval becomes zero or negative (i.e. the driver has to brake _now_ instead of accelerating) switch to brake-mode and re-start the current simulation interval with the original ds
parent 27ee1a08
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
DrivingModeBrake,
}
protected DrivingMode CurrentDrivingMode;
protected internal DrivingMode CurrentDrivingMode;
protected Dictionary<DrivingMode, IDriverMode> DrivingModes = new Dictionary<DrivingMode, IDriverMode>();
public DefaultDriverStrategy()
......@@ -288,12 +288,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Meter newds;
response = CheckRequestDoesNotExceedNextAction(absTime, ds, targetVelocity, gradient, response, out newds);
if (newds.IsEqual(0, 1e-3) || ds.IsEqual(newds, 1e-3.SI<Meter>())) {
if (ds.IsEqual(newds, 1e-3.SI<Meter>())) {
return response;
}
Log.Debug("Exceeding next ActionDistance at {0}. Reducing max Distance to {1}",
if (newds.IsSmallerOrEqual(0, 1e-3)) {
newds = ds;
DriverStrategy.CurrentDrivingMode = DefaultDriverStrategy.DrivingMode.DrivingModeBrake;
DriverStrategy.BrakeTrigger = DriverStrategy.NextDrivingAction;
}
Log.Debug("Exceeding next ActionDistance at {0}. Reducing max Distance from {2} to {1}",
DriverStrategy.NextDrivingAction.ActionDistance,
newds);
newds, ds);
return new ResponseDrivingCycleDistanceExceeded() {
Source = this,
MaxDistance = newds,
......
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