- Messages
- 440
- Country

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.
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 > ! 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 > (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 > 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>
