Jump to content
The simFlight Network Forums

FSUIPC Client DLL for .NET - Version 2.0


Recommended Posts

I would've said that aircraft like Cessna (the single propeller ones) don't have autopilot, but it seems i was wrong.

The A/P is generally part of the radio stack complex installed in light aircraft. The FS one looks like the Bendix King set. Of course A/P is extra expense, so it depends how much you pay for your aircraft, but the FS Bendix King radio stack has the A/P -- it's at the bottom of the stack in the radio window/gauge.

Is there any possibility to retrieve through FSUIPC client dll for .net the aircraft model also? As far as i can see, for feelthere B777-200ER for example, all i get is BOEING, for A318 i get AIRBUS.

Please use the Search facilities to search the offset documentation. It would be much faster for you and save us time too! No one remembers all of the offset values, it just isn't possible. We have to look them up too!

Searching for "model" reveals offset 3500, which provides the ATC Model information from the Aircraft.CFG file. There's other ATC-type Identification strings in offsets from 3130 to 3160 and the full Title at 3D00. You'll need to look at those and see what it is you want.

Please do make use of the reference information provided. It probably takes me as long to look these things up as would do for you, but i shouldn't need to do it for you.

What does the offset for aircraft type actually retrieve? (by that i mean from where ...).

The offset tables in the documentation describe these things. The "type" is an FS indication -- you want the actual memory location in the FS code? Why? If you mean how does FS derive it, I don't know -- but it must be from the Aircraft.cfg file or the AIR file. One or the other.

Pete

Link to comment
Share on other sites

To get to my question, basically based on those bools i am calling a Process({group_name} but in my timer_tick event handler, i might call Process 4 times (i have 4 groups).

Is that much more resource consuming then rather calling Process() without any group name (when all the groups must be processed) ?

Hi,

Firstly, calling Process() without a group doesn't process all the groups. It only processes offsets that are not assigned to any group.

Calling 4 Process()'s is not very efficient and will probably take about 4 times longer than calling the same number of offsets in one Process().

At the moment the DLL does not allow you to process multiple groups in 1 Process() so you've no choice but to call Process() 4 times.

I can add another overload to Process() that will take an array of groups. This will then bundle all the offsets in the given groups into 1 process call. I think this would be a very useful feature.

I'll send you a beta version via PM for you to test when I've implemented it.

Paul

Link to comment
Share on other sites

  • 4 weeks later...

Hi Paul.

I have a performance question.

My situation:

I have quite a lot of variables to read, but not all of them are needed always.

Posibility a:

Read always all variables.

Posibility b:

Group variables based on when they are needed.

Ex. Group1: keypress vars, speed, alt. hdg. etc. Group2. Flaps. Group 3. Throttles. Group 4. Lights, etc

Read every 200ms Group1. Depending on conditions of those variables Read 1 or 2 groups.

I ask this becasue in another topic you said that reading different groups, one after another, is not a good idea, but the logic says that because normally groups 2,3,4, etc would not be needed, the posibility b is better. Maybe you refer to reading all groups always.

Thanks

Link to comment
Share on other sites

Hi javiercuellar,

Each Process() call you make has an impact on performance because of the overheads involved in getting the data from FSUIPC. The amount of data you read in each process is not that significant in terms of speed. So getting 30 offsets in one process() is always going to be faster than making 2 process() calls of 15 offsets each.

The grouping is good if you have groups of offsets that need to be updated at different rates, or updated conditionally like your example.

In the 1.3 version of the DLL you need to call each group in a separate Process() call, so updating 3 groups would need 3 process() calls. This was a slight drawback in terms of performance.

I've since added a feature (for the poster above you) that allows you to process multiple groups in one process call. The DLL bundles them into a single FSUIPC call.

I'll PM you the beta 1.4 version in a few minutes so you can try it out.

If anyone else wants this feature, PM me and I'll send you the beta also.

Paul

Link to comment
Share on other sites

  • 1 month later...

Hello everyone again,

I need to retrieve the FS time so my acars program can caculate block to block times. I have tried and failed.

My code at top of page:

    Dim hour As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H238) ' Hour - For total hour caculation
    Dim minute As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H239) ' Minutes - For total hour caculation
    Dim second As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H23A) ' Seconds - For total hour caculation

The process code:

        Try

            ' Process the default group 
            FSUIPCConnection.Process()
            Me.blocka.Text = Me.blocka.Text & hour.ToString("f1") & ":"
            Me.blocka.Text = Me.blocka.Text & minute.Value.ToString("F2") & ":"
            Me.blocka.Text = Me.blocka.Text & second.Value.ToString("F2")

        Catch exFSUIPC As FSUIPCException
            If exFSUIPC.FSUIPCErrorCode = FSUIPCError.FSUIPC_ERR_SENDMSG Then
                FSUIPCError1.Show()
                FSUIPCConnection.Close()

            Else

                Throw exFSUIPC
            End If

        Catch ex As Exception
            ' Sometime when the connection is lost, bad data gets returned 
            ' and causes problems with some of the other lines.  
            ' This catch block just makes sure the user doesn't see any
            ' other Exceptions apart from FSUIPCExceptions.
        End Try

