A32X: Add more realistic startup and fix some FADEC inaccuracies

This commit is contained in:
Joshua Davidson 2017-11-22 18:34:43 -05:00
parent ec77702b9f
commit 2542ff4f95
12 changed files with 617 additions and 251 deletions

View file

@ -1229,7 +1229,7 @@
<file>Aircraft/IDG-A32X/Nasal/pneumatics.nas</file>
<file>Aircraft/IDG-A32X/Nasal/hydraulics.nas</file>
<file>Aircraft/IDG-A32X/Nasal/fuel.nas</file>
<file>Aircraft/IDG-A32X/Nasal/engines.nas</file>
<file>Aircraft/IDG-A32X/Nasal/engines-common.nas</file>
<file>Aircraft/IDG-A32X/Nasal/ADIRS.nas</file>
<file>Aircraft/IDG-A32X/Nasal/fire.nas</file>
<file>Aircraft/IDG-A32X/Nasal/brakes.nas</file>

View file

@ -14,7 +14,7 @@
<bleed> 0.03 </bleed>
<idlen1> 19.7 </idlen1>
<idlen2> 61.2 </idlen2>
<n1spinup> 0.1 </n1spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 1.0 </n2spinup>
<maxn1> 103.8 </maxn1>
<maxn2> 101.4 </maxn2>

View file

@ -14,7 +14,7 @@
<bleed> 0.03 </bleed>
<idlen1> 19.7 </idlen1>
<idlen2> 61.2 </idlen2>
<n1spinup> 0.1 </n1spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 1.0 </n2spinup>
<maxn1> 103.8 </maxn1>
<maxn2> 101.4 </maxn2>

View file

@ -14,7 +14,7 @@
<bleed> 0.03 </bleed>
<idlen1> 19.7 </idlen1>
<idlen2> 61.2 </idlen2>
<n1spinup> 0.1 </n1spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 1.0 </n2spinup>
<maxn1> 103.8 </maxn1>
<maxn2> 101.4 </maxn2>

View file

@ -14,7 +14,7 @@
<bleed> 0.03 </bleed>
<idlen1> 22.4 </idlen1>
<idlen2> 60.9 </idlen2>
<n1spinup> 0.1 </n1spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 1.0 </n2spinup>
<maxn1> 103.8 </maxn1>
<maxn2> 101.4 </maxn2>

View file

@ -103821,6 +103821,7 @@ refs 4
kids 0
OBJECT poly
name "lat.dash"
loc 0 0.0010868 0
data 13
lat.dash.mesh
texture "fcu.png"
@ -103841,6 +103842,7 @@ refs 4
kids 0
OBJECT poly
name "lat.fmgc"
loc 0 0.0010868 0
data 13
lat.fmgc.mesh
texture "fcu.png"
@ -103912,6 +103914,7 @@ refs 4
kids 0
OBJECT poly
name "spd.dash"
loc 0 0.0010868 0
data 13
spd.dash.mesh
texture "fcu.png"
@ -103932,6 +103935,7 @@ refs 4
kids 0
OBJECT poly
name "spd.fmgc"
loc 0 0.0010868 0
data 13
spd.fmgc.mesh
texture "fcu.png"
@ -104012,6 +104016,7 @@ refs 4
kids 0
OBJECT poly
name "ver.fmgc"
loc 0 0.0010868 0
data 13
ver.fmgc.mesh
texture "fcu.png"
@ -104043,6 +104048,7 @@ refs 4
kids 0
OBJECT poly
name "vs.dash"
loc 0 0.0010868 0
data 12
vs.dash.mesh
texture "fcu.png"

367
Nasal/engines-cfm.nas Normal file
View file

