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

FSXA XML timing

Vitus

Resource contributor
Messages
1,480
Country
newzealand
Hi there,

I have a very general question about timing in XML. I use the
Code:
<UPDATE>
section quite often to recalculate the status of my different customized systems (vacuum, electric, all indicators, payload manager,...). My question is how reliable is the frequency section within the update tag?

For instance:
Code:
<Update>
  <Frequency>1</Frequency>
  (L:COUNT,percent) 1 + 100 min (&gt;L:COUNT,percent)
</Update>

will this code be executed once a second and increment the COUNT variable - on every system? I use this method quite often and it works fine on my PC - but it is "quick and dirty" and the question is if I could get in trouble later on. What are other solutions for coding time-relevant-updates?

Regards
Vitus
 
It will be ~reliable as long as no one enters the "fast mode."

If there's any question, simply use the A:Elapsed seconds,seconds variable.
 
Thanks for your appraisal Bill!

A:Elapsed seconds,seconds ? That one is not listed in the SDKs "Simulation Variables" table. A simple way would be something like:
Code:
(E:LOCAL TIME,seconds) (L:OLD TIME,seconds) - (&gt;L:TIME DIFF,seconds)
(E:LOCAL TIME,seconds) (&gt;L:OLD TIME,seconds)

buuuuuuut I need a higher precision - will a code like that also work with milliseconds?

Regards
Vitus
 
Thanks for your appraisal Bill!

A:Elapsed seconds,seconds ? That one is not listed in the SDKs "Simulation Variables" table. A simple way would be something like:
Code:
(E:LOCAL TIME,seconds) (L:OLD TIME,seconds) - (&gt;L:TIME DIFF,seconds)
(E:LOCAL TIME,seconds) (&gt;L:OLD TIME,seconds)

buuuuuuut I need a higher precision - will a code like that also work with milliseconds?

Regards
Vitus

Oops! My bad. I meant to write:

E:ABSOLUTE TIME,seconds Time, as referenced from 12:00 AM January 1, 0000

The return is a FLOAT64 value, so you should be able to slice-and-dice any time value you need from that.
 
Hey,
pardon my intrusion into this thread but this interests me as well.

Code:
(E:ABSOLUTE TIME,seconds) (L:OLD TIME,seconds) - (>L:TIME DIFF,seconds)
(E:ABSOLUTE TIME,seconds) (>L:OLD TIME,seconds)

because time diff = old time - absolute time and
old time = absolute time
then wouldn't you end up with a scenario in which you are subtracting

time diff = (absolute time) - absolute time for which the only value is 0?
 
You have to look at the big picture. Say you want to animate a needle that moves exactly two degrees per second. If the gauge is updated precisely every 0.1 seconds you know for sure that your needle-animation code must be something like:
Code:
(L:NEEDLE DEGREES,degree) 0.2 + (&gt;L:NEEDLE DEGREES,degree)

And the NEEDLE DEGREES variable will continuously increase exactly 2 degree per second.

BUT we are running Windows and a Flightsim developed by MS, hence we cannot be 100% sure about this precise timing. :D

If you want a precisely timed animation - or whatsoever - you need to determine the time between each gauge update. In the example above TIME DIFF is always the time between the last gauge update and now.

To use it with our needle you need something like:
Code:
(E:ABSOLUTE TIME,seconds) (L:OLD TIME,seconds) - (&gt;L:TIME DIFF,seconds)
(L:NEEDLE DEGREES,degree) (L:TIME DIFF,seconds) 2 * + (&gt;L:NEEDLE DEGREES,degree)
(E:ABSOLUTE TIME,seconds) (>L:OLD TIME,seconds)

Regards
Vitus
 
Back
Top