Can anyone help me?

Sorry for my lack of VB knowledge...this is my first big project,

Mitch

Link to comment
Share on other sites

I need to retrieve the FS time so my acars program can caculate block to block times. I have tried and failed.

My code at top of page:

    Dim hour As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H238) ' Hour - For total hour caculation
    Dim minute As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H239) ' Minutes - For total hour caculation
    Dim second As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H23A) ' Seconds - For total hour caculation

I expect someone who knows this sort of code will chip in and help, but my first reaction is that "integer" is probably the wrong type for these one byte (8-bit) values. Normally in a 32-bit environment an integer is 32 bits, or 4 bytes, so you are reading, into each of those variables, 4 times too much data and thereby getting a completely wrong result.

Regards

Pete

Link to comment
Share on other sites

EDIT: Pete is also up late and beat me to it!

My code at top of page:

    Dim hour As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H238) ' Hour - For total hour caculation
    Dim minute As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H239) ' Minutes - For total hour caculation
    Dim second As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H23A) ' Seconds - For total hour caculation

Mitch

Hi Mitch,

These three offsets are only 1 byte long (as specified in the FSUIPC programmer's guide). You have declared them as type Integer which is 4 bytes long.

My documentation supplied with the DLL (UserGuide.htm) tells you that for 1 byte offsets you need to use type 'Byte' in Visual Basic , e.g.

    Dim hour As Offset(Of Byte) = New FSUIPC.Offset(Of Byte)(&H238) ' Hour - For total hour caculation

Let me know if you have more questions about this.

Paul

Link to comment
Share on other sites

Ok thanks guys...know how to do all the offset stuff...

Just a quick question... I need to calculate touchdown rate (030C) but in the documentation it says it returns it as meters per second or something. How do I convert this to feet per minute and then put it in a textbox (i know the sending data to textbox part)? (in vb).

Thanks,

Mitch

Link to comment
Share on other sites

I need to calculate touchdown rate (030C) but in the documentation it says it returns it as meters per second or something. How do I convert this to feet per minute...

Hi Mitch,

The documentation for 030C says it's the same data as 02C8. The documentation for 02C8 says:

For the more usual ft/min you need to apply the conversion *60*3.28084/256

So all you need to do is use the formula given like this:

' Declare the offset
Dim tdRateOffset As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H30C)

' Convert to ft/min
Dim touchDownRate As Double
touchDownRate = tdRateOffset.Value * 60D * 3.28084D / 256D

/ 256 turns the raw data into metres/sec

* 3.28084 turns it into feet/sec (3.28084 feet in a metre)

* 60 turns it into feet/min (60 seconds in a minute)

Paul

Link to comment
Share on other sites

  • 6 months later...

What are the "Pro's & Con's" using FSUIPC versus Simconnect? and/or "Why should I use FSUIPC and not Simconnect?

Hi,

SimConnect only works with FSX. If that's the only version of Flight Sim you want your application to work with then SimConnect is probably what you'd want to use. There are a few esoteric things that you can do with SimConnect that can't be done with FSUIPC like creating AI aircraft. You'll need to check the available functionality against what your application needs to do.

If you want your program to work with older versions of Flight Sim as well (FS2000, FS2004 etc) then you must use FSUIPC.

The version of FSUIPC that runs with FSX actually uses SimConnect to get most of the data. It just adds a compatibility layer over the top so that existing FSUIPC applications work with FSX.

I can't say if the SimConnect API is any easier than FSUIPC as I've not used SimConnect.

Paul

Link to comment
Share on other sites

What are the "Pro's & Con's" using FSUIPC versus Simconnect? and/or "Why should I use FSUIPC and not Simconnect?

Hi,

SimConnect only works with FSX. If that's the only version of Flight Sim you want your application to work with then SimConnect is probably what you'd want to use. There are a few esoteric things that you can do with SimConnect that can't be done with FSUIPC like creating AI aircraft. You'll need to check the available functionality against what your application needs to do.

If you want your program to work with older versions of Flight Sim as well (FS2000, FS2004 etc) then you must use FSUIPC.

The version of FSUIPC that runs with FSX actually uses SimConnect to get most of the data. It just adds a compatibility layer over the top so that existing FSUIPC applications work with FSX.

I can't say if the SimConnect API is any easier than FSUIPC as I've not used SimConnect.

Paul

Hi Paul,

thanks a lot for your reply - this is already useful enough for me.

Rgds

Tim

Link to comment
Share on other sites

  • 2 weeks later...

