• 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 Low engine power gauge?

Messages
10,163
Country
us-arizona
Does anyone have working code for lowering engine power when at low fuel or something similar where fuel could be substituted for something else?

I am doing an electric airplane and would love to have the power drop at points 25% and 10%. I would love to do this in XML... Hoping someone might have a working code that does this?

I recall the P51 air racer in FSX Accelleration did something like this but have no idea how they accomplished it.


Bill
 
When I say power levels, I mean fuel levels. Using fuel as 'electricity'. 10% fuel would be 10% power. Power would then be gutless at that low level.


Bill
 
The simplest way would be limiting throttle input (can be done with standard variables and EventIDs), but you'll need a more complex animation for your VC throttle lever in order to hide the manipulation from the user.
 
Or if you have no mixture lever showing because its electric. You could have the mixture change based on altitude and fuel level. The reason for the altitude code is because the mixture needs to be on manual so the xml coding can control it.
I think Heretic's idea is easier.
I am assuming the fuel is fuel cells and its a solar powered source.
 
Last edited:
Easy in C... but then you really, really didn't want to hear that! :rotfl:As Bjorn says, seperate the animation code from the driver code. The driver code is your electricity. I used to do something similar waybackwhen to simulate super/turbo chargers.
 
The best way to reduce fuel used while maintaining sufficient power to keep it flying is to change the specific fuel consumption. This is in the aircraft.cfg. Outside of having C or something similar like SimIn SDK FDE you cannot change this in flight. If you could and halved the value you would get the same power using half the fuel.
I think this is an example of wanting to change a fundamental parameter in the sim without departing from the normal sim capabilities. Not possible IMHO.

You could also play with Table 154a and make the drag non-existent at low Mach while having normal drag at higher Mach. To do that you would have to make CD0 = 0 in 1101 or 1536.

If you want to just reduce fuel consumption, just close the throttle somewhat, fuel use is essentially linear with power set so you would obviously have insufficient power to continue flying . I suppose you could have a hidden engine up your sleeve which uses ungauged fuel and bring it into play when the throttle is closed.
Roy
 
I tried this in my update section. Worked several times with 'very low' power, then stopped working when I tried to do a 'reset' system for it, (last block of code), for when power was reloaded/refreshed/refueled.


// LOW POWER AT 25 PERCENT FUEL
(A:FUEL TANK LEFT MAIN LEVEL,percent) 25 <
(A:Avionics Master Switch,bool) 1 == and
if{ 1500 (>K:MIXTURE1_SET,bool) }

// LOW POWER AT 10 PERCENT FUEL
(A:FUEL TANK LEFT MAIN LEVEL,percent) 10 <
(A:Avionics Master Switch,bool) 1 == and
if{ 1200 (>K:MIXTURE1_SET,bool) }

// LOW POWER AT 5 PERCENT FUEL
(A:FUEL TANK LEFT MAIN LEVEL,percent) 5 <
(A:Avionics Master Switch,bool) 1 == and
if{ 1000 (>K:MIXTURE1_SET,bool) }

// note below, I commented this out to see if this was causing the corruption of low power functionality. aircraft config engine is set to automixture. low mixture was occuring and lowest mixture point at 5 percent fuel was originally at 1500 mixture lever setting, but now nothing.

<!-- /////////////////////////////////////////////////////////////////////////////////////// OFF
// RESET MIXTURE SYSTEM
(A:GENERAL ENG MIXTURE LEVER POSITION,percent) 20 &lt;
(A:FUEL TANK LEFT MAIN LEVEL,percent) 27 &gt; and
(A:Avionics Master Switch,bool) 1 == and
if{ (>K:MIXTURE_SET_BEST,bool) }
//////////////////////////////////////////////////////////////////////////////////////////// OFF -->
 
No units for EventIDs ==> "(>K:MIXTURE1_SET)"

