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

FS2004 XML timer not counting at expected rate

Messages
18
Hello,

I'm building a few XML gauges for one of my aircraft, and for elements which require timers, have been using the following code:

(P:Absolute time,seconds) 1 % 1 > !

This, based on what I've read in other threads, should introduce a 1 second timer cycle.

In actual practice, I'm using this timer to increment a variable for each second that it's above a limit, shown here:

Code:
<Update>
(L:ITTModified,enum) 870 > if{ (P:Absolute time,seconds) 1 % 1 > ! if{
     (G:Var2,enum) ++ (>G:Var2,enum) } }
   (G:Var2,enum) 20 > if{ (>K:TOGGLE_ENGINE1_FAILURE) }
</Update>

Once the variable is incremented above 20, the engine should fail.

However, I'm finding that the engine fails after just 4 to 5 seconds. I have adjusted the values in the timer (example: (P:Absolute time,seconds) 2 % 0.5 > ! )... but still no luck.

Is there something I'm missing?
 
I would think the best way to do this is not to use the timer at all, but instead use the known frequency of update ( 18hz ) to do your timing.

18 * 4 = 72, 18 * 5 = 90, etc..

Plus (G:Vars) donot use suffix' at all IE (G:Var9)

Below the engine will fail after 5 minutes - 5 * 60 * 18 = 5400
For a 20 second wait before fail use the values ( 20 *18 = 360 ) 361 and 360
It should also reset the timer after falling under 870* ITT if it didn't fail already.


Code:
<Update>
  (L:ITTModified,enum) 870 &gt; (G:Var2) 5401 &lt; and 
    if{ 
    (G:Var2) ++ (>G:Var2) 
    (G:Var2) 5400 == 
      if{ 
       (>K:TOGGLE_ENGINE1_FAILURE) 
        }
      } 
      els{ 
          (L:ITTModified,enum) 870 &lt; (G:Var2) 5400 &lt; and 
              if{ 
                 0 (>G:Var2) 
                }
          }
</Update>

Doing it like above will also negate the constant firing of TOGGLE_ENGINE1_FAILURE.

An example why to use just the above, in the following ((P:Absolute time,seconds) 2 % 0.5 > ! ) 1/2 of a 2 second seed is on, the other half is off. Meaning when on for 1 second (G:Var2) will increment 9 times..

Roman
 
Last edited:
I was going to say... perhaps you are outside of normal Universe time for this dimension, but people will probably throw tomatoes at me, so I'll just keep to my self.. :eek:
 
I was going to say... perhaps you are outside of normal Universe time for this dimension, but people will probably throw tomatoes at me, so I'll just keep to my self.. :eek:

Not tomatoes but definately "egg on the face" after I uploaded my external VC10 refuelling panel without the switch bmps!!!!!!!!!!! Oops!!
vololiberista
 
In actual practice, I'm using this timer to increment a variable for each second that it's above a limit, shown here:
.....
Once the variable is incremented above 20, the engine should fail.

I'm not sure if you want the variable to be cumulative whenever the engine goes above limit, or would reset if the engine goes below and increment again from zero if it goes above again?

In the first case, you could write:

Code:
<Update>
(L:ITTModified,enum) 870 > 
  if{ (G:Var2) (P:Absolute time,seconds) (G:Var2) 0 == * + (>G:Var2) 
      (P:Absolute time,seconds)  (G:Var2) - d (>G:Var3) 20 > 
      if{ (>K:TOGGLE_ENGINE1_FAILURE)  0 (>G:Var2)  0 (>G:Var3) }
     }
  els{ (P:Absolute time,seconds)  (G:Var2) - (G:Var3) - (G:Var2) + (>G:Var2) }
</Update>
And in the second:

Code:
<Update>
(L:ITTModified,enum) 870 > 
  if{ (G:Var2) (P:Absolute time,seconds) (G:Var2) 0 == * + (>G:Var2) 
      (P:Absolute time,seconds)  (G:Var2) - 20 > 
      if{ (>K:TOGGLE_ENGINE1_FAILURE)  0 (>G:Var2) }
     }
  els{ 0 (>G:Var2) }
</Update>


An example why to use just the above, in the following ((P:Absolute time,seconds) 2 % 0.5 > ! ) 1/2 of a 2 second seed is on, the other half is off. Meaning when on for 1 second (G:Var2) will increment 9 times..
Roman

The correct expression would be ((P:Absolute time,seconds) 2 % 0.5 2 * > ! ) so a half (0.5) of the cycle has one second on and one second off

Tom
 
Thank you all very much for the replies.

The simple solution of working from multiples of the gauge frequency had not occurred to me! :D

I've rebuilt now, and all is working perfectly.
 
The simple solution of working from multiples of the gauge frequency had not occurred to me!

On a side note, if you use the gauge frequency as a timer, you should check that the sim is not in pause, otherwise the counter will lose syncronization.

Tom
 
Back
Top