From 5eab8c7362fded7724132c507a250a8e46fdea87 Mon Sep 17 00:00:00 2001 From: hayden2000 Date: Tue, 7 Jan 2020 19:12:13 -0500 Subject: [PATCH 1/9] Add ILS warning on pfd --- Models/Instruments/PFD/PFD.nas | 16 +++++++++++++++- Models/Instruments/PFD/res/pfd.svg | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 44c79462..079be9be 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -110,6 +110,8 @@ var aileron_input = props.globals.getNode("/controls/flight/aileron-input-fast", var elevator_input = props.globals.getNode("/controls/flight/elevator-input-fast", 1); var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 1); +var appr_enabled = props.globals.getNode("/it-autoflight/output/appr-armed/", 1); +var loc_enabled = props.globals.getNode("/it-autoflight/output/loc-armed/", 1); # Create Nodes: var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); @@ -187,7 +189,7 @@ var canvas_PFD_base = { "AI_bank_lim","AI_bank_lim_X","AI_pitch_lim","AI_pitch_lim_X","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading","AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","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"]; + "TRK_pointer","machError","ilsError"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -845,6 +847,12 @@ var canvas_PFD_1 = { me["GS_pointer"].hide(); } + if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { + me["ilsError"].show(); + } else { + me["ilsError"].hide(); + } + me.updateCommon(); }, updateFast: func() { @@ -1134,6 +1142,12 @@ var canvas_PFD_2 = { me["GS_pointer"].hide(); } + if (ap_ils_mode2.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { + me["ilsError"].show(); + } else { + me["ilsError"].hide(); + } + me.updateCommon(); }, updateFast: func() { diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index b334de65..967b6961 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -4875,4 +4875,17 @@ x="34.684372" y="874.4469" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:48px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#ff0000;fill-opacity:1;stroke-width:0.75">MACH + + ILS From 9f721db682197b6d3b25db18d206e25eab1a3549 Mon Sep 17 00:00:00 2001 From: hayden2000 Date: Wed, 8 Jan 2020 08:08:26 -0500 Subject: [PATCH 2/9] Add ILS data to PFD --- Models/Instruments/PFD/PFD.nas | 15 ++++++++++++++- Models/Instruments/PFD/res/pfd.svg | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 079be9be..386cb7f0 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -112,6 +112,7 @@ var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 1); var appr_enabled = props.globals.getNode("/it-autoflight/output/appr-armed/", 1); var loc_enabled = props.globals.getNode("/it-autoflight/output/loc-armed/", 1); +var ils_data = props.globals.getNode("/FMGC/internal/ils1-mcdu/", 1); # Create Nodes: var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); @@ -189,7 +190,7 @@ var canvas_PFD_base = { "AI_bank_lim","AI_bank_lim_X","AI_pitch_lim","AI_pitch_lim_X","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading","AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","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"]; + "TRK_pointer","machError","ilsError","ils_code","ils_freq"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -831,9 +832,15 @@ var canvas_PFD_1 = { if (ap_ils_mode.getValue() == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); + me["ils_code"].setText(split("/", ils_data.getValue())[0]); + me["ils_freq"].setText(split("/", ils_data.getValue())[1]); + me["ils_code"].show(); + me["ils_freq"].show(); } else { me["LOC_scale"].hide(); me["GS_scale"].hide(); + me["ils_code"].hide(); + me["ils_freq"].hide(); } if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { @@ -1126,9 +1133,15 @@ var canvas_PFD_2 = { if (ap_ils_mode2.getValue() == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); + me["ils_code"].setText(ils_v[0].getValue()); + me["ils_freq"].setText(ils_v[1].getValue()); + me["ils_code"].show(); + me["ils_freq"].show(); } else { me["LOC_scale"].hide(); me["GS_scale"].hide(); + me["ils_code"].hide(); + me["ils_freq"].hide(); } if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 967b6961..92fdffed 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -4888,4 +4888,28 @@ x="683" y="809" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:48px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#ff9900;fill-opacity:1;stroke-width:0.75">ILS + + ILS + + ILS From b386c0d14d237523af9de3387d267344ab9d49d7 Mon Sep 17 00:00:00 2001 From: hayden2000 Date: Wed, 8 Jan 2020 14:07:05 -0500 Subject: [PATCH 3/9] Bug fixes for MCDU2 --- Models/Instruments/PFD/PFD.nas | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 386cb7f0..91c84aad 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -112,7 +112,9 @@ var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 1); var appr_enabled = props.globals.getNode("/it-autoflight/output/appr-armed/", 1); var loc_enabled = props.globals.getNode("/it-autoflight/output/loc-armed/", 1); -var ils_data = props.globals.getNode("/FMGC/internal/ils1-mcdu/", 1); +var ils_data1 = props.globals.getNode("/FMGC/internal/ils1-mcdu/", 1); +# Independent MCDU ILS not implemented yet, use MCDU1 in the meantime +# var ils_data2 = props.globals.getNode("/FMGC/internal/ils2-mcdu/", 1); # Create Nodes: var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); @@ -832,8 +834,8 @@ var canvas_PFD_1 = { if (ap_ils_mode.getValue() == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); - me["ils_code"].setText(split("/", ils_data.getValue())[0]); - me["ils_freq"].setText(split("/", ils_data.getValue())[1]); + me["ils_code"].setText(split("/", ils_data1.getValue())[0]); + me["ils_freq"].setText(split("/", ils_data1.getValue())[1]); me["ils_code"].show(); me["ils_freq"].show(); } else { @@ -1133,8 +1135,9 @@ var canvas_PFD_2 = { if (ap_ils_mode2.getValue() == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); - me["ils_code"].setText(ils_v[0].getValue()); - me["ils_freq"].setText(ils_v[1].getValue()); + # Independent MCDU ILS not implemented yet, use MCDU1 in the meantime + me["ils_code"].setText(split("/", ils_data1.getValue())[0]); + me["ils_freq"].setText(split("/", ils_data1.getValue())[1]); me["ils_code"].show(); me["ils_freq"].show(); } else { From cc47730a380c880549957754ec61e9f93dee7eeb Mon Sep 17 00:00:00 2001 From: hayden2000 Date: Wed, 15 Jan 2020 18:13:41 -0500 Subject: [PATCH 4/9] Fix text coordinates --- Models/Instruments/PFD/PFD.nas | 2 +- Models/Instruments/PFD/res/pfd.svg | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 91c84aad..90e945aa 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -857,7 +857,7 @@ var canvas_PFD_1 = { } if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { - me["ilsError"].show(); + me["ilsError"].show(); } else { me["ilsError"].hide(); } diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 92fdffed..be55d9ae 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -4879,14 +4879,14 @@ ILS Date: Wed, 15 Jan 2020 18:41:48 -0500 Subject: [PATCH 5/9] ILS message after loc/appr established --- 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 90e945aa..0d70c66f 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -856,7 +856,7 @@ var canvas_PFD_1 = { me["GS_pointer"].hide(); } - if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { + if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1 or gs_in_range.getValue() == 1)) { me["ilsError"].show(); } else { me["ilsError"].hide(); From db07cb2ad230b046319e5ae4a5651eff54bf7008 Mon Sep 17 00:00:00 2001 From: hayden2000 Date: Wed, 15 Jan 2020 19:34:31 -0500 Subject: [PATCH 6/9] Add DME distance --- Models/Instruments/PFD/PFD.nas | 19 ++++++++++++++++--- Models/Instruments/PFD/res/pfd.svg | 13 +++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 0d70c66f..6cbe4867 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -115,6 +115,8 @@ var loc_enabled = props.globals.getNode("/it-autoflight/output/loc-armed/", 1); var ils_data1 = props.globals.getNode("/FMGC/internal/ils1-mcdu/", 1); # Independent MCDU ILS not implemented yet, use MCDU1 in the meantime # var ils_data2 = props.globals.getNode("/FMGC/internal/ils2-mcdu/", 1); +var dme_in_range = props.globals.getNode("/instrumentation/nav[0]/dme-in-range", 1); +var dme_data = props.globals.getNode("/instrumentation/dme[0]/indicated-distance-nm", 1); # Create Nodes: var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); @@ -192,7 +194,7 @@ var canvas_PFD_base = { "AI_bank_lim","AI_bank_lim_X","AI_pitch_lim","AI_pitch_lim_X","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading","AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","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"]; + "TRK_pointer","machError","ilsError","ils_code","ils_freq","dme_dist"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -838,11 +840,17 @@ var canvas_PFD_1 = { me["ils_freq"].setText(split("/", ils_data1.getValue())[1]); me["ils_code"].show(); me["ils_freq"].show(); + if (dme_in_range.getValue() == 1) { + me["dme_dist"].setText(int(dme_data.getValue()) ~ "NM"); + me["dme_dist"].show(); + + } } else { me["LOC_scale"].hide(); me["GS_scale"].hide(); me["ils_code"].hide(); me["ils_freq"].hide(); + me["dme_dist"].hide(); } if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { @@ -856,7 +864,7 @@ var canvas_PFD_1 = { me["GS_pointer"].hide(); } - if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1 or gs_in_range.getValue() == 1)) { + if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { me["ilsError"].show(); } else { me["ilsError"].hide(); @@ -1140,11 +1148,16 @@ var canvas_PFD_2 = { me["ils_freq"].setText(split("/", ils_data1.getValue())[1]); me["ils_code"].show(); me["ils_freq"].show(); + if (dme_in_range.getValue() == 1) { + me["dme_dist"].setText(int(dme_data.getValue()) ~ "NM"); + me["dme_dist"].show(); + } } else { me["LOC_scale"].hide(); me["GS_scale"].hide(); me["ils_code"].hide(); me["ils_freq"].hide(); + me["dme_dist"].hide(); } if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { @@ -1159,7 +1172,7 @@ var canvas_PFD_2 = { } if (ap_ils_mode2.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { - me["ilsError"].show(); + me["ilsError"].show(); } else { me["ilsError"].hide(); } diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index be55d9ae..190c4042 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -4912,4 +4912,17 @@ x="34.684372" y="930.26117" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:38.39944839px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#b055be;fill-opacity:1;stroke-width:0.75">ILS + + ILS + From 8039f7ef66d7378621588baa999782dda51fc4cc Mon Sep 17 00:00:00 2001 From: hayden2000 Date: Wed, 15 Jan 2020 19:43:50 -0500 Subject: [PATCH 7/9] Shift down ILS message to not conflict with mach when displayed --- Models/Instruments/PFD/res/pfd.svg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 190c4042..7c7c5e1c 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -4898,7 +4898,7 @@ sodipodi:role="line" id="tspan978" x="34.684372" - y="885.26117" + y="920.26117" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:38.39944839px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#b055be;fill-opacity:1;stroke-width:0.75">ILS ILS ILS From 303a92c9a28d8f6dca03ea1590e751fb078787e4 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 17 Jan 2020 17:50:38 +0000 Subject: [PATCH 8/9] Adjust position, fix formatting, fix colour --- Models/Instruments/PFD/PFD.nas | 37 ++++++++------- Models/Instruments/PFD/res/pfd.svg | 73 ++++++++++++++++-------------- 2 files changed, 60 insertions(+), 50 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 6cbe4867..e42d14e4 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -56,7 +56,7 @@ var lvr_clb = props.globals.getNode("/systems/thrust/lvrclb", 1); var throt_box = props.globals.getNode("/modes/pfd/fma/throttle-mode-box", 1); var pitch_box = props.globals.getNode("/modes/pfd/fma/pitch-mode-box", 1); var ap_box = props.globals.getNode("/modes/pfd/fma/ap-mode-box", 1); -var fd_box = props.globals.getNode("/modes/pfd/fma/fd-mode-box", 1); +var fd_box = props.globals.getNode("/modes/pfd/fma/fd-mode-box", 1); var at_box = props.globals.getNode("/modes/pfd/fma/athr-mode-box", 1); var fbw_law = props.globals.getNode("/it-fbw/law", 1); var ap_mode = props.globals.getNode("/modes/pfd/fma/ap-mode", 1); @@ -166,7 +166,7 @@ var canvas_PFD_base = { tran_rect[2], # 1 xe tran_rect[3], # 2 ye tran_rect[0]); #3 xs - # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx + # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx me[key].set("clip", clip_rect); me[key].set("clip-frame", canvas.Element.PARENT); } @@ -194,7 +194,7 @@ var canvas_PFD_base = { "AI_bank_lim","AI_bank_lim_X","AI_pitch_lim","AI_pitch_lim_X","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading","AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","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"]; + "TRK_pointer","machError","ilsError","ils_code","ils_freq","dme_dist","dme_dist_legend"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -356,7 +356,7 @@ var canvas_PFD_base = { me["FMA_man_box"].hide(); me["FMA_flx_box"].show(); me["FMA_flxtemp"].show(); - me["FMA_manmode"].setText("FLX "); + me["FMA_manmode"].setText("FLX "); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); } else if ((state1_act == "MAN THR" and thr1_act < 0.83) or (state2_act == "MAN THR" and thr2_act < 0.83)) { me["FMA_flx_box"].hide(); @@ -386,7 +386,7 @@ var canvas_PFD_base = { me["FMA_man_box"].hide(); me["FMA_flx_box"].show(); me["FMA_flxtemp"].show(); - me["FMA_manmode"].setText("FLX "); + me["FMA_manmode"].setText("FLX "); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); } } else { @@ -619,7 +619,7 @@ var canvas_PFD_base = { updateCommonFast: func() { # Attitude Indicator pitch_cur = pitch.getValue(); - roll_cur = roll.getValue(); + roll_cur = roll.getValue(); me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); @@ -841,16 +841,17 @@ var canvas_PFD_1 = { me["ils_code"].show(); me["ils_freq"].show(); if (dme_in_range.getValue() == 1) { - me["dme_dist"].setText(int(dme_data.getValue()) ~ "NM"); - me["dme_dist"].show(); - - } + me["dme_dist"].setText(sprintf("%2.0f", int(dme_data.getValue()))); + me["dme_dist"].show(); + me["dme_dist_legend"].show(); + } } else { me["LOC_scale"].hide(); me["GS_scale"].hide(); me["ils_code"].hide(); me["ils_freq"].hide(); me["dme_dist"].hide(); + me["dme_dist_legend"].hide(); } if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { @@ -865,9 +866,9 @@ var canvas_PFD_1 = { } if (ap_ils_mode.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { - me["ilsError"].show(); + me["ilsError"].show(); } else { - me["ilsError"].hide(); + me["ilsError"].hide(); } me.updateCommon(); @@ -1149,15 +1150,17 @@ var canvas_PFD_2 = { me["ils_code"].show(); me["ils_freq"].show(); if (dme_in_range.getValue() == 1) { - me["dme_dist"].setText(int(dme_data.getValue()) ~ "NM"); - me["dme_dist"].show(); - } + me["dme_dist"].setText(sprintf("%2.0f", int(dme_data.getValue()))); + me["dme_dist"].show(); + me["dme_dist_legend"].show(); + } } else { me["LOC_scale"].hide(); me["GS_scale"].hide(); me["ils_code"].hide(); me["ils_freq"].hide(); me["dme_dist"].hide(); + me["dme_dist_legend"].hide(); } if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { @@ -1172,9 +1175,9 @@ var canvas_PFD_2 = { } if (ap_ils_mode2.getValue() == 0 and (appr_enabled.getValue() == 1 or loc_enabled.getValue() == 1)) { - me["ilsError"].show(); + me["ilsError"].show(); } else { - me["ilsError"].hide(); + me["ilsError"].hide(); } me.updateCommon(); diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 7c7c5e1c..38bb35d6 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -37,16 +37,16 @@ guidetolerance="10" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="705" + inkscape:window-width="716" + inkscape:window-height="403" id="namedview371" - showgrid="false" - inkscape:zoom="2.0149341" - inkscape:cx="51.385843" - inkscape:cy="279.39354" + showgrid="true" + inkscape:zoom="1.025" + inkscape:cx="678.88837" + inkscape:cy="332.98605" inkscape:window-x="-8" - inkscape:window-y="-8" - inkscape:window-maximized="1" + inkscape:window-y="0" + inkscape:window-maximized="0" inkscape:current-layer="svg2" showguides="true" inkscape:snap-global="false" @@ -4875,54 +4875,61 @@ x="34.684372" y="874.4469" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:48px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#ff0000;fill-opacity:1;stroke-width:0.75">MACH - ILS - + id="tspan773" + x="667.37634" + y="855.60309" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#bb6100;fill-opacity:1;stroke-width:0.75;">ILS ILS - + y="935.95209" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:38.98999884px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#b055be;fill-opacity:1;stroke-width:0.75;">ILS ILS - + y="974.72784" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:38.98999884px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#b055be;fill-opacity:1;stroke-width:0.75;">000.00 ILS - + y="1013.5292" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:38.98999884px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#b055be;fill-opacity:1;stroke-width:0.75;">0.0 + NM From c40c32433a972e56b94a5630d007f75efe5ce91f Mon Sep 17 00:00:00 2001 From: vezza Date: Mon, 27 Jan 2020 19:01:33 +0100 Subject: [PATCH 9/9] Brakes temp improvements --- Nasal/Systems/brakesystem.nas | 273 +++++++++++++++++++++++++--------- 1 file changed, 201 insertions(+), 72 deletions(-) diff --git a/Nasal/Systems/brakesystem.nas b/Nasal/Systems/brakesystem.nas index 951fff26..79c099b0 100755 --- a/Nasal/Systems/brakesystem.nas +++ b/Nasal/Systems/brakesystem.nas @@ -24,7 +24,11 @@ # "overheated brakes", any level <=1 means "brake temperature OK". # No exact science here - but good enough for now :-). ########################################################################## - +# +# Added brakes temp calculations and adapted for A320-family +# 2020, Andrea Vezzali +# +########################################################################## var BrakeSystem = { new : func() @@ -33,14 +37,14 @@ var BrakeSystem = # deceleration caused by brakes alone (knots/s2) m.BrakeDecel = 1.0; # kt/s^2 # Higher value means quicker cooling - m.CoolingFactor = 0.0005; + m.CoolingFactor = 0.00005; # Scaling divisor. Use this to scale the energy output. # Manually tune this value: a total energy output # at "/gear/brake-thermal-energy" > 1.0 means overheated brakes, # anything below <= 1.0 means energy absorbed by brakes is OK. #m.ScalingDivisor= 700000*450.0; - m.ScalingDivisor = 0.000000007; + m.ScalingDivisor = 0.000000006; m.LSmokeActive = 0; m.LSmokeToggle = 0; @@ -56,33 +60,35 @@ var BrakeSystem = reset : func() { # Initial thermal energy - setprop("controls/gear/brake-fans",0); setprop("gear/gear[1]/Lbrake-thermal-energy",0.0); setprop("gear/gear[2]/Rbrake-thermal-energy",0.0); + + setprop("controls/gear/brake-fans",0); setprop("gear/gear[1]/Lbrake-smoke",0); setprop("gear/gear[2]/Rbrake-smoke",0); - setprop("gear/gear[1]/L1brake-temp-degc",getprop("environment/temperature-degc")); - setprop("gear/gear[1]/L2brake-temp-degc",getprop("environment/temperature-degc")); - setprop("gear/gear[2]/R3brake-temp-degc",getprop("environment/temperature-degc")); - setprop("gear/gear[2]/R4brake-temp-degc",getprop("environment/temperature-degc")); - setprop("gear/gear[1]/L1brake-temp-degf",getprop("environment/temperature-degf")); - setprop("gear/gear[1]/L2brake-temp-degf",getprop("environment/temperature-degf")); - setprop("gear/gear[2]/R3brake-temp-degf",getprop("environment/temperature-degf")); - setprop("gear/gear[2]/R4brake-temp-degf",getprop("environment/temperature-degf")); - - #Introducing a random error on the brakes temp sensors - if (rand() > 0.5) - { - setprop("gear/gear[1]/L1error_temp_degc", math.round(rand()*5)); - setprop("gear/gear[1]/L2error_temp_degc", math.round(rand()*5)); - setprop("gear/gear[2]/R3error_temp_degc", math.round(rand()*5)); - setprop("gear/gear[2]/R4error_temp_degc", math.round(rand()*5)); - } else { - setprop("gear/gear[1]/L1error_temp_degc", math.round(rand()*(-5))); - setprop("gear/gear[1]/L2error_temp_degc", math.round(rand()*(-5))); - setprop("gear/gear[2]/R3error_temp_degc", math.round(rand()*(-5))); - setprop("gear/gear[2]/R4error_temp_degc", math.round(rand()*(-5))); - } + setprop("gear/gear[1]/L-Thrust",0); + setprop("gear/gear[2]/R-Thrust",0); + + #Introducing a random error on temp sensors (max 5°C) + setprop("gear/gear[1]/L1error-temp-degc", math.round(rand()*(5))); + setprop("gear/gear[1]/L2error-temp-degc", math.round(rand()*(5))); + setprop("gear/gear[2]/R3error-temp-degc", math.round(rand()*(5))); + setprop("gear/gear[2]/R4error-temp-degc", math.round(rand()*(5))); + + var atemp = getprop("environment/temperature-degc") or 0; + var vmach = getprop("velocities/mach") or 0; + var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); + var tatdegf = 32+(1.8 * tatdegc); + + setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")); + setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")); + setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")); + setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")); + setprop("gear/gear[1]/L1brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[1]/L1brake-temp-degc"))); + setprop("gear/gear[1]/L2brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[1]/L2brake-temp-degc"))); + setprop("gear/gear[2]/R3brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[2]/R3brake-temp-degc"))); + setprop("gear/gear[2]/R4brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[2]/R4brake-temp-degc"))); + setprop("sim/animation/fire-services",0); me.LastSimTime = 0.0; }, @@ -92,69 +98,192 @@ var BrakeSystem = { var CurrentTime = getprop("sim/time/elapsed-sec"); var dt = CurrentTime - me.LastSimTime; + var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); + var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); + var LBrakeLevel = getprop("fdm/jsbsim/fcs/left-brake-cmd-norm"); + var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm"); + var atemp = getprop("environment/temperature-degc") or 0; + var vmach = getprop("velocities/mach") or 0; + var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); + var tatdegf = 32+(1.8 * tatdegc); + setprop("environment/total-air-temperature-degc", tatdegc); + setprop("environment/total-air-temperature-degf", tatdegf); + var L_thrust_lb = getprop("engines/engine[0]/thrust_lb"); + var R_thrust_lb = getprop("engines/engine[1]/thrust_lb"); if (dt<1.0) { - #cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degf * 0.00001) - var CoolingRatio = me.CoolingFactor+(getprop("environment/temperature-degf")*0.00001); + var OnGround = getprop("gear/gear[1]/wow"); + #cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001) + var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); + var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); if (getprop("controls/gear/brake-fans")) { #increase CoolingRatio if Brake Fans are active - CoolingRatio = CoolingRatio * 3; + LCoolingRatio = LCoolingRatio * 3; + RCoolingRatio = RCoolingRatio * 3; } - - var nCoolFactor = math.ln(1-CoolingRatio); + if (getprop("gear/gear[1]/position-norm")) + { + #increase CoolingRatio if gear down according to airspeed + LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt"); + } else { + #Reduced CoolingRatio if gear up + LCoolingRatio = LCoolingRatio * 0.1; + } + if (getprop("gear/gear[2]/position-norm")) + { + #increase CoolingRatio if gear down according to airspeed + RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt"); + } else { + #Reduced CoolingRatio if gear up + RCoolingRatio = RCoolingRatio * 0.1; + } + if (LBrakeLevel>0) + { + #Reduced CoolingRatio if Brakes used + LCoolingRatio = LCoolingRatio * 0.1 * LBrakeLevel; + } + if (RBrakeLevel>0) + { + #Reduced CoolingRatio if Brakes used + RCoolingRatio = RCoolingRatio * 0.1 * RBrakeLevel; + } + + var LnCoolFactor = math.ln(1-LCoolingRatio); + var RnCoolFactor = math.ln(1-RCoolingRatio); - var OnGround = getprop("gear/gear[1]/wow"); - var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); - var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); - - var LBrakeLevel = getprop("fdm/jsbsim/fcs/left-brake-cmd-norm"); - var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm"); - #} - var BrakeLevel = (LBrakeLevel + RBrakeLevel)/2; - if ((OnGround)and(BrakeLevel>0)) - { - # absorb more energy + L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb")); + if (L_thrust_lb < 1) + { + L_thrust_lb = 1 + } + L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.000000001; + + R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb")); + if (R_thrust_lb < 1) + { + R_thrust_lb = 1 + } + R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.000000001; + + if (OnGround) + { var V1 = getprop("velocities/groundspeed-kt"); var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor); + # absorb some kinetic energy: # dE= 1/2 * m * V1^2 - 1/2 * m * V2^2) - var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel; + var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel; var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; - # do not absorb more energy when plane is (almost) stopped - # Thermal energy computation - if (V2_L>0) - { - LThermalEnergy += Mass * (V1*V1 - V2_L*V2_L)/2; - # cooling effect: reduce thermal energy by (nCoolFactor)^dt - LThermalEnergy = LThermalEnergy * math.exp(nCoolFactor * dt); - } else { - # cooling effect: reduced cooling when speed = 0 and brakes on - LThermalEnergy = LThermalEnergy * math.exp(nCoolFactor * 0.3 * dt); - } - if (V2_R>0) - { - RThermalEnergy += Mass * (V1*V1 - V2_R*V2_R)/2; - # cooling effect: reduce thermal energy by (nCoolFactor)^dt - RThermalEnergy = RThermalEnergy * math.exp(nCoolFactor * dt); - } else { - # cooling effect: reduced cooling when speed = 0 and brakes on - RThermalEnergy = RThermalEnergy * math.exp(nCoolFactor * 0.3 * dt); - } - } else { - LThermalEnergy = LThermalEnergy * math.exp(nCoolFactor * dt); - RThermalEnergy = RThermalEnergy * math.exp(nCoolFactor * dt); - } - + + #TODO - Adjust ThermalEnergy according to differential braking + #LBrakeLevel-RBrakeLevel + + LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); + if (getprop("services/chocks/left")) + { + if (!getprop("controls/gear/brake-parking")) + { + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); + } else { + #LThermalEnergy += L_Thrust; + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); + } + } else { + if (!getprop("controls/gear/brake-parking")) + { + if (LBrakeLevel>0) + { + if (V2_L>0) + { + #LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust; + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); + } else { + #LThermalEnergy += math.abs(L_Thrust); + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); + } + } else { + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); + } + } else { + #LThermalEnergy += math.abs(L_Thrust); + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); + } + } + + RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); + if (getprop("services/chocks/right")) + { + if (!getprop("controls/gear/brake-parking")) + { + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); + } else { + #RThermalEnergy += math.abs(R_Thrust); + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); + } + } else { + if (!getprop("controls/gear/brake-parking")) + { + if (RBrakeLevel>0) + { + if (V2_R>0) + { + #RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust; + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); + } else { + #RThermalEnergy += math.abs(R_Thrust); + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); + } + } else { + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); + } + } else { + #RThermalEnergy += math.abs(R_Thrust); + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); + } + } + + } else { + LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); + RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); + } + + if (LThermalEnergy < 0) { + LThermalEnergy = 0 + } + if (LThermalEnergy > 3) { + LThermalEnergy = 3 + } + if (RThermalEnergy < 0) { + RThermalEnergy = 0 + } + if (RThermalEnergy > 3) { + RThermalEnergy = 3 + } + + setprop("gear/gear[1]/L-Thrust",L_Thrust); + setprop("gear/gear[2]/R-Thrust",R_Thrust); setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy); setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy); #Calculating Brakes temperature - setprop("gear/gear[1]/L1brake-temp-degc",getprop("gear/gear[1]/L1error_temp_degc")+getprop("environment/temperature-degc")+(LThermalEnergy * (300-getprop("gear/gear[1]/L1error_temp_degc")-getprop("environment/temperature-degc")))); - setprop("gear/gear[1]/L2brake-temp-degc",getprop("gear/gear[1]/L2error_temp_degc")+getprop("environment/temperature-degc")+(LThermalEnergy * (300-getprop("gear/gear[1]/L2error_temp_degc")-getprop("environment/temperature-degc")))); - setprop("gear/gear[2]/R3brake-temp-degc",getprop("gear/gear[2]/R3error_temp_degc")+getprop("environment/temperature-degc")+(RThermalEnergy * (300-getprop("gear/gear[2]/R3error_temp_degc")-getprop("environment/temperature-degc")))); - setprop("gear/gear[2]/R4brake-temp-degc",getprop("gear/gear[2]/R4error_temp_degc")+getprop("environment/temperature-degc")+(RThermalEnergy * (300-getprop("gear/gear[2]/R4error_temp_degc")-getprop("environment/temperature-degc")))); + setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L1error-temp-degc")))); + setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc")))); + setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc")))); + setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc")))); setprop("gear/gear[1]/L1brake-temp-degf",(32 + (1.8 * getprop("gear/gear[1]/L1brake-temp-degc")))); setprop("gear/gear[1]/L2brake-temp-degf",(32 + (1.8 * getprop("gear/gear[1]/L2brake-temp-degc")))); setprop("gear/gear[2]/R3brake-temp-degf",(32 + (1.8 * getprop("gear/gear[2]/R3brake-temp-degc"))));