Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

gearbox: add properties for last upshift, last downshift

parent e0e11c04
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// </summary>
protected internal bool Disengaged = true;
public Second LastUpshift { get; private set; }
public Second LastDownshift { get; private set; }
public bool ClutchClosed(Second absTime)
{
return _engageTime.IsSmallerOrEqual(absTime);
......@@ -83,6 +87,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
ModelData = gearboxModelData;
_strategy = strategy;
_strategy.Gearbox = this;
LastDownshift = -double.MaxValue.SI<Second>();
LastUpshift = -double.MaxValue.SI<Second>();
}
#region ITnInProvider
......@@ -333,14 +340,24 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
bool dryRun)
{
// Set a Gear if no gear was set and engineSpeed is not zero
//if (!Disengaged && DataBus.VehicleStopped && !outAngularVelocity.IsEqual(0))
//{
// Gear = _strategy.InitGear(absTime, dt, outTorque, outAngularVelocity);
//}
if (Disengaged && !outAngularVelocity.IsEqual(0)) {
Disengaged = false;
var lastGear = Gear;
if (DataBus.VehicleStopped) {
Gear = _strategy.InitGear(absTime, dt, outTorque, outAngularVelocity);
} else {
Gear = _strategy.Engage(absTime, dt, outTorque, outAngularVelocity);
}
if (Gear > lastGear) {
LastUpshift = absTime;
}
if (Gear < lastGear) {
LastDownshift = absTime;
}
Log.Debug("Gearbox engaged gear {0}", Gear);
}
......
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