From e652df4f7acde86f61270099a75eb856f2a62cc7 Mon Sep 17 00:00:00 2001
From: Dippold Martin <dippold@ivt.tugraz.at>
Date: Wed, 3 Jun 2015 08:46:04 +0200
Subject: [PATCH] * Update of calibration of vehicle speed and anemometer speed
 (high speed test instead of "claibration test")

---
 CSE/Calculation/Signal_identification.vb |   4 +-
 CSE/Calculation/main_calculation_call.vb | 260 ++++++++++-------------
 CSE/GUI/F_Main.Designer.vb               |  67 ++++--
 CSE/GUI/F_Main.vb                        |   8 +-
 CSE/IO/cJob.vb                           |   2 +-
 CSE/declaration_public.vb                |   2 +-
 CSE/utils.vb                             |   5 +
 7 files changed, 177 insertions(+), 171 deletions(-)

diff --git a/CSE/Calculation/Signal_identification.vb b/CSE/Calculation/Signal_identification.vb
index 9fe35f7..c1ffeed 100644
--- a/CSE/Calculation/Signal_identification.vb
+++ b/CSE/Calculation/Signal_identification.vb
@@ -688,9 +688,9 @@ Module Signal_identification
         ' Initialise
         run = 0
         anz = 0
-        If coastingSeq = 0 Or coastingSeq = 2 Then
+        If coastingSeq = 1 Or coastingSeq = 2 Then
             igear = vehicleX.gearRatio_low
-            If coastingSeq = 0 Then
+            If coastingSeq = 1 Then
                 RunIDx = IDLS1
             Else
                 RunIDx = IDLS2
diff --git a/CSE/Calculation/main_calculation_call.vb b/CSE/Calculation/main_calculation_call.vb
index d8ae83d..824f705 100644
--- a/CSE/Calculation/main_calculation_call.vb
+++ b/CSE/Calculation/main_calculation_call.vb
@@ -83,9 +83,9 @@ Public Module main_calculation_call
 
             ' Output which test are calculated
             For i = 0 To UBound(Job.coasting_fpaths)
-                If i = 0 Or i = 2 Then
+                If i = 1 Or i = 2 Then
                     ' Output on the GUI
-                    If i = 0 Then
+                    If i = 1 Then
                         logme(7, False, "Calculating the first low speed run...")
                     Else
                         logme(7, False, "Calculating the second low speed run...")
@@ -225,23 +225,63 @@ Public Module main_calculation_call
 
     ' Calculate the speed run parameter
     Function fCalcRun(ByVal MSCX As cMSC, ByVal vehicleX As cVehicle, ByVal coastingSeq As Integer) As Boolean
-        ' Calculate the corrected vehicle speed
-        fCalcCorVveh()
+        ' Declaration
+        Dim run As Integer
+        Dim Change As Boolean = True
 
-        ' Calculate the values for v_wind, beta and v_air
-        fWindBetaAir(vehicleX)
+        ' Calculate fv_veh + fv_pe by HS otherwise use the values
+        If coastingSeq = 0 Then
+            ' Initialisation
+            Job.fv_veh = 0
+            Job.fv_veh_opt2 = 0
+            Job.fv_pe = 0
+            run = 0
+        End If
 
-        ' Calculate the moving average from v_vind
-        fMoveAve(CalcData(tCompCali.t), CalcData(tCompCali.vwind_c), CalcData(tCompCali.vwind_1s))
+        ' Evaluate the valid sections
+        'fCalcValidSec(MSCX, coastingSeq, run, Change)
 
-        ' Calculate the average values for v_wind, beta and v_wind_1s_max
-        fWindBetaAirErg()
+        Do While Change
+            If coastingSeq = 0 Then
+                ' Initialise Parameter
+                Job.fv_veh = 0
+                Job.fv_veh_opt2 = 0
+                Job.fv_pe = 0
+                run += 1
+            End If
 
-        ' Calculate the other speed run relevant values
-        fCalcSpeedVal(MSCX, vehicleX, coastingSeq)
+            ' Calculate fv_veh
+            If coastingSeq = 0 Then ffv_veh(MSCX)
 
