Jump to content
Sign in to follow this  
Guest Patrick_Waugh

Finding deltas

Recommended Posts

Guest Patrick_Waugh

Does anyone have a working callback that demonstrats how they are capturing a change (delta) in a FS value like an RPM or other FLOAT64 var?I'd like to be able to check on the rate of change of some vars, and not sure the best way to do this.I have tried something like this:

FLOAT64 FSAPI TorqueNeedle_cb(PELEMENT_NEEDLE pelement){	previousTorque = currentTorque;	currentTorque = pelement->source_var.var_value.n / 163.84;	deltaTorque = currentTorque - previousTorque;	return currentTorque;}
but, of course, the change at 18hz is very small, and I'm not sure this is a good approach.What are others doing?Patrick

Share this post


Link to post
Share on other sites

Well, you could use a timer to set your test interval......alternatively, sometimes a simple 'counter' will suffice! ;)if (count == 20){ count = 0; do_stuff ; count++ ; }


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

The link I'm givin is all in xml, ( http://forums.avsim.net/dcboard.php?az=sho...33083&mode=full ) Bill was right on.... Sample something (catch the time) then sample again (catch the time), difference in samples over difference in time = Delta Regards,Roman


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Roman,Thanks, I know the meaning of Deltas in mathmatics.I probably forgot to mention in my original post but I'm working in C/C++, and so I'm looking for how others are doing it in C.But, that is a great topic for those using XML.Patrick

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...