Orbiter-Forum  

Go Back   Orbiter-Forum > Projects > ORBITER: 2010-P1 and newer > Bug
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Lift Vector Rotation Incorrect? Issue Tools
issueid=1394 12-16-2018 07:57 PM
XR2 Ravenstar Commander
Lift Vector Rotation Incorrect?
It appears that the lift vector is possibly being rotated incorrectly.

Hi,

I was experimenting with the SDK, and examining the lift and drag vectors. I was trying to back calculate the bank angle during a reentry.

The scenario I'm looking at is:

Code:
BEGIN_DESC

END_DESC

BEGIN_ENVIRONMENT
  System Sol
  Date MJD 51983.7885633472
  Help CurrentState_img
END_ENVIRONMENT

BEGIN_FOCUS
  Ship GL-01
END_FOCUS

BEGIN_CAMERA
  TARGET GL-01
  MODE Cockpit
  FOV 90.00
END_CAMERA

BEGIN_HUD
  TYPE Surface
END_HUD

BEGIN_MFD Left
  TYPE User
  MODE MFD Template
END_MFD

BEGIN_MFD Right
  TYPE Surface
  SPDMODE 1
END_MFD

BEGIN_SHIPS
GL-01:DeltaGlider
  STATUS Orbiting Earth
  RPOS 5631280.530 3039433.202 -760674.503
  RVEL 1390.2494 -791.5059 7095.6579
  AROT 33.898 -23.997 13.216
  VROT -0.0538 -0.0368 0.0229
  AFCMODE 7
  PRPLEVEL 0:0.028248 1:0.376463
  NAVFREQ 0 0 0 0
  XPDR 0
  HOVERHOLD 0 1 0.0000e+00 0.0000e+00
  AAP 0:0 0:0 0:0
END
END_SHIPS

BEGIN_ExtMFD
END

BEGIN_DX9ExtMFD
END

In this case, the flight path angle is approximately zero, the sideslip angle is zero, and the bank angle is 45 degrees, as indicated on Surface MFD. Using the call pV->GetBank() confirms this.

However: extracting the lift and weight vectors (using pV->GetLiftVector() and pV->GetWeightVector()), and taking the inverse cosine of the dot product, shows a bank angle of approximately 37 degrees, not 45 degrees as shown on Surface MFD and pV->GetBank() return. Interestingly, zeroing out the angle of attack fixes the issue, and the divergence seems to get worse at higher angles of attack.

This was run on a clean install of SVN Rev. 84 (and the same behavior exists in version 160828).

To experiment, I added the following code to the MFDTemplate::Update method:

Code:
OBJHANDLE hEarth = oapiGetGbodyByName("Earth");
VESSEL* pV = oapiGetFocusInterface();

double bankAngle = pV->GetBank() * 180 / PI;
double sideslip = pV->GetSlipAngle() * 180 / PI;
VECTOR3 liftVec, gravVec;
pV->GetLiftVector(liftVec);
pV->GetWeightVector(gravVec);
normalise(liftVec);
normalise(gravVec);

double LdotG = dotp(liftVec, gravVec);
double calcBankAngle = 180 - (acos(LdotG) * 180 / PI);

std::string bankAngleStr = "Returned Bank: " + std::to_string(bankAngle);
const char* bankAngleChar = bankAngleStr.c_str();
skp->Text(W / 10, 2 * H / 10, bankAngleChar, bankAngleStr.length());

std::string calcBankAngleStr = "Calculated Bank: " + std::to_string(calcBankAngle);
const char* calcBankAngleChar = calcBankAngleStr.c_str();
skp->Text(W / 10, 3 * H / 10, calcBankAngleChar, calcBankAngleStr.length());

std::string sideslipStr = "Sideslip Angle: " + std::to_string(sideslip);
const char* sideslipChar = sideslipStr.c_str();
skp->Text(W / 10, 4 * H / 10, sideslipChar, sideslipStr.length());

Is Orbiter's flight model doing something where the lift vector is not necessarily perpendicular to the wings at higher angles of attack? I wasn't sure if this was the case, or if it was a bug (or a stupid math error on my part ).
Issue Details
Project ORBITER: 2010-P1 and newer
Status Unconfirmed
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)

12-17-2018 09:17 AM
GLS GLS is online now
Addon Developer
 
I didn't check you math (I have too much math of my own already), but reading your post could this issue be interpreted as "there is a (erroneous) force making the vehicle roll back to 0"?

If so, then I think I have encountered the same issue with SSU, as to keep a left bank it has to keep putting left aileron. Flying with the DG it remains +/- stable at a bank without further aileron inputs, but that was with a very low alpha, which fits your findings. I'll have to check the DG with an higher alpha to see if it makes a difference.
Reply
12-17-2018 03:24 PM
XR2 Ravenstar Commander
 
