YSFlight Physics Engine

By Decaff_42

This page is continuously being developed and expanded. Please check back in the future for additional updates!

Preface

This research would not be possible without contributions from some amazing members of the YSFlight Community and the collective pool of knowledge that has been amassed over the years. I would like to specifically note the importance of Waspe414 and Midnight Rambler for their efforts breaking down the YFS and DAT files respectively.


Furthermore Waspe414 (a.k.a UltraViolet) was instrumental in helping identify a method of testing Thrust at different altitudes. Without her help one of the most fundamental properties of YSFlight aircraft performance would not have been unlocked with anywhere near the same level of precision. Her encouragement to pursue further testing and experimentation was highly inspirational.

1 - Introduction

1.1 - Purpose

Creating models for YSFlight has been an enjoyable and rewarding experience for myself and many other members of the YSFlight community. But underneath the vertices and animations, the DAT files control everything about how an aircraft or ground object will behave. Historically I treated DAT files as a secondary part of the addon creation process, something that is only done to ensure weapons are located correctly, fuel burn rates are appropriate and angle of attack inputs will not automatically stall the aircraft. Beyond these simple concerns I did not pay much attention to them until I worked on the F-35 project. In may ways this project highlighted not only the subtleties that can enhance the visual model, but also the immense improvement of tweaking the DAT file parameters until the desired behavior is obtained. The combination of the two, but more so the latter drove the result that I was looking for in the aircraft.


The complication of countless trial and error DAT file edits and test flights drove home the point that there had to be a better way of developing a DAT file. Research in YSFHQ forum topics and community knowledge (Many thanks to Neocon, Midnight Rambler and Waspe414 for sharing their knowledge) showed that while there are some generalities about the effect certain parameters have on aircraft behavior (such as reducing landing distance [REFLNRWY] for improved brake performance), little was quantitatively known and the effect of many DAT parameters were less well known.

1.2 - Inspiration

While the F-35 Project is the largest inspiration for a deep dive into the Science of YSFlight, it was my attempt to make the Boeing 787 model fly realistic ranges that originally sparked my interest in unlocking the mysteries of YSFlight. Once again, generalities such as; "fly above 40,000 feet for best fuel burn rate for ground speed" are a driving force in the civilian YSFlight world. These generalities work, but are by no means optimal. My original goal was to create a tool to read a DAT file and provide a list of speeds and altitudes that would result in a specific range. Such a tool could be used to calculate Virtual Airline routes and could also have YSFlight Combat applications for strike mission planning. Almost as soon as I started to investigate, it became apparent that this project was much larger than originally anticipated.


2 - An Introduction To Basic Aerodynamics

Before diving into a technical examination of YSFlight aircraft performance and handling, a general understanding of aerodynamics is required for the casual reader. This chapter presumes knowledge of fundamental aerodynamic and aviation terms. At the end of this page, have a collection of terms and a brief explanation for some and may be a useful reference for understanding the aerodynamics and aviation terms used throughout this document.


2.1 - The Four Basic Forces

There are four basic forces that act on a powered airplane in flight: Lift, Drag, Thrust and Gravity (a.k.a. Weight). There are many great resources for learning about Aerodynamics, including NASA's website, but some of the most important fundamentals for our research are discussed below in this chapter. To visualize how these forces act on the aircraft, it may be useful to look at the Figure below for a general reference.

Figure 2.1 - A basic free-body diagram of the forces acting on an aircraft in level flight.

2.2 - Lift

Lift is a force generated by the wings and fuselage of an aircraft that acts in an upwards direction on the aircraft. In order for the Lift force to be generated, the aircraft must be moving through the air. This force can be calculated using the air density (rho), aircraft's airspeed (V), wing area (S) and lift coefficient (CL) as seen in Equation 2.1.


Perhaps one of the more interesting parts of the Lift Force, is that it acts perpendicular to the aircraft's body. Figure 4.1 shows the Angle of Attack and how it influences the orientation of the Lift and Thrust forces relative to the Drag and Weight forces while in level flight.

(2.1)

2.2.1 - Lift Coefficient

The Lift Coefficient is a function of Angle of Attack (as you will see in later sections, this parameter is vital for Lift and Drag calculations), and not actually a constant like the name "coefficient" might imply. The exact function to calculate the Lift Coefficient is virtually non-existent for real airplanes and all but the most simplistic models. You can read an excelent summary of the simplest airfoil of them all, a "Flat Plate", from CalTech here. Most airplanes need to be tested in a wind tunnel, on the computer with CFD, and/or real life in order to accurately develop an experimental model for the Lift Coefficient at various angles of attack. Regardless of the experiments designed to determine the specifics of the Lift Coefficient, a typical profile can be seen in Figure 2.2. At any Angle of Attack for which there is a Lift Coefficient, the aircraft can generate a Lift force. However once the Angle of Attack moves beyond the plot, the aircraft will lose the ability to generate Lift and the aircraft will stall.

Figure 2.2 - A generic example of the Lift Coefficient vs Angle of Attack profile.

This profile is typical of a wide range of airplanes and from it, four key parameters that shape it can be identified. It is useful to understand that these parameters can be applied to just about any Lift Coefficient curve regardless of the actual shape.

  1. Zero Angle of Attack Lift Coefficient. When the aircraft is at zero AoA, the amount of lift that can be generated is generally positive. In the profile, this serves as the y-axis intercept. This will be shown as CL0 in equations.

  2. Slope or steepness of the straight portion of the profile is critical for determining the overall profile. A shallow slope will enable the aircraft to have similar lift characteristics at a wide range of Angle of Attack values. A steeper slope will enable the aircraft to generate more lift, which for fighter aircraft, is used to pull g. This parameter will be denoted as CL_a

  3. The point at which the aircraft stalls at positive angles of attack.

  4. The point at which the aircraft stalls at negative angles of attack.


2.2.2 - Simplified Lift Coefficient

The physics model of YSFlight is simplified compared to real life and the parameters from the DAT file need to define the Lift Coefficient profile. A reasonable approximation that can be made, even in real life, is to use a straight line for the Lift Coefficient profile. There is some evidence in the DAT Files to support this hypothesis:

  1. In the 20150406 and 20170314 DAT files for the stock P-51 Mustang, there is a line for the lift coefficient of a propeller blade that lists 4 arguments: two angles of attack and two lift coefficients. This is all the information that is required to mathematically define a line. In addition it specifically states that the Lift Coefficient is approximated by a straight line. It is therefore not a large leap in logic to assume that the overall Lift Coefficient of an airplane in YSFlight is approximated by a straight line.

  2. In every stock DAT file there is a section at the bottom with some important comments. One indicates that REFVCRUS, REFACRUS and REFTCRUS parameters will play a roll in defining Clzero. This directly relates to CL0 as discussed above.

  3. The second comment at the bottom of the DAT files indicates that ClSlope is determined by REFVLAND, REFAOALD, REFLNRWY and REFTHRLD. This is simply CLa as pointed out above.