@ -0,0 +1,367 @@
# A3XX IAE V2500 Engine
# Joshua Davidson (it0uchpods)
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
#####################
# Initializing Vars #
#####################
var engines = props.globals.getNode("/engines").getChildren("engine");
var egt_min = 434;
var egt_start = 587;
var egt_max = 712;
var start_time = 10;
var egt_lightup_time = 4;
var egt_lightdn_time = 10;
var shutdown_time = 20;
var egt_shutdown_time = 20;
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 0);
setprop("/controls/engines/engine[1]/igniter-b", 0);
setprop("/controls/engines/engine[0]/last-igniter", "B");
setprop("/controls/engines/engine[1]/last-igniter", "B");
var eng_init = func {
setprop("/controls/engines/engine[0]/man-start", 0);
setprop("/controls/engines/engine[1]/man-start", 0);
}
# Trigger Startups and Stops
setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) {
fast_start_one();
} else {
if (getprop("/controls/engines/engine[0]/man-start") == 0) {
start_one_check();
} else if (getprop("/controls/engines/engine[0]/man-start") == 1) {
eng_one_man_start.start();
}
}
} else if (getprop("/controls/engines/engine[0]/cutoff-switch") == 1) {
eng_one_auto_start.stop();
eng_one_man_start.stop();
eng_one_n2_check.stop();
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 0);
setprop("/controls/engines/engine[0]/man-start", 0);
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop();
}
});
var fast_start_one = func {
setprop("/controls/engines/engine[0]/cutoff", 0);
setprop("/engines/engine[0]/out-of-fuel", 0);
setprop("/engines/engine[0]/run", 1);
setprop("/engines/engine[0]/cutoff", 0);
setprop("/engines/engine[0]/starter", 0);
setprop("/fdm/jsbsim/propulsion/set-running", 0);
setprop("/engines/engine[0]/state", 3);
setprop("/systems/pneumatic/eng1-starter", 0);
}
setlistener("/controls/engines/engine[0]/man-start", func {
start_one_mancheck();
});
var start_one_mancheck = func {
if (getprop("/controls/engines/engine[0]/man-start") == 1) {
if (getprop("/controls/engines/engine-start-switch") == 2 and (getprop("/controls/engines/engine[0]/cutoff-switch") == 1)) {
setprop("/systems/pneumatic/eng1-starter", 1);
settimer(start_one_mancheck_b, 0.5);
}
} else {
if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) {
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 0);
setprop("/controls/engines/engine[0]/starter", 0);
}
}
}
var start_one_mancheck_b = func {
if (getprop("/systems/pneumatic/total-psi") >= 28) {
setprop("/engines/engine[0]/state", 1);
setprop("/controls/engines/engine[0]/starter", 1);
}
}
var start_one_check = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
setprop("/systems/pneumatic/eng1-starter", 1);
settimer(start_one_check_b, 0.5);
}
}
var start_one_check_b = func {
if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/systems/pneumatic/total-psi") >= 28) and (getprop("/controls/engines/engine[0]/cutoff-switch") == 0)) {
auto_start_one();
}
}
setlistener("/controls/engines/engine[1]/cutoff-switch", func {
if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) {
fast_start_two();
} else {
if (getprop("/controls/engines/engine[1]/man-start") == 0) {
start_two_check();
} else if (getprop("/controls/engines/engine[1]/man-start") == 1) {
eng_two_man_start.start();
}
}
} else if (getprop("/controls/engines/engine[1]/cutoff-switch") == 1) {
eng_two_auto_start.stop();
eng_two_man_start.stop();
eng_two_n2_check.stop();
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-b", 0);
setprop("/controls/engines/engine[1]/man-start", 0);
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/engines/engine[1]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
}
});
var fast_start_two = func {
setprop("/controls/engines/engine[1]/cutoff", 0);
setprop("/engines/engine[1]/out-of-fuel", 0);
setprop("/engines/engine[1]/run", 1);
setprop("/engines/engine[1]/cutoff", 0);
setprop("/engines/engine[1]/starter", 0);
setprop("/fdm/jsbsim/propulsion/set-running", 1);
setprop("/engines/engine[1]/state", 3);
setprop("/systems/pneumatic/eng2-starter", 0);
}
setlistener("/controls/engines/engine[1]/man-start", func {
start_two_mancheck();
});
var start_two_mancheck = func {
if (getprop("/controls/engines/engine[1]/man-start") == 1) {
if (getprop("/controls/engines/engine-start-switch") == 2 and (getprop("/controls/engines/engine[1]/cutoff-switch") == 1)) {
setprop("/systems/pneumatic/eng2-starter", 1);
settimer(start_two_mancheck_b, 0.5);
}
} else {
if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) {
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 0);
setprop("/controls/engines/engine[1]/starter", 0);
}
}
}
var start_two_mancheck_b = func {
if (getprop("/systems/pneumatic/total-psi") >= 28) {
setprop("/engines/engine[1]/state", 1);
setprop("/controls/engines/engine[1]/starter", 1);
}
}
var start_two_check = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and getprop("/controls/engines/engine[1]/cutoff-switch") == 0) {
setprop("/systems/pneumatic/eng2-starter", 1);
settimer(start_two_check_b, 0.5);
}
}
var start_two_check_b = func {
if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/systems/pneumatic/total-psi") >= 28) and (getprop("/controls/engines/engine[1]/cutoff-switch") == 0)) {
auto_start_two();
}
}
# Start Engine One
var auto_start_one = func {
setprop("/engines/engine[0]/state", 1);
setprop("/controls/engines/engine[0]/starter", 1);
eng_one_auto_start.start();
}
var eng_one_auto_start = maketimer(0.5, func {
if (getprop("/engines/engine[0]/n2-actual") >= 22) {
eng_one_auto_start.stop();
setprop("/engines/engine[0]/state", 2);
setprop("/controls/engines/engine[0]/cutoff", 0);
if (getprop("/controls/engines/engine[0]/last-igniter") == "B") {
setprop("/controls/engines/engine[0]/igniter-a", 1);
setprop("/controls/engines/engine[0]/igniter-b", 0);
setprop("/controls/engines/engine[0]/last-igniter", "A");
} else if (getprop("/controls/engines/engine[0]/last-igniter") == "A") {
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 1);
setprop("/controls/engines/engine[0]/last-igniter", "B");
}
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_egt_check.start();
eng_one_n2_check.start();
}
});
var eng_one_man_start = maketimer(0.5, func {
if (getprop("/engines/engine[0]/n2-actual") >= 16.7) {
eng_one_man_start.stop();
setprop("/engines/engine[0]/state", 2);
setprop("/controls/engines/engine[0]/cutoff", 0);
setprop("/controls/engines/engine[0]/igniter-a", 1);
setprop("/controls/engines/engine[0]/igniter-b", 1);
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_egt_check.start();
eng_one_n2_check.start();
}
});
var eng_one_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[0]/egt-actual") >= egt_start) {
eng_one_egt_check.stop();
interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time);
}
});
var eng_one_n2_check = maketimer(0.5, func {
if (getprop("/engines/engine[0]/n2-actual") >= 43.0) {
if (getprop("/controls/engines/engine[0]/igniter-a") != 0) {
setprop("/controls/engines/engine[0]/igniter-a", 0);
}
if (getprop("/controls/engines/engine[0]/igniter-b") != 0) {
setprop("/controls/engines/engine[0]/igniter-b", 0);
}
}
if (getprop("/engines/engine[0]/n2-actual") >= 57.0) {
eng_one_n2_check.stop();
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 3);
}
});
# Start Engine Two
var auto_start_two = func {
setprop("/engines/engine[1]/state", 1);
setprop("/controls/engines/engine[1]/starter", 1);
eng_two_auto_start.start();
}
var eng_two_auto_start = maketimer(0.5, func {
if (getprop("/engines/engine[1]/n2-actual") >= 22) {
eng_two_auto_start.stop();
setprop("/engines/engine[1]/state", 2);
setprop("/controls/engines/engine[1]/cutoff", 0);
if (getprop("/controls/engines/engine[1]/last-igniter") == "B") {
setprop("/controls/engines/engine[1]/igniter-a", 1);
setprop("/controls/engines/engine[1]/igniter-b", 0);
setprop("/controls/engines/engine[1]/last-igniter", "A");
} else if (getprop("/controls/engines/engine[1]/last-igniter") == "A") {
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-b", 1);
setprop("/controls/engines/engine[1]/last-igniter", "B");
}
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_egt_check.start();
eng_two_n2_check.start();
}
});
var eng_two_man_start = maketimer(0.5, func {
if (getprop("/engines/engine[1]/n2-actual") >= 16.7) {
eng_two_man_start.stop();
setprop("/engines/engine[1]/state", 2);
setprop("/controls/engines/engine[1]/cutoff", 0);
setprop("/controls/engines/engine[1]/igniter-a", 1);
setprop("/controls/engines/engine[1]/igniter-b", 1);
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_egt_check.start();
eng_two_n2_check.start();
}
});
var eng_two_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[1]/egt-actual") >= egt_start) {
eng_two_egt_check.stop();
interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time);
}
});
var eng_two_n2_check = maketimer(0.5, func {
if (getprop("/engines/engine[1]/n2-actual") >= 50.0) {
if (getprop("/controls/engines/engine[1]/igniter-a") != 0) {
setprop("/controls/engines/engine[1]/igniter-a", 0);
}
if (getprop("/controls/engines/engine[1]/igniter-b") != 0) {
setprop("/controls/engines/engine[1]/igniter-b", 0);
}
}
if (getprop("/engines/engine[1]/n2-actual") >= 57.0) {
eng_two_n2_check.stop();
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 3);
}
});
# Various Other Stuff
setlistener("/controls/engines/engine-start-switch", func {
if (getprop("/engines/engine[0]/state") == 0) {
start_one_check();
start_one_mancheck();
}
if (getprop("/engines/engine[1]/state") == 0) {
start_two_check();
start_two_mancheck();
}
if ((getprop("/controls/engines/engine-start-switch") == 0) or (getprop("/controls/engines/engine-start-switch") == 1)) {
if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) {
setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
}
if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) {
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
}
}
});
setlistener("/systems/pneumatic/start-psi", func {
if (getprop("/systems/pneumatic/total-psi") < 12) {
if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) {
setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
}
if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) {
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
}
}
});

