Skip to content

Commit

Permalink
Control: AP: Improve TF mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Octal450 committed Sep 20, 2018
1 parent a414637 commit 2421aa2
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 21 deletions.
23 changes: 16 additions & 7 deletions Mirage-2000/Nasal/terrain_follow.nas
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var pickingMethod = 0;
if ((major == 2017 and minor == 2 and pica >= 1) or (major == 2017 and minor > 2) or major > 2017) {
pickingMethod = 1;
}
setprop("/instrumentation/tfs/ground-altitude-ft-current",0);
setprop("/instrumentation/tfs/ground-altitude-ft-lookahead",0);

var myPos = geo.aircraft_position();
var xyz = nil;
Expand All @@ -41,10 +43,18 @@ var terrain = geo.Coord.new();

setprop ("instrumentation/tfs/delay-sec", 4);

var tfs_radar = func() {
#Calling 2 time the function
var tfs_radar = func(){
var delay_sec = getprop("instrumentation/tfs/delay-sec");
setprop("/instrumentation/tfs/ground-altitude-ft-current",tfs_radar_calculation(1));
setprop("/instrumentation/tfs/ground-altitude-ft-lookahead",tfs_radar_calculation(delay_sec));

}



var tfs_radar_calculation = func(delay_sec) {
var speed_kt = getprop("velocities/groundspeed-kt");
var delay_sec = getprop("instrumentation/tfs/delay-sec")
+ 0.5 * getprop("autopilot/settings/tf-mode");
var range_m = (speed_kt * 1852 / 3600) * delay_sec;

var lat_deg = getprop ("position/latitude-deg");
Expand All @@ -67,9 +77,8 @@ var tfs_radar = func() {
if((target_altitude_m == nil)
or (altitude_m - target_altitude_m > 1000))
{
setprop("instrumentation/tfs/ground-altitude-ft",
math.max (0, getprop ("instrumentation/tfs/ground-altitude-ft")));
setprop("instrumentation/tfs/malfunction", 1);
return math.max (0, getprop ("instrumentation/tfs/ground-altitude-ft"));
}
else
{
Expand All @@ -81,9 +90,9 @@ var tfs_radar = func() {
target_pos.set_alt(target_altitude_m);
}

setprop("instrumentation/tfs/ground-altitude-ft",
(target_altitude_m+30) * M2FT);
setprop("instrumentation/tfs/malfunction", 0);
return ((target_altitude_m) * M2FT);

}

#settimer (tfs_radar, 0.1);
Expand Down
60 changes: 49 additions & 11 deletions Mirage-2000/Systems/it-fbw-ap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,48 @@
</config>
</pid-controller>

<filter>
<name>TFS Ground Altitude Current Damp</name>
<type>exponential</type>
<input>/instrumentation/tfs/ground-altitude-ft-current</input>
<output>/it-fbw/ap/ground-altitude-current-damp</output>
<filter-time>0.12</filter-time>
</filter>

<filter>
<name>TFS Ground Altitude Lookahead Damp</name>
<type>exponential</type>
<input>/instrumentation/tfs/ground-altitude-ft-lookahead</input>
<output>/it-fbw/ap/ground-altitude-lookahead-damp</output>
<filter-time>0.12</filter-time>
</filter>

<filter>
<name>TF Error Computer</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<expression>
<difference>
<property>/position/altitude-ft</property>
<sum>
<max>
<property>/it-fbw/ap/ground-altitude-current-damp</property>
<property>/it-fbw/ap/ground-altitude-lookahead-damp</property>
</max>
<property>/it-fbw/ap/tf-protection</property>
<property>/autopilot/settings/target-altitude-ft</property>
</sum>
</difference>
</expression>
</input>
<output>/it-fbw/ap/tf-error</output>
</filter>

<filter>
<name>System Command: Vert Speed to Pitch Absolute Computer</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<condition>
<equals>
Expand All @@ -528,19 +567,18 @@
<div>
<min>
<max>
<product> <!-- Error Computer -->
<difference>
<property>/position/altitude-ft</property>
<sum>
<property>/instrumentation/tfs/ground-altitude-ft</property>
<property>/autopilot/settings/target-altitude-ft</property>
</sum>
<value>1.0</value>
</difference>
<product>
<property>/it-fbw/ap/tf-error</property>
<table>
<property>/velocities/mach</property>
<entry><ind>0.2</ind><dep>-7</dep></entry>
<entry><ind>2.1</ind><dep>-2</dep></entry>
<entry><ind>0.2</ind><dep>-14.0</dep></entry>
<entry><ind>2.1</ind><dep> -4.0</dep></entry>
</table>
<table>
<abs><property>/it-fbw/ap/tf-error</property></abs>
<entry><ind> 0</ind><dep>1.0</dep></entry>
<entry><ind> 250</ind><dep>1.5</dep></entry>
<entry><ind>1000</ind><dep>2.5</dep></entry>
</table>
</product>
<value>-5000</value>
Expand Down
2 changes: 1 addition & 1 deletion Mirage-2000/m2000-5-set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<sim>

<description>Mirage 2000 (YASim)</description>
<author>BARANGER Emmanuel (3D/FDM), Buckaroo (FDM), 5H1N0B1 (Weapons, systems), F-Sig and hardball (3D, systems, dual seat)</author>
<author>BARANGER Emmanuel (3D/FDM), Buckaroo (FDM), 5H1N0B1 (Weapons, systems), F-Sig and hardball (3D, systems, dual seat), Joshua Davidson (FCS/FBW/Autopilot)</author>

<long-description>The Dassault Mirage 2000 is a French multirole, single-engine fourth-generation jet fighter manufactured by Dassault Aviation. It was designed in the late 1970s as a lightweight fighter based on the Mirage III for the French Air Force (Armee de l'Air). The Mirage 2000 evolved into a multirole aircraft with several variants developed, with sales to a number of nations. The variants include the Mirage 2000N and 2000D strike variants, the improved Mirage 2000-5 and several export variants. Over 600 aircraft were built and it has been in service with nine nations.</long-description>

Expand Down
2 changes: 1 addition & 1 deletion Mirage-2000/m2000-5B-backseat-set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<sim>

<description>Mirage 2000 Biplace back-seat (YASim)</description>
<author>BARANGER Emmanuel (3D/FDM), Buckaroo (FDM), 5H1N0B1 (Weapons, systems), F-Sig and hardball (3D, systems, dual seat)</author>
<author>BARANGER Emmanuel (3D/FDM), Buckaroo (FDM), 5H1N0B1 (Weapons, systems), F-Sig and hardball (3D, systems, dual seat), Joshua Davidson (FCS/FBW/Autopilot)</author>

<aircraft-version>2015-09-16</aircraft-version>
<status>production</status>
Expand Down
2 changes: 1 addition & 1 deletion Mirage-2000/m2000-5B-set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<sim>

<description>Mirage 2000 Biplace (B, N, D) (YASim)</description>
<author>BARANGER Emmanuel (3D/FDM), Buckaroo (FDM), 5H1N0B1 (Weapons, systems), F-Sig and hardball (3D, systems, dual seat)</author>
<author>BARANGER Emmanuel (3D/FDM), Buckaroo (FDM), 5H1N0B1 (Weapons, systems), F-Sig and hardball (3D, systems, dual seat), Joshua Davidson (FCS/FBW/Autopilot)</author>

<long-description>The Dassault Mirage 2000 is a French multirole, single-engine fourth-generation jet fighter manufactured by Dassault Aviation. It was designed in the late 1970s as a lightweight fighter based on the Mirage III for the French Air Force (Armee de l'Air). The Mirage 2000 evolved into a multirole aircraft with several variants developed, with sales to a number of nations. The variants include the Mirage 2000N and 2000D strike variants, the improved Mirage 2000-5 and several export variants. Over 600 aircraft were built and it has been in service with nine nations.</long-description>

Expand Down

0 comments on commit 2421aa2

Please sign in to comment.