From these simplifications we can mathematically describe the YSFlight Lift Coefficient function to be a piecewise function with respect to Angle of Attack:

(2.2)

2.3 - Drag

Drag is the force that slows an airplane down and as shown in in Figure 2.1 acts in the opposite direction of the aircraft's flight path. There are many sources of drag, however the total drag on the aircraft can be approximated using Equation 2.3, where the air density is (rho), aircraft's airspeed is (V), reference area is (A) (The more complex a model for drag that is used, different reference areas are used. Since the only area provided in the DAT file is the Wing Area, we shall assume that this reference area is equal to the Wing Area. This is not an unreasonable assumption to make as it is often used in initial aircraft design.) and Drag Coefficient (CD).

(2.3)

2.3.1 - Drag Coefficient

Similarly to the Lift Coefficient, the Drag Coefficient is a property of an aircraft's geometry and a function of Angle of Attack. The Drag Coefficient vs Angle of Attack profile can be approximated by a parabolic function, as shown in Figure 2.3 below. In this Figure, it should be noted that the offset from the vertical axis is exaggerated. Most of the time the lowest Drag Coefficient value is when the aircraft has a zero or near-zero Angle of Attack. Additionally it is impossible for an object to have zero or less than zero Drag Coefficient values. If such a thing were possible, then perpetual motion would be easily attainable as there would be nothing to slow down an aircraft and it would fly forever.

Figure 2.3 - A Generic example of the Drag Coefficient vs Angle of Attack profile.

2.3.2 - Simplified Drag Coefficient

Since it has been determined that YSFlight probably uses a simplified Lift Coefficient profile, it stands to reason that the Drag Coefficient profile would be similarly simplified and use a parabolic approximation for the Drag Coefficient. While Figure 2.3 shows the parabola not centered on the Y-axis, it would make sense from a simplification point of view for this to be the case. Some flight data will be needed to determine the profile of the Drag Coefficient vs Angle of Attack function and it may turn out that there is an offset in the horizontal axis.


Beyond the general simplifications that can reasonably be assumed, there is some evidence in the DAT files that suggests that the parabola is used for the Drag Coefficient.

  1. In the P-51 DAT file in the 20150406 version of YSFlight, there is a line describing the Drag Coefficient for each propeller blade saying that it is approximated by a quadratic function. Two sets of coordinates are provided: "minCd AOAminCd cd1 AOA1"

  2. At the bottom of any DAT File there are two comments describing that a set of variables will control "CdConst" and "CdZero"

2.4 - Weight

The weight of the aircraft is important in a number of ways, but perhaps most critical when determining how much Lift is required to keep an aircraft flying. Weight always acts straight down which makes it easy to handle in equations. As the aircraft burns fuel the total aircraft weight will change. The same is true to dropping or firing weaponry in-game.

2.5 - Thrust

As long as the thrust vectoring or a thrust reverser is not active, the thrust force will always point where the aircraft's nose is pointing. Future analysis will examine how the thrust force changes with respect to these changes, but for now is beyond the initial scope of this investigation.

3 - Flight Data

The most important part of this project is the ability to extract data from YSFlight. While the GUI HUD can be useful for some basic testing (such as fuel burn rates) it falls woefully short in other areas (e.g. Angle of Attack Calculations or Throttle value). In these areas (and more) the .yfs file is a treasure trove of information that can be extracted and converted into a meaningful format.

3.1 - YFS Files

Every flight in YSFlight can be saved into a .yfs file. Essentially this is a long text file with all the aircraft data and event times that can be manipulated. Waspe414's post detailing the different sections and some initial insight into the data included can be found on YSFHQ.

3.2 - Data Quality

When it comes to evaluating data quality there are several things that need to be considered. Some impacts are relevant to each frame\footnote{Just like a video has images (frames) that are spliced together to form a video, data can be thought of in a similar manner.} of data in the YFS file, while some apply to specific parameters that are recorded.

  1. How frequently data is recorded (Data rate).

  2. What resolution the data has for each parameter.

4 - Equation Derivations

Before diving into flying and collecting data, it is important to understand the equations that will be used to extract meaning from the flight data. By performing some initial analysis specific criteria can be developed for flight data and the massive effort involved in flying, collecting, and processing the data can be targeted to achieve maximum results with a minimum of wasted time.

Figure 4.1 - A basic free-body diagram of the forces acting on aircraft in level flight.

4.1 - Free Body Diagram

Looking a Figure 4.1, the net forces acting on the aircraft can be derived as seen below. This allows us to connect the in-depth equations for the lift and drag coefficients (Equations 2.1 and 2.3 respectively) to the overall forces that will be derived from in-flight data. Note that in these equations, the forces from Figure 2.1 are used in their short-hand notation as indicated by the parenthesis next to each force in the Figure and that the horizontal direction is denoted as X and the vertical direction is denoted as Y. M_total represents the total mass of the aircraft, fuel and weapons.

(4.1)

(4.2)

It it is assumed that the aircraft is not accelerating, the equations become slightly simpler. Equations 4.1 and 4.2 will be needed if more complex analysis is required to understand a dynamic aircraft.

(4.3)

(4.4)

Re-arranging Equations 4.3 and 4.4 it is possible to solve for Lift and Drag.

(4.5)

(4.6)

Plugging Equation 4.6 into 4.5, it is possible to develop an equation for drag that is a function of known values.

(4.7)

4.2 - Combine Aerodynamic and Free-Body Equations

By combining Equations 4.7 and 4.6 with 2.1 and 2.3 respectively, the Lift and Drag Coefficients can be solved for directly.

4.2.1 - Non-Accelerating Level Flight

The complete equations for level flight include the acceleration in vertical and horizontal directions and the Lift and Drag Coefficient equations change slightly.

(4.8)

(4.9)

4.2.2 - Accelerating Level Flight

The complete equations for level flight include the acceleration in vertical and horizontal directions and the Lift and Drag Coefficient equations change slightly.

(4.10)

(4.11)

4.3 - Linear Equations

Based on the discoveries inside the DAT files, we can assume a linear function is used to define the Lift Coefficient profile. Therefore the general equation will be:

(4.12)

Plugging in our key parameters as defined in Section 2.2.1 into Equation 4.12, the general form of the Lift Coefficient profile is found.

(4.13)

4.4 - Quadratic Equation

Quadratic equations are more complex than Linear equations, but the algebra can be simplified with our knowledge of what goes into defining the Drag Coefficient in YSFlight. The general form of a quadratic equation is shown by 4.14.

(4.14)

Knowing that there are two pairs of coordinates that define the Propeller Drag Coefficient function, it can be deduced that these coordinates define the vertex and a point on the curve. While it is still unknown if the parabola for the Drag Coefficient is centered on the vertical axis, a general equation for the Drag Coefficient can be derived based on the propeller arguments. In Equation 4.15, the minimum Drag Coefficient is (h) and the Angle of Attack which produces that Drag Coefficient is (k), however the constant (a) still needs to be solved for.

