1
0
Fork 0

Update engine nasal files to pts / getValue()

This commit is contained in:
legoboyvdlp R 2020-11-22 22:00:21 +00:00
parent 1ece6edb5b
commit 024fca8b7d
5 changed files with 252 additions and 245 deletions

View file

@ -22,6 +22,7 @@ var Controls = {
Engines: { Engines: {
startSw: props.globals.getNode("/controls/engines/engine-start-switch"), startSw: props.globals.getNode("/controls/engines/engine-start-switch"),
Engine: { Engine: {
cutoff: [props.globals.getNode("/controls/engines/engine[0]/cutoff"), props.globals.getNode("/controls/engines/engine[1]/cutoff")],
cutoffSw: [props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"), props.globals.getNode("/controls/engines/engine[1]/cutoff-switch")], cutoffSw: [props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"), props.globals.getNode("/controls/engines/engine[1]/cutoff-switch")],
firePb: [props.globals.getNode("/controls/engines/engine[0]/fire-btn"), props.globals.getNode("/controls/engines/engine[1]/fire-btn")], firePb: [props.globals.getNode("/controls/engines/engine[0]/fire-btn"), props.globals.getNode("/controls/engines/engine[1]/fire-btn")],
throttle: [props.globals.getNode("/controls/engines/engine[0]/throttle"), props.globals.getNode("/controls/engines/engine[1]/throttle")], throttle: [props.globals.getNode("/controls/engines/engine[0]/throttle"), props.globals.getNode("/controls/engines/engine[1]/throttle")],
@ -30,6 +31,7 @@ var Controls = {
throttleOutput: [props.globals.getNode("/controls/engines/engine[0]/throttle-output"), props.globals.getNode("/controls/engines/engine[1]/throttle-output")], throttleOutput: [props.globals.getNode("/controls/engines/engine[0]/throttle-output"), props.globals.getNode("/controls/engines/engine[1]/throttle-output")],
throttlePos: [props.globals.getNode("/controls/engines/engine[0]/throttle-pos"), props.globals.getNode("/controls/engines/engine[1]/throttle-pos")], throttlePos: [props.globals.getNode("/controls/engines/engine[0]/throttle-pos"), props.globals.getNode("/controls/engines/engine[1]/throttle-pos")],
throttleRev: [props.globals.getNode("/controls/engines/engine[0]/throttle-rev"), props.globals.getNode("/controls/engines/engine[1]/throttle-rev")], throttleRev: [props.globals.getNode("/controls/engines/engine[0]/throttle-rev"), props.globals.getNode("/controls/engines/engine[1]/throttle-rev")],
starter: [props.globals.getNode("/controls/engines/engine[0]/starter"), props.globals.getNode("/controls/engines/engine[1]/starter")],
reverser: [props.globals.getNode("/controls/engines/engine[0]/reverser"), props.globals.getNode("/controls/engines/engine[1]/reverser")], reverser: [props.globals.getNode("/controls/engines/engine[0]/reverser"), props.globals.getNode("/controls/engines/engine[1]/reverser")],
}, },
}, },

View file

@ -18,45 +18,43 @@ var shutdown_time = 20;
var egt_shutdown_time = 20; var egt_shutdown_time = 20;
var eng_init = func { var eng_init = func {
setprop("/controls/engines/engine[0]/man-start", 0);
setprop("/controls/engines/engine[1]/man-start", 0);
eng_common_init(); eng_common_init();
} }
# Trigger Startups and Stops # Trigger Startups and Stops
setlistener("/controls/engines/engine[0]/cutoff-switch", func { setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { if (!pts.Controls.Engines.Engine.cutoffSw[0].getValue()) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) { if (pts.Acconfig.running.getValue()) {
fast_start_one(); fast_start_one();
} else { } else {
if (getprop("/controls/engines/engine[0]/man-start") == 0) { if (!manStart[0].getValue()) {
start_one_check(); start_one_check();
} else if (getprop("/controls/engines/engine[0]/man-start") == 1) { } else {
eng_one_man_start.start(); eng_one_man_start.start();
} }
} }
} else if (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 1) { } else if (pts.Controls.Engines.Engine.cutoffSw[0].getValue()) {
cutoff_one(); cutoff_one();
} }
}); }, 0, 0);
var cutoff_one = func { var cutoff_one = func {
eng_one_auto_start.stop(); eng_one_auto_start.stop();
eng_one_man_start.stop(); eng_one_man_start.stop();
eng_one_n2_check.stop(); eng_one_n2_check.stop();
setprop("/controls/engines/engine[0]/igniter-a", 0); igniterA[0].setValue(0);
setprop("/controls/engines/engine[0]/igniter-b", 0); igniterB[0].setValue(0);
setprop("/controls/engines/engine[0]/man-start", 0); manStart[0].setValue(0);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
setprop("/controls/engines/engine[0]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[0].setValue(1);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop(); eng_one_n2_check.stop();
} }
var fast_start_one = func { var fast_start_one = func {
setprop("/controls/engines/engine[0]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[0].setValue(0);
setprop("/engines/engine[0]/out-of-fuel", 0); setprop("/engines/engine[0]/out-of-fuel", 0);
setprop("/engines/engine[0]/run", 1); setprop("/engines/engine[0]/run", 1);
@ -65,81 +63,81 @@ var fast_start_one = func {
setprop("/fdm/jsbsim/propulsion/set-running", 0); setprop("/fdm/jsbsim/propulsion/set-running", 0);
setprop("/engines/engine[0]/state", 3); pts.Engines.Engine.state[0].setValue(3);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
} }
setlistener("/controls/engines/engine[0]/man-start", func { setlistener("/controls/engines/engine[0]/man-start", func {
start_one_mancheck(); start_one_mancheck();
}); }, 0, 0);
var start_one_mancheck = func { var start_one_mancheck = func {
if (getprop("/controls/engines/engine[0]/man-start") == 1) { if (manStart[0].getValue()) {
if (getprop("/controls/engines/engine-start-switch") == 2 and (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 1)) { if (pts.Controls.Engines.startSw.getValue() == 2 and (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 1)) {
setprop("/systems/pneumatics/valves/starter-valve-1", 1); systems.PNEU.Valves.starter1.setValue(1);
settimer(start_one_mancheck_b, 0.5); settimer(start_one_mancheck_b, 0.5);
} }
} else { } else {
if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) { if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) {
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
} }
} }
} }
var start_one_mancheck_b = func { var start_one_mancheck_b = func {
if (systems.PNEU.Psi.engine1.getValue() >= 25) { if (systems.PNEU.Psi.engine1.getValue() >= 25) {
setprop("/engines/engine[0]/state", 1); pts.Engines.Engine.state[0].setValue(1);
setprop("/controls/engines/engine[0]/starter", 1); pts.Controls.Engines.Engine.starter[0].setValue(1);
} }
} }
var start_one_check = func { var start_one_check = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { if (pts.Controls.Engines.startSw.getValue() == 2 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) {
setprop("/systems/pneumatics/valves/starter-valve-1", 1); systems.PNEU.Valves.starter1.setValue(1);
settimer(start_one_check_b, 0.5); settimer(start_one_check_b, 0.5);
} }
} }
var start_one_check_b = func { var start_one_check_b = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and systems.PNEU.Psi.engine1.getValue() and !pts.Controls.Engines.Engine.cutoffSw[0].getValue()) { if (pts.Controls.Engines.startSw.getValue() == 2 and systems.PNEU.Psi.engine1.getValue() >= 25and !pts.Controls.Engines.Engine.cutoffSw[0].getValue()) {
auto_start_one(); auto_start_one();
} }
} }
setlistener("/controls/engines/engine[1]/cutoff-switch", func { setlistener("/controls/engines/engine[1]/cutoff-switch", func {
if (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { if (!pts.Controls.Engines.Engine.cutoffSw[1].getValue()) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) { if (pts.Acconfig.running.getValue()) {
fast_start_two(); fast_start_two();
} else { } else {
if (getprop("/controls/engines/engine[1]/man-start") == 0) { if (!manStart[1].getValue()) {
start_two_check(); start_two_check();
} else if (getprop("/controls/engines/engine[1]/man-start") == 1) { } else {
eng_two_man_start.start(); eng_two_man_start.start();
} }
} }
} else if (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 1) { } else if (pts.Controls.Engines.Engine.cutoffSw[1].getValue()) {
cutoff_two(); cutoff_two();
} }
}); }, 0, 0);
var cutoff_two = func { var cutoff_two = func {
eng_two_auto_start.stop(); eng_two_auto_start.stop();
eng_two_man_start.stop(); eng_two_man_start.stop();
eng_two_n2_check.stop(); eng_two_n2_check.stop();
setprop("/controls/engines/engine[1]/igniter-a", 0); igniterA[1].setValue(0);
setprop("/controls/engines/engine[1]/igniter-b", 0); igniterB[1].setValue(0);
setprop("/controls/engines/engine[1]/man-start", 0); manStart[1].setValue(0);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
setprop("/controls/engines/engine[1]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[1].setValue(1);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
var fast_start_two = func { var fast_start_two = func {
setprop("/controls/engines/engine[1]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[1].setValue(0);
setprop("/engines/engine[1]/out-of-fuel", 0); setprop("/engines/engine[1]/out-of-fuel", 0);
setprop("/engines/engine[1]/run", 1); setprop("/engines/engine[1]/run", 1);
@ -148,69 +146,69 @@ var fast_start_two = func {
setprop("/fdm/jsbsim/propulsion/set-running", 1); setprop("/fdm/jsbsim/propulsion/set-running", 1);
setprop("/engines/engine[1]/state", 3); pts.Engines.Engine.state[1].setValue(3);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
} }
setlistener("/controls/engines/engine[1]/man-start", func { setlistener("/controls/engines/engine[1]/man-start", func {
start_two_mancheck(); start_two_mancheck();
}); }, 0, 0);
var start_two_mancheck = func { var start_two_mancheck = func {
if (getprop("/controls/engines/engine[1]/man-start") == 1) { if (manStart[1].getValue() == 1) {
if (getprop("/controls/engines/engine-start-switch") == 2 and (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 1)) { if (pts.Controls.Engines.startSw.getValue() == 2 and (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 1)) {
setprop("/systems/pneumatics/valves/starter-valve-2", 1); systems.PNEU.Valves.starter2.setValue(1);
settimer(start_two_mancheck_b, 0.5); settimer(start_two_mancheck_b, 0.5);
} }
} else { } else {
if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) { if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) {
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
} }
} }
} }
var start_two_mancheck_b = func { var start_two_mancheck_b = func {
if (systems.PNEU.Psi.engine2.getValue() >= 25) { if (systems.PNEU.Psi.engine2.getValue() >= 25) {
setprop("/engines/engine[1]/state", 1); pts.Engines.Engine.state[1].setValue(1);
setprop("/controls/engines/engine[1]/starter", 1); pts.Controls.Engines.Engine.starter[1].setValue(1);
} }
} }
var start_two_check = func { var start_two_check = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { if (pts.Controls.Engines.startSw.getValue() == 2 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) {
setprop("/systems/pneumatics/valves/starter-valve-2", 1); systems.PNEU.Valves.starter2.setValue(1);
settimer(start_two_check_b, 0.5); settimer(start_two_check_b, 0.5);
} }
} }
var start_two_check_b = func { var start_two_check_b = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and systems.PNEU.Psi.engine2.getValue() >= 25 and !pts.Controls.Engines.Engine.cutoffSw[1].getValue()) { if (pts.Controls.Engines.startSw.getValue() == 2 and systems.PNEU.Psi.engine2.getValue() >= 25 and !pts.Controls.Engines.Engine.cutoffSw[1].getValue()) {
auto_start_two(); auto_start_two();
} }
} }
# Start Engine One # Start Engine One
var auto_start_one = func { var auto_start_one = func {
setprop("/engines/engine[0]/state", 1); pts.Engines.Engine.state[0].setValue(1);
setprop("/controls/engines/engine[0]/starter", 1); pts.Controls.Engines.Engine.starter[0].setValue(1);
eng_one_auto_start.start(); eng_one_auto_start.start();
} }
var eng_one_auto_start = maketimer(0.5, func { var eng_one_auto_start = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[0].getValue() >= 22) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 22) {
eng_one_auto_start.stop(); eng_one_auto_start.stop();
setprop("/engines/engine[0]/state", 2); pts.Engines.Engine.state[0].setValue(2);
setprop("/controls/engines/engine[0]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[0].setValue(0);
if (getprop("/controls/engines/engine[0]/last-igniter") == "B") { if (lastIgniter[0].getValue() == "B") {
setprop("/controls/engines/engine[0]/igniter-a", 1); igniterA[0].setValue(1);
setprop("/controls/engines/engine[0]/igniter-b", 0); igniterB[0].setValue(0);
setprop("/controls/engines/engine[0]/last-igniter", "A"); lastIgniter[0].setValue("A");
} else if (getprop("/controls/engines/engine[0]/last-igniter") == "A") { } else if (lastIgniter[0].getValue() == "A") {
setprop("/controls/engines/engine[0]/igniter-a", 0); igniterA[0].setValue(0);
setprop("/controls/engines/engine[0]/igniter-b", 1); igniterB[0].setValue(1);
setprop("/controls/engines/engine[0]/last-igniter", "B"); lastIgniter[0].setValue("B");
} }
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_egt_check.start(); eng_one_egt_check.start();
@ -221,10 +219,10 @@ var eng_one_auto_start = maketimer(0.5, func {
var eng_one_man_start = maketimer(0.5, func { var eng_one_man_start = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[0].getValue() >= 16.7) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 16.7) {
eng_one_man_start.stop(); eng_one_man_start.stop();
setprop("/engines/engine[0]/state", 2); pts.Engines.Engine.state[0].setValue(2);
setprop("/controls/engines/engine[0]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[0].setValue(0);
setprop("/controls/engines/engine[0]/igniter-a", 1); igniterA[0].setValue(1);
setprop("/controls/engines/engine[0]/igniter-b", 1); igniterB[0].setValue(1);
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_egt_check.start(); eng_one_egt_check.start();
eng_one_n2_check.start(); eng_one_n2_check.start();
@ -232,7 +230,7 @@ var eng_one_man_start = maketimer(0.5, func {
}); });
var eng_one_egt_check = maketimer(0.5, func { var eng_one_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[0]/egt-actual") >= egt_start) { if (pts.Engines.Engine.egtActual[0].getValue() >= egt_start) {
eng_one_egt_check.stop(); eng_one_egt_check.stop();
interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time); interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time);
} }
@ -240,40 +238,40 @@ var eng_one_egt_check = maketimer(0.5, func {
var eng_one_n2_check = maketimer(0.5, func { var eng_one_n2_check = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[0].getValue() >= 43.0) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 43.0) {
if (getprop("/controls/engines/engine[0]/igniter-a") != 0) { if (igniterA[0].getValue() != 0) {
setprop("/controls/engines/engine[0]/igniter-a", 0); igniterA[0].setValue(0);
} }
if (getprop("/controls/engines/engine[0]/igniter-b") != 0) { if (igniterB[0].getValue() != 0) {
setprop("/controls/engines/engine[0]/igniter-b", 0); igniterB[0].setValue(0);
} }
} }
if (pts.Engines.Engine.n2Actual[0].getValue() >= 57.0) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 57.0) {
eng_one_n2_check.stop(); eng_one_n2_check.stop();
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 3); pts.Engines.Engine.state[0].setValue(3);
} }
}); });
# Start Engine Two # Start Engine Two
var auto_start_two = func { var auto_start_two = func {
setprop("/engines/engine[1]/state", 1); pts.Engines.Engine.state[1].setValue(1);
setprop("/controls/engines/engine[1]/starter", 1); pts.Controls.Engines.Engine.starter[1].setValue(1);
eng_two_auto_start.start(); eng_two_auto_start.start();
} }
var eng_two_auto_start = maketimer(0.5, func { var eng_two_auto_start = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[1].getValue() >= 22) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 22) {
eng_two_auto_start.stop(); eng_two_auto_start.stop();
setprop("/engines/engine[1]/state", 2); pts.Engines.Engine.state[1].setValue(2);
setprop("/controls/engines/engine[1]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[1].setValue(0);
if (getprop("/controls/engines/engine[1]/last-igniter") == "B") { if (lastIgniter[1].getValue() == "B") {
setprop("/controls/engines/engine[1]/igniter-a", 1); igniterA[1].setValue(1);
setprop("/controls/engines/engine[1]/igniter-b", 0); igniterB[1].setValue(0);
setprop("/controls/engines/engine[1]/last-igniter", "A"); lastIgniter[1].setValue("A");
} else if (getprop("/controls/engines/engine[1]/last-igniter") == "A") { } else if (lastIgniter[1].getValue() == "A") {
setprop("/controls/engines/engine[1]/igniter-a", 0); igniterA[1].setValue(0);
setprop("/controls/engines/engine[1]/igniter-b", 1); igniterB[1].setValue(1);
setprop("/controls/engines/engine[1]/last-igniter", "B"); lastIgniter[1].setValue("B");
} }
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_egt_check.start(); eng_two_egt_check.start();
@ -284,10 +282,10 @@ var eng_two_auto_start = maketimer(0.5, func {
var eng_two_man_start = maketimer(0.5, func { var eng_two_man_start = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[1].getValue() >= 16.7) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 16.7) {
eng_two_man_start.stop(); eng_two_man_start.stop();
setprop("/engines/engine[1]/state", 2); pts.Engines.Engine.state[1].setValue(2);
setprop("/controls/engines/engine[1]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[1].setValue(0);
setprop("/controls/engines/engine[1]/igniter-a", 1); igniterA[1].setValue(1);
setprop("/controls/engines/engine[1]/igniter-b", 1); igniterB[1].setValue(1);
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_egt_check.start(); eng_two_egt_check.start();
eng_two_n2_check.start(); eng_two_n2_check.start();
@ -295,7 +293,7 @@ var eng_two_man_start = maketimer(0.5, func {
}); });
var eng_two_egt_check = maketimer(0.5, func { var eng_two_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[1]/egt-actual") >= egt_start) { if (pts.Engines.Engine.egtActual[1].getValue() >= egt_start) {
eng_two_egt_check.stop(); eng_two_egt_check.stop();
interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time); interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time);
} }
@ -303,17 +301,17 @@ var eng_two_egt_check = maketimer(0.5, func {
var eng_two_n2_check = maketimer(0.5, func { var eng_two_n2_check = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[1].getValue() >= 50.0) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 50.0) {
if (getprop("/controls/engines/engine[1]/igniter-a") != 0) { if (igniterA[1].getValue() != 0) {
setprop("/controls/engines/engine[1]/igniter-a", 0); igniterA[1].setValue(0);
} }
if (getprop("/controls/engines/engine[1]/igniter-b") != 0) { if (igniterB[1].getValue() != 0) {
setprop("/controls/engines/engine[1]/igniter-b", 0); igniterB[1].setValue(0);
} }
} }
if (pts.Engines.Engine.n2Actual[1].getValue() >= 57.0) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 57.0) {
eng_two_n2_check.stop(); eng_two_n2_check.stop();
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 3); pts.Engines.Engine.state[1].setValue(3);
} }
}); });
@ -327,31 +325,31 @@ setlistener("/controls/engines/engine-start-switch", func {
start_two_check(); start_two_check();
start_two_mancheck(); start_two_mancheck();
} }
if ((getprop("/controls/engines/engine-start-switch") == 0) or (getprop("/controls/engines/engine-start-switch") == 1)) { if ((pts.Controls.Engines.startSw.getValue() == 0) or (pts.Controls.Engines.startSw.getValue() == 1)) {
if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) { if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) {
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
setprop("/controls/engines/engine[0]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[0].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
} }
if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) { if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) {
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
setprop("/controls/engines/engine[1]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[1].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
} }
}); }, 0, 0);
setlistener("/systems/pneumatics/psi/engine-1-psi", func { setlistener("/systems/pneumatics/psi/engine-1-psi", func {
if (systems.PNEU.Psi.engine1.getValue() < 24.5) { if (systems.PNEU.Psi.engine1.getValue() < 24.5) {
if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) { if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) {
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
setprop("/controls/engines/engine[0]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[0].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
} }
} }
@ -360,10 +358,10 @@ setlistener("/systems/pneumatics/psi/engine-1-psi", func {
setlistener("/systems/pneumatics/psi/engine-2-psi", func { setlistener("/systems/pneumatics/psi/engine-2-psi", func {
if (systems.PNEU.Psi.engine2.getValue() < 24.5) { if (systems.PNEU.Psi.engine2.getValue() < 24.5) {
if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) { if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) {
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
setprop("/controls/engines/engine[1]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[1].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
} }

View file

@ -3,6 +3,11 @@
# Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Josh Davidson (Octal450)
var manStart = [props.globals.initNode("/controls/engines/engine[0]/man-start", 0, "BOOL"),props.globals.initNode("/controls/engines/engine[1]/man-start", 0, "BOOL")];
var lastIgniter = [props.globals.getNode("/controls/engines/engine[0]/last-igniter"),props.globals.initNode("/controls/engines/engine[1]/last-igniter")];
var igniterA = [props.globals.initNode("/controls/engines/engine[0]/igniter-a", 0, "BOOL"),props.globals.initNode("/controls/engines/engine[1]/igniter-a", 0, "BOOL")];
var igniterB = [props.globals.initNode("/controls/engines/engine[0]/igniter-b", 0, "BOOL"),props.globals.initNode("/controls/engines/engine[1]/igniter-b", 0, "BOOL")];
if (pts.Options.eng.getValue() == "IAE") { if (pts.Options.eng.getValue() == "IAE") {
io.include("engines-iae.nas"); io.include("engines-iae.nas");
} else { } else {
@ -10,7 +15,8 @@ if (pts.Options.eng.getValue() == "IAE") {
} }
var eng_common_init = func { var eng_common_init = func {
# nada manStart[0].setValue(0);
manStart[1].setValue(0);
} }
# Engine thrust commands # Engine thrust commands

View file

@ -17,46 +17,45 @@ var egt_lightdn_time = 10;
var shutdown_time = 20; var shutdown_time = 20;
var egt_shutdown_time = 20; var egt_shutdown_time = 20;
var eng_init = func { var eng_init = func {
setprop("/controls/engines/engine[0]/man-start", 0);
setprop("/controls/engines/engine[1]/man-start", 0);
eng_common_init(); eng_common_init();
} }
# Trigger Startups and Stops # Trigger Startups and Stops
setlistener("/controls/engines/engine[0]/cutoff-switch", func { setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { if (!pts.Controls.Engines.Engine.cutoffSw[0].getValue()) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) { if (pts.Acconfig.running.getValue()) {
fast_start_one(); fast_start_one();
} else { } else {
if (getprop("/controls/engines/engine[0]/man-start") == 0) { if (!manStart[0].getValue()) {
start_one_check(); start_one_check();
} else if (getprop("/controls/engines/engine[0]/man-start") == 1) { } else if (manStart[0].getValue()) {
eng_one_man_start.start(); eng_one_man_start.start();
} }
} }
} else if (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 1) { } else if (pts.Controls.Engines.Engine.cutoffSw[0].getValue()) {
cutoff_one(); cutoff_one();
} }
}); }, 0, 0);
var cutoff_one = func { var cutoff_one = func {
eng_one_auto_start.stop(); eng_one_auto_start.stop();
eng_one_man_start.stop(); eng_one_man_start.stop();
eng_one_n2_check.stop(); eng_one_n2_check.stop();
setprop("/controls/engines/engine[0]/igniter-a", 0); igniterA[0].setValue(0);
setprop("/controls/engines/engine[0]/igniter-b", 0); igniterB[0].setValue(0);
setprop("/controls/engines/engine[0]/man-start", 0); manStart[0].setValue(0);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
setprop("/controls/engines/engine[0]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[0].setValue(1);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop(); eng_one_n2_check.stop();
} }
var fast_start_one = func { var fast_start_one = func {
setprop("/controls/engines/engine[0]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[0].setValue(0);
setprop("/engines/engine[0]/out-of-fuel", 0); setprop("/engines/engine[0]/out-of-fuel", 0);
setprop("/engines/engine[0]/run", 1); setprop("/engines/engine[0]/run", 1);
@ -65,81 +64,81 @@ var fast_start_one = func {
setprop("/fdm/jsbsim/propulsion/set-running", 0); setprop("/fdm/jsbsim/propulsion/set-running", 0);
setprop("/engines/engine[0]/state", 3); pts.Engines.Engine.state[0].setValue(3);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
} }
setlistener("/controls/engines/engine[0]/man-start", func { setlistener("/controls/engines/engine[0]/man-start", func {
start_one_mancheck(); start_one_mancheck();
}); }, 0, 0);
var start_one_mancheck = func { var start_one_mancheck = func {
if (getprop("/controls/engines/engine[0]/man-start") == 1) { if (manStart[0].getValue()) {
if (getprop("/controls/engines/engine-start-switch") == 2 and (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 1)) { if (pts.Controls.Engines.startSw.getValue() == 2 and (pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 1)) {
setprop("/systems/pneumatics/valves/starter-valve-1", 1); systems.PNEU.Valves.starter1.setValue(1);
settimer(start_one_mancheck_b, 0.5); settimer(start_one_mancheck_b, 0.5);
} }
} else { } else {
if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) { if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) {
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
} }
} }
} }
var start_one_mancheck_b = func { var start_one_mancheck_b = func {
if (systems.PNEU.Psi.engine1.getValue() >= 25) { if (systems.PNEU.Psi.engine1.getValue() >= 25) {
setprop("/engines/engine[0]/state", 1); pts.Engines.Engine.state[0].setValue(1);
setprop("/controls/engines/engine[0]/starter", 1); pts.Controls.Engines.Engine.starter[0].setValue(1);
} }
} }
var start_one_check = func { var start_one_check = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { if (pts.Controls.Engines.startSw.getValue() == 2 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) {
setprop("/systems/pneumatics/valves/starter-valve-1", 1); systems.PNEU.Valves.starter1.setValue(1);
settimer(start_one_check_b, 0.5); settimer(start_one_check_b, 0.5);
} }
} }
var start_one_check_b = func { var start_one_check_b = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and systems.PNEU.Psi.engine1.getValue() and !pts.Controls.Engines.Engine.cutoffSw[0].getValue()) { if (pts.Controls.Engines.startSw.getValue() == 2 and systems.PNEU.Psi.engine1.getValue() >= 25 and !pts.Controls.Engines.Engine.cutoffSw[0].getValue()) {
auto_start_one(); auto_start_one();
} }
} }
setlistener("/controls/engines/engine[1]/cutoff-switch", func { setlistener("/controls/engines/engine[1]/cutoff-switch", func {
if (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { if (!pts.Controls.Engines.Engine.cutoffSw[1].getValue()) {
if (getprop("/systems/acconfig/autoconfig-running") == 1) { if (pts.Acconfig.running.getValue()) {
fast_start_two(); fast_start_two();
} else { } else {
if (getprop("/controls/engines/engine[1]/man-start") == 0) { if (!manStart[1].getValue()) {
start_two_check(); start_two_check();
} else if (getprop("/controls/engines/engine[1]/man-start") == 1) { } else if (manStart[1].getValue()) {
eng_two_man_start.start(); eng_two_man_start.start();
} }
} }
} else if (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 1) { } else if (pts.Controls.Engines.Engine.cutoffSw[1].getValue()) {
cutoff_two(); cutoff_two();
} }
}); }, 0, 0);
var cutoff_two = func { var cutoff_two = func {
eng_two_auto_start.stop(); eng_two_auto_start.stop();
eng_two_man_start.stop(); eng_two_man_start.stop();
eng_two_n2_check.stop(); eng_two_n2_check.stop();
setprop("/controls/engines/engine[1]/igniter-a", 0); igniterA[1].setValue(0);
setprop("/controls/engines/engine[1]/igniter-b", 0); igniterB[1].setValue(0);
setprop("/controls/engines/engine[1]/man-start", 0); manStart[1].setValue(0);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
setprop("/controls/engines/engine[1]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[1].setValue(1);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
var fast_start_two = func { var fast_start_two = func {
setprop("/controls/engines/engine[1]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[1].setValue(0);
setprop("/engines/engine[1]/out-of-fuel", 0); setprop("/engines/engine[1]/out-of-fuel", 0);
setprop("/engines/engine[1]/run", 1); setprop("/engines/engine[1]/run", 1);
@ -148,69 +147,69 @@ var fast_start_two = func {
setprop("/fdm/jsbsim/propulsion/set-running", 1); setprop("/fdm/jsbsim/propulsion/set-running", 1);
setprop("/engines/engine[1]/state", 3); pts.Engines.Engine.state[1].setValue(3);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
} }
setlistener("/controls/engines/engine[1]/man-start", func { setlistener("/controls/engines/engine[1]/man-start", func {
start_two_mancheck(); start_two_mancheck();
}); }, 0, 0);
var start_two_mancheck = func { var start_two_mancheck = func {
if (getprop("/controls/engines/engine[1]/man-start") == 1) { if (manStart[1].getValue() == 1) {
if (getprop("/controls/engines/engine-start-switch") == 2 and (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 1)) { if (pts.Controls.Engines.startSw.getValue() == 2 and (pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 1)) {
setprop("/systems/pneumatics/valves/starter-valve-2", 1); systems.PNEU.Valves.starter2.setValue(1);
settimer(start_two_mancheck_b, 0.5); settimer(start_two_mancheck_b, 0.5);
} }
} else { } else {
if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) { if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) {
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
} }
} }
} }
var start_two_mancheck_b = func { var start_two_mancheck_b = func {
if (systems.PNEU.Psi.engine1.getValue() >= 25) { if (systems.PNEU.Psi.engine1.getValue() >= 25) {
setprop("/engines/engine[1]/state", 1); pts.Engines.Engine.state[1].setValue(1);
setprop("/controls/engines/engine[1]/starter", 1); pts.Controls.Engines.Engine.starter[1].setValue(1);
} }
} }
var start_two_check = func { var start_two_check = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { if (pts.Controls.Engines.startSw.getValue() == 2 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) {
setprop("/systems/pneumatics/valves/starter-valve-2", 1); systems.PNEU.Valves.starter2.setValue(1);
settimer(start_two_check_b, 0.5); settimer(start_two_check_b, 0.5);
} }
} }
var start_two_check_b = func { var start_two_check_b = func {
if (getprop("/controls/engines/engine-start-switch") == 2 and systems.PNEU.Psi.engine2.getValue() >= 25 and !pts.Controls.Engines.Engine.cutoffSw[1].getValue()) { if (pts.Controls.Engines.startSw.getValue() == 2 and systems.PNEU.Psi.engine2.getValue() >= 25 and !pts.Controls.Engines.Engine.cutoffSw[1].getValue()) {
auto_start_two(); auto_start_two();
} }
} }
# Start Engine One # Start Engine One
var auto_start_one = func { var auto_start_one = func {
setprop("/engines/engine[0]/state", 1); pts.Engines.Engine.state[0].setValue(1);
setprop("/controls/engines/engine[0]/starter", 1); pts.Controls.Engines.Engine.starter[0].setValue(1);
eng_one_auto_start.start(); eng_one_auto_start.start();
} }
var eng_one_auto_start = maketimer(0.5, func { var eng_one_auto_start = maketimer(0.5, func {
if (pts.Engines.Engine.n1Actual[0].getValue() >= 4.7) { if (pts.Engines.Engine.n1Actual[0].getValue() >= 4.7) {
eng_one_auto_start.stop(); eng_one_auto_start.stop();
setprop("/engines/engine[0]/state", 2); pts.Engines.Engine.state[0].setValue(2);
setprop("/controls/engines/engine[0]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[0].setValue(0);
if (getprop("/controls/engines/engine[0]/last-igniter") == "B") { if (lastIgniter[0].getValue() == "B") {
setprop("/controls/engines/engine[0]/igniter-a", 1); igniterA[0].setValue(1);
setprop("/controls/engines/engine[0]/igniter-b", 0); igniterB[0].setValue(0);
setprop("/controls/engines/engine[0]/last-igniter", "A"); lastIgniter[0].setValue("A");
} else if (getprop("/controls/engines/engine[0]/last-igniter") == "A") { } else if (lastIgniter[0].getValue() == "A") {
setprop("/controls/engines/engine[0]/igniter-a", 0); igniterA[0].setValue(0);
setprop("/controls/engines/engine[0]/igniter-b", 1); igniterB[0].setValue(1);
setprop("/controls/engines/engine[0]/last-igniter", "B"); lastIgniter[0].setValue("B");
} }
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_egt_check.start(); eng_one_egt_check.start();
@ -221,10 +220,10 @@ var eng_one_auto_start = maketimer(0.5, func {
var eng_one_man_start = maketimer(0.5, func { var eng_one_man_start = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[0].getValue() >= 16.7) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 16.7) {
eng_one_man_start.stop(); eng_one_man_start.stop();
setprop("/engines/engine[0]/state", 2); pts.Engines.Engine.state[0].setValue(2);
setprop("/controls/engines/engine[0]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[0].setValue(0);
setprop("/controls/engines/engine[0]/igniter-a", 1); igniterA[0].setValue(1);
setprop("/controls/engines/engine[0]/igniter-b", 1); igniterB[0].setValue(1);
interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[0].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_one_egt_check.start(); eng_one_egt_check.start();
eng_one_n2_check.start(); eng_one_n2_check.start();
@ -232,7 +231,7 @@ var eng_one_man_start = maketimer(0.5, func {
}); });
var eng_one_egt_check = maketimer(0.5, func { var eng_one_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[0]/egt-actual") >= egt_start) { if (pts.Engines.Engine.egtActual[0].getValue() >= egt_start) {
eng_one_egt_check.stop(); eng_one_egt_check.stop();
interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time); interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time);
} }
@ -240,40 +239,40 @@ var eng_one_egt_check = maketimer(0.5, func {
var eng_one_n2_check = maketimer(0.5, func { var eng_one_n2_check = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[0].getValue() >= 43.0) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 43.0) {
if (getprop("/controls/engines/engine[0]/igniter-a") != 0) { if (igniterA[0].getValue() != 0) {
setprop("/controls/engines/engine[0]/igniter-a", 0); igniterA[0].setValue(0);
} }
if (getprop("/controls/engines/engine[0]/igniter-b") != 0) { if (igniterB[0].getValue() != 0) {
setprop("/controls/engines/engine[0]/igniter-b", 0); igniterB[0].setValue(0);
} }
} }
if (pts.Engines.Engine.n2Actual[0].getValue() >= 57.0) { if (pts.Engines.Engine.n2Actual[0].getValue() >= 57.0) {
eng_one_n2_check.stop(); eng_one_n2_check.stop();
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 3); pts.Engines.Engine.state[0].setValue(3);
} }
}); });
# Start Engine Two # Start Engine Two
var auto_start_two = func { var auto_start_two = func {
setprop("/engines/engine[1]/state", 1); pts.Engines.Engine.state[1].setValue(1);
setprop("/controls/engines/engine[1]/starter", 1); pts.Controls.Engines.Engine.starter[1].setValue(1);
eng_two_auto_start.start(); eng_two_auto_start.start();
} }
var eng_two_auto_start = maketimer(0.5, func { var eng_two_auto_start = maketimer(0.5, func {
if (pts.Engines.Engine.n1Actual[1].getValue() >= 4.7) { if (pts.Engines.Engine.n1Actual[1].getValue() >= 4.7) {
eng_two_auto_start.stop(); eng_two_auto_start.stop();
setprop("/engines/engine[1]/state", 2); pts.Engines.Engine.state[1].setValue(2);
setprop("/controls/engines/engine[1]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[1].setValue(0);
if (getprop("/controls/engines/engine[1]/last-igniter") == "B") { if (lastIgniter[1].getValue() == "B") {
setprop("/controls/engines/engine[1]/igniter-a", 1); igniterA[1].setValue(1);
setprop("/controls/engines/engine[1]/igniter-b", 0); igniterB[1].setValue(0);
setprop("/controls/engines/engine[1]/last-igniter", "A"); lastIgniter[1].setValue("A");
} else if (getprop("/controls/engines/engine[1]/last-igniter") == "A") { } else if (lastIgniter[1].getValue() == "A") {
setprop("/controls/engines/engine[1]/igniter-a", 0); igniterA[1].setValue(0);
setprop("/controls/engines/engine[1]/igniter-b", 1); igniterB[1].setValue(1);
setprop("/controls/engines/engine[1]/last-igniter", "B"); lastIgniter[1].setValue("B");
} }
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_egt_check.start(); eng_two_egt_check.start();
@ -284,10 +283,10 @@ var eng_two_auto_start = maketimer(0.5, func {
var eng_two_man_start = maketimer(0.5, func { var eng_two_man_start = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[1].getValue() >= 16.7) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 16.7) {
eng_two_man_start.stop(); eng_two_man_start.stop();
setprop("/engines/engine[1]/state", 2); pts.Engines.Engine.state[1].setValue(2);
setprop("/controls/engines/engine[1]/cutoff", 0); pts.Controls.Engines.Engine.cutoff[1].setValue(0);
setprop("/controls/engines/engine[1]/igniter-a", 1); igniterA[1].setValue(1);
setprop("/controls/engines/engine[1]/igniter-b", 1); igniterB[1].setValue(1);
interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time); interpolate(engines[1].getNode("egt-actual"), egt_start, egt_lightup_time);
eng_two_egt_check.start(); eng_two_egt_check.start();
eng_two_n2_check.start(); eng_two_n2_check.start();
@ -295,7 +294,7 @@ var eng_two_man_start = maketimer(0.5, func {
}); });
var eng_two_egt_check = maketimer(0.5, func { var eng_two_egt_check = maketimer(0.5, func {
if (getprop("/engines/engine[1]/egt-actual") >= egt_start) { if (pts.Engines.Engine.egtActual[1].getValue() >= egt_start) {
eng_two_egt_check.stop(); eng_two_egt_check.stop();
interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time); interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time);
} }
@ -303,17 +302,17 @@ var eng_two_egt_check = maketimer(0.5, func {
var eng_two_n2_check = maketimer(0.5, func { var eng_two_n2_check = maketimer(0.5, func {
if (pts.Engines.Engine.n2Actual[1].getValue() >= 43.0) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 43.0) {
if (getprop("/controls/engines/engine[1]/igniter-a") != 0) { if (igniterA[1].getValue() != 0) {
setprop("/controls/engines/engine[1]/igniter-a", 0); igniterA[1].setValue(0);
} }
if (getprop("/controls/engines/engine[1]/igniter-b") != 0) { if (igniterB[1].getValue() != 0) {
setprop("/controls/engines/engine[1]/igniter-b", 0); igniterB[1].setValue(0);
} }
} }
if (pts.Engines.Engine.n2Actual[1].getValue() >= 57.0) { if (pts.Engines.Engine.n2Actual[1].getValue() >= 57.0) {
eng_two_n2_check.stop(); eng_two_n2_check.stop();
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 3); pts.Engines.Engine.state[1].setValue(3);
} }
}); });
@ -327,31 +326,31 @@ setlistener("/controls/engines/engine-start-switch", func {
start_two_check(); start_two_check();
start_two_mancheck(); start_two_mancheck();
} }
if ((getprop("/controls/engines/engine-start-switch") == 0) or (getprop("/controls/engines/engine-start-switch") == 1)) { if ((pts.Controls.Engines.startSw.getValue() == 0) or (pts.Controls.Engines.startSw.getValue() == 1)) {
if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) { if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) {
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
setprop("/controls/engines/engine[0]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[0].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
} }
if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) { if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) {
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
setprop("/controls/engines/engine[1]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[1].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
} }
}); }, 0, 0);
setlistener("/systems/pneumatics/psi/engine-1-psi", func { setlistener("/systems/pneumatics/psi/engine-1-psi", func {
if (systems.PNEU.Psi.engine1.getValue() < 24.5) { if (systems.PNEU.Psi.engine1.getValue() < 24.5) {
if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) { if (pts.Engines.Engine.state[0].getValue() == 1 or pts.Engines.Engine.state[0].getValue() == 2) {
setprop("/controls/engines/engine[0]/starter", 0); pts.Controls.Engines.Engine.starter[0].setValue(0);
setprop("/controls/engines/engine[0]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[0].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-1", 0); systems.PNEU.Valves.starter1.setValue(0);
setprop("/engines/engine[0]/state", 0); pts.Engines.Engine.state[0].setValue(0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
} }
} }
@ -360,10 +359,10 @@ setlistener("/systems/pneumatics/psi/engine-1-psi", func {
setlistener("/systems/pneumatics/psi/engine-2-psi", func { setlistener("/systems/pneumatics/psi/engine-2-psi", func {
if (systems.PNEU.Psi.engine2.getValue() < 24.5) { if (systems.PNEU.Psi.engine2.getValue() < 24.5) {
if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) { if (pts.Engines.Engine.state[1].getValue() == 1 or pts.Engines.Engine.state[1].getValue() == 2) {
setprop("/controls/engines/engine[1]/starter", 0); pts.Controls.Engines.Engine.starter[1].setValue(0);
setprop("/controls/engines/engine[1]/cutoff", 1); pts.Controls.Engines.Engine.cutoff[1].setValue(1);
setprop("/systems/pneumatics/valves/starter-valve-2", 0); systems.PNEU.Valves.starter2.setValue(0);
setprop("/engines/engine[1]/state", 0); pts.Engines.Engine.state[1].setValue(0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
} }

View file

@ -97,6 +97,8 @@ var PNEU = {
pack2: props.globals.getNode("/systems/air-conditioning/valves/flow-control-valve-2"), pack2: props.globals.getNode("/systems/air-conditioning/valves/flow-control-valve-2"),
ramAir: props.globals.getNode("/systems/air-conditioning/valves/ram-air"), ramAir: props.globals.getNode("/systems/air-conditioning/valves/ram-air"),
hotAir: props.globals.getNode("/systems/air-conditioning/valves/hot-air"), hotAir: props.globals.getNode("/systems/air-conditioning/valves/hot-air"),
starter1: props.globals.getNode("/systems/pneumatics/valves/starter-valve-1"),
starter2: props.globals.getNode("/systems/pneumatics/valves/starter-valve-2"),
}, },
pressMode: props.globals.getNode("/systems/pressurization/mode", 1), pressMode: props.globals.getNode("/systems/pressurization/mode", 1),
init: func() { init: func() {