I woule like to count the number of turtles stopped (the speed is 0 means stopped) around the red turtle on the right side on this road (like a 3D image), every by ticks without putting in the number of red turtles. For 3D image, ie. the number of turtles is 11. This means the queue length that does not include the number of red turtles of Little's Law. The following is the sample program. However the program does not well work. For 3D image, in this case, ie. the number of turtles is 14. It counts the number of blue turtles without the red turtle (I puts a flag "right-end" to the red turtle for differentiation to the other blue turtles). I think this program needs to add the speed 0 conditions to count the number of turtles stopping next to the red turtle on the right (I put "ask turtles with [ speed = 0 ]". However this seems not to work well.). I am stucking,, Please advise me.
ask turtles with [ not right-end ] ;a flag "right-end" to the red turtle for differentiation to the other blue turtles
[
ask turtles with [ speed = 0 ] ;the speed is 0 means stopped
[
set top max-one-of turtles [who] ;get a turtle with biggest id
set topx [xcor] of top
set L count turtles with [xcor > topx] ; L is the queue length of Little's Law
]
]
Aucun commentaire:
Enregistrer un commentaire