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

MSFS20 Airbus Trim Setting

Messages
5
Country
unitedkingdom
Hi all, I am trying to set the trim value of whichever plane you are in via an event in managed Simconnect (C#). Here is the code I am using:

_simConnect?.MapClientEventToSimEvent(Events.SET_ELEVATOR_TRIM, "AXIS_ELEV_TRIM_SET");

_simConnect?.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, Events.SET_ELEVATOR_TRIM, (uint)5000,
Group.ID_PRIORITY_STANDARD, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);

This code is cut for brevity but works fine for every aircraft tried, i.e., the on-screen trim wheel changes correctly according to the new value sent. All except any Airbus plane I have tried. When this code is triggered in an Airbus, the in-cockpit trim wheel moves quickly between the new position and the old and doesn't stay in the new position like it does with other planes.

I did read something about there being an auto-trim on the Airbus’s which may be causing this and I should turn off the FCU1 and FCU2 I think to prevent this trim wheel flickering issue. However, even when I start cold and dark in the same Airbus (so no panels are on) I still see this flickering issue. Also if I assign an analogue trim wheel to the elevator trim axis within msfs controls and I don’t use simconnect at all, all works fine and the trim wheel turns smoothly as expected.

So, the question is… why does the Airbus trim wheel flicker like this when using simconnect when no other planes do and using the same code? Whats the difference? Does the Airbus use a different LVAR or event or something?

Needless to say, I am new to this simconnect business so any help here would be greatly appreciated. What obvious thing am I missing? Could you point me in the right direction. Thanks.
 
I have changed to setting the trim position via a data id rather than event as this seems more precise:

C#:
...
_simConnect.AddToDataDefinition(Definitions.TrimPosition,
                "ELEVATOR TRIM POSITION",
                "radians",
                SIMCONNECT_DATATYPE.FLOAT64,
                0,
                SimConnect.SIMCONNECT_UNUSED);
...
_simConnect.RequestDataOnSimObjectType(DataRequests.Request1,
                Definitions.TrimPosition,
                0,
                SIMCONNECT_SIMOBJECT_TYPE.USER);
...

However, the problem remains.
Why does this code work fine in setting the trim for every plane apart from airbus ones? What am I missing?
 
If it works on every plane except the Airbus, you're going to have to assume that Asobo have done something different for that aircraft. The only way you are going to find that out is to work your way through all the XML trim code relating to the Airbus and compare it to another default aircraft. You say all other aircraft work; what about the B747? That also has an auto-trim.

I don't do MSFS work (not unless I really have to!) but everything you say points to the Airbus being different - or being bugged. Don't rule that out.
 
Thanks. As suggested, I tried the B747 today, and all was fine there. So, I don't think auto-trim is the cause of the problem.
I did some further tests with different aircraft and I now don't think its all Airbus's as the standard A320 was fine.
The standard A310 fails to have its trim position set via the 'elevator trim position' variable as described above however. Even cold-and-dark the A310 has the same issue. Another reason why I don't think auto-trim is the cause as all electrical systems are off.
Other users of my software have reported these problems with the A380X and FBW A32NX.
I also had a look in the behaviours debug window for anything related to trim in the A310 but couldn't see anything useful. I am open to further ideas, though. Cheers.
 
Okay... Cold'n'dark isn't really going to tell you anything. If the aircraft has electric trim tabs then if it has been coded properly, any incoming demands from SimConnect should be overridden/reset by the internal code. Also this:
_simConnect.RequestDataOnSimObjectType(DataRequests.Request1, Definitions.TrimPosition, 0, SIMCONNECT_SIMOBJECT_TYPE.USER);
Trim is dynamic. RequestDataOnSimobjectType is not. Try using RequestDataOnSimObject instead and start a continuous request for the trim tab position once you have got an open SimConnect connection. That should let you track the trim command. I don't do C# 😄 so this is the vb.Net equivalent:
Code:
        p3d_simconnect.AddToDataDefinition(P3Data.DEFINE_CONTROL_SURFACES, "ELEVATOR TRIM POSITION", "radians", SIMCONNECT_DATATYPE.FLOAT64, 0, 720)
(...)
        p3d_simconnect.RequestDataOnSimObject(P3Data.REQUEST_CONTROL_SURFACES, P3Data.DEFINE_CONTROL_SURFACES, SIMCONNECT_SIMOBJECT_TYPE.USER, SIMCONNECT_PERIOD.VISUAL_FRAME, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, 0, 0, 0)
Don't forget you'll need to dump the incoming data into a local array before you can successfully read it because on the next update cycle it won't be there any more. See https://fsdeveloper.com/forum/resources/sd2gau40.291/ specifically the section on SimConnect for one way to handle that. The bad news is it's written in C/C++, but the process should be easily translatable into C#.
 