-        ' Evaluate the valid sections
-        fCalcValidSec(MSCX, coastingSeq)
+            ' Calculate the corrected vehicle speed
+            fCalcCorVveh()
+
+            ' Calculate fv_pe
+            If coastingSeq = 0 Then ffvpeBeta(False)
+
+            ' Calculate the values for v_wind, beta and v_air
+            fWindBetaAir(vehicleX)
+
+            ' Calculate the moving average from v_vind
+            fMoveAve(CalcData(tCompCali.t), CalcData(tCompCali.vwind_c), CalcData(tCompCali.vwind_1s))
+
+            ' Calculate the average values for v_wind, beta and v_wind_1s_max
+            fWindBetaAirErg()
+
+            ' Calculate the other speed run relevant values
+            fCalcSpeedVal(MSCX, vehicleX, coastingSeq)
+
+            ' Evaluate the valid sections
+            fCalcValidSec(MSCX, coastingSeq, run, Change)
+
+            ' Error
+            If run > 10 Then
+                Throw New Exception("The evaluation is not possible because iteration for valid datasets does not converge (n>10)!")
+            End If
+        Loop
+
+        ' Show the results on GUI
+        If coastingSeq = 0 Then uRB = True
 
         Return True
     End Function
@@ -249,167 +289,74 @@ Public Module main_calculation_call
     ' Function to calibrate fv_veh
     Sub ffv_veh(ByVal MSCX As cMSC)
         ' Declaration
-        Dim i, j, CalcX(0), VSec(0), num As Integer
-        Dim ave_vz(0), ave_vz2(0), ave_vn(0) As Double
+        Dim i, num As Integer
 
         ' Initialise
-        ave_vz(0) = 0
-        ave_vz2(0) = 0
+        Job.fv_veh = 0
+        Job.fv_veh_opt2 = 0
         num = 0
 
         ' Calculate velocity correction
         For i = 0 To ErgValues(tCompErg.SecID).Count - 1
-            ' Identify if the section already is done
-            If i = 0 Then
-                CalcX(UBound(CalcX)) = ErgValues(tCompErg.SecID)(i)
-                VSec(UBound(VSec)) = 0
-            Else
-                If Not CalcX.Contains(ErgValues(tCompErg.SecID)(i)) Then
-                    ReDim Preserve CalcX(UBound(CalcX) + 1)
-                    ReDim Preserve VSec(UBound(VSec) + 1)
-                    ReDim Preserve ave_vz(UBound(ave_vz) + 1)
-                    ReDim Preserve ave_vn(UBound(ave_vn) + 1)
-                    ReDim Preserve ave_vz2(UBound(ave_vz2) + 1)
-                    CalcX(UBound(CalcX)) = ErgValues(tCompErg.SecID)(i)
-                    VSec(UBound(VSec)) = 0
-                Else
-                    Continue For
-                End If
-            End If
-
-            ' Calculate the values
-            For j = i + 1 To ErgValues(tCompErg.SecID).Count - 1
-                If ErgValues(tCompErg.used)(i) = 1 And j = i + 1 Then
-                    VSec(UBound(VSec)) = 1
-                    ave_vz(UBound(ave_vz)) += ErgValues(tCompErg.v_MSC)(i)
-                    ave_vn(UBound(ave_vn)) += ErgValues(tCompErg.v_veh_CAN)(i)
-                    If Not MSCX.tUse Then
-                        ave_vz2(UBound(ave_vz2)) += ErgValues(tCompErg.v_MSC_GPS)(i)
-                    End If
+            If ErgValues(tCompErg.used)(i) = 1 Then
+                ' Error if the vehicle velocity of the CAN is 0
+                If ErgValues(tCompErg.v_veh_CAN)(i) = 0 Then
+                    Throw New Exception("The measured vehicle velocity (v_veh_CAN) is 0 in section: " & ErgValues(tCompErg.SecID)(i))
                 End If
