Basic Stella Builtins Library
2f8ce032a51741af9d65f200e054433e
isee systems, inc.
Stella Architect
0
20
4
0
ramp_function
initial_value_1+RAMP(slope, start_time, stop_time)
10
2
0
step_function
initial_value_2+STEP(step_value, step_time)
10
10
0
pulse_function
initial_value_3+PULSE(pulse_value, pulse_time, frequency)
10
10
4
0
Flow_1
0
Flow_2
0
Flow_3
(inputStock_1)/delay_per_step
(Stock_1Stock_2)/delay_per_step
(Stock_2"third_order_information_delay_(final_stock)")/delay_per_step
"averaging_time_smoothn"/3
15
2
3
IF("Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"=1) THEN(STEP(10, 2)) ELSE(IF("Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"=2) THEN(PULSE(10, 2, 0)) ELSE(RAMP(.5, 2)))
SMTHN(input, "averaging_time_smoothn", N)
5
5 + RAMP(1, 0)
MIN(ceiling_amount, variable_amount)
5
MAX(floor_amount, variable_amount)
2
3
IF("Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"=1) THEN(STEP(10, 2)) ELSE(IF("Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"=2) THEN(PULSE(10, 2, 0)) ELSE(RAMP(.5, 2)))
DELAYN(input_1, "averaging_time_delayn", N_1)
2
IF("Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"=1) THEN(STEP(10, 2)) ELSE(IF("Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"=2) THEN(PULSE(10, 2, 0)) ELSE(RAMP(.5, 2)))
DELAY(input_2, delay_duration)
HISTORY(input_3, history_time)
0
0
0
RAMP(2, 0)
5
1
1
IF(condition_switch=1)
THEN(value_if_true)
ELSE(value_if_false)
5
5
10
IF(start_time_switch<="<<time>>")
THEN(value_if_true)
ELSE(value_if_false)
TIME
TIME MOD(interval)
UNIFORM(lower_range, upper_range)
0
Flow_4
Flow_5
0
Flow_5
Flow_6
0
Flow_6
"third_order_material_delay_(final_flow)"
input_1
(Stock_4)/delay_per_step_2
(Stock_5)/delay_per_step_2
"averaging_time_delayn"/3
Stock_6/delay_per_step_2
5
SINWAVE(amplitude, period)+shift_up_or_down
5
10
COSWAVE(amplitude, period)+shift_up_or_down
0
5
10
IF(TIME MOD(sample_interval)=0)
THEN(UNIFORM(lower_range, upper_range))
ELSE(0)
1
HISTORY(input_3, TIMEhistory_time)
SMTH3(input, "averaging_time_smoothn")
DELAY3(input_1, "averaging_time_delayn")
DT
pulse_value/"<<DT>>"
start_time
ramp_function
slope
ramp_function
step_time
step_function
step_value
step_function
pulse_time
pulse_function
pulse_value
pulse_function
frequency
pulse_function

Stock_1
Flow_2
Stock_2
Flow_3
delay_per_step
Flow_2
delay_per_step
Flow_3
"third_order_information_delay_(final_stock)"
Flow_3
delay_per_step
Flow_1
Stock_1
Flow_1
Stock_2
Flow_2





A ramp function is a function of time that produces a desired linear behavior between a specified interval. It takes the inputs (slope, start time, stop time) where slope indicates the rise of the line per time unit. Start time and stop time indicate when the ramp should be active.
stop_time
ramp_function
A step function is a function of time that produces a sudden step increase at a desired time. It takes the inputs (step, time) where step is the incremental change (can be positive or negative) from the initial value and time is the time that the step happens.
A pulse function is a function of time that produces a sudden pulse at a desired time and occurring on a desired interval. It takes the inputs (volume, first pulse, interval) where volume is the amount that comes through at each pulse, first pulse is the time that the pulses start happening, and interval is how often the pulse reoccurs after the first pulse. Interval can optionally be left blank if there is no desired reoccurrence.
An important thing to note with the pulse function is that it produces the entire pulse value in one DT... NOT in one time step. This is to approximate that the pulse happense more or less instantaneously. Because of this and because of how each timestep is calculated in the software, the graph shows some misleading results. In this case, with DT set to 1/4 and a pulse value set to 10, the graph indicates pulse amounts of 40. This is because to get a pulse of 10, the software passes on a value to the pulse function equal to the value divided by the DT so that after the time step, the desired amount gets passed through the function. The calculations have been provided here just to show why the graph returns the values that it does.
delay_per_step
Flow_1
"averaging_time_smoothn"
smthn_function
N
smthn_function
input
smthn_function

ceiling_amount
min_function
variable_amount
min_function
floor_amount
max_function


max_function


"averaging_time_delayn"
delayn_function
N_1
delayn_function
input_1
delayn_function
delay_duration
delay_function
input_2
delay_function


