• 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.

P3D v4 B-25J Fuel Selector Gauge Help Needed

Messages
86
Country
us-arkansas
I would like to ask the fsdeveloper community for help with a 2D fuel selector gauge. This gauge is for a freeware B-25J that was converted from FSX to P3D.

The first issues I noticed with this gauge were...

1. The left fuel selector, when set to left main, would feed fuel from both the left and right aux tanks.
2. The left fuel selector, when set to right main, would feed fuel from the right aux tank.
3. The left fuel selector, when set to left aux, would cause the engine to die.
4. The right fuel selector, when set to right main, would feed fuel from both the left and right aux tanks.
5. The right fuel selector was unclickable, so the user could not switch tanks.

I made sure that the LeftMain, RightMain, LeftAux, and RightAux entries in the aircraft.cfg were correct, and they were. I noticed number_of_tank_selectors=1 in the aircraft config, so I changed it to number_of_tank_selectors=2. That fixed the problem with the fuel selector being unclickable, but then I noticed...

6. The right fuel selector, when set to left main, would feed fuel from the left aux tank.
7. The right fuel selector, when set to right aux, would cause the engine to die.

I looked through the panel.cfg to see what xml file controls the fuel selector gauge, which was ecu.xml located in the B25.bin. I extracted the ecu.xml file and looked through it with notepad. I noticed...

XML:
    <!-- Fuel Selector L -->
    <Area Left="29" Top="312" Width="76" Height="76">
      <Help ID="HELPID_GAUGE_FUEL_SELECTOR" />
      <Tooltip ID="TOOLTIPTEXT_DC3_LEFT_FUEL_SELECTOR" />
      <Area Left="39" Top="38" Width="40" Height="36">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_OFF" />
      </Area>
      <Area Left="0" Top="0" Width="38" Height="33">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_LEFT" />
      </Area>
      <Area Left="39" Top="0" Width="37" Height="38">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_RIGHT" />
      </Area>
      <Area Left="0" Top="36" Width="37" Height="31">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_CENTER" />
      </Area>
    </Area>
    <!-- Fuel Selector R -->
    <Area Left="290" Top="312" Width="76" Height="76">
      <Help ID="HELPID_GAUGE_FUEL_SELECTOR" />
      <Tooltip ID="TOOLTIPTEXT_DC3_RIGHT_FUEL_SELECTOR" />
      <Area Left="39" Top="38" Width="40" Height="36">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_2_OFF" />
      </Area>
      <Area Left="0" Top="0" Width="38" Height="33">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_2_LEFT" />
      </Area>
      <Area Left="39" Top="0" Width="37" Height="38">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_2_RIGHT" />
      </Area>
      <Area Left="0" Top="36" Width="37" Height="31">
        <Cursor Type="Hand" />
        <Click Event="FUEL_SELECTOR_2_CENTER" />
      </Area>
    </Area>
  </Mouse>
</Gauge>

I tried many different things to fix it, but what ultimately solved the tank switching problem was this...

XML:
    <!-- Fuel Selector L -->
    <Area Left="29" Top="312" Width="76" Height="76">
      <Help ID="HELPID_GAUGE_FUEL_SELECTOR" />
      <Tooltip ID="TOOLTIPTEXT_DC3_LEFT_FUEL_SELECTOR" />
      <Area Left="39" Top="38" Width="40" Height="36">
    <Tooltip ID="">Engine 1 Fuel Selector Off</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
        <Click>(>K:FUEL_SELECTOR_OFF)
    </Click>
      </Area>
      <Area Left="0" Top="0" Width="38" Height="33">
    <Tooltip ID="">Engine 1 Fuel Selector Left Main</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
        <Click>19 (>K:FUEL_SELECTOR_SET)
    </Click>
      </Area>
      <Area Left="39" Top="0" Width="37" Height="38">
    <Tooltip ID="">Engine 1 Fuel Selector Right Main</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
        <Click>20 (>K:FUEL_SELECTOR_SET)
    </Click>
      </Area>
      <Area Left="0" Top="36" Width="37" Height="31">
    <Tooltip ID="">Engine 1 Fuel Selector Left Aux</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
        <Click>4 (>K:FUEL_SELECTOR_SET)
    </Click>
      </Area>
    </Area>
    <!-- Fuel Selector R -->
    <Area Left="290" Top="312" Width="76" Height="76">
      <Help ID="HELPID_GAUGE_FUEL_SELECTOR" />
      <Tooltip ID="TOOLTIPTEXT_DC3_RIGHT_FUEL_SELECTOR" />
      <Area Left="39" Top="38" Width="40" Height="36">
    <Tooltip ID="">Engine 1 Fuel Selector Off</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
        <Click>(>K:FUEL_SELECTOR_2_OFF)
    </Click>
      </Area>
      <Area Left="0" Top="0" Width="38" Height="33">
    <Tooltip ID="">Engine 1 Fuel Selector Left Main</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
    <Click>19 (>K:FUEL_SELECTOR_2_SET)
    </Click>
      </Area>
      <Area Left="39" Top="0" Width="37" Height="38">
    <Tooltip ID="">Engine 1 Fuel Selector Right Main</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
    <Click>20 (>K:FUEL_SELECTOR_2_SET)
    </Click>
      </Area>
      <Area Left="0" Top="36" Width="37" Height="31">
    <Tooltip ID="">Engine 1 Fuel Selector Right Aux</Tooltip>
    <Help ID=""/>
        <Cursor Type="Hand" />
        <Click>5 (>K:FUEL_SELECTOR_2_SET)
    </Click>
      </Area>
    </Area>
  </Mouse>
