1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
Jonathan Redpath 2022-01-25 16:35:39 +00:00
commit 164bb0fb55
16 changed files with 382 additions and 177 deletions

View file

@ -4857,6 +4857,8 @@
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<not><property>FMGC/FCU-working</property></not>
<equals>
<property>it-autoflight/input/kts-mach</property>
<value>1</value>
@ -4882,6 +4884,7 @@
<property>it-autoflight/input/spd-managed</property>
<value>0</value>
</equals>
<property>FMGC/FCU-working</property>
</and>
</condition>
</animation>
@ -4903,6 +4906,7 @@
<property>it-autoflight/input/spd-managed</property>
<value>0</value>
</equals>
<property>FMGC/FCU-working</property>
</and>
</condition>
</animation>
@ -4945,6 +4949,7 @@
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<not><property>FMGC/FCU-working</property></not>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>0</value>
@ -4963,6 +4968,7 @@
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<not><property>FMGC/FCU-working</property></not>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>1</value>
@ -4984,6 +4990,7 @@
<property>it-autoflight/custom/show-hdg</property>
<value>1</value>
</equals>
<property>FMGC/FCU-working</property>
</and>
</condition>
</animation>
@ -5030,10 +5037,13 @@
<type>select</type>
<object-name>alt-text</object-name>
<condition>
<not-equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</not-equals>
<and>
<property>FMGC/FCU-working</property>
<not-equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</not-equals>
</and>
</condition>
</animation>
@ -5082,6 +5092,7 @@
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<not><property>FMGC/FCU-working</property></not>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>1</value>
@ -5104,6 +5115,7 @@
<property>it-autoflight/output/vert</property>
<value>1</value>
</equals>
<property>FMGC/FCU-working</property>
</and>
</condition>
</animation>
@ -5121,6 +5133,7 @@
<property>it-autoflight/output/vert</property>
<value>5</value>
</equals>
<property>FMGC/FCU-working</property>
</and>
</condition>
</animation>
@ -5142,6 +5155,7 @@
<property>it-autoflight/output/vert</property>
<value>5</value>
</not-equals>
<property>FMGC/FCU-working</property>
</and>
</condition>
</animation>

View file

