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) {
|
||||
|
|
|
@ -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