From 06c91592e13acdb554bcd2d5974c6a80b52b6ee5 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <quaritsch@ivt.tugraz.at> Date: Tue, 7 Feb 2023 06:52:49 +0100 Subject: [PATCH] check if a battery is available, so the electric WHR is connected to the battery before checking whether the batery is full --- .../Models/SimulationComponent/Impl/CombustionEngine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index c73e2d1554..fd7d038a70 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -495,7 +495,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var (pWHRelMap, pWHRelCorr) = GetWHRPower(ModelData.ElectricalWHR, engineSpeed, engineTorque); var (pWHRmechMap, pWHRmechCorr) = GetWHRPower(ModelData.MechanicalWHR, engineSpeed, engineTorque); - if (Math.Abs(DataBus.BatteryInfo.StateOfCharge - DataBus.BatteryInfo.MaxSoC) < 0.01) { + if (DataBus.BatteryInfo != null && Math.Abs(DataBus.BatteryInfo.StateOfCharge - DataBus.BatteryInfo.MaxSoC) < 0.01) { // we are close to the max charge - 'bypass' electric WHR... pWHRelCorr = 0.SI<Watt>(); } -- GitLab