Simulation with AnyLogic/Pedestrian Simulation/Step 8. Adding ticket windows

Step 8. Adding Ticket Windows
Now we will expand our model by adding ticket windows.

Modify the model animation
 * 1) Draw lines representing ticket windows as shown in the figure below. [[File:Step 8. Adding ticket windows 1.png]]
 * 2) Add these lines to a new group. Name the group windowsGroup.
 * 3) Draw polylines representing queues to ticket windows as shown in the figure below. [[File:Step 8. Adding ticket windows 2.png]]
 * 4) The starting point of the polyline is important since it stands for the head of the queue. Place the first point of each polyline near the corresponding service line.
 * 5) Add these polylines to a new group. Name the group windowsQueuesGroup.
 * 6) Move lineBeforeGates a little bit down: [[File:Step 8. Adding ticket windows 3.png]]

Now we will modify the model flowchart.

Modify the flowchart
 * 1) Add new objects and connect them as shown below: [[File:Step 8. Adding ticket windows 4.png]]
 * 2) Configure PedServices object. This object will define parameters of a service representing ticket windows. Services defined by this object can be referenced by flowchart objects PedServices. Set the following object properties: [[File:Step 8. Adding ticket windows 5.png]]
 * 3) *Name this object windows.
 * 4) *Specify the group containing lines representing services. Type windowsGroup in the Services (group of lines) field.
 * 5) *Specify the group containing polylines representing queues to services. Type windowsQueuesGroup in the Queues (group of lines, polylines) field.
 * 6) *Specify the service time. Type triangular(15*second, 25*second, 35*second) in the Delay field (you can use code assist). We assume that service time is triangularly distributed with minimum value of 15 seconds, average value of 25, and maximum value of 35 seconds.
 * 7) *Change the Service type to Delay. Delay service is defined by a line, which pedestrians should step on for service delay time.
 * 8) Configure PedSelectOutput object. We need it to route non-ticketed passengers to ticket windows while other ones – straight to the ticket control gates. PedSelectOutput object is a decision making block of Pedestrian Library. The pedestrian arrived at the PedSelectOutput object is forwarded along one of five output ports depending on ratios specified for these ports. Set up the following object properties: [[File:Step 8. Adding ticket windows 6.png]]
 * 9) *Specify ratios for flows going to ticket control gates (Chance 1) and to ticket windows (Chance 2) correspondingly. In this flowchart we assume that the number of passengers that have already bought their tickets is actually significantly higher.
 * 10) Configure just added PedService object. This flowchart object references to PedServices object defining a service representing subway ticket windows. Set the following object properties: [[File:Step 8. Adding ticket windows 7.png]]
 * 11) *Specify the PedServices object defining the service pedestrians will pass through. Type windows (the name of our PedServices object) in the Service (PedServices) field.

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