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

<PropertyList>

    <filter>
        <type>gain</type>
        <gain>100.0</gain>
        <input>
            <property>/systems/electrical/battery-charge-percent</property> <!-- this property ranges from 0.0 to 1.0 despite its name -->
        </input>
        <output>
            <property>/systems/electrical/battery-charge-percent-100</property>
        </output>
    </filter>
    
    <logic>
        <name>Low Voltage LED</name>
        <input>
            <and>
                <greater-than>
                    <property>systems/electrical/volts</property>
                    <value>0.0</value>
                </greater-than>
                <less-than>
                    <property>systems/electrical/amps</property>
                    <value>0.0</value>
                </less-than>
                
            </and>
        </input>
        <output>
            <property>/instrumentation/low-voltage-led</property>
        </output>
    </logic>

    <logic>
        <name>Hydraulic On/Off</name>
        <input>
            <and>
                <less-than>
                    <property>systems/electrical/outputs/hydraulic-pump</property>
                    <value>31.5</value>
                </less-than>
                <greater-than>
                    <property>systems/electrical/outputs/hydraulic-pump</property>
                    <value>20.0</value>
                </greater-than>
                <property>/controls/switches/master-bat</property>
            </and>
        </input>
        <output>
            <property>/sim/model/c172p/hydraulics/hydraulic-pump</property>
        </output>
    </logic>

    <logic>
        <name>Amphibious Gear Hydraulic Damage</name>
        <input>
            <and>
                <equals>
                    <property>fdm/jsbsim/pontoon-damage/left-pontoon</property>
                    <value>0</value>
                </equals>
                <equals>
                    <property>fdm/jsbsim/pontoon-damage/right-pontoon</property>
                    <value>0</value>
                </equals>
                <property>controls/gear/gear-down-command</property>
            </and>
        </input>
        <output>
            <property>controls/gear/gear-down</property>
        </output>
    </logic>
	
	<flipflop>
        <name>Pitch-Trim annunciator conditions for too long</name>
        <type>monostable</type>
        <inverted type="bool">true</inverted>
        <S><not>

            <and>
                <property>/autopilot/kap140/pitch-axis-fail</property>

                <!-- only show if AP is PFT or not-standby (POH p. S15-11) -->
                <!-- ie. dont show annunciator when AP is in stdby and we have over-g -->
                <or>
                    <equals>
                        <property>autopilot/kap140/panel/state-previous</property>
                        <value>6</value>
                    </equals>
                    <and>
                        <not-equals>
                            <property>autopilot/kap140/panel/state-previous</property>
                            <value>6</value>
                        </not-equals>
                        <not><property>autopilot/kap140/sensors/excess-g</property></not>
                    </and>
                </or>
            </and>

        </not></S>
        <time>
            <value> 0.5 </value>
        </time>
        <output> <property>/instrumentation/annunciator/pitch-trim-trigger</property> </output>
    </flipflop>

    <!-- Avionics fan -->
    <logic>
        <name>avionics_fan_operating</name>
        <input>
            <and>
                <property>systems/electrical/avionics-fan/serviceable</property>
                <greater-than>
                    <property>systems/electrical/outputs/avionics-fan</property>
                    <value>12.0</value>
                </greater-than>
            </and>
        </input>
        <output>
            <property>systems/electrical/avionics-fan/operating</property>
        </output>
    </logic>
    <filter>
        <name>avionics_fan_spin</name>
        <debug>false</debug>
        <type>exponential</type>
        <filter-time>3.0</filter-time>
        <input>systems/electrical/avionics-fan/operating</input>
        <output>systems/electrical/avionics-fan/spin</output>
    </filter>
</PropertyList>
