APU: make the code shutting down the APU after 0.2 seconds of power loss more resilient, uisng JSBSim
This commit is contained in:
parent
5e61555eb5
commit
7dfd9f15ff
2 changed files with 161 additions and 145 deletions
|
@ -273,24 +273,6 @@ var APU = {
|
||||||
me.autoStop();
|
me.autoStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systems.ELEC.Bus.dcBat.getValue() < 25) {
|
|
||||||
if (!me._powerLost) {
|
|
||||||
me._powerLost = 1;
|
|
||||||
settimer(func() {
|
|
||||||
if (me._powerLost) {
|
|
||||||
if (me.GenericControls.starter.getValue()) {
|
|
||||||
me.GenericControls.starter.setValue(0);
|
|
||||||
}
|
|
||||||
if (me.state != 0) {
|
|
||||||
me.autoStop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 0.2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
me._powerLost = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (systems.ELEC.EmerElec.getValue() == 1 and (systems.ELEC.EmerElec45.getValue() != 1 and systems.ELEC.Source.EmerGen.voltsRelay.getValue() < 110)) {
|
if (systems.ELEC.EmerElec.getValue() == 1 and (systems.ELEC.EmerElec45.getValue() != 1 and systems.ELEC.Source.EmerGen.voltsRelay.getValue() < 110)) {
|
||||||
me.inhibitEMERELEC = 1;
|
me.inhibitEMERELEC = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -316,6 +298,19 @@ var APUController = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setlistener("/systems/apu/shutdown-power-loss", func(val) {
|
||||||
|
if (APUController.APU != nil) {
|
||||||
|
if (val.getBoolValue()) {
|
||||||
|
if (APUController.APU.GenericControls.starter.getValue()) {
|
||||||
|
APUController.APU.GenericControls.starter.setValue(0);
|
||||||
|
}
|
||||||
|
if (APUController.APU.state != 0) {
|
||||||
|
APUController.APU.autoStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0, 0);
|
||||||
|
|
||||||
var _masterTime = 0;
|
var _masterTime = 0;
|
||||||
setlistener("/controls/apu/master", func() {
|
setlistener("/controls/apu/master", func() {
|
||||||
if (APUController.APU != nil) {
|
if (APUController.APU != nil) {
|
||||||
|
|
|
@ -7,51 +7,51 @@
|
||||||
<channel name="APU" execrate="8">
|
<channel name="APU" execrate="8">
|
||||||
<!-- bleed 1.8 kg / sec @ 42 psig -->
|
<!-- bleed 1.8 kg / sec @ 42 psig -->
|
||||||
<!-- fuel 148 kg/hr -->
|
<!-- fuel 148 kg/hr -->
|
||||||
<!-- generator 24034 rpm, 10129 rpm fuel ctl, 32045 rpm starter, 51965 rpm cooling, 4137rpm oil pump -->
|
<!-- generator 24034 rpm, 10129 rpm fuel ctl, 32045 rpm starter, 51965 rpm cooling, 4137rpm oil pump -->
|
||||||
|
|
||||||
<fcs_function name="/systems/apu/bleed-load-kw">
|
<fcs_function name="/systems/apu/bleed-load-kw">
|
||||||
<function>
|
<function>
|
||||||
<ifthen>
|
<ifthen>
|
||||||
<eq>
|
<eq>
|
||||||
<property>/controls/pneumatics/switches/apu</property>
|
<property>/controls/pneumatics/switches/apu</property>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</eq>
|
</eq>
|
||||||
<value>252</value>
|
<value>252</value>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</ifthen>
|
</ifthen>
|
||||||
</function>
|
</function>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
|
|
||||||
<fcs_function name="/systems/apu/electrical-load-kw">
|
<fcs_function name="/systems/apu/electrical-load-kw">
|
||||||
<function>
|
<function>
|
||||||
<ifthen>
|
<ifthen>
|
||||||
<gt>
|
<gt>
|
||||||
<property>/systems/electrical/relay/apu-glc/output</property>
|
<property>/systems/electrical/relay/apu-glc/output</property>
|
||||||
<value>110</value>
|
<value>110</value>
|
||||||
</gt>
|
</gt>
|
||||||
<value>132</value>
|
<value>132</value>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</ifthen>
|
</ifthen>
|
||||||
</function>
|
</function>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
<fcs_function name="/systems/apu/apu-load-cmd">
|
<fcs_function name="/systems/apu/apu-load-cmd">
|
||||||
<function>
|
<function>
|
||||||
<quotient>
|
<quotient>
|
||||||
<sum>
|
<sum>
|
||||||
<property>/systems/apu/electrical-load-kw</property>
|
<property>/systems/apu/electrical-load-kw</property>
|
||||||
<property>/systems/apu/bleed-load-kw</property>
|
<property>/systems/apu/bleed-load-kw</property>
|
||||||
</sum>
|
</sum>
|
||||||
<value>400</value>
|
<value>400</value>
|
||||||
</quotient>
|
</quotient>
|
||||||
</function>
|
</function>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
<actuator name="/systems/apu/apu-load">
|
<actuator name="/systems/apu/apu-load">
|
||||||
<input>/systems/apu/apu-load-cmd</input>
|
<input>/systems/apu/apu-load-cmd</input>
|
||||||
<rate_limit>0.01</rate_limit> <!-- 60 seconds cooling period for bleed which is ~ 60% -->
|
<rate_limit>0.01</rate_limit> <!-- 60 seconds cooling period for bleed which is ~ 60% -->
|
||||||
</actuator>
|
</actuator>
|
||||||
|
|
||||||
<washout_filter name="/systems/apu/dn-dt">
|
<washout_filter name="/systems/apu/dn-dt">
|
||||||
<input>/engines/engine[2]/n1</input>
|
<input>/engines/engine[2]/n1</input>
|
||||||
|
@ -60,60 +60,60 @@
|
||||||
|
|
||||||
<fcs_function name="/systems/apu/egt-degC">
|
<fcs_function name="/systems/apu/egt-degC">
|
||||||
<function>
|
<function>
|
||||||
<sum>
|
<sum>
|
||||||
<product>
|
<product>
|
||||||
<property>/systems/apu/apu-load</property>
|
<property>/systems/apu/apu-load</property>
|
||||||
<value>50</value>
|
<value>50</value>
|
||||||
</product>
|
</product>
|
||||||
<ifthen>
|
<ifthen>
|
||||||
<or>
|
<or>
|
||||||
<lt>
|
<lt>
|
||||||
<property>/engines/engine[2]/n1</property>
|
<property>/engines/engine[2]/n1</property>
|
||||||
<value>0.5</value>
|
<value>0.5</value>
|
||||||
</lt>
|
</lt>
|
||||||
<gt>
|
<gt>
|
||||||
<property>/systems/apu/dn-dt</property>
|
<property>/systems/apu/dn-dt</property>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</gt>
|
</gt>
|
||||||
</or>
|
</or>
|
||||||
<table>
|
<table>
|
||||||
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
||||||
<tableData>
|
<tableData>
|
||||||
5.0 20.0
|
5.0 20.0
|
||||||
8.0 45.0
|
8.0 45.0
|
||||||
10.0 120.0
|
10.0 120.0
|
||||||
12.0 225.0
|
12.0 225.0
|
||||||
18.0 430.0
|
18.0 430.0
|
||||||
25.0 500.0
|
25.0 500.0
|
||||||
27.0 560.0
|
27.0 560.0
|
||||||
30.0 720.0
|
30.0 720.0
|
||||||
35.0 785.0
|
35.0 785.0
|
||||||
40.0 800.0
|
40.0 800.0
|
||||||
45.0 795.0
|
45.0 795.0
|
||||||
50.0 785.0
|
50.0 785.0
|
||||||
60.0 755.0
|
60.0 755.0
|
||||||
75.0 645.0
|
75.0 645.0
|
||||||
90.0 520.0
|
90.0 520.0
|
||||||
100.0 415.0
|
100.0 415.0
|
||||||
</tableData>
|
</tableData>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
||||||
<tableData>
|
<tableData>
|
||||||
2.0 200.0
|
2.0 200.0
|
||||||
8.0 220.0
|
8.0 220.0
|
||||||
12.0 225.0
|
12.0 225.0
|
||||||
18.0 240.0
|
18.0 240.0
|
||||||
30.0 250.0
|
30.0 250.0
|
||||||
50.0 265.0
|
50.0 265.0
|
||||||
60.0 295.0
|
60.0 295.0
|
||||||
75.0 380.0
|
75.0 380.0
|
||||||
90.0 410.0
|
90.0 410.0
|
||||||
100.0 415.0
|
100.0 415.0
|
||||||
</tableData>
|
</tableData>
|
||||||
</table>
|
</table>
|
||||||
</ifthen>
|
</ifthen>
|
||||||
</sum>
|
</sum>
|
||||||
</function>
|
</function>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
|
@ -138,30 +138,30 @@
|
||||||
</function>
|
</function>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
<fcs_function name="/systems/apu/oil/oil-temperature-degC">
|
<fcs_function name="/systems/apu/oil/oil-temperature-degC">
|
||||||
<function>
|
<function>
|
||||||
<product>
|
<product>
|
||||||
<sum>
|
<sum>
|
||||||
<value>1.0</value> <!-- tune -->
|
<value>1.0</value> <!-- tune -->
|
||||||
<product>
|
<product>
|
||||||
<property>/systems/apu/apu-load</property>
|
<property>/systems/apu/apu-load</property>
|
||||||
<value>0.3</value>
|
<value>0.3</value>
|
||||||
</product>
|
</product>
|
||||||
</sum>
|
</sum>
|
||||||
<table>
|
<table>
|
||||||
<independentVar lookup="row">/systems/apu/oil/oil-pressure-psi</independentVar>
|
<independentVar lookup="row">/systems/apu/oil/oil-pressure-psi</independentVar>
|
||||||
<tableData>
|
<tableData>
|
||||||
0 0
|
0 0
|
||||||
25 135
|
25 135
|
||||||
35 105
|
35 105
|
||||||
55 85
|
55 85
|
||||||
</tableData>
|
</tableData>
|
||||||
</table>
|
</table>
|
||||||
<quotient>
|
<quotient>
|
||||||
<property>/engines/engine[2]/n1</property>
|
<property>/engines/engine[2]/n1</property>
|
||||||
<value>100</value>
|
<value>100</value>
|
||||||
</quotient>
|
</quotient>
|
||||||
</product>
|
</product>
|
||||||
</function>
|
</function>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
|
@ -170,10 +170,10 @@
|
||||||
<sum>
|
<sum>
|
||||||
<property>/systems/apu/oil/level-l</property>
|
<property>/systems/apu/oil/level-l</property>
|
||||||
<product>
|
<product>
|
||||||
<quotient>
|
<quotient>
|
||||||
<property>/engines/engine[2]/n1</property>
|
<property>/engines/engine[2]/n1</property>
|
||||||
<value>100</value>
|
<value>100</value>
|
||||||
</quotient>
|
</quotient>
|
||||||
<property>/systems/apu/oil/allow-oil-consumption</property>
|
<property>/systems/apu/oil/allow-oil-consumption</property>
|
||||||
<value>-0.00000131437</value>
|
<value>-0.00000131437</value>
|
||||||
<property>simulation/channel-dt</property>
|
<property>simulation/channel-dt</property>
|
||||||
|
@ -183,6 +183,27 @@
|
||||||
<output>/systems/apu/oil/level-l</output>
|
<output>/systems/apu/oil/level-l</output>
|
||||||
</fcs_function>
|
</fcs_function>
|
||||||
|
|
||||||
|
<switch name="/systems/apu/shutdown-power-loss-cmd">
|
||||||
|
<default value="0"/>
|
||||||
|
<test logic="AND" value="1">
|
||||||
|
/systems/electrical/bus/dc-bat lt 25
|
||||||
|
</test>
|
||||||
|
</switch>
|
||||||
|
|
||||||
|
<actuator name="/systems/apu/shutdown-power-loss-timer">
|
||||||
|
<input>/systems/apu/shutdown-power-loss-cmd</input>
|
||||||
|
<rate_limit sense="incr">5</rate_limit>
|
||||||
|
<rate_limit sense="decr">100</rate_limit>
|
||||||
|
</actuator>
|
||||||
|
|
||||||
|
<switch name="/systems/apu/shutdown-power-loss">
|
||||||
|
<default value="0"/>
|
||||||
|
<test logic="AND" value="1">
|
||||||
|
/systems/apu/shutdown-power-loss-timer eq 1
|
||||||
|
</test>
|
||||||
|
</switch>
|
||||||
|
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
|
|
||||||
</system>
|
</system>
|
||||||
|
|
Loading…
Reference in a new issue