• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Setting Fuel Flow Order?

Messages
10,158
Country
us-arizona
Hey all,

Can one set fuel flow to be in an order? For instance, I have tip tanks, wing tanks, and core tanks. Can I set the system up to flow from tips first, deplete those, then the feed draws from the wing tanks and have core main tanks last?

Would that need to be an automated logic invisible gauge or can a setting be done that does this automatically?

(I actually need the core tanks to be untouched and have to be 'transferred' to the wing tanks for flow to the engine to occur, after the wing tanks are used up).

Many thanks,

Bill
LHC
 
Automatic logic since you did not mention the user changing the fuel selector.

I suspect there is no fuel selector?

Help on the auto logic...
With a hidden fuel selector you can do this:
Write a code to switch the fuel selector on aircraft reload to "left tip" and "right tip"
Next have another code that tells the fuel selector to switch to "left main" and "right main" when tip tanks are empty or low.
Repeat for center tanks...
 
Just make sure you compare the desired tank selection with the actual before deciding to send the key event. That way you will prevent flooding.
 
Automatic logic since you did not mention the user changing the fuel selector.

I suspect there is no fuel selector?

Exactly. The engines drain the fuel from tip tanks first, then the wings with each engine draining from each side. When the wings run low, you have to transfer fuel from the centers to the wings or the engines starve.

Help on the auto logic...
With a hidden fuel selector you can do this:
Write a code to switch the fuel selector on aircraft reload to "left tip" and "right tip"
Next have another code that tells the fuel selector to switch to "left main" and "right main" when tip tanks are empty or low.
Repeat for center tanks...

Many thanks. Should be interesting. Doesnt sound toooo difficult. :S


Just make sure you compare the desired tank selection with the actual before deciding to send the key event. That way you will prevent flooding.

Arrigatto, Naruto-kun.
 
Bill,

There could be multiple ways to do this.. I'm assuming it is a 2 engine aircraft. The statement you made is a little "iffy" on exactly what you want.
(I actually need the core tanks to be untouched and have to be 'transferred' to the wing tanks for flow to the engine to occur, after the wing tanks are used up)
Do you mean the transfer of fuel between the core tanks to wing tanks = the fuel flow rate to the engine? (Easiest to accomplish) -or-
Do you mean transfer all (or at a specific rate) the fuel from the core tanks to the wing tanks once the wing tanks are empty the first time?

From this post just using the basic FS logic the easy way would work..

The aircraft.cfg -
Code:
fuel_type = 1 // OR TYPE OF FUEL NEEDED
number_of_tank_selectors = 2 // MUST BE 2
LeftTip = -7.50, -3.3, -0.45, 27, 3 // REPRESENTS LEFT TIP TANK
LeftAux = -7.92, -10.0, -0.45, 15, 0 // REPRESENTS LEFT WING TANK
LeftMain = -7.54, -18.0, 0.10, 15, 0 // REPRESENTS LEFT CORE TANK
RightTip = -7.50, 3.3, -0.45, 27, 3 // REPRESENTS RIGHT TIP TANK
RightAux = -7.92, 10.0, -0.45, 15, 0 // REPRESENTS RIGHT WING TANK
RightMain = -7.54, 18.0, 0.10, 15, 0 // REPRESENTS RIGHT CORE TANK
electric_pump=2 // OPTIONAL AS NEEDED

