<?xml version="1.0"?>

<!--
	Stop control. For the MiG-15bis, but can be used in every JSB craft with names rewriting.
	Author: Slavutinsky Victor
-->

<system>

	<fileheader>
		<author> Slavutinsky Victor </author>
		<filecreationdate> 2010-10-03 </filecreationdate>
		<version>$Revision: 1.00 $</version>
		<description> Stop control </description>
	</fileheader>

<!--	That must be aded to set file

	<stopcontrol>
		<serviceable type="bool">1</serviceable>

		<lever-input type="bool">1</lever-input>
		<lever-command type="bool">1</lever-command>
		<lever-pos type="float">1</lever-pos>
		<lever-switch type="bool">1</lever-switch>

	</stopcontrol>

-->
	<channel name="Stopcontrol">

		<switch name="calculations/stopcontrol/lever-allowed">
			<default value="systems/stopcontrol/lever-command"/>
			<test logic="AND" value="systems/stopcontrol/lever-input">
				systems/stopcontrol/serviceable eq 1
			</test>
			<output>systems/stopcontrol/lever-command</output>
		</switch>

		<kinematic name="calculations/stopcontrol/lever-pos">
			<input>systems/stopcontrol/lever-command</input>
			<traverse>
			<setting>
				<position>0</position>
				<time>0</time>
			</setting>
			<setting>
				<position>1</position>
				<time>0.2</time>
			</setting>
			</traverse>
			<output>systems/stopcontrol/lever-pos</output>
		</kinematic>

		<switch name="calculations/stopcontrol/lever-not-allowed">
			<default value="systems/stopcontrol/lever-input"/>
			<test logic="AND" value="systems/stopcontrol/lever-command">
				systems/stopcontrol/serviceable eq 0
			</test>
			<output>systems/stopcontrol/lever-input</output>
		</switch>

		<switch name="calculations/stopcontrol/lever-switch">
			<default value="systems/stopcontrol/lever-switch"/>
			<test logic="AND" value="1">
				systems/stopcontrol/lever-pos ge 0.5
			</test>
			<test logic="AND" value="0">
				systems/stopcontrol/lever-pos lt 0.5
			</test>
			<output>systems/stopcontrol/lever-switch</output>
		</switch>

<!-- click -->

		<switch name="calculations/stopcontrol/click">
			<default value="systems/sounds/click/on"/>
			<test logic="AND" value="1">
				systems/stopcontrol/lever-pos ge 0.25
				systems/stopcontrol/lever-pos le 0.75
				systems/sounds/click/on == 0
			</test>
			<output>systems/sounds/click/on</output>
		</switch>

	</channel>

</system>
