From 22cfc55e6b3b384ad6b1a54c354879e35043d173 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Tue, 27 Jul 2021 13:54:35 +0200
Subject: [PATCH] bugfix dcdc converter: consider efficiency when checking if
 battery can supply dcdc converter

---
 VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs
index fd0a9d86a5..2f277bc92e 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs
@@ -33,7 +33,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
 		{
 			var dischargeEnergy = (-DataBus.BatteryInfo.MaxDischargePower(dt) * dt);
 			var chargeEnergy = (-DataBus.BatteryInfo.MaxChargePower(dt) * dt);
-			if (PreviousState.ConsumedEnergy.IsBetween(chargeEnergy, dischargeEnergy)) {
+			if ((PreviousState.ConsumedEnergy / Efficiency).IsBetween(chargeEnergy, dischargeEnergy)) {
 				return PreviousState.ConsumedEnergy / dt / Efficiency;
 			}
 
-- 
GitLab