new ITAF 132

This commit is contained in:
Joshua Davidson 2017-02-19 17:24:50 -05:00
parent afd3ccd858
commit 76f587b65d
3 changed files with 166 additions and 73 deletions

View file

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

View file

@ -622,45 +622,40 @@
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
<text>
<label>Mode:</label> <checkbox>
</text> <label>True HDG</label>
<text> <property>/it-autoflight/input/trk</property>
<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>
<binding> <binding>
<command>property-assign</command> <command>dialog-apply</command>
<property>/it-autoflight/input/trk</property>
<value>0</value>
</binding> </binding>
</button> <live>true</live>
<button> </checkbox>
<pref-width>45</pref-width> <checkbox>
<legend>Track</legend> <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> <binding>
<command>property-assign</command> <command>dialog-apply</command>
<property>/it-autoflight/input/trk</property>
<value>1</value>
</binding> </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>
<group> <group>

View file

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