Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1....

60
Pedestrian Library Tutorial © 1992-2005 XJ Technologies Company Ltd. www.xjtek.com

Transcript of Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1....

Page 1: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

Pedestrian Library Tutorial

© 1992-2005 XJ Technologies Company Ltd. www.xjtek.com

Page 2: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Copyright © 1992-2005 XJ Technologies. All rights reserved.

XJ Technologies Company Ltd [email protected] http://www.xjtek.com/products/anylogic

© 1992-2005 XJ Technologies http://www.xjtek.com

3

Page 3: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Contents

ABOUT THIS TUTORIAL ..........................................................................................5

1. GETTING STARTED WITH ANYLOGICTM.......................................................6

1.1 HOW TO CREATE A NEW ANYLOGICTM MODEL..............................................6

1.2 HOW TO USE PEDESTRIAN LIBRARY ....................................................................8

1.3 HOW TO CONNECT OBJECTS..................................................................................10

1.4 HOW TO DRAW AN ANIMATION...........................................................................11

2. SUBWAY ENTRANCE MODEL ........................................................................ 13

2.1 CREATING A NEW PROJECT....................................................................................13

2.2 CREATING A MODEL ANIMATION.......................................................................13

2.3 ADDING A PASSENGER FLOW................................................................................20

2.4 RUNNING THE MODEL AND OBSERVING BEHAVIOR...............................22

2.5 ADDING TICKET CONTROL GATES ....................................................................24

2.6 CHANGING PASSENGER ARRIVAL RATE INTERACTIVELY .....................29

2.7 ADDING TICKET WINDOWS....................................................................................32

2.8 COLLECTING STATISTICS .........................................................................................37

3. SUBWAY TRANSFER POINT MODEL ............................................................ 41

3.1 CREATING A NEW PROJECT....................................................................................41

3.2 CREATING A MODEL ANIMATION.......................................................................41

3.3 ADDING PASSENGER FLOWS..................................................................................47

3.4 CREATING A TWO-STORIED MODEL..................................................................51

3.5 ADDING ESCALATORS ...............................................................................................56

4. CONCLUSION..................................................................................................... 61

© 1992-2005 XJ Technologies http://www.xjtek.com

4

Page 4: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

About this Tutorial

AnyLogicTM provides the Pedestrian Library, a higher-level library for simulating pedestrian flows in “physical” environment. It allows creating models of pedestrian buildings (like subway stations, security checks, etc.) or streets (big number of pedestrians). The Pedestrian Library allows you to create flexible models, collect basic and advanced statistics, and effectively visualize the process you are modeling to validate and present your model. You may collect statistics on pedestrian density in different areas, to assure acceptable performance of service points with hypothetic load, estimate lengths of stay in specific areas, detect potential problems with interior geometry – effect of adding obstacles and many other applications. In models created with Pedestrian Library, pedestrians move in continuous space, reacting on different kinds of obstacles (walls, different kinds of areas) and other pedestrians.

In this tutorial you will learn how to create models with Pedestrian Library. We will create two simple illustrative examples of subway entrance and subway transfer point. The first model will demonstrate how to simulate simple pedestrian flow and services using AnyLogicTM Pedestrian Library; the second – how to build many-storied models.

Note that there are several reference files available for these models representing the milestones of the editing. You can use reference files if you experience any difficulties creating a model and you would like to compare your model with the reference file. Reference files are located under Examples \ Pedestrian Library Tutorial

Models folder, and you can use Start Page to open those examples. Start Page will appear automatically once you close the model you are editing.

© 1992-2005 XJ Technologies http://www.xjtek.com

5

Page 5: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

1. Getting Started with AnyLogicTM

This section contains general information about creating models with Pedestrian Library. You will learn how to create a new model and adjust its settings, how to use the library stencil and connect objects to build a model.

1.1 How to create a new AnyLogicTM model

In this tutorial, you will create several models. This section briefly explains how to create a new model and adjust model settings.

► How to create a new AnyLogicTM model

Click the New button

Adjust new model settings

Once you clicked the New button, a dialog box opens where you can choose the folder and give a file name for your new model.

© 1992-2005 XJ Technologies http://www.xjtek.com

6

Page 6: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

You can create several alternative model settings. A group of model settings is called an experiment, and experiments are displayed under the Experiments item in the model tree.

One experiment is created by default and named Simulation. Click the experiment in the tree, and adjust model settings using the Properties window.

� Select the class that will be started once you click the Run button. By default, this property is set to Main, a single blank class created automatically in the new model.

