From 350534897cc177ce1ce6e60884255f5c015967e6 Mon Sep 17 00:00:00 2001
From: Joshua Davidson <joshuadavidson2000@gmail.com>
Date: Tue, 21 Nov 2017 20:40:44 -0500
Subject: [PATCH] A3XX: FADEC: Add Idle Limit, and new Engine MilThrust and
 IdleThrust curves

---
 Engines/cfm56_5b4.xml         | 28 ++++++++++++++--------------
 Engines/leap1a26.xml          | 28 ++++++++++++++--------------
 Engines/pw1127g.xml           | 28 ++++++++++++++--------------
 Engines/v2527_a5.xml          | 28 ++++++++++++++--------------
 Systems/a320-aerodynamics.xml |  8 ++++----
 Systems/fadec-cfm.xml         | 32 ++++++++++++++++++++++++++++++++
 Systems/fadec-iae.xml         | 32 ++++++++++++++++++++++++++++++++
 Systems/fmgc-thrust.xml       | 10 +++++++---
 revision.txt                  |  2 +-
 9 files changed, 132 insertions(+), 64 deletions(-)

diff --git a/Engines/cfm56_5b4.xml b/Engines/cfm56_5b4.xml
index c36b79e4..30468479 100644
--- a/Engines/cfm56_5b4.xml
+++ b/Engines/cfm56_5b4.xml
@@ -17,7 +17,7 @@
 	<n1spinup>        0.2 </n1spinup>
 	<n2spinup>        2.0 </n2spinup>
 	<maxn1>         103.8 </maxn1>
-	<maxn2>          99.6 </maxn2>
+	<maxn2>         101.4 </maxn2>
 	<augmented>         0 </augmented>
 	<injected>          0 </injected>
 
@@ -27,12 +27,12 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			    -10000   0       10000   20000   30000   40000   50000
-			0.0  0.0430  0.0488  0.0528  0.0694  0.0899  0.1183  0.1467
-			0.2  0.0500  0.0501  0.0335  0.0544  0.0797  0.1049  0.1342
-			0.4  0.0040  0.0047  0.0020  0.0272  0.0595  0.0891  0.1203
-			0.6  0.0     0.0     0.0     0.0     0.0276  0.0718  0.1073
-			0.8  0.0     0.0     0.0     0.0     0.0474  0.0868  0.0900
-			1.0  0.0     0.0     0.0     0.0     0.0     0.0552  0.0800
+			0.0  0.0430  0.0458  0.0378  0.0684  0.0819  0.0793  0.0000
+			0.2  0.0500  0.0291  0.0205  0.0514  0.0727  0.0729  0.0000
+			0.4  0.0040  0.0047  0.0012  0.0412  0.0585  0.0671  0.0000
+			0.6  0.0000  0.0000  0.0000  0.0000  0.0416  0.0518  0.0000
+			0.8  0.0000  0.0000  0.0000  0.0000  0.0354  0.0468  0.0000
+			1.0  0.0000  0.0000  0.0000  0.0000  0.0000  0.0352  0.0000
 			</tableData>
 		</table>
 	</function>
@@ -43,13 +43,13 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			     -10000   0       10000   20000   30000   40000   50000
-			0.0   1.2600  1.0000  0.7400  0.5440  0.3720  0.2410  0.0000
-			0.2   1.1710  0.9740  0.6970  0.5160  0.3650  0.2310  0.0000
-			0.4   1.1500  0.9570  0.6920  0.5260  0.3670  0.2230  0.0000
-			0.6   1.1810  0.9410  0.7210  0.5460  0.3380  0.1880  0.0000
-			0.8   1.2290  1.0200  0.7820  0.5370  0.2840  0.1450  0.0000
-			0.9   1.2580  1.0200  0.7820  0.5020  0.2510  0.0650  0.0000
-			1.0   1.1810  0.9510  0.7210  0.4210  0.1540  0.0150  0.0000
+			0.0   1.2600  1.0000  0.7400  0.5640  0.3920  0.2710  0.0000
+			0.2   1.1710  0.9740  0.6970  0.5360  0.3850  0.2610  0.0000
+			0.4   1.1500  0.9570  0.6920  0.5460  0.3870  0.2530  0.0000
+			0.6   1.1810  0.9410  0.7210  0.5660  0.3580  0.2180  0.0000
+			0.8   1.2290  1.0200  0.7820  0.5570  0.3040  0.1930  0.0000
+			0.9   1.2580  1.0200  0.7820  0.5220  0.2710  0.1140  0.0000
+			1.0   1.1810  0.9510  0.7210  0.4410  0.1740  0.0450  0.0000
 			1.2   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			1.4   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			</tableData>