154
Nasal/engines-common.nas Normal file
View file

@ -0,0 +1,154 @@
# A3XX Engine Control
# Joshua Davidson (it0uchpods)
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
if (getprop("/options/eng") == "IAE") {
io.include("engines-iae.nas");
} else {
io.include("engines-cfm.nas");
}
var spinup_time = 49;
var apu_max = 100;
var apu_egt_min = 352;
var apu_egt_max = 704;
setprop("/systems/apu/rpm", 0);
setprop("/systems/apu/egt", 42);
# Start APU
setlistener("/controls/APU/start", func {
if ((getprop("/controls/APU/master") == 1) and (getprop("/controls/APU/start") == 1)) {
if (getprop("/systems/acconfig/autoconfig-running") == 0) {
interpolate("/systems/apu/rpm", apu_max, spinup_time);
apu_egt_check.start();
} else if (getprop("/systems/acconfig/autoconfig-running") == 1) {
interpolate("/systems/apu/rpm", apu_max, 5);
interpolate("/systems/apu/egt", apu_egt_min, 5);
}
} else if (getprop("/controls/APU/master") == 0) {
apu_egt_check.stop();
apu_stop();
}
});
var apu_egt_check = maketimer(0.5, func {
if (getprop("/systems/apu/rpm") >= 28) {
apu_egt_check.stop();
interpolate("/systems/apu/egt", apu_egt_max, 5);
apu_egt2_check.start();
}
});
var apu_egt2_check = maketimer(0.5, func {
if (getprop("/systems/apu/egt") >= 701) {
apu_egt2_check.stop();
interpolate("/systems/apu/egt", apu_egt_min, 30);
}
});
# Stop APU
setlistener("/controls/APU/master", func {
if (getprop("/controls/APU/master") == 0) {
setprop("/controls/APU/start", 0);
apu_egt_check.stop();
apu_egt2_check.stop();
apu_stop();
}
});
var apu_stop = func {
interpolate("/systems/apu/rpm", 0, 30);
interpolate("/systems/apu/egt", 42, 40);
}
# Various Other Stuff
var doIdleThrust = func {
setprop("/controls/engines/engine[0]/throttle", 0.0);
setprop("/controls/engines/engine[1]/throttle", 0.0);
}
var doTOGAThrust = func {
setprop("/controls/engines/engine[0]/throttle", 1.0);
setprop("/controls/engines/engine[1]/throttle", 1.0);
}
# Reverse Thrust System
var toggleFastRevThrust = func {
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2");
if (state1 == "IDLE" and state2 == "IDLE" and getprop("/controls/engines/engine[0]/reverser") == "0" and getprop("/controls/engines/engine[1]/reverser") == "0" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1);
setprop("/controls/engines/engine[1]/reverser", 1);
setprop("/controls/engines/engine[0]/throttle-rev", 0.4);
setprop("/controls/engines/engine[1]/throttle-rev", 0.4);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
} else if ((getprop("/controls/engines/engine[0]/reverser") == "1") or (getprop("/controls/engines/engine[1]/reverser") == "1") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
}
}
var doRevThrust = func {
if (getprop("/controls/engines/engine[0]/reverser") == "1" and getprop("/controls/engines/engine[1]/reverser") == "1" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
if (pos1 < 0.4) {
setprop("/controls/engines/engine[0]/throttle-rev", pos1 + 0.133333333);
}
if (pos2 < 0.4) {
setprop("/controls/engines/engine[1]/throttle-rev", pos2 + 0.133333333);
}
}
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2");
if (state1 == "IDLE" and state2 == "IDLE" and getprop("/controls/engines/engine[0]/reverser") == "0" and getprop("/controls/engines/engine[1]/reverser") == "0" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1);
setprop("/controls/engines/engine[1]/reverser", 1);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
}
}
var unRevThrust = func {
if (getprop("/controls/engines/engine[0]/reverser") == "1" or getprop("/controls/engines/engine[1]/reverser") == "1") {
var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
if (pos1 > 0.0) {
setprop("/controls/engines/engine[0]/throttle-rev", pos1 - 0.133333333);
} else {
unRevThrust_b();
}
if (pos2 > 0.0) {
setprop("/controls/engines/engine[1]/throttle-rev", pos2 - 0.133333333);
} else {
unRevThrust_b();
}
}
}
var unRevThrust_b = func {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
}

