Howto:Implement wing flex

From FlightGear wiki
Jump to navigation Jump to search
Wing flex as seen on the Boeing 747-400.

Wing flex is the flexing of wings on aircraft, due to lift and fuselage load. FlightGear is able to show realistic wing flex. Currently the Boeing 787, A330-200, 747-400, MD-11, Citation II and CRJ-900 are equipped with flexing wings.

This article describes a simple approach to model static wing flex. Using this approach, the wing will bend realistically under load, but it will not oscillate after load changes, e.g., on hard touchdown. For a more sophisticated model for dynamic wing flex, please see the Wingflexer article.

Model

A few edits have to be made to the aircraft model. Each wing has to be cut into multiple sections. The more sections, the smoother the wing flex. Be carefull that you do not cut through flaps or engines. Naming our wing sections, from fuselage to wing tip: wing.1, wing.2 and wing.3.

Measure the coordinates of the start of each new wing section, you will need them to animate the wings.

Animation

The following lines have to be added to the aircraft model .xml file. These lines are used with three wing sections, and a JSBSim FDM.

 <animation>
  <type>rotate</type>
  <object-name>LeftWing.1</object-name>
  <object-name>LeftWing.2</object-name>
  <object-name>LeftWing.3</object-name>
  <property>fdm/jsbsim/aero/coefficient/CLalpha</property>
  <factor>-0.0000045</factor>
  <offset-deg>0</offset-deg>   
  <center>
   <x-m> 0.00</x-m>
   <y-m>-4.00</y-m>
   <z-m>-1.70</z-m>
  </center>
  <axis>
   <x>1.0</x>
   <y>0.0</y>
   <z>0.0</z>
  </axis>
 </animation>
 
 <animation>
  <type>rotate</type>
  <object-name>LeftWing.2</object-name>
  <object-name>LeftWing.3</object-name>
  <property>fdm/jsbsim/aero/coefficient/CLalpha</property>
  <factor>-0.0000045</factor>
  <offset-deg>0</offset-deg>   
  <center>
   <x-m> 0.00</x-m>
   <y-m>-8.00</y-m>
   <z-m>-1.50</z-m>
  </center>
  <axis>
   <x>1.0</x>
   <y>0.0</y>
   <z>0.0</z>
  </axis>
 </animation>
 
 <animation>
  <type>rotate</type>
  <object-name>LeftWing.3</object-name>
  <property>fdm/jsbsim/aero/coefficient/CLalpha</property>
  <factor>-0.0000045</factor>
  <offset-deg>0</offset-deg>
  <center>
   <x-m>  0.00</x-m>
   <y-m>-12.25</y-m>
   <z-m> -1.25</z-m>
  </center>
  <axis>
   <x>1.0</x>
   <y>0.0</y>
   <z>0.0</z>
  </axis>
 </animation>

You probably need to add a lot more objects to each section (like engines, flaps, ailerons etc.) and also change the center coordinates according to your aircraft. For the right wing, just change the sign of the center <y-m> coordinate and the factor value.

JSBSim

JSBSim calculates the lift force of the aircraft. The lift reacts on the G-forces, the velocity and turbulences. The respective property is: fdm/jsbsim/aero/coefficient/CLalpha

YASim

YASim does not calculate wingflex as nice as JSBSim, but a pretty realistic effect can be reached by using the accelerations/pilot-g[0] property instead.

Related content

  • Wingflexer – A newer way to add wing flex, though it still need to be animated much like here