-                If ErgValues(tCompErg.used)(j) = 1 And ErgValues(tCompErg.SecID)(i) = ErgValues(tCompErg.SecID)(j) Then
-                    VSec(UBound(VSec)) = 1
-                    ave_vz(UBound(ave_vz)) += ErgValues(tCompErg.v_MSC)(j)
-                    ave_vn(UBound(ave_vn)) += ErgValues(tCompErg.v_veh_CAN)(j)
-                    If Not MSCX.tUse Then
-                        ave_vz2(UBound(ave_vz2)) += ErgValues(tCompErg.v_MSC_GPS)(j)
-                    End If
-                End If
-            Next j
-        Next i
-
-        ' error message if the CAN velocity is 0
-        For i = 0 To UBound(CalcX)
-            If ave_vn(i) = 0 And VSec(i) = 1 Then
-                Throw New Exception("The measured vehicle velocity (v_veh_CAN) is 0 in section: " & CalcX(i))
-            End If
-        Next i
-
-        ' Calculate the factor
-        For i = 0 To UBound(CalcX)
-            If VSec(i) = 1 Then
                 If MSCX.tUse Then
-                    Job.fv_veh += ave_vz(i) / ave_vn(i)
+                    Job.fv_veh += ErgValues(tCompErg.v_MSC)(i) / ErgValues(tCompErg.v_veh_CAN)(i)
                     Job.fv_veh_opt2 = 0
                     num += 1
                 Else
-                    Job.fv_veh += ave_vz2(i) / ave_vn(i)
-                    Job.fv_veh_opt2 += ave_vz(i) / ave_vn(i)
+                    Job.fv_veh += ErgValues(tCompErg.v_MSC_GPS)(i) / ErgValues(tCompErg.v_veh_CAN)(i)
+                    Job.fv_veh_opt2 += ErgValues(tCompErg.v_MSC)(i) / ErgValues(tCompErg.v_veh_CAN)(i)
                     num += 1
                 End If
             End If
         Next i
 
+        ' Error if no valid section is found
+        If num = 0 Then
+            Throw New Exception("No used/valid section is found for calculation of fv_veh!")
+        End If
+
         ' Calculate the average over all factors
         Job.fv_veh = Job.fv_veh / num
         Job.fv_veh_opt2 = Job.fv_veh_opt2 / num
     End Sub
 
-    Function ffvpeBeta() As Boolean
+    ' Function to calculate fv_pe & beta_amn
+    Function ffvpeBeta(Optional ByVal allData As Boolean = True) As Boolean
         ' Declaration
-        Dim anz_s(1, 0), i, j, CalcX(0), VSec(0), num As Integer
-        Dim ave_vc(1, 0), vair_ic(1, 0), beta_ic(1, 0), v_air_ges, beta_ges, ave_vc_ges As Double
+        Dim i, anz_DirID(1) As Integer
+        Dim vair_ic(1), beta_ic(1), sum_v_veh As Double
 
         ' Initialise
         For i = 0 To 1
-            ave_vc(i, 0) = 0
-            vair_ic(i, 0) = 0
-            beta_ic(i, 0) = 0
-            anz_s(i, 0) = 0
+            vair_ic(i) = 0
+            If allData Then beta_ic(i) = 0
+            anz_DirID(i) = 0
         Next i
-        num = 0
+        sum_v_veh = 0
 
         ' Calculate velocity correction
         For i = 0 To ErgValues(tCompErg.SecID).Count - 1
-            ' Identify if the section already is done
-            If i = 0 Then
-                CalcX(UBound(CalcX)) = ErgValues(tCompErg.SecID)(i)
-                VSec(UBound(VSec)) = 0
-            Else
-                If Not CalcX.Contains(ErgValues(tCompErg.SecID)(i)) Then
-                    ReDim Preserve CalcX(UBound(CalcX) + 1)
-                    ReDim Preserve VSec(UBound(VSec) + 1)
-                    ReDim Preserve ave_vc(1, UBound(ave_vc, 2) + 1)
-                    ReDim Preserve vair_ic(1, UBound(vair_ic, 2) + 1)
-                    ReDim Preserve beta_ic(1, UBound(beta_ic, 2) + 1)
-                    ReDim Preserve anz_s(1, UBound(anz_s, 2) + 1)
-                    CalcX(UBound(CalcX)) = ErgValues(tCompErg.SecID)(i)
-                    VSec(UBound(VSec)) = 0
+            If ErgValues(tCompErg.used)(i) = 1 Then
+                sum_v_veh += ErgValues(tCompErg.v_veh)(i) / 3.6
+                If ErgValues(tCompErg.DirID)(i) = ErgValues(tCompErg.DirID)(0) Then
+                    vair_ic(0) += ErgValues(tCompErg.vair_ic)(i)
+                    If allData Then beta_ic(0) += ErgValues(tCompErg.beta_ic)(i)
+                    anz_DirID(0) += 1
                 Else
