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

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

adapt method of computing gearshift count

parent ca1a3287
No related branches found
No related tags found
No related merge requests found
......@@ -487,9 +487,17 @@ namespace TUGraz.VectoCore.OutputData
return 100 * sum / Duration(data);
}
/// <summary>
/// The following logic applies:
/// - shifting from gear A to gear B counts as gearshift (with or without traction interruption)
/// - shifting from gear A to neutral couts as gearshift if the vehicle stopped
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static Scalar GearshiftCount(this IModalDataContainer data)
{
var prevGear = data.GetValues<uint>(ModalResultField.Gear).First();
var lastGear = prevGear;
var gearCount = 0;
var shifts = data.GetValues(x => new {
......@@ -498,13 +506,17 @@ namespace TUGraz.VectoCore.OutputData
});
foreach (var entry in shifts) {
if (entry.Speed != null && entry.Speed.IsSmallerOrEqual(0.1)) {
prevGear = 0;
gearCount++;
if (prevGear != entry.Gear) {
gearCount++;
}
}
if (entry.Gear == 0 || entry.Gear == prevGear) {
continue;
if (entry.Gear != 0 && entry.Gear != prevGear) {
if (lastGear != entry.Gear) {
gearCount++;
}
lastGear = entry.Gear;
}
gearCount++;
prevGear = entry.Gear;
}
return gearCount.SI<Scalar>();
......@@ -553,4 +565,4 @@ namespace TUGraz.VectoCore.OutputData
return retVal;
}
}
}
\ No newline at end of file
}
......@@ -110,6 +110,7 @@
<Compile Include="Models\Simulation\GetSectionTest.cs" />
<Compile Include="Models\Simulation\DeclarationSimulationFactoryTest.cs" />
<Compile Include="Reports\ActualModalSimulationDataTest.cs" />
<Compile Include="Reports\GearshiftCountTest.cs" />
<Compile Include="Reports\ModDataTest.cs" />
<Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" />
<Compile Include="Models\Simulation\PwheelModeTests.cs" />
......
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