#Sam Krimmel #3/14/18 #rocket1.py - first rocket program from ggrocket import Rocket, Planet earth = Planet(color=(0x9aa2af), radius=1737400, planetmass=73480000000000000000000, viewscale=0.00002) rocket = Rocket(earth, altitude=100000, velocity=1632, timezoom=3, thrust=1) earth.run(rocket)
from ggrocket import Rocket, Planet earth = Planet(viewscale=0.0005, color=0Xff0000) rocket = Rocket(earth, altitude=2000000, velocity=6900, timezoom=3) earth.run(rocket)
#Sam Krimmel #3/15/18 #rocekt3.py from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer, Slider earth = Planet(planetmass=0) RocketStarted = False StartTime = None BurnTime = 0 me = 25600 mp = 395700 F1D = 716000 N1D = 9 Ftotal = F1D*N1D tburn = 180 vmaxre = Ftotal*tburn/mp*log((me+mp)/me) print("Predicted final velocity (Rocket Equation), vmax: ", vmaxre, "m/s") def GetThrust(): global BurnTime global RocketStarted if RocketStarted: BurnTime = rocket.shiptime - StartTime if BurnTime >= tburn:
# Function for calculating the percent of fuel remaining, as text def FuelPct(self): return "Fuel Supply: {0:.1f}%".format(100 * self.FuelLeft / mdescfuel) # Function for showing the vertical velocity def VertVel(self): if not self.ElapsedTime: return "Vertical Velocity N/A" else: return "Vertical Velocity: {0:.1f} m/s".format(self.DeltaAltitude / self.ElapsedTime) moon = Planet(planetmass=moonmass, radius=moonradius, viewscale=0.02, color=0x202020) tz = Slider((10, 300), 0, 5, 0, positioning="physical", leftkey="a", rightkey="d") #Create and "run" the rocket lander = Lem(moon, altitude=alt, velocity=vel, timescale=tz) moon.run(lander)
from ggrocket import Rocket, Planet earth = Planet(viewscale=0.00005) rocket = Rocket(earth, altitude=400000, velocity=1000, timezoom=1) earth.run(rocket)
from ggrocket import Rocket, Planet earth = Planet(viewscale=0.000005, color=0x800080) rocket = Rocket(earth, altitude=2000000, velocity=6900.39, timezoom=3) earth.run(rocket)
from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer earth = Planet(planetmass=0,viewscale=0.0005) # no gravity to simplify things RocketStarted = False StartTime = None # to keep track of when burn started BurnTime = 0 # keep track of how much time the burn has lasted # Falcon F9R specifications me = 25600 # Empty mass mp = 395700 # Propellent mass F1D = 716000 # Single engine thrust (Newtons) N1D = 9 # Number of rocket engines Ftotal = F1D * N1D # Total thrust (Newtons) tburn = 180 # Burn time (seconds) # Predict the final velocity using Tsiolkovsky's Rocket Equation vmaxre = Ftotal*tburn/mp*log((me+mp)/me) print("Predicted final velocity (Rocket Equation), vmax: ", vmaxre, " m/s") # Create a function for determining the rocket thrust def GetThrust(): global BurnTime global RocketStarted if RocketStarted: # get the burn time: seconds since start BurnTime = rocket.shiptime - StartTime # is it time to stop the rocket? if BurnTime >= tburn:
from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer earth = Planet(planetmass=0, viewscale=0.0005) RocketStarted = False StartTime = None BurnTime = 0 #Falcon heavy specs Me = 25600 Mf = 119100 Mo = 276600 Mp = Mf + Mo F1d = 716000 N1d = 9 Ftotal = N1d * F1d Tburn = 180 Vmaxre = Ftotal * Tburn / Mp * log((Me + Mp) / Me) print(Vmaxre) def GetThrust(): global BurnTime global RocketStarted if RocketStarted: BurnTime = rocket.shiptime - StartTime if BurnTime >= Tburn: RocketStarted = False
#Max Low #3-15-18 #rocket3.py -- getting into orbit with realistice thrust from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer, Slider earth = Planet( viewscale = 0.000005) # no gavity for simplification RocketStarted = False StartTime = None # to keep track of when burn started BurnTime = 0 # how long burn has lasted # Falcon F9R specifications me = 25600 # empty mass mp = 395700 #propellent mass F1D = 716000 # single engine thrust (N) N1D =9 #Number of rocket engines Ftotal = F1D*N1D # total thrust (N) tburn = 180 # burn time # Predict the final vleocity based on N's 2nd law vmax = Ftotal*tburn/(me+mp) print("predicted final velocity (N's 2nd law), vmax: ", vmax, "m/s") # Vfianl based on Tsiolkovsky's Rocket Equation vmaxre = Ftotal*tburn/mp*log((me+mp)/me) print("Predicted final velocity (rocket Eqation), vmax: ",vmaxre, "m/s")
from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer from ggame import Color earth = Planet(planetmass=0, viewscale=0.000054, color=0xF2FA04) # no gravity to simplify things RocketStarted = False StartTime = None # to keep track of when burn started BurnTime = 0 # keep track of how much time the burn has lasted # Falcon F9R specifications me = 25600 # Empty mass mp = 395700 # Propellent mass F1D = 716000 # Single engine thrust (Newtons) N1D = 9 # Number of rocket engines Ftotal = F1D * N1D # Total thrust (Newtons) tburn = 180 # Burn time (seconds) # Predict the final velocity based on simple Newtons' 2nd Law vmax = Ftotal*tburn/(me+mp) print("Predicted final velocity (Newton's 2nd Law), vmax: ", vmax, " m/s") # Create a function for determining the rocket thrust def GetThrust(): global BurnTime global RocketStarted if RocketStarted: # get the burn time: seconds since start BurnTime = rocket.shiptime - StartTime # is it time to stop the rocket?
from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer earth = Planet(color=0xFF61C8) # no gravity to simplify things RocketStarted = False StartTime = None # to keep track of when burn started BurnTime = 0 # keep track of how much time the burn has lasted # Falcon F9R specifications me = 25600 # Empty mass mp = 395700 # Propellent mass F1D = 716000 # Single engine thrust (Newtons) N1D = 9 # Number of rocket engines Ftotal = F1D * N1D # Total thrust (Newtons) tburn = 180 # Burn time (seconds) # Predict the final velocity using Tsiolkovsky's Rocket Equation vmaxre = Ftotal*tburn/mp*log((me+mp)/me) print("Predicted final velocity (Rocket Equation), vmax: ", vmaxre, " m/s") # Create a function for determining the rocket thrust def GetThrust(): global BurnTime global RocketStarted if RocketStarted: # get the burn time: seconds since start BurnTime = rocket.shiptime - StartTime # is it time to stop the rocket? if BurnTime >= tburn:
from ggrocket import Rocket, Planet earth = Planet(viewscale=.001082) rocket = Rocket(earth, altitude=161000, velocity=7810, timezoom=3.6) earth.run(rocket)
from ggrocket import Rocket, Planet earth = Planet(viewscale=5) rocket = Rocket(earth, altitude=50) earth.run(rocket)
#James Roth #3/15/18 #rocket4.py - moon landing from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer, Label, Slider earth = Planet(viewscale=0.0001) # no gravity to simplify things Stage1Started = False Stage2Started = False PayloadLaunched = False StartTime = None # to keep track of when burn started BurnTime = 0 # keep track of how much time the burn has lasted # Falcon F9R specifications # FIRST STAGE me1 = 25600 # Empty mass (kg) mp1 = 395700 # Propellent mass (kg) Ftotal1 = 6.444E6 # Total thrust (Newtons) tburn1 = 180 # Burn time (seconds) # SECOND STAGE me2 = 3900 # Empty mass (kg) mp2 = 92670 # Propellent mass (kg) Ftotal2 = 8.01E5 # Total thrust (Newtons) tburn2 = 372 # Burn time (seconds) # PAYLOAD mep = 8000 # Payload mass (kg) # Predict the final velocity using Tsiolkovsky's Rocket Equation,
from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer, Label, Slider earth = Planet() # no gravity to simplify things Stage1Started = False Stage2Started = False PayloadLaunched = False StartTime = None # to keep track of when burn started BurnTime = 0 # keep track of how much time the burn has lasted # Falcon F9R specifications # FIRST STAGE me1 = 25600 # Empty mass (kg) mp1 = 395700 # Propellent mass (kg) Ftotal1 = 6.444E6 # Total thrust (Newtons) tburn1 = 180 # Burn time (seconds) # SECOND STAGE me2 = 3900 # Empty mass (kg) mp2 = 92670 # Propellent mass (kg) Ftotal2 = 8.01E5 # Total thrust (Newtons) tburn2 = 372 # Burn time (seconds) # PAYLOAD mep = 8000 # Payload mass (kg) # Predict the final velocity using Tsiolkovsky's Rocket Equation, # In two stages! vmax1 = Ftotal1 * tburn1 / mp1 * log( (me1 + mp1 + me2 + mp2 + mep) / (me1 + me2 + mp2 + mep)) vmax2 = Ftotal2 * tburn2 / mp2 * log((me2 + mp2 + mep) / (me2 + mep))
# rocketscience from ggrocket import Rocket, Planet from math import radians, sqrt, log from ggmath import InputButton, Timer, Label, Slider earth = Planet(planetmass=0) # no gravity to simplify things Stage1Started = False Stage2Started = False PayloadLaunched = False StartTime = None # to keep track of when burn started BurnTime = 0 # keep track of how much time the burn has lasted # Falcon F9R specifications # FIRST STAGE me1 = 25600 # Empty mass (kg) mp1 = 395700 # Propellent mass (kg) Ftotal1 = 6.444E6 # Total thrust (Newtons) tburn1 = 180 # Burn time (seconds) # SECOND STAGE me2 = 3900 # Empty mass (kg) mp2 = 92670 # Propellent mass (kg) Ftotal2 = 8.01E5 # Total thrust (Newtons) tburn2 = 372 # Burn time (seconds) # PAYLOAD mep = 13150 # Payload mass (kg) # Predict the final velocity using Tsiolkovsky's Rocket Equation, # In two stages! vmax1 = Ftotal1*tburn1/mp1*log((me1+mp1+me2+mp2+mep)/(me1+me2+mp2+mep))
from ggrocket import Rocket, Planet moon = Planet(viewscale=0.00005, planetmass=7.348E22, radius=1737000) rocket = Rocket(moon, altitude=1837000, velocity=1000, timezoom=3) moon.run(rocket)
from ggrocket import Rocket, Planet from math import radians, sqrt from ggmath import Slider earth = Planet() # Constants relating to Earth and physics Re = 6.371E6 # Earth radius: 6371000 meters in scientific notation Me = 5.972E24 # Earth mass in kg (5.972 x 10^24) G = 6.674E-11 # Gravitational constant # Add a slider for controlling the timezoom tz = Slider((10,400), 0, 5, 0, positioning="physical") # Calculate the escape velocity from Earth's surface radius Ve=sqrt(2*Me*G/Re) print("Predicted escape velocity is ", Ve, " m/s") rocket = Rocket(earth, heading=radians(90), directiond=90, velocity=Ve, timezoom=tz) earth.run(rocket)
from ggrocket import Rocket, Planet from math import radians, sqrt from ggmath import Slider earth = Planet(viewscale=0.00014, planetmass=7.342E22) Re = 1.737E6 Me = 7.342E22 G = 6.674E-11 Ve = sqrt(2 * Me * G / Re) print("Predicted escape velocity is ", Ve, " m/s") tz = Slider((10, 400), 0, 3, 0, positioning="physical") rocket = Rocket(earth, heading=radians(90), directiond=90, velocity=Ve, timezoom=tz) earth.run(rocket)
from ggrocket import Rocket, Planet earth = Planet(viewscale=0.00014, planetmass=73420000000000000000000) rocket = Rocket(earth, altitude=100, velocity=1000, timezoom=3) earth.run(rocket)
#Max Low #3-14-18 #rocket1.py -- first rocket orbital program safe altitude from ggrocket import Rocket, Planet from ggame import * data = {} data['thrust'] =0 def thrust(): return data['thrust'] earth = Planet(radius=1737400 , planetmass=73500000000000000000000 , viewscale=0.000009, color=0x00FFFF) rocket = Rocket(earth, altitude=10000, velocity=1632, timezoom=2, thrust = thrust ) def upThrust(event): data['thrust'] += 0.1 def downThrust(event): data['thrust'] -= 0.1 App.listenKeyEvent('keydown','t', upThrust) App.listenKeyEvent('keydown','g', downThrust) earth.run(rocket)