-                    Continue For
+                    vair_ic(1) += ErgValues(tCompErg.vair_ic)(i)
+                    If allData Then beta_ic(1) += ErgValues(tCompErg.beta_ic)(i)
+                    anz_DirID(1) += 1
                 End If
             End If
-
-            ' Summerise the parameter
-            For j = i + 1 To ErgValues(tCompErg.SecID).Count - 1
-                If ErgValues(tCompErg.used)(i) = 1 And j = i + 1 Then
-                    VSec(UBound(VSec)) = 1
-                    If ErgValues(tCompErg.DirID)(i) = ErgValues(tCompErg.DirID)(0) Then
-                        ave_vc(0, (UBound(ave_vc, 2))) += ErgValues(tCompErg.v_veh)(i) / 3.6
-                        vair_ic(0, (UBound(vair_ic, 2))) += ErgValues(tCompErg.vair_ic)(i)
-                        beta_ic(0, (UBound(beta_ic, 2))) += ErgValues(tCompErg.beta_ic)(i)
-                        anz_s(0, (UBound(anz_s, 2))) += 1
-                    Else
-                        ave_vc(1, (UBound(ave_vc, 2))) += ErgValues(tCompErg.v_veh)(i) / 3.6
-                        vair_ic(1, (UBound(vair_ic, 2))) += ErgValues(tCompErg.vair_ic)(i)
-                        beta_ic(1, (UBound(beta_ic, 2))) += ErgValues(tCompErg.beta_ic)(i)
-                        anz_s(1, (UBound(anz_s, 2))) += 1
-                    End If
-                End If
-                If ErgValues(tCompErg.used)(j) = 1 And ErgValues(tCompErg.SecID)(i) = ErgValues(tCompErg.SecID)(j) Then
-                    VSec(UBound(VSec)) = 1
-                    If ErgValues(tCompErg.DirID)(j) = ErgValues(tCompErg.DirID)(0) Then
-                        ave_vc(0, (UBound(ave_vc, 2))) += ErgValues(tCompErg.v_veh)(j) / 3.6
-                        vair_ic(0, (UBound(vair_ic, 2))) += ErgValues(tCompErg.vair_ic)(j)
-                        beta_ic(0, (UBound(beta_ic, 2))) += ErgValues(tCompErg.beta_ic)(j)
-                        anz_s(0, (UBound(anz_s, 2))) += 1
-                    Else
-                        ave_vc(1, (UBound(ave_vc, 2))) += ErgValues(tCompErg.v_veh)(j) / 3.6
-                        vair_ic(1, (UBound(vair_ic, 2))) += ErgValues(tCompErg.vair_ic)(j)
-                        beta_ic(1, (UBound(beta_ic, 2))) += ErgValues(tCompErg.beta_ic)(j)
-                        anz_s(1, (UBound(anz_s, 2))) += 1
-                    End If
-                End If
-            Next j
         Next i
 
-        ' Calculate the average
-        For i = 0 To UBound(CalcX)
-            v_air_ges = 0
-            ave_vc_ges = 0
-            For j = 0 To 1
-                If VSec(i) = 1 Then
-                    v_air_ges += vair_ic(j, i) / anz_s(j, i)
-                    beta_ges += beta_ic(j, i) / anz_s(j, i)
-                    ave_vc_ges += ave_vc(j, i) / anz_s(j, i)
-                    num += 1
-                End If
-            Next j
-            Job.fv_pe += ave_vc_ges / v_air_ges
-        Next i
-
-        Job.fv_pe = Job.fv_pe / (UBound(CalcX) + 1)
-        Job.beta_ame += beta_ges / num - AmeAng
+        Job.fv_pe = (sum_v_veh / (anz_DirID(0) + anz_DirID(1))) / (0.5 * (vair_ic(0) / anz_DirID(0) + vair_ic(1) / anz_DirID(1)))
+        If allData Then Job.beta_ame = (0.5 * (beta_ic(0) / anz_DirID(0) + beta_ic(1) / anz_DirID(1))) - AmeAng
 
         Return True
     End Function
