From abc21449557b146df99d98b5fcc39ca09c487f3b Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <quaritsch@ivt.tugraz.at>
Date: Thu, 24 Aug 2023 17:00:40 +0200
Subject: [PATCH] ICE: if stationary full load gets negative (extrapolation)
 return 0W - too high engine speed is handled by Hybrid strategy or shift
 strategy later on

---
 .../Models/SimulationComponent/Impl/CombustionEngine.cs      | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
index 7619043b39..1dd5777c92 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
@@ -561,7 +561,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			
 			var stationaryFullLoadPower = stationaryFullLoadTorque * avgAngularVelocity;
 			Watt dynFullPowerCalculated;
-
+			
 			// disable pt1 behaviour if PT1Disabled is true, or if the previous enginepower is greater than the current stationary fullload power (in this case the pt1 calculation fails)
 			if (PT1Disabled || PreviousState.EnginePower.IsGreaterOrEqual(stationaryFullLoadPower)) {
 				dynFullPowerCalculated = stationaryFullLoadPower;
@@ -592,6 +592,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 					if (dryRun) {
 						dynFullPowerCalculated = stationaryFullLoadPower;
 					} else {
+						if (stationaryFullLoadTorque.IsSmaller(0)) {
+							return 0.SI<Watt>();
+						}
 						throw;
 					}
 				}
-- 
GitLab