Courses: Introduction to GoldSim:
Unit 13 - Modeling Discrete Events
Lesson 8 - Tracking the State of a System Using Status and Milestone Elements
In many models, the state of the system changes discretely (suddenly) during a simulation in a binary manner. Examples of such state changes include the following:
- A piece of equipment fails (i.e., changes its state from operating to failed);
- An object (e.g., a pump or a light) turns on or off;
- A business opens and closes for the day; and
- A task or activity is completed (i.e., it changes from unfinished to finished).
In a simulation, it is useful for the state of the system to be referenced by other elements and subsequently affect other things in the model (e.g., if one task is completed, another one can start).
To support this, GoldSim provides two elements that can be used to track the state of the system: the Status element and the Milestone element. Both of these elements can respond to discrete signals.
We will begin by considering the Status element. To do so, let’s examine an Example model. You will find this model in the “Examples” subfolder of the “Basic GoldSim Course” folder you should have downloaded and unzipped to your Desktop. In that folder, open a model file named Example18_Status.gsm.
The model looks like this:
If you examine the Simulation Settings, you will note that the model is set up as a Calendar Time simulation that runs for 3 days, with a 1 minute timestep.
The model simulates a conveyor belt that moves soil from one location to another, where it is subsequently stockpiled. The conveyor belt is modeled using a Material Delay (discussed in detail in Unit 8, Lesson 10). The stockpile at the end of the conveyor belt is a Reservoir (because it simply accumulates soil, we are using a Reservoir here rather than a Pool). When the conveyor belt is operating, it moves at a rate of 100 m/hr, and is 250 m long. This results in a Delay Time for the Material Delay (i.e., the time to travel the length of the conveyor belt) of 2.5 hours. When the conveyor is operating, it is loaded with soil at a rate of 1000 kg/hr.
The conveyor belt, however, only operates from 8AM to 5PM. Outside of that time, the conveyor belt stops (and is no longer loaded). The model uses a Status element to track the state of the conveyor belt (on or off). Double-click on the Status element (named Operating) now. It looks like this:
As can be seen, a Status element is relatively simple. It has an Initial Condition (True or False), and two buttons that both access Triggering dialogs. The first Triggering dialog is used to specify events that set the Status to True. The second Triggering dialog is used to specify events that set the Status to False. A Status has a single output, which is a condition (True or False).
In this case, the Initial Condition is “False”, since if you examine the Simulation Settings, you will note that the Start Time is midnight (when the conveyor belt is off). The Triggering dialog for setting the Status to True looks like this:
“Hour” is a Run Property (discussed in Unit 10, Lesson 3). It is an integer number between 0 and 23 representing the hour of the day. Hence, it would take on a value of 0 between midnight and 1AM; it would take on a value of 8 between 8AM and 9AM.
So this particular trigger sets the Status to True at 8AM.
The Triggering dialog for setting the Status to False looks like this:
So this particular trigger sets the Status to False at 5PM.
When the conveyor belt is off (i.e., the Status is set to False), we need to do two things: 1) stop the conveyor belt; and 2) stop loading the conveyor belt. As a result, you will see that the Status element affects two elements:
- The Loading_Rate is set to 0 kg/hr if the Status is False:
- The Conveyor_Delay is set to a very large number (effectively shutting the conveyor belt down) if the Status is False:
Run the model now and view the Time History Result element named Stockpile Tracking:
This displays the amount of material in the stockpile, as well as the value of the Status element (True is plotted as 1 and False is plotted as 0).
Now let’s briefly consider a second element that can be used to track the state of a system, the Milestone. In this model, let’s assume that we want to record when the stockpile gets to a certain size (e.g., 20,000 kg). Moreover, at that point we want to shut down the entire process.
Return to Edit Mode, and insert a Milestone element (you will find it under the “Events” element category). The Milestone element looks like this:
Let’s name this element Fill_Stockpile. The Milestone has a button that provides access to a Triggering dialog, as well as several options. In this case, we will use the default options (e.g., the Event may only occur once). We will then enter the following trigger:
The “At Stock Test” trigger was discussed in Lesson 4. It causes the Milestone to be triggered at exactly the point where the condition becomes True (i.e., it inserts a new timestep to do so if necessary).
If we look at the output interface for the Milestone, we see that it has three outputs (all are secondary outputs):
“Date” is the calendar date/time that the Milestone was triggered; “ETime” is the elapsed time that the Milestone was triggered; and “Completion_Status” is a condition that becomes True when the Milestone is triggered. We are going to use this last output to further control the Status element. We want to change the status to False when the Milestone is reached. To do this, the Triggering dialog for setting the Status to False needs to be edited to look like this:
In addition, Triggering dialog for setting the Status to True needs to be edited to make sure it is never triggered once the Milestone is reached. We can accomplish that by doing this:
This ensures that we only start operating if the Milestone has not yet been met (the “Not” operator simply takes the opposite of the condition that follows it).
The model should now look similar to this:
(The Example with the added Milestone element can be found in the “Examples” subfolder of the “Basic GoldSim Course” folder as Example19_Status_with_Milestone.gsm.)
Run the model and look at the Time History Result element again. It looks like this:
The conveyor belt stopped operating as soon as the stockpile reached 20,000 kg. Now place your cursor over the Milestone element:
You can see that it reports that the Milestone was “achieved” (i.e., triggered) on 3 January 2016 at 12:30:00.
This simple example provides a good introduction to Status and Milestone elements. You can learn more about these elements in GoldSim Help.
In the next Lesson, we will work on an Exercise that illustrates one of the most powerful applications for Status elements: modeling a common type of active feedback control.