reset password
Author Message
rmedina0531
Posts: 19
Posted 14:49 Apr 03, 2020 |

NetLogo Defines these types of roads

 ; This procedure draws roads of different types between 2 patches.
  ; type-of-road in {0, 1, 3, 4}
  ; 0 - dynamic congestion road
  ; 1 - static congestion road
  ; 3 - middle road (zero congestion)
  ; 4 - deactivated middle road

This should mean that a road type of 0 should give a variable delay time depending on traffic, and the static congestion road (type 1) should have a constant delay time, but when running the simulation and inspecting the road patches, the patches with type 1 are giving the variable delay time and the ones of type 0 are static. Am I reading this wrong or are the descriptions incorrect?

sdo8
Posts: 54
Posted 19:09 Apr 03, 2020 |

I've just noticed this as well.

 

In the netlogo model: Lines 47-53:


to go
  check-middle
  spawn-commuters
  ask commuters [ commuter-move ]
  ask patches with [road-type = 1] [ determine-congestion ]
  tick
end

As Ricardo mentioned, road-type 1 is a static congestion road (Based off of the Netlogo comments). However, these patches still determine-congestion. Lines 134-144 for determine-congestion are:


to determine-congestion ; patch procedure that determines congestion of dynamic patches
  ifelse last-here = 0 [ ; congestion is determine based on how recently the last commuter was here
    set delay int (base-delay / 2)
  ][
    set delay floor (((250 / spawn-rate)/(ticks - last-here + 1)) * base-delay)
  ]
  let g 255 + floor (255 * (0.5 - (delay / base-delay)))
  if g < 127 [set g 127]
  if g > 255 [set g 255]
  set pcolor (list 255 g 0)
end

It looks like the numbers for "type-of-road" in draw-road are swapped between "dynamic congestion row (0)" and "static congestion road (1)". They are supposed to be 1 and 0 respectively. Lines 232-238 set a base-delay for a type-of-road = 1 as well.


        if-else type-of-road = 1
        [
          set pcolor yellow
          set delay 5
          set road-type 1
          set base-delay 10
        ]

However, the comments under "base-delay" in patches-own, lines 22-28, state that base-delay is used for dynamic delay roads.


patches-own
[
  delay ; ticks turtle has to spend before leaving patch
  base-delay ; base amount of ticks for dynamic delay road
  road-type ; road with static delay or road with dynamic delay
  last-here ; tick that the a dynamic road was last occupied
]

TLDR; It looks like a wrong description and the road-types should be 1 for dynamic congestion roads and 0 for static congestion roads.