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

FSX random virble for gauges

Messages
118
Country
israel
Hi

I just work on precision panel for C172P/S

I just add some Random fluctuations to VOR needles (depande on VHF Reception range) and some other gauges.

I just add sone formulas to the (A:NAV1 CDI, number):

<Macro Name="random1">
(E:Local time, seconds) 2 * sin 3 *
</Macro>

<Macro Name="random2">
(E:Local time, seconds) 0.5 * cos 4 *
</Macro>

<Macro Name="random3">
(E:Local time, seconds) 3 * cos -1.5 *
</Macro>

<Macro Name="random">
@random1 @random2 @random3 (A:NAV1 HAS NAV, bool) * * *
</Macro>

this creates a number thats runs between -11 to +11 almost random

I have 2 questions:

1) do you think this formulas can caouse memory leak and stutters, do you know better formula for random movenent in and out?

2) do elements that are not visible (with <Visible> tag) affects on sim performance?
 
Hi thanks for answering I will try this random formula.

my main quwestion is if formula depands on sim time thats runs always, can cause performance hit, like stutters...

p.s what is the meaning of <update> ?
 
I have had a need for an XML random number generator for some time now. Could never see a reliable way of implementing it myself. This Pierre L'Ecuyer style one came along at a very opportune moment. I have incorporated it already and it works just fine. Thanks a lot, Bob! :)
 
Hi thanks for answering I will try this random formula.

my main quwestion is if formula depands on sim time thats runs always, can cause performance hit, like stutters...

p.s what is the meaning of <update> ?


update

Definition: bring up to date
Synonyms: amend, modernize, refresh, refurbish, rejuvenate, renew, renovate, restore, revise
 
In the case of XML, it is a section where you would place stuff you want to be evaluated every gauge cycle (up to 18 times per second).

Code:
<Update>
   (* stuff to be evaluated/executed every cycle *)
</Update>
 
Hi thanks for answering I will try this random formula.

my main quwestion is if formula depands on sim time thats runs always, can cause performance hit, like stutters...

p.s what is the meaning of <update> ?
I don't believe that using an xml sim variable (A:, E:, P: ) will have more impact on performance than using an L: variable.
Not 100% sure, but I believe the variable is calculated/stored by FS anyways every cycle, so memory usage/calculation time for updating the variable should be the same whether you use it or not (?)

I'm using the following quasirandom number generator based on middle square method suggested by John Von Neumann. While said to be a very poor generator, if it was good enough for him working on Eniac, it's good enough for me on FS :D
http://en.wikipedia.org/wiki/Middle-square_method
Code:
(L:RandomNumber,number) 
(E:ABSOLUTE TIME,seconds) 1 % + 
d * 100 * 1 % 
(>L:RandomNumber,number)
 
Hi

I finnished to build my VOR gauge which considerate the VHF range formula (line of site).
when flying at low altitude and far from VOR station, the signal we can receive is on and off, cause the needle to rotate randomally left and right, also the to/from flag moves on and off untill we climb to altitude witch the signal is high enough for a stable indication.

the problem is when the random formula takes action on the VOR needle, I get light performance hit.

I done a test:
default VOR
my VOR but not tuned to a station (no random)
my VOR tuned to a station (with random)
the results is -11% frame rate hits and some stutters

in my opinion this performance hit is too high for some real gimics :)

if you want to test my VOR gauge, just download from
http://www.virtual-flight.com/dl/fsx/vor.zip and use vor!VOR1_Indicator ...



my question about <update> is:
if I want only one element to update at 5 HZ
I need to use it like this?

<update frequncy="5">
<element>

</element>
</update>

or

<element>
<update frequncy="5">

</update>
</element>

?

Thanks

Tomer
 
Hi

I finnished to build my VOR gauge which considerate the VHF range formula (line of site).
when flying at low altitude and far from VOR station, the signal we can receive is on and off, cause the needle to rotate randomally left and right, also the to/from flag moves on and off untill we climb to altitude witch the signal is high enough for a stable indication.

the problem is when the random formula takes action on the VOR needle, I get light performance hit.

I done a test:
default VOR
my VOR but not tuned to a station (no random)
my VOR tuned to a station (with random)
the results is -11% frame rate hits and some stutters

in my opinion this performance hit is too high for some real gimics :)

