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

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

throw exception in case an engine speed occurs multiple times

parent 67982229
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,12 @@ namespace TUGraz.VectoCore.InputData.Reader
tmp = data.Columns.Count > 3 ? new PT1(data) : new PT1();
}
entriesFld.Sort((entry1, entry2) => entry1.EngineSpeed.Value().CompareTo(entry2.EngineSpeed.Value()));
var duplicates = entriesFld.Select(x => x.EngineSpeed.AsRPM).GroupBy(x => x).Where(g => g.Count() > 1)
.Select(g => g.Key).ToList();
if (duplicates.Count > 0) {
throw new VectoException(
"Error reading full-load curve: multiple entries for engine speeds {0}", string.Join(", ", duplicates));
}
return new EngineFullLoadCurve(entriesFld, tmp);
}
......
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