From 00a859827eaff3f4e0d8c493eb541452f7536c8f Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Thu, 14 Apr 2022 14:30:47 +0200 Subject: [PATCH] HybridStrategy Request Refactored if-statements of nextGear for easier debugging --- .../Strategies/HybridStrategy.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 1994691105..3a356983de 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -602,13 +602,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public virtual IHybridStrategyResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun) { - var nextGear = DataBus.VehicleInfo.VehicleStopped - ? Controller.ShiftStrategy.NextGear - : !DataBus.GearboxInfo.GearEngaged(absTime) - ? Controller.ShiftStrategy.NextGear - : PreviousState.GearboxEngaged - ? DataBus.GearboxInfo.Gear - : Controller.ShiftStrategy.NextGear; + GearshiftPosition nextGear; + if (DataBus.VehicleInfo.VehicleStopped) + nextGear = Controller.ShiftStrategy.NextGear; + else if (!DataBus.GearboxInfo.GearEngaged(absTime)) + nextGear = Controller.ShiftStrategy.NextGear; + else if (PreviousState.GearboxEngaged) + nextGear = DataBus.GearboxInfo.Gear; + else + nextGear = Controller.ShiftStrategy.NextGear; + if (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && StrategyParameters.MaxPropulsionTorque?.GetVECTOValueOrDefault(nextGear) != null && DataBus.GearboxInfo.TCLocked) { var emOff = new HybridStrategyResponse { -- GitLab