AnyLogic 9
Expand
Font size

Service with lines

In pedestrian flow models, the services define a group of similar physical service objects (turnstiles, ticket vending machines, security checkpoints, check-in counters, and so on).

There are two types of space markup shapes that you can use to draw services in your pedestrian model:

  •  Service with Area — Use this to define a service with an electronic queue (such as a bank teller, railway station information desk, and so on). Pedestrians do not stand in a queue line, but wait for their turn in the adjacent area. The area is defined by a polygonal node.
  •  Service with Lines — Use this to define a service with a queue where pedestrians wait in a queue line until the service becomes available. Two types of queues are supported: standard queues lines, and a “serpentine” queue typically used in airport check-in areas.
Demo model: Service With Lines Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files). Demo model: Service With LinesOpen the model in your AnyLogic desktop installation.

First, you draw the service in the graphical diagram, then add the PedService Pedestrian Library block to the flowchart and configure it by tuning its parameters.

To draw a service with lines

  1. Drag the  Service with Lines element from the Space Markup section of the  Pedestrian Library palette to the graphical diagram.

  2. Locate the service points in the graphical editor. When working with markup shapes, the first click selects all the shapes of that markup element (in our case, two queue lines and two service points). To select just one specific shape, click that shape again. You can then edit that particular shape and your changes will not affect other markup shapes.
    A third click on the same shape selects all shapes of that markup element, again.

  3. The service points are usually placed with the same offset. If necessary, place these two service points to match their locations on the drawing before you change the number of services. The service points you add later will be placed with this custom offset. To move a service point, select and drag it without releasing the left mouse button.

  4. You can now change the number of service points. Open the service properties and change the Number of services value. For example, set it to 3 and you will see a new service point appear on the graphical diagram:

Demo model: Serpentine Queue Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files). Demo model: Serpentine QueueOpen the model in your AnyLogic desktop installation.

To draw a service with a “serpentine” queue

In this example, we will draw four-check in counters with a serpentine queue. Here is our approximate layout: there are four placeholders for check-in counters on the left side:

You can drop this layout into the graphical editor using the  Image element from the Presentation palette. Consider locking it afterwards by selecting the Lock option in its properties, so that you do not accidentally move the image while drawing the service.

  1. Drag the  Service with Lines element from the Space Markup section of the Pedestrian Library palette into the graphical diagram. You will see the space markup shape consisting of two service points and two queue lines. In our example, we need to rotate the shape because the service points should be on the left side.

  2. Now we will place the service points near the placeholders. The service point defines the place where the passenger will wait while receiving the service. Since the placeholders define the locations for the check-in counters, you should place the service points not inside the placeholders, but close to them.
    Move the bottom service point to the lower placeholder. You will notice that when you click the service, you select all the shapes that make up this complex element. To select just one particular shape of a complex space markup element (in our case, a service point), click it again.

    If you need to adjust the shape with more precision, you can turn grid alignment off by selecting Scale > Snap to grid on the toolbar.

  3. Open the properties of the Service with Lines element. The easiest way to open the properties of the complex space markup shape is to click anywhere in the graphical editor, and then click the services shape.
  4. Set Number of services to 4, Number of queues to 1, and set Queue type: Serpentine.

  5. After configuring the properties, the shape should look like shown below. You can see that the service points have the same offset. Therefore, we first adjusted the location of the service point to define the distance between the neighboring service points, and then increased the number of services.

  6. Now we are going to change the shape of the “serpentine” queue.
  7. Select the queue shape by clicking the entire complex Service element once, then clicking again, this time on the queue itself. Move the starting point of the queue where you need it.
  8. If necessary, adjust the width of the queue shape by dragging the handle at the corner of the shape.

  9. We have placed the first segment of the queue shape where we need it, and we can continue drawing the queue by adding more segments. Right-click the queue shape and select Append from the context menu.
  10. Click the end point of the existing queue to toggle the drawing mode.
    Add another point by clicking at the place where the queue will turn. Note that you should click exactly in the middle of the passage, as shown in the figure below:

  11. Continue drawing the serpentine queue by adding more turning points, like shown in the figure below. Add the last point by double-clicking.

  12. If some of the points are not aligned, adjust them by dragging the point handles with the mouse.

  13. Finally, you will get the queue with the desired shape:

  14. To define how passengers check in at the drawn counters, insert the PedService Pedestrian Library block into your flowchart, configure its parameters, and select the name of the just drawn Service with Lines in the Services parameter of this PedService block.

Properties

General

Name — The name of the service. The name is used to identify and access the service shape from code.

Show name — If selected, the shape name is displayed in the graphical editor.

Lock — If selected, the service is locked. Locked elements do not respond to mouse clicks, and they cannot be selected in the graphical editor until you unlock them. This is often needed when you want to prevent the element from being edited while other elements are placed over it.

Ignore — If selected, the service is excluded from the model.

Number of services — Specifies the number of service points.

Number of queues — Specifies the number of queues leading to the service points..

Queue type — The type of the queue: standard Line queue, or Serpentine queue (also called “zigzag” queue).

Service type — The type of the service point. Use Linear for services where pedestrians should move along the service shape, passing start and end points of the line. Use Point for services, where pedestrians should stand at any point on the line.

Number of reverse queues — [Enabled if the service is Bidirectional] Specifies the number of reverse queues leading to the service points. Pedestrians can pass services in any direction.

