diff --git a/CSE/Calculation/Minor_routines_calculate.vb b/CSE/Calculation/Minor_routines_calculate.vb index e5c5663db7bb5972256241fc5ff2ea8b730523ca..bff624a23b67eedd530a68761fcadfbdff2ee53e 100644 --- a/CSE/Calculation/Minor_routines_calculate.vb +++ b/CSE/Calculation/Minor_routines_calculate.vb @@ -55,49 +55,50 @@ Module Minor_routines_calculate ' Function for the calculation of the moving average Public Function fMoveAve(ByVal TimeX As List(Of Double), ByVal ValuesX As List(Of Double), ByRef NewValues As List(Of Double), Optional ByVal Ave_t As Single = AveSec) As Boolean ' Declaration - Dim i, lauf, laufE, zEnd, tI, Anz, pos, PktB, PktE, anzPkt As Integer + Dim i, lauf, laufE, zEnd, Anz, pos, PktB, PktE, anzPkt As Integer Dim t0, tstep As Double Dim Sprung As Boolean Dim Summe As Double + Dim tI As New List(Of Integer) ' Initialise Sprung = False - tI = 0 tstep = 0 'Check whether Time is not reversed For i = 1 To TimeX.Count - 1 If i = 1 Then tstep = TimeX(i) - TimeX(i - 1) If tstep + (tstep * Crt.delta_Hz_max / 100) < Math.Abs(TimeX(i) - TimeX(i - 1)) Or tstep - (tstep * Crt.delta_Hz_max / 100) > Math.Abs(TimeX(i) - TimeX(i - 1)) Then - If Sprung Then - logme(9, False, "Time step invalid! t(" & i - 1 & ") = " & TimeX(i - 1) & "[s], t(" & i & ") = " & TimeX(i) & "[s]") - Return False - Else - Sprung = True - tI = i - End If + Sprung = True + TI.Add(i) End If Next i ' Initialise + If TI.Count = 0 Then TI.Add(0) + If Sprung Then TI.Add(TimeX.Count - 1) Anz = Math.Round(Ave_t / tstep, 0) zEnd = TimeX.Count - 1 pos = 0 t0 = 0 anzPkt = 0 If Sprung Then - laufE = 2 + laufE = ti.Count - 1 Else - laufE = 1 + laufE = 0 End If - For lauf = 1 To laufE - If Sprung And lauf = 1 Then - zEnd = tI - 1 + For lauf = 0 To laufE + If Sprung And lauf = 0 Then + zEnd = tI(lauf) - 1 pos = 0 + ElseIf Sprung And lauf <> 0 Then + zEnd = TI(lauf) - 1 + t0 = TI(lauf - 1) + pos = TI(lauf - 1) Else - pos = tI - t0 = tI + pos = TI(lauf) + t0 = TI(lauf) zEnd = TimeX.Count - 1 End If @@ -126,48 +127,49 @@ Module Minor_routines_calculate ' Function for the calculation of the moving average Public Function fMoveAve(ByVal TimeX As List(Of Double), ByVal ValuesX As List(Of Double), ByRef NewValues As List(Of Double), ByRef StepValues As List(Of Double)) As Boolean ' Declaration - Dim i, lauf, laufE, zEnd, tI, Anz, pos, PktB, PktE, anzPkt As Integer + Dim i, lauf, laufE, zEnd, Anz, pos, PktB, PktE, anzPkt As Integer Dim t0, tstep As Double Dim Sprung As Boolean Dim Summe As Double + Dim tI As New List(Of Integer) ' Initialise Sprung = False - tI = 0 tstep = 0 'Check whether Time is not reversed For i = 1 To TimeX.Count - 1 If i = 1 Then tstep = TimeX(i) - TimeX(i - 1) If tstep + (tstep * Crt.delta_Hz_max / 100) < Math.Abs(TimeX(i) - TimeX(i - 1)) Or tstep - (tstep * Crt.delta_Hz_max / 100) > Math.Abs(TimeX(i) - TimeX(i - 1)) Then - If Sprung Then - logme(9, False, "Time step invalid! t(" & i - 1 & ") = " & TimeX(i - 1) & "[s], t(" & i & ") = " & TimeX(i) & "[s]") - Return False - Else - Sprung = True - tI = i - End If + Sprung = True + tI.Add(i) End If Next i ' Initialise + If tI.Count = 0 Then tI.Add(0) + If Sprung Then tI.Add(TimeX.Count - 1) zEnd = TimeX.Count - 1 pos = 0 t0 = 0 anzPkt = 0 If Sprung Then - laufE = 2 + laufE = tI.Count - 1 Else - laufE = 1 + laufE = 0 End If - For lauf = 1 To laufE - If Sprung And lauf = 1 Then - zEnd = tI - 1 + For lauf = 0 To laufE + If Sprung And lauf = 0 Then + zEnd = tI(lauf) - 1 pos = 0 + ElseIf Sprung And lauf <> 0 Then + zEnd = tI(lauf) - 1 + t0 = tI(lauf - 1) + pos = tI(lauf - 1) Else - pos = tI - t0 = tI + pos = tI(lauf) + t0 = tI(lauf) zEnd = TimeX.Count - 1 End If diff --git a/CSE/Calculation/Signal_identification.vb b/CSE/Calculation/Signal_identification.vb index b8cbda820a5c30594b90be506b321297e0a78348..afb3c5c0677cc1cd39cb471d3d30dbdfb71fe7b7 100644 --- a/CSE/Calculation/Signal_identification.vb +++ b/CSE/Calculation/Signal_identification.vb @@ -14,6 +14,9 @@ Module Signal_identification ' Divide the signal into there directions Public Sub fIdentifyMS(ByVal MSC As cMSC, ByRef vMSC As cVirtMSC, Optional ByVal virtMSC As Boolean = True, Optional ByVal SectionDev As Boolean = True) + ' Declaration + Dim i As Integer + If virtMSC Then ' Calculation of the virtual MSC points fvirtMSC(MSC, vMSC) @@ -27,10 +30,12 @@ Module Signal_identification DevInSec(vMSC) ' Leap in time control - If JumpPoint <> -1 Then - If CalcData(tCompCali.SecID)(JumpPoint) <> 0 Then - Throw New Exception(format("The detected leap in time({0}) is not allowed to be inside a measurement section!", CalcData(tCompCali.SecID)(JumpPoint))) - End If + If JumpPoint.Count > 0 Then + For i = 0 To JumpPoint.Count - 1 + If CalcData(tCompCali.SecID)(JumpPoint(i)) <> 0 Then + Throw New Exception(format("The detected leap in time({0}) is not allowed to be inside a measurement section!", CalcData(tCompCali.SecID)(JumpPoint(i)))) + End If + Next i End If ' Calculate the root points from the measuered data between the MSC points @@ -778,8 +783,8 @@ Module Signal_identification If CalcData(tCompCali.SecID)(i - 1) = CalcData(tCompCali.SecID)(i) And CalcData(tCompCali.SecID)(i + 1) = CalcData(tCompCali.SecID)(i) Then If (CalcData(tCompCali.dist_root)(i + 1) - CalcData(tCompCali.dist_root)(i - 1)) = 0 Then CalcData(tCompCali.slope_deg)(i) = 0 - logme(9, False, "Standstill or loss of vehicle speed signal inside MS not permitted (Error at line " & i & ")") - BWorker.CancelAsync() + logme(8, False, "Standstill or loss of vehicle speed signal inside MS (at line " & i & ")! Gradient set to 0") + 'BWorker.CancelAsync() ' XXXX: What is absolutely neccessary to run afterwards, and cannot return immediately here?? Else CalcData(tCompCali.slope_deg)(i) = (Math.Asin((CalcData(tCompCali.alt)(i + 1) - CalcData(tCompCali.alt)(i - 1)) / (CalcData(tCompCali.dist_root)(i + 1) - CalcData(tCompCali.dist_root)(i - 1)))) * 180 / Math.PI diff --git a/CSE/IO/input.vb b/CSE/IO/input.vb index 1c6fcf33040c4e027894c41b56ae091b6d393f61..41d4a0eb2386f64401b5123426cae835df96b35f 100644 --- a/CSE/IO/input.vb +++ b/CSE/IO/input.vb @@ -191,16 +191,15 @@ Public Module input Dim sKV As New KeyValuePair(Of tComp, Integer) Dim SpaltenUndef As New Dictionary(Of String, Integer) Dim sKVUndef As New KeyValuePair(Of String, Integer) - Dim ErrDat As Boolean = False Dim EnumStr As tCompCali Dim UTMCoord As New cUTMCoord ' Initialise tDim = -1 - JumpPoint = -1 InputData = New Dictionary(Of tComp, List(Of Double)) InputUndefData = New Dictionary(Of String, List(Of Double)) CalcData = New Dictionary(Of tCompCali, List(Of Double)) + JumpPoint = New List(Of Integer) For i = 0 To UBound(OptPar) OptPar(i) = True Next i @@ -299,12 +298,13 @@ Public Module input CalcData(tCompCali.t).Add(CDbl(Line(sKV.Value))) If tDim >= 1 Then If Math.Abs((InputData(sKV.Key)(tDim) - InputData(sKV.Key)(tDim - 1)) / (1 / HzIn) - 1) * 100 > Crt.delta_Hz_max Then - If ErrDat Then - Throw New Exception("The input data is not recorded at " & HzIn & "Hz at line: " & JumpPoint & " and " & tDim) - Else - ErrDat = True - JumpPoint = tDim - End If + JumpPoint.Add(tDim) + 'If ErrDat Then + ' Throw New Exception("The input data is not recorded at " & HzIn & "Hz at line: " & JumpPoint & " and " & tDim) + 'Else + ' ErrDat = True + ' JumpPoint.Add(tDim) + 'End If End If End If ElseIf sKV.Key = tComp.lati Then @@ -348,10 +348,6 @@ Public Module input ElseIf sKV.Key = tComp.beta_ic Then If InputData(sKV.Key)(tDim) > 360 Or InputData(sKV.Key)(tDim) < -360 Then Throw New Exception("The beta_ic angle is higher then +-360°! This is not a possible angle. Please correct.") - 'ElseIf InputData(sKV.Key)(tDim) > 180 Then - ' InputData(sKV.Key)(tDim) = InputData(sKV.Key)(tDim) - 360 - 'ElseIf InputData(sKV.Key)(tDim) < -180 Then - ' InputData(sKV.Key)(tDim) = InputData(sKV.Key)(tDim) + 360 End If End If Next sKV diff --git a/CSE/declaration_public.vb b/CSE/declaration_public.vb index 16112e229ef53f6e7ba3621eeb9fae9898602c4d..c8c2d754c0aedc7b2a463447cf1676375929b3ba 100644 --- a/CSE/declaration_public.vb +++ b/CSE/declaration_public.vb @@ -51,7 +51,7 @@ Module declaration_public ' Constances for the array declaration - Public JumpPoint As Integer = -1 ' Point at that a jump in the time-resolved data is detected + Public JumpPoint As List(Of Integer) ' Point at that a jump in the time-resolved data is detected Public OptPar() As Boolean = ({True, True, True}) ' Array to identify if optional parameters are given ' Boolean for the programm control