From 06c0300668689a7155f54c74bcf2e799c0b563cb Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 19 Nov 2021 09:34:45 +0100
Subject: [PATCH] hybrid strategy: no not allow solutions with too high engine
 speed even if ICE is off

(cherry picked from commit 0e2cd1252f0f67b9f60effa0f07ca098fbbc4a7f)
---
 .../Impl/HybridController.cs                  | 24 +++++++++----------
 .../Strategies/HybridStrategy.cs              |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs
index 10723ec1b2..03f7d5f96e 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs
@@ -181,18 +181,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 					continue;
 				}
 
-				var gear = DataBus.GearboxInfo.Gear;
-				var maxSpeed = VectoMath.Min(DataBus.GearboxInfo.GetGearData(gear.Gear).MaxSpeed,
-					DataBus.EngineInfo.EngineN95hSpeed);
-				if (!dryRun && retVal is ResponseSuccess && DataBus.GearboxInfo.GearEngaged(absTime) && retVal.Gearbox.InputSpeed.IsGreater(maxSpeed)) {
-					Strategy.AllowEmergencyShift = true;
-					retryCount++;
-					retry = true;
-					Strategy.OperatingpointChangedDuringRequest(absTime, dt, outTorque, outAngularVelocity, false, retVal);
-					continue;
-				}
-
-				if (!dryRun && strategySettings.CombustionEngineOn && retVal is ResponseEngineSpeedTooHigh && !strategySettings.ProhibitGearshift) {
+                var gear = DataBus.GearboxInfo.Gear;
+                var maxSpeed = VectoMath.Min(DataBus.GearboxInfo.GetGearData(gear.Gear).MaxSpeed,
+                    DataBus.EngineInfo.EngineN95hSpeed);
+                if (!dryRun && retVal is ResponseSuccess && DataBus.GearboxInfo.GearEngaged(absTime) && retVal.Gearbox.InputSpeed.IsGreater(maxSpeed)) {
+                    Strategy.AllowEmergencyShift = true;
+                    retryCount++;
+                    retry = true;
+                    Strategy.OperatingpointChangedDuringRequest(absTime, dt, outTorque, outAngularVelocity, false, retVal);
+                    continue;
+                }
+
+                if (!dryRun && strategySettings.CombustionEngineOn && retVal is ResponseEngineSpeedTooHigh && !strategySettings.ProhibitGearshift) {
 					retryCount++;
 					retry = true;
 					Strategy.AllowEmergencyShift = true;
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
index 9264e039e3..412df7fd7a 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
@@ -1452,7 +1452,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
 			if (best == null) {
 				return null;
 			}
-			if (!best.IgnoreReason.InvalidEngineSpeed() || best.ICEOff ||
+			if (!best.IgnoreReason.InvalidEngineSpeed() || /*best.ICEOff ||*/
 				eval.Select(x => x.Gear).Distinct().Count() <= 1) {
 				best.SimulationInterval = dt;
 				return best;
-- 
GitLab