Before you start learning Stella, please make sure that you realize that this is a software tool designed to build dynamic models. This means that the system that we study is changing in time, that there are variables that evolve. This also means that there are certain limitations and certain conventions. There are systems that are not very well suited to model with Stella. If we simply want to use Stella for certain calculations we may probably do it, but this may not be the best way to go, since using, say, Excel may be much simpler. For example, some standard economic systems, which are usually formulated in terms of some equilibrium state, may be hard to define in Stella, unless we go away from the equilibrium and consider the transition processes as well.
When using Stella we really need to start with identifying the state variables, which will be called Stocks in Stella, and then figuring out what makes these variables to grow (because there are flows of material or energy coming in), or to decrease (because there are flows that go out).
Stella opens with a graphic menu that contains a number of icons.
The first four are the main building blocks for your model.
The rectangles are to represent the state variables, which
are also called "Stocks" in Stella. They are
to describe the elements in your system. These are the quantities
that change in the system, that you analyze and report as a result
of the modeling exercise. For each of the state variable a differential
(difference) equation is to be created in Stella.
The flows represent the processes in which materials (or quantities)
are taken from one state variable and added to another. The
cloud is used to show that material is exchanged with
the outside of the system.
Circles represent parameters or auxiliary variables (also
called "Converters" in Stella. These are all the quantities
that are either constant in the model or will be calculated
based on the values of the state variables.
Lines with arrows are to show what depends upon what. They are
to feed the value from one Stella icon into another. They cannot
move material or quantities, they only convey information.
To build a model using these tools you first click on the State variable
icon and then click somewhere in the window, where this variable will
be located on the diagram. The variable appears with a "Noname" name.
You click on this title and type the name that you want this variable
Next you click on the Flow icon and choose where you want to draw the
flow that will go into of from the state variable. Then you hold on
the mouse button and drag the cursor from where the flow starts to where
it goes. If you want a state variable to receive a flow or to be drained
by a flow make sure that the State variable icon gets highlighted
as you put the cursor on top of it. If it does then it will get
attached to the flow. If it does not then it will not be associated
with the flow and this might create a problem in the future if you do not
notice that there is a cloud placed somewhere on top of your State variable
or right next to it. You will be thinking that the flow is there, while in
reality it is not.
As you drag the flow from one element to another, you can make it angle
if you hit the Shift key. This is useful to keep the diagram tidy and
clear. You then give a name to the "Noname" flow similarly to the
You may now need to add an auxiliary variable. In a similar way now you
choose the circle icon and place it somewhere on your diagram.
You give it a name. If you click and hold on any of the names of
the elements in the diagram you can drag the name around the icon that
it belongs to. This is useful to keep your diagram tidy.
Finally you use the connector arrows to link variables, flows and
state variables. Just like with flows after you choose the connector
icon you click the mouse on the origin of information and then drag
the arrow to connect it with the recipient of the information.
By drawing this diagram you have already formulated one differential
(or rather difference) equation that will go into your model:
Next you need to specify the actual size of FLOW and the initial
condition for S_VARIABLE.
Before you go any further you need to switch the model from the
so-called "Mapping Mode" to the "Modeling Mode". This is done by
clicking on the button on the left hand side. You may notice that "?"
will appear on all elements in the diagram that need further
If you double-click on the parameter icon, you get this dialogue window:
Even though it requires that you "place the right hand side of equation here"
in reality all you need to do is give the value for the parameter
that you want to use in your model. Suppose the rate we want to use in
0.01. We simply type that value in instead of the highlighted words and
click on the "OK" button (or hit the "Enter" key). If for some reason you
prefer only to click you can also use the numerical pad offered in the
dialogue box. You can also use some arithmetic expressions, like 1/100, or
choose some of the built-in functions that are listed there.
Next we double click on the flow icon and open this dialogue box:
Now indeed you are to "place the right hand side of equation here".
The required inputs are listed above and if you click on any of them
they will be copied into the equation field. Let us describe the flow
as a product of the available stock in S_VARIABLE and the rate
coefficient that we have already specified in PARAMETER:
PARAMETER*S_VARIABLE goes into the equation field.
We click "OK" and similarly double click on the State variable icon.
This opens the dialogue window to specify the initial conditions.
The list of "Allowable Inputs" may be somewhat confusing, because it
would be only on a rare occasion that you would need any of the flows
or other state variables to specify the initial conditions. In most
cases you will simply type a constant, say 10. Or you may store this
constant as a parameter and then refer to it in this box.
Note that there is a check-box that says "Non-negative". By default all state variables
come checked as non-negative. This can turn out to be quite misleading. You want
the flows in your model to make sense and to work in such a way that the Stocks
do not get depleted and negative. By clamping them with this check-box, you loose
track of what is really happening in your model. You may well be generating some
totally crazy behavior that is supposed to make a stock negative, however you will not
even notice that if that variable is clamped. It is recommended that you keep this box
unchecked, unless you really know what you are doing and have a clear understanding
of the effect of various flows on the state variable.
Finally, there are several radio buttons at the top that say Reservoir, Conveyor, Queue, Oven. These are different built-in ways to modify the way the equations work in Stella. In this course we will be using only the Reservoir option. This is primarily because the other three are quite unclear in terms of the conventions and math that is standing behind them in Stella. Check out the Stella manuals if you wish to figure these out.
Now that all the question marks are gone, your model is ready to run.
You can also check out the equations that you have generated by clicking
on the downward arrow in the upper left corner:
The equation here describes the exponential growth model that we have
Before you start running the model you need to specify how you want the
output to look like. Let us go back to the other icons on top of the window.
The next group of three are mostly for convenience and are not essential
to create models. The first one allows you to place buttons in the
diagram. This may be handy for navigation or for model runs. Instead of going
through menus you can get something done by simply pressing a button
right in the diagram. The next icon allows you to group certain variables
and processes into sectors. This is useful to put some more order into
the diagram. It also allows you to run only certain parts of the model.
The third icon is to wrap certain details about processes and display
them as one icon in the diagram. Also mostly serves esthetic purposes.
The next group of 4 are the Output Tools.
You click on the Graph icon, choose a place on the diagram and click
again. A new window is open to display the graphs. Double click anywhere in
that window and a dialogue box is open.
By double clicking on any of the values in the left hand side you
add them to the list of variables on the right hand side. These will
be graphed (no more than 5 per graphic). You can check out the
different buttons and options available. The most useful one is
the scaling that is controlled by highlighting (clicking once) a
variable among the selected ones and then clicking on the
arrow to the right of it. Then you can change the minimal and maximal
values for this variable that will define the scale in the graph.
In a very similar way you can define a Table to output values that
variables take during the course of the simulation. Choose the Table
icon, click anywhere in the diagram and a Table window opens.
Double click anywhere in that window and a dialogue box opens.
Once again you choose the variables that you want to display and
specify some of the characteristics of your Table. Also in a similar way
you can generate output for an individual variable. In this case you will
get the value that it attains by the end of the simulation.
As a result for the model that we were building we can design the output
and run the model by choosing "Run" from the Run menu, or pressing Command-R
(on a Mac) or Ctrl-R (in Windows). In this case we display the graphic of
exponential growth quite similar to the one we have seen
Finally we can look at the Editing Tools presented
by the fourth group of icons.
The navigation cursor (the hand) is the one you would be mostly using to
open and close windows and to arrange elements of your diagram.
The paintbrush icon is to add some colors to the diagram. You can color
individual elements or change the color of your graphics. The icon
that is supposed to look like dynamite is to delete things in the
diagram. Be careful - there is no undo in Stella! (Note: Stella version 8 and above finally has the undo feature implemented.) If you blow
something up - it is gone. To use this tool click on the dynamite icon,
then choose the element you want to delete and click on it. What is to
be blown away will be highlighted. Do not release the mouse button
until you verify that what is to be deleted is what you really want to
get rid of.
The ghost is very useful when you need to connect elements that are very
far apart in the diagram. In that case the diagram gets too busy if you
do all the connections directly. Click on the ghost icon, then click on
any of the elements in the diagram you want to ghost. A copy of it will
be created that can be put anywhere else in the diagram you need.
This brief overview covers only some of the basics of Stella. However
it may be sufficient as a starter, since most of the dialogue
boxes and menu options are quite self-explanatory and may be mastered
by the good old trial and error method. Please note that:
Also please note the following rules of good style, when building your models:
- You cannot connect two Stocks with an information flow. Only material Flows
can change a Stock. The information about a Stock can affect a Flow, but not
the information flow.
- A material Flow is assumed positive. If it becomes negative Stella will
clamp it to zero. A negative Inflow is actually an Outflow. Therefore since you
specify the direction of your Flow, the sign matters, and Stella makes sure that
all Flows are positive. If you need a Flow that can become negative, use the Biflow
option. A Biflow can go in both directions. Make sure that you have the positive
flow associated with the direction in which you first drew the Biflow. The negative
flow will then go in the opposite direction.
- You cannot connect auxiliary variables with material Flows. Only information
flows are appropriate in this case.
- Try to keep your diagram tidy. Avoid long connectors and confusing names. Avoid
criss-crossing flows. The easier it is to read your diagram the less errors you
will be making, the more appealing it will be to anyone else you need to explain
the model to.
- There is no such thing as too much documentation. Every variable or flow in Stella has
a Document option, which is useful to record your ideas and comments about what
you are modeling and the assumptions you are making. It is extremely important
both for the model developer and the model user.
Copyright note: This course presentation is copyrighted material by
Dr. Alexey Voinov, and all models, images and layouts are by Alexey
Voinov unless specified otherwise.
This material must be properly acknowledged just as if it were
presented in a printed format e.g.:
Voinov A. (1999). Simulation Modeling, Online Course.