</Gauge>

With these changes, I am now able to switch the tanks by clicking on the respective area on the gauge, and I even get a nice tooltip when I hover my mouse over it.

HOWEVER, during startup, the aircraft always defaults to...

1. Left fuel selector sets to Left Main and feeds fuel from the LeftAux tank
2. Right fuel selector sets to Right Main and feeds fuel from the RightAux tank.
3. Switching tanks on the fuel selector causes the fuel to begin to feed from the selected tanks correctly.
3. The BMP images (that point to which tank is selected) for the fuel selector levers disappears UNLESS I have the tanks switched to OFF. The disappearing BMP images do not cause a problem with the selected tanks feeding fuel correctly.

I took a look at the ecu.xml file again, and noticed...

XML:
<!-- ========================= Left Fuel Selector ================ -->
  <Element>
    <Position X="67" Y="350" />
    <Select>
      <Value>(A:Fuel tank selector:1,enum)</Value>
      <Case Value="0">
        <Image Name="ecu_fuel_tank_selector_off.bmp" UseTransparency="Yes">
          <Axis X="47" Y="25" />
        </Image>
      </Case>
      <!-- If ALL then default to LEFT-->
      <Case Value="1">
        <Image Name="ecu_fuel_tank_selector_left_main.bmp" UseTransparency="Yes">
          <Axis X="19" Y="29" />
        </Image>
      </Case>
      <Case Value="2">
        <Image Name="ecu_fuel_tank_selector_left_main.bmp" UseTransparency="Yes">
          <Axis X="19" Y="29" />
        </Image>
      </Case>
      <Case Value="3">
        <Image Name="ecu_fuel_tank_selector_right_main.bmp" UseTransparency="Yes">
          <Axis X="32" Y="25" />
        </Image>
      </Case>
      <Case Value="6">
        <Image Name="ecu_fuel_tank_selector_aux.bmp" UseTransparency="Yes">
          <Axis X="31" Y="24" />
        </Image>
      </Case>
    </Select>
  </Element>
  <!-- ========================= Right Fuel Selector =============== -->
  <Element>
    <Position X="328" Y="350" />
    <Select>
      <Value>(A:Fuel tank selector:2,enum)</Value>
      <Case Value="0">
        <Image Name="ecu_fuel_tank_selector_off.bmp" UseTransparency="Yes">
          <Axis X="47" Y="25" />
        </Image>
      </Case>
      <!-- If ALL the default to RIGHT-->
      <Case Value="1">
        <Image Name="ecu_fuel_tank_selector_right_main.bmp" UseTransparency="Yes">
          <Axis X="32" Y="25" />
        </Image>
      </Case>
      <Case Value="2">
        <Image Name="ecu_fuel_tank_selector_left_main.bmp" UseTransparency="Yes">
          <Axis X="19" Y="29" />
        </Image>
      </Case>
      <Case Value="3">
        <Image Name="ecu_fuel_tank_selector_right_main.bmp" UseTransparency="Yes">
          <Axis X="32" Y="25" />
        </Image>
      </Case>
      <Case Value="6">
        <Image Name="ecu_fuel_tank_selector_aux.bmp" UseTransparency="Yes">
          <Axis X="31" Y="24" />
        </Image>
      </Case>
    </Select>
  </Element>

