Jump to content

Is there a built-in Mu constant?


Recommended Posts

Nope, here's the debug output of .gravParameter, for each body:

--- Begin Body List---
Mu: 1.17233279483249E+18
Sun     G=17.1365654964294

Mu: 168609378654.509
Moho     G=2.69867173862968

Mu: 8171730229210.87
Eve     G=16.6826981269693

Mu: 8289449.81471635
Gilly     G=0.0490667567239553

Mu: 3531600000000
Kerbin     G=9.81335156413656

Mu: 65138397520.7807
Mun     G=1.62901629764501

Mu: 1765800026.31247
Minmus     G=0.490667585518345

Mu: 301363211975.098
Duna     G=2.94400558622524

Mu: 18568368573.144
Ike     G=1.09909540910873

Mu: 21484488600
Dres     G=1.1285354298757

Mu: 282528004209995
Jool     G=7.85068136829352

Mu: 1962000029236.08
Laythe     G=7.85068136829352

Mu: 207481499473.751
Vall     G=2.30613761172288

Mu: 2825280042099.95
Tylo     G=7.85068136829352

Mu: 2486834944.41491
Bop     G=0.588801080687464

Mu: 721702080
Pol     G=0.372907359437189

Mu: 74410814527.0496
Eeloo     G=1.68789652635378
--- End Body List ---

 

Edited by Xyphos
Link to comment
Share on other sites

Thanks, but that equasion says

v = sqrt( GM / r )