(4.15)

By plugging in the other point on the Drag Coefficient profile, the constant $a$ can be solved for using these steps:

(4.16)

(4.17)

Re-arranging, we find that:

(4.18)

Therefore the general equation for the Drag Coefficient may be written as:

(4.19)

Based on the other parts of the DAT file we may be able to skip solving for (a) entirely. Since only two values are noted, we may even be able to drop the (a_min) value from the equation if the minimum Drag Coefficient occurs at zero Angle of Attack.

(4.20)

4.5 - Smoothing Functions

When working with derived acceleration and velocity data, it may be necessary to implement a smoothing function in order to prevent noise from entering into the final data product.


A common method of smoothing data is to take a moving average of the data. By looking at the raw data immediately around the point in time of interest and taking an average of that data, signal noise can be reduced significantly. When using data smoothing methods, sometimes weightings can be applied to the data points so that points further away from the time of interest have less influence than points closer to the point of interest.

Figure 4.2 - An example of different smoothing methods applied to calculate aircraft acceleration.

The acceleration derivation test results shown in Figure 4.2 highlight several key points about smoothing data.

  1. Initializing the derivation can often result in data points that are vastly different that reality

  2. Generally the more complex the initial derivation of a value the more refined the result

  3. Post-processing a derived parameter may lead to significant gains in overall signal noise reduction.

4.6 - Relative Air Density

An experimental model of how the Air Density changes with altitude is vital to accurately calculating Lift and Drag Forces and Coefficients in the real world. Since the Lift and Drag Coefficients change with Angle of Attack, for a specific Angle of Attack they should not change with altitude. Thus if a series of data points at different altitudes can be collected, then the Lift and Drag Coefficients can be treated as constants that do not necessarily have to be known in order to be manipulated.


With data from any two altitudes the ratio between the two air density values can be determined. The wing area and lift (or drag) coefficient are constants for constant angles of attack and can therefore be set equal to each other when dealing with equations from different altitudes. Velocity and Lift Force can be calculated at each straight-and-level flight condition. In Equation 4.21, the subscript (i) indicates a generic altitude at which data has been collected and the equation can be solved for.

(4.21)

(4.22)

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.23)

By isolating one altitude's air density on one side, we can develop an equation for the second altitude's air density.

(4.24)

(4.25)

4.7 - Calculating Angle of Attack

Calculating Angle of Attack is vital to the lift and drag coefficient calculations, but from the YFS File data it is slightly harder than one might expect. Since this equation relies on derived parameters (velocities) this equation is best for slowly-changing or static Angles of Attack. When the aircraft is rapidly changing Angle of Attack, this methodology becomes less accurate.


To calculate Angle of Attack, the aircraft's velocity must be converted from the Tangential Reference Frame stored in the .YFS file to the Aircraft Reference Frame (See Appendix A for a definition of these to coordinate systems). Going forward V1, V2, V3, will represent the component velocities in the ARF, while Vx, Vy, Vz will represent the component velocities in the TRF. Equation 4.25 shows the general setup for the rotation equation.

(4.26)

This can be expanded to show the rotations about each individual axis and each rotation matrix can be seen in Equations 4.28 through 4.30.

(4.27)

Rotation Matrix about x-axis

(4.28)

Rotation Matrix about y-axis

(4.29)

Rotation Matrix about z-axis

(4.30)

While it is possible to perform three matrix equations to find the final results, the rotation matrices can be combined into a single matrix to make the final equation simpler to perform with a program. Thus Equation 4.26 can be re-written as Equation 4.31. Note the trigonometry short hand for expressing Sine and Cosine where C_a is cos(a) and S_a is sin(a).

(4.31)

From this equation the Angle of Attack as well as the Angle of Side Slip can be calculated:

(4.32)

(4.33)

5 - Testing Methods

This section has been simplified from the PDF version.


Knowing what data can be extracted from YSFlight and what equations to use for gaining meaningful insight, a procedure can be developed to target specific results. Overall the main goal of any testing method and procedure is to minimize the error, one of the best ways to do so is to ensure any procedure is repeatable. Making use of in-game aids like the HUD and auto-pilot controls allows for a higher degree of accuracy and substantially improved repeatability.

5.1 - Flares

Since the .YFS file records event times like flare deployments, the post-flight analysis can be designed such that the flare times can trigger certain data recording events.

5.1.1 - Flare Instances

Since flares will deploy at a specific time, the aircraft's state can be extracted exactly when the flare is deployed. This is most effective for dynamic maneuvers where the aircraft cannot achieve a stable auto-pilot condition. This method is perhaps best suited for instances where the test pilot is performing a maneuver and receives an indication in the HUD that the condition has been met.

5.1.2 - Flare Segments

Another use for flares is to mark beginning and end times of flight segments where data should be captured. This is best suited for conditions where an auto-pilot can achieve a stable condition and the segment can later be extracted from the rest of the flight data.

5.1.3 - Flare Segment Averages

This is primarily used to collect straight-and-level data at specific conditions. The key difference between the flare segment and flare segment averages technique comes post-flight where the data collected for each parameter is averaged for the duration of the segment.

5.2 - Slow Down Drift

Collecting data while in straight-and-level auto-pilot and flying at different speeds is a valid way to collect data at different Angles of Attack. The problem with this method is that it takes a long time to collect the data. In addition it requires the engine thrust to play a role in any Lift and Drag calculations. While this is a known quantity thanks to testing, any addition to the equations is a potential source of error.


One interesting feature of YSFlight is that the auto-pilot will continue to fly the aircraft straight-and-level even if the engine is out of fuel. In this phase of flight only Lift, Drag and Gravity forces are acting on the aircraft. This simplifies the equations for Lift and Drag Coefficients. By setting the Thrust force to zero in Equations 4.10 and 4.11 while assuming zero vertical acceleration with the auto-pilot engaged, the following equations can be formed:

(5.1)

(5.2)

With the horizontal acceleration component remaining in the equation representing the aerodynamic Drag force on the aircraft, a smoothing function should be used to reduce the variability of the Drag Coefficient.


As a consequence of this smoothing function, the rate at which the Angle of Attack changes may influence how well the calculated CD vs AoA trend matches the real values. If the Angle of Attack changes rapidly the lag in the moving average function may skew the data, rather than clarify in this particular situation.

5.3 - Ground Testing

Setting the CDBYGEAR value to zero will make moving on the ground identical to flying at approximately 1 meter off the ground. Thus drag and other useful data can be gathered. There are several flavors of data that can be gathered since auto-pilot won't be enabled.

  1. Influence of aircraft configuration on acceleration. Both increasing and decreasing speed.

  2. Maximum speed attainable with a given aircraft configuration (flaps, spoiler, etc)

    • It should be noted that this is only if the lift generated at zero Angle of Attack does not exceed the aircraft weight.

  3. Influence of altitude on acceleration

    • This will require elevated runway areas so the aircraft can continue to run on the "ground" even when really it is thousands of feet in the air.


