AnyLogic
Expand
Font size

Connecting flowchart blocks

Agents can move between the blocks of your flowchart only if the ports of these blocks are joined via connectors — paths that agents use to flow through the model.

There are output and input ports in the blocks. You may only connect outputs to inputs, otherwise you will get a runtime error.

You can connect multiple output ports to one input port and multiple input ports to one output port. The only exception from this rule is the Fluid Library. For more information on the Fluid Library port connections, refer to the corresponding Fluid Library ports article.

In case multiple output ports are connected to one input port and more than one block wants to pass over an agent, the fair choice of agent is provided by a kind of round-robin algorithm implemented in the input port.

If one output port is connected to several input ports, it will choose the “first in some internal queue” port among those that are ready to accept the agent. More precisely, the output port will rely on the choice of AnyLogic engine among several simultaneous events. Fairness is not guaranteed in this case and such connection is therefore prohibited: it will cause an error at model runtime. To have full control over the agent distribution, use the SelectOutput blocks or custom agent routing implemented via blocks that take agents out of the process flow or put them into the flowchart. See the list of library specific blocks below:

AnyLogic library Blocks
Process Modeling Library
Material Handling Library
 Enter
 Exit
Pedestrian Library  PedEnter
 PedExit
Rail Library  TrainEnter
 TrainExit
Road Traffic Library  CarEnter
 CarExit
Fluid Library  FluidEnter
 FluidExit

Drawing connectors between blocks

To connect two ports automatically

This option is available by default. To disable it, go to Tools > Preferences > Graphical editor and deselect Connect automatically, when ports are close enough option.

  1. Drag a block from the Palette view and hover it next to the block where you want to establish the connection.
  2. When you see a connector appear between the ports of these two blocks, drop the block on the graphical editor.

To draw a connector between two blocks manually

  1. Double-click the port of the block where you want to start drawing the connector.
  2. If you need to draw a straight line between two blocks, simply click once on the port of the block where you want the connector to end.
  3. If you need to draw a connector with a complex shape, click the graphical editor to place the first salient point. Keep placing these points until you achieve the intended shape of the connector and place the last click on the port of the block where you want the connector to end.

By default, drawing the connectors starts with a double-click, but you can switch to single-click in Tools > Preferences > Graphical editor.
How can we improve this article?