From a0b13ffa3bebdf1ae16356ec49d05c37dbbf12d7 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Tue, 27 Jul 2021 18:06:41 +0200
Subject: [PATCH] bugfix in batterySystem::MaxSoC (resulted in confusion
 (invalid scores) in hybrid strategy), set fuel costs to 0 if ICE is off

---
 .../Models/SimulationComponent/Impl/BatterySystem.cs          | 2 +-
 .../Models/SimulationComponent/Strategies/HybridStrategy.cs   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs
index b2856aa303..8ea633a720 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs
@@ -219,7 +219,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 		}
 
 		public double MinSoC => _minSoc ?? (_minSoc = Batteries.Values.Sum(x => x.CapacityMinSoc) / TotalCapacity);
-		public double MaxSoC => _maxSoc ?? (_maxSoc = Batteries.Values.Sum(x => x.CapacityMinSoc) / TotalCapacity);
+		public double MaxSoC => _maxSoc ?? (_maxSoc = Batteries.Values.Sum(x => x.CapacityMaxSoc) / TotalCapacity);
 		public AmpereSecond Capacity => TotalCapacity;
 
 		public Volt NominalVoltage => Batteries.Values.Select(x => x.NominalVoltage).Average();
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
index 79f9e7d481..d74718f13e 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
@@ -2099,11 +2099,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
 					VectoMath.Min(
 						ModelData.GearboxData.Gears[resp.Gearbox.Gear.Gear].MaxSpeed,
 						DataBus.EngineInfo.EngineN95hSpeed)) ) {
-				tmp.FuelCosts = double.NaN;
+				tmp.FuelCosts = iceOff ? 0 : double.NaN;
 				tmp.IgnoreReason |= HybridConfigurationIgnoreReason.EngineSpeedTooHigh;
 			}
 			if (resp.Engine.EngineSpeed.IsSmallerOrEqual(ModelData.EngineData.IdleSpeed)) {
-				tmp.FuelCosts = double.NaN;
+				tmp.FuelCosts = iceOff ? 0 : double.NaN;
 				tmp.IgnoreReason |= HybridConfigurationIgnoreReason.EngineSpeedTooLow;
 			}
 
-- 
GitLab