Jump to content
The simFlight Network Forums

Booleans


Recommended Posts

Hi Pete,

I've managed to sort out most of my problems (believe it or not :D ). Slap me with a rotten trout, but I only realised all the formulas and var types are *also* in FSI2 - STUPID of me, I know... Ok, so now everything is running and working, and reporting correctly. I can finally proceed to actually do things with the data now.

With some of my data, I also call a couple of boolean values (plane on ground, stall warning, overspeed warning, and crashed).

My application pulls this data every 10ms (and it does put quite a bit of stress on WideFS - CPU load arround 50% on a P4 1.7GHz). However, all my data returns correctly, except the booleans. They would *sometimes* at *random* indicate wrong. The airbourne boolean is about the only one that's always correct. Stalling and overspeed goes true very often for a couple of seconds, to minutes, and then back to false (0), the same with the crashed flag (but significantly less than overspeed and stalling). When these values goes high in my application, there is no indication in the Simulator that they are true (i.e. overspeed / stall warning does not go off in the cockpit)

I know updating every 10ms may be asking allot, I will more than likely update less later (like say, every 250ms or something), but, can these controls be trusted from FS? It's funny to me how it can magically say, I crashed (even through I have crash detection disabled in the simulator), and then later, it says that I didn't crash? The simulator must be confused 8)

Is this pointing back to my code again, or is it because I call them to often / fast, or is it merely a matter of using additional functionality to determine, or rather, confirm, these booleans?

This is about the last thing I have a problem with - hopefully this is something simple as well...

On another issue related to WideFS... Pete have you had any reports of WideFS using 100% CPU when it looses it's connection to FSUIPC? I have my Sim running, WideFS connected (with no application running from WideFS). When I close my Sim (and FSUIPC), WideFS on the second computer will consume 100% CPU... Not a big problem, just a bit of a annoyance. Yes, latest version of both FSUIPC and WideFS.

Thanks as always,

--

Chris.

Link to comment
Share on other sites

My application pulls this data every 10ms

Why? That's 100 times per second! Is that the frame rate you get in FS? I think you need to be more reasonably -- most of the stuff won't even be changing every frame, let alone at two to four times the frame rate. FSUIPC is only processing things once or twice per frame at most.

(and it does put quite a bit of stress on WideFS - CPU load arround 50% on a P4 1.7GHz).

Oh, on WideFS? You'll only be loading the local Client then, unless you are writing stuff too frequently too -- WideServer only sends changes in any case. If you ran your program on the FS PC I think your FS frame rates might plummet.

Stalling and overspeed goes true very often for a couple of seconds, to minutes, and then back to false (0), the same with the crashed flag (but significantly less than overspeed and stalling).

Can you tell me the actual offsets you are reading, and their size? If you are classifying them as "BOOLEAN" in your program and reading them as such, it would explain your problem because:

036C Stall warning -- is a single BYTE (char probably in VB).

036D Overspeed -- ditto

0840 Crashed -- is 2 bytes (a "short" if you like)

If you are reading these as 4-byte integers (which is what a BOOLEAN probably is in VB, then you are getting unrelate values in the other three bytes!

PLEASE PLEASE PLEASE always use FSUIPC's IPC read/write logging to actually CHECK what it is your program is doing!! I cannot emphasise this enough. I spent a lot of time building in all these EASY ways for you to work stuff out -- you should be using them! Please?

You could even try using FSInterrogate a little more too. I see you actually mentioned it.

On another issue related to WideFS... Pete have you had any reports of WideFS using 100% CPU when it looses it's connection to FSUIPC?

WideClient talks to WideServer. WideServer talks to FSUIPC. There is no way WideServer can lose its connection to FSUIPC, they are both within FS.

If you mean wideClient, then it never itself uses 100% of anything, but your program probably will. If you are calling it every 10 mSecs then a lot of that 100% processor time is spent switching processes back and forth. I doubt if your program is even relaxing enough to process its messages is it?

If there's nothing else going on in the client (no other processes to run), then, yes, of course wideclient will soak up the spare. It's multithreaded and its background thread is constantly checking things. If your program was doing anything (which presumably it isn't because it isn't getting new data) then the two between them would use 100% unless you had somerthing else also running.

FS itself consumes 100% even when doing nothing .. or 50% on a dual processor or hyperthreading system (as it only uses one "processor").

Regards,

Pete

Link to comment
Share on other sites

Ok, I'm only going to take the crash detection for now...

Dim IPCOnGround As Boolean = True
Public ReadOnly Property OnGround() As Boolean
  Get
    Dim dwResult As Integer = 0
    Dim dwToken As Integer = 0
    Dim myInt As Integer = 0
    Try
      myFSUIPC.FSUIPC_Read(&H366, 2, dwToken, dwResult)
      myFSUIPC.FSUIPC_Process(dwResult)
      myFSUIPC.FSUIPC_Get(dwToken, myInt)
    Finally
      If myInt = 0 Then
        IPCOnGround = False
      Else 
        IPCOnGround = True
    End Try
    Return IPCOnGround
  End Get
End Property

And again... By typing over my example code from the one PC into this here text box... I saw my mistake already... Wrong variables!!!!!

Thanks for the WideClient info.. What you explained seems to be spot on. And yes, I'm definately going to start doing less reads, 10ms is definately to much... I do need a 'smooth' flow of the data though, but I recon 250ms (4 times per second) should be fine...

I'll play some more with the code and DOUBLE CHECK things giving problems before running here again :)

Thanks Pete.

PS: Don't you ever sleep?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.