One important part of the DAT file that also has to be disabled is the influence of Variable Geometry Wing, as this will influence the lift and drag characteristics.

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.

(7.1)

7.1.1.1 - 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

7.2.2.1 - 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.

(7.2)

7.2.2.2 - 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.

Figure 7.1 - A Series of 9 flight trials were flow at different altitudes and speeds and plotted against a theoretical trend line.

The theoretical model for fuel burn rate is a linear function between the DAT File FUELMILI value at 100 percent throttle and zero burn rate at zero throttle. It was observed that if an aircraft was left on the ground after spawning, no fuel was burned while the throttle was at idle. This model can be described as such:

(7.3)

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.

7.2.3.1 - 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.

Figure 7.2 - Harrier hover thrust values plotted against total aircraft weight provides a highly linear trend.

7.2.3.2 - 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.


Thrust Cutback is when the engine cannot produce the requested thrust (via throttle setting) and instead produces a different thrust value. By categorizing the cutback as a percentage, a simple multiplier can be added to the baseline thrust equation. Thrust Cutback applies to both afterburning and non-afterburning engine operation.

Figure 7.3 - The Thrust Cutback changes with altitude above 4 kilometers and again at 12 kilometers. Between 20 and 36 kilometers a constant thrust cutback has been observed. Above 36km the throttle retards to zero similar to a depletion of fuel and no thrust is produced.

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.

(7.4)

7.2.3.3 - 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.

Figure 7.4 - Afterburner thrust output (corrected for altitude) as a function of throttle.

Even though the data points do not line up nicely on the trend line, they do track linearly along with the trend. Since only a portion of the vertical axis is shown, the difference between the trend and measured thrust appears to be large, but in reality the average error was 0.5 percent, with the peak being 1.5 percent. While not insignificant this error is certainly acceptable and the thrust model should be considered valid.


7.2.3.4 - Thrust Equation

Based on the data collected, the actual thrust output of a jet engine in YSFlight can be calculated using the following equation:

(7.5)

An interesting part of this equation setup is that there is a thrust range between the maximum non-afterburning thrust and the minimum afterburning thrust where the engine cannot produce that thrust.

Figure 7.5 - Thrust vs Throttle for a sample case with THRMILIT = 10t, and THRAFTBN = 15t.

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

There are 4 key DAT file parameters for the performance of a Jet engine in YSFlight:

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

(7.6)

While it is possible that there is a different, velocity-dependent equation for when V < PROPVMIN, it is likely that this region is assumed to be static thrust and thus fall under a simpler equation. Until a firm understanding of Lift and Drag is established, the dynamic thrust model cannot be evaluated.

7.3.2.1 - 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.

Figure 7.6 - Propeller Engine burn rate tests show a deviation from the Jet Engine model using the Stock P-51 DAT File.

A second trial was conducted on the ground with parking brake on. By running the engine at different throttle settings (using the default 5 percent bump form the "q" key) and recording how long it took to burn off a percentage of the on-board fuel, the burn rate was calculated. There was some thought that the units of the FUELMILI parameter might have made a difference. The default FUELMILI parameter for the Stock P-51 is 0.08kg so the pound equivalent (0.176lb) was used and the trial re-run. As seen in Figure 7.7, the results were nearly identical. A different FUELMILI value of 0.5lb was chosen to have something sharply different and the results showed a similar linear trend that was subtly different from the jet engine model.

Figure 7.7 - Propeller Engine burn rate testing on the ground shows the consistent deviation from the jet engine model. All but the last data set used 1579HP.

Based on the data from two different burn rates which do not share a common factor and the trend-line linear equations (thanks to Excel), the equation of the fuel burn rate can be calculated using two data points. (1) The 100\% throttle fuel consumption is ~90.8\% of the jet-engine model. (2) The zero throttle burn rate (as defined by the trend-line) is roughly half the FUELMILI value in pounds per minute.


The table below shows the numerical data collected and represented in Figure 7.6. The last data set shows that the engine power does not impact the fuel burn rates, meaning that FUELMILI is the only DAT impact.

Based on this data, the equation for the propeller engine fuel burn rate can be expressed as a piecewise function:

(7.7)

7.3.2.2 - Propeller Efficiency and Effect on Thrust Output in Hover

The PROPEFCY Dat Variable controls a significant portion of a propeller engine's thrust output. Shown in Figure 7.8, the effect of changing the PROPEFCY value can be seen clearly. At lower PROPEFCY values, the aircraft requires higher throttle values to maintain a hover with identical weights. In addition to the highly linear data, each of the y-axis intercepts is 0 +/- 0.95 (As determined via Excel's Linear Trendline chart options), which for four or five point data sets, is a remarkable similarity. From this we can conclude that the engine produces zero thrust at zero throttle just like a jet engine, even though the in-game animation shows the propeller blades still spinning.

Figure 7.8 clearly shows the highly linear trend between the throttle position and actual thrust output of the engine. With the equation for each trendline displayed in Excel (see the table above) it is possible to extrapolate what the maximum thrust is at for each trial. Of particular note is that the maximum thrust for each PROPEFCY value is simply the PROPEFCY value multiplied with the maximum thrust when PROPEFCY = 1.0. In addition when correcting for the PROPEFCY value, the thrust per HP (the same HP value was used for all trials) is remarkably similar given the subtle variances in the trendline equations and truncated slope parameters.

Figure 7.8 - Using different PROPEFCY values, a low-altitude hover was performed at different fuel weights to test different overall aircraft weights. WEIGHCLN=6t, WEIGFUEL=8t, PROPELLR=2750HP

The effect can be sanity-checked by looking at the Throttle = 50 value for PROPEFCY = 0.6. Follow that line across to the PROPEFCY = 1.0 line and we see that this roughly corresponds to 9600 kg of thrust. As shown in Equation 7.8, this almost exactly is a 0.6 ratio between the two thrust values.

(7.8)

7.3.2.3 - Power vs Thrust At Speeds Less Than PROPVMIN

PROPVMIN is the dividing line in the propeller engine thrust model. Investigating extremely slow speed thrust is difficult with the in-game auto pilots, however hovering is possible with a helicopter. By changing the PROPELLR value, the effect at different fuel weights (and thus throttle positions) can be observed. Once again, a highly linear trend between throttle position and thrust output is observed. In Excel the R2 values were 0.99978 or better. See wikipedia for more information about R2 meaning.

Figure 7.9 - Using different PROPELLR values, a low-altitude hover was performed at different fuel weights to test different overall aircraft weights to see variations due to engine power. WEIGHCLN=6t, WEIGFUEL=8t, PROPEFCY=1.0

7.3.2.4 - 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 7.3.2.3, 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.

Figure 7.10 - The cutback (n) for propeller aircraft as a function of altitude.

