Step 6. Adding dynamic variables

We need to add two dynamic variables representing adoptions resulting from word of mouth and from advertising.

 Create AdoptionFromAd dynamic variable
  1. Drag the Dynamic variable  element from the System Dynamics palette onto the graphical diagram of agent.
  2. In the Properties view, change the Name to AdoptionFromAd.

Now we want to specify a formula for this dynamic variable. The formula for the adoption from advertising is AdEffectiveness*PotentialAdopters.

Again, as with mentioning some variable in stock's initial value, when you mention some variable in equation of dynamic variable, flow, or some other system dynamics element, you need to connect those variables with a link prior to specifying the formula. 

 Add links from two variables to AdoptionFromAd

  1. Add a link from PotentialAdopters to AdoptionFromAd

  1. You can adjust the link appearance (change its arc) by dragging the marker in the middle of the link. Adjust the appearance to make the link look like in the following figure:

You may have noticed that this link looks different from the one drawn from TotalPopulation to PotentialAdopters. Links to variables mentioned in stock initial values are drawn with dotted lines, while other links - with solid lines. 

  1. Add one more link, going from AdEffectiveness to AdoptionFromAd.
  1. Now you can specify the formula in the properties AdoptionFromAd (in the AdoptionFromAd = edit box):  AdEffectiveness*PotentialAdopters


 Create AdoptionFromWOM dynamic variable
  1. Add one more dynamic variable. Name it AdoptionFromWOM and specify the following formula:
    ContactRate*AdoptionFraction*PotentialAdopters*Adopters/TotalPopulation
You may find it boring to add numerous links for all the variables mentioned in this formula. For this case AnyLogic provides a quick fix mechanism that automatically creates missing links to the variables mentioned in an equation.
  1. After specifying the given formula, click inside the formula field. You will see error indicators. 


  1. Click the error indicator (right where the arrow points in the figure above). You will see the context menu with items Create missing link for: ContactRate, etc. Choose this item and the corresponding link from the parameter ContactRate to AdoptionFromWOM will be created. Do the same things for all other missing links one by one.


  1. You can also fix dependency links using the context menu.

Finally you will get the following stock and flow diagram:

Now we can formulate the adoption flow using just defined dynamic variables. The two sources of adoption are assumed to be independent. Thus, the total adoption rate is the sum of adoptions resulting from word of mouth driven by the population of adopters and adoptions resulting from advertising.

 Define the formula for the adoption rate

  1. We want to define the formula AdoptionFromAd+AdoptionFromWOM for the flow. First, add two links pointing from these variables to the flow.
  2. Now select the flow on the diagram and go to the flow properties. Specify the formula expression in the AdoptionRate= field:
    AdoptionFromAd+AdoptionFromWOM


Now we have completely defined our model. The stock and flow diagram of the model should look like as on the figure below.


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. You can add polarity labels for the links present in your stock and flow diagram. 

Actually all of them are positive except for the one going from TotalPopulation to AdoptionFromWOM.

 Add polarity labels for links

  1. To add a polarity sign, select the link in the graphical editor and choose + or - option from the Polarity group of options in the link's Properties.
  2. You can change here the color of the link either (in the Color control).

Our model has one balancing and one reinforcing feedback loop. 

 Add an identifier for Market Saturation loop

  1. Drag the Loop  element from the System Dynamics palette onto the graphical diagram, as shown in the figure below:

  1. Go to the Properties view to set up properties of the loop. 
  2. Set the Direction of this loop - this loop is Counterclockwise
  3. Type the brief text explaining the meaning of this loop in the Text property: Market Saturation. This text will be shown on the presentation.
  4. Choose the symbol that will be shown for this element from the Type group of buttons. Choose B here (stands for Balancing) since this loop is balancing.
To determine if a causal loop is reinforcing or balancing, one can start with an assumption, e.g. "VariableN increases" and follow the loop around. 

The loop is:

 Add an identifier for Word of Mouth loop

  1. Add one more loop identifier as shown in the figure below:

  1. This loop stands for word of mouth effect. It is reinforcing, so choose R as a symbol denoting its type. 
  2. Specify Word of Mouth as its Text.
  3. Set the Direction of this loop - this loop is Clockwise
Finally the diagram should look like in the figure below:


         Step 5. Defining initial values of stocks

          Step 7. Configuring simulation