Lesson 9 - Using Run Properties to Explicitly Reference Time
For our next Exercise involving a dynamic simulation, we will use the second method discussed previously to generate dynamic behavior: defining a variable that explicitly references time in its definition.
In particular, we are going to create a variable that implements something like this:
"If the elapsed simulation time < 10 days, set the value to A, else set the value to B"
In order to do so, we need to learn how to do two new things (that are used in all complex models):
- Reference the simulation time; and
- Create complex if-then logic.
In this Lesson, we will learn about the former. The next Lesson will then discuss creating complex if-then logic. We will then be ready to tackle the next Exercise.
To facilitate the referencing of time in a simulation, GoldSim provides a number of special reserved names, referred to as Run Properties, that can be directly referenced in input fields. One of the most common Run Properties is ETime (elapsed time). You can enter the names of the Run Properties directly when editing input fields (just as you would enter the name of an output), or you can insert them into an input field using the Insert Link dialog.
In order to experiment with Run Properties, open a new model and create an Expression element. After doing so, right-click in the Equation field and select Insert Link… from the menu. The following dialog will be displayed:
As can be seen above, at the top of the dialog is a folder labeled “Run Properties”. If you expand this folder, you will see that the Run Properties are organized into four categories (Calendar Time, Elapsed Time, Simulation and Reporting Periods):
Expanding any particular category folder lists all of the Run Properties in that category. For now, we are only interested in the Elapsed Time category:
The most commonly used of these is ETime (the elapsed time since the start of the simulation). It has units of time. RTime is the remaining time in the simulation (computed as the duration minus the elapsed time). It also has units of time. The other Elapsed Time Run Properties are unitless. For example, EDay is the elapsed number of days since the start of the simulation.
Note: All the Run Properties are protected names, so, for example, you cannot create an element named “ETime” or “RTime”.
We will discuss some of the other categories of Run Properties in subsequent Units. For example, the Calendar Time Run Properties are of value when running a Calendar Time simulation (i.e., with a specified Start Time and End Time rather than a Duration), as they allow you to reference calendar time properties of the simulation (e.g., the month, day of month or year).