And you need to provide an engine index for the mixture lever position ==> "GENERAL ENG MIXTURE LEVER POSITION:1"
 
No units for EventIDs ==> "(>K:MIXTURE1_SET)"

And you need to provide an engine index for the mixture lever position ==> "GENERAL ENG MIXTURE LEVER POSITION:1"


This is from the FSX SDK Events Doc;


MIXTURE1_SET Set mixture lever 1 exact value (0 – 16383)
So if I wanted to set it to something like, like 1200, that is written like;
1200 (>K:MIXTURE1_SET,bool)
right?

Thanks for the heads up. No wonder I wasnt getting a reset, lol..
 
This should get you started. You may need to tweak the values. The variable for mixture is 0 to 100 percent. The event is 0 to 16383 scale.
The reason we include the the mixture variable is to prevent flooding. But you can test without this line of code to get your power setting set correctly first. I divided by 2 for the scale and the percent to get all the values then added 1 to the percent so they are slightly higher than the scale for the event.

Code:
// ENABLE AND DISABLE MIXTURE CONTROL
(A:FUEL TANK LEFT MAIN LEVEL,percent) 25 &lt;= if{ 1 (>L:SET_POWER_NODE,Bool) } els{ 0 (>L:SET_POWER_NODE,Bool) }

// LOW POWER AT 25 PERCENT FUEL
(L:SET_POWER_NODE,Bool) 1 ==
(A:FUEL TANK LEFT MAIN LEVEL,percent) 25 &lt; and
(A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) 51 &gt; and
if{ 8191 (>K:MIXTURE1_SET) }

// LOW POWER AT 10 PERCENT FUEL
(L:SET_POWER_NODE,Bool) 1 ==
(A:FUEL TANK LEFT MAIN LEVEL,percent) 10 &lt; and
(A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) 26 &gt; and
if{ 4095 (>K:MIXTURE1_SET) }

// LOW POWER AT 5 PERCENT FUEL
(L:SET_POWER_NODE,Bool) 1 ==
(A:FUEL TANK LEFT MAIN LEVEL,percent) 10 &lt; and
(A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) 13 &gt; and
if{ 2047 (>K:MIXTURE1_SET) }


If you change the mixture units from percent to radians it may use the same scale as the event. This would make things easier.
Code:
// ENABLE AND DISABLE MIXTURE CONTROL
(A:FUEL TANK LEFT MAIN LEVEL,percent) 25 &lt;= if{ 1 (>L:SET_POWER_NODE,Bool) } els{ 0 (>L:SET_POWER_NODE,Bool) }

// LOW POWER AT 25 PERCENT FUEL
(L:SET_POWER_NODE,Bool) 1 ==
(A:FUEL TANK LEFT MAIN LEVEL,percent) 25 &lt; and
(A:GENERAL ENG MIXTURE LEVER POSITION:1,Radians) 8192 &gt; and
if{ 8191 (>K:MIXTURE1_SET) }

// LOW POWER AT 10 PERCENT FUEL
(L:SET_POWER_NODE,Bool) 1 ==
(A:FUEL TANK LEFT MAIN LEVEL,percent) 10 &lt; and
(A:GENERAL ENG MIXTURE LEVER POSITION:1,Radians) 4096 &gt; and
if{ 4095 (>K:MIXTURE1_SET) }

// LOW POWER AT 5 PERCENT FUEL
(L:SET_POWER_NODE,Bool) 1 ==
(A:FUEL TANK LEFT MAIN LEVEL,percent) 10 &lt; and
(A:GENERAL ENG MIXTURE LEVER POSITION:1,Radians) 2048 &gt; and
if{ 2047 (>K:MIXTURE1_SET) }

Now that auto mixture is off and you decide to use the mixture to reduce power altitude will play an effect as well. So i think you may need to write this code 4 more times and then include different altitude ranges. And set the mixture lever values according to that altitude range!
 
Last edited:
Back
Top