Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

FUEL_TANK_LEFT_MAIN_LEVEL

Featured Replies

I must say that I am ashamed to be posting this,(could not find an ashamed smile to put here) but how do you get FUEL_TANK_LEFT_MAIN_LEVEL to show gallons in C++ :-hmmmIn xml is was simple, but every way I try in C++ I either get compiler errors or it complies but does not work.:-zhelp

  • Commercial Member

You didn't show exactly what you're doing... but, in C++ the normal variable for the left tank is FUEL_QUANTITY_LEFT. It returns the amount of fuel in gallons by default.The variable you're using is a bit "odd". It returns a value of 8388608.0 to represent 100%. To translate that into gallons or pounds of fuel you'd have to also reference the FUEL_TANK_LEFT_MAIN_CAPACITY variable which returns the total tank capacity in gallons.To convert from gallons to pounds you need to use the FUEL_WEGHT_PER_GALLON variable.

Ed Wilson

Mindstar Aviation
My Playland - I69

Hi EdI was going to use FUEL_QUANTITY_LEFT, but if I remember correctly that gives the combined total for Left Main as well as Left Aux, and I need seperate gauges for each tank.The code I am trying to get to work is using the variables FUEL_TANK_LEFT_MAIN_LEVEL and FUEL_TANK_LEFT_MAIN_CAPACITY, As you pointed out the first variable does give out a odd number, which is where I am getting confused. Some how I have got to use FUEL_TANK_LEFT_MAIN_CAPACITY to alter 8388608.0 to 62 gallons :-roll. Time to give it a rest tonight, my brain is just not working, will start again tomorrow, thanks for the help so far Ed, at least I now know I am using the right variables :-)

Russell,Declare a float variable:FLOAT64 LeftFuelQty;Then use:execute_calculator_code("(A:FUEL TANK LEFT MAIN QUANTITY, gallons)", &LeftFuelQty, NULL, NULL);Much easier than messing around with the native C variables.Doug

  • Commercial Member

Ok... here's what you need to do:FLOAT64 fuel_pct = FUEL_TANK_LEFT_MAIN_LEVELvar.var_value.n/8388608.0;FLOAT64 fuel_amt_gal = FUEL_TANK_LEFT_MAIN_CAPACITYvar.var_value.n * fuel_pct;

Ed Wilson

Mindstar Aviation
My Playland - I69

Hi Russel,here is what I use for the rxpGNS WAAS (and for previous GNS as well):double rxpGNS::AcftFuelCapacity(){ module_var mvar; double value = 0.0; mvar.Init(FUEL_TANK_LEFT_MAIN_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_LEFT_AUX_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_LEFT_TIP_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_CENTER_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_CENTER2_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_RIGHT_MAIN_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_RIGHT_AUX_CAPACITY); value += mvar.Lookup(); mvar.Init(FUEL_TANK_RIGHT_TIP_CAPACITY); value += mvar.Lookup(); return (value * 3.7853); // convert gallons to liters}double rxpGNS::AcftFuelLevel(){ module_var mvar; double value = 0.0; mvar.Init(FUEL_QUANTITY_RIGHT); value += mvar.Lookup(); mvar.Init(FUEL_QUANTITY_LEFT); value += mvar.Lookup(); mvar.Init(FUEL_QUANTITY_CENTER); value += mvar.Lookup(); return (value * 3.7853); // convert gallons to liters}double rxpGNS::AcftFuelFlow(){ module_var mvar; double value = 0.0; mvar.Init(ENGINE1_FF_GPH); value += mvar.Lookup(); mvar.Init(ENGINE2_FF_GPH); value += mvar.Lookup(); mvar.Init(ENGINE3_FF_GPH); value += mvar.Lookup(); mvar.Init(ENGINE4_FF_GPH); value += mvar.Lookup(); return (value * 3.7853); // convert gallons to liters}class module_var : public MODULE_VAR{public: module_var() {id = MODULE_VAR_NONE; var_ptr = 0; var_type = VAR_TYPE_NONE; var_value.n = 0.0; var_old.n = 0.0;}; void Init(GAUGE_TOKEN tok){id = tok; initialize_var((PMODULE_VAR) this);}; void Update() {lookup_var((PMODULE_VAR) this);}; FLOAT64 Lookup() {lookup_var((PMODULE_VAR) this); return var_value.n;}; FLOAT64 Val() {return var_value.n;}; int ValInt() {return var_value.e; }; int ValFlag() {return var_value.f; }; bool ValBool() {return (var_value.:( ? true : false; }; void* ValPtr() {return var_value.p; }; long ValOctal() {return var_value.o; };};Hope this helps!

I should have checked this thread before I started. Brain is working today, came up with this:FLOAT64 FSAPI left_main_fuel_quantity_cb(PELEMENT_NEEDLE pelement){ lookup_var(&left_main_fuel); current_fuel_left_main = left_main_fuel.var_value.n; lookup_var(&left_main); left_main_capacity = left_main.var_value.n; current_fuel_left_main = current_fuel_left_main /8388608.0; current_fuel_left_main = left_main_capacity * current_fuel_left_main; return current_fuel_left_main;}Ed looks like your code is the same but with a lot less typing. Doug I have not tried using the execute_calculator_code before, so will give that a try. JeanLuc will add your code to the long list of bits of code I have for future reference.Thanks

As Doug said, "execute_calculator_code" is easy to use, especially if you need the Fuel-Quantity in lbs or kg:FLOAT64 FuelSys::GetCenterTankQuantityLbs() const{ FLOAT64 val; execute_calculator_code("(A:FUEL TANK CENTER QUANTITY, gallons)",&val,NULL,NULL); return val * FuelSys::GetFuelWeightPerGallonLbs();}FLOAT64 FuelSys::GetCenterTankQuantityKilograms() const{ FLOAT64 val; execute_calculator_code("(A:FUEL TANK CENTER QUANTITY, gallons)",&val,NULL,NULL); return val * FuelSys::GetFuelWeightPerGallonKilograms();}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.