Wingflexer: Difference between revisions

Jump to navigation Jump to search
151 bytes added ,  28 February 2016
(→‎Wiki articles: Clarification related to animating the wing flex)
Line 130: Line 130:


== How to add to your aircraft ==
== How to add to your aircraft ==
Create a file $YourAircraft/Systems/wingflexer-params.xml which contains the parameters adjusted to your aircraft
Create a file <tt>''[[$FG_ROOT]]/Aircraft/<your aircraft>/Systems/wingflexer-params.xml''</tt> which contains the parameters adjusted to your aircraft:
<?xml version="1.0" encoding="UTF-8"?>
<syntaxhighlight lang="xml">
<PropertyList>
<?xml version="1.0" encoding="UTF-8"?>
    <params>
 
        <m-wing-dry-kg type="double">12000.</m-wing-dry-kg>
<PropertyList>
        <K type="double">259.</K>
 
        <D type="double">12.</D>
<params>
        <fuel-frac type="double">0.375</fuel-frac>
  <m-wing-dry-kg type="double">12000</m-wing-dry-kg>
        <lift-node-lbs alias="/fdm/jsbsim/forces/fbz-aero-lbs"/>
  <K type="double">259</K>
        <fuel-node-1-kg alias="/consumables/fuel/tank/level-kg"/>
  <D type="double">12</D>
        <fuel-node-2-kg alias="/consumables/fuel/tank[1]/level-kg"/>
  <fuel-frac type="double">0.375</fuel-frac>
        <fuel-node-3-kg type="double">0.</fuel-node-3-kg>
  <lift-node-lbs alias="/fdm/jsbsim/forces/fbz-aero-lbs"/>
        <fuel-node-4-kg type="double">0.</fuel-node-4-kg>
  <fuel-node-1-kg alias="/consumables/fuel/tank/level-kg"/>
    </params>
  <fuel-node-2-kg alias="/consumables/fuel/tank[1]/level-kg"/>
</PropertyList>
  <fuel-node-3-kg type="double">0</fuel-node-3-kg>
  <fuel-node-4-kg type="double">0</fuel-node-4-kg>
</params>
 
</PropertyList>
</syntaxhighlight>
 
Also adjust the property node aliases for the wing fuel tanks. Wingflexer supports up to four tanks in total. Since we're currently only solving one equation and hence get only one deflection which is used for both wings, we have to average the wing mass. Internally, m_fuel is simply the sum of all given fuel nodes,  
Also adjust the property node aliases for the wing fuel tanks. Wingflexer supports up to four tanks in total. Since we're currently only solving one equation and hence get only one deflection which is used for both wings, we have to average the wing mass. Internally, m_fuel is simply the sum of all given fuel nodes,  
  m_fuel = fuel-node-1-kg + fuel-node-2-kg + fuel-node-3-kg + fuel-node-4-kg
m_fuel = fuel-node-1-kg + fuel-node-2-kg + fuel-node-3-kg + fuel-node-4-kg
so you must include the weighting factor in fuel-frac (e.g. 1/2 if you provide 2 fuel nodes). If you have more than 4 wing tanks in total, use another property rule to compute the average.
so you must include the weighting factor in fuel-frac (e.g. 1/2 if you provide 2 fuel nodes). If you have more than 4 wing tanks in total, use another property rule to compute the average.


In $yourAircraft-set.xml, in <systems> section, load the parameters and the wingflexer module:
In your aircraft's [[Aircraft-set.xml|*-set.xml file]], in <code><nowiki><systems></nowiki></code> section, load the parameters and the wingflexer module:
<systems>
<syntaxhighlight lang="xml">
    <wingflexer include="Systems/wingflexer-params.xml"/>
<systems>
    <property-rule n="100">
  <wingflexer include="Systems/wingflexer-params.xml"/>
        <name>wing flexer property rule</name>
  <property-rule n="100">
        <path>Aircraft/Generic/wingflexer.xml</path>
    <name>wing flexer property rule</name>
    </property-rule>
    <path>Aircraft/Generic/wingflexer.xml</path>
</systems>
  </property-rule>
</systems>
</syntaxhighlight>


The wingflexer writes the deflection to /sim/systems/wingflexer/z-m.
The wingflexer writes the deflection to <code>/sim/systems/wingflexer/z-m</code>.
Finally, your model rotate animation has to pick it up and multiply it by z_fac
Finally, your model rotate animation has to pick it up and multiply it by z_fac:
<animation>
<syntaxhighlight lang="xml">
    <type>rotate</type>
<animation>
    <property>sim/systems/wingflexer/z-m</property>
  <type>rotate</type>
    <factor>10.</factor>
  <property>sim/systems/wingflexer/z-m</property>
    ...
  <factor>10</factor>
</animation>
  <!-- ... -->
</animation>
</syntaxhighlight>


If your aircraft uses JSBSim, you're done now. Yasim requires an extra step, described next.
If your aircraft uses JSBSim, you're done now. YASim requires an extra step, described next.


== Yasim ==
== Yasim ==

Navigation menu