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

FSX custom variables for shift objects

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
Hello,

I'm trying to code a pfd's maximum speed bar to follow the flap angle. Therefore I took the values from the kneeboard and interpolated between them.

This is an excerpt of the code:
Code:
(L:max current flap pos) 20 >= if{ 230 (L:max current flap pos) 4.5 * - (A:Airspeed select indicated or true, knots) - 10 - }
(L:max current flap pos) 30 >= if{ 185 (L:max current flap pos) 1 * - (A:Airspeed select indicated or true, knots) - 10 - }

before adding the interpolation the bar showed OK despite it jumped step by step.
after adding the interpolation it did not move anymore.

Did I do anything wrong with the custom variable's (L:max current flap pos) format or unit?
It is a copy of the major flap angle (in case left and right are different, e.g. when failed) converted to degrees. It worked well for the condition but not for the output value.

Thanks in advance for any help.

Dave
 
L: vars also require a unit. You can either use "bool" for a value range from 0 to 1 or "number" or "enum".
 
I tried it all, it doesn't work.
For the condition it also works without a unit but for the output value it does not help.
 
Try this:

Code:
(A:TRAILING EDGE FLAPS LEFT ANGLE,degree) (A:TRAILING EDGE FLAPS RIGHT ANGLE,degree) max sp0
l0 30 >=
if{ (A:Airspeed select indicated or true, knots) 185 l0 30 - - - }
els{ (A:Airspeed select indicated or true, knots) 230 l0 20 - 0 max 4.5 * - - }
 
Thanks for the tip. :)
The sp0 / l0 thing made me search the help doc and I found out what it does.
Now I found a way that works for me:

Code:
(A:TRAILING EDGE FLAPS RIGHT ANGLE, degrees) (A:TRAILING EDGE FLAPS LEFT ANGLE, degrees) max sp0
                            (A:LEADING EDGE FLAPS RIGHT ANGLE, degrees) (A:LEADING EDGE FLAPS LEFT ANGLE, degrees) max sp1
                            l0 0 == if{ (A:Airspeed barber pole, knots) 230 (A:Airspeed barber pole, knots) - 0.05 * l1 * + (A:Airspeed select indicated or true, knots) - 10 - }
                            l0 0 > if{ 230 (A:Airspeed select indicated or true, knots) - 10 - }
                            l0 1 > if{ 230 (A:Airspeed select indicated or true, knots) - 10 - }
                            l0 8 > if{ 230 (A:Airspeed select indicated or true, knots) - 10 - }
                            l0 20 > if{ 320 l0 4.5 * - (A:Airspeed select indicated or true, knots) - 10 - }
                            l0 22.222 < (A:GEAR CENTER POSITION, percent) (A:GEAR LEFT POSITION, percent) min (A:GEAR RIGHT POSITION, percent) min 0 > and if{ 220 (A:Airspeed select indicated or true, knots) - 10 - }
                            l0 30 > if{ 215 l0 - (A:Airspeed select indicated or true, knots) - 10 - }

I precalculated some of the constants to save performance.

For this aircraft when moving the flap lever from 0 to 1 only the slats are extended.
I also took the max speed for landing gear extended into account.
Everything is moving smoothly as it should.
 
Back
Top