AnyLogic
Expand
Font size

Phase 1. Creating a simple model

First, we will create the simplest queuing model simulating how customers are serviced at the ATM.

Create a new model

  1. Click the  New toolbar button. The New Model dialog box is displayed.
  2. Specify the name of the model. Type Bank in the Model name edit box.

  3. Specify the location where you want to store your model files. Browse for the existing folder using the Browse button, or type the name of the folder you want to create in the Location edit box.
  4. Select minutes as model time units.
  5. Click Finish to complete the process.

A new model is created. It already has one agent type called  Mainand an experiment called  Simulation experiment. Agents are the main building blocks of AnyLogic model. In our case  Main agent will serve as the place where will define all the logic of the model: here we will put the process flowchart, and define some simple animation.

In the center of the workspace you will see the graphical editor. It shows the diagram of the  Main agent type.

To the left of the graphical editor you can see the  Projects view and the  Palette view sharing the same area. The  Projects view provides access to AnyLogic models currently opened in the workspace. The workspace tree provides easy navigation throughout the models. The  Palette view contains all graphical elements you can add onto the graphical editor of your agent just by drag'n'drop. Model elements are organized in palettes by category.

On the right side of the workspace you can see the  Properties view. The  Properties view is used to view and modify the properties of a currently selected model element(s). When you select something — e.g., in the  Projects view or in the graphical editor — the  Properties view displays the properties of the selection.

Now we can start developing the model.

Creating a process flowchart

Now we will define the process with a flowchart composed from Process Modeling Library blocks.

Each block here defines some operation that will be performed with agents passing through this block.

In AnyLogic you create flowcharts by adding the blocks from the library palette to the graphical diagram, connecting blocks together and tuning the parameters of the blocks.

Create the model flowchart

  1. After you create the model, AnyLogic will switch to the  Palette view and display the  Process Modeling Library palette:

  2. Add  Process Modeling Library blocks on the diagram and connect them as shown in the figure below. To add a flowchart block on the diagram, drag the required element from the palette into the graphical editor.

  3. While dragging the blocks, and placing them close to each other, you may see the lines connecting the blocks appear. These connectors should connect only the ports lying on right and left borders of the block icons.

Our flowchart describes the simplest queuing system, consisting of a source of agents, a delay, a queue before this delay, and the final sink block.

Let's say a couple of words about these flowchart blocks.

  •  Source block generates agents. It is usually used as a starting point of the process flow. In our example, it models customer arrival.
  •  Queue block models queues. In this model it simulates a queue of customers waiting for the moment they can start accessing ATM services.
  •  Delay here simulates the delay associated with the service at ATM.
  •  Sink block indicates the end of the flowchart and destroys the incoming agents.

See Process Modeling Library blocks for a list of all  Process Modeling Library blocks with short descriptions and links to individual detailed articles on every block.

Configure the flowchart blocks

  1. To modify properties of some model element, first select it by clicking on it in the graphical editor or in the  Projects view. This opens the properties of this element in the  Properties view.
  2. Select  Source block. In the  Properties viewspecify how often customers arrive by setting the Arrival rate to 0.3 per minute.

  3. Modify the properties of the  Queue block. Set the Capacity to 15 agents. At most 15 customers will wait in a queue.

  4. Rename the  Delay block to ATM.
  5. Assume that processing time inside ATM is triangularly distributed with mean value of 1.5, min of 0.8 and max value of 3.5 minutes.

The triangular() function is a standard AnyLogic random number generator. AnyLogic also provides other random number distributions, like normal, Poisson, exponential, etc. Refer to Probability distributions page for the list of all available random number generators.

Running the model

We have finished modeling the simplest queuing system and we are ready to run the resulting model. First, build your model by clicking the  Build model toolbar button. If there are some errors in your model, the building fails and then the  Problems view appears listing all the errors found in your model. Double-click an error in the list to open the location of the error and fix it.

After the model is successfully built, you can start it. Running the simulation, you automatically bring the current model up to date.

Start the model

  1. Click the  Run toolbar button and choose the experiment you want to run from the drop-down list. Your  Simulation experiment is called Bank/Simulation.

If this model is the only one opened in the workspace at the moment, you will be prompted to run this particular experiment. Later on this button will start the previously run experiment. To run any other experiment, right-click (Mac OS: Ctrl + click) the experiment in the  Projects view and choose Run from the context menu.

Having started the model, you will see the model window. It displays the presentation of the top-level agent type (by default, it's  Main).

The model will launch immediately. You will see animated flowchart. Each model created with  Process Modeling Library instantly has animated flowchart where you can see detailed current block status, for example queue size, number of agents left and so on — completely visualized!

If needed, adjust the execution speed to your needs using Slow down and Speed up buttons in the control panel.

You can inspect flowchart blocks to get the detailed information on their current state. Click on the block to open its inspect window. Inspect window shows statistics of the block, e.g. Queue block's inspect shows the queue capacity, the number of agents passed through either port of the block and also whether the timeout option is enabled for this queue. Contains string displays the number of agents currently being in the block along with IDs of these agents.

How can we improve this article?