diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas
index e1d11200..fa2c5a26 100644
--- a/Nasal/ECAM/ECAM-logic.nas
+++ b/Nasal/ECAM/ECAM-logic.nas
@@ -2355,7 +2355,7 @@ var messages_memo = func {
if ((phaseVarMemo2 == 1 or phaseVarMemo2 == 2) and toMemoLine1.active != 1 and ldgMemoLine1.active != 1 and (systems.ADIRS.ADIRunits[0].inAlign == 1 or systems.ADIRS.ADIRunits[1].inAlign == 1 or systems.ADIRS.ADIRunits[2].inAlign == 1)) {
irs_in_align.active = 1;
- if (getprop("/ECAM/phases/timer/eng1or2-output")) {
+ if (FWC.Timer.eng1or2Output.getValue()) {
irs_in_align.colour = "a";
} else {
irs_in_align.colour = "g";
diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas
index cdb0310e..baa5ca52 100644
--- a/Nasal/ECAM/ECAM-phases.nas
+++ b/Nasal/ECAM/ECAM-phases.nas
@@ -2,19 +2,14 @@
# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
-var twoEngOff = 0;
var myPhase = nil;
var eng = nil;
var eng1epr = nil;
var eng2epr = nil;
var eng1n1 = nil;
var eng2n1 = nil;
-var eng1n2 = nil;
-var eng2n2 = nil;
-var eprlim = nil;
var master1 = nil;
var master2 = nil;
-var n1lim = nil;
var gear_agl_cur = nil;
var FWC = {
@@ -53,23 +48,27 @@ var FWC = {
Logic: {
gnd: props.globals.getNode("/ECAM/ground-calc-immediate"),
IRSinAlign: props.globals.initNode("/ECAM/irs-in-align", 0, "BOOL"),
+ feet1500: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-1500"),
+ feet800: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-800"),
},
Timer: {
- eng1idle: props.globals.initNode("/ECAM/phases/timer/eng1idle", 0, "INT"),
- eng2idle: props.globals.initNode("/ECAM/phases/timer/eng2idle", 0, "INT"),
- eng1or2: props.globals.initNode("/ECAM/phases/timer/eng1or2", 0, "INT"),
+ eng1idle: props.globals.getNode("/ECAM/phases/timer/eng1idle"),
+ eng2idle: props.globals.getNode("/ECAM/phases/timer/eng2idle"),
+ eng1or2: props.globals.getNode("/ECAM/phases/phase-calculation/one-engine-running"),
toInhibit: props.globals.initNode("/ECAM/phases/timer/to-inhibit", 0, "INT"),
ldgInhibit: props.globals.initNode("/ECAM/phases/timer/ldg-inhibit", 0, "INT"),
eng1idleOutput: props.globals.getNode("/ECAM/phases/timer/eng1idle-output"),
eng2idleOutput: props.globals.getNode("/ECAM/phases/timer/eng2idle-output"),
- eng1or2Output: props.globals.initNode("/ECAM/phases/timer/eng1or2-output", 0, "INT"),
+ eng1and2Off: props.globals.getNode("/ECAM/phases/phase-calculation/engines-1-2-not-running"),
+ eng1or2Output: props.globals.getNode("/ECAM/phases/phase-calculation/engine-1-or-2-running"),
toInhibitOutput: props.globals.getNode("/ECAM/phases/timer/to-inhibit-output"),
ldgInhibitOutput: props.globals.getNode("/ECAM/phases/timer/ldg-inhibit-output"),
gnd: props.globals.getNode("/ECAM/timer/ground-calc"), # ZGND
gnd2Sec: props.globals.getNode("/ECAM/phases/monostable/gnd-output"),
+ gnd2SecHalf: props.globals.getNode("/ECAM/phases/monostable/gnd-output-2"), # hack to prevent getting confused between phase 5 / 6
},
speed80: props.globals.initNode("/ECAM/phases/speed-gt-80", 0, "BOOL"),
- toPower: props.globals.initNode("/ECAM/phases/to-power-set", 0, "BOOL"),
+ toPower: props.globals.getNode("/ECAM/phases/phase-calculation/takeoff-power"),
altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1),
};
@@ -82,53 +81,12 @@ var phaseLoop = func() {
eng2epr = pts.Engines.Engine.eprActual[1].getValue();
eng1n1 = pts.Engines.Engine.n1Actual[0].getValue();
eng2n1 = pts.Engines.Engine.n1Actual[1].getValue();
- eng1n2 = pts.Engines.Engine.n2Actual[0].getValue();
- eng2n2 = pts.Engines.Engine.n2Actual[1].getValue();
master1 = pts.Controls.Engines.Engine.cutoffSw[0].getBoolValue();
master2 = pts.Controls.Engines.Engine.cutoffSw[1].getBoolValue();
FWC.Flipflop.recallReset.setValue(0);
# Various things
- if (eng1n2 >= 59.4 and !master1) {
- FWC.Timer.eng1idle.setValue(1);
- } else {
- FWC.Timer.eng1idle.setValue(0);
- }
-
- if (eng2n2 >= 59.4 and !master2) {
- FWC.Timer.eng2idle.setValue(1);
- } else {
- FWC.Timer.eng2idle.setValue(0);
- }
-
- if (eng1n2 >= 59.4 or eng2n2 >= 59.4) {
- FWC.Timer.eng1or2.setValue(1);
- } else {
- FWC.Timer.eng1or2.setValue(0);
- }
-
- if ((FWC.Timer.eng1idleOutput.getBoolValue() == 0 or master1) and (FWC.Timer.eng2idleOutput.getBoolValue() == 0 or master2)) {
- twoEngOff = 1;
- } else {
- twoEngOff = 0;
- }
-
- if (eng == "IAE") {
- eprlim = getprop("/controls/engines/epr-limit");
- if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Thrust.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
- FWC.toPower.setBoolValue(1);
- } else {
- FWC.toPower.setBoolValue(0);
- }
- } else {
- n1lim = getprop("/controls/engines/n1-limit");
- if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Thrust.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
- FWC.toPower.setBoolValue(1);
- } else {
- FWC.toPower.setBoolValue(0);
- }
- }
if (myPhase == 9) {
FWC.Monostable.phase9.setBoolValue(1);
@@ -149,7 +107,7 @@ var phaseLoop = func() {
FWC.Flipflop.phase10Reset.setBoolValue(0);
}
- if ((FWC.Logic.gnd.getBoolValue() and twoEngOff and myPhase == 9) and FWC.Flipflop.phase10Output.getBoolValue()) {
+ if ((FWC.Logic.gnd.getBoolValue() and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Flipflop.phase10Output.getBoolValue()) {
FWC.Monostable.phase1.setBoolValue(1); # true for 300 sec then false
} else {
FWC.Monostable.phase1.setBoolValue(0);
@@ -171,21 +129,21 @@ var phaseLoop = func() {
gear_agl_cur = pts.Position.gearAglFt.getValue();
# Phase 5 monostable
- if (FWC.toPower.getBoolValue() and (gear_agl_cur <= 1500 and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1)) {
+ if (FWC.toPower.getBoolValue() and (!FWC.Logic.feet1500.getBoolValue() and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1)) {
FWC.Monostable.phase5.setBoolValue(1);
} else {
FWC.Monostable.phase5.setBoolValue(0);
}
# Phase 7 monostable
- if (!FWC.toPower.getBoolValue() and gear_agl_cur <= 1500 and gear_agl_cur <= 800 and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1) {
+ if (!FWC.toPower.getBoolValue() and !FWC.Logic.feet1500.getBoolValue() and !FWC.Logic.feet800.getBoolValue() and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1) {
FWC.Monostable.phase7.setBoolValue(1);
} else {
FWC.Monostable.phase7.setBoolValue(0);
}
# Actual Phases
- if ((!FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1 and twoEngOff and myPhase != 9) and !FWC.Monostable.phase1Output.getBoolValue()) {
+ if ((!FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1 and FWC.Timer.eng1and2Off.getValue() and myPhase != 9) and !FWC.Monostable.phase1Output.getBoolValue()) {
setPhase(1);
}
@@ -205,7 +163,7 @@ var phaseLoop = func() {
setPhase(5);
}
- if (!FWC.Logic.gnd.getValue() and FWC.Timer.gnd2Sec.getValue() != 1 and !(FWC.Monostable.phase5.getBoolValue() and FWC.Monostable.phase5Output.getBoolValue()) and !(FWC.Monostable.phase7.getBoolValue() and FWC.Monostable.phase7Output.getBoolValue())) {
+ if (!FWC.Logic.gnd.getValue() and FWC.Timer.gnd2SecHalf.getValue() != 1 and (!FWC.Monostable.phase5.getBoolValue() or !FWC.Monostable.phase5Output.getBoolValue()) and (!FWC.Monostable.phase7.getBoolValue() or !FWC.Monostable.phase7Output.getBoolValue())) {
setPhase(6);
}
@@ -221,7 +179,7 @@ var phaseLoop = func() {
setPhase(9);
}
- if ((FWC.Logic.gnd.getBoolValue() and twoEngOff and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) {
+ if ((FWC.Logic.gnd.getBoolValue() and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) {
setPhase(10);
}
diff --git a/Systems/a320-aircond.xml b/Systems/a320-aircond.xml
index 0f74d621..4c481df9 100644
--- a/Systems/a320-aircond.xml
+++ b/Systems/a320-aircond.xml
@@ -466,7 +466,7 @@
/gear/gear[1]/wow eq 1
/systems/air-conditioning/landing-switch eq 1
/velocities/airspeed-kt lt 70
- /ECAM/phases/to-power-set ne 1
+ /ECAM/phases/phase-calculation/takeoff-power ne 1
@@ -474,7 +474,7 @@
/gear/gear[1]/wow eq 1
- /ECAM/phases/to-power-set eq 1
+ /ECAM/phases/phase-calculation/takeoff-power eq 1
/gear/gear[1]/wow eq 1
@@ -507,7 +507,7 @@
/gear/gear[1]/wow eq 1
- /ECAM/phases/to-power-set eq 1
+ /ECAM/phases/phase-calculation/takeoff-power eq 1
/gear/gear[1]/wow eq 1
diff --git a/Systems/a320-fwc-phases.xml b/Systems/a320-fwc-phases.xml
index dceae541..f2e78d6a 100644
--- a/Systems/a320-fwc-phases.xml
+++ b/Systems/a320-fwc-phases.xml
@@ -12,6 +12,19 @@
120
1
+
+
+ /ECAM/phases/phase-calculation/one-engine-running
+ 120
+ 0.03333333333
+
+
+
+ /ECAM/phases/monostable/phase-1-300
+ 0.00333333333
+ 120
+
+
@@ -80,12 +93,6 @@
-
- /ECAM/phases/monostable/phase-1-300
- 0.00333333333
- 120
-
-
@@ -93,6 +100,135 @@
/ECAM/phases/monostable/phase-1-300 eq 1
+
+
+
+
+ /position/gear-agl-ft ge 1500
+
+
+
+
+
+
+ /ECAM/phases/phase-calculation/altitude-ge-1500 eq 1
+
+
+
+
+
+
+ /position/gear-agl-ft lt 800
+
+
+
+
+
+
+
+
+
+ /engines/engine[0]/n2 ge 59.4
+ /controls/engines/engine[0]/cutoff-switch eq 0
+
+
+
+
+
+
+ /engines/engine[1]/n2 ge 59.4
+ /controls/engines/engine[1]/cutoff-switch eq 0
+
+
+
+
+
+
+
+ /ECAM/phases/timer/eng1idle-output eq 0
+ /controls/engines/engine[0]/cutoff-switch eq 1
+
+
+ /ECAM/timer/ground-calc eq 1
+ /ECAM/phases/timer/eng1idle eq 0
+
+
+
+
+
+
+
+
+ /ECAM/phases/timer/eng2idle-output eq 0
+ /controls/engines/engine[1]/cutoff-switch eq 1
+
+
+ /ECAM/timer/ground-calc eq 1
+ /ECAM/phases/timer/eng2idle eq 0
+
+
+
+
+
+
+
+ /ECAM/phases/phase-calculation/engine-1-off eq 1
+ /ECAM/phases/phase-calculation/engine-2-off eq 1
+
+
+
+
+
+
+ /engines/engine[0]/state eq 3
+ /engines/engine[1]/state eq 3
+
+
+
+
+
+
+
+
+ /controls/engines/engine[0]/throttle ge 0.779
+ /systems/thrust/lim-flex eq 1
+
+
+ /controls/engines/engine[0]/throttle ge 0.99
+ /systems/thrust/lim-flex eq 0
+
+
+
+
+ /controls/engines/engine[1]/throttle ge 0.779
+ /systems/thrust/lim-flex eq 1
+
+
+ /controls/engines/engine[1]/throttle ge 0.99
+ /systems/thrust/lim-flex eq 0
+
+
+
+
+
+
+ /ECAM/phases/phase-calculation/takeoff-power-logic
+ 120
+ 0.01666666666
+
+
+
+
+
+ /ECAM/phases/phase-calculation/takeoff-power-logic eq 1
+
+ /ECAM/phases/phase-calculation/takeoff-power-timer ne 0
+ /ECAM/phases/phase-calculation/altitude-ge-1500 eq 0
+ /controls/engines/engine[0]/throttle ge 0.599
+ /controls/engines/engine[1]/throttle ge 0.599
+
+
+
diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml
index 67ca2c19..d3467929 100644
--- a/Systems/a320-fwc.xml
+++ b/Systems/a320-fwc.xml
@@ -20,13 +20,6 @@
0.033
-
- Timer for the ECAM system
- /ECAM/phases/timer/eng1or2
- 120
- 0.033
-
-
Timer for the ECAM system
/ECAM/phases/timer/to-inhibit
@@ -1804,7 +1797,7 @@
/controls/engines/engine[0]/throttle-lever ge 0.13333333333
- /ECAM/phases/to-power-set eq 0
+ /ECAM/phases/phase-calculation/takeoff-power eq 0
@@ -1857,7 +1850,7 @@
/controls/engines/engine[1]/throttle-lever ge 0.13333333333
- /ECAM/phases/to-power-set eq 0
+ /ECAM/phases/phase-calculation/takeoff-power eq 0
@@ -2062,7 +2055,7 @@
/instrumentation/radar-altimeter[0]/radar-altitude-ft lt 750
/instrumentation/radar-altimeter[1]/radar-altitude-ft lt 750
- /ECAM/phases/to-power-set eq 0
+ /ECAM/phases/phase-calculation/takeoff-power eq 0
fcs/slat-pos-deg gt 16
fcs/flap-pos-deg gt 18
@@ -2098,7 +2091,7 @@
/instrumentation/radar-altimeter[0]/radar-altitude-ft lt 750
/instrumentation/radar-altimeter[1]/radar-altitude-ft lt 750
- /ECAM/phases/to-power-set eq 0
+ /ECAM/phases/phase-calculation/takeoff-power eq 0
/gear/gear[0]/position-norm ne 1
/gear/gear[1]/position-norm ne 1
diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml
index 660862f6..ac9e1af3 100644
--- a/Systems/ecam-proprules.xml
+++ b/Systems/ecam-proprules.xml
@@ -203,6 +203,17 @@
+
+ monostable
+
+
+ /ECAM/ground-calc-immediate
+
+
+
+
monostable
- ECAM/phases/to-power-set
+ ECAM/phases/phase-calculation/takeoff-power
@@ -1008,4 +1019,14 @@
+
+ RS
+
+ /ECAM/phases/phase-calculation/altitude-flipflop-set
+
+
+ /ECAM/phases/phase-calculation/altitude-flipflop-reset
+
+
+