A3XX: FBW: Add high speed protection
This commit is contained in:
parent
d3c280fcf2
commit
0b76615228
5 changed files with 241 additions and 88 deletions
|
@ -117,7 +117,6 @@ setlistener("/sim/signals/fdm-initialized", func {
|
|||
var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
|
||||
var thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
|
||||
var thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
|
||||
var mmoIAS = 0;
|
||||
});
|
||||
|
||||
var FMGCinit = func {
|
||||
|
@ -270,13 +269,8 @@ var masterFMGC = maketimer(0.2, func {
|
|||
}
|
||||
|
||||
flap = getprop("/controls/flight/flap-pos");
|
||||
mmoIAS = (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") / getprop("/instrumentation/airspeed-indicator/indicated-mach")) * 0.82;
|
||||
if (flap == 0) { # 0
|
||||
if (mmoIAS < 350) {
|
||||
setprop("/FMGC/internal/maxspeed", mmoIAS);
|
||||
} else {
|
||||
setprop("/FMGC/internal/maxspeed", 350);
|
||||
}
|
||||
setprop("/FMGC/internal/maxspeed", getprop("/it-fbw/speeds/vmo-mmo"));
|
||||
setprop("/FMGC/internal/minspeed", 202);
|
||||
} else if (flap == 1) { # 1
|
||||
setprop("/FMGC/internal/maxspeed", 230);
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
|
||||
# If All ELACs Fail, Alternate Law
|
||||
|
||||
setprop("/it-fbw/roll-back", 0);
|
||||
setprop("/it-fbw/spd-hold", 0);
|
||||
setprop("/it-fbw/protections/overspeed", 0);
|
||||
setprop("/it-fbw/protections/overspeed-roll-back", 0);
|
||||
setprop("/it-fbw/speeds/vmo-mmo", 350);
|
||||
var mmoIAS = 0;
|
||||
|
||||
var fctlInit = func {
|
||||
setprop("/controls/fctl/elac1", 1);
|
||||
setprop("/controls/fctl/elac2", 1);
|
||||
|
@ -23,15 +30,12 @@ var fctlInit = func {
|
|||
setprop("/systems/fctl/fac1", 0);
|
||||
setprop("/systems/fctl/fac2", 0);
|
||||
setprop("/it-fbw/degrade-law", 0);
|
||||
setprop("/it-fbw/override", 0);
|
||||
setprop("/it-fbw/law", 0);
|
||||
updatet.start();
|
||||
fbwt.start();
|
||||
}
|
||||
|
||||
setprop("/it-fbw/roll-back", 0);
|
||||
setprop("/it-fbw/spd-hold", 0);
|
||||
|
||||
###################
|
||||
# Update Function #
|
||||
###################
|
||||
|
||||
var update_loop = func {
|
||||
var elac1_sw = getprop("/controls/fctl/elac1");
|
||||
var elac2_sw = getprop("/controls/fctl/elac2");
|
||||
|
@ -158,10 +162,31 @@ var update_loop = func {
|
|||
setprop("/it-fbw/degrade-law", 2);
|
||||
}
|
||||
|
||||
mmoIAS = (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") / getprop("/instrumentation/airspeed-indicator/indicated-mach")) * 0.82;
|
||||
if (mmoIAS < 350) {
|
||||
setprop("/it-fbw/speeds/vmo-mmo", mmoIAS);
|
||||
} else {
|
||||
setprop("/it-fbw/speeds/vmo-mmo", 350);
|
||||
}
|
||||
|
||||
if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") > getprop("/it-fbw/speeds/vmo-mmo") + 6 and getprop("/it-fbw/law") == 0) {
|
||||
if (getprop("/it-fbw/protections/overspeed") != 1) {
|
||||
setprop("/it-fbw/protections/overspeed", 1);
|
||||
}
|
||||
if (getprop("/it-autoflight/output/ap1") == 1) {
|
||||
setprop("/it-autoflight/input/ap1", 0);
|
||||
}
|
||||
if (getprop("/it-autoflight/output/ap2") == 1) {
|
||||
setprop("/it-autoflight/input/ap2", 0);
|
||||
}
|
||||
} else {
|
||||
if (getprop("/it-fbw/protections/overspeed") != 0) {
|
||||
setprop("/it-fbw/protections/overspeed", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var fbw_loop = func {
|
||||
|
||||
var ail = getprop("/controls/flight/aileron");
|
||||
|
||||
if (ail > 0.4 or ail < -0.4) {
|
||||
|
@ -172,12 +197,18 @@ var fbw_loop = func {
|
|||
if (getprop("/it-fbw/roll-back") == 0 and (getprop("/orientation/roll-deg") > 33.5 or getprop("/orientation/roll-deg") < -33.5)) {
|
||||
setprop("/it-fbw/roll-back", 1);
|
||||
}
|
||||
} else if (ail < 0.05 and ail > -0.05) {
|
||||
} else if (ail < 0.04 and ail > -0.04) {
|
||||
setprop("/it-fbw/roll-lim", "33");
|
||||
if (getprop("/it-fbw/roll-back") == 1 and getprop("/orientation/roll-deg") <= 33.5 and getprop("/orientation/roll-deg") >= -33.5) {
|
||||
setprop("/it-fbw/roll-back", 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ail > 0.04 or ail < -0.04) {
|
||||
setprop("/it-fbw/protections/overspeed-roll-back", 0);
|
||||
} else if (ail < 0.04 and ail > -0.04) {
|
||||
setprop("/it-fbw/protections/overspeed-roll-back", 1);
|
||||
}
|
||||
|
||||
if (getprop("/it-fbw/override") == 0) {
|
||||
var degrade = getprop("/it-fbw/degrade-law");
|
||||
|
@ -210,19 +241,5 @@ var fbw_loop = func {
|
|||
}
|
||||
}
|
||||
|
||||
###########################
|
||||
# Various Other Functions #
|
||||
###########################
|
||||
|
||||
setlistener("/sim/signals/fdm-initialized", func {
|
||||
setprop("/it-fbw/override", 0);
|
||||
setprop("/it-fbw/law", 0);
|
||||
updatet.start();
|
||||
fbwt.start();
|
||||
});
|
||||
|
||||
##########
|
||||
# Timers #
|
||||
##########
|
||||
var updatet = maketimer(0.1, update_loop);
|
||||
var fbwt = maketimer(0.03, fbw_loop);
|
||||
|
|
|
@ -21,10 +21,16 @@
|
|||
<gain>1</gain>
|
||||
<input>
|
||||
<condition>
|
||||
<not-equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<sum>
|
||||
|
@ -70,10 +76,16 @@
|
|||
</input>
|
||||
<input>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<and>
|
||||
<not-equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>0</value>
|
||||
</not-equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<sum>
|
||||
|
@ -86,6 +98,46 @@
|
|||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<input>
|
||||
<condition>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<sum>
|
||||
<table>
|
||||
<property>/controls/flight/elevator-input</property>
|
||||
<entry><ind> 0.0</ind><dep> 2.5</dep></entry>
|
||||
<entry><ind>-1.0</ind><dep> 5.0</dep></entry>
|
||||
</table>
|
||||
<product>
|
||||
<table>
|
||||
<property>/orientation/pitch-deg</property>
|
||||
<entry><ind>29.99999</ind><dep>0</dep></entry>
|
||||
<entry><ind>30.00000</ind><dep>1</dep></entry>
|
||||
</table>
|
||||
<table>
|
||||
<property>/controls/flight/elevator-input</property>
|
||||
<entry><ind> 0</ind><dep>-2.5</dep></entry>
|
||||
<entry><ind>-1</ind><dep>-5.0</dep></entry>
|
||||
</table>
|
||||
</product>
|
||||
<table>
|
||||
<property>/orientation/pitch-deg</property>
|
||||
<entry><ind> 30</ind><dep> 0</dep></entry>
|
||||
<entry><ind> 33</ind><dep>-4</dep></entry>
|
||||
</table>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/it-fbw/pitch-rate</output>
|
||||
</filter>
|
||||
|
||||
|
@ -280,50 +332,48 @@
|
|||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<and>
|
||||
<or>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</or>
|
||||
<or>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<property>/position/gear-agl-ft</property>
|
||||
<value>100</value>
|
||||
</greater-than-equals>
|
||||
<or>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/ap1</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/ap2</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</or>
|
||||
</and>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<property>/position/gear-agl-ft</property>
|
||||
<value>50</value>
|
||||
</greater-than-equals>
|
||||
<or>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-fbw/law</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</or>
|
||||
<or>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<property>/position/gear-agl-ft</property>
|
||||
<value>100</value>
|
||||
</greater-than-equals>
|
||||
<or>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/ap1</property>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/ap2</property>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</and>
|
||||
</or>
|
||||
</and>
|
||||
</or>
|
||||
</and>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<property>/position/gear-agl-ft</property>
|
||||
<value>50</value>
|
||||
</greater-than-equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/ap1</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/ap2</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
</and>
|
||||
</or>
|
||||
<less-than>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<value>40</value>
|
||||
|
@ -346,6 +396,10 @@
|
|||
<property>/fdm/jsbsim/forces/load-factor</property>
|
||||
<value>-0.5</value>
|
||||
</less-than>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
|
|
|
@ -27,10 +27,14 @@
|
|||
<property>/it-fbw/roll-lim</property>
|
||||
<value>33</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/roll-back</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
|
@ -70,10 +74,16 @@
|
|||
</input>
|
||||
<input>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/it-fbw/roll-lim</property>
|
||||
<value>67</value>
|
||||
</equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-fbw/roll-lim</property>
|
||||
<value>67</value>
|
||||
</equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<sum>
|
||||
|
@ -112,10 +122,16 @@
|
|||
</input>
|
||||
<input>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/it-fbw/roll-back</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-fbw/roll-back</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<table>
|
||||
|
@ -129,6 +145,78 @@
|
|||
</table>
|
||||
</expression>
|
||||
</input>
|
||||
<input>
|
||||
<condition>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<not-equals>
|
||||
<property>/it-fbw/protections/overspeed-roll-back</property>
|
||||
<value>1</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<sum>
|
||||
<table>
|
||||
<property>/controls/flight/aileron-input</property>
|
||||
<entry><ind>-1</ind><dep>-12.0</dep></entry>
|
||||
<entry><ind> 0</ind><dep> 0.0</dep></entry>
|
||||
<entry><ind> 1</ind><dep> 12.0</dep></entry>
|
||||
</table>
|
||||
<product>
|
||||
<table>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<entry><ind>-40.00000</ind><dep>1</dep></entry>
|
||||
<entry><ind>-39.99999</ind><dep>0</dep></entry>
|
||||
</table>
|
||||
<table>
|
||||
<property>/controls/flight/aileron-input</property>
|
||||
<entry><ind>-1</ind><dep>12.0</dep></entry>
|
||||
<entry><ind> 0</ind><dep> 0.0</dep></entry>
|
||||
</table>
|
||||
</product>
|
||||
<product>
|
||||
<table>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<entry><ind>39.99999</ind><dep>0</dep></entry>
|
||||
<entry><ind>40.00000</ind><dep>1</dep></entry>
|
||||
</table>
|
||||
<table>
|
||||
<property>/controls/flight/aileron-input</property>
|
||||
<entry><ind>0</ind><dep> 0.0</dep></entry>
|
||||
<entry><ind>1</ind><dep>-12.0</dep></entry>
|
||||
</table>
|
||||
</product>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<input>
|
||||
<condition>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-fbw/protections/overspeed</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-fbw/protections/overspeed-roll-back</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
<expression>
|
||||
<table>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<entry><ind>-40</ind><dep> 25.0</dep></entry>
|
||||
<entry><ind>-15</ind><dep> 10.0</dep></entry>
|
||||
<entry><ind> 0</ind><dep> 0.0</dep></entry>
|
||||
<entry><ind> 15</ind><dep>-10.0</dep></entry>
|
||||
<entry><ind> 40</ind><dep>-25.0</dep></entry>
|
||||
</table>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/it-fbw/roll-rate</output>
|
||||
</filter>
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
4041
|
||||
4042
|
Reference in a new issue