Jump to content

Problem with L:Vars in a fuel gauge


Buzzer

Recommended Posts

I have been trying to develop an XML gauge to show several fuel parameters, particularly actual fuel load at engine start, as well as fuel flow, fuel used, fuel remaining, range and time to empty. If I use the following coding the gallons units display but when I switch to display pounds (using the G:Var1 parameter) the pounds will not display. If i use only gallons or pounds in separate gauges each will display correctly. But, by trying to combine both into a single gauge, only the (G:Var1,bool) ! option works.

 

The flow and fuel remaining work together and work when switched between gallons and pounds. This is probably because they are using standard sim variables and are not relying on the (L:FUELGAL,gallons) parameter.

 

I would also like to be able to base the engine combustion requirement on any of the engines (whichever starts first), not just on engine 1. Although there will usually only be an insignificant usage of between, say engine 4 starting and engine 1 starting, I would like to be able to remove that slight difference. I have tried various "OR" options but cannot get anything to work to initiate the L:FUEL parameter.

 

Any ideas or suggestions welcome.

 

Below is the relevant section(s) of my gauge coding

 

//----LOAD AT START

(A:GENERAL ENG COMBUSTION:1,bool) == if{

(A:FUEL TOTAL QUANTITY,gallons) (>L:FUELGAL,gallons) }

 

(G:Var1, bool) !

Font="Arial" FontSize="8" Color="0x55D9FF"

BackgroundColor="Black" Adjust="Right"

VerticalAdjust="Center">

%((L:FUELGAL,gallons))%!5.1f! GAL

 

(G:Var1, bool)

Font="Arial" FontSize="8" Color="0x55D9FF"

BackgroundColor="Black" Adjust="Right"

VerticalAdjust="Center">

%((L:FUELGAL,gallons) 6 * )%!6.1f!

LBS

 

/-------USED

 

(G:Var1, bool) !

 

BackgroundColor="Black" Adjust="Right" VerticalAdjust="Center">

%((L:FUELGAL,gallons) (A:FUEL TOTAL QUANTITY,gallons) - )%!5.1f! GAL

 

 

(G:Var1, bool)

BackgroundColor="Black" Adjust="Right" VerticalAdjust="Center">

%((L:FUELGAL,gallons) (A:FUEL TOTAL QUANTITY,gallons) - 6 * )%!6.1f! LBS

 

Click to change Fuel Units %((G:Var1, bool) !

)%{if}to Pounds%{else}to Gallons%{end}

(G:Var1, bool) ! (>G:Var1, bool)

Link to comment
Share on other sites

Typo perhaps.

Element1-- position X=0 Y=0

Element2-- position X=0 Y=9

 

I think you may have meant to type a 0 instead of a 9 there.

 

(With a 9, the lbs reading would appear in a different spot. That spot may not be visible in your gauge. (Hidden behind a bitmap image for example.))

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

Yes Top Gun, position X=0 Y=9 should have been Y=0, but it still does not show and would have anyway. And yes, the G:Var1 does work. It changes the toolltip and changes the other fuel values (flow, remaining etc), which I have not shown here as they work OK.
Link to comment
Share on other sites

Starting at the top...

 

