<?xml version="1.0"?>
<!--
Copyright (c) 2018 Heiko.H.Schulz
Used and adapted to BN-2 by Bea Wolf 2023
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/>.
-->



<!--
Simulates effects of icing to weight, all other effects like drag and loss of lift are simulated in the fdm-file
-->

<system name="icing">
	<property value="0.0">ice/wing</property>
	<property value="0.0">ice/stabilizer</property>
	<property value="0.0">ice/fuselage</property>
	<property value="0.0">ice/propeller</property>
	
	<channel name="Ice Weight">
		
		<summer name="ice/total">
			<input>ice/wing</input>
			<input>ice/stabilizer</input>
			<input>ice/fuselage</input>
			<input>ice/propeller</input>
		</summer>
		
		<pure_gain name="ice/weight">
			<input>ice/total</input>
			<gain>100</gain>
			<output>inertia/pointmass-weight-lbs[15]</output>
		</pure_gain>
		
		<!--<fcs_function name="systems/engine/ice">
		<function>
		<table>
		<independentVar lookup="row">ice/wing</independentVar>
		<tableData breakPoint="0">
		0	0.18
		0.5	0.18
		2	3.6
		</tableData>
		</table>  
		</function>
		<clipto>
		<min> 0.0 </min>
		<max> 1.00 </max>
		</clipto>
		<output>systems/engine/ice/air-intake-impedance-factor</output>   
		</fcs_function>	-->
		
		
		
	</channel>
	
	<channel name="Engine Reaction to Icing">
		<aerosurface_scale name="icing-engine-air-inlet">
			<!-- ice accumulation in nose inlets reduces cooling airflow -->
			<input>ice/wing</input> <!-- ice in inches -->
			<gain>1.0</gain>
			<zero_centered>false</zero_centered>
			<domain>
				<min>0.00</min>
				<max>0.010</max> <!-- at this inch the max-range is output (thicker ice does not increase effect further) -->
			</domain>
			<range>
				<!-- reducing factor: 1=no reduction/0=full blocked; min=no-ice, max=full-ice -->
				<min>1.00</min>
				<max>0.75</max>
			</range>
			<clipto>
				<min>0.75</min>
				<max>1.00</max>
			</clipto>
			<output>propulsion/engine[0]/cooling-factor</output>
			<output>propulsion/engine[1]/cooling-factor</output>
		</aerosurface_scale>
	</channel>
	
</system>
