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 62dabd1a authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

fix: add cycle entry after stop

parent 58708ee0
No related branches found
No related tags found
No related merge requests found
......@@ -52,10 +52,15 @@ namespace DeclarationCycleZip
table.Columns.Add("<stop>");
var lastDistance = cycleData.Entries.First().Distance - 1.SI<Meter>();
DrivingCycleData.DrivingCycleEntry prevEntry = null;
foreach (var x in cycleData.Entries) {
if (x.Distance.IsEqual(lastDistance)) {
if (prevEntry != null && prevEntry.VehicleTargetSpeed.IsEqual(0.SI<MeterPerSecond>())) {
x.Distance = x.Distance + 1.SI<Meter>();
} else {
continue;
}
}
var row = table.NewRow();
row["<s>"] = x.Distance.Value().ToString(CultureInfo.InvariantCulture);
row["<v>"] = x.VehicleTargetSpeed.ConvertTo().Kilo.Meter.Per.Hour.Value().ToString(CultureInfo.InvariantCulture);
......@@ -63,6 +68,7 @@ namespace DeclarationCycleZip
row["<stop>"] = x.StoppingTime.Value().ToString(CultureInfo.InvariantCulture);
table.Rows.Add(row);
lastDistance = x.Distance;
prevEntry = x;
}
VectoCSVFile.Write(Path.GetFileName(args[0]), table);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment