hydraulic system added, not connected to flight controls yet

This commit is contained in:
Joshua Davidson 2017-05-02 20:54:39 -04:00
parent ce6edfcc36
commit 9bf01fae96
15 changed files with 1354 additions and 1010 deletions

View file

@ -90,7 +90,7 @@
<file>Aircraft/A320Family/Nasal/engines.nas</file>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/pneumatics.nas</file>
<!--file>Aircraft/A320Family/Nasal/hydraulics.nas</file-->
<file>Aircraft/A320Family/Nasal/hydraulics.nas</file>
<file>Aircraft/A320Family/Nasal/ADIRS.nas</file>
</systems>
<fbw>

View file

@ -83,7 +83,7 @@
<file>Aircraft/A320Family/Nasal/engines.nas</file>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/pneumatics.nas</file>
<!--file>Aircraft/A320Family/Nasal/hydraulics.nas</file-->
<file>Aircraft/A320Family/Nasal/hydraulics.nas</file>
<file>Aircraft/A320Family/Nasal/ADIRS.nas</file>
</systems>
<fbw>

View file

@ -33,7 +33,10 @@
<electrical>
<path></path>
</electrical>
<!-- Custom FBW System -->
<!-- Custom FBW/Flight Controls System -->
<!--autopilot>
<path>Aircraft/A320Family/Systems/hydraulics.xml</path>
</autopilot-->
<autopilot>
<path>Aircraft/A320Family/Systems/it-fbw-b.xml</path>
</autopilot>
@ -406,7 +409,7 @@
<landing-lights n="1" type="bool">0</landing-lights>
<landing-lights n="2" type="bool">0</landing-lights>
<nav-lights-switch type="int">0</nav-lights-switch>
<overhead-panel-norm type="double">0.8</overhead-panel-norm>
<overhead-panel-norm type="double">0.0</overhead-panel-norm>
<main-panel-pedestal-norm type="double">0.8</main-panel-pedestal-norm>
<strobe type="bool">0</strobe>
</lighting>

View file

@ -83,7 +83,7 @@
<file>Aircraft/A320Family/Nasal/engines.nas</file>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/pneumatics.nas</file>
<!--file>Aircraft/A320Family/Nasal/hydraulics.nas</file-->
<file>Aircraft/A320Family/Nasal/hydraulics.nas</file>
<file>Aircraft/A320Family/Nasal/ADIRS.nas</file>
</systems>
<fbw>

View file

@ -89,7 +89,7 @@
<file>Aircraft/A320Family/Nasal/engines.nas</file>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/pneumatics.nas</file>
<!--file>Aircraft/A320Family/Nasal/hydraulics.nas</file-->
<file>Aircraft/A320Family/Nasal/hydraulics.nas</file>
<file>Aircraft/A320Family/Nasal/ADIRS.nas</file>
</systems>
<fbw>

View file

