ECAM phases: fix interaction of phase 1 / phase 10 and finish the move from Nasal --> jsb
This commit is contained in:
parent
611cd9c74c
commit
10edd0fd0f
3 changed files with 126 additions and 89 deletions
|
@ -69,10 +69,10 @@ var ECAM = {
|
|||
},
|
||||
reset: func() {
|
||||
for (var i = 0; i <= 8; i = i + 1) {
|
||||
setprop("ECAM/msg/line" ~ i, "");
|
||||
setprop("ECAM/rightmsg/line" ~ i, "");
|
||||
setprop("ECAM/msg/linec" ~ i, "w");
|
||||
setprop("ECAM/rightmsg/linec" ~ i, "w");
|
||||
setprop("/ECAM/msg/line" ~ i, "");
|
||||
setprop("/ECAM/rightmsg/line" ~ i, "");
|
||||
setprop("/ECAM/msg/linec" ~ i, "w");
|
||||
setprop("/ECAM/rightmsg/linec" ~ i, "w");
|
||||
}
|
||||
|
||||
me.lights.apu.setValue(0);
|
||||
|
@ -129,9 +129,6 @@ var ECAM = {
|
|||
me._cachePage = newPage;
|
||||
page.setValue(newPage);
|
||||
},
|
||||
clrLight: func() {
|
||||
me.lights.clr.setValue(1);
|
||||
},
|
||||
};
|
||||
|
||||
var ECAMControlPanel = {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
|
||||
|
||||
var myPhase = nil;
|
||||
var currentPhase = nil;
|
||||
var eng = nil;
|
||||
var eng1epr = nil;
|
||||
var eng2epr = nil;
|
||||
|
@ -22,11 +22,16 @@ var FWC = {
|
|||
Monostable: {
|
||||
phase1: props.globals.initNode("/ECAM/phases/monostable/phase-1-300", 0, "BOOL"),
|
||||
phase5: props.globals.initNode("/ECAM/phases/monostable/phase-5", 0, "BOOL"),
|
||||
phase5Temp: 0,
|
||||
phase7: props.globals.initNode("/ECAM/phases/monostable/phase-7", 0, "BOOL"),
|
||||
phase7Temp: 0,
|
||||
phase9: props.globals.initNode("/ECAM/phases/monostable/phase-9", 0, "BOOL"),
|
||||
phase1Output: props.globals.initNode("/ECAM/phases/monostable/phase-1-300-output"),
|
||||
phase1OutputTemp: 0,
|
||||
phase5Output: props.globals.initNode("/ECAM/phases/monostable/phase-5-output"),
|
||||
phase5OutputTemp: 0,
|
||||
phase7Output: props.globals.initNode("/ECAM/phases/monostable/phase-7-output"),
|
||||
phase7OutputTemp: 0,
|
||||
phase9Output: props.globals.initNode("/ECAM/phases/monostable/phase-9-output"),
|
||||
toPowerOutput: props.globals.getNode("/ECAM/phases/monostable/to-power-set-output"),
|
||||
m80kt: props.globals.getNode("/ECAM/phases/monostable-80kt"),
|
||||
|
@ -38,12 +43,14 @@ var FWC = {
|
|||
phase2Set: props.globals.initNode("/ECAM/phases/flipflop/phase-2-set", 0, "BOOL"),
|
||||
phase2Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-2-reset", 0, "BOOL"),
|
||||
phase2Output: props.globals.initNode("/ECAM/phases/flipflop/phase-2-output", 0, "BOOL"),
|
||||
phase2OutputTemp: 0,
|
||||
phase10Set: props.globals.initNode("/ECAM/phases/flipflop/phase-10-set", 0, "BOOL"),
|
||||
phase10Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-10-reset", 0, "BOOL"),
|
||||
phase10Output: props.globals.initNode("/ECAM/phases/flipflop/phase-10-output", 0, "BOOL"),
|
||||
recallSet: props.globals.initNode("/ECAM/flipflop/recall-set", 0, "BOOL"),
|
||||
recallReset: props.globals.initNode("/ECAM/flipflop/recall-reset", 0, "BOOL"),
|
||||
recallOutput: props.globals.initNode("/ECAM/flipflop/recall-output", 0, "BOOL"),
|
||||
recallOutputTemp: 0,
|
||||
},
|
||||
Logic: {
|
||||
gnd: props.globals.getNode("/ECAM/logic/ground-calc-immediate"),
|
||||
|
@ -60,7 +67,9 @@ var FWC = {
|
|||
eng1idleOutput: props.globals.getNode("/ECAM/phases/timer/eng1idle-output"),
|
||||
eng2idleOutput: props.globals.getNode("/ECAM/phases/timer/eng2idle-output"),
|
||||
eng1and2Off: props.globals.getNode("/ECAM/phases/phase-calculation/engines-1-2-not-running"),
|
||||
eng1and2OffTemp: 0,
|
||||
eng1or2Output: props.globals.getNode("/ECAM/phases/phase-calculation/engine-1-or-2-running"),
|
||||
eng1or2OutputTemp: 0,
|
||||
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
|
||||
|
@ -68,7 +77,9 @@ var FWC = {
|
|||
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"),
|
||||
speed80Temp: 0,
|
||||
toPower: props.globals.getNode("/ECAM/phases/phase-calculation/takeoff-power"),
|
||||
toPowerTemp: 0,
|
||||
altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1),
|
||||
};
|
||||
|
||||
|
@ -79,124 +90,78 @@ var phaseLoop = func() {
|
|||
if ((systems.ELEC.Bus.acEss.getValue() < 110 and systems.ELEC.Bus.ac2.getValue() < 110) or pts.Acconfig.running.getBoolValue()) { return; }
|
||||
if (pts.Sim.Replay.replayActive.getBoolValue()) { return; }
|
||||
|
||||
myPhase = pts.ECAM.fwcWarningPhase.getValue();
|
||||
eng = pts.Options.eng.getValue();
|
||||
eng1epr = pts.Engines.Engine.eprActual[0].getValue();
|
||||
eng2epr = pts.Engines.Engine.eprActual[1].getValue();
|
||||
eng1n1 = pts.Engines.Engine.n1Actual[0].getValue();
|
||||
eng2n1 = pts.Engines.Engine.n1Actual[1].getValue();
|
||||
master1 = pts.Controls.Engines.Engine.cutoffSw[0].getBoolValue();
|
||||
master2 = pts.Controls.Engines.Engine.cutoffSw[1].getBoolValue();
|
||||
currentPhase = pts.ECAM.fwcWarningPhase.getValue();
|
||||
gnd = FWC.Logic.gnd.getBoolValue();
|
||||
gndTimer = FWC.Timer.gnd.getValue();
|
||||
FWC.Flipflop.recallReset.setValue(0);
|
||||
|
||||
if (FWC.Flipflop.recallReset.getValue() != 0) {
|
||||
FWC.Flipflop.recallReset.setValue(0);
|
||||
}
|
||||
|
||||
# Various things
|
||||
|
||||
if (myPhase == 9) {
|
||||
FWC.Monostable.phase9.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Monostable.phase9.setBoolValue(0);
|
||||
}
|
||||
|
||||
# Phase 1 / 10 flipflop
|
||||
if (myPhase == 9) {
|
||||
FWC.Flipflop.phase10Set.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Flipflop.phase10Set.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (gndTimer == 1 and pts.Controls.Engines.Engine.firePb[0].getBoolValue()) {
|
||||
FWC.Flipflop.phase10Reset.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Flipflop.phase10Reset.setBoolValue(0);
|
||||
}
|
||||
|
||||
if ((gnd 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);
|
||||
}
|
||||
|
||||
# Phase 2 flipflop
|
||||
if (myPhase == 3 or myPhase == 8) {
|
||||
FWC.Flipflop.phase2Set.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Flipflop.phase2Set.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (!FWC.Monostable.m80kt.getBoolValue() and myPhase != 9 and ((!FWC.Monostable.phase9Output.getBoolValue() and gndTimer == 1) or (!FWC.Monostable.toPowerOutput.getBoolValue() and gndTimer == 1))) {
|
||||
FWC.Flipflop.phase2Reset.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Flipflop.phase2Reset.setBoolValue(0);
|
||||
}
|
||||
|
||||
gear_agl_cur = pts.Position.gearAglFt.getValue();
|
||||
FWC.toPowerTemp = FWC.toPower.getBoolValue();
|
||||
FWC.Timer.eng1and2OffTemp = FWC.Timer.eng1and2Off.getValue();
|
||||
FWC.Timer.eng1or2OutputTemp = FWC.Timer.eng1or2Output.getBoolValue();
|
||||
FWC.speed80Temp = FWC.speed80.getBoolValue();
|
||||
|
||||
# Phase 5 monostable
|
||||
if (FWC.toPower.getBoolValue() and (!FWC.Logic.feet1500.getBoolValue() and !gnd and FWC.Timer.gnd2Sec.getValue() != 1)) {
|
||||
FWC.Monostable.phase5.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Monostable.phase5.setBoolValue(0);
|
||||
}
|
||||
FWC.Monostable.phase1OutputTemp = FWC.Monostable.phase1Output.getBoolValue();
|
||||
FWC.Flipflop.phase2OutputTemp = FWC.Flipflop.phase2Output.getBoolValue();
|
||||
FWC.Monostable.phase5Temp = FWC.Monostable.phase5.getBoolValue();
|
||||
FWC.Monostable.phase5OutputTemp = FWC.Monostable.phase5Output.getBoolValue();
|
||||
FWC.Monostable.phase7Temp = FWC.Monostable.phase7.getBoolValue();
|
||||
FWC.Monostable.phase7OutputTemp = FWC.Monostable.phase7Output.getBoolValue();
|
||||
|
||||
# Phase 7 monostable
|
||||
if (!FWC.toPower.getBoolValue() and !FWC.Logic.feet1500.getBoolValue() and !FWC.Logic.feet800.getBoolValue() and !gnd and FWC.Timer.gnd2Sec.getValue() != 1) {
|
||||
FWC.Monostable.phase7.setBoolValue(1);
|
||||
} else {
|
||||
FWC.Monostable.phase7.setBoolValue(0);
|
||||
}
|
||||
|
||||
# Actual Phases
|
||||
if ((gnd and FWC.Timer.eng1and2Off.getValue() and myPhase != 9) and !FWC.Monostable.phase1Output.getBoolValue()) {
|
||||
# Set Phases
|
||||
if ((gnd and FWC.Timer.eng1and2OffTemp and currentPhase != 9) and !FWC.Monostable.phase1OutputTemp) {
|
||||
setPhase(1);
|
||||
}
|
||||
|
||||
if (FWC.Timer.eng1or2Output.getBoolValue() and (gnd and !FWC.toPower.getBoolValue() and !FWC.speed80.getBoolValue()) and !FWC.Flipflop.phase2Output.getBoolValue()) {
|
||||
if (FWC.Timer.eng1or2OutputTemp and (gnd and !FWC.toPowerTemp and !FWC.speed80Temp) and !FWC.Flipflop.phase2OutputTemp) {
|
||||
setPhase(2);
|
||||
}
|
||||
|
||||
if (FWC.Timer.eng1or2Output.getBoolValue() and (gndTimer == 1 and FWC.toPower.getBoolValue()) and !FWC.speed80.getBoolValue()) {
|
||||
if (FWC.Timer.eng1or2OutputTemp and (gndTimer == 1 and FWC.toPowerTemp) and !FWC.speed80Temp) {
|
||||
setPhase(3);
|
||||
}
|
||||
|
||||
if ((gndTimer == 1 and FWC.toPower.getBoolValue()) and FWC.speed80.getBoolValue()) {
|
||||
if ((gndTimer == 1 and FWC.toPowerTemp) and FWC.speed80Temp) {
|
||||
setPhase(4);
|
||||
}
|
||||
|
||||
if (FWC.Monostable.phase5.getBoolValue() and FWC.Monostable.phase5Output.getBoolValue()) {
|
||||
if (FWC.Monostable.phase5Temp and FWC.Monostable.phase5OutputTemp) {
|
||||
setPhase(5);
|
||||
}
|
||||
|
||||
if (!gnd 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())) {
|
||||
if (!gnd and FWC.Timer.gnd2SecHalf.getValue() != 1 and (!FWC.Monostable.phase5Temp or !FWC.Monostable.phase5OutputTemp) and (!FWC.Monostable.phase7Temp or !FWC.Monostable.phase7OutputTemp)) {
|
||||
setPhase(6);
|
||||
}
|
||||
|
||||
if ((FWC.Monostable.phase7.getBoolValue() and FWC.Monostable.phase7Output.getBoolValue()) and myPhase != 8) {
|
||||
if ((FWC.Monostable.phase7Temp and FWC.Monostable.phase7OutputTemp) and currentPhase != 8) {
|
||||
setPhase(7);
|
||||
}
|
||||
|
||||
if (!FWC.toPower.getBoolValue() and FWC.speed80.getBoolValue() and (gnd or FWC.Timer.gnd2Sec.getValue == 1)) {
|
||||
if (!FWC.toPowerTemp and FWC.speed80Temp and (gnd or FWC.Timer.gnd2Sec.getValue() == 1)) {
|
||||
setPhase(8);
|
||||
}
|
||||
|
||||
if (FWC.Flipflop.phase2Output.getBoolValue() and (gnd and !FWC.toPower.getBoolValue() and !FWC.speed80.getBoolValue()) and FWC.Timer.eng1or2.getBoolValue()) {
|
||||
if (FWC.Flipflop.phase2OutputTemp and (gnd and !FWC.toPowerTemp and !FWC.speed80Temp) and FWC.Timer.eng1or2.getBoolValue()) {
|
||||
setPhase(9);
|
||||
}
|
||||
|
||||
if ((gnd and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) {
|
||||
if ((gnd and FWC.Timer.eng1and2OffTemp and currentPhase == 9) and FWC.Monostable.phase1OutputTemp) {
|
||||
setPhase(10);
|
||||
}
|
||||
|
||||
# FWC Inhibiting
|
||||
myPhase = pts.ECAM.fwcWarningPhase.getValue();
|
||||
if (myPhase >= 3 and myPhase <= 5 and !FWC.Flipflop.recallOutput.getValue()) {
|
||||
currentPhase = pts.ECAM.fwcWarningPhase.getValue();
|
||||
FWC.Flipflop.recallOutputTemp = FWC.Flipflop.recallOutput.getValue();
|
||||
if (currentPhase >= 3 and currentPhase <= 5 and !FWC.Flipflop.recallOutputTemp) {
|
||||
FWC.Timer.toInhibit.setValue(1);
|
||||
} else {
|
||||
FWC.Timer.toInhibit.setValue(0);
|
||||
}
|
||||
|
||||
if (myPhase == 7 or myPhase == 8 and !FWC.Flipflop.recallOutput.getValue()) {
|
||||
if (currentPhase == 7 or currentPhase == 8 and !FWC.Flipflop.recallOutputTemp) {
|
||||
FWC.Timer.ldgInhibit.setValue(1);
|
||||
} else {
|
||||
FWC.Timer.ldgInhibit.setValue(0);
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
<rate_limit sense="incr">0.03333333333</rate_limit>
|
||||
</actuator>
|
||||
|
||||
<actuator name="/ECAM/phases/monostable/phase-1-300-output">
|
||||
<actuator name="/ECAM/phases/monostable/phase-1-300-timer">
|
||||
<input>/ECAM/phases/monostable/phase-1-300</input>
|
||||
<rate_limit sense="incr">0.00333333333</rate_limit>
|
||||
<rate_limit sense="decr">120</rate_limit>
|
||||
<rate_limit sense="decr">0.00333333333</rate_limit>
|
||||
<rate_limit sense="incr">120</rate_limit>
|
||||
</actuator>
|
||||
|
||||
</channel>
|
||||
|
@ -95,8 +95,8 @@
|
|||
|
||||
<switch name="/ECAM/phases/monostable/phase-1-300-output">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/phases/monostable/phase-1-300-output ne 1
|
||||
<test logic="OR" value="1">
|
||||
/ECAM/phases/monostable/phase-1-300-timer ne 0
|
||||
/ECAM/phases/monostable/phase-1-300 eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
@ -229,6 +229,27 @@
|
|||
</test>
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/monostable/phase-5">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/phases/phase-calculation/takeoff-power eq 1
|
||||
/ECAM/phases/phase-calculation/altitude-ge-1500 eq 0
|
||||
/ECAM/logic/ground-calc-immediate eq 0
|
||||
/ECAM/phases/monostable/gnd-output ne 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/monostable/phase-7">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/phases/phase-calculation/takeoff-power eq 0
|
||||
/ECAM/phases/phase-calculation/altitude-ge-1500 eq 0
|
||||
/ECAM/phases/phase-calculation/altitude-ge-800 eq 0
|
||||
/ECAM/logic/ground-calc-immediate eq 0
|
||||
/ECAM/phases/monostable/gnd-output ne 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/monostable/phase-8">
|
||||
<default value="0"/>
|
||||
|
@ -237,6 +258,60 @@
|
|||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/monostable/phase-9">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/warning-phase eq 9
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/flipflop/phase-10-set">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/warning-phase eq 9
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/flipflop/phase-10-reset">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/timer/ground-calc eq 1
|
||||
/controls/engines/engine[0]/fire-btn eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/monostable/phase-1-300">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/phases/phase-calculation/engines-1-2-not-running eq 1
|
||||
/ECAM/logic/ground-calc-immediate eq 1
|
||||
/ECAM/warning-phase eq 9
|
||||
/ECAM/phases/flipflop/phase-10-output eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/flipflop/phase-2-set">
|
||||
<default value="0"/>
|
||||
<test logic="OR" value="1">
|
||||
/ECAM/warning-phase eq 3
|
||||
/ECAM/warning-phase eq 8
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/ECAM/phases/flipflop/phase-2-reset">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="1">
|
||||
/ECAM/phases/monostable-80kt eq 0
|
||||
/ECAM/warning-phase ne 9
|
||||
/ECAM/timer/ground-calc eq 1
|
||||
<test logic="OR">
|
||||
/ECAM/phases/monostable/phase-9-output eq 0
|
||||
/ECAM/phases/monostable/to-power-set-output eq 0
|
||||
</test>
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
|
||||
</channel>
|
||||
|
||||
</system>
|
||||
|
|
Loading…
Reference in a new issue