There are some situations in which you may want to reference the previous (as opposed to the current) value of an element’s output. For example, you may want to reference the amount of money in an account (represented by a Reservoir) one day ago, as opposed to at the current time. GoldSim allows you to reference an output’s previous value by using a Previous Value element.
A previous value element outputs the value of its input from the previous update of the model. Usually, a model is only updated every timestep, so that the previous update refers to the previous “scheduled” timestep specified in the Time Phase settings of the Simulation Settings dialog.
In some cases, however, GoldSim actually updates the model between specified (scheduled) timesteps. In such a case, the previous value is not necessarily the previous scheduled timestep, and may return a value between the current scheduled timestep and the previous scheduled timestep.
There are basically three instances in which a Previous Value element can be useful:
• Occasionally, you may actually want to directly reference the previous value of an output (as in the example of an account mentioned above). Generally, however, you should be careful when doing so, and in most cases it is poor modeling practice, as it ties your model to the timestep length. For example, if you were interested in obtaining the value for an output from 3 days previous, and to do so you used a Previous Value element, you would need to take care to always use a 3 day timestep. In such a case, rather than choosing a 3 day timestep and referencing its previous value using Previous Value element, it is almost always better to use an Information Delay with a Delay Time of 3 days.
• In some situations, you may wish to simulate a static or dynamic process in which the variables in the loop are coupled such that they respond instantaneously to each other, and there are no time lags. In GoldSim, these are referred to as recursive loops, and they are conceptually different from feedback loops. The output of a Previous Value element can be used to provide an approximation to the current value of an output so that coupled equations can be solved explicitly.
• GoldSim provides the ability to carry out looping (iterative) calculations at each update (at each point in time) within a Container. In these special Containers, a calculation is repeated until a specified number of loops is completed or a particular condition is met. In most cases, the condition will likely involve comparing the output of the looping calculation to the previous loop’s output (e.g., determining if (X now - Xprev) < some tolerance value). Previous Value elements can be used to facilitate such a calculation.
Learn more about:
Inputs and Outputs to a Previous Value Element
Understanding Timestepping in GoldSim