• 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 Where is the code for "aircraft logic"?

Messages
435
Country
france
I don't know if this post should be here or in the "aircraft design" section.
My question is about the aircraft "logic", to know where it is located. What I mean here is the code that is executed to manage some aircraft system that is not related to any display. I am especially interested in the A320 Neo. I saw all the gauges that have a display are coded in JavaScript, all the code is available in "asobo-vcockpit-instruments-..." folders, even the rudder trim is defined there because it has an LCD display. That is fine.
But I can't find the code that manages the systems, for example:
  • Flaps: in configuration 1+F, when you reach the max speed of 215 kts, they automatically retract to config 1
  • Autothrust: when you take-off, engine thrust is reduced when you reach the altitude of 1500 ft
  • Fly by wire: the flight envelope protection and auto-trim automatically act of the flight controls.
All these systems are good and realistic but I think they need some tweaking. This is why I would like to find where they are defined.
I could find any JavaScript code for this, I couldn't find any WASM either and I don't think this is modeled in the behaviors, but I may be wrong.
Is it hard-coded in the sim itself? Is it protected in .spb files? Is it accessible for us?

Any information is welcome.

Thanks,
Eric
 
Messages
8
Country
us-massachusetts
Are you referring to tweaking the default A320neo or our A32NX? Our developers are actively working on custom autothrust, fly-by-wire, and autopilot systems, and have already made a lot of progress. These are coded in WASM (C++), partially auto-generated from Matlab models. Flap behavior is defined in flight_model.cfg.

 
Messages
435
Country
france
Thanks for your answer.
My question was about the tweaking the default A320 Neo.
I know the excellent work you are doing on the A32NX, my goal is to know if the default A320 Neo fly by wire and other systems can be tweaked and if it can be reused for another Airbus aircraft.
You confirm what I thought, the fly by wire system and others are defined in C++, but even if the source code is not available, I couldn't find where these WASM files are located. Are they accessible somewhere or are they included in the sim code itself?

[EDIT] Forget my question, I understand your team is working on custom systems developed in C++/WASM but Microsoft/Asobo didn't do this so I cannot find any WASM file for the default A320 Neo.
 
Last edited:
Messages
435
Country
france
I have just downloaded 2 freeware planes: the A330 by Project Mega Pack that has its own virtual cockpit and an A380 that uses the A320 Neo VC.
The A330 has a fly by wire system, which is the A320 system, and the A380 doesn't. So does the sim know when to make the fly by wire active or not? I tried to see if it is defined in one of the cfg files but couldn't find out...
Any idea?
 
Messages
435
Country
france
Yes, I have just seen this, it should do the trick. I will test this and let you know.

[EDIT] I confirm, it works, this line in the model.cfg file determines if fly by wire is used or not with the aircraft.
Thank you Prepar3DGuy, and thank you Romain if you read this, you both had the right information :)
 
Last edited:
Messages
145
Country
unitedkingdom
Hey Eric, do you mean you've found the Asobo A320 code that does 'if airspeed hits this number, auto-move the flaps into this setting" ? FWIW I searched the A320 & asobo-vcockpit-* packages and couldn't find it, so if I was to guess Imaybe be it's buried in the modelbehaviours XML template hierarchy (or does the config "fly-by-wire" setting enable a generic built-in extension to the MSFS flight control of any aircraft?). I presume the code has to be custom for the A320, so even if there's a generalised implementation (in an XML template? JS include?) there would need to be the custom call from the A320. I'm interested to know the answer just to add clarity to what Asobo thinks is the way to do things...
 
Messages
435
Country
france
No, I didn't find any code 😕
I can understand the FBW code that provides flight envelope protection is embedded in the sim itself. It is activated if the fly_by_wire parameter is set to 1 in the flight_model.cfg file. It was already like this in FSX, I had forgotten this when I posted my question...

But I have no answer about the flaps logic. Where is the code that retracts the flaps from 1+F to 1 when the max airspeed is reached? This is Airbus-specific so it should be defined in an A320 file, but I couldn't find it, not even in the model files.
If it embedded in the sim like the FBW system, then there should be a parameter that makes it active or not. Some more time is needed for additional testing to determine how this is done.

I'm sorry I can't help more here...
 
Messages
87
Country
russia
Where is the code that retracts the flaps from 1+F to 1 when the max airspeed is reached?
What I have found for now is the indication on ECAM that was coded in JS (blablabla...\Packages\Official\OneStore\asobo-vcockpits-instruments-a320-neo\html_ui\Pages\VCockpit\Instruments\Airliners\A320_Neo\EICAS\ECAM\A320_Neo_UpperECAM.js) see for lines 684-694 and is based on "TRAILING EDGE FLAPS LEFT INDEX" simulation variable. That is just change "1+F" to "1".
  • Flaps: in configuration 1+F, when you reach the max speed of 215 kts, they automatically retract to config 1
My deduction that it controlled by flight_model.cfg. Look at the [FLAPS.0] section. By the way flaps-position-autoretract.1 and flaps-position-inhibit.1 are not documented yet.
Rich (BB code):
flaps-position.0 = 0, -1, 0
flaps-position.1 = 10, 215, 0.25
flaps-position-autoretract.1 = 0, 210, 230
flaps-position-inhibit.1 = air,increasing
flaps-position.2 = 15, 200, 0.5
 
Messages
435
Country
france
I agree with you, I also found the way the flaps positions are defined in the JS code, with 2 possibles positions (1 and 1+F) for a single handle position (1). But this does not explain the automatic retraction of flaps.
Nevertheless, the second part of your post perfectly answers my question, the flight_model.cfg file is certainly where the automatic retraction is defined, as you describe it. I missed it because i was focused on the flaps level definition in cockpit.cfg

[FLAPS_LEVELS]
slats_level_1 = 0
flaps_level_1 = 0
slats_level_2 = 18
flaps_level_2 = 10
slats_level_3 = 22
flaps_level_3 = 15
slats_level_4 = 22
flaps_level_4 = 20
slats_level_5 = 27
flaps_level_5 = 35
It has absolutely no interest here and I even think it is redundant with the other flap definition in flight_model.cfg. Asobo didn't make our life easy :)

Anyway, I thank you for this information, very useful.
 
Messages
852
Country
indonesia
I still at C program, still use FSX C++ SimConnect, modified procedure as MSFS schema.
just doesn't use GDI+ anymore, it way heavy to run in MSFS (killed fps). however that GDI+ run smooth and light in FSX. redone all glass display from scratch in nanoVG
will consider JS for later, it will for display purpose only
 
Messages
8
Country
us-massachusetts
All of the default fly-by-wire and default autopilot code, as well as flaps logic, is handled internally by the base simulator code (which cannot be modified). You can only enable/disable these, and tweak them via limited CFG options. Which is why, if you're developing anything above a very basic level, it's well worth the investment to code completely custom systems which override/replace the default ones.
 
Messages
435
Country
france
You're right, this is the conclusion I came to as well. Nevertheless I regret this because some systems are good but not perfect, and tweaking them would be easier that redevelop them all.
Now we know what we have to do as developers :)
 
Top