From 107318abf4f0cb9a25e68d97eb6af20d89928bb5 Mon Sep 17 00:00:00 2001
From: DIPPOLD Martin <Dippold@ivt.tugraz.at>
Date: Tue, 24 Jun 2014 07:32:24 +0200
Subject: [PATCH] Change *.csdat files into csv format (Delete units)

---
 CSE/CSE_Globals.vb                       | 43 ++++++++++++++++++++++++
 CSE/Calculation/main_calculation_call.vb | 12 +++----
 CSE/IO/OutputTest.vb                     |  3 +-
 CSE/IO/input.vb                          | 24 +++++++------
 CSE/IO/output.vb                         | 41 +++++++++++-----------
 CSE/declaration_public.vb                |  5 +--
 DemoData/DataDemo_CAL.csdat              |  2 +-
 DemoData/DataDemo_HS.csdat               |  2 +-
 DemoData/DataDemo_LS1.csdat              |  2 +-
 DemoData/DataDemo_LS2.csdat              |  2 +-
 10 files changed, 93 insertions(+), 43 deletions(-)

diff --git a/CSE/CSE_Globals.vb b/CSE/CSE_Globals.vb
index af5d670..283d8eb 100644
--- a/CSE/CSE_Globals.vb
+++ b/CSE/CSE_Globals.vb
@@ -287,6 +287,49 @@
         End Select
     End Function
 
+    Public Function fCompUnit(ByVal ID As tComp) As String
+        Select Case ID
+            Case tComp.t
+                Return "[s]"
+            Case tComp.lati
+                Return "[mm.mm]"
+            Case tComp.longi
+                Return "[mm.mm]"
+            Case tComp.hdg
+                Return "[°]"
+            Case tComp.v_veh_GPS
+                Return "[km/h]"
+            Case tComp.v_veh_CAN
+                Return "[km/h]"
+            Case tComp.vair_ar
+                Return "[m/s]"
+            Case tComp.beta_ar
+                Return "[°]"
+            Case tComp.n_eng
+                Return "[rpm]"
+            Case tComp.tq_l
+                Return "[Nm]"
+            Case tComp.tq_r
+                Return "[Nm]"
+            Case tComp.t_amb_veh
+                Return "[°C]"
+            Case tComp.t_tire
+                Return "[°C]"
+            Case tComp.p_tire
+                Return "[bar]"
+            Case tComp.fc
+                Return "[kg/h]"
+            Case tComp.trigger
+                Return "[-]"
+            Case tComp.user_valid
+                Return "[-]"
+            Case tComp.Undefined
+                Return "[-]"
+            Case Else
+                Return "ERROR"
+        End Select
+    End Function
+
     Public Function fCompName(ByVal ID As tCompWeat) As String
         Select Case ID
             Case tCompWeat.t
diff --git a/CSE/Calculation/main_calculation_call.vb b/CSE/Calculation/main_calculation_call.vb
index 49d9268..b634dce 100644
--- a/CSE/Calculation/main_calculation_call.vb
+++ b/CSE/Calculation/main_calculation_call.vb
@@ -12,7 +12,7 @@
         ErgValues = Nothing
         ErgValuesUndef = Nothing
         Units = Nothing
-        UnitsUndef = Nothing
+        'UnitsUndef = Nothing
 
         If isCalibrate Then
             ' Declarations
@@ -123,7 +123,7 @@
                 ErgValues = Nothing
                 ErgValuesUndef = Nothing
                 Units = Nothing
-                UnitsUndef = Nothing
+                'UnitsUndef = Nothing
             Next i
 
             ' Check if the LS/HS test run is valid
@@ -162,9 +162,9 @@
             ' Clear the dictionaries
             ErgValuesComp = Nothing
             ErgValuesUndefComp = Nothing
-            UnitsErgUndefComp = Nothing
+            'UnitsErgUndefComp = Nothing
             ErgValuesReg = Nothing
-            UnitsUndef = Nothing
+            'UnitsUndef = Nothing
             InputWeatherData = Nothing
             UnitsWeat = Nothing
         End If
@@ -971,7 +971,7 @@
         If coastingSeq = 0 Then
             ErgValuesComp = New Dictionary(Of tCompErg, List(Of Double))
             ErgValuesUndefComp = New Dictionary(Of String, List(Of Double))
-            UnitsErgUndefComp = New Dictionary(Of String, List(Of String))
+            'UnitsErgUndefComp = New Dictionary(Of String, List(Of String))
 
             For Each sKV In ErgValues
                 ErgValuesComp.Add(sKV.Key, New List(Of Double))
