Page 7 of 19 FirstFirst ... 5678917 ... LastLast
Results 61 to 70 of 181

Thread: Space Computer. Brought to you by kOS and hopefully many nerds.

  1. #61
    OMG I don't know why I would want the computer to do the calculation once when it could obviously be wasting cpu cycles doing over and over. Is that a trick question? You don't need a control loop to handle this. I see your loop doesn't even start until eta:apoapsis < 30. What if you have a burn time longer than one minute? What happens then? That could happen with a highly elliptical orbit and a low TWR insertion stage.
    What else do you want to use those CPU cycles for? Are you trying to play doom on kOS while circularizing? If you're worried that it hogs down your actual CPU just add a "wait 0.05" in the loop. A control loop is less error prone and more versatile in my opinion.

    Oh, and if you'd read the script you'd see that if the burntime was longer than 1 minute the ship would just pitch up or down to keep eta:apoapsis close to 0. So it would work just fine.

  2. #62
    Quote Originally Posted by Ralathon View Post
    What else do you want to use those CPU cycles for? Are you trying to play doom on kOS while circularizing? If you're worried that it hogs down your actual CPU just add a "wait 0.05" in the loop. A control loop is less error prone and more versatile in my opinion.

    Oh, and if you'd read the script you'd see that if the burntime was longer than 1 minute the ship would just pitch up or down to keep eta:apoapsis close to 0. So it would work just fine.
    I don't know about you, but my FPS tanks drastically when running anything but simple loops in kOS. Also my answer to what could I be doing with those CPU cycles. I don't know... Hmm stage watching maybe... Perhaps.. Low fuel warning. Basically anything I want.

  3. #63
    Ambient occlusion baker Cpt. Kipard's Avatar
    Join Date
    Jun 2013
    Location
    Planet Dirt
    Posts
    2,303
    Quote Originally Posted by Payload View Post
    Also closely corroborated by that Orbital calc.
    In other words wrong. You keep confusing concepts and variables. All you did was calculate the difference between orbital speeds of two different circular orbits. That's not the same as calculating the necessary dv for each burn. Even on that page it tells you how much dv you need to expend:

    periapsis: 1250.0000 km, apoapsis: 1300.0000 km
    periapsis: 650.0000 km AMSL, apoapsis: 700.0000 km AMSL

    velocity at periapsis: 1697.0 m/s, at apoapsis: 1631.7 m/s
    Hohmann delta-v at periapsis: 16.4 m/s, at apoapsis: 16.2 m/s
    Vesc at periapsis: 2376.7 m/s, at apoapsis: 2330.5 m/s

    period: 80.2 minutes
    semimajor axis: 1275.0000 km
    semiminor axis: 1274.7549 km
    eccentricity: 0.0
    specific orbital energy: -1384.4682 kJ/kg

    Why is this so hard to grasp? You keep screwing up because you're trying to do short cuts and it's getting ridiculous. If you want to time your burn with a variable then just do what I explained to you.
    Quote Originally Posted by pxi View Post
    My two currency units while the 4 Door
    Sedan of Measured Expectations
    waits at the traffic-lights.
    Public Service Announcement
    Mod Development Links Compilation
    Intermediate Texturing Guide
    Panels and Edge Damage Texturing
    Landing Gear Rigging

  4. #64
    Quote Originally Posted by Cpt. Kipard View Post
    In other words wrong. You keep confusing concepts and variables. All you did was calculate the difference between orbital speeds of two different circular orbits. That's not the same as calculating the necessary dv for each burn. Even on that page it tells you how much dv you need to expend:

    periapsis: 1250.0000 km, apoapsis: 1300.0000 km
    periapsis: 650.0000 km AMSL, apoapsis: 700.0000 km AMSL

    velocity at periapsis: 1697.0 m/s, at apoapsis: 1631.7 m/s
    Hohmann delta-v at periapsis: 16.4 m/s, at apoapsis: 16.2 m/s
    Vesc at periapsis: 2376.7 m/s, at apoapsis: 2330.5 m/s

    period: 80.2 minutes
    semimajor axis: 1275.0000 km
    semiminor axis: 1274.7549 km
    eccentricity: 0.0
    specific orbital energy: -1384.4682 kJ/kg

    Why is this so hard to grasp? You keep screwing up because you're trying to do short cuts and it's getting ridiculous. If you want to time your burn with a variable then just do what I explained to you.
    Too bad it's not wrong. You aren't understanding what the calculator is telling you.

    periapsis: 600.0000 km, apoapsis: 700.0000 km
    periapsis: 0.0000 km AMSL, apoapsis: 100.0000 km AMSL

    velocity at periapsis: 2517.3 m/s, at apoapsis: 2157.7 m/s
    Hohmann delta-v at periapsis: 91.6 m/s, at apoapsis: 88.1 m/s
    Vesc at periapsis: 3430.4 m/s, at apoapsis: 3176.0 m/s

    period: 29.2 minutes
    semimajor axis: 650.0000 km
    semiminor axis: 648.0741 km
    eccentricity: 0.1
    specific orbital energy: -2715.6877 kJ/kg

    -----------------------------------------------------------------------------------------

    periapsis: 650.0000 km, apoapsis: 650.0000 km
    periapsis: 50.0000 km AMSL, apoapsis: 50.0000 km AMSL

    velocity at periapsis: 2330.5 m/s, at apoapsis: 2330.5 m/s
    Hohmann delta-v at periapsis: 0.0 m/s, at apoapsis: 0.0 m/s
    Vesc at periapsis: 3295.9 m/s, at apoapsis: 3295.9 m/s

    period: 29.2 minutes
    semimajor axis: 650.0000 km
    semiminor axis: 650.0000 km
    eccentricity: 0.0
    specific orbital energy: -2715.6877 kJ/kg

    Noticing anything similar?
    You can do that with any orbit.
    _______________________________________________

    50k and 200k what's the SMA? It's 725k that's what. What is the SMA of 125k circular orbit? Is it 725k? What is the orbital period?

    periapsis: 650.0000 km, apoapsis: 800.0000 km
    periapsis: 50.0000 km AMSL, apoapsis: 200.0000 km AMSL

    velocity at periapsis: 2448.1 m/s, at apoapsis: 1989.1 m/s
    Hohmann delta-v at periapsis: 117.6 m/s, at apoapsis: 111.6 m/s
    Vesc at periapsis: 3295.9 m/s, at apoapsis: 2970.9 m/s

    period: 34.4 minutes
    semimajor axis: 725.0000 km
    semiminor axis: 721.1103 km
    eccentricity: 0.1
    specific orbital energy: -2434.7545 kJ/kg

    -------------------------------------------------------------------------------------------

    What about 125 circular.

    periapsis: 725.0000 km, apoapsis: 725.0000 km
    periapsis: 125.0000 km AMSL, apoapsis: 125.0000 km AMSL

    velocity at periapsis: 2206.7 m/s, at apoapsis: 2206.7 m/s
    Hohmann delta-v at periapsis: 0.0 m/s, at apoapsis: 0.0 m/s
    Vesc at periapsis: 3120.7 m/s, at apoapsis: 3120.7 m/s

    period: 34.4 minutes
    semimajor axis: 725.0000 km
    semiminor axis: 725.0000 km
    eccentricity: 0.0
    specific orbital energy: -2434.7545 kJ/kg

    __________________________________________________ _______

    But lets do yours.
    You have set periapsis to 650k and apoapsis to 700k. Alright no problem
    650000+700000/2 + 600000 = 1275000 SMA? Lets just see..

    periapsis: 1250.0000 km, apoapsis: 1300.0000 km
    periapsis: 650.0000 km AMSL, apoapsis: 700.0000 km AMSL

    velocity at periapsis: 1697.0 m/s, at apoapsis: 1631.7 m/s
    Hohmann delta-v at periapsis: 16.4 m/s, at apoapsis: 16.2 m/s
    Vesc at periapsis: 2376.7 m/s, at apoapsis: 2330.5 m/s

    period: 80.2 minutes
    semimajor axis: 1275.0000 km
    semiminor axis: 1274.7549 km
    eccentricity: 0.0
    specific orbital energy: -1384.4682 kJ/kg

    Note the orbital period.
    Now lets see what the SMA is for a 675 circular... Hmmm. Could it possibly be 1275k. I don't know since I am apparently dumb. Lets have the calculator find out for us.

    periapsis: 1275.0000 km, apoapsis: 1275.0000 km
    periapsis: 675.0000 km AMSL, apoapsis: 675.0000 km AMSL

    velocity at periapsis: 1664.0 m/s, at apoapsis: 1664.0 m/s
    Hohmann delta-v at periapsis: 0.0 m/s, at apoapsis: 0.0 m/s
    Vesc at periapsis: 2353.3 m/s, at apoapsis: 2353.3 m/s

    period: 80.2 minutes
    semimajor axis: 1275.0000 km
    semiminor axis: 1275.0000 km
    eccentricity: 0.0
    specific orbital energy: -1384.4682 kJ/kg

    That must be wizardry I guess.

    Thus I pontificate that periapsis+apoapsis/2 + 600000 is exactly the same calc as circular. Thus you can treat any orbit as circular as long as you replace orbital altitude with the average orbital altitude. The periods are the same. The average speed is the same. The SMA is the same.
    Read this.
    http://en.wikipedia.org/wiki/Orbital_speed
    It's a mathematical fact. You only need to know your average orbital altitude to get the SMA. Being in a 0k by 100k orbit is exactly the same as being in a 50k x 50k orbit. Well if you don't factor in that smacking into the ground problem anyway.

    This is stupid really because we are arguing about the same thing just thinking about it differently. We should stop now. I'm getting correct answers and if it wasn't for you I wouldn't be.
    Last edited by Payload; 6th September 2013 at 07:49.

  5. #65
    Ambient occlusion baker Cpt. Kipard's Avatar
    Join Date
    Jun 2013
    Location
    Planet Dirt
    Posts
    2,303
    If you look at a dictionary definition for "Red Herring", then you'll see the above post. But that's ok, I'll just wait for your script.
    Quote Originally Posted by pxi View Post
    My two currency units while the 4 Door
    Sedan of Measured Expectations
    waits at the traffic-lights.
    Public Service Announcement
    Mod Development Links Compilation
    Intermediate Texturing Guide
    Panels and Edge Damage Texturing
    Landing Gear Rigging

  6. #66
    Quote Originally Posted by Cpt. Kipard View Post
    If you look at a dictionary definition for "Red Herring", then you'll see the above post. But that's ok, I'll just wait for your script.
    Why wait.

    Code:
    set fApoapsis to 700000.
    set fPeriapsis to 650000.
    
    set Gk to 3.5316000*10^12.
    set Radius to 600000 + fApoapsis.
    set iRadius to 600000 + ((fApoapsis+fPeriapsis)/2).
    set tVel to (Gk/Radius)^0.5.
    set iVel to (Gk/iRadius)^0.5.
    set reqdV to (iVel-tVel).
    set acceleration to (maxthrust/mass).
    set burnTime to (reqdV/acceleration).
    set tTime to (burnTime/2).
    print "".
    print Radius.
    print iRadius.
    print iVel.
    print tVel.
    print reqdV.
    print burnTime.
    print tTime.
    
    set aRadius to 600000 + fApoapsis.
    set pRadius to 600000 + fPeriapsis.
    set aVel to (Gk/aRadius)^0.5.
    set pVel to (Gk/pRadius)^0.5.
    set reqdV2 to ((pVel-aVel)/2).
    set acceleration2 to (maxthrust/mass).
    set burnTime2 to (reqdV/acceleration).
    set tTime2 to (burnTime/2).
    print " ".
    print aRadius.
    print pRadius.
    print aVel.
    print pVel.
    print reqdV2.
    print burnTime2.
    print tTime2.
    print " ".
    if burnTime = burnTime2 { print "The burntimes are the same or this wouldn't print.". }.


    Now add your orbital calc to the bottom and see how different your burnTime is than mine. I'm interested since kOS barely has 1 second resolution anyway. Use the same constant since that is what is on the KSP wiki.


    Well I guess we will have to call that close enough to good.

  7. #67
    Quote Originally Posted by Payload View Post
    Why wait.

    Code:
    set fApoapsis to 700000.
    set fPeriapsis to 650000.
    
    set Gk to 3.5316000*10^12.
    set Radius to 600000 + fApoapsis.
    set iRadius to 600000 + ((fApoapsis+fPeriapsis)/2).
    set tVel to (Gk/Radius)^0.5.
    set iVel to (Gk/iRadius)^0.5.
    set reqdV to (iVel-tVel).
    set acceleration to (maxthrust/mass).
    set burnTime to (reqdV/acceleration).
    set tTime to (burnTime/2).
    print "".
    print Radius.
    print iRadius.
    print iVel.
    print tVel.
    print reqdV.
    print burnTime.
    print tTime.
    
    set aRadius to 600000 + fApoapsis.
    set pRadius to 600000 + fPeriapsis.
    set aVel to (Gk/aRadius)^0.5.
    set pVel to (Gk/pRadius)^0.5.
    set reqdV2 to ((pVel-aVel)/2).
    set acceleration2 to (maxthrust/mass).
    set burnTime2 to (reqdV/acceleration).
    set tTime2 to (burnTime/2).
    print " ".
    print aRadius.
    print pRadius.
    print aVel.
    print pVel.
    print reqdV2.
    print burnTime2.
    print tTime2.
    print " ".
    if burnTime = burnTime2 { print "The burntimes are the same or this wouldn't print.". }.


    Now add your orbital calc to the bottom and see how different your burnTime is than mine. I'm interested since kOS barely has 1 second resolution anyway. Use the same constant since that is what is on the KSP wiki.


    Well I guess we will have to call that close enough to good.

    Thanks for this Payload. I'm going to test out setting up actual burn times for my circularization burn scripts now, considering mine was more of the loop until correct method, and while working, was rather slow.

  8. #68
    Quote Originally Posted by Desrtfox View Post
    Thanks for this Payload. I'm going to test out setting up actual burn times for my circularization burn scripts now, considering mine was more of the loop until correct method, and while working, was rather slow.
    Don't thank me yet. I may not be right! I only think I'm right! Plus I'm pretty sure that even though this works just fine for burn time. It may not work very well if you are counting on the dV to be accurate for MECO. Like I said, I use pure logic for MECO.

    Current testing says it reduces my eccentricity by a factor of 8.

    I bet someone recognizes this baby.



    Before I added the burn time calc, this was giving me a .008 eccentricity. Orbital parameters at time of calc. I was 69500m into a -100k x 100k orbit.

    Still I prefer this.




    That is the Jebpollo. It's got everything for a single guy. You will just have to pretend there are three.

    Here is the craft file for Jebpollo. http://pastebin.com/2zp4N9MU Just save it as Jebpollo.craft in notepad. Make sure you are set it to all files so you don't get Jebpollo.craft.txt.

    Here is the script that runs her. Make sure you remove the comments. Comments don't parse yet as far as I know. I just haven't worked the asparagus variables into the menu system yet. I haven't quite decided how I will do it. So that is why the comments are there incase you want to use asparagus staging you will know how.

    Code:
    clearscreen.
    set rpAlt to 100.
    set rProgram to 90.
    set r to 180.
    set p to 0.
    set y to 0.
    set orbit to 0.
    set tOrbit to 100000.
    set hAtmo to 69500.
    set tAngle to up + R(y,p,r).
    set tThr to 1.
    set turn1 to 9999.
    set turn2 to 14999.
    set turn3 to 19999.
    set turn4 to 24999.
    set turn5 to 49000.
    set selection to 0.
    set flagup to 0.
    set flagdown to 0.
    set confirm to 0.
                        // If your rocket has no aparagus stages set Count to 0.
    set Count to 0.     // For aparagus. Count = Number of asparagus stages.
    set aspFuel to 0.   // aspFuel = The amount of liquidfuel in one asparagus stage.
    
    on abort { toggle ag2. wait until verticalspeed < 0. toggle ag3. }.
    
    print "Select your orbit altitude.".
    print "--------------------------------".
    print " ".
    print " ".
    print "Use action group 9 to add 10Km to orbit alt.".
    print " ".
    print "Use action group 8 to remove 10Km from orbit alt.".
    print " ".
    print "Use action group 7 to confirm orbit alt.".
    
    until selection = 1
     {
    on ag9 set flagup to 1.
    on ag8 set flagdown to 1.
    on ag7 set confirm to 1.
     
     if flagup = 1
     {
     clearscreen.
     print "Select your orbit altitude.".
     print "--------------------------------".
     print " ".
     print "Default orbit alt is set to " + tOrbit + "m".
     print " ".
     print "Use action group 9 to add 10Km to orbit alt.".
     print " ".
     print "Use action group 8 to remove 10Km from orbit alt.".
     print " ".
     print "Use action group 7 to confirm orbit alt.".
     print " ".
     set tOrbit to tOrbit + 10000.
     print "You have selected " + tOrbit.
     toggle ag9.
     set flagup to 0.
     }.
     
     if flagdown = 1
     {
     clearscreen.
     print "Select your orbit altitude.".
     print "--------------------------------".
     print "".
     print "Default orbit alt is set to " + tOrbit + "m".
     print " ".
     print "Use action group 9 to add 10Km to orbit alt.".
     print " ".
     print "Use action group 8 to remove 10Km from orbit alt.".
     print " ".
     print "Use action group 7 to confirm orbit alt.".
     print " ".
     set tOrbit to tOrbit - 10000.
     if tOrbit < 80000 { set tOrbit to 80000. }.
     print "You have selected " + tOrbit + "m".
     toggle ag8.
     set flagdown to 0.
     }.
     
     if confirm = 1
     {
     clearscreen.
     print " ".
     print "You have confirmed " + tOrbit + "m".
     print " ".
     print "Lift Off in 5s.".
     toggle ag7.
     set confirm to 0.
     wait 2.
     set selection to 1.
     }.
     }.
    
    set xOrbit to tOrbit + 1000.
    set cAlt to tOrbit - (tOrbit*.05).
    set xAlt to tOrbit - 1000.
    set hAlt to tOrbit - 5.
    clearscreen.
    print "Orbit altitude set to " + tOrbit + "m".
    lock steering to tAngle.
    lock throttle to tThr.
    
    print "3". wait 1.
    print "2". wait 1.
    print "1". Wait 1.
    Print "Lift Off!". stage.
    
    set StartFuel to <liquidfuel>.
    
    
    when altitude > rpAlt then
     {
     set r to rProgram.
     print "Roll Program".
     }.
    
    when altitude > turn1 then set p to -35.
    when altitude > turn2 then set p to -45.
    when altitude > turn3 then set p to -60.
    when altitude > turn4 then set p to -75.
    when apoapsis > turn5 then set p to -90.
    
    when apoapsis > tOrbit then
     {
     toggle ag5.
     set tThr to 0.
     set Gk to 3.5316000*10^12.
     set Radius to 600000 + apoapsis.
     set iRadius to 600000 + ((apoapsis+periapsis)/2).
     set tVel to (Gk/Radius)^0.5.
     set iVel to (Gk/iRadius)^0.5.
     set reqdV to (iVel-tVel).
     set acceleration to (maxthrust/mass).
     set burnTime to (reqdV/acceleration).
     set tTime to (burnTime/2).
     until altitude > hAtmo
     {
     if apoapsis < hAlt { set tThr to .1. }.
     if apoapsis > tOrbit { set tThr to 0. }.
     }.
     when eta:apoapsis < tTime then set tThr to 1.
     }.
    
    when periapsis > cAlt then set tThr to .1.
    when periapsis > xAlt then
     {
     if periapsis > xAlt OR apoapsis > xOrbit
     {
     set tThr to 0.
     sas on.
     print "You Are Now In Orbit".
     set orbit to 1.
     }.
     }.
     
    until orbit = 1
     {
     set StageSolid to stage:solidfuel.
     Set StageLiquid to stage:liquidfuel.
     set Lfuel to <liquidfuel>.
     set tAngle to up + R(y,p,r).
     
     if Lfuel < StartFuel - aspFuel AND Count > 0
     { stage. set StartFuel to Lfuel. set Count to Count - 1. }.
     
     if StageSolid > 0 AND StageSolid < 1
     { stage. }.
    
     if StageLiquid = 0 AND StageSolid = 0
     { if Lfuel > 0 { wait .1. stage. }. }.
     }.
     
    set tThr to 0.
    toggle ag1.
    print " ".
    print "Apoapsis is " + apoapsis + "m".
    print " ".
    print "Periapsis is " + periapsis + "m".
    print " ".
    print "Orbital Eccentricity is " +
     (((apoapsis + 600000)-(periapsis + 600000))/((apoapsis + 600000)+(periapsis + 600000))).
    print " ".
    EDIT: I forgot to add! Try the abort sequence anytime after lift off. Click the abort button to the left of the altimeter and wait. It does everything else. I still have to do it about 20 more times before I get it out of my system. So simple yet so cool.
    Last edited by Payload; 6th September 2013 at 12:48.

  9. #69
    Quote Originally Posted by Steven Mading View Post
    Another thing the language could use that I just ran into:

    There's no way to abort the program other than trying to if-check around the whole thing. I wanted to put a check at the front of my script to say this:
    Code:
    if maxthrust = 0 { 
      print "ABORTING PROGRAM: No active engines right now.".
      print "Do not run until after you've started up the engines.".
      ...Crud what goes here? break?  abort?...
    }.
    ... rest of program continues on from here.
    There needs to be an "exit" or something like that. Or perhaps allow "break" outside a loop to mean exit.

    Use CNTRL-C in the kOS window to break out of the program if you need to. I'm not really sure what your issue is. If you program is written correctly it should end when it's end conditions are met. The end condition can be written in to your main loop or it can be set to be before that with a "when then". I don't think this is something wrong with kOS or it's missing anything. It has everything you need. You just have to learn to use it. For instance my launch to orbit script ends when you are either in orbit or it knows you aren't going to make it.

  10. #70
    Quote Originally Posted by JewelShisen View Post
    Clearly you missed what he is looking for. He is looking for some way to have the program self abort if you haven't started the engines. There is no 'abort' command to kill an entire program.
    What you are talking about already exist. He just hasn't set it up correctly.

    If you get stuck in a loop because of a program error you can just hit CNTRL-C.
    Last edited by Leonov; 8th September 2013 at 23:31.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •