From 80d590e694899d07bb610b1c7cccf1f00c1c1454 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Sun, 18 Oct 2015 09:17:59 +0200 Subject: [PATCH] speedup for search braking power (linear search part) --- VectoCore/Configuration/Constants.cs | 5 ----- VectoCore/Models/SimulationComponent/Impl/Driver.cs | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/VectoCore/Configuration/Constants.cs b/VectoCore/Configuration/Constants.cs index 076772cc9b..d7c6e3c120 100644 --- a/VectoCore/Configuration/Constants.cs +++ b/VectoCore/Configuration/Constants.cs @@ -72,11 +72,6 @@ namespace TUGraz.VectoCore.Configuration public static Meter DriverActionDistanceTolerance = 0.25.SI<Meter>(); - /// <summary> - /// The initial search interval for the breaking power search in the driver. - /// </summary> - public static readonly Watt BreakingPowerInitialSearchInterval = 20.SI().Kilo.Watt.Cast<Watt>(); - /// <summary> /// The initial search interval for the operating point search in the driver. /// </summary> diff --git a/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/Models/SimulationComponent/Impl/Driver.cs index 1616ce9411..eb8118aa52 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -478,8 +478,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var debug = new List<dynamic>(); // only used while testing - var searchInterval = Constants.SimulationSettings.BreakingPowerInitialSearchInterval; - var operatingPoint = new OperatingPoint() { SimulationDistance = ds, Acceleration = acceleration }; Watt origDelta = null; initialResponse.Switch(). @@ -491,6 +489,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl throw new UnexpectedResponseException("cannot use response for searching braking power!", r); }); + // braking power is in the range of the exceeding delta. set searching range to 2/3 so that + // the target point is approximately in the center of the second interval + var searchInterval = origDelta.Abs() * 2 / 3; + debug.Add(new { brakePower = 0.SI<Watt>(), searchInterval, delta = origDelta, operatingPoint }); var brakePower = searchInterval * -origDelta.Sign(); -- GitLab