Howto:Implement a Fly-By-Wire System for Airliners: Difference between revisions

no edit summary
m (→‎/Nasal/fbw.nas: start adding helpers)
No edit summary
Line 43: Line 43:


* Automatically holds the current aircraft pitch and roll degree when stick is brought back to the center! < NEW!
* Automatically holds the current aircraft pitch and roll degree when stick is brought back to the center! < NEW!
* ALPHA PROTECTION doesn't allow the plane to pitch up higher than 20 degrees < NEW!




Line 215: Line 217:


me.update_elevator();
me.update_elevator();
## ALPHA PROTECTION
if (pitch > 20) {
setprop("/controls/fbw/alpha-protect", 1);
setprop("/controls/fbw/alpha-limit", 22);
} elsif (pitch < -20) {
setprop("/controls/fbw/alpha-protect", 1);
setprop("/controls/fbw/alpha-limit", -22);
} else setprop("/controls/fbw/alpha-protect", 0);


## AUTO-STABILIZATION
## AUTO-STABILIZATION
Line 480: Line 493:
      <u_max>1.0</u_max>  <!-- maximum output clamp -->
      <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
    </config>
  </pid-controller>
<!-- =============================================================== -->
<!-- Alpha Protection -->
<!-- =============================================================== -->
<pid-controller>
    <name>Alpha Protection</name>
    <debug>false</debug>
    <enable>
<prop>/controls/fbw/alpha-protect</prop>
    </enable>
    <input>
    <prop>/orientation/pitch-deg</prop>
  </input>
  <reference>
    <prop>/controls/fbw/alpha-limit</prop>
  </reference>
  <output>
    <prop>/controls/flight/elevator-trim</prop>
  </output>
  <config>
    <Kp>-0.05</Kp>      <!-- proportional gain -->
    <beta>1.0</beta>    <!-- input value weighing factor -->
    <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
    <gamma>0.0</gamma>  <!-- input value weighing factor for -->
                        <!-- unfiltered derivative error -->
    <Ti>1.0</Ti>        <!-- integrator time -->
    <Td>0.00001</Td>    <!-- derivator time -->
    <u_min>-1.0</u_min> <!-- minimum output clamp -->
    <u_max>1.0</u_max>  <!-- maximum output clamp -->
  </config>
    </pid-controller>
    </pid-controller>


449

edits