Particle oscillation on a spring

Particle oscillation on a spring preview image

1 collaborator

Default-person Hrvoje Mladinić (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.2 • Viewed 265 times • Downloaded 35 times • Run 0 times
Download the 'Particle oscillation on a spring' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

turtles-own 
[delta_V_y delta_y delta_t d_y]

globals
[l m k F V_y E_k E_p E_uk a]

to setup
  clear-all
  setup-opruga
  setup-čestica
  reset-ticks
end 

to setup-opruga
  ask patches
  [
    set pcolor white
  ]
  ask patch 0 1 [set pcolor yellow]
  ask patch -1 1 [set pcolor yellow]
  ask patch -2 1 [set pcolor yellow]
  ask patch 1 1 [set pcolor yellow]
  ask patch 2 1 [set pcolor yellow]
  set l length_of_the_spring 
  ask patch 0 (0 - l) [set pcolor red]
end 

to setup-čestica
  create-turtles 1
  ask turtle 0 
    [
    setxy 0 random (0 - l) * 2
    set color green
    set shape "circle" 
    ]   
end 

to go
  ask turtle 0 
  [
  unos
  izračun
  ]
  tick
end 

to unos
  set delta_t 0.001
  set k constant_of_the_spring
  set m mass_of_the_particle
end 

to izračun 
  set delta_y (abs ycor) - l
  set F (k * delta_y) 
  set delta_V_y (F * delta_t) / m
  set V_y (V_y + delta_V_y)
  set d_y (V_y * delta_t)
  set ycor (ycor + d_y)
  set E_k (m * V_y * V_y) / 2
  set E_p (k * delta_y * delta_y) / 2
  set E_uk E_k + E_p
  set a delta_V_y / delta_t
end 





  
  

There is only one version of this model, created over 11 years ago by Hrvoje Mladinić.

Attached files

File Type Description Last updated
Particle oscillation on a spring.png preview Preview for 'Particle oscillation on a spring' over 11 years ago, by Hrvoje Mladinić Download

This model does not have any ancestors.

This model does not have any descendants.