@ -93,9 +93,6 @@ var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altit
var clbReducFt = props.globals.getNode("/fdm/jsbsim/fadec/clbreduc-ft", 1);
var reducFt = props.globals.getNode("/FMGC/internal/accel-agl-ft", 1); # It's not AGL anymore
var thrAccSet = props.globals.getNode("/MCDUC/thracc-set", 1);
var flapTO = props.globals.getNode("/FMGC/internal/to-flap", 1);
var THSTO = props.globals.getNode("/FMGC/internal/to-ths", 1);
var flapTHSSet = props.globals.getNode("/FMGC/internal/flap-ths-set", 1);
var flex = props.globals.getNode("/fdm/jsbsim/fadec/limit/flex-temp", 1);
var flexSet = props.globals.getNode("/fdm/jsbsim/fadec/limit/flex-active-cmd", 1);
var engOutAcc = props.globals.getNode("/FMGC/internal/eng-out-reduc", 1);
@ -4393,12 +4390,12 @@ var canvas_MCDU_base = {
me["Simple_L5"].setFontSize(small);
}
if (flapTHSSet.getValue() == 1) {
if (fmgc.FMGCInternal.toFlapThsSet) {
me["Simple_R3"].setFontSize(normal);
if (THSTO.getValue() >= 0) {
me["Simple_R3"].setText(sprintf("%s", flapTO.getValue()) ~ sprintf("/UP%2.1f", THSTO.getValue()));
if (fmgc.FMGCInternal.toThs) {
me["Simple_R3"].setText(sprintf("%s", fmgc.FMGCInternal.toFlap) ~ sprintf("/UP%2.1f", fmgc.FMGCInternal.toThs));
} else {
me["Simple_R3"].setText(sprintf("%s", flapTO.getValue()) ~ sprintf("/DN%2.1f", -1 * THSTO.getValue()));
me["Simple_R3"].setText(sprintf("%s", fmgc.FMGCInternal.toFlap) ~ sprintf("/DN%2.1f", -1 * fmgc.FMGCInternal.toThs));
}
} else {
me["Simple_R3"].setFontSize(small);

View file

@ -1685,7 +1685,7 @@
<object-name>overfly</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.button("OVFY", 0);</script>
@ -1710,23 +1710,11 @@
<action>
<button>0</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/MCDU[0]/clrbtn-timeout</property>
<step>1</step>
<min>0</min>
<max>6</max>
<wrap>false</wrap>
</binding>
<binding>
<command>nasal</command>
<script>mcdu.button("LONGCLR", 0);</script>
<script>mcdu.button("CLR", 0, "down");</script>
<condition>
<and>
<equals>
<property>/MCDU[0]/clrbtn-timeout</property>
<value>5</value>
</equals>
<greater-than-equals>
<property>systems/electrical/bus/ac-1</property>
<value>110</value>
@ -1737,21 +1725,17 @@
</greater-than>
</and>
</condition>
</binding>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>mcdu.button("CLR", 0);</script>
<script>mcdu.button("CLR", 0, "up");</script>
<condition>
<and>
<less-than>
<property>/MCDU[0]/clrbtn-timeout</property>
<value>5</value>
</less-than>
<greater-than-equals>
<property>systems/electrical/bus/ac-1</property>
<value>110</value>
</greater-than-equals>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu1</property>
<value>0.01</value>
@ -1759,11 +1743,6 @@
</and>
</condition>
</binding>
<binding>
<command>property-assign</command>
<property>/MCDU[0]/clrbtn-timeout</property>
<value>0</value>
</binding>
</mod-up>
</action>
</animation>

View file

@ -1685,7 +1685,7 @@
<object-name>overfly</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.button("OVFY", 1);</script>
@ -1710,48 +1710,32 @@
<action>
<button>0</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/MCDU[1]/clrbtn-timeout</property>
<step>1</step>
<min>0</min>
<max>6</max>
<wrap>false</wrap>
</binding>
<binding>
<command>nasal</command>
<script>mcdu.button("LONGCLR", 1);</script>
<script>mcdu.button("CLR", 1, "down");</script>
<condition>
<and>
<equals>
<property>/MCDU[1]/clrbtn-timeout</property>
<value>5</value>
</equals>
<greater-than-equals>
<property>systems/electrical/bus/ac-2</property>
<value>110</value>
</greater-than-equals>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu2</property>
<value>0.01</value>
</greater-than>
</and>
</condition>
</binding>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>mcdu.button("CLR", 1);</script>
<script>mcdu.button("CLR", 1, "up");</script>
<condition>
<and>
<less-than>
<property>/MCDU[1]/clrbtn-timeout</property>
<value>5</value>
</less-than>
<greater-than-equals>
<property>systems/electrical/bus/ac-2</property>
<value>110</value>
</greater-than-equals>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu2</property>
<value>0.01</value>
@ -1759,11 +1743,6 @@
</and>
</condition>
</binding>
<binding>
<command>property-assign</command>
<property>/MCDU[1]/clrbtn-timeout</property>
<value>0</value>
</binding>
</mod-up>
</action>
</animation>

View file

@ -19,6 +19,7 @@ var engOpt = props.globals.getNode("/options/eng", 1);
var thrustState = [nil, nil];
# local variables
var takeoffConfig = 0;
var transmitFlag1 = 0;
var transmitFlag2 = 0;
var phaseVar3 = nil;
@ -2325,6 +2326,40 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(fctlSpdBrkStillOut);
}
if (fctlPitchTrimDisag.clearFlag == 0 and takeoffConfig and fmgc.FMGCInternal.toFlapThsSet and abs(-getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") - fmgc.FMGCInternal.toThs) >= 1.3) {
fctlPitchTrimDisag.active = 1;
fctlPitchTrimDisag2.active = 1;
} else {
ECAM_controller.warningReset(fctlPitchTrimDisag);
ECAM_controller.warningReset(fctlPitchTrimDisag2);
}
if (fctlFlapsDisag.clearFlag == 0 and takeoffConfig and fmgc.FMGCInternal.toFlapThsSet and (fmgc.FMGCInternal.toFlap + 1 != pts.Controls.Flight.flapsPos.getValue())) {
fctlFlapsDisag.active = 1;
} else {
ECAM_controller.warningReset(fctlFlapsDisag);
}
if (toSpdsDisag.clearFlag == 0 and takeoffConfig and fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set and !(fmgc.FMGCInternal.v1 <= fmgc.FMGCInternal.vr and fmgc.FMGCInternal.vr <= fmgc.FMGCInternal.v2)) {
toSpdsDisag.active = 1;
} else {
ECAM_controller.warningReset(toSpdsDisag);
}
if (toSpdsTooLow.clearFlag == 0 and takeoffConfig and
fmgc.FMGCInternal.toFlapThsSet and fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet and fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set
and (fmgc.FMGCInternal.v1 < mcdu.VMCG.getValue() or fmgc.FMGCInternal.vr < (mcdu.VMCA.getValue() * 1.05) or fmgc.FMGCInternal.v2 < (mcdu.VMCA.getValue() * 1.10) or fmgc.FMGCInternal.v2 < (1.13 * mcdu.chooseVS1G()))) {
toSpdsTooLow.active = 1;
} else {
ECAM_controller.warningReset(toSpdsTooLow);
}
if (toSpdsNotInserted.clearFlag == 0 and takeoffConfig and (!fmgc.FMGCInternal.v1set or !fmgc.FMGCInternal.vrset or !fmgc.FMGCInternal.v2set)) {
toSpdsNotInserted.active = 1;
} else {
ECAM_controller.warningReset(toSpdsNotInserted);
}
gearPosition = pts.Gear.position[1].getValue();
if (directLaw.clearFlag == 0 and warningNodes.Timers.directLaw.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8) {
directLaw.active = 1;

View file

@ -494,6 +494,12 @@ var warnings = std.Vector.new([
# F/CTL SPD BRK STILL OUT
var fctlSpdBrkStillOut = warning.new(msg: "F/CTL SPD BRK STILL OUT ", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var fctlPitchTrimDisag = warning.new(msg: "F/CTL", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var fctlPitchTrimDisag2 = warning.new(msg: "PITCH TRIM/MCDU/CG DISAGREE", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var fctlFlapsDisag = warning.new(msg: "F/CTL FLAPS/MCDU DISAGREE", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var toSpdsDisag = warning.new(msg: "T.O V1/VR/V2 DISAGREE ", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var toSpdsTooLow = warning.new(msg: "T.O SPEEDS TOO LOW ", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var toSpdsNotInserted = warning.new(msg: "T.O SPEEDS NOT INSERTED ", colour: "a", aural: 1, light: 1, isMainMsg: 1),
# DIRECT LAW
var directLaw = warning.new(msg: "F/CTL DIRECT LAW", colour: "a", aural: 1, light: 1, isMainMsg: 1),

View file

@ -49,6 +49,7 @@ var Misc = {
};
var Position = {
airborne5Secs: props.globals.getNode("/systems/fmgc/airborne-5-secs"),
gearAglFtTemp: 0,
gearAglFt: props.globals.getNode("/position/gear-agl-ft", 1),
indicatedAltitudeFt: props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1),
@ -429,7 +430,7 @@ var ITAF = {
},
ap1Master: func(s) {
if (s == 1) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and FMGCNodes.Power.FMGC1Powered.getBoolValue() and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100 and Position.airborne5Secs.getBoolValue()) {
Output.ap1.setBoolValue(1);
me.updateFma();
Output.latTemp = Output.lat.getValue();
@ -451,7 +452,7 @@ var ITAF = {
},
ap2Master: func(s) {
if (s == 1) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and FMGCNodes.Power.FMGC2Powered.getBoolValue() and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100 and Position.airborne5Secs.getBoolValue()) {
Output.ap2.setBoolValue(1);
me.updateFma();
Output.latTemp = Output.lat.getValue();
@ -482,7 +483,8 @@ var ITAF = {
},
athrMaster: func(s) {
if (s == 1) {
if (systems.ELEC.Bus.acEss.getValue() >= 110 and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0 and systems.FADEC.n1Mode[0].getValue() == 0 and systems.FADEC.n1Mode[1].getValue() == 0) {
if ((FMGCNodes.Power.FMGC1Powered.getBoolValue() or FMGCNodes.Power.FMGC2Powered.getBoolValue()) and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0 and systems.FADEC.n1Mode[0].getValue() == 0 and systems.FADEC.n1Mode[1].getValue() == 0) {
Output.athr.setBoolValue(1);
Custom.ThrLock.setValue(0);
Custom.Sound.enableAthrOff = 1;

View file

@ -129,6 +129,9 @@ var FMGCInternal = {
vrset: 0,
v2: 0,
v2set: 0,
toFlap: 0,
toThs: 0,
toFlapThsSet: 0,
# PERF APPR
destMag: 0,
@ -270,6 +273,10 @@ var FMGCNodes = {
machToKtsFactor: props.globals.getNode("/FMGC/internal/mach-to-kts-factor"),
mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"),
slat: props.globals.getNode("/FMGC/internal/slat"),
Power: {
FMGC1Powered: props.globals.getNode("systems/fmgc/power/power-1-on"),
FMGC2Powered: props.globals.getNode("systems/fmgc/power/power-2-on"),
},
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
tow: props.globals.getNode("/FMGC/internal/tow"),

View file

@ -195,7 +195,7 @@ var MessageController = {
typeIIMessages: std.Vector.new([
TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"),
TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0),
TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0),
TypeIIMessage.new("T.O SPEEDS TOO LOW", "amb", 0),TypeIIMessage.new("CHECK TAKE OFF DATA", "amb", 0),
TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533
TypeIIMessage.new("GPS PRIMARY"),TypeIIMessage.new("GPS PRIMARY LOST", "amb", 0),
]),

View file

@ -558,6 +558,19 @@ var departurePage = {
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]);
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway;
mcdu.perfToCheckTakeoffData(me.computer);
if (fmgc.FMGCInternal.v1set) {
fmgc.FMGCInternal.v1set = 0;
fmgc.FMGCInternal.v1 = 0;
}
if (fmgc.FMGCInternal.vrset) {
fmgc.FMGCInternal.vrset = 0;
fmgc.FMGCInternal.vr = 0;
}
if (fmgc.FMGCInternal.v2set) {
fmgc.FMGCInternal.v2set = 0;
fmgc.FMGCInternal.v2 = 0;
}
me.updateRunways();
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer);

View file

@ -169,6 +169,7 @@ var fuelPredInput = func(key, i) {
fmgc.fuelCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
} else if (find("/", scratchpad) != -1) {
if (acconfig_weight_kgs.getValue() == 1) {
scratchpad = scratchpad / LBS2KGS;
@ -199,6 +200,7 @@ var fuelPredInput = func(key, i) {
fmgc.fuelCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
@ -235,6 +237,7 @@ var fuelPredInput = func(key, i) {
fmgc.fuelCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}

View file

@ -207,6 +207,7 @@ var initInputB = func(key, i) {
fmgc.blockCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
} else if (find("/", scratchpad) != -1) {
if (acconfig_weight_kgs.getValue() == 1) {
scratchpad = scratchpad / LBS2KGS;
@ -238,6 +239,7 @@ var initInputB = func(key, i) {
fmgc.blockCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
@ -275,6 +277,7 @@ var initInputB = func(key, i) {
fmgc.blockCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}

View file

@ -155,9 +155,9 @@ var MCDU_reset = func(i) {
fmgc.FMGCInternal.v2set = 0;
setprop("/FMGC/internal/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("/MCDUC/thracc-set", 0);
setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/flap-ths-set", 0);
fmgc.FMGCInternal.toFlap = 0;
fmgc.FMGCInternal.toThs = 0.0;
fmgc.FMGCInternal.toFlapThsSet = 0;
setprop("/fdm/jsbsim/fadec/limit/flex-temp", 0);
setprop("/fdm/jsbsim/fadec/limit/flex-active-cmd", 0);
setprop("/FMGC/internal/eng-out-reduc", "1500");
@ -1535,6 +1535,8 @@ var pagebutton = func(btn, i) {
}
}
var buttonCLRDown = [0,0]; # counter for down event
var button = func(btn, i, event = "") {
page = pageNode[i].getValue();
if (page != "MCDU") {
@ -1544,32 +1546,40 @@ var button = func(btn, i, event = "") {
} else if (btn == "SP") {
mcdu_scratchpad.scratchpads[i].addChar(" ");
} else if (btn == "CLR") {
if (size(scratchpad) == 0) {
mcdu_scratchpad.scratchpads[i].addChar("CLR");
} else {
mcdu_scratchpad.scratchpads[i].clear();
if (event == "down") {
if (size(scratchpad) > 0) {
if (buttonCLRDown[i] > 4) {
mcdu_scratchpad.scratchpads[i].empty();
}
buttonCLRDown[i] = buttonCLRDown[i] + 1;
}
}
else if (event == "" or buttonCLRDown[i]<=4) {
buttonCLRDown[i] = 0;
#var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless??
if (size(scratchpad) == 0) {
mcdu_scratchpad.scratchpads[i].addChar("CLR");
} else {
mcdu_scratchpad.scratchpads[i].clear();
}
} else { # up with buttonCLRDown[i]>4
buttonCLRDown[i] = 0;
}
} else if (btn == "LONGCLR") {
mcdu_scratchpad.scratchpads[i].empty();
} else if (btn == "DOT") {
mcdu_scratchpad.scratchpads[i].addChar(".");
} else if (btn == "PLUSMINUS") {
if (size(scratchpad)==0) {
mcdu_message(i, "NOT ALLOWED");
} else if (isint(scratchpad)==1) {
mcdu_scratchpad.scratchpads[i].addChar("-");
var _toggle = right(scratchpad,1);
if (_toggle == "+" or _toggle == "-") {
_toggle = (_toggle == "-") ? "+" : "-";
mcdu_scratchpad.scratchpads[i].clear();
mcdu_scratchpad.scratchpads[i].addChar(_toggle);
} else {
var _toggle = right(scratchpad,1);
if (find(_toggle,"-+")!=-1) {
_toggle = (_toggle == "-") ? "+" : "-";
mcdu_scratchpad.scratchpads[i].clear();
mcdu_scratchpad.scratchpads[i].addChar(_toggle);
} else {
mcdu_message(i, "NOT ALLOWED");
}
mcdu_scratchpad.scratchpads[i].addChar("-");
}
} else if (btn == "OVFY") {
if (size(scratchpad)==0) {
if (size(scratchpad) == 0) {
mcdu_scratchpad.scratchpads[i].addChar("@");
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -3,19 +3,55 @@
# Copyright (c) 2022 Josh Davidson (Octal450)
# Copyright (c) 2020 Matthew Maring (mattmaring)
# VMCA 109.5 at 0ft
# VMCG 106.5 at 0ft all conf
var standard_VMCA = 109.5; # TODO calculate VMCA/VMCG on altitude (ft) of departure airport (read below)
var standard_VMCG = 106.5;
# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT))
var perfTOCheckVSpeeds = func(i) {
if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { # only when v1/vr/v2 all sets
if (fmgc.FMGCInternal.v1>fmgc.FMGCInternal.vr or fmgc.FMGCInternal.vr > fmgc.FMGCInternal.v2) mcdu_messageTypeII(i,"V1/VR/V2 DISAGREE");
else if (fmgc.FMGCInternal.v1<standard_VMCG or fmgc.FMGCInternal.vr<(standard_VMCA*1.05) or fmgc.FMGCInternal.v2<(standard_VMCA*1.10)) mcdu_messageTypeII(i,"TO SPEED TOO LOW");
#else if (Vr<KVr*VS1G or V2<KV2*VS1G) mcdu_messageTypeII(i,"TO SPEED TOO LOW"); #TODO - check to VS1G and look constant KVr KV2 on manual, not own by me :/
var doneMessageCheck = 0;
var perfToCheckTakeoffData = func(i) {
if (fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set) {
if (doneMessageCheck) {
mcdu_scratchpad.messageQueues[i].deleteWithText("CHECK TAKE OFF DATA");
}
mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("CHECK TAKE OFF DATA"));
doneMessageCheck = 1;
}
}
var doneMessageDisag = 0;
var perfTOCheckVSpeedsConsistency = func(i) {
if (fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set) {
if (!(fmgc.FMGCInternal.v1 <= fmgc.FMGCInternal.vr and fmgc.FMGCInternal.vr <= fmgc.FMGCInternal.v2)) {
if (doneMessageDisag) {
mcdu_scratchpad.messageQueues[i].deleteWithText("V1/VR/V2 DISAGREE");
}
mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("V1/VR/V2 DISAGREE"));
doneMessageDisag = 1;
}
}
}
var VMCA = props.globals.getNode("/FMGC/internal/vmca-kt");
var VMCG = props.globals.getNode("/FMGC/internal/vmcg-kt");
var chooseVS1G = func() {
if (fmgc.FMGCInternal.toFlap == 1) {
return fmgc.FMGCInternal.vs1g_conf_1f;
} elsif (fmgc.FMGCInternal.toFlap == 2) {
return fmgc.FMGCInternal.vs1g_conf_2;
} elsif (fmgc.FMGCInternal.toFlap == 3) {
return fmgc.FMGCInternal.vs1g_conf_3;
}
};
var doneMessageToLow = 0;
var perfTOCheckVSpeedsLimitations = func(i) {
if (fmgc.FMGCInternal.toFlapThsSet and fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet and fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set) {
if (fmgc.FMGCInternal.v1 < VMCG.getValue() or fmgc.FMGCInternal.vr < (VMCA.getValue() * 1.05) or fmgc.FMGCInternal.v2 < (VMCA.getValue() * 1.10) or fmgc.FMGCInternal.v2 < (1.13 * chooseVS1G())) {
if (doneMessageToLow) {
mcdu_scratchpad.messageQueues[i].deleteWithText("T.O SPEEDS TOO LOW");
}
mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("T.O SPEEDS TOO LOW"));
doneMessageToLow = 1;
}
}
}
@ -42,7 +78,8 @@ var perfTOInput = func(key, i) {
fmgc.FMGCNodes.v1set.setValue(1);
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeeds(i); # do V-speeds validation
perfTOCheckVSpeedsConsistency(i);
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -63,7 +100,8 @@ var perfTOInput = func(key, i) {
fmgc.FMGCInternal.vrset = 1;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeeds(i); # do V-speeds validation
perfTOCheckVSpeedsConsistency(i);
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -87,7 +125,8 @@ var perfTOInput = func(key, i) {
setprop("/it-autoflight/settings/togaspd", scratchpad);
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeeds(i); # do V-speeds validation
perfTOCheckVSpeedsConsistency(i);
perfTOCheckVSpeedsLimitations(i);
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -152,9 +191,9 @@ var perfTOInput = func(key, i) {
}
} else if (key == "R3" and modifiable) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/flap-ths-set", 0);
fmgc.FMGCInternal.toFlap = 0;
fmgc.FMGCInternal.toThs = 0;
fmgc.FMGCInternal.toFlapThsSet = 0;
mcdu_scratchpad.scratchpads[i].empty();
} else {
if (find("/", scratchpad) != -1) {
@ -165,45 +204,71 @@ var perfTOInput = func(key, i) {
var trims = size(trim);
var trima = substr(trim, 2);
var trimb = substr(trim, 0, 3);
var validtrima = num(trima) != nil and num(trima) >= 0 and num(trima) <= 7.0;
var validtrimb = num(trimb) != nil and num(trimb) >= 0 and num(trimb) <= 7.0;
if (flaps == 0 and getprop("/FMGC/internal/flap-ths-set")) {
if (flaps == 0 and fmgc.FMGCInternal.toFlapThsSet) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-ths", -1 * trima);
fmgc.FMGCInternal.toThs = -1 * trima;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
perfToCheckTakeoffData(i);
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-ths", -1 * trimb);
fmgc.FMGCInternal.toThs = -1 * trimb;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
perfToCheckTakeoffData(i);
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-ths", trima);
fmgc.FMGCInternal.toThs = trima;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
perfToCheckTakeoffData(i);
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-ths", trimb);
fmgc.FMGCInternal.toThs = trimb;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
perfToCheckTakeoffData(i);
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", -1 * trima);
setprop("/FMGC/internal/flap-ths-set", 1);
fmgc.FMGCInternal.toFlap = flap;
fmgc.FMGCInternal.toThs = -1 * trima;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
if (fmgc.FMGCInternal.toFlapThsSet) {
perfToCheckTakeoffData(i);
}
fmgc.FMGCInternal.toFlapThsSet = 1;
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", -1 * trimb);
setprop("/FMGC/internal/flap-ths-set", 1);
fmgc.FMGCInternal.toFlap = flap;
fmgc.FMGCInternal.toThs = -1 * trimb;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
if (fmgc.FMGCInternal.toFlapThsSet) {
perfToCheckTakeoffData(i);
}
fmgc.FMGCInternal.toFlapThsSet = 1;
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", trima);
setprop("/FMGC/internal/flap-ths-set", 1);
fmgc.FMGCInternal.toFlap = flap;
fmgc.FMGCInternal.toThs = trima;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
if (fmgc.FMGCInternal.toFlapThsSet) {
perfToCheckTakeoffData(i);
}
fmgc.FMGCInternal.toFlapThsSet = 1;
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", trimb);
setprop("/FMGC/internal/flap-ths-set", 1);
fmgc.FMGCInternal.toFlap = flap;
fmgc.FMGCInternal.toThs = trimb;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
if (fmgc.FMGCInternal.toFlapThsSet) {
perfToCheckTakeoffData(i);
}
fmgc.FMGCInternal.toFlapThsSet = 1;
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -211,11 +276,13 @@ var perfTOInput = func(key, i) {
mcdu_message(i, "NOT ALLOWED");
}
} else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) {
setprop("/FMGC/internal/to-flap", scratchpad);
if (!getprop("/FMGC/internal/flap-ths-set")) {
setprop("/FMGC/internal/flap-ths-set", 1);
}
fmgc.FMGCInternal.toFlap = scratchpad;
mcdu_scratchpad.scratchpads[i].empty();
perfTOCheckVSpeedsLimitations(i);
if (fmgc.FMGCInternal.toFlapThsSet) {
perfToCheckTakeoffData(i);
}
fmgc.FMGCInternal.toFlapThsSet = 1;
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -231,6 +298,8 @@ var perfTOInput = func(key, i) {
if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 99) {
systems.FADEC.Limit.flexTemp.setValue(scratchpad);
systems.FADEC.Limit.flexActiveCmd.setBoolValue(1);
perfTOCheckVSpeedsLimitations(i);
perfToCheckTakeoffData(i);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -1,15 +1,5 @@
# A3XX Electrical System
# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
# Local vars
var battery1_sw = 0;
var battery2_sw = 0;
var batt1_fail = 0;
var batt2_fail = 0;
var battery1_percent = 0;
var battery2_percent = 0;
var dc1 = 0;
var dc2 = 0;
# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
# Main class
var ELEC = {
@ -204,47 +194,33 @@ var ELEC = {
me.Fail.tr1Fault.setBoolValue(0);
me.Fail.tr2Fault.setBoolValue(0);
},
_FMGC1: 0,
_FMGC2: 0,
_activeFMGC: nil,
_timer1On: 0,
_timer2On: 0,
loop: func(notification) {
# Autopilot Disconnection routines
me._activeFMGC = fcu.FCUController.activeFMGC.getValue();
me._FMGC1 = fmgc.Output.ap1.getValue();
me._FMGC2 = fmgc.Output.ap2.getValue();
if (notification.dcEssShed < 25) {
if (me._FMGC1 and !me._timer1On) { # delay 1 cycle to avoid spurious
me._timer1On = 1;
} elsif (me._FMGC1) {
if (notification.dcEssShed < 25) {
fcu.apOff("hard", 1);
if (me._activeFMGC == 1) {
fcu.athrOff("hard");
}
}
me._timer1On = 0;
}
}
if (notification.dc2 < 25) {
if (me._FMGC2 and !me._timer2On) { # delay 1 cycle to avoid spurious
me._timer2On = 1;
} elsif (me._FMGC2) {
if (notification.dc2 < 25) {
fcu.apOff("hard", 2);
if (me._activeFMGC == 2) {
fcu.athrOff("hard");
}
}
me._timer2On = 0;
}
}
loop: func() {
# Empty
},
};
setlistener("/systems/fmgc/power/power-1-on", func(val) {
if (!val.getBoolValue()) {
if (fmgc.Output.ap1.getValue()) {
fcu.apOff("hard", 1);
}
if (fcu.FCUController.activeFMGC.getValue() == 1 and fmgc.Output.athr.getValue()) {
fcu.athrOff("hard");
}
}
}, 0, 0);
setlistener("/systems/fmgc/power/power-2-on", func(val) {
if (!val.getBoolValue()) {
if (fmgc.Output.ap2.getValue()) {
fcu.apOff("hard", 2);
}
if (fcu.FCUController.activeFMGC.getValue() == 2 and fmgc.Output.athr.getValue()) {
fcu.athrOff("hard");
}
}
}, 0, 0);
# Emesary
var A320Electrical = notifications.SystemRecipient.new("A320 Electrical",ELEC.loop,ELEC);
emesary.GlobalTransmitter.Register(A320Electrical);

View file

@ -4,9 +4,52 @@
<!-- Copyright (c) 2022 Josh Davidson and Jonathan Redpath -->
<system name="A320: FMGC">
<property value="350">/FMGC/internal/vmo-kts</property>
<channel name="FMGC Power" execrate="8">
<switch name="/systems/fmgc/power/power-1">
<default value="0"/>
<test logic="OR" value="1">
/systems/electrical/bus/dc-ess-shed ge 25
</test>
</switch>
<switch name="/systems/fmgc/power/power-2">
<default value="0"/>
<test logic="OR" value="1">
/systems/electrical/bus/dc-2 ge 25
</test>
</switch>
<actuator name="/systems/fmgc/power/power-1-timer">
<input>/systems/fmgc/power/power-1</input>
<rate_limit sense="decr">5</rate_limit>
<rate_limit sense="incr">100</rate_limit>
</actuator>
<actuator name="/systems/fmgc/power/power-2-timer">
<input>/systems/fmgc/power/power-2</input>
<rate_limit sense="decr">5</rate_limit>
<rate_limit sense="incr">100</rate_limit>
</actuator>
<switch name="/systems/fmgc/power/power-1-on">
<default value="0"/>
<test logic="OR" value="1">
/systems/fmgc/power/power-1-timer ne 0
</test>
</switch>
<switch name="/systems/fmgc/power/power-2-on">
<default value="0"/>
<test logic="OR" value="1">
/systems/fmgc/power/power-2-timer ne 0
</test>
</switch>
</channel>
<channel name="Envelope Protection" execrate="8">
<!-- Vmo/Mmo -->
@ -382,7 +425,7 @@
70000 118.16
75000 122.28
80000 126.35
</tableData>
</tableData>
</table>
</function>
</fcs_function>
@ -593,6 +636,50 @@
</function>
</fcs_function>
<!-- VMCA -->
<fcs_function name="/FMGC/internal/vmca-kt">
<function>
<table>
<independentVar lookup="row">/position/altitude-ft</independentVar>
<tableData>
-2000 112.0
0 110.0
2000 108.0
4000 107.5
6000 105.5
8000 103.0
9200 101.2
10000 100.0
12000 96.5
14100 93.5
</tableData>
</table>
</function>
</fcs_function>
<!-- VMCG -->
<fcs_function name="/FMGC/internal/vmcg-kt">
<function>
<table>
<independentVar lookup="row">/position/altitude-ft</independentVar>
<independentVar lookup="column">fcs/flap-pos-deg</independentVar>
<tableData>
10 15 20
-2000 111.5 109.5 109.0
0 109.5 107.5 107.0
2000 107.5 105.5 105.0
4000 107.0 105.0 104.5
6000 105.0 103.0 103.0
8000 103.0 101.0 100.5
9200 101.0 99.0 98.5
10000 100.0 98.0 97.5
12000 96.5 94.5 94.0
14100 93.0 91.0 91.0
</tableData>
</table>
</function>
</fcs_function>
<!-- Slat -->
<pure_gain name="/FMGC/internal/slat">
<input>/FMGC/internal/vs1g-conf-0</input>
@ -664,6 +751,31 @@
</clipto>
</fcs_function>
</channel>
<channel name="FMGC" execrate="8">
<switch name="/systems/fmgc/airborne">
<default value="0"/>
<test logic="OR" value="1">
/gear/gear[1]/wow eq 0
/gear/gear[2]/wow eq 0
</test>
</switch>
<actuator name="/systems/fmgc/airborne-timer">
<input>/systems/fmgc/airborne</input>
<rate_limit sense="decr">100</rate_limit>
<rate_limit sense="incr">0.2</rate_limit>
</actuator>
<switch name="/systems/fmgc/airborne-5-secs">
<default value="0"/>
<test logic="OR" value="1">
/systems/fmgc/airborne-timer eq 1
</test>
</switch>
<fcs_function name="/systems/fmgc/cas-compare/cas-1-to-3">
<function>
<abs>