Sign in to follow this  
Guest zavoq

CDI Needle Devflection in XML Gauges

Recommended Posts

I am attempting to create a VOR gauge in XML, and am stuck on the way FSX interprets the deflection of the needle. According to the SDK, it is seen as a number between -127 and 127. Problem is, the gauges show deflection based on degrees from the course, in 2 degree increments with 10 degrees left or right of the course being full deflection. How do I convert -127 and 127 to degrees so that the gauge will accuratly display the planes position?Thanks in advance,Charlie

Share this post


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

For a tuned VOR the +/- 127 represents the +/- 10* of lateral deflection.For a tuned ILS the +/- 127 represents the +/- 2.5* of lateral deflection.

Share this post


Link to post
Share on other sites

The best (and simplest) way is to look at some of the default XML gauge for examples. For instance, here's the code from the Beech Baron: (A:HSI CDI needle valid, bool) if{ (A:HSI CDI needle, number) } els{ 0 }Note that ACES scaled the movement by a factor of 22, and the 'needle' will shift left/right accordingly. You would calculate your own scale factor to match with your artwork size/scale. In this particular case, the total scale is 45 pixels (so 22 on either side of center), so 22 pixels is the scalar: 22/127 = 0.173 scale factor.For a VOR head, you might need to pivot the needle from the top, in which case you'd use a rather than a movement.You could also use a non-linearity table instead of a scaling factor......there's a baker's dozen different ways to accomplish the task. ;)

Share this post


Link to post
Share on other sites

>>>>How do I convert -127 and 127 to degrees so that the gauge will accuratly display the planes position?<<<

Share this post


Link to post
Share on other sites

So in other words (just to make sure that I have this correct) +127 = full 10 degree deflection right and -127 should be a full 10degree deflection left.So I just need to match up 127 with my artworks 10 degree mark to the right, and 127 with my artworks 10 degree mark to the leftIs that correct?Charlie

Share this post


Link to post
Share on other sites

>So in other words (just to make sure that I have this>correct) +127 = full 10 degree deflection right and -127>should be a full 10degree deflection left.>>So I just need to match up 127 with my artworks 10 degree mark>to the right, and 127 with my artworks 10 degree mark to the>left>>Is that correct?>>CharlieWell, I can't claim for certain negative is left... but... yes, you have the right understanding.

Share this post


Link to post
Share on other sites

Fantastic. Thanks for all of the help everyone. I think I got my Vor working like a charm. and to test it, I threw in 7 different NAVs from various planes into my panel just to make sure everything matched up. So either mine is spot on, or all others (including mine now) is incorrect. Im betting for the formerThanks againCharlie

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