From 250d177d1723ec75a9539cbaeb0121dd4d885f60 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 3 Aug 2021 16:56:35 +0100 Subject: [PATCH] Add trigonometric wind speed calculation to navdisplay; bugfix WPT / DECEL symbol files; correct how the wind arrow / TAS / GS display on the ND and improve the dashed route line --- Models/Instruments/ND/canvas/map/DECEL.symbol | 3 +- .../ND/canvas/map/WPT-airbus.symbol | 2 +- Models/Instruments/ND/canvas/style.nas | 49 ++++----- Nasal/Libraries/property-tree-setup.nas | 4 + Systems/a320-adr.xml | 2 +- Systems/libraries.xml | 8 -- Systems/pfd.xml | 103 ++++++++++++++++++ 7 files changed, 130 insertions(+), 41 deletions(-) diff --git a/Models/Instruments/ND/canvas/map/DECEL.symbol b/Models/Instruments/ND/canvas/map/DECEL.symbol index c0a65b20..37a70536 100644 --- a/Models/Instruments/ND/canvas/map/DECEL.symbol +++ b/Models/Instruments/ND/canvas/map/DECEL.symbol @@ -23,8 +23,7 @@ var init = func { var draw = func{ if(me.decel_grp != nil){ var spd_ctrl = getprop(me.options.spd_ctrl); - var spd_managed = (spd_ctrl == me.options.managed_val); - if(spd_managed) + if(spd_ctrl) me.decel_grp.setColor(me.style.managed_color); else me.decel_grp.setColor(me.style.selected_color); diff --git a/Models/Instruments/ND/canvas/map/WPT-airbus.symbol b/Models/Instruments/ND/canvas/map/WPT-airbus.symbol index 439e8e1e..7d00e465 100644 --- a/Models/Instruments/ND/canvas/map/WPT-airbus.symbol +++ b/Models/Instruments/ND/canvas/map/WPT-airbus.symbol @@ -82,7 +82,7 @@ var draw = func{ var wp_group = me.element; var alt = me.model.alt; var i = me.model.idx; - var vnav_actv = getprop(me.options.ver_ctrl) == me.options.managed_val; + var vnav_actv = getprop(me.options.spd_ctrl) == 1; var curwp = getprop(me.options.current_wp); if(alt > 0){ var wp_d = me.model.wp.distance_along_route; diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 4e8205ef..eca9b7b4 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -529,7 +529,7 @@ canvas.NDStyles["Airbus"] = { var lat_ctrl = getprop(me.options.lat_ctrl); var is_managed = (lat_ctrl == me.options.managed_val); var is_active = getprop(me.options.fplan_active); - (is_managed and is_active ? [] : [32, 16]); + (is_managed and is_active ? [] : [12, 12]); }, line_dash_alternate_active: [32,16], line_dash_temporary: [32,16], @@ -561,6 +561,7 @@ canvas.NDStyles["Airbus"] = { "fplan_active", "lat_ctrl", "ver_ctrl", + "spd_ctrl", "current_wp", "wp_count", "dep_rwy", @@ -758,21 +759,14 @@ canvas.NDStyles["Airbus"] = { id: "tas", impl: { init: func(nd,symbol), - predicate: func(nd) nd.aircraft_source.get_spd() > 100, + predicate: func(nd) getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 60, is_true: func(nd) { - nd.symbols.tas.setText(sprintf("%3.0f",getprop("/velocities/TAS") )); + nd.symbols.tas.setText(sprintf("%3.0f",getprop("/instrumentation/airspeed-indicator/true-speed-kt"))); nd.symbols.tas.show(); }, - is_false: func(nd) nd.symbols.tas.hide(), - }, - }, - { - id: "tasLbl", - impl: { - init: func(nd,symbol), - predicate: func(nd) nd.aircraft_source.get_spd() > 100, - is_true: func(nd) nd.symbols.tasLbl.show(), - is_false: func(nd) nd.symbols.tasLbl.hide(), + is_false: func(nd){ + nd.symbols.tas.setText("---"); + } }, }, { @@ -1006,12 +1000,6 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), common: func(nd) nd.symbols.gs.setText(sprintf("%3.0f",nd.aircraft_source.get_gnd_spd() )), - predicate: func(nd) nd.aircraft_source.get_gnd_spd() >= 30, - is_true: func(nd) { - #nd.symbols.gs.show(); - nd.symbols.gs.setFontSize(36); - }, - is_false: func(nd) {},#nd.symbols.gs.hide(), }, }, { @@ -1341,7 +1329,7 @@ canvas.NDStyles["Airbus"] = { nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered") and (nd.change_phase != 1) and ( - getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val or + getprop(nd.options.defaults.lat_ctrl) == 0 or nd.get_switch("toggle_trk_line") ) }, @@ -1357,7 +1345,8 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered") and (nd.change_phase != 1) - and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) + and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42), is_true: func(nd) { nd.symbols.trkInd2.show(); nd.symbols.trkInd2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R); @@ -1371,7 +1360,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered") and (nd.change_phase != 1) and - getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val and + getprop(nd.options.defaults.lat_ctrl) == 0 and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.trkline2.show(); @@ -1530,24 +1519,26 @@ canvas.NDStyles["Airbus"] = { id:"wind", impl: { init: func(nd,symbol), - predicate: ALWAYS, + predicate: func(nd) (getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100), is_true: func(nd) { - var windDir = getprop("environment/wind-from-heading-deg"); - if(!nd.get_switch("toggle_true_north")) + var windDir = pts.Instrumentation.PFD.windDirection.getValue() or 0; + if(nd.get_switch("toggle_true_north")) windDir = windDir + getprop("environment/magnetic-variation-deg"); - nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,getprop("environment/wind-speed-kt"))); + nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,pts.Instrumentation.PFD.windSpeed.getValue() or 0)); }, - is_false: NOTHING, + is_false: func(nd) { + nd.symbols.wind.setText("---/--"); + } }, }, { id:"windArrow", impl: { init: func(nd,symbol), - predicate: func(nd) (!(nd.in_mode("toggle_display_mode", ["PLAN"]) and (nd.get_switch("toggle_display_type") == "LCD"))), + predicate: func(nd) (!(nd.in_mode("toggle_display_mode", ["PLAN"]) and (nd.get_switch("toggle_display_type") == "LCD")) and (pts.Instrumentation.PFD.windSpeed.getValue() or 0) >= 2 and getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100), is_true: func(nd) { nd.symbols.windArrow.show(); - var windArrowRot = getprop("environment/wind-from-heading-deg"); + var windArrowRot = pts.Instrumentation.PFD.windDirection.getValue() or 0; if(nd.in_mode("toggle_display_mode", ["MAP","PLAN"])) { if(nd.get_switch("toggle_true_north")) windArrowRot = windArrowRot - nd.aircraft_source.get_trk_tru(); diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 73ee448e..50c3e756 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -204,6 +204,10 @@ var Instrumentation = { gsDeflection: props.globals.getNode("/instrumentation/nav[0]/gs-needle-deflection-norm"), locDeflection: props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm"), }, + PFD: { + windDirection: props.globals.getNode("/instrumentation/pfd/wind-direction"), + windSpeed: props.globals.getNode("/instrumentation/pfd/wind-speed"), + }, TCAS: { servicable: props.globals.getNode("/instrumentation/tcas/serviceable"), Inputs: { diff --git a/Systems/a320-adr.xml b/Systems/a320-adr.xml index 1946e513..a1fa63a3 100644 --- a/Systems/a320-adr.xml +++ b/Systems/a320-adr.xml @@ -530,7 +530,7 @@ /systems/navigation/probes/tat-1/tat - /velocities/TAS + /instrumentation/airspeed-indicator/true-speed-kt 2 7569 diff --git a/Systems/libraries.xml b/Systems/libraries.xml index fecc9de2..16092c98 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -608,14 +608,6 @@ /systems/pressurization/targetvs - - TAS - gain - 1.0 - /instrumentation/airspeed-indicator/true-speed-kt - /velocities/TAS - - LBtoKG gain diff --git a/Systems/pfd.xml b/Systems/pfd.xml index 733054dc..a4741f0a 100644 --- a/Systems/pfd.xml +++ b/Systems/pfd.xml @@ -573,5 +573,108 @@ /instrumentation/iesi/pitch-deg + + + Wind East + gain + 1.0 + + + + + /velocities/speed-east-fps + 0.592484 + + + /orientation/pitch-deg + /orientation/heading-deg + + /systems/navigation/adr/output/tas-3 + + + + + + /instrumentation/pfd/wind-speed-east + -4096 + 4096 + + + + Wind North + gain + 1.0 + + + + + /velocities/speed-north-fps + 0.592484 + + + /orientation/pitch-deg + /orientation/heading-deg + + /systems/navigation/adr/output/tas-3 + + + + + + /instrumentation/pfd/wind-speed-north + -4096 + 4096 + + + Wind Direction + exponential + 1.28 + + + + + + /instrumentation/pfd/wind-speed-east + /instrumentation/pfd/wind-speed-north + + + 180 + + + + /instrumentation/pfd/wind-direction + + 0 + 360 + + + + + Wind Speed + exponential + 1.28 + + + + + + /instrumentation/pfd/wind-speed-east + 2 + + + /instrumentation/pfd/wind-speed-north + 2 + + + + + + /instrumentation/pfd/wind-speed + 0 + 256 + +