Sign in to follow this  
Guest bartels

Uni-Fuel Gauge

Recommended Posts

Greetings, I'm moving on from the simple toggling xml stuff that got my feet wet, and I'm trying to modify the Baron Left Fuel Quantity Gauge. Since it is a percentage gauge, I thought it would be nice to turn this into a gauge which gives you the percentage of fuel left for all of your tanks, not just the left one.I thought there might be an A: option which was similar to the "Fuel tank left main level" which would read "Fuel tank all level", but there is not.So, I am assuming that the way to do this is to add up all the fuel tanks instead?If I understand Arne's document correctly, the operators go at the end of the stack. So this is what I tried to do.

<Gauge Name="FuelQuantity" Version="1.0">   <Image Name="Fuel_Gauge_Background.bmp" ImageSizes="53,53,83,83"/>   <Element>	  <Position X="26" Y="33"/>	  <Image Name="Fuel_Gauge_Needle.bmp" PointsTo="North" ImageSizes="5,17,5,24">		 <Axis X="2" Y="24"/>	  </Image>	  <Rotate>		 <Value Minimum="0" Maximum="1">(A:Fuel tank left main level,part) (A:Fuel tank right main level,part) (A:FUEL TANK LEFT AUX LEVEL,part) (A:FUEL TANK LEFT TIP LEVEL,part) (A:FUEL TANK RIGHT AUX LEVEL,part) (A:FUEL TANK RIGHT TIP LEVEL,part) (A:FUEL TANK CENTER LEVEL,part) (A:FUEL TANK CENTER2 LEVEL,part) (A:FUEL TANK CENTER3 LEVEL,part) (A:FUEL TANK EXTERNAL1 LEVEL,part) (A:FUEL TANK EXTERNAL2 LEVEL,part) +</Value>		 <Failures>			<SYSTEM_ELECTRICAL_PANELS Action="0"/>			<GAUGE_FUEL_INDICATORS Action="Freeze"/>		 </Failures>		 <Nonlinearity>			<Item Value="0" X="9" Y="19"/>			<Item Value="0.25" X="19" Y="13"/>			<Item Value="0.5" X="32" Y="11"/>			<Item Value="0.75" X="41" Y="18"/>			<Item Value="1" X="44" Y="20"/>		 </Nonlinearity>		 <Delay DegreesPerSecond="10"/>	  </Rotate>   </Element>   <Mouse>	  <Help ID="HELPID_CONCORDE_FUEL_QUANTITY"/>   </Mouse></Gauge>

The only part which is changed from the default Baron gauge is the section. However, when I tried this gauge out, the selector was on zero, and it obviously didn't work.Now, I'm a complete newbie to working with operations in XML, and such, so I probably royally mucked it up, not understanding how to add these different tanks.Plus, would I have to change the minimum and maximum values? It would be helpful to know what the variable "part" is returning. And why it ends up being from 0 to 1.Any help? THX!

Share this post


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

>If I understand Arne's document correctly, the operators go at the end of the stack.Not necessarily. The operators are placed behind the operands. In this specialcase there are two ways to proceed since the sequnce of operations is arbitrary in additions: <Value Minimum="0" Maximum="1">(A:Fuel tank left main level,part) (A:Fuel tank right main level,part) (A:FUEL TANK LEFT AUX LEVEL,part) (A:FUEL TANK LEFT TIP LEVEL,part) (A:FUEL TANK RIGHT AUX LEVEL,part) (A:FUEL TANK RIGHT TIP LEVEL,part) (A:FUEL TANK CENTER LEVEL,part) (A:FUEL TANK CENTER2 LEVEL,part) (A:FUEL TANK CENTER3 LEVEL,part) (A:FUEL TANK EXTERNAL1 LEVEL,part) (A:FUEL TANK EXTERNAL2 LEVEL,part) + + + + + + + + +</Value>This does make up a big stack and makes the sum at the end,whereas <Value Minimum="0" Maximum="1">(A:Fuel tank left main level,part) (A:Fuel tank right main level,part) (A:FUEL TANK LEFT AUX LEVEL,part) +(A:FUEL TANK LEFT TIP LEVEL,part) +(A:FUEL TANK RIGHT AUX LEVEL,part) +(A:FUEL TANK RIGHT TIP LEVEL,part) +(A:FUEL TANK CENTER LEVEL,part) +(A:FUEL TANK CENTER2 LEVEL,part) +(A:FUEL TANK CENTER3 LEVEL,part) +(A:FUEL TANK EXTERNAL1 LEVEL,part) + (A:FUEL TANK EXTERNAL2 LEVEL,part) +</Value>makes intermediate sums and holds the number of stack entries small.A complete different approach would be using FUEL TOTAL QUANTITY WEIGHT as variable, posibly some suitable conversions are possible, you should try a bit here.Arne Bartels

Share this post


Link to post
Share on other sites

I tried approach number 2 already, and that was giving me totally useless readout in the gauge. I think what i'm not understanding, is what variable gets produced by the "A:Fuel tank right main level,part"line. Now since its minimum and maximum value is 0-1, then I assume that if the tank is half empty, this variable would return the value of .50, and then the "Item Value="0.5" X="32" Y="11"" line tells the gauge where to draw the needle (showing there is half a tank.)So after adding all the tanks (9 of them) I would have to divide my result by 9?(A:Fuel tank left main level,part) (A:Fuel tank right main level,part) +(A:FUEL TANK LEFT AUX LEVEL,part) +(A:FUEL TANK LEFT TIP LEVEL,part) +(A:FUEL TANK RIGHT AUX LEVEL,part) +(A:FUEL TANK RIGHT TIP LEVEL,part) +(A:FUEL TANK CENTER LEVEL,part) +(A:FUEL TANK CENTER2 LEVEL,part) +(A:FUEL TANK CENTER3 LEVEL,part) +(A:FUEL TANK EXTERNAL1 LEVEL,part) + (A:FUEL TANK EXTERNAL2 LEVEL,part) + 9 /Am I on the right track here? So, if I am adding up all these tanks, and all of them full equal "1", then do I have to divied my total the amount of tanks to get a value of "1"? Is that what the variable "part" is?But then I run into the problem that if some of the tanks return 0 because they don't exist in the plane, then simply dividing by 9 doesn't give the correct value. The divisor should be the number of tanks that return "1", discarding tanks that return "0" from any future calculations, but this would involve an "if" statement which I certainly don't know how to do. :-(This may be more complicated than I thought.Also, regarding the Total Fuel Weight angle... That would circumvent the problem of trying to figure out the divisor, but how on earth could I figure out what kind of formula to use to always return a value of 1 if all the tanks are full, given that different tanks have different capacities, and thus, different weights.What about FUEL TOTAL CAPACITY? Would this return a value between 0 and 1 depending on how much fuel there is?My head is starting to hurt. :-)

Share this post


Link to post
Share on other sites

If Im counted correctly you have 11 tanks so in principle it would be division by eleven. To get rid of the nonexistent tanks you might be able to use ... CAPACITY and if it isn't zero add the divisor up (or possibly a conversion "part" gives you 1 or 0 I don't know).It moight be possible that with conversion ...,part or ...,percentage FUEL TOTAL QUANTITY WEIGHT gives the needed value, you never know. Otherwise with FUEL TOTAL CAPACITY you can check how big the sum of tank volumes is and with FUEL WEIGHT PER GALLON you can calculate the existing fuel volume from FUEL TOTAL QUANTITY WEIGHT. Everything together should enable you to calculate the needed value.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