Jump to content
The simFlight Network Forums

Sample rate and programming techniques


AASHQ
 Share

Recommended Posts

Dear all (LS),

Some issues I have to consider upfront my design fase I wanna share.

1. Supose I have a throttle device connected through FSUIPC, what kind of interval (times/second) would I consider as a minimum and advise average ? Consider that the FSUIPC_Process takes the longest time to complete.

2. An other issue is, advise needed, I could read from a offset with a large size, getting all data into one relative big block and break it down to what I need and visa versa (for writing) or I can read/write in tiny offset size per item. Wich techniques is common or preferable.

3. If FSUIPC_Process is invoke, does read all values of FSUIPC and reminds it for all futher FSUIPC_Read(s) ?

Sorry for my poor english (do my upmost best to express myself).

Regards,

Bob.

Link to comment
Share on other sites

1. Supose I have a throttle device connected through FSUIPC, what kind of interval (times/second) would I consider as a minimum and advise average ? Consider that the FSUIPC_Process takes the longest time to complete.

It really depends on what sort of aircraft you intend to use it with. A fast response jet fighter would need a more responsive throttle than a modern heavy airliner, whose engines take a while to spool anyway and which really only take your throttle input as a guide and process it through assorted electronic and mechanical and even computerised control-check-change-apply processes.

I am just finalising an interim update to FSUIPC which provides direct axis assignment and hence does its own joystick polling. I find scanning the joystick inputs at anything from 10 to 40 times per second appears more or less the same -- in other words, I can't see any difference in FS. A default based on the standard Windows "timer tick" (55 mSecs, or 18.2 cps) is certainly adequate for pretty much all purposes --- but why not make yours adjustable by parameter so that you can experiment yourself?

To save a lot of time and unnecessary process switches, always compare the new value you are about to post with the last one posted. If they are the same (withing a specific "delta" value, either way), discard it, don't send it. Sending values for a difference of 1 in a range of 16384 is a waste of time. For 16384 try a delta of something like 256 as default -- again make it adjustable, and set it to the highest value which doesn't result in a loss of resolution on your engine settings.

2. An other issue is, advise needed, I could read from a offset with a large size, getting all data into one relative big block and break it down to what I need and visa versa (for writing) or I can read/write in tiny offset size per item. Wich techniques is common or preferable.

If you need ALL of the information in the larger block, then that is more efficient, because FSUIPC only has to process the one request in the data instead of looping arond doing lots of small ones. But the differences are probably not really measurable. If there are "gaps" in the large block -- information you don't need, but which may be changing -- then it would make it less efficient over WideFS because WideServer would be keeping a check on changes to values you don't care about, and generating Network traffic needlessly when they do change.

But it doesn't make a lot of difference at all really, either way. When I designed stuff like the AI traffic "TCAS" tables, I provided lots of values and markers for folks to streamline their access and only read the parts that had changed, but after doing that I too found it didn't really make much difference to performance. My "TrafficLook" program just reads the whole blocks every second -- try it on the same PC as FS and also on WideFS. Of course, once a second isn't a big load in any case -- so that's another consideration. You might get better results, both in FS and in your program, if you do a lot less often than a little very often. But maybe that is less "smooth". There'll be an optimum somewhere between, but I'm not sure it is worth spending too much time looking for it, and measuring the differences may prove futile unless your PC is really overloaded in the first place.

3. If FSUIPC_Process is invoke, does read all values of FSUIPC and reminds it for all futher FSUIPC_Read(s) ?

I don't really understand that question. There's no "memory" in FSUIPC as to what program wants what. Maybe you are thinking about WideFS? In that case your "Process" calls only talk to WideClient. WideClient only places requests for data not previously requested through to WideServer. WideServer remembers which Clients want which data, but only sends it after that when it changes, and it keeps sending it when it changes whether you ask for it again or not.

Hope this helps! ;-)

Regards,

Pete

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

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