Serve pedestrians from — Defines the queue from which the service will serve pedestrians. When the service becomes free, it chooses the queue again according to the selected option. The following alternative options define the queue to be selected:
Longest queue — the queue with the largest number of pedestrians.
Closest queue (strict) — the queue that is closest to the service, no matter whether it is empty or not.
Closest not empty queue — the non-empty queue that is closest to the service.
Next queue (round robin) — the queues are selected sequentially in a circular order.
Priority queue — the queue with the highest priority is selected (according to the expression specified in the Queue priority field below) Other queue — the queue is returned by the expression specified in the Queue field below.

Bidirectional — [Enabled if the Type of service is Linear] If selected, pedestrians can pass services in both directions.

Wait for exit — [Enabled if the Type of service is Linear] If selected, the service will not start serving another pedestrian if a pedestrian is currently being served and has not yet reached the end of the service queue. For example, turnstiles do not have this restriction, but the security check service does.

Queue priority — [Visible if Serve pedestrians from is set to Priority queue] The Java expression that returns the queue priority. The greater the value, the higher the priority. The expression is dynamically reevaluated for each non-empty queue. Based on the results of revaluations, the queue with the highest priority is selected. You can refer to the service’s queues in the expression using the local variable queue.

Queue — [Visible if Serve pedestrians from is set to Other] The Java expression that returns the selected queue. Typically, you place the call to your custom Java function here. The service point that just became free and is currently selecting the queue is available here as serviceUnit.

Grouping

This entire section is available only if Type of service is Point.

Waiting area for groups — Select to create the area that will act as the waiting area for pedestrian group members. Inside this area, the members of the pedestrian group will wait while the leader of their group is serviced at this service (you should do this only if the Group behavior in service is Only one group member is serviced, others wait in a waiting area). The waiting area is defined by a polygonal node.

Group behavior — When passing through a service, a group of pedestrians may behave differently. You can select one of three behavior modes (All group members are serviced individually, Only one group member is serviced, others wait in a queue, or Only one group member is serviced, others wait in a waiting area).
Since the behavior may depend on the role of the particular group (guided tour group, family, group of friends), you may want to define it once for the group to avoid setting several times in different service shapes. In this case, define the behavior mode in the block creating this group (it can be PedSource, PedEnter, or PedGroupAssemble).

If you want this particular group of services to follow the same rules you have defined for the group, simply select Depends on the settings of each incoming group.

If this block defines the service where the pedestrian groups behave in a different way, select The same for all groups and define this behavior using the parameter below.

The behavior — Specifies how groups of pedestrians behave while passing through this service. There are three behaviors:

  • All group members are serviced individually — Each member of the group should be serviced individually. An example: turnstiles.
  • Only one member is serviced, others wait in a queue — An example: a family buying movie tickets at the counter. All the family members wait in line to choose the seats together, but only one of them — the head of the family — pays and gets serviced.
  • Only one member is serviced, others wait in a waiting area — An example: a tourist group buying museum tickets. The tourists do not wait in line, they just wait for their tour guide to buy the tickets for the whole group. To draw the waiting area for this case, select the Waiting area for groups option above and adjust the created polygonal node in the graphical editor.
Appearance

Service color — The color of service shape.

Queue color — The color of queue shapes.

Reverse queue color — [Accessible if Bidirectional is enabled] The color of reverse queue shapes.

Position and size

Level — The level to which this service belongs.

Visibility and presentation

Visible — If selected, the service is visible during animation at model runtime.

Show in — Select whether the shape is displayed in both 2D and 3D animation, 2D only, or 3D only.

Agent presentation — If selected, the service is also visible on the upper-level agent that hosts the agent containing this service.

Servicing groups of pedestrians

When passing through services with lines, a group of pedestrians may behave differently.

The behaviors are:

  • All group members are serviced individually — Each member of the group should be serviced individually. An example: turnstiles.
  • Only one member is serviced, others wait in a queue — An example: a family buying movie tickets at the counter. All the family members wait in line to choose the seats together, but only one of them — the head of the family — pays and gets serviced.
  • Only one member is serviced, others wait in a waiting area — An example: a tourist group buying museum tickets. The tourists do not wait in line, they just wait for their tour guide to buy the tickets for the whole group. To draw the waiting area for this case, select the Waiting area for groups option above and adjust the created polygonal node in the graphical editor.

You can select a behavior mode in the flowchart block that creates pedestrian groups (it can be PedSource, PedEnter, or PedGroupAssemble), and even change the group servicing settings in the properties of some specific service with lines (in the Grouping property section).

Demo model: Group Behavior in Services Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files). Demo model: Group Behavior in ServicesOpen the model in your AnyLogic desktop installation.

Functions

You can obtain the properties of the service with lines at model runtime using the API.

The service and queue line elements that make up a service with lines also provide their own sets of functions.
Service
Function Description
boolean isBidirectional() Returns true if the service with lines is bidirectional, that is, pedestrians can pass services in both directions. Returns false otherwise.
boolean isWaitForExit() Returns true if the service with lines is set to wait for exit, that is, the service cannot start servicing other pedestrians if a pedestrian is currently being serviced. Returns false otherwise.
Queue lines
Function Description
List getQueues() Returns the list of queue lines belonging to the current service with lines.
List getReverseQueues() Returns the list of reverse queue lines belonging to the current service with lines.
Color getQueueColor() Returns the color of the queue elements.
Color getReverseQueueColor() Returns the color of the reverse queue elements.
setQueueColor(Color color) Sets the color of the queue elements.
setReverseQueueColor(Color color) Sets the color of the reverse queue elements.
Waiting area
Function Description
AreaNode getGroupWaitingArea() Returns the area markup element (if any) associated with the current service with lines.
Level
Function Description
Level getLevel() Returns the level on which this service is located.
Removal
Function Description
void remove() Removes the service with line from the presentation. If this element is not a part of presentation, the function does nothing. Note, that removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
How can we improve this article?