This commit is contained in:
Jonathan Redpath 2017-02-20 14:29:37 +00:00
commit 514495850c
3 changed files with 167 additions and 73 deletions

View file

@ -1,5 +1,6 @@
# IT AUTOFLIGHT System Controller by Joshua Davidson (it0uchpods/411).
# V3.0.0 Build 130
# IT AUTOFLIGHT System Controller
# Joshua Davidson (it0uchpods)
# V3.0.0 Build 132
# This program is 100% GPL!
print("IT-AUTOFLIGHT: Please Wait!");
@ -36,6 +37,8 @@ var ap_init = func {
setprop("/it-autoflight/output/vert", 7);
setprop("/it-autoflight/settings/min-pitch", -8);
setprop("/it-autoflight/settings/max-pitch", 8);
setprop("/it-autoflight/settings/use-nav2-radio", 0);
setprop("/it-autoflight/settings/use-backcourse", 0);
setprop("/it-autoflight/internal/min-pitch", -8);
setprop("/it-autoflight/internal/max-pitch", 8);
setprop("/it-autoflight/internal/alt", 10000);
@ -179,7 +182,8 @@ var lateral = func {
setprop("/it-autoflight/mode/arm", " ");
}
} else if (latset == 2) {
setprop("/instrumentation/nav/signal-quality-norm", 0);
setprop("/instrumentation/nav[0]/signal-quality-norm", 0);
setprop("/instrumentation/nav[1]/signal-quality-norm", 0);
setprop("/it-autoflight/output/loc-armed", 1);
setprop("/it-autoflight/output/appr-armed", 0);
setprop("/it-autoflight/mode/arm", "LOC");
@ -264,10 +268,12 @@ var vertical = func {
if (getprop("/it-autoflight/output/lat") == 2) {
# Do nothing because VORLOC is active
} else {
setprop("/instrumentation/nav/signal-quality-norm", 0);
setprop("/instrumentation/nav[0]/signal-quality-norm", 0);
setprop("/instrumentation/nav[1]/signal-quality-norm", 0);
setprop("/it-autoflight/output/loc-armed", 1);
}
setprop("/instrumentation/nav/gs-rate-of-climb", 0);
setprop("/instrumentation/nav[0]/gs-rate-of-climb", 0);
setprop("/instrumentation/nav[1]/gs-rate-of-climb", 0);
setprop("/it-autoflight/output/appr-armed", 1);
setprop("/it-autoflight/mode/arm", "ILS");
setprop("/it-autoflight/autoland/target-vs", "-650");
@ -312,13 +318,7 @@ var vertical = func {
var altinput = getprop("/it-autoflight/input/alt");
setprop("/it-autoflight/internal/alt", altinput);
var fpanow = (int(10*getprop("/it-autoflight/internal/fpa")))*0.1;
if (fpanow < 9.9 and fpanow > -9.9) {
setprop("/it-autoflight/input/fpa", fpanow);
} else if (fpanow >= 9.9) {
setprop("/it-autoflight/input/fpa", 9.9);
} else if (fpanow <= -9.9) {
setprop("/it-autoflight/input/fpa", -9.9);
}
setprop("/it-autoflight/input/fpa", fpanow);
setprop("/it-autoflight/output/appr-armed", 0);
setprop("/it-autoflight/output/vert", 5);
setprop("/it-autoflight/mode/vert", "FPA");
@ -341,7 +341,7 @@ var vertical = func {
setprop("/it-autoflight/mode/arm", " ");
var altinput = getprop("/it-autoflight/input/alt");
setprop("/it-autoflight/internal/alt", altinput);
thrustmode();
thrustmodet.start();
alandt.stop();
alandt1.stop();
}
@ -370,6 +370,7 @@ var alt_on = func {
setprop("/it-autoflight/mode/vert", "ALT CAP");
setprop("/it-autoflight/internal/max-pitch", 8);
setprop("/it-autoflight/internal/min-pitch", -8);
minmaxtimer.start();
}
var fpa_calc = func {
@ -623,37 +624,51 @@ var update_apparmelec = func {
}
var locarmcheck = func {
var locdefl = getprop("instrumentation/nav/heading-needle-deflection-norm");
if ((locdefl < 0.9233) and (getprop("instrumentation/nav/signal-quality-norm") > 0.99)) {
setprop("/it-autoflight/output/loc-armed", 0);
setprop("/it-autoflight/output/lat", 2);
setprop("/it-autoflight/mode/lat", "LOC");
if (getprop("/it-autoflight/output/appr-armed") == 1) {
# Do nothing because G/S is armed
} else {
setprop("/it-autoflight/mode/arm", " ");
}
var locdefl = getprop("instrumentation/nav[0]/heading-needle-deflection-norm");
var locdefl_b = getprop("instrumentation/nav[1]/heading-needle-deflection-norm");
if ((locdefl < 0.9233) and (getprop("instrumentation/nav[0]/signal-quality-norm") > 0.99) and (getprop("/it-autoflight/settings/use-nav2-radio") == 0)) {
make_loc_active();
} else if ((locdefl_b < 0.9233) and (getprop("instrumentation/nav[1]/signal-quality-norm") > 0.99) and (getprop("/it-autoflight/settings/use-nav2-radio") == 1)) {
make_loc_active();
} else {
return 0;
}
}
var apparmcheck = func {
var signal = getprop("/instrumentation/nav/gs-needle-deflection-norm");
if (signal <= -0.000000001) {
setprop("/it-autoflight/output/appr-armed", 0);
setprop("/it-autoflight/output/vert", 2);
setprop("/it-autoflight/mode/vert", "G/S");
var make_loc_active = func {
setprop("/it-autoflight/output/loc-armed", 0);
setprop("/it-autoflight/output/lat", 2);
setprop("/it-autoflight/mode/lat", "LOC");
if (getprop("/it-autoflight/output/appr-armed") == 1) {
# Do nothing because G/S is armed
} else {
setprop("/it-autoflight/mode/arm", " ");
if (getprop("/it-autoflight/settings/land-enable") == 1){
alandt.start();
}
thrustmode();
}
}
var apparmcheck = func {
var signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm");
var signal_b = getprop("/instrumentation/nav[1]/gs-needle-deflection-norm");
if ((signal <= -0.000000001) and (getprop("/it-autoflight/settings/use-nav2-radio") == 0)) {
make_appr_active();
} else if ((signal_b <= -0.000000001) and (getprop("/it-autoflight/settings/use-nav2-radio") == 1)) {
make_appr_active();
} else {
return 0;
}
}
var make_appr_active = func {
setprop("/it-autoflight/output/appr-armed", 0);
setprop("/it-autoflight/output/vert", 2);
setprop("/it-autoflight/mode/vert", "G/S");
setprop("/it-autoflight/mode/arm", " ");
if (getprop("/it-autoflight/settings/land-enable") == 1){
alandt.start();
}
thrustmode();
}
# Autoland Stage 1 Logic (Land)
var aland = func {
var ap1 = getprop("/it-autoflight/output/ap1");

View file

@ -622,45 +622,40 @@
<group>
<layout>hbox</layout>
<text>
<label>Mode:</label>
</text>
<text>
<label>[MAG]</label>
<visible>
<equals>
<property>/it-autoflight/input/trk</property>
<value>0</value>
</equals>
</visible>
</text>
<text>
<label>[TRK]</label>
<visible>
<equals>
<property>/it-autoflight/input/trk</property>
<value>1</value>
</equals>
</visible>
</text>
<button>
<pref-width>60</pref-width>
<legend>Magnetic</legend>
<checkbox>
<label>True HDG</label>
<property>/it-autoflight/input/trk</property>
<binding>
<command>property-assign</command>
<property>/it-autoflight/input/trk</property>
<value>0</value>
<command>dialog-apply</command>
</binding>
</button>
<button>
<pref-width>45</pref-width>
<legend>Track</legend>
<live>true</live>
</checkbox>
<checkbox>
<label>Use NAV2</label>
<property>/it-autoflight/settings/use-nav2-radio</property>
<enable>
<not-equals>
<property>/it-autoflight/output/vert</property>
<value>2</value>
</not-equals>
</enable>
<binding>
<command>property-assign</command>
<property>/it-autoflight/input/trk</property>
<value>1</value>
<command>dialog-apply</command>
</binding>
</button>
<live>true</live>
</checkbox>
<checkbox>
<label>B/C</label>
<property>/it-autoflight/settings/use-backcourse</property>
<enable>
<property>/it-autoflight/settings/extra/unused-button</property>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
</group>
<group>

View file

@ -98,17 +98,36 @@
</filter>
<filter>
<name>NAV1 ERROR DEG</name>
<name>NAV ERROR DEG</name>
<debug>false</debug>
<type>gain</type>
<input>
<condition>
<equals>
<property>/it-autoflight/settings/use-nav2-radio</property>
<value>0</value>
</equals>
</condition>
<property>/instrumentation/nav[0]/radials/target-auto-hdg-deg</property>
<offset>
<property>/orientation/heading-deg</property>
<scale>-1.0</scale>
</offset>
</input>
<output>/it-autoflight/internal/nav1-heading-error-deg</output>
<input>
<condition>
<equals>
<property>/it-autoflight/settings/use-nav2-radio</property>
<value>1</value>
</equals>
</condition>
<property>/instrumentation/nav[1]/radials/target-auto-hdg-deg</property>
<offset>
<property>/orientation/heading-deg</property>
<scale>-1.0</scale>
</offset>
</input>
<output>/it-autoflight/internal/nav-heading-error-deg</output>
<period>
<min>-180</min>
<max>180</max>
@ -117,17 +136,36 @@
</filter>
<filter>
<name>NAV1 COURSE ERROR</name>
<name>NAV COURSE ERROR</name>
<debug>false</debug>
<type>gain</type>
<input>
<condition>
<equals>
<property>/it-autoflight/settings/use-nav2-radio</property>
<value>0</value>
</equals>
</condition>
<property>/instrumentation/nav[0]/radials/selected-deg</property>
<offset>
<property>/orientation/heading-magnetic-deg</property>
<scale>-1.0</scale>
</offset>
</input>
<output>/it-autoflight/internal/nav1-course-error</output>
<input>
<condition>
<equals>
<property>/it-autoflight/settings/use-nav2-radio</property>
<value>1</value>
</equals>
</condition>
<property>/instrumentation/nav[1]/radials/selected-deg</property>
<offset>
<property>/orientation/heading-magnetic-deg</property>
<scale>-1.0</scale>
</offset>
</input>
<output>/it-autoflight/internal/nav-course-error</output>
<period>
<min>-180</min>
<max>180</max>
@ -135,6 +173,22 @@
<gain>1.0</gain>
</filter>
<!--filter>
<name>NAV BC ERROR DEG</name>
<debug>false</debug>
<type>gain</type>
<input>
<expression>
<sum>
<property>/it-autoflight/internal/nav-heading-error-deg</property>
<value>180</value>
</sum>
</expression>
</input>
<output>/it-autoflight/internal/nav-bc-heading-error-deg</output>
<gain>1.0</gain>
</filter-->
<filter>
<name>INTERNAL VERTICAL SPEED COMPUTER</name>
<debug>false</debug>
@ -347,7 +401,22 @@
</condition>
</enable>
<input>
<property>/it-autoflight/internal/nav1-heading-error-deg</property>
<condition>
<equals>
<property>/it-autoflight/settings/use-backcourse</property>
<value>0</value>
</equals>
</condition>
<property>/it-autoflight/internal/nav-heading-error-deg</property>
</input>
<input>
<condition>
<equals>
<property>/it-autoflight/settings/use-backcourse</property>
<value>1</value>
</equals>
</condition>
<property>/it-autoflight/internal/nav-bc-heading-error-deg</property>
</input>
<reference>
<value>0.0</value>
@ -656,8 +725,23 @@
<property>/velocities/vertical-speed-fps</property>
</input>
<reference>
<condition>
<equals>
<property>/it-autoflight/settings/use-nav2-radio</property>
<value>0</value>
</equals>
</condition>
<property>/instrumentation/nav[0]/gs-rate-of-climb</property>
</reference>
<reference>
<condition>
<equals>
<property>/it-autoflight/settings/use-nav2-radio</property>
<value>1</value>
</equals>
</condition>
<property>/instrumentation/nav[1]/gs-rate-of-climb</property>
</reference>
<output>
<property>/it-autoflight/internal/target-pitch-deg</property>
</output>