ADIRS: make it that PFD comes online after ~25 seconds of align per video reference. FBW: make it that failures can be reverted. So if failure condition ends, you go back to normal law. Please report any problems!
This commit is contained in:
parent
d925c3553b
commit
3582325aa4
3 changed files with 107 additions and 86 deletions
|
@ -1088,7 +1088,7 @@ var canvas_PFD_1 = {
|
||||||
wow2_act = wow2.getValue();
|
wow2_act = wow2.getValue();
|
||||||
|
|
||||||
# Errors
|
# Errors
|
||||||
if (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1)) {
|
if (systems.ADIRS.ADIRunits[0].operating == 1 or (systems.ADIRS.ADIRunits[2].operating == 1 and att_switch.getValue() == -1)) {
|
||||||
me["AI_group"].show();
|
me["AI_group"].show();
|
||||||
me["HDG_group"].show();
|
me["HDG_group"].show();
|
||||||
me["AI_error"].hide();
|
me["AI_error"].hide();
|
||||||
|
@ -1132,7 +1132,7 @@ var canvas_PFD_1 = {
|
||||||
me["FPV"].hide();
|
me["FPV"].hide();
|
||||||
} else {
|
} else {
|
||||||
var aoa = me.getAOAForPFD1();
|
var aoa = me.getAOAForPFD1();
|
||||||
if (aoa == nil or (systems.ADIRS.ADIRunits[0].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == -1)){
|
if (aoa == nil or (systems.ADIRS.ADIRunits[0].operating != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].operating != 1 and att_switch.getValue() == -1)){
|
||||||
me["FPV"].hide();
|
me["FPV"].hide();
|
||||||
} else {
|
} else {
|
||||||
var roll_deg = roll.getValue() or 0;
|
var roll_deg = roll.getValue() or 0;
|
||||||
|
@ -1870,7 +1870,7 @@ var canvas_PFD_2 = {
|
||||||
wow2_act = wow2.getValue();
|
wow2_act = wow2.getValue();
|
||||||
|
|
||||||
# Errors
|
# Errors
|
||||||
if (systems.ADIRS.ADIRunits[1].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == 1)) {
|
if (systems.ADIRS.ADIRunits[1].operating == 1 or (systems.ADIRS.ADIRunits[2].operating == 1 and att_switch.getValue() == 1)) {
|
||||||
me["AI_group"].show();
|
me["AI_group"].show();
|
||||||
me["HDG_group"].show();
|
me["HDG_group"].show();
|
||||||
me["AI_error"].hide();
|
me["AI_error"].hide();
|
||||||
|
@ -1907,7 +1907,7 @@ var canvas_PFD_2 = {
|
||||||
me["FPV"].hide();
|
me["FPV"].hide();
|
||||||
} else {
|
} else {
|
||||||
var aoa = me.getAOAForPFD2();
|
var aoa = me.getAOAForPFD2();
|
||||||
if (aoa == nil or (systems.ADIRS.ADIRunits[1].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == 1)) {
|
if (aoa == nil or (systems.ADIRS.ADIRunits[1].operating != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].operating != 1 and att_switch.getValue() == 1)) {
|
||||||
me["FPV"].hide();
|
me["FPV"].hide();
|
||||||
} else {
|
} else {
|
||||||
var roll_deg = roll.getValue() or 0;
|
var roll_deg = roll.getValue() or 0;
|
||||||
|
|
|
@ -13,10 +13,24 @@ var sec2 = 0;
|
||||||
var sec3 = 0;
|
var sec3 = 0;
|
||||||
var fac1 = 0;
|
var fac1 = 0;
|
||||||
var fac2 = 0;
|
var fac2 = 0;
|
||||||
|
var dualELACFault = 0;
|
||||||
|
var tripleSECFault = 0;
|
||||||
|
var dualFACFault = 0;
|
||||||
|
var adr1 = 0;
|
||||||
|
var adr2 = 0;
|
||||||
|
var adr3 = 0;
|
||||||
|
var tripleADRFail = 0;
|
||||||
|
var doubleADRFail = 0;
|
||||||
|
var ir1 = 0;
|
||||||
|
var ir2 = 0;
|
||||||
|
var ir3 = 0;
|
||||||
|
var tripleIRFail = 0;
|
||||||
|
var doubleIRFail = 0;
|
||||||
var blue = 0;
|
var blue = 0;
|
||||||
var green = 0;
|
var green = 0;
|
||||||
var yellow = 0;
|
var yellow = 0;
|
||||||
|
var blueGreenFail = 0;
|
||||||
|
var greenYellowFail = 0;
|
||||||
var ail = 0;
|
var ail = 0;
|
||||||
var roll = 0;
|
var roll = 0;
|
||||||
var rollback = 0;
|
var rollback = 0;
|
||||||
|
@ -154,84 +168,81 @@ var update_loop = func {
|
||||||
fac2 = FBW.Computers.fac2.getBoolValue();
|
fac2 = FBW.Computers.fac2.getBoolValue();
|
||||||
law = FBW.activeLaw.getValue();
|
law = FBW.activeLaw.getValue();
|
||||||
lawyaw = FBW.activeYawLaw.getValue();
|
lawyaw = FBW.activeYawLaw.getValue();
|
||||||
|
adr1 = systems.ADIRS.Operating.adr[0].getValue();
|
||||||
|
adr2 = systems.ADIRS.Operating.adr[1].getValue();
|
||||||
|
adr3 = systems.ADIRS.Operating.adr[2].getValue();
|
||||||
|
ir1 = systems.ADIRS.ADIRunits[0].operating;
|
||||||
|
ir2 = systems.ADIRS.ADIRunits[1].operating;
|
||||||
|
ir3 = systems.ADIRS.ADIRunits[2].operating;
|
||||||
|
|
||||||
# Degrade logic, all failures which degrade FBW need to go here. -JD
|
# Degrade logic, all failures which degrade FBW need to go here. -JD
|
||||||
blue = systems.HYD.Psi.blue.getValue();
|
blue = systems.HYD.Psi.blue.getValue();
|
||||||
green = systems.HYD.Psi.green.getValue();
|
green = systems.HYD.Psi.green.getValue();
|
||||||
yellow = systems.HYD.Psi.yellow.getValue();
|
yellow = systems.HYD.Psi.yellow.getValue();
|
||||||
if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) {
|
|
||||||
if (!elac1 and !elac2) {
|
dualELACFault = !elac1 and !elac2;
|
||||||
if (lawyaw == 0) {
|
tripleSECFault = !sec1 and !sec2 and !sec3;
|
||||||
FBW.degradeYawLaw.setValue(1);
|
dualFACFault = !fac1 and !fac2;
|
||||||
}
|
|
||||||
if (law == 0) {
|
blueGreenFail = blue < 1500 and green < 1500 and yellow >= 1500;
|
||||||
FBW.degradeLaw.setValue(1);
|
greenYellowFail = blue >= 1500 and green < 1500 and yellow < 1500;
|
||||||
FBW.apOff = 1;
|
tripleADRFail = !adr1 and !adr2 and !adr3;
|
||||||
}
|
doubleADRFail = (!adr1 and !adr2 and adr3) or (adr1 and !adr2 and !adr3) or (!adr1 and adr2 and !adr3);
|
||||||
}
|
tripleIRFail = !ir1 and !ir2 and !ir3;
|
||||||
if ((!elac1 and elac2 and ((green < 1500 and yellow >= 1500) or (green >= 1500 and yellow < 1500))) or (!elac2 and elac1 and blue < 1500)) {
|
doubleIRFail = (!ir1 and !ir2 and ir3) or (ir1 and !ir2 and !ir3) or (!ir1 and ir2 and !ir3);
|
||||||
if (lawyaw == 0) {
|
|
||||||
FBW.degradeYawLaw.setValue(1);
|
if (tripleADRFail or doubleADRFail or doubleIRFail or tripleIRFail or dualFACFault or !FBW.yawdamper.getValue() or greenYellowFail or blueGreenFail or dualELACFault or (!elac1 and elac2 and ((green < 1500 and yellow >= 1500) or (green >= 1500 and yellow < 1500))) or (!elac2 and elac1 and blue < 1500) or tripleSECFault or systems.ELEC.EmerElec.getBoolValue()) {
|
||||||
}
|
if (dualFACFault or !FBW.yawdamper.getValue() or greenYellowFail or (systems.ELEC.EmerElec.getBoolValue() and !fac1) or tripleIRFail) {
|
||||||
if (law == 0) {
|
|
||||||
FBW.degradeLaw.setValue(1);
|
|
||||||
FBW.apOff = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!sec1 and !sec2 and !sec3) {
|
|
||||||
if (lawyaw == 0) {
|
|
||||||
FBW.degradeYawLaw.setValue(1);
|
|
||||||
}
|
|
||||||
if (law == 0) {
|
|
||||||
FBW.degradeLaw.setValue(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (systems.ELEC.EmerElec.getBoolValue()) {
|
|
||||||
if (lawyaw == 0 or lawyaw == 1) {
|
|
||||||
} elsif (fac1 and lawyaw == 2) {
|
|
||||||
FBW.degradeYawLaw.setValue(1);
|
|
||||||
}
|
|
||||||
if (law == 0) {
|
|
||||||
FBW.degradeLaw.setValue(1);
|
|
||||||
FBW.apOff = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (blue < 1500 and green < 1500 and yellow >= 1500) {
|
|
||||||
if (lawyaw == 0) {
|
|
||||||
FBW.degradeYawLaw.setValue(1);
|
|
||||||
}
|
|
||||||
if (law == 0) {
|
|
||||||
FBW.degradeLaw.setValue(1);
|
|
||||||
FBW.apOff = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((!fac1 and !fac2) or !FBW.yawdamper.getValue() or (blue >= 1500 and green < 1500 and yellow < 1500)) {
|
|
||||||
if (lawyaw == 0 or lawyaw == 1) {
|
if (lawyaw == 0 or lawyaw == 1) {
|
||||||
FBW.degradeYawLaw.setValue(2);
|
FBW.degradeYawLaw.setValue(2);
|
||||||
}
|
}
|
||||||
if (law == 0) {
|
} elsif (fac1 and lawyaw == 2 and systems.ELEC.EmerElec.getBoolValue()) {
|
||||||
FBW.degradeLaw.setValue(1);
|
FBW.degradeYawLaw.setValue(1);
|
||||||
|
} elsif (lawyaw == 0) {
|
||||||
|
FBW.degradeYawLaw.setValue(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (law == 0 and !tripleIRFail) {
|
||||||
|
FBW.degradeLaw.setValue(1);
|
||||||
|
if (!tripleSECFault) {
|
||||||
FBW.apOff = 1;
|
FBW.apOff = 1;
|
||||||
}
|
}
|
||||||
}
|
} elsif (tripleIRFail and (law == 0 or law == 1)) {
|
||||||
if (!elac1 and !elac2 and !sec1 and !sec2 and !sec3 and !fac1 and !fac2) {
|
FBW.degradeLaw.setValue(2);
|
||||||
FBW.degradeLaw.setValue(3);
|
|
||||||
FBW.apOff = 1;
|
FBW.apOff = 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
FBW.degradeYawLaw.setValue(0);
|
||||||
|
FBW.degradeLaw.setValue(0);
|
||||||
|
FBW.apOff = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pts.Controls.Gear.gearDown.getBoolValue() and !fmgc.Input.ap1.getBoolValue() and !fmgc.Input.ap2.getBoolValue()) {
|
if (dualELACFault and tripleSECFault and dualFACFault) {
|
||||||
if (law == 1) {
|
FBW.degradeLaw.setValue(3);
|
||||||
FBW.degradeLaw.setValue(2);
|
FBW.apOff = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# degrade loop runs faster; reset this variable
|
# degrade loop runs faster; reset this variable
|
||||||
law = FBW.activeLaw.getValue();
|
law = FBW.activeLaw.getValue();
|
||||||
|
|
||||||
# Mech Backup can always return to direct, if it can.
|
if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) {
|
||||||
if (law == 3 and (elac1 or elac2 or sec1 or sec2 or sec3 or fac1 or fac2) and systems.ELEC.Bus.acEss.getValue() >= 110 and (green >= 1500 or blue >= 1500 or yellow >= 1500)) {
|
if (pts.Controls.Gear.gearDown.getBoolValue()) {
|
||||||
FBW.degradeLaw.setValue(2);
|
if (law == 1) {
|
||||||
|
FBW.degradeLaw.setValue(2); # todo 3 sec timer
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (law == 2 and !tripleIRFail) {
|
||||||
|
FBW.degradeLaw.setValue(1); # todo 3 sec timer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# If they can, laws can go back to standard law
|
||||||
|
if (law == 3) {
|
||||||
|
if (!dualELACFault or !tripleSECFault or !dualFACFault) {
|
||||||
|
FBW.degradeLaw.setValue(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cas = pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue();
|
cas = pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue();
|
||||||
|
|
|
@ -10,32 +10,31 @@ var _selfTestTime = nil;
|
||||||
var ADIRSnodesND = [props.globals.getNode("/instrumentation/efis[0]/nd/ir-1", 1),props.globals.getNode("/instrumentation/efis[1]/nd/ir-2", 1),props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1)];
|
var ADIRSnodesND = [props.globals.getNode("/instrumentation/efis[0]/nd/ir-1", 1),props.globals.getNode("/instrumentation/efis[1]/nd/ir-2", 1),props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1)];
|
||||||
|
|
||||||
var ADIRU = {
|
var ADIRU = {
|
||||||
# local vars
|
|
||||||
_alignTime: 0,
|
|
||||||
_voltageMain: 0,
|
|
||||||
_voltageBackup: 0,
|
|
||||||
_voltageLimitedTime: 0,
|
|
||||||
_noPowerTime: 0,
|
|
||||||
_timeVar: 0,
|
|
||||||
_roll: 0,
|
|
||||||
_pitch: 0,
|
|
||||||
_gs: 0,
|
|
||||||
|
|
||||||
num: 0,
|
|
||||||
aligned: 0,
|
|
||||||
inAlign: 0,
|
|
||||||
outputOn: 1, # 0 = disc, 1 = normal
|
|
||||||
mode: 0, # 0 = off, 1 = nav, 2 = att
|
|
||||||
energised: 0, # 0 = off, 1 = on
|
|
||||||
operative: 0, # 0 = off,
|
|
||||||
alignTimer: nil,
|
|
||||||
input: [],
|
|
||||||
output: [],
|
|
||||||
|
|
||||||
# methods
|
# methods
|
||||||
new: func(n) {
|
new: func(n) {
|
||||||
var adiru = { parents:[ADIRU] };
|
var adiru = { parents:[ADIRU] };
|
||||||
adiru.num = n;
|
adiru.num = n;
|
||||||
|
adiru._alignTime = 0;
|
||||||
|
adiru._pfdTime = 0;
|
||||||
|
adiru._voltageMain = 0;
|
||||||
|
adiru._voltageBackup = 0;
|
||||||
|
adiru._voltageLimitedTime = 0;
|
||||||
|
adiru._noPowerTime = 0;
|
||||||
|
adiru._timeVar = 0;
|
||||||
|
adiru._roll = 0;
|
||||||
|
adiru._pitch = 0;
|
||||||
|
adiru._gs = 0;
|
||||||
|
|
||||||
|
adiru.aligned = 0;
|
||||||
|
adiru.operating = 0; # ir operating - used for PFD + fbw failure
|
||||||
|
adiru.inAlign = 0;
|
||||||
|
adiru.outputOn = 1; # 0 = disc; 1 = normal
|
||||||
|
adiru.mode = 0; # 0 = off; 1 = nav; 2 = att
|
||||||
|
adiru.energised = 0; # 0 = off; 1 = on
|
||||||
|
adiru.operative = 0; # 0 = off;
|
||||||
|
adiru.alignTimer = nil;
|
||||||
|
adiru.input = [];
|
||||||
|
adiru.output = [];
|
||||||
adiru.alignTimer = maketimer(0.1, adiru, me.alignLoop);
|
adiru.alignTimer = maketimer(0.1, adiru, me.alignLoop);
|
||||||
|
|
||||||
return adiru;
|
return adiru;
|
||||||
|
@ -93,6 +92,7 @@ var ADIRU = {
|
||||||
if (!ADIRS.skip.getValue()) {
|
if (!ADIRS.skip.getValue()) {
|
||||||
if (time > 0 and me.aligned == 0 and me.inAlign == 0 and me.operative == 1) {
|
if (time > 0 and me.aligned == 0 and me.inAlign == 0 and me.operative == 1) {
|
||||||
me._alignTime = pts.Sim.Time.elapsedSec.getValue() + time;
|
me._alignTime = pts.Sim.Time.elapsedSec.getValue() + time;
|
||||||
|
me._pfdTime = pts.Sim.Time.elapsedSec.getValue() + 20 + (rand() * 5);
|
||||||
me.inAlign = 1;
|
me.inAlign = 1;
|
||||||
if (me.alignTimer != nil) {
|
if (me.alignTimer != nil) {
|
||||||
me.alignTimer.start();
|
me.alignTimer.start();
|
||||||
|
@ -101,6 +101,7 @@ var ADIRU = {
|
||||||
} else {
|
} else {
|
||||||
if (me.aligned == 0 and me.inAlign == 0 and me.operative == 1) {
|
if (me.aligned == 0 and me.inAlign == 0 and me.operative == 1) {
|
||||||
me._alignTime = pts.Sim.Time.elapsedSec.getValue() + 5;
|
me._alignTime = pts.Sim.Time.elapsedSec.getValue() + 5;
|
||||||
|
me._pfdTime = pts.Sim.Time.elapsedSec.getValue() + 1;
|
||||||
me.inAlign = 1;
|
me.inAlign = 1;
|
||||||
if (me.alignTimer != nil) {
|
if (me.alignTimer != nil) {
|
||||||
me.alignTimer.start();
|
me.alignTimer.start();
|
||||||
|
@ -114,6 +115,7 @@ var ADIRU = {
|
||||||
me.aligned = 0;
|
me.aligned = 0;
|
||||||
ADIRSnodesND[me.num].setValue(0);
|
ADIRSnodesND[me.num].setValue(0);
|
||||||
ADIRS.Operating.aligned[me.num].setValue(0);
|
ADIRS.Operating.aligned[me.num].setValue(0);
|
||||||
|
me.operating = 0;
|
||||||
if (me.alignTimer != nil) {
|
if (me.alignTimer != nil) {
|
||||||
me.alignTimer.stop();
|
me.alignTimer.stop();
|
||||||
}
|
}
|
||||||
|
@ -124,6 +126,9 @@ var ADIRU = {
|
||||||
call(canvas_nd.ND_2.NDFo.predicates[predicate]);
|
call(canvas_nd.ND_2.NDFo.predicates[predicate]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
irOperating: func() {
|
||||||
|
me.operating = 1;
|
||||||
|
},
|
||||||
stopAlignAligned: func() {
|
stopAlignAligned: func() {
|
||||||
me.inAlign = 0;
|
me.inAlign = 0;
|
||||||
me.aligned = 1;
|
me.aligned = 1;
|
||||||
|
@ -155,9 +160,14 @@ var ADIRU = {
|
||||||
} elsif (pts.Sim.Time.elapsedSec.getValue() >= me._alignTime) {
|
} elsif (pts.Sim.Time.elapsedSec.getValue() >= me._alignTime) {
|
||||||
me.stopAlignAligned();
|
me.stopAlignAligned();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!me.operating and pts.Sim.Time.elapsedSec.getValue() >= me._pfdTime) {
|
||||||
|
me.irOperating();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
instAlign: func() {
|
instAlign: func() {
|
||||||
me.stopAlignAligned();
|
me.stopAlignAligned();
|
||||||
|
me.irOperating();
|
||||||
},
|
},
|
||||||
# Update loop
|
# Update loop
|
||||||
update: func() {
|
update: func() {
|
||||||
|
|
Loading…
Reference in a new issue