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

FSXA Fuel Tank Selectors...

Messages
9
Country
unitedstates
Guys,
I'm hoping someone can help me out with this bit of code. Fisrt of all, the aircraft I'm working on is the F82E Twin Mustang that had a unique fuel tank set up, basicly a pump for each tank (2 per engine) and a fuel valve for each engine that were all controlled by electric switches. The current code that I have now allows each tank to be activated seperately and works great, but the problem is when I select both tanks for engine 1 FSX defaults to FUEL_SELECTOR_LEFT (using Doug Dawson's event logger). What I need to happen is when both switches are activated is FSX to show FUEL_SELECTOR_ALL for each engine since this was the way that the aircraft was set up.

Here is my code...

Code:
<!-- Fuel Tank Logic -->
       <PartInfo>
        <Name>F82_Fuel_Initializer</Name>
        <Visibility>
         <Parameter>
          <Code>
            (L:F82_init, bool) 0 ==
            if{ 
                0 (>K:FUEL_SELECTOR_SET) 0 (>K:FUEL_SELECTOR_2_SET) AND
                1 (>L:F82_INIT, BOOL)
              }
            <!-- Engine 1 Fuel tank selectors -->
            (L:LeftOutbd, number) 0 ==
            (L:LeftInbd, number) 0 ==
            and if{ (>K:FUEL_SELECTOR_OFF) }

            (L:LeftOutbd, number) 1 ==
            (L:LeftInbd, number) 0 ==
            and if{ (>K:FUEL_SELECTOR_LEFT) }

            (L:LeftOutbd, number) 0 ==
            (L:LeftInbd, number) 1 ==
            and if{ (>K:FUEL_SELECTOR_LEFT_AUX) }

            (L:LeftOutbd, number) 1 ==
            (L:LeftInbd, number) 1 ==
            and if{ (>K:FUEL_SELECTOR_ALL) }

            <!-- Engine 2 Fuel tank selectors -->
            (L:RightOutbd, number) 0 ==
            (L:RightInbd, number) 0 ==
            and if{ (>K:FUEL_SELECTOR_2_OFF) }

            (L:RightOutbd, number) 1 ==
            (L:Rightnbd, number) 0 ==
            and if{ (>K:FUEL_SELECTOR_2_RIGHT) }

            (L:RightOutbd, number) 0 ==
            (L:RightInbd, number) 1 ==
            and if{ (>K:FUEL_SELECTOR_2_RIGHT_AUX) }

            (L:RightOutbd, number) 1 ==
            (L:RightInbd, number) 1 ==
            and if{ (>K:FUEL_SELECTOR_2_ALL) }    
          </Code>
         </Parameter>
        </Visibility>
       </PartInfo>
I have this tagged as a visibility part only for preloading with no animantion or mouse rect attached. Using gmax with FSXA. Any suggestions? This has me stumped!

Thanks,
Mark
 
You actually cannot connect tanks designated for the right engine to the left engine...

The only option there is a cross-feed. "ALL" simply means "all tanks assigned to the X engine."
 
Last edited:
Thanks for the reply Fr. Bill!
I'm not trying to connect the left tanks to the right engine, etc... what I meant to say is ALL tanks on the left side (L:LeftOutbd) and (L:LeftInbd) be toggled at the same time. My thinking was this means all tanks for the specific engine (>K:FUEL_SELECTOR_ALL) or in the case of the right hand engine (>K:FUEL_SELECTOR_2_ALL) using (L:RightOutbd) and (L:RightInbd). There is also the possibility of (>K:FUEL_SELECTOR_BOTH). Would that toggle fuel flow from both tanks to engine1 at the same time?
Looking through the SDK I also see RECIP ENG FUEL NUMBER TANKS USED:index. Would this indicate 2 tanks per engine and how/where would this be activated? Something like (A:RECIP ENG FUEL NUMBER TANKS USED:1) 2?

Thanks again,
Mark
 
Like this!

Code:
(A:RECIP ENG FUEL NUMBER TANKS USED:1[COLOR="Red"], number[/COLOR]) 2

Aircraft Engine Data:
In the multiplayer Shared Cockpit mode the only supported index is 1, which means that the data is assumed to be identical for all engines. In single player mode engine indexes are from 1 to 4.

You say your issue only happens when the left fuel selector is set to all. But if you set the right to all it works fine? Strange!

DG:eek:
 
Last edited:
Oh, I see. My bad for not reading closely enough... :o


I don't see anything wrong with your script syntax, nor with the logic.

You might try using the _SET event to see if it makes any difference at all:
Code:
            (L:LeftOutbd, number) 1 ==
            (L:LeftInbd, number) 1 ==
            and if{ 1 (>K:FUEL_SELECTOR_SET) }
 
Like this!


Code:
(A:RECIP ENG FUEL NUMBER TANKS USED:1, number) 2Aircraft Engine Data:
In the multiplayer Shared Cockpit mode the only supported index is 1, which means that the data is assumed to be identical for all engines. In single player mode engine indexes are from 1 to 4.

You say your issue only happens when the left fuel selector is set to all. But if you set the right to all it works fine? Strange!

DG
Hi DG! Haven't got it working for the right hand engine yet, but thanks for clarifiing that bit about the shared cockpit :) I figure once I get things set up correctly for the left hand engine I could just swap over to the right... :rolleyes:

Oh, I see. My bad for not reading closely enough...


I don't see anything wrong with your script syntax, nor with the logic.

You might try using the _SET event to see if it makes any difference at all:

Code:
(L:LeftOutbd, number) 1 ==
(L:LeftInbd, number) 1 ==
and if{ 1 (>K:FUEL_SELECTOR_SET) }
Bill... thanks, will give that one a try and see what happens

Mark
 
Bill,
Finally solved my tank selector issue. What I ended up doing was making a gauge with the following code and putting it in the VC...

Code:
<Gauge Name="fuel" Version="1.0">
<Element>
  <Position X="0" Y="0"/>
  <Select>
    <Value>
     <!-- Flip fuel pumps ON if Engines are Running when aircraft is loaded  -->
      (L:FirstLoad,bool) !
      if{
        1 (>K:FUEL_SELECTOR_SET)
      if{ 
        1 (>L:LeftOutbd, bool)
        1 (>L:LeftInbd, bool)
      }
        1 (>K:FUEL_SELECTOR_2_SET)
      if{ 
        1 (>L:RightOutbd, bool)
        1 (>L:RightInbd, bool)
      }
      1 (>L:FirstLoad,bool)
      }
    </Value>
  </Select>
</Element>

<Update Frequency="12">
  <!-- Set fuel pumps according to the switches for the left engine -->
    (L:LeftOutbd, bool) ! (L:LeftInbd, bool) !  and   if{ 0 (>K:FUEL_SELECTOR_SET) }
    (L:LeftOutbd, bool)   (L:LeftInbd, bool) !  and   if{ 2 (>K:FUEL_SELECTOR_SET) }
    (L:LeftOutbd, bool) ! (L:LeftInbd, bool)    and   if{ 4 (>K:FUEL_SELECTOR_SET) }
    (L:LeftOutbd, enum) 1 ==
    (L:LeftInbd, enum) 1 ==  and
    if{ 16 (>K:FUEL_SELECTOR_SET) } 

  <!-- Set fuel pumps according to the switches for the right engine -->
    (L:RightOutbd, bool) ! (L:RightInbd, bool)    and   if{ 5 (>K:FUEL_SELECTOR_2_SET) }
    (L:RightOutbd, bool)   (L:RightInbd, bool) !  and   if{ 3 (>K:FUEL_SELECTOR_2_SET) }
    (L:RightOutbd, bool) ! (L:RightInbd, bool) !  and   if{ 0 (>K:FUEL_SELECTOR_2_SET) }
    (L:RightOutbd, enum) 1 ==
    (L:RightInbd, enum) 1 == and
    if{ 16 (>K:FUEL_SELECTOR_2_SET) }
</Update>
</Gauge>

It selects each tank individually and will also show both tanks selected. Question, can the <Update> routine be used in 3D parts or gauges only? I would prefer to have this coded as 3D instead of a seperate gauge.

The struggle continues!

Thanks,
Mark


EDIT:
I spoke too soon... The switches will work correctly but when I check the event logger it defaults to FUEL_SELECTOR_LEFT no matter what the switch positions are...
 
Last edited:
Mark, placing this into the .mdl file is simple...

Create a single, tiny polygon at 0,0,0, then assign a "Visibility" condition to it.

In your modeldef.xml (or makeMDL.parts.xml) file, create an entry like this and add your script:

Code:
   <PartInfo>
    <Name>LogicScript</Name>
    <Visibility>
      <Parameter>
        <Code>
          <!-- INITIALIZATION ROUTINE -->

          <!-- 1 SECOND UPDATE -->
          (P:Absolute time,seconds) 1 % 1 > !
          if{

            }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 
Thanks Bill! That did the trick. Your help is much appreciated.

Mark

No problem, Mark. To keep my sanity, I will typically "script" the logic in an XML gauge <Update> section first, then only after it has been throughly tested and debugged will I move the completed script to the compiled model's "logic polygon."

This keeps me from having to compile/test/compile/test constantly... :rotfl:
 
Back
Top