diff --git a/Engines/leap1a26.xml b/Engines/leap1a26.xml
index be02a9d8..56468742 100644
--- a/Engines/leap1a26.xml
+++ b/Engines/leap1a26.xml
@@ -17,7 +17,7 @@
 	<n1spinup>        0.2 </n1spinup>
 	<n2spinup>        2.0 </n2spinup>
 	<maxn1>         103.8 </maxn1>
-	<maxn2>          99.6 </maxn2>
+	<maxn2>         101.4 </maxn2>
 	<augmented>         0 </augmented>
 	<injected>          0 </injected>
 
@@ -27,12 +27,12 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			    -10000   0       10000   20000   30000   40000   50000
-			0.0  0.0430  0.0488  0.0528  0.0694  0.0899  0.1183  0.1467
-			0.2  0.0500  0.0501  0.0335  0.0544  0.0797  0.1049  0.1342
-			0.4  0.0040  0.0047  0.0020  0.0272  0.0595  0.0891  0.1203
-			0.6  0.0     0.0     0.0     0.0     0.0276  0.0718  0.1073
-			0.8  0.0     0.0     0.0     0.0     0.0474  0.0868  0.0900
-			1.0  0.0     0.0     0.0     0.0     0.0     0.0552  0.0800
+			0.0  0.0430  0.0458  0.0378  0.0684  0.0819  0.0793  0.0000
+			0.2  0.0500  0.0291  0.0205  0.0514  0.0727  0.0729  0.0000
+			0.4  0.0040  0.0047  0.0012  0.0412  0.0585  0.0671  0.0000
+			0.6  0.0000  0.0000  0.0000  0.0000  0.0416  0.0518  0.0000
+			0.8  0.0000  0.0000  0.0000  0.0000  0.0354  0.0468  0.0000
+			1.0  0.0000  0.0000  0.0000  0.0000  0.0000  0.0352  0.0000
 			</tableData>
 		</table>
 	</function>
@@ -43,13 +43,13 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			     -10000   0       10000   20000   30000   40000   50000
-			0.0   1.2600  1.0000  0.7400  0.5440  0.3720  0.2410  0.0000
-			0.2   1.1710  0.9740  0.6970  0.5160  0.3650  0.2310  0.0000
-			0.4   1.1500  0.9570  0.6920  0.5260  0.3670  0.2230  0.0000
-			0.6   1.1810  0.9410  0.7210  0.5460  0.3380  0.1880  0.0000
-			0.8   1.2290  1.0200  0.7820  0.5370  0.2840  0.1450  0.0000
-			0.9   1.2580  1.0200  0.7820  0.5020  0.2510  0.0650  0.0000
-			1.0   1.1810  0.9510  0.7210  0.4210  0.1540  0.0150  0.0000
+			0.0   1.2600  1.0000  0.7400  0.5640  0.3920  0.2710  0.0000
+			0.2   1.1710  0.9740  0.6970  0.5360  0.3850  0.2610  0.0000
+			0.4   1.1500  0.9570  0.6920  0.5460  0.3870  0.2530  0.0000
+			0.6   1.1810  0.9410  0.7210  0.5660  0.3580  0.2180  0.0000
+			0.8   1.2290  1.0200  0.7820  0.5570  0.3040  0.1930  0.0000
+			0.9   1.2580  1.0200  0.7820  0.5220  0.2710  0.1140  0.0000
+			1.0   1.1810  0.9510  0.7210  0.4410  0.1740  0.0450  0.0000
 			1.2   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			1.4   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			</tableData>
diff --git a/Engines/pw1127g.xml b/Engines/pw1127g.xml
index 0e3f8569..40c5fe2c 100644
--- a/Engines/pw1127g.xml
+++ b/Engines/pw1127g.xml
@@ -17,7 +17,7 @@
 	<n1spinup>        0.2 </n1spinup>
 	<n2spinup>        2.0 </n2spinup>
 	<maxn1>         103.8 </maxn1>
