Buckaroo's Flightgear Projects
Guide To YASim: Contents

Troubleshooting YASim Solutions

By Gary "Buckaroo" Neely


Getting a good YASim solution can be difficult. Some configurations solve with no trouble, particularly if the CG is correct, the model is simple, and the developer is meticulous. Others seem to willfully fight you. The following are situations I've often encountered when dealing with problematic FDMs, and my thoughts on how to fix the problem.


CG Location

Before diagnosing any YASim solver issue, make sure that your CG is reasonable. For a YASim aircraft, a CG in the 25-36% MAC range works best. YASim tends to be happier with solutions using CG's in the aft range. See Weight and Balance for more information.


Large Lift Ratios

If the solver gives you a lift ratio approaching 150, it's a good idea to re-examine the FDM. If lift ratio exceeds 200, the FDM is unlikely to have reasonable flight characteristics. When you see these high lift ratios, the solver is telling you that the aircraft's thrust, drag and lift results are not well balanced, resulting in a solution that is forcing the aircraft to be very "slick" to compensate for being under-powered or other configuration issues. In my experience, the problem is usually caused by choices for approach, cruise, wing incidence, and airfoil stall and camber settings. Sometimes it's caused by mistakes in engine settings.

Most conventional general aviation aircraft should have lift ratios under 100, in the 60-90+ range. A high-performance, fast or slick airframe might go over 100. It's been my experience that high-lift aircraft will have very low lift ratios, in the 50-80 range, with high drag coefficient values in the 20-40 range. These numbers will look extreme, but real-life high-lift aircraft often are extreme configurations.


"Insufficient elevator to trim for approach"

You'll see this a lot when building YASim FDMs. YASim is griping that it doesn't have enough elevator authority to meet the necessary approach profile. Should you increase the lift attribute on your hstab elevator flap? Maybe, but there are other things to check first.

An elevator usually needs a lift attribute ranging from 1.3 to 1.6. If you can get good solutions using such values, you're probably OK. But if the elevator lift needs to be well beyond this range, then there may be other factors causing the problem.

CG is the first thing to check. If you tweaked geometry positions or weights, CG may have changed. Check that your CG is where you think it should be. Is it in a good range? A forward CG requires more elevator authority. An aft CG requires less, but might also make the aircraft unstable or difficult to fly. One test is to research the real aircraft's stall characteristics and make certain your simulation stalls in a similar fashion.

Check your geometry. Melchior's YASim importer for Blender is useful for viewing this at a glance. Are the flight surfaces where they should be? A single wrong number or inverted sign can place a flight surface in a weird position and invalidate the FDM.

Approach angle of attack is another value that can cause this problem. A high approach AoA needs a lot of elevator authority to hold it there because it's fighting the wing's large negative pitching moment. This may be beyond the design configuration of the aircraft. Make sure your approach values are reasonable and not too great. Look at photos of the aircraft on approach and try to estimate their angle of attack with respect to the glide angle. High-lift aircraft and those with very effective flaps will often have surprisingly low approach angles, sometimes even negative.

Check other approach settings. Flaps should be set as fully deployed (1.0), fuel should be some smallish value like 0.2, propellers set to full-fine (1.0), and throttle should be be appropriate to hold the approach attitude, perhaps a low to mid power setting 0.2-0.4.

High-lift configurations can also give "insufficient elevator" headaches. I cover this situation in more detail further down in this guide.

If you get into "insufficient elevator" problems, try the above ideas before ramping up elevator flap lift. And whatever you do, don't start adding "effectiveness" values on your horizontal stabilizer to get a solution. All that does is add drag to your stabilizer. It might give you a solution, but it won't address the core problem.


High-Lift Configurations

