Engineer: more reliable engine callouts.

parent 5afc0d2e
......@@ -22,7 +22,7 @@ var V_1 = 245.0;
var V_R = 340.0;
var V_2 = 380.0;
var _running = [0, 0, 0, 0, 0];
var _running = [1, 1, 1, 1];
var _takeoff = 0;
var _apu = 0;
......@@ -121,12 +121,17 @@ var _loop = func {
return;
}
var running = [0, 0, 0, 0];
for(var ii = 0; ii < 4; ii = ii + 1){
running[ii] = getprop("/fdm/jsbsim/propulsion/engine[" ~ ii ~ "]/set-running");
}
var WOW = getprop("/gear/gear[1]/wow") or getprop("/gear/gear[2]/wow");
var Vind = getprop("/fdm/jsbsim/fcs/NPK/instr/US-I[1]/gauge/V-km_h");
var ready = (!getprop("/fdm/jsbsim/fcs/NPK/status/takeoff-notready") or (Vind > 100.0));
if(WOW){
for(ii = 0; ii < 4; ii += 1){
if(getprop("/fdm/jsbsim/propulsion/engine[" ~ ii ~ "]/set-running") == 0){
if(running[ii] == 0){
ready = 0;
break;
}
......@@ -158,61 +163,44 @@ var _loop = func {
}
_cg_callout = cg_callout;
var test_lights = (
getprop("/fdm/jsbsim/propulsion/air/APD/panel/button/test-lights") +
getprop("/fdm/jsbsim/propulsion/engine[4]/panel/button/test-lights")
);
if(!test_lights){
for(var i = 0; i < 4; i = i + 1){
if(getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/light/fault")){
if(_running[i]){
_running[i] = 0;
if(!getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/lever/cutoff")){
say("eng" ~ (i + 1) ~ "fault", 1.0);
}
}
}else{
if(!_running[i]){
_running[i] = 1;
if(
getprop("/fdm/jsbsim/propulsion/air/APD/panel/switch/engine-select") *
(getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/lever/throttle/pos-deg") < 10.0)
){
say("eng" ~ (i + 1) ~ "idle", 2.0);
}
}
for(var ii = 0; ii < 4; ii = ii + 1){
if(running[ii] > _running[ii]){
if(getprop("/fdm/jsbsim/propulsion/engine[" ~ ii ~ "]/panel/lever/throttle/pos-deg") < 10.0){
say("eng" ~ (ii + 1) ~ "idle", 2.0);
}
}else if(running[ii] < _running[ii]){
if(!getprop("/fdm/jsbsim/propulsion/engine[" ~ ii ~ "]/panel/lever/cutoff")){
say("eng" ~ (ii + 1) ~ "fault", 1.0);
}
}
}
var apu = (getprop("/fdm/jsbsim/propulsion/engine[4]/panel/gauge/n") > 70.0);
if(apu < _apu){
say("apu_off", 2.0);
}
var apu = (getprop("/fdm/jsbsim/propulsion/engine[4]/panel/gauge/n") > 70.0);
if(apu < _apu){
say("apu_off", 2.0);
}
_apu = apu;
if(WOW){
var takeoff = 1;
for(var i = 0; i < 4; i = i + 1){
if(
((getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/lever/throttle/pos-deg") - _alpha_v_to) < -0.5) or
(abs(getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/gauge/n") - _n_to) > 10.0) or
getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/light/check-engine")
){
takeoff = 0;
break;
}
}
if(takeoff > _takeoff){
say("takeoff", 5.0);
if(WOW){
var takeoff = 1;
for(var i = 0; i < 4; i = i + 1){
if(
((getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/lever/throttle/pos-deg") - _alpha_v_to) < -0.5) or
(abs(getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/gauge/n") - _n_to) > 10.0) or
getprop("/fdm/jsbsim/propulsion/engine[" ~ i ~ "]/panel/light/check-engine")
){
takeoff = 0;
break;
}
_takeoff = takeoff;
}
if(takeoff > _takeoff){
say("takeoff", 5.0);
}
_takeoff = takeoff;
}
_ready = ready;
_apu = apu;
_running = running;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment