Merge branch 'master' into MCDU

This commit is contained in:
Joshua Davidson 2017-12-14 21:29:37 -05:00
commit 23ace333a1
17 changed files with 230 additions and 77 deletions

View file

@ -10,7 +10,7 @@
<sim> <sim>
<author>it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555), Charlie Schwehm (Wecsje)</author> <author>it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555)</author>
<status>Pre V1.0</status> <status>Pre V1.0</status>

View file

@ -43,7 +43,7 @@
</text> </text>
<text> <text>
<halign>left</halign> <halign>left</halign>
<label>Joshua Davidson (it0uchpods), Jonanthan Redpath (legoboyvdlp), Charlie Schwehm (Wecsje), J Maverick 16, Thorsten Herrmann (TH-555)</label> <label>Joshua Davidson (it0uchpods), Jonanthan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555)</label>
</text> </text>
<hrule/> <hrule/>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>controls/lighting/landing-lights[1]</use></intensity_scale> <intensity_scale type="float"><use>controls/lighting/landing-lights[1]</use></intensity_scale>
<pointing_x type="float">1</pointing_x> <pointing_x type="float">1</pointing_x>
<pointing_y type="float">0.0</pointing_y> <pointing_y type="float">0.0</pointing_y>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>controls/lighting/landing-lights[2]</use></intensity_scale> <intensity_scale type="float"><use>controls/lighting/landing-lights[2]</use></intensity_scale>
<pointing_x type="float">1</pointing_x> <pointing_x type="float">1</pointing_x>
<pointing_y type="float">0.0</pointing_y> <pointing_y type="float">0.0</pointing_y>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>sim/model/lights/strobe/state</use></intensity_scale> <intensity_scale type="float"><use>sim/model/lights/strobe/state</use></intensity_scale>
<pointing_x type="float">-1</pointing_x> <pointing_x type="float">-1</pointing_x>
<pointing_y type="float">0.70710678</pointing_y> <pointing_y type="float">0.70710678</pointing_y>

View file

@ -12,9 +12,10 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <intensity_scale type="float"><use>sim/model/lights/strobe/state</use></intensity_scale> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>sim/model/lights/strobe/state</use></intensity_scale>
<pointing_x type="float">-1</pointing_x> <pointing_x type="float">-1</pointing_x>
<pointing_y type="float">-0.70710678</pointing_y> <pointing_y type="float">-0.70710678</pointing_y>
<pointing_z type="float">0.0</pointing_z> <pointing_z type="float">0.0</pointing_z>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>sim/model/lights/tailstrobe/state</use></intensity_scale> <intensity_scale type="float"><use>sim/model/lights/tailstrobe/state</use></intensity_scale>
<pointing_x type="float">-1.0</pointing_x> <pointing_x type="float">-1.0</pointing_x>
<pointing_y type="float">0.0</pointing_y> <pointing_y type="float">0.0</pointing_y>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.85</light_color_base_r> <light_color_base_r type="float">0.85</light_color_base_r>
<light_color_base_g type="float">0.85</light_color_base_g> <light_color_base_g type="float">0.85</light_color_base_g>
<light_color_base_b type="float">0.99</light_color_base_b> <light_color_base_b type="float">0.99</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>/sim/model/lights/nav-lights</use></intensity_scale> <intensity_scale type="float"><use>/sim/model/lights/nav-lights</use></intensity_scale>
<pointing_x type="float">-1.0</pointing_x> <pointing_x type="float">-1.0</pointing_x>
<pointing_y type="float">0</pointing_y> <pointing_y type="float">0</pointing_y>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>/sim/model/lights/nose-lights</use></intensity_scale> <intensity_scale type="float"><use>/sim/model/lights/nose-lights</use></intensity_scale>
<pointing_x type="float">1</pointing_x> <pointing_x type="float">1</pointing_x>
<pointing_y type="float">0.0</pointing_y> <pointing_y type="float">0.0</pointing_y>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>controls/lighting/leftturnoff</use></intensity_scale> <intensity_scale type="float"><use>controls/lighting/leftturnoff</use></intensity_scale>
<pointing_x type="float">1.0</pointing_x> <pointing_x type="float">1.0</pointing_x>
<pointing_y type="float">0.75</pointing_y> <pointing_y type="float">0.75</pointing_y>

View file