Up until 20km altitude (65610 feet), the cutback follows a cubic formula. Above this point the cutback factor changes as a constant throttle setting resulted in a constant climb rate. During the one trial that went above 20km the vertical velocity indicator sat at a constant 1279 feet per minute, indicating that the engine's thrust output was constant (relative to any drag changes) from 20km to 36km (118100 ft).


The equation for (n) can be described as a piecewise function as shown below where (y) is the aircraft's altitude. Note that the constants (a) through (d) can be found in the table below for altitude measured in meters or feet. Without further data the region above 20km will be assumed to carry the last test value (0.06).

(7.9)

7.3.2.5 - Dynamic Propeller Thrust

Until further data is collected to identify Lift and Drag Properties, a detailed verification of the Dynamic Propeller thrust model (as shown in the DAT File comments) cannot be performed and must wait.


7.3.3 - Propeller Thrust

As seen in the data presented in this section (note that the V >= PROPVMIN is assumed and not verified through testing), the thrust of a YSFlight Propeller aircraft can be approximated using the following piece-wise function where (n) is the Altitude cutback factor and (V) is the true airspeed of the aircraft.

(7.10)

8 - The YSFlight Atmosphere

Understanding how key properties change with altitude is fundamental to later analysis of Lift and Drag and how several other DAT Variables effect them.

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

The Average Flare Segment testing method was used to collect data at 1000 +/- 50 foot increments from 1000 to 60000 feet. At each condition, the aircraft was flown at 150 KIAS +/- 0.1 knots. This tightly controlled Angle of Attack and thus the Lift Coefficient Value as desired in Section 4.6. While the GUI HUD speed indication does not provide 0.1 knot accuracy, the relative position of the number and the layout provide a reasonable degree of certainty that this speed was kept within tolerances.


Using Equation 4.25 to compare the air density at each altitude to the 1000 foot test condition the resulting profile showed a similar profile to the Standard Day Model for Air Density.


8.1.2 - Results

To compare the model to the data collected, the model's density for 1000 feet was applied to the collected data point at 1000 feet. This Calibration converted the remaining data points from a normalized ratio into actual values. Figure 8.1 shows the near-exact match between the Standard Day model and the Calibrated data.

Figure 8.1 - YSFlight's Air Density is shown to be nearly identical to the Standard Atmosphere Model's Air Density vs Altitude profile.

8.2 - Speed of Sound

One way to classify the aircraft's speed is by referencing the speed of sound. The aircraft's Mach Number is the fraction of the speed of sound that the aircraft is traveling. Often it is expressed as "Mach 1" or "Mach 0.8". Depending on the Mach Number the aircraft is flying at, there are different effects that can be observed and different properties that need to be accounted for in aircraft design.

(8.1)

n air, the speed of sound can be calculated based on the air temperature as seen in Equation 8.1 (see NASA's website for for further information), where gamma is the Specific Heat Ratio (1.4 for air) and R is the Gas Constant (8.31447 for air). At higher altitudes the temperature decreases so the speed of sound also decreases. In addition to the lower air density, this allows airplanes to travel at high supersonic speeds.

(8.2)

8.2.1 - Mach Number with Altitude

At sea level the speed of sound is 340.3 meters per second or 660 knots. Flying in the Mig-35 Testbed aircraft, the True and Indicated Air Speeds were recorded when the HUD indicated Mach 1.00 at various altitudes. In previous versions of YSFlight the Mach number was rounded to 0.1 Mach, where as in the current version of YSFlight the Mach number is rounded to 0.01 Mach. This provides a greater degree of accuracy for determining when the aircraft is operating at Mach 1.

Figure 8.2 - Mach as a function of KTAS and KIAS at different altitudes.

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)

(8.4)

8.3 - Wind

YSFlight has the capability to introduce wind into the simulation. The wind is either set by the server host, or in the pre-flight setup screens. No matter what altitude an aircraft is flying, the wind will always influence their flight path. In the image below, the aircraft is flying with the straight and level auto-pilot engaged and no rudder trim. The purple arrow shows the aircraft's heading and the orange arrow shows the aircraft's actual flight path.

Figure 8.3 - Smoke trails show where the aircraft has traveled. With 16 kt of wind, this aircraft had a significant angle between the flight path and heading.

8.3.1 - Wind Influence On Takeoff Roll

During takeoff roll, the influence of wind is noticeable. On break release, no influence can be felt in the handling of the aircraft, but as the takeoff continues the influence of wind is more noticeable. This impact is especially felt with crosswinds, no matter how strong they are.

Figure 8.4 - As takeoff roll reaches higher speeds, the influence of wind becomes greater until it reaches a steady value.

By converting the aircraft's forward velocity into a percentage of MANESPD2, and the aircraft's sideways velocity into a fraction of the wind's velocity, the wind's influence can be seen to begin around 25 percent of MANESPD2 and gradually fill in until the full influence of the wind is realized before being abruptly capped at the actual speed of the wind. It is also important to note that MANESPD2 is where the maximum effect of wind is first felt.

Figure 8.5 - Wind influence starts at approximately 25 percent of MANESPD2.

(8.5)

In excel, a linear trend line was fitted to each altitude's data set and several trends became apparent. First, the y-axis intercept (b) was always near-zero. This makes sense as at zero meters per second there should be zero knots. The fact that different values were generated shows that there is some minor error in the data collection, likely due to the aircraft not exactly flying at the recorded IAS. The second observation which is most obvious with a plot is that there is a linear relationship between the slope of the trend lines when plotted against altitude. Rather than plot the unforced trend line values, we can force the y-axis intercept to be zero to match the known boundary condition where zero meters per second is zero knots. The forced trend line was also a very close match to the data set for each altitude.

8.4 - Converting Between Meters Per Second and Knots Indicated Air Speed

Knowing the Indicated Air Speed (IAS) of an aircraft in YSFlight provides significant information for analytically purposes. Many performance metrics of an aircraft are tied to IAS, such as angle of attack in straight and level flight which directly ties into lift and drag.


Although speed is recorded in knots in the YSFlight HUD or instruments, position data in the .yfs files are recorded in meters. Thus to reduce conversion errors (which have plagued previous iterations of this conversion), it is important to translate directly from meters per second to Knots IAS (KIAS).


A series of flights were flown at different altitudes and airspeeds to correlate the in-game True Air Speed (TAS) and IAS. Using the Flare Segment averaging method good velocity averages were obtained in meters per second so the direct correlation between targeted IAS and .yfs file meters per second was possible.

Figure 8.6 - Airspeed to meters per second calibration data sets at different altitudes between 1000ft and 50000ft. The high linearity shows that the data collected did not have any large errors.

You can see the data points gathered in this testing in Figure 8.6. As the altitude increased the highly linear relationship between IAS and meters per second changed as the slope of the linear line became smaller. It is expected that the relationship is linear because the two velocities are simply being converted from one unit to another. In absolute speed, the following conversion relates meters per second to knots:

