1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
Jonathan Redpath 2022-01-08 20:07:39 +00:00
commit cfbd7f2f2b
10 changed files with 591 additions and 430 deletions

View file

@ -1473,7 +1473,39 @@
<!-- Cocktpit Door Switch -->
<animation>
<type>knob</type>
<type>slider</type>
<object-name>CockpitDoorSwitch</object-name>
<object-name>CockpitDoorSwitch.mark</object-name>
<property>controls/doors/doorc-switch</property>
<drag-direction>vertical</drag-direction>
<action>
<binding>
<command>property-adjust</command>
<property>controls/doors/doorc-switch</property>
<factor>-1</factor>
<min>-1</min>
<max>1</max>
<wrap>0</wrap>
</binding>
</action>
<release>
<binding>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>0</value>
</binding>
</release>
<hovered>
<binding>
<command>set-tooltip</command>
<tooltip-id>doorc-switch-lock</tooltip-id>
<label>Cockpit door switch</label>
</binding>
</hovered>
</animation>
<animation>
<type>rotate</type>
<object-name>CockpitDoorSwitch</object-name>
<object-name>CockpitDoorSwitch.mark</object-name>
<property>controls/doors/doorc-switch</property>
@ -1485,38 +1517,6 @@
<axis>
<object-name>CockpitDoorSwitch.axis</object-name>
</axis>
<action>
<binding>
<command>property-cycle</command>
<property>controls/doors/doorc-switch</property>
<value>-1</value>
<value>0</value>
<value>1</value>
<wrap>false</wrap>
</binding>
<binding>
<command>nasal</command>
<script>setprop("sim/sounde/switch1", 1);</script>
</binding>
</action>
<release>
<binding>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>0</value>
</binding>
<binding>
<command>nasal</command>
<script>setprop("sim/sounde/switch1", 1);</script>
</binding>
</release>
<hovered>
<binding>
<command>set-tooltip</command>
<tooltip-id>doorc-switch-lock</tooltip-id>
<label>Cockpit door switch</label>
</binding>
</hovered>
</animation>
<animation>

View file

