1
0
Fork 0

Control: Simulate thrust reversers properly

This commit is contained in:
Josh Davidson 2021-04-24 13:05:23 -04:00
parent 581dd5a1f6
commit a376044f5c
9 changed files with 374 additions and 328 deletions

View file

@ -6810,7 +6810,7 @@
<binding> <binding>
<command>property-adjust</command> <command>property-adjust</command>
<property>controls/engines/engine[0]/throttle</property> <property>controls/engines/engine[0]/throttle</property>
<step type="double">0.01</step> <step>0.01</step>
<max>1</max> <max>1</max>
</binding> </binding>
</action> </action>
@ -6821,7 +6821,7 @@
<binding> <binding>
<command>property-adjust</command> <command>property-adjust</command>
<property>controls/engines/engine[0]/throttle</property> <property>controls/engines/engine[0]/throttle</property>
<step type="double">-0.01</step> <step>-0.01</step>
<min>0</min> <min>0</min>
</binding> </binding>
</action> </action>
@ -6840,20 +6840,11 @@
<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>
<property>fdm/jsbsim/fcs/reverse-lever[0]</property> <property>fdm/jsbsim/fadec/reverse-lever[0]</property>
<factor>-3.5</factor>
<axis>
<object-name>trim.axis</object-name>
</axis>
</animation>
<animation>
<name>Engine 1 throttle lever rev 2</name>
<type>rotate</type>
<object-name>thr_l</object-name>
<property>fdm/jsbsim/fcs/reverse-thr-lever[0]</property>
<interpolation> <interpolation>
<entry><ind>0.00</ind><dep> 0</dep></entry> <entry><ind>0.00</ind><dep> 0.0</dep></entry>
<entry><ind>0.50</ind><dep>-20</dep></entry> <entry><ind>0.25</ind><dep> -3.5</dep></entry>
<entry><ind>1.00</ind><dep>-23.5</dep></entry>
</interpolation> </interpolation>
<axis> <axis>
<object-name>trim.axis</object-name> <object-name>trim.axis</object-name>
@ -6870,7 +6861,7 @@
<binding> <binding>
<command>property-adjust</command> <command>property-adjust</command>
<property>controls/engines/engine[1]/throttle</property> <property>controls/engines/engine[1]/throttle</property>
<step type="double">0.01</step> <step>0.01</step>
<max>1</max> <max>1</max>
</binding> </binding>
</action> </action>
@ -6881,7 +6872,7 @@
<binding> <binding>
<command>property-adjust</command> <command>property-adjust</command>
<property>controls/engines/engine[1]/throttle</property> <property>controls/engines/engine[1]/throttle</property>
<step type="double">-0.01</step> <step>-0.01</step>
<min>0</min> <min>0</min>
</binding> </binding>
</action> </action>
@ -6900,20 +6891,11 @@
<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>
<property>fdm/jsbsim/fcs/reverse-lever[1]</property> <property>fdm/jsbsim/fadec/reverse-lever[1]</property>
<factor>-3.5</factor>
<axis>
<object-name>trim.axis</object-name>
</axis>
</animation>
<animation>
<name>Engine 2 throttle lever rev 2</name>
<type>rotate</type>
<object-name>thr_r</object-name>
<property>fdm/jsbsim/fcs/reverse-thr-lever[1]</property>
<interpolation> <interpolation>
<entry><ind>0.00</ind><dep> 0</dep></entry> <entry><ind>0.00</ind><dep> 0.0</dep></entry>
<entry><ind>0.50</ind><dep>-20</dep></entry> <entry><ind>0.25</ind><dep> -3.5</dep></entry>
<entry><ind>1.00</ind><dep>-23.5</dep></entry>
</interpolation> </interpolation>
<axis> <axis>
<object-name>trim.axis</object-name> <object-name>trim.axis</object-name>
@ -8168,8 +8150,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.010</character-size> <!-- size (height) im meters --> <character-size>0.010</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.050</max-width> <!-- the maximum width of the text --> <max-width>0.050</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8199,8 +8181,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.010</character-size> <!-- size (height) im meters --> <character-size>0.010</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.060</max-width> <!-- the maximum width of the text --> <max-width>0.060</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8230,8 +8212,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.008</character-size> <!-- size (height) im meters --> <character-size>0.008</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.060</max-width> <!-- the maximum width of the text --> <max-width>0.060</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8261,8 +8243,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.010</character-size> <!-- size (height) im meters --> <character-size>0.010</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.1</character-aspect-ratio> <character-aspect-ratio>1.1</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.060</max-width> <!-- the maximum width of the text --> <max-width>0.060</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8292,8 +8274,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.010</character-size> <!-- size (height) im meters --> <character-size>0.010</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.060</max-width> <!-- the maximum width of the text --> <max-width>0.060</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8323,8 +8305,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.008</character-size> <!-- size (height) im meters --> <character-size>0.008</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.060</max-width> <!-- the maximum width of the text --> <max-width>0.060</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8354,8 +8336,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.010</character-size> <!-- size (height) im meters --> <character-size>0.010</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.040</max-width> <!-- the maximum width of the text --> <max-width>0.040</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8531,8 +8513,8 @@
<draw-alignment type="bool">false</draw-alignment> <draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox> <draw-boundingbox type="bool">false</draw-boundingbox>
<font>led.txf</font> <font>led.txf</font>
<character-size type="double">0.007</character-size> <character-size>0.007</character-size>
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <max-height>0.012</max-height>
<max-width>0.040</max-width> <max-width>0.040</max-width>
<font-resolution> <font-resolution>
@ -8562,8 +8544,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.007</character-size> <!-- size (height) im meters --> <character-size>0.007</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.040</max-width> <!-- the maximum width of the text --> <max-width>0.040</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8595,8 +8577,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.007</character-size> <!-- size (height) im meters --> <character-size>0.007</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.040</max-width> <!-- the maximum width of the text --> <max-width>0.040</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>
@ -8626,8 +8608,8 @@
<draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center --> <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
<draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box --> <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
<font>led.txf</font> <!-- The font file name, relative to data/Fonts --> <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
<character-size type="double">0.007</character-size> <!-- size (height) im meters --> <character-size>0.007</character-size> <!-- size (height) im meters -->
<character-aspect-ratio type="double">1.0</character-aspect-ratio> <character-aspect-ratio>1.0</character-aspect-ratio>
<max-height>0.012</max-height> <!-- the maximum height of the text --> <max-height>0.012</max-height> <!-- the maximum height of the text -->
<max-width>0.040</max-width> <!-- the maximum width of the text --> <max-width>0.040</max-width> <!-- the maximum width of the text -->
<font-resolution> <font-resolution>