Then a "forcing" gauge (VC) sets the selectors in their proper place.
Code:
<Update>
(A:FUEL TANK SELECTOR:1, number) 2 != if{ 2 (&gt;K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2, number) 3 != if{ 3 (&gt;K:FUEL_SELECTOR_2_SET) }
</Update>

_________________________________________________________________________

If you want to have an "actual" fuel transfer once the wing tanks are empty the first time then there could be 2 ways.

1. (Not so good) Use the Concorde transfer system. There would be only 1 core tank and 2 wing tanks and 1 selector. Would have to toggle between forward and aft transfer at equal rates.. There are 2 vintage posts at Avsim that show this and other tank setups. Here & Here

2. (Much better) Use the above (easy way) and then incorporate Doug's fuel dump gauge when necessary to "take from" cores and "put it into" the wing tanks.
 
Last edited:
Exactly. The engines drain the fuel from tip tanks first, then the wings with each engine draining from each side. When the wings run low, you have to transfer fuel from the centers to the wings or the engines starve.

Bill, you could use SIMVARS' class in XMLTools to transfer fuel from center to wing tanks, would be simple to code as well.

Tom
 
Tom,

Ahh I missed that quote :( . I believe Bill codes for both FS9 and FSX ?

Bill,

If you could live with - "If the wing tanks has a level of fuel, keep it that way" then even though the engines are taking from the cores it is simulating the engines taking from the wings with the cores keeping the same level in the wings. Just a little aircraft.cfg and gauge change from above would do it. (Would work in FS9 & FSX+)

Code:
fuel_type = 1 // OR TYPE OF FUEL NEEDED
number_of_tank_selectors = 2 // MUST BE 2
LeftTip = -7.50, -3.3, -0.45, 27, 3 // REPRESENTS LEFT TIP TANK
LeftAux = -7.92, -10.0, -0.45, 15, 0 // REPRESENTS LEFT CORE TANK
LeftMain = -7.54, -18.0, 0.10, 15, 0 // REPRESENTS LEFT WING TANK
RightTip = -7.50, 3.3, -0.45, 27, 3 // REPRESENTS RIGHT TIP TANK
RightAux = -7.92, 10.0, -0.45, 15, 0 // REPRESENTS RIGHT CORE TANK
RightMain = -7.54, 18.0, 0.10, 15, 0 // REPRESENTS RIGHT WING TANK
electric_pump=2 // OPTIONAL AS NEEDED

Code:
<Update>
<!-- APPLY RULES SO "SIMULATED" FUEL TRANSFER OCCOURS -->
<!-- IF BOTH THE TIPS AND MAINS ARE EMPTY THEN STARVE THE ENGINE -->
<!-- OTHERWISE USE FS LOGIC -->
<!-- FROM FSX SDK - NOT TESTED -->

<!-- LEFT SIDE -->
(A:FUEL TANK LEFT TIP LEVEL, Percent Over 100) 0.1 &lt; (A:FUEL TANK LEFT MAIN LEVEL, Percent Over 100) 0.1 &lt; and
   if{ (A:FUEL TANK SELECTOR:1, number) 0 != if{ 0 (&gt;K:FUEL_SELECTOR_SET) } }
   els{ (A:FUEL TANK SELECTOR:1, number) 2 != if{ 2 (&gt;K:FUEL_SELECTOR_SET) } }

<!-- RIGHT SIDE -->
(A:FUEL TANK RIGHT TIP LEVEL, Percent Over 100) 0.1 &lt; (A:FUEL TANK RIGHT MAIN LEVEL, Percent Over 100) 0.1 &lt; and
   if{ (A:FUEL TANK SELECTOR:2, number) 0 != if{ 0 (&gt;K:FUEL_SELECTOR_2_SET) } }
   els{ (A:FUEL TANK SELECTOR:2, number) 2 != if{ 2 (&gt;K:FUEL_SELECTOR_2_SET) } }
</Update>


Just 1 of the "Gazillion" ways to do it.

EDIT - This would work as long as the end user uses a proper filling technique.. Wing tanks first! Then optional the rest of the way.. I guess the only real way to get this done especially if the aircraft has "true transfer" pumps between all tanks is to use Doug's gauge if you are to include FS9..

An example would be the end user filled the tips and partially filled the cores with nothing in the wings. The gauge would have to be programmed so that the tips transferred to the wings and whatever space was left over in the wings would be transferred from the cores then FS logic would take over.. Again, another 1 of the "Gazillion" ways to do it. :stirthepo
 
Last edited:
Many thanks Roman and Tom. A thousand thanks for the input on setting up the tanks and selectors.

This is for a vintage Learjet 24B. The engines fed from the tip tanks, then the wing tanks. The Core fuselage tanks were like an auxiliary system, where the tip tanks had to be empty before landing, so they were priority to empty out first. A true transfer pump is used to move the fuel from the wings to the core tanks when fueling it up, then later as the wings empty, you transfer fuel back into the wings from the core tanks.
 
According to what your saying there is no fuel selector but there is 2 fuel transfer switches is that right?

This method would burn from 3 tanks. if you assign the tanks to this order below, then your hidden fuel selector can use the default Left and Right position rather than a set code. And you can just add 2 fuel transfer switches for main to aux tanks. The aux tanks are now your wing tanks....
SDK:
FUEL_SELECTOR_LEFT
Turns selector 1 to LEFT position (burns from tip then aux then main)
FUEL_SELECTOR_2_RIGHT
Turns selector 2 to RIGHT position (burns from tip then aux then main)

I see an issue:
Your saying you must transfer fuel from the main to the aux since this aircraft does not feed fuel from the main tanks as they are really your aux tanks...Use method 1:stirthepo


Method 1:
instead of using tip aux then main. Just use tip, aux and another for your reserve....

Method 2:
So you can just create 2 codes to set 2 hidden fuel selectors. And you will need to prevent flooding as Naruto mentioned.


Flooding: To prevent flooding you ask that the fuel tank is empty and the fuel selector switch is in the tip tank position so this way once this flips the switch to the Aux tanks it can no longer keep sending an action over and over.

Code:
<Update>
LEFT TIP EMPTY ----------  HALF GALLON              FUEL SEL LEFT TIP ON
(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:1, Enum) 12 == and

FUEL SEL LEFT TIP OFF / LEFT WING TANK ON
if{ 2 (&gt;K:FUEL_SELECTOR_1_SET) }

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

RIGHT TIP EMPTY ----------- HALF GALLON              FUEL SEL RIGHT TIP ON
(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:2, Enum) 12 == and

FUEL SEL RIGHT TIP OFF / RIGHT WING TANK ON
if{ 3 (&gt;K:FUEL_SELECTOR_2_SET) }
</Update>
 
Last edited:
Off to test this out;

Code:
<Update>

<!-- WING TIP TANKS ON -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.51 &gt; (A:FUEL TANK SELECTOR:1, Enum) 12 ! and
if{ 12 (&gt;K:FUEL_SELECTOR_1_SET) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.51 &gt; (A:FUEL TANK SELECTOR:2, Enum) 11 ! and
if{ 11 (&gt;K:FUEL_SELECTOR_2_SET) }

<!-- WING TANKS ON -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:1, Enum) 12 == and
if{ 2 (&gt;K:FUEL_SELECTOR_1_SET) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:2, Enum) 12 == and
if{ 3 (&gt;K:FUEL_SELECTOR_2_SET) }

<!-- OUT OF FUEL -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK LEFT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_OFF) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_2_OFF) }

