1
0
Fork 0

Add hydraulic system; bugfix IESI, fixes for the ECAM

This commit is contained in:
legoboyvdlp R 2019-10-15 16:46:38 +01:00
parent 3ce57e9476
commit 6555d85c08
12 changed files with 582 additions and 286 deletions

View file

@ -137,6 +137,8 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="glass-effect1"/> <system file="glass-effect1"/>
<system file="a320-fcs"/> <system file="a320-fcs"/>
<system file="a320-spoiler"/> <system file="a320-spoiler"/>
<system file="a320-electrical"/>
<system file="a320-hydraulic"/>
<system file="a320-lights"/> <system file="a320-lights"/>
<system file="a320-engine-fire"/> <system file="a320-engine-fire"/>

View file

@ -137,6 +137,8 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="glass-effect1"/> <system file="glass-effect1"/>
<system file="a320-fcs"/> <system file="a320-fcs"/>
<system file="a320-spoiler"/> <system file="a320-spoiler"/>
<system file="a320-electrical"/>
<system file="a320-hydraulic"/>
<system file="a320-lights"/> <system file="a320-lights"/>
<system file="a320-engine-fire"/> <system file="a320-engine-fire"/>

View file

@ -133,11 +133,12 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
</tank> </tank>
</propulsion> </propulsion>
<system file="a320-electrical"/>
<system file="fuel"/> <system file="fuel"/>
<system file="glass-effect1"/> <system file="glass-effect1"/>
<system file="a320-fcs"/> <system file="a320-fcs"/>
<system file="a320-spoiler"/> <system file="a320-spoiler"/>
<system file="a320-electrical"/>
<system file="a320-hydraulic"/>
<system file="a320-lights"/> <system file="a320-lights"/>
<system file="a320-engine-fire"/> <system file="a320-engine-fire"/>

View file

@ -137,6 +137,8 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="glass-effect1"/> <system file="glass-effect1"/>
<system file="a320-fcs"/> <system file="a320-fcs"/>
<system file="a320-spoiler"/> <system file="a320-spoiler"/>
<system file="a320-electrical"/>
<system file="a320-hydraulic"/>
<system file="a320-lights"/> <system file="a320-lights"/>
<system file="a320-engine-fire"/> <system file="a320-engine-fire"/>

View file

@ -137,6 +137,8 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="glass-effect1"/> <system file="glass-effect1"/>
<system file="a320-fcs"/> <system file="a320-fcs"/>
<system file="a320-spoiler"/> <system file="a320-spoiler"/>
<system file="a320-electrical"/>
<system file="a320-hydraulic"/>
<system file="a320-lights"/> <system file="a320-lights"/>
<system file="a320-engine-fire"/> <system file="a320-engine-fire"/>

View file

