autoland light, phase as a nodes optimzed fmgc phase loop
This commit is contained in:
parent
e1f4c230cc
commit
c4036fc407
5 changed files with 210 additions and 67 deletions
|
@ -1206,7 +1206,7 @@
|
|||
<object-name>audio_call_vhf2_led</object-name>
|
||||
<object-name>audio_call_vhf3_led</object-name>
|
||||
<object-name>audio_mech_sgn</object-name>
|
||||
<object-name>autoland_light_on</object-name>
|
||||
<!-- <object-name>autoland_light_on</object-name> -->
|
||||
<object-name>ecam_c_b_led</object-name>
|
||||
<object-name>ecam_el_dc_led</object-name>
|
||||
<object-name>ecam_sts_led</object-name>
|
||||
|
@ -6158,6 +6158,29 @@
|
|||
</emission>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>autoland_light_on</object-name>
|
||||
<condition>
|
||||
<or>
|
||||
<equals>
|
||||
<property>controls/switches/annun-test</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>instrumentation/pfd/lights/autoland-armed</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>instrumentation/pfd/lights/autoland-on</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</and>
|
||||
</or>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<!-- Master Warning and Caution -->
|
||||
<animation>
|
||||
<type>select</type>
|
||||
|
|
|
@ -164,6 +164,9 @@ var amberFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/
|
|||
var amberFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-2", 0, "BOOL");
|
||||
var dhFlash = props.globals.initNode("/instrumentation/pfd/flash-indicators/dh-flash", 0, "BOOL");
|
||||
|
||||
var light_autoland_armed = props.globals.initNode("/instrumentation/pfd/lights/autoland-armed", 0, "BOOL");
|
||||
var light_autoland_on = props.globals.initNode("/instrumentation/pfd/lights/autoland-on", 0, "BOOL");
|
||||
|
||||
var canvas_PFD_base = {
|
||||
init: func(canvas_group, file) {
|
||||
var font_mapper = func(family, weight) {
|
||||
|
|
|
@ -86,6 +86,7 @@ var FMGCinit = func {
|
|||
FMGCInternal.minspeed = 0;
|
||||
FMGCInternal.maxspeed = 338;
|
||||
FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
|
||||
FMGCNodes.phase.setValue(0);
|
||||
FMGCInternal.mngSpd = 157;
|
||||
FMGCInternal.mngSpdCmd = 157;
|
||||
FMGCInternal.mngKtsMach = 0;
|
||||
|
@ -259,6 +260,7 @@ var FMGCNodes = {
|
|||
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
|
||||
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
|
||||
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
|
||||
phase: props.globals.initNode("/FMGC/internal/phase", 0, "INT"),
|
||||
};
|
||||
|
||||
############
|
||||
|
@ -603,88 +605,144 @@ var radios = maketimer(1, func() {
|
|||
adf1();
|
||||
});
|
||||
|
||||
|
||||
|
||||
var prop_n1_left = pts.Engines.Engine.n1Actual[0];
|
||||
var prop_n1_right = pts.Engines.Engine.n1Actual[1];
|
||||
#var prop_nmodelat = Modes.PFD.FMA.rollMode;
|
||||
#var prop_mode = Modes.PFD.FMA.pitchMode;
|
||||
var prop_gs = pts.Velocities.groundspeed;
|
||||
var prop_alt = pts.Instrumentation.Altimeter.indicatedFt;
|
||||
var prop_state1 = pts.Systems.Thrust.state[0];
|
||||
var prop_state2 = pts.Systems.Thrust.state[1];
|
||||
#var prop_accel_agl_ft = Setting.reducAglFt;
|
||||
var prop_gear0 = pts.Gear.wow[0];
|
||||
#var prop_altSel = Input.alt;
|
||||
|
||||
var masterFMGC = maketimer(0.2, func {
|
||||
n1_left = pts.Engines.Engine.n1Actual[0].getValue();
|
||||
n1_right = pts.Engines.Engine.n1Actual[1].getValue();
|
||||
|
||||
n1_left = prop_n1_left.getValue();
|
||||
n1_right = prop_n1_right.getValue();
|
||||
modelat = Modes.PFD.FMA.rollMode.getValue();
|
||||
mode = Modes.PFD.FMA.pitchMode.getValue();
|
||||
gs = pts.Velocities.groundspeed.getValue();
|
||||
alt = pts.Instrumentation.Altimeter.indicatedFt.getValue();
|
||||
gs = prop_gs.getValue();
|
||||
alt = prop_alt.getValue();
|
||||
# cruiseft = FMGCInternal.crzFt;
|
||||
# cruiseft_b = FMGCInternal.crzFt - 200;
|
||||
state1 = pts.Systems.Thrust.state[0].getValue();
|
||||
state2 = pts.Systems.Thrust.state[1].getValue();
|
||||
state1 = prop_state1.getValue();
|
||||
state2 = prop_state2.getValue();
|
||||
accel_agl_ft = Setting.reducAglFt.getValue();
|
||||
gear0 = pts.Gear.wow[0].getBoolValue();
|
||||
gear0 = prop_gear0.getBoolValue();
|
||||
altSel = Input.alt.getValue();
|
||||
|
||||
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 and FMGCInternal.phase == 1) { # rejected takeoff
|
||||
FMGCInternal.phase = 0;
|
||||
var phase = FMGCInternal.phase;
|
||||
var newphase = phase;
|
||||
|
||||
if (phase == 0) {
|
||||
|
||||
if (gear0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
|
||||
newphase = 1;
|
||||
systems.PNEU.pressMode.setValue("TO");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (phase == 1) {
|
||||
|
||||
if (gear0) {
|
||||
|
||||
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " ") { # rejected takeoff
|
||||
newphase = 0;
|
||||
systems.PNEU.pressMode.setValue("GN");
|
||||
}
|
||||
|
||||
if (gear0 and FMGCInternal.phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
|
||||
FMGCInternal.phase = 1;
|
||||
}
|
||||
else if (((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
|
||||
newphase = 2;
|
||||
systems.PNEU.pressMode.setValue("TO");
|
||||
}
|
||||
|
||||
if (FMGCInternal.phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
|
||||
FMGCInternal.phase = 2;
|
||||
systems.PNEU.pressMode.setValue("TO");
|
||||
}
|
||||
|
||||
if (FMGCInternal.phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) {
|
||||
FMGCInternal.phase = 3;
|
||||
else if (phase == 2) {
|
||||
|
||||
if ((mode == "ALT CRZ" or mode == "ALT CRZ*")) {
|
||||
newphase = 3;
|
||||
systems.PNEU.pressMode.setValue("CR");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (phase == 3) {
|
||||
|
||||
if (FMGCInternal.crzFl >= 200) {
|
||||
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
|
||||
FMGCInternal.phase = 4;
|
||||
if ((flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
|
||||
newphase = 4;
|
||||
systems.PNEU.pressMode.setValue("DE");
|
||||
}
|
||||
} else {
|
||||
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
|
||||
FMGCInternal.phase = 4;
|
||||
if ((flightPlanController.arrivalDist <= 200 and altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
|
||||
newphase = 4;
|
||||
systems.PNEU.pressMode.setValue("DE");
|
||||
}
|
||||
}
|
||||
|
||||
if (FMGCInternal.phase == 4) {
|
||||
}
|
||||
|
||||
else if (phase == 4) {
|
||||
|
||||
if (getprop("/FMGC/internal/decel")) {
|
||||
FMGCInternal.phase = 5;
|
||||
newphase = 5;
|
||||
}
|
||||
else if (altSel == (FMGCInternal.crzFl * 100)) { # back to CRZ state
|
||||
FMGCInternal.phase = 3;
|
||||
newphase = 3;
|
||||
systems.PNEU.pressMode.setValue("CR");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint
|
||||
setprop("/FMGC/internal/decel", 1);
|
||||
} else if (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
|
||||
setprop("/FMGC/internal/decel", 0);
|
||||
}
|
||||
else if (phase == 5) {
|
||||
|
||||
if ((FMGCInternal.phase == 5) and state1 == "TOGA" and state2 == "TOGA") {
|
||||
FMGCInternal.phase = 6;
|
||||
if (state1 == "TOGA" and state2 == "TOGA") {
|
||||
newphase = 6;
|
||||
systems.PNEU.pressMode.setValue("TO");
|
||||
Input.toga.setValue(1);
|
||||
}
|
||||
|
||||
if (FMGCInternal.phase == 6 and alt >= accel_agl_ft) { # todo when insert altn or new dest
|
||||
FMGCInternal.phase = 2;
|
||||
}
|
||||
|
||||
tempOverspeed = systems.ADIRS.overspeedVFE.getValue();
|
||||
if (tempOverspeed != 1024) {
|
||||
FMGCInternal.maxspeed = tempOverspeed - 4;
|
||||
else if (phase == 6) {
|
||||
|
||||
if (alt >= accel_agl_ft) { # todo when insert altn or new dest
|
||||
newphase = 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and
|
||||
flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint
|
||||
setprop("/FMGC/internal/decel", 1);
|
||||
} else if (getprop("/FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
|
||||
setprop("/FMGC/internal/decel", 0);
|
||||
}
|
||||
|
||||
|
||||
if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) {
|
||||
FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4;
|
||||
} elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) {
|
||||
FMGCInternal.maxspeed = 284;
|
||||
} else {
|
||||
FMGCInternal.maxspeed = fmgc.FMGCInternal.vmo_mmo;
|
||||
}
|
||||
|
||||
if (newphase != phase) { # phase changed
|
||||
FMGCInternal.phase = newphase;
|
||||
FMGCNodes.phase.setValue(newphase);
|
||||
}
|
||||
|
||||
|
||||
|
||||
############################
|
||||
# fuel
|
||||
############################
|
||||
|
@ -774,7 +832,7 @@ var masterFMGC = maketimer(0.2, func {
|
|||
}
|
||||
|
||||
# predicted takeoff speeds
|
||||
if (FMGCInternal.phase == 1) {
|
||||
if (phase == 1) {
|
||||
FMGCInternal.clean_to = FMGCInternal.clean;
|
||||
FMGCInternal.vs1g_clean_to = FMGCInternal.vs1g_clean;
|
||||
FMGCInternal.vs1g_conf_2_to = FMGCInternal.vs1g_conf_2;
|
||||
|
@ -796,7 +854,7 @@ var masterFMGC = maketimer(0.2, func {
|
|||
}
|
||||
|
||||
# predicted approach (temp go-around) speeds
|
||||
if (FMGCInternal.phase == 5 or FMGCInternal.phase == 6) {
|
||||
if (phase == 5 or phase == 6) {
|
||||
FMGCInternal.clean_appr = FMGCInternal.clean;
|
||||
FMGCInternal.vs1g_clean_appr = FMGCInternal.vs1g_clean;
|
||||
FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2;
|
||||
|
@ -917,7 +975,8 @@ var masterFMGC = maketimer(0.2, func {
|
|||
}
|
||||
}
|
||||
|
||||
if (gear0 and pts.Controls.Flight.flapsPos.getValue() < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
|
||||
#if (gear0 and pts.Controls.Flight.flapsPos.getValue() < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
|
||||
if (gear0 and flap < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
|
||||
if (!FMGCInternal.takeoffState) {
|
||||
fmgc.FMGCNodes.toState.setValue(1);
|
||||
}
|
||||
|
@ -929,13 +988,21 @@ var masterFMGC = maketimer(0.2, func {
|
|||
FMGCInternal.takeoffState = 0;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
############################
|
||||
#handle radios, runways, v1/vr/v2
|
||||
############################
|
||||
|
||||
var updateAirportRadios = func {
|
||||
|
||||
var phase = FMGCInternal.phase;
|
||||
|
||||
print("# Update airport radios");
|
||||
|
||||
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
|
||||
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
|
||||
if (destination_rwy != nil and FMGCInternal.phase >= 2) {
|
||||
if (phase >= 2 and destination_rwy != nil) {
|
||||
var airport = airportinfo(FMGCInternal.arrApt);
|
||||
setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
|
||||
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
||||
|
@ -950,7 +1017,7 @@ var masterFMGC = maketimer(0.2, func {
|
|||
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
}
|
||||
} else if (departure_rwy != nil and FMGCInternal.phase <= 1) {
|
||||
} else if (phase <= 1 and departure_rwy != nil) {
|
||||
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
||||
runway_ils = departure_rwy.ils_frequency_mhz;
|
||||
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
|
||||
|
@ -964,10 +1031,15 @@ var masterFMGC = maketimer(0.2, func {
|
|||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
setlistener(FMGCNodes.phase, updateAirportRadios);
|
||||
setlistener(flightPlanController.changed, updateAirportRadios);
|
||||
|
||||
var reset_FMGC = func {
|
||||
FMGCInternal.phase = 0;
|
||||
FMGCNodes.phase.serValue(0);
|
||||
fd1 = Input.fd1.getValue();
|
||||
fd2 = Input.fd2.getValue();
|
||||
spd = Input.kts.getValue();
|
||||
|
|
|
@ -923,6 +923,17 @@
|
|||
</clipto>
|
||||
</pure_gain>
|
||||
|
||||
<fcs_function name="/instrumentation/radar-altimeter-difference">
|
||||
<function>
|
||||
<abs>
|
||||
<difference>
|
||||
<property>/instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected</property>
|
||||
<property>/instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected</property>
|
||||
</difference>
|
||||
</abs>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<switch name="/instrumentation/transponder/altimeter-input/mode-c-alt-ft">
|
||||
<test logic="AND" value="/instrumentation/altimeter[0]/mode-c-alt-ft">
|
||||
/instrumentation/transponder/altimeter-input-src eq 1
|
||||
|
|
|
@ -2301,6 +2301,40 @@
|
|||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/instrumentation/pfd/lights/autoland-armed">
|
||||
<default value="0"/>
|
||||
<test logic="OR" value="1">
|
||||
<!-- /gear/gear[0]/wow eq 0 -->
|
||||
<test logic="AND">
|
||||
/modes/pfd/ILS1 eq 1
|
||||
/instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected le 200
|
||||
</test>
|
||||
<test logic="AND">
|
||||
/modes/pfd/ILS2 eq 1
|
||||
/instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected le 200
|
||||
</test>
|
||||
<!-- /instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected le 200 -->
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/instrumentation/pfd/lights/autoland-on">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/instrumentation/pfd/lights/autoland-armed eq 1
|
||||
<test logic="OR">
|
||||
<test logic="AND">
|
||||
/it-autoflight/output/ap1 eq 0
|
||||
/it-autoflight/output/ap2 eq 0
|
||||
</test>
|
||||
/instrumentation/radar-altimeter-difference gt 15
|
||||
<!-- TODO
|
||||
- Localizer deviation excessive
|
||||
- Loss of localizer signal
|
||||
-->
|
||||
</test>
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
</channel>
|
||||
|
||||
<channel name="ENG" execrate="16">
|
||||
|
|
Loading…
Reference in a new issue