Queuing in PD

All topics related to questions in Pedestrian Dynamics
Post Reply
BPeter
Posts: 11
Joined: Sunday 26 October, 2014 - 23:54

Queuing in PD

Post by BPeter »

Hi guys,

I need to simulate queuing, but I can’t figure out how it works… The target is similar to the one presented in the example_models/queuing/check_in. I tried to make such a model; it’s fine until sending the agents into an indicative corridor, but from there they spread out to all the ticket facilities, regardless of how many agents are alredy being served. How can I set that only one agent is being served at a time, just like in the example model? And how can I route the agents from an indicative corridor to a specific ticket facility? Or route them to the one that has just became free?

Is using indicative corridors the only way to model queuing? Then what does the „use server queues” option do in the facility settings? I’ve tried to experiment with these settings but with little success.

If I copy the 4DS code from the entry trigger field of the ActionArea from the example model to my model, than all the agents get locked in the indicative corridor.

I really don’t understand how it works. The best would be a queuing tutorial or something like that.
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: Queuing in PD

Post by marlies »

Hello Peter,

Let me first explain the use of server queues in an activity location. See attached model. The upper ticket location in the model has 2 server queues. The lower ticket location does not use server queues.

Both locations have a service time of 30 seconds and the agents are equally distributed over both locations. However, running the model will show more agents staying in the upper ticket location. The difference is:

- The lower location is just a location with a stay time of 30 seconds, the location can server an unlimited number of agents at the same time.
- The upper location has a limited capacity of 2 servers and will server only 2 agents at the same time. With the queue capacity you can define how much agents can wait for each server (like separated queues before a desk). The rest of the agents will wait in an internal "common queue".

When you run the model and open the tracer window (Menu Tools > Tracer) you will see a trace of the agent's staytime in each of the locations: the lower one has always 30 seconds, the upper location has longer stay times because of the waiting times.

I will come back to your question regarding the example model in another post later today.

Kind Regards, Marlies
Attachments
Example_Queueing.mod
(72.63 KiB) Downloaded 320 times
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: Queuing in PD

Post by marlies »

Hello Peter,

I changed the model check in a bit, to make it easier to understand. See attached model.

Please have a look at the following:
- Agents have an activity route from Entry to Bagdrop_area to Bagdrop to Exit. The bagdrop_area activity location is at the end of the indicative corridor.
- The bagdrop area has a specific activity time: if there are less than 4 agents at bag drop the agent may proceed (time = 0) else the agent has to wait until it will get a trigger (time = -1).
- Now check the exit trigger of the bagdrop locations (you'll find this trigger in the tab Location): here you will find that when an agent leaves (exits), the location will trigger the next agent in the bagdrop_area (the bagdrop area has ID 572). This is one of the standard trigger options. The code will trigger the next agent to proceed.
- Please make sure to check as well the location assignment rule via: Agent Input > Activities > Activity Bagdrop > Locations and then Location Assignment. At that location a user defined option was selected to assign agents to the different desks. The key is that agents should go to an "empty" location by checking the sum of the number of agents in the location and approaching the location.

The code can be made more generic (instead of using all the hard coded location ID numbers), but I hope that in this way the principle for routing and assigning locations will become clear to you.

If there are any questions left, just post again!

Kind regards,

Marlies
Attachments
Check_In_V3.mod
(92.45 KiB) Downloaded 294 times
BPeter
Posts: 11
Joined: Sunday 26 October, 2014 - 23:54

Re: Queuing in PD

Post by BPeter »

Dear Marlies,

Thank you for your kind help! However, I tried to build up almost the same model, and it behaves quite strange. The logic that you explained in your answer is clear to me, however my model doesn't work well. The situation is the following:

I drew the environment and copied the 4DS codes from the specific fields that you mentioned to their counterparts in my model. Of course, I changed the ID of each location in those codes. Now what happens is most of the check-in desks handle more than one agent simultaneously, while others may be unoccupied. Thus, sometimes there are waiting agents in the queue despite the available desks.
What I figured out from this is that the activity time code of the waiting area (which we modeled with a ticket facility at the end of the indicative corridor) works well; it forces the agents to wait unless there are less than 3 agents being served (I have 3 c/i desks). But, because of some desks having served more than one agent simultaneously, the situation can occur when one or two desks serve more than 3, so the queuing agents wait, despite the third desk being available.
I guess this is because approaching agents are not counted as "assigned" to a specific desk.

Maybe the problem is with the location assignment:

{**Select a desk which has no agent and no agent approaching and is thus available.
If more desks are available, select the desk with the lowest id**}
AgentActivity_DetermineLocationByMinimumScore(
i,c,
ActivityLocation_GetNumberOfAgents(s) + ActivityLocation_GetNumberOfApproachingAgents(s) = 0,
ActivityLocation_GetID(s)
)


Or I dont' know :? I don't know why it behaves differently if I do the same as in your example model.

So, I need to ensure that no more than one agent is assigned (being served or approaching) to one check-in desk, as in reality.
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: Queuing in PD

Post by marlies »

Hi Peter,

I forgot to mention an important check in my previous post, that needs to be selected: the option "Store approaching agents". This option can be found in the tab Location of the ticket facilities. I guess that this is not the case in your model yet.

So, the problem you describe is indeed related to the code of the location assignment, because in that code the restriction is:

Code: Select all

ActivityLocation_GetNumberOfAgents(s) + ActivityLocation_GetNumberOfApproachingAgents(s) = 0
So it sums up the number of agents (which is the number of agents actually in the activity location) and the number of agents that is approaching the location. By default PD will not store the approaching agents as it takes more simulation effort, but in some cases you really need to know how many are on their way to an activity location. That's why the check is available. In this model you'll need the check, otherwise the location assignment will alwayt return 0 approaching agents. In that case it can happen that when more agents arrive more or less at the same time they will be sent to the same location.

Kind regards, Marlies
BPeter
Posts: 11
Joined: Sunday 26 October, 2014 - 23:54

Re: Queuing in PD

Post by BPeter »

Dear Marlies,
Thank you, now it works as it should. ;)

