Resonance Model

Resonance Model preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.3.0 • Viewed 67 times • Downloaded 5 times • Run 0 times
Download the 'Resonance Model' 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

globals [
  a1 ; angle of planet 1 from positive horizontal
  a2 ; angle of planet 2 from positive horizontal
  p1 ; the period of the first planet
  p2 ; the period of the second planet
  r1 ; the radius of the first planet
  r2 ; the radius of the second planet
  period_1 ; to display period of first planet
  period_2 ; to display period of second planet
]

breed [stars star]
breed [planets planet]

to setup
  clear-all

  set r1 (r_1 * 100)
  set r2 (r_2 * 100)
  set-periods

  create-stars 1[
    set color yellow
    set size 3
    set shape "circle"
    setxy 0 0
  ]
  create-planets 2[
    set size 1
    set shape "circle"
  ]

  ask planet 1 [
    set color blue
    set heading 0
    fd r1
    rt 90
  ]
  ask planet 2 [
    set color red
    set heading 0
    fd r2
    rt 90
  ]

  reset-ticks

  output-print "The period of the first planet in days is:"
  output-print period_1
  output-print "The period of the second planet in days is:"
  output-print period_2
end 

to preset
  ask planet 1 [
    pen-down
    move-planet r1 p1
  ]

  ask planet 2 [
    pen-down
    move-planet r2 p2
  ]

  ifelse (a1 = a2) [
    ask planets [
      set color white
    ]
  ]
  [
    ask planet 1 [
      set color blue
    ]
    ask planet 2 [
      set color red
    ]
  ]

  set-slopes
  tick

  if ticks = 1500000 [
    stop
  ]
end 

to set-slopes
  ask planet 1 [
    ifelse (pxcor != 0) [
      set a1 atan pxcor pycor
    ]
    [
      ifelse (pycor > 0) [
        set a1 0
      ]
      [
        set a1 180
      ]
    ]
  ]

  ask planet 2 [
    ifelse (pxcor != 0) [
      set a2 atan pxcor pycor
    ]
    [
      ifelse (pycor > 0) [
        set a2 0
      ]
      [
        set a2 180
      ]
    ]
  ]
end 

to setup-free
  clear-all
  set r1 (radius-1 * 100)
  set r2 (radius-2 * 100)
  set p1 (period-1 / 100)
  set p2 (period-2 / 100)

  create-stars 1[
    set color yellow
    set size 3
    set shape "circle"
    setxy 0 0
  ]
  create-planets 2[
    set size 1
    set shape "circle"
  ]

  ask planet 1 [
    set color blue
    set heading 0
    fd r1
    rt 90
  ]
  ask planet 2 [
    set color red
    set heading 0
    fd r2
    rt 90
  ]

  reset-ticks
end 

to free-play

  ask planet 1 [
    pen-down
    move-planet r1 p1
  ]

  ask planet 2 [
    pen-down
    move-planet r2 p2
  ]

  ifelse (a1 = a2) [
    ask planets [
      set color white
    ]
  ]
  [
    ask planet 1 [
      set color blue
    ]
    ask planet 2 [
      set color red
    ]
  ]

  set-slopes

  tick

  if ticks = 1500000 [
    stop
  ]
end 

to move-planet [r p]
  fd (pi * r / 180) * (p / 50)
  rt p / 50
end 

to set-periods
  ; system 1
  if (r_1 = 0.0919) and (r_2 = 0.1087) [
    set period_1 10.340
    set period_2 13.286
    set p1 (period_1 / 100)
    set p2 (period_2 / 100)
  ]
  ; system 2
  if (r_1 = 0.1370) and (r_2 = 0.1720) [
    set period_1 18.357
    set period_2 25.648
    set p1 (18.357 / 100)
    set p2 (25.648 / 100)
  ]
  ; system 3
  if (r_1 = 0.0740) and (r_2 = 0.0890) [
    set period_1 7.008
    set period_2 8.719
    set p1 (7.008 / 100)
    set p2 (8.719 / 100)
  ]
  ; system 4
  if (r_1 = 0.0798) and (r_2 = 0.0649) [
    set period_1 8.689
    set period_2 19.535
    set p1 (8.689 / 100)
    set p2 (19.535 / 100)
  ]
  ; system 5
  if (r_1 = 0.1153) and (r_2 = 0.1283) [
    set period_1 13.868
    set period_2 16.219
    set p1 (13.868 / 100)
    set p2 (16.219 / 100)
  ]
  ; system 6
  if (r_1 = 0.0370) and (r_2 = 0.0590) [
    set period_1 7.384
    set period_2 14.789
    set p1 (7.384 / 100)
    set p2 (14.789 / 100)
  ]
end 

There is only one version of this model, created 8 months ago by Naya Davidson-Lindfors.

Attached files

File Type Description Last updated
Resonance Model.png preview Preview for 'Resonance Model' 8 months ago, by Naya Davidson-Lindfors Download

This model does not have any ancestors.

This model does not have any descendants.