where GM is CelestrialBody.gravParameter, and 'r' being the radius of orbit (assuming it's a perfect circle, which really, never happens)

having computed that, my debug log shows:

Gilly     G=0.0490667567239553   OrbitV=12.166589067956   OrbitAlt=56000

I'm not sure if thats' right or if I'm doing it wrong.  13 dV seems a bit low?

Edited by Xyphos
Link to comment
Share on other sites

1 minute ago, Aelfhe1m said:

Have a look at this thread

that's the thread I've been looking at, and @K^2 specified some other weird formula that I've not seen before, which really confused me.

now I just need to figure out how to add additional deltaV for atmosphere...

4gH/Vt

but how do I calculate surface terminal velocity?

Link to comment
Share on other sites

10 minutes ago, Xyphos said:

now I just need to figure out how to add additional deltaV for atmosphere...

4gH/Vt

That thread is from 4 years ago, when the old "souposphere" was still in use. Take anything it says about the atmosphere with a large grain of salt.

10 minutes ago, Xyphos said:

but how do I calculate surface terminal velocity?

Looks like Wikipedia has a formula for that, as they do for many things:

https://en.wikipedia.org/wiki/Terminal_velocity

Link to comment
Share on other sites

51 minutes ago, HebaruSan said:

That thread is from 4 years ago, when the old "souposphere" was still in use. Take anything it says about the atmosphere with a large grain of salt.

Looks like Wikipedia has a formula for that, as they do for many things:

https://en.wikipedia.org/wiki/Terminal_velocity

okay so... in order to calculate the deltaV requirement to get a vessel from the surface of an atmospheric body to full orbit, requires calculation of surface terminal velocity, which requires calculation for drag coefficient, from a hypothetical non-existent vessel, to which has no drag....

is there a "dirty" way to compute this without needing drag coefficients? 

Edited by Xyphos
Link to comment
Share on other sites

2 minutes ago, Xyphos said:

okay so... in order to calculate the deltaV requirement to get a vessel from the surface of an atmospheric body to full orbit, requires calculation of surface terminal velocity, which requires calculation for drag coefficient, from a hypothetical non-existent vessel, to which has no drag....

For terms that depend on a vessel, I'd recommend designing a simple reference craft. Say, a command pod, some fuel tanks, and a Reliant. Most real craft will be similar enough, and for those that are significantly different, they'd be expected to perform weirdly anyway.

2 minutes ago, Xyphos said:

is there a "dirty" way to compute this without needing drag coefficients? 

I wrote a DeltaVToOrbit function, but it's just a "dirty" approximation, so I wasn't going to mention it in case you found something better. I calculated the simple delta V to orbit for a sample of bodies (Hohmann transfer from surface plus an adjustment for rotation), then compared to the official values from the subway maps to determine some ad hoc linear coefficients for gravity loss and drag loss:

As you can see from the "Err%" column, it results in errors of up to 30%, with Kerbin tuned to be close to 0%. But I have my fingers crossed with respect to your investigation into drag coefficients.

Link to comment
Share on other sites

well, I didn't have much luck investigating atmospheric effects, but I did manage to assemble a "dirty" computation model. worst case, you end up with more delta-V left over than you actually needed.

            public XorcSystemBody(CelestialBody body)
            {
                const double addedAltitude = 10000;

                Name = body.bodyName;
                GeeASL = body.GeeASL * G;
                Selected = body.isHomeWorld; // Name.Equals("Kerbin");

                var R = body.Radius + (body.atmosphere ? body.atmosphereDepth : body.minOrbitalDistance) + addedAltitude;

                // solving for orbital velocity
                var OV = Math.Sqrt(body.gravParameter / R);

                // solving for Hohmann from surface to sub-orbit
                var HT = Math.Sqrt(body.gravParameter / body.Radius) * Math.Sqrt((2 * R) / (body.Radius + R));

                Log("OV:{0}   HT:{1}   ATM:{2}", OV, HT, body.atmDensityASL);

                // dirty and inaccurate, simply add  % of the orbital velocity, multiplied by surface atmospheric pressure, (unless atm is less than 1)
                // to compensate for energy losses and imperfect piloting skills.
                // worst-case, you end up having more delta-V left over than you actually needed, once you get to orbit.
                OrbitDv = HT + ((OV * 0.5) * (body.atmDensityASL > 1 ? body.atmDensityASL : 1));
            }
--- Begin Body List---
OV:66865.3052852131   HT:66982.1861279674   ATM:0.000724928619656331
Sun     G=17.1365654964294   OrbitV=100414.838770574

OV:569.428489895637   HT:954.425791338654   ATM:0
Moho     G=2.69867173862968   OrbitV=1239.14003628647

OV:3196.03860842037   HT:3528.76187199897   ATM:6.23837138885624
Eve     G=16.6826981269693   OrbitV=13497.7997782237

OV:12.166589067956   HT:32.1718209590611   ATM:0
Gilly     G=0.0490667567239553   OrbitV=38.2551154930391

OV:2278.93163823856   HT:2500.77487991222   ATM:1.22497705725583
Kerbin     G=9.81335156413656   OrbitV=3896.59436586056

OV:393.816483490122   HT:664.274124317323   ATM:0
Mun     G=1.62901629764501   OrbitV=861.182366062384

OV:113.946582760896   HT:202.093130169358   ATM:0
Minmus     G=0.490667585518345   OrbitV=259.066421549806

OV:890.539771231467   HT:1011.17868170966   ATM:0.149935103789845
Duna     G=2.94400558622524   OrbitV=1456.44856732539

OV:250.885675720724   HT:445.293892644323   ATM:0
Ike     G=1.09909540910873   OrbitV=570.736730504685

OV:269.411825569623   HT:460.828102541681   ATM:0
Dres     G=1.1285354298757   OrbitV=595.534015326492

OV:6745.04654185952   HT:6920.82856568498   ATM:6.70262205528434
Jool     G=7.85068136829352   OrbitV=29525.5774233785

OV:1871.78296839637   HT:2036.20069475704   ATM:0.764571404126208
Laythe     G=7.85068136829352   OrbitV=2972.09217895523

OV:571.839137494635   HT:969.103628888492   ATM:0
Vall     G=2.30613761172288   OrbitV=1255.02319763581

OV:1509.45408901854   HT:2519.25456689736   ATM:0
Tylo     G=7.85068136829352   OrbitV=3273.98161140664

OV:122.953396276873   HT:234.192728469969   ATM:0
Bop     G=0.588801080687464   OrbitV=295.669426608406

OV:83.7067279893296   HT:151.609907597204   ATM:0
Pol     G=0.372907359437189   OrbitV=193.463271591869

OV:406.641568971577   HT:695.116614186788   ATM:0
Eeloo     G=1.68789652635378   OrbitV=898.437398672576

--- End Body List ---

 

Link to comment
Share on other sites

18 hours ago, Xyphos said:

@K^2 specified some other weird formula that I've not seen before, which really confused me.

now I just need to figure out how to add additional deltaV for atmosphere...

4gH/Vt

but how do I calculate surface terminal velocity?

This formula gives losses to drag and gravity during optimal vertical ascent to escape velocity for old KSP aerodynamics. It was purely an observation that it tends to give a correct ballpark estimate for losses during a normal ascent to orbit.

Since they changed the aerodynamics, this formula is almost useless. You could use it as a very generous upper bound, but in practice, your losses will be a lot smaller.

Likewise, terminal velocity used to be really easy to calculate with the old system. Now, it will be very different for different rockets, so it's almost not worth bothering with.

Basically, with new aerodynamics you have two options. 1) Proper simulation, integrating all relevant forces over particular ascent profile. 2) Just winging it.

Link to comment
Share on other sites

Just now, K^2 said:

2) Just winging it.

thanks for the reply, but I think I just did wing it, as shown in the post before yours. :)

feel free to improve it if you wish, but the output numbers match that of the delta-v "subway" map or slightly higher..

Link to comment
Share on other sites

I've been kind of wanting to write a generic optimizer that takes a file containing any KSP rocket, makes an educated guess on when to trigger stages, and computes an optimal ascent profile for it. It wouldn't shave off much, but custom profile will always be better than generic.

Unfortunately, this involves considerable amount of work which I don't have time for.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...