Lesson 5 - How to Make Models Vary with Time
Now that we have discussed how we represent time and define the timestep in GoldSim, in this Lesson we briefly discuss the various ways we can actually build a model that is time-dependent.
There are three ways to create a model that will vary with time in GoldSim:
- Use one or more GoldSim elements that implicitly compute their output as a function of time.
- Define one or more variables that explicitly reference time in their definition.
- Use one or more GoldSim elements whose outputs are inherently stochastic.
Let’s explore all three of these in a bit more detail.
Using a GoldSim element that implicitly computes its output as a function of time
This is by far the most important and interesting way to make a model vary with time. Recalling our discussion from Lesson 2, using such elements is how you would represent endogenous dynamic behavior. Endogenous behavior is something that comes from “inside” the model and is explained by the relationships within the model. That is, if a system evolves endogenously, it means that the model structure itself is inherently causing the model variables to change with time.
In order to cause endogenous dynamic behavior, an element must have “memory” or “inertia” with regard to the past. That is, the current value of the element’s output(s) must be a function of inputs to the element at previous timesteps. If the current value of the element’s output(s) are only a function of the inputs to the element at the current timestep, the element cannot generate endogenous dynamics.
So what kinds of GoldSim elements generate such behavior? The most commonly used elements that generate such behavior are the Stock elements (we’ve seen one type of these – the Pool element – in the previous Unit). These elements solve time integrals, so by definition, they are inherently a function of time (and their current value is a function of their inputs at previous timesteps). Other GoldSim elements also generate endogenous behavior, including Delay elements and the Status element. We will discuss one type of stock element (the Reservoir) in the next Lesson. We will revisit another type of stock element (the Pool), as well as Delays and the Status element in subsequent Units.
Defining a variable that explicitly references time in its definition
This is another common way to generate dynamic behavior. An example of this would be to define a variable using an if-then statement that implemented something like this:
"If the elapsed simulation time < 10 days, set the value to A, else set the value to B"
In this case, the variable changes with time because we explicitly tell it to. In this particular example, the value of the variable at the current time is not a function of its previous values. When we do something like this, we are typically trying to represent some process that is happening external to the model that results in such a change. Recalling our discussion from Lesson 2, such external influences on the evolution of a model are referred to as being exogenous.
As we shall see later in this Unit, GoldSim provides some powerful tools for allowing you to reference things like the elapsed time in a simulation.
Using a GoldSim element whose outputs are inherently stochastic
A stochastic variable is a variable that varies randomly to some extent, and whose behavior can be analyzed and described statistically but not predicted precisely. Classic examples of stochastic variables include the average daily rainfall rate, and the price of a commodity or a security (e.g., a stock or bond).
One of GoldSim’s key features is its ability to represent stochastic processes. In fact, GoldSim was specifically designed from the outset to do so. As such, it provides a number of powerful elements that can be used to model stochastic processes and random events. We will introduce some of these elements in subsequent Units.
In a simulation model, such features are intended to represent exogenous processes or “forcing functions”: behavior that is coming from “outside” the model and is not due to or explained by the model (although in some circumstances, these features can also be used to generate some endogenous behavior).