@ -5392,6 +5392,12 @@ var canvas_MCDU_base = {
me.colorRight(myVertRev[i].R1[2],myVertRev[i].R2[2],myVertRev[i].R3[2],myVertRev[i].R4[2],myVertRev[i].R5[2],myVertRev[i].R6[2]);
}
if (myVertRev[i] != nil and (myVertRev[i].type == 1 and fmgc.FMGCInternal.desSpdLimSet) or (myVertRev[i].type != 1 and fmgc.FMGCInternal.clbSpdLimSet)) {
me["Simple_L2"].setFontSize(normal);
} else {
me["Simple_L2"].setFontSize(small);
}
pageSwitch[i].setBoolValue(1);
}
} else if (page == "DEPARTURE") {

View file

@ -648,8 +648,6 @@ var canvas_pfd = {
obj.AI_fpv_rot = obj["FPV"].createTransform();
obj.page = obj.group;
# temporarily hidden
obj["ASI_buss"].hide();
obj["ASI_index_middle"].hide();
# end temporary hide
@ -664,7 +662,7 @@ var canvas_pfd = {
"ALT_digit_DN","ALT_digit_UP_metric","ALT_error","ALT_neg","ALT_group","ALT_group2","ALT_frame","VS_pointer","VS_box","VS_digit","VS_error","VS_group","QNH","QNH_setting","QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","CRS_pointer",
"HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five","HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","HDG_error","HDG_group","HDG_frame","TRK_pointer","machError","ilsError","ils_code","ils_freq","dme_dist","dme_dist_legend",
"ILS_HDG_R","ILS_HDG_L","ILS_right","ILS_left","outerMarker","middleMarker","innerMarker","v1_group","v1_text","vr_speed","F_target","S_target","FS_targets","flap_max","clean_speed","ground","ground_ref","FPV","spdLimError","vsFMArate","tailstrikeInd",
"Metric_box","Metric_letter","Metric_cur_alt","ASI_buss","ASI_index_middle"];
"Metric_box","Metric_letter","Metric_cur_alt","ASI_buss","ASI_buss_ref","ASI_buss_ref_blue","ASI_index_middle"];
},
getKeysTest: func() {
return ["Test_white","Test_text"];
@ -674,6 +672,7 @@ var canvas_pfd = {
},
aoa: 0,
showMetricAlt: 0,
ASItrendIsShown: 0,
update: func(notification) {
me.updatePower(notification);
@ -755,6 +754,9 @@ var canvas_pfd = {
if (dmc.DMController.DMCs[me.number].outputs[0] != nil) {
me.ind_spd = dmc.DMController.DMCs[me.number].outputs[0].getValue();
me["ASI_error"].hide();
me["ASI_buss"].hide();
me["ASI_buss_ref"].hide();
me["ASI_buss_ref_blue"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ASI_group"].show();
me["VLS_min"].hide();
@ -1097,17 +1099,23 @@ var canvas_pfd = {
me["ASI_trend_up"].setTranslation(0, math.clamp(me.ASItrend, 0, 50) * -6.6);
me["ASI_trend_down"].setTranslation(0, math.clamp(me.ASItrend, -50, 0) * -6.6);
if (me.ASItrend >= 2) {
me["ASI_trend_up"].show();
me["ASI_trend_down"].hide();
} else if (me.ASItrend <= -2) {
me["ASI_trend_down"].show();
me["ASI_trend_up"].hide();
if (notification.fac1 or notification.fac2) {
if (me.ASItrend >= 2 or (me.ASItrendIsShown and me.ASItrend >= 1)) {
me["ASI_trend_up"].show();
me["ASI_trend_down"].hide();
me.ASItrendIsShown = 1;
} else if (me.ASItrend <= -2 or (me.ASItrendIsShown and me.ASItrend <= -1)) {
me["ASI_trend_up"].hide();
me["ASI_trend_down"].show();
me.ASItrendIsShown = 1;
} else {
me["ASI_trend_up"].hide();
me["ASI_trend_down"].hide();
}
} else {
me["ASI_trend_up"].hide();
me["ASI_trend_down"].hide();
}
if (-notification.agl >= -565 and -notification.agl <= 565) {
me["ground_ref"].show();
@ -1116,7 +1124,19 @@ var canvas_pfd = {
}
} else {
me["ASI_group"].hide();
me["ASI_error"].show();
if (!systems.ADIRS.Operating.adr[0].getValue() and !systems.ADIRS.Operating.adr[1].getValue() and !systems.ADIRS.Operating.adr[2].getValue()) {
me["ASI_buss"].show();
me["ASI_buss_ref"].show();
me["ASI_buss_ref_blue"].show();
me["ASI_buss"].setTranslation(0, notification.bussTranslate);
me["ASI_buss_ref_blue"].setTranslation(0, notification.bussTranslate);
me["ASI_error"].hide();
} else {
me["ASI_buss"].hide();
me["ASI_buss_ref"].hide();
me["ASI_buss_ref_blue"].hide();
me["ASI_error"].show();
}
me["ASI_frame"].setColor(1,0,0);
me["clean_speed"].hide();
me["S_target"].hide();
@ -2032,6 +2052,8 @@ var input = {
decel: "/FMGC/internal/decel",
radio: "/FMGC/internal/radio",
baro: "/FMGC/internal/baro",
bussTranslate: "/instrumentation/pfd/buss/translate",
};
foreach (var name; keys(input)) {

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 349 KiB

View file

@ -27,8 +27,6 @@ var alt = 0;
var altitude = 0;
var flap = 0;
var flaps = 0;
var ias = 0;
var mach = 0;
var ktsmach = 0;
var kts_sel = 0;
var mach_sel = 0;
@ -80,6 +78,12 @@ var FMGCinit = func {
var FMGCInternal = {
minspeed: 0,
maxspeed: 0,
clbSpdLim: 250,
desSpdLim: 250,
clbSpdLimAlt: 10000,
desSpdLimAlt: 10000,
clbSpdLimSet: 0,
desSpdLimSet: 0,
takeoffState: 0,
# speeds
@ -255,7 +259,10 @@ var postInit = func() {
var FMGCNodes = {
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
decel: props.globals.initNode("/FMGC/internal/decel", 0, "BOOL"),
mngSpdAlt: props.globals.getNode("/FMGC/internal/mng-alt-spd"),
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"),
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
@ -334,11 +341,8 @@ var updateFuel = func {
final_fuel = 1000 * FMGCInternal.finalFuel;
zfw = 1000 * FMGCInternal.zfw;
final_time = final_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (final_time < 0) {
final_time = 0;
} elsif (final_time > 480) {
final_time = 480;
}
final_time = math.clamp(final_time, 0, 480);
if (num(final_time) >= 60) {
final_min = int(math.mod(final_time, 60));
final_hour = int((final_time - final_min) / 60);
@ -356,11 +360,8 @@ var updateFuel = func {
}
zfw = 1000 * FMGCInternal.zfw;
final_fuel = final_time * 2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903); # x2 for 2 engines
if (final_fuel < 0) {
final_fuel = 0;
} elsif (final_fuel > 80000) {
final_fuel = 80000;
}
final_fuel = math.clamp(final_fuel, 0, 80000);
FMGCInternal.finalFuel = final_fuel / 1000;
}
@ -372,11 +373,8 @@ var updateFuel = func {
alt_fuel = 1000 * num(FMGCInternal.altFuel);
zfw = 1000 * FMGCInternal.zfw;
alt_time = alt_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (alt_time < 0) {
alt_time = 0;
} elsif (alt_time > 480) {
alt_time = 480;
}
alt_time = math.clamp(alt_time, 0, 480);
if (num(alt_time) >= 60) {
alt_min = int(math.mod(alt_time, 60));
alt_hour = int((alt_time - alt_min) / 60);
@ -413,21 +411,14 @@ var updateFuel = func {
#trip_fuel = 4.003e+02 + (dist * -5.399e+01) + (dist * dist * -7.322e-02) + (dist * dist * dist * 1.091e-05) + (dist * dist * dist * dist * 2.962e-10) + (dist * dist * dist * dist * dist * -1.178e-13) + (dist * dist * dist * dist * dist * dist * 6.322e-18) + (crz * 5.387e+01) + (dist * crz * 1.583e+00) + (dist * dist * crz * 7.695e-04) + (dist * dist * dist * crz * -1.057e-07) + (dist * dist * dist * dist * crz * 1.138e-12) + (dist * dist * dist * dist * dist * crz * 1.736e-16) + (crz * crz * -1.171e+00) + (dist * crz * crz * -1.219e-02) + (dist * dist * crz * crz * -2.879e-06) + (dist * dist * dist * crz * crz * 3.115e-10) + (dist * dist * dist * dist * crz * crz * -4.093e-15) + (crz * crz * crz * 9.160e-03) + (dist * crz * crz * crz * 4.311e-05) + (dist * dist * crz * crz * crz * 4.532e-09) + (dist * dist * dist * crz * crz * crz * -2.879e-13) + (crz * crz * crz * crz * -3.338e-05) + (dist * crz * crz * crz * crz * -7.340e-08) + (dist * dist * crz * crz * crz * crz * -2.494e-12) + (crz * crz * crz * crz * crz * 5.849e-08) + (dist * crz * crz * crz * crz * crz * 4.898e-11) + (crz * crz * crz * crz * crz * crz * -3.999e-11);
trip_fuel = 4.018e+02 + (dist*3.575e+01) + (dist*dist*-4.260e-02) + (dist*dist*dist*-1.446e-05) + (dist*dist*dist*dist*4.101e-09) + (dist*dist*dist*dist*dist*-6.753e-13) + (dist*dist*dist*dist*dist*dist*5.074e-17) + (crz*-2.573e+01) + (dist*crz*-1.583e-01) + (dist*dist*crz*8.147e-04) + (dist*dist*dist*crz*4.485e-08) + (dist*dist*dist*dist*crz*-7.656e-12) + (dist*dist*dist*dist*dist*crz*4.503e-16) + (crz*crz*4.427e-01) + (dist*crz*crz*-1.137e-03) + (dist*dist*crz*crz*-4.409e-06) + (dist*dist*dist*crz*crz*-3.345e-11) + (dist*dist*dist*dist*crz*crz*4.985e-15) + (crz*crz*crz*-2.471e-03) + (dist*crz*crz*crz*1.223e-05) + (dist*dist*crz*crz*crz*9.660e-09) + (dist*dist*dist*crz*crz*crz*-2.127e-14) + (crz*crz*crz*crz*5.714e-06) + (dist*crz*crz*crz*crz*-3.546e-08) + (dist*dist*crz*crz*crz*crz*-7.536e-12) + (crz*crz*crz*crz*crz*-4.061e-09) + (dist*crz*crz*crz*crz*crz*3.355e-11) + (crz*crz*crz*crz*crz*crz*-1.451e-12);
if (trip_fuel < 400) {
trip_fuel = 400;
} elsif (trip_fuel > 80000) {
trip_fuel = 80000;
}
trip_fuel = math.clamp(trip_fuel, 400, 80000);
# cruize temp correction
trip_fuel = trip_fuel + (0.033 * (temp - 15 + (2 * crz / 10)) * flightPlanController.arrivalDist);
trip_time = 9.095e-02 + (dist*-3.968e-02) + (dist*dist*4.302e-04) + (dist*dist*dist*2.005e-07) + (dist*dist*dist*dist*-6.876e-11) + (dist*dist*dist*dist*dist*1.432e-14) + (dist*dist*dist*dist*dist*dist*-1.177e-18) + (crz*7.348e-01) + (dist*crz*3.310e-03) + (dist*dist*crz*-8.700e-06) + (dist*dist*dist*crz*-4.214e-10) + (dist*dist*dist*dist*crz*5.652e-14) + (dist*dist*dist*dist*dist*crz*-6.379e-18) + (crz*crz*-1.449e-02) + (dist*crz*crz*-7.508e-06) + (dist*dist*crz*crz*4.529e-08) + (dist*dist*dist*crz*crz*3.699e-13) + (dist*dist*dist*dist*crz*crz*8.466e-18) + (crz*crz*crz*1.108e-04) + (dist*crz*crz*crz*-4.126e-08) + (dist*dist*crz*crz*crz*-9.645e-11) + (dist*dist*dist*crz*crz*crz*-1.544e-16) + (crz*crz*crz*crz*-4.123e-07) + (dist*crz*crz*crz*crz*1.831e-10) + (dist*dist*crz*crz*crz*crz*7.438e-14) + (crz*crz*crz*crz*crz*7.546e-10) + (dist*crz*crz*crz*crz*crz*-1.921e-13) + (crz*crz*crz*crz*crz*crz*-5.453e-13);
if (trip_time < 10) {
trip_time = 10;
} elsif (trip_time > 480) {
trip_time = 480;
}
trip_time = math.clamp(trip_time, 10, 480);
# if (low air conditioning) {
# trip_fuel = trip_fuel * 0.995;
#}
@ -440,11 +431,7 @@ var updateFuel = func {
zfw = FMGCInternal.zfw;
landing_weight_correction = 9.951e+00 + (dist*-2.064e+00) + (dist*dist*2.030e-03) + (dist*dist*dist*8.179e-08) + (dist*dist*dist*dist*-3.941e-11) + (dist*dist*dist*dist*dist*2.443e-15) + (crz*2.771e+00) + (dist*crz*3.067e-02) + (dist*dist*crz*-1.861e-05) + (dist*dist*dist*crz*2.516e-10) + (dist*dist*dist*dist*crz*5.452e-14) + (crz*crz*-4.483e-02) + (dist*crz*crz*-1.645e-04) + (dist*dist*crz*crz*5.212e-08) + (dist*dist*dist*crz*crz*-8.721e-13) + (crz*crz*crz*2.609e-04) + (dist*crz*crz*crz*3.898e-07) + (dist*dist*crz*crz*crz*-4.617e-11) + (crz*crz*crz*crz*-6.488e-07) + (dist*crz*crz*crz*crz*-3.390e-10) + (crz*crz*crz*crz*crz*5.835e-10);
trip_fuel = trip_fuel + (landing_weight_correction * (FMGCInternal.lw * 1000 - 121254.24421) / 2204.622622);
if (trip_fuel < 400) {
trip_fuel = 400;
} elsif (trip_fuel > 80000) {
trip_fuel = 80000;
}
trip_fuel = math.clamp(trip_fuel, 400, 80000);
FMGCInternal.tripFuel = trip_fuel / 1000;
if (num(trip_time) >= 60) {
@ -498,11 +485,8 @@ var updateFuel = func {
FMGCInternal.extraFuel = extra_fuel / 1000;
lw = 1000 * FMGCInternal.lw;
extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines
if (extra_time < 0) {
extra_time = 0;
} elsif (extra_time > 480) {
extra_time = 480;
}
extra_time = math.clamp(extra_time, 0, 480);
if (num(extra_time) >= 60) {
extra_min = int(math.mod(extra_time, 60));
extra_hour = int((extra_time - extra_min) / 60);
@ -627,7 +611,7 @@ var masterFMGC = maketimer(0.2, func {
}
}
} elsif (FMGCInternal.phase == 4) {
if (getprop("/FMGC/internal/decel")) {
if (FMGCNodes.decel.getValue()) {
newphase = 5;
}
} elsif (FMGCInternal.phase == 5) {
@ -644,9 +628,9 @@ var masterFMGC = maketimer(0.2, func {
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and
flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint
setprop("/FMGC/internal/decel", 1);
} elsif (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
setprop("/FMGC/internal/decel", 0);
FMGCNodes.decel.setValue(1);
} elsif (FMGCNodes.decel.getValue() and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
FMGCNodes.decel.setValue(0);
}
tempOverspeed = systems.ADIRS.overspeedVFE.getValue();
@ -950,8 +934,8 @@ var updateAirportRadios = func {
};
setlistener(FMGCNodes.phase, updateAirportRadios,0,0);
setlistener(flightPlanController.changed, updateAirportRadios,0,0);
setlistener(FMGCNodes.phase, updateAirportRadios, 0, 0);
setlistener(flightPlanController.changed, updateAirportRadios, 0, 0);
var reset_FMGC = func {
FMGCInternal.phase = 0;
@ -1002,110 +986,76 @@ var reset_FMGC = func {
#################
# Managed Speed #
#################
var srsSpeedNode = props.globals.getNode("/it-autoflight/settings/togaspd", 1);
var ktToMach = func(val) { return val * FMGCNodes.ktsToMachFactor.getValue(); }
var machToKt = func(val) { return val * FMGCNodes.machToKtsFactor.getValue(); }
var ManagedSPD = maketimer(0.25, func {
if (FMGCInternal.crzSet and FMGCInternal.costIndexSet) {
if (Custom.Input.spdManaged.getBoolValue()) {
altitude = pts.Instrumentation.Altimeter.indicatedFt.getValue();
mode = Modes.PFD.FMA.pitchMode.getValue();
ias = pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue();
mach = pts.Instrumentation.AirspeedIndicator.indicatedMach.getValue();
decel = FMGCNodes.decel.getValue();
ktsmach = Input.ktsMach.getValue();
kts_sel = Input.kts.getValue();
mach_sel = Input.mach.getValue();
srsSPD = getprop("/it-autoflight/settings/togaspd");
phase = FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
flap = pts.Controls.Flight.flapsPos.getValue();
decel = getprop("/FMGC/internal/decel");
mode = Modes.PFD.FMA.pitchMode.getValue();
srsSPD = srsSpeedNode.getValue();
mng_alt_spd = math.round(FMGCNodes.mngSpdAlt.getValue(), 1);
mng_alt_mach = math.round(FMGCNodes.mngMachAlt.getValue(), 0.001);
if (mach > mng_alt_mach and (FMGCInternal.phase == 2 or FMGCInternal.phase == 3)) {
# Phase: 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
if (pts.Instrumentation.AirspeedIndicator.indicatedMach.getValue() > mng_alt_mach and (FMGCInternal.phase == 2 or FMGCInternal.phase == 3)) {
FMGCInternal.machSwitchover = 1;
} elsif (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) {
} elsif (pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue() > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) {
FMGCInternal.machSwitchover = 0;
}
if ((mode == " " or mode == "SRS") and (FMGCInternal.phase == 0 or FMGCInternal.phase == 1)) {
if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0;
FMGCInternal.mngSpdCmd = srsSPD;
} elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude <= FMGCInternal.clbSpdLimAlt) {
# Speed is maximum of greendot / climb speed limit
FMGCInternal.mngKtsMach = 0;
FMGCInternal.mngSpdCmd = decel ? FMGCInternal.minspeed : math.clamp(FMGCInternal.clbSpdLim, FMGCInternal.clean, 999);
} elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > (FMGCInternal.clbSpdLimAlt + 20)) {
FMGCInternal.mngKtsMach = FMGCInternal.machSwitchover ? 1 : 0;
FMGCInternal.mngSpdCmd = FMGCInternal.machSwitchover ? mng_alt_mach : mng_alt_spd;
} elsif ((FMGCInternal.phase >= 4 and FMGCInternal.phase <= 6) and altitude > (FMGCInternal.desSpdLimAlt + 20)) {
if (decel) {
FMGCInternal.mngKtsMach = 0;
}
if (FMGCInternal.mngSpdCmd != srsSPD) {
FMGCInternal.mngSpdCmd = srsSPD;
}
} elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude <= 10050) {
if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0;
}
if (FMGCInternal.mngSpdCmd != 250 and !decel) {
FMGCInternal.mngSpdCmd = 250;
} elsif (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
}
} elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !FMGCInternal.machSwitchover) {
if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0;
}
if (FMGCInternal.mngSpdCmd != mng_alt_spd) {
FMGCInternal.mngSpdCmd = mng_alt_spd;
}
} elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and FMGCInternal.machSwitchover) {
if (!FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 1;
}
if (FMGCInternal.mngSpdCmd != mng_alt_mach) {
FMGCInternal.mngSpdCmd = mng_alt_mach;
}
} elsif (FMGCInternal.phase == 4 and altitude > 11000 and !FMGCInternal.machSwitchover) {
if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0;
}
if (FMGCInternal.mngSpdCmd != mng_alt_spd) {
FMGCInternal.mngSpdCmd = mng_alt_spd;
}
} elsif (FMGCInternal.phase == 4 and altitude > 11000 and FMGCInternal.machSwitchover) {
if (!FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 1;
}
if (FMGCInternal.mngSpdCmd != mng_alt_mach) {
FMGCInternal.mngSpdCmd = mng_alt_mach;
}
} elsif ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude > 11000 and !FMGCInternal.machSwitchover) {
if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0;
}
if (FMGCInternal.mngSpdCmd != mng_alt_spd and !decel) {
FMGCInternal.mngSpdCmd = mng_alt_spd;
} elsif (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
}
} elsif ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) {
if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0;
}
if (FMGCInternal.mngSpdCmd != 250 and !decel) {
FMGCInternal.mngSpdCmd = 250;
} elsif (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
} else {
FMGCInternal.mngKtsMach = FMGCInternal.machSwitchover ? 1 : 0;
FMGCInternal.mngSpdCmd = FMGCInternal.machSwitchover ? mng_alt_mach : mng_alt_spd;
}
} elsif ((FMGCInternal.phase >= 4 and FMGCInternal.phase <= 6) and altitude <= FMGCInternal.desSpdLimAlt) {
FMGCInternal.mngKtsMach = 0;
# Speed is maximum of greendot / descent speed limit
FMGCInternal.mngSpdCmd = decel ? FMGCInternal.minspeed : math.clamp(FMGCInternal.desSpdLim, FMGCInternal.clean, 999);
}
if (FMGCInternal.mngSpdCmd > FMGCInternal.maxspeed - 5) {
FMGCInternal.mngSpd = (FMGCInternal.maxspeed - 5);
# Clamp to minspeed, maxspeed
if (FMGCInternal.phase >= 2) {
if (!FMGCInternal.mngKtsMach) {
FMGCInternal.mngSpd = math.clamp(FMGCInternal.mngSpdCmd, FMGCInternal.minspeed, FMGCInternal.maxspeed);
} else {
FMGCInternal.mngSpd = math.clamp(FMGCInternal.mngSpdCmd, ktToMach(FMGCInternal.minspeed), ktToMach(FMGCInternal.maxspeed));
}
} else {
FMGCInternal.mngSpd = FMGCInternal.mngSpdCmd;
}
# Update value of ktsMach
if (ktsmach and !FMGCInternal.mngKtsMach) {
Input.ktsMach.setValue(0);
} elsif (!ktsmach and FMGCInternal.mngKtsMach) {
Input.ktsMach.setValue(1);
}
if (kts_sel != FMGCInternal.mngSpd and !ktsmach) {
# Set target speed
if (Input.kts.getValue() != FMGCInternal.mngSpd and !ktsmach) {
Input.kts.setValue(FMGCInternal.mngSpd);
} elsif (mach_sel != FMGCInternal.mngSpd and ktsmach) {
} elsif (Input.mach.getValue() != FMGCInternal.mngSpd and ktsmach) {
Input.mach.setValue(FMGCInternal.mngSpd);
}
} else {

View file

@ -100,6 +100,7 @@ var triggerDoor = func(door, doorName, doorDesc) {
};
setlistener("/controls/doors/doorc-switch",func(a){
setprop("sim/sounde/switch1", 1);
if (systems.ELEC.Bus.dc1.getValue() > 25 or systems.ELEC.Bus.dc2.getValue() > 25) {
var pos = a.getValue();
var current = getprop("/sim/model/door-positions/doorc/lock-status");
@ -111,11 +112,11 @@ setlistener("/controls/doors/doorc-switch",func(a){
else if (pos == -1 and current == 1) { ## UNLOCK
settimer( func {
if (a.getValue() == pos) setprop("/sim/model/door-positions/doorc/lock-status",0);
},0.2);
},0.3);
}
#setprop("/sim/model/door-positions/doorc/lock-status",-9); ## FAULT
}
});
},0,0);
###########
# Systems #

View file

@ -15,7 +15,7 @@ var MCDU_init = func(i) {
var MCDU_reset = func(i) {
setprop("/MCDU[" ~ i ~ "]/active", 0);
setprop("/MCDU[" ~ i ~ "]/atsu-active", 0);
setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone
setprop("/it-autoflight/settings/togaspd", 157); #aka v2 clone
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
setprop("/MCDU[" ~ i ~ "]/last-atsu-page", "ATSUDLINK");
setprop("/MCDU[" ~ i ~ "]/active-system","");
@ -500,6 +500,8 @@ var lskbutton = func(btn, i) {
mcdu_scratchpad.scratchpads[i].empty();
}
}
} else if (page == "VERTREV") {
canvas_mcdu.myVertRev[i].pushButtonLeft(2);
} else if (page == "MCDUTEXT") {
atsu.freeTexts[i].selection = 1;
atsu.freeTexts[i].changed = 1;

View file

@ -1,4 +1,5 @@
var scratchpadStore = nil;
var scratchpadSplit = nil;
var vertRev = {
title: [nil, nil, nil],
@ -77,7 +78,7 @@ var vertRev = {
me.title = ["VERT REV", " AT ", "PPOS"];
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = ["250/10000", " CLB SPD LIM", "mag"];
me.L2 = [fmgc.FMGCInternal.clbSpdLim ~ "/" ~ fmgc.FMGCInternal.clbSpdLimAlt, " CLB SPD LIM", "mag"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
@ -90,7 +91,7 @@ var vertRev = {
me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0]];
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = ["250/10000", " CLB SPD LIM", "mag"];
me.L2 = [fmgc.FMGCInternal.clbSpdLim ~ "/" ~ fmgc.FMGCInternal.clbSpdLimAlt, " CLB SPD LIM", "mag"];
me.speed = me.getSpd();
if (me.speed[0] == nil) {
me.L3 = [" [ ]", " SPD CSTR", "blu"];
@ -130,7 +131,7 @@ var vertRev = {
}
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = ["250/10000", " CLB SPD LIM", "mag"];
me.L2 = [fmgc.FMGCInternal.clbSpdLim ~ "/" ~ fmgc.FMGCInternal.clbSpdLimAlt, " CLB SPD LIM", "mag"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
@ -146,7 +147,7 @@ var vertRev = {
}
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = ["250/10000", " DES SPD LIM", "mag"];
me.L2 = [fmgc.FMGCInternal.desSpdLim ~ "/" ~ fmgc.FMGCInternal.desSpdLimAlt, " DES SPD LIM", "mag"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
@ -180,7 +181,65 @@ var vertRev = {
},
pushButtonLeft: func(index) {
scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad;
if (index == 3 and me.type == 2) {
if (index == 2) {
if (scratchpadStore == "CLR") {
if (me.type == 1) {
fmgc.FMGCInternal.desSpdLim = 250;
fmgc.FMGCInternal.desSpdLimAlt = 10000;
fmgc.FMGCInternal.desSpdLimSet = 0;
} else {
fmgc.FMGCInternal.clbSpdLim = 250;
fmgc.FMGCInternal.clbSpdLimAlt = 10000;
fmgc.FMGCInternal.clbSpdLimSet = 0;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} elsif (find("/", scratchpadStore) != -1) {
scratchpadSplit = split("/", scratchpadStore);
if (size(scratchpadSplit[0]) == 3 and num(scratchpadSplit[0]) != nil and size(scratchpadSplit[1]) >= 3 and size(scratchpadSplit[1]) <= 5 and num(scratchpadSplit[1]) != nil) {
if (scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 340 and scratchpadSplit[1] >= 100 and scratchpadSplit[1] <= 39000) {
if (me.type == 1) {
fmgc.FMGCInternal.desSpdLim = scratchpadSplit[0];
fmgc.FMGCInternal.desSpdLimSet = 1;
if (size(scratchpadSplit[1]) != 0) {
fmgc.FMGCInternal.desSpdLimAlt = scratchpadSplit[1];
}
} else {
fmgc.FMGCInternal.clbSpdLim = scratchpadSplit[0];
fmgc.FMGCInternal.clbSpdLimSet = 1;
if (size(scratchpadSplit[1]) != 0) {
fmgc.FMGCInternal.clbSpdLimAlt = scratchpadSplit[1];
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
mcdu_message(me.computer, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
} elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3) {
if (scratchpadStore >= 100 and scratchpadStore <= 340) {
if (me.type == 1) {
fmgc.FMGCInternal.desSpdLim = scratchpadStore;
fmgc.FMGCInternal.desSpdLimSet = 1;
} else {
fmgc.FMGCInternal.clbSpdLim = scratchpadStore;
fmgc.FMGCInternal.clbSpdLimSet = 1;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
mcdu_message(me.computer, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
} elsif (index == 3 and me.type == 2) {
if (scratchpadStore == "CLR") {
me.wp.setSpeed("delete");
mcdu_scratchpad.scratchpads[me.computer].empty();

View file

@ -2380,6 +2380,14 @@
/it-fbw/law eq 0
fcs/slat-pos-deg lt 15
<test logic="OR">
<test logic="AND">
aero/alpha-deg-corrected ge 13.5
<test logic="OR">
/systems/navigation/aligned-1 eq 1
/systems/navigation/aligned-2 eq 1
/systems/navigation/aligned-3 eq 1
</test>
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-1 ge 13.5
/systems/navigation/adr/operating-1 eq 1
@ -2397,23 +2405,41 @@
<test logic="AND">
/it-fbw/law eq 0
fcs/slat-pos-deg ge 15
<test logic="AND">
/systems/navigation/adr/output/aoa-1 ge 22
/systems/navigation/adr/operating-1 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-2 ge 22
/systems/navigation/adr/operating-2 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-3 ge 22
/systems/navigation/adr/operating-3 eq 1
<test logic="OR">
<test logic="AND">
aero/alpha-deg-corrected ge 22
<test logic="OR">
/systems/navigation/aligned-1 eq 1
/systems/navigation/aligned-2 eq 1
/systems/navigation/aligned-3 eq 1
</test>
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-1 ge 22
/systems/navigation/adr/operating-1 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-2 ge 22
/systems/navigation/adr/operating-2 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-3 ge 22
/systems/navigation/adr/operating-3 eq 1
</test>
</test>
</test>
<test logic="AND">
/it-fbw/law ne 0
fcs/slat-pos-deg lt 15
<test logic="OR">
<test logic="AND">
aero/alpha-deg-corrected ge 8
<test logic="OR">
/systems/navigation/aligned-1 eq 1
/systems/navigation/aligned-2 eq 1
/systems/navigation/aligned-3 eq 1
</test>
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-1 ge 8
/systems/navigation/adr/operating-1 eq 1
@ -2431,17 +2457,27 @@
<test logic="AND">
/it-fbw/law ne 0
fcs/slat-pos-deg ge 15
<test logic="AND">
/systems/navigation/adr/output/aoa-1 ge 14
/systems/navigation/adr/operating-1 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-2 ge 14
/systems/navigation/adr/operating-2 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-3 ge 14
/systems/navigation/adr/operating-3 eq 1
<test logic="OR">
<test logic="AND">
aero/alpha-deg-corrected ge 14
<test logic="OR">
/systems/navigation/aligned-1 eq 1
/systems/navigation/aligned-2 eq 1
/systems/navigation/aligned-3 eq 1
</test>
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-1 ge 14
/systems/navigation/adr/operating-1 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-2 ge 14
/systems/navigation/adr/operating-2 eq 1
</test>
<test logic="AND">
/systems/navigation/adr/output/aoa-3 ge 14
/systems/navigation/adr/operating-3 eq 1
</test>
</test>
</test>
</test>

View file

@ -452,4 +452,62 @@
</channel>
<channel name="PFD BUSS" execrate="8">
<fcs_function name="/instrumentation/pfd/buss/translate">
<function>
<ifthen>
<lt>
<property>/fdm/jsbsim/fcs/slat-pos-deg</property>
<value>15</value>
</lt>
<table>
<independentVar lookup="row">aero/alpha-deg-corrected</independentVar>
<tableData>
-1.5 136.409
0.0 53.447
3.0 0
6.5 -53.447
8.0 -136.409
</tableData>
</table>
<table>
<independentVar lookup="row">aero/alpha-deg-corrected</independentVar>
<tableData>
-1.5 136.409
0.0 53.447
3.0 0
12.5 -53.447
14.0 -136.409
</tableData>
</table>
</ifthen>
</function>
</fcs_function>
</channel>
<channel name="FMGC">
<fcs_function name="/FMGC/internal/kts-to-mach-factor">
<function>
<quotient>
<property>/instrumentation/airspeed-indicator/indicated-mach</property>
<property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
</quotient>
</function>
</fcs_function>
<fcs_function name="/FMGC/internal/mach-to-kts-factor">
<function>
<quotient>
<property>/instrumentation/airspeed-indicator/indicated-mach</property>
<property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
</quotient>
</function>
</fcs_function>
</channel>
</system>