Menu

#1400 YASim slats always provide full stall enhancement even if not deployed.

3.2
Fixed
nobody
YASIM (32)
2014-04-04
2014-03-06
Anonymous
No

Originally created by: colin.d....@gmail.com
Originally owned by: cumuluni...@gmail.com

Examination of YASim's code for aerodynamic surfaces (Surface.cpp) has made it clear that YASim's slats will always provide their full stall enhancement, even if they are not deployed or only partially deployed. This is a very old bug, present in YASim since the beginning.

(The following explanation is a bit long; the problem is described at the very end, with judicious use of caps. :)

First, some explanation of how YASim slats work. They provide special properties to those Surfaces of a Wing that contain the slats. These properties are _slatPos, _slatDrag, and _slatAlpha. _slatPos is the slat position, varying between 0 and 1, with 0 being completely undeployed and 1 being fully deployed. _slatDrag is the multiplier to the Surface's drag provided by the slat when fully deployed. _slatAlpha determines the slat's stall enhancement. Unlike some other YASim control surfaces, slats do not act by multiplying their Surface's lift, though they do have this effect for drag. Instead they increase the Surface's critical angle of attack ("alpha") for stalls. _slatAlpha specifies how much the stall angle is increased. Like _slatDrag, it is intended to be the maximum value, when the slat is fully deployed.

By default, a Surface has _slatPos set to 0, _slatDrag to 1, and _slatAlpha to 0; in other words, no deployment and no change in drag or stall angle, corresponding to slats not being present. When Wing::newSurface creates a new Wing Surface with slats, it changes the parameters by having the Surface call Surface::setSlatParams(), which resets the _slatAlpha and _slatDrag parameters to the given values. These will be the "aoa" and "drag" values specified for the slat in the XML file. Surface::setSlatParams() is only intended to be called once, when the Surface containing the slat is set up.  This is similar to other YASim control surfaces like flaps and spoilers.

During flight, when a slat's position is set, the Surfaces containing the slat call Surface::setSlat() with the new position. This sets the _slatPos property for the Surfaces. No other properties are changed. Clearly, _slatPos is intended to modify both _slatDrag and _slatAlpha. Again, this is like what happens with other YASim control surfaces.

The slat's drag effect is applied during Surface::calcForce() when this method calls Surface::controlDrag() to determine how the drag is altered by flight controls. Here, the drag is modified as follows (line 347 of Surface.cpp):

    drag *= 1 + _slatPos * (_slatDrag - 1);

The slat's additional drag multiplier, (_slatDrag - 1), is scaled by _slatPos before scaling the overall drag. This is normal and matches the effects of flaps and spoilers.

The slat's stall effect is also applied during Surface::calcForces(), but this time when the method calls Surface::stallFunc() to determine what part of the Surface's lift curve we're on and how the lift should be scaled. As part of that scaling, the current angle of attack (alpha) needs to be compared with the stall angle of attack (stallAlpha), where the lift curve's stall behavior begins. This angle is normally based on the Surface's _stalls[i] property (for normal stalls, _stalls[0]).

The code for the slat's lift effect is (lines 283-284 of Surface.cpp):

    if(i == 0)
        stallAlpha += _slatAlpha;

This checks that this is a normal stall condition (forward movement, positive angle of attack), and if so, increases the stall angle of attack by _slatAlpha, the slat's angle of attack increment.

** NOTE: _slatAlpha IS NOT SCALED BY _slatPos!! **

Since _slatAlpha is only set *once*, when the slat is set up, this means that if a Surface has a slat, its stall angle is *ALWAYS* increased by the slat's FULL "aoa" increment, REGARDLESS OF THE SLAT'S POSITION.

This means that YASim aircraft with slats will always be harder to stall than they should be if the slats are not deployed.

Clearly, the code should read:

    if(i == 0)
        stallAlpha += _slatPos * _slatAlpha;

Discussion

  • Anonymous

    Anonymous - 2014-03-06

    Originally posted by: colin.d....@gmail.com

    Incidentally, fixing this will require retesting all YASim aircraft with slats, because the old "always-effective" slat behavior may have affected YASim's solution.

     
  • Anonymous

    Anonymous - 2014-03-08

    Originally posted by: bcoco...@gmail.com

    (No comment was entered for this change.)

    Labels: YASIM

     
  • Anonymous

    Anonymous - 2014-03-08

    Originally posted by: h...@hyde-tech.com

    I tested 777 with this fix.
    I don't notice significant maneuver change.
    tsfc may need to be changed but this is required change nonetheless.

     
  • Anonymous

    Anonymous - 2014-03-17

    Originally posted by: h...@hyde-tech.com

    Have you made change and applied merge request?

     
  • Anonymous

    Anonymous - 2014-03-22

    Originally posted by: colin.d....@gmail.com

    It took me a while, since I got distracted with other stuff and had to get up to speed on being able to submit merge requests to Gitorious, but I've just submitted one which is a one-liner fix for this issue.

     
  • Anonymous

    Anonymous - 2014-03-26

    Originally posted by: zakalawe@mac.com

    Thanks Colin, I'm on the road at the moment but will take a look at the merge request soon if no one beats me to it.

     
  • Anonymous

    Anonymous - 2014-04-04

    Originally posted by: NasalMusician

    (No comment was entered for this change.)

    Labels: Milestone-3.2
    Owner: cumuluni...@gmail.com
    Status: Fixed

     

Log in to post a comment.