diff --git a/A320-main.xml b/A320-main.xml index 8dd13cf07..cedabf6c7 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -711,6 +711,7 @@ 0 1500 + 1500 IDLE 0 diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 96d2fd3cc..dceb7cd0c 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -90,8 +90,10 @@ var state2 = props.globals.getNode("/engines/engine[1]/state", 1); var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); # TO PERF 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 accelAltFt = props.globals.getNode("/FMGC/internal/accel-agl-ft", 1); var thrAccSet = props.globals.getNode("/MCDUC/thracc-set", 1); +var accSetManual = props.globals.getNode("/MCDUC/acc-set-manual", 1); +var thrRedSetManual = props.globals.getNode("/MCDUC/thrRed-set-manual", 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); @@ -109,6 +111,10 @@ var final = props.globals.getNode("/FMGC/internal/final", 1); var radio = props.globals.getNode("/FMGC/internal/radio", 1); var baro = props.globals.getNode("/FMGC/internal/baro", 1); # GA PERF +var ga_clbReducFt = props.globals.getNode("/fdm/jsbsim/fadec/ga-clbreduc-ft", 1); # differs from TO clbRedcFt +var ga_accelAltFt = props.globals.getNode("/FMGC/internal/ga-accel-agl-ft", 1); # differs from TO accelAltFt +var ga_accSetManual = props.globals.getNode("/MCDUC/ga-acc-set-manual", 1); +var ga_thrRedSetManual = props.globals.getNode("/MCDUC/ga-thrRed-set-manual", 1); # AOC - SENSORS var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); var doorL1_pos = props.globals.getNode("/sim/model/door-positions/doorl1/position-norm", 1); #FWD door @@ -4292,15 +4298,15 @@ var canvas_MCDU_base = { showRight(me,-1, 1, 1, 1, 1, 1); showRightS(me,1, 1, 1, 1, 1, 1); showRightArrow(me,-1, -1, -1, -1, -1, 1); - showCenter(me,1, 1, 1, -1, -1, -1); + showCenter(me,1, 1, 1, -1, 1, -1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); showCenterS(me,1, 1, 1, -1, -1, -1); me.fontSizeLeft(normal, normal, normal, normal, 0, normal); me.fontSizeRight(normal, small, 0, 0, 0, normal); - me.fontSizeCenter(small, small, small, 0, 0, 0); - me.fontSizeCenterS(small, small, small, small, small, small); + me.fontSizeCenter(small, small, small, 0, small, 0); + me.fontSizeCenterS(small, small, small, small, 0, small); me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -4308,7 +4314,7 @@ var canvas_MCDU_base = { me.colorRight("grn", "blu", "blu", "blu", "blu", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorCenter("grn", "grn", "grn", "wht", "wht", "wht"); + me.colorCenter("grn", "grn", "grn", "wht", "blu", "wht"); me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); me["Simple_Title"].setText("TAKE OFF"); @@ -4316,7 +4322,6 @@ var canvas_MCDU_base = { } me["Simple_L4"].setText(sprintf("%3.0f", fmgc.FMGCInternal.transAlt)); - me["Simple_L5"].setText(" " ~ sprintf("%3.0f", clbReducFt.getValue()) ~ sprintf("/%3.0f", reducFt.getValue())); me["Simple_L6"].setText(" TO DATA"); me["Simple_L1S"].setText(" V1"); me["Simple_L2S"].setText(" VR"); @@ -4352,6 +4357,7 @@ var canvas_MCDU_base = { if (fmgc.FMGCInternal.phase == 1) { # GREEN title and not modifiable on TO phase me["Simple_Title"].setColor(GREEN); me.colorLeft("grn", "grn", "grn", "blu", "grn", "wht"); + me.colorCenter("grn", "grn", "grn", "blu", "grn", "wht"); me.colorRight("grn", "blu", "grn", "grn", "grn", "wht"); } else { me["Simple_Title"].setColor(WHITE); @@ -4394,12 +4400,68 @@ var canvas_MCDU_base = { me["Simple_L3"].hide(); } - if (thrAccSet.getValue() == 1) { - me["Simple_L5"].setFontSize(normal); + if(fmgc.FMGCInternal.depApt == ""){ + # todo: as for now FMGC will use default thrRed/accelAlt values unless it is overwritten + # these default values are not displayed in MCDU + + if (accSetManual.getBoolValue() and thrRedSetManual.getBoolValue()){ + me["Simple_L5"].setColor(BLUE); + me["Simple_L5"].setFontSize(normal); + me["Simple_L5"].setText(sprintf("%4.0f", clbReducFt.getValue())); + me["Simple_C5"].setColor(BLUE); + me["Simple_C5"].setFontSize(normal); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } else { + if (thrRedSetManual.getBoolValue()){ + me["Simple_L5"].setFontSize(normal); + me["Simple_L5"].setText(sprintf("%4.0f", clbReducFt.getValue())); + if (accSetManual.getBoolValue()) { + me["Simple_C5"].setFontSize(normal); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } else { + me["Simple_C5"].setColor(WHITE); + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setText(sprintf("/----- ")); + } + } else { + me["Simple_L5"].setColor(WHITE); + me["Simple_L5"].setFontSize(small); + me["Simple_L5"].setText("-----"); + if (accSetManual.getBoolValue()) { + me["Simple_C5"].setColor(BLUE); + me["Simple_C5"].setFontSize(normal); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } else { + me["Simple_C5"].setColor(WHITE); + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setText(sprintf("/----- ")); + } + } + } } else { - me["Simple_L5"].setFontSize(small); + if (thrRedSetManual.getBoolValue()){ + me["Simple_L5"].setFontSize(normal); + me["Simple_L5"].setText(sprintf("%4.0f", clbReducFt.getValue())); + if (accSetManual.getBoolValue()) { + me["Simple_C5"].setFontSize(normal); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } else { + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } + } else { + me["Simple_L5"].setFontSize(small); + me["Simple_L5"].setText(sprintf("%4.0f", clbReducFt.getValue())); + if (accSetManual.getBoolValue()) { + me["Simple_C5"].setFontSize(normal); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } else { + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setText(sprintf("/%4.0f ", accelAltFt.getValue())); + } + } } - + if (fmgc.FMGCInternal.toFlapThsSet) { me["Simple_R3"].setFontSize(normal); if (fmgc.FMGCInternal.toThs) { @@ -5044,14 +5106,15 @@ var canvas_MCDU_base = { showRight(me,-1, -1, -1, -1, 1, -1); showRightS(me,-1, -1, -1, -1, 1, -1); showRightArrow(me,-1, -1, -1, -1, -1, -1); - showCenter(me,1, 1, 1, -1, -1, -1); + showCenter(me,1, 1, 1, -1, 1, -1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); showCenterS(me,1, 1, 1, -1, -1, -1); - me.fontSizeLeft(normal, normal, normal, normal, 0, normal); - me.fontSizeRight(normal, small, 0, 0, 0, normal); - me.fontSizeCenter(small, small, small, 0, 0, 0); + #me.fontSizeLeft(normal, normal, normal, normal, small, normal); + #me.fontSizeRight(normal, small, 0, 0, 0, normal); + #me.fontSizeCenter(small, small, small, 0, small, 0); + #me.fontSizeCenterS(small, small, small, 0, small, 0); me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -5059,8 +5122,8 @@ var canvas_MCDU_base = { me.colorRight("wht", "blu", "blu", "blu", "blu", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorCenter("grn", "grn", "grn", "wht", "wht", "wht"); - me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("grn", "grn", "grn", "wht", "blu", "wht"); + me.colorCenterS("wht", "wht", "wht", "wht", "blu", "wht"); pageSwitch[i].setBoolValue(1); } @@ -5070,19 +5133,36 @@ var canvas_MCDU_base = { } else { me["Simple_Title"].setColor(WHITE); } - - if (thrAccSet.getValue() == 1) { - me["Simple_L5"].setFontSize(normal); - } else { - me["Simple_L5"].setFontSize(small); - } + if (engOutAccSet.getValue() == 1) { me["Simple_R5"].setFontSize(normal); } else { me["Simple_R5"].setFontSize(small); } - me["Simple_L5"].setText(sprintf("%3.0f", clbReducFt.getValue()) ~ sprintf("/%3.0f", reducFt.getValue())); + if(fmgc.FMGCInternal.arrApt == ""){ + if(ga_thrRedSetManual.getBoolValue()) { + me["Simple_L5"].setFontSize(normal); + me["Simple_L5"].setText(sprintf("%4.0f", ga_clbReducFt.getValue())); + } else { + me["Simple_L5"].setFontSize(small); + me["Simple_L5"].setText("-----"); + } + + if(ga_accSetManual.getBoolValue()){ + me["Simple_C5"].setFontSize(normal); + me["Simple_C5"].setText(sprintf("/%4.0f ", ga_accelAltFt.getValue())); + } else { + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setText(sprintf("/----- ")); + } + } else { + me["Simple_L5"].setFontSize(small); + me["Simple_L5"].setText(sprintf("%4.0f", ga_clbReducFt.getValue())); + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setText(sprintf("/%4.0f ", ga_accelAltFt.getValue())); + } + me["Simple_L6"].setText(" PHASE"); me["Simple_L5S"].setText("THR RED/ACC"); me["Simple_L6S"].setText(" PREV"); @@ -6150,4 +6230,5 @@ setlistener("/MCDU[0]/page", func { }, 0, 0); setlistener("/MCDU[1]/page", func { pageSwitch[1].setBoolValue(0); -}, 0, 0); \ No newline at end of file +}, 0, 0); + diff --git a/Models/Liveries/PW-NEO/DLH.xml b/Models/Liveries/PW-NEO/DLH.xml index 09d43e558..f5d8c682a 100644 --- a/Models/Liveries/PW-NEO/DLH.xml +++ b/Models/Liveries/PW-NEO/DLH.xml @@ -19,6 +19,10 @@ +0.0 +0.0 + 1000 + 1000 + 1500 + 1500 D-AINK diff --git a/Models/Liveries/PW-NEO/NKS.xml b/Models/Liveries/PW-NEO/NKS.xml index a195b371b..44386e1cd 100644 --- a/Models/Liveries/PW-NEO/NKS.xml +++ b/Models/Liveries/PW-NEO/NKS.xml @@ -19,6 +19,7 @@ +0.0 +0.0 + 1500 N903NK diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 537c92123..546bf9a60 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -288,6 +288,8 @@ var FCUController = { fmgc.Input.kts.setValue(me.iasTemp); } } + } else { + # speed preselection on FCU as speed is managed } } }, diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 0821514c6..5eda83be8 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -34,9 +34,24 @@ var windHdg = 0; var windSpeed = 0; var windsDidChange = 0; var tempOverspeed = nil; +var pinOptionGaAccelAlt = 1500; +if (getprop("/options/company-options/default-ga-accel-agl") != nil) { + pinOptionGaAccelAlt = getprop("/options/company-options/default-ga-accel-agl"); +} +var pinOptionGaThrRedAlt = 400; +if (getprop("/options/company-options/default-ga-thrRed-agl") != nil) { + pinOptionGaThrRedAlt = getprop("/options/company-options/default-ga-thrRed-agl"); +} +# min Value for ThrRed and AccelAlt are the company pin option defaults +var minAccelAlt = getprop("/options/company-options/default-accel-agl"); +var minThrRed = getprop("/options/company-options/default-thrRed-agl"); setprop("/position/gear-agl-ft", 0); -setprop("/it-autoflight/settings/accel-ft", 1500); #eventually set to 1500 above runway + +# 1500 ft is a default value not shown anywhere. It may not exist. +# In case it does not exist, a takeoff with no departure airport and no accel set would never go from TO PHASE to CLB PHASE +# unless manually set. +setprop("/it-autoflight/settings/accel-ft", 1500); setprop("/it-autoflight/internal/vert-speed-fpm", 0); setprop("/instrumentation/nav[0]/nav-id", "XXX"); setprop("/instrumentation/nav[1]/nav-id", "XXX"); @@ -128,6 +143,10 @@ var FMGCInternal = { toFlap: 0, toThs: 0, toFlapThsSet: 0, + accelAlt: 0, + accelAltSet: 0, + thrRedAlt: 0, + thrRedAltSet: 0, # PERF APPR destMag: 0, @@ -138,11 +157,18 @@ var FMGCInternal = { ldgConfig3: 0, ldgConfigFull: 0, + # PERF GA + gaAccelAlt: 0, + gaAccelAltSet: 0, + gaThrRedAlt: 0, + gaThrRedAltSet: 0, + # INIT A altAirport: "", altAirportSet: 0, altSelected: 0, arrApt: "", + destAptElev: 0, coRoute: "", coRouteSet: 0, costIndex: 0, @@ -157,6 +183,7 @@ var FMGCInternal = { gndTemp: 15, gndTempSet: 0, depApt: "", + depAptElev: 0, tropo: 36090, tropoSet: 0, toFromSet: 0, @@ -640,6 +667,9 @@ var masterFMGC = maketimer(0.2, func { systems.PNEU.pressMode.setValue("TO"); } } elsif (FMGCInternal.phase == 2) { + # change FADEC thrReduction from T/O-thrRedAlt to G/A-thrRedAlt + systems.FADEC.clbReduc = systems.FADEC.gaClbReduc; + if ((Modes.PFD.FMA.pitchMode == "ALT CRZ" or Modes.PFD.FMA.pitchMode == "ALT CRZ*")) { newphase = 3; systems.PNEU.pressMode.setValue("CR"); @@ -667,7 +697,7 @@ var masterFMGC = maketimer(0.2, func { Input.toga.setValue(1); } } elsif (FMGCInternal.phase == 6) { - if (alt >= accel_agl_ft) { # todo when insert altn or new dest + if (alt >= getprop("/FMGC/internal/ga-accel-agl-ft")) { # todo when insert altn or new dest newphase = 2; } } diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 928e6b766..1fe0e852f 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -7,8 +7,25 @@ var resetFlightplan = func(i) { fmgc.FMGCInternal.depApt = ""; fmgc.FMGCInternal.arrApt = ""; fmgc.FMGCInternal.toFromSet = 0; + fmgc.FMGCInternal.depAptElev = 0; + fmgc.FMGCInternal.destAptElev = 0; fmgc.FMGCNodes.toFromSet.setValue(0); fmgc.windController.resetDesWinds(); + + # clbreduc-ft and accel-agl-ft are set to arbitrary values they may not exist. + # In case they do not exist, a takeoff with no departure airport and no accel set would never go from TO PHASE to CLB PHASE + # unless manually changed. + setprop("/FMGC/internal/accel-agl-ft", 1500); + setprop("/fdm/jsbsim/fadec/clbreduc-ft", 1500); + setprop("MCDUC/thracc-set", 0); + setprop("MCDUC/acc-set-manual", 0); + setprop("MCDUC/thrRed-set-manual", 0); + + setprop("/FMGC/internal/ga-accel-agl-ft", 1500); + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", 1500); + setprop("MCDUC/ga-acc-set-manual", 0); + setprop("MCDUC/ga-thrRed-set-manual", 0); + setprop("/FMGC/internal/align-ref-lat", 0); setprop("/FMGC/internal/align-ref-long", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0); @@ -264,7 +281,39 @@ var initInputA = func(key, i) { fmgc.FMGCInternal.toFromSet = 1; fmgc.FMGCNodes.toFromSet.setValue(1); mcdu_scratchpad.scratchpads[i].empty(); - + fmgc.FMGCInternal.depAptElev = math.round(airportinfo(fromto[0]).elevation * M2FT, 10); + fmgc.FMGCInternal.destAptElev = math.round(airportinfo(fromto[1]).elevation * M2FT, 10); + + if (getprop("/options/company-options/default-thrRed-agl")) { + fmgc.FMGCInternal.thrRedAlt = getprop("/options/company-options/default-thrRed-agl") + fmgc.FMGCInternal.depAptElev; + fmgc.FMGCInternal.gaThrRedAlt = getprop("/options/company-options/default-ga-thrRed-agl") + fmgc.FMGCInternal.destAptElev; + } else { + fmgc.FMGCInternal.thrRedAlt = 400 + fmgc.FMGCInternal.depAptElev; # todo: minimum thrRed agl if no company option + fmgc.FMGCInternal.gaThrRedAlt = 1500 + fmgc.FMGCInternal.destAptElev; # as per FCOM 12-22_20-50-10-MCDU - Page Description - FMS2 Thales - PERF Page + } + + if (getprop("/options/company-options/default-accel-agl")) { + fmgc.FMGCInternal.accelAlt = getprop("/options/company-options/default-accel-agl") + fmgc.FMGCInternal.depAptElev; + fmgc.FMGCInternal.gaAccelAlt = getprop("/options/company-options/default-ga-accel-agl") + fmgc.FMGCInternal.destAptElev; + if (fmgc.FMGCInternal.gaAccelAlt < fmgc.FMGCInternal.gaThrRedAlt){ + fmgc.FMGCInternal.gaThrRedAlt = fmgc.FMGCInternal.gaAccelAlt; + } + } else { + fmgc.FMGCInternal.accelAlt = 400 + fmgc.FMGCInternal.depAptElev; # todo: minimum accel agl if no company option + fmgc.FMGCInternal.gaAccelAlt = 1500 + fmgc.FMGCInternal.destAptElev; # as per FCOM 12-22_20-50-10-MCDU - Page Description - FMS2 Thales - PERF Page + } + + setprop("/FMGC/internal/accel-agl-ft", fmgc.FMGCInternal.accelAlt); + setprop("/fdm/jsbsim/fadec/clbreduc-ft", fmgc.FMGCInternal.thrRedAlt); + setprop("MCDUC/thracc-set", 0); + setprop("MCDUC/acc-set-manual", 0); + setprop("MCDUC/thrRed-set-manual", 0); + + setprop("/FMGC/internal/ga-accel-agl-ft", fmgc.FMGCInternal.gaAccelAlt); + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", fmgc.FMGCInternal.gaThrRedAlt); + setprop("MCDUC/ga-acc-set-manual", 0); + setprop("MCDUC/ga-thrRed-set-manual", 0); + fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); fmgc.FMGCInternal.altSelected = 0; fmgc.updateARPT(); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 54f8f6b03..0638b9a78 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -154,7 +154,10 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.v2 = 0; fmgc.FMGCInternal.v2set = 0; setprop("/FMGC/internal/accel-agl-ft", 1500); #eventually set to 1500 above runway - setprop("/MCDUC/thracc-set", 0); + setprop("/fdm/jsbsim/fadec/clbreduc-ft", 1500); + setprop("MCDUC/thracc-set", 0); + setprop("MCDUC/acc-set-manual", 0); + setprop("MCDUC/thrRed-set-manual", 0); fmgc.FMGCInternal.toFlap = 0; fmgc.FMGCInternal.toThs = 0.0; fmgc.FMGCInternal.toFlapThsSet = 0; @@ -190,6 +193,10 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.ldgConfigFull = 1; # GA PERF + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", 1500); + setprop("/FMGC/internal/ga-accel-agl-ft", 1500); + setprop("MCDUC/ga-acc-set-manual", 0); + setprop("MCDUC/ga-thrRed-set-manual", 0); } var setMode = func(will) { diff --git a/Nasal/MCDU/PERFGA.nas b/Nasal/MCDU/PERFGA.nas index fc74d6f7a..d622c2173 100644 --- a/Nasal/MCDU/PERFGA.nas +++ b/Nasal/MCDU/PERFGA.nas @@ -6,26 +6,73 @@ var perfGAInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L5") { if (scratchpad == "CLR") { - setprop("/fdm/jsbsim/fadec/clbreduc-ft", 1500); - setprop("/FMGC/internal/accel-agl-ft", 1500); - setprop("MCDUC/thracc-set", 0); + if (fmgc.FMGCInternal.arrApt != "") { + fmgc.FMGCInternal.gaThrRedAlt = fmgc.pinOptionGaThrRedAlt + fmgc.FMGCInternal.destAptElev; + fmgc.FMGCInternal.gaAccelAlt = fmgc.pinOptionGaAccelAlt + fmgc.FMGCInternal.destAptElev; + } else { + fmgc.FMGCInternal.gaThrRedAlt = fmgc.pinOptionGaThrRedAlt; + fmgc.FMGCInternal.gaAccelAlt = fmgc.pinOptionGaAccelAlt; + } + + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", fmgc.FMGCInternal.gaThrRedAlt); + setprop("/FMGC/internal/ga-accel-agl-ft", fmgc.FMGCInternal.gaAccelAlt); + setprop("MCDUC/ga-acc-set-manual", 0); + setprop("MCDUC/ga-thrRed-set-manual", 0); + mcdu_scratchpad.scratchpads[i].empty(); + } else { var tfs = size(scratchpad); - if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) { + if (find("/", scratchpad) != -1) { var thracc = split("/", scratchpad); var thrred = size(thracc[0]); var acc = size(thracc[1]); - if (int(thrred) != nil and int(acc) != nil and (thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) { - setprop("/fdm/jsbsim/fadec/clbreduc-ft", thracc[0]); - setprop("/FMGC/internal/accel-agl-ft", thracc[1]); - setprop("MCDUC/thracc-set", 1); + var tempThrRed = 0; + var tempAcc = 0; + if (thrred >= 3 and thrred <= 5) {tempThrRed = int(thracc[0]/ 10) * 10;} + if (acc >= 3 and acc <= 5) {tempAcc = int(thracc[1]/ 10) * 10;} + + if (thrred and acc and tempAcc < tempThrRed) { + tempAcc = tempThrRed; # accel is always greater or eqal thrust reduction + } + + # at the moment 400ft/1500ft and 39000ft are hard coded defaults. + # needs to be checked + if (tempThrRed >= 400 and tempThrRed <= 39000 and tempAcc >= 1500 and tempAcc <= 39000) { + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", tempThrRed); + setprop("/FMGC/internal/ga-accel-agl-ft", tempAcc); + setprop("MCDUC/ga-acc-set-manual", 1); + setprop("MCDUC/ga-thrRed-set-manual", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else if (tempAcc >= 1500 and tempAcc <= 39000) { + setprop("/FMGC/internal/ga-accel-agl-ft", tempAcc); + setprop("MCDUC/ga-acc-set-manual", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else if (tempThrRed >= 400 and tempThrRed <= 39000) { + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", tempThrRed); + setprop("MCDUC/ga-thrRed-set-manual", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); } } else { - mcdu_message(i, "NOT ALLOWED"); + if (tfs >= 3 and tfs <= 5){ + var tempImp = int(scratchpad / 10) * 10; + if (tempImp and (tempImp >= 400) and (tempImp <= 39000)) { + setprop("/fdm/jsbsim/fadec/ga-clbreduc-ft", tempImp); + setprop("MCDUC/ga-thrRed-set-manual", 1); + + if (tempImp > getprop("/FMGC/internal/ga-accel-agl-ft")){ # set accel as high as thrRed + setprop("/FMGC/internal/ga-accel-agl-ft", tempImp); + setprop("MCDUC/ga-acc-set-manual", 1); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } } } } else if (key == "L6") { diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index 00c333b18..eaf181c8e 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -149,9 +149,30 @@ var perfTOInput = func(key, i) { } } else if (key == "L5" and modifiable) { if (scratchpad == "CLR") { - setprop("/fdm/jsbsim/fadec/clbreduc-ft", 1500); - setprop("/FMGC/internal/accel-agl-ft", 1500); + if (fmgc.FMGCInternal.depApt != "") { + if (getprop("/options/company-options/default-accel-agl")) { + fmgc.FMGCInternal.AccelAlt = getprop("/options/company-options/default-accel-agl") + fmgc.FMGCInternal.depAptElev; + } else { + # to check: minimum value if no company option is 400 ft above dep aerodrome + fmgc.FMGCInternal.AccelAlt = 400 + fmgc.FMGCInternal.depAptElev; + } + + if (getprop("/options/company-options/default-thrRed-agl")) { + fmgc.FMGCInternal.thrRedAlt = getprop("/options/company-options/default-thrRed-agl") + fmgc.FMGCInternal.depAptElev; + } else { + # to check: minimum value if no company option is 400 ft above dep aerodrome + fmgc.FMGCInternal.thrRedAlt = 400 + fmgc.FMGCInternal.depAptElev; + } + } else { + fmgc.FMGCInternal.AccelAlt = 1500; # todo: default accel if no depApt / probably doesn't exist? + fmgc.FMGCInternal.thrRedAlt = 1500; # todo: default ThrRed if no depApt / probably doesn't exist? + } + setprop("/FMGC/internal/accel-agl-ft", fmgc.FMGCInternal.AccelAlt); + setprop("/fdm/jsbsim/fadec/clbreduc-ft", fmgc.FMGCInternal.thrRedAlt); setprop("MCDUC/thracc-set", 0); + setprop("MCDUC/acc-set-manual", 0); + setprop("MCDUC/thrRed-set-manual", 0); + mcdu_scratchpad.scratchpads[i].empty(); } else { var tfs = size(scratchpad); @@ -163,28 +184,26 @@ var perfTOInput = func(key, i) { var accs = size(acc); #TODO - manual check - four digit alwway 0000 - default = runaway_elevation + 800 ft, min values runaway_elevation+400ft - - if (int(thrred) != nil and (thrreds >= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) { - - if (thrred<=acc) { # validation + if (int(thrred) != nil and (thrreds >= 3 and thrreds <= 5) and thrred >= fmgc.minThrRed and thrred <= 39000 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= fmgc.minAccelAlt and acc <= 39000) { setprop("/fdm/jsbsim/fadec/clbreduc-ft", int(thrred / 10) * 10); setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); setprop("MCDUC/thracc-set", 1); + setprop("MCDUC/acc-set-manual", 1); + setprop("MCDUC/thrRed-set-manual", 1); mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) { + } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= fmgc.minAccelAlt and acc <= 39000) { setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); + setprop("MCDUC/acc-set-manual", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } - } else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= 400 and scratchpad <= 39000) { + } else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= fmgc.minThrRed and scratchpad <= 39000) { setprop("/fdm/jsbsim/fadec/clbreduc-ft", int(scratchpad / 10) * 10); + setprop("MCDUC/thrRed-set-manual", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "R3" and modifiable) { diff --git a/Nasal/Systems/fadec-common.nas b/Nasal/Systems/fadec-common.nas index 0678d7aac..5a01aed75 100644 --- a/Nasal/Systems/fadec-common.nas +++ b/Nasal/Systems/fadec-common.nas @@ -11,6 +11,7 @@ var FADEC = { alphaFloor: props.globals.getNode("/fdm/jsbsim/fadec/alpha-floor"), alphaFloorSwitch: props.globals.getNode("/fdm/jsbsim/fadec/alpha-floor-switch"), clbReduc: props.globals.getNode("/fdm/jsbsim/fadec/clbreduc-ft"), + gaClbReduc: props.globals.getNode("/fdm/jsbsim/fadec/ga-clbreduc-ft"), detent: [props.globals.getNode("/fdm/jsbsim/fadec/control-1/detent", 1), props.globals.getNode("/fdm/jsbsim/fadec/control-2/detent", 1)], detentTemp: [0, 0], detentText: [props.globals.getNode("/fdm/jsbsim/fadec/control-1/detent-text"), props.globals.getNode("/fdm/jsbsim/fadec/control-2/detent-text")], diff --git a/Systems/fmgc-drivers.xml b/Systems/fmgc-drivers.xml index 62f584533..a8e028405 100644 --- a/Systems/fmgc-drivers.xml +++ b/Systems/fmgc-drivers.xml @@ -935,6 +935,51 @@ /it-autoflight/settings/accel-ft + + + GA Accel Altitude + gain + 1.0 + + + + + + /engines/engine[0]/state + 3 + + + + /engines/engine[1]/state + 3 + + + + + + + /engines/engine[0]/state + 3 + + + + /engines/engine[1]/state + 3 + + + + + + /FMGC/internal/ga-eng-out-reduc + + + + + /FMGC/internal/ga-accel-agl-ft + + + /it-autoflight/settings/ga-accel-ft +