-	<maxn2>          99.6 </maxn2>
+	<maxn2>         101.4 </maxn2>
 	<augmented>         0 </augmented>
 	<injected>          0 </injected>
 
@@ -27,12 +27,12 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			    -10000   0       10000   20000   30000   40000   50000
-			0.0  0.0430  0.0488  0.0528  0.0694  0.0899  0.1183  0.1467
-			0.2  0.0500  0.0501  0.0335  0.0544  0.0797  0.1049  0.1342
-			0.4  0.0040  0.0047  0.0020  0.0272  0.0595  0.0891  0.1203
-			0.6  0.0     0.0     0.0     0.0     0.0276  0.0718  0.1073
-			0.8  0.0     0.0     0.0     0.0     0.0474  0.0868  0.0900
-			1.0  0.0     0.0     0.0     0.0     0.0     0.0552  0.0800
+			0.0  0.0430  0.0458  0.0378  0.0684  0.0819  0.0793  0.0000
+			0.2  0.0500  0.0291  0.0205  0.0514  0.0727  0.0729  0.0000
+			0.4  0.0040  0.0047  0.0012  0.0412  0.0585  0.0671  0.0000
+			0.6  0.0000  0.0000  0.0000  0.0000  0.0416  0.0518  0.0000
+			0.8  0.0000  0.0000  0.0000  0.0000  0.0354  0.0468  0.0000
+			1.0  0.0000  0.0000  0.0000  0.0000  0.0000  0.0352  0.0000
 			</tableData>
 		</table>
 	</function>
@@ -43,13 +43,13 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			     -10000   0       10000   20000   30000   40000   50000
-			0.0   1.2600  1.0000  0.7400  0.5440  0.3720  0.2410  0.0000
-			0.2   1.1710  0.9740  0.6970  0.5160  0.3650  0.2310  0.0000
-			0.4   1.1500  0.9570  0.6920  0.5260  0.3670  0.2230  0.0000
-			0.6   1.1810  0.9410  0.7210  0.5460  0.3380  0.1880  0.0000
-			0.8   1.2290  1.0200  0.7820  0.5370  0.2840  0.1450  0.0000
-			0.9   1.2580  1.0200  0.7820  0.5020  0.2510  0.0650  0.0000
-			1.0   1.1810  0.9510  0.7210  0.4210  0.1540  0.0150  0.0000
+			0.0   1.2600  1.0000  0.7400  0.5640  0.3920  0.2710  0.0000
+			0.2   1.1710  0.9740  0.6970  0.5360  0.3850  0.2610  0.0000
+			0.4   1.1500  0.9570  0.6920  0.5460  0.3870  0.2530  0.0000
+			0.6   1.1810  0.9410  0.7210  0.5660  0.3580  0.2180  0.0000
+			0.8   1.2290  1.0200  0.7820  0.5570  0.3040  0.1930  0.0000
+			0.9   1.2580  1.0200  0.7820  0.5220  0.2710  0.1140  0.0000
+			1.0   1.1810  0.9510  0.7210  0.4410  0.1740  0.0450  0.0000
 			1.2   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			1.4   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			</tableData>
diff --git a/Engines/v2527_a5.xml b/Engines/v2527_a5.xml
index 37cda83c..a1354dac 100644
--- a/Engines/v2527_a5.xml
+++ b/Engines/v2527_a5.xml
@@ -17,7 +17,7 @@
 	<n1spinup>        0.2 </n1spinup>
 	<n2spinup>        2.0 </n2spinup>
 	<maxn1>         103.8 </maxn1>
-	<maxn2>          99.6 </maxn2>
+	<maxn2>         101.4 </maxn2>
 	<augmented>         0 </augmented>
 	<injected>          0 </injected>
 
@@ -27,12 +27,12 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			    -10000   0       10000   20000   30000   40000   50000
-			0.0  0.0430  0.0488  0.0528  0.0694  0.0899  0.1183  0.1467
-			0.2  0.0500  0.0501  0.0335  0.0544  0.0797  0.1049  0.1342
-			0.4  0.0040  0.0047  0.0020  0.0272  0.0595  0.0891  0.1203
-			0.6  0.0     0.0     0.0     0.0     0.0276  0.0718  0.1073
-			0.8  0.0     0.0     0.0     0.0     0.0474  0.0868  0.0900
-			1.0  0.0     0.0     0.0     0.0     0.0     0.0552  0.0800
+			0.0  0.0430  0.0458  0.0378  0.0684  0.0819  0.0793  0.0000
+			0.2  0.0500  0.0291  0.0205  0.0514  0.0727  0.0729  0.0000
+			0.4  0.0040  0.0047  0.0012  0.0412  0.0585  0.0671  0.0000
+			0.6  0.0000  0.0000  0.0000  0.0000  0.0416  0.0518  0.0000
+			0.8  0.0000  0.0000  0.0000  0.0000  0.0354  0.0468  0.0000
+			1.0  0.0000  0.0000  0.0000  0.0000  0.0000  0.0352  0.0000
 			</tableData>
 		</table>
 	</function>
