From b5ba11d14b6fdf76625549d57c4e42d384ff9b86 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Mon, 29 Aug 2016 16:54:05 +0200 Subject: [PATCH] MeasuredSpeedDrivingCycle: Corrected Merger Errors --- .../SimulationComponent/Impl/ATGearbox.cs | 2 +- .../Impl/MeasuredSpeedDrivingCycle.cs | 29 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index a189d40f3e..f738992670 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -255,7 +255,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var retval = IdleController.Request(absTime, dt, 0.SI<NewtonMeter>(), null); retval.ClutchPowerRequest = 0.SI<Watt>(); - CurrentState.SetState(0.SI<NewtonMeter>(), retval.EngineSpeed, outTorque, outAngularVelocity); + CurrentState.SetState(0.SI<NewtonMeter>(), 0.SI<PerSecond>(), outTorque, outAngularVelocity); TorqueConverter.Locked(CurrentState.InTorque, CurrentState.InAngularVelocity); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs index b127496f97..a31747be2f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs @@ -21,7 +21,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// </summary> public class MeasuredSpeedDrivingCycle : StatefulProviderComponent - <MeasuredSpeedDrivingCycle.DrivingCycleState, ISimulationOutPort, IDriverDemandInPort, IDriverDemandOutPort>, + <MeasuredSpeedDrivingCycle.DrivingCycleState, ISimulationOutPort, IDriverDemandInPort, IDriverDemandOutPort>, IDriverInfo, IDrivingCycleInfo, IMileageCounter, IDriverDemandInProvider, IDriverDemandInPort, ISimulationOutProvider, ISimulationOutPort { @@ -134,19 +134,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 => { @@ -155,7 +168,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl getYValue: result => ((ResponseDryRun)result).DeltaFullLoad, evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), criterion: - y => ((ResponseDryRun)y).DeltaFullLoad.Value()); + y => ((ResponseDryRun)y).DeltaFullLoad.Value()); Log.Info( "Found operating point for driver acceleration. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}", absTime, -- GitLab