From this data, a plot of the forced trend line slopes for each altitude can be created and is shown in Figure 8.7 below. The is a highly linear line which another trend line can be fitted to. To help bound this final trend line, the y-axis intercept can be fixed at 1.94384 because at zero altitude there is no difference between IAS and TAS. Thus the relationship between meters per second and KIAS is the nominal conversion between the two units as shown in Equation 8.5.


Putting together the equation for the forced trend line for the slopes, we can derive a relationship between KIAS and meters per second as shown in Equation 8.6 where V is velocity in meters per second and (A) is Altitude in meters.

(8.6)

As Figure 8.7 shows, there is some deviation between Equation 8.6 and the slope data, however the differences are relatively minor and will serve our purposes for most applications. In situations where precise KIAS values are needed, a linear interpolation of the forced m values from the table above will be the most accurate way to derive KIAS.

Figure 8.7 - The highly linear relationship between the forced slopes of m/s vs KIAS trend lines and altitude allows us to develop a simplified equation to related m/s and KIAS at all altitudes.

A final check of the data sets gathered for this analysis was performed to verify that the Knots TAS (KTAS) values were lining up with the expected conversion (Equation 8.5).

Figure 8.8 - There is a purely linear relationship between KTAS and m/s in YSFlight.

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)

When an aircraft is in a non-accelerating condition the net force in the x axis will be zero and we can re-arrange Equation 10.1 as shown in Equation 10.2:

(10.2)

This non-accelerating condition is not something that can easily be obtained in YSFlight. Although a straight and level auto-pilot exists, it has some variability with it as the throttle oscillates to maintain the desired speed as close as possible with an integer throttle value. Conversely if trying to reach a maximum speed with constant throttle or slow down to a throttle setting, theoretically a state an be obtained where there is no more acceleration. The issue with this condition is that it takes a long time to reach. Some testing has shown upwards of 30 minutes spent getting to this state, thus some small acceleration must either be accounted for, or accepted as error for using the no-acceleration assumption.


The net force will be zero when in a non-accelerating condition:

(10.3)

When accelerating the total drag will either be greater or less than the thrust force (depending on whether slowing down or accelerating) and the following will be true.

(10.4)

10.1.1 - Calculating Velocity and Acceleration

The .yfs file records the x, y, and z position of the aircraft's center of gravity. In order to calculate the acceleration an aircraft is experiencing, the velocity must first be derived. This is done by calculating the aircraft's distance traveled and then calculating velocity with the following equation:

(10.5)

Compared to other methods of calculating the aircraft's velocity using higher point differential methods, this provides a smoother output, mostly because the time-step between frames of .yfs file data is irregular and the assumption behind many of the Finite Difference methods of numerical derivation is that the time-steps are regularly spaced. As you can see in Figure 10.1, the noise that this caused would invalidate any precise measurements of net force on the aircraft.

Figure 10.1 - The noise in the 5 point FDF calculation method comes from the irregular time-steps in .yfs replay files.

While the velocity data for the sample test event shown above appears perfectly smooth compared to the alternate method of calculation, this is not the case, as the acceleration calculation will show. Three methods of calculating the aircraft's acceleration magnitude were used to evaluate which provided the smoothest data.

(10.6)

(10.7)

(10.8)

Unfortunately all of these had some noise in them, but this is expected when dealing with a second order derivative. The greater the gap between time slices, the quieter the resulting derivation was. In order to smooth this data into something that could be used with less error introduced into equations relating to net force, a 15 point average was applied to the data set. As you can see in Figure 10.2 below, this produces the clearest signal. By taking the average of the data calculated with Equation 10.8, a very smooth signal was obtained. The window over which the average was taken was expanded to 20 data points, however this had no appreciable change in data quality.

Figure 10.2 - A 15 point averaging method provides the smoothest acceleration data.

While the smoothing works for the majority of the data set, the initial few seconds of data are compromised as data is the backward-looking methods for velocity and acceleration derivatives going through initialization. For some methods of testing, the errors that this produces can be accounted for by simply delaying the execution of whatever maneuvers are being tested.


10.1.2 - Drag Coefficient

While the velocity must be calculated to subsequently calculate acceleration for the net force calculation, velocity is also important in calculating the Drag Coefficient.

(10.9)


(10.10)

Knowing the net force, we can re-arrange Equations 10.1, 10.4 and 10.9 as such:

(10.11)

This can then be re-arranged to isolate the Drag Coefficient on one side of the equation.


(10.12)

10.1.2.1 - Drag Coefficient Calculation Errors

While it is vastly simpler to only calculate the final velocity, rather than calculate, apply smoothing to and obtain accurate acceleration data, the impact of ignoring acceleration in the drag coefficient calculation needs to be understood. This can be done rather simply by looking at the impact of changing velocity, thrust, altitude (air density) and aircraft mass when the drag coefficient is calculated to omit a small acceleration in equation 10.12.


When changing the indicated variable, different accelerations between 0 and 0.01 m/s^2 were injected into the equation. By comparing the hypothetical drag coefficient to the drag coefficient calculated without the acceleration for each variable change, a delta can be determined and a percent error calculated.

Figure 10.3- An analysis of Equation 10.11 shows that the least error will be introduced with a lighter aircraft and a higher thrust.

These results are important to note as it sets a requirement to account for acceleration, despite flying each test sequence with as little acceleration possible for the period of time where measurements should be taken. Based on initial testing, the final ground run acceleration can mostly be kept to under 0.005 m/s^2. At the worst-case conditions analyzed here, omitting the acceleration from the Drag Coefficient calculation would result in a 0.7 percent error and a best-case 0.4 percent error. However looking at the lightest the aircraft could be made and the lowest thrust possible, an error as large as 2.5 percent would be introduced by omitting acceleration from the Drag Coefficient calculation. This analysis shows that accounting for small acceleration is critical to the overall accuracy of the drag coefficient measurement. In addition, doing so provides more flexibility for data collection as a wider range of aircraft weights, throttle settings can be used without significantly adding to the error.

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

Investigating the weapons in YSFlight can provide insight into how YSFlight works.

11.1 - Weapon Weights

Initially it was thought that performing hovers at various weapon and fuel states would provide the data needed to calculate how much different weapons weight. Initial testing revealed that the difference in throttle values recorded in YFS files caused significant errors in the calculated thrust. To achieve a higher weight resolution, the test was changed so that the aircraft was overloaded with fuel on the ground and had to burn off fuel in order to begin to hover. This method proved much more accurate thanks to the fuel meter on the Simple HUD reading to two decimal places. The point at which the aircraft's acceleration is 1.00g (determined via the Complex HUD), the weight of the aircraft is equal to the thrust, and thus a simple subtraction can be used to determine the actual weight of the aircraft.

11.1.1 - Equations

Determining the weight of the aircraft is vital. Using the fuel weight and a static (known) thrust, the difference between aircraft weight and thrust will be the weight of the weapon(s). Using multiple weapons of the same type will help average out errors.

(11.1)

(11.2)

(11.3)

11.1.2 - Error Reductions

