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

Custom fuel selectors

euroastar350

Resource contributor
Messages
826
Country
us-delaware
Hi guys,

I'm in the process of coding my FSX Trislander and I'm getting to the fuel selectors next. The real airplane has 3 selectors which has 2 functions, as tank selectors and cross feed functions. Quoted from a real world pilot that is helping me with the project:

OK this is purely from memory. The 3 rotary selector levers in the cockpit roof are all arrow shaped, the tip of the arrow pointing in the direction of the selection made. Left selector is coloured red, rear engine selector coloured yellow, right selector is green. The left and right selectors have 3 positions - left can be selected to LEFT TANK, X-FEED, OFF. the right selector can be selected to RIGHT TANK, X-FEED, OFF. the rear eng selector can be selected to LEFT TANK, BOTH, RIGHT TANK, OFF. The normal selections in flight are left to LEFT TANK, rear to BOTH, right to RIGHT TANK. X-FEED means crossfeed and is used on the left and right selectors to allow the left engine to feed from the right tank, or the right engine to feed from the left tank. The rear selector is usually at BOTH, but can be selected to feed from either the LEFT or RIGHT tank. All 3 selectors are turned to OFF when parked on the ground. The reason for X-FEED on the wing engines or LEFT/RIGHT on the rear engine is to balance up the quantity in the main tanks should it be necessary, or to feed all 3 engines from only one main tank if there is a blockage or similar problem in the system. The tip tanks ONLY feed fuel into the main tanks, once there is room in them for the transfer to take place. None of the engines can be fed directly from the tip tanks, as can be done on the Islander.

Forgot to say... looking up at the roof panel from the pilot's seat, all three selector arrows point forward in normal flight. When all are selected to OFF on the ground, the left and right selectors point outwards towards the wingtips, the rear selector points rearwards towards the tail. Using X-FEED, the left engine selector arrow would point to the right wing, the right engine selector to the left wing. The rear engine selector would point towards the left or right wing, if not feeding from BOTH in flight. This is a rough sketch of what you would see in flight when looking UPWARDS towards the roof panel - that's why left and right are reversed.

I have the selectors animated, but don't have a working code as of yet. What would be the best way to approach this? Much of systems are written into an external logic gauge, but an internal script would work just as well. Any help is appreciated

Trislander_fuel.jpg
 

Heretic

Resource contributor
Messages
6,830
Country
germany
First, the Aircraft.cfg should reflect the number of available fuel selectors (number_of_tank_selectors=3).

Second, the selector logic is a simple comparison of the animation code with the current state of the associated FSX-internal fuel selector and a subsequent, appropriate action.

