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

Skip to content
Snippets Groups Projects
Commit 624bc48c authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

allow 'searchoperatingpoint' to shorten simulation distance (e.g. if roll...

allow 'searchoperatingpoint' to shorten simulation distance (e.g. if roll action at low speeds) - allow vehicle stop, drive off again
parent e9f72dc8
No related branches found
No related tags found
No related merge requests found
......@@ -865,6 +865,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
var response = HandleRequestDisengaged(absTime, ds, gradient, velocityWithOverspeed, debug);
if (response is ResponseDrivingCycleDistanceExceeded) {
return response;
}
if (!(response is ResponseSuccess) && DataBus.ClutchInfo.ClutchClosed(absTime)) {
response = HandleRequestEngaged(
absTime, ds, targetVelocity, gradient, prohibitOverspeed, velocityWithOverspeed, debug);
......@@ -1100,7 +1103,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
bool prohibitOverspeed = false)
{
if (DataBus.VehicleInfo.VehicleSpeed <= DriverStrategy.BrakeTrigger.NextTargetSpeed && !DataBus.VehicleInfo.VehicleStopped) {
if (DataBus.VehicleInfo.VehicleSpeed.IsSmallerOrEqual(DriverStrategy.BrakeTrigger.NextTargetSpeed) && !DataBus.VehicleInfo.VehicleStopped) {
var retVal = HandleTargetspeedReached(absTime, ds, targetVelocity, gradient);
for (var i = 0; i < 3 && retVal == null; i++) {
retVal = HandleTargetspeedReached(absTime, ds, targetVelocity, gradient);
......
......@@ -440,6 +440,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
searchedOperatingPoint = SetTCOperatingPointATGbxCoastOrRoll(absTime, gradient, requestedOperatingPoint, initialResponse as ResponseDryRun);
}
if (searchedOperatingPoint == null) {
searchedOperatingPoint = SearchOperatingPoint(
absTime, requestedOperatingPoint.SimulationDistance,
gradient,
requestedOperatingPoint.Acceleration, initialResponse, coastingOrRoll: true, allowDistanceDecrease: true);
if (searchedOperatingPoint == null) {
throw new NotImplementedException();
}
if (searchedOperatingPoint.SimulationDistance.IsSmaller(ds)) {
return new ResponseDrivingCycleDistanceExceeded(this) {
MaxDistance = searchedOperatingPoint.SimulationDistance
};
}
}
if (!ds.IsEqual(searchedOperatingPoint.SimulationDistance)) {
// vehicle is at low speed, coasting would lead to stop before ds is reached: reduce simulated distance to stop distance.
Log.Debug(
......@@ -1052,7 +1068,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
protected OperatingPoint SearchOperatingPoint(Second absTime, Meter ds, Radian gradient,
MeterPerSquareSecond acceleration, IResponse initialResponse, bool coastingOrRoll = false)
MeterPerSquareSecond acceleration, IResponse initialResponse, bool coastingOrRoll = false, bool allowDistanceDecrease = false)
{
IterationStatistics.Increment(this, "SearchOperatingPoint", 0);
......@@ -1124,7 +1140,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (nanCount > 10) {
return true;
}
return r != null && !actionRoll && !ds.IsEqual(r.Driver.OperatingPoint.SimulationDistance);
return r != null && !actionRoll && !allowDistanceDecrease && !ds.IsEqual(r.Driver.OperatingPoint.SimulationDistance);
});
return ComputeTimeInterval(retVal.Acceleration, retVal.SimulationDistance);
} catch (VectoSearchAbortedException) {
......
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