Update Reverser System

This commit is contained in:
Joshua Davidson 2017-05-23 22:57:58 -04:00
parent 1b93911ff0
commit 3612cfa85c
9 changed files with 150 additions and 75 deletions

View file

@ -636,11 +636,11 @@
<keyboard> <keyboard>
<key n="127"> <key n="127">
<name>DEL</name> <name>DEL</name>
<desc>REV MSG</desc> <desc>Simple Engage/Disengage reversers</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
gui.popupTip("Use w to activate reverse thrust, and q to deactivate reverse thrust."); systems.toggleFastRevThrust();
</script> </script>
</binding> </binding>
</key> </key>
@ -650,7 +650,7 @@
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
systems.un_rev_thrust(); systems.unRevThrust();
</script> </script>
</binding> </binding>
</key> </key>
@ -660,7 +660,7 @@
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
systems.do_rev_thrust(); systems.doRevThrust();
</script> </script>
</binding> </binding>
</key> </key>
@ -670,7 +670,7 @@
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
systems.do_idle_thrust(); systems.doIdleThrust();
</script> </script>
</binding> </binding>
</key> </key>

View file

@ -59,6 +59,10 @@
<halign>left</halign> <halign>left</halign>
<label>E - Set Idle Thrust</label> <label>E - Set Idle Thrust</label>
</text> </text>
<text>
<halign>left</halign>
<label>DEL - Toggle Reverse Thrust</label>
</text>
<text> <text>
<halign>left</halign> <halign>left</halign>
<label>CTRL + B - Cycle Spoilers</label> <label>CTRL + B - Cycle Spoilers</label>

View file

@ -2132,13 +2132,7 @@
<name>Engine 1 throttle lever</name> <name>Engine 1 throttle lever</name>
<type>rotate</type> <type>rotate</type>
<object-name>thr_l</object-name> <object-name>thr_l</object-name>
<condition> <property>controls/engines/engine[0]/throttle-lever</property>
<not-equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>1</value>
</not-equals>
</condition>
<property>controls/engines/engine[0]/throttle-pos</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>10</dep></entry> <entry><ind>0.00000</ind><dep>10</dep></entry>
<entry><ind>0.59999</ind><dep>33</dep></entry> <entry><ind>0.59999</ind><dep>33</dep></entry>
@ -2168,16 +2162,10 @@
<name>Engine 1 throttle lever rev</name> <name>Engine 1 throttle lever rev</name>
<type>rotate</type> <type>rotate</type>
<object-name>thr_l</object-name> <object-name>thr_l</object-name>
<condition> <property>controls/engines/engine[0]/throttle-rev</property>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>1</value>
</equals>
</condition>
<property>controls/engines/engine[0]/throttle-pos</property>
<interpolation> <interpolation>
<entry><ind>0.00</ind><dep> 0</dep></entry> <entry><ind>0.00</ind><dep> 0</dep></entry>
<entry><ind>0.25</ind><dep>-10</dep></entry> <entry><ind>0.50</ind><dep>-10</dep></entry>
</interpolation> </interpolation>
<axis> <axis>
<x>0</x> <x>0</x>
@ -2221,13 +2209,7 @@
<name>Engine 2 throttle lever</name> <name>Engine 2 throttle lever</name>
<type>rotate</type> <type>rotate</type>
<object-name>thr_r</object-name> <object-name>thr_r</object-name>
<condition> <property>controls/engines/engine[1]/throttle-lever</property>
<not-equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>1</value>
</not-equals>
</condition>
<property>controls/engines/engine[1]/throttle-pos</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>10</dep></entry> <entry><ind>0.00000</ind><dep>10</dep></entry>
<entry><ind>0.59999</ind><dep>33</dep></entry> <entry><ind>0.59999</ind><dep>33</dep></entry>
@ -2257,16 +2239,10 @@
<name>Engine 2 throttle lever rev</name> <name>Engine 2 throttle lever rev</name>
<type>rotate</type> <type>rotate</type>
<object-name>thr_r</object-name> <object-name>thr_r</object-name>
<condition> <property>controls/engines/engine[1]/throttle-rev</property>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>1</value>
</equals>
</condition>
<property>controls/engines/engine[1]/throttle-pos</property>
<interpolation> <interpolation>
<entry><ind>0.00</ind><dep> 0</dep></entry> <entry><ind>0.00</ind><dep> 0</dep></entry>
<entry><ind>0.25</ind><dep>-10</dep></entry> <entry><ind>0.50</ind><dep>-10</dep></entry>
</interpolation> </interpolation>
<axis> <axis>
<x>0</x> <x>0</x>

View file

@ -931,7 +931,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos1</object-name> <object-name>thrpos1</object-name>
<property>/controls/engines/engine[0]/throttle</property> <property>/controls/engines/engine[0]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>-12</dep></entry> <entry><ind>0.00000</ind><dep>-12</dep></entry>
<entry><ind>0.23350</ind><dep> 53</dep></entry> <entry><ind>0.23350</ind><dep> 53</dep></entry>
@ -962,7 +962,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos2</object-name> <object-name>thrpos2</object-name>
<property>/controls/engines/engine[1]/throttle</property> <property>/controls/engines/engine[1]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>-12</dep></entry> <entry><ind>0.00000</ind><dep>-12</dep></entry>
<entry><ind>0.23350</ind><dep> 53</dep></entry> <entry><ind>0.23350</ind><dep> 53</dep></entry>