In less teutonic language (and assuming 0 = off, 1 = right/left, 2 = xfeed/both, 3 = left):
Code:
(L:Fuel Selector 1, number) 0 == (A:FUEL TANK SELECTOR:1,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 1 == (A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 2 == (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }

(L:Fuel Selector 2, number) 0 == (A:FUEL TANK SELECTOR:2,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 1 == (A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 2 == (A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_2_SET) }

(L:Fuel Selector 3, number) 0 == (A:FUEL TANK SELECTOR:3,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 1 == (A:FUEL TANK SELECTOR:3,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 2 == (A:FUEL TANK SELECTOR:3,enum) 16 != if{ 16 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 3 == (A:FUEL TANK SELECTOR:3,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_3_SET) }
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
First, the Aircraft.cfg should reflect the number of available fuel selectors (number_of_tank_selectors=3).

Second, the selector logic is a simple comparison of the animation code with the current state of the associated FSX-internal fuel selector and a subsequent, appropriate action.

In less teutonic language (and assuming 0 = off, 1 = right/left, 2 = xfeed/both, 3 = left):
Code:
(L:Fuel Selector 1, number) 0 == (A:FUEL TANK SELECTOR:1,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 1 == (A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 2 == (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }

(L:Fuel Selector 2, number) 0 == (A:FUEL TANK SELECTOR:2,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 1 == (A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 2 == (A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_2_SET) }

(L:Fuel Selector 3, number) 0 == (A:FUEL TANK SELECTOR:3,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 1 == (A:FUEL TANK SELECTOR:3,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 2 == (A:FUEL TANK SELECTOR:3,enum) 16 != if{ 16 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 3 == (A:FUEL TANK SELECTOR:3,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_3_SET) }


Hmmm, tried the above code which I added to my logic gauge and no dice. All engines can be started, even if the selectors are in the off position. Not sure if that's the way they are supposed to work, also updated my aircraft cfg to reflect 3 selectors. Am I missing something?
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Yep, it won't work as I've posted it because I'm dumb. Since it's a glaringly obvious error, I leave you to figure it out before I'll correct it. ;)
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
I've tried the combination of the following "K" events with no luck. I'm completely dumbfounded as I've never had to write a fuel system for an aircraft since I've only used default variables in all my models :p

Code:
FUEL_SELECTOR_2_ALL
FUEL_SELECTOR_2_OFF
FUEL_SELECTOR_2_RIGHT


FUEL_SELECTOR_3_ALL
FUEL_SELECTOR_3_LEFT
FUEL_SELECTOR_3_OFF
FUEL_SELECTOR_3_RIGHT


FUEL_SELECTOR_ALL
FUEL_SELECTOR_LEFT
FUEL_SELECTOR_OFF
 

Heretic

Resource contributor
Messages
6,830
Country
germany
The bug isn't in the key events, but in the condition to trigger them. Keep looking...
 
Messages
1,451
Country
mexico
Hi lads

Perhaps is where the error resides; use "number" instead. Björn helped me with this in the 429 garmin suite:

HTML:
(L:Fuel Selector 1, number) 0 == (A:FUEL TANK SELECTOR:1,number) 0 != if{ 0 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 1 == (A:FUEL TANK SELECTOR:1,number) 3 != if{ 3 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 2 == (A:FUEL TANK SELECTOR:1,number) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }

(L:Fuel Selector 2, number) 0 == (A:FUEL TANK SELECTOR:2,number) 0 != if{ 0 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 1 == (A:FUEL TANK SELECTOR:2,number) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 2 == (A:FUEL TANK SELECTOR:2,number) 3 != if{ 3 (>K:FUEL_SELECTOR_2_SET) }

(L:Fuel Selector 3, number) 0 == (A:FUEL TANK SELECTOR:3,number) 0 != if{ 0 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 1 == (A:FUEL TANK SELECTOR:3,number) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 2 == (A:FUEL TANK SELECTOR:3,number) 16 != if{ 16 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 3 == (A:FUEL TANK SELECTOR:3,number) 2 != if{ 2 (>K:FUEL_SELECTOR_3_SET) }
 
Last edited:

euroastar350

Resource contributor
Messages
826
Country
us-delaware
Investigating the DC3 Enhanced gauges, I see the fuel tank levels have to do their part for the selectors to work. The engines run off of the main wings tanks and only get filled from the tip tanks which has no part of the selectors at all. Am I close?
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Come on, guys. You're very close to totally disappoint me.

You've got two conditions that need to be logically connected to trigger a command. But with the buggy code above, only one condition will trigger a command. Why?
 
Messages
913
Country
indonesia
First, the Aircraft.cfg should reflect the number of available fuel selectors (number_of_tank_selectors=3).

Second, the selector logic is a simple comparison of the animation code with the current state of the associated FSX-internal fuel selector and a subsequent, appropriate action.

In less teutonic language (and assuming 0 = off, 1 = right/left, 2 = xfeed/both, 3 = left):
Code:
(L:Fuel Selector 1, number) 0 == (A:FUEL TANK SELECTOR:1,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 1 == (A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_SET) }
(L:Fuel Selector 1, number) 2 == (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }

(L:Fuel Selector 2, number) 0 == (A:FUEL TANK SELECTOR:2,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 1 == (A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) }
(L:Fuel Selector 2, number) 2 == (A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_2_SET) }

(L:Fuel Selector 3, number) 0 == (A:FUEL TANK SELECTOR:3,enum) 0 != if{ 0 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 1 == (A:FUEL TANK SELECTOR:3,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 2 == (A:FUEL TANK SELECTOR:3,enum) 16 != if{ 16 (>K:FUEL_SELECTOR_3_SET) }
(L:Fuel Selector 3, number) 3 == (A:FUEL TANK SELECTOR:3,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_3_SET) }

I'm poor in XML, code above is have 1 condition, 1 checker condition and a command. I do this on Osprey fuel transfer automation in C++ language with few more condition
 
Messages
913
Country
indonesia
......... if{ 16 (>K:FUEL_SELECTOR_3_SET) }..........
the number "16" is fuel tank variable which fuel tank would be use, please read SDK section variable -> Fuel Tank Selection, for more info
 
Last edited:

Heretic

Resource contributor
Messages
6,830
Country
germany
There is an "and" missing in every line, which is required to evaluate both the L: var and the A: var condition and not just the A: var one. :rolleyes:


I'm especially disappointed in George, who isn't new to the entire XML thing by any means.
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
I had the "and" added which had no affect, I will try again. In the meantime, this is what I came up with:

Code:
(L:BN2A_fuel_selector_01, number) 0 == (A:FUEL TANK SELECTOR:1,enum) 0 != and if{ 0 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_01, number) 1 == (A:FUEL TANK SELECTOR:1,enum) 2 != and if{ 2 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_01, number) 2 == (A:FUEL TANK SELECTOR:1,enum) 14 != and if{ 14 (>K:FUEL_SELECTOR_SET) }

            (L:BN2A_fuel_selector_02, number) 0 == (A:FUEL TANK SELECTOR:2,enum) 0 != and if{ 0 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_02, number) 1 == (A:FUEL TANK SELECTOR:2,enum) 3 != and if{ 3 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_02, number) 2 == (A:FUEL TANK SELECTOR:2,enum) 14 != and if{ 14 (>K:FUEL_SELECTOR_SET) }

            (L:BN2A_fuel_selector_03, number) 0 == (A:FUEL TANK SELECTOR:3,enum) 0 != and if{ 0 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_03, number) 1 == (A:FUEL TANK SELECTOR:3,enum) 3 != and if{ 3 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_03, number) 2 == (A:FUEL TANK SELECTOR:3,enum) 16 != and if{ 16 (>K:FUEL_SELECTOR_SET) }
            (L:BN2A_fuel_selector_03, number) 3 == (A:FUEL TANK SELECTOR:3,enum) 2 != and if{ 2 (>K:FUEL_SELECTOR_SET) }

            (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK SELECTOR:1, enum) 0 != and if{ 0 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 0 > and (A:FUEL TANK SELECTOR:1, enum) 2 != and if{ 2 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 > (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 < and (A:FUEL TANK SELECTOR:1, enum) 14 != and if{ 14 (>K:FUEL_SELECTOR_SET) } }     
 
            (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK SELECTOR:2, enum) 0 != and if{ 0 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 0 > and (A:FUEL TANK SELECTOR:2, enum) 3 != and if{ 3 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 > (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 < and (A:FUEL TANK SELECTOR:2, enum) 14 != and if{ 14 (>K:FUEL_SELECTOR_SET) } }

            (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK SELECTOR:3, enum) 0 != and if{ 0 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 0 > and (A:FUEL TANK SELECTOR:3, enum) 2 != and if{ 2 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 < (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 0 > and (A:FUEL TANK SELECTOR:3, enum) 3 != and if{ 3 (>K:FUEL_SELECTOR_SET) }
            (A:FUEL TANK RIGHT MAIN CAPACITY, gallons) 1 > (A:FUEL TANK LEFT MAIN CAPACITY, gallons) 1 < and (A:FUEL TANK SELECTOR:3, enum) 16 != and if{ 16 (>K:FUEL_SELECTOR_SET) } }

This can be entirely incorrect as I tried to replicate OFF-LEFT-XFEED (E1), OFF-RIGHT-XFEED (E2) and OFF-LEFT-BOTH-RIGHT (E3).
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
First of all, you are using K:FUEL_SELECTOR_SET event in all of your assignments. Change that with K:FUEL_SELECTOR_2_SET and K:FUEL_SELECTOR_3_SET when appropriate.

Second, fuel tank quantity and capacity values should not automatically affect the position of a fuel selector (unless you are coding a custom fuel system)

Third, scripts less verbosed are easier to maintain and debug, for example:

Code:
   (L:BN2A_fuel_selector_01, number) 0 == (A:FUEL TANK SELECTOR:1,enum) 0 != and if{ 0 }
   (L:BN2A_fuel_selector_01, number) 1 == (A:FUEL TANK SELECTOR:1,enum) 2 != and if{ 2 }
   (L:BN2A_fuel_selector_01, number) 2 == (A:FUEL TANK SELECTOR:1,enum) 14 != and if{ 14 }
   (>K:FUEL_SELECTOR_SET)

Even I would use registers with repetitive var names, but it's something not everyone find comfortable.

Tom
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
Ok so I managed to get the code to work somewhat, but the No.3 engine will not start, no matter which position the third selector is placed in. Here is the modified code I'm using:

Code:
<Element>
      <Select>
         <Value>
            (L:BN2A_fuel_selector_01, number) 0 == (A:FUEL TANK SELECTOR:1,enum) 0 != and if{ 0 }
            (L:BN2A_fuel_selector_01, number) 1 == (A:FUEL TANK SELECTOR:1,enum) 2 != and if{ 2 }
            (L:BN2A_fuel_selector_01, number) 2 == (A:FUEL TANK SELECTOR:1,enum) 14 != and if{ 14 }
            (>K:FUEL_SELECTOR_SET)

            (L:BN2A_fuel_selector_02, number) 0 == (A:FUEL TANK SELECTOR:2,enum) 0 != and if{ 0 }
            (L:BN2A_fuel_selector_02, number) 1 == (A:FUEL TANK SELECTOR:2,enum) 3 != and if{ 3 }
            (L:BN2A_fuel_selector_02, number) 2 == (A:FUEL TANK SELECTOR:2,enum) 14 != and if{ 14 }
            (>K:FUEL_SELECTOR_2_SET)

            (L:BN2A_fuel_selector_03, number) 0 == (A:FUEL TANK SELECTOR:3,enum) 0 != and if{ 0 }
            (L:BN2A_fuel_selector_03, number) 1 == (A:FUEL TANK SELECTOR:3,enum) 2 != and if{ 2 }
            (L:BN2A_fuel_selector_03, number) 2 == (A:FUEL TANK SELECTOR:3,enum) 16 != and if{ 16 }
            (L:BN2A_fuel_selector_03, number) 3 == (A:FUEL TANK SELECTOR:3,enum) 3 != and if{ 3 }
            (>K:FUEL_SELECTOR_3_SET)
         </Value>
      </Select>
   </Element>

Of course none of the engines will start up when the selectors are placed in crossfeed. Any ideas on what's causing the third engine not to start?
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
First, if you are going to use 14 on one wing, you probably need to use 15 on the other. From the SDK:

14 Crossfeed left to right
15 Crossfeed right to left

but the only crossfeed I could get to work reliably was 13. I don't know how to use 14, 15, and 16.
 
Top