From 59f1c0be9a68fe70022b1daf376f11a4bc70fb24 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Mon, 6 Jul 2020 15:05:38 +0200 Subject: [PATCH] P3 hybrid vehicles simple testcases run successfully --- .../Simulation/Data/ModalResultField.cs | 2 ++ .../SimulationComponent/Impl/Gearbox.cs | 4 +-- .../Impl/StopStartCombustionEngine.cs | 2 +- .../Strategies/HybridStrategy.cs | 31 +++++++++++++++++-- .../Integration/Hybrid/ParallelHybridTest.cs | 6 ++-- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs index 2ebd13aba1..079a1b2850 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs @@ -395,6 +395,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Data // only for graphDrawing Testcase [ModalResultField(typeof(SI), caption: "P_em-P2_mech [kW]", outputFactor: 1e-3)] P_electricMotor_mech_P2, + [ModalResultField(typeof(SI), caption: "P_em-P3_mech [kW]", outputFactor: 1e-3)] + P_electricMotor_mech_P3, // --> [ModalResultField(typeof(SI), caption: "P_bat_T [kW]", outputFactor: 1e-3)] P_battery_terminal, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index df7ec5cb36..9ba94c297f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -298,10 +298,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (dryRun) { // if gearbox is disengaged the 0[W]-line is the limit for drag and full load. var delta = inTorque * avgInAngularVelocity; - var remainingPowerTrain = NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), inAngularVelocity, true); + var remainingPowerTrain = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true); return new ResponseDryRun(this, remainingPowerTrain) { Gearbox = { - PowerRequest = delta, + PowerRequest = delta, Gear = 0, }, DeltaDragLoad = delta, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs index 8928659ef6..80b273bb64 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs @@ -60,7 +60,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { } return new ResponseOverload(this) { - Delta = outTorque * outAngularVelocity, + Delta = outTorque * ModelData.IdleSpeed, Engine = { TotalTorqueDemand = outTorque, PowerRequest = outTorque * outAngularVelocity, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 619abb2cae..126debae10 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -28,6 +28,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public class StrategyState { + public PerSecond AngularVelocity { get; set; } public HybridStrategyResponse Response { get; set; } public List<HybridResultEntry> Evaluations; public HybridResultEntry Solution { get; set; } @@ -134,9 +135,33 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var currentGear = PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear.Gear; if (!dryRun && DryRunAction.HasValue && DryRunAction == DataBus.DriverInfo.DrivingAction && DryRunResult != null) { - return CreateResponse(DryRunResult, currentGear); + var response = CreateResponse(DryRunResult, currentGear); + + CurrentState.Solution = DryRunResult; + CurrentState.AngularVelocity = outAngularVelocity; + CurrentState.Evaluations = null; + CurrentState.GearboxEngaged = DataBus.GearboxInfo.GearEngaged(absTime); + if (!DataBus.EngineCtl.CombustionEngineOn && !DryRunResult.ICEOff && !response.ShiftRequired) { + CurrentState.ICEStartTStmp = absTime; + } + + return response; + } + + if (dryRun && DataBus.DriverInfo.DrivingAction == DrivingAction.Brake) { + var tmp = MaxRecuperationSetting(absTime, dt, outTorque, outAngularVelocity); + var outTorqueWithoutBraking = + outTorque + 2 * DataBus.Brakes.BrakePower / (PreviousState.AngularVelocity + outAngularVelocity); + var maxRecuperationResponse = RequestDryRun(absTime, dt, outTorqueWithoutBraking, outAngularVelocity, currentGear, tmp.Setting); + if (maxRecuperationResponse.DeltaDragLoad.IsSmaller(0)) { + DryRunAction = DataBus.DriverInfo.DrivingAction; + DryRunResult = tmp; + var brakeRetVal = CreateResponse(tmp, currentGear); + DebugData.Add(new { Best = tmp, RetVal = brakeRetVal, DryRun = dryRun }); + return brakeRetVal; + } } - + var responseEmOff = new HybridResultEntry { U = double.NaN, @@ -219,6 +244,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies CurrentState.Response = dryRun ? null : retVal; if (!dryRun) { CurrentState.Solution = best; + CurrentState.AngularVelocity = outAngularVelocity; CurrentState.Evaluations = eval; CurrentState.GearboxEngaged = DataBus.GearboxInfo.GearEngaged(absTime); if (!DataBus.EngineCtl.CombustionEngineOn && !best.ICEOff && !retVal.ShiftRequired) { @@ -637,6 +663,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies retVal.MechanicalAssistPower[em.Item1] = null; } + PreviousState.AngularVelocity = outAngularVelocity; return retVal; } diff --git a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs index 921e386803..efeab63c8d 100644 --- a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs @@ -54,15 +54,15 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid private void InitGraphWriter() { //#if TRACE - //GraphWriter.Enable(); + GraphWriter.Enable(); //#else - GraphWriter.Disable(); + //GraphWriter.Disable(); //#endif GraphWriter.Xfields = new[] { ModalResultField.dist }; GraphWriter.Yfields = new[] { ModalResultField.v_act, ModalResultField.altitude, ModalResultField.acc, ModalResultField.Gear, - ModalResultField.P_ice_out, ModalResultField.P_electricMotor_mech_P2 , ModalResultField.BatterySOC, ModalResultField.FCMap + ModalResultField.P_ice_out, ModalResultField.P_electricMotor_mech_P3 , ModalResultField.BatterySOC, ModalResultField.FCMap }; GraphWriter.Series1Label = "Hybrid P2"; GraphWriter.PlotIgnitionState = true; -- GitLab