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

Adding a Delay to an XML Function

Messages
16
Country
unitedstates
I was wondering about how to add a delay to this function:

<!-- ENG2 ON AND GEN -->
(A:ENG2 N1 RPM, percent) 10 >
(L:O09_012_LT2, number) 0 == and
if{ 1 (>L:ENG2_POWER_ON,number) 1 (>L:AC_ON_ENG_PWR_STATE,number) } els{ 0 (>L:ENG2_POWER_ON,number) 0 (>L:AC_ON_ENG_PWR_STATE,number) }

Specifically, I want the else statement

{ 0 (>L:ENG2_POWER_ON,number) 0 (>L:AC_ON_ENG_PWR_STATE,number) }

to occur 2 seconds or so after the conditional statement returns false.
I've found lots of stuff about (P:Absolute time, seconds) but can't figure out how to get it to work.
 
Last edited:
Messages
495
Country
austria
Code:
<!-- ENG2 ON AND GEN -->
(A:ENG2 N1 RPM, percent) 10 >
(L:O09_012_LT2, number) 0 ==
and
if{ 
  1 (>L:ENG2_POWER_ON,number) 
  1 (>L:AC_ON_ENG_PWR_STATE,number)
   }

(A:ENG2 N1 RPM, percent) 10 &lt;
(L:O09_012_LT2, number) 0 !=
or
if{
  (P:Absolute time, seconds)  2 + (>L:Timer_Delay,seconds)
  }

(L:ENG2_POWER_ON,number) 0 !=
(L:AC_ON_ENG_PWR_STATE,number) 0 !=
or
(P:Absolute time, seconds)  (>L:Timer_Delay,seconds) &gt;
and
if{
   0 (>L:ENG2_POWER_ON,number)
   0 (>L:AC_ON_ENG_PWR_STATE,number)
   }

I think this should work. Not tested!
 
Messages
495
Country
austria
The above will not work..

Code:
<!-- ENG2 ON AND GEN -->
(A:ENG2 N1 RPM, percent) 10 >
(L:O09_012_LT2, number) 0 ==
and
if{
  1 (>L:ENG2_POWER_ON,number)
  1 (>L:AC_ON_ENG_PWR_STATE,number)
   }

(A:ENG2 N1 RPM, percent) 10 &lt;
(L:O09_012_LT2, number) 0 !=
or
(L:ENG2_POWER_ON,number) 1 ==
(L:AC_ON_ENG_PWR_STATE,number) 1 ==
or
and
(L:Timer_Delay,seconds) 0 ==
and
if{
  (P:Absolute time, seconds)  2 + (>L:Timer_Delay,seconds)
  }

(P:Absolute time, seconds)  (L:Timer_Delay,seconds) &gt;
(L:Timer_Delay,seconds) 0 !=
and
if{
   0 (>L:Timer_Delay,seconds)
   0 (>L:ENG2_POWER_ON,number)
   0 (>L:AC_ON_ENG_PWR_STATE,number)
   }

Not tested!
 
Last edited:
Messages
440
Country
us-wisconsin
If this is a gauge and not some model animation code then using the built in 18hz gauge read/refresh cycle will work.
2 seconds * 18 hz = 36
XML:
(A:ENG2 N1 RPM, percent) 10 > (L:O09_012_LT2, number) 0 == and
if{ 1 (>L:ENG2_POWER_ON,number) 1 (>L:AC_ON_ENG_PWR_STATE,number) 0 (>L:AC_ON_TIMER, number) }
els{ (L:AC_TIMER, number) ++ 36 min (>L:AC_TIMER, number) (L:AC_TIMER, number) 36 == if{ 0 (>L:ENG2_POWER_ON,number) 0 (>L:AC_ON_ENG_PWR_STATE,number) } }
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
As a sidenote (may not be important in this case, but good to realise):
There is a subtil difference between timers based on the AbsoluteTime Avar, and timers based on counting XML gauge schedules.
Namely in case you Pause the sim:

- Timers based on AbsoluteTime are stopped during Pause, because AbsoluteTime freezes.

- Timers based on counting gauge schedules keeps running, because gauges keep running when the sim is Paused.
Unless of course you add a Pause detection in the code, to explicitely stop the timer in Pause.

Rob
 
Top