View file

@ -996,13 +996,13 @@ input = {
slatLocked: "/fdm/jsbsim/fcs/slat-locked", slatLocked: "/fdm/jsbsim/fcs/slat-locked",
# N1 parameters # N1 parameters
N1_1: "/ECAM/Upper/N1[0]", N1_1: "/instrumentation/upper-ecam/n1[0]",
N1_2: "/ECAM/Upper/N1[1]", N1_2: "/instrumentation/upper-ecam/n1[1]",
N1_actual_1: "/engines/engine[0]/n1-actual", N1_actual_1: "/engines/engine[0]/n1-actual",
N1_actual_2: "/engines/engine[1]/n1-actual", N1_actual_2: "/engines/engine[1]/n1-actual",
N1_lim: "/ECAM/Upper/N1ylim", N1_lim: "/instrumentation/upper-ecam/n1-limit",
N1thr_1: "/ECAM/Upper/N1thr[0]", N1thr_1: "/instrumentation/upper-ecam/n1-thr[0]",
N1thr_2: "/ECAM/Upper/N1thr[1]", N1thr_2: "/instrumentation/upper-ecam/n1-thr[1]",
# N2 parameters # N2 parameters
N2_actual_1: "/engines/engine[0]/n2-actual", N2_actual_1: "/engines/engine[0]/n2-actual",

View file

@ -91,6 +91,7 @@ var systemsInit = func() {
systems.FUEL.init(); systems.FUEL.init();
systems.ADIRS.init(); systems.ADIRS.init();
systems.eng_init(); systems.eng_init();
systems.ENGINE.init();
systems.FADEC.init(); systems.FADEC.init();
systems.APUController.init(); systems.APUController.init();
systems.BrakeSys.reset(); systems.BrakeSys.reset();

View file

@ -17,121 +17,114 @@ var eng_common_init = func {
manStart[1].setValue(0); manStart[1].setValue(0);
} }
# Engine thrust commands var ENGINE = {
reverseLever: [props.globals.getNode("/controls/engines/engine[0]/reverse-lever"), props.globals.getNode("/controls/engines/engine[1]/reverse-lever")],
reverseLeverTemp: [0, 0],
throttle: [props.globals.getNode("/controls/engines/engine[0]/throttle"), props.globals.getNode("/controls/engines/engine[1]/throttle")],
init: func() {
me.reverseLever[0].setBoolValue(0);
me.reverseLever[1].setBoolValue(0);
},
};
# Engine Sim Control Stuff
var doIdleThrust = func { var doIdleThrust = func {
# Idle does not respect selected engines, because it is used to respond # Idle does not respect selected engines, because it is used to respond
# to "Retard" and both engines must be idle for spoilers to deploy # to "Retard" and both engines must be idle for spoilers to deploy
pts.Controls.Engines.Engine.throttle[0].setValue(0); ENGINE.throttle[0].setValue(0);
pts.Controls.Engines.Engine.throttle[1].setValue(0); ENGINE.throttle[1].setValue(0);
} }
var doClThrust = func { var doClThrust = func {
if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { if (pts.Sim.Input.Selected.engine[0].getBoolValue()) {
pts.Controls.Engines.Engine.throttle[0].setValue(0.63); ENGINE.throttle[0].setValue(0.63);
} }
if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { if (pts.Sim.Input.Selected.engine[1].getBoolValue()) {
pts.Controls.Engines.Engine.throttle[1].setValue(0.63); ENGINE.throttle[1].setValue(0.63);
} }
} }
var doMctThrust = func { var doMctThrust = func {
if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { if (pts.Sim.Input.Selected.engine[0].getBoolValue()) {
pts.Controls.Engines.Engine.throttle[0].setValue(0.8); ENGINE.throttle[0].setValue(0.8);
} }
if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { if (pts.Sim.Input.Selected.engine[1].getBoolValue()) {
pts.Controls.Engines.Engine.throttle[1].setValue(0.8); ENGINE.throttle[1].setValue(0.8);
} }
} }
var doTogaThrust = func { var doTogaThrust = func {
if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { if (pts.Sim.Input.Selected.engine[0].getBoolValue()) {
pts.Controls.Engines.Engine.throttle[0].setValue(1); ENGINE.throttle[0].setValue(1);
} }
if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { if (pts.Sim.Input.Selected.engine[1].getBoolValue()) {
pts.Controls.Engines.Engine.throttle[1].setValue(1); ENGINE.throttle[1].setValue(1);
} }
} }
# Reverse Thrust System - TODO: Totally f*cked! Redo the whole d*mn thing! # Intentionally not using + or -, floating point error would be BAD
var toggleFastRevThrust = func { # We just based it off Engine 1
#if (systems.FADEC.detentText[0].getValue() == "IDLE" and systems.FADEC.detentText[1].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverseCmd[0].getValue() == 0 and pts.Controls.Engines.Engine.reverseCmd[1].getValue() == 0 and pts.Gear.wow[1].getValue() == 1 and pts.Gear.wow[2].getValue() == 1) { var doRevThrust = func() {
# if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { ENGINE.reverseLeverTemp[0] = ENGINE.reverseLever[0].getValue();
# interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); if ((pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) and systems.FADEC.maxDetent.getValue() == 0) {
# pts.Controls.Engines.Engine.reverseCmd[0].setValue(1); if (ENGINE.reverseLeverTemp[0] < 0.25) {
# pts.Controls.Engines.Engine.reverseLever[0].setValue(0.65); ENGINE.reverseLever[0].setValue(0.25);
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[0].setValue(3.14); ENGINE.reverseLever[1].setValue(0.25);
# } } else if (ENGINE.reverseLeverTemp[0] < 0.5) {
# if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { ENGINE.reverseLever[0].setValue(0.5);
# interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4); ENGINE.reverseLever[1].setValue(0.5);
# pts.Controls.Engines.Engine.reverseCmd[1].setValue(1); } else if (ENGINE.reverseLeverTemp[0] < 0.75) {
# pts.Controls.Engines.Engine.reverseLever[1].setValue(0.65); ENGINE.reverseLever[0].setValue(0.75);
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[1].setValue(3.14); ENGINE.reverseLever[1].setValue(0.75);
# } } else if (ENGINE.reverseLeverTemp[0] < 1.0) {
#} else if (pts.Controls.Engines.Engine.reverseCmd[0].getValue() == 1 or pts.Controls.Engines.Engine.reverseCmd[1].getValue() == 1) { ENGINE.reverseLever[0].setValue(1.0);
# interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); ENGINE.reverseLever[1].setValue(1.0);
# interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); }
# pts.Controls.Engines.Engine.reverseLever[0].setValue(0); ENGINE.throttle[0].setValue(0);
# pts.Controls.Engines.Engine.reverseLever[1].setValue(0); ENGINE.throttle[1].setValue(0);
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[0].setValue(0); } else {
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[1].setValue(0); ENGINE.reverseLever[0].setValue(0);
# pts.Controls.Engines.Engine.reverseCmd[0].setValue(0); ENGINE.reverseLever[1].setValue(0);
# pts.Controls.Engines.Engine.reverseCmd[1].setValue(0); }
#}
} }
var doRevThrust = func { var unRevThrust = func() {
#if (pts.Gear.wow[1].getValue() != 1 and pts.Gear.wow[2].getValue() != 1) { ENGINE.reverseLeverTemp[0] = ENGINE.reverseLever[0].getValue();
# # Can't select reverse if not on the ground if ((pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) and systems.FADEC.maxDetent.getValue() == 0) {
# return; if (ENGINE.reverseLeverTemp[0] > 0.75) {
#} ENGINE.reverseLever[0].setValue(0.75);
#if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverseCmd[0].getValue() == 1) { ENGINE.reverseLever[1].setValue(0.75);
# var pos = pts.Controls.Engines.Engine.reverseLever[0].getValue(); } else if (ENGINE.reverseLeverTemp[0] > 0.5) {
# if (pos < 0.649) { ENGINE.reverseLever[0].setValue(0.5);
# pts.Controls.Engines.Engine.reverseLever[0].setValue(pos + 0.15); ENGINE.reverseLever[1].setValue(0.5);
# } } else if (ENGINE.reverseLeverTemp[0] > 0.25) {
#} ENGINE.reverseLever[0].setValue(0.25);
#if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverseCmd[1].getValue() == 1) { ENGINE.reverseLever[1].setValue(0.25);
# var pos = pts.Controls.Engines.Engine.reverseLever[1].getValue(); } else if (ENGINE.reverseLeverTemp[0] > 0) {
# if (pos < 0.649) { ENGINE.reverseLever[0].setValue(0);
# pts.Controls.Engines.Engine.reverseLever[1].setValue(pos + 0.15); ENGINE.reverseLever[1].setValue(0);
# } }
#} ENGINE.throttle[0].setValue(0);
# ENGINE.throttle[1].setValue(0);
#if (pts.Sim.Input.Selected.engine[0].getBoolValue() and systems.FADEC.detentText[0].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverseCmd[0].getValue() == 0) { } else {
# interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); ENGINE.reverseLever[0].setValue(0);
# pts.Controls.Engines.Engine.reverseLever[0].setValue(0.05); ENGINE.reverseLever[1].setValue(0);
# pts.Controls.Engines.Engine.reverseCmd[0].setValue(1); }
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[0].setValue(3.14);
#}
#if (pts.Sim.Input.Selected.engine[1].getBoolValue() and systems.FADEC.detentText[1].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverseCmd[1].getValue() == 0) {
# interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
# pts.Controls.Engines.Engine.reverseLever[1].setValue(0.05);
# pts.Controls.Engines.Engine.reverseCmd[1].setValue(1);
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[1].setValue(3.14);
#}
} }
var unRevThrust = func { var toggleFastRevThrust = func() {
#if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverseCmd[0].getValue() == 1) { if ((pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) and systems.FADEC.maxDetent.getValue() == 0) {
# var pos = pts.Controls.Engines.Engine.reverseLever[0].getValue(); if (ENGINE.reverseLever[0].getValue() != 0) { # NOT a bool, this way it always closes even if partially open
# if (pos > 0.051) { ENGINE.reverseLever[0].setValue(0);
# pts.Controls.Engines.Engine.reverseLever[0].setValue(pos - 0.15); ENGINE.reverseLever[1].setValue(0);
# } else { } else {
# interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); ENGINE.reverseLever[0].setValue(1);
# pts.Controls.Engines.Engine.reverseLever[0].setValue(0); ENGINE.reverseLever[1].setValue(1);
# pts.Controls.Engines.Engine.reverseCmd[0].setValue(0); }
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[0].setValue(0); ENGINE.throttle[0].setValue(0);
# } ENGINE.throttle[1].setValue(0);
#} } else {
#if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverseCmd[1].getValue() == 1) { ENGINE.reverseLever[0].setValue(0);
# var pos = pts.Controls.Engines.Engine.reverseLever[1].getValue(); ENGINE.reverseLever[1].setValue(0);
# if (pos > 0.051) { }
# pts.Controls.Engines.Engine.reverseLever[1].setValue(pos - 0.15);
# } else {
# interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
# pts.Controls.Engines.Engine.reverseLever[1].setValue(0);
# pts.Controls.Engines.Engine.reverseCmd[1].setValue(0);
# pts.Fdm.JSBsim.Propulsion.Engine.reverseCmdAngle[1].setValue(0);
# }
#}
} }

