1
0
Fork 0

Fix ref to old prop, remove old apu system, acconfig

This commit is contained in:
legoboyvdlp R 2020-04-17 23:41:36 +01:00
parent 6d95b51604
commit d0d6c8fa82
5 changed files with 28 additions and 104 deletions

View file

@ -306,7 +306,6 @@ var colddark = func {
var colddark_b = func { var colddark_b = func {
# Continues the Cold and Dark script, after engines fully shutdown. # Continues the Cold and Dark script, after engines fully shutdown.
setprop("controls/apu/master", 0); setprop("controls/apu/master", 0);
setprop("controls/apu/start", 0);
settimer(func { settimer(func {
setprop("controls/gear/brake-left", 0); setprop("controls/gear/brake-left", 0);
setprop("controls/gear/brake-right", 0); setprop("controls/gear/brake-right", 0);
@ -343,15 +342,14 @@ var beforestart = func {
libraries.systemsInit(); libraries.systemsInit();
failResetOld(); failResetOld();
setprop("controls/apu/master", 0); setprop("controls/apu/master", 0);
setprop("controls/apu/start", 0);
# Now the Startup! # Now the Startup!
props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-1").setValue(1);
props.globals.getNode("controls/electrical/switches/bat-2").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(1);
setprop("controls/apu/master", 1); setprop("controls/apu/master", 1);
setprop("controls/apu/start", 1); systems.APUController.APU.startCommand(1);
var apu_rpm_chk = setlistener("/systems/apu/rpm", func { var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func {
if (getprop("systems/apu/rpm") >= 98) { if (getprop("engines/engine[2]/n1") >= 98) {
removelistener(apu_rpm_chk); removelistener(apu_rpm_chk);
beforestart_b(); beforestart_b();
} }
@ -434,15 +432,14 @@ var taxi = func {
libraries.systemsInit(); libraries.systemsInit();
failResetOld(); failResetOld();
setprop("controls/apu/master", 0); setprop("controls/apu/master", 0);
setprop("controls/apu/start", 0);
# Now the Startup! # Now the Startup!
props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-1").setValue(1);
props.globals.getNode("controls/electrical/switches/bat-2").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(1);
setprop("controls/apu/master", 1); setprop("controls/apu/master", 1);
setprop("controls/apu/start", 1); systems.APUController.APU.startCommand(1);
var apu_rpm_chk = setlistener("/systems/apu/rpm", func { var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func {
if (getprop("systems/apu/rpm") >= 98) { if (getprop("engines/engine[2]/n1") >= 98) {
removelistener(apu_rpm_chk); removelistener(apu_rpm_chk);
taxi_b(); taxi_b();
} }
@ -511,7 +508,6 @@ var taxi_d = func {
# After Start items. # After Start items.
setprop("controls/engines/engine-start-switch", 1); setprop("controls/engines/engine-start-switch", 1);
setprop("controls/apu/master", 0); setprop("controls/apu/master", 0);
setprop("controls/apu/start", 0);
setprop("controls/pneumatic/switches/bleedapu", 0); setprop("controls/pneumatic/switches/bleedapu", 0);
setprop("controls/gear/brake-left", 0); setprop("controls/gear/brake-left", 0);
setprop("controls/gear/brake-right", 0); setprop("controls/gear/brake-right", 0);

View file

@ -14,7 +14,7 @@ var fac1Node = props.globals.getNode("controls/fctl/switches/fac1", 1);
var state1Node = props.globals.getNode("engines/engine[0]/state", 1); var state1Node = props.globals.getNode("engines/engine[0]/state", 1);
var state2Node = props.globals.getNode("engines/engine[1]/state", 1); var state2Node = props.globals.getNode("engines/engine[1]/state", 1);
var wowNode = props.globals.getNode("fdm/jsbsim/position/wow", 1); var wowNode = props.globals.getNode("fdm/jsbsim/position/wow", 1);
var apu_rpm = props.globals.getNode("systems/apu/rpm", 1); var apu_rpm = props.globals.getNode("engines/engine[2]/n1", 1);
var wing_pb = props.globals.getNode("controls/switches/wing", 1); var wing_pb = props.globals.getNode("controls/switches/wing", 1);
var apumaster = props.globals.getNode("controls/apu/master", 1); var apumaster = props.globals.getNode("controls/apu/master", 1);
var apu_bleedSw = props.globals.getNode("controls/pneumatic/switches/bleedapu", 1); var apu_bleedSw = props.globals.getNode("controls/pneumatic/switches/bleedapu", 1);
@ -424,7 +424,7 @@ var messages_priority_3 = func {
ECAM_controller.warningReset(eng1FireGnevacSw); ECAM_controller.warningReset(eng1FireGnevacSw);
} }
if (eng1FireGnevacApu.clearFlag == 0 and getprop("controls/apu/master") and getprop("systems/apu/rpm") > 99) { if (eng1FireGnevacApu.clearFlag == 0 and getprop("controls/apu/master") and getprop("engines/engine[2]/n1") > 99) {
eng1FireGnevacApu.active = 1; eng1FireGnevacApu.active = 1;
} else { } else {
ECAM_controller.warningReset(eng1FireGnevacApu); ECAM_controller.warningReset(eng1FireGnevacApu);
@ -607,7 +607,7 @@ var messages_priority_3 = func {
ECAM_controller.warningReset(eng2FireGnevacSw); ECAM_controller.warningReset(eng2FireGnevacSw);
} }
if (eng2FireGnevacApu.clearFlag == 0 and getprop("controls/apu/master") and getprop("systems/apu/rpm") > 99) { if (eng2FireGnevacApu.clearFlag == 0 and getprop("controls/apu/master") and getprop("engines/engine[2]/n1") > 99) {
eng2FireGnevacApu.active = 1; eng2FireGnevacApu.active = 1;
} else { } else {
ECAM_controller.warningReset(eng2FireGnevacApu); ECAM_controller.warningReset(eng2FireGnevacApu);
@ -1660,13 +1660,13 @@ var messages_right_memo = func {
ignition.active = 0; ignition.active = 0;
} }
if (getprop("controls/pneumatic/switches/bleedapu") == 1 and getprop("systems/apu/rpm") >= 95) { if (getprop("controls/pneumatic/switches/bleedapu") == 1 and getprop("engines/engine[2]/n1") >= 95) {
apu_bleed.active = 1; apu_bleed.active = 1;
} else { } else {
apu_bleed.active = 0; apu_bleed.active = 0;
} }
if (apu_bleed.active == 0 and getprop("systems/apu/rpm") >= 95) { if (apu_bleed.active == 0 and getprop("engines/engine[2]/n1") >= 95) {
apu_avail.active = 1; apu_avail.active = 1;
} else { } else {
apu_avail.active = 0; apu_avail.active = 0;

View file

@ -26,6 +26,7 @@ var APU = {
listenStopSignal: 0, listenStopSignal: 0,
bleedTime: 0, bleedTime: 0,
cooldownEndTime: 0, cooldownEndTime: 0,
startFast: 0,
warnings: { warnings: {
lowOilLevel: 0, lowOilLevel: 0,
}, },
@ -56,6 +57,7 @@ var APU = {
me.signals.bleedWasUsed = 0; me.signals.bleedWasUsed = 0;
me.signals.fault = 0; me.signals.fault = 0;
me.signals.autoshutdown = 0; me.signals.autoshutdown = 0;
me.startFast = 0;
checkApuStartTimer.stop(); checkApuStartTimer.stop();
apuStartTimer.stop(); apuStartTimer.stop();
apuStartTimer2.stop(); apuStartTimer2.stop();
@ -94,14 +96,15 @@ var APU = {
}, 3); }, 3);
settimer(func() { me.checkOil }, 8); settimer(func() { me.checkOil }, 8);
}, },
startCommand: func() { startCommand: func(fast = 0) {
if (me.listenSignals and (me.state == 1 or me.state == 2)) { if (me.listenSignals and (me.state == 1 or me.state == 2)) {
me.signals.startInProgress.setValue(1); me.signals.startInProgress.setValue(1);
me.startFast = fast;
me.setState(3); me.setState(3);
checkApuStartTimer.start(); checkApuStartTimer.start();
} }
}, },
checkApuStart: func() { checkApuStart: func(fast) {
if (pts.APU.rpm.getValue() < 7 and me.fuelValvePos.getValue() and me.inletFlapPos.getValue() == 1 and me.signals.oilTestComplete and !me.warnings.lowOilLevel) { if (pts.APU.rpm.getValue() < 7 and me.fuelValvePos.getValue() and me.inletFlapPos.getValue() == 1 and me.signals.oilTestComplete and !me.warnings.lowOilLevel) {
me.setState(4); me.setState(4);
me.listenStopSignal = 1; me.listenStopSignal = 1;
@ -111,6 +114,16 @@ var APU = {
}, },
startSequence: func() { startSequence: func() {
me.GenericControls.starter.setValue(1); me.GenericControls.starter.setValue(1);
if (me.startFast) {
setprop("controls/engines/engine[2]/cutoff", 0);
setprop("engines/engine[2]/out-of-fuel", 0);
setprop("engines/engine[2]/run", 1);
setprop("engines/engine[2]/cutoff", 0);
setprop("engines/engine[2]/starter", 0);
setprop("fdm/jsbsim/propulsion/set-running", 0);
}
apuStartTimer.start(); apuStartTimer.start();
}, },
waitStart: func() { waitStart: func() {

View file

@ -9,95 +9,10 @@ if (getprop("options/eng") == "IAE") {
io.include("engines-cfm.nas"); 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);
setprop("systems/apu/bleed-used", 0);
setprop("systems/apu/bleed-counting", 0);
setprop("systems/apu/bleed-time", 0);
var eng_common_init = func { var eng_common_init = func {
setprop("systems/apu/bleed-used", 0); # nada
} }
# Start APU
setlistener("/controls/apu/start", func {
if (getprop("controls/apu/master") == 1 and getprop("controls/apu/start") == 1) {
apuBleedChk.stop();
setprop("systems/apu/bleed-counting", 0);
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();
} else if (getprop("controls/apu/master") == 1) {
apuBleedChk.stop();
setprop("systems/apu/bleed-counting", 0);
setprop("systems/apu/bleed-used", 0);
}
});
var apu_stop = func {
if (getprop("systems/apu/bleed-used") == 1 and getprop("systems/apu/bleed-counting") != 1 and getprop("systems/acconfig/autoconfig-running") != 1) {
setprop("systems/apu/bleed-counting", 1);
setprop("systems/apu/bleed-time", getprop("sim/time/elapsed-sec"));
}
if (getprop("systems/apu/bleed-used") == 1 and getprop("systems/apu/bleed-counting") == 1 and getprop("systems/acconfig/autoconfig-running") != 1) {
apuBleedChk.start();
} else {
apuBleedChk.stop();
interpolate("/systems/apu/rpm", 0, 30);
interpolate("/systems/apu/egt", 42, 40);
setprop("systems/apu/bleed-counting", 0);
setprop("systems/apu/bleed-used", 0);
}
}
var apuBleedChk = maketimer(0.1, func {
if (getprop("systems/apu/bleed-used") == 1 and getprop("systems/apu/bleed-counting") == 1) {
if (getprop("systems/apu/bleed-time") + 60 <= getprop("sim/time/elapsed-sec")) {
apuBleedChk.stop();
interpolate("/systems/apu/rpm", 0, 30);
interpolate("/systems/apu/egt", 42, 40);
setprop("systems/apu/bleed-counting", 0);
setprop("systems/apu/bleed-used", 0);
}
}
});
# Various Other Stuff # Various Other Stuff
var doIdleThrust = func { var doIdleThrust = func {
# Idle does not respect selected engines, because it is used to respond # Idle does not respect selected engines, because it is used to respond

View file

@ -1323,7 +1323,7 @@
<test logic="OR"> <test logic="OR">
/controls/electrical/switches/apu eq 0 /controls/electrical/switches/apu eq 0
/systems/failures/electrical/apu eq 1 /systems/failures/electrical/apu eq 1
/systems/apu/rpm lt 94.9 /engines/engine[2]/n1 lt 94.9
</test> </test>
</test> </test>
</switch> </switch>