AnyLogic
Expand
Font size

Counting agents passed through the block

To know the number of agents that passed through the flowchart block, you should use the function count() of the corresponding port of the block. For example, if you have source block and want to know how many agents left its output port out, type the following code: source.out.count().

To know the name of the block’s port, please refer to the description of the block in the Library Reference Guide. The names of the block ports are shown on the block figure at the top of the page:

The image of the block with port names in Library Reference Guide

Statistics on agent throughput

AnyLogic also displays statistics on agent throughput through the flowchart blocks at the model runtime by displaying text labels with some stats near block icons.

  • The number that is shown on top of the icon shows the number of agents that are currently in the block.
  • The numbers displayed near the block ports show the number of agents that passed through these ports up to this moment.

To enable the display of counters, click the small triangle in the upper left or right corner of the block:

You can switch all the counters on or off in the AnyLogic Preferences.

How can we improve this article?