1
0
Fork 0

Improvements to ZFW/ZFWCG (correct order, add constraints, check decimal size)

This commit is contained in:
Matthew Maring 2020-06-26 17:11:27 -04:00
parent 3023fd45f2
commit 46ab42be56
5 changed files with 2336 additions and 2315 deletions

View file

@ -294,8 +294,8 @@ var canvas_MCDU_base = {
"Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow",
"Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C3B","Simple_C4","Simple_C4B","Simple_C5","Simple_C6","Simple_C1S",
"Simple_C2S","Simple_C3S","Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp",
"INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","FUELPRED","FUELPRED_ZFW",
"FUELPRED_ZFWCG","FUELPRED_ZFW_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR",
"INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFWCG_S","INITB_Block","FUELPRED","FUELPRED_ZFW",
"FUELPRED_ZFWCG","FUELPRED_ZFWCG_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR",
"PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From",
"FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R",
"arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star"];
@ -1483,7 +1483,7 @@ var canvas_MCDU_base = {
me.fontRightS(default, default, default, default, default, default);
me.fontSizeLeft(small, small, small, small, small, small);
me.fontSizeCenter(small, small, small, small, small, small);
me.fontSizeCenter(normal, small, small, small, small, small);
me.fontSizeRight(normal, normal, normal, small, small, small);
me["Simple_C4B"].setFontSize(small);
@ -1754,28 +1754,30 @@ var canvas_MCDU_base = {
}
}
me["Simple_R1S"].setText("ZFWCG/ ZFW");
me["Simple_R1"].setText(sprintf("%3.1f", zfw.getValue()));
me["Simple_R1S"].setText("ZFW/ZFWCG");
me["Simple_R1"].setText(sprintf("%3.1f", zfwcg.getValue()));
me["INITB_ZFWCG"].hide();
me["INITB_ZFWCG_S"].show();
me["Simple_R1"].show();
if (zfwcgSet.getValue() == 1) {
me["Simple_C1"].setFontSize(normal);
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["INITB_ZFWCG"].hide();
me["Simple_R1"].setFontSize(normal);
} else {
me["Simple_C1"].setFontSize(small);
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["INITB_ZFWCG"].hide();
me["Simple_R1"].setFontSize(small);
}
if (zfwSet.getValue() == 1) {
if (zfw.getValue() < 100) {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
} else {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
}
me["Simple_C1"].show();
me["INITB_ZFW"].hide();
me["INITB_ZFW_S"].show();
me["Simple_R1"].show();
} else {
me["Simple_C1"].hide();
me["INITB_ZFW"].show();
me["INITB_ZFW_S"].hide();
me["Simple_R1"].hide();
}
if (taxi_fuel_set.getValue() == 1) {
me["Simple_L1"].setFontSize(normal);
} else {
@ -1860,7 +1862,7 @@ var canvas_MCDU_base = {
me.fontRightS(default, default, default, default, default, default);
me.fontSizeLeft(normal, normal, small, small, small, small);
me.fontSizeCenter(small, small, small, small, small, small);
me.fontSizeCenter(small, small, normal, small, small, small);
me.fontSizeRight(normal, normal, normal, small, small, small);
me["Simple_C3B"].setFontSize(small);
@ -2026,26 +2028,28 @@ var canvas_MCDU_base = {
me.colorRight("ack", "ack", "blu", "grn", "grn", "grn");
}
me["Simple_R3S"].setText("ZFWCG/ZFW");
me["Simple_R3"].setText(sprintf("%3.1f", zfw.getValue()));
me["Simple_R3S"].setText("ZFW/ZFWCG");
me["Simple_R3"].setText(sprintf("%3.1f", zfwcg.getValue()));
me["Simple_R3"].show();
me["FUELPRED_ZFWCG"].hide();
me["FUELPRED_ZFWCG_S"].show();
if (zfwcgSet.getValue() == 1) {
me["Simple_C3"].setFontSize(normal);
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["FUELPRED_ZFWCG"].hide();
me["Simple_R3"].setFontSize(normal);
} else {
me["Simple_C3"].setFontSize(small);
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["FUELPRED_ZFWCG"].hide();
me["Simple_R3"].setFontSize(small);
}
if (zfwSet.getValue() == 1) {
if (zfw.getValue() < 100) {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
} else {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
}
me["Simple_C3"].show();
me["FUELPRED_ZFW"].hide();
me["FUELPRED_ZFW_S"].show();
me["Simple_R3"].show();
} else {
me["Simple_C3"].hide();
me["FUELPRED_ZFW"].show();
me["FUELPRED_ZFW_S"].hide();
me["Simple_R3"].hide();
}
if (rte_rsv_set.getValue() == 1) {

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View file

@ -148,14 +148,14 @@ var fuelPredInput = func(key, i) {
if (scratchpad == "CLR") {
mcdu_message(i, "NOT ALLOWED");
} else {
if (!getprop("/FMGC/internal/cost-index-set")) {
if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) {
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index"));
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index"));
}
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw_min = 80.6; #make based on performance
var zfw_max = 137.8; #make based on performance
if (size(scratchpad) == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
@ -167,26 +167,45 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
mcdu_scratchpad.scratchpads[i].empty();
} else if (find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]);
var zfw = num(zfwi[1]);
var zfwcgs = size(zfwi[0]);
var zfws = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
var zfw = num(zfwi[0]);
var zfwcg = num(zfwi[1]);
var zfws = size(zfwi[0]);
var zfwcgs = size(zfwi[1]);
if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfw", zfw);
setprop("/FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
setprop("/FMGC/internal/zfw", zfw);
} else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) {
if (scratchpad >= zfw_min and scratchpad <= zfw_max) {
setprop("/FMGC/internal/zfw", scratchpad);
setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
@ -196,31 +215,9 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -148,14 +148,14 @@ var initInputB = func(key, i) {
if (scratchpad == "CLR") {
mcdu_message(i, "NOT ALLOWED");
} else {
if (!getprop("/FMGC/internal/cost-index-set")) {
if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) {
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index"));
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index"));
}
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw_min = 80.6; #make based on performance
var zfw_max = 137.8; #make based on performance
if (size(scratchpad) == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
@ -171,18 +171,49 @@ var initInputB = func(key, i) {
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
mcdu_scratchpad.scratchpads[i].empty();
} else if (find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]);
var zfw = num(zfwi[1]);
var zfwcgs = size(zfwi[0]);
var zfws = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) {
setprop("/FMGC/internal/zfwcg", zfwi[0]);
setprop("/FMGC/internal/zfwcg-set", 1);
var zfw = num(zfwi[0]);
var zfwcg = num(zfwi[1]);
var zfws = size(zfwi[0]);
var zfwcgs = size(zfwi[1]);
if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfw", zfw);
setprop("/FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
} else if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
setprop("/FMGC/internal/zfw", zfwi[1]);
} else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) {
if (scratchpad >= zfw_min and scratchpad <= zfw_max) {
setprop("/FMGC/internal/zfw", scratchpad);
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
@ -196,20 +227,9 @@ var initInputB = func(key, i) {
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -88,7 +88,7 @@ var MCDU_reset = func(i) {
# INT-B
setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg", 55.1);
setprop("/FMGC/internal/zfwcg", 25.0);
setprop("/FMGC/internal/zfwcg-set", 0);
setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/block-set", 0);
@ -168,7 +168,7 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1);
# setprop("/FMGC/internal/dest-mag-grnd", -1);
# setprop("/FMGC/internal/dest-wind-grnd", -1);
# setprop("/FMGC/internal/dest-wind-grnd", -1);
setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/FMGC/internal/final", "");
setprop("/FMGC/internal/baro", 99999);