Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 6f6dbb51 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

initialize gear for velocity != 0, testcase

parent cd422511
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......
......@@ -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;
}
// ===============================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment