• 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 Presenting Highest Value SimVar in XML

Messages
19
Country
unitedkingdom
Hi all

Sorry I am feeling so dumb but cannot work out simple code to find highest value of 3 SimVars

I have a really long and cumbersome if code below which doesn't seem to work

<Code>
(A:TURB ENG ITT:1, celsius) > (A:TURB ENG MAX TORQUE PERCENT:1, percentage)
(A:TURB ENG ITT:1, celsius) > (A:TURB ENG N1:1, percent)
and
if{ (A:TURB ENG ITT:1, celsius) }
or if{ (A:TURB ENG MAX TORQUE PERCENT:1, percentage) > (A:TURB ENG ITT:1, celsius)
(A:TURB ENG MAX TORQUE PERCENT:1, percentage) > (A:TURB ENG N1:1, percent)
and
} if{ (A:TURB ENG MAX TORQUE PERCENT:1, percentage) }
els{ (A:TURB ENG N1:1, percent) }
</Code>

Can anybody suggest a nice neat way of using the highest value of 3 SimVars? All values present a value between 0 and 100

thanks in advance!
 
Messages
926
Country
australia
(A:TURB ENG ITT:1, celsius) (A:TURB ENG MAX TORQUE PERCENT:1, percentage) max (A:TURB ENG N1:1, percent) max

The max function will return the highest value of two inputs. So 5 2 max will return 5. You compare the first two simvars to find the max and then compare that result against the third. I think the above code should return the highest value of the 3.

Using max and min is a handy way of limiting the range of a variable.

For example:
(A:TURB ENG ITT:1, celsius) 0 max 100 min

will return values in the range 0 to 100. Anything less than 0 will be 0 (as var 0 max will return 0 if var is less than 0), anything above 100 will be 100.


You also need to learn how to do reverse polish notation.

The correct reverse polish notation format of the first line of your code should be:

(A:TURB ENG ITT:1, celsius) (A:TURB ENG MAX TORQUE PERCENT:1, percentage) &gt; (A:TURB ENG ITT:1, celsius) (A:TURB ENG N1:1, percent) &gt; and

 
Top