Let me ask a few more questions. (Sorry for the so many questions, but I need to have my project done with very tight deadlines and as a beginner I’m not really familiar with 4DS coding.)

So, the target is to simulate an airport’s check-in area. One schema is the one that we’ve discussed so far. Now I tried to make a model with a separate queue in front of each check-in desk, see the attached file. First I wanted to use only the one next to the entrance, based on the same logic as before. But agents don’t behave as I guess they should, based on the settings.

My questions are:

-How can I set that agents visit only the check-in desk in front of them? What’s the correct location assignment for that? (Of course only one person at a time.)

-How can I distribute the entering agents between the indicative corridors, for example to send them to the one with the least queuing people?

-When assigning a queue/desk to the entering agents, how is it possible to constrain their choice to a specific group of check in desks? This would model that a passenger can only use the desks assigned to his/her flight. Maybe setting a different activity route or agent profile for each airline’s passengers?

-I tried to make an availability schedule for the check-in desks, but the agents would still use the desk which is closed. And if an agent is being served at the time of a scheduled close, the agent gets stuck in the location. I tried to modify the location assignment like this:

{**Select a desk which has no agent and no agent approaching and is thus available. If more desks are available, select the desk with the lowest id**} AgentActivity_DetermineLocationByMinimumScore(i,c,ActivityLocation_GetNumberOfAgents(s) + ActivityLocation_GetNumberOfApproachingAgents(s) = 0 + ActivityLocation_GetAvailable(s) = 1,ActivityLocation_GetID(s))

I’m not sure if it’s correct, I just based it on the help menu.

Thank you for your help in advance!
Attachments
multiple_queue_checkin.mod
(91.45 KiB) Downloaded 302 times
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: Queuing in PD

Post by marlies »

Hi Peter,

I changed your model a bit, see attached. It now sends passengers to the smallest queue and then to the corresponding desk.

Please check the following locations:
- There is a new action area right after the entrance. The exit trigger of this action area contains code to send passenger into the corridor that belongs to their current destination.
- The "store appr. agents" option has now been checked on all wait locations at the end of the corridors.
- The location distribution of the wait activity has been changed to least nr of agents in activity + approaching.

The grouping can be achieved in multiple ways. The easiest to explain is that you can give each location a different group name (see first tab of the location). Then in the agent activity you can select an activity group. This will work if a desk belongs to the same group during the whole simulation (is that the case?). You will then need a different Wait activity and different route for each airline. I don't know how big your model will be. The solution might require quite some routes, but other might need more coding.

- your restriction for availability goes in the right direction, but the notation is slightly different:

Code: Select all

And(
 ActivityLocation_GetNumberOfAgents(s) + ActivityLocation_GetNumberOfApproachingAgents(s) = 0,     ActivityLocation_GetAvailable(s) = 1
)
If that's still not working, could you attach your model with the availability in it??

Kind regards, Marlies
Attachments
multiple_queue_checkin_v02.mod
(94.2 KiB) Downloaded 284 times
BPeter
Posts: 11
Joined: Sunday 26 October, 2014 - 23:54

Re: Queuing in PD

Post by BPeter »

Dear Marlies,

I modified the model to have 5 desks and 5 queues. I distinguished the airlines and their passengers with an own activity, activity route and agent profile for each. Two airlines (LH and BA) have two desks, and AF has one desk assigned. Furthermore I set the availability of three desks, so that at the beginning LH and BA have only one desk available, and AF has none for the first two minutes, which means that AF passengers have to queue and wait in front of the correct desk.

