Transfer much of managed speed loop to nodes or variables -- much faster!
This commit is contained in:
parent
1cbf30e638
commit
16df254d13
5 changed files with 153 additions and 203 deletions
|
@ -3369,7 +3369,7 @@ var canvas_MCDU_base = {
|
||||||
me.fontLeft(0, 0, 0, symbol, 0, 0);
|
me.fontLeft(0, 0, 0, symbol, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L1"].setText("SELECTED");
|
me["Simple_L1"].setText("SELECTED");
|
||||||
if (getprop("/it-autoflight/input/kts-mach")) {
|
if (fmgc.Input.ktsMach.getValue()) {
|
||||||
me["Simple_L4"].setText(sprintf(" %3.3f", getprop("/it-autoflight/input/mach")));
|
me["Simple_L4"].setText(sprintf(" %3.3f", getprop("/it-autoflight/input/mach")));
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L4"].setText(sprintf(" %s", int(getprop("/it-autoflight/input/kts"))));
|
me["Simple_L4"].setText(sprintf(" %s", int(getprop("/it-autoflight/input/kts"))));
|
||||||
|
@ -3387,10 +3387,10 @@ var canvas_MCDU_base = {
|
||||||
}
|
}
|
||||||
|
|
||||||
me["Simple_L3S"].setText(" MANAGED");
|
me["Simple_L3S"].setText(" MANAGED");
|
||||||
if (getprop("/it-autoflight/input/kts-mach")) {
|
if (fmgc.Input.ktsMach.getValue()) {
|
||||||
me["Simple_L3"].setText(sprintf(" %3.3f", getprop("/FMGC/internal/mng-spd")));
|
me["Simple_L3"].setText(sprintf(" %3.3f", fmgc.FMGCInternal.mngSpd));
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L3"].setText(sprintf(" %s", int(getprop("/FMGC/internal/mng-spd"))));
|
me["Simple_L3"].setText(sprintf(" %s", int(fmgc.FMGCInternal.mngSpd)));
|
||||||
}
|
}
|
||||||
|
|
||||||
me["Simple_L5S"].setText(" EXPEDITE");
|
me["Simple_L5S"].setText(" EXPEDITE");
|
||||||
|
@ -3510,7 +3510,7 @@ var canvas_MCDU_base = {
|
||||||
me.fontLeft(0, 0, 0, symbol, 0, 0);
|
me.fontLeft(0, 0, 0, symbol, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L1"].setText("SELECTED");
|
me["Simple_L1"].setText("SELECTED");
|
||||||
if (getprop("/it-autoflight/input/kts-mach")) {
|
if (fmgc.Input.ktsMach.getValue()) {
|
||||||
me["Simple_L4"].setText(sprintf(" %3.3f", getprop("/it-autoflight/input/mach")));
|
me["Simple_L4"].setText(sprintf(" %3.3f", getprop("/it-autoflight/input/mach")));
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L4"].setText(sprintf(" %s", int(getprop("/it-autoflight/input/kts"))));
|
me["Simple_L4"].setText(sprintf(" %s", int(getprop("/it-autoflight/input/kts"))));
|
||||||
|
@ -3530,10 +3530,10 @@ var canvas_MCDU_base = {
|
||||||
me["Simple_L2S"].setText(" CI");
|
me["Simple_L2S"].setText(" CI");
|
||||||
|
|
||||||
me["Simple_L3S"].setText(" MANAGED");
|
me["Simple_L3S"].setText(" MANAGED");
|
||||||
if (getprop("/it-autoflight/input/kts-mach")) {
|
if (fmgc.Input.ktsMach.getValue()) {
|
||||||
me["Simple_L3"].setText(sprintf(" %3.3f", getprop("/FMGC/internal/mng-spd")));
|
me["Simple_L3"].setText(sprintf(" %3.3f", fmgc.FMGCInternal.mngSpd));
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L3"].setText(sprintf(" %s", int(getprop("/FMGC/internal/mng-spd"))));
|
me["Simple_L3"].setText(sprintf(" %s", int(fmgc.FMGCInternal.mngSpd)));
|
||||||
}
|
}
|
||||||
|
|
||||||
me["Simple_R1S"].setText("DEST EFOB");
|
me["Simple_R1S"].setText("DEST EFOB");
|
||||||
|
@ -3658,7 +3658,7 @@ var canvas_MCDU_base = {
|
||||||
me.fontLeft(0, 0, 0, symbol, 0, 0);
|
me.fontLeft(0, 0, 0, symbol, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L1"].setText("SELECTED");
|
me["Simple_L1"].setText("SELECTED");
|
||||||
if (getprop("/it-autoflight/input/kts-mach")) {
|
if (fmgc.Input.ktsMach.getValue()) {
|
||||||
me["Simple_L4"].setText(sprintf(" %3.3f", getprop("/it-autoflight/input/mach")));
|
me["Simple_L4"].setText(sprintf(" %3.3f", getprop("/it-autoflight/input/mach")));
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L4"].setText(sprintf(" %3.0f", getprop("/it-autoflight/input/kts")));
|
me["Simple_L4"].setText(sprintf(" %3.0f", getprop("/it-autoflight/input/kts")));
|
||||||
|
@ -3678,10 +3678,10 @@ var canvas_MCDU_base = {
|
||||||
me["Simple_L2S"].setText(" CI");
|
me["Simple_L2S"].setText(" CI");
|
||||||
|
|
||||||
me["Simple_L3S"].setText(" MANAGED");
|
me["Simple_L3S"].setText(" MANAGED");
|
||||||
if (getprop("/it-autoflight/input/kts-mach")) {
|
if (fmgc.Input.ktsMach.getValue()) {
|
||||||
me["Simple_L3"].setText(sprintf(" %3.3f", getprop("/FMGC/internal/mng-spd")));
|
me["Simple_L3"].setText(sprintf(" %3.3f", fmgc.FMGCInternal.mngSpd));
|
||||||
} else {
|
} else {
|
||||||
me["Simple_L3"].setText(sprintf(" %3.0f", getprop("/FMGC/internal/mng-spd")));
|
me["Simple_L3"].setText(sprintf(" %3.0f", fmgc.FMGCInternal.mngSpd));
|
||||||
}
|
}
|
||||||
|
|
||||||
me["Simple_L5"].setText(" EXPEDITE");
|
me["Simple_L5"].setText(" EXPEDITE");
|
||||||
|
|
|
@ -2069,7 +2069,7 @@ var messages_config_memo = func {
|
||||||
toMemoLine3.colour = "c";
|
toMemoLine3.colour = "c";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getprop("/controls/flight/flaps-pos") > 0 and getprop("/controls/flight/flaps-pos") < 5) {
|
if (pts.Controls.Flight.flapsPos.getValue() > 0 and pts.Controls.Flight.flapsPos.getValue() < 5) {
|
||||||
toMemoLine4.msg = " FLAPS T.O";
|
toMemoLine4.msg = " FLAPS T.O";
|
||||||
toMemoLine4.colour = "g";
|
toMemoLine4.colour = "g";
|
||||||
} else {
|
} else {
|
||||||
|
@ -2136,7 +2136,7 @@ var messages_config_memo = func {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getprop("it-fbw/law") == 1 or getprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override")) {
|
if (getprop("it-fbw/law") == 1 or getprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override")) {
|
||||||
if (getprop("/controls/flight/flaps-pos") == 4) {
|
if (pts.Controls.Flight.flapsPos.getValue() == 4) {
|
||||||
ldgMemoLine4.msg = " FLAPS CONF 3";
|
ldgMemoLine4.msg = " FLAPS CONF 3";
|
||||||
ldgMemoLine4.colour = "g";
|
ldgMemoLine4.colour = "g";
|
||||||
} else {
|
} else {
|
||||||
|
@ -2144,7 +2144,7 @@ var messages_config_memo = func {
|
||||||
ldgMemoLine4.colour = "c";
|
ldgMemoLine4.colour = "c";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getprop("/controls/flight/flaps-pos") == 5) {
|
if (pts.Controls.Flight.flapsPos.getValue() == 5) {
|
||||||
ldgMemoLine4.msg = " FLAPS FULL";
|
ldgMemoLine4.msg = " FLAPS FULL";
|
||||||
ldgMemoLine4.colour = "g";
|
ldgMemoLine4.colour = "g";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,31 +12,18 @@ var code2 = 0;
|
||||||
var gear0 = 0;
|
var gear0 = 0;
|
||||||
var state1 = 0;
|
var state1 = 0;
|
||||||
var state2 = 0;
|
var state2 = 0;
|
||||||
var flaps = 0;
|
|
||||||
var dep = "";
|
var dep = "";
|
||||||
var arr = "";
|
var arr = "";
|
||||||
var n1_left = 0;
|
var n1_left = 0;
|
||||||
var n1_right = 0;
|
var n1_right = 0;
|
||||||
var flaps = 0;
|
|
||||||
var modelat = 0;
|
var modelat = 0;
|
||||||
var mode = 0;
|
var mode = 0;
|
||||||
var modeI = 0;
|
|
||||||
var gs = 0;
|
var gs = 0;
|
||||||
var aglalt = 0;
|
|
||||||
var cruiseft = 0;
|
var cruiseft = 0;
|
||||||
var cruiseft_b = 0;
|
var cruiseft_b = 0;
|
||||||
var newcruise = 0;
|
|
||||||
var phase = 0;
|
|
||||||
var state1 = 0;
|
var state1 = 0;
|
||||||
var state2 = 0;
|
var state2 = 0;
|
||||||
var wowl = 0;
|
|
||||||
var wowr = 0;
|
|
||||||
var targetalt = 0;
|
|
||||||
var targetvs = 0;
|
|
||||||
var targetfpa = 0;
|
|
||||||
var accel_agl_ft = 0;
|
var accel_agl_ft = 0;
|
||||||
var locarm = 0;
|
|
||||||
var apprarm = 0;
|
|
||||||
var fd1 = 0;
|
var fd1 = 0;
|
||||||
var fd2 = 0;
|
var fd2 = 0;
|
||||||
var spd = 0;
|
var spd = 0;
|
||||||
|
@ -65,37 +52,17 @@ var nameadf1 = "XX";
|
||||||
var ias = 0;
|
var ias = 0;
|
||||||
var mach = 0;
|
var mach = 0;
|
||||||
var ktsmach = 0;
|
var ktsmach = 0;
|
||||||
var mngktsmach = 0;
|
|
||||||
var mng_spd = 0;
|
|
||||||
var mng_spd_cmd = 0;
|
|
||||||
var kts_sel = 0;
|
var kts_sel = 0;
|
||||||
var mach_sel = 0;
|
var mach_sel = 0;
|
||||||
var srsSPD = 0;
|
var srsSPD = 0;
|
||||||
var mach_switchover = 0;
|
|
||||||
var decel = 0;
|
var decel = 0;
|
||||||
var mng_alt_spd_cmd = 0;
|
|
||||||
var mng_alt_spd = 0;
|
var mng_alt_spd = 0;
|
||||||
var mng_alt_mach_cmd = 0;
|
|
||||||
var mng_alt_mach = 0;
|
var mng_alt_mach = 0;
|
||||||
var mng_spd_cmd = 0;
|
|
||||||
var mng_spd = 0;
|
|
||||||
var ap1 = 0;
|
|
||||||
var ap2 = 0;
|
|
||||||
var flx = 0;
|
|
||||||
var lat = 0;
|
|
||||||
var newlat = 0;
|
|
||||||
var vert = 0;
|
|
||||||
var newvert = 0;
|
|
||||||
var newvertarm = 0;
|
|
||||||
var thr1 = 0;
|
|
||||||
var thr2 = 0;
|
|
||||||
var altsel = 0;
|
var altsel = 0;
|
||||||
var crzFl = 0;
|
var crzFl = 0;
|
||||||
|
var windHdg = 0;
|
||||||
|
var windSpeed = 0;
|
||||||
setprop("position/gear-agl-ft", 0);
|
setprop("position/gear-agl-ft", 0);
|
||||||
setprop("/FMGC/internal/mng-spd", 157);
|
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", 157);
|
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
|
||||||
setprop("/FMGC/internal/mach-switchover", 0);
|
|
||||||
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
|
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
|
||||||
setprop("/it-autoflight/internal/vert-speed-fpm", 0);
|
setprop("/it-autoflight/internal/vert-speed-fpm", 0);
|
||||||
setprop("/it-autoflight/output/fma-pwr", 0);
|
setprop("/it-autoflight/output/fma-pwr", 0);
|
||||||
|
@ -116,10 +83,10 @@ var FMGCinit = func {
|
||||||
FMGCInternal.minspeed = 0;
|
FMGCInternal.minspeed = 0;
|
||||||
FMGCInternal.maxspeed = 338;
|
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
|
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
|
||||||
setprop("/FMGC/internal/mng-spd", 157);
|
FMGCInternal.mngSpd = 157;
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", 157);
|
FMGCInternal.mngSpdCmd = 157;
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
setprop("/FMGC/internal/mach-switchover", 0);
|
FMGCInternal.machSwitchover = 0;
|
||||||
setprop("/FMGC/internal/loc-source", "NAV0");
|
setprop("/FMGC/internal/loc-source", "NAV0");
|
||||||
setprop("/FMGC/internal/optalt", 0);
|
setprop("/FMGC/internal/optalt", 0);
|
||||||
setprop("/FMGC/internal/landing-time", -99);
|
setprop("/FMGC/internal/landing-time", -99);
|
||||||
|
@ -261,6 +228,13 @@ var FMGCInternal = {
|
||||||
fob: 0,
|
fob: 0,
|
||||||
fuelPredGw: 0,
|
fuelPredGw: 0,
|
||||||
cg: 0,
|
cg: 0,
|
||||||
|
|
||||||
|
|
||||||
|
# Managed Speed
|
||||||
|
machSwitchover: 0,
|
||||||
|
mngKtsMach: 0,
|
||||||
|
mngSpd: 0,
|
||||||
|
mngSpdCmd: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
var postInit = func() {
|
var postInit = func() {
|
||||||
|
@ -273,10 +247,12 @@ var postInit = func() {
|
||||||
var FMGCNodes = {
|
var FMGCNodes = {
|
||||||
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
|
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
|
||||||
flexSet: props.globals.initNode("/FMGC/internal/flex-set", 0, "BOOL"),
|
flexSet: props.globals.initNode("/FMGC/internal/flex-set", 0, "BOOL"),
|
||||||
|
mngSpdAlt: props.globals.getNode("/FMGC/internal/mng-alt-spd"),
|
||||||
|
mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"),
|
||||||
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
|
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
|
||||||
|
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
|
||||||
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
|
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
|
||||||
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
|
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
|
||||||
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
############
|
############
|
||||||
|
@ -623,69 +599,47 @@ var radios = maketimer(1, func() {
|
||||||
var masterFMGC = maketimer(0.2, func {
|
var masterFMGC = maketimer(0.2, func {
|
||||||
n1_left = pts.Engines.Engine.n1Actual[0].getValue();
|
n1_left = pts.Engines.Engine.n1Actual[0].getValue();
|
||||||
n1_right = pts.Engines.Engine.n1Actual[1].getValue();
|
n1_right = pts.Engines.Engine.n1Actual[1].getValue();
|
||||||
flaps = getprop("/controls/flight/flaps-pos");
|
modelat = Modes.PFD.FMA.rollMode.getValue();
|
||||||
modelat = getprop("/modes/pfd/fma/roll-mode");
|
mode = Modes.PFD.FMA.pitchMode.getValue();
|
||||||
mode = getprop("/modes/pfd/fma/pitch-mode");
|
gs = pts.Velocities.groundspeed.getValue();
|
||||||
modeI = getprop("/it-autoflight/mode/vert");
|
alt = pts.Instrumentation.Altimeter.indicatedFt.getValue();
|
||||||
gs = getprop("/velocities/groundspeed-kt");
|
|
||||||
alt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
|
||||||
aglalt = pts.Position.gearAglFt.getValue();
|
|
||||||
# cruiseft = FMGCInternal.crzFt;
|
# cruiseft = FMGCInternal.crzFt;
|
||||||
# cruiseft_b = FMGCInternal.crzFt - 200;
|
# cruiseft_b = FMGCInternal.crzFt - 200;
|
||||||
newcruise = getprop("/it-autoflight/internal/alt");
|
state1 = pts.Systems.Thrust.state[0].getValue();
|
||||||
phase = FMGCInternal.phase;
|
state2 = pts.Systems.Thrust.state[1].getValue();
|
||||||
state1 = getprop("/systems/thrust/state1");
|
accel_agl_ft = Setting.reducAglFt.getValue();
|
||||||
state2 = getprop("/systems/thrust/state2");
|
|
||||||
wowl = getprop("/gear/gear[1]/wow");
|
|
||||||
wowr = getprop("/gear/gear[2]/wow");
|
|
||||||
targetalt = getprop("/it-autoflight/internal/alt");
|
|
||||||
targetvs = getprop("/it-autoflight/input/vs");
|
|
||||||
targetfpa = getprop("/it-autoflight/input/fpa");
|
|
||||||
accel_agl_ft = getprop("/it-autoflight/settings/accel-agl-ft");
|
|
||||||
locarm = getprop("/it-autopilot/output/loc-armed");
|
|
||||||
apprarm = getprop("/it-autopilot/output/appr-armed");
|
|
||||||
gear0 = pts.Gear.wow[0].getBoolValue();
|
gear0 = pts.Gear.wow[0].getBoolValue();
|
||||||
ap1 = getprop("/it-autoflight/output/ap1");
|
altSel = Input.alt.getValue();
|
||||||
ap2 = getprop("/it-autoflight/output/ap2");
|
|
||||||
flx = getprop("/systems/thrust/lim-flex");
|
|
||||||
lat = getprop("/it-autoflight/mode/lat");
|
|
||||||
newlat = getprop("/modes/pfd/fma/roll-mode");
|
|
||||||
vert = getprop("/it-autoflight/mode/vert");
|
|
||||||
newvert = getprop("/modes/pfd/fma/pitch-mode");
|
|
||||||
newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
|
|
||||||
thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
|
|
||||||
thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
|
|
||||||
altSel = getprop("/it-autoflight/input/alt");
|
|
||||||
|
|
||||||
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 and FMGCInternal.phase == 1) { # rejected takeoff
|
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 and FMGCInternal.phase == 1) { # rejected takeoff
|
||||||
FMGCInternal.phase = 0;
|
FMGCInternal.phase = 0;
|
||||||
setprop("/systems/pressurization/mode", "GN");
|
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)) {
|
if (gear0 and FMGCInternal.phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
|
||||||
FMGCInternal.phase = 1;
|
FMGCInternal.phase = 1;
|
||||||
setprop("/systems/pressurization/mode", "TO");
|
systems.PNEU.pressMode.setValue("TO");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FMGCInternal.phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
|
if (FMGCInternal.phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
|
||||||
FMGCInternal.phase = 2;
|
FMGCInternal.phase = 2;
|
||||||
setprop("/systems/pressurization/mode", "TO");
|
systems.PNEU.pressMode.setValue("TO");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FMGCInternal.phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) {
|
if (FMGCInternal.phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) {
|
||||||
FMGCInternal.phase = 3;
|
FMGCInternal.phase = 3;
|
||||||
setprop("/systems/pressurization/mode", "CR");
|
systems.PNEU.pressMode.setValue("CR");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FMGCInternal.crzFl >= 200) {
|
if (FMGCInternal.crzFl >= 200) {
|
||||||
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
|
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
|
||||||
FMGCInternal.phase = 4;
|
FMGCInternal.phase = 4;
|
||||||
setprop("/systems/pressurization/mode", "DE");
|
systems.PNEU.pressMode.setValue("DE");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
|
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;
|
FMGCInternal.phase = 4;
|
||||||
setprop("/systems/pressurization/mode", "DE");
|
systems.PNEU.pressMode.setValue("DE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +647,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
FMGCInternal.phase = 5;
|
FMGCInternal.phase = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 aglalt < 9500) { #todo decel pseudo waypoint
|
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);
|
setprop("/FMGC/internal/decel", 1);
|
||||||
} else if (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
|
} else if (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
|
||||||
setprop("/FMGC/internal/decel", 0);
|
setprop("/FMGC/internal/decel", 0);
|
||||||
|
@ -701,8 +655,8 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
|
|
||||||
if ((FMGCInternal.phase == 5) and state1 == "TOGA" and state2 == "TOGA") {
|
if ((FMGCInternal.phase == 5) and state1 == "TOGA" and state2 == "TOGA") {
|
||||||
FMGCInternal.phase = 6;
|
FMGCInternal.phase = 6;
|
||||||
setprop("/systems/pressurization/mode", "TO");
|
systems.PNEU.pressMode.setValue("TO");
|
||||||
setprop("/it-autoflight/input/toga", 1);
|
Input.toga.setValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FMGCInternal.phase == 6 and alt >= accel_agl_ft) { # todo when insert altn or new dest
|
if (FMGCInternal.phase == 6 and alt >= accel_agl_ft) { # todo when insert altn or new dest
|
||||||
|
@ -725,36 +679,38 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
############################
|
############################
|
||||||
# wind
|
# wind
|
||||||
############################
|
############################
|
||||||
|
windHdg = pts.Environment.windFromHdg.getValue();
|
||||||
|
windSpeed = pts.Environment.windSpeedKt.getValue();
|
||||||
if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) {
|
if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) {
|
||||||
var windsDidChange = 0;
|
var windsDidChange = 0;
|
||||||
if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) {
|
if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) {
|
||||||
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl50_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl50_wind[1]) {
|
if (sprintf("%03d", windHdg) != fmgc.windController.fl50_wind[0] or sprintf("%03d", windSpeed) != fmgc.windController.fl50_wind[1]) {
|
||||||
fmgc.windController.fl50_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
|
fmgc.windController.fl50_wind[0] = sprintf("%03d", windHdg);
|
||||||
fmgc.windController.fl50_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
|
fmgc.windController.fl50_wind[1] = sprintf("%03d", windSpeed);
|
||||||
fmgc.windController.fl50_wind[2] = "FL50";
|
fmgc.windController.fl50_wind[2] = "FL50";
|
||||||
windsDidChange = 1;
|
windsDidChange = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FMGCInternal.crzFt > 15000 and alt > 14980 and alt < 15020) {
|
if (FMGCInternal.crzFt > 15000 and alt > 14980 and alt < 15020) {
|
||||||
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl150_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl150_wind[1]) {
|
if (sprintf("%03d", windHdg) != fmgc.windController.fl150_wind[0] or sprintf("%03d", windSpeed) != fmgc.windController.fl150_wind[1]) {
|
||||||
fmgc.windController.fl150_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
|
fmgc.windController.fl150_wind[0] = sprintf("%03d", windHdg);
|
||||||
fmgc.windController.fl150_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
|
fmgc.windController.fl150_wind[1] = sprintf("%03d", windSpeed);
|
||||||
fmgc.windController.fl150_wind[2] = "FL150";
|
fmgc.windController.fl150_wind[2] = "FL150";
|
||||||
windsDidChange = 1;
|
windsDidChange = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FMGCInternal.crzFt > 25000 and alt > 24980 and alt < 25020) {
|
if (FMGCInternal.crzFt > 25000 and alt > 24980 and alt < 25020) {
|
||||||
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl250_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl250_wind[1]) {
|
if (sprintf("%03d", windHdg) != fmgc.windController.fl250_wind[0] or sprintf("%03d", windSpeed) != fmgc.windController.fl250_wind[1]) {
|
||||||
fmgc.windController.fl250_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
|
fmgc.windController.fl250_wind[0] = sprintf("%03d", windHdg);
|
||||||
fmgc.windController.fl250_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
|
fmgc.windController.fl250_wind[1] = sprintf("%03d", windSpeed);
|
||||||
fmgc.windController.fl250_wind[2] = "FL250";
|
fmgc.windController.fl250_wind[2] = "FL250";
|
||||||
windsDidChange = 1;
|
windsDidChange = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FMGCInternal.crzSet and alt > FMGCInternal.crzFt - 20 and alt < FMGCInternal.crzFt + 20) {
|
if (FMGCInternal.crzSet and alt > FMGCInternal.crzFt - 20 and alt < FMGCInternal.crzFt + 20) {
|
||||||
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.flcrz_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.flcrz_wind[1]) {
|
if (sprintf("%03d", windHdg) != fmgc.windController.flcrz_wind[0] or sprintf("%03d", windSpeed) != fmgc.windController.flcrz_wind[1]) {
|
||||||
fmgc.windController.flcrz_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
|
fmgc.windController.flcrz_wind[0] = sprintf("%03d", windHdg);
|
||||||
fmgc.windController.flcrz_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
|
fmgc.windController.flcrz_wind[1] = sprintf("%03d", windSpeed);
|
||||||
fmgc.windController.flcrz_wind[2] = "FL" ~ FMGCInternal.crzFl;
|
fmgc.windController.flcrz_wind[2] = "FL" ~ FMGCInternal.crzFl;
|
||||||
windsDidChange = 1;
|
windsDidChange = 1;
|
||||||
}
|
}
|
||||||
|
@ -767,9 +723,9 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
############################
|
############################
|
||||||
# calculate speeds
|
# calculate speeds
|
||||||
############################
|
############################
|
||||||
flap = getprop("/controls/flight/flaps-pos");
|
flap = pts.Controls.Flight.flapsPos.getValue();
|
||||||
weight_lbs = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() / 1000;
|
weight_lbs = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() / 1000;
|
||||||
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
altitude = pts.Instrumentation.Altimeter.indicatedFt.getValue();
|
||||||
|
|
||||||
# current speeds
|
# current speeds
|
||||||
FMGCInternal.clean = 2 * weight_lbs * 0.45359237 + 85;
|
FMGCInternal.clean = 2 * weight_lbs * 0.45359237 + 85;
|
||||||
|
@ -943,7 +899,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gear0 and flaps < 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 (!FMGCInternal.takeoffState) {
|
if (!FMGCInternal.takeoffState) {
|
||||||
fmgc.FMGCNodes.toState.setValue(1);
|
fmgc.FMGCNodes.toState.setValue(1);
|
||||||
}
|
}
|
||||||
|
@ -961,7 +917,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
|
|
||||||
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
|
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
|
||||||
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
|
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
|
||||||
if (destination_rwy != nil and phase >= 2) {
|
if (destination_rwy != nil and FMGCInternal.phase >= 2) {
|
||||||
var airport = airportinfo(FMGCInternal.arrApt);
|
var airport = airportinfo(FMGCInternal.arrApt);
|
||||||
setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
|
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"));
|
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
||||||
|
@ -976,7 +932,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
|
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
|
||||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||||
}
|
}
|
||||||
} else if (departure_rwy != nil and phase <= 1) {
|
} else if (departure_rwy != nil and FMGCInternal.phase <= 1) {
|
||||||
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
||||||
runway_ils = departure_rwy.ils_frequency_mhz;
|
runway_ils = departure_rwy.ils_frequency_mhz;
|
||||||
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
|
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
|
||||||
|
@ -994,25 +950,28 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
|
|
||||||
var reset_FMGC = func {
|
var reset_FMGC = func {
|
||||||
FMGCInternal.phase = 0;
|
FMGCInternal.phase = 0;
|
||||||
fd1 = getprop("/it-autoflight/input/fd1");
|
fd1 = Input.fd1.getValue();
|
||||||
fd2 = getprop("/it-autoflight/input/fd2");
|
fd2 = Input.fd2.getValue()
|
||||||
spd = getprop("/it-autoflight/input/kts");
|
spd = Input.spd.getValue();
|
||||||
hdg = getprop("/it-autoflight/input/hdg");
|
hdg = Input.hdg.getValue();
|
||||||
alt = getprop("/it-autoflight/input/alt");
|
alt = Input.alt.getValue();
|
||||||
|
|
||||||
ITAF.init();
|
ITAF.init();
|
||||||
FMGCinit();
|
FMGCinit();
|
||||||
flightPlanController.reset();
|
flightPlanController.reset();
|
||||||
windController.reset();
|
windController.reset();
|
||||||
windController.init();
|
windController.init();
|
||||||
|
|
||||||
mcdu.MCDU_reset(0);
|
mcdu.MCDU_reset(0);
|
||||||
mcdu.MCDU_reset(1);
|
mcdu.MCDU_reset(1);
|
||||||
setprop("it-autoflight/input/fd1", fd1);
|
mcdu.ReceivedMessagesDatabase.clearDatabase();
|
||||||
setprop("it-autoflight/input/fd2", fd2);
|
|
||||||
setprop("it-autoflight/input/kts", spd);
|
Input.fd1.setValue(fd1);
|
||||||
setprop("it-autoflight/input/hdg", hdg);
|
Input.fd2.setValue(fd2);
|
||||||
setprop("it-autoflight/input/alt", alt);
|
Input.kts.setValue(spd);
|
||||||
setprop("/systems/pressurization/mode", "GN");
|
Input.hdg.setValue(hdg);
|
||||||
|
Input.alt.setValue(alt);
|
||||||
|
|
||||||
|
systems.PNEU.pressMode.setValue("GN");
|
||||||
setprop("/systems/pressurization/vs", "0");
|
setprop("/systems/pressurization/vs", "0");
|
||||||
setprop("/systems/pressurization/targetvs", "0");
|
setprop("/systems/pressurization/targetvs", "0");
|
||||||
setprop("/systems/pressurization/vs-norm", "0");
|
setprop("/systems/pressurization/vs-norm", "0");
|
||||||
|
@ -1021,7 +980,7 @@ var reset_FMGC = func {
|
||||||
setprop("/systems/pressurization/outflowpos", "0");
|
setprop("/systems/pressurization/outflowpos", "0");
|
||||||
setprop("/systems/pressurization/deltap-norm", "0");
|
setprop("/systems/pressurization/deltap-norm", "0");
|
||||||
setprop("/systems/pressurization/outflowpos-norm", "0");
|
setprop("/systems/pressurization/outflowpos-norm", "0");
|
||||||
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
altitude = pts.Instrumentation.Altimeter.indicatedFt.getValue();
|
||||||
setprop("/systems/pressurization/cabinalt", altitude);
|
setprop("/systems/pressurization/cabinalt", altitude);
|
||||||
setprop("/systems/pressurization/targetalt", altitude);
|
setprop("/systems/pressurization/targetalt", altitude);
|
||||||
setprop("/systems/pressurization/diff-to-target", "0");
|
setprop("/systems/pressurization/diff-to-target", "0");
|
||||||
|
@ -1030,7 +989,6 @@ var reset_FMGC = func {
|
||||||
setprop("/systems/pressurization/ambientpsi", "0");
|
setprop("/systems/pressurization/ambientpsi", "0");
|
||||||
setprop("/systems/pressurization/cabinpsi", "0");
|
setprop("/systems/pressurization/cabinpsi", "0");
|
||||||
|
|
||||||
mcdu.ReceivedMessagesDatabase.clearDatabase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#################
|
#################
|
||||||
|
@ -1039,121 +997,110 @@ var reset_FMGC = func {
|
||||||
|
|
||||||
var ManagedSPD = maketimer(0.25, func {
|
var ManagedSPD = maketimer(0.25, func {
|
||||||
if (FMGCInternal.crzSet and FMGCInternal.costIndexSet) {
|
if (FMGCInternal.crzSet and FMGCInternal.costIndexSet) {
|
||||||
if (getprop("/it-autoflight/input/spd-managed") == 1) {
|
if (Custom.Input.spdManaged.getBoolValue()) {
|
||||||
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
altitude = pts.Instrumentation.Altimeter.indicatedFt.getValue();
|
||||||
mode = getprop("/modes/pfd/fma/pitch-mode");
|
mode = Modes.PFD.FMA.pitchMode.getValue();
|
||||||
ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt");
|
ias = pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue();
|
||||||
mach = getprop("/instrumentation/airspeed-indicator/indicated-mach");
|
mach = pts.Instrumentation.AirspeedIndicator.indicatedMach.getValue();
|
||||||
ktsmach = getprop("/it-autoflight/input/kts-mach");
|
ktsmach = Input.ktsMach.getValue();
|
||||||
mngktsmach = getprop("/FMGC/internal/mng-kts-mach");
|
kts_sel = Input.kts.getValue();
|
||||||
mng_spd = getprop("/FMGC/internal/mng-spd");
|
mach_sel = Input.mach.getValue();
|
||||||
mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd");
|
|
||||||
kts_sel = getprop("/it-autoflight/input/kts");
|
|
||||||
mach_sel = getprop("/it-autoflight/input/mach");
|
|
||||||
srsSPD = getprop("/it-autoflight/settings/togaspd");
|
srsSPD = getprop("/it-autoflight/settings/togaspd");
|
||||||
phase = FMGCInternal.phase; # 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
|
phase = FMGCInternal.phase; # 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
|
||||||
flap = getprop("/controls/flight/flaps-pos");
|
flap = pts.Controls.Flight.flapsPos.getValue();
|
||||||
mach_switchover = getprop("/FMGC/internal/mach-switchover");
|
|
||||||
decel = getprop("/FMGC/internal/decel");
|
decel = getprop("/FMGC/internal/decel");
|
||||||
|
|
||||||
mng_alt_spd_cmd = getprop("/FMGC/internal/mng-alt-spd");
|
mng_alt_spd = math.round(FMGCNodes.mngSpdAlt.getValue(), 1);
|
||||||
mng_alt_spd = math.round(mng_alt_spd_cmd, 1);
|
mng_alt_mach = math.round(FMGCNodes.mngMachAlt.getValue(), 0.001);
|
||||||
|
|
||||||
mng_alt_mach_cmd = getprop("/FMGC/internal/mng-alt-mach");
|
|
||||||
mng_alt_mach = math.round(mng_alt_mach_cmd, 0.001);
|
|
||||||
|
|
||||||
if (mach > mng_alt_mach and (FMGCInternal.phase == 2 or FMGCInternal.phase == 3)) {
|
if (mach > mng_alt_mach and (FMGCInternal.phase == 2 or FMGCInternal.phase == 3)) {
|
||||||
setprop("/FMGC/internal/mach-switchover", 1);
|
FMGCInternal.machSwitchover = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) {
|
if (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) {
|
||||||
setprop("/FMGC/internal/mach-switchover", 0);
|
FMGCInternal.machSwitchover = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode == " " or mode == "SRS") and (FMGCInternal.phase == 0 or FMGCInternal.phase == 1)) {
|
if ((mode == " " or mode == "SRS") and (FMGCInternal.phase == 0 or FMGCInternal.phase == 1)) {
|
||||||
if (mngktsmach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != srsSPD) {
|
if (FMGCInternal.mngSpdCmd != srsSPD) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", srsSPD);
|
FMGCInternal.mngSpdCmd = srsSPD;
|
||||||
}
|
}
|
||||||
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude <= 10050) {
|
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude <= 10050) {
|
||||||
if (mngktsmach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != 250 and !decel) {
|
if (FMGCInternal.mngSpdCmd != 250 and !decel) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", 250);
|
FMGCInternal.mngSpdCmd = 250;
|
||||||
} else if (mng_spd_cmd != FMGCInternal.minspeed and decel) {
|
} else if (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed);
|
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
|
||||||
}
|
}
|
||||||
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !mach_switchover) {
|
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !FMGCInternal.machSwitchover) {
|
||||||
if (mngktsmach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != mng_alt_spd) {
|
if (FMGCInternal.mngSpdCmd != mng_alt_spd) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
|
FMGCInternal.mngSpdCmd = mng_alt_spd;
|
||||||
}
|
}
|
||||||
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and mach_switchover) {
|
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and FMGCInternal.machSwitchover) {
|
||||||
if (!mngktsmach) {
|
if (!FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 1);
|
FMGCInternal.mngKtsMach = 1;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != mng_alt_mach) {
|
if (FMGCInternal.mngSpdCmd != mng_alt_mach) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach);
|
FMGCInternal.mngSpdCmd = mng_alt_mach;
|
||||||
}
|
}
|
||||||
} else if (FMGCInternal.phase == 4 and altitude > 11000 and !mach_switchover) {
|
} else if (FMGCInternal.phase == 4 and altitude > 11000 and !FMGCInternal.machSwitchover) {
|
||||||
if (mngktsmach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != mng_alt_spd) {
|
if (FMGCInternal.mngSpdCmd != mng_alt_spd) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
|
FMGCInternal.mngSpdCmd = mng_alt_spd;
|
||||||
}
|
}
|
||||||
} else if (FMGCInternal.phase == 4 and altitude > 11000 and mach_switchover) {
|
} else if (FMGCInternal.phase == 4 and altitude > 11000 and FMGCInternal.machSwitchover) {
|
||||||
if (!mngktsmach) {
|
if (!FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 1);
|
FMGCInternal.mngKtsMach = 1;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != mng_alt_mach) {
|
if (FMGCInternal.mngSpdCmd != mng_alt_mach) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach);
|
FMGCInternal.mngSpdCmd = mng_alt_mach;
|
||||||
}
|
}
|
||||||
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude > 11000 and !mach_switchover) {
|
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude > 11000 and !FMGCInternal.machSwitchover) {
|
||||||
if (mngktsmach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != mng_alt_spd and !decel) {
|
if (FMGCInternal.mngSpdCmd != mng_alt_spd and !decel) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
|
FMGCInternal.mngSpdCmd = mng_alt_spd;
|
||||||
} else if (mng_spd_cmd != FMGCInternal.minspeed and decel) {
|
} else if (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed);
|
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
|
||||||
}
|
}
|
||||||
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) {
|
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) {
|
||||||
if (mngktsmach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
setprop("/FMGC/internal/mng-kts-mach", 0);
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
if (mng_spd_cmd != 250 and !decel) {
|
if (FMGCInternal.mngSpdCmd != 250 and !decel) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", 250);
|
FMGCInternal.mngSpdCmd = 250;
|
||||||
} else if (mng_spd_cmd != FMGCInternal.minspeed and decel) {
|
} else if (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
|
||||||
setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed);
|
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd");
|
if (FMGCInternal.mngSpdCmd > FMGCInternal.maxspeed - 5) {
|
||||||
|
FMGCInternal.mngSpd = (FMGCInternal.maxspeed - 5);
|
||||||
if (mng_spd_cmd > FMGCInternal.maxspeed - 5) {
|
|
||||||
setprop("/FMGC/internal/mng-spd", FMGCInternal.maxspeed - 5);
|
|
||||||
} else {
|
} else {
|
||||||
setprop("/FMGC/internal/mng-spd", mng_spd_cmd);
|
FMGCInternal.mngSpd = FMGCInternal.mngSpdCmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ktsmach and !mngktsmach) {
|
if (ktsmach and !FMGCInternal.mngKtsMach) {
|
||||||
setprop("/it-autoflight/input/kts-mach", 0);
|
Input.ktsMach.setValue(0);
|
||||||
} else if (!ktsmach and mngktsmach) {
|
} else if (!ktsmach and FMGCInternal.mngKtsMach) {
|
||||||
setprop("/it-autoflight/input/kts-mach", 1);
|
Input.ktsMach.setValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mng_spd = getprop("/FMGC/internal/mng-spd");
|
if (kts_sel != FMGCInternal.mngSpd and !ktsmach) {
|
||||||
|
Input.kts.setValue(FMGCInternal.mngSpd);
|
||||||
if (kts_sel != mng_spd and !ktsmach) {
|
} else if (mach_sel != FMGCInternal.mngSpd and ktsmach) {
|
||||||
setprop("/it-autoflight/input/kts", mng_spd);
|
Input.mach.setValue(FMGCInternal.mngSpd);
|
||||||
} else if (mach_sel != mng_spd and ktsmach) {
|
|
||||||
setprop("/it-autoflight/input/mach", mng_spd);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ManagedSPD.stop();
|
ManagedSPD.stop();
|
||||||
|
|
|
@ -76,6 +76,8 @@ var Engines = {
|
||||||
var Environment = {
|
var Environment = {
|
||||||
magVar: props.globals.getNode("/environment/magnetic-variation-deg"),
|
magVar: props.globals.getNode("/environment/magnetic-variation-deg"),
|
||||||
tempDegC: props.globals.getNode("/environment/temperature-degc"),
|
tempDegC: props.globals.getNode("/environment/temperature-degc"),
|
||||||
|
windFromHdg: props.globals.getNode("/environment/wind-from-heading-deg"),
|
||||||
|
windSpeedKt: props.globals.getNode("/environment/wind-speed-kt"),
|
||||||
};
|
};
|
||||||
|
|
||||||
var Fdm = {
|
var Fdm = {
|
||||||
|
|
|
@ -98,6 +98,7 @@ var PNEU = {
|
||||||
ramAir: props.globals.getNode("/systems/air-conditioning/valves/ram-air"),
|
ramAir: props.globals.getNode("/systems/air-conditioning/valves/ram-air"),
|
||||||
hotAir: props.globals.getNode("/systems/air-conditioning/valves/hot-air"),
|
hotAir: props.globals.getNode("/systems/air-conditioning/valves/hot-air"),
|
||||||
},
|
},
|
||||||
|
pressMode: props.globals.getNode("/systems/pressurization/mode", 1),
|
||||||
init: func() {
|
init: func() {
|
||||||
me.resetFail();
|
me.resetFail();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue