From ea60de4eec6a822b9d169679ab07bd7835695521 Mon Sep 17 00:00:00 2001
From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at>
Date: Wed, 23 Nov 2022 09:43:46 +0100
Subject: [PATCH] set powerdemand to 0.Si<Watt> if powerdemand is null

---
 .../VectoCore/Models/SimulationComponent/ElectricSystem.cs    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs b/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs
index 5be54a2d3e..1e0bc2ecad 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs
@@ -28,9 +28,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
 
 		public IElectricSystemResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun = false)
 		{
-
+			powerDemand = powerDemand ?? 0.SI<Watt>();
 			var auxDemand = Consumers.Sum(x => x.PowerDemand(absTime, dt, dryRun)).DefaultIfNull(0);
-			var chargePower = Charger.Count == 0 ? 0.SI<Watt>() : Charger.Sum(x => x.PowerDemand(absTime, dt, powerDemand, auxDemand, dryRun));
+			var chargePower = Charger.Count == 0 ? 0.SI<Watt>() : Charger.Sum(x => x.PowerDemand(absTime, dt, powerDemand, auxDemand, dryRun)); 
 			var totalPowerDemand = powerDemand + chargePower - auxDemand;
 
 			var batResponse = Battery.MainBatteryPort.Request(absTime, dt, totalPowerDemand, dryRun);
-- 
GitLab