From 0294455dc917bc356f76a7ca27ffe7f19c81c152 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 13 Feb 2019 07:56:50 +0100
Subject: [PATCH] handle null-response also in the case no max-power operating
 point can be found

---
 .../Models/SimulationComponent/Impl/TorqueConverter.cs     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs
index b88d3b7e23..d66de46580 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs
@@ -177,8 +177,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			var dryOperatingPointMax = GetMaxPowerOperatingPoint(
 				absTime, dt, outAngularVelocity, engineResponse,
 				PreviousState.InTorque * PreviousState.InAngularVelocity);
-			var avgOutSpeedMax = (PreviousState.OutAngularVelocity + dryOperatingPointMax.OutAngularVelocity) / 2.0;
-			var deltaMax = (outTorque - dryOperatingPointMax.OutTorque) * avgOutSpeedMax;
+			var deltaMax = double.MaxValue.SI<Watt>() / 20;
+			if (dryOperatingPointMax != null) {
+				var avgOutSpeedMax = (PreviousState.OutAngularVelocity + dryOperatingPointMax.OutAngularVelocity) / 2.0;
+				deltaMax = (outTorque - dryOperatingPointMax.OutTorque) * avgOutSpeedMax;
+			}
 
 			var dryOperatingPointMin = GetDragPowerOperatingPoint(
 				absTime, dt, outAngularVelocity, engineResponse,
-- 
GitLab