@@ -984,7 +984,7 @@
             ' Transfer the ResultValues in the complet result file
             ErgValuesComp = ErgValues
             ErgValuesUndefComp = ErgValuesUndef
-            UnitsErgUndefComp = UnitsUndef
+            'UnitsErgUndefComp = UnitsUndef
         Else
             ' Add the ResultValues to the complet dictionary
             For Each sKV In ErgValues
diff --git a/CSE/IO/OutputTest.vb b/CSE/IO/OutputTest.vb
index a8fd540..9c62dd9 100644
--- a/CSE/IO/OutputTest.vb
+++ b/CSE/IO/OutputTest.vb
@@ -79,7 +79,8 @@
 
         ' Undefined input data
         For Each sKV In InputUndefData
-            AddToErg(sKV.Key, sKV.Key, UnitsUndef(sKV.Key)(0), "InputUndefData")
+            'AddToErg(sKV.Key, sKV.Key, UnitsUndef(sKV.Key)(0), "InputUndefData")
+            AddToErg(sKV.Key, sKV.Key, "", "InputUndefData")
         Next
 
         ' Calculated data
diff --git a/CSE/IO/input.vb b/CSE/IO/input.vb
index 0c5d850..d474482 100644
--- a/CSE/IO/input.vb
+++ b/CSE/IO/input.vb
@@ -220,8 +220,8 @@ Public Module input
             InputData = New Dictionary(Of tComp, List(Of Double))
             InputUndefData = New Dictionary(Of String, List(Of Double))
             CalcData = New Dictionary(Of tCompCali, List(Of Double))
-            Units = New Dictionary(Of tComp, List(Of String))
-            UnitsUndef = New Dictionary(Of String, List(Of String))
+            'Units = New Dictionary(Of tComp, List(Of String))
+            'UnitsUndef = New Dictionary(Of String, List(Of String))
             For i = 0 To UBound(OptPar)
                 OptPar(i) = True
             Next i
@@ -293,7 +293,7 @@ Public Module input
                     ' Add the component to the dictionary
                     SpaltenUndef.Add(txt, i)
                     InputUndefData.Add(txt, New List(Of Double))
-                    UnitsUndef.Add(txt, New List(Of String))
+                    'UnitsUndef.Add(txt, New List(Of String))
                 Else
                     ' Check if component is already defined
                     If MeasCheck(Comp) Then
@@ -306,7 +306,7 @@ Public Module input
                     MeasCheck(Comp) = True
                     Spalten.Add(Comp, i)
                     InputData.Add(Comp, New List(Of Double))
-                    Units.Add(Comp, New List(Of String))
+                    'Units.Add(Comp, New List(Of String))
                 End If
             Next i
 
@@ -342,9 +342,10 @@ Public Module input
                     Line = FileInMeasure.ReadLine
 
                     For Each sKV In Spalten
-                        If tDim = 0 Then
-                            Units(sKV.Key).Add(Line(sKV.Value))
-                        Else
+                        'If tDim = 0 Then
+                        '    Units(sKV.Key).Add(Line(sKV.Value))
+                        'Else
+                        If tDim <> 0 Then
                             InputData(sKV.Key).Add(CDbl(Line(sKV.Value)))
                             If sKV.Key = tComp.t Then
                                 CalcData(tCompCali.t).Add(CDbl(Line(sKV.Value)))
@@ -405,7 +406,7 @@ Public Module input
                     If valid_set Then
                         If tDim = 0 Then
                             InputData.Add(tComp.user_valid, New List(Of Double))
-                            Units.Add(tComp.user_valid, New List(Of String))
+                            'Units.Add(tComp.user_valid, New List(Of String))
                         Else
                             InputData(tComp.user_valid).Add(CDbl(1))
                         End If
@@ -413,9 +414,10 @@ Public Module input
 
                     ' Add the additional data to the undefined values
                     For Each sKVUndef In SpaltenUndef
-                        If tDim = 0 Then
-                            UnitsUndef(sKVUndef.Key).Add(Line(sKVUndef.Value))
-                        Else
+                        'If tDim = 0 Then
+                        '    UnitsUndef(sKVUndef.Key).Add(Line(sKVUndef.Value))
+                        'Else
+                        If tDim <> 0 Then
                             InputUndefData(sKVUndef.Key).Add(CDbl(Line(sKVUndef.Value)))
                         End If
                     Next
