AnyLogic
Expand
Font size

Link

System Dynamics element.

Link is used to define a dependency between elements of a stock and flow diagram. There are two types of dependencies:

  • Some element (stock, flow, dynamic variable or parameter) is mentioned in a formula of a flow or a dynamic variable. This type of a link is drawn with a solid line:

  • Some element is mentioned in the initial value of the stock. This type of link is drawn with a dotted line:

AnyLogic does not create links automatically but enforces the user to draw links explicitly in the graphical editor (however, AnyLogic also supports quick fix mechanism for missing links, see below).

If element A is mentioned in the equation or initial value of element B, you should first connect these elements with a link going from A to B and only then type the expression in the properties of B.

Positive and negative links

Links may have positive or negative polarity:

  • Positive causal link means that the two nodes change in the same direction, i.e. if the node in which the link starts decreases, the other node also decreases. Similarly, if the node in which the link starts increases, the other node increases.
    We assume that all other nodes keep the same values.

  • Negative causal link means that the two nodes change in opposite directions, i.e. if the node in which the link starts increases, then the other node decreases, and vice versa.
    We assume that all other nodes keep the same values.

The relationships between variables, represented by links, can be labeled as positive or negative. Polarity is usually indicated with a /- sign at the link arrowhead. It shows how the dependent variable changes when the independent variable changes.

To create a link from one SD element to another

  1. Double-click the .
  2. Right after that, go to the graphical editor and click the element that is mentioned in the equation.
  3. Finally, click the dependent element (i.e. the element, in whose equation the dependency is defined).
  4. When finished, you will see the link in the graphical editor. It will be selected and in case you have successfully drawn it, its end points should be indicated with little green circles (see case c in the figure below). Otherwise, if the link is selected but there is a white circle on some its end (case b), it means that this particular end point was not connected correctly. To fix and establish the valid connection, please drag this end point onto the variable you want to connect.

    It is important to draw the link in the right direction — from the independent variable to dependent (the figure a above demonstrates invalid connection case).
  5. Go to the Properties view to set up properties of the link. Choose the symbol that will indicate the link polarity from the Polarity group of options. You can choose from standard + and -, s (stands for same relationship), or o (opposite relationship). Moreover, you can specify your own symbol in the edit box to the right.
  6. If needed, change the line Color and Line width.
  7. Optionally, adjust the link appearance.

Properties

General

Polarity — Here you can choose the symbol that will be shown near the link and will denote its polarity. It can be + (means positive polarity), - (negative), s (stands for same relationship), or o (opposite relationship). Moreover, you can specify any other symbol in the edit box to the right.

Color — Here you can change the color of the link.

Line width — Here you can set the width of the link.

Delay — If selected, the double dash will be shown striking the link to indicate that this link involves delays in causal loop diagrams:

You can customize the link appearance, namely you can change link color and edit link bend angle.

To modify the bend angle of the link

  1. Select the link in the graphical editor. You will see the handle drawn in the middle of the link.
  2. Drag this handle aside. You will see that the bend angle changes in accordance with your action.

To change the color of the dependency

  1. Select the link in the graphical editor with a mouse click.
  2. In the Properties view, choose the color using the Color control.

AnyLogic provides a quick fix mechanism enabling you to add missing links in a handy way.

To add all missing links at once

  1. If an equation in the formula or initial value of some system dynamics element mentions some variables, and they are not connected with links, AnyLogic will display errors in the Problems view:

  2. Find the element that contains the equation in the graphical editor and right-click it.
  3. All necessary links will be drawn right away. The conflicts will be resolved, and the Problems view will clear.
  4. If there are redundant links, you can remove them using the option Remove Unused Links from the context menu.

To add a missing link one by one

  1. Let’s assume that equation in the formula or initial value of some system dynamics element, say variableA, mentions some variableB that is not connected with a link with variableA.
  2. Go to the Properties view of the variable that throws error indicator (variableA) and click in the equation field. You will see the error indicator shown to the left of the formula.

  3. Click the error indicator. You will see the context menu containing item(s) Create missing link for [variable_name].

  4. Choosing an item from the list you create the corresponding missing link. You can easily create all missing links one by one in such the way:

How can we improve this article?