View file

@ -1,4 +1,4 @@
# A3XX JSB Engine System
# A3XX IAE V2500 Engine
# Joshua Davidson (it0uchpods)
##############################################
@ -10,30 +10,15 @@
#####################
var engines = props.globals.getNode("/engines").getChildren("engine");
var n1_min = 22.4;
var n2_min = 60.7;
var egt_min = 434;
var n1_spin = 5.1;
var n2_spin = 22.8;
var n1_start = 22.3;
var n2_start = 60.6;
var egt_start = 587;
var n1_max = 105.8;
var n2_max = 102.1;
var egt_max = 712;
var n1_wm = 0;
var n2_wm = 0;
var apu_max = 100;
var apu_egt_min = 352;
var apu_egt_max = 704;
var spinup_time = 49;
var start_time = 10;
var egt_lightup_time = 2;
var egt_lightdn_time = 8;
var egt_lightup_time = 4;
var egt_lightdn_time = 10;
var shutdown_time = 20;
var egt_shutdown_time = 20;
setprop("/systems/apu/rpm", 0);
setprop("/systems/apu/egt", 42);
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
setprop("/controls/engines/engine[0]/igniter-a", 0);
@ -48,10 +33,7 @@ var eng_init = func {
setprop("/controls/engines/engine[1]/man-start", 0);
}
##############################
# Trigger Startups and Stops #
##############################
# Trigger Startups and Stops
setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) {
@ -60,13 +42,13 @@ setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (getprop("/controls/engines/engine[0]/man-start") == 0) {
start_one_check();
} else if (getprop("/controls/engines/engine[0]/man-start") == 1) {
eng_one_man_startt.start();
eng_one_man_start.start();
}
}
} else if (getprop("/controls/engines/engine[0]/cutoff-switch") == 1) {
eng_one_auto_startt.stop();
eng_one_man_startt.stop();
eng_one_n2_checkt.stop();
eng_one_auto_start.stop();
eng_one_man_start.stop();
eng_one_n2_check.stop();
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 0);
setprop("/controls/engines/engine[0]/man-start", 0);
@ -75,7 +57,7 @@ setlistener("/controls/engines/engine[0]/cutoff-switch", func {
setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_checkt.stop();
eng_one_n2_check.stop();
}
});
@ -140,13 +122,13 @@ setlistener("/controls/engines/engine[1]/cutoff-switch", func {
if (getprop("/controls/engines/engine[1]/man-start") == 0) {
start_two_check();
} else if (getprop("/controls/engines/engine[1]/man-start") == 1) {
eng_two_man_startt.start();
eng_two_man_start.start();
}
}
} else if (getprop("/controls/engines/engine[1]/cutoff-switch") == 1) {
eng_two_auto_startt.stop();
eng_two_man_startt.stop();
eng_two_n2_checkt.stop();
eng_two_auto_start.stop();
eng_two_man_start.stop();
eng_two_n2_check.stop();
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-b", 0);
setprop("/controls/engines/engine[1]/man-start", 0);
@ -211,19 +193,16 @@ var start_two_check_b = func {
}
}
####################
# Start Engine One #
####################
# Start Engine One
var auto_start_one = func {
setprop("/engines/engine[0]/state", 1);
setprop("/controls/engines/engine[0]/starter", 1);
eng_one_auto_startt.start();
eng_one_auto_start.start();
}
var eng_one_auto_start = func {
if (getprop("/engines/engine[0]/n2-actual") >= 24.1) {
eng_one_auto_startt.stop();
var eng_one_auto_start = maketimer(0.5, func {
if (getprop("/engines/engine[0]/n1-actual") >= 5.0) {
eng_one_auto_start.stop();
setprop("/engines/engine[0]/state", 2);
setprop("/controls/engines/engine[0]/cutoff", 0);
if (getprop("/controls/engines/engine[0]/last-igniter") == "B") {
@ -236,48 +215,57 @@ var eng_one_auto_start = func {
setprop("/controls/engines/engine[0]/last-igniter", "B");
}
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_n2_checkt.start();
eng_one_egt_check.start();
eng_one_n2_check.start();
}
}
});
var eng_one_man_start = func {
var eng_one_man_start = maketimer(0.5, func {
if (getprop("/engines/engine[0]/n2-actual") >= 16.7) {
eng_one_man_startt.stop();
eng_one_man_start.stop();
setprop("/engines/engine[0]/state", 2);
setprop("/controls/engines/engine[0]/cutoff", 0);
setprop("/controls/engines/engine[0]/igniter-a", 1);
setprop("/controls/engines/engine[0]/igniter-b", 1);
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_n2_checkt.start();
eng_one_egt_check.start();
eng_one_n2_check.start();
}
}
});
var eng_one_n2_check = func {
var eng_one_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[0]/egt-actual") >= egt_start) {
eng_one_egt_check.stop();
interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time);
}
});
var eng_one_n2_check = maketimer(0.5, func {
if (getprop("/engines/engine[0]/n2-actual") >= 43.0) {
eng_one_n2_checkt.stop();
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 0);
if (getprop("/controls/engines/engine[0]/igniter-a") != 0) {
setprop("/controls/engines/engine[0]/igniter-a", 0);
}
if (getprop("/controls/engines/engine[0]/igniter-b") != 0) {
setprop("/controls/engines/engine[0]/igniter-b", 0);
}
}
if (getprop("/engines/engine[0]/n2-actual") >= 57.0) {
eng_one_n2_check.stop();
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 3);
}
}
####################
# Start Engine Two #
####################
});
# Start Engine Two
var auto_start_two = func {
setprop("/engines/engine[1]/state", 1);
setprop("/controls/engines/engine[1]/starter", 1);
eng_two_auto_startt.start();
eng_two_auto_start.start();
}
var eng_two_auto_start = func {
if (getprop("/engines/engine[1]/n2-actual") >= 24.1) {
eng_two_auto_startt.stop();
var eng_two_auto_start = maketimer(0.5, func {
if (getprop("/engines/engine[1]/n1-actual") >= 5.0) {
eng_two_auto_start.stop();
setprop("/engines/engine[1]/state", 2);
setprop("/controls/engines/engine[1]/cutoff", 0);
if (getprop("/controls/engines/engine[1]/last-igniter") == "B") {
@ -290,91 +278,48 @@ var eng_two_auto_start = func {
setprop("/controls/engines/engine[1]/last-igniter", "B");
}
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_n2_checkt.start();
eng_two_egt_check.start();
eng_two_n2_check.start();
}
}
});
var eng_two_man_start = func {
var eng_two_man_start = maketimer(0.5, func {
if (getprop("/engines/engine[1]/n2-actual") >= 16.7) {
eng_two_man_startt.stop();
eng_two_man_start.stop();
setprop("/engines/engine[1]/state", 2);
setprop("/controls/engines/engine[1]/cutoff", 0);
setprop("/controls/engines/engine[1]/igniter-a", 1);
setprop("/controls/engines/engine[1]/igniter-b", 1);
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_n2_checkt.start();
eng_two_egt_check.start();
eng_two_n2_check.start();
}
}
});
var eng_two_n2_check = func {
var eng_two_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[1]/egt-actual") >= egt_start) {
eng_two_egt_check.stop();
interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time);
}
});
var eng_two_n2_check = maketimer(0.5, func {
if (getprop("/engines/engine[1]/n2-actual") >= 43.0) {
eng_two_n2_checkt.stop();
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-b", 0);
if (getprop("/controls/engines/engine[1]/igniter-a") != 0) {
setprop("/controls/engines/engine[1]/igniter-a", 0);
}
if (getprop("/controls/engines/engine[1]/igniter-b") != 0) {
setprop("/controls/engines/engine[1]/igniter-b", 0);
}
}
if (getprop("/engines/engine[1]/n2-actual") >= 57.0) {
eng_two_n2_check.stop();
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 3);
}
}
#############
# Start APU #
#############
setlistener("/controls/APU/start", func {
if ((getprop("/controls/APU/master") == 1) and (getprop("/controls/APU/start") == 1)) {
if (getprop("/systems/acconfig/autoconfig-running") == 0) {
interpolate("/systems/apu/rpm", apu_max, spinup_time);
apu_egt_checkt.start();
} else if (getprop("/systems/acconfig/autoconfig-running") == 1) {
interpolate("/systems/apu/rpm", apu_max, 5);
interpolate("/systems/apu/egt", apu_egt_min, 5);
}
} else if (getprop("/controls/APU/master") == 0) {
apu_egt_checkt.stop();
apu_stop();
}
});
var apu_egt_check = func {
if (getprop("/systems/apu/rpm") >= 28) {
apu_egt_checkt.stop();
interpolate("/systems/apu/egt", apu_egt_max, 5);
apu_egt2_checkt.start();
}
}
var apu_egt2_check = func {
if (getprop("/systems/apu/egt") >= 701) {
apu_egt2_checkt.stop();
interpolate("/systems/apu/egt", apu_egt_min, 30);
}
}
############
# Stop APU #
############
setlistener("/controls/APU/master", func {
if (getprop("/controls/APU/master") == 0) {
setprop("/controls/APU/start", 0);
apu_egt_checkt.stop();
apu_egt2_checkt.stop();
apu_stop();
}
});
var apu_stop = func {
interpolate("/systems/apu/rpm", 0, 30);
interpolate("/systems/apu/egt", 42, 40);
}
#######################
# Various other stuff #
#######################
# Various Other Stuff
setlistener("/controls/engines/engine-start-switch", func {
if (getprop("/engines/engine[0]/state") == 0) {
start_one_check();
@ -420,104 +365,3 @@ setlistener("/systems/pneumatic/start-psi", func {
}
}
});
var doIdleThrust = func {
setprop("/controls/engines/engine[0]/throttle", 0.0);
setprop("/controls/engines/engine[1]/throttle", 0.0);
}
var doTOGAThrust = func {
setprop("/controls/engines/engine[0]/throttle", 1.0);
setprop("/controls/engines/engine[1]/throttle", 1.0);
}
#########################
# Reverse Thrust System #
#########################
var toggleFastRevThrust = func {
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2");
if (state1 == "IDLE" and state2 == "IDLE" and getprop("/controls/engines/engine[0]/reverser") == "0" and getprop("/controls/engines/engine[1]/reverser") == "0" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1);
setprop("/controls/engines/engine[1]/reverser", 1);
setprop("/controls/engines/engine[0]/throttle-rev", 0.4);
setprop("/controls/engines/engine[1]/throttle-rev", 0.4);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
} else if ((getprop("/controls/engines/engine[0]/reverser") == "1") or (getprop("/controls/engines/engine[1]/reverser") == "1") and (getprop("/gear/gear[1]/wow") == 1) and (getprop("/gear/gear[2]/wow") == 1)) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
}
}
var doRevThrust = func {
if (getprop("/controls/engines/engine[0]/reverser") == "1" and getprop("/controls/engines/engine[1]/reverser") == "1" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
if (pos1 < 0.4) {
setprop("/controls/engines/engine[0]/throttle-rev", pos1 + 0.133333333);
}
if (pos2 < 0.4) {
setprop("/controls/engines/engine[1]/throttle-rev", pos2 + 0.133333333);
}
}
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2");
if (state1 == "IDLE" and state2 == "IDLE" and getprop("/controls/engines/engine[0]/reverser") == "0" and getprop("/controls/engines/engine[1]/reverser") == "0" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1);
setprop("/controls/engines/engine[1]/reverser", 1);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
}
}
var unRevThrust = func {
if (getprop("/controls/engines/engine[0]/reverser") == "1" or getprop("/controls/engines/engine[1]/reverser") == "1") {
var pos1 = getprop("/controls/engines/engine[0]/throttle-rev");
var pos2 = getprop("/controls/engines/engine[1]/throttle-rev");
if (pos1 > 0.0) {
setprop("/controls/engines/engine[0]/throttle-rev", pos1 - 0.133333333);
} else {
unRevThrust_b();
}
if (pos2 > 0.0) {
setprop("/controls/engines/engine[1]/throttle-rev", pos2 - 0.133333333);
} else {
unRevThrust_b();
}
}
}
var unRevThrust_b = func {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
}
# Timers
var eng_one_auto_startt = maketimer(0.5, eng_one_auto_start);
var eng_one_man_startt = maketimer(0.5, eng_one_man_start);
var eng_one_n2_checkt = maketimer(0.5, eng_one_n2_check);
var eng_two_auto_startt = maketimer(0.5, eng_two_auto_start);
var eng_two_man_startt = maketimer(0.5, eng_two_man_start);
var eng_two_n2_checkt = maketimer(0.5, eng_two_n2_check);
var apu_egt_checkt = maketimer(0.5, apu_egt_check);
var apu_egt2_checkt = maketimer(0.5, apu_egt2_check);