diff --git a/CSE/IO/output.vb b/CSE/IO/output.vb
index 4f9d199..a8af177 100644
--- a/CSE/IO/output.vb
+++ b/CSE/IO/output.vb
@@ -277,27 +277,28 @@
         Dim sKV As New KeyValuePair(Of String, List(Of Double))
 
         ' Input data
-        AddToErg(tComp.t, fCompName(tComp.t), Units(tComp.t)(0), "InputData")
-        AddToErg(tComp.lati, fCompName(tComp.lati), Units(tComp.lati)(0), "InputData")
-        AddToErg(tComp.longi, fCompName(tComp.longi), Units(tComp.longi)(0), "InputData")
-        AddToErg(tComp.hdg, fCompName(tComp.hdg), Units(tComp.hdg)(0), "InputData")
-        AddToErg(tComp.v_veh_GPS, fCompName(tComp.v_veh_GPS), Units(tComp.v_veh_GPS)(0), "InputData")
-        AddToErg(tComp.v_veh_CAN, fCompName(tComp.v_veh_CAN), Units(tComp.v_veh_CAN)(0), "InputData")
-        AddToErg(tComp.vair_ar, fCompName(tComp.vair_ar), Units(tComp.vair_ar)(0), "InputData")
-        AddToErg(tComp.beta_ar, fCompName(tComp.beta_ar), Units(tComp.beta_ar)(0), "InputData")
-        AddToErg(tComp.n_eng, fCompName(tComp.n_eng), Units(tComp.n_eng)(0), "InputData")
-        AddToErg(tComp.tq_l, fCompName(tComp.tq_l), Units(tComp.tq_l)(0), "InputData")
-        AddToErg(tComp.tq_r, fCompName(tComp.tq_r), Units(tComp.tq_r)(0), "InputData")
-        AddToErg(tComp.t_amb_veh, fCompName(tComp.t_amb_veh), Units(tComp.t_amb_veh)(0), "InputData")
-        AddToErg(tComp.t_tire, fCompName(tComp.t_tire), Units(tComp.t_tire)(0), "InputData")
+        AddToErg(tComp.t, fCompName(tComp.t), fCompUnit(tComp.t), "InputData")
+        AddToErg(tComp.lati, fCompName(tComp.lati), fCompUnit(tComp.lati), "InputData")
+        AddToErg(tComp.longi, fCompName(tComp.longi), fCompUnit(tComp.longi), "InputData")
+        AddToErg(tComp.hdg, fCompName(tComp.hdg), fCompUnit(tComp.hdg), "InputData")
+        AddToErg(tComp.v_veh_GPS, fCompName(tComp.v_veh_GPS), fCompUnit(tComp.v_veh_GPS), "InputData")
+        AddToErg(tComp.v_veh_CAN, fCompName(tComp.v_veh_CAN), fCompUnit(tComp.v_veh_CAN), "InputData")
+        AddToErg(tComp.vair_ar, fCompName(tComp.vair_ar), fCompUnit(tComp.vair_ar), "InputData")
+        AddToErg(tComp.beta_ar, fCompName(tComp.beta_ar), fCompUnit(tComp.beta_ar), "InputData")
+        AddToErg(tComp.n_eng, fCompName(tComp.n_eng), fCompUnit(tComp.n_eng), "InputData")
+        AddToErg(tComp.tq_l, fCompName(tComp.tq_l), fCompUnit(tComp.tq_l), "InputData")
+        AddToErg(tComp.tq_r, fCompName(tComp.tq_r), fCompUnit(tComp.tq_r), "InputData")
+        AddToErg(tComp.t_amb_veh, fCompName(tComp.t_amb_veh), fCompUnit(tComp.t_amb_veh), "InputData")
+        AddToErg(tComp.t_tire, fCompName(tComp.t_tire), fCompUnit(tComp.t_tire), "InputData")
         ' Write optional parameters
-        If OptPar(0) Then AddToErg(tComp.trigger, fCompName(tComp.trigger), Units(tComp.trigger)(0), "InputData")
-        If OptPar(1) Then AddToErg(tComp.p_tire, fCompName(tComp.p_tire), Units(tComp.p_tire)(0), "InputData")
-        If OptPar(2) Then AddToErg(tComp.fc, fCompName(tComp.fc), Units(tComp.fc)(0), "InputData")
+        If OptPar(0) Then AddToErg(tComp.trigger, fCompName(tComp.trigger), fCompUnit(tComp.trigger), "InputData")
+        If OptPar(1) Then AddToErg(tComp.p_tire, fCompName(tComp.p_tire), fCompUnit(tComp.p_tire), "InputData")
+        If OptPar(2) Then AddToErg(tComp.fc, fCompName(tComp.fc), fCompUnit(tComp.fc), "InputData")
 
         ' Undefined input data
         For Each sKV In InputUndefData