� In real time mode, the model is executed regarding the physical time, i.e., you specify how many model time units will be executed in one second. Real time mode best fits to present model animation. In virtual time mode, the model is executed not regarding physical time—that is, as fast as possible. This mode best fits when you need to run the model for a long period of time.

� Real or virtual time execution

� Root object (main model object)

© 1992-2005 XJ Technologies http://www.xjtek.com

7

Page 7: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

The additional simulation experiment properties tab allows you to control model execution.

� You can run the model infinitely or stop the model at the specific time. Also, you can specify advanced stop conditions, like statistics confidence interval, variable value condition, or any user-defined condition.

� If you use random numbers in the model, you can choose to generate random numbers unique for each model run (this is useful to collect statistics for multiple runs) or to generate the same random numbers and thus obtain the same model execution across runs (this is useful to run the model several times and see its behavior).

� Model stop condition

� Random number generator control

1.2 How to use Pedestrian Library

Pedestrian models consist of two main parts – environment and behavior. Environment incorporates walls, different areas, services, queues etc. Generally, to create an environment object you need to define it graphically, add corresponding library object and set up the animation properties for this object.

© 1992-2005 XJ Technologies http://www.xjtek.com

8

Page 8: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Behavior of pedestrians can be defined in style of flowcharts, in the same fashion as Enterprise Library. You drag the objects from the library stencil, set custom properties for the objects, and connect objects together.

► How to use Pedestrian Library

Pedestrian Library stencil shows all the objects in the library. You can click any object in the stencil and drag it onto the structure diagram. To get brief information about the object, just point the mouse over it and wait for the tooltip to appear.

Once you have dropped the object onto the structure diagram, it becomes selected and its properties are displayed in the Properties window where you can adjust them as your model requires. To adjust properties at a later time, first click the object to select it and then modify the object properties in the Properties window.

Open Pedestrian Library stencil

To add an object, drag it from the stencil with the mouse

Drop the object where you want

Change the object properties

� Open the Libraries page

� Click the Pedestrian Library tab

© 1992-2005 XJ Technologies http://www.xjtek.com

9

Page 9: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

1.3 How to connect objects

You will need to connect objects in order to create the model flowchart. You will have two options: connect instantly by dragging first object’s port onto second object’s port, or by means of the special Connector tool.

► To connect objects

Click the first port

Drag it onto the second port. A connector appears.

You can also use the Connector tool

To connect two near-by objects use drag method:

For long or curved connectors, click Connector , click the first port, and then click the second port.

� Click the first port to select it

� Drag the first port onto the second port to create a connector

© 1992-2005 XJ Technologies http://www.xjtek.com

10

Page 10: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

1.4 How to draw an animation

For each model you can create an animation to visually represent your model. You need this also to define graphically environment objects of your model. To create an animation you need to draw it using an animation diagram.

► To create an animation

Create a new animation

Draw shapes you want using drawing tools

Use window tabs to switch between animation and flowchart

To create a new animation for the class, click the New Animation

toolbar button. The animation editor window will be opened.

You can draw geometric shapes (lines, circles, rectangles etc.), add images, user-controllable controls (buttons, radio buttons, checkboxes etc.), indicators (charts, bar and arc indicators, text). All the shapes can change the appearance at run time.

© 1992-2005 XJ Technologies http://www.xjtek.com

11

Page 11: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

To switch between an animation and a flowchart just click the tabs of the opened windows.

If you have closed a window you can open it from the Project window at any time.

� Click the Projects tab

� Double-click the object item to open the flowchart

� Double-click the object’s animation item to open the animation

� Click tabs to switch

between a flowchart

and an animation

© 1992-2005 XJ Technologies http://www.xjtek.com

12

Page 12: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

2. Subway Entrance Model

In this section we will create a very simple model simulating passenger flow in the subway entrance. To get to subway trains passengers need to go through automatic ticket control gates. Some passengers may have their tickets already bought earlier to avoid frustration queuing while their train is about to depart. Those may directly go to trains. Passengers without tickets need to buy tickets at the ticket office and only then may go through ticket control gates. This model will demonstrate how to simulate simple pedestrian flow and services using AnyLogicTM Pedestrian Library.

2.1 Creating a new project

Create a new model as described in Section 1.1, “How to create a new AnyLogicTM model”. Using Simulation experiment, specify that the model is executed in real time mode and one model time unit will be executed in one second. In Pedestrian Library a model time unit is considered as one second of a model lifetime.

2.2 Creating a model animation