View file

@ -1137,7 +1137,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos1</object-name> <object-name>thrpos1</object-name>
<property>/controls/engines/engine[0]/throttle</property> <property>/controls/engines/engine[0]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>-10</dep></entry> <entry><ind>0.00000</ind><dep>-10</dep></entry>
<entry><ind>0.19560</ind><dep> 28</dep></entry> <entry><ind>0.19560</ind><dep> 28</dep></entry>
@ -1169,7 +1169,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos2</object-name> <object-name>thrpos2</object-name>
<property>/controls/engines/engine[1]/throttle</property> <property>/controls/engines/engine[1]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>-10</dep></entry> <entry><ind>0.00000</ind><dep>-10</dep></entry>
<entry><ind>0.19560</ind><dep> 28</dep></entry> <entry><ind>0.19560</ind><dep> 28</dep></entry>

View file

@ -935,7 +935,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos1</object-name> <object-name>thrpos1</object-name>
<property>/controls/engines/engine[0]/throttle</property> <property>/controls/engines/engine[0]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep> -2</dep></entry> <entry><ind>0.00000</ind><dep> -2</dep></entry>
<entry><ind>0.23350</ind><dep> 72</dep></entry> <entry><ind>0.23350</ind><dep> 72</dep></entry>
@ -966,7 +966,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos2</object-name> <object-name>thrpos2</object-name>
<property>/controls/engines/engine[1]/throttle</property> <property>/controls/engines/engine[1]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep> -2</dep></entry> <entry><ind>0.00000</ind><dep> -2</dep></entry>
<entry><ind>0.23350</ind><dep> 72</dep></entry> <entry><ind>0.23350</ind><dep> 72</dep></entry>

View file

@ -1137,7 +1137,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos1</object-name> <object-name>thrpos1</object-name>
<property>/controls/engines/engine[0]/throttle</property> <property>/controls/engines/engine[0]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>05</dep></entry> <entry><ind>0.00000</ind><dep>05</dep></entry>
<entry><ind>0.19560</ind><dep>33</dep></entry> <entry><ind>0.19560</ind><dep>33</dep></entry>
@ -1169,7 +1169,7 @@
<animation> <animation>
<type>rotate</type> <type>rotate</type>
<object-name>thrpos2</object-name> <object-name>thrpos2</object-name>
<property>/controls/engines/engine[1]/throttle</property> <property>/controls/engines/engine[1]/throttle-lever</property>
<interpolation> <interpolation>
<entry><ind>0.00000</ind><dep>05</dep></entry> <entry><ind>0.00000</ind><dep>05</dep></entry>
<entry><ind>0.19560</ind><dep>33</dep></entry> <entry><ind>0.19560</ind><dep>33</dep></entry>

View file