@@ -43,13 +43,13 @@
 			<independentVar lookup="column">atmosphere/density-altitude</independentVar>
 			<tableData>
 			     -10000   0       10000   20000   30000   40000   50000
-			0.0   1.2600  1.0000  0.7400  0.5440  0.3720  0.2410  0.0000
-			0.2   1.1710  0.9740  0.6970  0.5160  0.3650  0.2310  0.0000
-			0.4   1.1500  0.9570  0.6920  0.5260  0.3670  0.2230  0.0000
-			0.6   1.1810  0.9410  0.7210  0.5460  0.3380  0.1880  0.0000
-			0.8   1.2290  1.0200  0.7820  0.5370  0.2840  0.1450  0.0000
-			0.9   1.2580  1.0200  0.7820  0.5020  0.2510  0.0650  0.0000
-			1.0   1.1810  0.9510  0.7210  0.4210  0.1540  0.0150  0.0000
+			0.0   1.2600  1.0000  0.7400  0.5640  0.3920  0.2710  0.0000
+			0.2   1.1710  0.9740  0.6970  0.5360  0.3850  0.2610  0.0000
+			0.4   1.1500  0.9570  0.6920  0.5460  0.3870  0.2530  0.0000
+			0.6   1.1810  0.9410  0.7210  0.5660  0.3580  0.2180  0.0000
+			0.8   1.2290  1.0200  0.7820  0.5570  0.3040  0.1930  0.0000
+			0.9   1.2580  1.0200  0.7820  0.5220  0.2710  0.1140  0.0000
+			1.0   1.1810  0.9510  0.7210  0.4410  0.1740  0.0450  0.0000
 			1.2   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			1.4   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
 			</tableData>
diff --git a/Systems/a320-aerodynamics.xml b/Systems/a320-aerodynamics.xml
index ac6f276d..61d7f81f 100644
--- a/Systems/a320-aerodynamics.xml
+++ b/Systems/a320-aerodynamics.xml
@@ -121,7 +121,7 @@
 				<property>aero/qbar-psf</property>
 				<property>metrics/Sw-sqft</property>
 				<property>aero/cl-squared</property>
-				<value>0.035</value>
+				<value>0.036</value>
 			</product>
 		</function>
 
@@ -134,7 +134,7 @@
 					<independentVar lookup="row">velocities/mach</independentVar>
 					<tableData>
 						 0.00      0.000
-						 1.10      0.018
+						 1.10      0.017
 						 1.80      0.015
 					</tableData>
 				</table>
@@ -147,7 +147,7 @@
 				<property>aero/qbar-psf</property>
 				<property>metrics/Sw-sqft</property>
 				<property>fcs/flap-pos-deg</property>
-				<value> 0.00110 </value>
+				<value> 0.00120 </value>
 			</product>
 		</function>
 
@@ -157,7 +157,7 @@
 				<property>aero/qbar-psf</property>
 				<property>metrics/Sw-sqft</property>
 				<property>fcs/slat-pos-deg</property>
-				<value> 0.00080 </value>
+				<value> 0.00100 </value>
 			</product>
 		</function>
 
diff --git a/Systems/fadec-cfm.xml b/Systems/fadec-cfm.xml
index d4a250a6..f6bc50ad 100644
--- a/Systems/fadec-cfm.xml
+++ b/Systems/fadec-cfm.xml
@@ -11,6 +11,30 @@
 
 <PropertyList>
 
