Single orbiting body
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
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 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 ] hatch-vectors 1 [ set id "vel" set color blue hide-turtle ] ] 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 pen-up 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") ] ] pen-down 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 almost 5 years ago by Will Bradley.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Single orbiting body.png | preview | Preview for 'Single orbiting body' | almost 5 years ago, by Will Bradley | Download |
This model does not have any ancestors.
This model does not have any descendants.