@@ -461,7 +408,7 @@ Public Module main_calculation_call
         Dim SecCount As New cValidSec
         Dim OldValid(ErgValues(tCompErg.SecID).Count - 1), OldUse(ErgValues(tCompErg.SecID).Count - 1) As Boolean
 
-        ' initialisation
+        ' Initialisation
         Change = False
 
         ' Save the old values
@@ -614,7 +561,7 @@ Public Module main_calculation_call
         End If
     End Sub
 
-    ' Function to check if the calibration run is valid
+    ' Function to check if the evaluation run is valid
     Sub fCheckLSHS()
         ' Declaration
         Dim i, j, k, anz, anzHS1, anzHS2 As Integer
@@ -861,13 +808,17 @@ Public Module main_calculation_call
     End Sub
 
     ' Evaluate the Valid sections
-    Sub fCalcValidSec(ByVal MSCX As cMSC, ByVal coastingSeq As Integer)
+    Sub fCalcValidSec(ByVal MSCX As cMSC, ByVal coastingSeq As Integer, ByVal Run As Integer, ByRef Change As Boolean)
         ' Declaration
         Dim i As Integer
+        Dim OldValid(ErgValues(tCompErg.SecID).Count - 1), OldUse(ErgValues(tCompErg.SecID).Count - 1) As Boolean
+
+        ' Initialisation
+        Change = False
 
         ' Evaluation
         Select Case coastingSeq
-            Case 0, 2 ' Low speed test
+            Case 1, 2 ' Low speed test
                 For i = 0 To ErgValues(tCompErg.SecID).Count - 1
                     ' Identify whitch criteria is not valid
                     If ErgValues(tCompErg.user_valid)(i) = 1 Then ErgValues(tCompErg.val_User)(i) = 1
@@ -898,6 +849,13 @@ Public Module main_calculation_call
                     ErgValues(tCompErg.val_tq_1s)(i) = 1
                 Next i
             Case Else ' high speed test
+                ' Save the old values
+                For i = 0 To ErgValues(tCompErg.SecID).Count - 1
+                    OldValid(i) = ErgValues(tCompErg.valid)(i)
+                    OldUse(i) = ErgValues(tCompErg.used)(i)
+                Next i
+
+                ' Control the criterias
                 For i = 0 To ErgValues(tCompErg.SecID).Count - 1
                     ' Identify whitch criteria is not valid
                     If ErgValues(tCompErg.user_valid)(i) = 1 Then ErgValues(tCompErg.val_User)(i) = 1
@@ -926,8 +884,18 @@ Public Module main_calculation_call
                     ErgValues(tCompErg.val_vVeh_f)(i) = 1
                     ErgValues(tCompErg.val_tq_f)(i) = 1
                 Next i
-        End Select
 
+                ' Look if something have changed
+                If Run <> 0 Then
+                    For i = 0 To ErgValues(tCompErg.SecID).Count - 1
+                        If Not Int(OldValid(i)) = ErgValues(tCompErg.valid)(i) And Not Int(OldUse(i)) = ErgValues(tCompErg.used)(i) Then
+                            Change = True
+                        End If
+                    Next i
+                Else
+                    Change = True
+                End If
+        End Select
     End Sub
 
     ' Save the Dictionaries
diff --git a/CSE/GUI/F_Main.Designer.vb b/CSE/GUI/F_Main.Designer.vb
index b98c42f..0442a4a 100644
--- a/CSE/GUI/F_Main.Designer.vb
+++ b/CSE/GUI/F_Main.Designer.vb
@@ -215,6 +215,8 @@ Partial Class F_Main
         Me.Label20 = New System.Windows.Forms.Label()
         Me.LRhoAirRef = New System.Windows.Forms.Label()
         Me.TB_rho_air_ref = New System.Windows.Forms.TextBox()
