# 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 on other sites

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 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 on other sites

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

##### 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 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 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

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• 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!