-
Posts
1,083 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Xyphos
-
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
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.. -
[UI] Close gap between dialog toggles?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
that didn't work, here's the code I'm using: var optimizeForOptions = new DialogGUIVerticalLayout(IDGAF, IDGAF, SPACER, R0, TextAnchor.MiddleLeft, new DialogGUILabel("Optimize For:"), new DialogGUIScrollList(new Vector2(120, IDGAF), false, false, new DialogGUIVerticalLayout(IDGAF, IDGAF, IDGAF, new RectOffset(12, 0, 0, 0), TextAnchor.MiddleLeft, new DialogGUIContentSizer(FM.PreferredSize, FM.Unconstrained, true), new DialogGUIToggleGroup( new DialogGUIToggle((OptimizeFor == OptimizeForEnum.Mass), "Mass", b => { if (b) OptimizeFor = OptimizeForEnum.Mass; }, IDGAF, Height), new DialogGUIToggle((OptimizeFor == OptimizeForEnum.Cost), "Cost", b => { if (b) OptimizeFor = OptimizeForEnum.Cost; }, IDGAF, Height), new DialogGUIToggle((OptimizeFor == OptimizeForEnum.PartCount), "Part Count", b => { if (b) OptimizeFor = OptimizeForEnum.PartCount; }, IDGAF, Height) ), new DialogGUIFlexibleSpace() ) ) ); const float IDGAF = -1F; const float SPACER = 12F; static RectOffset R0 = new RectOffset(0,0,0,0); -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
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 --- -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
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? -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
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? -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
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? -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
I'm trying to calculate dV to get to orbit, tho I'm not so sure about the formula I was given... we'll see. -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
okay, but what's the 'a' ? -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
sqrt((r2/r1)GM/a) I've computed R values (both equal), but I just need GM and whatever 'a' is -
Is there a built-in Mu constant?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
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 --- -
snippet from my code: { 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; var C = Math.PI * (R * R); Log("R: {0}", R); } and the output from my debug log: Gilly G=0.0490667567239553 R: 680000
-
perfect. awesome. thanks
-
new question: what if the body is tidally locked? does that still count as rotation?
-
What's the math formula to compute the Delta-V required to reach full orbit around a specific celestial body from it's surface, including atmospheric pressure, if applicable? sure, I could look at the cheat-sheat chart, but I wanna know the formula.
-
I'm currently working on converting Gary Court's KORC to an in-game version with automatic part detection and automatic celestial body detection, so it should work with other mods, in theory. below is the [uncompleted] UI, I'm quite proud of being able to figure out the new Dialog UI stuff, with the help and support from other mod devs, thanks guys/gals! <3
-
DialogGUITextInput ?
Xyphos replied to Xyphos's topic in KSP1 C# Plugin Development Help and Support
Well, after some testing, I can't figure out how to validate the input - if I want a number-only field, I can get the text just fine, but setting that text doesn't seem to have any effect.