From 99554cb759472bd5b0e8008867c9f4ca9c3da822 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Tue, 23 Aug 2016 14:33:52 +0200 Subject: [PATCH] MeasuredSpeed: Additional Search if braking power was negative --- .../Impl/PowertrainDrivingCycle.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index 1c22fff8ad..a67cc3771a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -439,19 +439,32 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl .Case<ResponseGearShift>(() => response = NextComponent.Request(absTime, dt, acceleration, gradient)) .Case<ResponseUnderload>(r => { DataBus.BrakePower = SearchAlgorithm.Search(DataBus.BrakePower, r.Delta, -r.Delta, - getYValue: result => RightSample.Current.Gear == 0 - ? ((ResponseDryRun)result).GearboxPowerRequest - : ((ResponseDryRun)result).DeltaDragLoad, + getYValue: result => DataBus.ClutchClosed(absTime) + ? ((ResponseDryRun)result).DeltaDragLoad + : ((ResponseDryRun)result).GearboxPowerRequest, evaluateFunction: x => { DataBus.BrakePower = x; return NextComponent.Request(absTime, dt, acceleration, gradient, true); }, - criterion: y => RightSample.Current.Gear == 0 - ? ((ResponseDryRun)y).GearboxPowerRequest.Value() - : ((ResponseDryRun)y).DeltaDragLoad.Value()); + criterion: y => DataBus.ClutchClosed(absTime) + ? ((ResponseDryRun)y).DeltaDragLoad.Value() + : ((ResponseDryRun)y).GearboxPowerRequest.Value()); Log.Info( "Found operating point for braking. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}, BrakePower: {4}", absTime, dt, acceleration, gradient, DataBus.BrakePower); + + if (DataBus.BrakePower.IsSmaller(0)) { + Log.Info( + "BrakePower was negative: {4}. Setting to 0 and searching for acceleration operating point. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}", + absTime, dt, acceleration, gradient, DataBus.BrakePower); + DataBus.BrakePower = 0.SI<Watt>(); + acceleration = SearchAlgorithm.Search(acceleration, r.Delta, + Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating, + getYValue: result => ((ResponseDryRun)result).DeltaFullLoad, + evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), + criterion: y => ((ResponseDryRun)y).DeltaFullLoad.Value()); + } + response = NextComponent.Request(absTime, dt, acceleration, gradient); }) .Case<ResponseOverload>(r => { -- GitLab