High-lift or high-camber airfoils cause special problems for YASim. Airfoils with generous stall numbers or airfoils with high cambers (0.15 or more) can make it difficult to get good approach elevator results. This is particularly true in aircraft with airfoils having high camber, high stall configuration values, and high-lift flaps. Sometimes these configurations solve without much trouble, while others refuse to play nice. Just when you think you've got a configuration that works, you fly it and find you can't stall the plane no matter what. But re-configuring it to enable by-the-book stalls requires huge elevator authority which compromises other flight behaviors. It can be maddening.

When checking stall behavior, first make sure the real aircraft really can achieve a stall. Many won't stall by design. With the stick all the way back, the aircraft simply mushes downwards. Before fighting YASim's high-lift issues, make sure you really have to.

You can set extreme values on elevator lift to compensate, but this solution usually yields an elevator that has way too much authority for cruise. The plane will be sensitive in pitch, making it twitchy and fatiguing to fly. Even small elevator inputs will yield big pitch responses, so an auto-pilot will have trouble holding pitch. It's like using a sledgehammer to drive a small nail. The AP can't refine a solution and the aircraft will start porpoising. This has been called "spazzing" in the Flightgear forums. The problem is too much elevator authority.

Airfoils have very different responses for drag, lift, and moment as a function of angle of attack and flap deployment. These are major considerations for choosing a particular airfoil. Unfortunately YASim uses a kind of one-size-fits-all approach that doesn't allow a lot of tweaking of airfoil effects. The only factor we can manipulate to any degree is lift using the stall and camber settings, and even that is not very refined. If I could change a single thing about YASim, it would be to add the option to use tabular airfoil data for flight surfaces. Flap configuration is particularly simplistic.

If you have the data and are willing to learn another FDM scheme, consider using JSBsim when these problems become insurmountable in YASim. But if you don't have the time or inclination, there are still some options:

reduce camber
reduce stall alpha
reduce flap lift
move the wing slightly

"Camber" as YASim defines it is easy to find if you have airfoil data, but that doesn't mean it's realistically used at all possible values. Camber is a primary factor in the high-lift problem, so a reduction in camber is likely to make the task easier. Keep in mind that real wing CL values are 10-20% less than airfoil section values due to spanwise pressure gradient effects. For most GA aircraft, consider using Camber values 15-20% less than those derived from airfoil CL data. Just don't reduce camber so much that you lose the high-lift characteristics you are trying to simulate.

Try reducing stall characteristics such that the airfoil stalls sooner, or has a different stall width, or even reducing the value for peak below the default 1.5. Play with reducing stall AoA first, as this tends to give better results. Frankly, an airfoil with a high-lift camber, a high critical stall AoA, and a gentle fall-off at peak is probably too good to be true. The negative aspects of such an airfoil (monstrous drag, huge moments, etc.) may not be adequately simulated in YASim. You're dealing with a method that tries to simulate airfoils with a somewhat limited algorithmic approach, so you should feel free to tweak everything you've got to get something that matches real flight profiles.

