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();
|
||||
|
||||
# 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["HDG_group"].show();
|
||||
me["AI_error"].hide();
|
||||
|
@ -1132,7 +1132,7 @@ var canvas_PFD_1 = {
|
|||
me["FPV"].hide();
|
||||
} else {
|
||||
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();
|
||||
} else {
|
||||
var roll_deg = roll.getValue() or 0;
|
||||
|
@ -1870,7 +1870,7 @@ var canvas_PFD_2 = {
|
|||
wow2_act = wow2.getValue();
|
||||
|
||||
# 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["HDG_group"].show();
|
||||
me["AI_error"].hide();
|
||||
|
@ -1907,7 +1907,7 @@ var canvas_PFD_2 = {
|
|||
me["FPV"].hide();
|
||||
} else {
|
||||
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();
|
||||
} else {
|
||||
var roll_deg = roll.getValue() or 0;
|
||||
|
|
|
@ -13,10 +13,24 @@ var sec2 = 0;
|
|||
var sec3 = 0;
|
||||
var fac1 = 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 green = 0;
|
||||
var yellow = 0;
|
||||
var blueGreenFail = 0;
|
||||
var greenYellowFail = 0;
|
||||
var ail = 0;
|
||||
var roll = 0;
|
||||
var rollback = 0;
|
||||
|
@ -154,84 +168,81 @@ var update_loop = func {
|
|||
fac2 = FBW.Computers.fac2.getBoolValue();
|
||||
law = FBW.activeLaw.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
|
||||
blue = systems.HYD.Psi.blue.getValue();
|
||||
green = systems.HYD.Psi.green.getValue();
|
||||
yellow = systems.HYD.Psi.yellow.getValue();
|
||||
if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) {
|
||||
if (!elac1 and !elac2) {
|
||||
if (lawyaw == 0) {
|
||||
FBW.degradeYawLaw.setValue(1);
|
||||
}
|
||||
if (law == 0) {
|
||||
FBW.degradeLaw.setValue(1);
|
||||
FBW.apOff = 1;
|
||||
}
|
||||
}
|
||||
if ((!elac1 and elac2 and ((green < 1500 and yellow >= 1500) or (green >= 1500 and yellow < 1500))) or (!elac2 and elac1 and blue < 1500)) {
|
||||
if (lawyaw == 0) {
|
||||
FBW.degradeYawLaw.setValue(1);
|
||||
}
|
||||
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)) {
|
||||
|
||||
dualELACFault = !elac1 and !elac2;
|
||||
tripleSECFault = !sec1 and !sec2 and !sec3;
|
||||
dualFACFault = !fac1 and !fac2;
|
||||
|
||||
blueGreenFail = blue < 1500 and green < 1500 and yellow >= 1500;
|
||||
greenYellowFail = blue >= 1500 and green < 1500 and yellow < 1500;
|
||||
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;
|
||||
doubleIRFail = (!ir1 and !ir2 and ir3) or (ir1 and !ir2 and !ir3) or (!ir1 and ir2 and !ir3);
|
||||
|
||||
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 (lawyaw == 0 or lawyaw == 1) {
|
||||
FBW.degradeYawLaw.setValue(2);
|
||||
}
|
||||
if (law == 0) {
|
||||
FBW.degradeLaw.setValue(1);
|
||||
} elsif (fac1 and lawyaw == 2 and systems.ELEC.EmerElec.getBoolValue()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!elac1 and !elac2 and !sec1 and !sec2 and !sec3 and !fac1 and !fac2) {
|
||||
FBW.degradeLaw.setValue(3);
|
||||
} elsif (tripleIRFail and (law == 0 or law == 1)) {
|
||||
FBW.degradeLaw.setValue(2);
|
||||
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 (law == 1) {
|
||||
FBW.degradeLaw.setValue(2);
|
||||
}
|
||||
if (dualELACFault and tripleSECFault and dualFACFault) {
|
||||
FBW.degradeLaw.setValue(3);
|
||||
FBW.apOff = 1;
|
||||
}
|
||||
|
||||
|
||||
# degrade loop runs faster; reset this variable
|
||||
law = FBW.activeLaw.getValue();
|
||||
|
||||
# Mech Backup can always return to direct, if it can.
|
||||
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)) {
|
||||
FBW.degradeLaw.setValue(2);
|
||||
if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) {
|
||||
if (pts.Controls.Gear.gearDown.getBoolValue()) {
|
||||
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();
|
||||
|
|
|
@ -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 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
|
||||
new: func(n) {
|
||||
var adiru = { parents:[ADIRU] };
|
||||
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);
|
||||
|
||||
return adiru;
|
||||
|
@ -93,6 +92,7 @@ var ADIRU = {
|
|||
if (!ADIRS.skip.getValue()) {
|
||||
if (time > 0 and me.aligned == 0 and me.inAlign == 0 and me.operative == 1) {
|
||||
me._alignTime = pts.Sim.Time.elapsedSec.getValue() + time;
|
||||
me._pfdTime = pts.Sim.Time.elapsedSec.getValue() + 20 + (rand() * 5);
|
||||
me.inAlign = 1;
|
||||
if (me.alignTimer != nil) {
|
||||
me.alignTimer.start();
|
||||
|
@ -101,6 +101,7 @@ var ADIRU = {
|
|||
} else {
|
||||
if (me.aligned == 0 and me.inAlign == 0 and me.operative == 1) {
|
||||
me._alignTime = pts.Sim.Time.elapsedSec.getValue() + 5;
|
||||
me._pfdTime = pts.Sim.Time.elapsedSec.getValue() + 1;
|
||||
me.inAlign = 1;
|
||||
if (me.alignTimer != nil) {
|
||||
me.alignTimer.start();
|
||||
|
@ -114,6 +115,7 @@ var ADIRU = {
|
|||
me.aligned = 0;
|
||||
ADIRSnodesND[me.num].setValue(0);
|
||||
ADIRS.Operating.aligned[me.num].setValue(0);
|
||||
me.operating = 0;
|
||||
if (me.alignTimer != nil) {
|
||||
me.alignTimer.stop();
|
||||
}
|
||||
|
@ -124,6 +126,9 @@ var ADIRU = {
|
|||
call(canvas_nd.ND_2.NDFo.predicates[predicate]);
|
||||
}
|
||||
},
|
||||
irOperating: func() {
|
||||
me.operating = 1;
|
||||
},
|
||||
stopAlignAligned: func() {
|
||||
me.inAlign = 0;
|
||||
me.aligned = 1;
|
||||
|
@ -155,9 +160,14 @@ var ADIRU = {
|
|||
} elsif (pts.Sim.Time.elapsedSec.getValue() >= me._alignTime) {
|
||||
me.stopAlignAligned();
|
||||
}
|
||||
|
||||
if (!me.operating and pts.Sim.Time.elapsedSec.getValue() >= me._pfdTime) {
|
||||
me.irOperating();
|
||||
}
|
||||
},
|
||||
instAlign: func() {
|
||||
me.stopAlignAligned();
|
||||
me.irOperating();
|
||||
},
|
||||
# Update loop
|
||||
update: func() {
|
||||
|
|
Loading…
Reference in a new issue