diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index bf3db4315b964fb2329128672a5ff35c7a742620..399f1b592f270d9afca27707ead63ef92314a236 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -81,6 +81,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl case VectoSimulationJobType.BatteryElectricVehicle: return BuildBatteryElectricPowertrain(data); case VectoSimulationJobType.EngineOnlySimulation: return BuildEngineOnly(data); case VectoSimulationJobType.IEPC_E: return BuildFullPowertrainIEPCE(data); + case VectoSimulationJobType.IEPC_S: return BuildFullPowertrainIEPCSerial(data); default: throw new ArgumentOutOfRangeException($"Powertrain Builder cannot build Powertrain for JobType: {data.JobType}"); } case CycleType.EngineOnly: return BuildEngineOnly(data); @@ -763,7 +764,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl container.ModData?.AddElectricMotor(pos); ctl.AddElectricMotor(pos, motorData.Item2); - var motor = new ElectricMotor(container, motorData.Item2, ctl.ElectricMotorControl(pos), pos); + var motor = pos == PowertrainPosition.IEPC + ? new IEPC(container, motorData.Item2, ctl.ElectricMotorControl(pos), pos) + : new ElectricMotor(container, motorData.Item2, ctl.ElectricMotorControl(pos), pos); if (pos == PowertrainPosition.GEN) { es.Connect(new GensetChargerAdapter(motor)); } else { @@ -799,9 +802,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl /// └AxleGear /// │ ├(AxlegearInputRetarder) /// | ├Singlespeed Gearbox - /// | └Engine Ex + /// | └Engine IEPC /// └ APTNGearbox - /// └Engine E2 + /// └Engine IEPC /// </code> /// </summary> private IVehicleContainer BuildFullPowertrainIEPCE(VectoRunData data) @@ -873,6 +876,101 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return container; } + /// <summary> + /// Builds a battery electric powertrain for either E4, E3, or E2. + /// <code> + /// DistanceBasedDrivingCycle + /// └Driver + /// └Vehicle + /// └Wheels + /// └Brakes + /// └AxleGear + /// │ ├(AxlegearInputRetarder) + /// | ├Singlespeed Gearbox + /// | └Engine IEPC + /// └ APTNGearbox + /// └Engine IEPC + /// </code> + /// </summary> + private IVehicleContainer BuildFullPowertrainIEPCSerial(VectoRunData data) + { + if (data.Cycle.CycleType != CycleType.DistanceBased) { + throw new VectoException("CycleType must be DistanceBased"); + } + if (data.ElectricMachinesData.Count(x => x.Item1 == PowertrainPosition.GEN) != 1) { + throw new VectoException("IEPC vehicle needs exactly one GEN set."); + } + if (data.ElectricMachinesData.Count(x => x.Item1 != PowertrainPosition.GEN) != 1) { + throw new VectoException("IEPC vehicle needs exactly one electric motor."); + } + + var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; + var es = ConnectREESS(data, container); + + var strategy = new SerialHybridStrategy(data, container); + var ctl = new SerialHybridController(container, strategy, es); + + var engine = new StopStartCombustionEngine(container, data.EngineData); + + var idleController = engine.IdleController; + ctl.Engine = engine; + + var aux = new ElectricAuxiliary(container); + aux.AddConstant("P_aux_el", data.ElectricAuxDemand ?? 0.SI<Watt>()); + es.Connect(aux); + + 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)) + .AddComponent(new Wheels(container, data.VehicleData.DynamicTyreRadius, data.VehicleData.WheelsInertia)) + .AddComponent(ctl) + .AddComponent(new Brakes(container)); + + var pos = data.ElectricMachinesData.First(x => x.Item1 != PowertrainPosition.GEN).Item1; + IElectricMotor em; + if (pos != PowertrainPosition.IEPC) { + throw new ArgumentOutOfRangeException(nameof(pos), pos, "Invalid engine powertrain position for BatteryElectric Vehicle"); + } + + //-->AxleGear-->APTNGearbox or SinglespeedGearbox-->Engine E2 + var gearbox = data.GearboxData.Gears.Count > 1 + ? (IGearbox)new APTNGearbox(container, new APTNShiftStrategy(container)) + : new SingleSpeedGearbox(container, data.GearboxData); + em = GetElectricMachine(PowertrainPosition.IEPC, data.ElectricMachinesData, container, es, ctl); + powertrain + .AddComponent(data.AxleGearData != null ? new AxleGear(container, data.AxleGearData) : null) + .AddComponent(GetRetarder(RetarderType.AxlegearInputRetarder, data.Retarder, container)) + .AddComponent(gearbox) + .AddComponent(em); + + new ATClutchInfo(container); + if (data.AxleGearData == null) { + new DummyAxleGearInfo(container); + } + + if (data.BusAuxiliaries != null) { + if (!data.BusAuxiliaries.ElectricalUserInputsConfig.ConnectESToREESS) { + throw new VectoException("BusAux must be supplied from REESS!"); + } + + var auxCfg = data.BusAuxiliaries; + var busAux = new BusAuxiliariesAdapter(container, auxCfg); + var electricStorage = new NoBattery(container); + busAux.ElectricStorage = electricStorage; + var dcdc = new DCDCConverter(container, data.BusAuxiliaries.ElectricalUserInputsConfig.DCDCEfficiency); + busAux.DCDCConverter = dcdc; + es.Connect(dcdc); + em.BusAux = busAux; + } + + ctl.GenSet.AddComponent(GetElectricMachine(PowertrainPosition.GEN, data.ElectricMachinesData, container, es, ctl)) + .AddComponent(engine, idleController) + .AddAuxiliaries(container, data); + + return container; + } + /// <summary> /// Builds a simple conventional powertrain. /// <code> @@ -1005,6 +1103,59 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl } } + /// <summary> + /// Builds a simple serial hybrid powertrain with either E4, E3, or E2. + /// <code> + /// Vehicle + /// └Wheels + /// └SimpleHybridController + /// └Brakes + /// │ └Engine E4 + /// └AxleGear + /// │ ├(AxlegearInputRetarder) + /// │ └Engine E3 + /// ├(AngleDrive) + /// ├(TransmissionOutputRetarder) + /// └Gearbox or APTNGearbox + /// ├(TransmissionInputRetarder) + /// └Engine E2 + /// </code> + /// </summary> + public void BuildSimpleIEPCHybridPowertrain(VectoRunData data, VehicleContainer container) + { + var es = ConnectREESS(data, container); + var aux = new ElectricAuxiliary(container); + aux.AddConstant("P_aux_el", data.ElectricAuxDemand ?? 0.SI<Watt>()); + es.Connect(aux); + es.Connect(new GensetChargerAdapter(null)); + + var ctl = new SimpleHybridController(container, es); + + //Vehicle-->Wheels-->SimpleHybridController-->Brakes + var powertrain = new Vehicle(container, data.VehicleData, data.AirdragData) + .AddComponent(new Wheels(container, data.VehicleData.DynamicTyreRadius, data.VehicleData.WheelsInertia)) + .AddComponent(ctl) + .AddComponent(new Brakes(container)); + + var pos = data.ElectricMachinesData.First(x => x.Item1 != PowertrainPosition.GEN).Item1; + var gearbox = data.GearboxData.Gears.Count > 1 + ? (IGearbox)new APTNGearbox(container, ctl.ShiftStrategy) + : new SingleSpeedGearbox(container, data.GearboxData); + var em = GetElectricMachine(PowertrainPosition.IEPC, data.ElectricMachinesData, container, es, ctl); + powertrain + .AddComponent(data.AxleGearData != null ? new AxleGear(container, data.AxleGearData) : null) + .AddComponent(GetRetarder(RetarderType.AxlegearInputRetarder, data.Retarder, container)) + .AddComponent(gearbox) + .AddComponent(em); + } + + /// <summary> + /// Builds a simple genset + /// <code> + /// Engine Gen + /// └CombustionEngine + /// </code> + /// </summary> public void BuildSimpleGenSet(VectoRunData data, VehicleContainer container) { var es = ConnectREESS(data, container); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs index c2166b8895b10ee83c88a922765ce2a897922789..ed2c50526f16e5319ecf01a5efbd3bcc161196fe 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs @@ -25,7 +25,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (dataBus.RunData.VehicleData == null) { return; } - SetupVelocityDropPreprocessor(dataBus); + + if (!dataBus.IsTestPowertrain) { + SetupVelocityDropPreprocessor(dataBus); + } } public new static string Name => "APT-N"; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs index f910fa535413d41bf50afa4c4151199798964654..1ea0ef778e71df79a4fe3a7b8ea3b06f455a56f0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs @@ -116,9 +116,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ratio = DataBus.AxlegearInfo.Ratio; } - if (pos == PowertrainPosition.BatteryElectricE2) { + if (pos == PowertrainPosition.BatteryElectricE2 || pos == PowertrainPosition.IEPC) { ratio = DataBus.GearboxInfo.GetGearData(DataBus.GearboxInfo.NumGears).Ratio * - DataBus.AxlegearInfo.Ratio * + (DataBus.AxlegearInfo?.Ratio ?? 1.0) * (DataBus.AngledriveInfo?.Ratio ?? 1.0); } MaxVehicleSpeed = maxEMSpeed / ratio * DataBus.WheelsInfo.DynamicTyreRadius * 0.995; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs index 0b0700ec087b0d0c3f5e3047bd29801ef585c1d0..f9a5cc20ecc08f4558c10ffdd0a56f72683681d6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs @@ -289,9 +289,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var modData = new ModalDataContainer(runData, null, null); var builder = new PowertrainBuilder(modData); var testContainer = new SimplePowertrainContainer(runData); - builder.BuildSimpleSerialHybridPowertrain(runData, testContainer); + if (runData.JobType == VectoSimulationJobType.IEPC_S) { + builder.BuildSimpleIEPCHybridPowertrain(runData, testContainer); + } else { + builder.BuildSimpleSerialHybridPowertrain(runData, testContainer); + } - TestPowertrain = new TestPowertrain<T>(testContainer, DataBus); + TestPowertrain = new TestPowertrain<T>(testContainer, DataBus); var gensetContainer = new SimplePowertrainContainer(runData); builder.BuildSimpleGenSet(runData, gensetContainer);