You are on page 1of 4

Notes on the Vensim Equivalent of Stellas Conveyor Stock

Chapter 10 of Modeling the Environment describes the Conveyor stock, a special type of stock variable that Stella makes available within the stock
dialog box. Simply change the stock designation from reservoir to conveyor, and Stella will assign the slats image and expect you to follow the advice in
chapter 10. These notes explain how conveyor-like stocks (and their flows) may be implemented in Vensim.
Figure 1 shows a Stella conveyor stock that delays the inflow by 12 months. The transit time of the conveyor is controlled by a separate converter
(called the lag time) which is set to 12 months. The initial value of the stock is set to zero. The inflow is controlled by a time-dependent graph function. The
graph causes the inflow to jump to 100 in the 6th month. The DT is set to 0.25 months, and the inflow delivers 100 units into the stock. The contents of the stock
are removed 12 months later. The shape of the outflow is identical to the inflow. Figure 2 shows the same flows in Vensim. The stock is initialized at zero.
The equation for the outflow uses the DELAY FIXED function: outflow = DELAY FIXED(inflow,lag time,0)

Figure 1. Stella conveyor stock with a 12 month transit time and the contents
set to zero at the start of the simulation.

Figure 2. Vensim accomplishes the same 12 month delay in the flow with the
DELAY FIXED function.

Exercise #3 in Chapter 10 of Modeling the Environment asks you to practice with setting the initial value of a conveyor stock in Stella. In the example
on page 114, the stock of overwintering eggs has a 6-month transit time, so the user has the option of setting the initial value for each of the 6 slats in the
conveyor. This allows the eggs hatching flow in the first few months of a simulation to occur in the desired month.
When building the same model in Vensim, we leave the
initial value of the stock at zero. To create an early outflow
from the stock, we simply include an extra variable for the
flow in the initial months of the simulation. Figure 3 shows
the Vensim diagram for the model needed in exercise #4 on
page 114. The stocks are colored in yellow to remind us that
these are serving as the Vensim version of a conveyor stock.
The flows in pink make use of Vensims DELAY FIXED
equations to achieve the tightly controlled flows. For
example,
new eggs hatching =
DELAY FIXED(eggs deposited,incubation period,0)
maturation =
DELAY FIXED(births, maturation period,0)
deaths =
DELAY FIXED(maturation,adult period,0)
th

To get the initial 100 eggs to hatch in the 4 month, we need


to introduce a separate variable with the PULSE function:
Initial eggs to hatch in 4th month = 100*PULSE(4,1)
In Stella, we use the MOD function to keep track of the
month of the year (see page 353 of the book). Vensim calls
this the MODULO function, so we write:
Monthly counter = MODULO(time,12)

monthly counter

fraction female
eggs per female

incubation period
New
OverWintering
Eggs

eggs deposited

<Time>

initial eggs to hatch


in 4th month

new eggs hatching

total eggs hatching

Adults

deaths

maturation

adult period

Juveniles

births

maturation period

Vensim version of the model in the middle of page 114:


exercise #4, Chapter 10

Figure 3. Vensim version of the eggs and insects exercise.

Figure 4 is a print screen of the model with a


Vensim Table in view at the bottom of the screen.
This table confirms that the eggs are hatching in the
4th month of each year. The table also shows that the
adults appear in the 10th month of each year.

Figure 4. Verification of the Vensim version of exercise #4.


Time graph for Vensim Model
200
150

Figure 5 shows a time graph to confirm the model is


working correctly. Since there are no losses in the
system, we see 100 adults appearing year after year.

100
50
0
0

12

15

18

21 24 27
Time (Month)

30

33

36

39

42

total eggs hatching : Current


maturation : Current
deaths : Current

Figure 5. Vensim time graph for exercise #4.

45

48

Suggested Exercises for Eggs Model in Vensim


Exercise #4 Verify the Vensim Answer
Use the Vensims help feature to read about the DELAY FIXED function and the PULSE function, the new functions used in this model. Then build the model
shown in Figure 3. Run the model and produce the table shown in Figure 4 and the graph shown in Figure 5.

Exercise #5: add a 50% egg loss


With Stella, the egg loss is achieved by adding a second
outflow to the conveyor (see Figure 10.10 as an
example).

monthly counter

fraction female

incubation period

eggs per female


eggs deposited

New
OverWintering
Eggs

Vensim does not work with losses on the contents of the


stock. Rather, we implement the loss on the flow the
drains the stock. For example, Figure 6 shows how to
implement the 50% egg loss in Vensim. Notice that we
assume that the loss occurs as the eggs hatch.
The equation for the new eggs hatching would be
new eggs hatching
= DELAY FIXED(eggs deposited*(1-egg loss
fraction),incubation period,0)
If you run this model with the eggs per female set at 4,
the simulation should confirm that 100 adults appear
year after year. And they will appear in the 10th model
of each year.

new eggs hatching

total eggs hatching

egg loss
fraction
deaths

adult period

<Time>
initial eggs to hatch
in 4th month

Adults
maturation

Juveniles

maturation period

Vensim version of the model in the middle of page 114:


exercise #5, Chapter 10
Figure 6. Vensim version of exercise #5 from Chapter 10.

births