Thread Tools
This thread is privately moderated by mikeshellim, who may elect to delete unwanted replies.
Mar 13, 2017, 04:24 AM
Registered User
mikeshellim's Avatar

Differential without GVARs

GVARs are a precious resource

Gvars are the great unsung heroes of OpenTx. They're perfect for storing configuration parameters, and the Gvars menu provides a nice user-friendly front end.

However, gvars are a limited resource - only nine are available. If you run out of gvars, you'll find yourself having to delve into the Mixers menu to configure your model. So anything which saves on unnecessary use of gvars is to be welcomed. Which is where Diff comes in...

In order to implement aileron or flap differential, the standard method is to specify a gvar in the Diff field:

CH01 (RtAil)   aileron servo channel 
    [I3]Ail Weight(+100%) NoTrim Diff(GV8) [Aileron]
In the above case, a gvar makes sense, as it allows diff to be adjusted easily in the GVARS menu. But consider the following code, which allows diff to be adjusted using the rudder trim:

CH01 (RtAil)   aileron servo channel 
    [I3]Ail Weight(+100%) NoTrim Diff(GV8) [Aileron]  GV8 is set via SF3
CH15 (Diff)
    TrmR Weight(+100%) NoTrim Curve(3) [DifAdj]  TrmR sets diff value
    Adjust GV8 <= CH15  binds GV8 to CH15
Note that SF3 updates GV8 automatically with the value of the rudder trim. There is no need to set GV8 manually, yet it still takes up a precious line in the Gvars menu. Repeat this for flap diff and you have two wasted gvars.

Using mixes to calculate downward travel of ailerons and flaps

Because of this, I decided to explore an alternative method of implementing diff. I felt it should be possible to do using mixers, with OpenTx performing the necessary calculations to implement not just diff, but also diff suppression and reverse diff.

The method involves splitting the aileron input into separate 'up' and 'down' mixes.
  • The 'up' mix is not affected by diff, and is simply the value of the aileron input - I won't consider it further for now.
  • The 'down' mix needs a bit more thought. Flaps and ailerons are considered separately.

Flap down travel

The down-travel for flaps is straightforward:
Flap-Down = (A2F * (100-Diff)) (Equation 1)
A2F = aileron to flap mix
Diff = aileron diff between 0 and 100%
Aileron down travel

Aileron down-travel is more complicated as it takes into account diff, crow position and reverse diff.

When crow is off, the aileron down travel is reduced according to the value of diff. As crow is deployed, two effects occur, both of which increase the downward travel component: first, diff reduces to zero, and secondly reverse diff kicks in.
Ail-Down = Ail * (100% - (Diff * (100%-Crow)) + (RevDiff*Crow))
Ail-down = Ail * (100%-Diff + Crow(Diff+RevDiff)) (Equation 2)
Ail = aileron input
Diff = aileron diff between 0 and 100%
Crow = crow deployment between 0 and 100%
RevDiff = user specified (via GV6) extra downward aileron movement, increases from zero as spoiler deployed.

Implementation using mixers

The next task is to implement the down-travel mixes, according to equations 1 & 2 above. I'll reserve a couple of high mixes for these, and use OpenTx to perform the arithmetic:
  • Addition is implemented either (a) via an 'ADD' mixer line, or (b) by specifying a mixer offset.
  • Multiplication is implemented via a 'MULT' mixer line
  • Negation is implemented by setting weight to -100

In the code which follows,
  • CH13 is the Diff value from the rudder trim.
  • CH14 Implements equation 2 for down aileron movement.
  • CH15 implements equation 1 for down flap movement.
  • CH16 is the crow stick value, -100 is full crow, +100 is crow off.
  • GV6 is RevDiff

CH13 (Diff)  Ouputs diff value, according to Rudder trim
    TrmR Weight(+100%) NoTrim Curve(3) [DifAdj] Source = rudder trim

CH14 (DnAil)  Ouputs down aileron value (equation 2)
    CH13 Weight(+100%) Offset(GV6) [Diff]    (Diff+RevDiff)
 *= CH16 Weight(-50%) Offset(50%) [Crow]   *Crow
 += CH13 Weight(-100%) Offset(100%) [Diff]  +(100 - Diff)
 *= [I3]Ail Weight(+100%) NoTrim [Ail]     *Ail

CH15 (DnA2F)  Ouputs down flap value (equation 1)
    CH13 Weight(-100%) Offset(100%) [DifAdj]    (100 - Diff)
 *= [I3]Ail Weight(100%) NoTrim [Ail]    *Ail

CH16 (Crow)  Ouputs raw crow value in range -100 to +100
    MAX Weight(+100%) [Fixed]  default = crow off 
 := Thr Weight(+100%) Flight mode(Landing) [Thr]  Crow value (over-rides line above)
The servo channels

Putting it all together:

The right aileron channel starts like this:
CH01 (RtAil) 
    [I3]Ail Weight(+100%) NoTrim Function(x>0) [UpAil] func 'x>0' so active with RIGHT ail only
 += CH14 Weight(+100%) Function(x<0) [DnAil] func 'x<0' so active with LEFT ail only
 += CH21 Weight(+100%) [AilTrm]
The right flap channel starts like this (differences from ailerons are highlighted):
CH03 (RtFlap)
    [I3]Ail Weight(GV5) NoTrim Function(x>0) [RollUp]   GV5 is Ail2Flap mix
 += CH15 Weight(GV5) Function(x<0) [RollDn]
 += CH21 Weight(GV5) [AilTrm]


On my F3X setups, the modification saves 2 gvars at the cost of 2 or 3 mixers depending on the setup. The cost/benefit for other setups will vary.

The solution puts me in a bit of a dilemma. It works very well, however it's not obvious to the casual observer how it works, and I've always designed my setups for ease of maintenance. So I'm not quite ready to include this solution in my F3X templates - but there's nothing to stop you doing so! Get experimenting, and push the boundaries!!


Mike's OpenTx Clinic - your source for F3X templates
Mike's other blog - OpenTx chatter and tips
Glider Simulator a great testing and simulation tool by 'MiamiMike'.
Last edited by mikeshellim; Mar 22, 2017 at 08:21 PM.
Sign up now
to remove ads between posts