Simulation with AnyLogic/Pedestrian Simulation/Step 7. Changing passenger arrival rate interactively

< Simulation with AnyLogic‎ | Pedestrian Simulation

Step 7. Changing Passenger Arrival Rate InteractivelyEdit

In the current model the passenger arrival rate is fixed. However, AnyLogic provides a set of controls enabling changing the model parameters at the model runtime.

Now we will introduce how you can vary parameters of Pedestrian Library objects dynamically. 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 presentation to change the rate interactively.

  Add a slider to vary passenger arrival rate

  1. Open the Controls stencil of the Palette and drag the Slider   element from there into the graphical editor, e.g. to the right of the entrance layout:
  2. Set the properties of the slider. We want to vary the passenger arrival rate from 0 to 5000 pedestrians per hour. Therefore, specify 5000/hour() as slider’s Maximum value. We type 5000/hour() here since the default model time unit in pedestrian models is day. And since we want to define our rate in peds per hour, we divide the value by the constant defining time value equal to one hour according to the current time unit setting.
  3. Type 1000/hour() as the slider's Default value.
  4. Specify pedSource.set_rate(value); as the slider's Action. This code will modify the rate of our PedSource object each time the user will move the slider. value here is the local variable that stores the current value of the slider.

  Add text labels for the slider

  1. Add a title for the slider. Drag the Text   element from the Presentation palette onto the diagram (above the slider).
  2. Define the text to be displayed by this label in the Text property:
  3. In the same way add two text labels displaying slider's minimum (0) and maximum (5000) values. Place them below the slider as shown in the figure below:

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