Orbiter-Forum > Bug Lift Calculation Error?
 Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Lift Calculation Error? Issue Tools
07-30-2018 01:38 AM
 XR2 Ravenstar Commander
Lift Calculation Error?
There appears to be a potential error in lift calculation.

I was working on an MFD, and was examining the lift force vector for the delta glider.

From DeltaGlider.cpp:
Code:
```void VLiftCoeff (VESSEL *v, double aoa, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
int i;
const int nabsc = 9;
static const double CL[nabsc]  = {       0,      0,   -0.4,      0,    0.7,     1,   0.8,     0,      0};
static const double CM[nabsc]  = {       0,      0,  0.014, 0.0039, -0.006,-0.008,-0.010,     0,      0};
for (i = 0; i < nabsc-1 && AOA[i+1] < aoa; i++);
double f = (aoa-AOA[i]) / (AOA[i+1]-AOA[i]);
*cl = CL[i] + (CL[i+1]-CL[i]) * f;  // aoa-dependent lift coefficient
....
}```
If I'm reading this correctly, lift should be zero at -2 degrees angle of attack. See pictures below for correct behavior in Orbiter 2010:

However, the calculation Orbiter 2016 appears to be incorrect, see below. Note that as the slope (angle of velocity vector relative to the horizon) approaches zero, the problem goes away. It appears to be worse the larger the slope angle, and is actually close to correct in the third picture:

I compiled the DeltaGlider and traced through the code. The problem appears to be that the double aoa being fed into the function VLiftCoeff is not correct. To test, I made a dummy variable within VLiftCoeff:

Code:
```void VLiftCoeff (VESSEL *v, double aoa, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
int i;
const int nabsc = 9;
static const double CL[nabsc]  = {       0,      0,   -0.4,      0,    0.7,     1,   0.8,     0,      0};
static const double CM[nabsc]  = {       0,      0,  0.014, 0.0039, -0.006,-0.008,-0.010,     0,      0};
for (i = 0; i < nabsc-1 && AOA[i+1] < aoa; i++);
double f = (aoa-AOA[i]) / (AOA[i+1]-AOA[i]);
*cl = CL[i] + (CL[i+1]-CL[i]) * f;  // aoa-dependent lift coefficient
VESSEL* pV = oapiGetFocusInterface();
double aoaTest = pV->GetAOA();
......
}```
The variables aoaTest and aoa do not match when tracing through line by line. I have not traced through the drag calculation, but since AoA goes into induced drag, I would imagine this would be affected as well.

This was reproduced on a clean install of 160828.
Issue Details
Status Fixed
Priority 5 - Medium
Affected Version Revision denoted in description
Fixed Version (none)
Users able to reproduce bug 0
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)

 Filter responses to show Comments (4) Petitions (0) Changes (2) All
08-12-2018 10:41 PM
 Orbiter Founder
Is this problem dependent on the setting of "Atmospheric wind effects" under the Launchpad Parameters tab?

I just realised that there was a discrepancy between the AOA value passed to the lift and drag callback function (AOA calculated from air velocity vector) and the value returned by GetAOA (calculated from ground velocity vector). This has been fixed now in the latest beta (SVN r.77), where air velocity is used for both.

Could you try the latest beta and check if the problem still persists? The thing is, even before fixing the discrepancy, I couldn't really reproduce the problem (the difference between airspeed and groundspeed shouldn't have a significant effect, as far as I can tell), so maybe some other modification to the beta sources already corrected this.

If you can still reproduce the problem with the latest beta, can you post a scenario that exhibits the problem?
08-15-2018 02:03 AM
 XR2 Ravenstar Commander
Quote:
Originally Posted by martins
Is this problem dependent on the setting of "Atmospheric wind effects" under the Launchpad Parameters tab?
Ah, good thinking. I disabled Atmospheric Wind Effects and the problem went away. I did the math (L = (1/2)*rho*v^2*S*cL) and at high dynamic pressures, a degree or two can be the difference between a 100 kN of lift and zero lift, especially since the DG's lift curve slope is steep between -2° and 15° angle of attack.

I can confirm that with Atmospheric Wind Effects DISABLED in both the released 2016 version (160828) and the latest beta (rev 77), the problem is nonexistent.

I rebuilt the DeltaGlider .dll in Beta rev. 77, and added my dummy AoA variable, and traced through. I can confirm this problem is fixed (aoa matches aoaTest) both with Atmospheric Wind Effects ENABLED and DISABLED (see picture below from Beta rev. 77, where aoa and aoaTest match; Atmospheric Wind Effects is turned on in this screenshot).

Just found something else though...looks like Surface MFD is displaying the old incorrect AoA value based off the ground speed vector, also shown in the screenshot below.

Thanks for taking the time to look into this!

08-15-2018 10:12 AM
 Orbiter Founder
Quote:
Originally Posted by markl316
AJust found something else though...looks like Surface MFD is displaying the old incorrect AoA value based off the ground speed vector, also shown in the screenshot below.
Thanks for the heads-up. This should be fixed in the next commit.
08-18-2018 10:30 PM
 Orbiter Founder
The AOA calculation in the Surface MFD has now been switched from groundspeed to airspeed vector (SVN r.78).

I am closing this issue, but let me know if there are any more issues.

Issue Tools
Subscribe to this issue

All times are GMT. The time now is 03:43 PM.