Now we will draw the model animation. To simplify drawing, we will add the subway entrance layout first. You can draw the layout in AnyLogicTM using the animation editor, or you can import any picture as the layout. The drawing approach is good for prototyping, when you want to experiment with draft layouts. The image approach is excellent for working with an existing layout. We will add the existing image of the subway entrance.

© 1992-2005 XJ Technologies http://www.xjtek.com

13

Page 13: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

► Add subway entrance layout

To create a new animation, click the New Animation toolbar button.

Add the layout image. Click the Image toolbar button, and click the animation diagram to place a new image.

Set up the following properties:

� Navigate to the layout picture of the system.

Create new animation

Add a layout image

� Click Add… button and navigate to the layout picture

� Select Original size option

Move the image

© 1992-2005 XJ Technologies http://www.xjtek.com

14

Page 14: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

The layout picture we will use is Examples \ Pedestrian Library

Tutorial Models \ images \ entrance_layout.png

� To preserve necessary picture size, select the Original size option.

Move the image into the upper left corner of the animation area as shown in the figure below1. Then resize the animation area to (480,380) to embrace the added image entirely. Finally the model animation should look as in the figure below:

1 The animation area is defined with the dotted rectangle.

© 1992-2005 XJ Technologies http://www.xjtek.com

15

Page 15: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Now we will draw the model animation.

► Draw model animation

To simplify drawing you may need to switch off the grid and zoom in the animation using the corresponding toolbar buttons:

Draw the environment area border. Draw the polyline as shown in the figure below:

Draw the building walls

Draw an exit

Draw an entry

� Click Polyline toolbar button and click the first point

� Click several intermediate points as shown on the figure

� Double-click the last point

� Zoom in the animation

� Disable grid

© 1992-2005 XJ Technologies http://www.xjtek.com

16

Page 16: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up the following properties for the polyline drawn:

� On the Polyline tab of the Properties window, set the Closed polyline checkbox. This makes the polyline closed by connecting the first and the last polyline’s points.

� Name the polyline walls

� Make the polyline closed

� Change the polyline’s color and width to make it more noticeable

© 1992-2005 XJ Technologies http://www.xjtek.com

17

Page 17: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

You should define entry and exit points for the pedestrian flow.

Draw an entry first. Entry is a place where pedestrians appear in the simulated environment. It can be defined with a line, polyline, or a pivot containing lines and/or polylines.

Set up properties for the line drawn:

� Name the line entry

� Click Line and click the first point on the animation

� Click the last point

� Change the line’s color and width

© 1992-2005 XJ Technologies http://www.xjtek.com

18

Page 18: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Draw the exit line as shown in the figure below.

Exit line is a place where pedestrians are disposed by the simulated environment.

Set up properties for the line drawn:

Note that both entry and exit lines should fit inside the

environment area shape, i.e. inside walls polyline.

� Name the line exit

� Change the line’s color and width

� Draw the line

© 1992-2005 XJ Technologies http://www.xjtek.com

19

Page 19: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

2.3 Adding a passenger flow

Now we will finish creating the simple model simulating passenger flow. We need to add library objects adding and removing pedestrians from the simulated environment.

► Create the model flowchart

PedSource

PedSink

PedFloor

Add a PedSource object. PedSource object generates pedestrians.

Please refer to Pedestrian Library Reference Guide for the description of all Pedestrian Library objects. To invoke AnyLogicTM Pedestrian Library Reference Guide, choose the corresponding item from the Help menu.

© 1992-2005 XJ Technologies http://www.xjtek.com

20

Page 20: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set the following object properties:

� Define the entry point for the passenger flow. Choose the animation shape representing the passenger flow entry.

Add a PedSink object and connect it to the PedSource object. PedSink object disposes incoming pedestrians. It is usually used as an end point of the pedestrian flow. Set the following object properties:

� Define the exit point for the passenger flow. Choose the animation shape representing the passenger flow exit.

� Set animation.exit as the passenger flow exit point

� Set animation.entry as the passenger flow entry point

© 1992-2005 XJ Technologies http://www.xjtek.com

21

Page 21: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Add a PedFloor object. This object is used when you want to define a floor limited with some border2.

Set the following object properties:

� Set this floor as a base floor of our model.

� Use animation.walls polyline drawn earlier for this purpose.

� Choose base floor

� Set the walls for the floor

2.4 Running the model and observing behavior

We have finished creating a simple model using AnyLogicTM Pedestrian Library. Now you can run the model by clicking the Run button. You can see that the model behaves correct: passengers enter the subway entrance and pass through the corridor leading to the subway trains.

