1
0
Fork 0

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

This commit is contained in:
legoboyvdlp R 2021-08-03 16:56:35 +01:00
parent 22b76cf0a8
commit 250d177d17
7 changed files with 130 additions and 41 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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();

View file

@ -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: {

View file

@ -530,7 +530,7 @@
<property>/systems/navigation/probes/tat-1/tat</property>
<quotient>
<pow>
<property>/velocities/TAS</property>
<property>/instrumentation/airspeed-indicator/true-speed-kt</property>
<value>2</value>
</pow>
<value>7569</value>

View file

@ -608,14 +608,6 @@
<output>/systems/pressurization/targetvs</output>
</filter>
<filter>
<name>TAS</name>
<type>gain</type>
<gain>1.0</gain>
<input>/instrumentation/airspeed-indicator/true-speed-kt</input>
<output>/velocities/TAS</output>
</filter>
<filter>
<name>LBtoKG</name>
<type>gain</type>

View file

@ -573,5 +573,108 @@
</input>
<output>/instrumentation/iesi/pitch-deg</output>
</filter>
<filter>
<name>Wind East</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<difference>
<product>
<property>/velocities/speed-east-fps</property>
<value>0.592484</value> <!-- fps to kt -->
</product>
<product>
<cos><deg2rad><property>/orientation/pitch-deg</property></deg2rad></cos>
<sin><deg2rad><property>/orientation/heading-deg</property></deg2rad></sin>
<!--<floor>-->
<property>/systems/navigation/adr/output/tas-3</property>
<!--<value>100</value>
</floor>-->
</product>
</difference>
</expression>
</input>
<output>/instrumentation/pfd/wind-speed-east</output>
<min>-4096</min>
<max>4096</max>
</filter>
<filter>
<name>Wind North</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<difference>
<product>
<property>/velocities/speed-north-fps</property>
<value>0.592484</value> <!-- fps to kt -->
</product>
<product>
<cos><deg2rad><property>/orientation/pitch-deg</property></deg2rad></cos>
<cos><deg2rad><property>/orientation/heading-deg</property></deg2rad></cos>
<!--<floor>-->
<property>/systems/navigation/adr/output/tas-3</property>
<!--<value>100</value>
</floor>-->
</product>
</difference>
</expression>
</input>
<output>/instrumentation/pfd/wind-speed-north</output>
<min>-4096</min>
<max>4096</max>
</filter>
<filter>
<name>Wind Direction</name>
<type>exponential</type>
<filter-time>1.28</filter-time>
<input>
<expression>
<sum>
<rad2deg>
<atan2>
<property>/instrumentation/pfd/wind-speed-east</property>
<property>/instrumentation/pfd/wind-speed-north</property>
</atan2>
</rad2deg>
<value>180</value>
</sum>
</expression>
</input>
<output>/instrumentation/pfd/wind-direction</output>
<period>
<min>0</min>
<max>360</max>
</period>
</filter>
<filter>
<name>Wind Speed</name>
<type>exponential</type>
<filter-time>1.28</filter-time>
<input>
<expression>
<sqrt>
<sum>
<pow>
<property>/instrumentation/pfd/wind-speed-east</property>
<value>2</value>
</pow>
<pow>
<property>/instrumentation/pfd/wind-speed-north</property>
<value>2</value>
</pow>
</sum>
</sqrt>
</expression>
</input>
<output>/instrumentation/pfd/wind-speed</output>
<min>0</min>
<max>256</max>
</filter>
</PropertyList>