# Simulating Pedestrians Using Legion for Aimsun¶

Note about licenses: These exercises require a license for Aimsun Next Pro Micro, Advanced, or Expert Edition. They also require a Legion for Aimsun license, which can be provided upon request.

Note: This tutorial relates to the pedestrian model as implemented in the Legion for Aimsun software. If you want to know more about the in-built Aimsun Next pedestrian simulator, see Pedestrian Simulator.

## Introduction¶

In these exercises, the goal is to create a pedestrian area with all the necessary data to run a microsimulation of the network including embedded pedestrians.

We will define an area that pedestrians can walk through plus areas where there is interaction between vehicles and pedestrians.

We will also define pedestrian centroids, OD matrices, a traffic demand, and we will add a scenario experiment that include all these elements.

Note: If you have already completed the Simulating Pedestrians tutorial, you will be familiar with most of these exercises and techniques already.

## Exercise 1. Creating a Pedestrian Area¶

First, we need to create a pedestrian area for pedestrians to move through.

1. Select File > Open > Initial_Pedestrian.ang.

2. Click the Create Pedestrian Area icon .

3. Using the screenshot below as a guide, draw the polygon for the area by clicking its vertices at the required points. To finish and close the polygon, double-click to add the final point.

## Exercise 2. Adding More Layers¶

After creating the area, a new layer named Pedestrians Layer will be added to the Layers window. The goal of this exercise is to add more layers to help us organize the different graphical aspects of the pedestrian area. Such organization enables us to show those details we require but hide anything that is not needed in the simulation.

1. Right-click Pedestrians Layer > New Layer.

2. Repeat three times until you have four new Untitled layers.

3. Rename these layers as: Area, Centroids, Decision Nodes, and Obstacles.

The next steps moves the pedestrian area we created to the Area layer.

4. Click to select the pedestrian area.

5. Right-click Area > Move selection to this layer.

6. Open the Area layer and untick the box Allow Object Editing. This last step means that the pedestrian area cannot be changed or edited until this parameter is unticked.

## Exercise 3. Creating Obstacles¶

The aim of this exercise is to create pedestrian obstacles which will affect pedestrians' walking paths in the simulation.

First, activate the Obstacles layer so that the new obstacles are added to this active layer.

We will generate obstacles in three ways: from the objects in the pedestrian area, from a layer, and manually.

### 3.1 From objects in the pedestrian area¶

1. Right-click on Pedestrians Layer > Area and select Generate Pedestrian Obstacles.

2. All sections, nodes, and polygons partially or fully inside the pedestrian area will be used as obstacles. Hide the layers named OpenStreetMap and Network to reveal the obstacles that have been created.

### 3.2 From a layer¶

You can create obstacles from CAD drawings in a layer, if present.

1. Right-click on the layer and select Generate Pedestrian Obstacles.

2. Tick Select All and Include Active Sublayers if you want to include layers belonging to the first layer.

3. Set an Object Minimum Height to include/exclude objects of a certain height.

Objects included in your selection will be used as pedestrian obstacles.

### 3.3 Manually placing obstacles¶

1. Click the icons and to manually draw new pedestrian obstacles in the pedestrian area.

The first icon enables you to draw polylines and the second to draw polygons.

2. Add some arbitrary obstacles into the pedestrian area.

3. After adding your obstacles, lock the Area and Obstacles layers by opening Pedestrians Layer and unticking Allow Object Editing.

You can also right-click on the layer and select Disable Allow Object Editing.

## Exercise 4. Adding an Entrance and Exits (Centroids)¶

In this exercise we will add entrances and exits to enable simulated pedestrians to enter and leave the network within the pedestrian area. As we draw them in the model, we will add them to the activated Centroids layer.

When adding these objects, use the screenshot below as a guide.

1. Right-click Centroids > Activate. The layer icon turns blue to indicate that this is now the active layer.

2. Click the Pedestrian Entrance icon and draw the pedestrian entrance in the 2D view. The entrance is a rectangle which you can size and rotate as required.

When you add a pedestrian entrance to the network, a pedestrian centroid configuration is added to the Project folder.

3. Double-click the Pedestrian Exit icon and draw both pedestrian exits in the same manner as step 2.

Tip: when you double-click a tool icon it remains the active tool until you press Esc or select another tool.

If you need to move, resize, or rotate entrances and exits later, click to select and then drag to move; use their resizing handles to increase or decrease area. To rotate, click the Rotate icon and then click on the object to change its orientation.

4. Rename the entrance Metro IN and rename the exits CampNou OUT and South OUT, as indicated in the screenshot above.

## Exercise 5. Adding Decision Nodes¶

Decision nodes are virtual areas which pedestrians pass through as they travel on their route. They are useful for defining realistic pedestrian paths and movements.

1. Click the Create a Decision Node tool .

2. In the pedestrian area, draw the object's vertices to define the shape of the decision node.

The way in which pedestrians walk toward the decision node can be adjusted using focal points. The focal point is the central point in the decision node towards which pedestrians walk.

3. To adjust the direction of pedestrians, you can click and drag the focal point to different positions inside the area of the decision node.

4. Name the decision node DN-A.

## Exercise 6. Adding a Pedestrian Type¶

Now we have an area for pedestrians to enter, walk through, and exit, we need some pedestrians. In this exercise we will add a pedestrian type.

1. Select Project > New > Pedestrians > Pedestrian Type. A new Pedestrian Type is added to the Project folder.

2. Open the Pedestrian Type to check the default parameters.

The Pedestrian Simulator parameters specify the walking speed and radius of the pedestrian entities. The Type Parameters contain the parameters of the social-force model for pedestrian dynamics and are described elsewhere in Pedestrian Types.

3. Keep the default settings and click on the 3D Shapes tab. We will add the 3D figures for the simulated pedestrians next.

5. Double-click in the Shape cell and select pedestrian_female.osg.

6. Repeat steps 4 and 5 to add pedestrian_male.osg and pedestrian_child.osg.

To view the 3D animations of pedestrians, scroll to the bottom of the Pedestrian Type dialog.

7. Enter Percentage values to total 100.

8. Click OK.

## Exercise 7. Creating an OD Matrix¶

Note that a pedestrian centroid configuration has already been created in the Project window's Pedestrian Centroid Configuration folder.

Now that we have a pedestrian entrance and two exits, we can create an OD matrix to introduce pedestrian demand.

To create an OD matrix:

1. Rename the existing pedestrian centroid configuration as Pedestrian CC.

2. Right-click Pedestrian CC > New > Pedestrian OD Matrix.

3. Open the new OD matrix.

4. On the Main tab, enter an Initial Time of 08:00:00.

5. Click the Cells tab.

6. Enter the matrix data using the values shown below.

Pedestrians will take the shortest path between their origin and destination, taking roads, pedestrian crossings, and obstacles into consideration. If you require new or existing elements to act as obstacles to pedestrians, select the element and right-click Generate Pedestrian Obstacle.

## Exercise 8. Changing the Level (via Bridge)¶

The shortest path between Metro IN and CampNou OUT takes pedestrians over an available crossing, but there is no available path between Metro IN and South OUT.

In this exercise we will create an accessible path by adding a level-change element in the form of a bridge.

To change the level:

1. Right-click the Bridges layer and select Activate.

2. Click the Create Level Change Object icon .

3. Draw the object pictured below across the two road sections near South OUT. You can resize, move, and rotate it as desired. At the moment it appears underneath the sections. We will fix this in the next step.

4. Open the Pedestrians Layer and change Level to 150.

5. Click OK. This raises the whole pedestrian area above the sections, meaning the bridge now crosses over the sections.

6. Double-click on the bridge object and rename it Level Change.

7. Set Height as 4.00 m and for both access points (A and B) set the Percentage as 100%. The reason this is 100% is because there is only one access point at each side of the bridge.

8. Click OK.

## Exercise 9. Creating OD Routes¶

In this exercise, we will create the routes between the entrances and exits – specifically two different routes between the origin-to-destination centroids.

To create OD routes:

1. Right-click on Pedestrian CC > New > Pedestrian OD Route.

2. Rename it Route: Metro - Campnou.

3. Create a second OD route and rename it Route: Metro - South.

4. Open each of the pedestrian OD route objects.

5. To add Route Items, click on the locations to be visited in the 2D view.

6. Select Origin and Destination Centroids.

Your results should match those pictured in the next two screenshots.

To set the percentage-use figures for each route, we need to open the pedestrian OD matrix. In this case, as there is only one route between origin and destination, the percentage needs to be 100%.

1. Open each matrix, click on the Path Assignment tab, and add 100 to each cell in the Percentage column.

## Exercise 10. Traffic Control¶

You might recall from earlier tutorials that Node 959 already has signal groups, with Signal 5 linked to the pedestrian crossings. This signal will affect the new simulated pedestrians.

To view traffic control:

• Click on Node 959 to select it and then right-click Edit Control Plan > Control AM.

Phase 3 operates Signal 5 and allows pedestrians 14 seconds of green time.

## Exercise 11. Running the Simulation¶

We can now run the simulation, including the new pedestrian-related features. To do so, we need to include the pedestrian data.

To run the simulation:

1. Open Traffic Demand – Mat.

2. Click Add Demand Item and tick Pedestrian CC to add the pedestrian demand.

3. Click OK to add the demand to the dialog.

4. Open Micro SRC Experiment and select Aimsun Pedestrian Simulator.

5. Right-click Replication > Run Animated Simulation (Autorun).

6. Select the view mode Pedestrians to make it easier to observe the simulated pedestrians. This view increases their size, as shown below.

## Exercise 12. Including Transit Choices¶

In this exercise we will generate pedestrian trips from the metro to bus stop Stop 1 and from Stop 1 to Camp Nou. The routes are pictured below.

The first step in this process is to create origin and destination centroids at the bus stop Stop 1 in the form of an exit and an entrance. These objects enable pedestrians to exit the network by boarding a bus and to enter the network by alighting from a bus.

To include transit choices:

1. Right-click on the bus stop and select Generate Pedestrian Exit.

2. Right-click on the bus stop and select Generate Pedestrian Entrance.

The stop will now have an entrance and an exit, placed automatically at each end.

3. Open these new objects and name the exit In Bus and the entrance Out Bus (labeled below).

4. Open the pedestrian OD matrix to define the movements between the different centroids. On the Cell tab, add 300 pedestrians from ‘Metro In’ to ‘In Bus’:

5. It's optional but let's add another decision node (name it DN-B) so that pedestrians don't take the very shortest path but walk at a more realistic distance from the road section.

6. In the Alighting Distribution section of the OD matrix dialog, edit the percentage of pedestrians that exit via Out Bus and who then walk to Camp Nou:

Currently, 100% of the pedestrians that alight at Stop 1 walk to Camp Nou. Now we need to define, for the transit lines, the number of passengers that alight at each stop.

7. Open transit line L-Blue and click on the Timetables tab.

8. Click on the Initial Time of a schedule and tick the option Show Pedestrian Info.

9. In the Dwell Times section of the dialog, enter the data that specify that 30 passengers alight at Stop 1 and 100 board.

This second parameter is high so that in reality all the pedestrians waiting at the stop can board as long as the bus has capacity.

The maximum capacity of the bus is defined in the Vehicle Type dialog > Main tab. In our example, the maximum number of passengers in a bus is set at 50:

10. Run the simulation to observe the new transit options in action.

1. Run the simulation to observe the new transit options in action.