Jump to content
The simFlight Network Forums

Paul Henty

Members
  • Posts

    1,728
  • Joined

  • Days Won

    78

Posts posted by Paul Henty

  1. Hi George,

    I don't know of any issues with the LVAR read/write functionality.

    I've just tried it here with the example app connected to FSX:SE and it works fine. It read the throttle position and I was able to control the range and mode.

    LVARExample.thumb.png.fbc7e4885bb96591261a66b6f7b06273.png

    What version/type of flight sim are you using?

    When you say it fails to read them, do you mean the values are 0 or is there an error of some kind?

    Make sure you have the latest FSUIPC installed (see the downloads section on Pete's main forum), and the latest version of my DLL (3.1.1).

    Paul

  2.   Quote

    But, it takes around 10 secs as I load it 2 times now, once to an Xdocuments and once to a Dataset,

     

    Expand  

    10 seconds is a long time to read that file.

    If you are using my .NET Client DLL see the latest version (3.1) post in my sub forum. If you use the new AirportsDatabase feature it will save you a lot of coding and loading the database into memory takes about 2 seconds. The database it just a collection in memory, so if you need to get it into a dataset you'll have to transfer the data from the AirportsDatabase with your own code.

    If you're not using my DLL, here's the testing I did for the different ways of reading the runways.xml File:

    XMLTextReader: 24490 Airports in     674 ms
    XDocument:     24490 Airports in   1,254 ms
    XMLDocument:   24490 Airports in  16,275 ms
    Manual Read:   24490 Airports in     937 ms

    If you only need to read the file from top to bottom then XMLTextReader is about twice as fast as XDocument. But even using XDocument only takes just over a second for me. XMLTextReader will require writing a lot more code though.

    I also added code to create rows in a data table and that didn't add any significant time.

    XMLTextReader + Create Table Rows: 24490 Airports in 727 ms

    This test code just finds all the airports from the file, so this is just the time taken to read through the file. There's no other processing. In my DLL I read a lot of the data into an in-memory collection and it takes about 2 seconds with all the string parsing to numbers etc.

    Paul

    • Like 1
  3. Process() always brings back the current value. If you only want to do something when a value changes then you need to store the old value in a variable. The variable would need to be declared at the form or module level. Then after you Process(), you need to compare the current value with the old to see if it's different.

    Paul

     

  4. These offsets work fine in FSX and FSUIPC4.

    They always return the next waypoint id and the lon/lat of the next waypoint.

    The code you posted also works. I used it to follow a flightplan from waypoint to waypoint. It always gave the correct next waypoint and the correct distance and heading.

    Check your code to make sure you're not constantly reloading the flight plan. If you keep writing to &H130 you'll keep restarting the flightplan from the beginning. Make sure offset &H130 is in it's own group and that it's only processed when you need to load the flight plan.

    If that's not the problem then it looks like a bug in P3D.

    Paul

  5. Version 3 Released

    FSUIPCClientDLL is a library that make it easy for .NET developers to use FSUIPC.

    Version 3 is now available as a NuGet package called FSUIPCClientDLL.

    Full instructions on how to install it are on the new website below.

    Be sure to download the new example code application in either C# or VB. This is the main documentation for the library and covers all features of the library from beginners to advanced.

    http://fsuipc.paulhenty.com

    The website has:

    • Installation instructions for Version 3
    • Upgrade instructions from Version 2.4 & 3.0RC
    • Change history
    • New project templates for WinForms and WPF in both C# and VB.NET
    • New and improved example code applications in C# and VB.NET
    • Complete Video Guide for Beginners (C# and VB.NET)

    The main features added from V2.4 are:

    • Helper method to Read/Write LVARs
    • Weather Services
    • Airports/Runways Database
    • Helper method to send controls (events)
    • Helper method to move the aircraft and save/restore position snapshots
    • DLL no longer limited to 32bit. You can now write 64bit applications.

     

    • Thanks 1
  6. Hi Benny,

    Yes this is normal behaviour for ACTIdentifier. As the DLL says this is the Airline + Flight Number, or if there isn't one (GA Aircraft) then it's the tail number.

    To always get the tail number you have two choices:

     

    1. Override the FSUIPC.INI file file settings in code to always bring back the tail number in ATCIdentifier.

    Call this before you refresh the traffic info:

                FSUIPCConnection.AITrafficServices.OverrideAirbourneTrafficINISettings(ATCIdentifier.TailNumber, null);

    There is a similar one for ground traffic.

    Note that this will affect all FSUIPC applications reading AI Traffic.

     

    2. The other method is to use the extended information properties:

    Call this once after you  open the connection:

                FSUIPCConnection.AITrafficServices.UpdateExtendedPlaneIndentifiers(true, false, false, false);

    This will fill the property AIPlaneInfo.TailNumber.

    However, this will be a bit slow the first time you refresh the AI traffic as the DLL has to make additional calls to FSUIPC for each aircraft. After that the additional calls will only be made when a new plane is seen. But, this won't be very noticeable if you're only getting the tail number.

    Paul

     

  7. Yes the code looks fine, and works for me with FSX.

    Have you checked what values you are getting for these two lines?

    Dim lat As FsLatitude = New FsLatitude(gps_next_lat.Value)
    Dim lon As FsLongitude = New FsLongitude(gps_next_lon.Value)

    Is sounds like gps_next_lat and gps_next_lon.Value might be 0.

    If so then it's the same problem as the distance offset. It's not working in P3DV4.

    I've attached a new version of the DLL. This should load your AirportsDatabase now.

    Paul

    FSUIPCClient3.0_RC8.zip

    • Like 1
  8.   Quote

    Distance not good maybe try an other offset?

    Expand  

    You could try 60AC and 60B4 (Lon/Lat of next waypoint).

    If those are okay you can make a FsLatLonPoint with them. Then make another from the Player's Lat/Lon. Then you can get distance between both points (FsLatLonPoint.DistanceFromInNauticalMiles()).

      Quote

    Have you a way to avoid negative number to distance ?

    Expand  

    You can use Math.Abs() to make a number positive.

    • Math.Abs(5) = 5.
    • Math.Abs(-5) = 5.

    Paul

  9. Thanks for the file. I will investigate...

    I see you're using P3DV4. I know there are some things that don't work with V4. Maybe this is one of them.

    I would ask Pete in the main forum about this distance offset in P3dV4. I think he's back from holiday tomorrow.

    I have FSX and it works okay. I don't have P3D so I can't test it there.

    Paul

  10. This code works fine for me:

        Dim gps_distance As Offset(Of Double) = New Offset(Of Double)(&H60EC)
        Dim gps_nextWaypoint As Offset(Of String) = New Offset(Of String)(&H60A4, 6)

     

            FSUIPCConnection.Process()
            Dim distanceNM As Double = Math.Round(gps_distance.Value / 1852, 0)
            Me.TextBox1.Text = gps_nextWaypoint.Value.ToString() & ": " & distanceNM.ToString() + "NM"

    First check unconverted (metres) value in gps_distance.Value. Is that 0 as well?

    These offsets are only active when you have a flight plan active in Flight Sim. Are you sure you have one loaded? Are there waypoints defined in the flight plan?

    If you load the default Cessna with the G1000 GPS do you see the route on the GPS in the cockpit? It should be a magenta line.

    For the AirportsDatabase error - it seems there is a problem with one of the coms frequencies at an airport.

    As you have different scenery to me, I can't reproduce this.

    Could you zip these two files from your main flight sim install folder and attach them here please?

    • F5.csv
    • Runways.xml

    Thanks,

    Paul

  11. Sorry Fred, I didn't see your reply. I think you edited the post. I don't get notified of edits, only new posts.

    Yes the message will be the same, but this time the stack trace has line numbers.

    However, my source code has changed a lot since I sent that .pdb.

    Can you please use the current version attached, get the error and show me the full exception as above.

    There might be a few changes to the DLL that break your code. I have renamed a few properties and methods. Let me know if you get any errors and I'll tell you the new names.

    Thanks,

    Paul

    FSUIPCClient3.0_RC8.zip

    • Like 1
  12. Hi Fred,

    There is a table in the UserGuide.pdf that tells you how to work out which VB Types to use. This is in the 2.4 download package found here:

    http://forum.simflight.com/topic/74848-fsuipc-client-dll-for-net-version-24/

    See page 6.

    For the offsets you listed:

    If they are 8 Bytes and the description says "floating point double" then declare them (Of Double).

    If the description says string then declare as string and set the stated size: e.g. for 60A4:

    Dim gps_nextWaypoint As Offset(Of String) = New Offset(Of String)(&H60A4, 6)

    4 byte (32-bit) integers are (Of Integer).

    2 byte (16-bit) Integers are (Of Short).

    Paul

  13. Hi Luke,

    Welcome to the Sub-forum.

    The best way to start is to download the full V2.4 package for my .NET FSUIPC Client DLL from here:

    http://forum.simflight.com/topic/74848-fsuipc-client-dll-for-net-version-24/

    in that Zip you will find my DLL that you can use in your VB.NET applications. This makes it much easier to work with FSUIPC in .NET languages.

    Included in the Docs folder is a UserGuide.PDF that explains everything you need to know about connecting and reading/writing data.

    There is also a Sample Project in VB (and C#) that is a simple working application that reads data on a timer. It also shows the connection/disconnection logic.

    That should be your first starting point to get familiar with everything.

    You also need to refer to Pete's list of Offsets that is found in the Modules\FSUIPC Documentation folder in the main P3D install folder. For FSUIPC4 it's called "FSUIPC4 Offset Status.pdf". I don't know what the equivalent is for FSUIPC5 but I'm sure it'll be obvious.

    I am soon (hopefully in February) releasing version 3 which has all sorts of new features, and much better and more extensive code examples. All your 2.4 knowledge will still apply however.

    Paul

  14. Hi Fred,

    That code runs fine here. No problems.

    I can't really see what's going wrong without the exception details and the call stack.

    In the openFSUIPC() method, can you comment out the lines:
     

    Try
    
    Catch
        messagebox(...
    End Try

    Then run it again. You need to get the exception details and show me the call stack. Use the 'Copy Details' link and paste it here.

    Paul

     

×
×
  • 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.