2 By default each model contains one unlimited floor, which is called “base floor”. To know how to create multi-storied models study the second tutorial model.

© 1992-2005 XJ Technologies http://www.xjtek.com

22

Page 22: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

► Run the model and view animation

Click the

Run toolbar button

Click Stop to stop execution and continue editing the model

Click the Run toolbar button. AnyLogicTM switches to run-time layout. Having started the model, you will see the animation window. To adjust the execution speed, use Decrease model speed

and Increase model speed toolbar buttons.

You can also switch to virtual time mode to view simulation run at its maximum speed and simulate a long period of time. To enable

virtual time mode click the Enable virtual time mode toolbar button.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 1 - Simple model.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

23

Page 23: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

2.5 Adding ticket control gates

Now we will expand our model by adding automatic ticket control gates. Thus we will show you how services are defined in Pedestrian Library.

First, we will modify our animation and then modify the model flowchart.

► Modify the model animation

Draw four lines representing ticket control gates as shown in the figure below.

The starting point—that is, the point you click first to draw a

line—is important. Passengers will be moving from the point you draw first to the point you draw last.

� Draw lines

Draw ticket control gates (lines)

Draw queues to control gates (polylines)

Create a pivot group

Create a pivot group

© 1992-2005 XJ Technologies http://www.xjtek.com

24

Page 24: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Create a pivot group. Pivot is used to group several animation shapes. We need it since we want to define a service with several shapes.

Click the Pivot toolbar button and then click on the animation diagram. Pivot shape will appear on the animation.

Name the pivot gates. Add all created lines to the pivot group. Right-click the pivot shape and choose Add/Remove Shapes from the popup menu. Then select all just created lines (the easiest way to select several shapes is to subsequently click on them with Ctrl pressed) and click on the empty place of the animation diagram outside the layout image to finish the action.

Draw polylines animating queues to ticket control gates as shown in the figure below.

The starting point of the polyline is important. It stands for the

head of the queue. Therefore place the first point of each polyline near the corresponding ticket control gate.

Create pivot group and name it gatesQueues. Add all just created polylines to this pivot group as you did it recently for the lines representing control gates.

� Draw polylines

© 1992-2005 XJ Technologies http://www.xjtek.com

25

Page 25: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Now we will modify the model flowchart. Create and connect objects as shown below.

► Modify the model flowchart

Add a PedServiceQ object. The object allows defining one or multiple service point locations and queues to these service points.

Set the following object properties:

PedServiceQ

PedConfiguration

� Choose animation.gates as the service shape

� Specify the service delay time (in seconds)

� Choose true

� Set animation.gatesQueues as queue shape

� Choose false

© 1992-2005 XJ Technologies http://www.xjtek.com

26

Page 26: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

� Define the shape of a service point. It can be a line, a polyline, or a pivot containing several lines/polylines. We use a pivot since we want to define multiple services.

� WaitForPedToExit property defines whether service should wait for pedestrian to pass the end point of the service before recovery. Choose true to serve only one passenger at a time.

� ServeMultipleQueues property defines whether the service point should query multiple queues for pedestrians. Choose false to query only the closest queue.

� Choose the animation shape that defines the geometry of queue(s) to the service. Queues may be of different types. The queue type is detected automatically, depending on animation shape. Please refer to Pedestrian Library Reference Guide for the detailed description of queue types.

We use a pivot containing several polylines since we need to define multiple queues.

Add a PedConfiguration object. This object represents a set of Pedestrian Library’s global parameters and allows tuning the model for a specific task in order to get maximum model performance.

Set the following object properties:

� Choose true

� Choose false

� Choose true

� Choose true

© 1992-2005 XJ Technologies http://www.xjtek.com

27

Page 27: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

� Choose true to allow changing the default animation settings. Animation properties will be listed in the table under this property.

� Choose true to allow displaying the speed of the particular passenger in the animation.

� Choose true to allow displaying the density around the particular passenger in the animation.

� Choose false to hide the shapes that are used to define the model environment (walls, areas, services, etc.) in the model animation.

Now you can Run the model and observe its behavior. You can see that now passengers pass through ticket control gates and sometimes queues are generated.

You may examine the particular passenger state by clicking on its animation shape. This will show you the speed and the local density for this pedestrian. This option becomes available only when you add PedConfiguration block to your model and set low model speed, e.g. 1x.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 2 - Ticket control gates.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

28

Page 28: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

2.6 Changing passenger arrival rate interactively

Now we will make the passenger rate changeable. We want to interactively change the passenger arrival rate to assure acceptable performance of service points with hypothetic load. We will introduce the corresponding control element in the animation to change the rate interactively.

