From 5c885dd3cf8c40af81c1681a217913c5e26d21d7 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 1 Apr 2015 12:34:07 +0200
Subject: [PATCH] throw exception if no power demand can be found

---
 .../SimulationComponent/Data/AuxiliariesDemandAdapter.cs     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/VectoCore/Models/SimulationComponent/Data/AuxiliariesDemandAdapter.cs b/VectoCore/Models/SimulationComponent/Data/AuxiliariesDemandAdapter.cs
index e4933fddb2..308719bfae 100644
--- a/VectoCore/Models/SimulationComponent/Data/AuxiliariesDemandAdapter.cs
+++ b/VectoCore/Models/SimulationComponent/Data/AuxiliariesDemandAdapter.cs
@@ -32,7 +32,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 			//	Log.ErrorFormat("could not find entry in driving cycle for time {0}", absTime.TotalSeconds);
 			//	return 0;
 			//}
-			Log.ErrorFormat("Found Entry at index {0}", entry);
+			if (entry == -1) {
+				Log.ErrorFormat("time: {0} could not find power demand for auxiliary {1}", absTime.TotalSeconds, _auxiliaryId);
+				throw new VectoSimulationException(String.Format("time: {0} could not find power demand for auxiliary {1}", absTime.TotalSeconds, _auxiliaryId));
+			}
 			return _auxiliaryId == null ? _drivingCycle.Entries[entry].AdditionalAuxPowerDemand : _drivingCycle.Entries[entry].AuxiliarySupplyPower[_auxiliaryId];
 		}
 
-- 
GitLab