Updates not running at selected frequency

Version: FS20
Frequency: Consistently
Severity: High
Bug description:
Updates dont run at their selected frequency. The faster they run, the more error they run at.
This is a continuaton of this thread.

After 1 min the 10hz loop is 4% off.
The 100hz loop is almost 30% off!!!

When your whole plane runs simulations like volume and mass flows, having any deviation will cause long term problems. (fuel flows, temperatures)

Below I have the code that isued and a video of the deviation. The 1hz and input event code run correctly, but everything else runs differently.

Attachments:

		<Component ID="TEST">
			<UseTemplate Name="ASOBO_GT_Update">
			<FREQUENCY>100</FREQUENCY>
			<UPDATE_CODE>
				(L:TIMER_TEST_100HZ) 1 100 / (L:TIMER_TEST_GO) * + (&gt;L:TIMER_TEST_100HZ)
			</UPDATE_CODE>
			</UseTemplate>		
		
			<UseTemplate Name="ASOBO_GT_Update">
			<FREQUENCY>50</FREQUENCY>
			<UPDATE_CODE>
				(L:TIMER_TEST_50HZ) 1 50 / (L:TIMER_TEST_GO) * + (&gt;L:TIMER_TEST_50HZ)
			</UPDATE_CODE>
			</UseTemplate>			
					
			<UseTemplate Name="ASOBO_GT_Update">
			<FREQUENCY>30</FREQUENCY>
			<UPDATE_CODE>
				(L:TIMER_TEST_30HZ) 1 30 / (L:TIMER_TEST_GO) * + (&gt;L:TIMER_TEST_30HZ)
			</UPDATE_CODE>
			</UseTemplate>			
		
			<UseTemplate Name="ASOBO_GT_Update">
			<FREQUENCY>10</FREQUENCY>
			<UPDATE_CODE>
				(L:TIMER_TEST_10HZ) 1 10 / (L:TIMER_TEST_GO) * + (&gt;L:TIMER_TEST_10HZ)
			</UPDATE_CODE>
			</UseTemplate>				
			
			<UseTemplate Name="ASOBO_GT_Update">
			<FREQUENCY>1</FREQUENCY>
			<UPDATE_CODE>
				(L:TIMER_TEST_1HZ) 1 1 / (L:TIMER_TEST_GO) * + (&gt;L:TIMER_TEST_1HZ)
				
				(L:TIMER_TEST_GO) !
				if{
					0 (&gt;L:TIMER_TEST_100HZ)
					0 (&gt;L:TIMER_TEST_50HZ)
					0 (&gt;L:TIMER_TEST_30HZ)
					0 (&gt;L:TIMER_TEST_10HZ)
					0 (&gt;L:TIMER_TEST_1HZ)
					0 (&gt;L:TIMER_TEST_EVENT)
				}
			</UPDATE_CODE>
			</UseTemplate>			
		</Component>
2 Likes

Did some further testing.
The fastest a loop can run is the native framerate. By native framerate, i mean frame gen doesnt help.

Here is a simple 120hz loop and a 1hz loop that resets it.

I specifcally wanted to use Update loops to avoid the problems that come with low frame rates.

This is fixed in FS24, so it was known and fixed. FS20 is still a good product and we want our planes to work identically.

Is it possible you should be coding to E:SIMULATION TIME for your flow calculations rather then calculating deltas from an independent free-running clock? I do have similar calculations but the basic formulae I’m using are keyed off the simulation time so auto-correct for tiny errors on each update rather than accumulating a bigger error.

I do agree the absolute synchronisation of all sim variables to the simulation ā€˜clock’ is fundamental to a working simulation, and the MSFS franchise regularly loses sight of how important the time is, but what you’re describing sounds possibly related to the coding technique.

The problem is that some values are dampened. If the framerate gets to low then the dampening values become higher and the whole system breaks.
Some people play with 15fps + 4x frame gen. I would have to slow the whole plane down for things to work correctly for them.

My engine combustion simulations runs with the games frame rate using ā€œa:animation delta timeā€. We had problems with low framerates and I had to limit it below 30fps.

Small things like my airspeed and alitude needles and wingflex are alot lighter/faster, they breakdown below 60fps, which is why i put them on a 120hz loop.
Turns out it was only really running at 60hz but half speed. In FS24 they run correctly at 120hz, but thats 2x what i wanted…

BeamNG run their calculations at 2000hz, and its still janky sometimes.

Lol yup something is definitely going wrong there. I’d recommend using E:SIMULATION TIME rather than some delta value the sim might give you related to the graphics, i.e. for the wing flex you just want to know ā€œthese input vars occurred at time tā€.

If the ā€˜dampening’ code is yours, there’s a good answer on an exponential time series average with variable time steps here:

The core idea is the dampening period (e.g. a second for an ASI needle) is an absolute value independent of the simvar update periods.

If the dampening is in someone else’s code then you’re probably stuffed unless you can re-implement that.

Maybe a simpler alternative to the exponential moving average stuff could be to implement a separate ā€˜update’ component with a slower update rate you could be confident of, and then you could do simpler but more reliable moving average. If your animation update is at a higher rate then you could interpolate the two most recent values.

1 Like

Thanks ill take a look