dwhsmart Posted November 19, 2016 Report Share Posted November 19, 2016 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 Quote Link to comment Share on other sites More sharing options...

Thomas Richter Posted November 19, 2016 Report Share Posted November 19, 2016 Hi, first I guess you use latest FSUIPC version 4.958 Install FSUIPC4.958 ? To your questions: 1. the spoiler armed state can only be given in air if the flight model you use supports that. On ground the spoiler don't arm but deploy. 2. and 3. those offsets will give you only information if the FSX/ P3D original GPS system is used by the GPS gauge. If your flight model uses a different or external (add-on) GPS system that doesn't support those offsets then you will not get any information by reading them. Thomas Quote Link to comment Share on other sites More sharing options...

dwhsmart Posted November 19, 2016 Author Report Share Posted November 19, 2016 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. Quote Link to comment Share on other sites More sharing options...

Thomas Richter Posted November 19, 2016 Report Share Posted November 19, 2016 Hi, so that is a perfect match, PMDG! They use their own logic for spoilers, armed position will not be seen in standard FS Offset (maybe in their own offset list there is something). For GPS the same, they have their own planning and route system build into their FMC (CDU) that is not linked to FS GPS, so again no information available via standard FS Offsets. And again you will need to check their SDK if you can read route / procedure information. Thomas Quote Link to comment Share on other sites More sharing options...

forstmeier Posted November 19, 2016 Report Share Posted November 19, 2016 4 hours ago, dwhsmart said: 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. 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 . Quote Link to comment Share on other sites More sharing options...

dwhsmart Posted November 20, 2016 Author Report Share Posted November 20, 2016 Oh, the PMDG model needs to use the PMDG SDK to read the Information,I will go to understand and try. Is it possible that other models will use FSUIPC's standard interface to get these values? For example: Aerosoft Airbus model and so on. Thanks again for your reply Quote Link to comment Share on other sites More sharing options...

dwhsmart Posted November 20, 2016 Author Report Share Posted November 20, 2016 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! Quote Link to comment Share on other sites More sharing options...

Thomas Richter Posted November 20, 2016 Report Share Posted November 20, 2016 4 hours ago, dwhsmart said: Oh, the PMDG model needs to use the PMDG SDK to read the Information,I will go to understand and try. Is it possible that other models will use FSUIPC's standard interface to get these values? For example: Aerosoft Airbus model and so on. Hi, other Add-on aircrafts might have as well their own modelled gauges but maybe not an SDK available and standard Offsets might not be used in those cases. Best place to ask would be their forum where maybe others tried as well to get data out of their aircraft model systems. It depends all on if they make use of standard FS/P3D gauges and if not if they provide a way to get data out of their gauges. Thomas Quote Link to comment Share on other sites More sharing options...

dwhsmart Posted November 20, 2016 Author Report Share Posted November 20, 2016 Hi Thomas: Thank you very much for your help and information, I have to solve these problems about the idea. Thank you! Steven Ding Quote Link to comment Share on other sites More sharing options...

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.