Many thanks.
Cold'n'dark isn't really going to tell you anything. If the aircraft has electric trim tabs then if it has been coded properly, any incoming demands from SimConnect should be overridden/reset by the internal code.
Okay but if I drag the wheel with my mouse pointer, cold'n'dark or not it moves freely and as expected, which tells me auto-trim is not the problem or doesn't exist, doesn't it? I am wondering if the animation of the trim wheel is the thing that is locked and not the trim position. If I set the trim position via simconnect, the wheel flicks to the new position then immediately jumps back to its original position. In the A310 anyway.

Amazingly useful code there. I think I will have several uses and referrals to it, going forward. Thankyou.

Trim is dynamic. RequestDataOnSimobjectType is not. Try using RequestDataOnSimObject instead and start a continuous request for the trim tab position once you have got an open SimConnect connection.

I don't need to continuously request the trim position. Just thinking about this... for my purposes this might actually be very helpful, to use RequestDataOnSimObject instead I mean.

I ommitted this code before by mistake:

C#:
...
_simConnect.SetDataOnSimObject(Definitions.TrimPosition,
                SimConnect.SIMCONNECT_OBJECT_ID_USER,
                SIMCONNECT_DATA_SET_FLAG.DEFAULT,
                trimPosition);
...

This is the important part, as it actually sets the trim position. Does anything jump out at you here?
 
FWIW the ELEVATOR_TRIM_SET event is what usually works for me. The "AXIS_" version seemed hit/miss, though it's been a while since I tested it. Ditto with setting "ELEVATOR TRIM POSITION" sim var though in most models that seems to work as well. YMMV!

Why are there 3 different ways to set the same control? Seems like a sure path down confusion alley. But that's how it rolls.

The Airbus 3xx (any of them) is always weird because it just auto-trims... which I guess is the point of how it's controlled :) . The trim wheel animation isn't necessarily controlled by the actual trim position. I'm guessing they had to de-couple that somehow since turning that wheel when everything is off doesn't actually do anything (change any settings in the airplane). Or when it's in auto-mode, for that matter (not sure what the physical interaction with the wheel is supposed to be in this case... does it fight you? ignore input? turn back to actual position once you let go?). That's not actually unique to the Airbus since other APs can take control of trim as well and the physical adjusters become essentially decoupled. Various models seem to handle this differently (eg. TBM930).

There's probably some Input Event that can be used to spin the wheel, or an L var or something else custom to each model (since there's no standard event/var for "trim wheel position" as far as I know). Your best bet is probably in the Behaviors window indeed, or more searching. Maybe https://hubhop.mobiflight.com/presets/?search=trim could be a useful reference (for example specifically for the "FenixSim A320" model).

Cheers,
-Max
 
PS. Not to discourage anything, but I think it is extremely difficult, if not impossible, to have "generic" type controls for all aircraft in MSFS (even of the same basic type, eg. fixed wing piston single). There are just too many exceptions and variations, even in the standard (included) models (never mind 3rd party). Standard ways of doing things (Key Events/Sim Vars) are often thrown out the window for custom implementations with L vars, H events, G vars (Input Events), custom Key Events, or what-have-you. Trying to find documentation on these custom implementations is often difficult to say the least (special mention here for FBW A320 project which is very well documented). It's like the Wild West compared to FSX.

My personal approach has been to give the application user the options of which event/simvar/command will be used for a control (with a decent default, ideally). Granted this shifts the onus of discovery somewhat to the user, but OTOH it is more flexible. Depends on the scope of the app, of course, but for me, I don't really see any other practical way of supporting every possible model/implementation that comes along. And fixing something for one model has a high chance of breaking it for another model. 🤷‍♂️
 
FWIW the ELEVATOR_TRIM_SET event is what usually works for me. The "AXIS_" version seemed hit/miss, though it's been a while since I tested it. Ditto with setting "ELEVATOR TRIM POSITION" sim var though in most models that seems to work as well. YMMV!
YMMV, as you say. I've always found the _AXIS events in P3D to be the most reliable.
 
The trim wheel animation isn't necessarily controlled by the actual trim position. I'm guessing they had to de-couple that somehow since turning that wheel when everything is off doesn't actually do anything (change any settings in the airplane).
Aha, that would make sense now.

When dragging the wheel with the mouse, or even if I assign a physical wheel to trim in the controls, the in sim wheel does not fight me or spring back or anything like that. Its only when I try to set the wheel (either with an event or sim var) via simconnect does it fight me.

There's probably some Input Event that can be used to spin the wheel, or an L var or something else custom to each model
Thats the conclusion I came to as well. I couldn't find anything useful in the behaviors window when I had a look before; though I probably missed something. That HubHop link looks to be very useful though. Thanks.

As you say, it could be very difficult to have a generic control mapping for all planes especially if many use their own custom L var. At this point I am happy just to say something like "Trim may not appear to function as expected for planes equipped with auto-trim capabilities". This would be satisfactory I think. Thanks so much for help all.
 
Back
Top