+	<filter>
+		<name>IDLE Limit</name>
+		<type>gain</type>
+		<gain>1</gain>
+		<update-interval-secs type="double">0.05</update-interval-secs>
+		<input>
+			<condition>
+				<greater-than-equals>
+					<property>/position/gear-agl-ft</property>
+					<value>50</value>
+				</greater-than-equals>
+			</condition>
+			<expression>
+				<table>
+					<property>/position/altitude-ft</property> 
+					<entry><ind>    0</ind><dep>0.035</dep></entry>
+					<entry><ind>42000</ind><dep>0.285</dep></entry>
+				</table>
+			</expression>
+		</input>
+		<input>0</input>
+		<output>/controls/engines/idle-limit</output>
+	</filter>
+
 	<filter>
 		<name>MAN One</name>
 		<type>gain</type>
@@ -488,6 +512,10 @@
 			</expression>
 		</input>
 		<output>/controls/engines/engine[0]/throttle-output</output>
+		<min>
+			<property>/controls/engines/idle-limit</property>
+		</min>
+		<max>1.0</max>
 	</filter>
 	
 	<filter>
@@ -523,6 +551,10 @@
 			</expression>
 		</input>
 		<output>/controls/engines/engine[1]/throttle-output</output>
+		<min>
+			<property>/controls/engines/idle-limit</property>
+		</min>
+		<max>1.0</max>
 	</filter>
 	
 	<filter>
diff --git a/Systems/fadec-iae.xml b/Systems/fadec-iae.xml
index ae86ea79..95c59e33 100644
--- a/Systems/fadec-iae.xml
+++ b/Systems/fadec-iae.xml
@@ -11,6 +11,30 @@
 
 <PropertyList>
 
+	<filter>
+		<name>IDLE Limit</name>
+		<type>gain</type>
+		<gain>1</gain>
+		<update-interval-secs type="double">0.05</update-interval-secs>
+		<input>
+			<condition>
+				<greater-than-equals>
+					<property>/position/gear-agl-ft</property>
+					<value>50</value>
+				</greater-than-equals>
+			</condition>
+			<expression>
+				<table>
+					<property>/position/altitude-ft</property> 
+					<entry><ind>    0</ind><dep>0.035</dep></entry>
+					<entry><ind>42000</ind><dep>0.285</dep></entry>
+				</table>
+			</expression>
+		</input>
+		<input>0</input>
+		<output>/controls/engines/idle-limit</output>
+	</filter>
+
 	<filter>
 		<name>MAN One</name>
 		<type>gain</type>
@@ -967,6 +991,10 @@
 			</expression>
 		</input>
 		<output>/controls/engines/engine[0]/throttle-output</output>
+		<min>
+			<property>/controls/engines/idle-limit</property>
+		</min>
+		<max>1.0</max>
 	</filter>
 	
 	<filter>
@@ -1002,6 +1030,10 @@
 			</expression>
 		</input>
 		<output>/controls/engines/engine[1]/throttle-output</output>
+		<min>
+			<property>/controls/engines/idle-limit</property>
+		</min>
+		<max>1.0</max>
 	</filter>
 	
 	<filter>
diff --git a/Systems/fmgc-thrust.xml b/Systems/fmgc-thrust.xml
index 8233be20..3068292e 100644
--- a/Systems/fmgc-thrust.xml
+++ b/Systems/fmgc-thrust.xml
@@ -207,7 +207,9 @@
 			<gamma>0.0</gamma>
 			<Ti>10.0</Ti>
 			<Td>0.00001</Td>
-			<u_min>0.005</u_min>
+			<u_min>
+				<property>/controls/engines/idle-limit</property>
+			</u_min>
 			<u_max>
 				<property>/controls/engines/throttle-pid-max</property>
 			</u_max>
@@ -271,7 +273,9 @@
 			<gamma>0.0</gamma>
 			<Ti>10.0</Ti>
 			<Td>0.00001</Td>
-			<u_min>0.005</u_min>
+			<u_min>
+				<property>/controls/engines/idle-limit</property>
+			</u_min>
 			<u_max>
 				<property>/controls/engines/throttle-pid-max</property>
 			</u_max>
@@ -322,7 +326,7 @@
 			<value>0.0</value>
 		</input>
 		<input>
-			<value>0.005</value>
+			<property>/controls/engines/idle-limit</property>
 		</input>
 		<output>
 			<property>/controls/engines/throttle-cmd-pid</property>
diff --git a/revision.txt b/revision.txt
index c4395770..0cdf739f 100644
--- a/revision.txt
+++ b/revision.txt
@@ -1 +1 @@
-4027
\ No newline at end of file
+4028
\ No newline at end of file