I copied your location assignment code to every bag_drop activity, but the model doesn’t work, after a few seconds of running I get this error message:

1 No next activity destination found for agent: 174395272 loc( 8.93789672851563 , 6.05717134475708 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2
2 No next activity destination found for agent: 174396000 loc( 14.5062580108643 , 6.08751106262207 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2
3 No next activity destination found for agent: 174395168 loc( 8.99329280853271 , 6.0498104095459 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2
4 No next activity destination found for agent: 174397288 loc( 14.4519929885864 , 6.07795190811157 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2
5 No next activity destination found for agent: 208856124 loc( 8.95234966278076 , 6.0860013961792 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2
6 No next activity destination found for agent: 233094584 loc( 14.4616527557373 , 6.10563182830811 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2
7 No next activity destination found for agent: 233095900 loc( 8.97424125671387 , 6.08568525314331 ), layer: 1 at activity route: 1 : LH_Route . Last correct row: 2


If I set the default availability settings (always available) the model still won’t run correctly, some agents can’t find next activity destination…

So all in all what I need is:

-To be able to send, for example an LH passenger to one of the assigned LH check-in desks (practically to the one with the least people queuing). I think this could be achieved through the action area at the entrance, but I don’t see what the parameters mean in this: ActivityLocation_GetID( Agent_GetDestination( i, 1))-9,
So how should I do it?

-To be able to control the availability of the desks.

-If there's no desk available for a particular airline, its passengers should queue (either in front of the already assigned desk or at an area in the terminal) and wait for it to open. Now they can't find the next activity loacation in this case.

-I’d like to have a common use (automated) check-in desk, which can be used by passengers of several airlines. This would mean that for example a BA passenger could choose to drop his bag at a „normal” desk or to use this automated one, which may also be used by an LH passenger. (This would be the goal of my project, to assess the changes in passenger flow after setting up such machines.)

However, this is only an experimental model to learn the principles, the final project will consist of about 20 desks.
And one small remark: I noticed, that in the model you provided last time, some people first go „upwards”, towards the desks and then suddenly (or after reaching on of the desks) to the open end of the corridors. Why do they behave like that?

Thank you very much,
Peter
Attachments
multiple_queue_checkin_v03.mod
(123.85 KiB) Downloaded 284 times
BPeter
Posts: 11
Joined: Sunday 26 October, 2014 - 23:54

Re: Queuing in PD

Post by BPeter »

Dear Marlies,

I made some mistakes in the model attached to my previous post, so please look at this new one. This is a bit better, but still not the best. I coloured the passengers of each airline differently, to make them visually distinguishable while running the simumlation.

As you can see, LH (orange) passengers are ok, they queue as they should, but AF (blue) and half of BA’s passengers (red) don’t. Serving is in progress at these desks too, and the desks trigger the passengers correctly, but queuing people don’t use the corridor but try to gather on the small waiting areas. I have absolutely no idea why, since everything is set the way like in case of LH. What’s even more interesting is that one of BA’s queues is good.

Thanks,
Peter
Attachments
multiple_queue_checkin_v03.mod
(122.71 KiB) Downloaded 295 times
BPeter
Posts: 11
Joined: Sunday 26 October, 2014 - 23:54

Re: Queuing in PD

Post by BPeter »

Dear Marlies,

My model still doesn’t work. To get closer to where the problem is, I made exactly the same model that you attached to yout last post. 3 desks, 3 queues. No distinction between airlines, every passenger is allowed to use every desk. I set everything the way you did, copied the codes to the appropriate fields, of course changed the location ID’s in the codes.
But the model behaves in an unexplainable way, see the attached model.

In the other model I attached last time, I added a self bag-drop machine, to be used by only AF passengers for the first experiment. I defined an activity and activity route for that, and set the agent generator to generate AF passengers who must stick to this self_drop_route. However, these passengers dont’t use the corridor as well, instead many BA passengers do. BA passengers have nothing to do there, they have their own two assigned desks. But some of them follow this self_bag_drop corridor and once they get out of it, they continue their way to a BA waiting area… Only those queues develop normally that were already in the model you created. I attached this model too.

Now I have totally no idea what’s wrong and how to control the passenger movements. I understand the logic behind it, but PD just doesn’t do what it should. :(

Please Help :!: :!:
Attachments
multiple_airlines_checkin_v03.mod
This is the one with multiple airlines and a self_bag_drop machine
(132.59 KiB) Downloaded 289 times
3_desks_model.mod
This should be the simple one that you attached last time
(94.27 KiB) Downloaded 277 times
Post Reply