-            AddToErg(sKV.Key, sKV.Key, UnitsUndef(sKV.Key)(0), "InputUndefData")
+            'AddToErg(sKV.Key, sKV.Key, UnitsUndef(sKV.Key)(0), "InputUndefData")
+            AddToErg(sKV.Key, sKV.Key, "", "InputUndefData")
         Next
 
         ' Calculated data
@@ -434,11 +435,13 @@
         ' Undefined input data
         If calibration Then
             For Each sKV In InputUndefData
-                AddToErg(sKV.Key, sKV.Key, UnitsUndef(sKV.Key)(0), "ErgValuesUndef")
+                'AddToErg(sKV.Key, sKV.Key, UnitsUndef(sKV.Key)(0), "ErgValuesUndef")
+                AddToErg(sKV.Key, sKV.Key, "", "ErgValuesUndef")
             Next
         Else
             For Each sKV In ErgValuesUndefComp
-                AddToErg(sKV.Key, sKV.Key, UnitsErgUndefComp(sKV.Key)(0), "ErgValuesUndef")
+                'AddToErg(sKV.Key, sKV.Key, UnitsErgUndefComp(sKV.Key)(0), "ErgValuesUndef")
+                AddToErg(sKV.Key, sKV.Key, "", "ErgValuesUndef")
             Next
         End If
     End Sub
diff --git a/CSE/declaration_public.vb b/CSE/declaration_public.vb
index c028b6b..6acf146 100644
--- a/CSE/declaration_public.vb
+++ b/CSE/declaration_public.vb
@@ -7,6 +7,7 @@
 
     ' Control variables
     Public Const komment = "#"                                  ' Symbol for a comment in the input files
+    Public Const Teiler = ","
     Public AnzeigeMessage() As String = ({"", "", "", "         + ", "      ~ ", "   * ", " - ", "", "", ""})
 
     Public AppFormStarted = False
@@ -76,12 +77,12 @@
     Public ErgValuesUndef As Dictionary(Of String, List(Of Double))                         ' Dictionary for the undefined result data (from the undefined input data)
     Public InputWeatherData As Dictionary(Of tCompWeat, List(Of Double))                    ' Dictionary for the weather data
     Public Units As Dictionary(Of tComp, List(Of String))                                   ' Dictionary for the units of the input data
-    Public UnitsUndef As Dictionary(Of String, List(Of String))                             ' Dictionary for the units of the undefined input data
+    'Public UnitsUndef As Dictionary(Of String, List(Of String))                             ' Dictionary for the units of the undefined input data
     Public UnitsWeat As Dictionary(Of tCompWeat, List(Of String))                           ' Dictionary for the units of the weather data
     Public sKey As csKey                                                                    ' Key array for the input data (Definition of the column identifier)
     Public ErgValuesComp As Dictionary(Of tCompErg, List(Of Double))                        ' Dictionary for the result data (complete)
     Public ErgValuesUndefComp As Dictionary(Of String, List(Of Double))                     ' Dictionary for the undefined result data (from the undefined input data, complete)
-    Public UnitsErgUndefComp As Dictionary(Of String, List(Of String))                      ' Dictionary for the units of the undefined result data
+    'Public UnitsErgUndefComp As Dictionary(Of String, List(Of String))                      ' Dictionary for the units of the undefined result data
     Public ErgValuesReg As Dictionary(Of tCompErgReg, List(Of Double))                      ' Dictionary for the result data from the linear regression
 
     ' Result dictionaries
diff --git a/DemoData/DataDemo_CAL.csdat b/DemoData/DataDemo_CAL.csdat
index c4e86da..cdb6188 100644
--- a/DemoData/DataDemo_CAL.csdat
+++ b/DemoData/DataDemo_CAL.csdat
@@ -1,5 +1,5 @@
 <t>,<lat>,<long>,<hdg>,<v_veh_GPS>,<v_veh_CAN>,<v_air>,<beta>,<n_eng>,<tq_l>,<tq_r>,<t_amb_veh>,<t_tire>,Satelites