(A:GENERAL ENG COMBUSTION:1,bool) == if{

 

== is a comparison operator, you are not comparing anything so get rid of it. If there is combustion A:GENERAL ENG COMBUSTION will return a 1, no combustion = 0. That will satisfy your if{ } query.

 

So, if there is combustion then you read (A:FUEL TOTAL QUANTITY,gallons) and load that value into (>L:FUELGAL,gallons). Why not just use (A:FUEL TOTAL QUANTITY,gallons)?

 

%((L:FUELGAL,gallons) (A:FUEL TOTAL QUANTITY,gallons) - )%!5.1f! GAL

 

In plain English this equation would be...

 

L:FUELGAL - A:FUEL TOTAL QUANTITY

 

I do not think this is what you want, subtracting total capacity from currently available?

 

The same with...

 

%((L:FUELGAL,gallons) (A:FUEL TOTAL QUANTITY,gallons) - 6 * )%!6.1f! LBS

 

...or just use...

 

%(A:FUEL TOTAL QUANTITY WEIGHT,pounds) %!6.1f! LBS

 

peace,

the Bean

 

NB. I have not done any XML coding in a while, I am pretty sure I got this correct.

WWOD---What Would Opa Do? Farewell, my freind (sp)

 

Never argue with idiots.

They drag you down to their level and beat you with experience

Link to comment
Share on other sites

It's way too hot here and my head's a bit fuzzy, but doesn't the last element calculate fuel remaining?

Is that one working?(showing lbs when mode changed?)

 

I was assuming that that element worked, and that I only needed to check your element 2.

 

Please explain.

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

I am trying to capture the fuel load (which will be a fixed amount), when the engine starts (both gallons and pounds) them retain that fuel load. I also want to use that fuel load, less the current fuel quantity, to give me the total fuel used, as a constantly updated amount.

 

As explained, the fuel used and fuel remaining are working OK. the fuel remaining is, of course, just the current quantity (Gals or Lbs) and the fuel used is the fuel at engine start (L:FUELGAL,gallons) minus the current quantity (A:FUEL TOTAL QUANTITY,gallons). Both the REMAINING and USED show correctly in gallons or pounds (using G:Var1) but NOT the initial fuel load at startup.

 

The basic idea of course, is to select whatever fuel you determine you need for the flight then start engine(s), and the gauge will show what you originally selected, what you have now and what you have remaining.

 

All amounts EXCEPT original fuel and fuel used are just standard A:variables, but original fuel and fuel used require the value from L:FUELGAL,gallons. Why does fuel used show OK (when switched to show gallons or lbs) BUT original fuel will only show gallons but not lbs?

 

The whole process works fine if I create two (2) separate gauges one showing only gallons and the other showing only lbs.

Link to comment
Share on other sites

My bad, I got QUANTITY and CAPACITY mixed up. As I said, it's been a while.

 

In this picture, is there a return in the red circle? Why is the string not all on one line?

Capture.JPG

 

In the future, when you post code, put it in a code box.

 

Using square brackets instead of curllies...

 

{CODE} your code here {/CODE}

 

...will retain your code format, such as...

 

(G:Var1, bool)

Font="Arial" FontSize="8" Color="0x55D9FF"
BackgroundColor="Black" Adjust="Right"
VerticalAdjust="Center">
%((L:FUELGAL,gallons) 6 * )%!6.1f!
LBS

 

How do you stop your L:Var from being constantly updated as long as the engine is running?

 

peace,

the Bean

WWOD---What Would Opa Do? Farewell, my freind (sp)

 

Never argue with idiots.

They drag you down to their level and beat you with experience

Link to comment
Share on other sites

There is no return, I just had Notepad reduced in width so the text was wrapped onto the next line.

 

The L:Var is not constantly updated, because the value is stored in the L:Var while the engine is not running. when the engine is running the value is fixed.

Link to comment
Share on other sites

  • 2 weeks later...

I made that same gauge. When i did let the L var keep updating I got all 4. When i did stop it updating, after a while three showed. Both the gals, plus the used lbs. (not the lbs at start.).

Not sure why.

I also tried loading two L vars, and stopping both. Again only starting lbs did not show.

 

You may think you want my version now, but it was a few days ago already, and I had made many versions. Finding the best one may be tricky. I'd rather not go digging for it to be honest. It doesn't work completely anyway so it is of little use.

 

I did see a k:var in the list while trying that may be of use to you. Something like: K:FUEL_USED_SINCE_START (lbs I think)

 

If you use that for used fuel, your Lvar may work for fuel at start.

 

Also, one of the vars you were using is a multiplayer-shared-cockpit variable. I'f not sure if those work in single player.

(I usually avoid them just in case.)

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

'my' gauge was basically what you had posted in post one. With a background image added.

 

Btw, you place "fuel total quantity" in the Lvar. Then you display it (that works, Gal.) and you multiply by 6 to get lbs (that step fails.).

 

But, there are two k:vars in the list. "fuel total quantity (Gal.)" and also "fuel total quantity (lbs.)". Maybe make use of those two.

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

Also, one of the vars you were using is a multiplayer-shared-cockpit variable. I'f not sure if those work in single player.

(I usually avoid them just in case.)

There's no need to be concerned about variables that are listed as "multiplayer-shared-cockpit". They work just fine as single-user (solo) variables. It is simply that those MPSC variables are transmited over the network to another instance of the aircraft. That is all.

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

I now have the gauge working.

It shows USED and also FUEL_AT_TAKEOFF,

both in lbs and gal.

(so all 4 showing, 2 at a time.)

i have a clickspot on it for "switch units".

(and I also added a clickspot for "reset" in there.)

 

it works. Let's say "at start" shows 300 lbs, and USED shows 40 lbs.

When I click "reset" it shows for

"at_start" - 260 lbs (300-40=260 lbs. As expected.)

 

and USED shows 0 lbs after 'reset'. Also as expected.

 

It took of a lot of fidgeting to do. I think I added some Variables that may not be needed.

I'll try to clean it up. Once I have a 'minimal' version that still works I'll post it.

 

Please let me know if you still have any interest in getting it done. There's a few days work in it yet, at least, and I don't want to be doing that if you don't need it any more!

 

I'll wait for a reply.

il88pp.

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

Here's a few images of it.

 

It's the two numbers marked with arrow in the first image. Top is FUEL_AT_START

Bottom one is Fuel USED.

The third one was just something I added for testing only.

 

 

-1- Set to zero, make note of "Fuel At Start".

F1.jpg

 

-2- After Some time. See "Fuel at Start" is still the same.

_____Also note the amount used. That is what has been USED of "Fuel at Start"......

 

F2.jpg

 

-3- Reset pressed. Note Fuel at start is now 250 less. 250.20 to be exact. So the same amount as was indicated as "USED".

 

F3.jpg

 

 

 

 

 

----------------------------------------------------------------

 

Next are two for showing Gal -vs- lbs

-4- First lbs.

 

F4.jpg

 

 

 

-5- Switched quickly to Gal.

(Note, a small difference there may be, though calculation is 6xGal=lbs.

That is because I couldn't do this with sim paused. If lbs is showing, and I pause the sim, lbs still shows. but when switching, Gal does not show. (It does show as soon as I un-pause again.))

 

F5.jpg

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...