I tried changing <!-- If ALL the default to LEFT--> and <!-- If ALL the default to RIGHT--> to LEFT MAIN and RIGHT MAIN, and it doesn't solve the issue with it defaulting to feeding fuel from the LEFTAUX and RIGHTAUX tanks.

I'm also stumped as to how to fix the issue with the bitmaps disappearing.

During startup...

Fuel_Selector.png


When switching tanks EXCEPT OFF

Fuel_Selector_2.png


Everything I've mentioned above is the only lines of code I found associated with anything fuel related in this ecu.xml.

I hope this is enough information provided to receive some help. It would be appreciated!
 

Attachments

  • ecuxml.pdf
    240.6 KB · Views: 108
Last edited:
There is an ellipsis on the right-hand side of the icons above the text input area. Clicking it provides 3 more icons. The far right, looks like: </>, is the code one.
 
If you want the system to run automatically it does this in a standard sequence, tips, aux and main. For example I have a single engine jet which has 3 external drop tanks and I want to feed the center tank first then the remaining two externals then the aux then main.
I select tank 6 which is center until it has a small amount of fuel, the select 1 which is all. At that point the remaining externals (tips) feed followed by the aux tanks followed by the main. The automatic system will change the fuel selector settings. for you if you code it that way.
If you have two engines the principle is similar
Code:
A:fuel tank left aux quantity,gallons) 1 &gt;
                 if{
                     1 (&gt;K:FUEL_SELECTOR_LEFT_AUX)
                     }
                     els{
                         1 (&gt;K:FUEL_SELECTOR_ALL)
                         }
                 (A:fuel tank right aux quantity,gallons) 1 &gt;
                 if{
                     1 (&gt;K:FUEL_SELECTOR_2_RIGHT_AUX)
                     }
                     els{
                     1 (&gt;K:FUEL_SELECTOR_2_ALL)
                         }
That checks if there is aux fuel available on left and right and if so feeds aux. Once the aux fuel is low enough the system is switched to all which takes the remaining aux fuel and then feeds from main.

You can have it automatic or you can do it manually. I like automatic because you can use fuel up very quickly in a fighter and the last thing you want is a flame out because you were late manually selecting fuel.
And if you simply select ALL it feeds automatically without any code.
Roy
 
If you want the system to run automatically it does this in a standard sequence, tips, aux and main. For example I have a single engine jet which has 3 external drop tanks and I want to feed the center tank first then the remaining two externals then the aux then main.
I select tank 6 which is center until it has a small amount of fuel, the select 1 which is all. At that point the remaining externals (tips) feed followed by the aux tanks followed by the main. The automatic system will change the fuel selector settings. for you if you code it that way.
If you have two engines the principle is similar
Code:
A:fuel tank left aux quantity,gallons) 1 &gt;
                 if{
                     1 (&gt;K:FUEL_SELECTOR_LEFT_AUX)
                     }
                     els{
                         1 (&gt;K:FUEL_SELECTOR_ALL)
                         }
                 (A:fuel tank right aux quantity,gallons) 1 &gt;
                 if{
                     1 (&gt;K:FUEL_SELECTOR_2_RIGHT_AUX)
                     }
                     els{
                     1 (&gt;K:FUEL_SELECTOR_2_ALL)
                         }
That checks if there is aux fuel available on left and right and if so feeds aux. Once the aux fuel is low enough the system is switched to all which takes the remaining aux fuel and then feeds from main.

You can have it automatic or you can do it manually. I like automatic because you can use fuel up very quickly in a fighter and the last thing you want is a flame out because you were late manually selecting fuel.
And if you simply select ALL it feeds automatically without any code.
Roy
That's very interesting and I will definitely keep that in mind if I get involved in any other aircraft especially fighter jets.

However the goal for this project is to have the tanks feed fuel in accordance with how the levers are set. It would be great to have the BMP images of the levers to display and point to the correct fuel tanks instead of disappearing.

The only thing I can think of that would cause the BMP images to disappear would be that they are tagged to specific tanks. 'All' would point to the left and right main tanks on the selectors (BMP images displayed), which previously fed from both left and aux tanks before I changed the code.

I'm not that good at xml, but I have observed the behavior and wondering what needs to be changed to fix it.