► Set passenger arrival rate

Add a parameter to define passenger arrival rate

Modify PedSource properties

Click the empty area of the structure diagram. The Properties window will display the properties of the Main active object. Click

the New Parameter button in the bottom of the window and define a new parameter in the Parameter dialog box opened.

Name the parameter passengerRate and define it like this:

© 1992-2005 XJ Technologies http://www.xjtek.com

29

Page 29: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Use this parameter to define the passenger arrival rate.

Change the following property of the PedSource object:

► Add a slider to vary passenger arrival rate

� Define the passenger arrival rate with the created parameter

Add a slider to vary arrival rate

Add slider label

Add slider range labels

© 1992-2005 XJ Technologies http://www.xjtek.com

30

Page 30: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Click the Slider toolbar button and then click on the structure diagram to place a slider.

For the slider created, set up the following properties:

To show the actual arrival rate value at run time, specify the text note run-time property:

� Click the Choose button and set the text font you like. We use Times New Roman font of size 7 in tutorial models.

� Select passengerRate as the value

� Set up the max value of 2000

� Click Text and then click the animation to add a rate note

� Type “Passenger arrival rate:” during text note creation as design-time value

� Type ”Passenger arrival rate: ” + passengerRate as the runtime value

� Change the text font

© 1992-2005 XJ Technologies http://www.xjtek.com

31

Page 31: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

� Change the text font as you did it for recently added label.

Run the model by clicking the Run button. Now you can change the passenger rate interactively with the slider. Therefore, you can find the maximal passenger arrival rate that can be served.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 3 - Changing passenger arrival rate.alp.

2.7 Adding ticket windows

Now we will expand our model by adding ticket windows.

► Modify the model animation

Draw ticket windows (lines)

Draw queues to ticket windows (polylines)

Add lines to a new pivot group

Add polylines to a new pivot group

� Add two text labels displaying slider’s min and max values

© 1992-2005 XJ Technologies http://www.xjtek.com

32

Page 32: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Draw lines representing ticket windows as shown in the figure below.

Create a pivot group and name it windows. Add just created lines to the pivot group.

Draw polylines representing queues to ticket windows as shown in the figure below.

� Place the first point of each polyline near the corresponding service line.

Create pivot group and name it windowsQueues. Add all just created polylines to this pivot group.

� Draw lines

� Draw polylines

© 1992-2005 XJ Technologies http://www.xjtek.com

33

Page 33: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

► Modify the flowchart

SelectOutput

PedServiceQ

Place SelectOutput object. We need it to route non-ticketed passengers to ticket windows while other ones – straight to the ticket control gates.

SelectOutput object is a decision making block of Enterprise Library. The entity arrived at the SelectOutput object is forwarded along one of two output ports depending on the user-defined condition.

To add an object, open Enterprise Library stencil and drag the object from the stencil on the structure diagram in the same way you add Pedestrian Library objects3.

3 Pedestrian Library flow definition part is compatible with AnyLogicTM Enterprise Library. This allows all Enterprise Library objects to be used in Pedestrian Library models, thus creating complex flexible models consisting of Enterprise Library flowcharts and Pedestrian Library environment. Please refer to Pedestrian Library Reference Guide for details.

© 1992-2005 XJ Technologies http://www.xjtek.com

34

Page 34: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up the following object properties:

� Specify uniform()<0.85 as the passenger routing condition since the number of passengers that have already bought their tickets is actually significantly higher.

The uniform() function is the standard AnyLogicTM random number generator. AnyLogicTM provides also other random number distributions, like normal, triangular, exponential, etc. Please refer to User’s Manual for the description of all the random number generators. You can also see all the generator functions and their parameters in AnyLogicTM Class Reference, see the Func page. To invoke AnyLogicTM User’s Manual or Class Reference, choose these items from the Help menu.

� Type entity.setColor(Color.orange) as the object’s “on exit” action. The expression changes the passenger shape color at runtime. Those passengers who need to buy tickets will be painted orange.

Color is the standard JavaTM class, containing some predefined colors like black, blue, cyan, magenta, red and so on, and also allowing you to create any custom color.4

Note that since SelectOutput is Enterprise Library object it

works with entities but not with pedestrians. So we access a passenger as entity while in the objects of Pedestrian Library a pedestrian is accessed as ped. See Pedestrian Library Reference Guide for details about working with peds in library objects.

� Set up the routing condition

� Change the non-ticketed passenger color

