From 681b0d9f52bc312cf6b29be3960c53feb685aa7a Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <quaritsch@ivt.tugraz.at> Date: Thu, 2 Feb 2023 17:19:15 +0100 Subject: [PATCH] connect WHR also in simple powertrain (testpowertrain) make sure the whr previous state is correctly set if used in the testpowertrain --- .../VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs | 7 +++++++ VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs | 5 +++++ .../Models/SimulationComponent/Impl/CombustionEngine.cs | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 8a7e9f344a..7c05025a81 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 533a22dce5..5b02c4d9cc 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 cddf1f60dd..c73e2d1554 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; -- GitLab