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

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

SearchOperatingPoint - simple intervalFactor instead of lambda expression

parent 6bbf0fff
No related branches found
No related tags found
No related merge requests found
......@@ -401,7 +401,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var searchInterval = Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating;
var curve = DriverData.AccelerationCurve.Lookup(DataBus.VehicleSpeed());
Func<MeterPerSquareSecond, MeterPerSquareSecond> modifySearchInterval = x => x * 2;
var intervalFactor = 1.0;
Watt origDelta = null;
if (actionRoll) {
......@@ -427,10 +427,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// check if a correct searchInterval was found (when the delta changed signs, we stepped through the 0-point)
// from then on the searchInterval can be bisected.
if (origDelta.Sign() != delta.Sign()) {
modifySearchInterval = x => x / 2;
intervalFactor = 0.5;
}
searchInterval = modifySearchInterval(searchInterval);
searchInterval *= intervalFactor;
retVal.Acceleration += searchInterval * -delta.Sign();
if (retVal.Acceleration < (curve.Deceleration - Constants.SimulationSettings.MinimumAcceleration)
......
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