System Dynamics element.
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
So, if some element
is mentioned in the equation or initial value of element
B, you should first connect these elements with a link going from
and only then type the expression in the properties of
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.*
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
- Double-click the
element in the
palette so that its icon turns into
- Right after that, go to the graphical editor and click the element that is mentioned in the equation.
- Finally, click the dependent element (i.e. the element, in whose equation the dependency is defined).
- 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
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.
Please note that it is important to draw the link in the right direction - from the independent variable to dependent (the figure
above demonstrates invalid connection case).
- Go to the
view to set up properties of the link. Choose the symbol that will indicate the link polarity from the
group of options. You can choose from standard
same relationship), or
(opposite relationship). Moreover, you can specify your own symbol in the edit box to the right.
- If needed, change the line
adjust the link appearance.
– Here you can choose the symbol that will be shown near the link and will denote its polarity. It can be
(means positive polarity),
same relationship), or
(opposite). Moreover, you can specify any other symbol in the edit box to the right.
– Here you can change the color of the link.
– Here you can set the width of the link.
– If selected, the double dash will be shown striking the link to indicate that this link involves delays in causal loop diagrams:
Customizing the link appearance
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
To change the color of the dependency
- Select the link in the graphical editor. You will see the handle drawn in the middle of the link.
- Drag this handle aside. You will see that the bend angle changes in accordance with your action.
- Select the link in the graphical editor with a mouse click.
- In the
view, choose the color using the
Quick fix mechanism for missing links
AnyLogic provides a quick fix mechanism enabling you to add missing links in a handy way.
To add all missing links at once
- 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
- Find the element that contains the equation in the graphical editor and right-click it.
- In the context menu, you will find the option
Fix Dependency Links, expand it and select
Create Missing Links
to add the links that are expected to be there.
- All necessary links will be drawn right away. The conflicts will be resolved, and the
view will clear.
- 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
- Let's assume that equation in the formula or initial value of some system dynamics element, say
variableA, mentions some
that is not connected with a link with
- Go to the
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.
- Click the error indicator. You will see the context menu containing item(s)
Create missing link for [variable_name].
- 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:
System Dynamics tutorial
System Dynamics modeling