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

Can one 'read' throttle movement speed?

Messages
10,088
Country
us-arizona
Hey all,

Is it possible to read throttle movement 'speed'? For instance;
.Turbine at 20% RPM
.Throttle at 20% also
...if.. Throttle moves forward 'fast' (if that can be measured in speed)
........if.. causes needles to twitch
.....and.. causes turbine vibration for 4 seconds

Is this doable in XML code? If not, probably just the same. I am putting too many crazy effects in this poor jet. Its becoming an effects monster and is probably likely to win the MASSIVE AMOUNT OF L:VARS INTERNATIONAL AWARD OF THE YEAR award... :S
 
Messages
76
Country
netherlands
Sure: dx / dt = speed

When your gauge is almost done for the current frame store the current time and current throttleposition in Lvars. (named previousTime and previousThrottle)
In the next frame you use these Lvars (now holding time and postion of the previous frame) and the current time and position to calculate dx, dt and from those throttlespeed.

This gives the throttle's instant speed.
If you want to smooth it out a bit you could update the Lvars only once every n frames.

Or build a first-in-first-out buffer using n time/position pairs.
Each frame you drop the oldest, move every pair one place and add the current pair.
Then calculate the speed using the oldest and newest pair.

If you are just after an effect then you can also just test if the current position minus the previous position is greater than some threshold value.
 
Messages
211
Country
germany
The difference thrust lever position in percent minus motor speed in percent. I use this for variable smoke effects.

Code:
  <Element>
    <Select>
      <Value>

        (A:ENG1 N1 RPM,percent) 20 &gt;
    if{
        (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) (A:ENG1 N1 RPM,percent) - 15 &gt;
        if{
           (A:LIGHT RECOGNITION,number) 1 &lt;
           if{ (&gt;K:TOGGLE_RECOGNITION_LIGHTS) }
          }
        els{
           (A:LIGHT RECOGNITION,number) 0 &gt;
           if{ (&gt;K:TOGGLE_RECOGNITION_LIGHTS) }
           }
      }
   els{
           (A:LIGHT RECOGNITION,number) 0 &gt;
           if{ (&gt;K:TOGGLE_RECOGNITION_LIGHTS) }
      }
       
      </Value>
    </Select>
  </Element>


In a piston engine make the difference very low.
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Sure: dx / dt = speed
...
This gives the throttle's instant speed.
If you want to smooth it out a bit you could update the Lvars only once every n frames.

That would be the proper method. I would add that you need to wait for the throttle to stop moving by making a frame-check.

Tom
 
Messages
520
Country
australia
Hi Bill
Here is some very simple code I used to model compressor stall if the the throttle slammed forward
might help :)
Code:
<Gauge Name="ComStall1">
   <Update Frequency="7"/>
   <Element>
<Select>
 <Value>(A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) (A:TURB ENG1 CORRECTED N2,percent) - 30 &gt;  
    if{ (L:trendr,bool) 1 &lt; if{ 1 (>L:trendr,bool) } }
    els{ (L:trendr,bool) 0 &gt; if{ 0 (>L:trendr,bool) } }
</Value>
      </Select>
   </Element>
  <Element>
    <Select>
      <Value>(L:trendr,number) 1 == 
              if{ (G:Var6) 0 == if{ 1 (&gt;G:Var6) (P:Local Time, seconds) 1 + (&gt;G:Var7) } }
             els{ (G:Var6) 0 &gt; if{ 0 (&gt;G:Var6) } }
      </Value>
    </Select>
 </Element>
  <Element>
    <Select>
      <Value>(G:Var6) 1 == 
              if{ (P:Local Time, seconds) (G:Var7) &gt; if{ (&gt;K:TOGGLE_ENGINE1_FAILURE) } }
      </Value>
    </Select>
 </Element>
</Gauge>
 
Messages
10,088
Country
us-arizona
Many thanks guys. Massively appreciated.

Mav, I can use that one and replace the failure with vibration+timer to give it a hesitation. The actual jets will stumble if you stab the throttles too fast. This will work brilliant.

Thanks again.


Bill
 
Messages
12
Country
ca-ontario
Hi Bill
Here is some very simple code I used to model compressor stall if the the throttle slammed forward
might help :)
Code:
<Gauge Name="ComStall1">
   <Update Frequency="7"/>
   <Element>
<Select>
<Value>(A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) (A:TURB ENG1 CORRECTED N2,percent) - 30 &gt; 
    if{ (L:trendr,bool) 1 &lt; if{ 1 (>L:trendr,bool) } }
    els{ (L:trendr,bool) 0 &gt; if{ 0 (>L:trendr,bool) } }
</Value>
      </Select>
   </Element>
  <Element>
    <Select>
      <Value>(L:trendr,number) 1 ==
              if{ (G:Var6) 0 == if{ 1 (&gt;G:Var6) (P:Local Time, seconds) 1 + (&gt;G:Var7) } }
             els{ (G:Var6) 0 &gt; if{ 0 (&gt;G:Var6) } }
      </Value>
    </Select>
</Element>
  <Element>
    <Select>
      <Value>(G:Var6) 1 ==
              if{ (P:Local Time, seconds) (G:Var7) &gt; if{ (&gt;K:TOGGLE_ENGINE1_FAILURE) } }
      </Value>
    </Select>
</Element>
</Gauge>

Working on a simulated compressor stall myself and came across your post.
Doesn't the TOGGLE_ENGINE1_FAILURE completely kill the engine until you restart it? I thought a compressor stall typically resulted in a momentary loss of thrust which would often recover on it;s own or with a reduction in throttle?

My intent is to use a throttle movement speed measure (similar to your approach) combined with AoA to determine the severity of the stall. But I'm having a hard time coming up with a mechanism to simulate a temporary loss of thrust that can recover on it's own.
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
My intent is to use a throttle movement speed measure (similar to your approach) combined with AoA to determine the severity of the stall. But I'm having a hard time coming up with a mechanism to simulate a temporary loss of thrust that can recover on it's own.

With XMLTool's SIMVARS custom vars you can easily do that, just by writing directly to (A:TURB ENG CORRECTED N2:x, percent).

Something like (pseudocode for engine 1)

Code:
(L:Stall_enabled,bool)
if{  55 (>C:SIMVARS:TURB ENG CORRECTED N2:1, percent) }
etc..

Tom
 
Messages
12
Country
ca-ontario
With XMLTool's SIMVARS custom vars you can easily do that, just by writing directly to (A:TURB ENG CORRECTED N2:x, percent).

Something like (pseudocode for engine 1)

Code:
(L:Stall_enabled,bool)
if{  55 (>C:SIMVARS:TURB ENG CORRECTED N2:1, percent) }
etc..

Tom

Thank you Tom! That is exactly the sort of thing I'd like to do. I shall look into this. Is there a good SIMVARS reference you can suggest?
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Is there a good SIMVARS reference you can suggest?

Yes. Besides reading XMLTools user and examples documents, you can install TableAndSimExample.xml gauge that comes with XMLTools package to see how SIMVARS works.

Tom
 
Top