View file

@ -58,38 +58,28 @@ var fadecLoop = maketimer(0.7, func {
var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("/systems/fadec/powered2");
var N21 = getprop("/engines/engine[0]/n2-actual");
var N22 = getprop("/engines/engine[1]/n2-actual");
if (powered1) {
setprop("/systems/fadec/eng1/n1", 1);
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/n2", 1);
setprop("/systems/fadec/eng1/ff", 1);
} else {
setprop("/systems/fadec/eng1/n1", 0);
setprop("/systems/fadec/eng1/egt", 0);
setprop("/systems/fadec/eng1/n2", 0);
setprop("/systems/fadec/eng1/ff", 0);
}
if (powered2) {
setprop("/systems/fadec/eng2/n1", 1);
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/n2", 1);
setprop("/systems/fadec/eng2/ff", 1);
} else {
setprop("/systems/fadec/eng2/n1", 0);
setprop("/systems/fadec/eng2/egt", 0);
setprop("/systems/fadec/eng2/n2", 0);
setprop("/systems/fadec/eng2/ff", 0);
}
if (powered1 and N21 >= 3.5) {
setprop("/systems/fadec/eng1/n2", 1);
} else {
setprop("/systems/fadec/eng1/n2", 0);
}
if (powered2 and N22 >= 3.5) {
setprop("/systems/fadec/eng2/n2", 1);
} else {
setprop("/systems/fadec/eng2/n2", 0);
}
});

