Hi,
I have been working on a glider project and I want to make a total energy variometer. I learned how to create my own gauges like airsp, alt etc. using data from SimVar and they all are working perfectly but i have problems with creating TE Vario. There are values ,VARIOMETER TOTAL ENERGY", ,VARIOMETER NETTO" and some others but i see ,0" all the time when i connect to the game. In fact the only “variometer” value i can read is VERTICAL SPEED. If only I could get these values working then it would solve my problem and would be super easy to create that gauge. Any ideas?
Little update, SimVar is showing these values for Asobo gliders (dg1001, ls8) but for nothing else, also not for 3rd party gliders (for ex. ls4, as33)
Hello @Ignacy ,
Adding
[VARIOMETERS]
variometer.0 = 0, 0, 4
to your cockpit.cfg should be sufficient to make it work.
Where:
param 1 → just leave 0, it’s a legacy but requiered parameter
param 2 → Used only in the calculation of static pressure deviation. Expect a vs value
param 3 → is a time constant, dictating the speed at which the variable will interpolate
As soon as I have more information on the different parameters, I will post it here, and we will update the documentation.
I edited my post to add some infos.
Hope it helps,
Thank you
Regards,
Boris
Hi,
It worked! But only for less than a minute After short time vario turns off and needle stays at zero.
Hi,
Check that the variometer switch is ON and that the corresponding circuit is powered up.
Regards,
Boris
Hello again,
At the beggining when vario is working i can turn it on and off using vario switch, battery master and alternator - all that works but after less than a minute vario turns off eternaly (unless restart).
By the way this variometer is completely mechanic and contains no electronics, maybe there is an option to make it work independently from electrity
The Asobo Total Energy vario code is non-functional. A trivial test would be to fly a stock glider in a circle and you’ll see the vario shows strong lift on one side of the circle and strong sink on the other. The bug has been reported.
Your ONLY option is to copy the model XML from any of the free gliders e.g K7. There will be a clearly documented section with a single component that calculates a simvar L:B21_TE_MS (total energy reading in m/s).
Here y’go. Cut-and-paste this component into your model interior XML, then you’ll have a simvar L:B21_TE_MS
to animate your TE variometer needle. This open-source unrestricted code is used in all the freeware (& 3rd-party payware) gliders
<!-- ****************************************************************************************** -->
<!-- TOTAL ENERGY VARIO CALCULATION - OUTPUTS L:B21_TE_MS -->
<!-- ****************************************************************************************** -->
<Component ID="B21_TOTAL_ENERGY_VARIO_CALCULATION">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>20</FREQUENCY><!-- Update once per second -->
<UPDATE_CODE>
(L:B21_VARIO_INIT) 1 == if{
(E:SIMULATION TIME, seconds) d
(L:B21_VARIO_TIME_PREV_S) - d
0 == if{ quit }
(>L:B21_VARIO_TIME_DELTA_S)
(>L:B21_VARIO_TIME_PREV_S)
(L:B21_VARIO_TIME_DELTA_S) 1 /
0 max 1 min
(>L:B21_VARIO_COMP_SMOOTHING)
(A:AIRSPEED TRUE, meters per second) sqr (L:B21_VARIO_SPEED2_PREV_MS) - (>L:B21_VARIO_SPEED2_DELTA_MS)
(L:B21_VARIO_SPEED2_DELTA_MS) 19.62 / (L:B21_VARIO_TIME_DELTA_S) /
-40 max 40 min
(L:B21_VARIO_COMP_SMOOTHING) * (L:B21_VARIO_COMP_MS) 1 (L:B21_VARIO_COMP_SMOOTHING) - * +
(>L:B21_VARIO_COMP_MS)
(L:B21_VARIO_TIME_DELTA_S) 1 / 0 max 1 min (>L:B21_VARIO_VSI_SMOOTHING)
(A:PLANE ALTITUDE, meters) (L:B21_VARIO_ALT_PREV_M) - (L:B21_VARIO_TIME_DELTA_S) /
(L:B21_VARIO_VSI_SMOOTHING) * (L:B21_VARIO_VSI_MS) 1 (L:B21_VARIO_VSI_SMOOTHING) - * +
-40 max 40 min
(>L:B21_VARIO_VSI_MS)
(L:B21_VARIO_VSI_MS) (L:B21_VARIO_COMP_MS) + d
(>L:B21_VARIO_TE_MS)
-8 max 8 min
(A:AIRSPEED TRUE, meters per second) 10 < if{
0
} els{
(A:AIRSPEED TRUE, meters per second) 20 < if{
(A:AIRSPEED TRUE, meters per second) 10 - 10 / *
}
}
(>L:B21_TE_MS)
(A:AIRSPEED TRUE, meters per second) sqr (>L:B21_VARIO_SPEED2_PREV_MS)
(A:PLANE ALTITUDE, meters) (>L:B21_VARIO_ALT_PREV_M)
} els{
1 (>L:B21_VARIO_INIT)
0 (>L:B21_VARIO_COMP_MS)
0 (>L:B21_VARIO_VSI_MS)
(A:AIRSPEED TRUE, meters per second) sqr (>L:B21_VARIO_SPEED2_PREV_MS)
(A:PLANE ALTITUDE, meters) (>L:B21_VARIO_ALT_PREV_M)
(E:SIMULATION TIME, seconds) (>L:B21_VARIO_TIME_PREV_S)
}
</UPDATE_CODE>
</UseTemplate>
</Component>
Hi,
I am sorry for not answering so long. I pasted this code to my model XML behaviors and I tried to use it in two ways and I failed in both.
In first I tried with my own animation
Here is how it looks in blender. Simple animation from 0 to 10 with bias of 5 (in code) which should give Vario readings fromk -5 to +5 m/s.
Then I tried to copy animation from one of freeware gliders (this time ls4). I pasted it in behaviors just after TE calculation. However I was (am) not sure could this LS4 animation code work with my blender animation because I didn’t change anything in my blender animation keying nor timing because I couldn’t find any information on how should this blender animation look like… and so It could had worked or could not… and it did not work of course
(At the top b21 TE calculation code, below copied LS4 animation)
Can anyone help me and give some clues what might be wrong?
There are TWO things to get straight:
(1) cut/paste the component as listed
- make sure it’s in the part of your model XML that has Components (I’m assuming you already have those)
- make sure it’s at least in your INTERIOR XML, assuming you have both interior and exterior XML files.
At this point you will have a variable L:B21_TE_MS
updating with the value in meters per second of the Total Energy reading of the vario. You can use the SDK tool “Behaviours” listed on the top bar of the in-game Dev Menu to look at the value of any L: (aka LocalVar) variable, and that’s a core skill you want when you’re developing any plane. So you should be able to fly the plane and watch the variable going up and down.
(2) You should have a Component for your animation - I’m assuming you have Components for your animations already (there’s nothing special about a needle animation, it’s just yet another animation in your plane). The LS4 example is pretty reasonable for the LAYOUT but you have to get your values right. I.e. the name of your animation, the ANIM_LAG, and the ‘rpn’ code that puts the animation in the position you want it. I’m getting a strong impression you haven’t done a lot of MSFS model animation… if so here are some pointers:
(a) make the animation 0…100 from one end of the animation to the other. e.g. 0 could point at maximum sink and 100 could point at maximum lift. I.e. ZERO on the gauge would be animation frame 50.
(b) TEST your animation component totally separately from any messing around with variables you’re unfamiliar with. E.g. <ANIM_CODE>25</ANIM_CODE>
will set the animation frame number to an unvarying “25” and you should see the needle (given the 0…100 swing, but anything works) point half way between ZERO and MAX SINK. Change ANIM_CODE to 75 and reload the plane and the needle should point half-way positive. Change it to zero and the needle should point at zero sink.
(c) WHEN, and ONLY WHEN, you’ve seen the L:B21_TE_MS variable moving up and down in the Tools…Behaviours…LocalVars window AND you’ve seen the needle move to whatever number you’ve set in the <ANIM_CODE>
field of the Component XML, then you’re ready to connect the two parts.
(d) Say your min/max for the vario is -5 m/s … +5 m/s, then you want the animation frame to be 0 for -5m/s and 100 for +5 m/s. The formula for that in ANIM_CODE
is:
<ANIM_CODE>(L:B21_TE_MS,number) 10 * 50 +</ANIM_CODE>
and your ANIM_LAG (how many frames you want the animation to move per second) will be something like:
<ANIM_LAG>100</ANIM_LAG>
Hi,
Thanks for a fast response! Now it works Your explanation is excellent although I knew everything up to D point, I should had mentioned more information about my progress and what I managed to do not to bother you that much. But still I think this will help someone a lot! The problem for me was this certain ANIM_CODE. I have one more question - could you explain this formula?
ANIM_CODE>(L:B21_TE_MS,number) 10 * 50 +</ANIM_CODE>
I guess that 10*
multiplies the NUMBER so that it can match up to 50 frames for 5m/s but what does 50 +
mean? I must also make 30m/s vario so understanding this code will be helpful Could you reffer me to any topic/site where I could learn more about animations coding?
THANKS A LOT again!
ANIM_CODE is described here:
https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm
(L:B21_TE_MS,number)
means take the value of the L:B21_TE_MS variable and push it on the stack.
10
means take the value 10 and push it on the stack (if you quit at this point the last value on the stack will be 10, and that will move the animation to frame 10 - that’s useful for debugging).
*
means take the two top elements off the stack, multiply them together, push the result onto the stack
50
means push the value 50 onto the stack
+
means take the two top elements off the stack, add them together, push the result onto the stack
whatever number is on the stack when you reach </ANIM_CODE> is used as the frame number
SPACES between elements in the formula are important so don’t do 10*. Think of each thing as a step in the process the computer will follow.
FWIW it’s called “reverse polish notation” but that makes it sound more complicated than it is - basically you have to imagine a ‘stack’ you push numbers onto and any of the operators (e.g. +, -) take numbers from the stack, apply the operation, and push the answer back on the stack.
So for 10 - 2 * 3 (i.e. ans=4) you could do:
push 10
push 2
push 3
do the * (so the 2 & 3 get replaced with 6)
do the - (so 10 & 6 get replaced with 4)
X 10 * 50 * in RPN will leave a number 0…100 if X is -5 … +5, or similarly will leave 50 if X is 0.
I looked for a video for you but they all suck.
Thank you so much! I dont know how I missed this RPN topic but now I have a lot of material to study
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.