From e8fd43885db5ccf81039b6619c1872f467e1ebc7 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Sun, 30 Aug 2020 09:37:22 +1000 Subject: [PATCH 01/17] Add basic FPV functionality --- Models/Instruments/PFD/PFD.nas | 28 +++++++++++++++++++++++++++- Models/Instruments/PFD/res/pfd.svg | 5 +++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 29bdb447..1855c58a 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -15,6 +15,7 @@ var updateR = 0; var elapsedtime = 0; var altTens = 0; var altPolarity = ""; +var FPV_Y_COEFFICIENT = 12.5; # Fetch nodes: var state1 = props.globals.getNode("/systems/thrust/state1", 1); @@ -126,6 +127,9 @@ var inner_marker = props.globals.getNode("/instrumentation/marker-beacon/inner", var flap_config = props.globals.getNode("/controls/flight/flaps-input", 1); var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1); var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1); +var aoa_1 = props.globals.getNode("/systems/navigation/adr/output/aoa-1", 1); +var aoa_2 = props.globals.getNode("/systems/navigation/adr/output/aoa-2", 1); +var aoa_3 = props.globals.getNode("/systems/navigation/adr/output/aoa-3", 1); # Create Nodes: var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); @@ -212,7 +216,7 @@ var canvas_PFD_base = { "AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","ALT_box_flash","ALT_box","ALT_box_amber","ALT_scale","ALT_target","ALT_target_digit","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_digit_UP", "ALT_digit_DN","ALT_error","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"]; + "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"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -1079,6 +1083,17 @@ var canvas_PFD_1 = { me["FD_pitch"].hide(); } + # FPV + # If TRK FPA selected on the FCU, display FPV on PFD1 + # TODO - Deal with situation if AOA not available from ADR1 + # TODO - Hide FPV if error on PFD1 + if (ap_trk_sw.getValue() == 0) { + me["FPV"].hide(); + } else { + me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, math.clamp(aoa_1.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT); + me["FPV"].show(); + } + # ILS if (ap_ils_mode.getValue() == 1) { me["LOC_scale"].show(); @@ -1817,6 +1832,17 @@ var canvas_PFD_2 = { me["FD_pitch"].hide(); } + # FPV + # If TRK FPA selected on the FCU, display FPV on PFD2 + # TODO - Deal with situation if AOA not available from ADR2 + # TODO - Hide FPV if error on PFD2 + if (ap_trk_sw.getValue() == 0) { + me["FPV"].hide(); + } else { + me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, math.clamp(aoa_2.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT); + me["FPV"].show(); + } + # ILS if (ap_ils_mode2.getValue() == 1) { me["LOC_scale"].show(); diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 214a1acd..ca79543d 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -6656,4 +6656,9 @@ x="61.095329" y="74.429939" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:35.9995px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:0.657577">FLX + From 7a6fecad3d6593c79649bf68dbbe5b89d5a56c02 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Mon, 31 Aug 2020 13:42:02 +1000 Subject: [PATCH 02/17] Dim fixed aircraft outline if crew selects TRK-FPA --- Models/Instruments/PFD/PFD.nas | 28 ++++++++++++++++++++++++---- Models/Instruments/PFD/res/pfd.svg | 10 ++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 1855c58a..1c28658d 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -216,7 +216,7 @@ var canvas_PFD_base = { "AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","ALT_box_flash","ALT_box","ALT_box_amber","ALT_scale","ALT_target","ALT_target_digit","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_digit_UP", "ALT_digit_DN","ALT_error","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"]; + "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", "fixed_aircraft_outline_1","fixed_aircraft_outline_2"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -1014,6 +1014,22 @@ var canvas_PFD_base = { me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); me["AI_heading"].update(); }, + + dimFixedAircraftOutline: func() { + var r = 0.345098039; + var g = 0.349019608; + var b = 0.058823529; + me["fixed_aircraft_outline_1"].setColor(r, g, b); + me["fixed_aircraft_outline_2"].setColor(r, g, b); + }, + + undimFixedAircraftOutline: func() { + var r = 0.788235294; + var g = 0.819607843; + var b = 0.129411765; + me["fixed_aircraft_outline_1"].setColor(r, g, b); + me["fixed_aircraft_outline_2"].setColor(r, g, b); + }, }; var canvas_PFD_1 = { @@ -1089,9 +1105,11 @@ var canvas_PFD_1 = { # TODO - Hide FPV if error on PFD1 if (ap_trk_sw.getValue() == 0) { me["FPV"].hide(); + me.undimFixedAircraftOutline(); } else { - me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, math.clamp(aoa_1.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT); + me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa_1.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); me["FPV"].show(); + me.dimFixedAircraftOutline(); } # ILS @@ -1837,10 +1855,12 @@ var canvas_PFD_2 = { # TODO - Deal with situation if AOA not available from ADR2 # TODO - Hide FPV if error on PFD2 if (ap_trk_sw.getValue() == 0) { - me["FPV"].hide(); + me["FPV"].hide(); + me.undimFixedAircraftOutline(); } else { - me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, math.clamp(aoa_2.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT); + me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa_2.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); me["FPV"].show(); + me.dimFixedAircraftOutline(); } # ILS diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index ca79543d..92f8bc0d 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -1396,9 +1396,10 @@ + style="fill:none;fill-opacity:1;stroke:#c9d121;stroke-width:3.54375;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:label="fixed_aircraft_outline_1" /> + sodipodi:nodetypes="cccccccccccc" + inkscape:label="fixed_aircraft_outline_2" /> Date: Tue, 1 Sep 2020 20:27:03 +1000 Subject: [PATCH 03/17] Enable crew to switch to ADR3 if ADR1 or 2 unavailable --- Models/Instruments/PFD/PFD.nas | 50 +++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 1c28658d..e48ded32 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -130,6 +130,13 @@ var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1); var aoa_1 = props.globals.getNode("/systems/navigation/adr/output/aoa-1", 1); var aoa_2 = props.globals.getNode("/systems/navigation/adr/output/aoa-2", 1); var aoa_3 = props.globals.getNode("/systems/navigation/adr/output/aoa-3", 1); +var adr_1_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-1", 1); +var adr_2_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-2", 1); +var adr_3_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-3", 1); +var adr_1_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-1-fault", 1); +var adr_2_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-2-fault", 1); +var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-3-fault", 1); +var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); # Create Nodes: var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); @@ -1015,6 +1022,8 @@ var canvas_PFD_base = { me["AI_heading"].update(); }, + # dim the yellow outline of fixed aircraft symbol on PFDs + # eg when crew select TRK-FPA dimFixedAircraftOutline: func() { var r = 0.345098039; var g = 0.349019608; @@ -1023,13 +1032,30 @@ var canvas_PFD_base = { me["fixed_aircraft_outline_2"].setColor(r, g, b); }, + # undim the yellow outline of fixed aircraft symbol on PFDs undimFixedAircraftOutline: func() { - var r = 0.788235294; - var g = 0.819607843; - var b = 0.129411765; - me["fixed_aircraft_outline_1"].setColor(r, g, b); - me["fixed_aircraft_outline_2"].setColor(r, g, b); + var r = 0.788235294; + var g = 0.819607843; + var b = 0.129411765; + me["fixed_aircraft_outline_1"].setColor(r, g, b); + me["fixed_aircraft_outline_2"].setColor(r, g, b); }, + + # Get Angle of Attack from ADR1 or, depending on Switching panel, ADR3 + getAOAForPFD1: func() { + if (air_data_switch.getValue() != -1 and adr_1_switch.getValue() and !adr_1_fault.getValue()) return aoa_1.getValue(); + if (air_data_switch.getValue() == -1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue(); + return nil; + }, + + # Get Angle of Attack from ADR2 or, depending on Switching panel, ADR3 + getAOAForPFD2: func() { + if (air_data_switch.getValue() != 1 and adr_2_switch.getValue() and !adr_2_fault.getValue()) return aoa_2.getValue(); + if (air_data_switch.getValue() == 1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue(); + return nil; + }, + + }; var canvas_PFD_1 = { @@ -1101,13 +1127,12 @@ var canvas_PFD_1 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD1 - # TODO - Deal with situation if AOA not available from ADR1 - # TODO - Hide FPV if error on PFD1 - if (ap_trk_sw.getValue() == 0) { + var aoa = me.getAOAForPFD1(); + if (ap_trk_sw.getValue() == 0 or aoa == nil) { me["FPV"].hide(); me.undimFixedAircraftOutline(); } else { - me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa_1.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); + me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa, -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); me["FPV"].show(); me.dimFixedAircraftOutline(); } @@ -1852,13 +1877,12 @@ var canvas_PFD_2 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD2 - # TODO - Deal with situation if AOA not available from ADR2 - # TODO - Hide FPV if error on PFD2 - if (ap_trk_sw.getValue() == 0) { + var aoa = me.getAOAForPFD2(); + if (ap_trk_sw.getValue() == 0 or aoa == nil) { me["FPV"].hide(); me.undimFixedAircraftOutline(); } else { - me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa_2.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); + me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa, -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); me["FPV"].show(); me.dimFixedAircraftOutline(); } From f90010da16b5e66922877c557568593a3d2b39e0 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Sun, 6 Sep 2020 22:43:54 +1000 Subject: [PATCH 04/17] Adjust vertical or horizontal translation of FPV position to account for roll angle --- Models/Instruments/PFD/PFD.nas | 60 +++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index e48ded32..17509d99 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -15,7 +15,7 @@ var updateR = 0; var elapsedtime = 0; var altTens = 0; var altPolarity = ""; -var FPV_Y_COEFFICIENT = 12.5; +var track_diff = 0; # Fetch nodes: var state1 = props.globals.getNode("/systems/thrust/state1", 1); @@ -138,6 +138,7 @@ var adr_2_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-3-fault", 1); var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); + # Create Nodes: var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); var ground_diff = props.globals.initNode("/instrumentation/pfd/ground-diff", 0.0, "DOUBLE"); @@ -148,7 +149,7 @@ var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); -var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); +#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE"); @@ -972,7 +973,8 @@ var canvas_PFD_base = { me["HDG_target"].hide(); } - me["TRK_pointer"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, 0); + track_diff = track.getValue() - heading.getValue(); + me["TRK_pointer"].setTranslation((math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416, 0); split_ils = split("/", ils_data1.getValue()); if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) { @@ -1023,20 +1025,20 @@ var canvas_PFD_base = { }, # dim the yellow outline of fixed aircraft symbol on PFDs - # eg when crew select TRK-FPA - dimFixedAircraftOutline: func() { + # eg when crew select TRK + # 1 == dim + # 0 == undim + dimFixedAircraftOutline: func(dim_bool) { var r = 0.345098039; var g = 0.349019608; var b = 0.058823529; - me["fixed_aircraft_outline_1"].setColor(r, g, b); - me["fixed_aircraft_outline_2"].setColor(r, g, b); - }, + + if (dim_bool == 0) { + r = 0.788235294; + g = 0.819607843; + b = 0.129411765; + } - # undim the yellow outline of fixed aircraft symbol on PFDs - undimFixedAircraftOutline: func() { - var r = 0.788235294; - var g = 0.819607843; - var b = 0.129411765; me["fixed_aircraft_outline_1"].setColor(r, g, b); me["fixed_aircraft_outline_2"].setColor(r, g, b); }, @@ -1055,6 +1057,22 @@ var canvas_PFD_base = { return nil; }, + # Returns Y translation value for FPV - accounting for angle of roll + # (On the PFD the FPA is perpendicular to the artificial horizon which is not always horizontal) + getFPVYTranslation: func(track_x_translation, fpa_deg) { + + var FPV_Y_COEFFICIENT = 12.5; # query if it should be 12.5 or 11.825 + var pitch_px = pitch.getValue() * FPV_Y_COEFFICIENT; + var roll_rad = roll.getValue() * D2R; + + var pitch_y_translation = math.tan(roll_rad) * (( pitch_px/math.sin(roll_rad)) + track_x_translation); + + var fpa_y_translation = (fpa_deg * FPV_Y_COEFFICIENT)/math.cos(roll_rad); + + return pitch_y_translation + ((-1) * fpa_y_translation); + + }, + }; @@ -1130,11 +1148,13 @@ var canvas_PFD_1 = { var aoa = me.getAOAForPFD1(); if (ap_trk_sw.getValue() == 0 or aoa == nil) { me["FPV"].hide(); - me.undimFixedAircraftOutline(); + me.dimFixedAircraftOutline(0); } else { - me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa, -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); + var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; + var fpa_deg = pitch.getValue() - aoa; + me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); me["FPV"].show(); - me.dimFixedAircraftOutline(); + me.dimFixedAircraftOutline(1); } # ILS @@ -1880,11 +1900,13 @@ var canvas_PFD_2 = { var aoa = me.getAOAForPFD2(); if (ap_trk_sw.getValue() == 0 or aoa == nil) { me["FPV"].hide(); - me.undimFixedAircraftOutline(); + me.dimFixedAircraftOutline(0); } else { - me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, (math.clamp(aoa, -9.9, 9.9)*FPV_Y_COEFFICIENT)/math.cos(math.abs(roll_cur)*D2R)); + var fpa_deg = pitch.getValue() - aoa; + var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; + me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); me["FPV"].show(); - me.dimFixedAircraftOutline(); + me.dimFixedAircraftOutline(1); } # ILS From 8c98c6da056b94234938308cdae500d899d7599d Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Mon, 7 Sep 2020 21:52:39 +1000 Subject: [PATCH 05/17] Convert FPV from a path, whcih didn't render well in FG, to a group --- Models/Instruments/PFD/res/pfd.svg | 50 +++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 92f8bc0d..8ea3ede6 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -8,7 +8,7 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:docname="pfd.svg" - inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + inkscape:version="1.0 (262b4497e3, 2020-09-04)" id="svg2" version="1.1" viewBox="0 0 1024 1024" @@ -39,15 +39,15 @@ showguides="true" inkscape:current-layer="svg2" inkscape:window-maximized="1" - inkscape:window-y="23" + inkscape:window-y="0" inkscape:window-x="0" - inkscape:cy="886.5494" - inkscape:cx="916.44902" - inkscape:zoom="2.1546825" + inkscape:cy="686.37792" + inkscape:cx="635.80596" + inkscape:zoom="4.309365" showgrid="true" id="namedview371" - inkscape:window-height="1035" - inkscape:window-width="1920" + inkscape:window-height="835" + inkscape:window-width="1600" inkscape:pageshadow="2" inkscape:pageopacity="1" guidetolerance="10" @@ -6658,9 +6658,35 @@ x="61.095329" y="74.429939" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:35.9995px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:0.657577">FLX - + + + + + + From 10dcd4dbeec210b3757db74a5f71229c06c60fbc Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Wed, 9 Sep 2020 09:16:20 +1000 Subject: [PATCH 06/17] Display FPV in red if ADIRIS still in alignment or not available --- Models/Instruments/PFD/PFD.nas | 45 ++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 17509d99..080343b4 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -149,7 +149,9 @@ var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); -#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); +# This always seems to return 0 if TRK FPA selected, which is incorrect. I don't know how/where this value is set. +# So I've commented it out and calculate it using the difference between magnetic track and heading. +#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE"); @@ -1057,11 +1059,12 @@ var canvas_PFD_base = { return nil; }, - # Returns Y translation value for FPV - accounting for angle of roll - # (On the PFD the FPA is perpendicular to the artificial horizon which is not always horizontal) + # Returns Y (vertical) translation value for FPV - accounting for angle of roll + # (On the PFD the FPA is perpendicular to the artificial horizon, which is not always horizontal.) getFPVYTranslation: func(track_x_translation, fpa_deg) { - var FPV_Y_COEFFICIENT = 12.5; # query if it should be 12.5 or 11.825 + var FPV_Y_COEFFICIENT = 12.5; # query if it should be 12.5 or 11.825 + var pitch_px = pitch.getValue() * FPV_Y_COEFFICIENT; var roll_rad = roll.getValue() * D2R; @@ -1145,14 +1148,20 @@ var canvas_PFD_1 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD1 - var aoa = me.getAOAForPFD1(); - if (ap_trk_sw.getValue() == 0 or aoa == nil) { + if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); } else { - var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; - var fpa_deg = pitch.getValue() - aoa; - me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); + var aoa = me.getAOAForPFD1(); + if (aoa == nil or (systems.ADIRS.ADIRunits[0].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == -1)){ + me["FPV"].setTranslation(0, 0); + me["FPV"].setColor(1, 0, 0); + } else { + var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; + var fpa_deg = pitch.getValue() - aoa; + me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); + me["FPV"].setColor(0.050980392, 0.752941176, 0.290196078); + } me["FPV"].show(); me.dimFixedAircraftOutline(1); } @@ -1897,14 +1906,20 @@ var canvas_PFD_2 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD2 - var aoa = me.getAOAForPFD2(); - if (ap_trk_sw.getValue() == 0 or aoa == nil) { - me["FPV"].hide(); + if (ap_trk_sw.getValue() == 0 ) { + me["FPV"].hide(); me.dimFixedAircraftOutline(0); } else { - var fpa_deg = pitch.getValue() - aoa; - var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; - me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); + var aoa = me.getAOAForPFD2(); + if (aoa == nil or (systems.ADIRS.ADIRunits[1].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == 1)) { + me["FPV"].setTranslation(0, 0); + me["FPV"].setColor(1, 0, 0); + } else { + var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; + var fpa_deg = pitch.getValue() - aoa; + me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); + me["FPV"].setColor(0.050980392, 0.752941176, 0.290196078); + } me["FPV"].show(); me.dimFixedAircraftOutline(1); } From 273d045b77fd7700e9c3077e539ffc25fc75fa26 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Wed, 9 Sep 2020 18:30:07 +1000 Subject: [PATCH 07/17] Fix appearance of FPV --- Models/Instruments/PFD/res/pfd.svg | 52 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 8ea3ede6..8e9dc0f0 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -8,7 +8,7 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:docname="pfd.svg" - inkscape:version="1.0 (262b4497e3, 2020-09-04)" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" id="svg2" version="1.1" viewBox="0 0 1024 1024" @@ -41,9 +41,9 @@ inkscape:window-maximized="1" inkscape:window-y="0" inkscape:window-x="0" - inkscape:cy="686.37792" - inkscape:cx="635.80596" - inkscape:zoom="4.309365" + inkscape:cy="681.99254" + inkscape:cx="587.65082" + inkscape:zoom="6.0943624" showgrid="true" id="namedview371" inkscape:window-height="835" @@ -6661,32 +6661,32 @@ - + width="40.045986" + height="3.0663724" + x="465.87289" + y="511.68826" /> + style="fill:none;fill-opacity:1;stroke:#11c04b;stroke-width:4.42405;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect2947" + width="40.045986" + height="3.0663724" + x="389.94388" + y="511.68826" /> + From 65c105ffb5bf54a39f486232a0832f494c66193f Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Wed, 9 Sep 2020 20:49:47 +1000 Subject: [PATCH 08/17] Refactor to reduce duplicate lines of code - move to helper function --- Models/Instruments/PFD/PFD.nas | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 080343b4..d15ba937 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -976,7 +976,7 @@ var canvas_PFD_base = { } track_diff = track.getValue() - heading.getValue(); - me["TRK_pointer"].setTranslation((math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416, 0); + me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0); split_ils = split("/", ils_data1.getValue()); if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) { @@ -1026,7 +1026,7 @@ var canvas_PFD_base = { me["AI_heading"].update(); }, - # dim the yellow outline of fixed aircraft symbol on PFDs + # Dim the yellow outline of fixed aircraft symbol on PFDs # eg when crew select TRK # 1 == dim # 0 == undim @@ -1076,6 +1076,12 @@ var canvas_PFD_base = { }, + # Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs + # And set max and minimum values + getTrackDiffPixels: func(track_diff_deg) { + return ((math.clamp(track_diff_deg, -23.62, 23.62) / 10) * 98.5416); + }, + }; @@ -1157,7 +1163,7 @@ var canvas_PFD_1 = { me["FPV"].setTranslation(0, 0); me["FPV"].setColor(1, 0, 0); } else { - var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; + var track_x_translation = me.getTrackDiffPixels(track_diff); var fpa_deg = pitch.getValue() - aoa; me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); me["FPV"].setColor(0.050980392, 0.752941176, 0.290196078); @@ -1915,7 +1921,7 @@ var canvas_PFD_2 = { me["FPV"].setTranslation(0, 0); me["FPV"].setColor(1, 0, 0); } else { - var track_x_translation = (math.clamp(track_diff, -23.62, 23.62) / 10) * 98.5416; + var track_x_translation = me.getTrackDiffPixels(track_diff); var fpa_deg = pitch.getValue() - aoa; me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); me["FPV"].setColor(0.050980392, 0.752941176, 0.290196078); From 497a274df5c7893cac4a489410745084fb88b396 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Wed, 9 Sep 2020 21:25:18 +1000 Subject: [PATCH 09/17] Hide FPV when ADIRS aligning or not available --- Models/Instruments/PFD/PFD.nas | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index d15ba937..21c8fef0 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1160,16 +1160,16 @@ var canvas_PFD_1 = { } else { var aoa = me.getAOAForPFD1(); if (aoa == nil or (systems.ADIRS.ADIRunits[0].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == -1)){ - me["FPV"].setTranslation(0, 0); - me["FPV"].setColor(1, 0, 0); + me["FPV"].hide(); + me.dimFixedAircraftOutline(0); } else { var track_x_translation = me.getTrackDiffPixels(track_diff); var fpa_deg = pitch.getValue() - aoa; me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); - me["FPV"].setColor(0.050980392, 0.752941176, 0.290196078); + me["FPV"].show(); + me.dimFixedAircraftOutline(1); } - me["FPV"].show(); - me.dimFixedAircraftOutline(1); + } # ILS @@ -1918,16 +1918,15 @@ var canvas_PFD_2 = { } else { var aoa = me.getAOAForPFD2(); if (aoa == nil or (systems.ADIRS.ADIRunits[1].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == 1)) { - me["FPV"].setTranslation(0, 0); - me["FPV"].setColor(1, 0, 0); + me["FPV"].hide(); + me.dimFixedAircraftOutline(0); } else { var track_x_translation = me.getTrackDiffPixels(track_diff); var fpa_deg = pitch.getValue() - aoa; me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); - me["FPV"].setColor(0.050980392, 0.752941176, 0.290196078); + me["FPV"].show(); + me.dimFixedAircraftOutline(1); } - me["FPV"].show(); - me.dimFixedAircraftOutline(1); } # ILS From 159dc953b537b0e7c8d626921eca76a942384bd0 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Thu, 10 Sep 2020 19:19:21 +1000 Subject: [PATCH 10/17] restrict FPV to between -9.9 and 9.9 degrees as per FCOM --- Models/Instruments/PFD/PFD.nas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 21c8fef0..0bd31e42 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1165,6 +1165,12 @@ var canvas_PFD_1 = { } else { var track_x_translation = me.getTrackDiffPixels(track_diff); var fpa_deg = pitch.getValue() - aoa; + if (fpa_deg > 9.9 or fpa_deg < -9.9) { + fpa_deg = math.clamp(fpa_deg, -9.9, 9.9); + me["FPV"].setColor(1, 0, 0); + } else { + me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); + } me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); me["FPV"].show(); me.dimFixedAircraftOutline(1); @@ -1923,6 +1929,12 @@ var canvas_PFD_2 = { } else { var track_x_translation = me.getTrackDiffPixels(track_diff); var fpa_deg = pitch.getValue() - aoa; + if (fpa_deg > 9.9 or fpa_deg < -9.9) { + fpa_deg = math.clamp(fpa_deg, -9.9, 9.9); + me["FPV"].setColor(1, 0, 0); + } else { + me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); + } me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); me["FPV"].show(); me.dimFixedAircraftOutline(1); From 3881bdd38171eba62c26477a87e87422b73d791e Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Wed, 16 Sep 2020 22:17:11 +1000 Subject: [PATCH 11/17] Change how position of FPV is calculated - copy from MD11 --- Models/Instruments/PFD/PFD.nas | 70 +++++++++++++++++------------- Models/Instruments/PFD/res/pfd.svg | 8 ++-- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 0bd31e42..ba7fa245 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -16,6 +16,7 @@ var elapsedtime = 0; var altTens = 0; var altPolarity = ""; var track_diff = 0; +var AICenter = nil; # FPV # Fetch nodes: var state1 = props.globals.getNode("/systems/thrust/state1", 1); @@ -137,7 +138,7 @@ var adr_1_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr var adr_2_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-2-fault", 1); var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-3-fault", 1); var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); - +var alpha = props.globals.getNode("/fdm/jsbsim/aero/alpha-deg", 1); # TODO - Is this used anywhere? # Create Nodes: var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); @@ -149,9 +150,7 @@ var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); -# This always seems to return 0 if TRK FPA selected, which is incorrect. I don't know how/where this value is set. -# So I've commented it out and calculate it using the difference between magnetic track and heading. -#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); +#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); # returns incorrect value and can calculate on the fly var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE"); @@ -214,6 +213,9 @@ var canvas_PFD_base = { me.AI_horizon_hdg_trans = me["AI_heading"].createTransform(); me.AI_horizon_hdg_rot = me["AI_heading"].createTransform(); + me.AI_fpv_trans = me["FPV"].createTransform(); + me.AI_fpv_rot = me["FPV"].createTransform(); + me.page = canvas_group; return me; @@ -1026,8 +1028,7 @@ var canvas_PFD_base = { me["AI_heading"].update(); }, - # Dim the yellow outline of fixed aircraft symbol on PFDs - # eg when crew select TRK + # Dim the yellow outline of fixed aircraft symbol on PFDs (eg when crew select TRK) # 1 == dim # 0 == undim dimFixedAircraftOutline: func(dim_bool) { @@ -1059,23 +1060,6 @@ var canvas_PFD_base = { return nil; }, - # Returns Y (vertical) translation value for FPV - accounting for angle of roll - # (On the PFD the FPA is perpendicular to the artificial horizon, which is not always horizontal.) - getFPVYTranslation: func(track_x_translation, fpa_deg) { - - var FPV_Y_COEFFICIENT = 12.5; # query if it should be 12.5 or 11.825 - - var pitch_px = pitch.getValue() * FPV_Y_COEFFICIENT; - var roll_rad = roll.getValue() * D2R; - - var pitch_y_translation = math.tan(roll_rad) * (( pitch_px/math.sin(roll_rad)) + track_x_translation); - - var fpa_y_translation = (fpa_deg * FPV_Y_COEFFICIENT)/math.cos(roll_rad); - - return pitch_y_translation + ((-1) * fpa_y_translation); - - }, - # Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs # And set max and minimum values getTrackDiffPixels: func(track_diff_deg) { @@ -1154,6 +1138,7 @@ var canvas_PFD_1 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD1 + # Display FPV in red and freeze if FPA outside the range of -9.9 degrees or 9.9 degrees if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); @@ -1163,15 +1148,26 @@ var canvas_PFD_1 = { me["FPV"].hide(); me.dimFixedAircraftOutline(0); } else { + var roll_deg = roll.getValue() or 0; + var alpha_deg = aoa; + var fpa_deg = pitch.getValue() - alpha_deg; + + AICenter = me["AI_center"].getCenter(); var track_x_translation = me.getTrackDiffPixels(track_diff); - var fpa_deg = pitch.getValue() - aoa; - if (fpa_deg > 9.9 or fpa_deg < -9.9) { - fpa_deg = math.clamp(fpa_deg, -9.9, 9.9); + + if (fpa_deg > 9.9) { + alpha_deg = alpha_deg + (fpa_deg - 9.9); + me["FPV"].setColor(1, 0, 0); + } else if (fpa_deg < -9.9) { + alpha_deg = alpha_deg + (fpa_deg + 9.9); me["FPV"].setColor(1, 0, 0); } else { me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); } - me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); + + me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(alpha_deg, -20, 20) * 12.5); + me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); + me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); me.dimFixedAircraftOutline(1); } @@ -1918,6 +1914,7 @@ var canvas_PFD_2 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD2 + # Display FPV in red and freeze if FPA outside the range of -9.9 degrees or 9.9 degrees if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); @@ -1927,15 +1924,26 @@ var canvas_PFD_2 = { me["FPV"].hide(); me.dimFixedAircraftOutline(0); } else { + var roll_deg = roll.getValue() or 0; + var alpha_deg = aoa; + var fpa_deg = pitch.getValue() - alpha_deg; + + AICenter = me["AI_center"].getCenter(); var track_x_translation = me.getTrackDiffPixels(track_diff); - var fpa_deg = pitch.getValue() - aoa; - if (fpa_deg > 9.9 or fpa_deg < -9.9) { - fpa_deg = math.clamp(fpa_deg, -9.9, 9.9); + + if (fpa_deg > 9.9) { + alpha_deg = alpha_deg + (fpa_deg - 9.9); + me["FPV"].setColor(1, 0, 0); + } else if (fpa_deg < -9.9) { + alpha_deg = alpha_deg + (fpa_deg + 9.9); me["FPV"].setColor(1, 0, 0); } else { me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); } - me["FPV"].setTranslation(track_x_translation, me.getFPVYTranslation(track_x_translation, fpa_deg)); + + me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(alpha_deg, -20, 20) * 12.5); + me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); + me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); me.dimFixedAircraftOutline(1); } diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 8e9dc0f0..99184f61 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -46,8 +46,8 @@ inkscape:zoom="6.0943624" showgrid="true" id="namedview371" - inkscape:window-height="835" - inkscape:window-width="1600" + inkscape:window-height="1015" + inkscape:window-width="1920" inkscape:pageshadow="2" inkscape:pageopacity="1" guidetolerance="10" @@ -6659,7 +6659,9 @@ y="74.429939" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:35.9995px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:0.657577">FLX + id="FPV" + style="stroke:#11c04b;stroke-opacity:1" + transform="translate(0.03412367,-0.04316723)"> Date: Wed, 16 Sep 2020 22:35:44 +1000 Subject: [PATCH 12/17] Disable code that displays FPV in red if it is outside the range of negative to positive 9.9 degrees --- Models/Instruments/PFD/PFD.nas | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index ba7fa245..b0ed7d4e 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1138,7 +1138,6 @@ var canvas_PFD_1 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD1 - # Display FPV in red and freeze if FPA outside the range of -9.9 degrees or 9.9 degrees if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); @@ -1155,15 +1154,16 @@ var canvas_PFD_1 = { AICenter = me["AI_center"].getCenter(); var track_x_translation = me.getTrackDiffPixels(track_diff); - if (fpa_deg > 9.9) { - alpha_deg = alpha_deg + (fpa_deg - 9.9); - me["FPV"].setColor(1, 0, 0); - } else if (fpa_deg < -9.9) { - alpha_deg = alpha_deg + (fpa_deg + 9.9); - me["FPV"].setColor(1, 0, 0); - } else { - me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); - } + # Display FPV in red if FPA greater or less plus or minus 9.9 degrees + # if (fpa_deg > 9.9) { + # alpha_deg = alpha_deg + (fpa_deg - 9.9); + # me["FPV"].setColor(1, 0, 0); + # } else if (fpa_deg < -9.9) { + # alpha_deg = alpha_deg + (fpa_deg + 9.9); + # me["FPV"].setColor(1, 0, 0); + # } else { + # me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); + # } me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(alpha_deg, -20, 20) * 12.5); me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); @@ -1914,7 +1914,6 @@ var canvas_PFD_2 = { # FPV # If TRK FPA selected on the FCU, display FPV on PFD2 - # Display FPV in red and freeze if FPA outside the range of -9.9 degrees or 9.9 degrees if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); @@ -1931,15 +1930,16 @@ var canvas_PFD_2 = { AICenter = me["AI_center"].getCenter(); var track_x_translation = me.getTrackDiffPixels(track_diff); - if (fpa_deg > 9.9) { - alpha_deg = alpha_deg + (fpa_deg - 9.9); - me["FPV"].setColor(1, 0, 0); - } else if (fpa_deg < -9.9) { - alpha_deg = alpha_deg + (fpa_deg + 9.9); - me["FPV"].setColor(1, 0, 0); - } else { - me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); - } + # Display FPV in red if FPA greater or less plus or minus 9.9 degrees + # if (fpa_deg > 9.9) { + # alpha_deg = alpha_deg + (fpa_deg - 9.9); + # me["FPV"].setColor(1, 0, 0); + # } else if (fpa_deg < -9.9) { + # alpha_deg = alpha_deg + (fpa_deg + 9.9); + # me["FPV"].setColor(1, 0, 0); + # } else { + # me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); + # } me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(alpha_deg, -20, 20) * 12.5); me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); From b91ebcbb545e0d489a3a558c62835c14a8be6cb1 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Thu, 17 Sep 2020 21:12:04 +1000 Subject: [PATCH 13/17] NOrmalise track_diff to avoid issues when turning through North --- Models/Instruments/PFD/PFD.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index b0ed7d4e..7e57fc3c 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -977,7 +977,7 @@ var canvas_PFD_base = { me["HDG_target"].hide(); } - track_diff = track.getValue() - heading.getValue(); + track_diff = geo.normdeg180(track.getValue() - heading.getValue()); me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0); split_ils = split("/", ils_data1.getValue()); From cfea513ace2b265e5730fa03e74f5fc0d25de03e Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Fri, 18 Sep 2020 18:02:09 +1000 Subject: [PATCH 14/17] Minor refactor of FPV code - remove unused variables. --- Models/Instruments/PFD/PFD.nas | 47 ++++++---------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 7e57fc3c..06b6d2c9 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -16,7 +16,7 @@ var elapsedtime = 0; var altTens = 0; var altPolarity = ""; var track_diff = 0; -var AICenter = nil; # FPV +var AICenter = nil; # Fetch nodes: var state1 = props.globals.getNode("/systems/thrust/state1", 1); @@ -138,7 +138,6 @@ var adr_1_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr var adr_2_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-2-fault", 1); var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-3-fault", 1); var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); -var alpha = props.globals.getNode("/fdm/jsbsim/aero/alpha-deg", 1); # TODO - Is this used anywhere? # Create Nodes: var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); @@ -150,7 +149,7 @@ var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); -#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); # returns incorrect value and can calculate on the fly +#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); # returns incorrect value var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE"); @@ -1028,7 +1027,7 @@ var canvas_PFD_base = { me["AI_heading"].update(); }, - # Dim the yellow outline of fixed aircraft symbol on PFDs (eg when crew select TRK) + # Dim the yellow outline of fixed aircraft symbol on PFDs (when crew select TRK-FPA) # 1 == dim # 0 == undim dimFixedAircraftOutline: func(dim_bool) { @@ -1136,8 +1135,7 @@ var canvas_PFD_1 = { me["FD_pitch"].hide(); } - # FPV - # If TRK FPA selected on the FCU, display FPV on PFD1 + # If TRK FPA selected, display FPV on PFD1 if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); @@ -1148,24 +1146,10 @@ var canvas_PFD_1 = { me.dimFixedAircraftOutline(0); } else { var roll_deg = roll.getValue() or 0; - var alpha_deg = aoa; - var fpa_deg = pitch.getValue() - alpha_deg; - AICenter = me["AI_center"].getCenter(); var track_x_translation = me.getTrackDiffPixels(track_diff); - # Display FPV in red if FPA greater or less plus or minus 9.9 degrees - # if (fpa_deg > 9.9) { - # alpha_deg = alpha_deg + (fpa_deg - 9.9); - # me["FPV"].setColor(1, 0, 0); - # } else if (fpa_deg < -9.9) { - # alpha_deg = alpha_deg + (fpa_deg + 9.9); - # me["FPV"].setColor(1, 0, 0); - # } else { - # me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); - # } - - me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(alpha_deg, -20, 20) * 12.5); + me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(aoa, -20, 20) * 12.5); me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); @@ -1912,8 +1896,7 @@ var canvas_PFD_2 = { me["FD_pitch"].hide(); } - # FPV - # If TRK FPA selected on the FCU, display FPV on PFD2 + # If TRK FPA selected, display FPV on PFD2 if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); me.dimFixedAircraftOutline(0); @@ -1923,25 +1906,11 @@ var canvas_PFD_2 = { me["FPV"].hide(); me.dimFixedAircraftOutline(0); } else { - var roll_deg = roll.getValue() or 0; - var alpha_deg = aoa; - var fpa_deg = pitch.getValue() - alpha_deg; - + var roll_deg = roll.getValue() or 0; AICenter = me["AI_center"].getCenter(); var track_x_translation = me.getTrackDiffPixels(track_diff); - # Display FPV in red if FPA greater or less plus or minus 9.9 degrees - # if (fpa_deg > 9.9) { - # alpha_deg = alpha_deg + (fpa_deg - 9.9); - # me["FPV"].setColor(1, 0, 0); - # } else if (fpa_deg < -9.9) { - # alpha_deg = alpha_deg + (fpa_deg + 9.9); - # me["FPV"].setColor(1, 0, 0); - # } else { - # me["FPV"].setColor(0.066666667, 0.752941176, 0.294117647); - # } - - me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(alpha_deg, -20, 20) * 12.5); + me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(aoa, -20, 20) * 12.5); me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); From c3f88010d62034b9d6ba6052bcdfa1c98c8512fe Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Sun, 20 Sep 2020 09:16:16 +1000 Subject: [PATCH 15/17] Remove feature to dim fixed aircraft outline on PFD in TRK mode --- Models/Instruments/PFD/PFD.nas | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 06b6d2c9..21bb6993 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1026,24 +1026,6 @@ var canvas_PFD_base = { me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); me["AI_heading"].update(); }, - - # Dim the yellow outline of fixed aircraft symbol on PFDs (when crew select TRK-FPA) - # 1 == dim - # 0 == undim - dimFixedAircraftOutline: func(dim_bool) { - var r = 0.345098039; - var g = 0.349019608; - var b = 0.058823529; - - if (dim_bool == 0) { - r = 0.788235294; - g = 0.819607843; - b = 0.129411765; - } - - me["fixed_aircraft_outline_1"].setColor(r, g, b); - me["fixed_aircraft_outline_2"].setColor(r, g, b); - }, # Get Angle of Attack from ADR1 or, depending on Switching panel, ADR3 getAOAForPFD1: func() { @@ -1138,12 +1120,10 @@ var canvas_PFD_1 = { # If TRK FPA selected, display FPV on PFD1 if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); - me.dimFixedAircraftOutline(0); } else { var aoa = me.getAOAForPFD1(); if (aoa == nil or (systems.ADIRS.ADIRunits[0].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == -1)){ me["FPV"].hide(); - me.dimFixedAircraftOutline(0); } else { var roll_deg = roll.getValue() or 0; AICenter = me["AI_center"].getCenter(); @@ -1153,7 +1133,6 @@ var canvas_PFD_1 = { me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); - me.dimFixedAircraftOutline(1); } } @@ -1899,12 +1878,10 @@ var canvas_PFD_2 = { # If TRK FPA selected, display FPV on PFD2 if (ap_trk_sw.getValue() == 0 ) { me["FPV"].hide(); - me.dimFixedAircraftOutline(0); } else { var aoa = me.getAOAForPFD2(); if (aoa == nil or (systems.ADIRS.ADIRunits[1].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == 1)) { me["FPV"].hide(); - me.dimFixedAircraftOutline(0); } else { var roll_deg = roll.getValue() or 0; AICenter = me["AI_center"].getCenter(); @@ -1914,7 +1891,6 @@ var canvas_PFD_2 = { me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); - me.dimFixedAircraftOutline(1); } } From 7cf787ce567d5a1de71c742fd7802f4baa014500 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Sun, 20 Sep 2020 09:36:31 +1000 Subject: [PATCH 16/17] Replace FPV with one from MD-11 --- Models/Instruments/PFD/res/pfd.svg | 58 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 99184f61..605b6997 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -46,8 +46,8 @@ inkscape:zoom="6.0943624" showgrid="true" id="namedview371" - inkscape:window-height="1015" - inkscape:window-width="1920" + inkscape:window-height="835" + inkscape:window-width="1600" inkscape:pageshadow="2" inkscape:pageopacity="1" guidetolerance="10" @@ -6660,35 +6660,35 @@ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:35.9995px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:0.657577">FLX - + inkscape:label="#g4866" + transform="translate(4.3177635,10.931087)"> + transform="rotate(90)" + style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:4.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4864" + width="12.8" + height="4.7999878" + x="471.06799" + y="-446.19958" /> + + y="499.80042" + x="412.66745" + height="4.7999878" + width="12.8" + id="rect4860" + style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:4.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:4.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4862" + width="12.8" + height="4.7999878" + x="462.13199" + y="499.80042" /> From c956c71f411fefc01c92d687585d30fb558fd713 Mon Sep 17 00:00:00 2001 From: sgilchrist123 Date: Sun, 20 Sep 2020 16:31:41 +1000 Subject: [PATCH 17/17] Get value from prop tree only once instead of twice --- Models/Instruments/PFD/PFD.nas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 21bb6993..287dd968 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -976,13 +976,15 @@ var canvas_PFD_base = { me["HDG_target"].hide(); } - track_diff = geo.normdeg180(track.getValue() - heading.getValue()); + + var heading_deg = heading.getValue(); + track_diff = geo.normdeg180(track.getValue() - heading_deg); me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0); split_ils = split("/", ils_data1.getValue()); if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) { magnetic_hdg = ils_crs.getValue(); - magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue()); + magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading_deg); if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) { me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0); me["ILS_HDG_R"].hide();