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 a7801ee2 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge pull request #77 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:develop to develop

* commit 'f7f68a2c':
  allow more iterations for search braking power (additional count after switching to binary search)
  bugfix in driving cycle
parents c03b29c6 f7f68a2c
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;
......
......@@ -156,7 +156,7 @@ namespace TUGraz.VectoCore.Tests.Integration
public static readonly string[] CycleAccelerate_0_85_downhill_25 = {
// <s>,<v>,<grad>,<stop>
" 0, 0, 0, 2",
" 0, 0, -25, 2",
"1000, 85, -25, 0",
};
......
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