@ -12,9 +12,9 @@
<light_color_base_r type="float">0.46</light_color_base_r> <light_color_base_r type="float">0.46</light_color_base_r>
<light_color_base_g type="float">0.46</light_color_base_g> <light_color_base_g type="float">0.46</light_color_base_g>
<light_color_base_b type="float">0.63</light_color_base_b> <light_color_base_b type="float">0.63</light_color_base_b>
<light_color_center_r type="float">0.98</light_color_center_r> <light_color_center_r type="float">1.00</light_color_center_r> <!-- aviation white converted from 5500 K temp -->
<light_color_center_g type="float">0.98</light_color_center_g> <light_color_center_g type="float">0.93</light_color_center_g>
<light_color_center_b type="float">0.98</light_color_center_b> <light_color_center_b type="float">0.87</light_color_center_b>
<intensity_scale type="float"><use>controls/lighting/rightturnoff</use></intensity_scale> <intensity_scale type="float"><use>controls/lighting/rightturnoff</use></intensity_scale>
<pointing_x type="float"> 1.0</pointing_x> <pointing_x type="float"> 1.0</pointing_x>
<pointing_y type="float">-0.75</pointing_y> <pointing_y type="float">-0.75</pointing_y>

View file

@ -26,6 +26,19 @@ setlistener("/sim/signals/fdm-initialized", func {
var FPangle = 0; var FPangle = 0;
var gear1 = getprop("/gear/gear[1]/wow"); var gear1 = getprop("/gear/gear[1]/wow");
var gear2 = getprop("/gear/gear[2]/wow"); var gear2 = getprop("/gear/gear[2]/wow");
var gnds_mps = 0;
var current_course = 0;
var wp_fly_to = 0;
var next_course = 0;
var max_bank_limit = 0;
var delta_angle = 0;
var max_bank = 0;
var radius = 0;
var time = 0;
var delta_angle_rad = 0;
var R = 0;
var dist_coeff = 0;
var turn_dist = 0;
}); });
var APinit = func { var APinit = func {
@ -525,6 +538,10 @@ var trkfpa_on = func {
} }
} }
setlistener("/autopilot/route-manager/current-wp", func {
setprop("/autopilot/internal/wp-change-time", getprop("/sim/time/elapsed-sec"));
});
var ap_various = func { var ap_various = func {
trueSpeedKts = getprop("/instrumentation/airspeed-indicator/true-speed-kt"); trueSpeedKts = getprop("/instrumentation/airspeed-indicator/true-speed-kt");
if (trueSpeedKts > 420) { if (trueSpeedKts > 420) {
@ -536,7 +553,35 @@ var ap_various = func {
} }
if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) { if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) {
if (getprop("/autopilot/route-manager/wp/dist") <= getprop("/it-autoflight/internal/lnav-advance-nm")) { gnds_mps = getprop("/velocities/groundspeed-kt") * 0.5144444444444;
current_course = getprop("/instrumentation/gps/wp/leg-true-course-deg");
wp_fly_to = getprop("/autopilot/route-manager/current-wp") + 1;
if (wp_fly_to < 0) {
wp_fly_to = 0;
}
next_course = getprop("/autopilot/route-manager/route/wp["~wp_fly_to~"]/leg-bearing-true-deg");
max_bank_limit = getprop("/it-autoflight/internal/bank-limit");
delta_angle = math.abs(geo.normdeg180(current_course - next_course));
max_bank = delta_angle * 1.5;
if (max_bank > max_bank_limit) {
max_bank = max_bank_limit;
}
radius = (gnds_mps * gnds_mps) / (9.81 * math.tan(max_bank/57.2957795131));
time = 0.64 * gnds_mps * delta_angle * 0.7 / (360 * math.tan(max_bank/57.2957795131));
delta_angle_rad = (180 - delta_angle) / 114.5915590262;
R = radius/math.sin(delta_angle_rad);
dist_coeff = delta_angle * -0.011111 + 2;
if (dist_coeff < 1) {
ist_coeff = 1;
}
turn_dist = math.cos(delta_angle_rad) * R * dist_coeff / 1852;
setprop("/it-autoflight/internal/lnav-advance-nm", turn_dist);
if (getprop("/sim/time/elapsed-sec")-getprop("/autopilot/internal/wp-change-time") > 60) {
setprop("/autopilot/internal/wp-change-check-period", time);
}
if (getprop("/autopilot/route-manager/wp/dist") <= turn_dist) {
if ((getprop("/autopilot/route-manager/current-wp") + 1) < getprop("/autopilot/route-manager/route/num")) { if ((getprop("/autopilot/route-manager/current-wp") + 1) < getprop("/autopilot/route-manager/route/num")) {
setprop("/autopilot/route-manager/current-wp", getprop("/autopilot/route-manager/current-wp") + 1); setprop("/autopilot/route-manager/current-wp", getprop("/autopilot/route-manager/current-wp") + 1);
} }

View file

@ -13,6 +13,12 @@ var dc_amps_std = 150;
var ac_hz_std = 400; var ac_hz_std = 400;
var ac1_src = "XX"; var ac1_src = "XX";
var ac2_src = "XX"; var ac2_src = "XX";
var power_consumption = nil;
var screen_power_consumption = nil;
var screens = nil;
var lpower_consumption = nil;
var light_power_consumption = nil;
var lights = nil;
setlistener("/sim/signals/fdm-initialized", func { setlistener("/sim/signals/fdm-initialized", func {
var galley_sw = getprop("/controls/electrical/switches/galley"); var galley_sw = getprop("/controls/electrical/switches/galley");
@ -37,6 +43,7 @@ setlistener("/sim/signals/fdm-initialized", func {
var ac1 = getprop("/systems/electrical/bus/ac1"); var ac1 = getprop("/systems/electrical/bus/ac1");
var ac2 = getprop("/systems/electrical/bus/ac2"); var ac2 = getprop("/systems/electrical/bus/ac2");
var ac_ess = getprop("/systems/electrical/bus/ac-ess"); var ac_ess = getprop("/systems/electrical/bus/ac-ess");
var ac_ess_shed = getprop("/systems/electrical/bus/ac-ess-shed");
var dc1 = getprop("/systems/electrical/bus/dc1"); var dc1 = getprop("/systems/electrical/bus/dc1");
var dc2 = getprop("/systems/electrical/bus/dc2"); var dc2 = getprop("/systems/electrical/bus/dc2");
var dcbat = getprop("/systems/electrical/bus/dcbat"); var dcbat = getprop("/systems/electrical/bus/dcbat");
@ -58,11 +65,77 @@ setlistener("/sim/signals/fdm-initialized", func {
var bat1_volts = getprop("/systems/electrical/battery1-volts"); var bat1_volts = getprop("/systems/electrical/battery1-volts");
var bat2_volts = getprop("/systems/electrical/battery2-volts"); var bat2_volts = getprop("/systems/electrical/battery2-volts");
var replay = getprop("/sim/replay/replay-state"); var replay = getprop("/sim/replay/replay-state");
var wow = getprop("/gear/gear[1]/wow");
}); });
# Power Consumption, cockpit screens
# According to pprune, each LCD uses 60W. Will assume that it reduces linearly to ~50 watts when dimmed, and to 0 watts when off
var screen = {
name: "",
type: "", # LCD or CRT, will be used later when we have CRTs
max_watts: 0,
dim_watts: 0,
dim_prop: "",
elec_prop: "",
power_consumption: func() {
var dim_prop = me.dim_prop;
if (getprop(me.dim_prop) != 0) {
screen_power_consumption = (50 + (10 * getprop(dim_prop)));
} else {
screen_power_consumption = 0;
}
return screen_power_consumption;
},
new: func(name,type,max_watts,dim_watts,dim_prop,elec_prop) {
var s = {parents:[screen]};
s.name = name;
s.type = type;
s.max_watts = max_watts;
s.dim_watts = dim_watts;
s.dim_prop = dim_prop;
s.elec_prop = elec_prop;
return s;
}
};
# Power Consumption, lights
# from docs found on google
var light = {
name: "",
max_watts: 0,
control_prop: "",
elec_prop: "",
power_consumption: func() {
if (getprop(me.control_prop) != 0 and getprop(me.elec_prop) != 0) {
light_power_consumption = me.max_watts;
} else {
light_power_consumption = 0;
}
return light_power_consumption;
},
new: func(name,max_watts,control_prop,elec_prop) {
var l = {parents:[light]};
l.name = name;
l.max_watts = max_watts;
l.control_prop = control_prop;
l.elec_prop = elec_prop;
return l;
}
};
# Main Elec System
var ELEC = { var ELEC = {
init: func() { init: func() {
setprop("/controls/switches/annun-test", 0); setprop("/controls/switches/annun-test", 0);
setprop("/systems/electrical/nav-lights-power", 0);
setprop("/controls/electrical/switches/galley", 1); setprop("/controls/electrical/switches/galley", 1);
setprop("/controls/electrical/switches/idg1", 0); setprop("/controls/electrical/switches/idg1", 0);
setprop("/controls/electrical/switches/idg2", 0); setprop("/controls/electrical/switches/idg2", 0);
@ -90,6 +163,7 @@ var ELEC = {
setprop("/systems/electrical/bus/gen1-hz", 0); setprop("/systems/electrical/bus/gen1-hz", 0);
setprop("/systems/electrical/bus/gen2-hz", 0); setprop("/systems/electrical/bus/gen2-hz", 0);
setprop("/systems/electrical/bus/ac-ess", 0); setprop("/systems/electrical/bus/ac-ess", 0);
setprop("/systems/electrical/bus/ac-ess-shed", 0);
setprop("/systems/electrical/extra/ext-volts", 0); setprop("/systems/electrical/extra/ext-volts", 0);
setprop("/systems/electrical/extra/apu-volts", 0); setprop("/systems/electrical/extra/apu-volts", 0);
setprop("/systems/electrical/extra/gen1-volts", 0); setprop("/systems/electrical/extra/gen1-volts", 0);
@ -145,6 +219,33 @@ var ELEC = {
setprop("/systems/electrical/outputs/taxi-lights", 0); setprop("/systems/electrical/outputs/taxi-lights", 0);
setprop("/systems/electrical/outputs/transponder", 0); setprop("/systems/electrical/outputs/transponder", 0);
setprop("/systems/electrical/outputs/turn-coordinator", 0); setprop("/systems/electrical/outputs/turn-coordinator", 0);
screens = [screen.new(name: "DU1", type:"LCD", max_watts:60, dim_watts:50, dim_prop:"/controls/lighting/DU/du1", elec_prop:"/systems/electrical/bus/ac-ess"),
screen.new(name: "DU2", type:"LCD", max_watts:60, dim_watts:50, dim_prop:"/controls/lighting/DU/du2", elec_prop:"/systems/electrical/bus/ac-ess-shed"),
screen.new(name: "DU3", type:"LCD", max_watts:60, dim_watts:50, dim_prop:"/controls/lighting/DU/du3", elec_prop:"/systems/electrical/bus/ac-ess"),
screen.new(name: "DU4", type:"LCD", max_watts:60, dim_watts:50, dim_prop:"/controls/lighting/DU/du4", elec_prop:"/systems/electrical/bus/ac2"),
screen.new(name: "DU5", type:"LCD", max_watts:60, dim_watts:50, dim_prop:"/controls/lighting/DU/du5", elec_prop:"/systems/electrical/bus/ac2"),
screen.new(name: "DU6", type:"LCD", max_watts:60, dim_watts:50, dim_prop:"/controls/lighting/DU/du6", elec_prop:"/systems/electrical/bus/ac2")];
lights = [light.new(name: "logo-left", max_watts:31.5, control_prop:"/sim/model/lights/logo-lights", elec_prop:"/systems/electrical/bus/ac1"),
light.new(name: "logo-right", max_watts:31.5, control_prop:"/sim/model/lights/logo-lights", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "upper-beacon", max_watts:40, control_prop:"/sim/model/lights/beacon/state", elec_prop:"/systems/electrical/bus/ac1"),
light.new(name: "lower-beacon", max_watts:40, control_prop:"/sim/model/lights/beacon/state", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "strobe-left", max_watts:38, control_prop:"/sim/model/lights/strobe/state", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "strobe-right", max_watts:38, control_prop:"/sim/model/lights/strobe/state", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "tail-strobe", max_watts:12, control_prop:"/sim/model/lights/tailstrobe/state", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "tail-strobe-ctl", max_watts:30, control_prop:"/sim/model/lights/tailstrobe/state", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "tail-nav", max_watts:12, control_prop:"/sim/model/lights/nav-lights", elec_prop:"/systems/electrical/nav-lights-power"),
light.new(name: "left-nav", max_watts:12, control_prop:"/sim/model/lights/nav-lights", elec_prop:"/systems/electrical/nav-lights-power"),
light.new(name: "right-nav", max_watts:12, control_prop:"/sim/model/lights/nav-lights", elec_prop:"/systems/electrical/nav-lights-power"),
light.new(name: "left-land", max_watts:39, control_prop:"/controls/lighting/landing-lights[1]", elec_prop:"/systems/electrical/bus/ac1"),
light.new(name: "right-land", max_watts:39, control_prop:"/controls/lighting/landing-lights[2]", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "left-taxi", max_watts:31, control_prop:"/sim/model/lights/nose-lights", elec_prop:"/systems/electrical/bus/ac1"),
light.new(name: "right-taxi", max_watts:31, control_prop:"/sim/model/lights/nose-lights", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "left-turnoff", max_watts:21, control_prop:"/controls/lighting/leftturnoff", elec_prop:"/systems/electrical/bus/ac1"),
light.new(name: "right-turnoff", max_watts:21, control_prop:"/controls/lighting/rightturnoff", elec_prop:"/systems/electrical/bus/ac2"),
light.new(name: "left-wing", max_watts:24, control_prop:"/controls/lighting/wing-lights", elec_prop:"/systems/electrical/bus/ac1"),
light.new(name: "right-wing", max_watts:24, control_prop:"/controls/lighting/wing-lights", elec_prop:"/systems/electrical/bus/ac2")];
}, },
loop: func() { loop: func() {
galley_sw = getprop("/controls/electrical/switches/galley"); galley_sw = getprop("/controls/electrical/switches/galley");
@ -167,6 +268,7 @@ var ELEC = {
ac1 = getprop("/systems/electrical/bus/ac1"); ac1 = getprop("/systems/electrical/bus/ac1");
ac2 = getprop("/systems/electrical/bus/ac2"); ac2 = getprop("/systems/electrical/bus/ac2");
ac_ess = getprop("/systems/electrical/bus/ac-ess"); ac_ess = getprop("/systems/electrical/bus/ac-ess");
ac_ess_shed = getprop("/systems/electrical/bus/ac-ess-shed");
dc1 = getprop("/systems/electrical/bus/dc1"); dc1 = getprop("/systems/electrical/bus/dc1");
dc2 = getprop("/systems/electrical/bus/dc2"); dc2 = getprop("/systems/electrical/bus/dc2");
dcbat = getprop("/systems/electrical/bus/dcbat"); dcbat = getprop("/systems/electrical/bus/dcbat");
@ -186,6 +288,7 @@ var ELEC = {
gen1_fail = getprop("/systems/failures/elec-gen1"); gen1_fail = getprop("/systems/failures/elec-gen1");
gen2_fail = getprop("/systems/failures/elec-gen2"); gen2_fail = getprop("/systems/failures/elec-gen2");
replay = getprop("/sim/replay/replay-state"); replay = getprop("/sim/replay/replay-state");
wow = getprop("/gear/gear[1]/wow");
if (extpwr_on and gen_ext_sw) { if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/gen-ext", 1); setprop("/systems/electrical/gen-ext", 1);
@ -363,14 +466,20 @@ var ELEC = {
ac1 = getprop("/systems/electrical/bus/ac1"); ac1 = getprop("/systems/electrical/bus/ac1");
ac2 = getprop("/systems/electrical/bus/ac2"); ac2 = getprop("/systems/electrical/bus/ac2");
if (!ac_ess_fail and (ac1 >= 110 or ac2 >= 110)) { if ((ac_ess_fail or (ac1 <= 110 or ac2 <= 110)) or (ias > 50 and getprop("/controls/hydraulic/rat-deployed") == 1 and (ac1 == 0) and (ac2 == 0) and wow)) {
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
} else {
setprop("/systems/electrical/bus/ac-ess", 0); setprop("/systems/electrical/bus/ac-ess", 0);
} else {
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
} }
ac_ess = getprop("/systems/electrical/bus/ac-ess"); ac_ess = getprop("/systems/electrical/bus/ac-ess");
if (ac1 == 0 and ac2 == 0 and emergen == 0) {
setprop("/systems/electrical/bus/ac-ess-shed", 0);
} else {
setprop("/systems/electrical/bus/ac-ess-shed", ac_volt_std);
}
if (ac_ess >= 110 and !gallery_fail) { if (ac_ess >= 110 and !gallery_fail) {
if (galley_sw == 1 and !galley_shed) { if (galley_sw == 1 and !galley_shed) {
setprop("/systems/electrical/bus/galley", ac_volt_std); setprop("/systems/electrical/bus/galley", ac_volt_std);
@ -393,7 +502,7 @@ var ELEC = {
setprop("/controls/electrical/switches/emer-gen", 1); setprop("/controls/electrical/switches/emer-gen", 1);
} }
if (ias < 100) { if (ias < 100 or (ac1 == 1) or (ac2 == 1)) {
setprop("/controls/electrical/switches/emer-gen", 0); setprop("/controls/electrical/switches/emer-gen", 0);
} }
@ -572,6 +681,24 @@ var ELEC = {
} else { } else {
setprop("/systems/electrical/gen2-fault", 0); setprop("/systems/electrical/gen2-fault", 0);
} }
foreach(var screena; screens) {
power_consumption = screena.power_consumption();
if (getprop(screena.elec_prop) != 0) {
setprop("/systems/electrical/DU/" ~ screena.name ~ "/watts", power_consumption);
} else {
setprop("/systems/electrical/DU/" ~ screena.name ~ "/watts", 0);
}
}
foreach(var lighta; lights) {
power_consumption = lighta.power_consumption();
if (getprop(screena.elec_prop) != 0 and getprop(lighta.control_prop) != 0) {
setprop("/systems/electrical/light/" ~ lighta.name ~ "/watts", power_consumption);
} else {
setprop("/systems/electrical/light/" ~ lighta.name ~ "/watts", 0);
}
}
}, },
}; };

View file

@ -34,11 +34,11 @@ setprop("/engines/engine[1]/oil-qt-actual", qty2);
# Lights # # Lights #
########## ##########
var beacon_switch = props.globals.getNode("/controls/switches/beacon", 2); var beacon_switch = props.globals.getNode("/controls/switches/beacon", 2);
var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.16, 1], "/controls/lighting/beacon"); var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls/lighting/beacon");
var strobe_switch = props.globals.getNode("/controls/switches/strobe", 2); var strobe_switch = props.globals.getNode("/controls/switches/strobe", 2);
var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe"); var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe");
var tail_strobe_switch = props.globals.getNode("/controls/switches/tailstrobe", 2); var tail_strobe_switch = props.globals.getNode("/controls/switches/tailstrobe", 2);
var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.11, 1], "/controls/lighting/strobe"); var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe");
var logo_lights = getprop("/sim/model/lights/logo-lights"); var logo_lights = getprop("/sim/model/lights/logo-lights");
var nav_lights = props.globals.getNode("/sim/model/lights/nav-lights"); var nav_lights = props.globals.getNode("/sim/model/lights/nav-lights");
var wow = getprop("/gear/gear[2]/wow"); var wow = getprop("/gear/gear[2]/wow");
@ -365,9 +365,9 @@ var lightsLoop = maketimer(0.2, func {
# nose lights # nose lights
if (settingT == 0.5 and gear > 0.9) { if (settingT == 0.5 and gear > 0.9 and (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0)) {
setprop("/sim/model/lights/nose-lights", 0.85); setprop("/sim/model/lights/nose-lights", 0.85);
} else if (settingT == 1 and gear > 0.9) { } else if (settingT == 1 and gear > 0.9 and (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0)) {
setprop("/sim/model/lights/nose-lights", 1); setprop("/sim/model/lights/nose-lights", 1);
} else { } else {
setprop("/sim/model/lights/nose-lights", 0); setprop("/sim/model/lights/nose-lights", 0);
@ -378,11 +378,15 @@ var lightsLoop = maketimer(0.2, func {
left_turnoff_light = props.globals.getNode("/controls/lighting/leftturnoff"); left_turnoff_light = props.globals.getNode("/controls/lighting/leftturnoff");
right_turnoff_light = props.globals.getNode("/controls/lighting/rightturnoff"); right_turnoff_light = props.globals.getNode("/controls/lighting/rightturnoff");
if (settingTurnoff == 1 and gear > 0.9) { if (settingTurnoff == 1 and gear > 0.9 and getprop("/systems/electrical/bus/ac1") > 0) {
left_turnoff_light.setBoolValue(1); left_turnoff_light.setBoolValue(1);
right_turnoff_light.setBoolValue(1);
} else { } else {
left_turnoff_light.setBoolValue(0); left_turnoff_light.setBoolValue(0);
}
if (settingTurnoff == 1 and gear > 0.9 and getprop("/systems/electrical/bus/ac2") > 0) {
right_turnoff_light.setBoolValue(1);
} else {
right_turnoff_light.setBoolValue(0); right_turnoff_light.setBoolValue(0);
} }
@ -393,9 +397,15 @@ var lightsLoop = maketimer(0.2, func {
wow = getprop("/gear/gear[2]/wow"); wow = getprop("/gear/gear[2]/wow");
slats = getprop("/controls/flight/slats"); slats = getprop("/controls/flight/slats");
if (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0) {
setprop("/systems/electrical/nav-lights-power", 1);
} else {
setprop("/systems/electrical/nav-lights-power", 0);
}
if (setting == 0 and logo_lights == 1) { if (setting == 0 and logo_lights == 1) {
logo_lights.setBoolValue(0); logo_lights.setBoolValue(0);
} else if (setting == 1 or setting == 2) { } else if (setting == 1 or setting == 2 and (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0)) {
if ((wow) or (!wow and slats > 0)) { if ((wow) or (!wow and slats > 0)) {
logo_lights.setBoolValue(1); logo_lights.setBoolValue(1);
} else { } else {
@ -405,7 +415,7 @@ var lightsLoop = maketimer(0.2, func {
logo_lights.setBoolValue(0); logo_lights.setBoolValue(0);
} }
if (setting == 1 or setting == 2) { if (setting == 1 or setting == 2 and (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0 or getprop("/systems/electrical/bus/dc1") > 0 or getprop("/systems/electrical/bus/dc2") > 0)) {
nav_lights.setBoolValue(1); nav_lights.setBoolValue(1);
} else { } else {
nav_lights.setBoolValue(0); nav_lights.setBoolValue(0);

View file

@ -438,36 +438,6 @@
<output>/instrumentation/pfd/track-deg</output> <output>/instrumentation/pfd/track-deg</output>
</filter> </filter>
<filter>
<name>LNAV ADVANCE</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<sum>
<table>
<property>/velocities/groundspeed-kt</property>
<entry><ind>120</ind><dep>1.0</dep></entry>
<entry><ind>400</ind><dep>1.2</dep></entry>
</table>
<table>
<abs>
<dif>
<property>/autopilot/route-manager/wp[1]/true-bearing-deg</property>
<property>/autopilot/route-manager/wp[0]/true-bearing-deg</property>
</dif>
</abs>
<entry><ind>30</ind><dep>0.0</dep></entry>
<entry><ind>70</ind><dep>1.0</dep></entry>
</table>
</sum>
</expression>
</input>
<output>/it-autoflight/internal/lnav-advance-nm</output>
<min>1.0</min>
<max>5.0</max>
</filter>
<filter> <filter>
<name>HEADING ERROR DEG</name> <name>HEADING ERROR DEG</name>
<debug>false</debug> <debug>false</debug>

View file

@ -11,7 +11,7 @@
<filter> <filter>
<name>Groundspeed Meters Per Second</name> <name>Groundspeed Meters Per Second</name>
<type>gain</type> <type>gain</type>
<gain>0.51444444444</gain> <gain>0.5144444444444</gain>
<input>/velocities/groundspeed-kt</input> <input>/velocities/groundspeed-kt</input>
<output>/velocities/groundspeed-mps</output> <output>/velocities/groundspeed-mps</output>
<min>0</min> <min>0</min>
@ -574,7 +574,7 @@
<input> <input>
<expression> <expression>
<product> <product>
<property>velocities/uBody-fps</property> <property>/velocities/uBody-fps</property>
<value>0.592484</value> <value>0.592484</value>
</product> </product>
</expression> </expression>
@ -589,11 +589,11 @@
<update-interval-secs type="double">0.05</update-interval-secs> <update-interval-secs type="double">0.05</update-interval-secs>
<input> <input>
<product> <product>
<property>fdm/jsbsim/inertia/weight-lbs</property> <property>/fdm/jsbsim/inertia/weight-lbs</property>
<value>0.45359237</value> <value>0.45359237</value>
</product> </product>
</input> </input>
<output>fdm/jsbsim/inertia/weight-kg</output> <output>/fdm/jsbsim/inertia/weight-kg</output>
</filter> </filter>
<filter> <filter>

View file

@ -1 +1 @@
4067 4068