Single orbiting body v2
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
A small mass orbiting a large mass.
HOW IT WORKS
Really simple. The ship turtle is gravitationally attracted towards the planet.
HOW TO USE IT
Press setup to set up the model, and go to start it. The other buttons are self-explanatory. One word of caution: remember to restart the model (press setup and then go) after making changes to sliders.
THINGS TO NOTICE
How do potential and kinetic energy relate? What about position, velocity, and acceleration?
THINGS TO TRY
Try achieving escape velocity, or maybe crashing into the planet below.
EXTENDING THE MODEL
Multiple space-ships? Maybe even a moon? (Or you could always download Kerbal Space Program.)
NETLOGO FEATURES
Unfortunately, I couldn't figure out how to get the labels for the vectors to show up behind the planet, so I added a toggle to turn the planet view on/off. Additionally, one tick represents one second, and there are usually 30 t/sec at normal run speed. This means that it generally runs ~30x faster than real life.
CREDITS AND REFERENCES
http://modelingcommons.org/browse/one_model/6483
Will Bradley, 2020
Comments and Questions
breed [planets planet] breed [sats sat] breed [vectors vector] globals [ grav-const distance-m planet-mass-kg satellite-mass-kg vx-m-s vy-m-s acc-m-s2 vx vy acc-x acc-y m-per-patch kinetic-energy potential-energy check-orbit? vector-vectors-scale-factor ] turtles-own [ id ] to configure-iss set planet-radius 6.371 set planet-mass 5.972 set satellite-mass 41.97 set initial-velocity 7.66 set initial-altitude 6.709 setup end to setup clear-all set check-orbit? true reset-ticks set grav-const 6.67408 * 10 ^ (-11) set m-per-patch 1000000 set planet-mass-kg planet-mass * 10 ^ 24 set satellite-mass-kg satellite-mass * 10 ^ 4 create-planets 1 [ ;set label (word "planet, diameter " (size * 100) " km") set color blue set size planet-radius * 2 set shape "circle" ] create-sats 1 [ set color red set heading 270 setxy 0 initial-altitude set acc-m-s2 grav-const * planet-mass-kg / (distance one-of planets * m-per-patch) ^ 2 set pen-size 1 set pen-mode "down" ] set vx-m-s -1 * initial-velocity * 1000 set vy-m-s 0 ; ask one-of sats [ hatch-vectors 1 [ set id "acc" set color green hide-turtle set pen-mode "up" ] hatch-vectors 1 [ set id "vel" set color blue hide-turtle set pen-mode "up" ] ] end to go if check-orbit? [ clear-links ask one-of sats [ set distance-m distance one-of planets * m-per-patch set acc-m-s2 grav-const * planet-mass-kg / (distance-m) ^ 2 set acc-x -1 * acc-m-s2 * xcor / (distancexy 0 0) ; use similar triangles to get standard basis vecs from scalar set acc-y -1 * acc-m-s2 * ycor / (distancexy 0 0) set vx-m-s vx-m-s + acc-x set vy-m-s vy-m-s + acc-y set kinetic-energy 0.5 * satellite-mass-kg * (vx-m-s ^ 2 + vy-m-s ^ 2) set potential-energy -1 * grav-const * satellite-mass-kg * planet-mass-kg / (distance-m) let new-x xcor + vx-m-s / m-per-patch let new-y ycor + vy-m-s / m-per-patch facexy new-x new-y if vectors-shown [make-vectors] set xcor new-x set ycor new-y test-kill-orbit ] ] ifelse show-planet [ ask planets [show-turtle] ] [ ask planets [hide-turtle] ] tick end to make-vectors ask vectors with [id = "acc"] [ set xcor max list (min (list (0.5 * vectors-scale-factor * (acc-x) + [xcor] of one-of sats) max-pxcor)) min-pxcor set ycor max list (min (list (0.5 * vectors-scale-factor * (acc-y) + [ycor] of one-of sats) max-pycor)) min-pycor create-links-from sats [ set color green set label (word "acc: " precision acc-m-s2 2 " m/s/s") ] ] ask vectors with [id = "vel"] [ set xcor max list (min (list (vectors-scale-factor * (vx-m-s / 2000) + [xcor] of one-of sats) max-pxcor)) min-pxcor set ycor max list (min (list (vectors-scale-factor * (vy-m-s / 2000) + [ycor] of one-of sats) max-pycor)) min-pycor create-links-from sats [ set color blue set label (word "vel: " precision (sqrt(vx-m-s ^ 2 + vy-m-s ^ 2) / 1000) 2 " km/s") ] ] end to test-kill-orbit if distancexy 0 0 < planet-radius or abs xcor > max-pxcor or abs ycor > max-pycor [ set shape "x" set check-orbit? false ask vectors with [id = "acc" or id = "vel"] [die] stop ] end ; Copyright 2020 Will Bradley
There is only one version of this model, created over 4 years ago by Will Bradley.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Single orbiting body v2.png | preview | Preview for 'Single orbiting body v2' | over 4 years ago, by Will Bradley | Download |
This model does not have any ancestors.
This model does not have any descendants.