From 6f6dbb511e1d3973a1a7f99e5c3dd96f6b871c2c Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Tue, 22 Sep 2015 08:55:40 +0200 Subject: [PATCH] initialize gear for velocity != 0, testcase --- .../SimulationComponent/Impl/ShiftStrategy.cs | 19 ++++++++++++++- .../GearboxPowertrainTest.cs | 23 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs b/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs index 7ae4f076bc..e840a4b221 100644 --- a/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs +++ b/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs @@ -158,8 +158,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } return 1; } + for (var gear = (uint)Data.Gears.Count; gear > 1; gear--) { + var response = Gearbox.Initialize(gear, outTorque, outEngineSpeed); + + var currentPower = response.EnginePowerRequest; + var inAngularSpeed = outEngineSpeed * Data.Gears[gear].Ratio; + var inTorque = currentPower / inAngularSpeed; + + var fullLoadPower = currentPower - response.DeltaFullLoad; + var reserve = 1 - (currentPower / fullLoadPower).Cast<Scalar>(); + + if (!IsBelowDownShiftCurve(gear, inTorque, inAngularSpeed) && !IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && + reserve >= Data.StartTorqueReserve / 100) { + return gear; + } + if (IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && gear < Data.Gears.Count) { + return gear + 1; + } + } - // todo else return 1; } } diff --git a/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs b/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs index d85995518c..9eb57c45cf 100644 --- a/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs @@ -93,6 +93,29 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent AssertHelper.AreRelativeEqual(593.202.RPMtoRad(), container.EngineSpeed); } + [TestMethod] + public void Gearbox_Initialize_85_RefLoad() + { + var cycle = CreateCycleData(new[] { + // <s>,<v>,<grad>,<stop> + " 0, 85, 2.95016969027809, 0", + " 100, 85, 2.95016969027809, 0", + }); + var container = CreatePowerTrain(cycle, "Gearbox_Initialize.vmod", 7500.0.SI<Kilogram>(), 19300.SI<Kilogram>()); + var retVal = container.Cycle.Initialize(); + Assert.AreEqual(11u, container.Gear); + Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + + AssertHelper.AreRelativeEqual(1195.996.RPMtoRad(), container.EngineSpeed); + + var absTime = 0.SI<Second>(); + var ds = 1.SI<Meter>(); + + retVal = container.Cycle.Request(absTime, ds); + container.CommitSimulationStep(absTime, retVal.SimulationInterval); + absTime += retVal.SimulationInterval; + } + // =============================== -- GitLab