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 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 ...@@ -487,9 +487,17 @@ namespace TUGraz.VectoCore.OutputData
return 100 * sum / Duration(data); 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) public static Scalar GearshiftCount(this IModalDataContainer data)
{ {
var prevGear = data.GetValues<uint>(ModalResultField.Gear).First(); var prevGear = data.GetValues<uint>(ModalResultField.Gear).First();
var lastGear = prevGear;
var gearCount = 0; var gearCount = 0;
var shifts = data.GetValues(x => new { var shifts = data.GetValues(x => new {
...@@ -498,13 +506,17 @@ namespace TUGraz.VectoCore.OutputData ...@@ -498,13 +506,17 @@ namespace TUGraz.VectoCore.OutputData
}); });
foreach (var entry in shifts) { foreach (var entry in shifts) {
if (entry.Speed != null && entry.Speed.IsSmallerOrEqual(0.1)) { if (entry.Speed != null && entry.Speed.IsSmallerOrEqual(0.1)) {
prevGear = 0; if (prevGear != entry.Gear) {
gearCount++; gearCount++;
} }
if (entry.Gear == 0 || entry.Gear == prevGear) {
continue;
} }
if (entry.Gear != 0 && entry.Gear != prevGear) {
if (lastGear != entry.Gear) {
gearCount++; gearCount++;
}
lastGear = entry.Gear;
}
prevGear = entry.Gear; prevGear = entry.Gear;
} }
return gearCount.SI<Scalar>(); return gearCount.SI<Scalar>();
......
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
<Compile Include="Models\Simulation\GetSectionTest.cs" /> <Compile Include="Models\Simulation\GetSectionTest.cs" />
<Compile Include="Models\Simulation\DeclarationSimulationFactoryTest.cs" /> <Compile Include="Models\Simulation\DeclarationSimulationFactoryTest.cs" />
<Compile Include="Reports\ActualModalSimulationDataTest.cs" /> <Compile Include="Reports\ActualModalSimulationDataTest.cs" />
<Compile Include="Reports\GearshiftCountTest.cs" />
<Compile Include="Reports\ModDataTest.cs" /> <Compile Include="Reports\ModDataTest.cs" />
<Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" /> <Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" />
<Compile Include="Models\Simulation\PwheelModeTests.cs" /> <Compile Include="Models\Simulation\PwheelModeTests.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment