Simulation with AnyLogic/Pedestrian Simulation/Step 6. Adding ticket control gates

Step 6. 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
 * 1) Draw four lines representing ticket control gates as shown in the figure below. [[File:Step 6. Adding ticket control gates 1.png]]
 * 2) The starting point is important. Passengers will move from the stating to the ending point of a line.
 * 3) Create a group containing all these lines drawn. We need it since we want to define a service with several shapes. Select four just created lines (the easiest way to select several shapes is to subsequently click on them with Ctrl pressed), right-click the selection and choose Grouping/Create a group from the popup menu. You will see a group icon [[File:Step 6. Adding ticket control gates 2.png]] appeared in the center of the selection. Select this group and rename it to gatesGroup.
 * 4) Draw polylines animating queues to ticket control gates as shown in the figure below: [[File:Step 6. Adding ticket control gates 3.png]]
 * 5) 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.
 * 6) Add all just created polylines to a new group as you did it recently for the lines representing control gates. Name this group gatesQueuesGroup.
 * 7) Draw a line as shown in the figure below. Name it lineBeforeGates. [[File:Step 6. Adding ticket control gates 4.png]]

Now we will modify the model flowchart.

Modify the model flowchart
 * 1) Add new objects and connect them as shown below: [[File:Step 6. Adding ticket control gates 5.png]]
 * 2) Modify the properties of the PedGoTo object. Now we want this block to move passengers not to subway trains but to our line located before the ticket control gates. Set the following object properties: [[File:Step 6. Adding ticket control gates 6.png]]
 * 3) *Specify new destination for passengers. Choose lineBeforeGates as the Target (point, line).
 * 4) Configure PedServices object. PedServices object represents one or multiple services and defines its default properties. Services defined by this object can be referenced by flowchart objects PedServices. Set the following object properties: [[File:Step 6. Adding ticket control gates 7.png]]
 * 5) *Name this object gates.
 * 6) *Specify the group containing lines representing services. Type gatesGroup in the Services (group of lines) field.
 * 7) *Specify the group containing polylines representing queues to services. Type gatesQueuesGroup in the Queues (group of lines, polylines) field.
 * 8) *Leave all other properties unchanged. You can see that the Delay time is uniformly distributed with minimum value of 2 seconds and maximum value of 3 seconds. Leave it since it is typical delay time for ticket control gates.
 * 9) *Leave the Service type: Delay and pass through. There are two types of services in Pedestrian Library. Delay and pass through service is defined by a line, along which pedestrians should move. Pedestrian services at beginning point of the line and then moves to ending point before leaving service. We use it since we want passengers to pass through service lines representing ticket control gates. Another type of service (Delay) is also defined by line, which pedestrians should step on for service delay time.
 * 10) Configure PedService object. PedService object is added into flowchart to model how pedestrian flow passes through a service defined by PedService object. Set the following object properties: [[File:Step 6. Adding ticket control gates 8.png]]
 * 11) *Specify the PedServices object defining the service pedestrians will pass through. Type gates (the name of our PedServices object) in the Service (PedServices) field.

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.