Debian Codegraph @

Aircraft/c172p/Models/Interior/Panel/Instruments/kap140/kap140-proprules.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4
5 This are the filters to control the actual 'mode' of the KAP 140
6 The actual 'control' (the control loops) are in a different xml file.
7
8 This filters control the modes and output them in the prop-tree as:
9
10 autopilot/kap140/settings/lateral-mode
11 autopilot/kap140/settings/lateral-arm
12 autopilot/kap140/settings/vertical-mode
13 autopilot/kap140/settings/vertical-arm
14
15 The properties with prefix '-mode' reflect what is currently active.
16 The properties with prefix '-arm' show what will be active if the conditional are meet.
17
18 The numbers of the 'lateral-*' properties has the meaning as followed:
19 0 = off
20 1 = ROL (only in '-mode')
21 2 = HDG (only in '-mode')
22 3 = NAV
23 4 = APR
24 5 = REV
25 6 = GS (special, only possible in '-arm' if 'lateral-mode' is 4)
26
27 The numbers of the 'vertical-*' properties has the meaning as followed:
28 0 = off
29 1 = VS (only in '-mode')
30 2 = ALT
31 3 = GS (special, only possible in '-mode' if 'lateral-mode' is 4)
32
33 Special behavior of the GS (Glide Slope):
34
35 Case 1:
36 lateral-mode = 4 (APR)
37 lateral-arm = 6 (GS ARM)
38
39 We have captured the localizer and waiting for the GS.
40
41 Case 2:
42 lateral-mode = 4 (APR)
43 vertical-mode = 3 (GS)
44
45 We have captured the localizer and the GS.
46
47 -->
48
49 <PropertyList include="kap140-config.xml">
50
51 <!-- Servos failure mapping for failure-manager-->
52 <logic>
53 <input>
54 <and>
55 <greater-than>
56 <property>autopilot/kap140/panel/state</property>
57 <value>2</value>
58 </greater-than>
59 <or>
60 <not><property>autopilot/kap140/servo/roll-servo/serviceable</property></not>
61 <greater-than>
62 <property>autopilot/kap140/servo/roll-servo/check-timer</property>
63 <value>0</value>
64 </greater-than>
65 <and>
66 <greater-than>
67 <expression>
68 <abs><property>autopilot/kap140/servo/roll-servo/force</property></abs>
69 </expression>
70 <value alias="/params/roll-servo-force-max"/>
71 </greater-than>
72 </and>
73 </or>
74 </and>
75 </input>
76 <output>autopilot/kap140/roll-axis-fail</output>
77 </logic>
78 <logic>
79 <input>
80 <and>
81 <greater-than>
82 <property>autopilot/kap140/panel/state</property>
83 <value>2</value>
84 </greater-than>
85 <or>
86 <not><property>autopilot/kap140/servo/pitch-servo/serviceable</property></not>
87 <not><property>autopilot/kap140/servo/elevator-trim-servo/serviceable</property></not>
88 <property>autopilot/kap140/sensors/excess-g</property>
89 <greater-than>
90 <property>autopilot/kap140/servo/pitch-servo/check-timer</property>
91 <value>0</value>
92 </greater-than>
93 <and>
94 <greater-than>
95 <expression>
96 <abs><property>autopilot/kap140/servo/pitch-servo/force</property></abs>
97 </expression>
98 <value alias="/params/pitch-servo-force-max"/>
99 </greater-than>
100 </and>
101 </or>
102 </and>
103 </input>
104 <output>autopilot/kap140/pitch-axis-fail</output>
105 </logic>
106
107 <!-- Detect servo movement -->
108 <filter>
109 <type>derivative</type>
110 <gain>100</gain>
111 <input>
112 <condition>
113 <greater-than>
114 <property>autopilot/kap140/settings/lateral-mode</property>
115 <value>0</value>
116 </greater-than>
117 </condition>
118 <property>controls/flight/aileron</property>
119 </input>
120 <input>0</input>
121 <output>autopilot/kap140/servo/roll-servo/moverate</output>
122 <filter-time>0.5</filter-time>
123 </filter>
124 <filter>
125 <type>derivative</type>
126 <gain>100</gain>
127 <input>
128 <condition>
129 <greater-than>
130 <property>autopilot/kap140/settings/vertical-mode</property>
131 <value>0</value>
132 </greater-than>
133 </condition>
134 <property>controls/flight/elevator</property>
135 </input>
136 <input>0</input>
137 <output>autopilot/kap140/servo/pitch-servo/moverate</output>
138 <filter-time>0.5</filter-time>
139 </filter>
140
141 <!-- Detect excess g forces (c182s POH p. S15-6); disconnect AP. -->
142 <!-- (Note: we want to filter short bursts that can occur during turbolences) -->
143 <logic>
144 <input>
145 <or>
146 <less-than>
147 <property>accelerations/pilot-gdamped</property>
148 <value alias="/params/gforce-min"/>
149 </less-than>
150 <greater-than>
151 <property>accelerations/pilot-gdamped</property>
152 <value alias="/params/gforce-max"/>
153 </greater-than>
154 </or>
155 </input>
156 <output>autopilot/kap140/sensors/excess-g-raw</output>
157 </logic>
158 <flipflop>
159 <name>Excess G-forces for too long</name>
160 <type>monostable</type>
161 <inverted type="bool">true</inverted>
162 <S> <not> <property>autopilot/kap140/sensors/excess-g-raw</property> </not> </S>
163 <time>
164 <value>1.0</value>
165 </time>
166 <output> <property>autopilot/kap140/sensors/excess-g</property> </output>
167 </flipflop>
168
169 <!-- Detect inoperable turn-indicator -->
170 <logic>
171 <input>
172 <and>
173 <property>instrumentation/turn-indicator/serviceable</property>
174 <greater-than>
175 <property>systems/electrical/outputs/turn-coordinator</property>
176 <value>12</value>
177 </greater-than>
178 </and>
179 </input>
180 <output>autopilot/kap140/sensors/turn-indicator-operable</output>
181 </logic>
182
183 <!-- servo check -->
184
185 <filter>
186 <name>set roll servo check</name>
187 <type>gain</type>
188 <debug>false</debug>
189 <enable>
190 <condition>
191 <property>autopilot/kap140/powered</property>
192 <equals>
193 <property>autopilot/kap140/servo/roll-servo/check-timer</property>
194 <value>0.0</value>
195 </equals>
196 </condition>
197 </enable>
198 <input>
199 <expression>
200 <sum>
201 <property>autopilot/kap140/panel/pft-1</property>
202 <value>5.0</value>
203 <product>
204 <mod>
205 <product>
206 <property>sim/time/elapsed-sec</property>
207 <value>1.61803398875</value>
208 </product>
209 <value>1.0</value>
210 </mod>
211 <value>5.0</value>
212 </product>
213 </sum>
214 </expression>
215 </input>
216 <output>autopilot/kap140/servo/roll-servo/check-timer</output>
217 </filter>
218
219 <filter>
220 <name>clear roll servo check</name>
221 <type>gain</type>
222 <debug>false</debug>
223 <enable>
224 <condition>
225 <property>autopilot/kap140/powered</property>
226 <greater-than>
227 <property>autopilot/kap140/servo/roll-servo/check-timer</property>
228 <value>1.0</value>
229 </greater-than>
230 <greater-than>
231 <property>sim/time/elapsed-sec</property>
232 <property>autopilot/kap140/servo/roll-servo/check-timer</property>
233 </greater-than>
234 </condition>
235 </enable>
236 <input>-1.0</input>
237 <output>autopilot/kap140/servo/roll-servo/check-timer</output>
238 </filter>
239
240 <filter>
241 <name>set pitch servo check</name>
242 <type>gain</type>
243 <debug>false</debug>
244 <enable>
245 <condition>
246 <property>autopilot/kap140/powered</property>
247 <equals>
248 <property>autopilot/kap140/servo/pitch-servo/check-timer</property>
249 <value>0.0</value>
250 </equals>
251 </condition>
252 </enable>
253 <input>
254 <expression>
255 <sum>
256 <property>autopilot/kap140/panel/pft-1</property>
257 <value>15.0</value>
258 <product>
259 <mod>
260 <product>
261 <property>sim/time/elapsed-sec</property>
262 <value>1.61803398875</value>
263 </product>
264 <value>1.0</value>
265 </mod>
266 <value>15.0</value>
267 </product>
268 </sum>
269 </expression>
270 </input>
271 <output>autopilot/kap140/servo/pitch-servo/check-timer</output>
272 </filter>
273
274 <filter>
275 <name>clear pitch servo check</name>
276 <type>gain</type>
277 <debug>false</debug>
278 <enable>
279 <condition>
280 <property>autopilot/kap140/powered</property>
281 <greater-than>
282 <property>autopilot/kap140/servo/pitch-servo/check-timer</property>
283 <value>1.0</value>
284 </greater-than>
285 <greater-than>
286 <property>sim/time/elapsed-sec</property>
287 <property>autopilot/kap140/servo/pitch-servo/check-timer</property>
288 </greater-than>
289 </condition>
290 </enable>
291 <input>-1.0</input>
292 <output>autopilot/kap140/servo/pitch-servo/check-timer</output>
293 </filter>
294
295 <!-- reset all if the AP has no power -->
296 <filter>
297 <name>unpowered</name>
298 <type>gain</type>
299 <debug>false</debug>
300 <enable>
301 <condition>
302 <property>autopilot/kap140/powered</property>
303 <less-than>
304 <property alias="/params/power-supplied"/>
305 <expression>
306 <product>
307 <value alias="/params/power-nominal"/>
308 <value>0.7</value>
309 </product>
310 </expression>
311 </less-than>
312 </condition>
313 </enable>
314 <input>0</input>
315 <output>autopilot/kap140/powered</output>
316 </filter>
317
318 <filter>
319 <name>cold state</name>
320 <type>gain</type>
321 <debug>false</debug>
322 <enable>
323 <condition>
324 <or>
325 <not><property>autopilot/kap140/powered</property></not>
326 <not><property>autopilot/kap140/serviceable</property></not>
327 </or>
328 </condition>
329 </enable>
330 <input>0</input>
331 <output>autopilot/kap140/bad-condition</output>
332 <output>autopilot/kap140/panel/state</output>
333 <output>autopilot/kap140/panel/state-old</output>
334 <output>autopilot/kap140/sensors/pitch-up</output>
335 <output>autopilot/kap140/sensors/pitch-down</output>
336 <output>autopilot/kap140/panel/pft-1</output>
337 <output>autopilot/kap140/panel/pft-2</output>
338 <output>autopilot/kap140/panel/pft-3</output>
339 <output>autopilot/kap140/panel/digit</output>
340 <output>autopilot/kap140/panel/digit-mode</output>
341 <output>autopilot/kap140/panel/digit-timer</output>
342 <output>autopilot/kap140/panel/baro-mode</output>
343 <output>autopilot/kap140/panel/baro-timer</output>
344 <output>autopilot/kap140/panel/nav-timer</output>
345 <output>autopilot/kap140/panel/gs-timer</output>
346 <output>autopilot/kap140/settings/cws</output>
347 <output>autopilot/kap140/settings/ap-disc</output>
348 <output>autopilot/kap140/servo/roll-servo/check-timer</output>
349 <output>autopilot/kap140/servo/pitch-servo/check-timer</output>
350 </filter>
351
352 <!-- reset default altitude if the AP has no power -->
353 <filter>
354 <name>default-altitude</name>
355 <type>gain</type>
356 <debug>false</debug>
357 <enable>
358 <condition>
359 <not><property>autopilot/kap140/panel/state</property></not>
360 </condition>
361 </enable>
362 <input alias="/params/default-altitude"/>
363 <output>autopilot/internal/target-altitude</output>
364 </filter>
365
366 <!-- reset default baro setting if the AP has no power and is not tied -->
367 <filter>
368 <name>default-inhg</name>
369 <type>gain</type>
370 <debug>false</debug>
371 <enable>
372 <condition>
373 <not><property>autopilot/kap140/panel/state</property></not>
374 <not><property alias="/params/baro-tied"/></not>
375 </condition>
376 </enable>
377 <input>29.92</input>
378 <output alias="/params/baro-inhg"/>
379 </filter>
380
381 <!-- start the Pre-Flight-Test if the AP receive enough powered -->
382 <filter>
383 <name>powered</name>
384 <type>gain</type>
385 <debug>false</debug>
386 <enable>
387 <condition>
388 <not><property>autopilot/kap140/powered</property></not>
389 <greater-than>
390 <property alias="/params/power-supplied"/>
391 <expression>
392 <product>
393 <value alias="/params/power-nominal"/>
394 <value>0.7</value>
395 </product>
396 </expression>
397 </greater-than>
398 </condition>
399 </enable>
400 <input>1</input>
401 <output>autopilot/kap140/powered</output>
402 </filter>
403
404 <!-- control conditions for every PFT stage -->
405 <filter>
406 <name>bad-condition</name>
407 <type>gain</type>
408 <debug>false</debug>
409 <enable>
410 <condition>
411 <greater-than>
412 <property>autopilot/kap140/panel/state</property>
413 <value>-1</value>
414 </greater-than>
415 <less-than>
416 <property>autopilot/kap140/panel/state</property>
417 <value>3</value>
418 </less-than>
419 <not><property>autopilot/kap140/bad-condition</property></not>
420 </condition>
421 </enable>
422 <input>
423 <condition>
424 <equals>
425 <property>autopilot/kap140/panel/state</property>
426 <value>0</value>
427 </equals>
428 <not><property>autopilot/kap140/serviceable</property></not>
429 </condition>
430 <value>1</value>
431 </input>
432 <input>
433 <condition>
434 <equals>
435 <property>autopilot/kap140/panel/state</property>
436 <value>1</value>
437 </equals>
438 <not><property>autopilot/kap140/programmed</property></not>
439 </condition>
440 <value>1</value>
441 </input>
442 <input>
443 <condition>
444 <equals>
445 <property>autopilot/kap140/panel/state</property>
446 <value>2</value>
447 </equals>
448 <or>
449 <property>autopilot/kap140/roll-axis-fail</property>
450 <property>autopilot/kap140/pitch-axis-fail</property>
451 <not><property>autopilot/kap140/sensors/turn-indicator-operable</property></not>
452 </or>
453 </condition>
454 <value>1</value>
455 </input>
456 <output>autopilot/kap140/bad-condition</output>
457 </filter>
458
459 <!-- PFT stage 1 -->
460 <filter>
461 <name>state1-timer</name>
462 <type>gain</type>
463 <debug>false</debug>
464 <enable>
465 <condition>
466 <equals>
467 <property>autopilot/kap140/panel/state</property>
468 <value>0</value>
469 </equals>
470 <equals>
471 <property>autopilot/kap140/powered</property>
472 <value>1</value>
473 </equals>
474 <less-than>
475 <property>autopilot/kap140/panel/pft-1</property>
476 <value>1</value>
477 </less-than>
478 </condition>
479 </enable>
480 <input>
481 <condition>
482 <property>autopilot/kap140/bad-condition</property>
483 </condition>
484 <expression>
485 <sum>
486 <property>sim/time/elapsed-sec</property>
487 <value>0.2</value>
488 </sum>
489 </expression>
490 </input>
491 <input>
492 <expression>
493 <sum>
494 <property>sim/time/elapsed-sec</property>
495 <value>4</value>
496 </sum>
497 </expression>
498 </input>
499 <output>autopilot/kap140/panel/pft-1</output>
500 </filter>
501
502 <filter>
503 <name>state1</name>
504 <type>gain</type>
505 <debug>false</debug>
506 <enable>
507 <condition>
508 <equals>
509 <property>autopilot/kap140/panel/state</property>
510 <value>0</value>
511 </equals>
512 <equals>
513 <property>autopilot/kap140/powered</property>
514 <value>1</value>
515 </equals>
516 <greater-than>
517 <property>autopilot/kap140/panel/pft-1</property>
518 <value>1</value>
519 </greater-than>
520 </condition>
521 </enable>
522 <input>1</input>
523 <output>autopilot/kap140/panel/state</output>
524 </filter>
525
526 <!-- PFT stage 2 -->
527 <filter>
528 <name>state2-timer</name>
529 <type>gain</type>
530 <debug>false</debug>
531 <enable>
532 <condition>
533 <equals>
534 <property>autopilot/kap140/panel/state</property>
535 <value>1</value>
536 </equals>
537 <equals>
538 <property>autopilot/kap140/powered</property>
539 <value>1</value>
540 </equals>
541 <greater-than>
542 <property>sim/time/elapsed-sec</property>
543 <property>autopilot/kap140/panel/pft-1</property>
544 </greater-than>
545 <less-than>
546 <property>autopilot/kap140/panel/pft-2</property>
547 <value>1</value>
548 </less-than>
549 </condition>
550 </enable>
551 <input>
552 <condition>
553 <property>autopilot/kap140/bad-condition</property>
554 </condition>
555 <expression>
556 <sum>
557 <property>sim/time/elapsed-sec</property>
558 <value>0.2</value>
559 </sum>
560 </expression>
561 </input>
562 <input>
563 <expression>
564 <sum>
565 <property>sim/time/elapsed-sec</property>
566 <value>4</value>
567 </sum>
568 </expression>
569 </input>
570 <output>autopilot/kap140/panel/pft-2</output>
571 </filter>
572
573 <filter>
574 <name>state2</name>
575 <type>gain</type>
576 <debug>false</debug>
577 <enable>
578 <condition>
579 <equals>
580 <property>autopilot/kap140/panel/state</property>
581 <value>1</value>
582 </equals>
583 <equals>
584 <property>autopilot/kap140/powered</property>
585 <value>1</value>
586 </equals>
587 <greater-than>
588 <property>autopilot/kap140/panel/pft-2</property>
589 <value>1</value>
590 </greater-than>
591 </condition>
592 </enable>
593 <input>2</input>
594 <output>autopilot/kap140/panel/state</output>
595 </filter>
596
597 <!-- PFT stage 3 -->
598 <filter>
599 <name>state3-timer</name>
600 <type>gain</type>
601 <debug>false</debug>
602 <enable>
603 <condition>
604 <equals>
605 <property>autopilot/kap140/panel/state</property>
606 <value>2</value>
607 </equals>
608 <equals>
609 <property>autopilot/kap140/powered</property>
610 <value>1</value>
611 </equals>
612 <greater-than>
613 <property>sim/time/elapsed-sec</property>
614 <property>autopilot/kap140/panel/pft-2</property>
615 </greater-than>
616 <less-than>
617 <property>autopilot/kap140/panel/pft-3</property>
618 <value>1</value>
619 </less-than>
620 </condition>
621 </enable>
622 <input>
623 <condition>
624 <property>autopilot/kap140/bad-condition</property>
625 </condition>
626 <expression>
627 <sum>
628 <property>sim/time/elapsed-sec</property>
629 <value>0.2</value>
630 </sum>
631 </expression>
632 </input>
633 <input>
634 <expression>
635 <sum>
636 <property>sim/time/elapsed-sec</property>
637 <value>2</value>
638 </sum>
639 </expression>
640 </input>
641 <output>autopilot/kap140/panel/pft-3</output>
642 </filter>
643
644 <filter>
645 <name>state3</name>
646 <type>gain</type>
647 <debug>false</debug>
648 <enable>
649 <condition>
650 <equals>
651 <property>autopilot/kap140/panel/state</property>
652 <value>2</value>
653 </equals>
654 <equals>
655 <property>autopilot/kap140/powered</property>
656 <value>1</value>
657 </equals>
658 <greater-than>
659 <property>autopilot/kap140/panel/pft-3</property>
660 <value>1</value>
661 </greater-than>
662 </condition>
663 </enable>
664 <input>3</input>
665 <output>autopilot/kap140/panel/state</output>
666 </filter>
667
668 <!-- PFT finish ; decide if the AP is usable and need baro settings (untied) or not (tied) -->
669 <filter>
670 <name>state4-5</name>
671 <type>gain</type>
672 <debug>false</debug>
673 <enable>
674 <condition>
675 <equals>
676 <property>autopilot/kap140/panel/state</property>
677 <value>3</value>
678 </equals>
679 <greater-than>
680 <property>sim/time/elapsed-sec</property>
681 <property>autopilot/kap140/panel/pft-3</property>
682 </greater-than>
683 </condition>
684 </enable>
685 <input>
686 <condition>
687 <property>autopilot/kap140/bad-condition</property>
688 </condition>
689 <value>-1</value>
690 </input>
691 <input>
692 <condition>
693 <equals>
694 <value alias="/params/model"/>
695 <value>3</value>
696 </equals>
697 <not><property alias="/params/baro-tied"/></not>
698 </condition>
699 <value>4</value>
700 </input>
701 <input>5</input>
702 <output>autopilot/kap140/panel/state</output>
703 </filter>
704
705 <!-- PFT finish ; decide if the AP is usable and need baro settings (untied) or not (tied) -->
706 <filter>
707 <name>state5</name>
708 <type>gain</type>
709 <debug>false</debug>
710 <enable>
711 <condition>
712 <equals>
713 <property>autopilot/kap140/panel/state</property>
714 <value>4</value>
715 </equals>
716 <equals>
717 <property>autopilot/kap140/powered</property>
718 <value>1</value>
719 </equals>
720 <greater-than>
721 <property>autopilot/kap140/panel/button-baro</property>
722 <value>0</value>
723 </greater-than>
724 </condition>
725 </enable>
726 <input>5</input>
727 <output>autopilot/kap140/panel/state</output>
728 </filter>
729
730 <!-- set FPM timer while approaching preselected altitude -->
731 <filter>
732 <name>display FPM while closing to preselected altitude</name>
733 <debug>false</debug>
734 <type>gain</type>
735 <enable>
736 <condition>
737 <equals>
738 <property>autopilot/kap140/settings/vertical-arm</property>
739 <value>2</value>
740 </equals>
741 <or>
742 <greater-than>
743 <property>autopilot/internal/target-climb-rate</property>
744 <value>100</value>
745 </greater-than>
746 <less-than>
747 <property>autopilot/internal/target-climb-rate</property>
748 <value>-100</value>
749 </less-than>
750 </or>
751 <greater-than>
752 <expression>
753 <abs>
754 <property>autopilot/internal/target-climb-rate</property>
755 </abs>
756 </expression>
757 <expression>
758 <product>
759 <abs>
760 <dif>
761 <property>autopilot/internal/target-altitude</property>
762 <property alias="/params/indicated-altitude-ft"/>
763 </dif>
764 </abs>
765 <value alias="/params/vs-ratio"/>
766 </product>
767 </expression>
768 </greater-than>
769 </condition>
770 </enable>
771 <input>sim/time/elapsed-sec</input>
772 <output>autopilot/kap140/panel/fpm-timer</output>
773 </filter>
774
775 <!-- reset FPM timer if we captured the altitude -->
776 <filter>
777 <name>display FPM while closing to preselected altitude</name>
778 <debug>false</debug>
779 <type>gain</type>
780 <enable>
781 <condition>
782 <greater-than>
783 <property>autopilot/kap140/settings/vertical-mode</property>
784 <value>1</value>
785 </greater-than>
786 </condition>
787 </enable>
788 <input>0</input>
789 <output>autopilot/kap140/panel/fpm-timer</output>
790 </filter>
791
792 <!-- decide what the digit will show up -->
793 <filter>
794 <name>digit-mode</name>
795 <type>gain</type>
796 <debug>false</debug>
797 <enable>
798 <condition>
799 <greater-than>
800 <property>autopilot/kap140/panel/state</property>
801 <value>3</value>
802 </greater-than>
803 </condition>
804 </enable>
805 <input>
806 <condition>
807 <equals>
808 <property>autopilot/kap140/panel/state</property>
809 <value>6</value>
810 </equals>
811 <or>
812 <and>
813 <equals>
814 <value alias="/params/model"/>
815 <value>3</value>
816 </equals>
817 <less-than>
818 <property>autopilot/kap140/settings/vertical-mode</property>
819 <value>3</value>
820 </less-than>
821 <greater-than>
822 <expression>
823 <sum>
824 <property>autopilot/kap140/panel/fpm-timer</property>
825 <value>3</value>
826 </sum>
827 </expression>
828 <property>sim/time/elapsed-sec</property>
829 </greater-than>
830 </and>
831 <and>
832 <equals>
833 <value alias="/params/model"/>
834 <value>2</value>
835 </equals>
836 <equals>
837 <property>autopilot/kap140/settings/vertical-mode</property>
838 <value>1</value>
839 </equals>
840 </and>
841 </or>
842 </condition>
843 <value>2</value>
844 </input>
845 <input>
846 <condition>
847 <equals>
848 <value alias="/params/model"/>
849 <value>3</value>
850 </equals>
851 <or>
852 <equals>
853 <property>autopilot/kap140/panel/state</property>
854 <value>4</value>
855 </equals>
856 <and>
857 <greater-than>
858 <property>autopilot/kap140/panel/state</property>
859 <value>4</value>
860 </greater-than>
861 <greater-than>
862 <expression>
863 <sum>
864 <property>autopilot/kap140/panel/baro-timer</property>
865 <value>3</value>
866 </sum>
867 </expression>
868 <property>sim/time/elapsed-sec</property>
869 </greater-than>
870 </and>
871 </or>
872 </condition>
873 <value>3</value>
874 </input>
875 <input>
876 <condition>
877 <equals>
878 <value alias="/params/model"/>
879 <value>3</value>
880 </equals>
881 <greater-than>
882 <property>autopilot/kap140/panel/state</property>
883 <value>4</value>
884 </greater-than>
885 </condition>
886 <value>1</value>
887 </input>
888 <input>0</input>
889 <output>autopilot/kap140/panel/digit-mode</output>
890 </filter>
891
892 <!-- control the digit timer -->
893 <filter>
894 <name>set digit-timer</name>
895 <type>gain</type>
896 <debug>false</debug>
897 <enable>
898 <condition>
899 <equals>
900 <property>autopilot/kap140/panel/state</property>
901 <value>4</value>
902 </equals>
903 <less-than>
904 <property>autopilot/kap140/panel/digit-timer</property>
905 <value>1</value>
906 </less-than>
907 </condition>
908 </enable>
909 <input>sim/time/elapsed-sec</input>
910 <output>autopilot/kap140/panel/digit-timer</output>
911 </filter>
912
913 <filter>
914 <name>stop digit-timer</name>
915 <type>gain</type>
916 <debug>false</debug>
917 <enable>
918 <condition>
919 <equals>
920 <property>autopilot/kap140/panel/state</property>
921 <value>5</value>
922 </equals>
923 <greater-than>
924 <property>autopilot/kap140/panel/digit-timer</property>
925 <value>0</value>
926 </greater-than>
927 </condition>
928 </enable>
929 <input>0</input>
930 <output>autopilot/kap140/panel/digit-timer</output>
931 </filter>
932
933 <!-- control the digit display on Pre-Flight-Test -->
934 <filter>
935 <name>pft digit</name>
936 <type>gain</type>
937 <debug>false</debug>
938 <enable>
939 <condition>
940 <greater-than>
941 <property>autopilot/kap140/panel/state</property>
942 <value>0</value>
943 </greater-than>
944 <less-than>
945 <property>autopilot/kap140/panel/state</property>
946 <value>4</value>
947 </less-than>
948 </condition>
949 </enable>
950 <input>
951 <expression>
952 <product>
953 <property>autopilot/kap140/panel/state</property>
954 <value>10000</value>
955 </product>
956 </expression>
957 </input>
958 <output>autopilot/kap140/panel/digit</output>
959 </filter>
960
961 <!-- what should the digit display show -->
962 <filter>
963 <name>normal digit</name>
964 <type>gain</type>
965 <debug>false</debug>
966 <enable>
967 <condition>
968 <greater-than>
969 <property>autopilot/kap140/panel/state</property>
970 <value>3</value>
971 </greater-than>
972 </condition>
973 </enable>
974 <input>
975 <condition>
976 <equals>
977 <property>autopilot/kap140/panel/digit-mode</property>
978 <value>1</value>
979 </equals>
980 </condition>
981 <expression>
982 <abs><property>autopilot/internal/target-altitude</property></abs>
983 </expression>
984 </input>
985 <input>
986 <condition>
987 <equals>
988 <property>autopilot/kap140/panel/digit-mode</property>
989 <value>2</value>
990 </equals>
991 </condition>
992 <expression>
993 <abs><property>autopilot/internal/target-climb-rate</property></abs>
994 </expression>
995 </input>
996 <input>
997 <condition>
998 <equals>
999 <property>autopilot/kap140/panel/digit-mode</property>
1000 <value>3</value>
1001 </equals>
1002 <equals>
1003 <property>autopilot/kap140/panel/baro-mode</property>
1004 <value>0</value>
1005 </equals>
1006 </condition>
1007 <expression>
1008 <sum>
1009 <product>
1010 <property alias="/params/baro-inhg"/>
1011 <value>1000</value>
1012 </product>
1013 <value>5</value>
1014 </sum>
1015 </expression>
1016 </input>
1017 <input>
1018 <condition>
1019 <equals>
1020 <property>autopilot/kap140/panel/digit-mode</property>
1021 <value>3</value>
1022 </equals>
1023 <equals>
1024 <property>autopilot/kap140/panel/baro-mode</property>
1025 <value>1</value>
1026 </equals>
1027 </condition>
1028 <property alias="/params/baro-hpa"/>
1029 </input>
1030 <output>autopilot/kap140/panel/digit</output>
1031 </filter>
1032
1033 <!-- switch AP between ON/STBY -->
1034 <filter>
1035 <name>AP on</name>
1036 <type>gain</type>
1037 <debug>false</debug>
1038 <enable>
1039 <condition>
1040 <equals>
1041 <property>autopilot/kap140/panel/state</property>
1042 <value>5</value>
1043 </equals>
1044 <not><property>autopilot/kap140/pitch-axis-fail</property></not>
1045 <not><property>autopilot/kap140/roll-axis-fail</property></not>
1046 <equals>
1047 <property>autopilot/kap140/panel/state</property>
1048 <property>autopilot/kap140/panel/state-old</property>
1049 </equals>
1050 <greater-than>
1051 <property>autopilot/kap140/panel/button-ap</property>
1052 <value>0</value>
1053 </greater-than>
1054 <greater-than>
1055 <property>sim/time/elapsed-sec</property>
1056 <expression>
1057 <sum>
1058 <property>autopilot/kap140/panel/button-ap</property>
1059 <value>0.25</value>
1060 </sum>
1061 </expression>
1062 </greater-than>
1063 </condition>
1064 </enable>
1065 <input>6</input>
1066 <output>autopilot/kap140/panel/state</output>
1067 <output>autopilot/kap140/panel/fpm-timer</output>
1068 </filter>
1069
1070 <filter>
1071 <name>FPM timer after AP on</name>
1072 <type>gain</type>
1073 <debug>false</debug>
1074 <enable>
1075 <condition>
1076 <equals>
1077 <property>autopilot/kap140/panel/fpm-timer</property>
1078 <value>6</value>
1079 </equals>
1080 </condition>
1081 </enable>
1082 <input>sim/time/elapsed-sec</input>
1083 <output>autopilot/kap140/panel/fpm-timer</output>
1084 </filter>
1085
1086 <filter>
1087 <name>AP standby</name>
1088 <type>gain</type>
1089 <debug>false</debug>
1090 <enable>
1091 <condition>
1092 <equals>
1093 <property>autopilot/kap140/panel/state</property>
1094 <value>6</value>
1095 </equals>
1096 <or>
1097 <property>autopilot/kap140/pitch-axis-fail</property>
1098 <property>autopilot/kap140/roll-axis-fail</property>
1099 <not><property>autopilot/kap140/sensors/turn-indicator-operable</property></not>
1100 <and>
1101 <not><property>autopilot/kap140/settings/cws</property></not>
1102 <property>autopilot/kap140/sensors/excess-g</property>
1103 </and>
1104 <and>
1105 <equals>
1106 <property>autopilot/kap140/panel/state</property>
1107 <property>autopilot/kap140/panel/state-old</property>
1108 </equals>
1109 <greater-than>
1110 <property>autopilot/kap140/panel/button-ap</property>
1111 <value>0</value>
1112 </greater-than>
1113 </and>
1114 </or>
1115 </condition>
1116 </enable>
1117 <input>5</input>
1118 <output>autopilot/kap140/panel/state</output>
1119 <output>autopilot/kap140/panel/ap-timer</output>
1120 </filter>
1121
1122 <filter>
1123 <name>set disengage</name>
1124 <type>gain</type>
1125 <debug>false</debug>
1126 <enable>
1127 <condition>
1128 <equals>
1129 <property>autopilot/kap140/panel/ap-timer</property>
1130 <value>5</value>
1131 </equals>
1132 </condition>
1133 </enable>
1134 <input>
1135 <expression>
1136 <sum>
1137 <property>sim/time/elapsed-sec</property>
1138 <value>5</value>
1139 </sum>
1140 </expression>
1141 </input>
1142 <output>autopilot/kap140/panel/ap-timer</output>
1143 </filter>
1144
1145 <filter>
1146 <name>clear disengage</name>
1147 <type>gain</type>
1148 <debug>false</debug>
1149 <enable>
1150 <condition>
1151 <greater-than>
1152 <property>autopilot/kap140/panel/ap-timer</property>
1153 <value>5</value>
1154 </greater-than>
1155 <greater-than>
1156 <property>sim/time/elapsed-sec</property>
1157 <property>autopilot/kap140/panel/ap-timer</property>
1158 </greater-than>
1159 </condition>
1160 </enable>
1161 <input>0</input>
1162 <output>autopilot/kap140/panel/ap-timer</output>
1163 <output>autopilot/kap140/panel/fpm-timer</output>
1164 <output>autopilot/kap140/panel/hdg-timer</output>
1165 <output>autopilot/kap140/panel/nav-timer</output>
1166 <output>autopilot/kap140/panel/gs-timer</output>
1167 <output>autopilot/kap140/panel/baro-timer</output>
1168 <output>autopilot/kap140/panel/digit-timer</output>
1169 <output>autopilot/kap140/panel/button-ap</output>
1170 <output>autopilot/kap140/settings/cws</output>
1171 <output>autopilot/kap140/settings/ap-disc</output>
1172 <output>autopilot/kap140/sensors/pitch-up</output>
1173 <output>autopilot/kap140/sensors/pitch-down</output>
1174 </filter>
1175
1176 <!-- disengage via ap-disc -->
1177
1178 <filter>
1179 <name>clear ap-disc</name>
1180 <type>gain</type>
1181 <debug>false</debug>
1182 <enable>
1183 <condition>
1184 <property>autopilot/kap140/settings/ap-disc</property>
1185 <less-than>
1186 <property>autopilot/kap140/panel/state</property>
1187 <value>6</value>
1188 </less-than>
1189 </condition>
1190 </enable>
1191 <input>0</input>
1192 <output>autopilot/kap140/settings/ap-disc</output>
1193 </filter>
1194
1195 <filter>
1196 <name>ap-disc set state-old</name>
1197 <type>gain</type>
1198 <debug>false</debug>
1199 <enable>
1200 <condition>
1201 <property>autopilot/kap140/settings/ap-disc</property>
1202 <equals>
1203 <property>autopilot/kap140/panel/state</property>
1204 <value>6</value>
1205 </equals>
1206 <equals>
1207 <property>autopilot/kap140/panel/state-old</property>
1208 <value>5</value>
1209 </equals>
1210 </condition>
1211 </enable>
1212 <input>6</input>
1213 <output>autopilot/kap140/panel/state-old</output>
1214 </filter>
1215
1216 <filter>
1217 <name>ap-disc set state</name>
1218 <type>gain</type>
1219 <debug>false</debug>
1220 <enable>
1221 <condition>
1222 <property>autopilot/kap140/settings/ap-disc</property>
1223 <equals>
1224 <property>autopilot/kap140/panel/state</property>
1225 <value>6</value>
1226 </equals>
1227 <equals>
1228 <property>autopilot/kap140/panel/state-old</property>
1229 <value>6</value>
1230 </equals>
1231 </condition>
1232 </enable>
1233 <input>5</input>
1234 <output>autopilot/kap140/panel/state</output>
1235 <output>autopilot/kap140/panel/ap-timer</output>
1236 </filter>
1237
1238 <!-- set default lateral mode at AP activation -->
1239 <filter>
1240 <name>lateral mode</name>
1241 <type>gain</type>
1242 <debug>false</debug>
1243 <enable>
1244 <condition>
1245 <equals>
1246 <property>autopilot/kap140/panel/state</property>
1247 <value>6</value>
1248 </equals>
1249 <equals>
1250 <property>autopilot/kap140/settings/lateral-mode</property>
1251 <value>0</value>
1252 </equals>
1253 </condition>
1254 </enable>
1255 <input>1</input>
1256 <output>autopilot/kap140/settings/lateral-mode</output>
1257 </filter>
1258
1259 <!-- take over FPM at AP activation -->
1260 <filter>
1261 <name>set FPM</name>
1262 <type>gain</type>
1263 <debug>false</debug>
1264 <enable>
1265 <condition>
1266 <equals>
1267 <property>autopilot/kap140/panel/state</property>
1268 <value>6</value>
1269 </equals>
1270 <not-equals>
1271 <property>autopilot/kap140/settings/vertical-mode</property>
1272 <value>1</value>
1273 </not-equals>
1274 <greater-than>
1275 <value alias="/params/model"/>
1276 <value>1</value>
1277 </greater-than>
1278 </condition>
1279 </enable>
1280 <input>autopilot/internal/vert-speed-fpm</input>
1281 <output>autopilot/internal/target-climb-rate</output>
1282 </filter>
1283
1284 <!-- set default vertical mode at AP activation -->
1285 <filter>
1286 <name>vertical mode</name>
1287 <type>gain</type>
1288 <debug>false</debug>
1289 <enable>
1290 <condition>
1291 <equals>
1292 <property>autopilot/kap140/panel/state</property>
1293 <value>6</value>
1294 </equals>
1295 <equals>
1296 <property>autopilot/kap140/settings/vertical-mode</property>
1297 <value>0</value>
1298 </equals>
1299 <greater-than>
1300 <value alias="/params/model"/>
1301 <value>1</value>
1302 </greater-than>
1303 </condition>
1304 </enable>
1305 <input>1</input>
1306 <output>autopilot/kap140/settings/vertical-mode</output>
1307 </filter>
1308
1309 <!-- reset modes if AP is STBY -->
1310 <filter>
1311 <name>init</name>
1312 <type>gain</type>
1313 <debug>false</debug>
1314 <enable>
1315 <condition>
1316 <less-than>
1317 <property>autopilot/kap140/panel/state</property>
1318 <value>6</value>
1319 </less-than>
1320 </condition>
1321 </enable>
1322 <input>0</input>
1323 <output>autopilot/kap140/settings/lateral-mode</output>
1324 <output>autopilot/kap140/settings/lateral-arm</output>
1325 <output>autopilot/kap140/settings/vertical-mode</output>
1326 <output>autopilot/kap140/settings/vertical-arm</output>
1327 <output>autopilot/internal/target-climb-rate</output>
1328 <output>autopilot/internal/target-intercept-angle</output>
1329 <output>autopilot/internal/target-roll-deg</output>
1330 <output>autopilot/internal/target-pressure</output>
1331 </filter>
1332
1333 <!-- reset targets in ROLL mode -->
1334 <filter>
1335 <name>init</name>
1336 <type>gain</type>
1337 <debug>false</debug>
1338 <enable>
1339 <condition>
1340 <less-than>
1341 <property>autopilot/kap140/settings/lateral-mode</property>
1342 <value>1</value>
1343 </less-than>
1344 </condition>
1345 </enable>
1346 <input>0</input>
1347 <output>autopilot/internal/target-intercept-angle</output>
1348 <output>autopilot/internal/target-roll-deg</output>
1349 </filter>
1350
1351 <!-- set the FPM timer -->
1352 <filter>
1353 <name>FPM display</name>
1354 <type>gain</type>
1355 <debug>false</debug>
1356 <enable>
1357 <condition>
1358 <equals>
1359 <property>autopilot/kap140/panel/state</property>
1360 <value>6</value>
1361 </equals>
1362 <or>
1363 <greater-than>
1364 <property>autopilot/kap140/panel/button-up</property>
1365 <value>0</value>
1366 </greater-than>
1367 <greater-than>
1368 <property>autopilot/kap140/panel/button-down</property>
1369 <value>0</value>
1370 </greater-than>
1371 </or>
1372 </condition>
1373 </enable>
1374 <input>sim/time/elapsed-sec</input>
1375 <output>autopilot/kap140/panel/fpm-timer</output>
1376 </filter>
1377
1378 <!--- clear the FPM timer -->
1379 <filter>
1380 <name>stop fpm-timer</name>
1381 <type>gain</type>
1382 <debug>false</debug>
1383 <enable>
1384 <condition>
1385 <greater-than>
1386 <property>autopilot/kap140/panel/state</property>
1387 <value>4</value>
1388 </greater-than>
1389 <greater-than>
1390 <property>autopilot/kap140/panel/fpm-timer</property>
1391 <value>1</value>
1392 </greater-than>
1393 <greater-than>
1394 <property>sim/time/elapsed-sec</property>
1395 <expression>
1396 <sum>
1397 <property>autopilot/kap140/panel/fpm-timer</property>
1398 <value>3</value>
1399 </sum>
1400 </expression>
1401 </greater-than>
1402 </condition>
1403 </enable>
1404 <input>0</input>
1405 <output>autopilot/kap140/panel/fpm-timer</output>
1406 </filter>
1407
1408 <!-- FPM setting -->
1409 <filter>
1410 <name>FPM up</name>
1411 <type>gain</type>
1412 <debug>false</debug>
1413 <enable>
1414 <condition>
1415 <equals>
1416 <property>autopilot/kap140/panel/state</property>
1417 <value>6</value>
1418 </equals>
1419 <equals>
1420 <property>autopilot/kap140/settings/vertical-mode</property>
1421 <value>1</value>
1422 </equals>
1423 <greater-than>
1424 <property>autopilot/kap140/panel/button-up</property>
1425 <value>0</value>
1426 </greater-than>
1427 </condition>
1428 </enable>
1429 <input>
1430 <expression>
1431 <sum>
1432 <product>
1433 <floor>
1434 <product>
1435 <dif>
1436 <property>sim/time/elapsed-sec</property>
1437 <property>autopilot/kap140/panel/button-up</property>
1438 </dif>
1439 <value>3</value>
1440 </product>
1441 </floor>
1442 <value>100</value>
1443 </product>
1444 <property>autopilot/kap140/panel/fpm-old</property>
1445 </sum>
1446 </expression>
1447 </input>
1448 <output>autopilot/internal/target-climb-rate</output>
1449 <min>-2000</min>
1450 <max>2000</max>
1451 </filter>
1452
1453 <filter>
1454 <name>FPM down</name>
1455 <type>gain</type>
1456 <debug>false</debug>
1457 <enable>
1458 <condition>
1459 <equals>
1460 <property>autopilot/kap140/panel/state</property>
1461 <value>6</value>
1462 </equals>
1463 <greater-than>
1464 <property>autopilot/kap140/panel/button-down</property>
1465 <value>0</value>
1466 </greater-than>
1467 </condition>
1468 </enable>
1469 <input>
1470 <expression>
1471 <sum>
1472 <product>
1473 <floor>
1474 <product>
1475 <dif>
1476 <property>sim/time/elapsed-sec</property>
1477 <property>autopilot/kap140/panel/button-down</property>
1478 </dif>
1479 <value>3</value>
1480 </product>
1481 </floor>
1482 <value>-100</value>
1483 </product>
1484 <property>autopilot/kap140/panel/fpm-old</property>
1485 </sum>
1486 </expression>
1487 </input>
1488 <output>autopilot/internal/target-climb-rate</output>
1489 <min>-2000</min>
1490 <max>2000</max>
1491 </filter>
1492
1493 <!-- Altitude Capture (ALT ARM) -->
1494 <filter>
1495 <name>slow down FPM while approaching ALT</name>
1496 <debug>false</debug>
1497 <type>gain</type>
1498 <enable>
1499 <condition>
1500 <equals>
1501 <property>autopilot/kap140/settings/vertical-arm</property>
1502 <value>2</value>
1503 </equals>
1504 <greater-than>
1505 <expression>
1506 <abs>
1507 <property>autopilot/internal/target-climb-rate</property>
1508 </abs>
1509 </expression>
1510 <expression>
1511 <product>
1512 <abs>
1513 <dif>
1514 <property>autopilot/internal/target-altitude</property>
1515 <property alias="/params/indicated-altitude-ft"/>
1516 </dif>
1517 </abs>
1518 <value alias="/params/vs-ratio"/>
1519 </product>
1520 </expression>
1521 </greater-than>
1522 </condition>
1523 </enable>
1524 <input>
1525 <condition>
1526 <less-than>
1527 <property alias="/params/indicated-altitude-ft"/>
1528 <property>autopilot/internal/target-altitude</property>
1529 </less-than>
1530 </condition>
1531 <expression>
1532 <product>
1533 <ceil>
1534 <product>
1535 <dif>
1536 <property>autopilot/internal/target-altitude</property>
1537 <property alias="/params/indicated-altitude-ft"/>
1538 </dif>
1539 <value alias="/params/vs-ratio"/>
1540 <value>0.01</value>
1541 </product>
1542 </ceil>
1543 <value>100</value>
1544 </product>
1545 </expression>
1546 </input>
1547 <input>
1548 <expression>
1549 <product>
1550 <floor>
1551 <product>
1552 <dif>
1553 <property>autopilot/internal/target-altitude</property>
1554 <property alias="/params/indicated-altitude-ft"/>
1555 </dif>
1556 <value alias="/params/vs-ratio"/>
1557 <value>0.01</value>
1558 </product>
1559 </floor>
1560 <value>100</value>
1561 </product>
1562 </expression>
1563 </input>
1564 <output>autopilot/internal/target-climb-rate</output>
1565 </filter>
1566
1567 <!-- reference altitude -->
1568 <filter>
1569 <name>reference altitude up</name>
1570 <type>gain</type>
1571 <debug>false</debug>
1572 <enable>
1573 <condition>
1574 <equals>
1575 <property>autopilot/kap140/panel/state</property>
1576 <value>6</value>
1577 </equals>
1578 <equals>
1579 <property>autopilot/kap140/settings/vertical-mode</property>
1580 <value>2</value>
1581 </equals>
1582 <greater-than>
1583 <property>autopilot/kap140/panel/button-up</property>
1584 <value>0</value>
1585 </greater-than>
1586 <greater-than>
1587 <property>sim/time/elapsed-sec</property>
1588 <expression>
1589 <sum>
1590 <property>autopilot/kap140/panel/button-up</property>
1591 <value>1</value>
1592 </sum>
1593 </expression>
1594 </greater-than>
1595 </condition>
1596 </enable>
1597 <input>500</input>
1598 <output>autopilot/internal/target-climb-rate</output>
1599 </filter>
1600
1601 <filter>
1602 <name>reference altitude down</name>
1603 <type>gain</type>
1604 <debug>false</debug>
1605 <enable>
1606 <condition>
1607 <equals>
1608 <property>autopilot/kap140/panel/state</property>
1609 <value>6</value>
1610 </equals>
1611 <equals>
1612 <property>autopilot/kap140/settings/vertical-mode</property>
1613 <value>2</value>
1614 </equals>
1615 <greater-than>
1616 <property>autopilot/kap140/panel/button-down</property>
1617 <value>0</value>
1618 </greater-than>
1619 <greater-than>
1620 <property>sim/time/elapsed-sec</property>
1621 <expression>
1622 <sum>
1623 <property>autopilot/kap140/panel/button-down</property>
1624 <value>1</value>
1625 </sum>
1626 </expression>
1627 </greater-than>
1628 </condition>
1629 </enable>
1630 <input>-500</input>
1631 <output>autopilot/internal/target-climb-rate</output>
1632 </filter>
1633
1634 <!-- take over actual climb rare if we are in VS and CWS is active -->
1635 <filter>
1636 <name>CWS target-climb-rate</name>
1637 <type>gain</type>
1638 <debug>false</debug>
1639 <enable>
1640 <condition>
1641 <equals>
1642 <property>autopilot/kap140/panel/state</property>
1643 <value>6</value>
1644 </equals>
1645 <equals>
1646 <property>autopilot/kap140/settings/vertical-mode</property>
1647 <value>1</value>
1648 </equals>
1649 <property>autopilot/kap140/settings/cws</property>
1650 </condition>
1651 </enable>
1652 <input>autopilot/internal/vert-speed-fpm</input>
1653 <output>autopilot/internal/target-climb-rate</output>
1654 </filter>
1655
1656 <!-- reset target climb rate if UP/DN buttons are not pressed and we are in ALT-HOLD mode
1657 <filter>
1658 <name>ALT reset climb rate</name>
1659 <type>gain</type>
1660 <debug>false</debug>
1661 <enable>
1662 <condition>
1663 <equals>
1664 <property>autopilot/kap140/panel/state</property>
1665 <value>6</value>
1666 </equals>
1667 <equals>
1668 <property>autopilot/kap140/settings/vertical-mode</property>
1669 <value>2</value>
1670 </equals>
1671 <equals>
1672 <property>autopilot/kap140/panel/button-up</property>
1673 <value>0</value>
1674 </equals>
1675 <equals>
1676 <property>autopilot/kap140/panel/button-down</property>
1677 <value>0</value>
1678 </equals>
1679 </condition>
1680 </enable>
1681 <input><value>0</value></input>
1682 <output>autopilot/internal/target-climb-rate</output>
1683 </filter>
1684 -->
1685
1686 <!-- set rounded FPM to next 100 ft -->
1687 <filter>
1688 <name>round target-climb-rate</name>
1689 <type>gain</type>
1690 <debug>false</debug>
1691 <enable>
1692 <condition>
1693 <equals>
1694 <property>autopilot/kap140/panel/state</property>
1695 <value>6</value>
1696 </equals>
1697 <equals>
1698 <property>autopilot/kap140/settings/vertical-mode</property>
1699 <value>1</value>
1700 </equals>
1701 <not><property>autopilot/kap140/settings/cws</property></not>
1702 <not-equals>
1703 <expression>
1704 <mod>
1705 <property>autopilot/internal/target-climb-rate</property>
1706 <value>100</value>
1707 </mod>
1708 </expression>
1709 <value>0</value>
1710 </not-equals>
1711 </condition>
1712 </enable>
1713 <input>
1714 <expression>
1715 <product>
1716 <floor>
1717 <div>
1718 <sum>
1719 <property>autopilot/internal/target-climb-rate</property>
1720 <value>50</value>
1721 </sum>
1722 <value>100</value>
1723 </div>
1724 </floor>
1725 <value>100</value>
1726 </product>
1727 </expression>
1728 </input>
1729 <min>-2000</min>
1730 <max>2000</max>
1731 <output>autopilot/internal/target-climb-rate</output>
1732 </filter>
1733
1734 <!-- take over actual pressure if we are in ALT and CWS is active -->
1735 <filter>
1736 <name>CWS target-pressure</name>
1737 <type>gain</type>
1738 <debug>false</debug>
1739 <enable>
1740 <condition>
1741 <equals>
1742 <property>autopilot/kap140/panel/state</property>
1743 <value>6</value>
1744 </equals>
1745 <equals>
1746 <property>autopilot/kap140/settings/vertical-mode</property>
1747 <value>2</value>
1748 </equals>
1749 <property>autopilot/kap140/settings/cws</property>
1750 </condition>
1751 </enable>
1752 <input>
1753 <property alias="/params/pressure-source"/>
1754 </input>
1755 <output>autopilot/internal/target-pressure</output>
1756 </filter>
1757
1758 <!-- control the BARO timer -->
1759 <filter>
1760 <name>set baro-timer</name>
1761 <type>gain</type>
1762 <debug>false</debug>
1763 <enable>
1764 <condition>
1765 <or>
1766 <equals>
1767 <property>autopilot/kap140/panel/state</property>
1768 <value>4</value>
1769 </equals>
1770 <and>
1771 <greater-than>
1772 <property>autopilot/kap140/panel/state</property>
1773 <value>4</value>
1774 </greater-than>
1775 <greater-than>
1776 <property>autopilot/kap140/panel/button-baro</property>
1777 <value>0</value>
1778 </greater-than>
1779 </and>
1780 </or>
1781 </condition>
1782 </enable>
1783 <input>sim/time/elapsed-sec</input>
1784 <output>autopilot/kap140/panel/baro-timer</output>
1785 </filter>
1786
1787 <!-- switch BARO between InHg/hPa -->
1788 <filter>
1789 <name>BARO mode</name>
1790 <type>gain</type>
1791 <debug>false</debug>
1792 <enable>
1793 <condition>
1794 <greater-than>
1795 <property>autopilot/kap140/panel/state</property>
1796 <value>3</value>
1797 </greater-than>
1798 <equals>
1799 <property>autopilot/kap140/panel/baro-mode</property>
1800 <property>autopilot/kap140/panel/baro-mode-old</property>
1801 </equals>
1802 <greater-than>
1803 <property>autopilot/kap140/panel/button-baro</property>
1804 <value>0</value>
1805 </greater-than>
1806 <greater-than>
1807 <property>sim/time/elapsed-sec</property>
1808 <expression>
1809 <sum>
1810 <property>autopilot/kap140/panel/button-baro</property>
1811 <value>2.0</value>
1812 </sum>
1813 </expression>
1814 </greater-than>
1815 </condition>
1816 </enable>
1817 <input>
1818 <condition>
1819 <property>autopilot/kap140/panel/baro-mode</property>
1820 </condition>
1821 <value>0</value>
1822 </input>
1823 <input>1</input>
1824 <output>autopilot/kap140/panel/baro-mode</output>
1825 </filter>
1826
1827 <filter>
1828 <name>reset hdg-timer</name>
1829 <type>gain</type>
1830 <debug>false</debug>
1831 <enable>
1832 <condition>
1833 <equals>
1834 <property>autopilot/kap140/panel/state</property>
1835 <value>6</value>
1836 </equals>
1837 <greater-than>
1838 <property>autopilot/kap140/panel/hdg-timer</property>
1839 <value>0</value>
1840 </greater-than>
1841 <greater-than>
1842 <property>sim/time/elapsed-sec</property>
1843 <expression>
1844 <sum>
1845 <property>autopilot/kap140/panel/hdg-timer</property>
1846 <value>5</value>
1847 </sum>
1848 </expression>
1849 </greater-than>
1850 </condition>
1851 </enable>
1852 <input>0</input>
1853 <output>autopilot/kap140/panel/hdg-timer</output>
1854 </filter>
1855
1856 <!-- trigger NAV/APR/REV -->
1857 <filter>
1858 <name>nav-beam capture</name>
1859 <type>gain</type>
1860 <debug>false</debug>
1861 <enable>
1862 <condition>
1863 <greater-than>
1864 <property>autopilot/kap140/settings/lateral-arm</property>
1865 <value>2</value>
1866 </greater-than>
1867 <less-than>
1868 <property>autopilot/kap140/settings/lateral-arm</property>
1869 <value>6</value>
1870 </less-than>
1871 <property>instrumentation/nav-source/signal-valid</property>
1872
1873 <or>
1874 <!-- with DG+ROL mode: capture once the calculated intercept course is smaller than the commanded ROL course difference -->
1875 <and>
1876 <not><property alias="/params/hsi-installed" /></not>
1877 <equals>
1878 <property>autopilot/kap140/settings/lateral-mode</property>
1879 <value>1</value>
1880 </equals>
1881
1882 <greater-than-equals>
1883 <expression>
1884 <difference>
1885 <abs><property>autopilot/internal/heading-bug-latch-error</property></abs>
1886 <abs><property>autopilot/internal/intercept-angle</property></abs>
1887 </difference>
1888 </expression>
1889 <value>0</value>
1890 </greater-than-equals>
1891 </and>
1892
1893 <!-- with HSI or DG+HDG: capture just using the radial course error -->
1894 <property alias="/params/hsi-installed" />
1895 <and>
1896 <not-equals>
1897 <property>autopilot/kap140/settings/lateral-mode</property>
1898 <value>1</value>
1899 </not-equals>
1900 </and>
1901 </or>
1902
1903 <less-than>
1904 <expression>
1905 <abs><property>instrumentation/nav-source/heading-needle-deflection-norm</property></abs>
1906 </expression>
1907 <value>0.6</value>
1908 </less-than>
1909 <not-equals>
1910 <property>instrumentation/nav-source/heading-needle-deflection-norm</property>
1911 <value>0.0</value>
1912 </not-equals>
1913 </condition>
1914 </enable>
1915 <input>
1916 <expression>
1917 <product>
1918 <property>autopilot/kap140/settings/lateral-arm</property>
1919 <value>-1</value>
1920 </product>
1921 </expression>
1922 </input>
1923 <output>autopilot/kap140/settings/lateral-arm</output>
1924 </filter>
1925
1926 <filter>
1927 <name>signal lost</name>
1928 <type>gain</type>
1929 <debug>false</debug>
1930 <enable>
1931 <condition>
1932 <greater-than>
1933 <property>autopilot/kap140/settings/lateral-mode</property>
1934 <value>2</value>
1935 </greater-than>
1936 <less-than>
1937 <property>autopilot/kap140/settings/lateral-mode</property>
1938 <value>6</value>
1939 </less-than>
1940 <less-than>
1941 <property>autopilot/kap140/panel/nav-timer</property>
1942 <value>1</value>
1943 </less-than>
1944 <not><property>instrumentation/nav-source/signal-valid</property></not>
1945 </condition>
1946 </enable>
1947 <input>sim/time/elapsed-sec</input>
1948 <output>autopilot/kap140/panel/nav-timer</output>
1949 </filter>
1950
1951 <filter>
1952 <name>cancel nav-timer in ROL or HDG mode</name>
1953 <type>gain</type>
1954 <debug>false</debug>
1955 <enable>
1956 <condition>
1957 <less-than>
1958 <property>autopilot/kap140/settings/lateral-mode</property>
1959 <value>3</value>
1960 </less-than>
1961 <greater-than>
1962 <property>autopilot/kap140/panel/nav-timer</property>
1963 <value>1</value>
1964 </greater-than>
1965 </condition>
1966 </enable>
1967 <input>0</input>
1968 <output>autopilot/kap140/panel/nav-timer</output>
1969 </filter>
1970
1971 <filter>
1972 <name>ROL mode after 30sec signal lost</name>
1973 <type>gain</type>
1974 <debug>false</debug>
1975 <enable>
1976 <condition>
1977 <greater-than>
1978 <property>autopilot/kap140/settings/lateral-mode</property>
1979 <value>2</value>
1980 </greater-than>
1981 <less-than>
1982 <property>autopilot/kap140/settings/lateral-mode</property>
1983 <value>6</value>
1984 </less-than>
1985 <greater-than>
1986 <property>autopilot/kap140/panel/nav-timer</property>
1987 <value>1</value>
1988 </greater-than>
1989 <greater-than>
1990 <property>sim/time/elapsed-sec</property>
1991 <expression>
1992 <sum>
1993 <property>autopilot/kap140/panel/nav-timer</property>
1994 <value>30</value>
1995 </sum>
1996 </expression>
1997 </greater-than>
1998 </condition>
1999 </enable>
2000 <input>1</input>
2001 <output>autopilot/kap140/settings/lateral-mode</output>
2002 </filter>
2003
2004 <!-- set NAV/APR/REV -->
2005 <filter>
2006 <name>set lateral mode</name>
2007 <type>gain</type>
2008 <debug>false</debug>
2009 <enable>
2010 <condition>
2011 <less-than>
2012 <property>autopilot/kap140/settings/lateral-arm</property>
2013 <value>0</value>
2014 </less-than>
2015 <less-than>
2016 <property>autopilot/kap140/panel/hdg-timer</property>
2017 <value>1</value>
2018 </less-than>
2019 </condition>
2020 </enable>
2021 <input>
2022 <expression>
2023 <product>
2024 <property>autopilot/kap140/settings/lateral-arm</property>
2025 <value>-1</value>
2026 </product>
2027 </expression>
2028 </input>
2029 <output>autopilot/kap140/settings/lateral-mode</output>
2030 </filter>
2031
2032 <!-- arm GS -->
2033 <filter>
2034 <name>set GS-arm</name>
2035 <type>gain</type>
2036 <debug>false</debug>
2037 <enable>
2038 <condition>
2039 <greater-than>
2040 <value alias="/params/model"/>
2041 <value>1</value>
2042 </greater-than>
2043 <equals>
2044 <property>autopilot/kap140/settings/lateral-mode</property>
2045 <value>4</value>
2046 </equals>
2047 <not-equals>
2048 <property>autopilot/kap140/settings/vertical-mode</property>
2049 <value>3</value>
2050 </not-equals>
2051 <less-than>
2052 <property>autopilot/kap140/panel/nav-timer</property>
2053 <value>1</value>
2054 </less-than>
2055 <property>instrumentation/nav-source/has-gs</property>
2056 </condition>
2057 </enable>
2058 <input>6</input>
2059 <output>autopilot/kap140/settings/lateral-arm</output>
2060 </filter>
2061
2062 <!-- disarm GS -->
2063 <filter>
2064 <name>clear GS-arm</name>
2065 <type>gain</type>
2066 <debug>false</debug>
2067 <enable>
2068 <condition>
2069 <greater-than>
2070 <value alias="/params/model"/>
2071 <value>1</value>
2072 </greater-than>
2073 <equals>
2074 <property>autopilot/kap140/settings/lateral-arm</property>
2075 <value>6</value>
2076 </equals>
2077 <or>
2078 <and>
2079 <equals>
2080 <property>autopilot/kap140/settings/lateral-mode</property>
2081 <value>4</value>
2082 </equals>
2083 <greater-than>
2084 <property>autopilot/kap140/panel/nav-timer</property>
2085 <value>1</value>
2086 </greater-than>
2087 </and>
2088 <not-equals>
2089 <property>autopilot/kap140/settings/lateral-mode</property>
2090 <value>4</value>
2091 </not-equals>
2092 </or>
2093 </condition>
2094 </enable>
2095 <input>0</input>
2096 <output>autopilot/kap140/settings/lateral-arm</output>
2097 </filter>
2098
2099 <!-- clear lateral arm -->
2100 <filter>
2101 <name>clear lateral arm</name>
2102 <type>gain</type>
2103 <debug>false</debug>
2104 <enable>
2105 <condition>
2106 <less-than>
2107 <property>autopilot/kap140/settings/lateral-arm</property>
2108 <value>0</value>
2109 </less-than>
2110 <equals>
2111 <property>autopilot/kap140/settings/lateral-mode</property>
2112 <expression>
2113 <abs><property>autopilot/kap140/settings/lateral-arm</property></abs>
2114 </expression>
2115 </equals>
2116
2117 </condition>
2118 </enable>
2119 <input>0</input>
2120 <output>autopilot/kap140/settings/lateral-arm</output>
2121 <output>autopilot/internal/target-intercept-angle</output>
2122 <output>autopilot/internal/target-roll-deg</output>
2123 </filter>
2124
2125 <!-- capture GS -->
2126 <filter>
2127 <name>capture GS</name>
2128 <type>gain</type>
2129 <debug>false</debug>
2130 <enable>
2131 <condition>
2132 <property>instrumentation/nav-source/signal-valid</property>
2133 <property>instrumentation/nav-source/gs-in-range</property>
2134 <less-than>
2135 <property>instrumentation/nav-source/gs-needle-deflection</property>
2136 <value>0.2</value>
2137 </less-than>
2138 <greater-than>
2139 <property>instrumentation/nav-source/gs-needle-deflection</property>
2140 <value>-0.4</value>
2141 </greater-than>
2142 <or>
2143 <equals>
2144 <property>autopilot/kap140/settings/lateral-arm</property>
2145 <value>6</value>
2146 </equals>
2147 <greater-than>
2148 <property>autopilot/kap140/panel/gs-timer</property>
2149 <value>1</value>
2150 </greater-than>
2151 </or>
2152 </condition>
2153 </enable>
2154 <input>3</input>
2155 <output>autopilot/kap140/settings/vertical-mode</output>
2156 </filter>
2157
2158 <filter>
2159 <name>clear GS timer</name>
2160 <type>gain</type>
2161 <debug>false</debug>
2162 <enable>
2163 <condition>
2164 <property>instrumentation/nav-source/signal-valid</property>
2165 <property>instrumentation/nav-source/gs-in-range</property>
2166 <greater-than>
2167 <property>autopilot/kap140/panel/gs-timer</property>
2168 <value>1</value>
2169 </greater-than>
2170 <equals>
2171 <property>autopilot/kap140/settings/vertical-mode</property>
2172 <value>3</value>
2173 </equals>
2174 </condition>
2175 </enable>
2176 <input>0</input>
2177 <output>autopilot/kap140/panel/gs-timer</output>
2178 </filter>
2179
2180 <filter>
2181 <name>lost GS</name>
2182 <type>gain</type>
2183 <debug>false</debug>
2184 <enable>
2185 <condition>
2186 <equals>
2187 <property>autopilot/kap140/settings/vertical-mode</property>
2188 <value>3</value>
2189 </equals>
2190 <not><property>instrumentation/nav-source/gs-in-range</property></not>
2191 <less-than>
2192 <property>autopilot/kap140/panel/gs-timer</property>
2193 <value>1</value>
2194 </less-than>
2195 </condition>
2196 </enable>
2197 <input>sim/time/elapsed-sec</input>
2198 <output>autopilot/kap140/panel/gs-timer</output>
2199 </filter>
2200
2201 <filter>
2202 <name>fall back to VS</name>
2203 <type>gain</type>
2204 <debug>false</debug>
2205 <enable>
2206 <condition>
2207 <equals>
2208 <property>autopilot/kap140/settings/vertical-mode</property>
2209 <value>3</value>
2210 </equals>
2211 <not><property>instrumentation/nav-source/gs-in-range</property></not>
2212 <greater-than>
2213 <property>autopilot/kap140/panel/gs-timer</property>
2214 <value>1</value>
2215 </greater-than>
2216 </condition>
2217 </enable>
2218 <input>1</input>
2219 <output>autopilot/kap140/settings/vertical-mode</output>
2220 </filter>
2221
2222 <!-- clear GS-arm and target pressure -->
2223 <filter>
2224 <name>clear GS-arm</name>
2225 <type>gain</type>
2226 <debug>false</debug>
2227 <enable>
2228 <condition>
2229 <equals>
2230 <property>autopilot/kap140/settings/lateral-arm</property>
2231 <value>6</value>
2232 </equals>
2233 <equals>
2234 <property>autopilot/kap140/settings/vertical-mode</property>
2235 <value>3</value>
2236 </equals>
2237 </condition>
2238 </enable>
2239 <input>0</input>
2240 <output>autopilot/kap140/settings/lateral-arm</output>
2241 <output>autopilot/internal/target-pressure</output>
2242 </filter>
2243
2244 <!-- set target-pressure -->
2245 <filter>
2246 <name>set target-pressure</name>
2247 <debug>false</debug>
2248 <type>gain</type>
2249 <enable>
2250 <condition>
2251 <equals>
2252 <property>autopilot/kap140/settings/vertical-mode</property>
2253 <value>1</value>
2254 </equals>
2255 <equals>
2256 <property>autopilot/kap140/settings/vertical-arm</property>
2257 <value>2</value>
2258 </equals>
2259 <less-than>
2260 <expression>
2261 <abs>
2262 <dif>
2263 <property>autopilot/internal/target-altitude</property>
2264 <property alias="/params/indicated-altitude-ft"/>
2265 </dif>
2266 </abs>
2267 </expression>
2268 <value>1</value>
2269 </less-than>
2270 </condition>
2271 </enable>
2272 <input>
2273 <property alias="/params/pressure-source"/>
2274 </input>
2275 <output>autopilot/internal/target-pressure</output>
2276 </filter>
2277
2278 <!-- signal ALT capture -->
2279 <filter>
2280 <name>capture ALT</name>
2281 <debug>false</debug>
2282 <type>gain</type>
2283 <enable>
2284 <condition>
2285 <equals>
2286 <property>autopilot/kap140/settings/vertical-mode</property>
2287 <value>1</value>
2288 </equals>
2289 <equals>
2290 <property>autopilot/kap140/settings/vertical-arm</property>
2291 <value>2</value>
2292 </equals>
2293 <greater-than>
2294 <property>autopilot/internal/target-pressure</property>
2295 <value>0</value>
2296 </greater-than>
2297 </condition>
2298 </enable>
2299 <input>-1</input>
2300 <output>autopilot/kap140/settings/vertical-arm</output>
2301 </filter>
2302
2303 <!-- set ALT -->
2304 <filter>
2305 <name>set ALT</name>
2306 <debug>false</debug>
2307 <type>gain</type>
2308 <enable>
2309 <condition>
2310 <equals>
2311 <property>autopilot/kap140/settings/vertical-arm</property>
2312 <value>-1</value>
2313 </equals>
2314 </condition>
2315 </enable>
2316 <input>2</input>
2317 <output>autopilot/kap140/settings/vertical-mode</output>
2318 </filter>
2319
2320 <!-- clear ALT-arm -->
2321 <filter>
2322 <name>clear ALT-arm</name>
2323 <debug>false</debug>
2324 <type>gain</type>
2325 <enable>
2326 <condition>
2327 <equals>
2328 <property>autopilot/kap140/settings/vertical-arm</property>
2329 <value>-1</value>
2330 </equals>
2331 <equals>
2332 <property>autopilot/kap140/settings/vertical-mode</property>
2333 <value>2</value>
2334 </equals>
2335 </condition>
2336 </enable>
2337 <input>0</input>
2338 <output>autopilot/kap140/settings/vertical-arm</output>
2339 </filter>
2340
2341 <!-- fallback to VS -->
2342 <filter>
2343 <name>fallback to VS</name>
2344 <debug>false</debug>
2345 <type>gain</type>
2346 <enable>
2347 <condition>
2348 <equals>
2349 <property>autopilot/kap140/settings/vertical-mode</property>
2350 <value>3</value>
2351 </equals>
2352 <not-equals>
2353 <property>autopilot/kap140/settings/lateral-mode</property>
2354 <value>4</value>
2355 </not-equals>
2356 </condition>
2357 </enable>
2358 <input>1</input>
2359 <output>autopilot/kap140/settings/vertical-mode</output>
2360 </filter>
2361
2362 <!-- altitude alerter -->
2363
2364 <filter>
2365 <name>approaching 1000ft from preselected altitude</name>
2366 <debug>false</debug>
2367 <type>gain</type>
2368 <enable>
2369 <condition>
2370 <greater-than>
2371 <property>autopilot/kap140/panel/state</property>
2372 <value>4</value>
2373 </greater-than>
2374 <equals>
2375 <property>autopilot/kap140/panel/alt-alert</property>
2376 <value>0</value>
2377 </equals>
2378 <less-than>
2379 <expression>
2380 <abs>
2381 <dif>
2382 <property>autopilot/internal/target-altitude</property>
2383 <property alias="/params/indicated-altitude-ft"/>
2384 </dif>
2385 </abs>
2386 </expression>
2387 <value>1000</value>
2388 </less-than>
2389 <greater-than>
2390 <expression>
2391 <abs>
2392 <dif>
2393 <property>autopilot/internal/target-altitude</property>
2394 <property alias="/params/indicated-altitude-ft"/>
2395 </dif>
2396 </abs>
2397 </expression>
2398 <value>200</value>
2399 </greater-than>
2400 </condition>
2401 </enable>
2402 <input>sim/time/elapsed-sec</input>
2403 <output>autopilot/kap140/panel/alt-alert</output>
2404 <output>autopilot/kap140/panel/alt-alert-sound</output>
2405 </filter>
2406
2407 <filter>
2408 <name>altitude reaching save band</name>
2409 <debug>false</debug>
2410 <type>gain</type>
2411 <enable>
2412 <condition>
2413 <greater-than>
2414 <property>autopilot/kap140/panel/state</property>
2415 <value>4</value>
2416 </greater-than>
2417 <not-equals>
2418 <property>autopilot/kap140/panel/alt-alert</property>
2419 <value>0</value>
2420 </not-equals>
2421 <less-than>
2422 <expression>
2423 <abs>
2424 <dif>
2425 <property>autopilot/internal/target-altitude</property>
2426 <property alias="/params/indicated-altitude-ft"/>
2427 </dif>
2428 </abs>
2429 </expression>
2430 <value>200</value>
2431 </less-than>
2432 </condition>
2433 </enable>
2434 <input>0</input>
2435 <output>autopilot/kap140/panel/alt-alert</output>
2436 </filter>
2437
2438 <filter>
2439 <name>altitude reached</name>
2440 <debug>false</debug>
2441 <type>gain</type>
2442 <enable>
2443 <condition>
2444 <greater-than>
2445 <property>autopilot/kap140/panel/state</property>
2446 <value>4</value>
2447 </greater-than>
2448 <equals>
2449 <property>autopilot/kap140/panel/alt-alert</property>
2450 <value>0</value>
2451 </equals>
2452 <equals>
2453 <property>autopilot/kap140/panel/alt-alert-arm</property>
2454 <value>0</value>
2455 </equals>
2456 <less-than>
2457 <expression>
2458 <abs>
2459 <dif>
2460 <property>autopilot/internal/target-altitude</property>
2461 <property alias="/params/indicated-altitude-ft"/>
2462 </dif>
2463 </abs>
2464 </expression>
2465 <value>5</value>
2466 </less-than>
2467 </condition>
2468 </enable>
2469 <input>sim/time/elapsed-sec</input>
2470 <output>autopilot/kap140/panel/alt-alert-arm</output>
2471 </filter>
2472
2473 <filter>
2474 <name>altitude leaving save band</name>
2475 <debug>false</debug>
2476 <type>gain</type>
2477 <enable>
2478 <condition>
2479 <greater-than>
2480 <property>autopilot/kap140/panel/state</property>
2481 <value>4</value>
2482 </greater-than>
2483 <property>autopilot/kap140/panel/alt-alert-arm</property>
2484 <equals>
2485 <property>autopilot/kap140/panel/alt-alert</property>
2486 <value>0</value>
2487 </equals>
2488 <greater-than>
2489 <expression>
2490 <abs>
2491 <dif>
2492 <property>autopilot/internal/target-altitude</property>
2493 <property alias="/params/indicated-altitude-ft"/>
2494 </dif>
2495 </abs>
2496 </expression>
2497 <value>200</value>
2498 </greater-than>
2499 </condition>
2500 </enable>
2501 <input>sim/time/elapsed-sec</input>
2502 <output>autopilot/kap140/panel/alt-alert</output>
2503 <output>autopilot/kap140/panel/alt-alert-sound</output>
2504 </filter>
2505
2506 <filter>
2507 <name>altitude more than 1000ft away</name>
2508 <debug>false</debug>
2509 <type>gain</type>
2510 <enable>
2511 <condition>
2512 <greater-than>
2513 <property>autopilot/kap140/panel/state</property>
2514 <value>4</value>
2515 </greater-than>
2516 <not-equals>
2517 <property>autopilot/kap140/panel/alt-alert</property>
2518 <value>0</value>
2519 </not-equals>
2520 <greater-than>
2521 <expression>
2522 <abs>
2523 <dif>
2524 <property>autopilot/internal/target-altitude</property>
2525 <property alias="/params/indicated-altitude-ft"/>
2526 </dif>
2527 </abs>
2528 </expression>
2529 <value>1000</value>
2530 </greater-than>
2531 </condition>
2532 </enable>
2533 <input>0</input>
2534 <output>autopilot/kap140/panel/alt-alert</output>
2535 <output>autopilot/kap140/panel/alt-alert-arm</output>
2536 </filter>
2537
2538 <filter>
2539 <name>stop sound</name>
2540 <debug>false</debug>
2541 <type>gain</type>
2542 <enable>
2543 <condition>
2544 <not-equals>
2545 <property>autopilot/kap140/panel/alt-alert-sound</property>
2546 <value>0</value>
2547 </not-equals>
2548 <greater-than>
2549 <property>autopilot/kap140/panel/alt-alert</property>
2550 <value>0</value>
2551 </greater-than>
2552 <greater-than>
2553 <expression>
2554 <dif>
2555 <property>sim/time/elapsed-sec</property>
2556 <property>autopilot/kap140/panel/alt-alert</property>
2557 </dif>
2558 </expression>
2559 <value>2</value>
2560 </greater-than>
2561 </condition>
2562 </enable>
2563 <input>0</input>
2564 <output>autopilot/kap140/panel/alt-alert-sound</output>
2565 </filter>
2566
2567 <!-- Pitch Trim (PT) -->
2568
2569 <filter>
2570 <name>set pitch up</name>
2571 <debug>false</debug>
2572 <type>gain</type>
2573 <enable>
2574 <condition>
2575 <equals>
2576 <property>autopilot/kap140/panel/state</property>
2577 <value>6</value>
2578 </equals>
2579 <less-than>
2580 <property>autopilot/kap140/sensors/elevator-trim-transit</property>
2581 <value>0.0</value>
2582 </less-than>
2583 <less-than>
2584 <property>autopilot/kap140/sensors/pitch-up</property>
2585 <value>2.0</value>
2586 </less-than>
2587 </condition>
2588 </enable>
2589 <input>
2590 <condition>
2591 <not><property>autopilot/kap140/sensors/elevator-trim-demand-high</property></not>
2592 </condition>
2593 <value>1.0</value>
2594 </input>
2595 <input>
2596 <condition>
2597 <property>autopilot/kap140/sensors/elevator-trim-demand-high</property>
2598 </condition>
2599 <property>sim/time/elapsed-sec</property>
2600 </input>
2601 <input>autopilot/kap140/sensors/pitch-up</input>
2602 <output>autopilot/kap140/sensors/pitch-up</output>
2603 </filter>
2604
2605 <filter>
2606 <name>set pitch down</name>
2607 <debug>false</debug>
2608 <type>gain</type>
2609 <enable>
2610 <condition>
2611 <equals>
2612 <property>autopilot/kap140/panel/state</property>
2613 <value>6</value>
2614 </equals>
2615 <greater-than>
2616 <property>autopilot/kap140/sensors/elevator-trim-transit</property>
2617 <value>0.0</value>
2618 </greater-than>
2619 <less-than>
2620 <property>autopilot/kap140/sensors/pitch-down</property>
2621 <value>2.0</value>
2622 </less-than>
2623 </condition>
2624 </enable>
2625 <input>
2626 <condition>
2627 <not><property>autopilot/kap140/sensors/elevator-trim-demand-high</property></not>
2628 </condition>
2629 <value>1.0</value>
2630 </input>
2631 <input>
2632 <condition>
2633 <property>autopilot/kap140/sensors/elevator-trim-demand-high</property>
2634 </condition>
2635 <property>sim/time/elapsed-sec</property>
2636 </input>
2637 <output>autopilot/kap140/sensors/pitch-down</output>
2638 </filter>
2639
2640 <filter>
2641 <name>reset pitch up</name>
2642 <debug>false</debug>
2643 <type>gain</type>
2644 <enable>
2645 <condition>
2646 <greater-than-equals>
2647 <property>autopilot/kap140/sensors/elevator-trim-transit</property>
2648 <value>0.0</value>
2649 </greater-than-equals>
2650 </condition>
2651 </enable>
2652 <input>0.0</input>
2653 <output>autopilot/kap140/sensors/pitch-up</output>
2654 </filter>
2655
2656 <filter>
2657 <name>reset pitch down</name>
2658 <debug>false</debug>
2659 <type>gain</type>
2660 <enable>
2661 <condition>
2662 <less-than-equals>
2663 <property>autopilot/kap140/sensors/elevator-trim-transit</property>
2664 <value>0.0</value>
2665 </less-than-equals>
2666 </condition>
2667 </enable>
2668 <input>0.0</input>
2669 <output>autopilot/kap140/sensors/pitch-down</output>
2670 </filter>
2671
2672 <filter>
2673 <name>pitch trim change</name>
2674 <debug>false</debug>
2675 <type>gain</type>
2676 <input>
2677 <expression>
2678 <dif>
2679 <property>autopilot/kap140/sensors/elevator-trim-demand</property>
2680 <property>autopilot/kap140/sensors/elevator-trim</property>
2681 </dif>
2682 </expression>
2683 </input>
2684 <output>autopilot/kap140/sensors/elevator-trim-transit</output>
2685 </filter>
2686
2687 <filter>
2688 <name>store pitch trim</name>
2689 <debug>false</debug>
2690 <type>noise-spike</type>
2691 <max-rate-of-change>
2692 <condition>
2693 <greater-than>
2694 <property>autopilot/kap140/panel/state</property>
2695 <value>4</value>
2696 </greater-than>
2697 <not><property>autopilot/kap140/sensors/manual-trim</property></not>
2698 </condition>
2699 <value>0.020</value>
2700 </max-rate-of-change>
2701 <max-rate-of-change>10.0</max-rate-of-change>
2702 <input>controls/flight/elevator-trim</input>
2703 <output>autopilot/kap140/sensors/elevator-trim</output>
2704 </filter>
2705
2706 <!-- pitch trim run-away -->
2707
2708 <filter>
2709 <name>check pitch trim run-away</name>
2710 <debug>false</debug>
2711 <type>gain</type>
2712 <enable>
2713 <condition>
2714 <greater-than>
2715 <property>autopilot/kap140/panel/state</property>
2716 <value>4</value>
2717 </greater-than>
2718 </condition>
2719 </enable>
2720 <input>
2721 <condition>
2722 <less-than>
2723 <property>autopilot/kap140/sensors/pitch-trim-run</property>
2724 <value>1.0</value>
2725 </less-than>
2726 <not-equals>
2727 <property>controls/flight/elevator-trim</property>
2728 <property>autopilot/kap140/sensors/elevator-trim</property>
2729 </not-equals>
2730 </condition>
2731 <expression>
2732 <sum>
2733 <property>sim/time/elapsed-sec</property>
2734 <value>5.0</value>
2735 </sum>
2736 </expression>
2737 </input>
2738 <input>
2739 <condition>
2740 <greater-than>
2741 <property>autopilot/kap140/sensors/pitch-trim-run</property>
2742 <value>1.0</value>
2743 </greater-than>
2744 <equals>
2745 <property>controls/flight/elevator-trim</property>
2746 <property>autopilot/kap140/sensors/elevator-trim</property>
2747 </equals>
2748 </condition>
2749 <value>0.0</value>
2750 </input>
2751 <input>autopilot/kap140/sensors/pitch-trim-run</input>
2752 <output>autopilot/kap140/sensors/pitch-trim-run</output>
2753 </filter>
2754
2755 <filter>
2756 <name>check pitch trim run-away</name>
2757 <debug>false</debug>
2758 <type>gain</type>
2759 <input>
2760 <condition>
2761 <property>autopilot/kap140/sensors/elevator-trim-transit</property>
2762 <property>autopilot/kap140/sensors/pitch-trim-run</property>
2763 <greater-than>
2764 <property>sim/time/elapsed-sec</property>
2765 <property>autopilot/kap140/sensors/pitch-trim-run</property>
2766 </greater-than>
2767 </condition>
2768 <value>1</value>
2769 </input>
2770 <input>0</input>
2771 <output>autopilot/kap140/sensors/pitch-trim</output>
2772 </filter>
2773
2774 <filter>
2775 <name>reset manual trim flag</name>
2776 <debug>false</debug>
2777 <type>gain</type>
2778 <enable>
2779 <condition>
2780 <property>autopilot/kap140/sensors/manual-trim</property>
2781 </condition>
2782 </enable>
2783 <input>0</input>
2784 <output>autopilot/kap140/sensors/manual-trim</output>
2785 </filter>
2786
2787 <!-- Logic by Josh Davidson (Octal450) 2021 -->
2788 <!-- Makes the conditions way simpler in the control system, easier to understand -->
2789
2790 <logic>
2791 <input>
2792 <equals>
2793 <property>autopilot/kap140/panel/state</property>
2794 <value>6</value>
2795 </equals>
2796 <not><property>autopilot/kap140/roll-axis-fail</property></not>
2797 <not><property>autopilot/kap140/settings/cws</property></not>
2798 </input>
2799 <output>/autopilot/internal/logic/roll-active</output>
2800 </logic>
2801
2802 <logic>
2803 <input>
2804 <and>
2805 <equals>
2806 <property>autopilot/kap140/settings/lateral-mode</property>
2807 <value>2</value>
2808 </equals>
2809 <less-than>
2810 <property>autopilot/kap140/panel/hdg-timer</property>
2811 <value>1</value>
2812 </less-than>
2813 <not><property>autopilot/kap140/settings/from-hdg</property></not>
2814 </and>
2815 </input>
2816 <output>/autopilot/internal/logic/hdg-active</output>
2817 </logic>
2818
2819 <logic>
2820 <input>
2821 <or>
2822 <and>
2823 <equals>
2824 <property>autopilot/kap140/settings/lateral-mode</property>
2825 <value>3</value>
2826 </equals>
2827 <less-than>
2828 <property>autopilot/kap140/panel/nav-timer</property>
2829 <value>1</value>
2830 </less-than>
2831 <property>instrumentation/nav-source/signal-valid</property>
2832 </and>
2833 <and>
2834 <not><property alias="/params/hsi-installed" /></not>
2835 <equals>
2836 <property>autopilot/kap140/settings/lateral-arm</property>
2837 <value>3</value>
2838 </equals>
2839 <less-than>
2840 <property>autopilot/kap140/panel/nav-timer</property>
2841 <value>1</value>
2842 </less-than>
2843 <equals>
2844 <property>autopilot/kap140/settings/lateral-mode</property>
2845 <value>2</value>
2846 </equals>
2847 <less-than>
2848 <property>autopilot/kap140/panel/hdg-timer</property>
2849 <value>1</value>
2850 </less-than>
2851 <property>instrumentation/nav-source/signal-valid</property>
2852 </and>
2853 </or>
2854 </input>
2855 <output>/autopilot/internal/logic/nav-active</output>
2856 </logic>
2857
2858 <logic>
2859 <input>
2860 <or>
2861 <and>
2862 <equals>
2863 <property>autopilot/kap140/settings/lateral-mode</property>
2864 <value>4</value>
2865 </equals>
2866 <less-than>
2867 <property>autopilot/kap140/panel/nav-timer</property>
2868 <value>1</value>
2869 </less-than>
2870 <property>instrumentation/nav-source/signal-valid</property>
2871 </and>
2872 <and>
2873 <not><property alias="/params/hsi-installed" /></not>
2874 <equals>
2875 <property>autopilot/kap140/settings/lateral-arm</property>
2876 <value>4</value>
2877 </equals>
2878 <less-than>
2879 <property>autopilot/kap140/panel/nav-timer</property>
2880 <value>1</value>
2881 </less-than>
2882 <equals>
2883 <property>autopilot/kap140/settings/lateral-mode</property>
2884 <value>2</value>
2885 </equals>
2886 <less-than>
2887 <property>autopilot/kap140/panel/hdg-timer</property>
2888 <value>1</value>
2889 </less-than>
2890 <property>instrumentation/nav-source/signal-valid</property>
2891 </and>
2892 </or>
2893 </input>
2894 <output>/autopilot/internal/logic/apr-active</output>
2895 </logic>
2896
2897 <logic>
2898 <input>
2899 <or>
2900 <and>
2901 <equals>
2902 <property>autopilot/kap140/settings/lateral-mode</property>
2903 <value>5</value>
2904 </equals>
2905 <less-than>
2906 <property>autopilot/kap140/panel/nav-timer</property>
2907 <value>1</value>
2908 </less-than>
2909 <property>instrumentation/nav-source/signal-valid</property>
2910 </and>
2911 <and>
2912 <not><property alias="/params/hsi-installed" /></not>
2913 <equals>
2914 <property>autopilot/kap140/settings/lateral-arm</property>
2915 <value>5</value>
2916 </equals>
2917 <less-than>
2918 <property>autopilot/kap140/panel/nav-timer</property>
2919 <value>1</value>
2920 </less-than>
2921 <equals>
2922 <property>autopilot/kap140/settings/lateral-mode</property>
2923 <value>2</value>
2924 </equals>
2925 <less-than>
2926 <property>autopilot/kap140/panel/hdg-timer</property>
2927 <value>1</value>
2928 </less-than>
2929 <property>instrumentation/nav-source/signal-valid</property>
2930 </and>
2931 </or>
2932 </input>
2933 <output>/autopilot/internal/logic/rev-active</output>
2934 </logic>
2935
2936 <logic>
2937 <input>
2938 <greater-than>
2939 <value alias="/params/model" />
2940 <value>1</value>
2941 </greater-than>
2942 <equals>
2943 <property>autopilot/kap140/panel/state</property>
2944 <value>6</value>
2945 </equals>
2946 <not><property>autopilot/kap140/pitch-axis-fail</property></not>
2947 <not><property>autopilot/kap140/settings/cws</property></not>
2948 </input>
2949 <output>/autopilot/internal/logic/pitch-active</output>
2950 </logic>
2951
2952 <logic>
2953 <input>
2954 <and>
2955 <equals>
2956 <property>autopilot/kap140/settings/vertical-mode</property>
2957 <value>2</value>
2958 </equals>
2959 <equals>
2960 <property>autopilot/kap140/panel/button-up</property>
2961 <value>0</value>
2962 </equals>
2963 <equals>
2964 <property>autopilot/kap140/panel/button-down</property>
2965 <value>0</value>
2966 </equals>
2967 </and>
2968 </input>
2969 <output>/autopilot/internal/logic/alt-active</output>
2970 </logic>
2971
2972 <logic>
2973 <input>
2974 <equals>
2975 <property>autopilot/kap140/settings/vertical-mode</property>
2976 <value>3</value>
2977 </equals>
2978 </input>
2979 <output>/autopilot/internal/logic/gs-active</output>
2980 </logic>
2981
2982 </PropertyList>