1
0
Fork 0

ADIRS update, now shows airspeed on PFD

This commit is contained in:
legoboyvdlp R 2019-11-06 19:09:42 +00:00
parent b1bfb39c4a
commit 15c2f680a4
18 changed files with 1027 additions and 568 deletions

View file

@ -717,6 +717,10 @@
<on-bat type="bool">0</on-bat>
</lights>
</adirscp>
<switching>
<att-hdg type="int">0</att-hdg>
<air-data type="int">0</air-data>
</switching>
</navigation>
<OH>
<protectors>
@ -1173,6 +1177,11 @@
</speaker>
</tcas>
<transponder>
<airspeed-input-src type="int">0</airspeed-input-src>
<altimeter-input-src type="int">0</altimeter-input-src>
</transponder>
<!-- See http://wiki.flightgear.org/index.php/GPWS -->
<mk-viii n="0">
<serviceable type="bool">true</serviceable>
@ -1713,6 +1722,7 @@
<file>Aircraft/A320-family/Nasal/engines-common.nas</file>
<file>Aircraft/A320-family/Nasal/ADIRS.nas</file>
<file>Aircraft/A320-family/Nasal/ADIRS/ADR.nas</file>
<file>Aircraft/A320-family/Nasal/ADIRS/SwitchingPanel.nas</file>
<file>Aircraft/A320-family/Nasal/fire.nas</file>
<file>Aircraft/A320-family/Nasal/brakes.nas</file>
<file>Aircraft/A320-family/Nasal/ground_services.nas</file>
@ -1790,6 +1800,9 @@
<atc>
<file>Aircraft/A320-family/Nasal/atc.nas</file>
</atc>
<dmc>
<file>Aircraft/A320-family/Nasal/DMC.nas</file>
</dmc>
</nasal>
</PropertyList>

View file

@ -6071,6 +6071,65 @@
</action>
</animation>
<animation>
<type>rotate</type>
<object-name>ecam_air_data</object-name>
<object-name>ecam_air_data.mark</object-name>
<factor>30</factor>
<property>/controls/navigation/switching/air-data</property>
<axis>
<x1-m>-0.428673</x1-m>
<y1-m>-0.022557</y1-m>
<z1-m>-0.051784</z1-m>
<x2-m>-0.430086</x2-m>
<y2-m>-0.022557</y2-m>
<z2-m>-0.060321</z2-m>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>ecam_air_data</object-name>
<action>
<button>0</button>
<button>3</button>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (systems.SwitchingPanel.Switches.airData.getValue() != 1) {
systems.SwitchingPanel.doAirData(systems.SwitchingPanel.Switches.airData.getValue() + 1);
} else {
systems.SwitchingPanel.doAirData(-1);
}
</script>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/knb1", 1);</script>
</binding>
</action>
<action>
<button>2</button>
<button>4</button>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (systems.SwitchingPanel.Switches.airData.getValue() != -1) {
systems.SwitchingPanel.doAirData(systems.SwitchingPanel.Switches.airData.getValue() - 1);
} else {
systems.SwitchingPanel.doAirData(1);
}
</script>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/knb1", 1);</script>
</binding>
</action>
</animation>
<!-- Z Colors/Effects -->
<animation>
<type>material</type>

View file

@ -596,7 +596,7 @@
<condition>
<or>
<equals>
<property>controls/adirs/ir[0]/align</property>
<property>controls/navigation/adirscp/lights/ir-1-off</property>
<value>1</value>
</equals>
<equals>
@ -692,7 +692,7 @@
<condition>
<or>
<equals>
<property>controls/adirs/ir[1]/align</property>
<property>controls/navigation/adirscp/lights/ir-2-off</property>
<value>1</value>
</equals>
<equals>
@ -788,7 +788,7 @@
<condition>
<or>
<equals>
<property>controls/adirs/ir[2]/align</property>
<property>controls/navigation/adirscp/lights/ir-3-off</property>
<value>1</value>
</equals>
<equals>

View file