</Update>
 
Works awesome. A thousand thanks DG and Roman.

I am posting my work on this. Its all functioning fine in Prepar3D V2. I havent tested it yet in FSX.

Gauge for controlling the fuel selectors (hidden switch, no fuel selector in the aircraft, must have 2 fuel selectors stated in the aircraft.cfg file). This manages which tanks run. In this case, tip tanks bleed out first, then switches to wing main tanks. When both (4) of those are dry, engines starve, selector auto-selects 'off' selection for both fuel hidden fuel selectors. Center1 Tank still can have fuel in it, (in this case) and engines starve. (I needed this. Fuel must be transferred from fuselage to wings for engines to use, as the engines cannot take fuel from the center1 fuel tank).

Code:
<Gauge Name="Fuel Selector Automatic Manager" Version="1.0">
  <Size X="5" Y="5" />

<Update>

<!-- WING TIP TANKS ON -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.51 &gt; (A:FUEL TANK SELECTOR:1, Enum) 12 ! and
if{ 12 (&gt;K:FUEL_SELECTOR_1_SET) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.51 &gt; (A:FUEL TANK SELECTOR:2, Enum) 11 ! and
if{ 11 (&gt;K:FUEL_SELECTOR_2_SET) }

<!-- WING TANKS ON -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:1, Enum) 12 == and
if{ 2 (&gt;K:FUEL_SELECTOR_1_SET) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:2, Enum) 11 == and
if{ 3 (&gt;K:FUEL_SELECTOR_2_SET) }