Would the Case Value = have anything to do with this? I notice it's listed just before each .BMP is specified, and the sequence is 0, 1, 2, 3, 6.

Thanks
 
Last edited:
I looked at the fuel tank selection numbers in the P3Dv4 SDK again. It's the same list I used when I made the change to the code above that resulted in the fuel tanks feeding correctly.

Fuel Tank Selection​

NumberDescription
0Off
1All
2Left
3Right
4Left auxiliary
5Right auxiliary
6Center
7Center2
8Center3
9External1
10External2
11Right tip
12Left tip
13Crossfeed
14Crossfeed left to right
15Crossfeed right to left
16Both
17External
18Isolate
19Left main
20Right main

So if a case value in the ecu.xml above corresponds to the numbers in this list then it makes sense why after I changed the code for the tanks the bmp images stop showing. I'm going to try changing them when I get home from work and report back.
 
Last edited:
Changing the Case Values to the same number as the <Click># fixed the problem. The BMP images show correctly now based on the user selection, and the tanks switch and feed fuel as they should!

I realized the tooltips I added for the engine 1 tanks were the same as engine 2, so I fixed them.
 
As far as I can see, you have three fuel tanks, Aux, Left Main and right main and each engine can take fuel at any time from any of the three. Normally you would probably want to feed both engines from the aux tank first, then switch the left to the left tank and right to right tank. That procedure would keep the center of gravity laterally stationary.

Please note that there is just one auxiliary tank which is common to both engines so the code has it designated as center <Case Value="6"> for Value>(A:Fuel tank selector:1,enum)</Value> Same for the other engine selector
In your aircraft.cfg you need to check what name has been assigned to that tank. Again, see the SDK simulation objects, aircraft configuration files [fuel]. The one aux tank should be called Center1 not left aux or right aux. The fuel selector cases you have in the code do this for each selector left or right separately
0 selector off no fuel flow to that engine.
1 All. fuel will flow to that engine from the center tank first, then from the left and right sides equally.
2 Fuel will flow to that engine from the left main and any other leftXXXX designated tanks equally (Leftmain, leftaux, lefttip)
3 Same as 2 except right not left.
4,5 if you had separate left, right aux tanks you would use these.
19,20 if you really wanted to use left main and right main use these.

The bitmaps would display unless there were errors in their names or in the code according to the case you quote.

Looks like you fixed it anyhow
Roy
 
As far as I can see, you have three fuel tanks, Aux, Left Main and right main and each engine can take fuel at any time from any of the three. Normally you would probably want to feed both engines from the aux tank first, then switch the left to the left tank and right to right tank. That procedure would keep the center of gravity laterally stationary.

Please note that there is just one auxiliary tank which is common to both engines so the code has it designated as center <Case Value="6"> for Value>(A:Fuel tank selector:1,enum)</Value> Same for the other engine selector
In your aircraft.cfg you need to check what name has been assigned to that tank. Again, see the SDK simulation objects, aircraft configuration files [fuel]. The one aux tank should be called Center1 not left aux or right aux. The fuel selector cases you have in the code do this for each selector left or right separately
0 selector off no fuel flow to that engine.
1 All. fuel will flow to that engine from the center tank first, then from the left and right sides equally.
2 Fuel will flow to that engine from the left main and any other leftXXXX designated tanks equally (Leftmain, leftaux, lefttip)
3 Same as 2 except right not left.
4,5 if you had separate left, right aux tanks you would use these.
19,20 if you really wanted to use left main and right main use these.

The bitmaps would display unless there were errors in their names or in the code according to the case you quote.

Looks like you fixed it anyhow
Roy
When the aircraft is started with ctrl + e it I assume it defaults the tank selectors to ALL and feeds fuel from both AUX tanks. The tank selectors once again disappear. I may revisit that issue later to see if I can get it to default to using the left and right mains in accordance with the selector during startup. However, for now I'm satisfied with being able to switch the tanks, fuel feeding properly based on the tank is selected, and the bmp images not disappearing when selecting them manually. I do not use ctrl + e to start the aircraft, but since the vc does not have animated switches, I use the Starter 1 and Starter 2 key bindings. I had to revisit the aircraft.cfg and increase the starter torque until the engines would start, but that was another issue fixed today. I appreciate you taking the time to look over the code and offer suggestions.
 
Back
Top