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

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

Pull request #192: correct comparison in gearshift position after refactoring

Merge in VECTO/vecto-dev from VECTO/mq_vecto-dev:develop to develop

* commit '60336af3':
  correct comparison in gearshift position after refactoring check if there is a successor/predecessor before checking shift polygon
parents 00d19b02 60336af3
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public GearList(GearshiftPosition[] gearList) => Entries = gearList;
public bool HasPredecessor(GearshiftPosition cur) => cur.Gear != 0 && cur != Entries[0];
public bool HasPredecessor(GearshiftPosition cur) => cur.Gear != 0 && !Entries[0].Equals(cur);
public GearshiftPosition Predecessor(GearshiftPosition cur)
{
......@@ -82,7 +82,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return idx <= 0 ? null : Entries[idx - 1];
}
public bool HasSuccessor(GearshiftPosition cur) => cur.Gear != 0 && cur != Entries[Entries.Length-1];
public bool HasSuccessor(GearshiftPosition cur) => cur.Gear != 0 && !Entries[Entries.Length-1].Equals(cur);
public GearshiftPosition Successor(GearshiftPosition cur)
{
......
......@@ -71,6 +71,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
public bool IsBelowDownshiftCurve(NewtonMeter inTorque, PerSecond inAngularVelocity)
{
if (!Downshift.Any()) {
return false;}
var section = Downshift.GetSection(entry => entry.AngularSpeed < inAngularVelocity);
if (section.Item2.AngularSpeed < inAngularVelocity) {
return false;
......@@ -99,6 +101,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
public bool IsAboveUpshiftCurve(NewtonMeter inTorque, PerSecond inAngularVelocity)
{
if (!Upshift.Any()) {
return false;
}
var section = Upshift.GetSection(entry => entry.AngularSpeed < inAngularVelocity);
if (section.Item2.AngularSpeed < inAngularVelocity) {
......
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