2019-10-15 15:46:38 +00:00
<?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 -->
<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>
2020-06-05 18:14:01 +00:00
<fcs_function name= "/systems/hydraulic/sources/rat/door-position" >
<function >
<product >
<value > 5</value>
<property > /systems/hydraulic/sources/rat/position</property>
</product>
</function>
<clipto >
<min > 0</min>
<max > 1</max>
</clipto>
</fcs_function>
<fcs_function name= "/systems/hydraulic/sources/rat/arm-position" >
<function >
<sum >
<value > -0.2</value>
<product >
<property > /systems/hydraulic/sources/rat/position</property>
<value > 1.25</value>
</product>
</sum>
</function>
<clipto >
<min > 0</min>
<max > 1</max>
</clipto>
</fcs_function>
2020-06-05 21:48:53 +00:00
<scheduled_gain name= "/systems/hydraulic/sources/rat/rat-airspeed-cmd" >
<input > velocities/vc-kts</input>
<table >
<independentVar lookup= "row" > aero/alpha-deg-norm</independentVar>
<tableData >
-60 0
0 1
60 0
</tableData>
</table>
</scheduled_gain>
<lag_filter name= "/systems/hydraulic/sources/rat/rat-airspeed" >
<input > /systems/hydraulic/sources/rat/rat-airspeed-cmd</input>
<c1 > 10</c1>
</lag_filter>
2020-06-05 20:56:05 +00:00
<fcs_function name= "/systems/hydraulic/sources/rat/rat-speed-rpm" >
<function >
<table >
2020-06-05 21:48:53 +00:00
<independentVar lookup= "row" > /systems/hydraulic/sources/rat/rat-airspeed</independentVar> <!-- use this meantime so it can stall. But ADR failures will break RAT which is bad... -->
2020-06-05 20:56:05 +00:00
<tableData >
2020-06-05 21:48:53 +00:00
50 0
85 150
90 2500
100 4800
350 6540
2020-06-05 20:56:05 +00:00
</tableData>
</table>
</function>
</fcs_function>
2019-10-15 15:46:38 +00:00
<fcs_function name= "/systems/hydraulic/sources/rat/source-psi" >
<function >
2019-10-15 18:03:43 +00:00
<ifthen >
<eq >
<property > /systems/hydraulic/sources/rat/position</property>
<value > 1</value>
</eq>
<table >
2020-06-05 21:48:53 +00:00
<independentVar lookup= "row" > /systems/hydraulic/sources/rat/rat-airspeed</independentVar>
2019-10-15 18:03:43 +00:00
<tableData >
2020-06-05 21:48:53 +00:00
90 0
100 2500
2019-10-15 18:03:43 +00:00
</tableData>
</table>
<value > 0</value>
</ifthen>
2019-10-15 15:46:38 +00:00
</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" >
2020-06-05 21:48:53 +00:00
<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>
2019-10-15 15:46:38 +00:00
<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 >
2020-06-05 21:48:53 +00:00
0 0
1 3000
2019-10-15 15:46:38 +00:00
</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 >
2020-06-05 21:48:53 +00:00
40 0
45 3000
2019-10-15 15:46:38 +00:00
</tableData>
</table>
<value > 0</value>
</ifthen>
</function>
</fcs_function>
2019-10-15 18:03:43 +00:00
<actuator name= "/systems/hydraulic/sources/green-edp/fire-valve" >
<input > /controls/engines/engine[0]/fire-btn</input>
<rate_limit > 0.25</rate_limit> <!-- 4 seconds -->
</actuator>
2019-10-15 15:46:38 +00:00
<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
2019-10-15 18:03:43 +00:00
/systems/hydraulic/sources/green-edp/fire-valve lt 0.10
2019-10-15 15:46:38 +00:00
</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 >
2020-06-05 21:48:53 +00:00
0 0
1 3000
2019-10-15 15:46:38 +00:00
</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 >
2020-06-05 21:48:53 +00:00
40 0
2019-10-15 15:46:38 +00:00
45 3000
</tableData>
</table>
<value > 0</value>
</ifthen>
</function>
</fcs_function>
2019-10-15 18:03:43 +00:00
<actuator name= "/systems/hydraulic/sources/yellow-edp/fire-valve" >
<input > /controls/engines/engine[1]/fire-btn</input>
<rate_limit > 0.25</rate_limit> <!-- 4 seconds -->
</actuator>
2019-10-15 15:46:38 +00:00
<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
2019-10-15 18:03:43 +00:00
/systems/hydraulic/sources/yellow-edp/fire-valve lt 0.10
2019-10-15 15:46:38 +00:00
</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>
2019-10-15 18:03:43 +00:00
<pure_gain name= "/systems/hydraulic/green-psi-ptu" >
<input > /systems/hydraulic/green-psi</input>
<gain > 0.9</gain>
</pure_gain>
2019-10-15 15:46:38 +00:00
<!-- 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>
2019-10-15 18:03:43 +00:00
<pure_gain name= "/systems/hydraulic/yellow-psi-ptu" >
<input > /systems/hydraulic/yellow-psi</input>
<gain > 0.9</gain>
</pure_gain>
2019-10-15 15:46:38 +00:00
<!-- 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>
2020-04-25 15:03:56 +00:00
<switch name= "/systems/hydraulic/sources/ptu/ptu-inhibited" >
2020-04-29 19:26:27 +00:00
<default value= "0" />
<test logic= "AND" value= "1" >
/gear/gear[0]/compression-norm ne 0
<test logic= "OR" >
<test logic= "AND" >
/sim/model/autopush/enabled eq 1
/controls/gear/brake-parking eq 0
</test>
/controls/gear/brake-parking eq 1
2020-04-25 15:03:56 +00:00
</test>
2020-04-29 19:26:27 +00:00
<test logic= "OR" >
<test logic= "AND" >
/controls/engines/engine[0]/cutoff-switch eq 0
/controls/engines/engine[1]/cutoff-switch eq 1
</test>
<test logic= "AND" >
/controls/engines/engine[0]/cutoff-switch eq 1
/controls/engines/engine[1]/cutoff-switch eq 0
</test>
2020-04-25 15:03:56 +00:00
</test>
</test>
</switch>
<switch name= "/systems/hydraulic/sources/ptu/ptu-hydraulic-condition" >
2019-10-15 18:03:43 +00:00
<test logic= "AND" value= "0" >
/systems/hydraulic/yellow-psi-diff gt -250
/systems/hydraulic/yellow-psi-diff lt 250
2020-04-25 15:03:56 +00:00
/systems/hydraulic/sources/ptu/ptu-hydraulic-condition eq 1
2019-10-15 18:03:43 +00:00
</test>
<test logic= "AND" value= "1" >
<test logic= "OR" >
/systems/hydraulic/yellow-psi-diff ge 250
/systems/hydraulic/yellow-psi-diff le -250
</test>
2020-04-25 15:03:56 +00:00
/systems/hydraulic/sources/ptu/ptu-hydraulic-condition eq 1
2019-10-15 18:03:43 +00:00
</test>
<test logic= "AND" value= "1" >
<test logic= "OR" >
/systems/hydraulic/yellow-psi-diff gt 500
/systems/hydraulic/yellow-psi-diff lt -500
</test>
2020-04-25 15:03:56 +00:00
/systems/hydraulic/sources/ptu/ptu-hydraulic-condition eq 0
2019-10-15 15:46:38 +00:00
</test>
</switch>
<switch name= "/systems/hydraulic/sources/ptu/green-yellow" >
<default value= "0" />
2019-10-15 18:03:43 +00:00
<test logic= "AND" value= "/systems/hydraulic/green-psi-ptu" >
2019-10-15 15:46:38 +00:00
/controls/hydraulic/switches/ptu eq 1
2020-04-25 15:03:56 +00:00
/systems/hydraulic/sources/ptu/ptu-hydraulic-condition eq 1
/systems/hydraulic/sources/ptu/ptu-inhibited eq 0
2019-10-15 15:46:38 +00:00
/systems/electrical/bus/dc-2 ge 25
/systems/failures/hydraulic/ptu ne 1
2019-10-15 18:03:43 +00:00
/systems/hydraulic/sources/yellow-edp/fire-valve lt 0.10
2019-10-15 15:46:38 +00:00
</test>
</switch>
2020-04-25 15:03:56 +00:00
<switch name= "/systems/hydraulic/sources/ptu/ptu-loop-sound-cmd" >
<default value= "0" />
<test logic= "OR" value= "1" >
/systems/hydraulic/sources/ptu/yellow-green ne 0
/systems/hydraulic/sources/ptu/green-yellow ne 0
</test>
</switch>
<actuator name= "/systems/hydraulic/sources/ptu/ptu-loop-sound" >
<input > /systems/hydraulic/sources/ptu/ptu-loop-sound-cmd</input>
<rate_limit sense= "incr" > 1</rate_limit>
<rate_limit sense= "decr" > 100</rate_limit> <!-- instant -->
</actuator>
2019-10-15 15:46:38 +00:00
<switch name= "/systems/hydraulic/sources/ptu/yellow-green" >
<default value= "0" />
2019-10-15 18:03:43 +00:00
<test logic= "AND" value= "/systems/hydraulic/yellow-psi-ptu" >
2019-10-15 15:46:38 +00:00
/controls/hydraulic/switches/ptu eq 1
2020-04-25 15:03:56 +00:00
/systems/hydraulic/sources/ptu/ptu-hydraulic-condition eq 1
/systems/hydraulic/sources/ptu/ptu-inhibited eq 0
2019-10-15 15:46:38 +00:00
/systems/electrical/bus/dc-2 ge 25
/systems/failures/hydraulic/ptu ne 1
2019-10-15 18:03:43 +00:00
/systems/hydraulic/sources/green-edp/fire-valve lt 0.10
2019-10-15 15:46:38 +00:00
</test>
</switch>
</channel>
2020-09-12 17:13:34 +00:00
<channel name= "Brakes" execrate= "8" >
<switch name= "/systems/hydraulic/brakes/mode" >
<default value= "0" />
<test logic= "AND" value= "1" >
/controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/askidnwssw eq 1
/systems/hydraulic/green-psi ge 2500
</test>
<test logic= "AND" value= "2" >
/controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/askidnwssw eq 1
/systems/hydraulic/yellow-psi ge 2500
</test>
<test logic= "AND" value= "2" >
/controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/accumulator-pressure-psi ge 0
</test>
</switch>
</channel>
2019-10-15 15:46:38 +00:00
<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>