Hi Captain Dowson and Captain Henty!

Thank you for your contributions to our FS experience!

I have recently started exploring the FSUIPC SDK and unfortunately, I could already use your help, as it seems that I can't manage to get Paul's client to connect with FSUIPC.

I have no idea whether this is an FSUIPC, a FSUIPC client, or a .NET problem, so I hope that this is the correct place to ask for help...

When I start the VB.NET client with FS not running I get error #2 FSUIPC_ERR_NOFS (as can be expected).

When FS is running whilst starting the .Net client I get error #12 FSUIPC_ERR_SENDMSG (as a result from loading the form).

Am I correct in thinking that this means that the running FSUIPC has been found but the client cannot communicate with FSUIPC?

When the form is loaded, the "Connect to FSUIPC" button is NOT disabled (as it should be after a successful connection according the code), but clicking on it results in error #1 FSUIPC_ERR_OPEN indicating that the connection to FSUIPC is already open....

Could any of you two gurus please point me in the right direction to search for a solution?

Thank You very much.

Joris.

I suspect the problem could have to do with my system configuration:

- Windows 7 (64)

- FS2004

- FSUIPC SDK release 29

- FSUIPC version 3.98 (properly registered)

- FSUIPCClientExample_VB v1.3 transferred to Visual Studio 2008

Link to comment
Share on other sites

When FS is running whilst starting the .Net client I get error #12 FSUIPC_ERR_SENDMSG (as a result from loading the form).

Hi Joris,

This error is thrown when the request to FSUIPC fails to get through. The most likely cause on Windows 7 is that your program (or VS2008) is running "As Administrator" but Flight Sim isn't. Or the other way around. Either run both "As Administrator" or neither.

If that's not the problem or doesn't sort it out can you re-post this problem as a new topic. This thread is a bit long and we may need Pete's help for this.

Thanks,

Paul

Link to comment
Share on other sites

hi all, i'm developing a little module, it module should write a takeoff time , my question is , ther is a EVENT who rise this...?? like a clik of a button?

i don't want to use offsett if i can

thank's a lot

Not with my DLL. There are no events built into it. You just need to keep checking to offset and wait for it to change.

Events are possible in the LUA scripting facility supplied with FSUIPC. See the LUA documentation provided with FSUIPC.

If you need more information or help with LUA please start a new topic for Pete.

Thanks,

Paul

Link to comment
Share on other sites

This error is thrown when the request to FSUIPC fails to get through. The most likely cause on Windows 7 is that your program (or VS2008) is running "As Administrator" but Flight Sim isn't. Or the other way around. Either run both "As Administrator" or neither.

Hi Paul,

Thanks for your reply and suggestion. It was indeed an 'As Administrator' problem.

I am deeply ashamed that I bothered you with this problem as you described this exact solution on here before.

I did try changing the 'Run as administrator' settings to make them all match before I asked for help, but I must have been distracted and had forgotten one.

Sorry, and thanks for your excellent support!

(I know where to come if I struggle and need more help :D)

Joris

Link to comment
Share on other sites

  • 2 weeks later...

Hi all, I have a problem reading data from the vertical velocity.

If the value is positive (the plane goes up) the values are correct, but if the data is negative (lower plane) the value of the variable is always the same: Vs = 64836

To know is this? I am currently working on a project that simulates the autopilot and display the values in a lcd 16x2, all other values pick them up without problems (alt, hdg, ias etc) but I have problems with this value.

Please help me, thank you very much and I give the code:

Public GRADOS_HDG As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7CC)

Public GRADOS_HDG_ant As Integer

Public ALTITUD As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7D4)

Public ALTITUD_ant As Integer

Public AP_VS As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7F2)

Public AP_VS_ant As Integer

FSUIPCConnection.Process()

GRADOS_HDG_ant = ((GRADOS_HDG.Value * 360) / 65536)

ALTITUD_ant = ((ALTITUD.Value * 3.28084) / 65536)

AP_VS_ant = AP_VS.Value

Link to comment
Share on other sites

Hi all, I have a problem reading data from the vertical velocity...

Please help me...

Pete has already given you the answer yesterday. Why are you posting this again here? I'm going to post this reply to both threads.

Your code is using the wrong data types. Each data type (e.g. Integer, Short, Double) stores a different amount of data. If you don't use the correct data type then you are getting the wrong values from FSUIPC. This happens because you end up getting the values of two offsets mixed together.

Public GRADOS_HDG As Offset (Of Integer ) = New FSUIPC.Offset (Of Integer )(&H7CC)

The "FSUIPC programmer's guide" clearly says this offset is 2 bytes long. You've used an Integer which is 4 bytes long. You need to use Short which is 2 bytes, like this:

Public GRADOS_HDG As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7CC)
Public GRADOS_HDG_ant As Short

