diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 8a7e9f344abcaf6fb60a04623b70a4646c6e23f9..7c05025a819033a7b82299abc10ef78adfb36464 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -1731,6 +1731,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl default: throw new VectoException("Wrong CycleType for SimplePowertrain"); } + if ((data.SuperCapData != null || data.BatteryData != null) && data.EngineData.WHRType.IsElectrical()) { + var dcDcConverterEfficiency = DeclarationData.WHRChargerEfficiency; + var whrCharger = new WHRCharger(container, dcDcConverterEfficiency); + es.Connect(whrCharger); + engine.WHRCharger = whrCharger; + } + vehicle.AddComponent(new Wheels(container, data.VehicleData.DynamicTyreRadius, data.VehicleData.WheelsInertia)) .AddComponent(ctl) .AddComponent(new Brakes(container)) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs b/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs index 533a22dce50e4ed01e9cf145d8fa998ad0ea6e58..5b02c4d9cc44e7a8270d963d572131a8b1b6bd0d 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs @@ -23,6 +23,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl protected override void DoCommitSimulationStep(Second time, Second simulationInterval) { AdvanceState(); + if (PreviousState.GeneratedEnergy == null && DataBus.IsTestPowertrain) { + // the method GeneratedEnergy is not called because there is no moddata to write and we are in a testpowertrain + // make sure the value is not null... + PreviousState.GeneratedEnergy = 0.SI<WattSecond>(); + } } #endregion diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index cddf1f60dd2be8b3ca89c10229ae77e07bab28c0..c73e2d1554162f00fb961103d680d5dfc88d16ec 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -494,7 +494,12 @@ 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) { + // we are close to the max charge - 'bypass' electric WHR... + pWHRelCorr = 0.SI<Watt>(); + } + container[ModalResultField.P_WHR_el_map] = pWHRelMap; container[ModalResultField.P_WHR_el_corr] = pWHRelCorr;