@ -13,11 +13,6 @@ var PFD2_display = nil;
var updateL = 0;
var updateR = 0;
var elapsedtime = 0;
var ASI = 0;
var ASItrgt = 0;
var ASItrgtdiff = 0;
var ASImax = 0;
var ASItrend = 0;
var altTens = 0;
var altPolarity = "";
@ -133,7 +128,9 @@ var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOU
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 speed_pred = props.globals.initNode("/instrumentation/pfd/speed-lookahead", 0.0, "DOUBLE");
var speed_pred_1 = props.globals.initNode("/instrumentation/pfd/speed-lookahead-1", 0.0, "DOUBLE");
var speed_pred_2 = props.globals.initNode("/instrumentation/pfd/speed-lookahead-2", 0.0, "DOUBLE");
var speed_pred_3 = props.globals.initNode("/instrumentation/pfd/speed-lookahead-3", 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_test_amount = props.globals.initNode("/instrumentation/du/du1-test-amount", 0.0, "DOUBLE");
@ -197,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"];
"TRK_pointer","machError"];
},
update: func() {
elapsedtime_act = elapsedtime.getValue();
@ -609,119 +606,6 @@ var canvas_PFD_base = {
}
},
updateCommonFast: func() {
# Airspeed
ind_spd = ind_spd_kt.getValue();
# Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations
if (ind_spd <= 30) {
ASI = 0;
} else if (ind_spd >= 420) {
ASI = 390;
} else {
ASI = ind_spd - 30;
}
FMGC_max = FMGC_max_spd.getValue();
if (FMGC_max <= 30) {
ASImax = 0 - ASI;
} else if (FMGC_max >= 420) {
ASImax = 390 - ASI;
} else {
ASImax = FMGC_max - 30 - ASI;
}
me["ASI_scale"].setTranslation(0, ASI * 6.6);
me["ASI_max"].setTranslation(0, ASImax * -6.6);
ind_mach = ind_spd_mach.getValue();
if (ind_mach >= 0.5) {
me["ASI_mach_decimal"].show();
me["ASI_mach"].show();
} else {
me["ASI_mach_decimal"].hide();
me["ASI_mach"].hide();
}
if (ind_mach >= 0.999) {
me["ASI_mach"].setText("999");
} else {
me["ASI_mach"].setText(sprintf("%3.0f", ind_mach * 1000));
}
if (managed_spd.getValue() == 1) {
me["ASI_target"].setColor(0.6901,0.3333,0.7450);
me["ASI_digit_UP"].setColor(0.6901,0.3333,0.7450);
me["ASI_decimal_UP"].setColor(0.6901,0.3333,0.7450);
me["ASI_digit_DN"].setColor(0.6901,0.3333,0.7450);
me["ASI_decimal_DN"].setColor(0.6901,0.3333,0.7450);
} else {
me["ASI_target"].setColor(0.0901,0.6039,0.7176);
me["ASI_digit_UP"].setColor(0.0901,0.6039,0.7176);
me["ASI_decimal_UP"].setColor(0.0901,0.6039,0.7176);
me["ASI_digit_DN"].setColor(0.0901,0.6039,0.7176);
me["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176);
}
tgt_ias = at_tgt_ias.getValue();
if (tgt_ias <= 30) {
ASItrgt = 0 - ASI;
} else if (tgt_ias >= 420) {
ASItrgt = 390 - ASI;
} else {
ASItrgt = tgt_ias - 30 - ASI;
}
ASItrgtdiff = tgt_ias - ind_spd;
if (ASItrgtdiff >= -42 and ASItrgtdiff <= 42) {
me["ASI_target"].setTranslation(0, ASItrgt * -6.6);
me["ASI_digit_UP"].hide();
me["ASI_decimal_UP"].hide();
me["ASI_digit_DN"].hide();
me["ASI_decimal_DN"].hide();
me["ASI_target"].show();
} else if (ASItrgtdiff < -42) {
if (at_mach_mode.getValue() == 1) {
me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].show();
} else {
me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_kts.getValue()));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].hide();
}
me["ASI_digit_DN"].show();
me["ASI_digit_UP"].hide();
me["ASI_target"].hide();
} else if (ASItrgtdiff > 42) {
if (at_mach_mode.getValue() == 1) {
me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000));
me["ASI_decimal_UP"].show();
me["ASI_decimal_DN"].hide();
} else {
me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_kts.getValue()));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].hide();
}
me["ASI_digit_UP"].show();
me["ASI_digit_DN"].hide();
me["ASI_target"].hide();
}
ASItrend = speed_pred.getValue() - ASI;
me["ASI_trend_up"].setTranslation(0, math.clamp(ASItrend, 0, 50) * -6.6);
me["ASI_trend_down"].setTranslation(0, math.clamp(ASItrend, -50, 0) * -6.6);
if (ASItrend >= 2) {
me["ASI_trend_up"].show();
me["ASI_trend_down"].hide();
} else if (ASItrend <= -2) {
me["ASI_trend_down"].show();
me["ASI_trend_up"].hide();
} else {
me["ASI_trend_up"].hide();
me["ASI_trend_down"].hide();
}
# Attitude Indicator
pitch_cur = pitch.getValue();
roll_cur = roll.getValue();
@ -947,6 +831,12 @@ var canvas_PFD_base = {
};
var canvas_PFD_1 = {
ASI: 0,
ASImax: 0,
ASItrend: 0,
ASItrgt: 0,
ASItrgtdiff: 0,
FMGC_max: 0,
new: func(canvas_group, file) {
var m = {parents: [canvas_PFD_1, canvas_PFD_base]};
m.init(canvas_group, file);
@ -964,23 +854,17 @@ var canvas_PFD_1 = {
# Errors
if ((adirs0_active.getValue() == 1) or (air_switch.getValue() == -1 and adirs2_active.getValue() == 1)) {
me["ASI_group"].show();
me["ALT_group"].show();
me["ALT_group2"].show();
me["ALT_scale"].show();
me["VS_group"].show();
me["ASI_error"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ALT_error"].hide();
me["ALT_frame"].setColor(1,1,1);
me["VS_error"].hide();
} else {
me["ASI_error"].show();
me["ASI_frame"].setColor(1,0,0);
me["ALT_error"].show();
me["ALT_frame"].setColor(1,0,0);
me["VS_error"].show();
me["ASI_group"].hide();
me["ALT_group"].hide();
me["ALT_group2"].hide();
me["ALT_scale"].hide();
@ -1037,11 +921,146 @@ var canvas_PFD_1 = {
me.updateCommon();
},
updateFast: func() {
# Airspeed
# ind_spd = ind_spd_kt.getValue();
# Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations
if (dmc.DMController.DMCs[0].outputs[0] != nil) {
ind_spd = dmc.DMController.DMCs[0].outputs[0].getValue();
me["ASI_error"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ASI_group"].show();
if (ind_spd <= 30) {
me.ASI = 0;
} else if (ind_spd >= 420) {
me.ASI = 390;
} else {
me.ASI = ind_spd - 30;
}
me.FMGC_max = FMGC_max_spd.getValue();
if (me.FMGC_max <= 30) {
me.ASImax = 0 - me.ASI;
} else if (me.FMGC_max >= 420) {
me.ASImax = 390 - me.ASI;
} else {
me.ASImax = me.FMGC_max - 30 - me.ASI;
}
me["ASI_scale"].setTranslation(0, me.ASI * 6.6);
me["ASI_max"].setTranslation(0, me.ASImax * -6.6);
if (managed_spd.getValue() == 1) {
me["ASI_target"].setColor(0.6901,0.3333,0.7450);
me["ASI_digit_UP"].setColor(0.6901,0.3333,0.7450);
me["ASI_decimal_UP"].setColor(0.6901,0.3333,0.7450);
me["ASI_digit_DN"].setColor(0.6901,0.3333,0.7450);
me["ASI_decimal_DN"].setColor(0.6901,0.3333,0.7450);
} else {
me["ASI_target"].setColor(0.0901,0.6039,0.7176);
me["ASI_digit_UP"].setColor(0.0901,0.6039,0.7176);
me["ASI_decimal_UP"].setColor(0.0901,0.6039,0.7176);
me["ASI_digit_DN"].setColor(0.0901,0.6039,0.7176);
me["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176);
}
tgt_ias = at_tgt_ias.getValue();
if (tgt_ias <= 30) {
me.ASItrgt = 0 - me.ASI;
} else if (tgt_ias >= 420) {
me.ASItrgt = 390 - me.ASI;
} else {
me.ASItrgt = tgt_ias - 30 - me.ASI;
}
me.ASItrgtdiff = tgt_ias - ind_spd;
if (me.ASItrgtdiff >= -42 and me.ASItrgtdiff <= 42) {
me["ASI_target"].setTranslation(0, me.ASItrgt * -6.6);
me["ASI_digit_UP"].hide();
me["ASI_decimal_UP"].hide();
me["ASI_digit_DN"].hide();
me["ASI_decimal_DN"].hide();
me["ASI_target"].show();
} else if (me.ASItrgtdiff < -42) {
if (at_mach_mode.getValue() == 1) {
me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].show();
} else {
me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_kts.getValue()));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].hide();
}
me["ASI_digit_DN"].show();
me["ASI_digit_UP"].hide();
me["ASI_target"].hide();
} else if (me.ASItrgtdiff > 42) {
if (at_mach_mode.getValue() == 1) {
me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000));
me["ASI_decimal_UP"].show();
me["ASI_decimal_DN"].hide();
} else {
me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_kts.getValue()));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].hide();
}
me["ASI_digit_UP"].show();
me["ASI_digit_DN"].hide();
me["ASI_target"].hide();
}
me.ASItrend = speed_pred_1.getValue() - me.ASI;
me["ASI_trend_up"].setTranslation(0, math.clamp(me.ASItrend, 0, 50) * -6.6);
me["ASI_trend_down"].setTranslation(0, math.clamp(me.ASItrend, -50, 0) * -6.6);
if (me.ASItrend >= 2) {
me["ASI_trend_up"].show();
me["ASI_trend_down"].hide();
} else if (me.ASItrend <= -2) {
me["ASI_trend_down"].show();
me["ASI_trend_up"].hide();
} else {
me["ASI_trend_up"].hide();
me["ASI_trend_down"].hide();
}
} else {
me["ASI_group"].hide();
me["ASI_error"].show();
me["ASI_frame"].setColor(1,0,0);
}
if (dmc.DMController.DMCs[0].outputs[2] != nil) {
ind_mach = dmc.DMController.DMCs[0].outputs[2].getValue();
me["machError"].hide();
if (ind_mach >= 0.5) {
me["ASI_mach_decimal"].show();
me["ASI_mach"].show();
} else {
me["ASI_mach_decimal"].hide();
me["ASI_mach"].hide();
}
if (ind_mach >= 0.999) {
me["ASI_mach"].setText("999");
} else {
me["ASI_mach"].setText(sprintf("%3.0f", ind_mach * 1000));
}
} else {
me["machError"].show();
}
me.updateCommonFast();
},
};
var canvas_PFD_2 = {
ASI: 0,
ASImax: 0,
ASItrend: 0,
ASItrgt: 0,
ASItrgtdiff: 0,
FMGC_max: 0,
new: func(canvas_group, file) {
var m = {parents: [canvas_PFD_2, canvas_PFD_base]};
m.init(canvas_group, file);
@ -1059,19 +1078,14 @@ var canvas_PFD_2 = {
# Errors
if ((adirs1_active.getValue() == 1) or (air_switch.getValue() == 1 and adirs2_active.getValue() == 1)) {
me["ASI_group"].show();
me["ALT_group"].show();
me["ALT_group2"].show();
me["ALT_scale"].show();
me["VS_group"].show();
me["ASI_error"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ALT_error"].hide();
me["ALT_frame"].setColor(1,1,1);
me["VS_error"].hide();
} else {
me["ASI_error"].show();
me["ASI_frame"].setColor(1,0,0);
me["ALT_error"].show();
me["ALT_frame"].setColor(1,0,0);
me["VS_error"].show();
@ -1132,6 +1146,136 @@ var canvas_PFD_2 = {
me.updateCommon();
},
updateFast: func() {
# Airspeed
# ind_spd = ind_spd_kt.getValue();
# Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations
if (dmc.DMController.DMCs[1].outputs[0] != nil) {
ind_spd = dmc.DMController.DMCs[1].outputs[0].getValue();
me["ASI_error"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ASI_group"].show();
if (ind_spd <= 30) {
me.ASI = 0;
} else if (ind_spd >= 420) {
me.ASI = 390;
} else {
me.ASI = ind_spd - 30;
}
me.FMGC_max = FMGC_max_spd.getValue();
if (me.FMGC_max <= 30) {
me.ASImax = 0 - me.ASI;
} else if (me.FMGC_max >= 420) {
me.ASImax = 390 - me.ASI;
} else {
me.ASImax = me.FMGC_max - 30 - me.ASI;
}
me["ASI_scale"].setTranslation(0, me.ASI * 6.6);
me["ASI_max"].setTranslation(0, me.ASImax * -6.6);
if (managed_spd.getValue() == 1) {
me["ASI_target"].setColor(0.6901,0.3333,0.7450);
me["ASI_digit_UP"].setColor(0.6901,0.3333,0.7450);
me["ASI_decimal_UP"].setColor(0.6901,0.3333,0.7450);
me["ASI_digit_DN"].setColor(0.6901,0.3333,0.7450);
me["ASI_decimal_DN"].setColor(0.6901,0.3333,0.7450);
} else {
me["ASI_target"].setColor(0.0901,0.6039,0.7176);
me["ASI_digit_UP"].setColor(0.0901,0.6039,0.7176);
me["ASI_decimal_UP"].setColor(0.0901,0.6039,0.7176);
me["ASI_digit_DN"].setColor(0.0901,0.6039,0.7176);
me["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176);
}
tgt_ias = at_tgt_ias.getValue();
if (tgt_ias <= 30) {
me.ASItrgt = 0 - me.ASI;
} else if (tgt_ias >= 420) {
me.ASItrgt = 390 - me.ASI;
} else {
me.ASItrgt = tgt_ias - 30 - me.ASI;
}
me.ASItrgtdiff = tgt_ias - ind_spd;
if (me.ASItrgtdiff >= -42 and me.ASItrgtdiff <= 42) {
me["ASI_target"].setTranslation(0, me.ASItrgt * -6.6);
me["ASI_digit_UP"].hide();
me["ASI_decimal_UP"].hide();
me["ASI_digit_DN"].hide();
me["ASI_decimal_DN"].hide();
me["ASI_target"].show();
} else if (me.ASItrgtdiff < -42) {
if (at_mach_mode.getValue() == 1) {
me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].show();
} else {
me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_kts.getValue()));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].hide();
}
me["ASI_digit_DN"].show();
me["ASI_digit_UP"].hide();
me["ASI_target"].hide();
} else if (me.ASItrgtdiff > 42) {
if (at_mach_mode.getValue() == 1) {
me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000));
me["ASI_decimal_UP"].show();
me["ASI_decimal_DN"].hide();
} else {
me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_kts.getValue()));
me["ASI_decimal_UP"].hide();
me["ASI_decimal_DN"].hide();
}
me["ASI_digit_UP"].show();
me["ASI_digit_DN"].hide();
me["ASI_target"].hide();
}
me.ASItrend = speed_pred_2.getValue() - me.ASI;
me["ASI_trend_up"].setTranslation(0, math.clamp(me.ASItrend, 0, 50) * -6.6);
me["ASI_trend_down"].setTranslation(0, math.clamp(me.ASItrend, -50, 0) * -6.6);
if (me.ASItrend >= 2) {
me["ASI_trend_up"].show();
me["ASI_trend_down"].hide();
} else if (me.ASItrend <= -2) {
me["ASI_trend_down"].show();
me["ASI_trend_up"].hide();
} else {
me["ASI_trend_up"].hide();
me["ASI_trend_down"].hide();
}
} else {
me["ASI_error"].show();
me["ASI_frame"].setColor(1,0,0);
me["ASI_group"].hide();
}
if (dmc.DMController.DMCs[1].outputs[2] != nil) {
ind_mach = dmc.DMController.DMCs[1].outputs[2].getValue();
me["machError"].hide();
if (ind_mach >= 0.5) {
me["ASI_mach_decimal"].show();
me["ASI_mach"].show();
} else {
me["ASI_mach_decimal"].hide();
me["ASI_mach"].hide();
}
if (ind_mach >= 0.999) {
me["ASI_mach"].setText("999");
} else {
me["ASI_mach"].setText(sprintf("%3.0f", ind_mach * 1000));
}
} else {
me["machError"].show();
}
me.updateCommonFast();
},
};

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 277 KiB