+        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
+        Me.GroupBox4 = New System.Windows.Forms.GroupBox()
         Me.MenuStrip1.SuspendLayout()
         Me.GroupBoxJob.SuspendLayout()
         Me.GB_hz_out.SuspendLayout()
@@ -240,6 +242,8 @@ Partial Class F_Main
         CType(Me.PBInfoIconCrt, System.ComponentModel.ISupportInitialize).BeginInit()
         Me.GroupBox14.SuspendLayout()
         Me.GroupBox10.SuspendLayout()
+        Me.GroupBox2.SuspendLayout()
+        Me.GroupBox4.SuspendLayout()
         Me.SuspendLayout()
         '
         'MenuStrip1
@@ -812,26 +816,20 @@ Partial Class F_Main
         '
         'GroupBox3
         '
-        Me.GroupBox3.Controls.Add(Me.Label17)
         Me.GroupBox3.Controls.Add(Me.Label16)
-        Me.GroupBox3.Controls.Add(Me.Label15)
         Me.GroupBox3.Controls.Add(Me.Label9)
         Me.GroupBox3.Controls.Add(Me.TextBoxRBetaMis)
-        Me.GroupBox3.Controls.Add(Me.Label8)
-        Me.GroupBox3.Controls.Add(Me.TextBoxRAirPos)
-        Me.GroupBox3.Controls.Add(Me.Label7)
-        Me.GroupBox3.Controls.Add(Me.TextBoxRVeh)
-        Me.GroupBox3.Location = New System.Drawing.Point(231, 166)
+        Me.GroupBox3.Location = New System.Drawing.Point(6, 18)
         Me.GroupBox3.Name = "GroupBox3"
-        Me.GroupBox3.Size = New System.Drawing.Size(463, 46)
+        Me.GroupBox3.Size = New System.Drawing.Size(135, 46)
         Me.GroupBox3.TabIndex = 31
         Me.GroupBox3.TabStop = False
-        Me.GroupBox3.Text = "Results"
+        Me.GroupBox3.Text = "From calibration"
         '
         'Label17
         '
         Me.Label17.AutoSize = True
-        Me.Label17.Location = New System.Drawing.Point(108, 16)
+        Me.Label17.Location = New System.Drawing.Point(108, 19)
         Me.Label17.Name = "Label17"
         Me.Label17.Size = New System.Drawing.Size(16, 13)
         Me.Label17.TabIndex = 35
@@ -840,7 +838,7 @@ Partial Class F_Main
         'Label16
         '
         Me.Label16.AutoSize = True
-        Me.Label16.Location = New System.Drawing.Point(422, 16)
+        Me.Label16.Location = New System.Drawing.Point(111, 19)
         Me.Label16.Name = "Label16"
         Me.Label16.Size = New System.Drawing.Size(17, 13)
         Me.Label16.TabIndex = 34
@@ -849,7 +847,7 @@ Partial Class F_Main
         'Label15
         '
         Me.Label15.AutoSize = True
-        Me.Label15.Location = New System.Drawing.Point(267, 16)
+        Me.Label15.Location = New System.Drawing.Point(270, 19)
         Me.Label15.Name = "Label15"
         Me.Label15.Size = New System.Drawing.Size(16, 13)
         Me.Label15.TabIndex = 33
@@ -858,7 +856,7 @@ Partial Class F_Main
         'Label9
         '
         Me.Label9.AutoSize = True
-        Me.Label9.Location = New System.Drawing.Point(317, 13)
+        Me.Label9.Location = New System.Drawing.Point(6, 16)
         Me.Label9.Name = "Label9"
         Me.Label9.Size = New System.Drawing.Size(44, 26)
         Me.Label9.TabIndex = 32
@@ -867,7 +865,7 @@ Partial Class F_Main
         'TextBoxRBetaMis
         '
         Me.TextBoxRBetaMis.Enabled = False
