Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 8f761677 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

HybridStrategy.DoSelectBestOption: When Braking search with MaxBY...

HybridStrategy.DoSelectBestOption: When Braking search with MaxBY MechanicalAssistPower instead of MinBy
parent a47f8cb0
Branches
Tags
No related merge requests found
......@@ -1598,13 +1598,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
if (filtered3.Length == 0) {
filtered3 = filtered2;
}
var filteredCurrentGear = filtered3.Where(x => x.Gear.Equals(currentGear)).ToArray();
if (filteredCurrentGear.Length > 0) {
if (DataBus.DriverInfo.DrivingAction == DrivingAction.Brake) {
best = filteredCurrentGear.MaxBy(x => x.Setting.MechanicalAssistPower.Sum(e => e.Value?.Item2 ?? 0.SI<NewtonMeter>()));
} else {
best = filteredCurrentGear.MinBy(x => x.Setting.MechanicalAssistPower.Sum(e => e.Value?.Item2 ?? 0.SI<NewtonMeter>()));
}
return best;
}
if (DataBus.DriverInfo.DrivingAction == DrivingAction.Brake) {
best = filtered3.MaxBy(x => x.Setting.MechanicalAssistPower.Sum(e => e.Value?.Item2 ?? 0.SI<NewtonMeter>()));
} else {
best = filtered3.MinBy(x => x.Setting.MechanicalAssistPower.Sum(e => e.Value?.Item2 ?? 0.SI<NewtonMeter>()));
}
if (best != null) {
return best;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment