Project XB-70 Valkyrie Development Thread

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,055
Reaction score
642
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
View attachment 35189

Well, just using the visual helpers, your total engine thrust is over 3 MN, it should not be more than 720 kN or 0.72 MN with afterburner.

The weight is 2.369 MN which seems about right for maximum weight.

Generally it feels like the controls are all crossed up. Trying to roll right rolls the vessel to the left, etc. I modified the scenario to start while airborne, and it is extremely unstable. I think you have some flight control surfaces set up forward of the center of pressure and it really wants to fly backwards because of it. I don't know if you are trying to implement the canards but if so they seem to be overpowering the wings and tail surfaces.

There seems to be a problem with your contact point definitions:

View attachment 35190
You also seem to have some spurious forces acting at the wheel contacts which don't seem to be doing good things.
My God!
I do not know where to start. Well first thank you for your patience and time to test my defective Valkyrie. I'm going to fix all this because it's a real mess. Thanks to your test I can know where to start: rewriting all the code. Anyway I'm going to keep the current code in another directory just in case.

By the way, did I correctly implement the data from the lift coefficient table?

Thank you again very much for your help.

2de78iulktm11.gif
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
For example, is the easiest solution.
Well, it's the easiest to get... Not necessarily the easiest to get into...

Do you mean GIT? Like a local (offline) repository?
That would already help you a lot, since it takes care of "I'm copying my project over here because I'm gonna make some changes and I'm not sure if I still need the old code or if it even still works afterward", yes. Hook it up to github or bitbucket (both are free at this level), and you also have the backup situation taken care off.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,617
Reaction score
2,337
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Well, it's the easiest to get... Not necessarily the easiest to get into...


That would already help you a lot, since it takes care of "I'm copying my project over here because I'm gonna make some changes and I'm not sure if I still need the old code or if it even still works afterward", yes. Hook it up to github or bitbucket (both are free at this level), and you also have the backup situation taken care off.

Well, even with the command line version, its pretty easy to learn the dozen most common command lines you need for getting your work done. Of course, if you come into things like rebasing out-of-sync branches...
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
Thanks @n72.75.
I have written the data from the NASA report that you shared with me but still the XB-70 does not take off. I'm sure I've done something wrong because I'm new to programming and have little knowledge of aeronautics.

I share my code of how I implemented the lift coefficient table of the page 76, maybe you can guide me.

C++:
void VLiftCoeff (VESSEL *v, double aoa, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
    const int nabsc = 7;
    static const double AOA[nabsc] = {  -4*RAD, -2*RAD,  0*RAD,  2*RAD,  4*RAD, 6*RAD, 8*RAD,};
    static const double CL[nabsc]  = {   -0.14,  -0.11,  -0.02,   0.06,   0.13,  0.20,  0.28,};
    static const double CM[nabsc]  = {    0.02,      0,      0,      0,      0,     0, -0.01,};
    int i;
    for (i = 0; i < nabsc-1 && AOA[i+1] < aoa; i++);
    if (i < nabsc - 1) {
        double f = (aoa - AOA[i]) / (AOA[i + 1] - AOA[i]);
        *cl = CL[i] + (CL[i + 1] - CL[i]) * f;  // aoa-dependent lift coefficient
        *cm = CM[i] + (CM[i + 1] - CM[i]) * f;  // aoa-dependent moment coefficient
    }
    else {
        *cl = CL[nabsc - 1];
        *cm = CM[nabsc - 1];
    }
    double saoa = sin(aoa);
    double pd = 0.015 + 0.4*saoa*saoa;  // profile drag
    *cd = pd + oapiGetInducedDrag (*cl, XB70_VLIFT_A, 1) + oapiGetWaveDrag (M, 0.6, 0.75, 0.8, 0.95);
    // profile drag + (lift-)induced drag + transonic/supersonic wave (compressibility) drag
}

View attachment 35169

And I apologize in advance for my ignorance, I know this should be easy to achieve but I can't.

I also have to fix the landing gear mechanism, it's a disaster. But my priority is to get the Valkyrie off the ground.
You only have your coefficients defined from +8 degrees to -4 degrees. That code will try to extrapolate the rest of the angular range with bizzare results. Basically your airfoils will never stall. Look at how it was done with the Delta Glider. They set the coefficients to zero above the stall angle all the way to +180, and do similar for the negative angles.

EDIT: This may be the cause of the flight instability if you have the canards set as a lifting surface. If they never stall, their lift increases with increasing angle of attack. You really want them to stall before the main wing.
 
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
My God!
I do not know where to start. Well first thank you for your patience and time to test my defective Valkyrie. I'm going to fix all this because it's a real mess. Thanks to your test I can know where to start: rewriting all the code. Anyway I'm going to keep the current code in another directory just in case.

No worries. If you are starting out with DeltaGlider code, be aware that a lot of that code has been deprecated. I strongly recommend reading the API_Guide.pdf and API_Reference.pdf in the Orbitersdk/doc folder to see the latest and greatest ways to implement things.
Things like the drag model have been absorbed into the airfoil lift coefficient definitions.

Basically just try to fix one thing at a time. A complete fresh code re-write may not be necessary, but just some editing and tweaking.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
Thanks @n72.75.
I have written the data from the NASA report that you shared with me but still the XB-70 does not take off. I'm sure I've done something wrong because I'm new to programming and have little knowledge of aeronautics.

I share my code of how I implemented the lift coefficient table of the page 76, maybe you can guide me.

C++:
void VLiftCoeff (VESSEL *v, double aoa, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
    const int nabsc = 7;
    static const double AOA[nabsc] = {  -4*RAD, -2*RAD,  0*RAD,  2*RAD,  4*RAD, 6*RAD, 8*RAD,};
    static const double CL[nabsc]  = {   -0.14,  -0.11,  -0.02,   0.06,   0.13,  0.20,  0.28,};
    static const double CM[nabsc]  = {    0.02,      0,      0,      0,      0,     0, -0.01,};
    int i;
    for (i = 0; i < nabsc-1 && AOA[i+1] < aoa; i++);
    if (i < nabsc - 1) {
        double f = (aoa - AOA[i]) / (AOA[i + 1] - AOA[i]);
        *cl = CL[i] + (CL[i + 1] - CL[i]) * f;  // aoa-dependent lift coefficient
        *cm = CM[i] + (CM[i + 1] - CM[i]) * f;  // aoa-dependent moment coefficient
    }
    else {
        *cl = CL[nabsc - 1];
        *cm = CM[nabsc - 1];
    }
    double saoa = sin(aoa);
    double pd = 0.015 + 0.4*saoa*saoa;  // profile drag
    *cd = pd + oapiGetInducedDrag (*cl, XB70_VLIFT_A, 1) + oapiGetWaveDrag (M, 0.6, 0.75, 0.8, 0.95);
    // profile drag + (lift-)induced drag + transonic/supersonic wave (compressibility) drag
}

View attachment 35169

And I apologize in advance for my ignorance, I know this should be easy to achieve but I can't.

I also have to fix the landing gear mechanism, it's a disaster. But my priority is to get the Valkyrie off the ground.
This is a plot of the lift coefficient CL for the DeltaGlider and the CL that you had in your code for the XB-70

CL vs alpha.png

If your angle of attack leaves the bounds of -4 degrees to +8 degrees, it would try to extrapolate to higher and lower angles of attack. If I understand the code correctly, it would try to interpolate between the last value at +8 and the value at -4, so your lift coefficients would never be higher than 0.28 and it would effectively stall at +8 degrees.

I'd say as a start, you might just want to leave the DG coefficients in that function as they seem to be pretty close to the XB-70 data that you tried to enter but it also completely defines CL at all angles. If you define the correct wing areas, chords, Oswald efficiency for the XB-70 wing in the airfoil definition I think you could get something flying.
 

Attachments

  • CL vs alpha.png
    CL vs alpha.png
    18.7 KB · Views: 6
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
I can just barely get her to fly by setting the trim full nose up and limiting throttle to 50%, and I think you need to go over some bumps to get the nose pitched high enough to climb. The elevators can't seem to pitch up the aircraft otherwise.

Screenshot at 2023-09-30 18-12-25.png
I think you need to put the wing above the center of mass of the aircraft so it will fly stably, unless you want to try to write an autopilot for it. The ailerons definitely seem to be crossed - attempting to roll right causes a roll to the left and vice versa. It also feels like the vertical stabilizers are weak - it really doesn't want to weathervane into the wind and is really unstable in yaw. You either need to increase their area or move them farther back (remember where you locate airfoils doesn't necessarily need to match the location of those surfaces on the mesh).

I really think you just have some location tweaking to do to get this flying. You're closer than you think.
 
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
The ailerons definitely seem to be crossed - attempting to roll right causes a roll to the left and vice versa. It also feels like the vertical stabilizers are weak - it really doesn't want to weathervane into the wind and is really unstable in yaw. You either need to increase their area or move them farther back (remember where you locate airfoils doesn't necessarily need to match the location of those surfaces on the mesh).

I really think you just have some location tweaking to do to get this flying. You're closer than you think.
@Matias Saibene - I just thought of something - are you aware of Orbiter's left handed coordinate system for vessels? If you are sitting in your cockpit, +X is toward the right wing, +Y is straight up, and +Z is in the forward direction. This might explain why the controls feel crossed and that it wants to fly backwards.
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,055
Reaction score
642
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
@Matias Saibene - I just thought of something - are you aware of Orbiter's left handed coordinate system for vessels? If you are sitting in your cockpit, +X is toward the right wing, +Y is straight up, and +Z is in the forward direction. This might explain why the controls feel crossed and that it wants to fly backwards.
Yes I knew, especially when viewing the axes with F9 and when designing with Blender, which although it has the +Z axis as "up", Blake's Orbiter Blender Mesh Tools automatically corrects them +Y "up" and +Z "front" .

In any case, I wouldn't be surprised if I made the mistake when writing the code.

I'm not currently coding, but I'll be back in a few days.
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,055
Reaction score
642
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
@Matias Saibene - I just thought of something - are you aware of Orbiter's left handed coordinate system for vessels? If you are sitting in your cockpit, +X is toward the right wing, +Y is straight up, and +Z is in the forward direction. This might explain why the controls feel crossed and that it wants to fly backwards.
Thank you for your help and the help of everyone who wrote. I changed the control surfaces values to AIRCTRL_AXIS_AUTO and the main wing position to coordinates +X0, +Y0, +Z0 and the TOUCHDOWNVTX coefficient values, and now I managed to take off. However, I had to drain the fuel to 10%. Now I'm going to continue testing but the first results are very encouraging. I am reading the code and values of the G42-200 and it provides me a lot of help as well.
As soon as I have everything ready and well tested, I will publish what I did to solve it so it can be of use to everyone.

Thank you.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
I implemented a delta wing model in my Mirage 2000 code that you might like for the XB-70. I updated the wing area and wingspan with XB-70 data. It flies very nicely and "feels" like a delta wing. You can make an identical HLiftCoeff and use it for the vertical stabilizers as well.

C++:
//Wing properties

const double wing_area = 585.0;                    //wing area [sq. m]
const double wing_span = 32.0;                    //wing span [m]
const double wing_aspect_ratio = pow(wing_span, 2) / wing_area; //wing aspect ratio
const double mean_chord_length = wing_area / wing_span; //wing mean chord length
const double wing_effectiveness = 0.4;            //wing effectiveness

C++:
void VLiftCoeff(VESSEL *v, double aoa, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
    //Following are coefficients to calculate lift coefficient for delta wings with
    //aspect ratio ~ 1.75 from Polhamus, A concept of the vortex lift of sharp-edge delta wings
    //based on a leading edge suction analogy, NASA TN D-3767.
    //https://ntrs.nasa.gov/api/citations/19670003842/downloads/19670003842.pdf

    const double Kp = 2.2;
    const double Kv = 3.2;
   
    *cl = Kp * sin(aoa)*cos(aoa)*cos(aoa) + Kv * cos(aoa)*sin(aoa)*sin(aoa);
    *cm = 0.0; //placeholder until a better model can be found.
    *cd = 0.003 + oapiGetInducedDrag(*cl, wing_aspect_ratio, wing_effectiveness) + oapiGetWaveDrag(M, 0.75, 1.0, 1.1, 0.01);
}

C++:
    CreateAirfoil3(LIFT_VERTICAL, _V(0.0, 4.0, 0.0), VLiftCoeff, 0, mean_chord_length, wing_area, wing_aspect_ratio);

The Kp and Kv coefficients from the Polhamus paper are for the XB-70 aspect ratio of ~1.75.

 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,055
Reaction score
642
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Well, after a lot of experimenting and learning, I have managed to polish the XB-70 Valkyrie code a bit.

Thanks to everyone who wrote their help that helped me get the Valkyrie to take off and fly as it should :cheers: .

Now I also improved the landing gear animations so that they work correctly according to video documentaries that I have seen.

However I still have to fix the fact that landing gear touchdown points sometimes don't update. Also the fact that I had to drastically increase the engine power, because not only did it not take off, but once flying it also couldn't accelerate beyond Mach 1. I probably have to solve something related to drag. I'll investigate it later.

 
Top