From d0d6c8fa823176042c0a90d659f433ea1e0aaf9c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 17 Apr 2020 23:41:36 +0100 Subject: [PATCH] Fix ref to old prop, remove old apu system, acconfig --- AircraftConfig/acconfig.nas | 16 ++--- Nasal/ECAM/ECAM-logic.nas | 10 +-- Nasal/Systems/APU.nas | 17 ++++- Nasal/Systems/FADEC/engines-common.nas | 87 +------------------------- Systems/a320-electrical.xml | 2 +- 5 files changed, 28 insertions(+), 104 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 93d94ca5..d7bb1a9e 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -306,7 +306,6 @@ var colddark = func { var colddark_b = func { # Continues the Cold and Dark script, after engines fully shutdown. setprop("controls/apu/master", 0); - setprop("controls/apu/start", 0); settimer(func { setprop("controls/gear/brake-left", 0); setprop("controls/gear/brake-right", 0); @@ -343,15 +342,14 @@ var beforestart = func { libraries.systemsInit(); failResetOld(); setprop("controls/apu/master", 0); - setprop("controls/apu/start", 0); # Now the Startup! props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(1); setprop("controls/apu/master", 1); - setprop("controls/apu/start", 1); - var apu_rpm_chk = setlistener("/systems/apu/rpm", func { - if (getprop("systems/apu/rpm") >= 98) { + systems.APUController.APU.startCommand(1); + var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func { + if (getprop("engines/engine[2]/n1") >= 98) { removelistener(apu_rpm_chk); beforestart_b(); } @@ -434,15 +432,14 @@ var taxi = func { libraries.systemsInit(); failResetOld(); setprop("controls/apu/master", 0); - setprop("controls/apu/start", 0); # Now the Startup! props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(1); setprop("controls/apu/master", 1); - setprop("controls/apu/start", 1); - var apu_rpm_chk = setlistener("/systems/apu/rpm", func { - if (getprop("systems/apu/rpm") >= 98) { + systems.APUController.APU.startCommand(1); + var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func { + if (getprop("engines/engine[2]/n1") >= 98) { removelistener(apu_rpm_chk); taxi_b(); } @@ -511,7 +508,6 @@ var taxi_d = func { # After Start items. setprop("controls/engines/engine-start-switch", 1); setprop("controls/apu/master", 0); - setprop("controls/apu/start", 0); setprop("controls/pneumatic/switches/bleedapu", 0); setprop("controls/gear/brake-left", 0); setprop("controls/gear/brake-right", 0); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 5a7537a1..c818bf70 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -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 state2Node = props.globals.getNode("engines/engine[1]/state", 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 apumaster = props.globals.getNode("controls/apu/master", 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); } - 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; } else { ECAM_controller.warningReset(eng1FireGnevacApu); @@ -607,7 +607,7 @@ var messages_priority_3 = func { 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; } else { ECAM_controller.warningReset(eng2FireGnevacApu); @@ -1660,13 +1660,13 @@ var messages_right_memo = func { 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; } else { 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; } else { apu_avail.active = 0; diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index 3038c299..05e9323f 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -26,6 +26,7 @@ var APU = { listenStopSignal: 0, bleedTime: 0, cooldownEndTime: 0, + startFast: 0, warnings: { lowOilLevel: 0, }, @@ -56,6 +57,7 @@ var APU = { me.signals.bleedWasUsed = 0; me.signals.fault = 0; me.signals.autoshutdown = 0; + me.startFast = 0; checkApuStartTimer.stop(); apuStartTimer.stop(); apuStartTimer2.stop(); @@ -94,14 +96,15 @@ var APU = { }, 3); settimer(func() { me.checkOil }, 8); }, - startCommand: func() { + startCommand: func(fast = 0) { if (me.listenSignals and (me.state == 1 or me.state == 2)) { me.signals.startInProgress.setValue(1); + me.startFast = fast; me.setState(3); 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) { me.setState(4); me.listenStopSignal = 1; @@ -111,6 +114,16 @@ var APU = { }, startSequence: func() { 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(); }, waitStart: func() { diff --git a/Nasal/Systems/FADEC/engines-common.nas b/Nasal/Systems/FADEC/engines-common.nas index 7d3416b4..3ccb3016 100644 --- a/Nasal/Systems/FADEC/engines-common.nas +++ b/Nasal/Systems/FADEC/engines-common.nas @@ -9,95 +9,10 @@ if (getprop("options/eng") == "IAE") { 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 { - 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 var doIdleThrust = func { # Idle does not respect selected engines, because it is used to respond diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index 8a41a756..4f83e3d2 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -1323,7 +1323,7 @@ /controls/electrical/switches/apu eq 0 /systems/failures/electrical/apu eq 1 - /systems/apu/rpm lt 94.9 + /engines/engine[2]/n1 lt 94.9