A min function is used to put a ceiling on a certain value. It requires two inputs and the min function will always pick the smallest of the two at any given time.
A max function is used to put a floor on a certain value. Like the min function, it requires two inputs and then picks the largest of the two values at any given time. A practical application of this is to use a max function to be sure that a value does not go negative by using the formula MAX(0, variable amount), then if the variable amount ever goes negative, the max function will choose 0
A discrete delay is used when there is no variability among the delay times. This can be though of as a pipeline where the input always takes exactly x number of time units to come out the other side. This can also be explained as being an infinite order delay by increasing N in the upper examples, you will see the behavior approach this discrete delay behavior. All that is required is two inputs (input, delay duration).
A delay function is used to simulate the effects of a multiorder delay process. This function takes the inputs (input, N, averaging time) where input is the initial input that will be subject to the delay process, N is the number of orders (or stocks) that the delay will go through, and averaging time is the total average delay time of the input. The idea with this function is that it simplifies a much more complex model structure into a single delay converter. (Note that a delay converter must be used here as there are hidden stocks inherent in this variable). One can change the distribution of the delay by changing N Higher N will result in a tighter distribution around the averaging time.
Shown here is both a DELAYN and a SMTHN function, which essentially work the same way in the examples shown here. In reality a DELAYN function is used to generate a multiple order material delay whereas a SMTHN function is used to generate a multiple order information delay. Examples of the full underlying model structure for each type can be seen by scrolling to the right.

initial_value_1
ramp_function
initial_value_2
step_function
initial_value_3
pulse_function
input_3
static_history_function
history_time
static_history_function
input_2
"Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"
input
input_1
A history function just returns a historical value from an input. If a static time input is used, it returns zero until the time has come, then takes the value at that indicated time and holds it constant from there on out. If a relative time reference is used, then the result will be similar to what you would get from a DELAY function just a discrete delay of a certain number of time units of the input variable.




condition_switch
if_then_else_function_1
value_if_true
if_then_else_function_1
value_if_false
if_then_else_function_1
1=True
0=False
IF THEN ELSE functions are used to set up conditional situations in your model. This formulation is made up of three different equations that are used together. First, put an expression within an IF function, which will evaluate an if expression is either true or false. This expression must be a logical expression using logical operators such as (=,<,>,=<,=>,><) Nested within this equation can be other logical operator functions such as AND, OR, or NOT. Second, enter a value or function in the THEN function. If the IF statement is true, then the function will return this value. Finally put a value or expression within the ELSE function so that if the IF statement is false, this value will be chosen. Note that an additional nested IF THEN ELSE formulation can be placed inside an ELSE function if more than two alternatives are required. Two examples of this equation are shown here to show how versatile this function can be in different situations.
Also shown in example 2 is the TIME function This simple function just returns the time and can be used in any time dependent situation.
Basic Stella Builtins Library
start_time_switch
if_then_else_function_2
"<<time>>"
if_then_else_function_2
if_then_else_function_2
if_then_else_function_2
delay_per_step_2
Flow_5
delay_per_step_2
Flow_6
delay_per_step_2
"third_order_material_delay_(final_flow)"
Stock_4
Flow_5
Stock_5
Flow_6
Stock_6
"third_order_material_delay_(final_flow)"
interval
mod_function

A MOD function simply returns the remainder when a certain number is divided by another number. This example shows a formulation (TIME MOD(interval)) which works in this way: It takes time as an input, in the case of this model, it runs from 0 to 20. Then it takes time divided by the interval and returns whatever the remainder of that division is. Whenever the interval divides perfectly into time, the result is then zero. This function can be used to simulate a fixed interval. Since 0 will be returned after every interval it can be used in formulations that require something to happen every so often. Note that any function can be placed before the MOD function, it doesn't have to be time.
amplitude
sinwave_function
amplitude
coswave_function
period
coswave_function
period
sinwave_function

The SINWAVE and COSWAVE functions are used to produce a sine wave and a cosine wave. The inputs required are amplitude (height of the wave) and period (length of the wave). These can be used to create input into the model that show cyclical behavior.
shift_up_or_down
coswave_function
shift_up_or_down
sinwave_function
lower_range
uniform_function
upper_range
uniform_function
lower_range
uniform_function_with_sample_interval
upper_range
uniform_function_with_sample_interval
sample_interval
uniform_function_with_sample_interval

The UNIFORM function is one of many builtin random number generator functions in Stella. It is used to pick a random number within a given range defined by a min and a max of that range. It will by default pick a new number at every DT as shown in the red graph. However, this function can be paired with a MOD function and put inside an IF THEN ELSE formulation to return a random number at only a specific interval. See the example given here:
input_3
history_function
history_time
history_function
© Will Noyes 2020
MINDS, System Dynamics Group, University of Bergen
This is an educational tool to learn about the commonly used builtin formulas in Stella.
For each formula there is a basic description, a model representation that allows you to control the different inputs, and one or two output graphs that show the result of that formula.
If you would like more information on any of these builtins or on any that are not demonstrated here, remember that you can always consult Stella Help.
Note: For newer versions of Stella, you need to first uncheck "Calculate loop dominance information" to resolve the invalid equation errors. Alternatively, disconnect the N converters from the SMTHN and DELAYN functions, and key in the Nth order directly into the equation.
smth3_function
smth3_function
Flow_4
delay3_function
delay_per_step_2
delay3_function




"<<DT>>"
graph_value
pulse_value
graph_value
"averaging_time_smoothn"
input
variable_amount
"Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"
"Input_type:_Step_=_1_Pulse_=_2_Ramp_=_3"
value_if_true
value_if_false
input_1
"averaging_time_delayn"