<!-- OUT OF FUEL -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK LEFT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_OFF) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_2_OFF) }

</Update>



</Gauge>

EDIT*** This code was corrected, a flaw was in it, it has been revised. It still has 'code flooding' occur when the fuel shuts off. I hope to have that fixed soon.
 
Last edited:
The cool thing about this is, I can maintain my names for the tanks; tips, mains, center. I had ALOT of things wired into those locations already, so recoding everything by changing names of the fuel tanks (tips to wings, wings to tips, etc) would have been a little nightmare. This bypasses that and I think has better control.

Ran the tanks out in order on a high speed test run. Was brilliant.
 
Awesome....You do not need "out of fuel" code since it will flood once both tanks are empty since your telling the fuel selector to stay off over and over. The other codes look good. Since it's a hidden fuel selector no need to turn it off. When fuel runs out the engines will fail to run.

If that was to prevent the engines from burning from your main aux tanks, then just use another name for the tank so the engine never gets fuel...
 
Hey is there any chance this code will work for FS9??? I have basicly the same guts for a Lear25 and this would be sweet if it could work

Greg
 
Greg,

Nothing whatsoever out of the ordinary and would work as long as the aircraft.cfg is configured the same for tanks.

Bill,

I agree with DG.. Even as a "logic rule" the code for shutting off the tanks while may or may not be necessary it still needs a check in it. EX.

-ORIGINAL-
Code:
(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK LEFT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_OFF) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_2_OFF) }

-NEW-
Code:
(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK LEFT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (A:FUEL TANK SELECTOR:1, number) 0 != if{ (&gt;K:FUEL_SELECTOR_OFF) } }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (A:FUEL TANK SELECTOR:2, number) 0 != if{ (&gt;K:FUEL_SELECTOR_2_OFF) } }

"Constant Firing" is a bad, bad thing.
Glad to help out ;)
 
Bill,

I leave you here another logic for your fuel system, providing you'll want to use XMLTools to transfer fuel from fuselage tank to wing tanks and vice versa:


