wingnut
Members-
Posts
27 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by wingnut
-
Because you need the True Anomaly to calculate your altitude and speed at any point in the orbit in contrast to Altitude and velocity:orbit:mag only returning the current values. I think the discrepancies may have something to do with the way Sin and Cos are calculated but I'm not sure. I've setup virtually the same script in a Java class and I get accurate results there...
-
Could someone please review a script for me which is supposed to calculate true anomaly in an eccentric orbit and after that the altitude and speed at this true anomaly. The script seems to deliver results which are not completely wrong but I can't verify that the calculated true anomaly is correct. Further to this, the calculated altitude and speed always seem to be corresponding to the periapsis even when I enter different mean anomalies. My script is based on the algorithm found on http://www.jgiesen.de/kepler/kepler.html as well as the equations and example problems of the Orbital Mechanics page on http://www.braeunig.us/space/. This is the script: // True anomaly set mu to 3.5316000*10^12. // gravitational parameter set rb to 600000. // radius of body declare parameter tof. set a to (rb*2 + periapsis + apoapsis)/2. //SMa set ec to ((rb+apoapsis) - (rb+periapsis))/((rb+apoapsis) + (rb+periapsis)). //eccentricity set t to 2*3.14159*sqrt(a^3/mu). //orbital period set n to sqrt(mu/a^3). //mean motion set M to n * tof. //mean anomaly at tof seconds after periapsis set maxiter to 30. set delta to 10^-3. set i to 0. if ec < 0.8 {set E to m.} //eccentric anomaly if ec >= 0.8 {set E to 3.14159.} set F to E - ec * sin(m) - m. set absF to F. if absF < 0 {set absF to F * (-1).} until absF <= delta OR i < maxiter { set E to E - F / (1.0 - ec * cos(E)). set F to E - ec * sin(E) - m. set absF to F. if absF < 0 {set absF to F * (-1).} set i to i + 1. } //set E to E / (3.14159 / 180). // convert to degree set fak to sqrt(1.0 - ec^2). set phi to arctan2(fak * sin(E), cos(E) - ec). set r to a * (1 - ec^2) / (1 + ec * cos(phi)). // altitude at true anomaly set v to sqrt(mu * (2 / r - 1 / a)). // velocity at true anomaly print "Elements for " + multi + " seconds after periapsis". log "Elements for " + multi + " seconds after periapsis" to orblog. print "True anomaly: " + phi. log "True anomaly: " + phi to orblog. print "Mean anomaly: " + M. log "Mean anomaly: " + M to orblog. print "Eccentric anomaly: " + E. log "Eccentric anomaly: " + E to orblog. print "Radius: " + r. log "Radius: " + r to orblog. print "Speed: " + v. log "Speed: " + v to orblog. This is output created by the script for a ca. 80km x 1,000 km Kerbin orbit: Elements for 3037.5 seconds after periapsis True anomaly: 5.77998497874809 Mean anomaly: 3.14123160679727 Eccentric anomaly: 3.14123160679727 Radius: 679672.744713293 Speed: 2832.04616886257 Elements for 0 seconds after periapsis True anomaly: 0 Mean anomaly: 0 Eccentric anomaly: 0 Radius: 678454.711152033 Speed: 2835.3381463772 Elements for 1518.75 seconds after periapsis True anomaly: 2.89128867366892 Mean anomaly: 1.57061583805724 Eccentric anomaly: 1.57061583805724 Radius: 678759.294063534 Speed: 2834.51419835746
-
D'oh. Thanks. I already figured it had something to do with the print or log statements but I did not spot the incorrect strings.
-
This is one of the scripts I'm trying to run and I'm almost certain that I did not change anything before it stopped working. But something significant must have been changed, why would it stop working then?: declare parameter apo. set var to altitude. lock throttle to 1. SAS ON. STAGE. wait until altitude > var. PRINT "GET:"+round(missiontime)+" LIFTOFF". log "GET:"+round(missiontime)+" LIFTOFF" to shiplog. wait until altitude > 10000. print "GET:"+round(missiontime)+" INITIATE PITCH PROGRAMME". log "GET:"+round(missiontime)+" INITIATE PITCH PROGRAMME" to shiplog. SAS OFF. lock steering to heading 90 by 45. print "GET:"+round(missiontime)+" PITCH TO 45". log "GET:"+round(missiontime)+" PITCH TO 45" to shiplog. wait until apoapsis > 70000. lock steering to heading 90 by 0. print "GET:"+round(missiontime)+" PITCH TO 90". log "GET:"+round(missiontime)+" PITCH TO 90" to shiplog. until apoapsis > apo { if stage:liquidfuel < 1 { break. }. }. lock throttle to 0. print "GET:"+round(missiontime)+" MECO". log "GET:"+round(missiontime)+" MECO" to shiplog. log "GET:"+round(missiontime)+" "+ FLOOR(STAGE:LIQUIDFUEL) + "/" + FLOOR(STAGE:OXIDIZER) + " PROPELLANT/OXIDIZER REMAINING" to shiplog. wait 1. STAGE. print "GET:"+round(missiontime)+" STAGE 1 SEPARATION". log "GET:"+round(missiontime)+" STAGE 1 SEPARATION" to shiplog. lock steering to PROGRADE. wait until eta:apoapsis < 60. set r to 600000. set os to r*sqrt(9.807/(r+apoapsis)). set vel to velocity:orbit. set dv to sqrt(vel:x^2 + vel:y^2 + vel:z^2). set dv to os - dv. set bt to dv/(maxthrust/mass). print "GET:"+round(missiontime)+" ORBIT INSERTION BURN. BT " + round(bt,2) + "s". log "GET:"+round(missiontime)+" ORBIT INSERTION BURN. BT " + round(bt,2) + "s" to shiplog. wait until eta:apoapsis < bt/2 + 1. lock throttle to 1. wait until periapsis > 70000. until periapsis > 70000 { if stage:liquidfuel < 1 { break. }. }. set ecc to ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). until ecc < 0.1 { set ecc TO ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). if ecc < ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)) { break. }. }. lock throttle to 0.5. until ecc < 0.05 { set ecc TO ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). if ecc < ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)) { break. }. }. lock throttle to 0.3. until ecc < 0.005 { set ecc TO ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). if ecc < ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)) { break. }. }. lock throttle to 0. TOGGLE AG2. PRINT "GET:"+round(missiontime)+" INSERTION BURN COMPLETE". log "GET:"+round(missiontime)+" INSERTION BURN COMPLETE" to shiplog. set ecc to ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). print "GET:"+round(missiontime)+" ECCENTRICITY " + round(ecc, 4). log "GET:"+round(missiontime)+" ECCENTRICITY " + round(ecc, 4) to shiplog. log "GET:"+round(missiontime)+" "+floor(STAGE:LIQUIDFUEL) + "/" + floor(STAGE:OXIDIZER) + " PROPELLANT/OXIDIZER REMAINING" to shiplog. STAGE. print "GET:"+round(missiontime)+" "PAYLOAD RELEASED". log "GET:"+round(missiontime)+" "PAYLOAD RELEASED" to shiplog. I have other scripts which cause the game to freeze as well when run from the launchpad. It doesn't matter if the script is run from the archive or copied to the vehicle's volume and run from there - both cases cause a freeze. Edit: this is the previous version of the script which still works on the launchpad: I checked it with Tortoise Merge and there are some changes of whitespaces in a couple of lines and I removed some print statements which were paired with log statements. I didn't have the time to investigate it more thoroughly yet. declare parameter apo. set var to altitude. lock throttle to 1. SAS ON. STAGE. wait until altitude > var. PRINT "GET:"+round(missiontime)+" LIFTOFF". log "GET:"+round(missiontime)+" LIFTOFF" to shiplog. wait until altitude > 10000. print "GET:"+round(missiontime)+" INITIATE PITCH PROGRAMME". log "GET:"+round(missiontime)+" INITIATE PITCH PROGRAMME" to shiplog. SAS OFF. lock steering to heading 90 by 45. print "GET:"+round(missiontime)+" PITCH TO 45". log "GET:"+round(missiontime)+" PITCH TO 45" to shiplog. wait until apoapsis > 70000. lock steering to heading 90 by 0. print "GET:"+round(missiontime)+" PITCH TO 90". log "GET:"+round(missiontime)+" PITCH TO 90" to shiplog. until apoapsis > apo { if stage:liquidfuel < 1 { print "GET:"+round(missiontime)+" TARGET APOAPSIS NOT REACHED". log "GET:"+round(missiontime)+" TARGET APOAPSIS NOT REACHED" to shiplog. break. }. }. lock throttle to 0. print "GET:"+round(missiontime)+" MECO". log "GET:"+round(missiontime)+" MECO" to shiplog. print "GET:"+round(missiontime)+" "+ FLOOR(STAGE:LIQUIDFUEL) + "/" + FLOOR(STAGE:OXIDIZER) + " PROPELLANT/OXIDIZER REMAINING". log "GET:"+round(missiontime)+" "+ FLOOR(STAGE:LIQUIDFUEL) + "/" + FLOOR(STAGE:OXIDIZER) + " PROPELLANT/OXIDIZER REMAINING" to shiplog. wait 1. STAGE. print "GET:"+round(missiontime)+" STAGE 1 SEPARATION". log "GET:"+round(missiontime)+" STAGE 1 SEPARATION" to shiplog. lock steering to PROGRADE. wait until eta:apoapsis < 60. set r to 600000. set os to r*sqrt(9.807/(r+apoapsis)). set vel to velocity:orbit. set dv to sqrt(vel:x^2 + vel:y^2 + vel:z^2). set dv to os - dv. set bt to dv/(maxthrust/mass). print "GET:"+round(missiontime)+" ORBIT INSERTION BURN. BT " + round(bt,2) + "s". log "GET:"+round(missiontime)+" ORBIT INSERTION BURN. BT " + round(bt,2) + "s" to shiplog. wait until eta:apoapsis < bt/2 + 1. lock throttle to 1. wait until periapsis > 70000. until periapsis > 70000 { if stage:liquidfuel < 1 { break. }. }. set ecc to ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). until ecc < 0.1 { set ecc TO ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). if ecc < ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)) { break. }. }. lock throttle to 0.5. until ecc < 0.05 { set ecc TO ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). if ecc < ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)) { break. }. }. lock throttle to 0.3. until ecc < 0.005 { set ecc TO ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). if ecc < ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)) { break. }. }. lock throttle to 0. TOGGLE AG2. PRINT "GET:"+round(missiontime)+" CIRCULARIZATION BURN COMPLETE". log "GET:"+round(missiontime)+" CIRCULARIZATION BURN COMPLETE" to shiplog. set ecc to ((r+apoapsis) - (r+periapsis))/((r+apoapsis) + (r+periapsis)). print "GET:"+round(missiontime)+" ECCENTRICITY " + round(ecc, 4). log "GET:"+round(missiontime)+" ECCENTRICITY " + round(ecc, 4) to shiplog. print "GET:"+round(missiontime)+" "+floor(STAGE:LIQUIDFUEL) + "/" + floor(STAGE:OXIDIZER) + " PROPELLANT/OXIDIZER REMAINING". log "GET:"+round(missiontime)+" "+floor(STAGE:LIQUIDFUEL) + "/" + floor(STAGE:OXIDIZER) + " PROPELLANT/OXIDIZER REMAINING" to shiplog. print "GET:"+round(missiontime)+" ANTENNA DEPLOYED". log "GET:"+round(missiontime)+" ANTENNA DEPLOYED" to shiplog.
-
Did any of you have a problem before, that running a script from the launchpad freezes your game?
-
Thank you baloan for your explanation. I have follow-up questions please as I am still not able to identify which formula on the Elliptic orbit page you used as basis for your velocity calculations, namely those two lines: set va to sqrt( vom^2 + 2*mu*(1/ra - 1/r) ). set v2 to sqrt( vom^2 + (mu * (2/r2 - 2/r + 1/a - 1/a2 ) ) ). Did you use thie velocity or the energy formula as basis and what did you change to get the tow equations from above?
-
Baloan, which formula did you use to calculate the deltav for the periapsis node to raise apoapsis? I'm trying to create a node at periapsis with the Hohmann transfer orbit formula but the projected apoapsis always turns out to be higher than specified in the parameter, this is my script launched from a low Kerbin orbit with an eccentricity of roughly 0.03: DECLARE PARAMETER x. SET r TO 600000. SET sma TO (APOAPSIS+2*r+PERIAPSIS)/2. SET gm TO 3531600000000. SET dv1 TO SQRT(gm/sma)*(SQRT(2*(x+r)/(sma+x+r))-1). ADD NODE(TIME:SECONDS + ETA:PERIAPSIS,0,0,dv1).
-
Thanks Oan, now the calculation in my spreadsheet has a result after all and it is equal to yours.
-
SanderB and Oan, could you please post examples for both your formulas? In Oan's formula I am not clear what y0 is supposed to be. In SanderB's formular I don't know where to get the velocity of descent Vd from and likewise Ga. Could you please post an example for a suicide burn of a vessel in a 20x20 km Mun orbit with a weight of 5 tons and thrust of 20 kN?
-
Not sure if this helps, but the same message is shown in a previous version of KSPTOT. I'm not sure though which version it is, there is only the Flyby Maneuver Sequencer and Optimal Two Burn Orbit change items in the Tools menue. Update: D'oh! Well, in the meantime I noticed that I copied the SMa value directly from the persistent.sfs file without noticing that this value represents meters instead of the expected kilometers in KSPTOT. When I input the value as is expected, then the two burn solution is computed fine. My bad.
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
Hi Arrowstar There appears to be an error in the Optimal Two Burn Orbit Change window/function: The following input into the Optimal Two Burn Orbit Change window produces the following error messgae KSPTOT version is 0.10 MATLAB compiler runtime is v81 as far as I can tell.
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
I was thinking of this Maximum Total Flight Time constraint highlighted in the red rectangle from your Optimization Tool for Orbiter:
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
Arrowstar, do you have plans to include flight constraints like maximum flight time for high energy transfer orbits?
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
Read the tooltip when you hover your mouse over the comic.
-
I posted the content of the persistent.sfs file which I was not able to load into KSP TOT to pastebin since there is a limitation on the amount of characters in a post on this forum: http://pastebin.com/YKW3jC6t I also tried running KSP TOT with administrator rights to no avail (Windows 7).
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
Hi Arrowstar I'm having strange results on a trip to Eve from Kerbin. The trajectory KSP TOT calculated is way off and I can't figure out why. I do not rule out an entry error on my end of course but I would be glad if anyone could have a look: I did not use MechJeb but the method of entering the result from the Departure Burn Optimizer into the Maneuver Node editor worked perfectly on a previous mission to Eve. The "select orbit from .sfs file" feature did not work as well in this session. The vessel selection window did not show up, even after several seconds of waiting time. Edit: I set number of synodic periods to calculate to 3 if that does matter.
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
Race into space Hopefully the KSP campaign mode will be inspired by this.
-
Hi Arrowstar, thanks for the detailed instructions on how to use the TOT. Are you going to include a PDF version of the instructions in the next release?
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
I made similar experience like adammada with a Kerbin->Eve->Kerbin flyby optimization. Thanks to MechJeb executing the departure burn, the outbound orbit from LKO and the Sun-centric orbit were relatively accurate (much more than when I would do the burn manually of course) but not accurate enough to actually enter Eve's and Kerbin's SOI. Consequently at least one additional maneuver would be required. Nevertheless I'm amazed that it works out so well already, without your tool I never would have figured out when and how to depart for such a mission in the first place. Is the departure time the time when I start the burn in LKO or the time when the ship is leaving Kerbin's SOI?
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
That's good news Arrowstar. I've run the Kerbin-Eve-Moho flyby scenario with the KSPTOTv7prerelease2: Calculating the initial positions took 2:40 minutes The Particle swarm optimization took 3:55 minutes This is a screenshot of my resource monitor during the first third of the Particle swarm optimization: The CPU usage was between 24 and 27% during the initial positions calculation. The CPU usage during the Particle swarm optimization was fluctuating between 26 and ~65%. Output: Hyperbolic Departure & Flyby Orbits: Hyperbolic Departure Orbit from Kerbin --------------------------------------------- Semi-major Axis = -2753.593 km Eccentricity = 1.2905 Inclination = 7.675 deg Right Ascension of AN = 236.603 deg Argument of Periapse = 0.000 deg --------------------------------------------- Inbound Hyperbolic Flyby Orbit to Eve --------------------------------------------- Semi-major Axis = -1455.331 km Eccentricity = 2.7298 Inclination = 166.920 deg Right Ascension of AN = 244.223 deg Argument of Periapse = 169.668 deg Periapse Radius = 2517.403 km --------------------------------------------- Outbound Hyperbolic Flyby Orbit from Eve --------------------------------------------- Semi-major Axis = -1455.330 km Eccentricity = 2.7298 Inclination = 166.920 deg Right Ascension of AN = 244.223 deg Argument of Periapse = 169.668 deg Periapse Radius = 2517.403 km Sun-Centric Transfer Orbit: Phase 1 Transfer Orbit (Kerbin -> Eve) --------------------------------------------- Semi-major Axis = 11073006.720 km Eccentricity = 0.2282 Inclination = 0.672 deg Right Ascension of AN = 107.217 deg Argument of Periapse = 180.202 deg Kerbin Depart True Anomaly = 179.798 deg Eve Arrive True Anomaly = 70.070 deg --------------------------------------------- Phase 2 Transfer Orbit (Eve -> Moho) --------------------------------------------- Semi-major Axis = 8191378.476 km Eccentricity = 0.26514 Inclination = 0.949 deg Right Ascension of AN = 135.733 deg Argument of Periapse = 76.445 deg Eve Depart True Anomaly = 145.315 deg Moho Arrive True Anomaly = 30.400 deg --------------------------------------------- Departure Date = Year 5, Day 223 20:25:29.912 (145398329.912 sec UT) Flyby Date = Year 5, Day 273 06:31:29.541 (149668289.541 sec UT) Arrival Date = Year 5, Day 308 05:00:39.870 (152686839.870 sec UT) DV Maneuver Information: Burn Information to Depart Kerbin --------------------------------------------- Total Delta-V = 1.13291 km/s Prograde Delta-V = 1050.30975 m/s Radial Delta-V = -0.00000 m/s Orbit Normal Delta-V = 424.66546 m/s --------------------- Departure True Anomaly = 236.60284 deg Departure Time Past Peri. = 1572.34027 sec Departure Time Before Peri. = 820.03384 sec --------------------------------------------- Burn Information to Depart Eve --------------------------------------------- Total Delta-V = 0.00000 km/s Prograde Delta-V = 0.00060 m/s Radial Delta-V = -0.00001 m/s Orbit Normal Delta-V = 0.00000 m/s --------------------- Departure True Anomaly = 0.00000 deg Departure Time Past Peri. = 0.00000 sec Departure Time Before Peri. = 0.00000 sec
- 4,935 replies
-
- ksptot
- mission planning
- (and 3 more)
-
Hi Arrowstar, thank you for this wonderful application. I already have Trajectory Optimization Tool v2.1 installed with the corresponding MCR 7.14 - is it possible to run both TOTs (for KSP and Orbiter) on the same MCR? The one for Orbiter did not work when I only had MCR 8.x installed. Will it be possible to enter the same planet as departing and arrival body in the Flyby Maneuver Sequencer, or are you even planning to implement flight plans with multiple customizable waypoints like in the TOT 2.1 for Orbiter? Offtopic: Is there any trick to use the output of the Departure Analysis Tool of the TOT for Orbiter in TransX? When I input it directly into a TransX plan, there is no real encounter...
- 4,935 replies
-
- 1
-
- ksptot
- mission planning
- (and 3 more)
-
Very simple SSTO - orbital stick
wingnut replied to diegzumillo's topic in KSP1 The Spacecraft Exchange
Haha, what an ugly vehicle. Congratulations for getting it into orbit. My SSTO attempts usually fail -
The New Stock Repository Version 0.21
wingnut replied to Maxed-Rockets's topic in KSP1 The Spacecraft Exchange
I want present to you a vehicle I created based on a picture on Moustachauve's ribbon generator site: The Bumblebee LASH (Low Atmospheric SHuttle) Technical data: Crew capacity: 3 Kerbals (unmanned operation capable - OKTO2 command pod on top of the X200-32 fuel tank) Delta-V (vacuum): 4231 m/s Delta-V (sea level): 3641 m/s Total mass (empty): 10.29 t Total mass (full): 34.29 t Thrust to weight ratio (main engines): 1.20 Thrust to weight ratio (VTOL engines): 0.26 Launch vehicle: Delta-V (vacuum): 5606 m/s Delta-V (sea level): 4757 m/s Total mass (empty): 175,12 Total mass (full): 431,12 t Thrust to weight ratio: 2.77 Note: the technical data was calculated 'manually' in a spreadsheet. Technical data calculated by plugins may vary to some degree. The vehicle is hard to control when fully throttled-up. I recommend throttling up slowly and turning on ASAS when the desired throttle state is reached. For VTOL landing right click the docking port on top of the X200-32 fuel tank and select "Control from here". Action groups: Custom 1: Activate main engines (deactivate VTOL engines) Custom 2: Activate VTOL engines (deactivate main engines) Custom 10: Toggle docking port; toggle comm dish; toggle solar panels Screenshots: http://imgur.com/a/iInr7 Download: http://pastebin.com/bvzzTPQn