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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1137,7 +1137,7 @@
<animation>
<type>rotate</type>
<object-name>thrpos1</object-name>
<property>/controls/engines/engine[0]/throttle</property>
<property>/controls/engines/engine[0]/throttle-lever</property>
<interpolation>
<entry><ind>0.00000</ind><dep>05</dep></entry>
<entry><ind>0.19560</ind><dep>33</dep></entry>
@ -1169,7 +1169,7 @@
<animation>
<type>rotate</type>
<object-name>thrpos2</object-name>
<property>/controls/engines/engine[1]/throttle</property>
<property>/controls/engines/engine[1]/throttle-lever</property>
<interpolation>
<entry><ind>0.00000</ind><dep>05</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[1]/throttle", 0.0);
}
@ -260,17 +260,8 @@ var do_idle_thrust = func {
#########################
# 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 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 toggleFastRevThrust = func {
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)) {
@ -278,35 +269,69 @@ var do_rev_thrust = func {
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("/controls/engines/engine[0]/throttle-pos", 0);
setprop("/controls/engines/engine[1]/throttle-pos", 0);
setprop("/controls/engines/engine[0]/throttle-rev", 0.5);
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[1]/reverser-angle-rad", 3.14);
}
}
var un_rev_thrust = func {
if ((getprop("/controls/engines/engine[0]/reverser") == "1") and (getprop("/controls/engines/engine[1]/reverser") == "1")) {
var pos1 = getprop("/controls/engines/engine[0]/throttle-pos");
var pos2 = getprop("/controls/engines/engine[1]/throttle-pos");
var unRevThrust = func {
if ((getprop("/controls/engines/engine[0]/reverser") == "1") or (getprop("/controls/engines/engine[1]/reverser") == "1")) {
var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
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 {
un_rev_thrust_b();
unRevThrust_b();
}
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 {
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[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[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0);

View file

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