From 582d93ca478c54a59b8fc4ae3aa0f1cae7b4394e Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 17 Sep 2021 08:40:35 +0200
Subject: [PATCH] fix measured speed testcase

---
 .../Data/CrosswindCorrectionVAirBeta.cs              | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs
index 0e63c8286c..add85eb1a6 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs
@@ -82,12 +82,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 
 		protected SquareMeter DeltaCdxA(double beta)
 		{
-			var idx = FindIndex(beta);
-			return VectoMath.Interpolate(AirDragEntries[idx - 1].Beta, AirDragEntries[idx].Beta, AirDragEntries[idx - 1].DeltaCdA,
-				AirDragEntries[idx].DeltaCdA, beta);
+			var (first, second) = FindIndex(beta);
+            return VectoMath.Interpolate(first.Beta, second.Beta, first.DeltaCdA,
+                second.DeltaCdA, beta);
 		}
 
-		protected int FindIndex(double beta)
+		protected (CrossWindCorrectionCurveReader.AirDragBetaEntry, CrossWindCorrectionCurveReader.AirDragBetaEntry) FindIndex(double beta)
 		{
 			if (beta < AirDragEntries.First().Beta) {
 				throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta);
@@ -96,8 +96,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 				throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta);
 			}
 
-			AirDragEntries.GetSection(x => x.Beta < beta, out var index);
-			return index + 1;
+			return AirDragEntries.GetSection(x => x.Beta < beta);
+			
 		}
 	}
 }
\ No newline at end of file
-- 
GitLab