No, it has nothing to do with a force/torque causing the vehicle to roll, it seems like it's simply a discrepancy between the bank angle and the angle that the lift vector is being rotated. If you could try to run the above scenario and code to try to reproduce it, that would be great (it took me 10 mins to recompile MFD Template and run the scenario).

In your SSU scenario is the sideslip angle zero? That could be doing it. Or, if the lift vector isn't perpendicular to the wings, maybe that's resulting in an imparted roll moment?

When I run my reentry trajectory propagator I'm working on, correcting for the discrepancy, it is extremely accurate, leading me to believe that the potential error in lift vector rotation is real, as opposed to the wrong value being returned by pV->GetLiftVector().
Reply
12-17-2018 03:30 PM
GLS GLS is online now
Addon Developer
 
Quote:
Originally Posted by markl316
 No, it has nothing to do with a force/torque causing the vehicle to roll, it seems like it's simply a discrepancy between the bank angle and the angle that the lift vector is being rotated.
But if the lift force angle is not at the same as the bank, that would mean it has a lateral component, right? The rest of what I see could be the controls reacting...
Anyway, I'll try your scenario/code later today, and the DG at high alpha to see what happens.
Reply
12-17-2018 03:34 PM
XR2 Ravenstar Commander
 
Quote:
Originally Posted by GLS
 But if the lift force angle is not at the same as the bank, that would mean it has a lateral component, right? The rest of what I see could be the controls reacting...
Anyway, I'll try your scenario/code later today, and the DG at high alpha to see what happens.
Hah, literally just thought of that and edited my above post 2 minutes ago. Sounds good on running the DG scenario today, let me know what you find.

The discrepancy seems to be the worst at 45 degrees bank, then get better as you go from 45 to 90 degrees, where it converges to the bank angle in surface MFD. I made some plots but they're at home; I'll post them tonight.
Reply
12-17-2018 10:02 PM
GLS GLS is online now
Addon Developer
 
Flying SSU and looking at the outputs of your code, I don't know what to make of them... sometimes one value is larger, other times it's the other way around. And to top off things, flying leveled, no (or very small) roll inputs, 43kft, alpha 11.5, beta -0.12, and I'm getting -1.95 actual bank and 14.5 calculated bank. *confused*
(yes, the wind is off)

Playing around with the DG in a bank at "high alpha", i.e. ~20, I don't really see a large tendency to roll, but sometimes it seems like it wants to bank more. *more confused*
Reply
12-17-2018 10:25 PM
XR2 Ravenstar Commander
 
Quote:
Originally Posted by GLS
 Flying SSU and looking at the outputs of your code, I don't know what to make of them... sometimes one value is larger, other times it's the other way around. And to top off things, flying leveled, no (or very small) roll inputs, 43kft, alpha 11.5, beta -0.12, and I'm getting -1.95 actual bank and 14.5 calculated bank. *confused*
(yes, the wind is off)
My code assumes zero flight path angle (ie vertical speed equals zero). That 14.5 degrees calculated bank is probably picking up the sum of your flight path angle and bank angle. I assume since you were at 43,000 feet you were testing this on final approach? I can play around with it and write new code to make it work with a nonzero flight path angle.


Quote:
Playing around with the DG in a bank at "high alpha", i.e. ~20, I don't really see a large tendency to roll, but sometimes it seems like it wants to bank more. *more confused*
How are you differentiating roll versus bank (I think they're the same)? What was your flight path angle here?
Reply
12-17-2018 11:50 PM
GLS GLS is online now
Addon Developer
 
Quote:
Originally Posted by markl316
 My code assumes zero flight path angle (ie vertical speed equals zero). That 14.5 degrees calculated bank is probably picking up the sum of your flight path angle and bank angle. I assume since you were at 43,000 feet you were testing this on final approach? I can play around with it and write new code to make it work with a nonzero flight path angle.
Yes, gamma affects your calculations... sorry, I should have read the instructions with more attention.



Quote:
Originally Posted by markl316
 How are you differentiating roll versus bank (I think they're the same)? What was your flight path angle here?
Hmmm, the angle wings make with the horizon?
Reply
12-18-2018 03:23 PM
XR2 Ravenstar Commander
 
Quote:
Originally Posted by GLS
 
Hmmm, the angle wings make with the horizon?
Whoops I misread, I thought you said they meant two different things, my mistake. I couldn't find those plots last night so I'll recreate my "experiment" in the next few days. We're you able to reproduce this with SSU flying with zero vertical speed?
Reply
12-23-2018 03:25 AM
XR2 Ravenstar Commander
 
Ok. I ran through several test cases, at the following flight conditions:
Ground Speed: 7063 m/s
Altitude: 71.2 km
Vertical Speed: +/- 20 m/s
Mach ~24
AOA: 40 degrees
Sideslip: 0 degrees
Swept bank angle from 0 degrees to 90 degrees right bank





The blue points are from test cases I ran, and the orange point is from a test case GLS ran at similar flight conditions. It looks like it's able to be reproduced.
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT. The time now is 01:50 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.