After

Width:  |  Height:  |  Size: 276 KiB

View file

@ -484,4 +484,5 @@
</and>
</condition>
</animation>
</PropertyList>

View file

@ -7,7 +7,7 @@ var _NUMADIRU = 3;
var _selfTestTime = nil;
var ADR = {
var ADIRU = {
# local vars
_voltageMain: 0,
_voltageBackup: 0,
@ -15,6 +15,7 @@ var ADR = {
_noPowerTime: 0,
_timeVar: 0,
num: 0,
outputOn: 0, # 0 = disc, 1 = normal
mode: 0, # 0 = off, 1 = nav, 2 = att
energised: 0, # 0 = off, 1 = on
@ -23,13 +24,13 @@ var ADR = {
output: [],
# methods
new: func() {
var adr = { parents:[ADR] };
return adr;
new: func(n) {
var adiru = { parents:[ADIRU] };
adiru.num = n;
return adiru;
},
updateEnergised: func(mode) {
me.energised = mode != 0 ? 1 : 0;
print("ADR energised status " ~ me.energised);
},
updatePower: func(elec) {
me._voltageMain = elec.getValue() or 0;
@ -44,6 +45,25 @@ var ADR = {
ADIRSnew._selfTest = 1;
_selfTestTime = pts.Sim.Time.elapsedSec.getValue();
ADIRSnew.Lights.adrOff[me.num].setValue(1);
ADIRSnew.Lights.adrFault[me.num].setValue(1);
settimer(func() {
ADIRSnew.Lights.adrOff[me.num].setValue(0);
ADIRSnew.Lights.adrFault[me.num].setValue(0);
}, 0.1);
settimer(func() {
ADIRSnew.Lights.adrOff[me.num].setValue(1);
ADIRSnew.Lights.adrFault[me.num].setValue(1);
ADIRSnew.Lights.irFault[me.num].setValue(1);
ADIRSnew.Lights.irOff[me.num].setValue(1);
}, 1.0);
settimer(func() {
ADIRSnew.Lights.adrOff[me.num].setValue(0);
ADIRSnew.Lights.adrFault[me.num].setValue(0);
ADIRSnew.Lights.irFault[me.num].setValue(0);
ADIRSnew.Lights.irOff[me.num].setValue(0);
}, 1.1);
ADIRSnew.selfTest();
},
setOperative: func(newOperative) {
@ -52,14 +72,13 @@ var ADR = {
if (newOperative) {
me.selfTest();
}
print("Set operative to " ~ me.operative);
}
},
update: func() {
me._timeVar = pts.Sim.Time.elapsedSec.getValue();
if (me.energised and !me._voltageMain and me._voltageLimitedTime and me._noPowerTime == 0) {
me._noPowerTime = me._timeVar;
print("ADR lost power at time " ~ me._noPowerTime);
print("ADIRU lost power at time " ~ me._noPowerTime);
}
if (me.energised and me.mode) {
@ -91,85 +110,32 @@ var ADR = {
},
};
var IR = {
# local vars
_voltageMain: 0,
_voltageBackup: 0,
_voltageLimitedTime: 0,
_noPowerTime: 0,
_timeVar: 0,
outputOn: 0, # 0 = disc, 1 = normal
mode: 0, # 0 = off, 1 = nav, 2 = att
energised: 0, # 0 = off, 1 = on
operative: 0, # 0 = off,
input: [],
output: [],
# methods
new: func() {
var ir = { parents:[IR] };
return ir;
},
updateEnergised: func(mode) {
me.energised = mode != 0 ? 1 : 0;
},
updatePower: func(elec) {
me._voltageMain = elec.getValue() or 0;
return me._voltageMain;
},
updateBackupPower: func(elec, isLimited) {
me._voltageBackup = elec.getValue() or 0;
me._voltageLimitedTime = isLimited;
return me._voltageBackup;
},
update: func() {
me._timeVar = pts.Sim.Time.elapsedSec.getValue();
if (me.energised and !me._voltageMain and me._voltageLimitedTime and me._noPowerTime == 0) {
me._noPowerTime = me._timeVar;
}
if (me._voltageMain or me._timeVar < me._noPowerTime + 300) {
me.operative = (me.outputOn and me.energised and me.mode) ? 1 : 0;
} else {
me.operative = 0;
}
},
};
var ADIRSControlPanel = {
adrSw: func(n) {
if (n < 0 or n > _NUMADIRU) { return; }
ADIRSnew._adrSwitchState = ADIRSnew.Switches.adrSw[n].getValue();
print("Switching adr unit " ~ n ~ " to " ~ !ADIRSnew._adrSwitchState);
ADIRSnew.Switches.adrSw[n].setValue(!ADIRSnew._adrSwitchState);
if (ADIRSnew.ADRunits[n] != nil) {
ADIRSnew.ADRunits[n].outputOn = !ADIRSnew._adrSwitchState;
if (ADIRSnew.ADIRunits[n] != nil) {
ADIRSnew.ADIRunits[n].outputOn = !ADIRSnew._adrSwitchState;
}
ADIRSnew.Lights.adrOff[n].setValue(ADIRSnew._adrSwitchState);
},
irSw: func(n) {
if (n < 0 or n > _NUMADIRU) { return; }
ADIRSnew._irSwitchState = ADIRSnew.Switches.irSw[n].getValue();
print("Switching ir unit " ~ n ~ " to " ~ !ADIRSnew._irSwitchState);
ADIRSnew.Switches.irSw[n].setValue(!ADIRSnew._irSwitchState);
if (ADIRSnew.IRunits[n] != nil) {
ADIRSnew.IRunits[n].outputOn = !ADIRSnew._irSwitchState;
}
ADIRSnew.Lights.irOff[n].setValue(ADIRSnew._adrSwitchState);
},
irModeSw: func(n, mode) {
if (n < 0 or n > _NUMADIRU) { return; }
if (mode < 0 or mode > 2) { return; }
me._irModeSwitchState = ADIRSnew.Switches.irModeSw[n].getValue();
print("Switching adirs " ~ n ~ " to mode " ~ mode);
if (ADIRSnew.ADRunits[n] != nil) {
ADIRSnew.ADRunits[n].mode = mode;
ADIRSnew.ADRunits[n].updateEnergised(mode);
ADIRSnew.Switches.irModeSw[n].setValue(mode);
}
if (ADIRSnew.IRunits[n] != nil) {
ADIRSnew.IRunits[n].mode = mode;
ADIRSnew.IRunits[n].updateEnergised(mode);
if (ADIRSnew.ADIRunits[n] != nil) {
ADIRSnew.ADIRunits[n].mode = mode;
ADIRSnew.ADIRunits[n].updateEnergised(mode);
ADIRSnew.Switches.irModeSw[n].setValue(mode);
}
}
@ -181,15 +147,16 @@ var ADIRSnew = {
_irSwitchState: 0,
_irModeSwitchState: 0,
_hasPower: 0,
_oldOperative: [0, 0, 0],
_cacheOperative: [0, 0, 0],
_cacheOutputOn: [0, 0, 0],
_flapPos: nil,
_slatPos: nil,
_selfTest: 0,
_init: 0,
# ADIRS Units
ADRunits: [nil, nil, nil],
IRunits: [nil, nil, nil],
ADIRunits: [nil, nil, nil],
#IRunits: [nil, nil, nil],
# Electrical
mainSupply: [systems.ELEC.Bus.acEss, systems.ELEC.Bus.ac2, systems.ELEC.Bus.ac1],
@ -219,8 +186,8 @@ var ADIRSnew = {
init: func() {
if (!me._init) {
for (i = 0; i < _NUMADIRU; i = i + 1) {
print("Creating new ADR unit " ~ i);
me.ADRunits[i] = ADR.new();
print("Creating new ADIRU " ~ i);
me.ADIRunits[i] = ADIRU.new(i);
me._init = 1;
}
}
@ -251,18 +218,19 @@ var ADIRSnew = {
if (me._init) {
for (i = 0; i < _NUMADIRU; i = i + 1) {
# update ADR units power
me._hasPower = me.ADRunits[i].updatePower(me.mainSupply[i]);
me._hasPower = me.ADIRunits[i].updatePower(me.mainSupply[i]);
if (me._hasPower == 0) {
me.ADRunits[i].updateBackupPower(me.backupSupply[i][0],me.backupSupply[i][1])
me.ADIRunits[i].updateBackupPower(me.backupSupply[i][0],me.backupSupply[i][1])
}
# Update ADR units
me.ADRunits[i].update();
me.ADIRunits[i].update();
if (me.ADRunits[i].operative != me._oldOperative[i]) {
me._oldOperative[i] = me.ADRunits[i].operative;
if (me.ADRunits[i].outputOn) {
me.Operating.adr[i].setValue(me.ADRunits[i].operative);
if (me.ADIRunits[i].operative != me._cacheOperative[i] or me.ADIRunits[i].outputOn != me._cacheOutputOn[i]) {
me._cacheOperative[i] = me.ADIRunits[i].operative;
me._cacheOutputOn[i] = me.ADIRunits[i].outputOn;
if (me.ADIRunits[i].outputOn) {
me.Operating.adr[i].setValue(me.ADIRunits[i].operative);
} else {
me.Operating.adr[i].setValue(0);
}

View file

@ -7,5 +7,26 @@ var SwitchingPanel = {
Switches: {
attHdg: props.globals.getNode("/controls/navigation/switching/att-hdg"),
airData: props.globals.getNode("/controls/navigation/switching/air-data"),
eisDmc: props.globals.getNode("/controls/navigation/switching/eis-dmc"),
},
doAirData: func(newAirData) {
if (newAirData < -1 or newAirData > 1) { return; }
me.Switches.airData.setValue(newAirData);
atc.transponderPanel.updateAirData();
if (newAirData == -1) {
dmc.DMController.DMCs[0].changeActiveADIRS(2);
dmc.DMController.DMCs[1].changeActiveADIRS(1);
} elsif (newAirData == 1) {
dmc.DMController.DMCs[0].changeActiveADIRS(0);
dmc.DMController.DMCs[1].changeActiveADIRS(2);
} elsif (newAirData == 0) {
dmc.DMController.DMCs[0].changeActiveADIRS(0);
dmc.DMController.DMCs[1].changeActiveADIRS(1);
}
},
doEisDMC: func(newDMC) {
if (newDMC < -1 or newDMC > 1) { return; }
me.Switches.eisDMC.setValue(newDMC);
},
};

70
Nasal/DMC.nas Normal file
View file

@ -0,0 +1,70 @@
# A3XX Display System
# Jonathan Redpath (legoboyvdlp)
# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
var DMC = {
_set: 0,
_setNil: 0,
activeADIRS: -9,
airspeeds: [props.globals.getNode("/systems/navigation/adr/output/cas-1", 1), props.globals.getNode("/systems/navigation/adr/output/cas-2", 1), props.globals.getNode("/systems/navigation/adr/output/cas-3", 1)],
machs: [props.globals.getNode("/systems/navigation/adr/output/mach-1", 1), props.globals.getNode("/systems/navigation/adr/output/mach-2", 1), props.globals.getNode("/systems/navigation/adr/output/mach-3", 1)],
outputs: [nil, nil, nil], # airspeed, altitude, mach
new: func(num) {
var d = { parents:[DMC] };
d.activeADIRS = num;
d.outputs = [nil, nil, nil];
return d;
},
changeActiveADIRS: func(newADIRS) {
me.activeADIRS = newADIRS;
me._set = 0;
},
setOutputs: func(ADIRS) {
me.outputs[0] = me.airspeeds[ADIRS];
me.outputs[2] = me.machs[ADIRS];
},
setOutputsNil: func() {
me.outputs[0] = nil;
me.outputs[1] = nil;
me.outputs[2] = nil;
},
update: func() {
if (systems.ADIRSnew.ADIRunits[me.activeADIRS].operative and systems.ADIRSnew.ADIRunits[me.activeADIRS].outputOn) {
if (me._set != 1) {
me._setNil = 0;
me.setOutputs(me.activeADIRS);
me._setADIRS = me.activeADIRS;
me._set = 1;
}
} else {
if (me._setNil != 1) {
me._set = 0;
me.setOutputsNil();
me._setNil = 1;
}
}
},
};
var DMController = {
_init: 0,
i: nil, # to make sure scope remains local use me.i
DMCs: [nil, nil, nil],
init: func() {
if (!me._init) {
me.DMCs = [DMC.new(0), DMC.new(1), DMC.new(2)];
me._init = 1;
}
},
loop: func() {
for (me.i = 0; me.i < 3; me.i = me.i + 1) {
me.DMCs[me.i].update();
}
},
};

View file

@ -163,6 +163,7 @@ var status = {
var ECAM_controller = {
_recallCounter: 0,
_noneActive: 0,
init: func() {
ECAMloopTimer.start();
me.reset();
@ -315,6 +316,7 @@ var ECAM_controller = {
}
},
recall: func() {
me._noneActive = 1;
me._recallCounter = 0;
foreach (var w; warnings.vector) {
if (w.clearFlag == 1) {
@ -322,9 +324,13 @@ var ECAM_controller = {
w.clearFlag = 0;
me._recallCounter += 1;
}
if (w.active == 1) {
me._noneActive = 0;
}
}
if (me._recallCounter == 0) {
if (me._recallCounter == 0 and me._noneActive) {
FWC.Btn.recallStsNormal.setValue(1);
settimer(func() {
if (FWC.Btn.recallStsNormal.getValue() == 1) { # catch unexpected error, trying something new here

View file

@ -973,7 +973,7 @@ var messages_priority_3 = func {
var messages_priority_2 = func {
phaseVar = phaseNode.getValue();
# DC EMER CONFIG
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dcEss.getValue() < 25 and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dcEss.getValue() < 25 and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar != 4 and phaseVar != 8 and dcEmerconfig.clearFlag == 0) {
dcEmerconfig.active = 1;
dcEmerconfigManOn.active = 1;
} else {
@ -981,7 +981,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(dcEmerconfigManOn);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dcEmerconfig.active and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dcEmerconfig.active and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar != 4 and phaseVar != 8 and dcBus12Fault.clearFlag == 0) {
dcBus12Fault.active = 1;
dcBus12FaultBlower.active = 1;
dcBus12FaultExtract.active = 1;
@ -997,7 +997,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(dcBus12FaultBrking);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.acEss.getValue() < 110 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.acEss.getValue() < 110 and phaseVar != 4 and phaseVar != 8 and AcBusEssFault.clearFlag == 0) {
AcBusEssFault.active = 1;
if (!systems.ELEC.Switch.acEssFeed.getBoolValue()) {
AcBusEssFaultFeed.active = 1;
@ -1011,7 +1011,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(AcBusEssFaultAtc);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.ac1.getValue() < 110 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.ac1.getValue() < 110 and phaseVar != 4 and phaseVar != 8 and AcBus1Fault.clearFlag == 0) {
AcBus1Fault.active = 1;
AcBus1FaultBlower.active = 1;
} else {
@ -1019,7 +1019,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(AcBus1FaultBlower);
}
if (!dcEmerconfig.active and systems.ELEC.Bus.dcEss.getValue() < 25 and phaseVar != 4 and phaseVar != 8) {
if (!dcEmerconfig.active and systems.ELEC.Bus.dcEss.getValue() < 25 and phaseVar != 4 and phaseVar != 8 and DcEssBusFault.clearFlag == 0) {
DcEssBusFault.active = 1;
DcEssBusFaultRadio.active = 1;
DcEssBusFaultRadio2.active = 1;
@ -1033,7 +1033,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(DcEssBusFaultGPWS);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.ac2.getValue() < 110 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.ac2.getValue() < 110 and phaseVar != 4 and phaseVar != 8 and AcBus2Fault.clearFlag == 0) {
AcBus2Fault.active = 1;
AcBus2FaultExtract.active = 1;
} else {
@ -1041,7 +1041,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(AcBus2FaultExtract);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() >= 25 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() >= 25 and phaseVar != 4 and phaseVar != 8 and dcBus1Fault.clearFlag == 0) {
dcBus1Fault.active = 1;
dcBus1FaultBlower.active = 1;
dcBus1FaultExtract.active = 1;
@ -1051,7 +1051,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(dcBus1FaultExtract);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dc1.getValue() >= 25 and systems.ELEC.Bus.dc2.getValue() <= 25 and phaseVar != 4 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dc1.getValue() >= 25 and systems.ELEC.Bus.dc2.getValue() <= 25 and phaseVar != 4 and phaseVar != 8 and dcBus2Fault.clearFlag == 0) {
dcBus2Fault.active = 1;
dcBus2FaultAirData.active = 1;
dcBus2FaultBaro.active = 1;
@ -1061,13 +1061,13 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(dcBus2FaultBaro);
}
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dcEmerconfig.active and systems.ELEC.Bus.dcBat.getValue() < 25 and phaseVar != 4 and phaseVar != 5 and phaseVar != 7 and phaseVar != 8) {
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dcEmerconfig.active and systems.ELEC.Bus.dcBat.getValue() < 25 and phaseVar != 4 and phaseVar != 5 and phaseVar != 7 and phaseVar != 8 and dcBusBatFault.clearFlag == 0) {
dcBusBatFault.active = 1;
} else {
ECAM_controller.warningReset(dcBusBatFault);
}
if (!(getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.dcEssShed.getValue() < 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and phaseVar != 4 and phaseVar != 8) {
if (!(getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.dcEssShed.getValue() < 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and phaseVar != 4 and phaseVar != 8 and dcBusEssShed.clearFlag == 0) {
dcBusEssShed.active = 1;
dcBusEssShedExtract.active = 1;
dcBusEssShedIcing.active = 1;
@ -1077,7 +1077,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(dcBusEssShedIcing);
}
if (!(getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.acEssShed.getValue() < 110 and systems.ELEC.Bus.acEss.getValue() >= 110 and phaseVar != 4 and phaseVar != 8) {
if (!(getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.acEssShed.getValue() < 110 and systems.ELEC.Bus.acEss.getValue() >= 110 and phaseVar != 4 and phaseVar != 8 and acBusEssShed.clearFlag == 0) {
acBusEssShed.active = 1;
if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config")) {
acBusEssShedAtc.active = 1;
@ -1089,7 +1089,13 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(acBusEssShedAtc);
}
if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dcEss.getValue() >= 25) {
if (phaseVar != 3 and phaseVar != 4 and phaseVar != 7 and systems.ELEC.Bus.ac1.getValue() and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 1 and tcasFault.clearFlag == 0) {
tcasFault.active = 1;
} else {
ECAM_controller.warningReset(tcasFault);
}
if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault.clearFlag == 0) {
fcuFault.active = 1;
fcuFaultBaro.active = 1;
} else {
@ -1097,7 +1103,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(fcuFaultBaro);
}
if (fcu.FCUController.FCU1.failed and !fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25) {
if (fcu.FCUController.FCU1.failed and !fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault1.clearFlag == 0) {
fcuFault1.active = 1;
fcuFault1Baro.active = 1;
} else {
@ -1105,7 +1111,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(fcuFault1Baro);
}
if (fcu.FCUController.FCU2.failed and !fcu.FCUController.FCU1.failed and systems.ELEC.Bus.dc2.getValue() >= 25) {
if (fcu.FCUController.FCU2.failed and !fcu.FCUController.FCU1.failed and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault2.clearFlag == 0) {
fcuFault2.active = 1;
fcuFault2Baro.active = 1;
} else {

View file

@ -221,6 +221,9 @@ var warnings = std.Vector.new([
var acBusEssShed = warning.new(msg: "ELEC DC ESS BUS SHED", colour: "a", aural: 1, light: 1),
var acBusEssShedAtc = warning.new(msg: " -ATC..............SYS 2", colour: "c"),
# TCAS FAULT
var tcasFault = warning.new(msg: "NAV TCAS FAULT", colour: "a", aural: 1, light: 1),
# FCU fault
var fcuFault = warning.new(msg: "AUTO FLT FCU 1+2 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1),
var fcuFaultBaro = warning.new(msg: " -PFD BARO REF: STD ONLY", colour: "c"),
@ -245,7 +248,6 @@ var warnings = std.Vector.new([
var apuLoopBFault = warning.new(msg: "APU FIRE LOOP B FAULT", colour: "a"),
var crgFwdFireDetFault = warning.new(msg: "FWD CRG DET FAULT", colour: "a"),
var crgAftFireDetFault = warning.new(msg: "AFT CRG DET FAULT", colour: "a"),
# Recall
var recallNormal = warning.new(msg: " ", colour: "g", hasSubmsg: 1),
var recallNormal1 = warning.new(msg: " ", colour: "g", hasSubmsg: 1),

View file

@ -9,6 +9,9 @@ var guiModes = ['OFF', 'STANDBY', 'TEST', 'GROUND', 'ON', 'ALTITUDE'];
var guiNode = props.globals.getNode("/sim/gui/dialogs/radios/transponder-mode", 1);
var forLoopFlag = 0;
var altimeter = props.globals.initNode("/instrumentation/transponder/altimeter-input-src", 0, "INT");
var airspeed = props.globals.initNode("/instrumentation/transponder/airspeed-input-src", 0, "INT");
var Transponder = {
mode: 0,
code: "2000",
@ -97,6 +100,8 @@ var Transponder = {
return;
}
me.activeADIRS = newADIRS;
altimeter.setValue(newADIRS);
airspeed.setValue(newADIRS);
},
modeSwitch: func(newMode) {
me.mode = newMode;
@ -196,6 +201,8 @@ var transponderPanel = {
# update newly selected transponder
Transponders.vector[me.atcSel - 1].modeSwitch(me.modeSel);
me.atcFailLight(Transponders.vector[me.atcSel - 1].failed);
me.updateAirData();
},
modeSwitch: func(newMode) {
if (newMode < 0 or newMode > 5) {
@ -223,11 +230,27 @@ var transponderPanel = {
me.codeDisp = me.code;
me.codeProp.setValue(sprintf("%s", me.codeDisp));
Transponders.vector[me.atcSel - 1].setCode(me.code);
},
updateAirData: func() {
if (me.atcSel == 1) {
if (systems.SwitchingPanel.Switches.airData.getValue() == -1) {
Transponders.vector[0].switchADIRS(3);
} else {
Transponders.vector[0].switchADIRS(1);
}
} else {
if (systems.SwitchingPanel.Switches.airData.getValue() == 1) {
Transponders.vector[1].switchADIRS(3);
} else {
Transponders.vector[1].switchADIRS(2);
}
}
},
};
var init = func() {
transponderPanel.atcSwitch(1);
transponderPanel.updateAirData();
transponderTimer.start();
}

View file

@ -220,6 +220,7 @@ var systemsInit = func {
ecam.ECAM_controller.init();
atc.init();
fcu.FCUController.init();
dmc.DMController.init();
}
setlistener("/sim/signals/fdm-initialized", func {
@ -238,6 +239,7 @@ var systemsLoop = maketimer(0.1, func {
fadec.FADEC.loop();
rmp.rmpUpdate();
fcu.FCUController.loop();
dmc.DMController.loop();
if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/nose") == 0 and getprop("/services/chocks/left") == 0 and getprop("/services/chocks/right") == 0))) {
setprop("/controls/electrical/ground-cart", 0);

View file

@ -45,6 +45,11 @@ var Instrumentation = {
AirspeedIndicator: {
indicatedSpdKt: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt"),
},
TCAS: {
Inputs: {
mode: props.globals.getNode("/instrumentation/tcas/inputs/mode"),
},
},
};
var JSBSIM = {

View file

@ -409,9 +409,8 @@
</quantization>
</sensor>
<fcs_function name="/systems/navigation/adr/computation/mach-1-compute">
<fcs_function name="/systems/navigation/adr/computation/mach-1-product">
<function>
<pow>
<product>
<value>5</value> <!-- 2 / specific heat ratio - 1 -->
<difference>
@ -434,55 +433,75 @@
<value>1</value>
</difference>
</product>
</function>
<clipto>
<min>0</min>
<max>999999999999</max>
</clipto>
</fcs_function>
<fcs_function name="/systems/navigation/adr/computation/mach-1-compute">
<function>
<pow>
<property>/systems/navigation/adr/computation/mach-1-product</property>
<value>0.5</value>
</pow>
</function>
</fcs_function>
<fcs_function name="/systems/navigation/adr/computation/mach-2-product">
<function>
<product>
<value>5</value> <!-- 2 / specific heat ratio - 1 -->
<difference>
<pow>
<sum>
<quotient>
<difference>
<property>/systems/navigation/probes/pitot-2</property> <!-- dynamic pressure -->
<property>/systems/navigation/probes/static-2</property>
</difference>
<property>/systems/navigation/probes/static-2</property> <!-- static pressure -->
</quotient>
<value>1</value>
</sum>
<quotient>
<value>2</value>
<value>7</value>
</quotient>
</pow>
<value>1</value>
</difference>
</product>
</function>
<clipto>
<min>0</min>
<max>999999999999</max>
</clipto>
</fcs_function>
<fcs_function name="/systems/navigation/adr/computation/mach-2-compute">
<function>
<pow>
<product>
<value>5</value>
<difference>
<pow>
<sum>
<quotient>
<difference>
<property>/systems/navigation/probes/pitot-2</property>
<property>/systems/navigation/probes/static-2</property>
</difference>
<property>/systems/navigation/probes/static-2</property>
</quotient>
<value>1</value>
</sum>
<quotient>
<value>2</value>
<value>7</value>
</quotient>
</pow>
<value>1</value>
</difference>
</product>
<property>/systems/navigation/adr/computation/mach-2-product</property>
<value>0.5</value>
</pow>
</function>
</fcs_function>
<fcs_function name="/systems/navigation/adr/computation/mach-3-compute">
<fcs_function name="/systems/navigation/adr/computation/mach-3-product">
<function>
<pow>
<product>
<value>5</value>
<value>5</value> <!-- 2 / specific heat ratio - 1 -->
<difference>
<pow>
<sum>
<quotient>
<difference>
<property>/systems/navigation/probes/pitot-3</property>
<property>/systems/navigation/probes/pitot-3</property> <!-- dynamic pressure -->
<property>/systems/navigation/probes/static-3</property>
</difference>
<property>/systems/navigation/probes/static-3</property>
<property>/systems/navigation/probes/static-3</property> <!-- static pressure -->
</quotient>
<value>1</value>
</sum>
@ -494,6 +513,17 @@
<value>1</value>
</difference>
</product>
</function>
<clipto>
<min>0</min>
<max>999999999999</max>
</clipto>
</fcs_function>
<fcs_function name="/systems/navigation/adr/computation/mach-3-compute">
<function>
<pow>
<property>/systems/navigation/adr/computation/mach-3-product</property>
<value>0.5</value>
</pow>
</function>
@ -914,6 +944,31 @@
<max>5000</max>
</clipto>
</pure_gain>
<switch name="/instrumentation/transponder/altimeter-input">
<test logic="AND" value="/systems/navigation/adr/output/baro-alt-corrected-1-capt">
/instrumentation/transponder/altimeter-input-src eq 1
</test>
<test logic="AND" value="/systems/navigation/adr/output/baro-alt-corrected-2-capt">
/instrumentation/transponder/altimeter-input-src eq 2
</test>
<test logic="AND" value="/systems/navigation/adr/output/baro-alt-corrected-3-capt">
/instrumentation/transponder/altimeter-input-src eq 3
</test>
</switch>
<switch name="/instrumentation/transponder/airspeed-input">
<test logic="AND" value="/systems/navigation/adr/output/cas-1">
/instrumentation/transponder/airspeed-input-src eq 1
</test>
<test logic="AND" value="/systems/navigation/adr/output/cas-2">
/instrumentation/transponder/airspeed-input-src eq 2
</test>
<test logic="AND" value="/systems/navigation/adr/output/cas-3">
/instrumentation/transponder/airspeed-input-src eq 3
</test>
</switch>
</channel>
</system>

View file

@ -224,6 +224,8 @@
<name>transponder</name>
<number>0</number>
<mode>2</mode>
<encoder-path>/instrumentation/transponder/altimeter-input</encoder-path>
<airspeed-path>/instrumentation/transponder/airspeed-input</airspeed-path>
<mode-c-altitude>/instrumentation/encoder/mode-c-alt-ft</mode-c-altitude>
<mode-s-altitude>/instrumentation/encoder/mode-s-alt-ft</mode-s-altitude>
</transponder>
@ -252,8 +254,6 @@
<intruder-use-own-alt>1</intruder-use-own-alt>
<intruder-inhibit-alt-ft>380</intruder-inhibit-alt-ft>
<intruder-minimum-own-alt-ft>1700</intruder-minimum-own-alt-ft> uncomment for 2019.3 -->
<power-supply>/systems/electrical/bus/ac-1</power-supply>
<minimum-supply-volts>109.9</minimum-supply-volts>
</tcas>
<radar>

View file

@ -174,12 +174,46 @@
<input>
<expression>
<difference>
<property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
<property>/systems/navigation/adr/output/cas-1</property>
<value>30</value>
</difference>
</expression>
</input>
<output>/instrumentation/pfd/speed-minus-30</output>
<output>/instrumentation/pfd/speed-minus-30-1</output>
<min>0</min>
<max>390</max>
</filter>
<filter>
<name>Speed Predictor Input</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<difference>
<property>/systems/navigation/adr/output/cas-2</property>
<value>30</value>
</difference>
</expression>
</input>
<output>/instrumentation/pfd/speed-minus-30-2</output>
<min>0</min>
<max>390</max>
</filter>
<filter>
<name>Speed Predictor Input</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<difference>
<property>/systems/navigation/adr/output/cas-3</property>
<value>30</value>
</difference>
</expression>
</input>
<output>/instrumentation/pfd/speed-minus-30-3</output>
<min>0</min>
<max>390</max>
</filter>
@ -193,12 +227,57 @@
<filter-gain>0.01</filter-gain>
</predict-simple>
<predict-simple>
<name>Speed Predictor (Smoothed)</name>
<debug>false</debug>
<input>/instrumentation/pfd/speed-minus-30-1</input>
<output>/instrumentation/pfd/speed-lookahead-cmd-1</output>
<seconds>10.0</seconds>
<filter-gain>0.01</filter-gain>
</predict-simple>
<predict-simple>
<name>Speed Predictor (Smoothed)</name>
<debug>false</debug>
<input>/instrumentation/pfd/speed-minus-30-2</input>
<output>/instrumentation/pfd/speed-lookahead-cmd-2</output>
<seconds>10.0</seconds>
<filter-gain>0.01</filter-gain>
</predict-simple>
<predict-simple>
<name>Speed Predictor (Smoothed)</name>
<debug>false</debug>
<input>/instrumentation/pfd/speed-minus-30-3</input>
<output>/instrumentation/pfd/speed-lookahead-cmd-3</output>
<seconds>10.0</seconds>
<filter-gain>0.01</filter-gain>
</predict-simple>
<filter>
<name>Speed Predictor Exponential</name>
<debug>false</debug>
<type>exponential</type>
<input>/instrumentation/pfd/speed-lookahead-cmd</input>
<output>/instrumentation/pfd/speed-lookahead</output>
<input>/instrumentation/pfd/speed-lookahead-cmd-1</input>
<output>/instrumentation/pfd/speed-lookahead-1</output>
<filter-time>0.32</filter-time>
</filter>
<filter>
<name>Speed Predictor Exponential</name>
<debug>false</debug>
<type>exponential</type>
<input>/instrumentation/pfd/speed-lookahead-cmd-2</input>
<output>/instrumentation/pfd/speed-lookahead-2</output>
<filter-time>0.32</filter-time>
</filter>
<filter>
<name>Speed Predictor Exponential</name>
<debug>false</debug>
<type>exponential</type>
<input>/instrumentation/pfd/speed-lookahead-cmd-3</input>
<output>/instrumentation/pfd/speed-lookahead-3</output>
<filter-time>0.32</filter-time>
</filter>