<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>

    <!--Flydat-->
    <!--EGT-->

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <dif>
                    <property>engines/engine/egt-degf</property>
                    <value>32</value>
                </dif>
            </expression>
        </input>
        <output>engines/engine/egt-32</output>
    </filter>


    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <product>
                    <property>engines/engine/egt-32</property>
                    <value>0.5555555555555</value>
                </product>
            </expression>
        </input>
        <output>engines/engine/egt-degc</output>
    </filter>

    <!--CHT-->

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <dif>
                    <property>engines/engine/cht-degf</property>
                    <value>32</value>
                </dif>
            </expression>
        </input>
        <output>engines/engine/cht-32</output>
    </filter>


    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <product>
                    <property>engines/engine/cht-32</property>
                    <value>0.5555555555555</value>
                </product>
            </expression>
        </input>
        <output>engines/engine/cht-degc</output>
    </filter>

    <!--oiltemp-->

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <dif>
                    <property>engines/engine/oil-temperature-degf</property>
                    <value>32</value>
                </dif>
            </expression>
        </input>
        <output>engines/engine/oil-temperature-32</output>
    </filter>


    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <product>
                    <property>engines/engine/oil-temperature-32</property>
                    <value>0.5555555555555</value>
                </product>
            </expression>
        </input>
        <output>engines/engine/oil-temperature-degc</output>
    </filter>

    <!--oilpress-->

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <div>
                    <property>engines/engine/oil-pressure-psi</property>
                    <value>14.504</value>
                </div>
            </expression>
        </input>
        <output>engines/engine/oil-pressure-bar</output>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <product>
                    <property>engines/engine/oil-pressure-bar</property>
                    <value>10</value>
                </product>
            </expression>
        </input>
        <output>engines/engine/oil-pressure-bar01</output>
    </filter>


    <!--iPad-->
    <filter>
        <name>flipflopinterpolation</name>
        <debug>false</debug>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <table>
                    <property>gear/gear[1]/compression-norm</property>
                    <entry>
                        <ind>0.0</ind>
                        <dep>0.0</dep>
                    </entry>
                    <entry>
                        <ind>0.59</ind>
                        <dep>0.0</dep>
                    </entry>
                    <entry>
                        <ind>0.6</ind>
                        <dep>1.0</dep>
                    </entry>
                    <entry>
                        <ind>1.0</ind>
                        <dep>1.0</dep>
                    </entry>
                </table>
            </expression>
        </input>
        <output>
            <property>aircraft/ipad/drop</property>
        </output>
    </filter>

    <flipflop>
        <type>RS</type> <!-- or SR -->
        <S>
            <property>aircraft/ipad/drop</property>
        </S>
        <R>
            <property>aircraft/ipad/drop-reset</property>
        </R>
        <output>aircraft/ipad/drop-status</output>
    </flipflop>

    <filter>
        <type>noise-spike</type>
        <max-rate-of-change>4</max-rate-of-change>
        <input>aircraft/ipad/drop-status</input>
        <output>aircraft/ipad/drop-current</output>
    </filter>

    <!--iPad
    information board-->

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <div>
                    <property>position/altitude-agl-ft</property>
                    <value>3.281</value>
                </div>
            </expression>
        </input>
        <output>position/altitude-agl-m</output>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <div>
                    <property>position/altitude-ft</property>
                    <value>3.281</value>
                </div>
            </expression>
        </input>
        <output>position/altitude-m</output>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <product>
                    <property>instrumentation/airspeed-indicator/indicated-speed-kt</property>
                    <value>1.852</value>
                </product>
            </expression>
        </input>
        <output>instrumentation/airspeed-indicator/indicated-speed-kmh</output>
    </filter>


    <!--Glass
    rain-->

    <filter>
        <name>splash-xa</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <table>
                    <property>velocities/airspeed-kt</property>
                    <entry>
                        <ind> 0</ind>
                        <dep> -1.5 </dep>
                    </entry>
                    <entry>
                        <ind>100</ind>
                        <dep> -3.0 </dep>
                    </entry>
                </table>
            </expression>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-xa</property>
        </output>
    </filter>

    <filter>
        <name>splash-za</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <table>
                    <property>velocities/airspeed-kt</property>
                    <entry>
                        <ind> 0</ind>
                        <dep> 1.0 </dep>
                    </entry>
                    <entry>
                        <ind>100</ind>
                        <dep> 1.0 </dep>
                    </entry>
                </table>
            </expression>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-za</property>
        </output>
    </filter>

    <filter>
        <name>splash-xr</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <table>
                    <property>engines/engine[0]/rpm</property>
                    <entry>
                        <ind> 0 </ind>
                        <dep> 0.1 </dep>
                    </entry>
                    <entry>
                        <ind> 948 </ind>
                        <dep> 1.0 </dep>
                    </entry>
                    <entry>
                        <ind> 6000 </ind>
                        <dep> 2.0 </dep>
                    </entry>
                </table>
            </expression>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-xr</property>
        </output>
    </filter>

    <filter>
        <name>splash-zr</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <expression>
                <table>
                    <property>engines/engine[0]/rpm</property>
                    <entry>
                        <ind> 0 </ind>
                        <dep> -1.0 </dep>
                    </entry>
                    <entry>
                        <ind> 948 </ind>
                        <dep> -1.0 </dep>
                    </entry>
                    <entry>
                        <ind> 6000 </ind>
                        <dep> -1.0 </dep>
                    </entry>
                </table>0 </expression>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-zr</property>
        </output>
    </filter>

    <filter>
        <name>splash-x</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <condition>
                <greater-than-equals>
                    <property>velocities/airspeed-kt</property>
                    <value>20</value>
                </greater-than-equals>
            </condition>
            <property>environment/aircraft-effects/splash-xa</property>
        </input>
        <input>
            <condition>
                <less-than>
                    <property>velocities/airspeed-kt</property>
                    <value>20</value>
                </less-than>
            </condition>
            <property>environment/aircraft-effects/splash-xr</property>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-vector-x</property>
        </output>
    </filter>

    <filter>
        <name>splash-y</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <value>0.0</value>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-vector-y</property>
        </output>
    </filter>

    <filter>
        <name>splash-z</name>
        <update-interval-secs type="double">0.01</update-interval-secs>
        <type>gain</type>
        <gain>1.0</gain>
        <input>
            <condition>
                <greater-than-equals>
                    <property>velocities/airspeed-kt</property>
                    <value>20</value>
                </greater-than-equals>
            </condition>
            <property>environment/aircraft-effects/splash-za</property>
        </input>
        <input>
            <condition>
                <less-than>
                    <property>velocities/airspeed-kt</property>
                    <value>20</value>
                </less-than>
            </condition>
            <property>environment/aircraft-effects/splash-zr</property>
        </input>
        <output>
            <property>environment/aircraft-effects/splash-vector-z</property>
        </output>
    </filter>


    <!--Autopilot-->

    <pid-controller>
        <name>Heading hold</name>
        <debug>false</debug>
        <enable>
            <prop>autopilot/locks/heading</prop>
            <value>1</value>
        </enable>
        <input>
            <prop>orientation/roll-deg</prop>
        </input>
        <reference>autopilot/settings/target-roll-deg</reference>
        <output>
            <prop>controls/flight/aileron</prop>
        </output>
        <config>
            <Kp>0.1</Kp>
            <Ti>1.0</Ti>
            <Td>0.0</Td>
            <u_min>-1.0</u_min>
            <u_max>1.0</u_max>
        </config>
    </pid-controller>

    <pid-controller>
        <name>Pitch hold</name>
        <debug>false</debug>
        <enable>
            <prop>autopilot/locks/altitude</prop>
            <value>1</value>
        </enable>
        <input>
            <prop>orientation/pitch-deg</prop>
        </input>
        <reference>autopilot/settings/target-pitch-deg</reference>
        <output>
            <prop>controls/flight/elevator</prop>
        </output>
        <config>
            <Kp>-0.1</Kp>
            <Ti>1.0</Ti>
            <Td>0.0</Td>
            <u_min>-1.0</u_min>
            <u_max>1.0</u_max>
        </config>
    </pid-controller>

</PropertyList>