1
0
Fork 0
fgdata/Aircraft/Instruments-3d/FG1000/GFC700-vertical-FSM.xml

527 lines
16 KiB
XML
Raw Normal View History

<PropertyList>
<!-- GFC 700 Autopilot Finite State Machine for vertical mode. Also handles AP and FD toggling -->
<branch>/autopilot/GFC700/FSM/vertical</branch>
<state>
<name>OFF</name>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-armed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-target</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/passive-mode</property>
<value>1</value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<state>
<name>PIT</name>
<!-- Pitch hold mode. We assign a filtered value, which limits to to [-15.0, 20.0] -->
<enter>
<command>property-assign</command>
<property n="0">/autopilot/settings/target-pitch-deg</property>
<property n="1">/autopilot/internal/filtered-pitch-deg</property>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value>pitch-hold</value>
</enter>
2019-02-17 21:35:32 +00:00
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>PIT</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-target</property>
<value></value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<state>
<name>GA</name>
<!-- GA mode - 7 degree pitch up-->
<enter>
<command>property-assign</command>
<property n="0">/autopilot/settings/target-pitch-deg</property>
<value>7.0</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value>pitch-hold</value>
</enter>
2019-02-17 21:35:32 +00:00
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>GA</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-target</property>
<value></value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<state>
<name>VS</name>
<!-- VS mode -->
<enter>
<command>nasal</command>
<script>
<!-- Calculate the fpm value to the nearest 100fpm. -->
setprop("/autopilot/settings/vertical-speed-fpm",
math.round(getprop("/autopilot/internal/vert-speed-fpm"),100)
);
setprop("/autopilot/annunciator/vertical-mode-target",
sprintf("%+ifpm", getprop("/autopilot/settings/vertical-speed-fpm"))
);
</script>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value>vertical-speed-hold</value>
</enter>
2019-02-17 21:35:32 +00:00
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>VS</value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<state>
<name>ALTS-ARM</name>
<!-- Arm Altitude Capture Mode - ALTS -->
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-armed</property>
<value>ALTS</value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<transition>
<name>ALTS Capture</name>
<!-- Altitude Capture Mode enabled when we get within 200ft of the selected altitude -->
<source>ALTS-ARM</source>
<target>ALTS</target>
<condition>
<less-than>
<property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
<value>200</value>
</less-than>
<greater-than>
<property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
<value>-200</value>
</greater-than>
</condition>
</transition>
<state>
<name>ALTS</name>
<enter>
<command>nasal</command>
<script>
<!-- Set up the 2nd target, so that it is independent of the Selected Altitude,
then annunciator to the reference value current target value, then enable
the altitude capture function -->
setprop("/autopilot/settings/target-altitude-ft-2", getprop("/autopilot/settings/target-alt-ft"));
setprop("/autopilot/annunciator/vertical-mode-target",
sprintf("%ift", getprop("/autopilot/settings/target-altitude-ft-2"))
);
</script>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>ALTS</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-armed</property>
<value>ALT</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value>altitude-hold2</value>
</enter>
2019-02-17 21:35:32 +00:00
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<transition>
<!-- ALTS (Selected Altitude Capture) automatically armed from PIT, TO/GA, VS, VPTH, FLC modes -->
<name>ALTS-ARM</name>
<source>PIT</source>
<source>GA</source>
<source>VS</source>
2019-02-17 21:35:32 +00:00
<source>FLC</source>
<target>ALTS-ARM</target>
<!-- Transitions must have a condition element. So set it to True -->
<condition>
<greater-than>
<property>/sim/time/elapsed-sec</property>
<value>0</value>
</greater-than>
</condition>
</transition>
<transition>
<!-- Altitude Hold Mode enabled when we get within 50ft of the selected altitude -->
<name>ALTS-ALT</name>
<source>ALTS</source>
<target>ALT</target>
<condition>
<less-than>
<property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
<value>50</value>
</less-than>
<greater-than>
<property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
<value>-50</value>
</greater-than>
</condition>
</transition>
<state>
<name>ALT</name>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>ALT</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-armed</property>
<value></value>
</enter>
<enter>
<command>nasal</command>
<script>
setprop("/autopilot/annunciator/vertical-mode-target",
sprintf("%ift", getprop("/autopilot/settings/target-altitude-ft-2"))
);
</script>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value>altitude-hold2</value>
</enter>
2019-02-17 21:35:32 +00:00
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<state>
<name>VNV</name>
</state>
<state>
<name>BC</name>
</state>
<state>
<name>FLC</name>
2019-02-17 21:35:32 +00:00
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>FLC</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-armed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/settings/target-speed-kt</property>
<property n="1">/autopilot/internal/filtered-airspeed</property>
</enter>
<enter>
<command>nasal</command>
<script>
setprop("/autopilot/annunciator/vertical-mode-target",
sprintf("%i kt", getprop("/autopilot/settings/target-speed-kt"))
);
</script>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value>speed-with-pitch-trim</value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<!-- From the OFF state, pressing any of FD, AP, CWS, NAV, BC, APR, HDG changes to PIT mode -->
<transition>
<name>OFF-PIT</name>
<source>OFF</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
<or>
<equals><property>/autopilot/vertical-mode-button</property><value>AP</value></equals>
<equals><property>/autopilot/vertical-mode-button</property><value>FD</value></equals>
<equals><property>/autopilot/vertical-mode-button</property><value>CWS</value></equals>
<equals><property>/autopilot/vertical-mode-button</property><value>NAV</value></equals>
<equals><property>/autopilot/vertical-mode-button</property><value>BC</value></equals>
<equals><property>/autopilot/vertical-mode-button</property><value>APR</value></equals>
<equals><property>/autopilot/vertical-mode-button</property><value>HDG</value></equals>
</or>
</condition>
</transition>
<!-- AP/FD logic is somewhat complex:
1) Pressing AP toggles the autopilot on/off
Handled by a separate FSM. We could use a series of transitions
to the same states below, but that would result in entry bindings being repeated, which would be bad
2) When the AP is enabled, the FD button is disabled. (Easy - no transition!)
3) Pressing the FD button when the FD is enabled switches off the FD : Switch-off transition below
-->
<!-- From any state pressing FD when FD is ON switches off the FD -->
<transition>
<name>FD-Switch-off</name>
<target>OFF</target>
<exclude-target>true</exclude-target>
<condition>
<not><equals><property>/autopilot/annunciator/autopilot-enabled</property><value>1</value></equals></not>
<equals><property>/autopilot/vertical-mode-button</property><value>FD</value></equals>
<equals><property>/autopilot/locks/passive-mode</property><value>1</value></equals>
</condition>
</transition>
<!-- From any state pressing VS changes to VS mode -->
<transition>
<name>VS-ON</name>
<target>VS</target>
<exclude-target>true</exclude-target>
<condition>
2019-02-17 21:35:32 +00:00
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
<not><equals><property>/autopilot/locks/altitude</property><value>vertical-speed-hold</value></equals></not>
</and>
</condition>
</transition>
<!-- From any state, pressing GA goes to GA mode -->
<transition>
<name>GA</name>
<target>GA</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>GA</value></equals>
</condition>
</transition>
<!-- From any state, pressing ALT goes to ALT mode -->
<transition>
<name>ALT</name>
<target>ALT</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>ALT</value></equals>
</condition>
<binding>
<command>nasal</command>
<script>
<!-- Set up the 2nd target to the current altitude within 10ft-->
setprop("/autopilot/settings/target-altitude-ft-2",
math.round(getprop("/instrumentation/altimeter/indicated-altitude-ft"),10));
</script>
</binding>
</transition>
2019-02-17 21:35:32 +00:00
<!-- From any state pressing FLC changes to FLC mode, if not already enabled -->
<transition>
<name>FLC-ON</name>
<target>FLC</target>
<exclude-target>true</exclude-target>
<condition>
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
<not><equals><property>/autopilot/locks/speed</property><value>speed-with-pitch-trim</value></equals></not>
</and>
</condition>
</transition>
<!-- Transitions to switch off various AP modes, which return to PIT mode. This is complicated as in many cases they may be in ALTS-ARM -->
<!-- From VS state pressing VS changes back to to PIT mode -->
<transition>
<name>VS-OFF</name>
<source>VS</source>
2019-02-17 21:35:32 +00:00
<source>ALTS-ARM</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
2019-02-17 21:35:32 +00:00
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
<equals><property>/autopilot/locks/altitude</property><value>vertical-speed-hold</value></equals>
</and>
</condition>
</transition>
<!-- From ALT state pressing ALT changes back to to PIT mode -->
<transition>
<name>ALT-OFF</name>
<source>ALT</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>ALT</value></equals>
</condition>
</transition>
2019-02-17 21:35:32 +00:00
<!-- From VNV state pressing VNV changes back to to PIT mode -->
<transition>
<name>VNV-OFF</name>
<source>VNV</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>VNV</value></equals>
</condition>
</transition>
<!-- From BC state pressing BC changes back to to PIT mode -->
<transition>
<name>BC-OFF</name>
<source>BC</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>BC</value></equals>
</condition>
</transition>
2019-02-17 21:35:32 +00:00
<!-- From FLC state pressing FLC changes back to to PIT mode. Note that we could be in ALTS-ARM mode as well, so check the AP setting -->
<transition>
<name>FLC-OFF</name>
<source>FLC</source>
2019-02-17 21:35:32 +00:00
<source>ALTS-ARM</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
2019-02-17 21:35:32 +00:00
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
<equals><property>/autopilot/locks/speed</property><value>speed-with-pitch-trim</value></equals>
</and>
</condition>
</transition>
<!-- From GA state, pressing GA returns to PIT mode -->
<transition>
<name>GA-OFF</name>
<source>GA</source>
<target>PIT</target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>GA</value></equals>
</condition>
</transition>
</PropertyList>