diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 1b00c24a..19147edc 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -1521,11 +1521,12 @@ - slider + knob CockpitDoorSwitch CockpitDoorSwitch.mark controls/doors/doorc-switch vertical + 14 property-adjust @@ -4705,6 +4706,8 @@ controls/switches/annun-test 1 + + FMGC/FCU-working it-autoflight/input/kts-mach 1 @@ -4730,6 +4733,7 @@ it-autoflight/input/spd-managed 0 + FMGC/FCU-working @@ -4751,6 +4755,7 @@ it-autoflight/input/spd-managed 0 + FMGC/FCU-working @@ -4793,6 +4798,7 @@ controls/switches/annun-test 1 + FMGC/FCU-working it-autoflight/custom/trk-fpa 0 @@ -4811,6 +4817,7 @@ controls/switches/annun-test 1 + FMGC/FCU-working it-autoflight/custom/trk-fpa 1 @@ -4832,6 +4839,7 @@ it-autoflight/custom/show-hdg 1 + FMGC/FCU-working @@ -4878,10 +4886,13 @@ select alt-text - - controls/switches/annun-test - 1 - + + FMGC/FCU-working + + controls/switches/annun-test + 1 + + @@ -4930,6 +4941,7 @@ controls/switches/annun-test 1 + FMGC/FCU-working it-autoflight/custom/trk-fpa 1 @@ -4952,6 +4964,7 @@ it-autoflight/output/vert 1 + FMGC/FCU-working @@ -4969,6 +4982,7 @@ it-autoflight/output/vert 5 + FMGC/FCU-working @@ -4990,6 +5004,7 @@ it-autoflight/output/vert 5 + FMGC/FCU-working diff --git a/Models/Instruments/IESI/res/iesi.svg b/Models/Instruments/IESI/res/iesi.svg index 8bdc1875..6f7810b2 100644 --- a/Models/Instruments/IESI/res/iesi.svg +++ b/Models/Instruments/IESI/res/iesi.svg @@ -5,7 +5,7 @@ viewBox="0 0 1024 1024" version="1.1" id="svg2" - inkscape:version="1.1 (c68e22c387, 2021-05-23)" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" sodipodi:docname="iesi.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" @@ -38,16 +38,16 @@ inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="986" + inkscape:window-height="974" id="namedview371" showgrid="true" - inkscape:zoom="0.93517029" - inkscape:cx="815.35952" - inkscape:cy="762.42799" + inkscape:zoom="0.66126526" + inkscape:cx="369.74572" + inkscape:cy="772.76099" inkscape:window-x="-11" inkscape:window-y="-11" inkscape:window-maximized="1" - inkscape:current-layer="ATTflag" + inkscape:current-layer="MsgBox" showguides="true" inkscape:snap-global="false" units="pt" @@ -72,11 +72,11 @@ inkscape:label="MsgBox"> + style="fill:#c9d121;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.48539;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + id="ATTflag" + style="display:inline"> + style="fill:#c9d121;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.48538;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> ATT : RST + width="280.59842" + height="91.115768" + x="361.70129" + y="287.18335" /> + inkscape:label="#g4573" + style="display:inline"> = 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); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index cc08febc..6ddc3699 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -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; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 4526a370..6898d406 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -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), diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 02455aef..b88b0291 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -46,6 +46,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), @@ -449,7 +450,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(); @@ -471,7 +472,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(); @@ -502,7 +503,7 @@ 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) { + if ((FMGCNodes.Power.FMGC1Powered.getBoolValue() or FMGCNodes.Power.FMGC2Powered.getBoolValue()) and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { Output.athr.setBoolValue(1); Custom.ThrLock.setValue(0); Custom.Sound.enableAthrOff = 1; diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 2b6d3d2f..5a82d759 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -132,6 +132,9 @@ var FMGCInternal = { vrset: 0, v2: 0, v2set: 0, + toFlap: 0, + toThs: 0, + toFlapThsSet: 0, # PERF APPR destMag: 0, @@ -264,6 +267,10 @@ var FMGCNodes = { ktsToMachFactor: props.globals.getNode("/FMGC/internal/kts-to-mach-factor"), machToKtsFactor: props.globals.getNode("/FMGC/internal/mach-to-kts-factor"), mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"), + 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"), v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 4446ec8f..1a22e03e 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -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), ]), diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas index ee3ab6b7..24d307a3 100644 --- a/Nasal/MCDU/DEPARTURE.nas +++ b/Nasal/MCDU/DEPARTURE.nas @@ -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); diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index e9da0033..339173c9 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -5,11 +5,7 @@ var OOOIReport = { new: func(state,time=0,fob="") { var report = {parents:[OOOIReport]}; report.state = state; - if (acconfig_weight_kgs.getValue() == 1) { - report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob * LBS2KGS; - } else { - report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; - } + report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; if (time != 0) { report.time = formatSecToHHMM(time); report.elapsed = time; diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 78d2b32e..957f314d 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -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"); } diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 13ca2d34..ad9c116b 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -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"); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 5992c2e3..eff2d9ca 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -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("/FMGC/internal/flex", 0); setprop("/FMGC/internal/flex-set", 0); setprop("/FMGC/internal/eng-out-reduc", "1500"); @@ -1534,17 +1534,16 @@ var button = func(btn, i, event = "") { } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); } else if (btn == "PLUSMINUS") { - if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") { + var _toggle = right(scratchpad,1); + if (_toggle == "+" or _toggle == "-") { + _toggle = (_toggle == "-") ? "+" : "-"; mcdu_scratchpad.scratchpads[i].clear(); - mcdu_scratchpad.scratchpads[i].addChar("+"); - } else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") { - mcdu_scratchpad.scratchpads[i].clear(); - mcdu_scratchpad.scratchpads[i].addChar("-"); + mcdu_scratchpad.scratchpads[i].addChar(_toggle); } else { mcdu_scratchpad.scratchpads[i].addChar("-"); } } else if (btn == "OVFY") { - if (mcdu_scratchpad.scratchpads[i].scratchpad == "") { + if (size(scratchpad) == 0) { mcdu_scratchpad.scratchpads[i].addChar("@"); } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index 7571aa52..1ccd9cc8 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -3,19 +3,55 @@ # Copyright (c) 2020 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= 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"); } @@ -233,6 +300,8 @@ var perfTOInput = func(key, i) { setprop("/FMGC/internal/flex-set", 1); var flex_calc = getprop("/FMGC/internal/flex") - getprop("environment/temperature-degc"); setprop("/FMGC/internal/flex-cmd", flex_calc); + perfTOCheckVSpeedsLimitations(i); + perfToCheckTakeoffData(i); mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index d3bf6556..7a9b8efe 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -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 = { @@ -202,47 +192,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); diff --git a/Systems/a320-fmgc.xml b/Systems/a320-fmgc.xml index cb4bc86a..f498d8ef 100644 --- a/Systems/a320-fmgc.xml +++ b/Systems/a320-fmgc.xml @@ -4,7 +4,120 @@ + + + + + + /systems/electrical/bus/dc-ess-shed ge 25 + + + + + + + /systems/electrical/bus/dc-2 ge 25 + + + + + /systems/fmgc/power/power-1 + 5 + 100 + + + + /systems/fmgc/power/power-2 + 5 + 100 + + + + + + /systems/fmgc/power/power-1-timer ne 0 + + + + + + + /systems/fmgc/power/power-2-timer ne 0 + + + + + + + + + + + + /position/altitude-ft + + -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 + +
+
+
+ + + + + + /position/altitude-ft + fcs/flap-pos-deg + + 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 + +
+
+
+ +
+ + + + + + /gear/gear[1]/wow eq 0 + /gear/gear[2]/wow eq 0 + + + + + /systems/fmgc/airborne + 100 + 0.2 + + + + + + /systems/fmgc/airborne-timer eq 1 + + diff --git a/Systems/instrumentation.xml b/Systems/instrumentation.xml index 1941fa4f..8b55dd87 100644 --- a/Systems/instrumentation.xml +++ b/Systems/instrumentation.xml @@ -168,11 +168,6 @@ /systems/vacuum/suction-inhg - - kt-70 - 0 - - magnetic-compass 0