• 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 Detecting that Elevator Trim is Changing

Here is my last try on it.

This is kind of based on your pseudo code above, using a full 30 seconds of sampling but using update frequency ticks rather than clock time.
Based on actual trim. The downside? It takes a full 30 seconds for each sample set.
It would act the same regardless if clock time or update ticks are used.
I would rather use my previous examples where it is based on trim change rate / velocity ( trim degrees / second ), that way the sampling resolution is down to 1 second.

IMO neither way is correct. Most likely in real life it uses trim change rate velocity and trim change rate acceleration to determine if the trim will go over a 2 degree difference using much less than a 1 second sample rate. For flight sim, this would be an overboard way to do it.

Regardless, hope this helps. If anything, provide examples of timers using the update frequency.
XML:
<Guage Name="AP_Overtrim_Warning" Version="1.0">

    <Update> 
    <!-- Update frequency is at 18 hertz, 
    therefore 30 seconds equals 540 update ticks (18 * 30) -->

        (A:AUTOPILOT MASTER, bool) if{ 
        <!-- AP is on -->
        
            (L:STAB_WARN_TIMER, number) 0 == if{ 
            <!-- When AP is first turned on, or, after a full 30 second sample .... -->
                (A:ELEVATOR TRIM POSITION, degrees) (>L:ELEVTRIMPOSPREV, number) 
                <!-- Update the previous trim position -->
            }
                    
            (A:ELEVATOR TRIM POSITION, degrees) (L:ELEVTRIMPOSPREV, number) - abs 2.01 &gt; ! if{ 
            <!-- Only update the timer ticks if a warning is NOT happening. 
            Basically pause the timer so when the overtrim alarm is sounded it will not cancel until 
            trim is brought back within limits.    Otherwise, the alarm will cancel after 
            the 30 second timer resets and starts over with a new previous trim position reference. 
            This "could" happen in as little as 0.05 seconds, not good.  -->

                (L:STAB_WARN_TIMER, number) ++ 541 % (>L:STAB_WARN_TIMER, number) 
                <!-- A looping 30 second timer based on update frequency (540), 
                runs when AP is on, is reset when AP is off. -->
            }
        
            (L:STAB_WARN_TIMER, number) 0 &gt; (L:ELEVTRIMPOSPREV, number) -999 != and if{ 
            <!-- Timer is greater than 0 (timer started & NOT on the update tick), 
            previous trim is updated (NOT equal to -999), AP is on, 
            do samples to see if trim is 2 degrees greater than the previous trim position -->
            
                (A:ELEVATOR TRIM POSITION, degrees) (L:ELEVTRIMPOSPREV, number) - abs 2.01 &gt; if{ 
                <!-- Check to see if trim is greater than 2 degrees from past trim in 30 second sample -->
                
                    1 (>L:SND_STABILIZER, bool) 
                    <!-- Yes it is, play sound -->
        
                } els {
                    0 (>L:SND_STABILIZER, bool) 
                    <!-- No it is not, turn off sound if playing -->
                } 
                <!-- End trim checks for sound -->

            } 
            <!-- End trim sampling -->

        } els{ 
        <!-- AP is off -->
        
            0 (>L:SND_STABILIZER, bool) 
            <!-- Make sure sound is off if AP is off -->
            0 (>L:STAB_WARN_TIMER, number) 
            <!-- Make sure timer is reset, ready to go, if AP is off -->
            -999 (>L:ELEVTRIMPOSPREV, number) 
            <!-- Just something extra to provide additional checks on first load 
            and subsequent sampling resets -->

        }

    </Update>

</Guage>
 
Hi spokes2112,

Thank you so much for reviewing and helping again!

I agree it is a tricky matter and also because of the cause you gave:
"Most likely in real life it uses trim change rate velocity and trim change rate acceleration to determine if the trim will go over a 2 degree difference using
much less than a 1 second sample rate. For flight sim, this would be an overboard way to do it."

Also in respect of this matter, maybe the model has not implemented very accurate or small steps for the trim so that your previous code
was not responding well.
For now I will test your code and thank you again for all.
BTW the aircraft that will use the gauge is the Simmer's Sky/SMS Overland freeware MD-11, which is IMHO kind of nice.
All the best to you.
 
Back
Top