YSFlight Physics Engine
This page is continuously being developed and expanded. Please check back in the future for additional updates!
Table of Contents
1 - Introduction
1.1 - Purpose
1.2 - Inspiration
2 - An Introduction To Basic Aerodynamics
2.1 - The Four Basic Forces
2.2 - Lift
2.2.2 - Simplified Lift Coefficient
2.3 - Drag
2.3.1 - Drag Coefficient
2.3.2 - Simplified Drag Coefficient
2.4 - Weight
2.5 - Thrust
3 - Flight Data
3.1 - YFS Files
3.2 - Data Quality
4 - Equation Derivations
4.1 - Free Body Diagram
4.2 - Combine Aerodynamic and Free-Body Equations
4.2.1 - Non-Accelerating Level Flight
4.2.2 - Accelerating Level Flight
4.3 - Linear Equations
4.4 - Quadratic Equation
4.5 - Smoothing Functions
The acceleration derivation test results shown in Figure 4.2 highlight several key points about smoothing data.
Initializing the derivation can often result in data points that are vastly different that reality
Generally the more complex the initial derivation of a value the more refined the result
Post-processing a derived parameter may lead to significant gains in overall signal noise reduction.
4.6 - Relative Air Density
Solving for the absolute constants at Altitudes 1 and 2, we see that the following is true if it is assumed that the aircraft is flying at the same angle of attack:
4.7 - Calculating Angle of Attack
Rotation Matrix about x-axis
Rotation Matrix about y-axis
Rotation Matrix about z-axis
5 - Testing Methods
5.1 - Flares
5.1.1 - Flare Instances
5.1.2 - Flare Segments
5.1.3 - Flare Segment Averages
5.2 - Slow Down Drift
5.3 - Ground Testing
6 - Test Aircraft
The main feature needed with test aircraft is the ability to edit the DAT file. Since the DNM plays no role in the performance of the aircraft, we don't need much. For this testing I've used several different aircraft to quickly get the type of DAT file needed. For example, while the primary aircraft used has been an HQPGAC MIG-31 to test high-speed and high altitude performance, the stock UH-60, Harrier, and P-51 aircraft have all been used in various modified ways to test different features of YSFlight Physics.
7 - Engine Performance
As shown in Equation 4.7 , the Thrust Force produced by the aircraft's power plant plays a key role in the calculation of Drag and Lift Forces. Additionally the fuel consumption and thrust settings must be known for accurate Lift and Drag Analysis over the course of a long flight to account for the burn-off of fuel.
7.1 - General Engine Information
The engine model in YSFlight has two main types: Jet and Propeller. Each has specific complexities and in an added wrinkle the propeller model has been updated in newer versions of YSFlight including 20150426. For the purposes of this analysis, focus shall be given to the older and simpler propeller model but leaves open the potential for future analysis of the newer propeller model.
7.1.1 - Throttle
The throttle is the only in-game control over how the engine model behaves (In the older simplified models this is the case. The newer YSFlight version has controls and DAT variables which imply that there will be pitch control for propeller engines using the newer system). In the YFS File this parameter is recorded as an integer from 0 to 99. By default the "Q" and "A" buttons will respectively add or subtract 5 percent throttle from the current value, but with the upper limit set at 99, the percentages do not line up with the integer value recorded in the YFS file. The throttle command percent can be calculated from the YFS file using Equation 7.1.
220.127.116.11 - Auto-pilot Thrust Values
Because the Engine can only vary it's throttle value by a single integer, there are times when the auto-pilot conditions can require a thrust between two throttle values to maintain the auto-pilot conditions. In this situations the pilot may observe the throttle flickering as the game commands slightly more and less thrust to average out to the required thrust. This is why when taking throttle samples during flight, it is important to take a large sample of throttle data points to obtain a proper average. Often the throttle value will vary in a cyclical manner that has a time period between 1 to 5 seconds, but it varies with condition and time. Based on the analysis performed during this investigation it is recommended to take samples over 30-60 seconds at a minimum in order to obtain a proper average throttle value.
7.1.2 - Apparent Zero-Throttle Thrust
If an aircraft sits on the ground with the brake off and the throttle at idle (0 commanded throttle), the aircraft sometimes begin to move. Now with wind, this is explainable by the drag force of the wind on the aircraft, however when there is no wind, this sometimes occurs. The explanation for this lies with the landing gear positions on the aircraft. If they do not share the same z-position value (second value in the DAT file), the aircraft will roll. Testing showed that the greater the difference between nose (or tail) wheel positions and the main gear, the faster the aircraft will roll. The very same aircraft with a constant z-position value for all the landing gear locations will not move an inch.
7.2 - Jet Engines
The Thrust generated by Jet Engines was the first to be evaluated. Due to the lesser number of DAT Variables required for a jet engine, it was deemed to be simpler for analysis purposes.
7.2.1 - DAT File Variables
There are 5 key DAT file parameters for the performance of a jet engine in YSFlight:
7.2.2 - Fuel Burn Rates
The amount of fuel that a jet engine burns is dependant on one of two main factors
Whether the engine is in afterburner or dry thrust
The throttle position
18.104.22.168 - Afterburning Fuel Burn Rate
When an engine is in afterburning operation the fuel consumption is independent of the throttle position. Whether the throttle is at the minimum afterburning setting or the maximum afterburning throttle setting, the fuel consumption will be the same. Therefore the fuel burn rate for this operation can be described as seen in Equation 7.2.
22.214.171.124 - Non-Afterburning Burn Rate
When an aircraft does not have an afterburner or is operating without engaging it, the fuel burn rate becomes proportional to the throttle setting regardless of altitude or air speed. In order to collect the information displayed in Figure 7.1, the Boeing 787 Test Bed aircraft was flown at 9 different altitudes and at different speeds. At each condition 0.3 percent of the on board fuel was burned and timed. Times varied from 30 seconds to several minutes, and was performed manually using a stopwatch. This factor, along with the 0.01 fuel percent HUD precision had some variance, but for the most part the data followed a highly-linear trend.
7.2.3 - Thrust
The thrust output of a jet engine is nominally proportional to the throttle position, but the actual thrust output of the engine varies also with altitude. This second influence on the thrust value caused considerable chaos with early models that appeared to work in some areas of the sky, while not in others.
126.96.36.199 - Nominal Thrust vs Throttle
Using the stock Harrier aircraft, a series of hover thrust tests were performed at various weights and fuel percentages. The collected throttle values were matched up with the total aircraft weight showing a highly linear trend between throttle and thrust output. These trials were performed at the same altitude so that an altitude influence could be eliminated from the data.
188.8.131.52 - Thrust Cutback
By sing the Thrust Hover testing method and climbing until the aircraft peaked out, the altitude at which the thrust was equal to the weight of the aircraft could be found. For each flight the DAT Value for the engine thrust was changed from anywhere between 10 tons and 1200 tons of thrust. Even with 1200 tons of thrust the aircraft could not climb above 65000 feet, indicating that there was a drastic change in the atmosphere at this altitude because flight above 65000 feet in YSFlight is possible when flying normally with a powerful fighter jet.
Looking at Figure 7.3 it is possible to see that there are four altitudes that matter for the cutback curve: 4km, 12km, 20km, and 36km (13100ft, 39400ft, 65600ft, and 118110ft respectively). The mathematical expression of this Cutback Percentage can be seen in Equation 7.4. It should be noted that at 20 km the engine thrust should produce zero thrust. Above 20 kilometers, the cutback jumps back to a constant value of 0.085 before all thrust is reduced to zero above 36 kilometers.
184.108.40.206 - Afterburner Thrust vs Throttle
Once gain using the Hover Thrust testing method, the different afterburner stages were tested. The data collected from this trial is plotted below in Figure 7.4. Because it was hypothesized that the Afterburning Thrust profile would reference the Military Thrust DAT Variable, two different Military Thrusts (10 and 12 tons) were used to see the influence on the actual thrust. As evident in the profiles of the two trials, the increase in military thrust had an impact on the afterburner thrust output.
7.3 - Propeller Engines
The other form of propulsion in YSFlight is via propellers. These appear in two flavors: Helicopters and Propeller Aircraft. Based on analysis of the DAT Files, it is thought that there is no difference between the two propulsion systems. Subtle differences exist between the jet and propeller engines which must be examined in detail.
7.3.1 - DAT File Variables
7.3.2 - Propeller Testing
There are several things that need to be tested in order to categorize the propeller thrust model. Unlike the jet engine in YSFlight there are several DAT-Controlled factors that need to be broken down. Based on the comments in the DAT File, there appears to be two regions for thrust based on aircraft velocity in the PROPVMIN value. It is expected that the Propeller thrust equation will look something like Equation 7.6
220.127.116.11 - Propeller Engine Fuel Burn Rates
Using the P-51 test aircraft the fuel burn rates were timed using the same method as the jet engine aircraft. Before performing trials at a full sweep of altitudes, tests were performed at 1000, 5000, and 10000 to see if any changes could be seen. As seen in Figure 7.6, all the data was linear, but noticeably less than expected. Using Equation 7.3, the Jet Model burn rate was calculated and plotted against test data. Although highly similar, there is a deviation from the Jet Engine model which suggests that there is something different about Propeller Engines. In addition to propeller engines not burning the FUELMILI amount at 100 percent throttle, the linear trend line equation has a non-zero y-axis intercept. This suggests a step-change in the function because at zero throttle, the engine did not burn any fuel.
18.104.22.168 - Propeller Efficiency and Effect on Thrust Output in Hover
22.214.171.124 - Power vs Thrust At Speeds Less Than PROPVMIN
126.96.36.199 - Power vs Altitude Hover Testing
Just like with jet engines, the actual thrust output of the aircraft changes with altitude. Performing a nearly identical test sequence to the jet engines, the test helicopter was set to climb until it stopped climbing and the altitude was recorded. For this experiment the aircraft weight was kept constant and the only change was the PROPELLR value. Based on the data gathered in Section 188.8.131.52, the maximum static thrust was calculated using the 6.85 kg/HP static thrust conversion. Knowing that the helicopter was set to 100 percent throttle, the cutback could be determined by the known thrust output (total weight) and static thrust at that throttle setting. The results are shown below.
184.108.40.206 - Dynamic Propeller Thrust
8 - The YSFlight Atmosphere
8.1 - Air Density
The air density is present in both the lift and drag equations (2.1 and 2.3) and therefore must be evaluated prior to a serious attempt at either property.
8.1.1 - Test Procedure
8.2 - Speed of Sound
8.2.1 - Mach Number with Altitude
From this graph, the equations for Mach in KTAS and KIAS can be derived as a function of altitude. Note that indicated air speed is not available above 36000m altitude.
8.3 - Wind
8.3.1 - Wind Influence On Takeoff Roll
8.4 - Converting Between Meters Per Second and Knots Indicated Air Speed
9 - Lift
This section has yet to be filled out.
10 - Drag
An analysis of drag in YSFlight is a critical part of understanding aircraft performance. This investigation systematically breaks down the different aspects of drag in YSFlight and identifies which DAT Variables influence Drag.
10.1 - Equation Derivation
The basic analysis for drag starts with an understanding of what drag forces exist and when they apply to the aircraft in YSFlight. This simplified view lets us break down each individual component and determine what .dat file variables influence them. The following equations are for a simplified flight condition with no roll angle, side-slip angle.
10.1.1 - Calculating Velocity and Acceleration
Knowing the net force, we can re-arrange Equations 10.1, 10.4 and 10.9 as such:
This can then be re-arranged to isolate the Drag Coefficient on one side of the equation.
10.1.2.1 - Drag Coefficient Calculation Errors
10.2 - Testing Methods
For the most part, the ground run method as described in Section 5 was used to test different DAT Variables. Testing was performed with a constant throttle setting to avoid any variability with acceleration. Typically 25%, 50%, 75% and 100% throttle settings were used. Immediately after the fight started, it was paused in order to input the flap or spoiler settings for the particular run being performed. While the inputs would not immediately be fully realized when the simulation resumed, within a few seconds they would be at the desired position. By running each test run until the aircraft speed stabilized to the point where acceleration was near-zero, the equations derived above could be used. If was found that when zooming in on the HUD, the best results came when waiting for the aircraft's speed to only change a pixel every few seconds.
10.2.1 - Limitations of Ground Run Testing
One issue with operating on the ground is that at a certain point the lift generated even at zero Angle of Attack will be sufficient to make the aircraft takeoff.
11 - Weapon Test Results
11.1 - Weapon Weights
11.1.1 - Equations
11.1.2 - Error Reductions
11.1.3 - Results
11.2 - Weapon Flight Profile
Weapons in YSFlight fly with different characteristics depending on the weapon type. Some share similar characteristics.
11.2.1 - B500 and B250 Flight Profile
220.127.116.11 - Finding B500/B250 Landing Spot
The total flight time can be solved using Equation 11.7.
and the result can be used to figure out how far down-range the weapon traveled.
By inputting Equations 11.11 and 11.12 into Equation 10.9, we can isolate the CdA term, which is a constant for the bomb.
Since the CdA term is a constant for the bomb, no matter what the velocity of the bomb actually is, we can calculate the drag force on the bomb to be:
18.104.22.168 - Calculating B500HD Flight-Path
Substituting in the Drag Equation from Equation 11.16:
In the current iteration, the next velocities need to be calculated in order to determine the change in flight path angle.
11.3 - Weapon Damage
11.3.2 - Blast Radius
12 - Miscellaneous DAT Variable Influence
Appendix A - Definitions
Aircraft Reference Frame: Shortened to ARF, this is a coordinate system attached to an aircraft with the positive x-axis pointed out the nose, the positive y-axis pointed out towards the right wing and the positive z-axis pointed directly down and out of the belly of the aircraft.
Angle of Attack: The Angle of Attack (AoA or Alpha) is the pitch-axis angle between the aircraft's actual flight path (see Figure A.2) and where the aircraft's nose is pointing. In Figure A.2 the aircraft is pointed in-line with the red arrow, while it is actually flying in the direction the blue arrow is pointed. In real life, this is one of the most important parameters for defining the aerodynamic properties of the aircraft. Within YSFlight players produce Angle of Attack commands when making pitch-stick inputs, therefore this is possibly the most important parameters to understand in this project.
Angle of Side Slip: The yaw-axis angle between the aircraft's flight path and the orientation of the aircraft. Pilots put in pedal to yaw the aircraft and introduce side-slip. Often referred to as "Beta" and shown with the Greek letter beta, aircraft typically do not fly with much if any side-slip outside of coordinated turns.
Bank Angle: The bank angle is the roll-angle between wings-level and upright flight and the current orientation of the wings relative to the horizon.
Drag: The aerodynamic force that slows down an aircraft in motion. Acts in the directly opposite direction of the flight path. The drag force is defined with the following equation:
Drag Coefficient: The Drag Coefficient is a non-dimensional value used to characterize the drag of a shape as it move through a medium. For aircraft, the Drag Coefficient value changes depending on the Angle of Attack the aircraft is flying at. For a more detailed explanation see Section 2.3.1. Re-arranging Equation A.1, the equation for the Drag Coefficient at any particular Angle of Attack is:
Flight Level: The Flight Level of an aircraft references the barometric altimeter reading when calibrated to 29.92 inH (Inches of Mercury), or Standard Day Sea Level Pressure. This allows for aircraft to safely establish vertical spacing after departing from areas with locally different pressure altimeter readings. When used in text or speech, Flight Level is often shortened to FL followed by a number indicating the altitude. This number is the aircraft's altitude in hundreds of feet when set to 29.92 inHg. For Example, an aircraft flying at 25,000 ft would be flying at FL250. An aircraft flying at 9000 ft under these rules would be at FL090.
Flight Path: The actual direction the aircraft is moving, regardless of orientation.
Flight Path Angle: The angle between the Flight Path of the aircraft and the horizon. Often referred to as "Gamma", this angle is primarily used in energy management in fighter aircraft and during landing to ensure the approach path is not too steep. In Figure A.2, this angle is between the blue angle and the horizon. When the aircraft is climbing, the angle is positive and when diving the angle is negative. Often the positive or negative sign is dropped in conversation and a climb or dive is specified (i.e. 10 Gamma Dive or 15 Gamma Climb).
Frame: A frame of data is all the data at a particular time in the data-stream. This is a shorthand way to indicate a grouping of parameters that may need to be referenced.
G Load: The load factor in apparent acceleration of gravity felt by those on-board the aircraft. One g is straight and level flight where all the vertical forces balance out. Fighter aircraft like the F-16 Falcon or F-35A Lightning II will allow for +9g to -3g. G is often used to measure how hard an aircraft is turning as the greater the G Load, the tighter the turn at a given speed.
HUD: Heads Up Display. In YSFlight there are two versions of the HUD which can be toggled in-flight via the in-game menu. This is a graphical way to present the pilot with critical information such as altitude, airspeed, flight path, bank angle, compass heading, and many other values.
Lift: The aerodynamic force generated by the wings and fuselage of an aircraft that acts directly up relative to the aircraft. Figure 2.1 shows how this force may not always point directly upwards, even in level flight. The equation for Lift looks very similar to the Drag Equation A.1, but slightly different.
Mach: The speed of sound. This value changes with temperature and thus changes with Altitude in YSFlight. At Sea Level this is 330 meters per second, or 660 knots. Symbolically, Mach is shown as "a" in the literature.
Sustainable: A flight condition is sustainable when the aircraft can achieve it in level flight. A sustainable condition may be defined as a target speed, g load or even angle of attack. level flight does not mean that the aircraft must be going straight, or that the aircraft be oriented upright, rather that the altitude of the aircraft does not change while performing the maneuver.
Pitch Attitude: The Pitch Attitude is the angle between the horizon and the orientation of the aircraft in the pitch-axis. Sometimes referred to as "Theta" it. See Figure A.2.
Tangential Reference Frame: This coordinate system is used in a wide range of applications, including GPS calculations, and is loosely related to the coordinate system used in .YFS file replay position data. Using this reference frame allows for easier interpretation of vectors. In this system, the positive x-axis is pointed to True North, the positive y-axis is pointed East, and the positive z-axis is pointed directly into the ground.
True Air Speed (TAS): Also referred to as TAS or KTAS, this air speed is the ground speed of the aircraft when there are no winds. This value is displayed in Knots in YSFlight.
Yaw: The rotation of the aircraft about its vertical axis relative to flight path.
Appendix B - Acronyms and Shorthand Notations
AoA - Angle of Attack
AoS - Angle of Side Slip
CFD - Computational Fluid Dynamics
DAT - Data File for YSFlight Aircraft
FL - Flight Level (Altitude Reference)
HUD - Heads Up Display
IAS - Indicated Air Speed
kg - Kilogram (unit of mass)
KIAS - Knots Indicated Air Speed
KTAS - Knots True Air Speed
m - Meter (unit of length)
M - Mach
N - Newton
S - Wing Area
TAS - True Air Speed
YFS - Replay file from YSFlight
Appendix C - Computational Requirements
C.1 - Language
C.2 - Importing DAT Files
C.3 - Algorithms For Derived Parameters
C.3.1 - Velocity
C.3.2 - Acceleration
C.3.3 - Burn Rate
C.3.4 - Angle of Attack and Angle of Side Slip
Appendix D - YSFlight HUD
YSFLight has two HUDs that can be activated in-game.
D.1 - Simple HUD
The Simple HUD is better than the Complex HUD in the following ways:
Fuel quantity percentage is displayed numerically to 2 decimal places
Flap and speed brakes are displayed in percentages
Figure D.1 - Simple HUD
D.2 - Complex HUD
The Complex HUD is better than the simple HUD in the following ways:
Mach and G are displayed to 2 decimal places
Climb/Dive rate numerically presented up to +/- 4000 feet per minute
Air Speed is numerically displayed to the ones digit
Angle of Attack ladder has 5 degree increments
Roll indicator has finer marking resolution
Figure D.2 - The Complex HUD