-        Me.TextBoxRBetaMis.Location = New System.Drawing.Point(367, 13)
+        Me.TextBoxRBetaMis.Location = New System.Drawing.Point(56, 16)
         Me.TextBoxRBetaMis.Name = "TextBoxRBetaMis"
         Me.TextBoxRBetaMis.RightToLeft = System.Windows.Forms.RightToLeft.No
         Me.TextBoxRBetaMis.Size = New System.Drawing.Size(55, 20)
@@ -877,7 +875,7 @@ Partial Class F_Main
         'Label8
         '
         Me.Label8.AutoSize = True
-        Me.Label8.Location = New System.Drawing.Point(154, 13)
+        Me.Label8.Location = New System.Drawing.Point(157, 16)
         Me.Label8.Name = "Label8"
         Me.Label8.Size = New System.Drawing.Size(48, 26)
         Me.Label8.TabIndex = 30
@@ -886,7 +884,7 @@ Partial Class F_Main
         'TextBoxRAirPos
         '
         Me.TextBoxRAirPos.Enabled = False
-        Me.TextBoxRAirPos.Location = New System.Drawing.Point(208, 13)
+        Me.TextBoxRAirPos.Location = New System.Drawing.Point(211, 16)
         Me.TextBoxRAirPos.Name = "TextBoxRAirPos"
         Me.TextBoxRAirPos.RightToLeft = System.Windows.Forms.RightToLeft.No
         Me.TextBoxRAirPos.Size = New System.Drawing.Size(59, 20)
@@ -896,7 +894,7 @@ Partial Class F_Main
         'Label7
         '
         Me.Label7.AutoSize = True
-        Me.Label7.Location = New System.Drawing.Point(6, 16)
+        Me.Label7.Location = New System.Drawing.Point(6, 19)
         Me.Label7.Name = "Label7"
         Me.Label7.Size = New System.Drawing.Size(37, 13)
         Me.Label7.TabIndex = 28
@@ -905,7 +903,7 @@ Partial Class F_Main
         'TextBoxRVeh
         '
         Me.TextBoxRVeh.Enabled = False
-        Me.TextBoxRVeh.Location = New System.Drawing.Point(49, 13)
+        Me.TextBoxRVeh.Location = New System.Drawing.Point(49, 16)
         Me.TextBoxRVeh.Name = "TextBoxRVeh"
         Me.TextBoxRVeh.RightToLeft = System.Windows.Forms.RightToLeft.No
         Me.TextBoxRVeh.Size = New System.Drawing.Size(59, 20)
@@ -1034,7 +1032,7 @@ Partial Class F_Main
         '
         'TPMain
         '
-        Me.TPMain.Controls.Add(Me.GroupBox3)
+        Me.TPMain.Controls.Add(Me.GroupBox4)
         Me.TPMain.Controls.Add(Me.GroupBoxJob)
         Me.TPMain.Controls.Add(Me.GroupBox1)
         Me.TPMain.Controls.Add(Me.GroupBoxInput)
@@ -2178,6 +2176,32 @@ Partial Class F_Main
         Me.TB_rho_air_ref.TabIndex = 1
         Me.TB_rho_air_ref.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
         '
+        'GroupBox2
+        '
+        Me.GroupBox2.Controls.Add(Me.Label17)
+        Me.GroupBox2.Controls.Add(Me.Label8)
+        Me.GroupBox2.Controls.Add(Me.TextBoxRVeh)
+        Me.GroupBox2.Controls.Add(Me.Label15)
+        Me.GroupBox2.Controls.Add(Me.Label7)
+        Me.GroupBox2.Controls.Add(Me.TextBoxRAirPos)
+        Me.GroupBox2.Location = New System.Drawing.Point(147, 18)
+        Me.GroupBox2.Name = "GroupBox2"
+        Me.GroupBox2.Size = New System.Drawing.Size(294, 46)
+        Me.GroupBox2.TabIndex = 34
+        Me.GroupBox2.TabStop = False
+        Me.GroupBox2.Text = "From High-speed test"
+        '
+        'GroupBox4
+        '
+        Me.GroupBox4.Controls.Add(Me.GroupBox3)
+        Me.GroupBox4.Controls.Add(Me.GroupBox2)
+        Me.GroupBox4.Location = New System.Drawing.Point(202, 166)
+        Me.GroupBox4.Name = "GroupBox4"
+        Me.GroupBox4.Size = New System.Drawing.Size(444, 70)
+        Me.GroupBox4.TabIndex = 35
+        Me.GroupBox4.TabStop = False
+        Me.GroupBox4.Text = "Results"
+        '
         'F_Main
         '
         Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -2237,6 +2261,9 @@ Partial Class F_Main
         Me.GroupBox14.PerformLayout()
         Me.GroupBox10.ResumeLayout(False)
         Me.GroupBox10.PerformLayout()
