Child of Urban (System Dynamics)

No preview image

1 collaborator

Default-person Javinel Servano (Author)

Tags

(This model has yet to be categorized with any tags)
Child of model Urban (System Dynamics) preview imageUrban (System Dynamics)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.4.0 • Viewed 36 times • Downloaded 0 times • Run 0 times
Download the 'Child of Urban (System Dynamics)' 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

;; System dynamics model globals
globals [
  ;; stock values
  y1
  y2
  y3
  ;; size of each step, see SYSTEM-DYNAMICS-GO
  dt
  ;; Additional global variable
  sigma
  r
  b
]

;; Initializes the system dynamics model.
;; Call this in your model's SETUP procedure.

to system-dynamics-setup
  reset-ticks
  set dt 0.001
  ;; initialize stock values
  set y1 random-float 0.0
  set y2 random-float 1.0
  set y3 random-float 0.0
  ;; initialize sigma
  set sigma 10.0
  ;; initialize r
  set r 28.0
  ;; initialize b
  set b 2.6667
end 

;; Step through the system dynamics model by performing next iteration of Euler's method.
;; Call this in your model's GO procedure.

to system-dynamics-go

  ;; compute variable and flow values once per step
  let local-y1' y1'
  let local-y2' y2'
  let local-y3' y3'

  ;; update stock values
  ;; use temporary variables so order of computation doesn't affect result.
  let new-y1 ( y1 + local-y1' )
  let new-y2 ( y2 + local-y2' )
  let new-y3 ( y3 + local-y3' )
  set y1 new-y1
  set y2 new-y2
  set y3 new-y3

  tick-advance dt
end 

;; Report value of flow

to-report y1'
  report ( sigma * (y2 - y1)
  ) * dt
end 

;; Report value of flow

to-report y2'
  report ( y1 * (r - y3) - y2
  ) * dt
end 

;; Report value of flow

to-report y3'
  report ( y1 * y2 - b * y3
  ) * dt
end 

;; Plot the current state of the system dynamics model's stocks
;; Call this procedure in your plot's update commands.

to system-dynamics-do-plot
  if plot-pen-exists? "y1" [
    set-current-plot-pen "y1"
    plotxy ticks y1
  ]
  if plot-pen-exists? "y2" [
    set-current-plot-pen "y2"
    plotxy ticks y2
  ]
  if plot-pen-exists? "y3" [
    set-current-plot-pen "y3"
    plotxy ticks y3
  ]
end 

There is only one version of this model, created 5 months ago by Javinel Servano.

Attached files

No files

Parent: Urban (System Dynamics)

This model does not have any descendants.

Graph of models related to 'Child of Urban (System Dynamics)'