@ -34,7 +34,8 @@ var colddark = func {
setprop("/controls/gear/gear-down", 1);
systems.elec_init();
systems.ADIRSreset();
systems.pneumatics_init();
systems.pneu_init();
systems.hyd_init();
itaf.ap_init();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
@ -77,7 +78,8 @@ var beforestart = func {
setprop("/controls/gear/gear-down", 1);
systems.elec_init();
systems.ADIRSreset();
systems.pneumatics_init();
systems.pneu_init();
systems.hyd_init();
itaf.ap_init();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
@ -109,6 +111,9 @@ var beforestart_b = func {
setprop("/controls/pneumatic/switches/bleedapu", 1);
setprop("/controls/pneumatic/switches/bleed1", 1);
setprop("/controls/pneumatic/switches/bleed2", 1);
setprop("/controls/hydraulic/eng1-pump", 1);
setprop("/controls/hydraulic/eng2-pump", 1);
setprop("/controls/hydraulic/elec-pump-blue", 1);
setprop("controls/adirs/ir[0]/knob","2");
setprop("controls/adirs/ir[1]/knob","2");
setprop("controls/adirs/ir[2]/knob","2");
@ -138,7 +143,8 @@ var taxi = func {
setprop("/controls/gear/gear-down", 1);
systems.elec_init();
systems.ADIRSreset();
systems.pneumatics_init();
systems.pneu_init();
systems.hyd_init();
itaf.ap_init();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
@ -170,6 +176,9 @@ var taxi_b = func {
setprop("/controls/pneumatic/switches/bleedapu", 1);
setprop("/controls/pneumatic/switches/bleed1", 1);
setprop("/controls/pneumatic/switches/bleed2", 1);
setprop("/controls/hydraulic/eng1-pump", 1);
setprop("/controls/hydraulic/eng2-pump", 1);
setprop("/controls/hydraulic/elec-pump-blue", 1);
setprop("controls/adirs/ir[0]/knob","2");
setprop("controls/adirs/ir[1]/knob","2");
setprop("controls/adirs/ir[2]/knob","2");

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 4.5 MiB

File diff suppressed because it is too large Load diff

View file

@ -165,13 +165,13 @@ var apu_stop = func {
setlistener("/controls/engines/engine-start-switch", func {
if ((getprop("/controls/engines/engine-start-switch") == 0) or (getprop("/controls/engines/engine-start-switch") == 1)) {
if (getprop("/controls/engines/engine[0]/state") == 1) {
if (getprop("/controls/engines/engine[0]/state") == 1 or getprop("/controls/engines/engine[0]/state") == 2) {
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);
}
if (getprop("/controls/engines/engine[1]/state") == 1) {
if (getprop("/controls/engines/engine[1]/state") == 1 or getprop("/controls/engines/engine[1]/state") == 2) {
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/engines/engine[1]/state", 0);
@ -182,13 +182,13 @@ setlistener("/controls/engines/engine-start-switch", func {
setlistener("/systems/pneumatic/start-psi", func {
if (getprop("/systems/pneumatic/total-psi") < 12) {
if (getprop("/engines/engine[0]/state") == 1) {
if (getprop("/engines/engine[0]/state") == 1 or getprop("/controls/engines/engine[0]/state") == 2) {
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);
}
if (getprop("/engines/engine[1]/state") == 1) {
if (getprop("/engines/engine[1]/state") == 1 or getprop("/controls/engines/engine[1]/state") == 2) {
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/engines/engine[1]/state", 0);

View file

@ -1,79 +1,130 @@
# A320 Hydraulics - Disabled until complete
# A320 Hydraulic System
# Joshua Davidson (it0uchpods)
# LGCIU
# Jonathan Redpath
# Note: Will be compressed
#############
# Init Vars #
#############
#####################
# 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 hyd_init = func {
setprop("/controls/hydraulic/eng1-pump", 0);
setprop("/controls/hydraulic/eng2-pump", 0);
setprop("/controls/hydraulic/elec-pump-blue", 0);
setprop("/controls/hydraulic/elec-pump-yellow", 0);
setprop("/controls/hydraulic/ptu", 1);
setprop("/controls/hydraulic/rat-man", 0);
setprop("/systems/hydraulic/ptu-active", 0);
setprop("/systems/hydraulic/blue-psi", 0);
setprop("/systems/hydraulic/green-psi", 0);
setprop("/systems/hydraulic/yellow-psi", 0);
hyd_timer.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
#######################
# Main Hydraulic Loop #
#######################
var master_hyd = func {
var eng1_pump_sw = getprop("/controls/hydraulic/eng1-pump");
var eng2_pump_sw = getprop("/controls/hydraulic/eng2-pump");
var elec_pump_blue_sw = getprop("/controls/hydraulic/elec-pump-blue");
var elec_pump_yellow_sw = getprop("/controls/hydraulic/elec-pump-yellow");
var ptu_sw = getprop("/controls/hydraulic/ptu");
var rat_man_sw = getprop("/controls/hydraulic/rat-man");
var blue_psi = getprop("/systems/hydraulic/blue-psi");
var green_psi = getprop("/systems/hydraulic/green-psi");
var yellow_psi = getprop("/systems/hydraulic/yellow-psi");
var rpmapu = getprop("/systems/apu/rpm");
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var dc_ess = getprop("/systems/electrical/bus/dc-ess");
var psi_diff = green_psi - yellow_psi;
if (psi_diff > 500 or psi_diff < -500 and ptu_sw) {
setprop("/systems/hydraulic/ptu-active", 1);
} else if (psi_diff < 20 and psi_diff > -20) {
setprop("/systems/hydraulic/ptu-active", 0);
}
var ptu_active = getprop("/systems/hydraulic/ptu-active");
if (elec_pump_blue_sw and dc_ess >= 25 and (stateL == 3 or stateR == 3)) {
if (blue_psi < 2900) {
setprop("/systems/hydraulic/blue-psi", blue_psi + 100);
} else {
setprop("/systems/hydraulic/blue-psi", 3000);
}
} else {
if (blue_psi > 1) {
setprop("/systems/hydraulic/blue-psi", blue_psi - 0.1);
} else {
setprop("/systems/hydraulic/blue-psi", 0);
}
}
if (eng1_pump_sw and stateL == 3) {
if (green_psi < 2900) {
setprop("/systems/hydraulic/green-psi", green_psi + 100);
} else {
setprop("/systems/hydraulic/green-psi", 3000);
}
} else if (ptu_active and stateL != 3) {
if (green_psi < 2900) {
setprop("/systems/hydraulic/green-psi", green_psi + 100);
} else {
setprop("/systems/hydraulic/green-psi", 3000);
}
} else {
if (green_psi > 1) {
setprop("/systems/hydraulic/green-psi", green_psi - 0.1);
} else {
setprop("/systems/hydraulic/green-psi", 0);
}
}
if (eng2_pump_sw and stateR == 3) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 100);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (elec_pump_yellow_sw and dc_ess >= 25) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 100);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (ptu_active and stateR != 3) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 100);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else {
if (yellow_psi > 1) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi - 0.1);
} else {
setprop("/systems/hydraulic/yellow-psi", 0);
}
}
}
#######################
# Various Other Stuff #
#######################
setlistener("/controls/gear/gear-down", func {
var down = getprop("/controls/gear/gear-down");
if (!down and (getprop("/gear/gear[0]/wow") or getprop("/gear/gear[1]/wow") or getprop("/gear/gear[2]/wow"))) {
setprop("/controls/gear/gear-down", 1);
}
});
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);
###################
# Update Function #
###################
var update_hydraulic = func {
master_hyd();
}
});
# 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
}
});
var hyd_timer = maketimer(0.2, update_hydraulic);

View file

@ -62,24 +62,28 @@ var pitch_input = func {
setlistener("/sim/signals/fdm-initialized", func {
setprop("/it-fbw/override", 0);
setprop("/it-fbw/law", 2);
setprop("/it-fbw/law", 3);
update_roll.start();
update_pitch.start();
});
setlistener("/systems/electrical/bus/ac-ess", func {
fbw_law();
});
var fbw_law = func {
if (getprop("/it-fbw/override") == 0) {
if (getprop("/systems/electrical/bus/ac-ess") >= 110) {
if (getprop("/it-fbw/law") != 0) {
setprop("/it-fbw/law", 0);
}
} else {
if (getprop("/it-fbw/law") != 2) {
setprop("/it-fbw/law", 2);
if (getprop("/it-fbw/law") != 3) {
setprop("/it-fbw/law", 3);
}
}
}
});
}
##########
# Timers #

View file

@ -5,7 +5,7 @@
# Init Vars #
#############
var pneumatics_init = func {
var pneu_init = func {
setprop("/controls/pneumatic/switches/bleed1", 0);
setprop("/controls/pneumatic/switches/bleed2", 0);
setprop("/controls/pneumatic/switches/bleedapu", 0);
@ -39,7 +39,7 @@ var master_pneu = func {
var pack2_sw = getprop("/controls/pneumatic/switches/pack2");
var hot_air_sw = getprop("/controls/pneumatic/switches/hot-air");
var ram_air_sw = getprop("/controls/pneumatic/switches/ram-air");
var pack_flo_sw = getprop("/controls/pneumatic/switches/pack-flo", 1);
var pack_flo_sw = getprop("/controls/pneumatic/switches/pack-flo");
var xbleed_sw = getprop("/controls/pneumatic/switches/xbleed");
var rpmapu = getprop("/systems/apu/rpm");
var stateL = getprop("/engines/engine[0]/state");
@ -75,13 +75,13 @@ var master_pneu = func {
}
if (pack1_sw == 1 and bleed1_sw) {
setprop("/systems/pneumatic/pack1", 9);
setprop("/systems/pneumatic/pack1", pack_flo_sw);
} else {
setprop("/systems/pneumatic/pack1", 0);
}
if (pack2_sw == 1 and bleed2_sw) {
setprop("/systems/pneumatic/pack2", 9);
setprop("/systems/pneumatic/pack2", pack_flo_sw);
} else {
setprop("/systems/pneumatic/pack2", 0);
}

View file

@ -84,16 +84,9 @@ setlistener("/controls/switches/no-smoking-sign", func {
}, 2);
});
##################
# Gear and Doors #
##################
setlistener("/controls/gear/gear-down", func {
var down = props.globals.getNode("/controls/gear/gear-down").getBoolValue();
if (!down and (getprop("/gear/gear[0]/wow") or getprop("/gear/gear[1]/wow") or getprop("/gear/gear[2]/wow"))) {
props.globals.getNode("/controls/gear/gear-down").setBoolValue(1);
}
});
#########
# Doors #
#########
# Front doors
var doorl1 = aircraft.door.new("/sim/model/door-positions/doorl1", 2);
@ -135,7 +128,8 @@ var triggerDoor = func(door, doorName, doorDesc) {
setlistener("/sim/signals/fdm-initialized", func {
systems.elec_init();
systems.adirs_init();
systems.pneumatics_init();
systems.pneu_init();
systems.hyd_init();
itaf.ap_init();
var autopilot = gui.Dialog.new("sim/gui/dialogs/autopilot/dialog", "Aircraft/A320Family/Systems/autopilot-dlg.xml");
setprop("/it-autoflight/input/fd1", 1);

9
Systems/hydraulics.xml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- Airbus A3XX Hydraulics System -->
<PropertyList>
</PropertyList>