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();
|
||||
}
|
||||
|
||||
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)) {
|
||||
me.inhibitEMERELEC = 1;
|
||||
} 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;
|
||||
setlistener("/controls/apu/master", func() {
|
||||
if (APUController.APU != nil) {
|
||||
|
|
|
@ -7,51 +7,51 @@
|
|||
<channel name="APU" execrate="8">
|
||||
<!-- bleed 1.8 kg / sec @ 42 psig -->
|
||||
<!-- 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">
|
||||
<function>
|
||||
<ifthen>
|
||||
<eq>
|
||||
<property>/controls/pneumatics/switches/apu</property>
|
||||
<value>1</value>
|
||||
</eq>
|
||||
<value>252</value>
|
||||
<value>0</value>
|
||||
</ifthen>
|
||||
</function>
|
||||
</fcs_function>
|
||||
<fcs_function name="/systems/apu/bleed-load-kw">
|
||||
<function>
|
||||
<ifthen>
|
||||
<eq>
|
||||
<property>/controls/pneumatics/switches/apu</property>
|
||||
<value>1</value>
|
||||
</eq>
|
||||
<value>252</value>
|
||||
<value>0</value>
|
||||
</ifthen>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
|
||||
<fcs_function name="/systems/apu/electrical-load-kw">
|
||||
<function>
|
||||
<ifthen>
|
||||
<gt>
|
||||
<property>/systems/electrical/relay/apu-glc/output</property>
|
||||
<value>110</value>
|
||||
</gt>
|
||||
<value>132</value>
|
||||
<value>0</value>
|
||||
</ifthen>
|
||||
</function>
|
||||
</fcs_function>
|
||||
<fcs_function name="/systems/apu/electrical-load-kw">
|
||||
<function>
|
||||
<ifthen>
|
||||
<gt>
|
||||
<property>/systems/electrical/relay/apu-glc/output</property>
|
||||
<value>110</value>
|
||||
</gt>
|
||||
<value>132</value>
|
||||
<value>0</value>
|
||||
</ifthen>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<fcs_function name="/systems/apu/apu-load-cmd">
|
||||
<function>
|
||||
<quotient>
|
||||
<sum>
|
||||
<property>/systems/apu/electrical-load-kw</property>
|
||||
<property>/systems/apu/bleed-load-kw</property>
|
||||
</sum>
|
||||
<value>400</value>
|
||||
</quotient>
|
||||
</function>
|
||||
</fcs_function>
|
||||
<fcs_function name="/systems/apu/apu-load-cmd">
|
||||
<function>
|
||||
<quotient>
|
||||
<sum>
|
||||
<property>/systems/apu/electrical-load-kw</property>
|
||||
<property>/systems/apu/bleed-load-kw</property>
|
||||
</sum>
|
||||
<value>400</value>
|
||||
</quotient>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<actuator name="/systems/apu/apu-load">
|
||||
<input>/systems/apu/apu-load-cmd</input>
|
||||
<rate_limit>0.01</rate_limit> <!-- 60 seconds cooling period for bleed which is ~ 60% -->
|
||||
</actuator>
|
||||
<actuator name="/systems/apu/apu-load">
|
||||
<input>/systems/apu/apu-load-cmd</input>
|
||||
<rate_limit>0.01</rate_limit> <!-- 60 seconds cooling period for bleed which is ~ 60% -->
|
||||
</actuator>
|
||||
|
||||
<washout_filter name="/systems/apu/dn-dt">
|
||||
<input>/engines/engine[2]/n1</input>
|
||||
|
@ -60,60 +60,60 @@
|
|||
|
||||
<fcs_function name="/systems/apu/egt-degC">
|
||||
<function>
|
||||
<sum>
|
||||
<product>
|
||||
<property>/systems/apu/apu-load</property>
|
||||
<value>50</value>
|
||||
</product>
|
||||
<ifthen>
|
||||
<or>
|
||||
<lt>
|
||||
<property>/engines/engine[2]/n1</property>
|
||||
<value>0.5</value>
|
||||
</lt>
|
||||
<gt>
|
||||
<property>/systems/apu/dn-dt</property>
|
||||
<value>0</value>
|
||||
</gt>
|
||||
</or>
|
||||
<table>
|
||||
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
||||
<tableData>
|
||||
5.0 20.0
|
||||
8.0 45.0
|
||||
10.0 120.0
|
||||
12.0 225.0
|
||||
18.0 430.0
|
||||
25.0 500.0
|
||||
27.0 560.0
|
||||
30.0 720.0
|
||||
35.0 785.0
|
||||
40.0 800.0
|
||||
45.0 795.0
|
||||
50.0 785.0
|
||||
60.0 755.0
|
||||
75.0 645.0
|
||||
90.0 520.0
|
||||
100.0 415.0
|
||||
</tableData>
|
||||
</table>
|
||||
<table>
|
||||
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
||||
<tableData>
|
||||
2.0 200.0
|
||||
8.0 220.0
|
||||
12.0 225.0
|
||||
18.0 240.0
|
||||
30.0 250.0
|
||||
50.0 265.0
|
||||
60.0 295.0
|
||||
75.0 380.0
|
||||
90.0 410.0
|
||||
100.0 415.0
|
||||
</tableData>
|
||||
</table>
|
||||
</ifthen>
|
||||
</sum>
|
||||
<sum>
|
||||
<product>
|
||||
<property>/systems/apu/apu-load</property>
|
||||
<value>50</value>
|
||||
</product>
|
||||
<ifthen>
|
||||
<or>
|
||||
<lt>
|
||||
<property>/engines/engine[2]/n1</property>
|
||||
<value>0.5</value>
|
||||
</lt>
|
||||
<gt>
|
||||
<property>/systems/apu/dn-dt</property>
|
||||
<value>0</value>
|
||||
</gt>
|
||||
</or>
|
||||
<table>
|
||||
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
||||
<tableData>
|
||||
5.0 20.0
|
||||
8.0 45.0
|
||||
10.0 120.0
|
||||
12.0 225.0
|
||||
18.0 430.0
|
||||
25.0 500.0
|
||||
27.0 560.0
|
||||
30.0 720.0
|
||||
35.0 785.0
|
||||
40.0 800.0
|
||||
45.0 795.0
|
||||
50.0 785.0
|
||||
60.0 755.0
|
||||
75.0 645.0
|
||||
90.0 520.0
|
||||
100.0 415.0
|
||||
</tableData>
|
||||
</table>
|
||||
<table>
|
||||
<independentVar lookup="row">/engines/engine[2]/n1</independentVar>
|
||||
<tableData>
|
||||
2.0 200.0
|
||||
8.0 220.0
|
||||
12.0 225.0
|
||||
18.0 240.0
|
||||
30.0 250.0
|
||||
50.0 265.0
|
||||
60.0 295.0
|
||||
75.0 380.0
|
||||
90.0 410.0
|
||||
100.0 415.0
|
||||
</tableData>
|
||||
</table>
|
||||
</ifthen>
|
||||
</sum>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
|
@ -138,30 +138,30 @@
|
|||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<fcs_function name="/systems/apu/oil/oil-temperature-degC">
|
||||
<fcs_function name="/systems/apu/oil/oil-temperature-degC">
|
||||
<function>
|
||||
<product>
|
||||
<sum>
|
||||
<value>1.0</value> <!-- tune -->
|
||||
<product>
|
||||
<property>/systems/apu/apu-load</property>
|
||||
<value>0.3</value>
|
||||
</product>
|
||||
</sum>
|
||||
<table>
|
||||
<independentVar lookup="row">/systems/apu/oil/oil-pressure-psi</independentVar>
|
||||
<tableData>
|
||||
0 0
|
||||
25 135
|
||||
35 105
|
||||
55 85
|
||||
</tableData>
|
||||
</table>
|
||||
<quotient>
|
||||
<property>/engines/engine[2]/n1</property>
|
||||
<value>100</value>
|
||||
</quotient>
|
||||
</product>
|
||||
<product>
|
||||
<sum>
|
||||
<value>1.0</value> <!-- tune -->
|
||||
<product>
|
||||
<property>/systems/apu/apu-load</property>
|
||||
<value>0.3</value>
|
||||
</product>
|
||||
</sum>
|
||||
<table>
|
||||
<independentVar lookup="row">/systems/apu/oil/oil-pressure-psi</independentVar>
|
||||
<tableData>
|
||||
0 0
|
||||
25 135
|
||||
35 105
|
||||
55 85
|
||||
</tableData>
|
||||
</table>
|
||||
<quotient>
|
||||
<property>/engines/engine[2]/n1</property>
|
||||
<value>100</value>
|
||||
</quotient>
|
||||
</product>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
|
@ -170,10 +170,10 @@
|
|||
<sum>
|
||||
<property>/systems/apu/oil/level-l</property>
|
||||
<product>
|
||||
<quotient>
|
||||
<property>/engines/engine[2]/n1</property>
|
||||
<value>100</value>
|
||||
</quotient>
|
||||
<quotient>
|
||||
<property>/engines/engine[2]/n1</property>
|
||||
<value>100</value>
|
||||
</quotient>
|
||||
<property>/systems/apu/oil/allow-oil-consumption</property>
|
||||
<value>-0.00000131437</value>
|
||||
<property>simulation/channel-dt</property>
|
||||
|
@ -183,6 +183,27 @@
|
|||
<output>/systems/apu/oil/level-l</output>
|
||||
</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>
|
||||
|
||||
</system>
|
||||
|
|
Loading…
Reference in a new issue