@ -252,7 +252,7 @@ setlistener("/systems/pneumatic/start-psi", func {
} }
}); });
var do_idle_thrust = func { var doIdleThrust = func {
setprop("/controls/engines/engine[0]/throttle", 0.0); setprop("/controls/engines/engine[0]/throttle", 0.0);
setprop("/controls/engines/engine[1]/throttle", 0.0); setprop("/controls/engines/engine[1]/throttle", 0.0);
} }
@ -260,17 +260,8 @@ var do_idle_thrust = func {
######################### #########################
# Reverse Thrust System # # Reverse Thrust System #
######################### #########################
var do_rev_thrust = func {
if ((getprop("/controls/engines/engine[0]/reverser") == "1") and (getprop("/controls/engines/engine[1]/reverser") == "1") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) { var toggleFastRevThrust = func {
var pos1 = getprop("/controls/engines/engine[0]/throttle-pos");
var pos2 = getprop("/controls/engines/engine[1]/throttle-pos");
if (pos1 < 0.5) {
setprop("/controls/engines/engine[0]/throttle-pos", pos1 + 0.167);
}
if (pos2 < 0.5) {
setprop("/controls/engines/engine[1]/throttle-pos", pos2 + 0.167);
}
}
var state1 = getprop("/systems/thrust/state1"); var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2"); var state2 = getprop("/systems/thrust/state2");
if ((state1 == "IDLE") and (state2 == "IDLE") and (getprop("/controls/engines/engine[0]/reverser") == "0") and (getprop("/controls/engines/engine[1]/reverser") == "0") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) { if ((state1 == "IDLE") and (state2 == "IDLE") and (getprop("/controls/engines/engine[0]/reverser") == "0") and (getprop("/controls/engines/engine[1]/reverser") == "0") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) {
@ -278,35 +269,69 @@ var do_rev_thrust = func {
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4); interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1); setprop("/controls/engines/engine[0]/reverser", 1);
setprop("/controls/engines/engine[1]/reverser", 1); setprop("/controls/engines/engine[1]/reverser", 1);
setprop("/controls/engines/engine[0]/throttle-pos", 0); setprop("/controls/engines/engine[0]/throttle-rev", 0.5);
setprop("/controls/engines/engine[1]/throttle-pos", 0); setprop("/controls/engines/engine[1]/throttle-rev", 0.5);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
} else if ((getprop("/controls/engines/engine[0]/reverser") == "1") or (getprop("/controls/engines/engine[1]/reverser") == "1") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
}
}
var doRevThrust = func {
if ((getprop("/controls/engines/engine[0]/reverser") == "1") and (getprop("/controls/engines/engine[1]/reverser") == "1") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) {
var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
if (pos1 < 0.5) {
setprop("/controls/engines/engine[0]/throttle-rev", pos1 + 0.167);
}
if (pos2 < 0.5) {
setprop("/controls/engines/engine[1]/throttle-rev", pos2 + 0.167);
}
}
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2");
if ((state1 == "IDLE") and (state2 == "IDLE") and (getprop("/controls/engines/engine[0]/reverser") == "0") and (getprop("/controls/engines/engine[1]/reverser") == "0") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1);
setprop("/controls/engines/engine[1]/reverser", 1);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14); setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14); setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
} }
} }
var un_rev_thrust = func { var unRevThrust = func {
if ((getprop("/controls/engines/engine[0]/reverser") == "1") and (getprop("/controls/engines/engine[1]/reverser") == "1")) { if ((getprop("/controls/engines/engine[0]/reverser") == "1") or (getprop("/controls/engines/engine[1]/reverser") == "1")) {
var pos1 = getprop("/controls/engines/engine[0]/throttle-pos"); var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-pos"); var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
if (pos1 > 0.0) { if (pos1 > 0.0) {
setprop("/controls/engines/engine[0]/throttle-pos", pos1 - 0.167); setprop("/controls/engines/engine[0]/throttle-rev", pos1 - 0.167);
} else { } else {
un_rev_thrust_b(); unRevThrust_b();
} }
if (pos2 > 0.0) { if (pos2 > 0.0) {
setprop("/controls/engines/engine[1]/throttle-pos", pos2 - 0.167); setprop("/controls/engines/engine[1]/throttle-rev", pos2 - 0.167);
} else { } else {
un_rev_thrust_b(); unRevThrust_b();
} }
} }
} }
var un_rev_thrust_b = func { var unRevThrust_b = func {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/controls/engines/engine[0]/throttle-pos", 0);
setprop("/controls/engines/engine[1]/throttle-pos", 0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0); setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0); setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0); setprop("/controls/engines/engine[0]/reverser", 0);

View file

@ -244,16 +244,77 @@
<name>Throttle L</name> <name>Throttle L</name>
<type>gain</type> <type>gain</type>
<gain>1</gain> <gain>1</gain>
<enable> <update-interval-secs type="double">0.05</update-interval-secs>
<input>
<condition> <condition>
<equals> <equals>
<property>/controls/engines/engine[0]/reverser</property> <property>/controls/engines/engine[0]/reverser</property>
<value>0</value> <value>0</value>
</equals> </equals>
</condition> </condition>
</enable> <property>/controls/engines/engine[0]/throttle</property>
</input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>1</value>
</equals>
</condition>
<value>0</value>
</input>
<output>/controls/engines/engine[0]/throttle-lever</output>
</filter>
<filter>
<name>Throttle R</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs> <update-interval-secs type="double">0.05</update-interval-secs>
<input>/controls/engines/engine[0]/throttle</input> <input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
<value>0</value>
</equals>
</condition>
<property>/controls/engines/engine[1]/throttle</property>
</input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
<value>1</value>
</equals>
</condition>
<value>0</value>
</input>
<output>/controls/engines/engine[1]/throttle-lever</output>
</filter>
<filter>
<name>Throttle L</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>0</value>
</equals>
</condition>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
<value>1</value>
</equals>
</condition>
<property>/controls/engines/engine[0]/throttle-rev</property>
</input>
<output>/controls/engines/engine[0]/throttle-pos</output> <output>/controls/engines/engine[0]/throttle-pos</output>
</filter> </filter>
@ -261,16 +322,25 @@
<name>Throttle R</name> <name>Throttle R</name>
<type>gain</type> <type>gain</type>
<gain>1</gain> <gain>1</gain>
<enable> <update-interval-secs type="double">0.05</update-interval-secs>
<input>
<condition> <condition>
<equals> <equals>
<property>/controls/engines/engine[1]/reverser</property> <property>/controls/engines/engine[1]/reverser</property>
<value>0</value> <value>0</value>
</equals> </equals>
</condition> </condition>
</enable> <property>/controls/engines/engine[1]/throttle</property>
<update-interval-secs type="double">0.05</update-interval-secs> </input>
<input>/controls/engines/engine[1]/throttle</input> <input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
<value>1</value>
</equals>
</condition>
<property>/controls/engines/engine[1]/throttle-rev</property>
</input>
<output>/controls/engines/engine[1]/throttle-pos</output> <output>/controls/engines/engine[1]/throttle-pos</output>
</filter> </filter>