4 To see the list of predefined colors, as well as the methods of the Color class that allows you to construct custom colors, open http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Color.html or see your locally installed JavaTM documentation.

© 1992-2005 XJ Technologies http://www.xjtek.com

35

Page 35: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Add a PedServiceQ object to define a service representing subway ticket windows.

Set up the following object properties:

� There are two types of services in Pedestrian Library: lengthwise and traversal. Lengthwise services are used when pedestrians should move along the service shape, passing begin and end points of the line. Traversal services are used when pedestrians should stand at any point of the service line. In our example, ticket control gates are represented with a lengthwise service while ticket windows should be defined as a traversal service.

� Type triangular(15, 25, 35)

We assume that service time is triangularly distributed with the min value of 15 seconds, average value of 25, and the max value of 35 seconds.

� Specify the service delay time

� Change the service type

� Choose the service shape

� Choose false

� Choose the queue shape

� Change the served passenger color

Run the model by clicking the Run button. Note that now some passengers first go to the ticket windows to buy a ticket and only then go through ticket control gates.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 4 - Ticket windows.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

36

Page 36: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

2.8 Collecting statistics

Now some statistics is worth collecting: we want to know the total number of passengers in the building and how much time passenger spends in the subway entrance. The objects of the Pedestrian Library are already capable of collecting the basic statistics. You can also collect advanced statistics for some area whenever you need them.

► Define the area for collecting statistics

Add a PedAreaStats object. PedAreaStats object represents one or multiple areas for collecting basic statistics – number of pedestrians, average density and length of stay.

Set the following object properties:

© 1992-2005 XJ Technologies http://www.xjtek.com

37

Add a PedAreaStats object

� Choose animation.walls

� Allow statistics collecting

Add a variable

Page 37: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

� Specify the area for collecting statistics. We want to collect statistics for the whole subway entrance therefore we select the polyline that defines the building walls.

We need a variable to be able to display the collected statistics

using animation indicators. To add a variable, click the Variable toolbar button and then click at the empty place of the structure diagram.

Set up the following properties of the variable:

� Specify that the variable value is defined with a Formula.

� Type pedAreaStats.size()

Here pedAreaStats is the name of the PedAreaStats object we created. Each PedAreaStats object has functions that return its statistics. The function size() returns the total number of pedestrians inside the area defined for the PedAreaStats object. For more information about the statistics measured by a PedAreaStats object, please refer to Pedestrian Library Reference Guide.

� Choose Formula

� Define the formula

© 1992-2005 XJ Technologies http://www.xjtek.com

38

Page 38: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

We want to view the collected statistics. Draw a chart indicator and a label to display them directly in the animation.

► Add indicators on animation

Click the Chart Indicator toolbar button and then click the structure diagram to place a chart indicator.

Resize the chart indicator and set up the following properties:

� Choose the variable passengers to be displayed with this chart indicator. This chart will display how the number of passengers in the subway entrance changes with time.

� Set up the value to indicate

� Set max value to 25

Add a chart indicator

Add a label to the indicator

Place a label to display the average passenger’s length of stay time

© 1992-2005 XJ Technologies http://www.xjtek.com

39

Page 39: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Add a text label under the indicator. Set up the following properties of the label:

Add a text label to display the average passenger’s length of stay time.

� Type the design-time value: Average length of stay of passengers:

� Type the run-time value:

"Average length of stay of passengers: " + pedAreaStats.getAverageTime()

� Change the text font

� Set up the text design-time value

� Set up the text run-time value

� Set up the text to be displayed

Run the model by clicking the Run button. You will see statistics about average passenger length of stay time and the current number of passengers in the model. This may help you to discover how to improve efficiency and provide better service.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 5 - Statistics.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

40

Page 40: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

3. Subway Transfer Point Model

In this section we will create a model of a subway transfer point. This model will demonstrate you how to build many-storied models in AnyLogicTM Pedestrian Library.

3.1 Creating a new project

Create a new model as described in Section 1.1, “How to create a new AnyLogicTM model”.

3.2 Creating a model animation

We will create a simple model with two pedestrian flows representing passengers transferring to other subway lines.

First add the picture of the subway transfer layout.

► Add subway transfer layout

Create new animation

Add layout

© 1992-2005 XJ Technologies http://www.xjtek.com

41

Page 41: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Add the layout image. Set up the following properties:

� The layout picture we will use is Examples \ Pedestrian Library Tutorial Models \ images \ transfer_layout.png

Move and resize the animation area to (580, 400) to embrace the added image entirely. Finally the model animation should look as in the figure below:

� Select Original size option

� Choose the image