Code:
<Gauge Name="Fuel Selector Automatic Manager" Version="1.0">
  <Size X="5" Y="5" />
  <Comment> This gauge requires XMLTools module installed </Comment>
  <Comment> FSX version only </Comment>

    <Macro Name="GetElapsed">                             
        (P:Absolute time,@1) (L:Elapsed,@1) - abs
    </Macro>
 
    <Macro Name="SetElapsed">                             
        (P:Absolute time,@1) (>L:Elapsed,@1)
    </Macro>

    <Update>
        <!-- Fuel Selectors to LEFT and RIGHT -->
        <!-- Burns first from Tip Tanks, then Wing tanks -->
        <!-- Engines starve when out of fuel from Wing tanks  -->
     
        (A:FUEL TANK SELECTOR:1, Enum) 2 != if{ 2 (>K:FUEL_SELECTOR_1_SET) }
        (A:FUEL TANK SELECTOR:2, Enum) 3 != if{ 3 (>K:FUEL_SELECTOR_2_SET) }
 
        <!-- FUS TANK SWITCH placed to "XFER" position -->
        (L:Fuselage Tank Pump Position,enum) 1 ==
        if{

                @GetElapsed(seconds) 1 >
                if{     
                     2500 d (>L:FuelFlowXFER,Pounds per hour) 2 /   (* Typical transfer rate 2500 PPH *)
                     @GetElapsed(hours) * (A:FUEL WEIGHT PER GALLON,Pounds) /
                     (A:FUEL TANK CENTER QUANTITY,Gallons) 0.5 > * (* Do NOT transfer if FUS TANK is out of fuel *)
                     (>L:PerWing_Delta_XFer,Gallons)  (* Rate of transfer per each wing, in gallons *)                  
                     (A:FUEL TANK LEFT MAIN QUANTITY,Gallons) (L:PerWing_Delta_XFer,Gallons) + (>C:SIMVARS:FUEL TANK LEFT MAIN QUANTITY,Gallons)
                     (A:FUEL TANK RIGHT MAIN QUANTITY,Gallons) (L:PerWing_Delta_XFer,Gallons) + (>C:SIMVARS:FUEL TANK RIGHT MAIN QUANTITY,Gallons)
                     (A:FUEL TANK CENTER QUANTITY,Gallons) (L:PerWing_Delta_XFer,Gallons) 2 * - (>C:SIMVARS:FUEL TANK CENTER QUANTITY,Gallons)
                     }
                } 
     
        <!-- FUS TANK SWITCH placed to "FILL" position -->     
        (L:Fuselage Tank Pump Position,enum) 2 ==
        if{
                <!-- Write here the logic -->
             }
     
        <!-- This line MUST go just before closing </Update> -->  
        @GetElapsed(seconds) 1 > if{ @SetElapsed(hours) }

    </Update>
 

</Gauge>

It is not tested, but should work OK.

Tom
 
Last edited:
Bill,

I agree with DG.. Even as a "logic rule" the code for shutting off the tanks while may or may not be necessary it still needs a check in it. EX.

"Constant Firing" is a bad, bad thing.
Glad to help out ;)

Many thanks Roman. I should have known that. Thanks for showing how the switch would be written, the check system.


Bill
 
Roman, I dont know why but your code with the check in it didnt work. I tried re-writing it a few times, nothing seemed to work. What happens is the fuel selectors go to the center main and the engines never starve out.

I ALSO found a mistake I had made in the code. I am posting the revised code here. I'll edit it above (if I can) and get that corrected also. I have the 'Roman' section commented out until I can figure out the right way to go on the code for shutting down the fuel flow.

Code:
<Gauge Name="Fuel Selector Automatic Manager" Version="1.0">
  <Size X="5" Y="5" />

<Update>

<!-- WING TIP TANKS ON -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.51 &gt; (A:FUEL TANK SELECTOR:1, Enum) 12 ! and
if{ 12 (&gt;K:FUEL_SELECTOR_1_SET) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.51 &gt; (A:FUEL TANK SELECTOR:2, Enum) 11 ! and
if{ 11 (&gt;K:FUEL_SELECTOR_2_SET) }

<!-- WING TANKS ON -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:1, Enum) 12 == and
if{ 2 (&gt;K:FUEL_SELECTOR_1_SET) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK SELECTOR:2, Enum) 11 == and
if{ 3 (&gt;K:FUEL_SELECTOR_2_SET) }

<!-- OUT OF FUEL -->

<!-- ////////////////// SAVED
(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK LEFT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (A:FUEL TANK SELECTOR:1, Enum) 0 ! if{ (&gt;K:FUEL_SELECTOR_OFF) } }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (A:FUEL TANK SELECTOR:2, Enum) 0 ! if{ (&gt;K:FUEL_SELECTOR_2_OFF) } }
/////////////////////// SAVED -->

(A:FUEL TANK LEFT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK LEFT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_OFF) }

(A:FUEL TANK RIGHT TIP QUANTITY, Gallons) 0.5 &lt; (A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) 0.5 &lt; and
if{ (&gt;K:FUEL_SELECTOR_2_OFF) }


</Update>



</Gauge>
 
Back
Top