Merge branch 'dev' of https://github.com/vezza/A320-family into vezza-dev
This commit is contained in:
commit
f37f60afb2
3 changed files with 318 additions and 86 deletions
|
@ -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 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 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 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 at_box = props.globals.getNode("/modes/pfd/fma/athr-mode-box", 1);
|
||||||
var fbw_law = props.globals.getNode("/it-fbw/law", 1);
|
var fbw_law = props.globals.getNode("/it-fbw/law", 1);
|
||||||
var ap_mode = props.globals.getNode("/modes/pfd/fma/ap-mode", 1);
|
var ap_mode = props.globals.getNode("/modes/pfd/fma/ap-mode", 1);
|
||||||
|
@ -110,6 +110,13 @@ var aileron_input = props.globals.getNode("/controls/flight/aileron-input-fast",
|
||||||
var elevator_input = props.globals.getNode("/controls/flight/elevator-input-fast", 1);
|
var elevator_input = props.globals.getNode("/controls/flight/elevator-input-fast", 1);
|
||||||
var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1);
|
var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1);
|
||||||
var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 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_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:
|
# Create Nodes:
|
||||||
var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE");
|
var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE");
|
||||||
|
@ -159,7 +166,7 @@ var canvas_PFD_base = {
|
||||||
tran_rect[2], # 1 xe
|
tran_rect[2], # 1 xe
|
||||||
tran_rect[3], # 2 ye
|
tran_rect[3], # 2 ye
|
||||||
tran_rect[0]); #3 xs
|
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", clip_rect);
|
||||||
me[key].set("clip-frame", canvas.Element.PARENT);
|
me[key].set("clip-frame", canvas.Element.PARENT);
|
||||||
}
|
}
|
||||||
|
@ -187,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",
|
"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",
|
"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",
|
"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","ils_code","ils_freq","dme_dist","dme_dist_legend"];
|
||||||
},
|
},
|
||||||
updateDu1: func() {
|
updateDu1: func() {
|
||||||
var elapsedtime_act = elapsedtime.getValue();
|
var elapsedtime_act = elapsedtime.getValue();
|
||||||
|
@ -349,7 +356,7 @@ var canvas_PFD_base = {
|
||||||
me["FMA_man_box"].hide();
|
me["FMA_man_box"].hide();
|
||||||
me["FMA_flx_box"].show();
|
me["FMA_flx_box"].show();
|
||||||
me["FMA_flxtemp"].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);
|
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)) {
|
} 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();
|
me["FMA_flx_box"].hide();
|
||||||
|
@ -379,7 +386,7 @@ var canvas_PFD_base = {
|
||||||
me["FMA_man_box"].hide();
|
me["FMA_man_box"].hide();
|
||||||
me["FMA_flx_box"].show();
|
me["FMA_flx_box"].show();
|
||||||
me["FMA_flxtemp"].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);
|
me["FMA_man_box"].setColor(0.8078,0.8039,0.8078);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -612,7 +619,7 @@ var canvas_PFD_base = {
|
||||||
updateCommonFast: func() {
|
updateCommonFast: func() {
|
||||||
# Attitude Indicator
|
# Attitude Indicator
|
||||||
pitch_cur = pitch.getValue();
|
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_trans.setTranslation(0, pitch_cur * 11.825);
|
||||||
me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter());
|
me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter());
|
||||||
|
@ -829,9 +836,22 @@ var canvas_PFD_1 = {
|
||||||
if (ap_ils_mode.getValue() == 1) {
|
if (ap_ils_mode.getValue() == 1) {
|
||||||
me["LOC_scale"].show();
|
me["LOC_scale"].show();
|
||||||
me["GS_scale"].show();
|
me["GS_scale"].show();
|
||||||
|
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();
|
||||||
|
if (dme_in_range.getValue() == 1) {
|
||||||
|
me["dme_dist"].setText(sprintf("%2.0f", int(dme_data.getValue())));
|
||||||
|
me["dme_dist"].show();
|
||||||
|
me["dme_dist_legend"].show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
me["LOC_scale"].hide();
|
me["LOC_scale"].hide();
|
||||||
me["GS_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) {
|
if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) {
|
||||||
|
@ -845,6 +865,12 @@ var canvas_PFD_1 = {
|
||||||
me["GS_pointer"].hide();
|
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();
|
me.updateCommon();
|
||||||
},
|
},
|
||||||
updateFast: func() {
|
updateFast: func() {
|
||||||
|
@ -1118,9 +1144,23 @@ var canvas_PFD_2 = {
|
||||||
if (ap_ils_mode2.getValue() == 1) {
|
if (ap_ils_mode2.getValue() == 1) {
|
||||||
me["LOC_scale"].show();
|
me["LOC_scale"].show();
|
||||||
me["GS_scale"].show();
|
me["GS_scale"].show();
|
||||||
|
# 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();
|
||||||
|
if (dme_in_range.getValue() == 1) {
|
||||||
|
me["dme_dist"].setText(sprintf("%2.0f", int(dme_data.getValue())));
|
||||||
|
me["dme_dist"].show();
|
||||||
|
me["dme_dist_legend"].show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
me["LOC_scale"].hide();
|
me["LOC_scale"].hide();
|
||||||
me["GS_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) {
|
if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) {
|
||||||
|
@ -1134,6 +1174,12 @@ var canvas_PFD_2 = {
|
||||||
me["GS_pointer"].hide();
|
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();
|
me.updateCommon();
|
||||||
},
|
},
|
||||||
updateFast: func() {
|
updateFast: func() {
|
||||||
|
|
|
@ -37,16 +37,16 @@
|
||||||
guidetolerance="10"
|
guidetolerance="10"
|
||||||
inkscape:pageopacity="1"
|
inkscape:pageopacity="1"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:window-width="1366"
|
inkscape:window-width="716"
|
||||||
inkscape:window-height="705"
|
inkscape:window-height="403"
|
||||||
id="namedview371"
|
id="namedview371"
|
||||||
showgrid="false"
|
showgrid="true"
|
||||||
inkscape:zoom="2.0149341"
|
inkscape:zoom="1.025"
|
||||||
inkscape:cx="51.385843"
|
inkscape:cx="678.88837"
|
||||||
inkscape:cy="279.39354"
|
inkscape:cy="332.98605"
|
||||||
inkscape:window-x="-8"
|
inkscape:window-x="-8"
|
||||||
inkscape:window-y="-8"
|
inkscape:window-y="0"
|
||||||
inkscape:window-maximized="1"
|
inkscape:window-maximized="0"
|
||||||
inkscape:current-layer="svg2"
|
inkscape:current-layer="svg2"
|
||||||
showguides="true"
|
showguides="true"
|
||||||
inkscape:snap-global="false"
|
inkscape:snap-global="false"
|
||||||
|
@ -4875,4 +4875,61 @@
|
||||||
x="34.684372"
|
x="34.684372"
|
||||||
y="874.4469"
|
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</tspan></text>
|
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</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:30px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:0.75;"
|
||||||
|
x="667.37634"
|
||||||
|
y="855.60309"
|
||||||
|
id="ilsError"
|
||||||
|
inkscape:label="#text1608"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
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</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:38.98999884px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.75;"
|
||||||
|
x="34.684372"
|
||||||
|
y="935.95209"
|
||||||
|
id="ils_code"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan978"
|
||||||
|
x="34.684372"
|
||||||
|
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</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:38.98999884px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.75;"
|
||||||
|
x="34.684372"
|
||||||
|
y="974.72784"
|
||||||
|
id="ils_freq"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan979"
|
||||||
|
x="34.684372"
|
||||||
|
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</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:38.98999884px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.75;"
|
||||||
|
x="34.684372"
|
||||||
|
y="1013.5292"
|
||||||
|
id="dme_dist"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan780"
|
||||||
|
x="34.684372"
|
||||||
|
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</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:30.00000191px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:0.75"
|
||||||
|
x="116.45473"
|
||||||
|
y="1014.0706"
|
||||||
|
id="dme_dist_legend"
|
||||||
|
inkscape:label="#dme_dist-5"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan780-3"
|
||||||
|
x="116.45473"
|
||||||
|
y="1014.0706"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:24px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#179ab7;fill-opacity:1;stroke-width:0.75">NM</tspan></text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 280 KiB |
|
@ -24,7 +24,11 @@
|
||||||
# "overheated brakes", any level <=1 means "brake temperature OK".
|
# "overheated brakes", any level <=1 means "brake temperature OK".
|
||||||
# No exact science here - but good enough for now :-).
|
# No exact science here - but good enough for now :-).
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
#
|
||||||
|
# Added brakes temp calculations and adapted for A320-family
|
||||||
|
# 2020, Andrea Vezzali
|
||||||
|
#
|
||||||
|
##########################################################################
|
||||||
var BrakeSystem =
|
var BrakeSystem =
|
||||||
{
|
{
|
||||||
new : func()
|
new : func()
|
||||||
|
@ -33,14 +37,14 @@ var BrakeSystem =
|
||||||
# deceleration caused by brakes alone (knots/s2)
|
# deceleration caused by brakes alone (knots/s2)
|
||||||
m.BrakeDecel = 1.0; # kt/s^2
|
m.BrakeDecel = 1.0; # kt/s^2
|
||||||
# Higher value means quicker cooling
|
# Higher value means quicker cooling
|
||||||
m.CoolingFactor = 0.0005;
|
m.CoolingFactor = 0.00005;
|
||||||
# Scaling divisor. Use this to scale the energy output.
|
# Scaling divisor. Use this to scale the energy output.
|
||||||
# Manually tune this value: a total energy output
|
# Manually tune this value: a total energy output
|
||||||
# at "/gear/brake-thermal-energy" > 1.0 means overheated brakes,
|
# at "/gear/brake-thermal-energy" > 1.0 means overheated brakes,
|
||||||
# anything below <= 1.0 means energy absorbed by brakes is OK.
|
# anything below <= 1.0 means energy absorbed by brakes is OK.
|
||||||
#m.ScalingDivisor= 700000*450.0;
|
#m.ScalingDivisor= 700000*450.0;
|
||||||
|
|
||||||
m.ScalingDivisor = 0.000000007;
|
m.ScalingDivisor = 0.000000006;
|
||||||
|
|
||||||
m.LSmokeActive = 0;
|
m.LSmokeActive = 0;
|
||||||
m.LSmokeToggle = 0;
|
m.LSmokeToggle = 0;
|
||||||
|
@ -56,33 +60,35 @@ var BrakeSystem =
|
||||||
reset : func()
|
reset : func()
|
||||||
{
|
{
|
||||||
# Initial thermal energy
|
# Initial thermal energy
|
||||||
setprop("controls/gear/brake-fans",0);
|
|
||||||
setprop("gear/gear[1]/Lbrake-thermal-energy",0.0);
|
setprop("gear/gear[1]/Lbrake-thermal-energy",0.0);
|
||||||
setprop("gear/gear[2]/Rbrake-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[1]/Lbrake-smoke",0);
|
||||||
setprop("gear/gear[2]/Rbrake-smoke",0);
|
setprop("gear/gear[2]/Rbrake-smoke",0);
|
||||||
setprop("gear/gear[1]/L1brake-temp-degc",getprop("environment/temperature-degc"));
|
setprop("gear/gear[1]/L-Thrust",0);
|
||||||
setprop("gear/gear[1]/L2brake-temp-degc",getprop("environment/temperature-degc"));
|
setprop("gear/gear[2]/R-Thrust",0);
|
||||||
setprop("gear/gear[2]/R3brake-temp-degc",getprop("environment/temperature-degc"));
|
|
||||||
setprop("gear/gear[2]/R4brake-temp-degc",getprop("environment/temperature-degc"));
|
#Introducing a random error on temp sensors (max 5°C)
|
||||||
setprop("gear/gear[1]/L1brake-temp-degf",getprop("environment/temperature-degf"));
|
setprop("gear/gear[1]/L1error-temp-degc", math.round(rand()*(5)));
|
||||||
setprop("gear/gear[1]/L2brake-temp-degf",getprop("environment/temperature-degf"));
|
setprop("gear/gear[1]/L2error-temp-degc", math.round(rand()*(5)));
|
||||||
setprop("gear/gear[2]/R3brake-temp-degf",getprop("environment/temperature-degf"));
|
setprop("gear/gear[2]/R3error-temp-degc", math.round(rand()*(5)));
|
||||||
setprop("gear/gear[2]/R4brake-temp-degf",getprop("environment/temperature-degf"));
|
setprop("gear/gear[2]/R4error-temp-degc", math.round(rand()*(5)));
|
||||||
|
|
||||||
#Introducing a random error on the brakes temp sensors
|
var atemp = getprop("environment/temperature-degc") or 0;
|
||||||
if (rand() > 0.5)
|
var vmach = getprop("velocities/mach") or 0;
|
||||||
{
|
var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2)));
|
||||||
setprop("gear/gear[1]/L1error_temp_degc", math.round(rand()*5));
|
var tatdegf = 32+(1.8 * tatdegc);
|
||||||
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[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc"));
|
||||||
setprop("gear/gear[2]/R4error_temp_degc", math.round(rand()*5));
|
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc"));
|
||||||
} else {
|
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc"));
|
||||||
setprop("gear/gear[1]/L1error_temp_degc", math.round(rand()*(-5)));
|
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc"));
|
||||||
setprop("gear/gear[1]/L2error_temp_degc", math.round(rand()*(-5)));
|
setprop("gear/gear[1]/L1brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[1]/L1brake-temp-degc")));
|
||||||
setprop("gear/gear[2]/R3error_temp_degc", math.round(rand()*(-5)));
|
setprop("gear/gear[1]/L2brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[1]/L2brake-temp-degc")));
|
||||||
setprop("gear/gear[2]/R4error_temp_degc", math.round(rand()*(-5)));
|
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);
|
setprop("sim/animation/fire-services",0);
|
||||||
me.LastSimTime = 0.0;
|
me.LastSimTime = 0.0;
|
||||||
},
|
},
|
||||||
|
@ -92,69 +98,192 @@ var BrakeSystem =
|
||||||
{
|
{
|
||||||
var CurrentTime = getprop("sim/time/elapsed-sec");
|
var CurrentTime = getprop("sim/time/elapsed-sec");
|
||||||
var dt = CurrentTime - me.LastSimTime;
|
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)
|
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 OnGround = getprop("gear/gear[1]/wow");
|
||||||
var CoolingRatio = me.CoolingFactor+(getprop("environment/temperature-degf")*0.00001);
|
#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"))
|
if (getprop("controls/gear/brake-fans"))
|
||||||
{
|
{
|
||||||
#increase CoolingRatio if Brake Fans are active
|
#increase CoolingRatio if Brake Fans are active
|
||||||
CoolingRatio = CoolingRatio * 3;
|
LCoolingRatio = LCoolingRatio * 3;
|
||||||
|
RCoolingRatio = RCoolingRatio * 3;
|
||||||
}
|
}
|
||||||
|
if (getprop("gear/gear[1]/position-norm"))
|
||||||
var nCoolFactor = math.ln(1-CoolingRatio);
|
{
|
||||||
|
#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");
|
L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb"));
|
||||||
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy");
|
if (L_thrust_lb < 1)
|
||||||
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy");
|
{
|
||||||
|
L_thrust_lb = 1
|
||||||
var LBrakeLevel = getprop("fdm/jsbsim/fcs/left-brake-cmd-norm");
|
}
|
||||||
var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm");
|
L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.000000001;
|
||||||
#}
|
|
||||||
var BrakeLevel = (LBrakeLevel + RBrakeLevel)/2;
|
R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb"));
|
||||||
if ((OnGround)and(BrakeLevel>0))
|
if (R_thrust_lb < 1)
|
||||||
{
|
{
|
||||||
# absorb more energy
|
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 V1 = getprop("velocities/groundspeed-kt");
|
||||||
var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor);
|
var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor);
|
||||||
|
|
||||||
# absorb some kinetic energy:
|
# absorb some kinetic energy:
|
||||||
# dE= 1/2 * m * V1^2 - 1/2 * m * V2^2)
|
# 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;
|
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
|
||||||
# do not absorb more energy when plane is (almost) stopped
|
|
||||||
# Thermal energy computation
|
#TODO - Adjust ThermalEnergy according to differential braking
|
||||||
if (V2_L>0)
|
#LBrakeLevel-RBrakeLevel
|
||||||
{
|
|
||||||
LThermalEnergy += Mass * (V1*V1 - V2_L*V2_L)/2;
|
LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
|
||||||
# cooling effect: reduce thermal energy by (nCoolFactor)^dt
|
if (getprop("services/chocks/left"))
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(nCoolFactor * dt);
|
{
|
||||||
} else {
|
if (!getprop("controls/gear/brake-parking"))
|
||||||
# cooling effect: reduced cooling when speed = 0 and brakes on
|
{
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(nCoolFactor * 0.3 * dt);
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
}
|
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
||||||
if (V2_R>0)
|
} else {
|
||||||
{
|
#LThermalEnergy += L_Thrust;
|
||||||
RThermalEnergy += Mass * (V1*V1 - V2_R*V2_R)/2;
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
# cooling effect: reduce thermal energy by (nCoolFactor)^dt
|
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(nCoolFactor * dt);
|
}
|
||||||
} else {
|
} else {
|
||||||
# cooling effect: reduced cooling when speed = 0 and brakes on
|
if (!getprop("controls/gear/brake-parking"))
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(nCoolFactor * 0.3 * dt);
|
{
|
||||||
}
|
if (LBrakeLevel>0)
|
||||||
} else {
|
{
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(nCoolFactor * dt);
|
if (V2_L>0)
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(nCoolFactor * dt);
|
{
|
||||||
}
|
#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[1]/Lbrake-thermal-energy",LThermalEnergy);
|
||||||
setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy);
|
setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy);
|
||||||
|
|
||||||
#Calculating Brakes temperature
|
#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]/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",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[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",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]/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",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[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]/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[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"))));
|
setprop("gear/gear[2]/R3brake-temp-degf",(32 + (1.8 * getprop("gear/gear[2]/R3brake-temp-degc"))));
|
||||||
|
|
Loading…
Add table
Reference in a new issue