Archived

This topic is now archived and is closed to further replies.

Alba

Fuel Percent Revisited

Recommended Posts

Hi Folks.Further to Bill's reply to my original Fuel Percent post, my Fuel Stats gauge has these few lines of code. I will be expanding it to include all the tanks. This code is my starting point to show a list of the tanks in a window. This is just the Total Fuel Load to start with.Alas, the second String part returns a figure of 447. I expected to see 100 as all tanks are filled. The poundage figure is correct as that corresponds to the fuel loading. The a/c Fuel and payload window shows all tanks at 100% Could someone check and if possible explain the workings of the percent variable.Thanks.Here's the code:-%((A:FUEL TOTAL QUANTITY WEIGHT, lbs))%!08.2f!%((A:FUEL TOTAL QUANTITY WEIGHT, percent))%!03d!Cheers...Kenny

Share this post


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

It doesn't work the way you wrote it. You can not get a percent value as a return for the weight.The variables Bill posted in your other thread are the ones that return the percent values.The SDK covers what variables return what values.

Share this post


Link to post
Share on other sites

>Alas, the second String part returns a figure of 447. I>expected to see 100 as all tanks are filled. The poundage>figure is correct as that corresponds to the fuel loading. The>a/c Fuel and payload window shows all tanks at 100% If you want to display the current total fuel on board as a percentage of the total capacity, you will need to calculate it yourself, as FS only has token variables for individual tank percentages.%(100 (A:FUEL TOTAL QUANTITY, gallons) (A:FUEL TOTAL CAPACITY,gallons) / *)%!03d%!For example, if the total fuel capacity of your a/c is 10,000 gallons, and the total fuel quantity (fuel on board) is currently 5,000 gallons, then...(5,000 / 10,000) * 100 = 50%

Share this post


Link to post
Share on other sites

Folks, thanks for the input.Ed, I am still at the very basic stages of XML and the SDK is still a bit mysterious to me. I can grasp the Key Events and the Variables not too badly but converting them into XML is where I need the help.Bill, my display is intended to work like a PFD where it will show various windows toggled by switches. This is perhaps not the best way to work it but it's where I am right now in my learning curve. I would like a pop up window showing, at the top, the total fuel in pounds and percentage. Then a series of Data lines down the display showing the load and percentage of the various tanks. If I understand your reply correctly, will the Token Variables that you posted earlier work okay for the individual tanks without the calculation that's needed for the total loading?Cheers...Kenny

Share this post


Link to post
Share on other sites

That is correct, Kenny. All the individual tanks have token variables to display either their current fuel level as "gallons" (or liters), and as a percentage.Use the SDK to determine the precise name and unit for each token variable.The basic template for token variables is:(A:TokenVarName,units)

Share this post


Link to post
Share on other sites

Roger Bill, thanks for that.However, looking at the Token Vars. doc. it looks like I will be unable to display the fuel weight for each tank in pounds. The variables are like you say in gallons or percent. There is a parameter for converting gallons to pounds I see but at present level I am unable to make it work.I will change my readouts to gallons and percentage figures.Edited a few mins. later....Bill, this is working out fine. I am getting the readouts as expected and corresponding to the a/c fuel figures. I assume the readouts will change as the a/c uses fuel. Also, I am making a new section for each tank. Is that the best way? I have not as yet made a gauge using large amounts of code, although I see that the GPS sample is very complex with large sections of code. Regards...Kenny

Share this post


Link to post
Share on other sites