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

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

move acceleration estimation to AMT class

parent 382c00fc
No related branches found
No related tags found
No related merge requests found
......@@ -160,12 +160,41 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected virtual uint CheckUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear)
{
return DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
// if the driver's intention is _not_ to accelerate or drive along then don't upshift
if (DataBus.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverBehavior != DrivingBehavior.Driving) {
return currentGear;
}
if ((absTime - Gearbox.LastDownshift).IsSmaller(10.SI<Second>())) {
return currentGear;
}
var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
if (nextGear == currentGear) {
return nextGear;
}
// estimate acceleration for selected gear
if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) {
// if less than 0.1 for next gear, don't shift
if (nextGear - currentGear == 1) {
return currentGear;
}
// if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift!
if (nextGear > currentGear &&
EstimateAccelerationForGear(currentGear + 1, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) {
return currentGear;
}
nextGear = currentGear + 1;
}
return nextGear;
}
protected virtual uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear)
{
if ((absTime - Gearbox.LastUpshift).IsSmaller(10.SI<Second>())) {
return currentGear;
}
return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
}
......
......@@ -11,45 +11,5 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Data.EarlyShiftUp = false;
Data.SkipGears = true;
}
protected override uint CheckUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear)
{
// if the driver's intention is _not_ to accelerate or drive along then don't upshift
if (DataBus.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverBehavior != DrivingBehavior.Driving) {
return currentGear;
}
if ((absTime - Gearbox.LastDownshift).IsSmaller(10.SI<Second>())) {
return currentGear;
}
var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
if (nextGear == currentGear) {
return nextGear;
}
// estimate acceleration for selected gear
if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) {
// if less than 0.1 for next gear, don't shift
if (nextGear - currentGear == 1) {
return currentGear;
}
// if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift!
if (nextGear > currentGear &&
EstimateAccelerationForGear(currentGear + 1, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) {
return currentGear;
}
}
return nextGear;
}
protected override uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear)
{
if ((absTime - Gearbox.LastUpshift).IsSmaller(10.SI<Second>())) {
return currentGear;
}
return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
}
}
}
\ No newline at end of file
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