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

P3D v5 Help With XML Gauge "If no recent increase in X, don't do Y"

Messages
16
Country
unitedstates
Hello, I've been pretty successful the last few weeks with XML gauges. I just can't seem to wrap my head around a certain concept:

I'm making a gauge that creates a sound when N2 is increased, only between 53% N2 to 60% N2. The gauge works great so far, one thing: I'd like the sound not to play if N2 hasn't increased in say.. 1 second. For now, if thrust is increased and abruptly pauses, the sound stays. Any ideas? All the weird math I have is me being an amateur and using throttle position as an N2 comparison, but of course this won't always work with different weather conditions, etc. The N2 value is of course changing constantly so I'm looking for a better way to do this.

Thanks in advance


<!-- Howl start sound -->
(A:TURB ENG CORRECTED N2:2,percent) 60 >
if{ 1 (>L:HOWL_VAR2,number) }

(A:TURB ENG CORRECTED N2:2,percent) 54 &lt;
if{ 0 (>L:HOWL_VAR2,number) }

(A:GENERAL ENG COMBUSTION:2,bool)
(L:HOWL_VAR2,number) 0 == and
(L:ENG2_HOWL_STATE,number) 0 == and
(A:TURB ENG CORRECTED N2:2,percent) 53 > and
(A:GENERAL ENG THROTTLE LEVER POSITION:2,percent over 100) 45 * 52 + (A:TURB ENG CORRECTED N2:2,percent) > and
(A:GENERAL ENG THROTTLE LEVER POSITION:2,percent over 100) 0.04 >= and
if{ 1 (>L:EXT_ENG2_HOWL_START,number) 1 (>L:ENG2_HOWL_STATE,number) 1 (>L:HOWL2 Timer Running,number) }

This timer is just to help the transition between "START" and "RUN"
.....................
(L:HOWL2 Timer Running,number) 0 ==
if{ (P:ABSOLUTE TIME,seconds) (>L:HOWL2 Start Time,seconds) }

(L:HOWL2 Timer Running,number) 1 ==
if{ (P:ABSOLUTE TIME,seconds) (L:HOWL2 Start Time,number) - (>L:HOWL2 Elapsed Time,number)

(L:HOWL2 Elapsed Time,number) 1.08 44100 (L:EXT_ENG2_HOWL_RUN_FREQ,number) / * >=
if{ 0 (>L:HOWL2 Timer Running,number) 2 (>L:ENG2_HOWL_STATE,number) }
}
.....................

<!-- Play the loop sound -->
(L:ENG2_HOWL_STATE,number) 2 ==
if{ 2 (>L:EXT_ENG2_HOWL_RUN,number) }

<!-- play STOP -->
(A:TURB ENG CORRECTED N2:2,percent) 60 >
(A:TURB ENG CORRECTED N2:2,percent) 54 &lt; or
(A:GENERAL ENG THROTTLE LEVER POSITION:2,percent over 100) 45 * 52 + (A:TURB ENG CORRECTED N2:2,percent) &lt;= or
(A:GENERAL ENG THROTTLE LEVER POSITION:2,percent over 100) 0.04 &lt; or
(L:ENG2_HOWL_STATE,number) 2 == and
if{ 1 (>L:EXT_ENG2_HOWL_STOP,number) 0 (>L:EXT_ENG2_HOWL_RUN,number) 0 (>L:ENG2_HOWL_STATE,number) }
 
Last edited:
First, everything in the gauge seems to apply to engine #2 except for this line:

(A:TURB ENG CORRECTED N2:1,percent) 54 &lt;

It that correct?
 
First, everything in the gauge seems to apply to engine #2 except for this line:

(A:TURB ENG CORRECTED N2:1,percent) 54 &lt;

It that correct?

Yeah sorry, I kind of copied and pasted things from there without looking. Like I said it works pretty well except that one thing I’m trying to come up with.
 
Set a custom L: flag variable when the increase happens. The variable should contain the time (in seconds) the moment the increase was registered. Then compare that variable *with 1 second added to it* to the current time (in seconds). If the flag variable is not equal to 0 and the current time exceeds the variable plus one added to it, 1 second has elapsed. Then set your sound variable to 0 (or however you do it) and reset the flag variable to 0.
 
Set a custom L: flag variable when the increase happens. The variable should contain the time (in seconds) the moment the increase was registered. Then compare that variable *with 1 second added to it* to the current time (in seconds). If the flag variable is not equal to 0 and the current time exceeds the variable plus one added to it, 1 second has elapsed. Then set your sound variable to 0 (or however you do it) and reset the flag variable to 0.

Thank you! I get most of what you're saying and started to build this. One thing I'm having trouble with is actually measuring an increase more than once. Of course the first increase can be attributed to say, N2 being more than what it was at idle. My issue is once it's above that, how can I continually measure an increase? Since there are no variables for commanded engine parameters, only current.
 
Came up with a way: Used the sine of absolute time (that way no need to waste space with a timer) , and when that number is >= 0.95 (which happens randomly between 1 second and maybe 2 seconds), it takes a snapshot of current N2. While that's happening, current N2 is also being read live, so it will compare whether snapshot is greater than current, and play the sound.


(L:What,bool) !
if{ (A:TURB ENG CORRECTED N2:1,percent) near (>L:Current N2,number) }

(P:ABSOLUTE TIME,seconds) sin abs 0.95 >=
if{ (A:TURB ENG CORRECTED N2:1,percent) near (>L:Start N2,number) }

(L:Current N2,number) (L:Start N2,number) >
if{ 1 (>L:SOUND,number) } els{ 0 (>L:SOUND,number) }

It seems to mostly work, unless anyone has suggestions.
 
Back
Top