AnyLogic
Expand
Font size

Phase 5. Initial values of stocks

Now we are ready to specify initial values of stocks.

We want to set total population (our  TotalPopulation parameter) as the initial value of  PotentialAdopters stock.

When you mention some element in initial value of a stock, you should first connect it to this stock with a link.  Link is used to define a dependency between elements of a stock and flow diagram.

To create a link

  1. Double-click the  Link.
  2. Right after that, go to the graphical editor and click the element that is mentioned in initial value (TotalPopulation).
  3. Finally, click the  PotentialAdopters stock.
    It is important to draw the link in the right direction — from the independent variable to dependent.

  4. You will see the link in the graphical editor.
    Analogous to the flow, when it is selected, its end points should be indicated with little green circles. Otherwise, if there is a white circle on some its end, it means that this particular end point was not connected correctly. To establish the valid connection, please drag this end point onto the variable you want to connect.

Now, when you created the link, you can specify the initial value mentioning the connected parameter.

Define the initial number of potential adopters

  1. Select the  PotentialAdopters stock.
  2. In the stock’s Properties, type TotalPopulation in the Initial value edit box. Use code completion master to avoid typing the whole names of variables and functions. To open the master, click at the desired position in the edit box, and then press Ctrl + Space (Alt + Space on Mac).

The list of model variables and functions available in the current context appears. Scroll to the name you want to add, or type the first letters of the name until it becomes visible in the list. Press Enter to insert the name.

Finally you should get  TotalPopulation specified as the stock’s initial value:

We do not need to set up the initial value for the  Adopters stock explicitly since there are no adopters initially and the stock is already initialized with zero by default.

How can we improve this article?