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

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

PT1: Problem with range check solved

parent c051401a
No related branches found
No related tags found
No related merge requests found
......@@ -69,13 +69,13 @@ namespace TUGraz.VectoCore.Models.Declaration
public override Second Lookup(PerSecond key)
{
var index = 1;
if (key < _entries[0].Key) {
if (key.IsSmaller(_entries[0].Key)) {
Log.Error("requested rpm below minimum rpm in pt1 - extrapolating. n_eng_avg: {0}, rpm_min: {1}",
key.ConvertTo().Rounds.Per.Minute, _entries[0].Key.ConvertTo().Rounds.Per.Minute);
} else {
index = _entries.FindIndex(x => x.Key > key);
index = _entries.FindIndex(x => x.Key.IsGreater(key));
if (index <= 0) {
index = (key > _entries[0].Key) ? _entries.Count - 1 : 1;
index = key.IsGreater(_entries[0].Key) ? _entries.Count - 1 : 1;
}
}
......
......@@ -109,13 +109,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine
public override Second Lookup(PerSecond key)
{
var index = 1;
if (key < _entries[0].Key) {
if (key.IsSmaller(_entries[0].Key)) {
Log.Error("requested rpm below minimum rpm in pt1 - extrapolating. n_eng_avg: {0}, rpm_min: {1}",
key.ConvertTo().Rounds.Per.Minute, _entries[0].Key.ConvertTo().Rounds.Per.Minute);
} else {
index = _entries.FindIndex(x => x.Key > key);
index = _entries.FindIndex(x => x.Key.IsGreater(key));
if (index <= 0) {
index = (key > _entries[0].Key) ? _entries.Count - 1 : 1;
index = key.IsGreater(_entries[0].Key) ? _entries.Count - 1 : 1;
}
}
......
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