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

MSFS [SOLVED] What Model XML var tells you the pilot has moved their throttle slider?

Messages
244
Country
unitedkingdom
I've had a strange bug appear in my aircraft maybe a couple of sim updates ago:

In just my aircraft (AS33 motor glider), the variable (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) no longer changes when I move my joystick slider set to "THROTTLE AXIS" in Control Settings.

The value of that variable *does* change as expected when I execute e.g. 8888 (>K:THROTTLE1_SET), so my drag of the throttle lever works fine with the var updating and the engine responding as expected.

If I use keypoard control inputs F2 (throttle down) F3 (throttle up) then the (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) goes up and down as expected.

If I load the stock Cessna 152, the same THROTTLE AXIS control works absolutely fine, so it's not my Control Settings or a broken axis.

Any hints or clues?

Am I mistaken assuming that GENERAL ENG THROTTLE LEVER POSITION var is the fundamental thing that the sim updates when you move the THROTTLE AXIS set up in Control Settings?

In case it's a clue, my plane is showing A:GENERAL ENG THROTTLE MANAGED MODE:1 equal to 4, although I've no idea how that variable gets set or what it does.

I've tried copying the Cessna 152 engines.cfg and systems.cfg to my plane, but (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) is still inop on my AS33 when I move the control axis input.
 
Last edited:

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
MANAGED something usually refers to an autopilot function. A:GENERAL ENG THROTTLE MANAGED MODE:1 being 4 is the mode for its role in the autopilot, could be something like Mach hold, I have not found a list of modes that includes a 4. However, being managed its value is not externally settable.
The engine settings are in three groups, GENERAL applies to any engine, JET and RECIP are specific to those types. It does appear that GENERAL ENG THROTTLE LEVER POSITION is the variable that you should be able to set. Try doing it as the first act in that setting page, if you have more than one setting open it does nothing.
Roy
 
Messages
244
Country
unitedkingdom
update:

I've just discovered another Controls Settings Axis input "THROTTLE 1 AXIS" - if I set THIS to the slider on my stick (instead of THROTTLE AXIS) , then (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) changes like a boss in my AS33 and ALSO the Cessna 152 still works.

I guess I'm unclear what the Control Setting "THROTTLE AXIS" axis does and how I'd support that in my single-engine airplane, assuming that's the common setting your average sim pilot would use on a single slider.

Any advice appreciated.
GENERAL ENG THROTTLE LEVER POSITION is the variable that you should be able to set.
thanks - to clarify, I'm able to set the variable in the model XML fine. What's not happening is the variable being set when I move a joystick slider set to "THROTTLE AXIS", although the variable IS updated when I move a joystick slider set to "THROTTLE 1 AXIS".
 
Messages
94
For the SU7 update, it's clear that Asobo changed the way throttle axis works. They also apparently updated their ASOBO_ENGINE_Lever_Throttle_Template so that the THROTTLE AXIS binding still worked as before. So the simple solution to your problem would be to use that template.

But I think the real answer will be to figure out how their template is able to do what it does while code GENERAL ENG THROTTLE LEVER POSITION:1 is not. The clues lie in the Input Events system. https://docs.flightsimulator.com/ht...ls/ModelBehaviors/Input_Event_Definitions.htm

I have been thinking about what are the minimal ingredients to use the ENGINE input events to control throttle. First, we will need the engine_inputs.xml
Code:
<Include ModelBehaviorFile="Asobo\Common\Inputs\Engine_Inputs.xml"/>
This defines the input events and looks to be responsible for binding to the AXIS. This file creates an input preset for ENGINE_Throttle_#THROTTLE_ID#. In our behavior code, we will need to reference that preset like this:
Code:
<UseInputEvent ID="ENGINE">
    <THROTTLE_ID>1</THROTTLE_ID>
</UseInputEvent>
It appears that the throttle position will be returned at
Code:
(B:ENGINE_Throttle:1, Percent)
which we would use instead of
Code:
(A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent)

I haven't tested this in the sim yet, and input events can do much more than this, but I think it's a start to understanding this new system.
 
Messages
94
In engine_inputs.xml, there are bindings for the throttle event IDs. This one in particular may be how it can use the generic THROTTLE AXIS.
Code:
<Binding EventID="AXIS_THROTTLE_SET">

This could mean for us that we can intercept any of the sim events and use the p0 value directly for whatever we want.
 
Messages
244
Country
unitedkingdom
Thanks very much Sal1800.

I can confirm that adding the following to the model XML had the effect of the GEN ENG THROTTLE LEVER POSITION:1 variable updating as before the MFSF update:

Code:
    <Behaviors>
        <Include ModelBehaviorFile="Asobo\Common.xml"/>
        <Include ModelBehaviorFile="Asobo\Generic\FX.xml"/>
        <Include ModelBehaviorFile="Asobo\Common\Inputs\Engine_Inputs.xml"/>

        <!-- *************** -->
        <!--     THROTTLE    -->
        <!-- *************** -->

        <Component ID="AS33_ENGINE">
            <UseInputEvent ID="ENGINE">
                <THROTTLE_ID>1</THROTTLE_ID>
            </UseInputEvent>
        </Component>

        ... THE REST OF THE MODEL XML

