From a9a1e4ad39dbbe9ab77aac4f1b6f803348f36d61 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 24 Apr 2017 13:46:44 +0100 Subject: [PATCH] pneumatics and basic LGCIU --- A319-100-IAE-set.xml | 2 + A320-200-IAE-set.xml | 2 + A321-200-IAE-set.xml | 2 + ACJ-IAE-set.xml | 2 + AircraftConfig/acconfig.nas | 12 +-- Models/Instruments/OHpanel/OHpanel.xml | 10 +-- Nasal/ADIRS.nas | 2 +- Nasal/engines.nas | 8 +- Nasal/hydraulics.nas | 76 ++++++++++++++++++ Nasal/pneumatics.nas | 104 +++++++++++++++++++++++++ Nasal/systems.nas | 4 +- 11 files changed, 207 insertions(+), 17 deletions(-) create mode 100644 Nasal/hydraulics.nas create mode 100644 Nasal/pneumatics.nas diff --git a/A319-100-IAE-set.xml b/A319-100-IAE-set.xml index 28a3bae6..9fa8a4a4 100644 --- a/A319-100-IAE-set.xml +++ b/A319-100-IAE-set.xml @@ -90,6 +90,8 @@ Aircraft/A320Family/Nasal/electrical.nas Aircraft/A320Family/Nasal/engines.nas Aircraft/A320Family/Nasal/ADIRS.nas + Aircraft/A320Family/Nasal/hydraulics.nas + Aircraft/A320Family/Nasal/pneumatics.nas Aircraft/A320Family/Nasal/it-fbw.nas diff --git a/A320-200-IAE-set.xml b/A320-200-IAE-set.xml index 0f423434..6a1633fd 100644 --- a/A320-200-IAE-set.xml +++ b/A320-200-IAE-set.xml @@ -83,6 +83,8 @@ Aircraft/A320Family/Nasal/electrical.nas Aircraft/A320Family/Nasal/engines.nas Aircraft/A320Family/Nasal/ADIRS.nas + Aircraft/A320Family/Nasal/hydraulics.nas + Aircraft/A320Family/Nasal/pneumatics.nas Aircraft/A320Family/Nasal/it-fbw.nas diff --git a/A321-200-IAE-set.xml b/A321-200-IAE-set.xml index a25b82cc..b7debff8 100644 --- a/A321-200-IAE-set.xml +++ b/A321-200-IAE-set.xml @@ -83,6 +83,8 @@ Aircraft/A320Family/Nasal/electrical.nas Aircraft/A320Family/Nasal/engines.nas Aircraft/A320Family/Nasal/ADIRS.nas + Aircraft/A320Family/Nasal/hydraulics.nas + Aircraft/A320Family/Nasal/pneumatics.nas Aircraft/A320Family/Nasal/it-fbw.nas diff --git a/ACJ-IAE-set.xml b/ACJ-IAE-set.xml index 8e6730ae..65b68976 100644 --- a/ACJ-IAE-set.xml +++ b/ACJ-IAE-set.xml @@ -89,6 +89,8 @@ Aircraft/A320Family/Nasal/electrical.nas Aircraft/A320Family/Nasal/engines.nas Aircraft/A320Family/Nasal/ADIRS.nas + Aircraft/A320Family/Nasal/hydraulics.nas + Aircraft/A320Family/Nasal/pneumatics.nas Aircraft/A320Family/Nasal/it-fbw.nas diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 9c059a57..f689af6d 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -54,7 +54,7 @@ var colddark_b = func { # Continues the Cold and Dark script, after engines fully shutdown. setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); - setprop("/controls/APU/bleed", 0); + setprop("/controls/bleed/OHP/bleedapu", 0); setprop("/controls/electrical/switches/gen-apu", 0); setprop("/controls/electrical/switches/battery1", 0); setprop("/controls/electrical/switches/battery2", 0); @@ -85,7 +85,7 @@ var beforestart = func { setprop("/it-autoflight/input/fd2", 1); setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); - setprop("/controls/APU/bleed", 0); + setprop("/controls/bleed/OHP/bleedapu", 0); setprop("/controls/electrical/switches/gen-apu", 0); setprop("/controls/electrical/switches/battery1", 0); setprop("/controls/electrical/switches/battery2", 0); @@ -106,7 +106,7 @@ var beforestart_b = func { # Continue with engine start prep. setprop("/controls/electrical/switches/gen-apu", 1); setprop("/controls/electrical/switches/galley", 1); - setprop("/controls/APU/bleed", 1); + setprop("/controls/bleed/OHP/bleedapu", 1); setprop("/controls/electrical/switches/gen1", 1); setprop("/controls/electrical/switches/gen2", 1); setprop("controls/adirs/ir[0]/knob","2"); @@ -145,7 +145,7 @@ var taxi = func { setprop("/it-autoflight/input/fd2", 1); setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); - setprop("/controls/APU/bleed", 0); + setprop("/controls/bleed/OHP/bleedapu", 0); setprop("/controls/electrical/switches/gen-apu", 0); setprop("/controls/electrical/switches/battery1", 0); setprop("/controls/electrical/switches/battery2", 0); @@ -166,7 +166,7 @@ var taxi_b = func { # Continue with engine start prep, and start engine 2. setprop("/controls/electrical/switches/gen-apu", 1); setprop("/controls/electrical/switches/galley", 1); - setprop("/controls/APU/bleed", 1); + setprop("/controls/bleed/OHP/bleedapu", 1); setprop("/controls/electrical/switches/gen1", 1); setprop("/controls/electrical/switches/gen2", 1); setprop("controls/adirs/ir[0]/knob","2"); @@ -200,7 +200,7 @@ var taxi_c = func { var taxi_d = func { # After Start items. setprop("/controls/engines/engine-start-switch", 1); - setprop("/controls/APU/bleed", 0); + setprop("/controls/bleed/OHP/bleedapu", 0); setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); setprop("/systems/acconfig/autoconfig-running", 0); diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 7dc3fad2..f04ed05f 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -1854,7 +1854,7 @@ false property-toggle - controls/pneumatic/engine[0]/bleed + controls/bleed/OHP/bleed1 @@ -1863,7 +1863,7 @@ Engine 1 bleed on textranslate Eng1BleedBtn2 - controls/pneumatic/engine[0]/bleed + controls/bleed/OHP/bleed1 0.5 1 @@ -1883,7 +1883,7 @@ false property-toggle - controls/APU/bleed + controls/bleed/OHP/bleedapu @@ -1932,7 +1932,7 @@ false property-toggle - controls/pneumatic/engine[1]/bleed + controls/bleed/OHP/bleed2 @@ -1940,7 +1940,7 @@ Engine 2 bleed on textranslate Eng2BleedBtn2 - controls/pneumatic/engine[1]/bleed + controls/bleed/OHP/bleed2 0.5 1 diff --git a/Nasal/ADIRS.nas b/Nasal/ADIRS.nas index eced1f36..d851a858 100644 --- a/Nasal/ADIRS.nas +++ b/Nasal/ADIRS.nas @@ -14,7 +14,7 @@ setprop("/systems/electrical/bus/ac1", 0); setprop("/systems/electrical/bus/ac2", 0); setprop("/systems/electrical/bus/ac-ess", 0); -var ADIRSinit = func { +var adirs_init = func { var motionroll = getprop("/controls/adirs/motionroll"); var motionpitch = getprop("/controls/adirs/motionpitch"); setprop("controls/adirs/skip",0); #define this here, as we want this to be off on startup diff --git a/Nasal/engines.nas b/Nasal/engines.nas index 57f19f58..c0d1e4df 100644 --- a/Nasal/engines.nas +++ b/Nasal/engines.nas @@ -48,7 +48,7 @@ setlistener("/controls/engines/engine[0]/cutoff-switch", func { }); var start_one_check = func { - if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/controls/APU/bleed") == 1) and (getprop("/systems/apu/rpm") >= 98)) { + if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/controls/bleed/OHP/bleedapu") == 1) and (getprop("/systems/apu/rpm") >= 98)) { auto_start_one(); } } @@ -65,7 +65,7 @@ setlistener("/controls/engines/engine[1]/cutoff-switch", func { }); var start_two_check = func { - if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/controls/APU/bleed") == 1) and (getprop("/systems/apu/rpm") >= 98)) { + if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/controls/bleed/OHP/bleedapu") == 1) and (getprop("/systems/apu/rpm") >= 98)) { auto_start_two(); } } @@ -174,8 +174,8 @@ setlistener("/controls/engines/engine-start-switch", func { } }); -setlistener("/controls/APU/bleed", func { - if (getprop("/controls/APU/bleed") == 0) { +setlistener("/controls/bleed/OHP/bleedapu", func { + if (getprop("/controls/bleed/OHP/bleedapu") == 0) { if (getprop("/controls/engines/engine[0]/state") == 1) { eng_one_stop(); } diff --git a/Nasal/hydraulics.nas b/Nasal/hydraulics.nas new file mode 100644 index 00000000..08c20c7a --- /dev/null +++ b/Nasal/hydraulics.nas @@ -0,0 +1,76 @@ +# A320Family LGCIU +# Jonathan Redpath + +##################### +# Initializing Vars # +##################### +var lgciu_init = func { +#Hydraulics +setprop("controls/LGCIU/hyd/safetyvalvepos",0); #1 is closed, 0 is open. +setprop("controls/LGCIU/hyd/cutoffvalvepos",0); #1 is closed, 0 is open. +setprop("controls/LGCIU/hyd/doorselvalvepos",1); #1 is closed, 0 is open. +setprop("controls/LGCIU/hyd/gearselvalvepos",1); #1 is closed, 0 is open. +#Sensors +setprop("controls/LGCIU/sensor/ten",1); #1 is yes condition, ie on ground. Used to prohibit retraction on ground +setprop("controls/LGCIU/sensor/adr1and3flt",0); +setprop("controls/LGCIU/inhibit",1); +#Timers +safety_valve_ADR_timer.start(); +sensorten.start(); +} + +var safety_valve_ADR = setlistener("controls/LGCIU/sensor/adr1and3flt", func { +var ADRfault = getprop("controls/LGCIU/sensor/adr1and3flt"); +if (ADRfault) { +setprop("controls/LGCIU/hyd/safetyvalvepos",1); #close valve if we have ADR 1 + 3 FAULT +} +}); + +var gear_retract_inhibit = setlistener("controls/LGCIU/sensor/ten", func { +var sens10 = getprop("controls/LGCIU/sensor/ten"); +var gearcmd = getprop("gear/gear-cmd-norm"); +if (sens10) { +setprop("controls/LGCIU/inhibit",1); #use this property in gear retraction logic, eg if not gearinhib +} else { +setprop("controls/LGCIU/inhibit",0); +} +}); + + +# Logic: +#On the 320 series, the LGCIU, controls the safety valve when either ADR 1 or 3 has an indicated airspeed greater than 260KIAS, the valve will close preventing extension in flight. There is also a function where when the aircraft senses it's on the ground, the valve also closes to prevent inadvertent gear retraction. +#ADR 1/3 less than 260 kts with L/G lever down ----> safety valve is open(lets hydraulic fluid pass through it) {take off condition} +#ADR 1/3 less than 260 kts with L/G lever up ----> safety valve is still open as there is a 'Self Maintained' logic. {initial climb condition} As soon as ADR 1/3 more than 260 kts the safety valve will close (stop the hydraulic supply) {cruise} +#ADR 1/3 more than 260 kts with L/G lever up ----> safety valve will remain close and when ADR 1/3 drops below 260 kts with L/G lever up it will still remain close. It will open only when L/G lever is selected down.{descent condition} + +var ADRlock = setlistener("controls/LGCIU/hyd/safetyvalvepos", func { #lock the valve if there is an ADR 1 + 3 fault +var ADRfault = getprop("controls/LGCIU/sensor/adr1and3flt"); +var valve = getprop("controls/LGCIU/hyd/safetyvalvepos"); +if (!valve and ADRfault) { +setprop("controls/LGCIU/hyd/safetyvalvepos",1); +} +}); + +var safety_valve_ADR_timer = maketimer(1, func { +var ADR1 = getprop("controls/adirs/ir[0]/fault"); +var ADR3 = getprop("controls/adirs/ir[2]/fault"); +if (ADR1 and ADR3) { +setprop("controls/LGCIU/sensor/adr1and3flt", 1); +} else { +setprop("controls/LGCIU/sensor/adr1and3flt", 0); +} +}); + +var sensorten = maketimer(0.1, func { +var gearpos = getprop("/gear/gear[0]/position-norm"); +var gearpo1 = getprop("/gear/gear[1]/position-norm"); +var gearpo2 = getprop("/gear/gear[2]/position-norm"); +var gear1comp = getprop("gear/gear[0]/compression-norm"); +var gear2comp = getprop("gear/gear[1]/compression-norm"); +var gear3comp = getprop("gear/gear[2]/compression-norm"); +if (gearpos and gearpo1 and gearpo2 and ((gear1comp > 0) and (gear2comp > 0) and (gear3comp > 0))) { +setprop("controls/LGCIU/sensor/ten",1); #1 is yes condition, ie on ground. Used to prohibit retraction on ground +} else { +setprop("controls/LGCIU/sensor/ten",0); #1 is yes condition, ie on ground. Used to prohibit retraction on ground +} +}); \ No newline at end of file diff --git a/Nasal/pneumatics.nas b/Nasal/pneumatics.nas new file mode 100644 index 00000000..730ac626 --- /dev/null +++ b/Nasal/pneumatics.nas @@ -0,0 +1,104 @@ +var pneumatics_init = func { +#Temps and Pressures. Controls ECAM indications +setprop("/controls/bleed/BMC1/tempspsi/eng1/bleedvalvepsi",0); #eng 1 bleed pressure +setprop("/controls/bleed/BMC1/tempspsi/eng1/bleedvalvetemp",0); #eng 2 bleed temp +setprop("/controls/bleed/BMC1/tempspsi/eng2/bleedvalvepsi",0); #eng 1 bleed pressure +setprop("/controls/bleed/BMC1/tempspsi/eng2/bleedvalvetemp",0); #eng 2 bleed temp +setprop("/controls/bleed/BMC1/tempspsi/eng1/downstreamfavtemp",0); #eng 1 bleed temp upstream of precooler +setprop("/controls/bleed/BMC1/tempspsi/eng2/downstreamfavtemp",0); #eng 2 bleed temp upstream of precooler +#valves +setprop("/controls/bleed/BMC1/valves/xbleed",0); #controls xbleed valve pos +setprop("/controls/bleed/BMC1/valves/eng1/bleedvalvepos",0); #eng 1 bleed off on startup +setprop("/controls/bleed/BMC1/valves/eng1/OPRESSvalve",0); #at 75 PSI the valve moves to 50 percent closed and at 85 psi moves to 100 percent +setprop("/controls/bleed/BMC1/valves/eng1/bleedengsrc","7"); +setprop("/controls/bleed/BMC1/valves/eng1/fav",0); #limits temp upstream of bleed valve to 200C. closes as needed to maintain temp. closed on startup as engine n1 is 0 +setprop("/controls/bleed/BMC1/valves/eng2/fav",0); #limits temp upstream of bleed valve to 200C. closes as needed to maintain temp. closed on startup as engine n1 is 0 +setprop("/controls/bleed/BMC1/valves/eng2/bleedvalvepos",0); #eng 1 bleed off on startup +setprop("/controls/bleed/BMC1/valves/eng2/OPRESSvalve",0); +setprop("/controls/bleed/BMC1/valves/eng2/bleedengsrc","7"); +setprop("/controls/bleed/BMC1/valves/eng2/fav",0); +setprop("/controls/bleed/BMC1/valves/apubleed",0); #apu bleed off on startup +setprop("/controls/bleed/BMC1/valves/eng1/startvalve",0); #must be open for engine start. Opens automatically. Can get stuck (note for v.1.0) +setprop("/controls/bleed/BMC1/valves/eng2/startvalve",0); +setprop("/controls/bleed/ground",0); #ground air disco on startup. Remember that packs must be off for this, maybe make copilot screen message like 777 autopilot messages +#7th stage of HP compressor is where the bleed is normally extracted at 44 PSI +- 4 but at low N2 10th stage is selected to provide 36 +- 4 psi +#Overhead +setprop("/controls/bleed/OHP/pack1",0); +setprop("/controls/bleed/OHP/pack2",0); +setprop("/controls/bleed/OHP/bleed1",0); +setprop("/controls/bleed/OHP/bleed2",0); +setprop("/controls/bleed/OHP/xbleed",0); #controls xbleed valve MODE +setprop("/controls/bleed/OHP/bleedapu",0); +setprop("/controls/bleed/OHP/ramair",0); +} + + + +##################### +# Bleed Valve Logic # +##################### +setlistener("/controls/bleed/OHP/bleed1", func { +var bleed1 = getprop("/controls/bleed/OHP/bleed1"); +if (bleed1) { + setprop("/controls/bleed/BMC1/valves/eng1/bleedvalvepos",1); +} else { + setprop("/controls/bleed/BMC1/valves/eng1/bleedvalvepos",0); +} +}); + +setlistener("/controls/bleed/OHP/bleed2", func { +var bleed2 = getprop("/controls/bleed/OHP/bleed2"); +if (bleed2) { + setprop("/controls/bleed/BMC1/valves/eng2/bleedvalvepos",1); +} else { + setprop("/controls/bleed/BMC1/valves/eng2/bleedvalvepos",0); +} +}); + +var bleed_valve_eng1 = func { #logic that closes the bleed valve + var opress1 = getprop("/controls/bleed/BMC1/valves/eng1/OPRESSvalve"); + var apubleed = getprop("/controls/bleed/BMC1/valves/apubleed"); + var bleedohp1 = getprop("/controls/bleed/OHP/bleed1"); + var eng1valveopen = getprop("/controls/bleed/BMC1/valves/eng1/startvalve"); + #if (opress1 or firepb or leak or ovht or apubleed or eng1valveopen or !bleedohp1) + if (opress1 or apubleed or !bleedoph1 or eng1valveopen) { + var bleedvalve1 = getprop("/controls/bleed/BMC1/valves/eng1/bleedvalvepos"); + setprop(bleedvalve1,0); + } +} + +var bleed_valve_eng2 = func { #logic that closes the bleed valve + var opress2 = getprop("/controls/bleed/BMC1/valves/eng2/OPRESSvalve"); + var apubleed = getprop("/controls/bleed/BMC1/valves/apubleed"); + var bleedohp2 = getprop("/controls/bleed/OHP/bleed2"); + var eng2valveopen = getprop("/controls/bleed/BMC1/valves/eng2/startvalve"); + #if (opress2 or firepb or leak or ovht or apubleed or eng1valveopen or !bleedohp2) + if (opress2 or apubleed or !bleedoph2 or eng2valveopen) { + var bleedvalve2 = getprop("/controls/bleed/BMC1/valves/eng2/bleedvalvepos"); + setprop(bleedvalve2,0); + } +} + +setlistener("/controls/bleed/OHP/bleedapu", func { +var bleedAPU = getprop("/controls/bleed/OHP/bleedapu"); +if (bleedAPU) { +apubleedtimer.start(); +} else { +apubleedtimer.stop(); +setprop("/controls/bleed/BMC1/valves/xbleed",0); #close xbleed +setprop("/controls/bleed/BMC1/valves/apubleed",0); #close apu bleed +} +}); + +var apubleedtimer = maketimer(0.1, func { +var APU = getprop("/systems/apu/rpm"); +if (APU > 94.9) { +setprop("/controls/bleed/BMC1/valves/xbleed",1); #open xbleed so apu can supply both packs +setprop("/controls/bleed/BMC1/valves/eng1/bleedvalvepos",0); #close eng bleeds +setprop("/controls/bleed/BMC1/valves/eng2/bleedvalvepos",0); +setprop("/controls/bleed/OHP/bleed1",0); #close eng bleeds on OHP +setprop("/controls/bleed/OHP/bleed2",0); +setprop("/controls/bleed/BMC1/valves/apubleed",1); #open apu bleed +apubleedtimer.stop(); +} +}); \ No newline at end of file diff --git a/Nasal/systems.nas b/Nasal/systems.nas index a4ea6eca..3f2625dc 100644 --- a/Nasal/systems.nas +++ b/Nasal/systems.nas @@ -147,7 +147,9 @@ var triggerDoor = func(door, doorName, doorDesc) setlistener("/sim/signals/fdm-initialized", func { systems.elec_init(); - systems.ADIRSinit(); + systems.adirs_init(); + systems.lgciu_init(); + systems.pneumatics_init(); itaf.ap_init(); var autopilot = gui.Dialog.new("sim/gui/dialogs/autopilot/dialog", "Aircraft/A320Family/Systems/autopilot-dlg.xml"); setprop("/controls/engines/thrust-limit", "TOGA");