# 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
* Draw four lines representing ticket control gates as shown in the figure below.
* The starting point is important. Passengers will move from the stating to the ending point of a line.
* 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 appeared in the center of the selection. Select this group and rename it to gatesGroup.
* 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.
* Add all just created polylines to a new group as you did it recently for the lines representing control gates. Name this group gatesQueuesGroup.
* Draw a line as shown in the figure below. Name it lineBeforeGates.
Now we will modify the model flowchart.
Modify the model flowchart
* Add new objects and connect them as shown below:
* 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:
** Specify new destination for passengers. Choose lineBeforeGates as the Target (point, line).
* 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:
** Name this object gates.
** Specify the group containing lines representing services. Type gatesGroup in the Services (group of lines) field.
** Specify the group containing polylines representing queues to services. Type gatesQueuesGroup in the Queues (group of lines, polylines) field.
** 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.
** 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.
* 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:
** 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.