Sign in to follow this  
Guest bartels

Trying to learn gauges in XML

Recommended Posts

I havet tried to make a simple altimeter. It works if I just copy all the code from somewhere. Now i have difficulties with nonlinearity.I have nonlinearity table(A:Indicated Altitude, meters) 100 /But when I start gauge the needle is pointing upwards. And it should be pointing down.How exactly those coordinates have to be? I mean that I measure them from PSP and then put in table. Do they have to be exactly that point where the needle points?Or is it possible to make nonlinearity table with degrees?Hope you understand.

Share this post


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

In principle you grab the coordiabtes from any painting problem and fill them in the nonlinearity table. They don't have to be exact, they have to be somewhere on the line from the rotation centre to the tic marks of the gauge. Make also sure that your needle bon your bitmap points to the same direction as in the "PointsTo=" parameter. E.g. a needle facing to the right needs PointsTo="East". Using PointsToDegreees="90" is also allowed.Nonlinearities can be used with degrees see boeing747-400Clock.xml.Note that without nonlinearities the angles are measured in radians , not the more common degrees (with nonlinerities also, but then they are hidden).Arne BartelsArne Bartels

Share this post


Link to post
Share on other sites

I am still confused by that PointsTo. It took some trial and error to get my dual CHT EGT gauge needles to move in the right direction. One thing about the NONLINEARITY, I discovered that you may need to reverse the order of the items when the needle moves in the opposite direction. I will have to study my own code to see what I actually did to explain this.Here is the fuel gauge code showing simple nonlinearity (BTW I could not get the gauge to work without adding nonlinearity points---the needle just spun around). The points were read directly from my image editing program and are not exact, just reasonably close to where the gauge mark is. I tried to line up with the mark as closely as possible and bring the mouse out to the end of the mark, but none are exactly symmetrical. I doubt it matters much if I were a few pixels off or not exactly mirror image.

<Gauge Name="KNX Fuel" Version="1.0">   <Update Frequency="6"/>   <Container/>   <Image Name="fuel_background.bmp" ImageSizes="153,153,153,153"/>   <Element>	  <Position X="76" Y="76"/>	  <Image Name="analog_needle.bmp" PointsTo="East" ImageSizes="51,8,51,8">		 <Axis X="0" Y="0"/>	  </Image>	  <Rotate>		 <Value Minimum="0" Maximum="360">(A:Fuel tank left main level, percent)</Value>		 <Failures>			<SYSTEM_ELECTRICAL_PANELS Action="0"/>		 </Failures><Nonlinearity>			<Item Value="0" X="10" Y="113"/>			<Item Value="25" X="2" Y="74"/>			<Item Value="50" X="72" Y="1"/>		<Item Value="100" X="150" Y="74"/>		 </Nonlinearity><Delay DegreesPerSecond="7"/>	  </Rotate>   </Element>   <Mouse>	  <Tooltip ID="TOOLTIPTEXT_LEFT_FUEL_PERCENT"/>   </Mouse></Gauge>

Here is the code for the dual EGT CHT gauge. A single gauge has two facing needles.

<Gauge Name="KNX Left Engine Temperature Indicator" Version="1.0">   <Image Name="egt_cht_background.bmp" ImageSizes="153,153,153,153"/>   <Element>	  <Position X="76" Y="76"/>	  <Image Name="analog_needle.bmp" PointsTo="East" ImageSizes="51,8,51,8">		 <Axis X="0" Y="0"/>	  </Image>	  <Rotate>		 <Value Minimum="0" Maximum="700">(A:Eng1 exhaust gas temperature, celsius)		 </Value>		 <Failures>			<SYSTEM_ENGINE Action="0"/>		 </Failures>	<Nonlinearity>			<Item Value="0" X="22" Y="130"/>			<Item Value="500" X="2" Y="74"/>		<Item Value="1000" X="32" Y="17"/>		 </Nonlinearity>	<Delay DegreesPerSecond="12"/>	 </Rotate>	</Element>	<Element>	  <Position X="78" Y="78"/>	  <Image Name="analog_needle.bmp" PointsTo="East" ImageSizes="51,8,51,8">		 <Axis X="0" Y="0"/>	  </Image>	  <Rotate>		 <Value Minimum="50" Maximum="250">(A:Eng1 cylinder head temperature,celsius)		 </Value>		 <Failures>			<SYSTEM_ENGINE Action="0"/>		 </Failures>		 <Nonlinearity>		 <Item Value="200" X="120" Y="15"/>		 <Item Value="0" X="128" Y="132"/>   		 </Nonlinearity>	 <Delay DegreesPerSecond="2"/>	  </Rotate>	</Element><Mouse><Area Left="0" Right="32" Top="0" Bottom="153"><Tooltip ID="TOOLTIPTEXT_ENG1_EGT_CELSIUS"/>	   </Area>	   <Area Left="33" Right="153" Top="0" Bottom="153"><Tooltip ID="TOOLTIPTEXT_ENG1_CHT_CELSIUS"/> 	   </Area></Mouse></Gauge>

Now, I had to reverse the "direction of mangatudes" in the nonlinearlity items to get the needle to move correctly. Maybe I should use a different PointsTo direction to avoid this? But I tried all directions and none of them worked except East. Steve

Share this post


Link to post
Share on other sites

If your needle looks something like this "-->" you need PointsTo="East". If it looks like this "<--" you need PointsTo="West". The PointsTo has nothing to do with rotation sense, only with the start angle.Nonlinearities have also to be sorted clockwise according to the background bitmap. For counterclockwise rotation sort the nonlinearities X= Y= entries clockwise, so the Values= entries are sorted upside down.Arne Bartels

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