In addition the (B:ENGINE_Throttle_1, percent) variable is updated to contain the throttle setting 0..100, although with the original
GEN ENG THROTTLE LEVER POSITION:1 SimVar updating I don't need that (note minor typo in earlier post using "B:ENGINE_Throttle:1").

You can insert your own additional RPN code into the throttle update with the ON_BEFORE_SET parameter:
Code:
        <Component ID="AS33_ENGINE">
            <UseInputEvent ID="ENGINE">
                <THROTTLE_ID>1</THROTTLE_ID>
                <ON_BEFORE_SET> p0 .... ANY RPN CODE CAN USE THIS THROTTLE SETTING VALUE 0..16384  .... </ON_BEFORE_SET>
            </UseInputEvent>
        </Component>

E.g. <ON_BEFORE_SET>p0 (&gt;L:B21_THROTTLE_POSITION)</ON_BEFORE_SET> maintains the L:var L:B21_THROTTLE_POSITION

There are identical ON_BEFORE_DEC and ON_BEFORE_INC parameters also, with the RPN being given the current throttle settings as p0 (0..16364)

There are actually quite a few throttle update events in the template code, and it's not documented which gets called when (e.g. when the user hits F3, moves the joystick axis, etc) but the 'SET' event does get called when the other events (e.g. DEC, INC) get called, so in general just the SET event is needed to monitor the variables (but you would need to trigger the DEC / INC events if you want to change the throttle via those events rather than just SET).

IF you have throttle update code in your model XML (e.g. on your own drag animation) and want to rely on the ON_BEFORE_SET code and the B:ENGINE_Throttle_1 variable, then your throttle updates MUST use
{new pos 0..1} (&gt;B:ENGINE_Throttle_1_SET) rather than {new pos 0..16384} (&gt;K:THROTTLE1_SET) otherwise the B: vars don't get updated.
 
Messages
244
Country
unitedkingdom
Further notes: I think the term "Input Event" is fairly key here- these are not currently sim 'events' you'd SUBSCRIBE to in the normal programming sense. I.e. you'd normally want to subscribe to a "THROTTLE CHANGED" event or a "VIEW CHANGED" event but these don't exist. In code of the style 1 (&gt;THROTTLE_1_INC) then THROTTLE_1_INC is more accurately a procedure you want called than an event. If FSX RPN was able to call functions in a sim API (e.g. sim.throttle_inc() I assume the idea of calling these things 'events' would never have occurred as the 'event' is basically "call the same bit of sim code that would have been called if someone hit the key currently mapped to THROTTLE UP".

I'm not sure how important these "Input Events" are actually going to be - the throttle update was unusual in that the code which updates the GENERAL ENG THROTTLE LEVER POSITION SimVar was broken in the same update, which the more I look at it the more it looks more like an unexpected bug rather than a planned change. I wouldn't think Asobo can go around breaking SimVars in existing aircraft too often, so the main opportunity will be new user input events (VR?) and new templates with new simvars, & TBH it doesn't really matter to me if they're B: vars, O: vars, L: vars, or A: vars.
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
In XML
GENERAL ENG THROTTLE LEVER POSITION:index has a settable value which is the percent of max throttle position for the indexed engine and it is an A: variable.
The value can be set by code, by control adjustment or by the autopilot in which case the throttle is in a managed mode and the usual control has no function.
There are a slew of events associated with the throttles which allow you do do things that include setting the throttle axis to a value which is between minus 16383 and plus 16383. It also allows something like Throttle_60 which has no index and sets the throttles to 60 percent.
Unfortunately the control setting part of the program does not necessarily use the same terms for these variables nor events.
Roy
 
Messages
244
Country
unitedkingdom
In a nutshell the SDK docs are two updates out of date. The new throttle support is as defined in Asobo\Common\Inputs\Engine_Inputs.xml
by control adjustment
this bit broke two updates ago. Moving the THROTTLE AXIS control no longer directly updates the GENERAL ENG THROTTLE LEVER POSITION:index. Instead it generates a new MSFS 'Input Event' which can be handled by new XML template code, which is generally intended to update new "B:" variables containing the throttle position. However you can write XML RPN which handles the new "Input Event" and *writes* the GENERAL ENG THROTTLE LEVER POSITION:index variable which partially recovers the prior situation. Asobo provide (unannounced and undocumented) template code in Asobo\Common\Inputs\Engine_Inputs.xml that does this, with which they updated their aircraft within the same update.
that include setting the throttle axis
*If* you use the Asobo template code for the throttle (which is kind-of necessary, or you have to replicate the event handling within it, otherwise your THROTTLE AXIS control won't work), *and* you actually use the "B:" variable to get the throttle position, then writing directly to the GENERAL ENG THROTTLE LEVER POSITION:index variable does NOT update the B: variable, so there's a little bit of a catch-22 here.
 
Top