Jump to content
The simFlight Network Forums

dwhsmart

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by dwhsmart

  1. 6 hours ago, forstmeier said:

    You can read and write offsets for the PMDG-777 with the Pmdg777 SDK.

    When coding with VB.net you can include the translated SDK  (x VB.net) for the Pmdg777. You read and set all those values.

    You need the Microsoft.FlightSimulator.Simconnect.dll and the PMDG_777X_SDK.h  > in your  VB.net "Release" Folder.

    Just read this Post >

    By the way: you can use the FSX Simconnect.dll for reading and setting the Spoiler "Tick number" and the "Spoiler position value". There is no problem with using different sistems together.

    The route distance "from" > "to" can be calculated in this way: (this is the real nautical mathe formula)

    
    Dim LatitudeAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H560)  'Latitude
    Dim LongitudeAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568) 'Longitude
    
         Lat1 = LatitudeAircraft.value
         Lon1 = LongitudeAircraft.value
    
         lat1 = lat1 * 90 / (10001750D * 65536D * 65536D)
         lon1 = lon1 * 360 / (65536D * 65536D * 65536D * 65536D)
    
         'Dim d As Double
         'lat2, lon2 = destination coordinates that could be the runway center Start position
         d = distance(lat1, lon1, lat2, lon2, "N")  'distance between 2 Pos
    
    
    
        'Function calculate lat, lot between 2 points in distance
        Function distance(ByVal lat1, ByVal lon1, ByVal lat2, ByVal lon2, ByVal unit) As Double
            Dim theta, dist
            theta = lon1 - lon2
            dist = Math.Sin(deg2rad(lat1)) * Math.Sin(deg2rad(lat2)) + Math.Cos(deg2rad(lat1)) * Math.Cos(deg2rad(lat2)) * Math.Cos(deg2rad(theta))
    
    
            'Dim dist As Double
            'read distance result with 1 or 2 decimals    .ToString("f2")
            dist = acos(dist) ' used if theta in calculation is used
    
            dist = rad2deg(dist)
            distance = dist * 60 * 1.1515
            Select Case UCase(unit)
                Case "K"    'Kilometer
                    distance = distance * 1.609344
                Case "N"    'Nautic miles
                    distance = distance * 0.8684
            End Select
    
        End Function
    
    
    
        'convert decimal degreees to radians
        Function deg2rad(ByVal Deg)
            deg2rad = CDbl(Deg * pi / 180)
        End Function
    
        'convert radians to decimal degrees
        Function rad2deg(ByVal Rad)
            rad2deg = CDbl(Rad * 180 / pi)
        End Function
    
    
        'get arccos using the arctan function
        Function acos(ByVal rad)
            Dim pi As Double = 3.14159265358979
            acos = 0
            If Math.Abs(rad) <> 1 Then
                acos = pi / 2 - Math.Atan(rad / Math.Sqrt(1 - rad * rad))
            ElseIf rad = -1 Then
                acos = pi
            End If
        End Function
    
        Public Function Atan2(ByVal y As Double, ByVal x As Double) As Double
            Dim Pi As Double = 3.14159265358979
    
            If y > 0 Then
                If x >= y Then
                    Atan2 = Math.Atan(y / x)
                ElseIf x <= -y Then
                    Atan2 = Math.Atan(y / x) + Pi
                Else
                    Atan2 = Pi / 2 - Math.Atan(x / y)
                End If
            Else
                If x >= -y Then
                    Atan2 = Math.Atan(y / x)
                ElseIf x <= y Then
                    Atan2 = Math.Atan(y / x) - Pi
                Else
                    Atan2 = -Math.Atan(x / y) - Pi / 2
                End If
            End If
    
        End Function

    Always specify when referring to a PMDG aircraft

    You would need a similare calculation approach when using the pmdg / VB.net SDK.

    Raimund

    .

     

    Very helpful to me, thank you!

  2. Hi Thomas

    I am using FSUIPC Version 4.955c. The aircraft model is PMDG-777-300ER. The development environment is Visual Studio  2015(.net framework4.0 , VB.Net). The FSUIPCClient.dll that is used is V2.4.

    About the Spoilers offsets, whether on the ground or in the air, 0BD0, 0BD4, 0BD8 these three are able to get to the value, only 0BCC can not get the value.

    In addition to the GPS system, are there other offsets that can get information on approach status, route distance and estimated flight time?

    Thanks again for your reply.

  3. Hi Paul Henty:

    I am developing a program that uses FSUIPC as the interface to detect the status of the aircraft in FSX and P3D, but I have encountered some problems in the development:

    1.Through 0BCC can not get the state of Spoilers armed.

    2.Through 60FC 6108 615C 6140 6137, can not get the relevant state of the aircraft approach.

    3. Through 61A0,6198, can not get the Route total distance and  Destination ETE.

    My english is poor,please forgive me.

    Hope to get your reply,Thanks.

    Steven Ding

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.