Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acc thr red correction as tested #309

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions A320-main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@
<cmd type="double">0</cmd>
</athr>
<clbreduc-ft type="double">1500</clbreduc-ft>
<ga-clbreduc-ft type="double">1500</ga-clbreduc-ft>
<control-1 n="0">
<detent-text type="string">IDLE</detent-text>
<n1-mode-sw type="bool">0</n1-mode-sw>
Expand Down
129 changes: 105 additions & 24 deletions Models/Instruments/MCDU/MCDU.nas
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -4292,31 +4298,30 @@ 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");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
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");

pageSwitch[i].setBoolValue(1);
}

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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -5044,23 +5106,24 @@ 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");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
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);
}
Expand All @@ -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");
Expand Down Expand Up @@ -6150,4 +6230,5 @@ setlistener("/MCDU[0]/page", func {
}, 0, 0);
setlistener("/MCDU[1]/page", func {
pageSwitch[1].setBoolValue(0);
}, 0, 0);
}, 0, 0);

4 changes: 4 additions & 0 deletions Models/Liveries/PW-NEO/DLH.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<company-options>
<idle-factor>+0.0</idle-factor>
<perf-factor>+0.0</perf-factor>
<default-thrRed-agl type="int">1000</default-thrRed-agl>
<default-accel-agl type="int">1000</default-accel-agl>
<default-ga-thrRed-agl type="int">1500</default-ga-thrRed-agl>
<default-ga-accel-agl type="int">1500</default-ga-accel-agl>
</company-options>
<model-options>
<registration type="string">D-AINK</registration>
Expand Down
1 change: 1 addition & 0 deletions Models/Liveries/PW-NEO/NKS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<company-options>
<idle-factor>+0.0</idle-factor>
<perf-factor>+0.0</perf-factor>
<default-accel-agl type="int">1500</default-accel-agl>
</company-options>
<model-options>
<registration type="string">N903NK</registration>
Expand Down
2 changes: 2 additions & 0 deletions Nasal/FMGC/FCU.nas
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ var FCUController = {
fmgc.Input.kts.setValue(me.iasTemp);
}
}
} else {
# speed preselection on FCU as speed is managed
}
}
},
Expand Down
34 changes: 32 additions & 2 deletions Nasal/FMGC/FMGC.nas
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -128,6 +143,10 @@ var FMGCInternal = {
toFlap: 0,
toThs: 0,
toFlapThsSet: 0,
accelAlt: 0,
accelAltSet: 0,
thrRedAlt: 0,
thrRedAltSet: 0,

# PERF APPR
destMag: 0,
Expand All @@ -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,
Expand All @@ -157,6 +183,7 @@ var FMGCInternal = {
gndTemp: 15,
gndTempSet: 0,
depApt: "",
depAptElev: 0,
tropo: 36090,
tropoSet: 0,
toFromSet: 0,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}
}
Expand Down
Loading