View file

@ -1,5 +1,5 @@
# A3XX FADEC/Throttle Control System by Joshua Davidson (it0uchpods)
# V2.0.0
# A3XX FADEC/Throttle Control System
# Joshua Davidson (it0uchpods)
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
@ -7,7 +7,6 @@
setprop("/systems/thrust/alpha-floor", 0);
setprop("/systems/thrust/toga-lk", 0);
setprop("/systems/thrust/epr/toga-lim", 0.0);
setprop("/systems/thrust/epr/mct-lim", 0.0);
setprop("/systems/thrust/epr/flx-lim", 0.0);
@ -198,6 +197,8 @@ setlistener("/systems/thrust/state2", func {
var thrust_lim = func {
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
engstate1 = getprop("/engines/engine[0]/state");
engstate2 = getprop("/engines/engine[1]/state");
thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
eprtoga = getprop("/systems/thrust/epr/toga-lim");
@ -208,7 +209,12 @@ var thrust_lim = func {
n1mct = getprop("/systems/thrust/n1/mct-lim");
n1flx = getprop("/systems/thrust/n1/flx-lim");
n1clb = getprop("/systems/thrust/n1/clb-lim");
if (getprop("/gear/gear[1]/wow") == 0 or getprop("/gear/gear[2]/wow") == 0) {
if (getprop("/FMGC/internal/flex-set") == 1 and getprop("/systems/fadec/n1mode1") == 0 and getprop("/systems/fadec/n1mode2") == 0 and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
setprop("/systems/thrust/lim-flex", 1);
} else if (getprop("/FMGC/internal/flex-set") == 0 and engstate1 != 3 and engstate2 != 3) {
setprop("/systems/thrust/lim-flex", 0);
}
if (getprop("/gear/gear[1]/wow") == 0 or getprop("/gear/gear[2]/wow") == 0 or (engstate1 != 3 and engstate2 != 3)) {
if ((state1 == "TOGA" or state2 == "TOGA" or (state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) or getprop("/systems/thrust/alpha-floor") == 1 or getprop("/systems/thrust/toga-lk") == 1) {
setprop("/controls/engines/thrust-limit", "TOGA");
setprop("/controls/engines/epr-limit", eprtoga);
@ -227,7 +233,6 @@ var thrust_lim = func {
setprop("/controls/engines/n1-limit", n1clb);
}
} else if (getprop("/FMGC/internal/flex-set") == 1 and getprop("/systems/fadec/n1mode1") == 0 and getprop("/systems/fadec/n1mode2") == 0) {
setprop("/systems/thrust/lim-flex", 1);
setprop("/controls/engines/thrust-limit", "FLX");
setprop("/controls/engines/epr-limit", eprflx);
setprop("/controls/engines/n1-limit", n1flx);

View file

@ -1 +1 @@
4029
4030