if you want to test my VOR gauge, just download from
http://www.virtual-flight.com/dl/fsx/vor.zip and use vor!VOR1_Indicator ...



my question about <update> is:
if I want only one element to update at 5 HZ
I need to use it like this?

<update frequncy="5">
<element>

</element>
</update>

or

<element>
<update frequncy="5">

</update>
</element>

?

Thanks

Tomer

Some GOOD news ?
I don't think the "random" behaviour of your VOR Gauges is very "Real World" Realistic.

The VOR gauge's FLAG has a far degree of Hystresis. Once you climb high enough for the flag to indicate you have enough signal for a reliable bearing reading, then the signal has to drop quite significantly again, before the flag goes back to indicating "No signal".

It would be very rare to see a VOR gauge acting the way you describe.

You might do better to simulate this Hystresis effect , and gain the added advantage, of not needing to process the Frame rate reducing code you currently have added.

Note: While better than nothing, the line of sight equation does NOT take into account terrain.
(Adding the effect of terrain is not an insignificant task)

While the addition of line of sight range is neat, it is only a first approximation to what is really happening, so it really does not have to be that exacting.
 
Last edited:
hi Geoff,

you right, I fly c172 in real world and I know that line of sight range is only formula. what happand in real word in depand on terrain and temerature, atmoshper and meny parameters.

but in FSX thare is no "line of sight". almost all VHF VOR and UHF DME range is ~150 NM, so I want to simulate real behavior of VOR/DME from takeoff to cruise alt.

about the Hystresis effect formula:
I'll try to reduce the speed of Hystresis effect but I guess that the fps drop will be the same if I still use (E:Local time, seconds) :mad:.

here is video I taked from my last flight.
http://www.youtube.com/watch?v=cqV0jV8M1G8

we can see during takeoff roll, the needle with light Hystresis around center and off flag.
between 150ft to 250ft, on and off and above 250ft, albost stable neddle and flag with light Hystresis
 
Last edited:
I have 2 questions:

1) do you think this formulas can caouse memory leak and stutters, do you know better formula for random movenent in and out?

2) do elements that are not visible (with <Visible> tag) affects on sim performance?


1) No, they can't cause memory leaks and stutters other than those produced by the normal rendering of the gauge. In your VOR's example, it shouldn't be any difference because the code is very simple.

2) Yes, and it can be easily measured: Put yourself in VC main view, with the whole panel visible, check FPS value, then scroll down the view until it shows only the floor of the cockpit and check FPS again; the difference would be produced by a rendering of the panel's gaugeset.

I don't believe that using an xml sim variable (A:, E:, P: ) will have more impact on performance than using an L: variable.
Not 100% sure, but I believe the variable is calculated/stored by FS anyways every cycle, so memory usage/calculation time for updating the variable should be the same whether you use it or not (?)

Sim variables (A:,E:,etc) are always updated at standard frame rate, whether they are used in a gauge or not. Local (L) variables are updated/recalled only when they are referenced within a gauge's code.

my question about <update> is:
if I want only one element to update at 5 HZ
I need to use it like this?

<update frequncy="5">
<element>

</element>
</update>

or

<element>
<update frequncy="5">

</update>
</element>

?

Thanks

<Update> must go outside an <Element> structure. For example:

Code:
<Gauge xxx>
  <Update Frequency="5"/>
  <Element1>
  </Element1>
  <Element2>
  </Element2>
  etc
</Gauge>
Tom
 
hi Geoff,

you right, I fly c172 in real world and I know that line of sight range is only formula. what happand in real word in depand on terrain and temerature, atmoshper and meny parameters.

but in FSX thare is no "line of sight". almost all VHF VOR and UHF DME range is ~150 NM, so I want to simulate real behavior of VOR/DME from takeoff to cruise alt.

What I would suggest is this.

Calculate the line of sight range (LOS Range), at the most, once a second.
Set your own Flag, with Hystresis
ie if ((Range > LOS Range) and (flag == 0)) then Flag = 1
if ((Range < (0.9 * LOS Range)) and (flag ==1 )) then Flag = 0

Then, if Flag =1, you are out of range of VOR.
( Force Flag indiactor to show, and Center needle)

No need for and Random calculations, or any random needle movements.
 
Back
Top