One interesting thing that was noticed using some of the data was that if the fuel percentage at 1.00g was used exclusively, the weights were consistently underestimating weapon weights (it was assumed that 500 pound bombs weighed 500 pounds). Therefore the fuel percentages at 1.00g and 1.01g were averaged together. It was noted in the mach vs altitude trials that the airspeed difference between Mach 1.00 and Mach 1.01 were several knots. Knowing that YSFlight rounds the HUD values, by taking the average between the 1.00g and 1.01g, we can get a truer reading on the actual point where the aircraft takes off.

(11.4)

11.1.3 - Results

There were two odd results found during these trials. First was the 250 pound bomb weighing 240 pounds. The second was that the AIM9X missile weighed nothing. After communicating the results for the AIM9X weapon class, Soji updated the weight class in the latest test builds of YSFlight so that the AIM9X weighed the same as an AIM9.


The following notes apply to the data presented in the table below:

  1. FUEL indicates the weight of an empty external fuel tank.

  2. FLR indicates the weight of the flare pod that stays with the aircraft even after the flares are fully dispensed. Flares themselves do not weight anything.

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

Using the UH-60 test bed, B500 and B250 weapons were dropped at 500 foot increments. Using the Bullet record of the replay file to determine launch time and altitude, a replay of the flight was reviewed to determine when the weapon hit the ground. By monitoring the F4 view, the time just before and after impact was determined. The average of these two times helps reduce potential error in the time calculation.


In order to obtain a baseline to compare against, the theoretical time it would take an object to fall the same distance without drag was calculated. From the basic kinematic equations, the free fall time calculation was simplified as the tests had no starting velocity.

(11.5)

The results were astonishing. With twenty data points from the in-game tests, the friction-less model matched nearly every single measurement. The average difference between the measured and modeled free fall times was 0.0027 seconds. Given the 0.05 second interval between the two frames of data before and after the impact, this level of matching is quite impressive. The largest difference between the measured and modeled time was 0.027 seconds. The results of the tests can be found in Figure 11.1. This high-degree of similarity leads to only one conclusion. 500 and 250 pound bombs in YSFlight are modeled with simple kinematic equations from Physics 1.

Figure 11.1 - B500 and B250 free fall time vs friction-less model.

11.2.1.1 - Finding B500/B250 Landing Spot

Given the starting position, velocity and orientation of the weapon, we can calculate exactly where the weapon will fly in-game. From parameters that can be derived as shown in Section 3, the pitch angle and initial velocity can be converted into the vertical and horizontal velocity components at the time of weapon release.

(11.6)

The total flight time can be solved using Equation 11.7.

(11.7)

and the result can be used to figure out how far down-range the weapon traveled.

(11.8)

When combined with the known release point position, flight path angle and bank angle, the final coordinates can be calculated. It is assumed that the Y coordinate will be zero as most maps are flat, but this obviously breaks down near elevation grids or when striking a raised ground object.


11.2.2 - B500HD Flight Profile

he 500 pound High-Drag bomb has interesting flight characteristics in YSFlight. Using the same 500 foot incremental drops from the UH-60 test bed, the free-fall times were calculated in the same manner as the B500 and B250 tests.


The interesting part of the High Drag Bomb is that it does not fall in an ideal friction less manner. At some point the bomb must reach a terminal velocity, much like a human sky-diver. If the terminal velocity (V_T) can be found, then a lot of information can be determined. Assuming the bomb is in a purely vertical free fall, then the force of gravity pulling the bomb downward will be the same magnitude as the drag force. This leads to a deceptively simple equation:

(11.9)

To find the terminal velocity, the last portion of the bomb's flight needs to be examined. We cannot directly measure this. However with the ladder of release altitudes from 500 to 10000 feet, we will assume that the first part of the latest free fall is the same as the entirety of the previous test altitude's free fall. Thus the difference in time and altitude can be assumed to be the last 500 feet of its flight.

(11.10)

by examining the differences between the times, an interesting trend appeared. After the 4500 foot altitude drop, each drop afterwards had a 500ft time of between 2.0 and 2.1 seconds. Taking the average altitude difference (152.58m) and average time delta (2.0375s) we can calculate an average terminal velocity of 74.88 meters per second.


With this knowledge, let us return to equation 11.9 and expand what the two forces are.

(11.11)

(11.12)

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.

(11.13)

(11.14)

From results table in Section 11.1.3, we find that the mass is 226.8 kilograms. g is the acceleration of gravity 9.81 m/s^2. Since we are looking at the last 500 feet of the flight, we shall assume that the air density is slightly above sea level and about 1.2 kg/m^3.


Putting all these constants into the equation, we find that:

(11.15)

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:

(11.16)

11.2.2.1 - Calculating B500HD Flight-Path

Calculating the flight path and thus optimum release angle/speed/altitudes for delivering a 500 pound High-Drag bomb on-target is no easy task. Since we know that the bomb's orientation will change, this changes the drag force direction relative to the outside world since the drag force will act opposite of the velocity vector. An iterative approach is required in order to calculate the position over time and thus the downrange travel of the weapon before impact.


Since the drag force will constantly change, a net force needs to be determined for the bomb in flight in order to then get the accelerations and thus change in velocity and flight path angle. The component forces in the horizontal and vertical directions will be critical to solving for the change in velocity.

(11.17)

(11.18)

Substituting in the Drag Equation from Equation 11.16:

(11.19)

Knowing the mass of the bomb, the acceleration in x and y directions can be calculated. When combined with the iteration time-step (dt), a change in velocity and position can be calculated. From these final velocities, a new flight path can be calculated for the next iteration.

(11.20)

(11.21)

(11.22)

In the current iteration, the next velocities need to be calculated in order to determine the change in flight path angle.

(11.23)

(11.24)

When performing the iterations, I prefer to use a while loop to find the point in time where the weapon will reach y=0, i.e. hit the ground. In addition, using relatively small time steps for the flight profile is key to reducing errors. Since there is a decent amount of assumptions, simplifications, and other built-in error sources, an extremely small time step is not advisable because the errors will compound and throw off the accuracy of the calculation. However on the flip side of things, a large time step is inadvisable because you loose fidelity. In this latter case, thing of a circle being approximated by a n-sided polygon. The fewer sides to the polygon the less accurate it represents a true circle.


When evaluating a new situation, I try to use a few different dt values to experiment a little. Typically I look for dt values between 0.1 and 0.5 seconds, however for a release from high altitudes I may exceed 1 second.


10.2.3 - Aiming B500HD In-Game

Figure 11.2 - B500HD flight path

With the ability to calculate the flight profile of the B500HD, a lot of the guess work can be taken out of aiming this weapon in-game. Given pilot-observable conditions (flight path, altitude, and speed), the eventual down-range distance and angle to impact point can be calculated. Knowing where the bomb hits the ground, in the example of the flight shown in Figure 11.2 this is 1160m down-range, the angle below the release aircraft's velocity vector to the actual impact point can be calculated.

(11.25)