© 1992-2005 XJ Technologies http://www.xjtek.com

42

Page 42: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Now we will draw the model animation.

► Draw model animation

Draw the polyline as shown in the figure below.

Draw building walls

Draw entry

Draw entry

Draw exit

Draw exit

� Click Polyline toolbar button and click the first point

� Click several intermediate points

� Double-click the last point

© 1992-2005 XJ Technologies http://www.xjtek.com

43

Page 43: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up the following properties for the polyline drawn:

� Specify walls1F name for the polyline

� Make the polyline closed

� Change the polyline’s color and width

© 1992-2005 XJ Technologies http://www.xjtek.com

44

Page 44: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Draw an entry for the first passenger flow.

Set up the following properties for the line drawn:

Draw an entry for the second passenger flow.

� Name the line entry1

� Change the line’s color and width

� Draw the line

� Draw the line

© 1992-2005 XJ Technologies http://www.xjtek.com

45

Page 45: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up properties for the line drawn:

Draw the exit for the first passenger flow.

Set up properties for the line drawn:

� Name the line entry2

� Change the line’s color and width

� Name the line exit1

� Change the line’s color and width

� Draw the line

© 1992-2005 XJ Technologies http://www.xjtek.com

46

Page 46: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Draw the exit for the second passenger flow.

Set up properties for the line drawn:

Note that all entry and exit lines should entirely fit inside the

floor walls shape, i.e. inside walls1F polyline.

� Leave the default name line

� Change the line’s color and width

� Draw the line

3.3 Adding passenger flows

Now we are ready to model two passenger flows by adding the corresponding library objects to the flowchart and animating the layout by setting up the animation properties for these objects. Create and connect objects as shown below.

© 1992-2005 XJ Technologies http://www.xjtek.com

47

Page 47: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

► Create the model flowchart

Set the following object properties:

PedSource

� Set passenger arrival rate

PedSink

PedSink

PedFloor

PedSource

� Set animation.entry1 as the first passenger flow entry point

� Set the arriving passenger color

© 1992-2005 XJ Technologies http://www.xjtek.com

48

Page 48: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set the following object properties:

Set the following object properties:

Set the following object properties:

� Set animation.exit1 as the first passenger flow exit point

� Set the arriving passenger color

� Set animation.line as the second passenger flow exit point

� Set passenger arrival rate

� Set animation.entry2 as the second passenger flow entry point

© 1992-2005 XJ Technologies http://www.xjtek.com

49

Page 49: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Define the floor with a PedFloor object. Set the following object properties:

� Set this floor as the base floor of our model.

� Define the walls for the floor. Use walls1F polyline drawn earlier for this purpose.

We have finished creating a model. Now you can run it and observe its behavior.

► Run the model and view animation

Click the

Run toolbar button

Click Stop to stop execution and edit the model

� Set animation.walls1F as the floor walls

� Choose base floor

Adjust the execution speed or switch to virtual time mode to view simulation run at its maximum speed by clicking the Enable virtual

time mode toolbar button.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Transfer Point - 1 - Simple model.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

50

Page 50: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

3.4 Creating a two-storied model

Now we will define the additional floor introducing you the availability of building many-storied models with Pedestrian Library.

First, we will modify the model animation and then modify the model flowchart.

► Modify the model animation

Draw the polyline representing the upper floor walls. It should embrace the pink area of the layout representing the upper floor and the line acting as the exit for the second passenger flow.

Draw second floor walls (polyline)

Draw exit (line)

� Click Polyline toolbar button and click the first point

� Click several intermediate points

� Double-click the last point

© 1992-2005 XJ Technologies http://www.xjtek.com

51

Page 51: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up the following properties for the polyline drawn:

The line we used as an exit for the second passenger flow will act now as a passage line from the lower to the upper floor. Draw new line to act as the exit as shown in the figure below.

� Name it walls2F

� Make the polyline closed

� Change its color and width

� Draw the line

© 1992-2005 XJ Technologies http://www.xjtek.com

52

Page 52: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

The line should fit inside walls2F polyline.

Set up properties for the line drawn:

► Modify the model flowchart

PedFloor

PedChangeFloor

PedConfiguration

� Name the line exit2

� Change the line’s color and width

Modify PedSink parameters

© 1992-2005 XJ Technologies http://www.xjtek.com

53

Page 53: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Create one more PedFloor object to define the additional floor of the model.

Set the following object properties:

Add a PedChangeFloor object. PedChangeFloor object moves pedestrians to another floor.

Set the following object properties:

