For Sure.
Let's start all over, Pete. I hope for the last time.
All I do is the following:
1. Pause FSIM.
2. Write the Position of the plane (Lat, Lon, Altitude, Pitch, Bank angle) to FSUIPC. (The plane now moves to its new location.)
3. Read Magnetic Variation. (magv)
4. Compute True heading by adding the Magnetic Heading I want, to the Magnetic Variation we just Read above in step 3. (Is the Magnetic variation of my new position (I wrote in step 2) not different than at the "old" position of my plane it was in before I moved in it in step 2?)
magv = (magv * 360#) / 65536#
FS_Head = txtHead.Text + magv
FS_Head = (FS_Head * 65536# * 65536#) / 360#
If FS_Head < -360 Then
FS_Head = FS_Head + 720
ElseIf FS_Head < 0 Then
FS_Head = 360 + FS_Head
ElseIf FS_Head = 0 Then
FS_Head = 360
ElseIf FS_Head > 360 Then
FS_Head = FS_Head - 360
End If
5. Write the True Heading to FSUIPC.
6. Finish
I hope that my English, which is not my First language, is understandable.
Clearly the mistake I make is somewhere in converting my Mangnetic Heading to True.
(An interesting thing I saw is that if I write the Pitch angle before the Altitude gets written the Pitch changes significantly. Perhaps this can help someone. It makes sense.)
Perhaps there is a order to write the Position parameters? (Lat, Lon, Alt, Heading, Pitch, Bank angle.)