+        Me.GroupBox2.ResumeLayout(False)
+        Me.GroupBox2.PerformLayout()
+        Me.GroupBox4.ResumeLayout(False)
         Me.ResumeLayout(False)
         Me.PerformLayout()
 
@@ -2433,5 +2460,7 @@ Partial Class F_Main
     Friend WithEvents ToolStripMenuItem1 As System.Windows.Forms.ToolStripSeparator
     Friend WithEvents ToolStripMenuItem2 As System.Windows.Forms.ToolStripSeparator
     Friend WithEvents CreateActivationFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
+    Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox
+    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
 
 End Class
diff --git a/CSE/GUI/F_Main.vb b/CSE/GUI/F_Main.vb
index 16cfdc8..b87cbd2 100644
--- a/CSE/GUI/F_Main.vb
+++ b/CSE/GUI/F_Main.vb
@@ -190,6 +190,10 @@ Public Class F_Main
         If workerMsg IsNot Nothing Then
             workerMsg.forwardLog()
         End If
+        If uRB Then
+            updateResultBoxes()
+            uRB = False
+        End If
     End Sub
 
     ' Identify the ending from the backgroundworker
@@ -213,8 +217,8 @@ Public Class F_Main
         CalibrationState = False
         EvaluationState = False
 
-        Me.TextBoxRVeh.Text = Math.Round(Job.fv_veh, 3).ToString
-        Me.TextBoxRAirPos.Text = Math.Round(Job.fv_pe, 3).ToString
+        'Me.TextBoxRVeh.Text = Math.Round(Job.fv_veh, 3).ToString
+        'Me.TextBoxRAirPos.Text = Math.Round(Job.fv_pe, 3).ToString
         Me.TextBoxRBetaMis.Text = Math.Round(Job.beta_ame, 2).ToString
     End Sub
 
diff --git a/CSE/IO/cJob.vb b/CSE/IO/cJob.vb
index ef51b26..5a10585 100644
--- a/CSE/IO/cJob.vb
+++ b/CSE/IO/cJob.vb
@@ -362,7 +362,7 @@ Public Class cJob
     End Property
     Public ReadOnly Property coasting_fpaths As String()
         Get
-            Return {low1_fpath, high_fpath, low2_fpath}
+            Return {high_fpath, low1_fpath, low2_fpath}
         End Get
     End Property
 
diff --git a/CSE/declaration_public.vb b/CSE/declaration_public.vb
index fe26741..fb398c1 100644
--- a/CSE/declaration_public.vb
+++ b/CSE/declaration_public.vb
@@ -56,7 +56,7 @@ Module declaration_public
 
     ' Boolean for the programm control
     Public FileBlock As Boolean = False                         ' Variable if a file is blocked by an other process
-
+    Public uRB As Boolean = False                               ' Update the result boxes on the GUI
 
     'File browser
     Public FB_Drives() As String
diff --git a/CSE/utils.vb b/CSE/utils.vb
index a7bd389..71d52dc 100644
--- a/CSE/utils.vb
+++ b/CSE/utils.vb
@@ -310,6 +310,11 @@ Module utils
         lbox.Text = format("{0}({1})", label, lbox.Items.Count)
     End Sub
 
+    ' Update the Resultboxes on the GUI
+    Public Sub updateResultBoxes()
+        F_Main.TextBoxRVeh.Text = Math.Round(Job.fv_veh, 3).ToString
+        F_Main.TextBoxRAirPos.Text = Math.Round(Job.fv_pe, 3).ToString
+    End Sub
 
     ' Definition for the Backgroundworker
     Class cLogMsg
-- 
GitLab