From dbfa4890aac5e56a67e022f590290004e744a6e3 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Thu, 11 Nov 2021 15:29:12 +0100
Subject: [PATCH] hybrid strategy: if no solution is found (i.e., use fallback
 EM-Off) and emergency shift is allowed, check if next gear is suitable

---
 .../SimulationComponent/Strategies/HybridStrategy.cs       | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
index 96240d2577..0a58c1de71 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
@@ -684,6 +684,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
 			if (best == null) {
 				best = ResponseEmOff;
 				best.ICEOff = false;
+				if (AllowEmergencyShift && GearList.HasSuccessor(currentGear)) {
+					var testResponse = GetEmOffResultEntry(absTime, dt, outTorque, outAngularVelocity, currentGear);
+					if (testResponse.Response.Engine.EngineSpeed.IsGreaterOrEqual(ModelData.EngineData.FullLoadCurves[0]
+						.RatedSpeed)) {
+						best.Gear = GearList.Successor(currentGear);
+					}
+				}
 			}
 
 			var retVal = CreateResponse(best, currentGear);
-- 
GitLab