View file

@ -27,7 +27,6 @@ var FADEC = {
}, },
lvrClb: props.globals.getNode("/fdm/jsbsim/fadec/lvrclb"), lvrClb: props.globals.getNode("/fdm/jsbsim/fadec/lvrclb"),
lvrClbStatus: 0, lvrClbStatus: 0,
togaLk: props.globals.getNode("/fdm/jsbsim/fadec/toga-lk"),
Lock: { Lock: {
thrLockAlert: props.globals.getNode("/fdm/jsbsim/fadec/thr-locked-alert"), thrLockAlert: props.globals.getNode("/fdm/jsbsim/fadec/thr-locked-alert"),
thrLockCmd: props.globals.getNode("/fdm/jsbsim/fadec/thr-locked"), thrLockCmd: props.globals.getNode("/fdm/jsbsim/fadec/thr-locked"),
@ -36,7 +35,9 @@ var FADEC = {
thrLockTime: props.globals.getNode("/fdm/jsbsim/fadec/thr-locked-time"), thrLockTime: props.globals.getNode("/fdm/jsbsim/fadec/thr-locked-time"),
}, },
manThrAboveMct: [0, 0], manThrAboveMct: [0, 0],
maxDetent: props.globals.getNode("/fdm/jsbsim/fadec/max-detent"),
n1Mode: [props.globals.getNode("/fdm/jsbsim/fadec/control-1/n1-mode"), props.globals.getNode("/fdm/jsbsim/fadec/control-2/n1-mode")], n1Mode: [props.globals.getNode("/fdm/jsbsim/fadec/control-1/n1-mode"), props.globals.getNode("/fdm/jsbsim/fadec/control-2/n1-mode")],
togaLk: props.globals.getNode("/fdm/jsbsim/fadec/toga-lk"),
init: func() { init: func() {
me.engOut.setBoolValue(0); me.engOut.setBoolValue(0);
me.Limit.activeMode.setBoolValue("TOGA"); me.Limit.activeMode.setBoolValue("TOGA");

View file

@ -392,6 +392,150 @@
</channel> </channel>
<channel name="Reversers">
<!-- Engine 1 -->
<switch name="fadec/reverse-1/position-cmd">
<default value="0"/>
<test value="1">
/controls/engines/engine[0]/reverse-lever ge 0.25
</test>
<output>/controls/engines/engine[0]/reverse-cmd</output>
</switch>
<switch name="fadec/reverse-1/position-rate">
<default value="0"/>
<test logic="OR" value="1">
/systems/hydraulic/green-psi ge 1500
/systems/acconfig/autoconfig-running eq 1
</test>
</switch>
<actuator name="fadec/reverse-1/position-norm">
<input>fadec/reverse-1/position-cmd</input>
<rate_limit>fadec/reverse-1/position-rate</rate_limit>
<output>/engines/engine[0]/reverser-pos-norm</output>
</actuator>
<pure_gain name="propulsion/engine[0]/reverser-angle-rad">
<input>fadec/reverse-1/position-norm</input>
<gain>3.14</gain>
</pure_gain>
<switch name="fadec/reverse-1/throttle-rev">
<default value="0"/>
<test value="0.84">
/controls/engines/engine[0]/reverse-lever eq 1
</test>
<test value="0.56">
/controls/engines/engine[0]/reverse-lever eq 0.75
</test>
<test value="0.28">
/controls/engines/engine[0]/reverse-lever eq 0.5
</test>
<clipto>
<min>0.08</min>
<max>1.0</max>
</clipto>
</switch>
<fcs_function name="fadec/reverse-1/throttle-rev">
<function>
<sum>
<value>0.08</value>
<product>
<difference>
<property>/controls/engines/engine[0]/reverse-lever</property>
<value>0.25</value>
</difference>
<quotient>
<difference>
<property>fadec/limit/mrev-norm</property>
<value>0.08</value>
</difference>
<value>0.75</value> <!-- 1.0 - 0.25 -->
</quotient>
</product>
</sum>
</function>
<clipto>
<min>0.08</min>
<max>fadec/limit/mrev-norm</max>
</clipto>
</fcs_function>
<!-- Engine 2 -->
<switch name="fadec/reverse-2/position-cmd">
<default value="0"/>
<test value="1">
/controls/engines/engine[1]/reverse-lever ge 0.25
</test>
<output>/controls/engines/engine[1]/reverse-cmd</output>
</switch>
<switch name="fadec/reverse-2/position-rate">
<default value="0"/>
<test logic="OR" value="1">
/systems/hydraulic/yellow-psi ge 1500
/systems/acconfig/autoconfig-running eq 1
</test>
</switch>
<actuator name="fadec/reverse-2/position-norm">
<input>fadec/reverse-2/position-cmd</input>
<rate_limit>fadec/reverse-2/position-rate</rate_limit>
<output>/engines/engine[1]/reverser-pos-norm</output>
</actuator>
<pure_gain name="propulsion/engine[1]/reverser-angle-rad">
<input>fadec/reverse-2/position-norm</input>
<gain>3.14</gain>
</pure_gain>
<switch name="fadec/reverse-2/throttle-rev">
<default value="0"/>
<test value="0.84">
/controls/engines/engine[1]/reverse-lever eq 1
</test>
<test value="0.56">
/controls/engines/engine[1]/reverse-lever eq 0.75
</test>
<test value="0.28">
/controls/engines/engine[1]/reverse-lever eq 0.5
</test>
<clipto>
<min>0.08</min>
<max>1.0</max>
</clipto>
</switch>
<fcs_function name="fadec/reverse-2/throttle-rev">
<function>
<sum>
<value>0.08</value>
<product>
<difference>
<property>/controls/engines/engine[1]/reverse-lever</property>
<value>0.25</value>
</difference>
<quotient>
<difference>
<property>fadec/limit/mrev-norm</property>
<value>0.08</value>
</difference>
<value>0.75</value> <!-- 1.0 - 0.25 -->
</quotient>
</product>
</sum>
</function>
<clipto>
<min>0.08</min>
<max>fadec/limit/mrev-norm</max>
</clipto>
</fcs_function>
</channel>
<channel name="Engine Control"> <!-- Very complicated, please don't touch if you don't understand it --> <channel name="Engine Control"> <!-- Very complicated, please don't touch if you don't understand it -->
<!-- Engine 1 --> <!-- Engine 1 -->
@ -402,9 +546,9 @@
<switch name="fadec/control-1/throttle-pos"> <switch name="fadec/control-1/throttle-pos">
<default value="fadec/control-1/throttle-lag"/> <default value="fadec/control-1/throttle-lag"/>
<!--test value="0"> <test value="0">
fadec/reverse-1/position-norm ne 0 fadec/reverse-1/position-norm ne 0
</test--> </test>
</switch> </switch>
<fcs_function name="fadec/control-1/idle-climb-n1"> <fcs_function name="fadec/control-1/idle-climb-n1">
@ -649,9 +793,9 @@
<switch name="fadec/control-2/throttle-pos"> <switch name="fadec/control-2/throttle-pos">
<default value="fadec/control-2/throttle-lag"/> <default value="fadec/control-2/throttle-lag"/>
<!--test value="0"> <test value="0">
fadec/reverse-2/position-norm ne 0 fadec/reverse-2/position-norm ne 0
</test--> </test>
</switch> </switch>
<fcs_function name="fadec/control-2/idle-climb-n1"> <fcs_function name="fadec/control-2/idle-climb-n1">
@ -1039,9 +1183,9 @@
<switch name="fadec/control-1/throttle-output"> <switch name="fadec/control-1/throttle-output">
<default value="fadec/control-1/lever-norm"/> <default value="fadec/control-1/lever-norm"/>
<!--test value="fadec/reverse-1/throttle-rev-cmd"> <test value="fadec/reverse-1/throttle-rev">
/controls/engines/engine[0]/reverse-lever gt 0 fadec/reverse-1/position-norm ne 0
</test--> </test>
<test value="fadec/athr/output"> <test value="fadec/athr/output">
fadec/athr/active eq 1 fadec/athr/active eq 1
</test> </test>
@ -1067,9 +1211,9 @@
<switch name="fadec/control-2/throttle-output"> <switch name="fadec/control-2/throttle-output">
<default value="fadec/control-2/lever-norm"/> <default value="fadec/control-2/lever-norm"/>
<!--test value="fadec/reverse-2/throttle-rev-cmd"> <test value="fadec/reverse-2/throttle-rev">
/controls/engines/engine[1]/reverse-lever gt 0 fadec/reverse-2/position-norm ne 0
</test--> </test>
<test value="fadec/athr/output"> <test value="fadec/athr/output">
fadec/athr/active eq 1 fadec/athr/active eq 1
</test> </test>
@ -1129,5 +1273,79 @@
</lag_filter> </lag_filter>
</channel> </channel>
<channel name="Upper ECAM Needles" execrate="4">
<fcs_function name="/instrumentation/upper-ecam/n1[0]">
<function>
<table>
<independentVar lookup="row">/engines/engine[0]/n1-actual</independentVar>
<tableData>
20 -131
50 -64
100 48
110 65
</tableData>
</table>
</function>
</fcs_function>
<fcs_function name="/instrumentation/upper-ecam/n1[1]">
<function>
<table>
<independentVar lookup="row">/engines/engine[1]/n1-actual</independentVar>
<tableData>
20 -131
50 -64
100 48
110 65
</tableData>
</table>
</function>
</fcs_function>
<fcs_function name="/instrumentation/upper-ecam/n1-thr[0]">
<function>
<table>
<independentVar lookup="row">fadec/control-1/lever-n1</independentVar>
<tableData>
20 -131
50 -64
100 48
110 65
</tableData>
</table>
</function>
</fcs_function>
<fcs_function name="/instrumentation/upper-ecam/n1-thr[1]">
<function>
<table>
<independentVar lookup="row">fadec/control-2/lever-n1</independentVar>
<tableData>
20 -131
50 -64
100 48
110 65
</tableData>
</table>
</function>
</fcs_function>
<fcs_function name="/instrumentation/upper-ecam/n1-limit">
<function>
<table>
<independentVar lookup="row">fadec/limit/toga</independentVar>
<tableData>
20 -131
50 -64
100 48
110 65
</tableData>
</table>
</function>
</fcs_function>
</channel>
</system> </system>

View file

@ -24,6 +24,26 @@
</quotient> </quotient>
</function> </function>
</fcs_function> </fcs_function>
<lag_filter name="fadec/reverse-lever[0]">
<input>/controls/engines/engine[0]/reverse-lever</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fadec/reverse-lever[1]">
<input>/controls/engines/engine[1]/reverse-lever</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/engine-cutoff[0]">
<input>/controls/engines/engine[0]/cutoff-switch</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/engine-cutoff[1]">
<input>/controls/engines/engine[1]/cutoff-switch</input>
<c1>20</c1>
</lag_filter>
</channel> </channel>

View file

@ -639,40 +639,6 @@
</channel> </channel>
<channel name="FADEC"> <!-- Redo it later -->
<lag_filter name="fcs/reverse-lever[0]">
<input>/controls/engines/engine[0]/reverse-cmd</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/reverse-lever[1]">
<input>/controls/engines/engine[1]/reverse-cmd</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/reverse-thr-lever[0]">
<input>/controls/engines/engine[0]/reverse-lever</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/reverse-thr-lever[1]">
<input>/controls/engines/engine[1]/reverse-lever</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/engine-cutoff[0]">
<input>/controls/engines/engine[0]/cutoff-switch</input>
<c1>20</c1>
</lag_filter>
<lag_filter name="fcs/engine-cutoff[1]">
<input>/controls/engines/engine[1]/cutoff-switch</input>
<c1>20</c1>
</lag_filter>
</channel>
<channel name="SFCC"> <!-- 40 for IAE, 35 for CFM/PW is simulated here properly, do NOT change it into seperate unless you like buggy behavior! --> <channel name="SFCC"> <!-- 40 for IAE, 35 for CFM/PW is simulated here properly, do NOT change it into seperate unless you like buggy behavior! -->
<switch name="/controls/flight/flaps-input"> <switch name="/controls/flight/flaps-input">

View file

@ -217,27 +217,10 @@
<output>/ECAM/Upper/EGT[1]</output> <output>/ECAM/Upper/EGT[1]</output>
</filter> </filter>
<filter> <!--filter>
<name>N1 1</name> <name>N1 1</name>
<type>gain</type> <type>gain</type>
<gain>1.0</gain> <gain>1.0</gain>
<input>
<condition>
<equals>
<property>/options/eng</property>
<value>CFM</value>
</equals>
</condition>
<expression>
<table>
<property>/engines/engine[0]/n1-actual</property>
<entry><ind> 20.0</ind><dep>-131</dep></entry>
<entry><ind> 50.0</ind><dep> -64</dep></entry>
<entry><ind>100.0</ind><dep> 48</dep></entry>
<entry><ind>110.0</ind><dep> 65</dep></entry>
</table>
</expression>
</input>
<input> <input>
<condition> <condition>
<equals> <equals>
@ -255,71 +238,13 @@
</table> </table>
</expression> </expression>
</input> </input>
<output>/ECAM/Upper/N1[0]</output> <output>/instrumentation/upper-ecam/n1[0]</output>
</filter>
<filter>
<name>N1 THR 1</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<condition>
<equals>
<property>/options/eng</property>
<value>CFM</value>
</equals>
</condition>
<expression>
<table>
<property>/fdm/jsbsim/fadec/control-1/lever-n1</property>
<entry><ind> 20.0</ind><dep>-131</dep></entry>
<entry><ind> 50.0</ind><dep> -64</dep></entry>
<entry><ind>100.0</ind><dep> 48</dep></entry>
<entry><ind>110.0</ind><dep> 65</dep></entry>
</table>
</expression>
</input>
<input>
<condition>
<equals>
<property>/options/eng</property>
<value>IAE</value>
</equals>
</condition>
<expression>
<table>
<property>/engines/engine[0]/n1-actual-cmd</property>
<entry><ind> 20.0</ind><dep>-112.5</dep></entry>
<entry><ind> 40.0</ind><dep> -67.5</dep></entry>
<entry><ind>100.0</ind><dep> 67.5</dep></entry>
<entry><ind>110.0</ind><dep> 90.0</dep></entry>
</table>
</expression>
</input>
<output>/ECAM/Upper/N1thr[0]</output>
</filter> </filter>
<filter> <filter>
<name>N1 2</name> <name>N1 2</name>
<type>gain</type> <type>gain</type>
<gain>1.0</gain> <gain>1.0</gain>
<input>
<condition>
<equals>
<property>/options/eng</property>
<value>CFM</value>
</equals>
</condition>
<expression>
<table>
<property>/engines/engine[1]/n1-actual</property>
<entry><ind> 20.0</ind><dep>-131</dep></entry>
<entry><ind> 50.0</ind><dep> -64</dep></entry>
<entry><ind>100.0</ind><dep> 48</dep></entry>
<entry><ind>110.0</ind><dep> 65</dep></entry>
</table>
</expression>
</input>
<input> <input>
<condition> <condition>
<equals> <equals>
@ -337,68 +262,8 @@
</table> </table>
</expression> </expression>
</input> </input>
<output>/ECAM/Upper/N1[1]</output> <output>/instrumentation/upper-ecam/n1[1]</output>
</filter> </filter-->
<filter>
<name>N1 THR 2</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<condition>
<equals>
<property>/options/eng</property>
<value>CFM</value>
</equals>
</condition>
<expression>
<table>
<property>/fdm/jsbsim/fadec/control-2/lever-n1</property>
<entry><ind> 20.0</ind><dep>-131</dep></entry>
<entry><ind> 50.0</ind><dep> -64</dep></entry>
<entry><ind>100.0</ind><dep> 48</dep></entry>
<entry><ind>110.0</ind><dep> 65</dep></entry>
</table>
</expression>
</input>
<input>
<condition>
<equals>
<property>/options/eng</property>
<value>IAE</value>
</equals>
</condition>
<expression>
<table>
<property>/engines/engine[1]/n1-actual-cmd</property>
<entry><ind> 20.0</ind><dep>-112.5</dep></entry>
<entry><ind> 40.0</ind><dep> -67.5</dep></entry>
<entry><ind>100.0</ind><dep> 67.5</dep></entry>
<entry><ind>110.0</ind><dep> 90.0</dep></entry>
</table>
</expression>
</input>
<output>/ECAM/Upper/N1thr[1]</output>
</filter>
<filter>
<name>N1 LIMIT</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<table>
<property>/fdm/jsbsim/fadec/limit/toga</property>
<entry><ind> 20.0</ind><dep>-131</dep></entry>
<entry><ind> 50.0</ind><dep> -64</dep></entry>
<entry><ind>100.0</ind><dep> 48</dep></entry>
<entry><ind>110.0</ind><dep> 65</dep></entry>
</table>
</expression>
</input>
<input>0</input>
<output>/ECAM/Upper/N1ylim</output>
</filter>
<filter> <filter>
<name>Flap Indicator</name> <name>Flap Indicator</name>