Understanding State Variables in
GoldSim
Within a GoldSim model (actually, any dynamic model), there are fundamentally two types of outputs:
- Outputs whose current
value only depends on the current value of their element’s inputs ((i.e., they
have no “memory”). These outputs themselves fall into one of two
sub-categories:
- Those that represent unchanging input data (or direct functions of input data) and are therefore static, in that they only need to be computed at the beginning of the simulation and do not need to be recalculated every timestep A discrete interval of time used in dynamic simulations.. Examples include the outputs of Data elements and Stochastics (which are not being resampled).
- Those whose inputs change with time, and therefore need to be recalculated every timestep. Examples include the outputs of Expressions and Selectors whose inputs vary with time.
- Outputs whose value is computed based on the historical value of the element's inputs (as opposed to only being a function of the current value of the element’s inputs). These outputs can be thought of as having “memory” of what has happened before. The primary output For an element with multiple outputs, the output that has the same name as the element. of a Reservoir A stock element that integrates and conserves flows of materials. or a Pool A stock element that integrates and conserves flows of materials. A Pool is a more powerful version of a Reservoir (it has additional features to more easily accommodate multiple inflows and outflows). is a classic example.
This second type of output is referred to as a
All state variables have, by definition, an initial value (e.g., for Integrators, Reservoirs and Pools, the initial value is explicitly specified). This allows the outputs to be computed when there are no historical input values available (e.g., at the start of simulation).
All state variables have “memory”; that is, their value at time t is a function of their value at time t - ∆t. Furthermore, state variables can change during a simulation in two different ways:
- Some state variables are intrinsically a function of time. That is, every timestep, they may change because they are inherently defined with respect to time. Integrators, Reservoirs and Pools are examples of this. Since these elements fundamentally solve time integrals, whenever the simulation time changes, by definition they must be updated.
- Some state variables can be triggered by or respond to other elements in the model, and in turn, change their value. A Status element is a good example of this.
Some state variables may change due to just one of these mechanisms, while others may potentially change due to both. For example, Status elements An event element that allows you to monitor the status of something that is changed instantaneously (i.e., is triggered) by events. can only change by the second mechanism; Reservoirs and Pools can change due to both.
The most common state variables are the primary outputs of stocks (Integrators, Reservoirs and Pools). A number of other elements, however, also have outputs which are state variables, and these are summarized in the table below.
Element | State Variable Output(s) |
Integrator | Primary Output |
Pool | Primary Output; Is_Full |
Reservoir | Primary Output; Is_Full |
Stochastic | Primary Output; Probability_Density; Cumulative_Probability |
Script | Primary Output |
Extrema | Primary Output |
Status | Primary Output |
Decision | Last_Decision |
Milestone | Completion_Status; Date; ETime |
Timed Event Generator | EventCount |
Triggered Event Generator | EventCount |
Discrete Change | EventCount |
Information Delay | Primary Output |
Material Delay | Primary Output; Amount_in_Transit |
Event Delay | EventCount; Num_in_Transit; Mean_Time; Current_Service_Time |
Discrete Change Delay | EventCount; Num_in_Transit; Num_in_Queue |
Conditional Container | Activity_Status; Completion_Status |
Previous Value | Primary Output |
Time Series | Primary Output |
History Generator | Primary Output |
The icons for state variables are indicated in browsers (e.g., output ports) by showing a vertical line to the left of the output triangle:
In this example, Reservoir1 (the primary output) and Is_Full are state variables.
Note: In addition to the elements listed above, a number of elements in GoldSim’s extension modules also have outputs that are state variables.