Debian Codegraph @

Aircraft/Instruments-3d/FG1000/GFC700-vertical-FSM.xml

raw symbols SCIP
1 <?xml version="1.0" ?>
2 <PropertyList>
3
4 <!-- GFC 700 Autopilot Finite State Machine for vertical mode. Also handles AP and FD toggling -->
5 <branch>/autopilot/GFC700/FSM/vertical</branch>
6
7 <state>
8 <name>OFF</name>
9 <enter>
10 <command>property-assign</command>
11 <property>/autopilot/locks/altitude</property>
12 <value></value>
13 </enter>
14 <enter>
15 <command>property-assign</command>
16 <property>/autopilot/annunciator/vertical-mode</property>
17 <value></value>
18 </enter>
19 <enter>
20 <command>property-assign</command>
21 <property>/autopilot/annunciator/vertical-mode-armed</property>
22 <value></value>
23 </enter>
24 <enter>
25 <command>property-assign</command>
26 <property>/autopilot/annunciator/vertical-mode-target</property>
27 <value></value>
28 </enter>
29 <enter>
30 <command>property-assign</command>
31 <property>/autopilot/locks/speed</property>
32 <value></value>
33 </enter>
34 <enter>
35 <command>property-assign</command>
36 <property>/autopilot/locks/passive-mode</property>
37 <value>1</value>
38 </enter>
39 <enter>
40 <!-- Reset button to avoid triggering next transition immediately -->
41 <command>property-assign</command>
42 <property>/autopilot/vertical-mode-button</property>
43 <value></value>
44 </enter>
45 </state>
46
47 <state>
48 <name>PIT</name>
49 <!-- Pitch hold mode. We assign a filtered value, which limits to to [-15.0, 20.0] -->
50 <enter>
51 <command>property-assign</command>
52 <property n="0">/autopilot/settings/target-pitch-deg</property>
53 <property n="1">/autopilot/internal/filtered-pitch-deg</property>
54 </enter>
55 <enter>
56 <command>property-assign</command>
57 <property>/autopilot/locks/altitude</property>
58 <value>pitch-hold</value>
59 </enter>
60 <enter>
61 <command>property-assign</command>
62 <property>/autopilot/locks/speed</property>
63 <value></value>
64 </enter>
65 <enter>
66 <command>property-assign</command>
67 <property>/autopilot/annunciator/vertical-mode</property>
68 <value>PIT</value>
69 </enter>
70 <enter>
71 <command>property-assign</command>
72 <property>/autopilot/annunciator/vertical-mode-target</property>
73 <value></value>
74 </enter>
75 <enter>
76 <!-- Reset button to avoid triggering next transition immediately -->
77 <command>property-assign</command>
78 <property>/autopilot/vertical-mode-button</property>
79 <value></value>
80 </enter>
81 </state>
82
83 <state>
84 <name>GA</name>
85 <!-- GA mode - 7 degree pitch up-->
86 <enter>
87 <command>property-assign</command>
88 <property n="0">/autopilot/settings/target-pitch-deg</property>
89 <value>7.0</value>
90 </enter>
91 <enter>
92 <command>property-assign</command>
93 <property>/autopilot/locks/altitude</property>
94 <value>pitch-hold</value>
95 </enter>
96 <enter>
97 <command>property-assign</command>
98 <property>/autopilot/locks/speed</property>
99 <value></value>
100 </enter>
101 <enter>
102 <command>property-assign</command>
103 <property>/autopilot/annunciator/vertical-mode</property>
104 <value>GA</value>
105 </enter>
106 <enter>
107 <command>property-assign</command>
108 <property>/autopilot/annunciator/vertical-mode-target</property>
109 <value></value>
110 </enter>
111 <enter>
112 <!-- Reset button to avoid triggering next transition immediately -->
113 <command>property-assign</command>
114 <property>/autopilot/vertical-mode-button</property>
115 <value></value>
116 </enter>
117 </state>
118
119 <state>
120 <name>VS</name>
121 <!-- VS mode -->
122 <enter>
123 <command>nasal</command>
124 <script>
125 <!-- Calculate the fpm value to the nearest 100fpm. -->
126 setprop("/autopilot/settings/vertical-speed-fpm",
127 math.round(getprop("/autopilot/internal/vert-speed-fpm"),100)
128 );
129
130 setprop("/autopilot/annunciator/vertical-mode-target",
131 sprintf("%+ifpm", getprop("/autopilot/settings/vertical-speed-fpm"))
132 );
133 </script>
134 </enter>
135 <enter>
136 <command>property-assign</command>
137 <property>/autopilot/locks/altitude</property>
138 <value>vertical-speed-hold</value>
139 </enter>
140 <enter>
141 <command>property-assign</command>
142 <property>/autopilot/locks/speed</property>
143 <value></value>
144 </enter>
145 <enter>
146 <command>property-assign</command>
147 <property>/autopilot/annunciator/vertical-mode</property>
148 <value>VS</value>
149 </enter>
150 <enter>
151 <!-- Reset button to avoid triggering next transition immediately -->
152 <command>property-assign</command>
153 <property>/autopilot/vertical-mode-button</property>
154 <value></value>
155 </enter>
156 </state>
157
158 <state>
159 <name>ALTS-ARM</name>
160 <!-- Arm Altitude Capture Mode - ALTS -->
161 <enter>
162 <command>property-assign</command>
163 <property>/autopilot/annunciator/vertical-mode-armed</property>
164 <value>ALTS</value>
165 </enter>
166 <enter>
167 <!-- Reset button to avoid triggering next transition immediately -->
168 <command>property-assign</command>
169 <property>/autopilot/vertical-mode-button</property>
170 <value></value>
171 </enter>
172 </state>
173
174 <transition>
175 <name>ALTS Capture</name>
176 <!-- Altitude Capture Mode enabled when we get within 200ft of the selected altitude -->
177 <source>ALTS-ARM</source>
178 <target>ALTS</target>
179 <condition>
180 <less-than>
181 <property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
182 <value>200</value>
183 </less-than>
184 <greater-than>
185 <property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
186 <value>-200</value>
187 </greater-than>
188 </condition>
189 </transition>
190
191 <state>
192 <name>ALTS</name>
193 <enter>
194 <command>nasal</command>
195 <script>
196 <!-- Set up the 2nd target, so that it is independent of the Selected Altitude,
197 then annunciator to the reference value current target value, then enable
198 the altitude capture function -->
199 setprop("/autopilot/settings/target-altitude-ft-2", getprop("/autopilot/settings/target-alt-ft"));
200 setprop("/autopilot/annunciator/vertical-mode-target",
201 sprintf("%ift", getprop("/autopilot/settings/target-altitude-ft-2"))
202 );
203 </script>
204 </enter>
205 <enter>
206 <command>property-assign</command>
207 <property>/autopilot/annunciator/vertical-mode</property>
208 <value>ALTS</value>
209 </enter>
210 <enter>
211 <command>property-assign</command>
212 <property>/autopilot/annunciator/vertical-mode-armed</property>
213 <value>ALT</value>
214 </enter>
215 <enter>
216 <command>property-assign</command>
217 <property>/autopilot/locks/altitude</property>
218 <value>altitude-hold2</value>
219 </enter>
220 <enter>
221 <command>property-assign</command>
222 <property>/autopilot/locks/speed</property>
223 <value></value>
224 </enter>
225 <enter>
226 <!-- Reset button to avoid triggering next transition immediately -->
227 <command>property-assign</command>
228 <property>/autopilot/vertical-mode-button</property>
229 <value></value>
230 </enter>
231 </state>
232
233 <transition>
234 <!-- ALTS (Selected Altitude Capture) automatically armed from PIT, TO/GA, VS, VPTH, FLC modes -->
235 <name>ALTS-ARM</name>
236 <source>PIT</source>
237 <source>GA</source>
238 <source>VS</source>
239 <source>FLC</source>
240 <target>ALTS-ARM</target>
241 <!-- Transitions must have a condition element. So set it to True -->
242 <condition>
243 <greater-than>
244 <property>/sim/time/elapsed-sec</property>
245 <value>0</value>
246 </greater-than>
247 </condition>
248 </transition>
249
250 <transition>
251 <!-- Altitude Hold Mode enabled when we get within 50ft of the selected altitude -->
252 <name>ALTS-ALT</name>
253 <source>ALTS</source>
254 <target>ALT</target>
255 <condition>
256 <less-than>
257 <property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
258 <value>50</value>
259 </less-than>
260 <greater-than>
261 <property>/autopilot/internal/ALTS-target-altitude-delta-ft</property>
262 <value>-50</value>
263 </greater-than>
264 </condition>
265 </transition>
266
267 <state>
268 <name>ALT</name>
269 <enter>
270 <command>property-assign</command>
271 <property>/autopilot/annunciator/vertical-mode</property>
272 <value>ALT</value>
273 </enter>
274 <enter>
275 <command>property-assign</command>
276 <property>/autopilot/annunciator/vertical-mode-armed</property>
277 <value></value>
278 </enter>
279 <enter>
280 <command>nasal</command>
281 <script>
282 setprop("/autopilot/annunciator/vertical-mode-target",
283 sprintf("%ift", getprop("/autopilot/settings/target-altitude-ft-2"))
284 );
285 </script>
286 </enter>
287 <enter>
288 <command>property-assign</command>
289 <property>/autopilot/locks/altitude</property>
290 <value>altitude-hold2</value>
291 </enter>
292 <enter>
293 <command>property-assign</command>
294 <property>/autopilot/locks/speed</property>
295 <value></value>
296 </enter>
297 <enter>
298 <!-- Reset button to avoid triggering next transition immediately -->
299 <command>property-assign</command>
300 <property>/autopilot/vertical-mode-button</property>
301 <value></value>
302 </enter>
303 </state>
304
305 <state>
306 <name>VNV</name>
307 </state>
308
309 <state>
310 <name>GS-ARM</name>
311 <enter>
312 <command>property-assign</command>
313 <property>/autopilot/annunciator/vertical-mode-armed</property>
314 <value>GS</value>
315 </enter>
316 <enter>
317 <!-- Reset button to avoid triggering next transition immediately -->
318 <command>property-assign</command>
319 <property>/autopilot/vertical-mode-button</property>
320 <value></value>
321 </enter>
322 </state>
323
324 <transition>
325 <name>GS Enabled</name>
326 <source>GS-ARM</source>
327 <target>GS</target>
328 <condition>
329 <or>
330 <and>
331 <not-equals>
332 <property>/autopilot/settings/nav-mode-source</property>
333 <value>NAV2</value>
334 </not-equals>
335 <equals>
336 <property>/instrumentation/nav[0]/gs-in-range</property>
337 <value>true</value>
338 </equals>
339 <less-than>
340 <!-- Must intercept the glideslope from below -->
341 <property>/instrumentation/nav[0]/gs-needle-deflection-norm</property>
342 <value>0.2</value>
343 </less-than>
344 <greater-than>
345 <!-- Must intercept the glideslope from below -->
346 <property>/instrumentation/nav[0]/gs-needle-deflection-norm</property>
347 <value>0.0</value>
348 </greater-than>
349 </and>
350 <and>
351 <equals>
352 <property>/autopilot/settings/nav-mode-source</property>
353 <value>NAV2</value>
354 </equals>
355 <equals>
356 <property>/instrumentation/nav[1]/gs-in-range</property>
357 <value>true</value>
358 </equals>
359 <less-than>
360 <!-- Must intercept the glideslope from below -->
361 <property>/instrumentation/nav[1]/gs-needle-deflection-norm</property>
362 <value>0.2</value>
363 </less-than>
364 <greater-than>
365 <!-- Must intercept the glideslope from below -->
366 <property>/instrumentation/nav[1]/gs-needle-deflection-norm</property>
367 <value>0.0</value>
368 </greater-than>
369 </and>
370 </or>
371 </condition>
372 </transition>
373
374 <state>
375 <name>GS</name>
376 <enter>
377 <command>property-assign</command>
378 <property>/autopilot/annunciator/vertical-mode</property>
379 <value>GS</value>
380 </enter>
381 <enter>
382 <command>property-assign</command>
383 <property>/autopilot/annunciator/vertical-mode-armed</property>
384 <value></value>
385 </enter>
386 <enter>
387 <command>property-assign</command>
388 <property>/autopilot/annunciator/vertical-mode-target</property>
389 <value></value>
390 </enter>
391 <enter>
392 <command>property-assign</command>
393 <property>/autopilot/locks/altitude</property>
394 <value>gs-hold</value>
395 </enter>
396 <enter>
397 <command>property-assign</command>
398 <property>/autopilot/locks/speed</property>
399 <value></value>
400 </enter>
401 </state>
402
403 <state>
404 <name>BC</name>
405 </state>
406
407 <state>
408 <name>FLC</name>
409 <enter>
410 <command>property-assign</command>
411 <property>/autopilot/annunciator/vertical-mode</property>
412 <value>FLC</value>
413 </enter>
414 <enter>
415 <command>property-assign</command>
416 <property>/autopilot/annunciator/vertical-mode-armed</property>
417 <value></value>
418 </enter>
419 <enter>
420 <command>property-assign</command>
421 <property>/autopilot/settings/target-speed-kt</property>
422 <property n="1">/autopilot/internal/filtered-airspeed</property>
423 </enter>
424 <enter>
425 <command>nasal</command>
426 <script>
427 setprop("/autopilot/annunciator/vertical-mode-target",
428 sprintf("%i kt", getprop("/autopilot/settings/target-speed-kt"))
429 );
430 </script>
431 </enter>
432 <enter>
433 <command>property-assign</command>
434 <property>/autopilot/locks/altitude</property>
435 <value></value>
436 </enter>
437 <enter>
438 <command>property-assign</command>
439 <property>/autopilot/locks/speed</property>
440 <value>speed-with-pitch-trim</value>
441 </enter>
442 <enter>
443 <!-- Reset button to avoid triggering next transition immediately -->
444 <command>property-assign</command>
445 <property>/autopilot/vertical-mode-button</property>
446 <value></value>
447 </enter>
448
449 </state>
450
451 <!-- From the OFF state, pressing any of FD, AP, CWS, NAV, BC, APR, HDG changes to PIT mode -->
452 <transition>
453 <name>OFF-PIT</name>
454 <source>OFF</source>
455 <target>PIT</target>
456 <exclude-target>true</exclude-target>
457 <condition>
458 <or>
459 <equals><property>/autopilot/vertical-mode-button</property><value>AP</value></equals>
460 <equals><property>/autopilot/vertical-mode-button</property><value>FD</value></equals>
461 <equals><property>/autopilot/vertical-mode-button</property><value>CWS</value></equals>
462 <equals><property>/autopilot/vertical-mode-button</property><value>NAV</value></equals>
463 <equals><property>/autopilot/vertical-mode-button</property><value>BC</value></equals>
464 <equals><property>/autopilot/vertical-mode-button</property><value>APR</value></equals>
465 <equals><property>/autopilot/vertical-mode-button</property><value>HDG</value></equals>
466 </or>
467 </condition>
468 </transition>
469
470 <!-- AP/FD logic is somewhat complex:
471 1) Pressing AP toggles the autopilot on/off
472 Handled by a separate FSM. We could use a series of transitions
473 to the same states below, but that would result in entry bindings being repeated, which would be bad
474 2) When the AP is enabled, the FD button is disabled. (Easy - no transition!)
475 3) Pressing the FD button when the FD is enabled switches off the FD : Switch-off transition below
476 -->
477
478 <!-- From any state pressing FD when FD is ON switches off the FD -->
479 <transition>
480 <name>FD-Switch-off</name>
481 <target>OFF</target>
482 <exclude-target>true</exclude-target>
483 <condition>
484 <not><equals><property>/autopilot/annunciator/autopilot-enabled</property><value>1</value></equals></not>
485 <equals><property>/autopilot/vertical-mode-button</property><value>FD</value></equals>
486 <equals><property>/autopilot/locks/passive-mode</property><value>1</value></equals>
487 </condition>
488 </transition>
489
490 <!-- From any state pressing VS changes to VS mode -->
491 <transition>
492 <name>VS-ON</name>
493 <target>VS</target>
494 <exclude-target>true</exclude-target>
495 <condition>
496 <and>
497 <equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
498 <not><equals><property>/autopilot/locks/altitude</property><value>vertical-speed-hold</value></equals></not>
499 </and>
500 </condition>
501 </transition>
502
503 <!-- From any state, pressing GA goes to GA mode -->
504 <transition>
505 <name>GA</name>
506 <target>GA</target>
507 <exclude-target>true</exclude-target>
508 <condition>
509 <equals><property>/autopilot/vertical-mode-button</property><value>GA</value></equals>
510 </condition>
511 </transition>
512
513 <!-- From any state, pressing ALT goes to ALT mode -->
514 <transition>
515 <name>ALT</name>
516 <target>ALT</target>
517 <exclude-target>true</exclude-target>
518 <condition>
519 <equals><property>/autopilot/vertical-mode-button</property><value>ALT</value></equals>
520 </condition>
521 <binding>
522 <command>nasal</command>
523 <script>
524 <!-- Set up the 2nd target to the current altitude within 10ft-->
525 setprop("/autopilot/settings/target-altitude-ft-2",
526 math.round(getprop("/instrumentation/altimeter/indicated-altitude-ft"),10));
527 </script>
528 </binding>
529 </transition>
530
531 <!-- From any state pressing FLC changes to FLC mode, if not already enabled -->
532 <transition>
533 <name>FLC-ON</name>
534 <target>FLC</target>
535 <exclude-target>true</exclude-target>
536 <condition>
537 <and>
538 <equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
539 <not><equals><property>/autopilot/locks/speed</property><value>speed-with-pitch-trim</value></equals></not>
540 </and>
541 </condition>
542 </transition>
543
544 <!-- From any state pressing APR changes to GS mode, if not already enabled -->
545 <transition>
546 <name>GS-ON</name>
547 <target>GS-ARM</target>
548 <exclude-target>true</exclude-target>
549 <condition>
550 <and>
551 <equals><property>/autopilot/vertical-mode-button</property><value>APR</value></equals>
552 <not><equals><property>/autopilot/locks/altitude</property><value>gs-hold</value></equals></not>
553 </and>
554 </condition>
555 </transition>
556
557 <!-- 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 -->
558
559
560 <!-- From VS state pressing VS changes back to to PIT mode -->
561 <transition>
562 <name>VS-OFF</name>
563 <source>VS</source>
564 <source>ALTS-ARM</source>
565 <target>PIT</target>
566 <exclude-target>true</exclude-target>
567 <condition>
568 <and>
569 <equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
570 <equals><property>/autopilot/locks/altitude</property><value>vertical-speed-hold</value></equals>
571 </and>
572 </condition>
573 </transition>
574
575 <!-- From ALT state pressing ALT changes back to to PIT mode -->
576 <transition>
577 <name>ALT-OFF</name>
578 <source>ALT</source>
579 <target>PIT</target>
580 <exclude-target>true</exclude-target>
581 <condition>
582 <equals><property>/autopilot/vertical-mode-button</property><value>ALT</value></equals>
583 </condition>
584 </transition>
585
586 <!-- From VNV state pressing VNV changes back to to PIT mode -->
587 <transition>
588 <name>VNV-OFF</name>
589 <source>VNV</source>
590 <target>PIT</target>
591 <exclude-target>true</exclude-target>
592 <condition>
593 <equals><property>/autopilot/vertical-mode-button</property><value>VNV</value></equals>
594 </condition>
595 </transition>
596
597 <!-- From BC state pressing BC changes back to to PIT mode -->
598 <transition>
599 <name>BC-OFF</name>
600 <source>BC</source>
601 <target>PIT</target>
602 <exclude-target>true</exclude-target>
603 <condition>
604 <equals><property>/autopilot/vertical-mode-button</property><value>BC</value></equals>
605 </condition>
606 </transition>
607
608 <!-- 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 -->
609 <transition>
610 <name>FLC-OFF</name>
611 <source>FLC</source>
612 <source>ALTS-ARM</source>
613 <target>PIT</target>
614 <exclude-target>true</exclude-target>
615 <condition>
616 <and>
617 <equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
618 <equals><property>/autopilot/locks/speed</property><value>speed-with-pitch-trim</value></equals>
619 </and>
620 </condition>
621 </transition>
622
623 <!-- From GA state, pressing GA returns to PIT mode -->
624 <transition>
625 <name>GA-OFF</name>
626 <source>GA</source>
627 <target>PIT</target>
628 <condition>
629 <equals><property>/autopilot/vertical-mode-button</property><value>GA</value></equals>
630 </condition>
631 </transition>
632
633
634 </PropertyList>