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

<!--
    Copyright (c) 2015 onox

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<PropertyList>
    
    <!-- ============================================================== -->
    <!-- Magnetos                                                       -->
    <!-- ============================================================== -->

    <filter>
        <name>Engine Magnetos</name>
        <type>gain</type>
        <input>
            <property>/controls/switches/magnetos</property>
        </input>
        <output>
            <property>/controls/engines/engine/magnetos</property> 
        </output>
    </filter>

    <filter>
        <name>fuel flow</name>
        <type>gain</type>
        <input>
            <condition>
                <equal-to> 
                    <property>/controls/fuel/tank[0]/fuel_selector</property>
                    <value>false</value>
                </equal-to>
            </condition>
            <value>0.0</value>
        </input>
        <output>
            <property>/engines/engine/fuel-flow-gph</property>
        </output>
    </filter>

    <logic>
        <name>Engine Starter</name>
        <input>
            <and>
                <less-than>
                    <property>/systems/electrical/outputs/starter</property>
                    <value>14.5</value>
                </less-than>
                <greater-than>
                    <property>/systems/electrical/outputs/starter</property>
                    <value>8.0</value>
                </greater-than>
				<property>/controls/switches/starter</property>
            </and>
        </input>
        <output>
            <property>/controls/engines/engine[0]/starter</property>
        </output>
    </logic>

   <logic>
        <name>fuel tank 1 On/Off</name>
        <input>
            <and>
                <less-than>
                    <property>controls/fuel/fuel-selector</property>
                    <value>2</value>
                </less-than>
                <greater-than>
                    <property>controls/fuel/fuel-selector</property>
                    <value>0</value>
                </greater-than>
            </and>
        </input>
        <output>
            <property>/fdm/jsbsim/propulsion/tank[1]/collector-valve</property>
        </output>
    </logic>
   <logic>
        <name>fuel tank 2 On/Off</name>
        <input>
            <and>
                <less-than>
                    <property>controls/fuel/fuel-selector</property>
                    <value>3</value>
                </less-than>
                <greater-than>
                    <property>controls/fuel/fuel-selector</property>
                    <value>1</value>
                </greater-than>
            </and>
        </input>
        <output>
            <property>/fdm/jsbsim/propulsion/tank[2]/collector-valve</property>
        </output>
    </logic>
	
</PropertyList>
