So, all together it looks like you want to use AHMI as a graphical interface for the simulation.
Maybe something similar to this:
https://www.youtube.com/watch?v=FRxoemOd5F0From your picture, the data seems to be coming in this format:
"┴Yes 20:37:00 12/09/19 0.0 0.0 0.0 0.0 -90.0 -90.0 -20.0 (followed by 20+ spaces)"
If this is continuous format and it doesn't change much, besides for numbers contained within the string, then you could try using a trick to display it within a TextBox as a single line (so set the TextBox's Multiline property to False):
Private Sub DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Try
Dim mydata As String = SerialPort1.ReadExisting()
If mydata.StartsWith("┴") Then
'Trim all the trailing spaces and remove ┴ character from the string.
Dim resultingString As String = mydata.TrimEnd(New Char() {" "c}).Substring(1)
'Trim all the excess spaces from the string.
Do
resultingString = resultingString.Replace(" ", " "c)
Loop Until resultingString.IndexOf(" ") = -1
'Compare the current text in the TextBox to the resultingString and replace it if different.
'This will update the values only when they change.
'This should be every second due to the clock value but might be different due to speed of communication.
If TextBox1.Text <> resultingString Then
If TextBox1.InvokeRequired Then
TextBox1.Invoke(DirectCast(Sub() TextBox1.Text = resultingString, MethodInvoker))
Else
TextBox1.Text = resultingString
End If
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
I didn't test the code above but it should theoretically give you a string that looks like this:
"Yes 20:37:00 12/09/19 0.0 0.0 0.0 0.0 -90.0 -90.0 -20.0"
Now you could split it and pass the values to AHMI controls, similar to this:
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If Not String.IsNullOrEmpty(TextBox1.Text) Then
Dim somestring() As String
'Split string based on space
somestring = TextBox1.Text.Split(New Char() {" "c})
'This should give us the following substrings:
'somestring(0) = Yes
'somestring(1) = 20:37:00
'somestring(2) = 12/09/19
'somestring(3) = 0.0
'somestring(4) = 0.0
'somestring(5) = 0.0
'somestring(6) = 0.0
'somestring(7) = -90.0
'somestring(8) = -90.0
'somestring(9) = -20.0
AttitudeIndicatorInstrumentControlHMI1.PitchAngle = CDbl(somestring(6))
AttitudeIndicatorInstrumentControlHMI1.RollAngle = CDbl(somestring(7))
AirSpeedIndicatorInstrumentControlHMI1.AirSpeed = CInt(somestring(3))
AltimeterInstrumentControlHMI1.Altitude = CInt(somestring(5))
HeadingIndicatorInstrumentControlHMI1.Heading = CInt(somestring(4))
TurnCoordinatorInstrumentControlHMI1.TurnQuality = CSng(somestring(6))
TurnCoordinatorInstrumentControlHMI1.TurnRate = CSng(somestring(9))
VerticalSpeedIndicatorInstrumentControlHMI1.VerticalSpeed = CInt(somestring(9))
'etc
End If
End Sub
I didn't test the code above either.
The whole code could skip a beat at certain times because of the serial communication, meaning how packets are received, or could even show different strings.
Resource:
https://stackoverflow.com/questions/26593520/scan-a-file-for-a-string-of-words-ignoring-extra-whitespaces-using-vb-net