From 248ee6d24877d1d28dd00caef0e61a1393369ebe Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Wed, 23 Mar 2022 17:57:18 +0100 Subject: [PATCH] adding whr charger class - connect generated whr power to REESS via whr charger. --- .../Models/Declaration/DeclarationData.cs | 2 + .../Models/Simulation/DataBus/IDataBus.cs | 2 + .../Simulation/Impl/PowertrainBuilder.cs | 26 +++- .../Simulation/Impl/VehicleContainer.cs | 6 + .../Models/Simulation/Impl/WHRCharger.cs | 77 ++++++++++ .../SimulationComponent/DCDCConverter.cs | 5 +- .../Impl/CombustionEngine.cs | 40 ++--- .../Impl/StopStartCombustionEngine.cs | 5 +- .../Strategies/HybridStrategy.cs | 14 ++ .../Strategies/SerialHybridStrategy.cs | 16 ++ .../Strategies/TestPowertrain.cs | 6 + .../ModalDataPostprocessingCorrection.cs | 7 +- .../Integration/Hybrid/ParallelHybridTest.cs | 8 +- .../P2 Group 5_325kW_WHR.vecto | 64 ++++++++ .../VKM/325kW_WHR.vmap | 140 ++++++++++++++++++ .../VKM/Engine_325kW_12.7l_WHR.veng | 42 ++++++ .../Utils/MockVehicleContainer.cs | 1 + 17 files changed, 431 insertions(+), 30 deletions(-) create mode 100644 VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs create mode 100644 VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/P2 Group 5_325kW_WHR.vecto create mode 100644 VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/325kW_WHR.vmap create mode 100644 VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/Engine_325kW_12.7l_WHR.veng diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index a8951c08c7..955717ee9e 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -100,6 +100,8 @@ namespace TUGraz.VectoCore.Models.Declaration public const double AlternatorEfficiency = 0.7; + public const double WHRChargerEfficiency = 0.98; + public static readonly ConcurrentDictionary<MissionType, DrivingCycleData> CyclesCache = new ConcurrentDictionary<MissionType, DrivingCycleData>(); diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs index 72d333eee4..00a7d3ab44 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs @@ -32,6 +32,7 @@ using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Models.Simulation.DataBus @@ -90,6 +91,7 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus IDCDCConverter DCDCConverter { get; } + WHRCharger WHRCharger { get; } bool IsTestPowertrain { get; } } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index e8c6f276bc..fe43bf9718 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -383,6 +383,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; var es = new ElectricSystem(container); + if (data.BatteryData != null && data.SuperCapData != null) { + throw new VectoException("Only one type of REESS is supported!"); + } if (data.BatteryData != null) { if (data.BatteryData.InitialSoC < data.BatteryData.Batteries.Min(x => x.Item2.MinSOC)) { throw new VectoException("Battery: Initial SoC has to be higher than min SoC"); @@ -401,10 +404,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl es.Connect(superCap); } - //var battery = new Battery(container, data.BatteryData); - //battery.Initialize(data.BatteryData.InitialSoC); - //es.Connect(battery); - var aux = new ElectricAuxiliary(container); aux.AddConstant("P_aux_el", data.ElectricAuxDemand ?? 0.SI<Watt>()); es.Connect(aux); @@ -436,6 +435,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ctl.Gearbox = gbx; ctl.Engine = engine; + 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; + + } + // DistanceBasedDrivingCycle --> driver --> vehicle --> wheels // --> axleGear --> (retarder) --> gearBox --> (retarder) --> clutch --> engine <-- Aux var cycle = new DistanceBasedDrivingCycle(container, data.Cycle); @@ -497,6 +504,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; var es = new ElectricSystem(container); + if (data.BatteryData != null && data.SuperCapData != null) { + throw new VectoException("Only one type of REESS is supported!"); + } if (data.BatteryData != null) { if (data.BatteryData.InitialSoC < data.BatteryData.Batteries.Min(x => x.Item2.MinSOC)) { throw new VectoException("Battery: Initial SoC has to be higher than min SoC"); @@ -533,6 +543,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl var idleController = engine.IdleController; ctl.Engine = engine; + 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; + + } + var cycle = new DistanceBasedDrivingCycle(container, data.Cycle); var powertrain = cycle .AddComponent(new Driver(container, data.DriverData, new DefaultDriverStrategy(container))) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index f4d2994642..182243953c 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -83,6 +83,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public IDCDCConverter DCDCConverter { get; protected set; } + public WHRCharger WHRCharger { get; protected set; } + public IElectricSystemInfo ElectricSystemInfo { get; protected set; } public virtual bool IsTestPowertrain => false; @@ -187,6 +189,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ElectricMotors[c23.Position] = c23; HasElectricMotor = true; } + + if (component is WHRCharger c25) { + WHRCharger = c25; + } _components.Add(Tuple.Create(commitPriority, component)); //todo mk20210617 use sorted list with inverse commitPriority (-commitPriority) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs b/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs new file mode 100644 index 0000000000..979140c4bf --- /dev/null +++ b/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs @@ -0,0 +1,77 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.Simulation.Impl +{ + public class WHRCharger : StatefulVectoSimulationComponent<WHRCharger.State>, IElectricChargerPort + { + public double Efficiency { get; } + + public WHRCharger(VehicleContainer container, double efficiency) : base(container) + { + Efficiency = efficiency; + PreviousState.GeneratedEnergy = 0.SI<WattSecond>(); + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { } + + protected override void DoCommitSimulationStep(Second time, Second simulationInterval) + { + AdvanceState(); + } + + #endregion + + #region Implementation of IElectricChargerPort + + public Watt Initialize() + { + PreviousState.GeneratedEnergy = 0.SI<WattSecond>(); + return 0.SI<Watt>(); + } + + public Watt PowerDemand(Second absTime, Second dt, Watt consumerPowerDemand, Watt auxPower, bool dryRun) + { + var maxDischargeEnergy = (-DataBus.BatteryInfo.MaxDischargePower(dt) * dt); + var maxChargeEnergy = (-DataBus.BatteryInfo.MaxChargePower(dt) * dt); + + var chargeEnergy = PreviousState.GeneratedEnergy + PreviousState.ExcessiveEnergy; + var efficiency = chargeEnergy > 0 ? Efficiency : 1 / Efficiency; + if ((chargeEnergy * efficiency).IsBetween(maxChargeEnergy, maxDischargeEnergy)) { + return chargeEnergy / dt * efficiency; + } + + if (!dryRun) { + CurrentState.ExcessiveEnergy = PreviousState.GeneratedEnergy; + } + + return 0.SI<Watt>(); + } + + public void GeneratedEnergy(WattSecond electricEnergy) + { + CurrentState.GeneratedEnergy = electricEnergy; + + } + + #endregion + + public class State + { + public State() + { + ExcessiveEnergy = 0.SI<WattSecond>(); + } + + public WattSecond GeneratedEnergy { get; set; } + + public WattSecond ExcessiveEnergy { get; set; } + } + + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs index 2f277bc92e..c42d792ece 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs @@ -33,8 +33,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent { var dischargeEnergy = (-DataBus.BatteryInfo.MaxDischargePower(dt) * dt); var chargeEnergy = (-DataBus.BatteryInfo.MaxChargePower(dt) * dt); - if ((PreviousState.ConsumedEnergy / Efficiency).IsBetween(chargeEnergy, dischargeEnergy)) { - return PreviousState.ConsumedEnergy / dt / Efficiency; + var efficiency = PreviousState.ConsumedEnergy > 0 ? 1 / Efficiency : Efficiency; + if ((PreviousState.ConsumedEnergy * efficiency).IsBetween(chargeEnergy, dischargeEnergy)) { + return PreviousState.ConsumedEnergy / dt * efficiency; } // write in mod-file for post-processing correction diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index ac304a4120..348c303923 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -70,6 +70,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected internal IAuxPort EngineAux; + public WHRCharger WHRCharger { get; set; } + public CombustionEngine(IVehicleContainer container, CombustionEngineData modelData, bool pt1Disabled = false) : base(container) { @@ -450,7 +452,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl container[ModalResultField.T_ice_drag] = CurrentState.FullDragTorque; container[ModalResultField.ICEOn] = CurrentState.EngineOn; - WriteWHRPower(container, avgEngineSpeed, CurrentState.EngineTorque); + WriteWHRPower(container, avgEngineSpeed, CurrentState.EngineTorque, simulationInterval); foreach (var fuel in ModelData.Fuels) { var result = fuel.ConsumptionMap.GetFuelConsumption( @@ -473,43 +475,39 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fcNCVcorr = fc * fuelData.HeatingValueCorrection; // TODO: wird fcNCVcorr var fcWHTC = fcNCVcorr * WHTCCorrectionFactor(fuel.FuelData); - //var fcAAUX = fcWHTC; - var advancedAux = EngineAux as BusAuxiliariesAdapter; - if (advancedAux != null) { + + if (EngineAux is BusAuxiliariesAdapter advancedAux) { advancedAux.DoWriteModalResultsICE(time, simulationInterval ,container); - //fcAAUX = advancedAux.AAuxFuelConsumption; } - var fcFinal = fcWHTC; // fcAAUX; + var fcFinal = fcWHTC; container[ModalResultField.FCMap, fuelData] = fc; container[ModalResultField.FCNCVc, fuel.FuelData] = fcNCVcorr; container[ModalResultField.FCWHTCc, fuel.FuelData] = fcWHTC; - //container[ModalResultField.FCAAUX, fuel.FuelData] = fcAAUX; - //container[ModalResultField.FCICEStopStart, fuel.FuelData] = fcFinal; container[ModalResultField.FCFinal, fuel.FuelData] = fcFinal; } } - protected virtual void WriteWHRPower(IModalDataContainer container, PerSecond engineSpeed, NewtonMeter engineTorque) + protected virtual void WriteWHRPower(IModalDataContainer container, PerSecond engineSpeed, + NewtonMeter engineTorque, Second simulationInterval) { - var pWHRelMap = 0.SI<Watt>(); - var pWHRelCorr = 0.SI<Watt>(); - var pWHRmechMap = 0.SI<Watt>(); - var pWHRmechCorr = 0.SI<Watt>(); - GetWHRPower(ModelData.ElectricalWHR, engineSpeed, engineTorque, ref pWHRelMap, ref pWHRelCorr); - GetWHRPower(ModelData.MechanicalWHR, engineSpeed, engineTorque, ref pWHRmechMap, ref pWHRmechCorr); + + var (pWHRelMap, pWHRelCorr) = GetWHRPower(ModelData.ElectricalWHR, engineSpeed, engineTorque); + var (pWHRmechMap, pWHRmechCorr) = GetWHRPower(ModelData.MechanicalWHR, engineSpeed, engineTorque); container[ModalResultField.P_WHR_el_map] = pWHRelMap; container[ModalResultField.P_WHR_el_corr] = pWHRelCorr; + WHRCharger?.GeneratedEnergy(pWHRelCorr * simulationInterval); + container[ModalResultField.P_WHR_mech_map] = pWHRmechMap; container[ModalResultField.P_WHR_mech_corr] = pWHRmechCorr; } - protected virtual void GetWHRPower(WHRData whr, PerSecond engineSpeed, NewtonMeter engineTorque, ref Watt pWHRMap, ref Watt pWHRCorr) + protected virtual (Watt, Watt) GetWHRPower(WHRData whr, PerSecond engineSpeed, NewtonMeter engineTorque) { if (whr == null) { - return; + return (0.SI<Watt>(), 0.SI<Watt>()); } var whrPwr = whr.WHRMap.GetWHRPower( @@ -520,9 +518,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl engineSpeed.Value(), engineTorque.Value(), whr.WHRMap.Name); } if (whrPwr.GeneratedPower != null) { - pWHRMap = whrPwr.GeneratedPower; - pWHRCorr = pWHRMap * whr.WHRCorrectionFactor; + var pWHRMap = whrPwr.GeneratedPower; + var pWHRCorr = pWHRMap * whr.WHRCorrectionFactor; + return (pWHRMap, pWHRCorr); } + return (0.SI<Watt>(), 0.SI<Watt>()); } protected virtual double WHTCCorrectionFactor(IFuelProperties fuel) @@ -580,7 +580,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // new check in vecto 3.x (according to Martin Rexeis) - if (dynFullPowerCalculated < StationaryIdleFullLoadPower) { + if (dynFullPowerCalculated < StationaryIdleFullLoadPower) { dynFullPowerCalculated = StationaryIdleFullLoadPower; } if (dynFullPowerCalculated > stationaryFullLoadPower) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs index d0288d50b2..96aba3d63c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs @@ -5,6 +5,7 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Utils; @@ -29,7 +30,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } public override bool CombustionEngineOn { get; set; } - + #region Overrides of CombustionEngine public override IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun) @@ -224,6 +225,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl container[ModalResultField.P_WHR_el_map] = 0.SI<Watt>(); container[ModalResultField.P_WHR_el_corr] = 0.SI<Watt>(); + WHRCharger?.GeneratedEnergy(0.SI<WattSecond>()); + container[ModalResultField.P_WHR_mech_map] = 0.SI<Watt>(); container[ModalResultField.P_WHR_mech_corr] = 0.SI<Watt>(); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 638b74642f..eeeff99dc0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -137,6 +137,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies (DataBus.DCDCConverter as DCDCConverter).PreviousState.ConsumedEnergy; } + if (TestPowertrain.WHRCharger != null) { + TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = + DataBus.WHRCharger.PreviousState.GeneratedEnergy; + TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = + DataBus.WHRCharger.PreviousState.ExcessiveEnergy; + } + TestPowertrain.Gearbox.PreviousState.InAngularVelocity = (DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity; @@ -317,6 +324,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies (DataBus.DCDCConverter as DCDCConverter).PreviousState.ConsumedEnergy; } + if (TestPowertrain.WHRCharger != null) { + TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = + DataBus.WHRCharger.PreviousState.GeneratedEnergy; + TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = + DataBus.WHRCharger.PreviousState.ExcessiveEnergy; + } + TestPowertrain.Gearbox.PreviousState.OutAngularVelocity = gearboxInfo.PreviousState.OutAngularVelocity; TestPowertrain.Gearbox.PreviousState.InAngularVelocity = gearboxInfo.PreviousState.InAngularVelocity; TestPowertrain.Gearbox._powershiftLossEnergy = gearboxInfo._powershiftLossEnergy; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs index f64706e76e..45f322c4b7 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs @@ -75,6 +75,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } TestPowertrain.Charger.ChargingPower = maxPowerGenset.ElectricPower; + + if (TestPowertrain.WHRCharger != null) { + TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = + DataBus.WHRCharger.PreviousState.GeneratedEnergy; + TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = + DataBus.WHRCharger.PreviousState.ExcessiveEnergy; + } + TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); @@ -169,6 +177,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } TestPowertrain.Charger.ChargingPower = maxPowerGenset.ElectricPower; + + if (TestPowertrain.WHRCharger != null) { + TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = + DataBus.WHRCharger.PreviousState.GeneratedEnergy; + TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = + DataBus.WHRCharger.PreviousState.ExcessiveEnergy; + } + TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs index 46a49f5cac..71a9ea6a40 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs @@ -58,6 +58,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public Dictionary<PowertrainPosition, ElectricMotor> ElectricMotorsUpstreamTransmission = new Dictionary<PowertrainPosition, ElectricMotor>(); public TorqueConverter TorqueConverter; public DCDCConverter DCDCConverter; + public WHRCharger WHRCharger; public TestPowertrain(SimplePowertrainContainer container, IDataBus realContainer) { @@ -95,6 +96,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (busAux != null && busAux.ElectricalUserInputsConfig.ConnectESToREESS) { DCDCConverter = container.DCDCConverter as DCDCConverter; } + + var whrCharger = container.SimulationComponents().FirstOrDefault(x => x is WHRCharger); + if (whrCharger != null) { + WHRCharger = whrCharger as WHRCharger; + } var driver = new MockDriver(container, realContainer); var cycle = new MockDrivingCycle(container, realContainer); diff --git a/VectoCore/VectoCore/OutputData/ModalDataPostprocessingCorrection.cs b/VectoCore/VectoCore/OutputData/ModalDataPostprocessingCorrection.cs index cb86cb60a5..411fea3308 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataPostprocessingCorrection.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataPostprocessingCorrection.cs @@ -265,8 +265,12 @@ namespace TUGraz.VectoCore.OutputData private static void SetWHRWork(IModalDataContainer modData, VectoRunData runData, CorrectedModalData r) { - r.WorkWHREl = modData.TimeIntegral<WattSecond>(ModalResultField.P_WHR_el_corr); + // no post-processing correction for electric WHR for HEV (WHR is connected to REESS in simulation) + r.WorkWHREl = (runData.BatteryData != null || runData.SuperCapData != null) && runData.EngineData.WHRType.IsElectrical() + ? 0.SI<WattSecond>() + : modData.TimeIntegral<WattSecond>(ModalResultField.P_WHR_el_corr); var altEff = DeclarationData.AlternatorEfficiency; + // in case of bus-auxiliaries update alternator efficiency depending on busaux configuration if (runData.BusAuxiliaries != null) { if (runData.BusAuxiliaries.ElectricalUserInputsConfig.ConnectESToREESS && runData.BusAuxiliaries.ElectricalUserInputsConfig.AlternatorType == AlternatorType.Smart) { @@ -287,6 +291,7 @@ namespace TUGraz.VectoCore.OutputData } r.WorkWHRElMech = -r.WorkWHREl / altEff; + r.WorkWHRMech = -modData.TimeIntegral<WattSecond>(ModalResultField.P_WHR_mech_corr); } diff --git a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs index f1b1ee675f..02a72ebcf1 100644 --- a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs @@ -232,7 +232,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid const string TestJobP1_APTS = @"TestData\Hybrids\GenericVehicle_P1-APT\CityBus_AT_Ser.vecto"; const string TestJobP1_APTP = @"TestData\Hybrids\GenericVehicle_P1-APT\CityBus_AT_PS.vecto"; - private const string TestJobP1 = @"E:\QUAM\tmp\Citybus_P1-APT-S-175kW-6.8l_C1\CityBus_AT_Ser.vecto"; + //private const string TestJobP1 = @"E:\QUAM\tmp\Citybus_P1-APT-S-175kW-6.8l_C1\CityBus_AT_Ser.vecto"; private const string TestJobCityBusP1_APTP = @"TestData\Hybrids\Citybus_P1-APT-P-220kW-7.7l\CityBus_AT-P.vecto"; @@ -576,6 +576,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid public const string Group5TestJob325kW = @"TestData\Hybrids\GenericVehicle_Group5_P2\P2 Group 5_325kW.vecto"; + public const string Group5TestJob325kW_WhrEl = @"TestData\Hybrids\GenericVehicle_Group5_P2\P2 Group 5_325kW_WHR.vecto"; + [ TestCase(Group5TestJob325kW, 0, TestName = "P2 Hybrid Group 5 325kW DriveCycle LongHaul"), TestCase(Group5TestJob325kW, 1, TestName = "P2 Hybrid Group 5 325kW DriveCycle Coach"), @@ -586,7 +588,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid TestCase(Group5TestJob325kW, 6, TestName = "P2 Hybrid Group 5 325kW DriveCycle RegionalDelivery"), TestCase(Group5TestJob325kW, 7, TestName = "P2 Hybrid Group 5 325kW DriveCycle Suburban"), TestCase(Group5TestJob325kW, 8, TestName = "P2 Hybrid Group 5 325kW DriveCycle Urban"), - TestCase(Group5TestJob325kW, 9, TestName = "P2 Hybrid Group 5 325kW DriveCycle UrbanDelivery"), + TestCase(Group5TestJob325kW, 9, TestName = "P2 Hybrid Group 5 325kW DriveCycle UrbanDelivery"), + + TestCase(Group5TestJob325kW_WhrEl, 6, TestName = "P2 Hybrid Group 5 325kW WHR DriveCycle RegionalDelivery"), ] public void P2HybridGroup5DriveCycle_325kW(string jobFile, int cycleIdx) { RunHybridJob(jobFile, cycleIdx); } diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/P2 Group 5_325kW_WHR.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/P2 Group 5_325kW_WHR.vecto new file mode 100644 index 0000000000..da386bfad4 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/P2 Group 5_325kW_WHR.vecto @@ -0,0 +1,64 @@ +{ + "Header": { + "CreatedBy": "", + "Date": "2020-08-24T13:41:04.1591616Z", + "AppVersion": "3", + "FileVersion": 8 + }, + "Body": { + "SavedInDeclMode": false, + "EngineOnlyMode": false, + "VehicleFile": "Vehicle\\Group5_HEV_325kW.vveh", + "EngineFile": "VKM\\Engine_325kW_12.7l_WHR.veng", + "GearboxFile": "Transmission\\AMT_12.vgbx", + "TCU": "Transmission\\AMT_12.vgbx", + "ShiftStrategy": "TUGraz.VectoCore.Models.SimulationComponent.Impl.AMTShiftStrategy", + "HybridStrategyParams": "ElectricMotor\\Inputdaten P2 Group 5\\Electric components\\Hybrid_Parameters.vhctl", + "AuxiliaryAssembly": "Classic", + "AuxiliaryVersion": "CLASSIC", + "AdvancedAuxiliaryFilePath": "", + "Aux": [], + "Padd": 3000.0, + "Padd_electric": 0.0, + "VACC": "Vehicle\\Truck.vacc", + "EngineStopStartAtVehicleStopThreshold": 0.0, + "EngineStopStartMaxOffTimespan": 1000.0, + "EngineStopStartUtilityFactor": 0.0, + "EcoRollMinSpeed": 0.0, + "EcoRollActivationDelay": 0.0, + "EcoRollUnderspeedThreshold": 0.0, + "EcoRollMaxAcceleration": 0.0, + "PCCEnableSpeed": 0.0, + "PCCMinSpeed": 0.0, + "PCCUnderspeed": 0.0, + "PCCOverSpeed": 5.0, + "PCCPreviewDistanceUC1": 0.0, + "PCCPreviewDistanceUC2": 0.0, + "LAC": { + "Enabled": true, + "PreviewDistanceFactor": 10.0, + "DF_offset": 2.5, + "DF_scaling": 1.5, + "DF_targetSpeedLookup": "", + "Df_velocityDropLookup": "", + "MinSpeed": 50.0 + }, + "OverSpeedEcoRoll": { + "Mode": "Overspeed", + "MinSpeed": 50.0, + "OverSpeed": 2.5 + }, + "Cycles": [ + "LongHaul", + "Coach", + "Construction", + "HeavyUrban", + "Interurban", + "MunicipalUtility", + "RegionalDelivery", + "Suburban", + "Urban", + "UrbanDelivery" + ] + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/325kW_WHR.vmap b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/325kW_WHR.vmap new file mode 100644 index 0000000000..db2292690b --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/325kW_WHR.vmap @@ -0,0 +1,140 @@ +engine speed [rpm] , torque [Nm] , fuel consumption [g/h] , whr power electric [W] +500 , -135.5 , 0 , 500 +500 , 0 , 1355 , 500 +500 , 213.4 , 3412.291 , 500 +500 , 426.8 , 5830.1 , 500 +500 , 640.2 , 8316.426 , 500 +500 , 853.6 , 10439.87 , 500 +500 , 1067 , 12823.69 , 500 +500 , 1188 , 14228.79 , 500 +500 , 1401.4 , 16628.66 , 500 +600 , -138 , 0 , 500 +600 , 0 , 1355 , 500 +600 , 213.4 , 3412.291 , 500 +600 , 426.8 , 5830.1 , 500 +600 , 640.2 , 8316.426 , 500 +600 , 853.6 , 10439.87 , 500 +600 , 1067 , 12823.69 , 500 +600 , 1188 , 14228.79 , 500 +600 , 1401.4 , 16628.66 , 500 +751 , -141.775 , 0 , 500 +750.9 , 0 , 1649.255 , 500 +750.9 , 213.4 , 4157.795 , 500 +750.9 , 426.8 , 7149.494 , 500 +750.9 , 640.2 , 10037.08 , 500 +750.9 , 853.6 , 12957.07 , 500 +750.9 , 1067 , 16055.22 , 500 +750.9 , 1280.4 , 19231.36 , 500 +750.9 , 1493.8 , 22400.17 , 500 +750.9 , 1544.879 , 23213.92 , 500 +751 , 1758.279 , 26392.93 , 500 +902 , -147.59 , 0 , 500 +901.8 , 0 , 2210.735 , 500 +901.8 , 213.4 , 5204.867 , 500 +901.8 , 426.8 , 8515.462 , 500 +901.8 , 640.2 , 11804.75 , 500 +901.8 , 853.6 , 15410.55 , 500 +901.8 , 1067 , 19081.7 , 500 +901.8 , 1280.4 , 22742.96 , 500 +901.8 , 1493.8 , 26543.87 , 500 +901.8 , 1707.2 , 30534.68 , 500 +901.8 , 1901.757 , 34352.75 , 500 +902 , 2115.157 , 38403.27 , 500 +1053 , -155.445 , 0 , 500 +1052.7 , 0 , 2768.035 , 500 +1052.7 , 213.4 , 6228.407 , 500 +1052.7 , 426.8 , 9836.041 , 500 +1052.7 , 640.2 , 13624.5 , 500 +1052.7 , 853.6 , 17854.95 , 500 +1052.7 , 1067 , 22072.71 , 500 +1052.7 , 1280.4 , 26161.13 , 500 +1052.7 , 1493.8 , 30525.55 , 500 +1052.7 , 1707.2 , 35019.18 , 500 +1052.7 , 1920.6 , 39913.3 , 500 +1052.7 , 2134 , 45438.16 , 500 +1053 , 2347.4 , 50542.53 , 500 +1204 , -165.44 , 0 , 500 +1203.6 , 0 , 3086.704 , 500 +1203.6 , 213.4 , 6943.027 , 500 +1203.6 , 426.8 , 11040.37 , 500 +1203.6 , 640.2 , 15504.65 , 500 +1203.6 , 853.6 , 20335.89 , 500 +1203.6 , 1067 , 25176.6 , 500 +1203.6 , 1280.4 , 29782.22 , 500 +1203.6 , 1493.8 , 34642.24 , 500 +1203.6 , 1707.2 , 39786.14 , 500 +1203.6 , 1920.6 , 45254.8 , 500 +1203.6 , 2134 , 51129.03 , 500 +1204 , 2347.4 , 56732.88 , 500 +1367 , -183.37 , 0 , 500 +1367.1 , 0 , 3845.344 , 500 +1367.1 , 213.4 , 7981.742 , 500 +1367.1 , 426.8 , 12796.69 , 500 +1367.1 , 640.2 , 17789.2 , 500 +1367.1 , 853.6 , 22854.21 , 500 +1367.1 , 1067 , 28302.84 , 500 +1367.1 , 1280.4 , 33739.91 , 500 +1367.1 , 1493.8 , 39393.87 , 500 +1367.1 , 1707.2 , 45836.33 , 500 +1367.1 , 1920.6 , 52078.71 , 500 +1367.1 , 2134 , 58296.41 , 500 +1367 , 2347.4 , 64530.56 , 500 +1490 , -200.5 , 0 , 500 +1489.6 , 0 , 4373.424 , 500 +1489.6 , 213.4 , 8861.484 , 500 +1489.6 , 426.8 , 14090.86 , 500 +1489.6 , 640.2 , 19518.29 , 500 +1489.6 , 853.6 , 25092.8 , 500 +1489.6 , 1067 , 30873.69 , 500 +1489.6 , 1280.4 , 36865.42 , 500 +1489.6 , 1493.8 , 43095.57 , 500 +1489.6 , 1707.2 , 50249.81 , 500 +1489.6 , 1920.6 , 57035.25 , 500 +1489.6 , 2041.712 , 60609.5 , 500 +1490 , 2255.112 , 67311.83 , 500 +1612 , -218.62 , 0 , 500 +1612.2 , 0 , 4904.015 , 500 +1612.2 , 213.4 , 9810.482 , 500 +1612.2 , 426.8 , 15403.9 , 500 +1612.2 , 640.2 , 21301.35 , 500 +1612.2 , 853.6 , 27492.32 , 500 +1612.2 , 1067 , 33580.96 , 500 +1612.2 , 1280.4 , 40114.61 , 500 +1612.2 , 1493.8 , 46914.77 , 500 +1612.2 , 1707.2 , 54666.14 , 500 +1612.2 , 1915.434 , 61862.91 , 500 +1612 , 2128.834 , 69491.99 , 500 +1735 , -235.225 , 0 , 500 +1734.7 , 0 , 5586.953 , 500 +1734.7 , 213.4 , 11041.15 , 500 +1734.7 , 426.8 , 16949.24 , 500 +1734.7 , 640.2 , 23500.23 , 500 +1734.7 , 853.6 , 30159.59 , 500 +1734.7 , 1067 , 36741.18 , 500 +1734.7 , 1280.4 , 43923.85 , 500 +1734.7 , 1493.8 , 51295.21 , 500 +1734.7 , 1707.2 , 59469.31 , 500 +1734.7 , 1789.259 , 62731.31 , 500 +1735 , 2002.659 , 70935.23 , 500 +1857 , -253.69 , 0 , 500 +1857.3 , 0 , 6673.839 , 500 +1857.3 , 213.4 , 12518.56 , 500 +1857.3 , 426.8 , 18687.88 , 500 +1857.3 , 640.2 , 25652.39 , 500 +1857.3 , 853.6 , 33003.08 , 500 +1857.3 , 1067 , 40438.09 , 500 +1857.3 , 1280.4 , 48117.52 , 500 +1857.3 , 1493.8 , 55848.59 , 500 +1857.3 , 1587.631 , 59434.17 , 500 +1857 , 1801.031 , 67215.39 , 500 +1957 , -270.69 , 0 , 500 +1957.3 , 0 , 6673.839 , 500 +1957.3 , 213.4 , 12518.56 , 500 +1957.3 , 426.8 , 18687.88 , 500 +1957.3 , 640.2 , 25652.39 , 500 +1957.3 , 853.6 , 33003.08 , 500 +1957.3 , 1067 , 40438.09 , 500 +1957.3 , 1280.4 , 48117.52 , 500 +1957.3 , 1493.8 , 55848.59 , 500 +1957.3 , 1587.631 , 59434.17 , 500 +1957 , 1801.031 , 67215.39 , 500 diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/Engine_325kW_12.7l_WHR.veng b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/Engine_325kW_12.7l_WHR.veng new file mode 100644 index 0000000000..78d970011f --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_Group5_P2/VKM/Engine_325kW_12.7l_WHR.veng @@ -0,0 +1,42 @@ +{ + "Header": { + "CreatedBy": "", + "Date": "2020-08-21T09:24:04.0725494Z", + "AppVersion": "3", + "FileVersion": 5 + }, + "Body": { + "SavedInDeclMode": false, + "ModelName": "325kW 12.7l Engine", + "Displacement": "12740", + "IdlingSpeed": 600.0, + "Inertia": 5.1498, + "Fuels": [ + { + "WHTC-Urban": 0.0, + "WHTC-Rural": 0.0, + "WHTC-Motorway": 0.0, + "WHTC-Engineering": 1.0, + "ColdHotBalancingFactor": 0.0, + "CFRegPer": 1.0, + "FuelMap": "325kW_WHR.vmap", + "FuelType": "DieselCI" + } + ], + "RatedPower": 0.0, + "RatedSpeed": 0.0, + "MaxTorque": 0.0, + "FullLoadCurve": "325kW.vfld", + "WHRType": [ + "ElectricalOutput" + ], + "WHRCorrectionFactors": { + "Urban": 1.0, + "Rural": 1.0, + "Motorway": 1.0, + "ColdHotBalancingFactor": 1.0, + "CFRegPer" : 1.0, + "EngineeringCorrectionFactor": 1.024 + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs index a10bf9609f..b327caafe9 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs @@ -121,6 +121,7 @@ namespace TUGraz.VectoCore.Tests.Utils public IHybridControllerCtl HybridControllerCtl { get; } public IAngledriveInfo AngledriveInfo { get; } public IDCDCConverter DCDCConverter { get; } + public WHRCharger WHRCharger { get; } public bool IsTestPowertrain => false; -- GitLab