All this is explained very clearly in the documentation that comes with my DLL. You need to read the "UserGuide.htm" document in the "Docs" folder in the zip you downloaded. Look at the section called "Registering your interest in an Offset". It has a table that tells you what variable type you need to use for each offset size and type.

Following the rules laid out in that table your entire code should read:

Public GRADOS_HDG As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7CC)
Public GRADOS_HDG_ant As Short
Public ALTITUD As Offset (Of Integer) = New FSUIPC.Offset (Of Integer)(&H7D4)
Public ALTITUD_ant As Integer
Public AP_VS As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7F2)
Public AP_VS_ant As Short
FSUIPCConnection.Process()
GRADOS_HDG_ant = ((GRADOS_HDG.Value * 360) / 65536)
ALTITUD_ant = ((ALTITUD.Value * 3.28084) / 65536)
AP_VS_ant = AP_VS.Value

Paul

Link to comment
Share on other sites

Pete has already given you the answer yesterday. Why are you posting this again here? I'm going to post this reply to both threads.

Your code is using the wrong data types. Each data type (e.g. Integer, Short, Double) stores a different amount of data. If you don't use the correct data type then you are getting the wrong values from FSUIPC. This happens because you end up getting the values of two offsets mixed together.

The "FSUIPC programmer's guide" clearly says this offset is 2 bytes long. You've used an Integer which is 4 bytes long. You need to use Short which is 2 bytes, like this:

Public GRADOS_HDG As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7CC)
Public GRADOS_HDG_ant As Short

All this is explained very clearly in the documentation that comes with my DLL. You need to read the "UserGuide.htm" document in the "Docs" folder in the zip you downloaded. Look at the section called "Registering your interest in an Offset". It has a table that tells you what variable type you need to use for each offset size and type.

Following the rules laid out in that table your entire code should read:

Public GRADOS_HDG As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7CC)
Public GRADOS_HDG_ant As Short
Public ALTITUD As Offset (Of Integer) = New FSUIPC.Offset (Of Integer)(&H7D4)
Public ALTITUD_ant As Integer
Public AP_VS As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7F2)
Public AP_VS_ant As Short
FSUIPCConnection.Process()
GRADOS_HDG_ant = ((GRADOS_HDG.Value * 360) / 65536)
ALTITUD_ant = ((ALTITUD.Value * 3.28084) / 65536)
AP_VS_ant = AP_VS.Value

Paul

Thank you very much and sorry for the trouble of putting the question twice. A greeting and you are great!!

Link to comment
Share on other sites

  • 2 weeks later...

Hi, how are you, sorry by the question, but

i cna't read aircraft name from dll.I'm developing app for FS2004, FSX.

and others,

and use

//**************************** Get aircraft name S*************************************

//public Fsuipc.

result = fsuipc.FSUIPC_Read(0x3D00, 256, ref token, ref dwResult);

//result = fsuipc.FSUIPC_Read(0x0564, 4, ref token, ref dwResult);

result = fsuipc.FSUIPC_Process(ref dwResult);

result = fsuipc.FSUIPC_Get(ref token, ref dwResult);

txtTipoAvion.Text = dwResult.ToString();

but i can't read nothing, can you help me please.?

Link to comment
Share on other sites

//**************************** Get aircraft name S*************************************

           //public Fsuipc.
            result = fsuipc.FSUIPC_Read(0x3D00, 256, ref token, ref dwResult);
            //result = fsuipc.FSUIPC_Read(0x0564, 4, ref token, ref dwResult);
            result = fsuipc.FSUIPC_Process(ref dwResult);
            result = fsuipc.FSUIPC_Get(ref token, ref dwResult);
            txtTipoAvion.Text = dwResult.ToString();

but i can't read nothing, can you help me please.?

You seem to be using the old C# SDK. Sadly, it doesn't support reading strings from FSUIPC (or floats or doubles either). If you haven't written too much code then I suggest you stop using this c# sdk; it really is awful. That's why I developed my .NET Client DLL which you can download on page 1 of this thread. My DLL supports all data types and it's much easier to understand and use.

If you have too much invested in the old C# SDK then let me know. I might be able to add string support to the old SDK. It's not my code though.

Paul

Link to comment
Share on other sites

You seem to be using the old C# SDK. Sadly, it doesn't support reading strings from FSUIPC (or floats or doubles either). If you haven't written too much code then I suggest you stop using this c# sdk; it really is awful. That's why I developed my .NET Client DLL which you can download on page 1 of this thread. My DLL supports all data types and it's much easier to understand and use.

If you have too much invested in the old C# SDK then let me know. I might be able to add string support to the old SDK. It's not my code though.

Paul

yes, i'm use old modules..... and y have a lot of code wrote.

but no porblem y will change for a nyopur dll is easyer than other code..thanks .... thank's a lot for your answer....

see you Demian

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.