From 71756f7a6fe23017dc29b956173cee76a6fd19e3 Mon Sep 17 00:00:00 2001 From: Harald Martini <harald.martini@student.tugraz.at> Date: Wed, 5 Oct 2022 09:04:12 +0200 Subject: [PATCH] added GetIdleController override for BEVs --- .../Simulation/Impl/PowertrainBuilder.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 6a2d303a6c..e2b52bb8a4 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -699,6 +699,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl var cycle = new DistanceBasedDrivingCycle(container, data.Cycle); + var powertrain = cycle .AddComponent(new Driver(container, data.DriverData, new DefaultDriverStrategy(container))) .AddComponent(new Vehicle(container, data.VehicleData, data.AirdragData)) @@ -752,6 +753,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl new DummyEngineInfo(container); + if (data.BusAuxiliaries != null) { if (!data.BusAuxiliaries.ElectricalUserInputsConfig.ConnectESToREESS) { throw new VectoException("BusAux must be supplied from REESS!"); @@ -777,9 +779,24 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl } dcdc.Connect(elAux); + + + if (data.PTO != null) + { + cycle.IdleController = GetIdleController(data.PTO, em, container) as IdleControllerSwitcher; + if (cycle.IdleController == null) + { + throw new VectoException("Could not assign IdleController to cycle"); + } + elAux.AddAuxiliary(new EPTO()); + } + + dcdc.Initialize(); } + + return container; } @@ -1439,6 +1456,12 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ? engine.IdleController : new IdleControllerSwitcher(engine.IdleController, new PTOCycleController(container, pto.PTOCycle)); + private static IIdleController GetIdleController(PTOData pto, IElectricMotor electricMotor, + IVehicleContainer container) => + pto?.PTOCycle is null + ? electricMotor.IdleController + : new IdleControllerSwitcher(electricMotor.IdleController, new PTOCycleController(container, pto.PTOCycle)); + internal static IAuxInProvider CreateAdvancedAuxiliaries(VectoRunData data, IVehicleContainer container) { var conventionalAux = CreateAuxiliaries(data, container); -- GitLab