cinematica

cinematica preview image

1 collaborator

Default-person Alexandre Ramos (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.5 • Viewed 228 times • Downloaded 19 times • Run 0 times
Download the 'cinematica' 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

breed [ corpo1 ] 
breed [ corpo2 ]


globals [pos veloc acel pos2 veloc2 acel2 tempo dist]

to setup
 clear-all
 ask patches [set pcolor white ]
 create-corpo1 1 [ setxy pos-ini 2 ]
  
 ask corpo1 [set shape "car"]
 ask corpo1 [set color blue ]
 ask corpo1 [set size 3 ]
 ask corpo1 [set pos pos-ini]
 ask corpo1 [set veloc veloc-ini]
 ask corpo1 [set acel acel-ini]
 
 create-corpo2 1 [ setxy pos-ini2 -2 ]
 ask corpo2 [set shape "car"]
 ask corpo2 [set color red ]
 ask corpo2 [set size 3 ]
 ask corpo2 [set pos2 pos-ini2]
 ask corpo2 [set veloc2 veloc-ini2]
 ask corpo2 [set acel2 acel-ini2]
 
 reset-ticks
end 

to move-corpo1
 ask corpo1 [set pos pos-ini + (veloc-ini * (tempo) +(acel * (tempo) * (tempo) / 2))] 
 ask corpo1 [set veloc veloc-ini + (acel * (tempo))] 
 ask corpo1 [ set xcor pos ]
end 

to move-corpo2
 ask corpo2 [set pos2 pos-ini2 + (veloc-ini2 * (tempo) +(acel2 * (tempo) * (tempo) / 2))] 
 ask corpo2 [set veloc2 veloc-ini2 + (acel2 * (tempo))] 
 ask corpo2 [set xcor pos2 ]
 ask corpo2 [ set dist (pos - pos2) ]
 ;if dist < 0 [set dist (dist * -1)]
 ask corpo2 [ if dist < 0 [set dist (dist * -1) ] ifelse encontro [ set dist (dist + 0.1) ] [ set dist (dist * -1) ] ]
end 

to go
 set tempo (ticks / 10000) 
 if tempo >= time [ stop ]
 move-corpo1
 move-corpo2
 if dist < 0.0002
  [ user-message "Os corpos se encontraram na posição" 
  user-message pos 
  user-message "metros e no tempo"
  user-message tempo
  user-message "segundos"
  ]
 tick
end 

There is only one version of this model, created over 10 years ago by Alexandre Ramos.

Attached files

File Type Description Last updated
cinematica.png preview Preview for 'cinematica' over 10 years ago, by Alexandre Ramos Download

This model does not have any ancestors.

This model does not have any descendants.