Reducing flap lift may help. Flaps alter lift and drag, but they should also change the effective incidence and camber of the wing. In addition, flap lift and drag is often not linear with flap deployment. These factors are not represented in YASim. (Flap simulation is #2 on my list of things I would change in YASim, just behind using tabular data for surface sections.) In many flap cases, especially with split flaps and high-lift configurations, flaps are mostly drag, and lots of it. In YASim, flap lift has a great effect on the moment produced by a surface, but flap drag has no effect on YASim moment calculations, so try reducing flap lift and adding flap drag.

Moving the wing slightly along the x-axis (waterline) may relieve some of the problems. YASim places lift forces rather far back on the chord (33%), so moving the wing forward by up to 8% of the mean chord may help such issues. Don't be reluctant to change geometry if such a move can make a better FDM. When moving a flight surface, remember that you are shifting mass distribution, so check your CG and re-balance.

In the end, all you can do is play with the numbers and fly the simulation. Don't be a slave to the numbers or someone's notion of the "right way" to do something. If you get something close to the behavior of the real thing, you win.


"My Plane Won't Fly Fast Enough!"

Developers sometimes have difficulty getting their YASim aircraft to reach the desired maximum flight speeds. Usually this is a configuration problem, but sometimes it's a YASim limitation or a misunderstanding of exactly what maximum speed means.

The first thing to check is the aircraft's cruise settings. In my opinion, YASim "Cruise" speed is best used to represent the aircraft in sustained level flight at maximum continuous power at an appropriate cruise altitude with all flight surfaces clean and gear retracted. Throttles should be wide-open, flaps fully retracted, gear up, propellers full-fine. Yes, props at full-fine, maximum RPM. This is not an economy cruise or noise-reduction configuration, it's a flat-out, max power, best-the-plane-can-do configuration.

Next, check that the cruise speed setting is in KTAS appropriate for that altitude. Not KIAS. This is very important and often misunderstood. When you do your test flights at altitude with full power and read off the KIAS numbers, remember to adjust for altitude and temperature to get KTAS. You might find a "slow" plane is actually doing just fine.

Supersonic speeds: YASim was originally built to simulate conventional general aviation aircraft. It wasn't designed for supersonic (or even transsonic) aircraft. YASim will allow you to fly at supersonic speeds, but here the simulation falls to game levels. I cover some of these issues elsewhere. For this discussion, if you need to go supersonic and high-fidelity flight isn't the main concern, check that your jet engines are producing the necessary thrust, and in particular look at jet exhaust speed. See my discussion on YASim jet engines for more information.


"Solution failed to converge after 10000 iterations."

Don't panic. You'll likely see this a lot until you've gained experience with YASim. This result tells you that you need to go back to the basics and check all the fundamental stuff. With a reasonable configuration, good geometry, good engine definitions, reasonable attributes, and a reasonable CG, YASim can usually give /some/ solution, even if it's whacky or tells you it doesn't have enough elevator for an approach.

There are a couple of things to check if YASim stubornly refuses to cooperate. The most basic is to make sure you've got a properly configured XML file. Make sure you have no weird characters that the XML parser might hate. (Hyphens in comments can be a problem.) Make sure all the primary required components are present. YASim will usually gripe if they're not, but some errors aren't trapped. Also make sure you've got a control input sub-element for elevator trim in your hstab configuration. That one is often missed by people new to YASim and will give mysterious errors.


 

YASim Singularities

You may have a perfectly good flight model with all characteristics tweaked nicely, and then discover that your infomation had wing incidence set too low. You add a degree to incidence, and suddenly YASim goes crazy and can't find a solution. The solver spews numbers that aren't even close to what you had before. Welcome to what I call YASim "singularities".

I often encounter situations where the change of one value, say a degree of wing incidence, creates or magnifies gaps where certain mid-range approach aoa's won't solve. I can make it solve with a very low approach aoa, say 2 degrees, or a much higher aoa of, say, 7, but the middle ranges won't solve, even though I might have had a great solution at 5 degrees aoa with an wing incidence 1 degree less.

YASim is a complex mathematical model with lots of algorithms, lots of educated guesswork, and yes, lots of fudges. There are many ways in which it can get "lost" and return junk, even if your inputs are absolutely good. The math falls into spaces where the numbers go out of range. The worst part is that you don't know where this is happening.

Sometimes these situations can be solved with by applying a little aerodynamic logic. Think about your configuration, what you're trying to tell the plane to do. Sometimes the situation seems to make no sense, especially given that most of us working with YASim are not experts in either aerodynamics or YASim's rather complex code base. If the situation makes no sense, try making very small changes to various related values. Sometimes a 0.1 change to a value will free YASim from a singularity and you'll get a good solution. Try it with approach aoa, or wing incidence, or stall values, etc. On one occasion I discovered that moving the end position of a flap segment very slightly dislodged the singularity. Sometimes a small change in CG will enable a solution. I've found no single cure.