Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

allow more iterations for search braking power (additional count after switching to binary search)

parent 697c0707
No related branches found
No related tags found
No related merge requests found
......@@ -473,23 +473,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Default(r => {
throw new UnexpectedResponseException("cannot use response for searching braking power!", r);
});
Watt delta;
debug.Add(new { brakePower = 0.SI<Watt>(), searchInterval, delta = origDelta, operatingPoint });
var brakePower = searchInterval * -origDelta.Sign();
// double the searchInterval until a good interval was found
var modeBinarySearch = false;
var intervalFactor = 1.0;
var retryCount = 0;
//ResponseDryRun response;
do {
operatingPoint = ComputeTimeInterval(operatingPoint.Acceleration, ds);
DataBus.BreakPower = brakePower;
var response =
(ResponseDryRun)
NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration, gradient, true);
delta = DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad : response.GearboxPowerRequest;
var delta = DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad : response.GearboxPowerRequest;
if (delta.IsEqual(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance)) {
LogManager.EnableLogging();
......@@ -503,7 +502,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// from then on the searchInterval can be bisected.
if (origDelta.Sign() != delta.Sign()) {
intervalFactor = 0.5;
//retryCount = 0; // again max. 100 iterations for the binary search...
if (!modeBinarySearch) {
modeBinarySearch = true;
retryCount = 0; // again max. 100 iterations for the binary search...
}
}
searchInterval *= intervalFactor;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment