Sign in to follow this  
rcbarend

Detecting Rate of Change

Recommended Posts

I would like to detect the rate at which a variable is changing and react to the rate, as opposed to the number in the variable.For instance, if I adjust the throttle too quickly, I would like to make another user defined variable dependant upon the rate it is increased, but if the throttle is adjusted slowly, there would be no impact on the second variable.Any thoughts?Steve

Share this post


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

Hi Steve,That's not very complicated.- Read the throttle, and save it's value in a temp variable.- In the next schedule, read the throttle again and compare with the previously saved value. Since the interval time betwen two samples is known (and fixed in in FS) you have a measure for the speed of change.(IN XML: the UPDATE FREQUENCY determines the schedue rate).If you want to make it more accurate:use either a fixed average (calculate the average over a fixed time (eg. 10 or 20 samples), or use a moving average (the average over the last x samples at any point in time).Disadvantage of using an average, is of course a "lag" in response time.Or even more complex (which eliminates this "lag"): make a predictive algoritm (so assume future values based on history); and constantly verify/adapt that.Cheers, Rob Barendregt.

Share this post


Link to post
Share on other sites

RobCan you post an example of the xml code??Im lost on this one.Steve

Share this post


Link to post
Share on other sites

Steve, (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) (G:Var1) - (>G:Var2) (* Var2 contains the difference between current read throttle position and previous one *) .... .... (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) (>G:Var1) Example:if the value of G:Var2 is 2, it means that in this interval the throttle is changing at a rate of 6*2= 12 % per sec.If this doesn't make it clear, I suggest you better describe exactly what you want to accomplish.. That will make it easier to give a good example ..Cheers, Rob

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