The Solar System

The Solar System preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Tags

astronomy 

Tagged by Ioannis Guertsonii about 1 month ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.4.0 • Viewed 101 times • Downloaded 2 times • Run 0 times
Download the 'The Solar System' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

; NETLOGO DEMO-3
; Computermodel of the Solar System
; Optimized programming code & adjusted scale (optional) !
; © Drs. Ioannis Guertsonii, 2024
; -------------------------------------------------------------------------


globals [  ; GLOBAL VARIABLES
  sun ; sun object
  ss  ; size sun (diameter)
  xc  ; x-coordinate center solar system
  yc  ; y-coordinate center solar system
  xb  ; x-coordinate planet
  yb  ; y-coordinate planet
]

turtles-own [  ; TURTLE ATTRIBUTES
  name  ; name planet
  dfs   ; distance from sun
  ot    ; orbit time
  a     ; angle
  a1    ; angle in 1 day
]

to setup  ; SETUP BUTTON
  clear-all
  if (backImage?) [  ; get background image of the universe (optional)
   import-drawing "stars.jpg"
  ]
  setup-sun  ; call sun procedure
  setup-planets  ; call planets procedure
  reset-ticks
end 

to setup-sun  ; SUN PROCEDURE
  create-turtles 1 [
    set shape "circle"
    set color yellow
    set ss (5)  ; not to scale !
     set size ss
    setxy 0 0
    set sun self
  ]
end 

to setup-planets  ; PLANETS PROCEDURE
 ifelse not(trueScale?)
 [  ; NO True Scale
  let planet-data [  ; name, distance from sun (relative), orbit-time (days), color, size (relative)
    ["Mercury" 4 880 violet 1]
    ["Venus" 8 225 pink 3]
    ["Earth" 12 365 green 4]
    ["Mars" 16 687 red 2]
    ["Jupiter" 20 4332 brown 8]
    ["Saturn" 24 10759 grey 7]
    ["Uranus" 28 30688 cyan 6]
    ["Neptune" 32 60182 blue 5]
   ]
   foreach planet-data [ ?1 ->
     create-turtles 1 [
      set name item 0 ?1
      set dfs item 1 ?1
      set ot item 2 ?1
      set color item 3 ?1
      set size (item 4 ?1) / 2
      set shape "circle"
      setxy (ss / 2 + dfs) 0
      set label name
    ]
   ]
  ]
  [  ; TRUE Scale
   let planet-data [  ; name, distance from sun (AU), orbit-time (days), color, size (diameter)
    ["Mercury" 0.4 880 violet 0.5]
    ["Venus" 0.7 225 pink 1.2]
    ["Earth" 1 365 green 1.3]
    ["Mars" 1.5 687 red 0.7]
    ["Jupiter" 5.2 4332 brown 7.15]  ; actual size = 14.3
    ["Saturn" 9.5 10759 grey 6.0]  ; actual size = 12.0
    ["Uranus" 19 30688 cyan 5.1]
    ["Neptune" 30 60182 blue 4.9]
   ]
   foreach planet-data [ ?1 ->
    create-turtles 1 [
     set name item 0 ?1
     set dfs item 1 ?1  ; Astronomical Unit (AU): 1 AU = 149.6 * 1000000 km
     set ot item 2 ?1
     set color item 3 ?1
     set size (item 4 ?1) / 2  ; Actual diameter = size * 10000 km
     set shape "circle"
     setxy (ss / 2 + dfs) 0
     set label name
   ]
  ]
 ]
end 

to go  ; GO BUTTON -> Procedure will be repeated until Button is pushed again

  tick   ; next day

  ask turtles with [self != sun] [
    if ticks > 0 [ pen-down ]
    set a1 (360 / ot)
     set a (a + a1)
    set xb (xc + (ss / 2 + dfs) * cos(a))  ; calculate new position planet
     set yb (yc + (ss / 2 + dfs) * sin(a))
    setxy xb yb  ; move to new position
  ]

  if (ticks = nrYears? * 365) [ stop ]   ; standard stop after entered number of years
end 

There is only one version of this model, created about 1 month ago by Ioannis Guertsonii.

Attached files

File Type Description Last updated
stars.jpg jpeg Background image of the Solar System about 1 month ago, by Ioannis Guertsonii Download
The Solar System.png preview Preview for 'The Solar System' about 1 month ago, by Ioannis Guertsonii Download

This model does not have any ancestors.

This model does not have any descendants.