In the example case, the bomb was released in a 30 degree climb, and the angle between the release point and the impact point is 23.3 degrees. Thus, at the time of release the pilot could aim at a point 53.3 degrees below the velocity vector and that is where the bomb should hit.

Figure 11.3 - B500HD flight path from a diving release.

Now admittedly this is not very useful to the pilot because the HUD pitch ladder does not extend 50 degrees. But if we consider a diving attack from medium altitude, such as 5000 feet or so, at a relatively steep angle, this angle between the velocity vector and the impact point will be much smaller. While Figure 11.3 has uneven scale axes, we can see that in this example the aiming point would be slightly below the velocity vector:

(11.26)

11.3 - Weapon Damage

11.3.2 - Blast Radius

12 - Miscellaneous DAT Variable Influence

Appendix A - Definitions

Before a comprehensive discussion of Aerodynamics or Physics related to flight can be had the proper terminology must be defined to ensure that concepts are communicated.

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.

Figure A.1 - The Aircraft Reference Frame axes overlaid on an airplane. Image credit: R. Whitford Design For Air Combat. Jane's Publishing Company Limited, London, England, 1987.

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.

Figure A.2 - A diagram of Pitch Attitude, Angle of Attack, and Flight Path Angle, referencing the Aircraft Orientation (red) and Flight Path (blue).

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:

(A.1)

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:

(A.1)

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.

(A.2)

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.

Figure A.3 - Tangential Reference Frame on the surface of the Earth. Image Credit: The-Crankshaft Publishing, "Reference Frame Definitions (GPS)", What-When-How. Offline.

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

For those not familiar with YSFlight, Aviation, or Aerodynamics, there are many acronyms and shorthand notations that are used in this document. While some terms are defined in Appendix A with greater detail, this list is brief.

  • 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

In order to crunch through an entire flight's-worth of YFS file data, a custom program needs to be written to extract meaningful data. When using Flare Segment methods (especially the Flare Segment Average method) of testing, the computational requirements are significant and trying to perform the tasks manually in a spreadsheet program becomes virtually impossible from a labor and time perspective. By investing in a comprehensive tool early and adapting with additional modules, expanding and updating it when discoveries are made, and using it often, significant time can be saved. At the end of this project the final code will be a complete program that others can use for their own analysis.


This chapter covers the language, requirements and execution of different features within the code.

C.1 - Language

Python is a common language that has a number of benefits, including multi-platform execution, built-in GUI creation and an easy to understand formatting and syntax. Although multiple versions of Python are currently used, Python 3.4.2 was chosen due to the author's familiarity with the language.

C.2 - Importing DAT Files


The DAT file for any aircraft contains the information we need to translate the YFS output into meaningful data. Since each line of the DAT file has an 8 character Variable name, this can be used to trigger key actions. A class for storing and handling DAT file information should be created. Upon creation it should generate a dictionary

C.3 - Algorithms For Derived Parameters

For many of the algorithms used to calculate derived parameters, multiple frames of data need to be looked at. In this section the subscript $i$ will indicate the current frame, (i-1) the previous frame, and (i+1) the next frame. This generalization provides all the indications we need for determining many parameters and only restricts the first and last frames from analysis. With proper handling this is a trivial constraint.

C.3.1 - Velocity

Since the position information in all three coordinates is known to a millimeter, the aircraft's velocity can be calculated using a 2-point First-Order Central Difference Numerical Differentiation Method.[11] This method has less error than simply looking ahead or behind in the data and taking an average of that period and takes nearly the same processing power, essentially giving better results for free.

(C.1)

In an attempt to figure out a better method, a 4-point first order central difference method was tried. It was thought that the increase in the number of points would smooth out any bumps and produce a better result. This was not the case and the 2-point method shown above remained in use.

C.3.2 - Acceleration

Originally the acceleration was going to be calculated with a 3-point second order central difference numerical differentiation method shown below.[11]

(C.2)

This method calculated significant errors (upwards of 1000 percent in some situations), so a simplified equation was used to greater success.

(C.3)

C.3.3 - Burn Rate

Using the Trapezoid Rule, a simple integration of the burn rate will produce a rough estimate for the change in aircraft weight since the last frame of data.

(C.4)

C.3.4 - Angle of Attack and Angle of Side Slip

Early implementations of the Angle of Attack calculation as shown in Section 4.7 had strange results including Angle of Attack values decreasing over time even with constant in-game Angle of Attack values. A temporary work-around using the Pitch Angle for level-flight Angle of Attack was implemented before the error (swap of Pitch and Yaw Angles in the raw YFS data) was identified and corrected, resulting in an elimination of the errors seen in earlier versions of the program.

Figure C.1 - Analysis performed on part 1 of the flight to determine air density vs altitude (see Section 8.1) the test data was collected at 5 degrees Angle of Attack. In test periods the altitude was adjusted. The spikes in Angle of Attack, followed by rock-steady 5 degrees Angle of Attack show that none of the previously seen errors are present in this calculation.

Rather than use a download-able module such as Numpy to perform the matrix multiplication required to calculate the Velocities in the Aircraft Reference Frame, a custom code was written instead. This allowed pure vanilla Python 3.4.2 to complete all the calculations and thus minimizes future user requirements to deal with installing additional Python modules.

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

References

  1. Decaff_42. YSFlight Aircraft Performance Analysis: Calculating Angle of Attack Using Euler Rotations, 2016. https://www.sites.google.com/site/ysdecaff/ysflight-scientific-research

  2. Decaff_42. YSFlight Scientific Research. https://www.sites.google.com/site/ysdecaff/ysflight-scientific-research

  3. R. Whitford Design For Air Combat. Jane's Publishing Company Limited, London, England, 1987.

  4. The-Crankshaft Publishing, "Reference Frame Definitions (GPS)", What-When-How. http://what-when-how.com/gps-with-high-rate-sensors/reference-frame-definitions-gps/

  5. Waspe414, "[Request] .yfs file parameters", 25 August 2015. https://forum.ysfhq.com/viewtopic.php?t=8007#p90235

  6. Midnight Rambler et all, ".DAT Variables". https://forum.ysfhq.com/viewtopic.php?t=1772

  7. D.~Hull. Fundamentals of Airplane Flight Mechanics. Springer, 2007. pg 45.

  8. Decaff_42. The YSFlight Atmosphere, 2016. https://www.sites.google.com/site/ysdecaff/ysflight-scientific-research

  9. Decaff_42 "YSFlight Aircraft Performance Analysis: Understanding DAT Variables & YFS File Data", 2016. https://www.sites.google.com/site/ysdecaff/ysflight-scientific-research

  10. Sandra May. "What is Aerodynamics", 2017. https://www.nasa.gov/audience/forstudents/k-4/stories/nasa-knows/what-is-aerodynamics-k4.html

  11. Amos Gilat and Vish Subramaniam. Numerical Methods for Engineers and Scientists, 3rd Edition. Wiley, 2013.

%2B