Sign in to follow this  
Guest JeanLuc_

Detecting a trend

Recommended Posts

Hi,I want to build a gauge that can detect a speed trend - i.e. be able to detect when the speed is increasing/decreasing.Any ideas? How can i take two measurements of speed at different times and then compare?Many thanks,Paul ScarrattPS Panelshttp://www.pspanels.co.uk

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

You store the speed in a variable at one time and compare it later with the new speed, take difference, store back in the variable. In C or XML? In both cases you should avoid calculating in each frame, that makes a speed trend too jerky. Try to use time steps up to a second or so. You could wait until the current time is bigger then a certain reference time plus a step, make differences in time and speed, display it and reset the stored time to the current value, so the waiting process can be restarted. Arne Bartels

Share this post


Link to post
Share on other sites

Hi,This may help.. this was from a 737-400 project that never came to be.(P:Local Time, seconds) 0.2 % 10 * int 0 == if{ (A:Airspeed indicated, knot) (>G:Var1) }(P:Local Time, seconds) 0.2 % 10 * int 1 == if{ (A:Airspeed indicated, knot) s1 (G:Var1) - 0.1 / 10 * l1 + (>G:Var3) }(G:Var3) (A:Airspeed indicated, knot) >(A:Airspeed indicated, knot) 45 < if{ 0 } els{ (G:Var3) (A:Airspeed indicated, knot) - }(G:Var3) (A:Airspeed indicated, knot) <(A:Airspeed indicated, knot) 45 < if{ 0 } els{ (G:Var3) (A:Airspeed indicated, knot) - }Regards,Roman(KGRB)

Share this post


Link to post
Share on other sites

>You store the speed in a variable at one time and compare it>later with the new speed, take difference, store back in the>variable. In C or XML? In both cases you should avoid>calculating in each frame, that makes a speed trend too jerky.....>Arne Bartels I think the trick is to put the speed, etc. in another variable. Then, use the stored variable in furture calculations. Rather reading speed, etc. again and assuming it is still the same. In XML, I copy A: variables to local L: variables on one 'tick' or strobe, then use the L: variables. One the next tick the L:variables are refreshed again. All in sequence. No display and calculations between the parameter copies. I display V_dot, dTAS/dt to 0.01 ft/sec resolution, and it's stable. Similar for attitude rates, I can see 0.001 deg/sec. I also filter the results, but that won't help much if one is reading a variable for the same calculation when it changes part way through. Here is a screen shot. Lots of rates calculated and displayed. p, q, and r are roll, pitch, and sideslip rates in deg/sec.http://forums.avsim.net/user_files/83489.gifRAF

Share this post


Link to post
Share on other sites

Is XML offering a PixelPerSec displacement lag feature? I would tend to think it is then wrong to use it in the trend vector, because the same gauge, displayed at different sizes, won't move the trend at the same speed?

Share this post


Link to post
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
Sign in to follow this