-[s],[mm.mm],[mm.mm],[¡],[km/h],[km/h],[m/s],[¡],[rpm],[Nm],[Nm],[¡C],[¡C],[#]
+# [s],[mm.mm],[mm.mm],[¡],[km/h],[km/h],[m/s],[¡],[rpm],[Nm],[Nm],[¡C],[¡C],[#]
 41371.61,2873.73671,456.47764,45,0.056,0.05768,3.243,-5.5,561,-141.2,67.8,20,40,10
 41371.62,2873.73671,456.47764,45,0.056,0.05768,3.243,-5.5,567.5,-147.5,71.3,20,40,10
 41371.63,2873.73671,456.47764,45,0.022,0.02266,3.796,-5.5,577,-154.4,75.2,20,40,10
diff --git a/DemoData/DataDemo_HS.csdat b/DemoData/DataDemo_HS.csdat
index 685d5af..2e620e0 100644
--- a/DemoData/DataDemo_HS.csdat
+++ b/DemoData/DataDemo_HS.csdat
@@ -1,5 +1,5 @@
 <t>,<lat>,<long>,<hdg>,<v_veh_GPS>,<v_veh_CAN>,<v_air>,<beta>,<n_eng>,<tq_l>,<tq_r>,<t_amb_veh>,<t_tire>,Satelites
-[s],[mm.mm],[mm.mm],[°],[km/h],[km/h],[m/s],[°],[rpm],[Nm],[Nm],[°C],[°C],[#]
+# [s],[mm.mm],[mm.mm],[°],[km/h],[km/h],[m/s],[°],[rpm],[Nm],[Nm],[°C],[°C],[#]
 45053.84,2873.71729,456.32412,45,24.614,25.35242,4.827,3.5,847,612.7,478.2,20,40,10
 45053.85,2873.71729,456.32418,45,24.632,25.37096,4.958,3.5,840.5,620.1,500.7,20,40,10
 45053.86,2873.71728,456.32423,225,24.633,25.37199,5.024,3.5,834,637.7,538.5,20,40,10
diff --git a/DemoData/DataDemo_LS1.csdat b/DemoData/DataDemo_LS1.csdat
index 96ad0c6..0977198 100644
--- a/DemoData/DataDemo_LS1.csdat
+++ b/DemoData/DataDemo_LS1.csdat
@@ -1,5 +1,5 @@
 <t>,<lat>,<long>,<hdg>,<v_veh_GPS>,<v_veh_CAN>,<v_air>,<beta>,<n_eng>,<tq_l>,<tq_r>,<t_amb_veh>,<t_tire>,Satelites
-[s],[mm.mm],[mm.mm],[°],[km/h],[km/h],[m/s],[°],[rpm],[Nm],[Nm],[°C],[°C],[#]
+# [s],[mm.mm],[mm.mm],[°],[km/h],[km/h],[m/s],[°],[rpm],[Nm],[Nm],[°C],[°C],[#]
 44423,2873.92143,456.82207,45,15.03,15.4809,1.702,-3.5,742.2,337.3305807,335.1959198,20,40,9
 44423.01,2873.92145,456.8221,45,15.048,15.49944,1.603,-3.5,748.8861386,337.4319217,335.0721062,20,40,9
 44423.02,2873.92146,456.82212,45,15.038,15.48914,1.663,-3.5,757.0544554,337.5320195,334.9472855,20,40,9
diff --git a/DemoData/DataDemo_LS2.csdat b/DemoData/DataDemo_LS2.csdat
index 57b1b3b..4e69f6c 100644
--- a/DemoData/DataDemo_LS2.csdat
+++ b/DemoData/DataDemo_LS2.csdat
@@ -1,5 +1,5 @@
 <t>,<lat>,<long>,<hdg>,<v_veh_GPS>,<v_veh_CAN>,<v_air>,<beta>,<n_eng>,<tq_l>,<tq_r>,<t_amb_veh>,<t_tire>,Satelites
-[s],[mm.mm],[mm.mm],[°],[km/h],[km/h],[m/s],[°],[rpm],[Nm],[Nm],[°C],[°C],[#]
+# [s],[mm.mm],[mm.mm],[°],[km/h],[km/h],[m/s],[°],[rpm],[Nm],[Nm],[°C],[°C],[#]
 47190,2873.92192,456.8227,45,14.631,15.06993,4.858,-3.5,723.5,312.8188063,299.1493724,20,40,10
 47190.01,2873.92193,456.82273,45,14.64,15.0792,4.724,-3.5,718,312.6604117,299.1719765,20,40,10
 47190.02,2873.92194,456.82275,45,14.667,15.10701,4.498,-3.5,720,312.5022511,299.1961634,20,40,10
-- 
GitLab