@ -80,7 +80,7 @@ var canvas_IESI_base = {
dcess = systems.ELEC.Bus.dcEss.getValue(); dcess = systems.ELEC.Bus.dcEss.getValue();
dchot1 = systems.ELEC.Bus.dcHot1.getValue(); dchot1 = systems.ELEC.Bus.dcHot1.getValue();
if (dcess >= 25 or dchot1 >= 25) { if (dcess >= 25 or (dchot1 >= 25 and airspeed.getValue() >= 50)) {
IESI.page.show(); IESI.page.show();
IESI.update(); IESI.update();
@ -97,7 +97,7 @@ var canvas_IESI_base = {
iesi_init.setBoolValue(0); iesi_init.setBoolValue(0);
} }
if (dcess >= 25 or dchot1 >= 25) { if (dcess >= 25 or (dchot1 >= 25 and airspeed.getValue() >= 50)) {
IESI.page.show(); IESI.page.show();
IESI.update(); IESI.update();
} else { } else {

View file

@ -2446,9 +2446,9 @@ var canvas_lowerECAM_hyd = {
green_psi = g_psi.getValue(); green_psi = g_psi.getValue();
yellow_psi = y_psi.getValue(); yellow_psi = y_psi.getValue();
me["Press-Green"].setText(sprintf("%s", green_psi)); me["Press-Green"].setText(sprintf("%s", math.round(green_psi, 50)));
me["Press-Blue"].setText(sprintf("%s", blue_psi)); me["Press-Blue"].setText(sprintf("%s", math.round(blue_psi, 50)));
me["Press-Yellow"].setText(sprintf("%s", yellow_psi)); me["Press-Yellow"].setText(sprintf("%s", math.round(yellow_psi, 50)));
if (blue_psi >= 1500) { if (blue_psi >= 1500) {
me["Blue-Line"].setColor(0.0509,0.7529,0.2941); me["Blue-Line"].setColor(0.0509,0.7529,0.2941);

View file

@ -1906,7 +1906,7 @@
</greater-than-equals> </greater-than-equals>
</condition> </condition>
<command>property-toggle</command> <command>property-toggle</command>
<property>controls/hydraulic/eng1-pump</property> <property>controls/hydraulic/switches/green-edp</property>
</binding> </binding>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -1922,11 +1922,11 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/hydraulic/eng1-pump-fault</property> <property>systems/hydraulic/lights/green-edp-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
<property>controls/hydraulic/eng1-pump</property> <property>controls/hydraulic/switches/green-edp</property>
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
@ -1944,7 +1944,7 @@
<condition> <condition>
<or> <or>
<equals> <equals>
<property>controls/hydraulic/eng1-pump</property> <property>controls/hydraulic/switches/green-edp</property>
<value>0</value> <value>0</value>
</equals> </equals>
<equals> <equals>
@ -1982,7 +1982,7 @@
</and> </and>
</condition> </condition>
<command>property-toggle</command> <command>property-toggle</command>
<property>controls/hydraulic/rat-man</property> <property>controls/hydraulic/switches/rat-man</property>
</binding> </binding>
<binding> <binding>
<condition> <condition>
@ -2074,7 +2074,7 @@
</greater-than-equals> </greater-than-equals>
</condition> </condition>
<command>property-toggle</command> <command>property-toggle</command>
<property>controls/hydraulic/elec-pump-blue</property> <property>controls/hydraulic/switches/blue-elec</property>
</binding> </binding>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -2090,11 +2090,11 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/hydraulic/elec-pump-b-fault</property> <property>systems/hydraulic/lights/blue-elec-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
<property>controls/hydraulic/elec-pump-blue</property> <property>controls/hydraulic/switches/blue-elec</property>
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
@ -2112,7 +2112,7 @@
<condition> <condition>
<or> <or>
<equals> <equals>
<property>controls/hydraulic/elec-pump-blue</property> <property>controls/hydraulic/switches/blue-elec</property>
<value>0</value> <value>0</value>
</equals> </equals>
<equals> <equals>
@ -2141,7 +2141,7 @@
</greater-than-equals> </greater-than-equals>
</condition> </condition>
<command>property-toggle</command> <command>property-toggle</command>
<property>controls/hydraulic/ptu</property> <property>controls/hydraulic/switches/ptu</property>
</binding> </binding>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -2157,11 +2157,11 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/hydraulic/ptu-fault</property> <property>systems/hydraulic/lights/ptu-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
<property>controls/hydraulic/ptu</property> <property>controls/hydraulic/switches/ptu</property>
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
@ -2179,7 +2179,7 @@
<condition> <condition>
<or> <or>
<equals> <equals>
<property>controls/hydraulic/ptu</property> <property>controls/hydraulic/switches/ptu</property>
<value>0</value> <value>0</value>
</equals> </equals>
<equals> <equals>
@ -2208,7 +2208,7 @@
</greater-than-equals> </greater-than-equals>
</condition> </condition>
<command>property-toggle</command> <command>property-toggle</command>
<property>controls/hydraulic/eng2-pump</property> <property>controls/hydraulic/switches/yellow-edp</property>
</binding> </binding>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -2224,11 +2224,11 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/hydraulic/eng2-pump-fault</property> <property>systems/hydraulic/lights/yellow-edp-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
<property>controls/hydraulic/eng2-pump</property> <property>controls/hydraulic/switches/yellow-edp</property>
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
@ -2246,7 +2246,7 @@
<condition> <condition>
<or> <or>
<equals> <equals>
<property>controls/hydraulic/eng2-pump</property> <property>controls/hydraulic/switches/yellow-edp</property>
<value>0</value> <value>0</value>
</equals> </equals>
<equals> <equals>
@ -2275,7 +2275,7 @@
</greater-than-equals> </greater-than-equals>
</condition> </condition>
<command>property-toggle</command> <command>property-toggle</command>
<property>controls/hydraulic/elec-pump-yellow</property> <property>controls/hydraulic/switches/yellow-elec</property>
</binding> </binding>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -2291,11 +2291,11 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/hydraulic/elec-pump-y-fault</property> <property>systems/hydraulic/lights/yellow-elec-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
<property>controls/hydraulic/elec-pump-yellow</property> <property>controls/hydraulic/switches/yellow-elec</property>
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
@ -2313,7 +2313,7 @@
<condition> <condition>
<or> <or>
<equals> <equals>
<property>controls/hydraulic/elec-pump-yellow</property> <property>controls/hydraulic/switches/yellow-elec</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>

View file

@ -799,19 +799,19 @@ var messages_priority_3 = func {
if (getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dualFail.active and phaseVar != 4 and phaseVar != 8 and emerconfig.clearFlag == 0) { if (getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dualFail.active and phaseVar != 4 and phaseVar != 8 and emerconfig.clearFlag == 0) {
emerconfig.active = 1; emerconfig.active = 1;
if (getprop("/systems/hydraulic/rat-position") != 0 and emerconfigMinRat.clearFlag == 0) { if (getprop("/systems/hydraulic/sources/rat/position") != 0 and emerconfigMinRat.clearFlag == 0) {
emerconfigMinRat.active = 1; emerconfigMinRat.active = 1;
} else { } else {
ECAM_controller.warningReset(emerconfigMinRat); ECAM_controller.warningReset(emerconfigMinRat);
} }
if (!getprop("/systems/electrical/some-electric-thingie/generator-1-reset") and !getprop("/systems/electrical/some-electric-thingie/generator-2-reset") and emerconfigGen.clearFlag == 0) { if (!(getprop("/systems/electrical/some-electric-thingie/generator-1-reset") and getprop("/systems/electrical/some-electric-thingie/generator-2-reset")) and emerconfigGen.clearFlag == 0) {
emerconfigGen.active = 1; emerconfigGen.active = 1;
} else { } else {
ECAM_controller.warningReset(emerconfigGen); ECAM_controller.warningReset(emerconfigGen);
} }
if (!getprop("/systems/electrical/some-electric-thingie/generator-1-reset-bustie") and !getprop("/systems/electrical/some-electric-thingie/generator-2-reset-bustie") and emerconfigGen2.clearFlag == 0) { if (!(getprop("/systems/electrical/some-electric-thingie/generator-1-reset-bustie") and getprop("/systems/electrical/some-electric-thingie/generator-2-reset-bustie")) and emerconfigGen2.clearFlag == 0) {
emerconfigGen2.active = 1; emerconfigGen2.active = 1;
if (getprop("/controls/electrical/switches/bus-tie")) { if (getprop("/controls/electrical/switches/bus-tie")) {
emerconfigBusTie.active = 1; emerconfigBusTie.active = 1;
@ -1124,7 +1124,7 @@ var messages_right_memo = func {
ptu.active = 0; ptu.active = 0;
} }
if (getprop("/systems/hydraulic/rat-position") != 0) { if (getprop("/systems/hydraulic/sources/rat/position") != 0) {
rat.active = 1; rat.active = 1;
} else { } else {
rat.active = 0; rat.active = 0;
@ -1136,7 +1136,7 @@ var messages_right_memo = func {
rat.colour = "g"; rat.colour = "g";
} }
if (getprop("/systems/electrical/relay/emer-glc/contact-pos") == 1 and getprop("/systems/hydraulics/rat-position") != 0 and getprop("/gear/gear[1]/wow") == 0) { if (getprop("/systems/electrical/relay/emer-glc/contact-pos") == 1 and getprop("/systems/hydraulic/sources/rat/position") != 0 and getprop("/gear/gear[1]/wow") == 0) {
emer_gen.active = 1; emer_gen.active = 1;
} else { } else {
emer_gen.active = 0; emer_gen.active = 0;

View file

@ -1,249 +1,60 @@
# A3XX Hydraulic System # A3XX Hydraulic System
# Joshua Davidson (Octal450) # Jonathan Redpath
# Copyright (c) 2019 Joshua Davidson (Octal450) # Copyright (c) 2019 Jonathan Redpath
var eng1_pump_sw = 0;
var eng2_pump_sw = 0;
var elec_pump_blue_sw = 0;
var elec_pump_yellow_sw = 0;
var yellow_hand_pump = 0;
var ptu_sw = 0;
var blue_psi = 0;
var green_psi = 0;
var yellow_psi = 0;
var rpmapu = 0;
var stateL = 0;
var stateR = 0;
var dc_ess = 0;
var psi_diff = 0;
var rat = 0;
var gs = 0;
var blue_leak = 0;
var green_leak = 0;
var yellow_leak = 0;
var blue_pump_fail = 0;
var green_pump_fail = 0;
var yellow_pump_eng_fail = 0;
var yellow_pump_elec_fail = 0;
var ptu_fail = 0;
var dc2 = 0;
var ptu_active = 0;
var accum = 0;
var lpsi = 0;
var rpsi = 0;
var parking = 0;
var askidnws_sw = 0;
var brake_mode = 0;
var brake_l = 0;
var brake_r = 0;
var brake_nose = 0;
var counter = 0;
var down = 0;
var HYD = { var HYD = {
Fail: {
blueElec: props.globals.getNode("/systems/failures/hydraulic/blue-elec"),
blueLeak: props.globals.getNode("/systems/failures/hydraulic/blue-leak"),
greenEng: props.globals.getNode("/systems/failures/hydraulic/green-edp"),
greenLeak: props.globals.getNode("/systems/failures/hydraulic/green-leak"),
ptuFault: props.globals.getNode("/systems/failures/hydraulic/ptu"),
yellowEng: props.globals.getNode("/systems/failures/hydraulic/yellow-edp"),
yellowElec: props.globals.getNode("/systems/failures/hydraulic/yellow-elec"),
yellowLeak: props.globals.getNode("/systems/failures/hydraulic/yellow-leak"),
},
Psi: {
},
Qty: {
blueInput: props.globals.initNode("/systems/hydraulic/blue-qty-input", 0, "INT"),
greenInput: props.globals.initNode("/systems/hydraulic/green-qty-input", 0, "INT"),
yellowInput: props.globals.initNode("/systems/hydraulic/yellow-qty-input", 0, "INT"),
},
Switch: {
blueElec: props.globals.getNode("/controls/hydraulic/switches/blue-elec"),
blueElecOvrd: props.globals.getNode("/controls/hydraulic/switches/blue-elec-ovrd"),
greenEDP: props.globals.getNode("/controls/hydraulic/switches/green-edp"),
ptu: props.globals.getNode("/controls/hydraulic/switches/ptu"),
rat: props.globals.getNode("/controls/hydraulic/switches/rat-man"),
yellowEDP: props.globals.getNode("/controls/hydraulic/switches/yellow-edp"),
yellowElec: props.globals.getNode("/controls/hydraulic/switches/yellow-elec"),
},
init: func() { init: func() {
setprop("/controls/hydraulic/eng1-pump", 1); me.resetFail();
setprop("/controls/hydraulic/eng2-pump", 1); me.Qty.blueInput.setValue(math.round((rand() * 4) + 8 , 0.1)); # Random between 8 and 12
setprop("/controls/hydraulic/elec-pump-blue", 1); me.Qty.greenInput.setValue(math.round((rand() * 4) + 8 , 0.1)); # Random between 8 and 12
setprop("/controls/hydraulic/elec-pump-yellow", 0); me.Qty.yellowInput.setValue(math.round((rand() * 4) + 8 , 0.1)); # Random between 8 and 12
setprop("/controls/hydraulic/hand-pump-yellow", 0); me.Switch.blueElec.setValue(1);
setprop("/controls/hydraulic/ptu", 1); me.Switch.blueElecOvrd.setValue(0);
setprop("/systems/hydraulic/ptu-active", 0); me.Switch.greenEDP.setValue(1);
setprop("/systems/hydraulic/blue-psi", 0); me.Switch.ptu.setValue(1);
setprop("/systems/hydraulic/green-psi", 0); me.Switch.rat.setValue(0);
setprop("/systems/hydraulic/yellow-psi", 0); me.Switch.yellowEDP.setValue(1);
setprop("/controls/gear/brake-parking", 0); me.Switch.yellowElec.setValue(0);
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", 0); },
setprop("/systems/hydraulic/brakes/pressure-left-psi", 0); resetFail: func() {
setprop("/systems/hydraulic/brakes/pressure-right-psi", 0); me.Fail.blueElec.setBoolValue(0);
setprop("/systems/hydraulic/brakes/askidnwssw", 1); me.Fail.blueLeak.setBoolValue(0);
setprop("/systems/hydraulic/brakes/mode", 0); me.Fail.greenEng.setBoolValue(0);
setprop("/systems/hydraulic/brakes/lbrake", 0); me.Fail.greenLeak.setBoolValue(0);
setprop("/systems/hydraulic/brakes/rbrake", 0); me.Fail.ptuFault.setBoolValue(0);
setprop("/systems/hydraulic/brakes/nose-rubber", 0); me.Fail.yellowEng.setBoolValue(0);
setprop("/systems/hydraulic/brakes/counter", 0); me.Fail.yellowElec.setBoolValue(0);
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0); me.Fail.yellowLeak.setBoolValue(0);
setprop("/systems/hydraulic/eng1-pump-fault", 0);
setprop("/systems/hydraulic/eng2-pump-fault", 0);
setprop("/systems/hydraulic/elec-pump-b-fault", 0);
setprop("/systems/hydraulic/elec-pump-y-fault", 0);
setprop("/systems/hydraulic/ptu-fault", 0);
setprop("/systems/hydraulic/ptu-supplies", "XX");
setprop("/systems/hydraulic/yellow-resv-lo-air-press", 0);
setprop("/systems/hydraulic/blue-resv-lo-air-press", 0);
setprop("/systems/hydraulic/green-resv-lo-air-press", 0);
setprop("/systems/hydraulic/yellow-resv-ovht", 0);
setprop("/systems/hydraulic/blue-resv-ovht", 0);
setprop("/systems/hydraulic/green-resv-ovht", 0);
setprop("/systems/hydraulic/elec-pump-yellow-ovht", 0);
setprop("/systems/hydraulic/elec-pump-blue-ovht", 0);
setprop("/systems/hydraulic/yellow-fire-valve", 0);
setprop("/systems/hydraulic/green-fire-valve", 0);
}, },
loop: func() { loop: func() {
eng1_pump_sw = getprop("/controls/hydraulic/eng1-pump");
eng2_pump_sw = getprop("/controls/hydraulic/eng2-pump");
elec_pump_blue_sw = getprop("/controls/hydraulic/elec-pump-blue");
elec_pump_yellow_sw = getprop("/controls/hydraulic/elec-pump-yellow");
yellow_hand_pump = getprop("/controls/hydraulic/hand-pump-yellow");
ptu_sw = getprop("/controls/hydraulic/ptu");
blue_psi = getprop("/systems/hydraulic/blue-psi");
green_psi = getprop("/systems/hydraulic/green-psi");
yellow_psi = getprop("/systems/hydraulic/yellow-psi");
rpmapu = getprop("/systems/apu/rpm");
stateL = getprop("/engines/engine[0]/state");
stateR = getprop("/engines/engine[1]/state");
dc_ess = getprop("/systems/electrical/bus/dc-ess");
psi_diff = green_psi - yellow_psi;
rat = getprop("/systems/hydraulic/rat-position");
gs = getprop("/velocities/groundspeed-kt");
blue_leak = getprop("/systems/failures/hyd-blue");
green_leak = getprop("/systems/failures/hyd-green");
yellow_leak = getprop("/systems/failures/hyd-yellow");
blue_pump_fail = getprop("/systems/failures/pump-blue");
green_pump_fail = getprop("/systems/failures/pump-green");
yellow_pump_eng_fail = getprop("/systems/failures/pump-yellow-eng");
yellow_pump_elec_fail = getprop("/systems/failures/pump-yellow-elec");
ptu_fail = getprop("/systems/failures/ptu");
dc2 = getprop("/systems/electrical/bus/dc-2");
if ((psi_diff > 500 or psi_diff < -500) and ptu_sw and dc2 > 25) {
setprop("/systems/hydraulic/ptu-active", 1);
} else if (psi_diff < 20 and psi_diff > -20) {
setprop("/systems/hydraulic/ptu-active", 0);
}
ptu_active = getprop("/systems/hydraulic/ptu-active");
if (elec_pump_blue_sw and dc_ess >= 25 and !blue_pump_fail and (stateL == 3 or stateR == 3 or getprop("/gear/gear[0]/wow") == 0) and !blue_leak) {
if (blue_psi < 2900) {
setprop("/systems/hydraulic/blue-psi", blue_psi + 50);
} else {
setprop("/systems/hydraulic/blue-psi", 3000);
}
} else if (gs >= 50 and (rat == 1) and !blue_leak) {
if (blue_psi < 2400) {
setprop("/systems/hydraulic/blue-psi", blue_psi + 50);
} else {
setprop("/systems/hydraulic/blue-psi", 2500);
}
} else {
if (blue_psi > 1) {
setprop("/systems/hydraulic/blue-psi", blue_psi - 25);
} else {
setprop("/systems/hydraulic/blue-psi", 0);
}
}
if (eng1_pump_sw and stateL == 3 and !green_pump_fail and !green_leak) {
if (green_psi < 2900) {
setprop("/systems/hydraulic/green-psi", green_psi + 50);
} else {
setprop("/systems/hydraulic/green-psi", 3000);
}
} else if (ptu_active and !ptu_fail and yellow_psi >= 1500 and !green_leak) {
if (green_psi < 2900) {
setprop("/systems/hydraulic/green-psi", green_psi + 50);
} else {
setprop("/systems/hydraulic/green-psi", 3000);
}
} else {
if (green_psi > 1) {
setprop("/systems/hydraulic/green-psi", green_psi - 25);
} else {
setprop("/systems/hydraulic/green-psi", 0);
}
}
if (eng2_pump_sw and stateR == 3 and !yellow_pump_eng_fail and !yellow_leak) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 50);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (elec_pump_yellow_sw and dc_ess >= 25 and !yellow_pump_elec_fail and !yellow_leak) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 50);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (ptu_active and !ptu_fail and green_psi >= 1500 and !yellow_leak) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 50);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (yellow_hand_pump and !yellow_leak and (getprop("/gear/gear[0]/wow") or getprop("/gear/gear[1]/wow") or getprop("/gear/gear[2]/wow"))) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 25);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else {
if (yellow_psi > 1) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi - 25);
} else {
setprop("/systems/hydraulic/yellow-psi", 0);
}
}
accum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
lpsi = getprop("/systems/hydraulic/brakes/pressure-left-psi");
rpsi = getprop("/systems/hydraulic/brakes/pressure-right-psi");
parking = getprop("/controls/gear/brake-parking");
askidnws_sw = getprop("/systems/hydraulic/brakes/askidnwssw");
brake_mode = getprop("/systems/hydraulic/brakes/mode");
brake_l = getprop("/systems/hydraulic/brakes/lbrake");
brake_r = getprop("/systems/hydraulic/brakes/rbrake");
brake_nose = getprop("/systems/hydraulic/brakes/nose-rubber");
counter = getprop("/systems/hydraulic/brakes/counter");
if (!parking and askidnws_sw and green_psi > 2500) {
# set mode to on
setprop("/systems/hydraulic/brakes/mode", 1);
} else if ((!parking and askidnws_sw and yellow_psi > 2500) or (!parking and askidnws_sw and accum > 0)) {
# set mode to altn
setprop("/systems/hydraulic/brakes/mode", 2);
} else {
# set mode to off
setprop("/systems/hydraulic/brakes/mode", 0);
}
if (brake_mode == 2 and yellow_psi > 2500 and accum < 700) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", accum + 50);
}
# Fault lights
if (green_pump_fail and eng1_pump_sw) {
setprop("/systems/hydraulic/eng1-pump-fault", 1);
} else {
setprop("/systems/hydraulic/eng1-pump-fault", 0);
}
if (blue_pump_fail and elec_pump_blue_sw) {
setprop("/systems/hydraulic/elec-pump-b-fault", 1);
} else {
setprop("/systems/hydraulic/elec-pump-b-fault", 0);
}
if (ptu_fail and ptu_sw) {
setprop("/systems/hydraulic/ptu-fault", 1);
} else {
setprop("/systems/hydraulic/ptu-fault", 0);
}
if (yellow_pump_eng_fail and eng2_pump_sw) {
setprop("/systems/hydraulic/eng2-pump-fault", 1);
} else {
setprop("/systems/hydraulic/eng2-pump-fault", 0);
}
if (yellow_pump_elec_fail and elec_pump_yellow_sw) {
setprop("/systems/hydraulic/elec-pump-y-fault", 1);
} else {
setprop("/systems/hydraulic/elec-pump-y-fault", 0);
}
}, },
}; };

View file

@ -327,12 +327,14 @@
/instrumentation/airspeed-indicator/indicated-speed-kt lt 100 /instrumentation/airspeed-indicator/indicated-speed-kt lt 100
/instrumentation/airspeed-indicator/indicated-speed-kt ge 50 /instrumentation/airspeed-indicator/indicated-speed-kt ge 50
/systems/electrical/bus/dc-bat eq 0 /systems/electrical/bus/dc-bat eq 0
/sim/time/elapsed-sec gt 10
</test> </test>
<test logic="AND" value="1"> <test logic="AND" value="1">
/instrumentation/airspeed-indicator/indicated-speed-kt lt 50 /instrumentation/airspeed-indicator/indicated-speed-kt lt 50
/controls/electrical/switches/bat-1 eq 1 /controls/electrical/switches/bat-1 eq 1
/controls/electrical/switches/bat-2 eq 1 /controls/electrical/switches/bat-2 eq 1
/systems/electrical/bus/dc-bat eq 0 /systems/electrical/bus/dc-bat eq 0
/sim/time/elapsed-sec gt 10
</test> </test>
</switch> </switch>
@ -374,25 +376,11 @@
/controls/electrical/switches/emer-elec-man-on eq 0 /controls/electrical/switches/emer-elec-man-on eq 0
</test> </test>
<test logic="OR" value="1"> <test logic="OR" value="1">
/controls/hydraulic/rat-man eq 1 /controls/hydraulic/switches/rat-man eq 1
/controls/electrical/switches/emer-elec-man-on eq 1 /controls/electrical/switches/emer-elec-man-on eq 1
</test> </test>
</switch> </switch>
<kinematic name="/systems/hydraulic/rat-position">
<input>/systems/electrical/some-electric-thingie/rat-deploy</input>
<traverse>
<setting>
<position>0.0</position>
<time>0.0</time>
</setting>
<setting>
<position>1.0</position>
<time>2.5</time>
</setting>
</traverse>
</kinematic>
<switch name="/systems/electrical/some-electric-thingie/emer-gen-operate"> <switch name="/systems/electrical/some-electric-thingie/emer-gen-operate">
<default value="0"/> <default value="0"/>
<test logic="AND" value="1"> <test logic="AND" value="1">
@ -416,7 +404,7 @@
<default value="0"/> <default value="0"/>
<test logic="AND" value="1"> <test logic="AND" value="1">
/systems/electrical/some-electric-thingie/emer-gen-operate eq 1 /systems/electrical/some-electric-thingie/emer-gen-operate eq 1
/systems/hydraulic/rat-position eq 1 /systems/hydraulic/sources/rat/position eq 1
</test> </test>
<test logic="AND" value="1"> <test logic="AND" value="1">
/controls/electrical/switches/emer-gen-test eq 1 /controls/electrical/switches/emer-gen-test eq 1

488
Systems/a320-hydraulic.xml Normal file
View file

@ -0,0 +1,488 @@
<?xml version="1.0"?>
<!-- Copyright (c) 2019 Jonathan Redpath (legoboyvdlp), Joshua Davidson (Octal450) -->
<system name="A320: Hydraulic">
<property value="500">/systems/hydraulic/sys-incr-rate</property> <!-- 2 seconds per 1000 psi -->
<property value="0">/systems/hydraulic/sources/ptu/green-yellow</property>
<property value="0">/systems/hydraulic/sources/ptu/yellow-green</property>
<channel name="SYS Leak Logic" execrate="8">
<!-- Blue -->
<switch name="/systems/hydraulic/blue-qty-cmd">
<default value="/systems/hydraulic/blue-qty-input"/>
<test value="0">
/systems/failures/hydraulic/blue-leak eq 1
</test>
</switch>
<switch name="/systems/hydraulic/blue-qty-decr-rate">
<default value="100"/> <!-- Instant -->
<test value="0.25">
/systems/failures/hydraulic/blue-leak eq 1
</test>
</switch>
<actuator name="/systems/hydraulic/blue-qty">
<input>/systems/hydraulic/blue-qty-cmd</input>
<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
<rate_limit sense="decr">/systems/hydraulic/blue-qty-decr-rate</rate_limit>
</actuator>
<!-- Green -->
<switch name="/systems/hydraulic/green-qty-cmd">
<default value="/systems/hydraulic/green-qty-input"/>
<test value="0">
/systems/failures/hydraulic/green-leak eq 1
</test>
</switch>
<switch name="/systems/hydraulic/green-qty-decr-rate">
<default value="100"/> <!-- Instant -->
<test value="0.25">
/systems/failures/hydraulic/green-leak eq 1
</test>
</switch>
<actuator name="/systems/hydraulic/green-qty">
<input>/systems/hydraulic/green-qty-cmd</input>
<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
<rate_limit sense="decr">/systems/hydraulic/green-qty-decr-rate</rate_limit>
</actuator>
<!-- Yellow -->
<switch name="/systems/hydraulic/yellow-qty-cmd">
<default value="/systems/hydraulic/yellow-qty-input"/>
<test value="0">
/systems/failures/hydraulic/yellow-leak eq 1
</test>
</switch>
<switch name="/systems/hydraulic/yellow-qty-decr-rate">
<default value="100"/> <!-- Instant -->
<test value="0.25">
/systems/failures/hydraulic/yellow-leak eq 1
</test>
</switch>
<actuator name="/systems/hydraulic/yellow-qty">
<input>/systems/hydraulic/yellow-qty-cmd</input>
<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
<rate_limit sense="decr">/systems/hydraulic/yellow-qty-decr-rate</rate_limit>
</actuator>
</channel>
<channel name="Main Hydraulic" execrate="8">
<!-- Common -->
<switch name="/systems/hydraulic/sys-decr-rate">
<default value="150"/> <!-- 1 second per 150 psi -->
<test value="500"> <!-- 2 seconds per 1000 psi for ACCONFIG -->
/systems/acconfig/autoconfig-running eq 1
</test>
</switch>
<!-- RAT Blue -->
<kinematic name="/systems/hydraulic/sources/rat/position">
<input>/systems/electrical/some-electric-thingie/rat-deploy</input>
<traverse>
<setting>
<position>0.0</position>
<time>0.0</time>
</setting>
<setting>
<position>1.0</position>
<time>2.5</time>
</setting>
</traverse>
</kinematic>
<fcs_function name="/systems/hydraulic/sources/rat/source-psi">
<function>
<table>
<independentVar lookup="row">/instrumentation/airspeed-indicator/indicated-speed-kt</independentVar>
<tableData>
99 0
100 2500
</tableData>
</table>
</function>
</fcs_function>
<switch name="/systems/hydraulic/sources/rat/output-psi">
<default value="/systems/hydraulic/sources/rat/source-psi"/>
</switch>
<!-- Elec Blue -->
<switch name="/systems/hydraulic/sources/blue-elec/pump-operate">
<default value="0"/>
<test logic="AND" value="1">
/controls/hydraulic/switches/blue-elec-ovrd eq 1
/controls/hydraulic/switches/blue-elec eq 1
position/wow eq 1
</test>
<test logic="AND" value="1">
<test logic="OR">
/controls/hydraulic/switches/blue-elec-ovrd eq 1
/controls/hydraulic/switches/blue-elec eq 1
</test>
<test logic="OR">
/engines/engine[0]/state eq 3
/engines/engine[1]/state eq 3
</test>
/systems/electrical/bus/ac-1 ge 110
</test>
<test logic="AND" value="1">
/systems/electrical/bus/ac-1 ge 110
/systems/electrical/relay/apu-glc/contact-pos eq 1
/systems/hydraulic/sources/blue-elec/pump-operate-apu-timer ne 0
</test>
</switch>
<switch name="/systems/hydraulic/sources/blue-elec/pump-operate-apu">
<default value="0"/>
<test logic="AND" value="1">
gear/unit[0]/WOW eq 0
/systems/electrical/bus/ac-1 ge 110
<test logic="OR">
/engines/engine[0]/state ne 3
/engines/engine[1]/state ne 3
</test>
/systems/electrical/relay/apu-glc/contact-pos eq 1
</test>
</switch>
<actuator name="/systems/hydraulic/sources/blue-elec/pump-operate-apu-timer">
<description>Timer for the ECAM system</description>
<input>/systems/hydraulic/sources/blue-elec/pump-operate-apu</input>
<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
<rate_limit sense="decr">0.0083333</rate_limit> <!-- 120 seconds -->
</actuator>
<fcs_function name="/systems/hydraulic/sources/blue-elec/source-psi">
<function>
<ifthen>
<nq>
<property>/systems/failures/hydraulic/blue-elec</property>
<value>1</value>
</nq>
<table>
<independentVar lookup="row">/systems/hydraulic/sources/blue-elec/pump-operate</independentVar>
<tableData>
0 0
1 3000
</tableData>
</table>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<switch name="/systems/hydraulic/sources/blue-elec/output-psi">
<default value="0"/>
<test value="/systems/hydraulic/sources/blue-elec/source-psi">
/systems/failures/hydraulic/blue-elec eq 0
</test>
</switch>
<!-- EDP Green -->
<fcs_function name="/systems/hydraulic/sources/green-edp/source-psi">
<function>
<ifthen>
<nq>
<property>/systems/failures/hydraulic/green-edp</property>
<value>1</value>
</nq>
<table>
<independentVar lookup="row">/engines/engine[0]/n2-actual</independentVar>
<tableData>
40 0
45 3000
</tableData>
</table>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<switch name="/systems/hydraulic/sources/green-edp/output-psi">
<default value="0"/>
<test value="/systems/hydraulic/sources/green-edp/source-psi">
/controls/hydraulic/switches/green-edp eq 1
</test>
</switch>
<!-- Elec Yellow -->
<switch name="/systems/hydraulic/sources/yellow-elec/pump-operate">
<default value="0"/>
<test logic="AND" value="1">
/controls/hydraulic/switches/yellow-elec eq 1
<test logic="OR"> <!-- TODO: via 3XX CB 122VU -->
/systems/electrical/sources/ext/output-volt ge 110
/systems/electrical/bus/ac-2 ge 110
</test>
</test>
</switch>
<fcs_function name="/systems/hydraulic/sources/yellow-elec/source-psi">
<function>
<ifthen>
<nq>
<property>/systems/failures/hydraulic/yellow-elec</property>
<value>1</value>
</nq>
<table>
<independentVar lookup="row">/systems/hydraulic/sources/yellow-elec/pump-operate</independentVar>
<tableData>
0 0
1 3000
</tableData>
</table>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<switch name="/systems/hydraulic/sources/yellow-elec/output-psi">
<default value="0"/>
<test value="/systems/hydraulic/sources/yellow-elec/source-psi">
/systems/failures/hydraulic/yellow-elec eq 0
</test>
</switch>
<!-- EDP Yellow -->
<fcs_function name="/systems/hydraulic/sources/yellow-edp/source-psi">
<function>
<ifthen>
<nq>
<property>/systems/failures/hydraulic/yellow-edp</property>
<value>1</value>
</nq>
<table>
<independentVar lookup="row">/engines/engine[1]/n2-actual</independentVar>
<tableData>
40 0
45 3000
</tableData>
</table>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<switch name="/systems/hydraulic/sources/yellow-edp/output-psi">
<default value="0"/>
<test value="/systems/hydraulic/sources/yellow-edp/source-psi">
/controls/hydraulic/switches/yellow-edp eq 1
</test>
</switch>
<!-- Blue PSI -->
<fcs_function name="/systems/hydraulic/blue-psi-cmd">
<function>
<ifthen>
<ge>
<property>/systems/hydraulic/blue-qty</property>
<value>1.0</value>
</ge>
<max>
<property>/systems/hydraulic/sources/blue-elec/output-psi</property>
<property>/systems/hydraulic/sources/rat/output-psi</property>
</max>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<actuator name="/systems/hydraulic/blue-psi">
<input>/systems/hydraulic/blue-psi-cmd</input>
<rate_limit sense="incr">/systems/hydraulic/sys-incr-rate</rate_limit>
<rate_limit sense="decr">/systems/hydraulic/sys-decr-rate</rate_limit>
</actuator>
<!-- Green PSI -->
<fcs_function name="/systems/hydraulic/green-psi-cmd-pump">
<function>
<ifthen>
<ge>
<property>/systems/hydraulic/green-qty</property>
<value>1.0</value>
</ge>
<property>/systems/hydraulic/sources/green-edp/output-psi</property>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<fcs_function name="/systems/hydraulic/green-psi-cmd">
<function>
<ifthen>
<ge>
<property>/systems/hydraulic/green-qty</property>
<value>1.0</value>
</ge>
<max>
<property>/systems/hydraulic/green-psi-cmd-pump</property>
<property>/systems/hydraulic/sources/ptu/yellow-green</property>
</max>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<actuator name="/systems/hydraulic/green-psi">
<input>/systems/hydraulic/green-psi-cmd</input>
<rate_limit sense="incr">/systems/hydraulic/sys-incr-rate</rate_limit>
<rate_limit sense="decr">/systems/hydraulic/sys-decr-rate</rate_limit>
</actuator>
<!-- Yellow PSI -->
<fcs_function name="/systems/hydraulic/yellow-psi-cmd-pump">
<function>
<ifthen>
<ge>
<property>/systems/hydraulic/yellow-qty</property>
<value>1.0</value>
</ge>
<max>
<property>/systems/hydraulic/sources/yellow-edp/output-psi</property>
<property>/systems/hydraulic/sources/yellow-elec/output-psi</property>
</max>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<fcs_function name="/systems/hydraulic/yellow-psi-cmd">
<function>
<ifthen>
<ge>
<property>/systems/hydraulic/yellow-qty</property>
<value>1.0</value>
</ge>
<max>
<property>/systems/hydraulic/yellow-psi-cmd-pump</property>
<property>/systems/hydraulic/sources/ptu/green-yellow</property>
</max>
<value>0</value>
</ifthen>
</function>
</fcs_function>
<actuator name="/systems/hydraulic/yellow-psi">
<input>/systems/hydraulic/yellow-psi-cmd</input>
<rate_limit sense="incr">/systems/hydraulic/sys-incr-rate</rate_limit>
<rate_limit sense="decr">/systems/hydraulic/sys-decr-rate</rate_limit>
</actuator>
<!-- PTU -->
<fcs_function name="/systems/hydraulic/yellow-psi-diff">
<function>
<difference>
<property>/systems/hydraulic/yellow-psi</property>
<property>/systems/hydraulic/green-psi</property>
</difference>
</function>
</fcs_function>
<switch name="/systems/hydraulic/sources/ptu/ptu-active">
<default value="0"/>
<test logic="OR" value="1">
/systems/hydraulic/yellow-psi-diff gt 500
/systems/hydraulic/yellow-psi-diff lt -500
</test>
</switch>
<switch name="/systems/hydraulic/sources/ptu/green-yellow">
<default value="0"/>
<test logic="AND" value="/systems/hydraulic/green-psi">
/controls/hydraulic/switches/ptu eq 1
/systems/hydraulic/sources/ptu/ptu-active eq 1
/systems/electrical/bus/dc-2 ge 25
/systems/failures/hydraulic/ptu ne 1
</test>
</switch>
<switch name="/systems/hydraulic/sources/ptu/yellow-green">
<default value="0"/>
<test logic="AND" value="/systems/hydraulic/yellow-psi">
/controls/hydraulic/switches/ptu eq 1
/systems/hydraulic/sources/ptu/ptu-active eq 1
/systems/electrical/bus/dc-2 ge 25
/systems/failures/hydraulic/ptu ne 1
</test>
</switch>
</channel>
<channel name="Lights" execrate="8">
<switch name="/systems/hydraulic/lights/blue-elec-fault">
<default value="0"/>
<test logic="OR" value="1">
<test logic="AND">
/systems/hydraulic/sources/blue-elec/output-psi le 1450
<test logic="OR">
/engines/engine[0]/state eq 3
/engines/engine[1]/state eq 3
</test>
</test>
/systems/hydraulic/blue-qty lt 2.4
</test>
</switch>
<switch name="/systems/hydraulic/lights/green-edp-fault">
<default value="0"/>
<test logic="OR" value="1">
<test logic="AND">
/systems/hydraulic/sources/green-edp/output-psi le 1750
/engines/engine[0]/state eq 3
</test>
<test>
/systems/hydraulic/green-qty lt 3.5
</test>
</test>
</switch>
<switch name="/systems/hydraulic/lights/yellow-edp-fault">
<default value="0"/>
<test logic="OR" value="1">
<test logic="AND">
/systems/hydraulic/sources/yellow-edp/output-psi le 1750
/engines/engine[1]/state eq 3
</test>
<test>
/systems/hydraulic/yellow-qty lt 3.5
</test>
</test>
</switch>
<switch name="/systems/hydraulic/lights/yellow-elec-fault">
<default value="0"/>
<test logic="OR" value="1">
<test logic="AND">
/systems/hydraulic/sources/yellow-elec/output-psi le 1450
/systems/hydraulic/sources/yellow-edp/output-psi le 1750
<test logic="AND">
/systems/hydraulic/sources/ptu/green-yellow le 1750
/systems/hydraulic/sources/ptu/yellow-green le 1750
</test>
</test>
<test>
/systems/hydraulic/yellow-qty lt 3.5
</test>
</test>
</switch>
<switch name="/systems/hydraulic/lights/ptu-fault">
<default value="0"/>
<test logic="OR" value="1">
/systems/hydraulic/yellow-qty lt 3.5
/systems/hydraulic/green-qty lt 3.5
</test>
</switch>
</channel>
</system>