Tupolev Tu-154B-2 by Yurik and his team.
[fg:toms-fgdata.git] / Aircraft / tu154b / Systems / absu154.xml
1 <?xml version="1.0"?>
2 <!--
3     
4     Author:   Yurik V. Nikiforoff, yurik@megasignal.com
5     Date:     apr-nov 2008
6     Function: Autopilot fot TU-154B
7     License:  GPL
8     -->
9 <autopilot name="ABSU-154">
10
11 <!-- INTERFACE PROPERTIES -->
12
13 <!-- Roll interface properties -->
14
15 <property value="0.001"> ap/alt-gain </property>
16
17 <!--<property> fcs/revers-by-joy </property>-->
18 <property value="0.0"> fcs/revers-by-key </property>
19 <property value="0.0"> ap/turbulence </property>
20 <!--<property value="0.1"> fcs/revers-1-limit </property>
21 <property value="0.03"> fcs/revers-2-limit </property>-->
22
23 <!--<property> fcs/revers-1-limit </property>
24 <property> fcs/revers-2-limit </property>-->
25
26   <property>ap/roll-selector</property>
27   <property>ap/input-heading-pnp</property>
28   <property>ap/input-heading-zk</property>
29   <!--<property>ap/input-heading-nvu</property>-->
30   <property>ap/input-at</property>
31   
32   <property>ap/suu-enable</property>
33   
34  <!-- <property>ap/input-z</property>-->
35   
36 <!--  <property>ap/gs-distance</property>
37   <property>ap/crosstrack-m</property> -->
38   
39   <property>ap/ils-epsilon</property> 
40   
41   <property>ap/at-pid-output</property> 
42   <property>ap/at-podg</property>
43   <property>ap/at-hold-0</property>
44   <property>ap/at-hold-1</property>
45   <property>ap/at-hold-2</property>
46   
47   <property>ap/input-heading-delta</property>
48   <property>ap/heading-cmd-norm</property>
49
50   
51   <property>ap/stab-input-roll-rad</property>
52   <property>ap/roll-hold</property>
53
54 <!-- Pitch interface properties -->
55   <property>ap/pitch-selector</property>
56
57 <!--<property>ap/gs-gain</property>-->
58 <property>ap/hdg-out</property>
59 <property>ap/output-pitch-current</property>
60
61   <property>ap/input-glideslope-speed</property>
62   <property>ap/input-glideslope-delta</property>
63   
64   <property>ap/glideslope-cmd-norm</property>
65
66
67   <property>ap/input-mach</property>
68   <property>ap/mach-cmd-norm</property>
69
70
71   <property>ap/input-speed</property>
72   <property>ap/speed-cmd-norm</property>
73
74
75   <property>ap/input-altitude</property>
76   <property>ap/altitude-cmd-norm</property>
77   
78
79   <property>ap/stab-input-pitch-rad</property>
80  
81   <property>ap/pitch-hold</property>
82   
83   <property>ap/go-around</property>
84
85   <property>ap/windup-trigger</property>
86
87
88  <!--Needles flag-->
89   <property>ap/ena-needles</property>
90
91 <channel name="Glue">
92
93 <fcs_function name="ap/navigac" >
94     <function>
95        <property>/tu154/switches/pn-5-navigac</property>
96     </function>
97   </fcs_function>
98
99 <fcs_function name="ap/posadk" >
100     <function>
101        <property>/tu154/switches/pn-5-posadk</property>
102     </function>
103 </fcs_function>
104
105 </channel>
106
107 <!--ILS and VOR debug channel-->
108 <!--
109 <channel name="Debug">
110   <fcs_function>
111     <function>
112        <property>/controls/engines/engine/throttle</property>
113     </function>
114     <output>
115       fcs/throttle-pos-norm
116     </output>
117   </fcs_function>
118   
119     <summer name="debug/latitude-track-rad">
120       <bias>0.819</bias>
121     </summer>
122     <summer name="debug/longitude-runway-rad">
123       <bias>2.134</bias>
124     </summer>
125     
126     <summer name="debug/latitude-distance-rad">
127       <input>debug/latitude-track-rad</input>
128       <input>-position/lat-gc-rad</input>
129     </summer>
130     
131     <pure_gain name="debug/latitude-distance-m"> 
132       <input>debug/latitude-distance-rad</input>
133       <gain>6378138.12</gain>
134     </pure_gain>
135     
136     <summer name="debug/longitude-distance-rad">
137       <input>debug/longitude-runway-rad</input>
138       <input>-position/long-gc-rad</input>
139     </summer>
140     <pure_gain name="debug/longitude-distance-m">
141       <input>debug/longitude-distance-rad</input>
142       <gain>4355962.26</gain>
143     </pure_gain>
144     
145     <fcs_function name="debug/deviation-deg">
146       <description>Arctang</description>
147       <function>
148         <product>
149           <atan2>
150               <property>debug/latitude-distance-m</property>
151               <property>debug/longitude-distance-m</property>
152           </atan2>  
153           <value>57.2958</value>
154         </product>
155       </function>
156     </fcs_function>
157     
158     <summer name="debug/heading-deg">
159       <input>debug/deviation-deg</input>
160       <bias>90</bias>
161     </summer>
162     
163   </channel>-->
164
165
166 <!--************************** ABSU staff ****************************-->
167 <!-- Parameter stabilizers -->
168         
169 <channel name="Mach stab">
170             <summer name="ap/m-error">
171               <input>-ap/input-mach</input>
172               <input>velocities/mach</input>
173               <clipto>
174                 <min>-0.5</min>
175                 <max>0.5</max>
176               </clipto>
177             </summer>
178             <!--Transient - see air speed PID-->
179             <summer name="ap/mach-transient-error">
180               <input>ap/output-pitch-current</input>
181               <input>-ap/mach-cmd-norm</input>
182             </summer>
183             
184             <switch name="ap/mach-trigger">
185               <default value="0.0"/>
186               <test value="-1.0">
187                 ap/pitch-selector == 4
188               </test>
189               <test value="-1.0">
190                 ap/pitch-hold == 0
191               </test>              
192             </switch>
193             
194             <pid name="ap/mach-pid-transient">
195               <input>ap/mach-transient-error</input>  
196               <kp> 0.00 </kp>         
197               <ki> 0.5 </ki>
198               <kd> 0.0 </kd>
199              <trigger>ap/mach-trigger</trigger>
200             </pid>
201             <!--End transient PID -->            
202
203             <switch name="ap/m-error-switched">
204              <default value="ap/mach-pid-transient"/>
205               <test value="ap/m-error">
206                 ap/pitch-selector == 4
207               </test>
208             </switch>
209
210             <pid name="ap/m-pid">
211               <input>ap/m-error-switched</input>
212         
213               <kp> 5.0 </kp>
214               <ki> 0.5 </ki>
215               <kd> 1.0 </kd>
216               
217              <trigger>ap/windup-trigger</trigger>
218               <clipto>
219                 <min>-0.3</min>
220                 <max>0.3</max>
221               </clipto>
222             </pid>
223
224             <pure_gain name="ap/m-cmd">
225               <input>ap/m-pid</input>
226               <gain>1.0</gain>
227               <output>ap/mach-cmd-norm</output>
228             </pure_gain>
229
230         </channel>
231         
232 <!-- *********************************************************-->
233         <channel name="Go around">
234           
235           <scheduled_gain name="ap/go-around-speed">
236             <input>ap/go-around</input>
237             <table>
238               <independentVar> fcs/flap-pos-deg </independentVar>
239               <tableData>
240                 0       363
241                 28      313
242                 45      263
243               </tableData>
244             </table>
245           </scheduled_gain>
246           
247           <switch name="ap/input-speed-switched">
248             <default value="ap/input-speed"/>
249             <test value="ap/go-around-speed">
250               ap/go-around == 1
251             </test>
252           </switch>
253           
254         </channel>
255         
256
257 <!-- *********************************************************-->
258         <channel name="Aero speed stab">
259             <summer name="ap/speed-error">
260               <input>-ap/input-speed-switched</input>
261               <input>velocities/vc-fps</input>
262               <clipto>
263                 <min>-100</min>
264                 <max>100</max>
265               </clipto>
266             </summer>
267
268 <!--This PID use for avoid transient impulse then mode has selected. It 
269 adjust speed-pid to right state all time. -->
270             <summer name="ap/speed-transient-error">
271               <input>ap/output-pitch-current</input>
272               <input>-ap/speed-cmd-norm</input>
273             </summer>
274             
275             <switch name="ap/speed-trigger">
276               <default value="0.0"/>
277               <test value="-1.0">
278                 ap/pitch-selector == 3
279               </test>
280               <test value="-1.0">
281                 ap/pitch-hold == 0
282               </test>              
283             </switch>
284
285             <pid name="ap/speed-pid-transient">
286               <input>ap/speed-transient-error</input>
287               <kp> 0.0 </kp>          
288               <ki> 80.0 </ki>
289               <kd> 0.0 </kd>
290               <trigger>ap/speed-trigger</trigger>
291             </pid>
292 <!--End transient PID -->            
293             <switch name="ap/speed-error-switched">
294               <default value="ap/speed-pid-transient"/>
295               <!--<default value="0.0"/>-->
296               <test value="ap/speed-error">
297                 ap/pitch-selector == 3
298               </test>
299             </switch>
300             
301             <pure_gain name="ap/speed-error-corrected">
302               <input>ap/speed-error-switched</input>
303               <gain>1.0</gain>
304             </pure_gain>
305
306             <pid name="ap/speed-pid">
307               <input>ap/speed-error-corrected</input>
308         
309               <kp> 0.01 </kp>         
310               <ki> 0.001 </ki>
311               <kd> 0.01 </kd>
312               
313              <trigger>ap/windup-trigger</trigger>
314               <clipto>
315                 <min>-0.3</min>
316                 <max>0.3</max>
317               </clipto>
318               
319             </pid>
320
321             <pure_gain name="ap/speed-cmd">
322               <input>ap/speed-pid</input>
323               <gain>1.0</gain>
324               <output>ap/speed-cmd-norm</output>
325             </pure_gain>
326
327         </channel>
328
329 <!-- *********************************************************-->
330         <channel name="Altitude">
331         
332             <pure_gain name="ap/altitude-error-vfps">
333               <input>velocities/v-down-fps</input> <!--Feet here-->
334               <gain>5.0</gain>
335             </pure_gain>
336             
337             <summer name="ap/altitude-error">
338               <input>ap/input-altitude</input>
339               <input>-position/h-sl-ft</input>
340               <input>ap/altitude-error-vfps</input>
341 <!--              <clipto>
342                 <min>-100</min>
343                 <max>100</max>
344               </clipto>-->
345             </summer>
346
347
348
349 <!--Transient speed - see air speed PID-->
350             <summer name="ap/altitude-transient-error">
351               <input>ap/output-pitch-current</input>
352               <input>-ap/altitude-cmd-norm</input>
353             </summer>
354             
355             <switch name="ap/altitude-trigger">
356               <default value="0.0"/>
357               <test value="-1.0">
358                 ap/pitch-selector == 2
359               </test>
360               <test value="-1.0">
361                 ap/pitch-hold == 0
362               </test>              
363             </switch>
364             
365             <pid name="ap/altitude-pid-transient">
366               <input>ap/altitude-transient-error</input>  
367               <kp> 0.0 </kp>          
368               <ki> 2000.0 </ki>
369               <kd> 0.0 </kd>
370               <trigger>ap/altitude-trigger</trigger>
371             </pid>
372             <!--End transient PID -->            
373
374             <switch name="ap/altitude-error-switched">
375               <default value="ap/altitude-pid-transient"/>
376               <!--<default value="0.0"/>-->
377               <test value="ap/altitude-error">
378                 ap/pitch-selector == 2
379               </test>
380             </switch>
381             
382             <pure_gain name="ap/altitude-error-norm">
383               <input>ap/altitude-error-switched</input>
384               <gain>0.001</gain>
385             </pure_gain>
386             <!--0.001-->
387             
388 <!--            <scheduled_gain name="ap/altitude-error-norm">
389               <input>ap/altitude-error-switched</input>
390               <table>
391                 <independentVar> position/h-sl-meters </independentVar>
392                 <tableData>
393                   1000            0.001
394                   10000           0.0003
395                 </tableData>
396               </table>
397             </scheduled_gain>-->
398             
399             
400             <pid name="ap/altitude-pid">
401               <input>ap/altitude-error-norm</input>
402               <kp> 0.5 </kp><!--0.3-->
403               <ki> 0.1</ki><!--0.04-->
404               <kd> 0.0</kd><!--0.04-->
405               <trigger>ap/windup-trigger</trigger>
406 <!--              <clipto>
407                 <min>-0.15</min>
408                 <max>0.15</max>
409               </clipto>-->
410             </pid>
411
412             <pure_gain name="ap/altitude-cmd">
413               <input>ap/altitude-pid</input>
414               <gain>1.0</gain>
415               <output>ap/altitude-cmd-norm</output>
416             </pure_gain>
417
418         </channel>
419         
420 <!-- ************************** STU Glissada *******************************-->
421         
422         <channel name="Glideslope stab">
423
424           <summer name="ap/gs-v-speed">
425             <input>ap/input-glideslope-speed</input> <!--Feet here-->
426             <input>ap/input-glideslope-delta</input>
427             <!--7 m/s max vert speed-->
428             <clipto>
429               <min>-23</min>    
430               <max>23</max>
431             </clipto>
432           </summer>
433
434           <summer name="ap/gs-error">
435            <input>velocities/v-down-fps</input> <!--Feet here-->
436             <input>ap/gs-v-speed</input>
437           </summer>
438
439           <switch name="ap/gs-gain-alt">
440             <default value="1.0"/>
441             <test value="0.5">
442               instrumentation/indicated-altitude-m lt 250.0
443             </test>
444           </switch>
445           
446           <pure_gain name="ap/gs-error-corr">
447             <input>ap/gs-error</input>
448             <gain>ap/gs-gain-alt</gain>
449           </pure_gain>
450
451           <switch name="ap/gs-limiter">
452             <default value="0.0"/>
453             <test value="1.0">
454               ap/windup-trigger != 0.0 <!--We stop Ki then pitch channel is limited-->
455             </test>
456           </switch>
457
458           <switch name="ap/gs-trigger">
459             <default value="-1.0"/>
460             <test value="ap/gs-limiter">
461               ap/pitch-selector == 5
462               ap/gs-error lt 4
463             </test>
464           </switch>
465
466
467           <switch name="ap/gs-error-switched">
468             
469             <default value="0.0"/>
470             <test value="ap/gs-error-corr">
471               ap/pitch-selector == 5
472               ap/posadk == 1
473             </test>
474           </switch>
475
476           
477           <pid name="ap/gs-pid">
478             <input>ap/gs-error-switched</input>
479             <kp> 0.018 </kp>            
480             <ki> 0.006 </ki>            
481             <kd> 0.0135 </kd>
482             <trigger>ap/gs-trigger</trigger>
483             <clipto>
484               <min>-0.14</min>
485               <max>0.14</max>
486             </clipto>
487             <output>ap/glideslope-cmd-norm</output>
488           </pid>
489         
490 </channel>
491         
492 <!--Transient compensation for "AP on" time-->
493 <channel name="Pitch compensation">
494
495             <switch name="ap/pitch-compensed">
496               <default value="attitude/pitch-rad"/>
497               <test value="ap/stab-input-pitch-rad">
498                 ap/pitch-selector == 1
499               </test>
500             </switch>
501           
502         </channel>
503
504
505 <!-- ********************** Pitch stabilizer ***********************************-->
506         <channel name="Pitch">
507
508 <!--              Pitch stab mode selector         
509     ap/pitch-selector state:
510     0 - pitch damper
511     1 - stabilize current pitch value
512     2 - stabilize current altitude by variate pitch
513     3 - stabilize current airspeed  
514     4 - stabilize current Mach
515     5 - stabilize glideslope
516
517 -->
518             <switch name="ap/input-pitch-rad">
519               <default value="ap/pitch-compensed"/>
520 <!--          <test value="">
521                 ap/pitch-selector == 1
522               </test>-->
523               <test value="ap/altitude-cmd-norm">
524                 ap/pitch-selector == 2
525               </test>
526               <test value="ap/speed-cmd-norm">
527                 ap/pitch-selector == 3
528               </test>
529               <test value="ap/mach-cmd-norm">
530                 ap/pitch-selector == 4
531               </test>
532               <test value="ap/glideslope-cmd-norm">
533                 ap/pitch-selector == 5
534                 ap/posadk == 1
535               </test>
536 <!--              <clipto>
537                 <min>-1.0</min>
538                 <max>1.0</max>
539               </clipto>-->
540   
541             </switch>
542             
543             <lag_filter name="ap/input-pitch-switched">
544               <input>ap/input-pitch-rad</input>  
545               <c1>0.175</c1><!--0.4-->
546               <output>ap/output-pitch-current</output><!--For transient procedure support-->
547             </lag_filter>
548             
549 <!--            <summer name="ap/input-pitch-switched">
550               <input>ap/input-pitch-rad</input>
551               <bias>0.0</bias>
552               <clipto>
553                 <min>-1.0</min>
554                 <max>1.0</max>
555               </clipto>
556               <output>ap/output-pitch-current</output>
557             </summer>-->
558
559
560             <fcs_function name="ap/bank-compensation">
561               <description>Abs</description>
562               <function>
563                 <product>
564                   <abs>
565                     <property>attitude/phi-rad</property>
566                   </abs>  
567                   <value>0.03</value>
568                 </product>
569               </function>
570             </fcs_function>
571
572             <summer name="ap/pitch-error">
573               <input>ap/input-pitch-switched</input>
574               <input>ap/bank-compensation</input>
575               <input>-attitude/pitch-rad</input>
576               <clipto>
577                 <min>-0.5</min>
578                 <max>0.5</max>
579               </clipto>
580               
581             </summer>
582             
583             <switch name="ap/pitch-error-switched">
584               <default value="0.0"/>
585               <test value="ap/pitch-error">
586                 ap/pitch-hold == 1
587               </test>
588             </switch>
589             
590             <switch name="ap/w-t">
591               <default value="0.0"/>
592               <test value="-1.0">
593                 ap/pitch-hold == 0
594               </test>              
595               <test value="1.0">
596                 fcs/absu-pitch gt 0.8
597               </test>
598               <test value="1.0">
599                 fcs/absu-pitch lt -0.4
600               </test>              
601             <output>ap/windup-trigger</output>
602             </switch>
603
604             <pid name="ap/pitch-hold-pid">
605               <input>ap/pitch-error-switched</input>
606               <kp> 7.0 </kp>
607               <ki> 4.0 </ki>
608               <kd> 0.0 </kd>
609               <trigger>ap/windup-trigger</trigger>            
610               <clipto>
611                 <min>-0.8</min>
612                 <max>0.8</max>
613               </clipto>
614               
615             </pid>
616             
617             <!--Turbulence switch-->        
618             <switch name="ap/pitch-turb">
619               <default value="-2.0"/>
620               <test value="-0.5">
621                 ap/turbulence == 1.0
622               </test>
623             </switch>
624             
625             <pure_gain name="ap/pitch-damper">
626               <input>velocities/q-aero-rad_sec</input>
627               <gain>ap/pitch-turb</gain>
628              <clipto>
629                 <min>-0.8</min>
630                 <max>0.8</max>
631               </clipto>
632             </pure_gain>
633             
634             <summer name="ap/pitch-ac">
635               <input>ap/pitch-hold-pid</input>
636               <input>ap/pitch-damper</input>
637             </summer>
638
639 <!--             Autopilot or  Pitch Damper only?        -->
640             <switch name="ap/pitch-inverted">
641               <default value="ap/pitch-ac"/>
642               <test value="ap/pitch-damper">
643                 ap/pitch-hold == 0
644               </test>
645             </switch>
646             
647             
648 <!-- +++++++++++++++++++ SUU ( enchance control system ) ++++++++++++++++++ -->
649 <!-- 
650 There is a system for enchance pitch control. It read pitch trimmer position and adjust gain of pitch channel of yoke control. 
651 -->
652             <scheduled_gain name="ap/suu">
653               <input>fcs/elevator-cmd-norm</input>
654               <table>
655                 <independentVar> fcs/pitch-trim-cmd-norm </independentVar>
656                 <tableData>
657                   -1            -1.2
658                   0             -0.175
659                   0.5           0.325
660                   0.583         0.4
661                   0.667         0.4
662                   1             0.4
663                 </tableData>
664               </table>
665             </scheduled_gain>
666             
667             <switch name="ap/suu-switched">
668               <default value="0.0"/>
669               <test value="ap/suu">
670                 ap/suu-enable == 1
671               </test>
672             </switch>
673
674             <summer name="ap/pitch-suu">
675              <input>ap/pitch-inverted</input>
676              <input>ap/suu-switched</input>
677               <clipto>
678                 <min>-1</min>
679                 <max>1</max>
680               </clipto>
681             </summer>
682
683 <!-- +++++++++++++++++++ END SUU subsystem  ++++++++++++++++++ -->
684
685             <pure_gain name="ap/elevator">
686               <input>-ap/pitch-suu</input>
687               <gain>systems/electrical-ok</gain>
688               <output>fcs/absu-pitch</output>
689               <clipto>
690                       <min>-0.6</min>
691                       <max>0.6</max>
692               </clipto>       
693             </pure_gain>
694
695
696       </channel>
697 <!-- +++++++++++++++++++ END Pitch Channels  ++++++++++++++++++ -->
698       
699 <!-- *********************** Heading channels ************************ -->
700
701       <channel name="Heading stab">
702 <!--
703         <pure_gain name="ap/heading-true-deg">
704          <input>attitude/heading-true-rad</input>
705          <gain>57.3</gain> 
706         </pure_gain>
707         
708         <summer name="ap/heading-fork">
709           <input> ap/heading-true-deg </input>
710           <input> -instrumentation/tks-heading </input>
711         </summer>-->
712         
713 <!--******************************* VOR Staff ***************************-->
714         <summer name="ap/heading-error-pnp">
715           <input> -instrumentation/pnp-heading </input>
716           <input> ap/input-heading-pnp </input>
717           <input> -instrumentation/drift-angle-deg </input>
718         </summer>
719 <!--
720         <switch name="ap/heading-error-vor">
721           <default value="ap/heading-error-auto"/>
722           <test value="ap/heading-error-pnp">
723             ap/delta-deadband ne 0
724           </test>
725         </switch>
726         -->
727 <!--
728         <pure_gain name="ap/vor-hdg">
729           <input> ap/hdg-out </input>
730           <gain> 0.05 </gain>
731         </pure_gain>-->
732         
733 <!--VOR angle stabilizer (epsilon) -->        
734         <pure_gain name="ap/vor-beam-error">
735 <!--<input> debug/deviation-deg</input>-->
736          <input> -ap/input-heading-delta </input>
737          <gain> 2.0 </gain><!--1-->
738          <clipto>
739            <min> -5 </min>
740            <max>  5 </max>
741          </clipto>
742         </pure_gain>
743
744         <lag_filter name="ap/beam-error-filtered">
745           <input>ap/vor-beam-error</input>
746          <c1>5.0</c1>
747         </lag_filter> 
748         
749         <pure_gain name="ap/beam-error-adjusted">
750           <input> ap/beam-error-filtered </input>
751           <gain> 7.0 </gain>
752         </pure_gain>
753         
754         <switch name="ap/vor-eps">
755           <default value="0.0"/>
756           <test value="ap/beam-error-adjusted">
757             ap/roll-selector eq 3
758           </test>
759         </switch>
760
761         <!--******************************* ZK Staff ***************************-->
762         <summer name="ap/heading-error-zk">
763 <!--<input> -ap/heading-true-deg </input>-->
764 <input> -instrumentation/pnp-heading </input>
765           <input> ap/input-heading-zk </input>
766         </summer>
767         <!--******************************* NVU Staff ***************************-->
768         <pure_gain name="ap/nvu-delta-corr">
769           <input> ap/input-z </input>
770           <gain> 0.01 </gain>
771           <clipto>
772             <min> -60 </min>
773             <max>  60 </max>
774           </clipto>
775         </pure_gain>
776         
777         <summer name="ap/heading-error-nvu">
778           <input> -instrumentation/tks-heading </input>
779           <input> ap/input-heading-nvu </input>
780           <input> -ap/nvu-delta-corr </input>
781           <input> -instrumentation/drift-angle-deg </input>
782         </summer>
783
784 <!--******************************* ILS Staff ***************************-->
785         <summer name="ap/heading-error-ils">
786           <input> -instrumentation/pnp-heading </input>
787           <input> ap/input-heading-pnp </input>
788           <input> -instrumentation/drift-angle-deg </input>
789         </summer>
790
791         <switch name="ap/ils-error-bias-switch">
792           <default value="0.0"/>
793           <test value="360.0">
794             ap/heading-error-ils lt -180
795           </test>
796           <test value="-360.0">
797             ap/heading-error-ils gt 180
798           </test>
799         </switch>
800         
801         <switch name="ap/ils-beam-ki">
802           <default value="0.003"/><!--0.003-->
803           <test value="0.007"><!--0.007-->
804             instrumentation/indicated-altitude-m lt 250.0
805           </test>
806         </switch>
807
808         <pure_gain name="ap/ils-beam-error">
809 <!--<input> -debug/heading-deg</input>-->
810           <input> ap/ils-epsilon </input><!---10...10-->
811           <!--<input> ap/ils-angle-deviation </input>-->
812           <gain> 2.5 </gain><!--25 deg from compass hdg for approach-->
813           <clipto>
814             <min> -25 </min>
815             <max> 25 </max>
816           </clipto>
817         </pure_gain>
818         
819         <lag_filter name="ap/ils-beam-filtered">
820           <input>ap/ils-beam-error</input>
821           <c1>5.0</c1>
822         </lag_filter> 
823         
824
825  <!--ILS heading       -->
826         <summer name="ap/ils-deviation">
827           <input> ap/ils-error-bias-switch </input>
828           <input> ap/heading-error-ils </input>
829           <input> ap/ils-beam-filtered </input>
830         </summer>
831         
832         <deadband name="ap/ils-hdg-windup">
833          <input> ap/ils-deviation </input>
834          <width> 40.0 </width>
835         </deadband >
836         
837         <switch name="ap/ils-hdg-stop-int">
838                 <default value="-1.0"/>
839                 <test value="0.0">
840                         ap/roll-selector == 5
841                         ap/ils-hdg-windup == 0
842                 </test>
843         </switch>
844
845         <pid name="ap/ils-hdg-pid">
846           <input>ap/ils-deviation</input>
847           <kp> 0.03 </kp><!--0.042-->
848           <ki> ap/ils-beam-ki </ki><!--0.002 - 0.005-->
849           <kd> 0.047 </kd><!--0.047-->
850           <trigger>ap/ils-hdg-stop-int</trigger>
851         </pid>
852 <!--    
853         <switch name="ap/ils-hdg-switched">
854           <default value="0.0"/>
855           <test value="ap/ils-hdg-pid">
856             ap/pitch-selector ne 5
857           </test>
858         </switch>-->
859
860         <summer name="ap/ils-out">
861 <!--         <input> ap/ils-beam-pid </input>
862          <input> ap/ils-beam-integrator </input>-->
863          <input> ap/ils-hdg-pid </input>
864          <clipto>
865            <min> -0.38 </min>
866            <max> 0.38 </max>
867          </clipto>
868         </summer>
869         
870 <!-- ############################## Needles ############################## -->
871         <pure_gain name="ap/heading-needle-deflection-ils">
872           <!--<input> ap/ils-angle-deviation </input>-->
873           <input> ap/ils-epsilon </input>
874           <gain>0.143</gain><!--0.1-->
875           <clipto>
876             <min> -1 </min>
877             <max>  1 </max>
878           </clipto>
879         </pure_gain>
880         
881         <pure_gain name="ap/heading-needle-deflection-vor">
882           <input> -ap/input-heading-delta </input>
883           <gain>0.02</gain>
884           <clipto>
885             <min> -1 </min>
886             <max>  1 </max>
887           </clipto>
888         </pure_gain>
889         
890         <pure_gain name="ap/heading-needle-deflection-nvu">
891           <input> -ap/input-z </input>
892           <gain>0.0002</gain>
893           <clipto>
894             <min> -1 </min>
895             <max>  1 </max>
896           </clipto>
897         </pure_gain>
898         
899         <switch name="ap/heading-needle-deflection">
900           <default value="0.0"/>
901           <test value="ap/heading-needle-deflection-vor">
902             ap/roll-selector eq 3
903             ap/posadk eq 0
904           </test>
905           <test value="ap/heading-needle-deflection-nvu">
906             ap/roll-selector eq 4
907             ap/posadk eq 0
908           </test>
909           <test value="ap/heading-needle-deflection-ils">
910             <!--ap/roll-selector eq 5-->
911             ap/posadk eq 1
912           </test>
913         </switch>
914
915         <pure_gain name="ap/gs-needle-deflection-ils">
916           <input> ap/input-glideslope-delta </input>
917           <gain>0.286</gain> <!---GS needle from NAV radio:3.5 ... 3.5-->
918           <clipto>
919             <min> -1 </min>
920             <max>  1 </max>
921           </clipto>
922         </pure_gain>
923
924         <switch name="ap/gs-needle-deflection">
925           <default value="0.0"/>
926           <test value="ap/gs-needle-deflection-ils">
927             <!--ap/pitch-selector eq 5-->
928             ap/posadk eq 1
929           </test>
930         </switch>        
931 <!--****************************** Heading stabilizer **********************-->
932 <!--ILS approach (STU Kurs) have own pid. -->        
933 <switch name="ap/heading-error">
934           <default value="0.0"/>
935           <test value="ap/heading-error-zk">
936             ap/roll-selector eq 2
937           </test>
938           <test value="ap/heading-error-pnp">
939             ap/roll-selector eq 3
940             ap/navigac == 1
941           </test>
942           <test value="ap/heading-error-nvu">
943             ap/roll-selector eq 4
944             ap/navigac == 1
945           </test>
946         </switch>
947         
948         <switch name="ap/heading-error-bias-switch">
949          <default value="0.0"/>
950          <test value="360.0">
951             ap/heading-error lt -180
952          </test>
953          <test value="-360.0">
954             ap/heading-error gt 180
955          </test>
956         </switch>
957
958         <summer name="ap/heading-deviation">
959          <input> ap/heading-error-bias-switch </input>
960          <input> ap/heading-error </input>
961          <input> ap/vor-eps </input>
962        </summer>
963         
964        <pid name="ap/heading-pid">
965           <input>ap/heading-deviation</input>
966           <kp> 0.05 </kp>
967           <ki> 0.0 </ki>
968           <kd> 0.025 </kd><!--1.3-->
969           <output>ap/heading-cmd-norm</output>
970         </pid>
971     
972       </channel>      
973
974 <!-- *********************** Wing leveler  ************************ -->
975     <channel name="Roll">
976 <!--              Roll stab mode selector         
977     ap/roll-selector state:
978     0 - roll damper
979     1 - stabilize current roll value
980     2 - stabilize current heading by variate roll
981     3 - VOR 
982     4 - NVU
983     5 - ILS (STU kurs)
984
985 -->
986             <switch name="ap/roll-trigger">
987               <default value="-1.0"/> 
988               <test value="0.0">
989                 ap/roll-hold ne 0
990               </test>
991             </switch>
992
993             <switch name="ap/input-roll-rad">
994               <!--All automatic stabilizer exclude ILS use it-->
995               <default value="ap/heading-cmd-norm"/> 
996               <test value="0.0">
997                 ap/roll-selector == 0 <!--Roll damper only-->
998               </test>
999
1000               <test value="ap/stab-input-roll-rad">
1001                 ap/roll-selector == 1 <!--Roll wheel-->
1002               </test>
1003
1004               <test value="ap/ils-out"> 
1005                 ap/roll-selector == 5 <!--ILS (STU Kurs) pid-->
1006                 ap/posadk == 1
1007               </test>        
1008             </switch>
1009             
1010             <lag_filter name="ap/input-roll-rad-clipped">
1011               <input>ap/input-roll-rad</input>
1012               <c1>0.7</c1>
1013               <clipto>
1014                 <min>-0.43</min>
1015                 <max>0.43</max>
1016               </clipto>
1017             </lag_filter> 
1018
1019             <summer name="ap/roll-error">
1020               <input>ap/input-roll-rad-clipped</input>
1021               <input>-attitude/roll-rad</input>
1022             </summer>
1023
1024             <pid name="ap/roll-hold-pid">
1025               <input>ap/roll-error</input>
1026               <kp> 9.0 </kp>
1027               <ki> 0.1 </ki>
1028               <kd> 0.0 </kd>
1029               <trigger>ap/roll-trigger</trigger>
1030               <clipto>
1031                 <min>-1.0</min>
1032                 <max>1.0</max>
1033               </clipto>
1034             </pid>
1035 <!--             Autopilot or  Roll Damper only?        -->
1036             <switch name="ap/roll-pid-switched">
1037               <default value="0.0"/>
1038               <test value="ap/roll-hold-pid">
1039                 ap/roll-hold ne 0
1040               </test>
1041             </switch>
1042             
1043             <pid name="ap/roll-damper">
1044               <input>-attitude/roll-rad</input>
1045               <kp> 0.0 </kp>
1046               <ki> 0.0 </ki>
1047               <kd> 1.0 </kd>
1048               <clipto>
1049                 <min>-1.0</min>
1050                 <max>1.0</max>
1051               </clipto>
1052             </pid>
1053 <!--
1054             <lag_filter name="ap/roll-lf">
1055               <input>fcs/aileron-cmd-norm</input>
1056               <c1>2.5</c1>
1057             </lag_filter> 
1058             
1059             <pure_gain name="ap/roll-suu">
1060               <input>ap/roll-lf</input>
1061               <gain>0.3</gain>
1062             </pure_gain>-->
1063             
1064 <!--Output-->            
1065             <summer name="ap/roll-out">
1066               <input>ap/roll-damper</input>
1067               <input>ap/roll-pid-switched</input>
1068 <!--<input>ap/roll-suu</input>-->
1069               <clipto>
1070                 <min>-1</min>
1071                 <max>1</max>
1072               </clipto>
1073             </summer>
1074             
1075             <!--Turbulence switch-->        
1076             <scheduled_gain name="ap/roll-turb">
1077               <input>ap/roll-out</input>
1078               <table>
1079                 <independentVar> ap/turbulence </independentVar>
1080                 <tableData>
1081                   0             1.0
1082                   1             0.5
1083                 </tableData>
1084               </table>
1085             </scheduled_gain>
1086             
1087             <pure_gain name="ap/aileron">
1088               <input>ap/roll-turb</input>
1089               <gain>1.0</gain>
1090               <output>fcs/absu-roll</output>
1091             </pure_gain>       
1092       </channel>      
1093       
1094 <!--******************************** Yaw control *****************************-->
1095       <channel name="Yaw">
1096     
1097         <!--Yaw damper-->        
1098         <washout_filter name="ap/yaw-wf">
1099           <input>velocities/r-aero-rad_sec</input>
1100           <c1>0.4</c1>
1101         </washout_filter>
1102         
1103         <pure_gain name="ap/yaw-damper">
1104           <input>ap/yaw-wf</input>
1105           <gain>8.0</gain><!--8-->
1106         </pure_gain>
1107         
1108         <!--Slip stabilizer-->
1109         <switch name="ap/beta-rad-switched">
1110           <default value="0.0"/>
1111           <test value="aero/beta-rad">
1112             ap/roll-hold ne 0
1113           </test>
1114         </switch>
1115         
1116         <pid name="ap/yaw-pid">
1117           <input>ap/beta-rad-switched</input>
1118           <kp> 1.0 </kp>
1119           <ki> 1.0 </ki>
1120           <kd> 0.0 </kd>
1121           <clipto>
1122             <min>-0.5</min>
1123             <max>0.5</max>
1124           </clipto>
1125         </pid>
1126         <!--             Autopilot or  Yaw Damper only?        -->        
1127         <switch name="ap/yaw-pid-switched">
1128           <default value="0.0"/>
1129           <test value="ap/yaw-pid">
1130             ap/roll-hold ne 0
1131           </test>
1132         </switch>
1133                
1134         <!--Output-->            
1135         <summer name="ap/yaw-out">
1136           <input>ap/yaw-damper</input>
1137           <!--<input>ap/yaw-suu</input>-->
1138           <input>-ap/yaw-pid-switched</input>
1139           <clipto>
1140             <min>-1</min>
1141             <max>1</max>
1142           </clipto>
1143         </summer>
1144             <!--Turbulence switch-->        
1145         <scheduled_gain name="ap/yaw-turb">
1146            <input>ap/yaw-out</input>
1147              <table>
1148                 <independentVar> ap/turbulence </independentVar>
1149                 <tableData>
1150                   0             1.0
1151                   1             0.5
1152              </tableData>
1153            </table>
1154         </scheduled_gain>
1155
1156         <pure_gain name="ap/rudder">
1157           <input>ap/yaw-turb</input>
1158           <gain>1.0</gain>
1159           <output>fcs/absu-yaw</output>
1160         </pure_gain>
1161         
1162       </channel>
1163 <!-- ***************************** Reverser ******************************* -->
1164 <channel name="Reverser">
1165   
1166         <switch name="fcs/rev-1-left-cmd">
1167           <default value="0.0"/>
1168           <test value="1.0">
1169             fcs/revers-by-key gt 0.5
1170           </test>          
1171           <test value="fcs/revers-by-joy">
1172             fcs/throttle-cmd-norm[0] lt fcs/revers-1-limit
1173           </test>
1174         </switch>
1175         <switch name="fcs/rev-1-right-cmd">
1176           <default value="0.0"/>
1177           <test value="1.0">
1178             fcs/revers-by-key gt 0.5
1179           </test>          
1180           <test value="fcs/revers-by-joy">
1181             fcs/throttle-cmd-norm[2] lt fcs/revers-1-limit
1182           </test>
1183         </switch>
1184         <switch name="fcs/rev-2-left-cmd">
1185           <default value="0.0"/>
1186           <test value="1.0">
1187             fcs/revers-by-key gt 0.5
1188           </test>          
1189           <test value="fcs/revers-by-joy">
1190             fcs/throttle-cmd-norm[0] lt fcs/revers-2-limit
1191           </test>
1192         </switch>
1193         <switch name="fcs/rev-2-right-cmd">
1194           <default value="0.0"/>
1195           <test value="1.0">
1196             fcs/revers-by-key gt 0.5
1197           </test>          
1198           <test value="fcs/revers-by-joy">
1199             fcs/throttle-cmd-norm[2] lt fcs/revers-2-limit
1200           </test>
1201         </switch>
1202         
1203         <kinematic name="fcs/reverser-lever-left">
1204           <input>fcs/rev-1-left-cmd</input>
1205           <traverse>
1206             <setting>
1207               <position>0</position>
1208               <time>0</time>
1209             </setting>
1210             <setting>
1211               <position>2.35</position>
1212               <time>2</time>
1213             </setting>
1214           </traverse>
1215           <output>propulsion/engine[0]/reverser-angle-rad</output>
1216         </kinematic>
1217         
1218         <kinematic name="fcs/reverser-lever-right">
1219           <input>fcs/rev-1-right-cmd</input>
1220           <traverse>
1221             <setting>
1222               <position>0</position>
1223               <time>0</time>
1224             </setting>
1225             <setting>
1226               <position>2.35</position>
1227               <time>2</time>
1228             </setting>
1229           </traverse>
1230           <output>propulsion/engine[2]/reverser-angle-rad</output>
1231         </kinematic>
1232
1233         <kinematic name="fcs/reverser-throttle-left">
1234           <input>fcs/rev-2-left-cmd</input>
1235           <traverse>
1236             <setting>
1237               <position>0</position>
1238               <time>0</time>
1239             </setting>
1240             <setting>
1241               <position>0.6</position>
1242               <time>1</time>
1243             </setting>
1244           </traverse>
1245         </kinematic>
1246         
1247         <kinematic name="fcs/reverser-throttle-right">
1248           <input>fcs/rev-2-right-cmd</input>
1249           <traverse>
1250             <setting>
1251               <position>0</position>
1252               <time>0</time>
1253             </setting>
1254             <setting>
1255               <position>0.6</position>
1256               <time>1</time>
1257             </setting>
1258           </traverse>
1259         </kinematic>
1260         
1261 </channel>
1262 <!-- ***************************** Autothrottle ******************************* -->      
1263       <channel name="At">
1264         
1265         <summer name="ap/at-error">
1266           <input>-ap/input-at</input>
1267           <input>velocities/vc-fps</input>
1268           <clipto>
1269             <min>-30</min>
1270             <max>30</max>
1271           </clipto>
1272         </summer>
1273
1274 <!--Transient compensation -->
1275         <summer name="ap/at-transient-error">
1276           <input>fcs/throttle-cmd-norm[0]</input>
1277           <input>-ap/at-pid-output</input>
1278         </summer>
1279                 
1280         <switch name="ap/at-tr-err-switched">
1281           <default value="0.0"/>
1282           <test value="-ap/at-transient-error">
1283             ap/at-podg == 1
1284           </test>
1285         </switch>
1286         
1287         <pure_gain name="ap/at-transient-compensator">
1288           <input>ap/at-tr-err-switched</input>
1289           <gain>20.0</gain>
1290         </pure_gain>       
1291
1292         <!--End transient procedure -->            
1293 <!--Helpers-->
1294         <switch name="ap/at-hold">
1295           <default value="0.0"/>
1296           <test value="1">
1297             ap/at-hold-0 == 1
1298           </test>
1299           <test value="1">
1300             ap/at-hold-1 == 1
1301           </test>
1302           <test value="1">
1303             ap/at-hold-2 == 1
1304           </test>
1305         </switch>
1306         
1307         <switch name="ap/at-trigger">
1308           <default value="0.0"/>
1309           <test value="-1.0">
1310             ap/at-podg == 0
1311           </test>
1312           <test value="-1.0">
1313             ap/at-hold == 0
1314           </test>
1315           <test value="1.0">
1316             ap/at-error > 0.0
1317             ap/at-pid-output > 0.9
1318           </test>
1319           <test value="1.0">
1320             ap/at-error lt 0.0
1321             ap/at-pid-output lt 0.1
1322           </test>
1323           
1324         </switch>
1325
1326         <switch name="ap/at-error-switched">
1327           <default value="ap/at-transient-compensator"/>
1328           <test value="ap/at-error">
1329             ap/at-hold == 1
1330           </test>
1331         </switch>
1332         
1333         <switch name="ap/at-pid-ki">
1334           <default value="0.1"/>
1335           <test value="0.001">
1336             ap/at-hold == 1
1337           </test>
1338         </switch>
1339         <switch name="ap/at-pid-kd">
1340           <default value="0.0"/>
1341           <test value="0.1">
1342             ap/at-hold == 1
1343           </test>
1344         </switch>
1345         
1346         <pid name="ap/at-pid">
1347           <input>-ap/at-error-switched</input>
1348           <kp> 0.04 </kp>
1349           <ki> ap/at-pid-ki </ki>
1350           <kd> ap/at-pid-kd </kd>
1351           <trigger>ap/at-trigger</trigger>
1352           <clipto>
1353             <min>0.0</min>
1354             <max>1.0</max>
1355           </clipto>
1356           <output>ap/at-pid-output</output>
1357         </pid>
1358
1359        <switch name="ap/at-thr-switched-0">
1360          <default value="fcs/throttle-cmd-norm[0]"/>
1361          <test value="fcs/reverser-throttle-left">
1362            fcs/reverser-throttle-left gt 0
1363          </test>
1364           <test value="ap/at-pid">
1365             ap/at-hold-0 == 1
1366           </test>
1367           <output>fcs/at-throttle-cmd-norm[0]</output>
1368         </switch>
1369         
1370         <switch name="ap/at-thr-switched-1">
1371           <default value="fcs/throttle-cmd-norm[1]"/>
1372           <test value="ap/at-pid">
1373             ap/at-hold-1 == 1
1374           </test>
1375           <output>fcs/at-throttle-cmd-norm[1]</output>
1376         </switch>
1377         
1378         <switch name="ap/at-thr-switched-2">
1379           <default value="fcs/throttle-cmd-norm[2]"/>
1380           <test value="fcs/reverser-throttle-right">
1381             fcs/reverser-throttle-right gt 0
1382           </test>
1383           <test value="ap/at-pid">
1384             ap/at-hold-2 == 1
1385           </test>
1386           <output>fcs/at-throttle-cmd-norm[2]</output>
1387         </switch>
1388       
1389       </channel>
1390       
1391 </autopilot>