� Specify the passage line to the new floor. Pedestrians should walk to the passage line to gain the floor defined in the object’s NewFloor property.

� Those passengers who have changed the floor will be painted blue.

� Define the floor the passenger will gain

� Define floor area with animation.walls2F polyline

� Specify the “passage line”

� Change the passenger color

© 1992-2005 XJ Technologies http://www.xjtek.com

54

Page 54: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set the following object properties:

Change the following object property:

� Allow changing the default animation settings

� Set animation.exit2 as the new passenger flow exit

� Hide the environment shapes in the animation

Now we have finished creating a two-storied model. Run the model by clicking the Run button. You can see that passengers entering the subway transfer point from different

entries may clash sometimes in the centre of the subway transfer hall. However in the place the upper floor (painted pink) overlays the lower one, passengers do not contact with each other since they move on different floors and these passenger flows are independent.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 2 - Two-storied model.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

55

Page 55: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

3.5 Adding escalators

Now we will finish our model by adding escalators transferring passengers to the upper floor. First, we will define escalator area graphically in the animation and then add the corresponding library objects.

► Modify the model animation

Draw a rectangle as shown in the figure below.

� The rectangle should precisely embrace the escalators drawn in the layout.

Draw escalators area

Draw escalator moving direction

� Click Rectangle and click the animation to draw the shape

� Resize the rectangle and place it as shown in the figure

© 1992-2005 XJ Technologies http://www.xjtek.com

56

Page 56: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up some properties for the rectangle drawn:

� Make the rectangle transparent since otherwise it will hide a part of the layout.

Draw a line defining the direction of the moving floor.

� Choose No Fill

� Name the rectangle escalatorArea

� Change the rectangle border color

� Click Line and click to draw the begin point

� Click to draw the end point

© 1992-2005 XJ Technologies http://www.xjtek.com

57

Page 57: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

Set up properties for the line drawn:

� To make sure the line is pointing in the right direction you can indicate the line’s end point with an arrow.

� Name the line direction

� You may draw the line as an arrow

� Customize the line appearance

© 1992-2005 XJ Technologies http://www.xjtek.com

58

Page 58: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

► Modify the model flowchart

PedAreaChangeSpeed object represents an area modifying the pedestrian speed (a “moving floor”). We use it to define escalators in our model.

Set the following object properties:

� Leave the default value since this area belongs to the base floor.

� Choose true to make this area act as a “moving floor”.

PedAreaChangeSpeed

� Choose escalator shape

PedAreaRestricted

� Choose true

� Define the speed

� Choose the line defining the “moving floor” direction

� Change the transferred passenger color

� Choose the floor this area belongs to

© 1992-2005 XJ Technologies http://www.xjtek.com

59

Page 59: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

PedAreaRestricted object represents area(s) with restricted entrance. We need it since escalators can transfer the limited number of passengers at a time only.

Set the following object properties:

� Leave the default value since this area belongs to the base floor.

� Choose “Peds number” to automatically open and close the area based on number of pedestrians inside it.

� Define minimum number of pedestrians within area, at which area stays closed. Area opens when number of pedestrians becomes less than this value.

� Define maximum number of pedestrians within area, at which area stays open. Area closes when number of pedestrians becomes bigger than this value.

� Set the area shape

� Choose the area floor

� Choose the area’s operating mode

� Specify the area’s closing clause

� Specify the area’s opening clause

We have finished creating our model. Run the model by clicking the Run button and observe its behavior. You can see that now escalators quickly transfer passengers to the upper floor. If escalators are full at the moment, passengers may need to wait a little.

The reference model for this point is Examples \ Pedestrian Library Tutorial Models \ Subway Entrance - 3 - Escalators.alp.

© 1992-2005 XJ Technologies http://www.xjtek.com

60

Page 60: Pedestrian Library Tutorial - american technologika · AnyLogicTM Pedestrian Library Tutorial 1. Getting Started with AnyLogicTM This section contains general information about creating

AnyLogicTM Pedestrian Library Tutorial

4. Conclusion

This tutorial has taught you how to create simple models in AnyLogicTM Pedestrian Library. When creating more complex models, AnyLogicTM example models may be useful since you can find the example with the similar problem definition and take the approach implemented in the example.

You can find a set of simple demonstrative examples explaining how Pedestrian Library objects work, located under Examples\Pedestrian Library Examples folder.

You can seamlessly use any other AnyLogicTM modeling techniques in your model. For more information about the modeling techniques and ways AnyLogicTM supports, please refer to User’s Manual.

© 1992-2005 XJ Technologies http://www.xjtek.com

61