Aceleracion Constante 2D

Aceleracion Constante 2D preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.2 • Viewed 172 times • Downloaded 12 times • Run 0 times
Download the 'Aceleracion Constante 2D' 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

breed [particles partcile]
particles-own [velx vely accx accy speed dist]
breed [markers marker]

to setup
  clear-all
  setup-world
  setup-particle
  reset-ticks
end 
;

to setup-world
  if show-axes[
    ask patches with [pycor = 0 and (pxcor mod 2 = 1)] [set pcolor white]
    ask patches with [pxcor = 0 and (pycor mod 2 = 1)] [set pcolor white]
  ]
end 
;

to setup-particle
  create-particles 1[                              ; Crear una tortuga-partícula de acuerdo a la información del usuario
   set xcor x0
   set ycor y0
   set shape "turtle"
   set color yellow
   set size 10
   set heading atan vx0 vy0
   set velx vx0
   set vely vy0
   set speed sqrt(vx0 ^ 2 + vy0 ^ 2)               ; Calcular rapidez y dirección iniciales
   set accx ax
   set accy ay
   set dist 0                                      ; Inicializar distancia recorrida
   if show-path [pen-down]                         ; Si usuario eligió mostrar trayectoria, mostrarla
  ]
end 
;
;;; Procedimiento a ejecutar en cada iteración

to go
  ask particles [
    move-const-accel                   ; Avanzar
    calc-const-accel                   ; Recalcular variables
    if show-turn-pts [show-crit-pts]   ; Si usuario eligió mostrar puntos críticos, mostrarlos
    if show-at-rest [show-rest-pts]    ; Si el usuario eligió mostrar puntos en reposo, mostrarlos
    if motion-diag [motion-diagram]
]
  tick                                 ; Avanzar contador de tiempo
                                       ; Si tortuga llega a la orilla del mundo, parar simulación
    if (abs [xcor] of turtle 0 >= (max-pxcor - 1) ) or (abs [ycor] of turtle 0 >= (max-pycor - 1) ) [stop]
end                ;
;;; Procedimiento para mover la partícula y actualizar distancia recorrida

to move-const-accel
    set dist (dist + (speed / 300))                   ; Calcular distancia a recorrer en tick de acuerdo a su rapidez actual
    fd speed / 300                                    ; Avanzar la tortuga de acuerdo a su rapidez y dirección actual
end 
;
;;; Procedimiento para actualizar variables bajo aceleración constante

to calc-const-accel
    set velx velx + (ax / 300)                        ; Actualizar componentes de velocidad de acuerdo a aceleración
    set vely vely + (ay / 300)
    set speed sqrt((velx * velx) + (vely * vely))     ; Actualizar rapidez de acuerdo a componentes actualizadas
    set heading atan velx vely                        ; Actualizar dirección de acuerdo a componentes actualizadas
end 
;
;;; Procedimiento para mostrar puntos críticos (cambios de dirección)

to show-crit-pts
      if ( (speed > 0.01) and ((abs velx < 0.001) or (abs vely < 0.001) ) ) [   ; si una de las componentes de su velocidad
        hatch-markers 1 [                                                       ; pero sin estar en reposo, dejar marcador rojo
          set shape "turtle"
          set color red
          set label "turn point"
          set size 10]
      ]
end 
;
;;; Procedimiento para mostrar puntos en reposo

to show-rest-pts
      if (show-at-rest) [                 ; Si el usuario eligió marcar puntos en reposo:
      if (speed < 0.001) [                ; si está en reposo, dejar marcador verde
        hatch-markers 1 [
          set shape "turtle"
          set color green
          set label "at rest"
          set size 10]
      ]
    ]
end 
;
;;; Procedimiento para generar Diagrama de Movimiento

to motion-diagram
  if (ticks mod 500 = 0)[                    ; Cada 500 ticks, crear una tortuga marcador para generar el diagrama de movimiento
    hatch-markers 1[
      set shape "turtle"
      set color yellow
      set size 10
      set label (ticks / 500 + 1)            ; Con identificador de cardinalidad
    ]
  ]
end 

There is only one version of this model, created over 5 years ago by Carlos Martinez-Torteya.

Attached files

File Type Description Last updated
Aceleracion Constante 2D.png preview Preview for 'Aceleracion Constante 2D' over 5 years ago, by Carlos Martinez-Torteya Download

This model does not have any ancestors.

This model does not have any descendants.